ChibiOS/HAL  7.0.3
hal_mfs.h File Reference

Managed Flash Storage module header. More...

#include "hal_flash.h"

Go to the source code of this file.

Data Structures

union  mfs_bank_header_t
 Type of a bank header. More...
 
union  mfs_data_header_t
 Type of a data block header. More...
 
struct  MFSConfig
 Type of a MFS configuration structure. More...
 
struct  mfs_transaction_op_t
 Type of a buffered write/erase operation within a transaction. More...
 
struct  MFSDriver
 Type of an MFS instance. More...
 

Macros

Configuration options
#define MFS_CFG_MAX_RECORDS   32
 Maximum number of indexed records in the managed storage. More...
 
#define MFS_CFG_MAX_REPAIR_ATTEMPTS   3
 Maximum number of repair attempts on partition mount. More...
 
#define MFS_CFG_WRITE_VERIFY   TRUE
 Verify written data. More...
 
#define MFS_CFG_STRONG_CHECKING   TRUE
 Enables a stronger and slower check procedure on mount. More...
 
#define MFS_CFG_BUFFER_SIZE   32
 Size of the buffer used for data copying. More...
 
#define MFS_CFG_MEMORY_ALIGNMENT   2
 Enforced memory alignment. More...
 
#define MFS_CFG_TRANSACTION_MAX   16
 Maximum number of objects writable in a single transaction. More...
 
Error codes handling macros
#define MFS_IS_ERROR(err)   ((err) < MFS_NO_ERROR)
 
#define MFS_IS_WARNING(err)   ((err) > MFS_NO_ERROR)
 
Alignment macros
#define MFS_ALIGN_MASK   ((uint32_t)MFS_CFG_MEMORY_ALIGNMENT - 1U)
 
#define MFS_IS_ALIGNED(v)   (((uint32_t)(v) & MFS_ALIGN_MASK) == 0U)
 
#define MFS_ALIGN_PREV(v)   ((uint32_t)(v) & ~MFS_ALIGN_MASK)
 
#define MFS_ALIGN_NEXT(v)
 

Typedefs

typedef uint32_t mfs_id_t
 Type of a record identifier. More...
 

Enumerations

Functions

void mfsObjectInit (MFSDriver *mfsp)
 Initializes an instance. More...
 
mfs_error_t mfsStart (MFSDriver *mfsp, const MFSConfig *config)
 Configures and activates a MFS driver. More...
 
void mfsStop (MFSDriver *mfsp)
 Deactivates a MFS driver. More...
 
mfs_error_t mfsErase (MFSDriver *mfsp)
 Destroys the state of the managed storage by erasing the flash. More...
 
mfs_error_t mfsReadRecord (MFSDriver *mfsp, mfs_id_t id, size_t *np, uint8_t *buffer)
 Retrieves and reads a data record. More...
 
mfs_error_t mfsWriteRecord (MFSDriver *mfsp, mfs_id_t id, size_t n, const uint8_t *buffer)
 Creates or updates a data record. More...
 
mfs_error_t mfsEraseRecord (MFSDriver *mfsp, mfs_id_t id)
 Erases a data record. More...
 
mfs_error_t mfsPerformGarbageCollection (MFSDriver *mfsp)
 Enforces a garbage collection operation. More...
 
mfs_error_t mfsStartTransaction (MFSDriver *mfsp, size_t size)
 Puts the driver in transaction mode. More...
 
mfs_error_t mfsCommitTransaction (MFSDriver *mfsp)
 A transaction is committed and finalized atomically. More...
 
mfs_error_t mfsRollbackTransaction (MFSDriver *mfsp)
 A transaction is rolled back atomically. More...
 

Detailed Description

Managed Flash Storage module header.

Definition in file hal_mfs.h.