Using f_mountdrive() with RAM

The f_mountdrive() function is part of the main SafeFLASH API. It calls fs_mount_ramdrive(). This page shows how to use the function with RAM.

Note: The main SafeFLASH File System User Guide describes how to use this call for all drive types.


int f_mountdrive (
    int           drivenum,
    void *        buffer,
    long          buffsize,
    FS_DRVMOUNT   mountfunc,
    FS_PHYGETID   phyfunc )


Argument Description Type
drivenum The number of the drive to mount (0='A', 1='B', and so on.). The maximum value of drivenum is set in FS_MAXVOLUME-1 in fsm.h. int
buffer The buffer pointer the file system uses. Allocate a buffer of the size required for the whole RAM file system, as shown in the example below. void *
buffsize The size of the allocated buffer that is passed to the mount function. long
mountfunc The fs_mount_ramdrive() function. FS_DRVMOUNT
phyfunc For a RAM drive this function is NULL. FS_PHYGETID


Return values

Return value Description
FS_VOL_OK Drive successfully mounted.
FS_VOL_NOTMOUNT Drive not mounted.
FS_VOL_NOTFORMATTED Drive is mounted but is not formatted.
FS_VOL_NOMEMORY Not enough memory, drive is not mounted.
FS_VOL_NOMORE No more drives available (FS_MAXVOLUME).
FS_VOL_DRVERROR Mount driver error, not mounted.