File System Component  Version 5.0
MDK-Professional Middleware for Devices with Flash File System
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
rl_fs.h File Reference
#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  fsMediaInfo
 Media information. More...
 
struct  fsIOC_Cache
 IO Control Cache information. More...
 
struct  fsCID_Register
 Memory card CID register. More...
 
struct  fsTime
 File System Time structure. More...
 
struct  fsFileInfo
 File information data. More...
 
struct  fsDriveInfo
 Drive information. More...
 

Macros

#define FS_FAT_ATTR_READ_ONLY   0x01
 FAT File Attribute bit masks.
 
#define FS_FAT_ATTR_HIDDEN   0x02
 Hidden file attribute.
 
#define FS_FAT_ATTR_SYSTEM   0x04
 System file attribute.
 
#define FS_FAT_ATTR_VOLUME_ID   0x08
 Volume ID attribute.
 
#define FS_FAT_ATTR_DIRECTORY   0x10
 Directory file attribute.
 
#define FS_FAT_ATTR_ARCHIVE   0x20
 Archive file attribute.
 
#define FS_MEDIA_INSERTED   0x01
 Driver CheckMedia return bit masks.
 
#define FS_MEDIA_PROTECTED   0x02
 Media Write Protected.
 
#define FS_MEDIA_INITIALIZED   0x04
 Media Initialized.
 
#define FS_MEDIA_NOCHKMEDIA   0x80
 Check Media Not implemented.
 

Enumerations

enum  fsStatus {
  fsOK = 0, fsError, fsAccessDenied, fsInvalidParameter,
  fsInvalidDrive, fsInvalidPath, fsUninitializedDrive, fsDriverError,
  fsMediaError, fsNoMedia, fsNoFileSystem, fsNoFreeSpace,
  fsFileNotFound, fsTooManyOpenFiles
}
 File System return codes. More...
 
enum  fsType {
  fsTypeNone = 0, fsTypeUnknown, fsTypeFAT12, fsTypeFAT16,
  fsTypeFAT32, fsTypeEFS
}
 File System Type. More...
 
enum  fsDevCtrlCode { fsDevCtrlCodeCheckMedia = 0, fsDevCtrlCodeFormat, fsDevCtrlCodeSerial, fsDevCtrlCodeGetCID }
 Driver DeviceCtrl parameter code. More...
 

Functions

fsStatus finit (const char *drive)
 Initialize File System and drive related driver.
 
fsStatus funinit (const char *drive)
 Uninitialize File System.
 
fsStatus fmount (const char *drive)
 Mount drive.
 
fsStatus funmount (const char *drive)
 Unmount drive.
 
fsStatus fdelete (const char *path)
 Delete a file or directory with given path name.
 
fsStatus ffind (const char *pattern, fsFileInfo *info)
 Find a file or directory matching search pattern.
 
fsStatus frename (const char *path, const char *newname)
 Rename a file or directory with given path name to a new name.
 
fsStatus fattrib (const char *path, const char *attr)
 Change file attributes.
 
int64_t ffree (const char *drive)
 Find free space on drive.
 
fsStatus fformat (const char *drive, const char *options)
 Format drive.
 
int32_t fanalyse (const char *drive)
 Analyse volume and check for file fragmentation.
 
fsStatus fcheck (const char *drive)
 Analyse volume and check for allocation errors.
 
fsStatus fdefrag (const char *drive)
 Defragment Embedded Flash drive.
 
fsStatus fmedia (const char *drive)
 Check if media present on removable drive.
 
fsStatus finfo (const char *drive, fsDriveInfo *info)
 Read drive information.
 
fsStatus fvol (const char *drive, char *label, uint32_t *serial)
 Read volume label and serial number.
 
fsStatus fs_get_time (fsTime *time)
 Callback function used to provide the current date and time to the File System.
 
int32_t fs_ioc_get_id (const char *drive)
 Check if valid drive is specified and return its ID.
 
fsStatus fs_ioc_lock (int32_t drv_id)
 Lock drive and block media access to the upper layer.
 
fsStatus fs_ioc_unlock (int32_t drv_id)
 Unlock drive and allow media access to the upper layer.
 
fsStatus fs_ioc_get_cache (int32_t drv_id, fsIOC_Cache *cache_info)
 Return IOC cache buffer information.
 
fsStatus fs_ioc_read_sector (int32_t drv_id, uint32_t sect, uint8_t *buf, uint32_t cnt)
 Read sector from media.
 
fsStatus fs_ioc_write_sector (int32_t drv_id, uint32_t sect, const uint8_t *buf, uint32_t cnt)
 Write sector to media.
 
fsStatus fs_ioc_read_info (int32_t drv_id, fsMediaInfo *info)
 Read media configuration info.
 
fsStatus fs_ioc_device_ctrl (int32_t drv_id, fsDevCtrlCode code, void *p)
 IOC device control access; control code is sent directly to device driver.
 

Macro Definition Documentation

#define FS_FAT_ATTR_ARCHIVE   0x20
#define FS_FAT_ATTR_DIRECTORY   0x10
#define FS_FAT_ATTR_HIDDEN   0x02
#define FS_FAT_ATTR_READ_ONLY   0x01

Read-only file attribute

#define FS_FAT_ATTR_SYSTEM   0x04
#define FS_FAT_ATTR_VOLUME_ID   0x08
#define FS_MEDIA_INITIALIZED   0x04
#define FS_MEDIA_INSERTED   0x01

Media Detected

#define FS_MEDIA_NOCHKMEDIA   0x80
#define FS_MEDIA_PROTECTED   0x02

Enumeration Type Documentation

Enumerator:
fsDevCtrlCodeCheckMedia 

Check Media Status.

fsDevCtrlCodeFormat 

Format Media at low level.

fsDevCtrlCodeSerial 

Return device serial number.

fsDevCtrlCodeGetCID 

Read Memory Card CID Register.

enum fsStatus
Enumerator:
fsOK 

Operation succeeded.

fsError 

Unspecified error.

fsAccessDenied 

Resource access denied.

fsInvalidParameter 

Invalid parameter specified.

fsInvalidDrive 

Nonexistent drive.

fsInvalidPath 

Invalid path specified.

fsUninitializedDrive 

Drive is uninitialized.

fsDriverError 

Read/write error.

fsMediaError 

Media error.

fsNoMedia 

No media, or not initialized.

fsNoFileSystem 

File system is not formatted.

fsNoFreeSpace 

No free space available.

fsFileNotFound 

Requested file not found.

fsTooManyOpenFiles 

Too many open files.

enum fsType
Enumerator:
fsTypeNone 

No file system (volume unformatted)

fsTypeUnknown 

File system type is unknown.

fsTypeFAT12 

File system type is FAT12.

fsTypeFAT16 

File system type is FAT16.

fsTypeFAT32 

File system type is FAT32.

fsTypeEFS 

File system type is EFS.