|
ChibiOS/HAL 9.0.0
|
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 | mfs_record_descriptor_t |
| 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... | |
| union | mfs_nocache_buffer |
| Type of an non-cacheable MFS buffer. More... | |
| struct | MFSDriver |
| Type of an MFS instance. More... | |
Macros | |
| #define | MFS_BANK_MAGIC_1 0xEC705ADEU |
| #define | MFS_BANK_MAGIC_2 0xF0339CC5U |
| #define | MFS_HEADER_MAGIC_1 0x5FAE45F0U |
| #define | MFS_HEADER_MAGIC_2 0xF045AE5FU |
Configuration options | |
| #define | MFS_CFG_MAX_RECORDS 32 |
| Maximum number of indexed records in the managed storage. | |
| #define | MFS_CFG_MAX_REPAIR_ATTEMPTS 3 |
| Maximum number of repair attempts on partition mount. | |
| #define | MFS_CFG_WRITE_VERIFY TRUE |
| Verify written data. | |
| #define | MFS_CFG_STRONG_CHECKING TRUE |
| Enables a stronger and slower check procedure on mount. | |
| #define | MFS_CFG_BUFFER_SIZE 32 |
| Size of the buffer used for data copying. | |
| #define | MFS_CFG_MEMORY_ALIGNMENT 2 |
| Enforced memory alignment. | |
| #define | MFS_CFG_TRANSACTION_MAX 16 |
| Maximum number of objects writable in a single transaction. | |
Error codes handling macros | |
| #define | MFS_IS_ERROR(err) |
| #define | MFS_IS_WARNING(err) |
Alignment macros | |
| #define | MFS_ALIGN_MASK ((uint32_t)MFS_CFG_MEMORY_ALIGNMENT - 1U) |
| #define | MFS_IS_ALIGNED(v) |
| #define | MFS_ALIGN_PREV(v) |
| #define | MFS_ALIGN_NEXT(v) |
Typedefs | |
| typedef uint32_t | mfs_id_t |
| Type of a record identifier. | |
| typedef union mfs_nocache_buffer | mfs_nocache_buffer_t |
| Type of an non-cacheable MFS buffer. | |
Enumerations | |
| enum | mfs_bank_t { MFS_BANK_0 = 0 , MFS_BANK_1 = 1 } |
| Type of a flash bank. More... | |
| enum | mfs_state_t { MFS_UNINIT = 0 , MFS_STOP = 1 , MFS_READY = 2 , MFS_TRANSACTION = 3 , MFS_ERROR = 4 } |
| Type of driver state machine states. More... | |
| enum | mfs_error_t { MFS_NO_ERROR = 0 , MFS_WARN_REPAIR = 1 , MFS_WARN_GC = 2 , MFS_ERR_INV_STATE = -1 , MFS_ERR_INV_SIZE = -2 , MFS_ERR_NOT_FOUND = -3 , MFS_ERR_OUT_OF_MEM = -4 , MFS_ERR_TRANSACTION_NUM = -5 , MFS_ERR_TRANSACTION_SIZE = -6 , MFS_ERR_NOT_ERASED = -7 , MFS_ERR_FLASH_FAILURE = -8 , MFS_ERR_INTERNAL = -9 } |
| Type of an MFS error code. More... | |
| enum | mfs_bank_state_t { MFS_BANK_ERASED = 0 , MFS_BANK_OK = 1 , MFS_BANK_GARBAGE = 2 } |
| Type of a bank state assessment. More... | |
Functions | |
| void | mfsObjectInit (MFSDriver *mfsp, mfs_nocache_buffer_t *ncbuf) |
| Initializes an instance. | |
| mfs_error_t | mfsStart (MFSDriver *mfsp, const MFSConfig *config) |
| Configures and activates a MFS driver. | |
| void | mfsStop (MFSDriver *mfsp) |
| Deactivates a MFS driver. | |
| mfs_error_t | mfsErase (MFSDriver *mfsp) |
| Destroys the state of the managed storage by erasing the flash. | |
| mfs_error_t | mfsReadRecord (MFSDriver *mfsp, mfs_id_t id, size_t *np, uint8_t *buffer) |
| Retrieves and reads a data record. | |
| mfs_error_t | mfsWriteRecord (MFSDriver *mfsp, mfs_id_t id, size_t n, const uint8_t *buffer) |
| Creates or updates a data record. | |
| mfs_error_t | mfsEraseRecord (MFSDriver *mfsp, mfs_id_t id) |
| Erases a data record. | |
| mfs_error_t | mfsPerformGarbageCollection (MFSDriver *mfsp) |
| Enforces a garbage collection operation. | |
Managed Flash Storage module header.
Definition in file hal_mfs.h.