C API for BALTECH SDK
flashfs.h File Reference

This command group provides access to custom data that is stored in a dataflash device. More...

#include "../typedefs.h"

Go to the source code of this file.

Macros

#define BRP_FlashFS_ErrFsCorrupt   BRP_ERR_STATUS(0x4900, 0x01)
 The file system is corrupt: Format required. More...
 
#define BRP_FlashFS_ErrRecordCorrupt   BRP_ERR_STATUS(0x4900, 0x02)
 The current record is corrupt. More...
 
#define BRP_FlashFS_ErrFlashAccess   BRP_ERR_STATUS(0x4900, 0x03)
 Dataflash cannot be accessed: Hardware error. More...
 
#define BRP_FlashFS_ErrDirectoryFull   BRP_ERR_STATUS(0x4900, 0x04)
 The File cannot be created, since there are no more free entries. More...
 
#define BRP_FlashFS_ErrFileNotFound   BRP_ERR_STATUS(0x4900, 0x05)
 The file is not created yet. More...
 
#define BRP_FlashFS_ErrEndOfFile   BRP_ERR_STATUS(0x4900, 0x06)
 The end of the file is reached: no more records available. More...
 
#define BRP_FlashFS_ErrFull   BRP_ERR_STATUS(0x4900, 0x07)
 There is no more space on the Dataflash. More...
 
#define BRP_FlashFS_ErrFileExist   BRP_ERR_STATUS(0x4900, 0x08)
 The file cannot be created, since it already exists. More...
 

Functions

brp_errcode brp_FlashFS_GetMemoryInfo (brp_protocol protocol, unsigned *TotalMem, unsigned *FreeMem)
 This command checks the consistency of the file system and retrieves information about the available dataflash memory space. More...
 
brp_errcode brp_FlashFS_Format (brp_protocol protocol, bool QuickFormat)
 This command resets the complete file system. More...
 
brp_errcode brp_FlashFS_CreateFile (brp_protocol protocol, unsigned FileId, unsigned RecordSize)
 This command creates a new empty file, if the file doesn't exist yet. More...
 
brp_errcode brp_FlashFS_DeleteFile (brp_protocol protocol, unsigned FileId)
 This command deletes a file and all its contained records. More...
 
brp_errcode brp_FlashFS_RenameFile (brp_protocol protocol, unsigned FileId, unsigned NewFileId)
 This command changes the File ID of a file from FileId to NewFileId , provided the file with ID FileId exists and a file with ID NewFileId doesn't exist yet. More...
 
brp_errcode brp_FlashFS_GetRecordSize (brp_protocol protocol, unsigned FileId, unsigned *RecordSize)
 This command retrieves the size of a single record of a certain file. More...
 
brp_errcode brp_FlashFS_GetFileSize (brp_protocol protocol, unsigned FileId, unsigned *FileSize)
 This command retrieves the number of records a certain file contains. More...
 
brp_errcode brp_FlashFS_ReadRecords (brp_protocol protocol, unsigned FileId, unsigned StartRecord, unsigned RecordCount, brp_FlashFS_ReadRecords_RecordList_Entry **RecordList, size_t *RecordList_len, brp_mempool *mempool)
 This command reads one or more records from a file. More...
 
brp_errcode brp_FlashFS_WriteRecords (brp_protocol protocol, unsigned FileId, unsigned StartRecord, brp_FlashFS_WriteRecords_RecordList_Entry *RecordList, size_t RecordList_len)
 This command writes one or more records to a file. More...
 

Detailed Description

This command group provides access to custom data that is stored in a dataflash device.

The access is handled through a flash file system. Each file, which is identified with a 16-bit ID, is organized in records of a fixed size. The record size can be between 1 and 254 and must be determined at file creation, but can be chosen individually for every file. All read and write operations use a record as the smallest storage unit. Records may be appended to the end of a file or they may overwrite existing records with new data.

Definition in file flashfs.h.