mikroSDK Reference Manual
file_system.h File Reference

Go to the source code of this file.

Data Structures

struct  logical_drive_t
 Logical Drive Base Data Structure. More...
 

Macros

#define NOP()   asm nop
 
#define FS_MAX_VOLUMES   ((uint8_t)5)
 Specifies the maximum amount of logical/physical drives that can be mounted at the same time. More...
 
#define FS_MAX_OBJECTS   ((uint8_t)10)
 : Specifies the maximum number of files and directories that can be opened at the same time. More...
 
#define FSS_OK   ((uint8_t)0)
 : Success.
 
#define FSS_GENERAL_ERROR   ((uint8_t)1)
 : Error.
 
#define FSS_DRIVE_FULL   ((uint8_t)2)
 : Drive memory is full, cannot write anymore into it.
 
#define FSS_END_OF_FILE   ((uint8_t)3)
 : The end of the file is reached while reading from it.
 
#define FSS_END_OF_DIRECTORY   ((uint8_t)4)
 : The end of the directory is reached while reading its entries.
 
#define FSS_NOT_IMPLEMENTED   ((uint8_t)5)
 : Function is either not implemented, or it is disabled.
 
#define FS_FILE_READ   0x01
 : Specifies read access to the file. Data can be read from the file.
 
#define FS_FILE_WRITE   0x02
 : Specifies write access to the file. Data can be written to the file. Combine with FS_FILE_READ for read-write access.
 
#define FS_FILE_OPEN_EXISTING   0x00
 : Opens a file. The function fails if the file is not existing.
 
#define FS_FILE_CREATE_NEW   0x04
 : Creates a new file. The function fails, if the file is existing.
 
#define FS_FILE_CREATE_ALWAYS   0x08
 : Creates a new file. If the file is existing, it will be truncated and overwritten.
 
#define FS_FILE_OPEN_ALWAYS   0x10
 : Opens the file if it is existing. If not, a new file will be created.
 
#define FS_FILE_OPEN_APPEND   0x30
 : Same as FS_FILE_OPEN_ALWAYS except the read/write pointer is set at the end of the file.
 

Typedefs

typedef int8_t fs_status_t
 : File System API return value More...
 
typedef void * fs_file_t
 : File data specific to a particular file system. More...
 
typedef void * fs_dir_t
 : Directory Data specific to a particular File System. More...
 
typedef struct logical_drive_vector_table logical_drive_vector_table_t
 Logical Drive Vector Table. More...
 

Enumerations

enum  fs_file_rw_pointer_t
 : file_seek API Starting Offset More...
 
enum  logical_drive_type_t
 Logical Drive File System Type Enumerator. More...
 

Functions

fs_status_t file_system_format (const char *__generic_ptr path)
 Format the Logical Drive. More...
 
fs_status_t file_system_mount (logical_drive_t *const ldrive_base, const char *__generic_ptr path, physical_drive_t *const pdrive_base)
 Mount Logical Drive to the File System. More...
 
fs_status_t file_system_unmount (const char *__generic_ptr path)
 Unmount Logical Drive from the File System. More...
 
fs_status_t file_system_remove (const char *__generic_ptr path)
 Removes a File or a Directory. More...
 
fs_status_t file_system_rename (const char *__generic_ptr old_path, const char *__generic_ptr new_path)
 Renames a File or a Directory. More...
 
fs_status_t file_system_mkdir (const char *__generic_ptr path)
 Make new Directory. More...
 

Typedef Documentation

◆ fs_status_t

typedef int8_t fs_status_t

Specifies the status of File System API execution, whether it was completed successfully or if it did not, and if did not, then why.

◆ fs_file_t

typedef void* fs_file_t

Allows file system APIs to accept file data struct parameter, no matter what particular file system implementation is used.

◆ fs_dir_t

typedef void* fs_dir_t

Allows file system APIs to accept file data struct parameter, no matter what particular file system implementation of file data structure is used.

Enumeration Type Documentation

◆ fs_file_rw_pointer_t

Specifies from what position in the file the API should start seeking.

Enumerator
SEEK_START 

Seek from the beginning of the file.

SEEK_CURRENT 

Seek from the cursor's current position in the file.

SEEK_END 

Seek from the end of the file.

◆ logical_drive_type_t

Used to specify what file system is logical drive configured in.

Enumerator
FS_TYPE_UNINITIALIZED 

Logical Drive structure is not initialized.

FS_TYPE_FATFS 

Logical Drive structure is initialized as FatFs.