![]() |
RAFW Flexible Software Package Documentation
Release v2.1.0
|
|
Functions | |
| fsp_err_t | RM_LITTLEFS_SPI_FLASH_W_Open (rm_littlefs_ctrl_t *const p_ctrl, rm_littlefs_cfg_t const *const p_cfg) |
| fsp_err_t | RM_LITTLEFS_SPI_FLASH_W_Close (rm_littlefs_ctrl_t *const p_ctrl) |
| int | rm_littlefs_spi_flash_w_read (const struct lfs_config *c, lfs_block_t block, lfs_off_t off, void *buffer, lfs_size_t size) |
| int | rm_littlefs_spi_flash_w_write (const struct lfs_config *c, lfs_block_t block, lfs_off_t off, const void *buffer, lfs_size_t size) |
| int | rm_littlefs_spi_flash_w_erase (const struct lfs_config *c, lfs_block_t block) |
| int | rm_littlefs_spi_flash_w_lock (const struct lfs_config *c) |
| int | rm_littlefs_spi_flash_w_unlock (const struct lfs_config *c) |
| int | rm_littlefs_spi_flash_w_sync (const struct lfs_config *c) |
Middleware for the LittleFS File System control using external SPI Flash on RA6W1/RA6W2. This module implements the LittleFS Interface.
This module provides the hardware port layer for the LittleFS file system. After initializing this module, refer to the LittleFS documentation to use the file system: https://github.com/ARMmbed/littlefs
| Configuration | Options | Default | Description |
|---|---|---|---|
| Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
| Configuration | Options | Default | Description |
|---|---|---|---|
| Name | Name must be a valid C symbol | g_rm_littlefs0 | Module name. |
| Read Size | Must be a non-negative integer | 1 | Minimum size of a block read. All read operations will be a multiple of this value. |
| Program Size | Must be a non-negative integer | 4 | Minimum size of a block program. All program operations will be a multiple of this value. |
| Block Size (bytes) | Must be a multiple of 64 | 128 | Size of an erasable block. This does not impact RAM consumption and may be larger than the physical erase size. However, non-inlined files take up at minimum one block. Must be a multiple of the read and program sizes. |
| Block Count | Manual Entry | (BSP_DATA_FLASH_SIZE_BYTES/128) | Number of erasable blocks on the device. |
| Block Cycles | Must be an integer | 1024 | Number of erase cycles before LittleFS evicts metadata logs and moves the metadata to another block. Suggested values are in the range 100-1000, with large values having better performance at the cost of less consistent wear distribution. Set to -1 to disable block-level wear-leveling. |
| Cache Size | Must be a non-negative integer | 64 | Size of block caches. Each cache buffers a portion of a block in RAM. The LittleFS needs a read cache, a program cache, and one additional cache per file. Larger caches can improve performance by storing more data and reducing the number of disk accesses. Must be a multiple of the read and program sizes, and a factor of the block size. |
| Lookahead Size | Must be a non-negative multiple of 8 | 16 | Size of the lookahead buffer in bytes. A larger lookahead buffer increases the number of blocks found during an allocation pass. The lookahead buffer is stored as a compact bitmap, so each byte of RAM can track 8 blocks. Must be a multiple of 8. |
| Configuration | Options | Default | Description |
|---|---|---|---|
| Custom lfs_util.h | Manual Entry | Add a path to your custom lfs_util.h file. It can be used to override some or all of the configurations defined here, and to define additional configurations. | |
| Thread Safe |
| Disabled | Enables thread safety in LittleFS. |
| Read Only |
| Disabled | Enables Read Only mode in LittleFS. |
| Use Malloc |
| Enabled | Configures the use of malloc by LittleFS. |
| Use Assert |
| Enabled | Configures the use of assert by LittleFS. |
| Debug Messages |
| Disabled | Configures debug messages. |
| Warning Messages |
| Disabled | Configures warning messages. |
| Error Messages |
| Disabled | Configures error messages. |
| Trace Messages |
| Disabled | Configures trace messages. |
| Intrinsics |
| Enabled | Configures intrinsic functions such as __builtin_clz. |
| Instance Name for STDIO wrapper | Name must be a valid C symbol | g_rm_littlefs0 | The rm_littlefs instance name to use with the STDIO wrapper. |
The LittleFS port blocks on Read/Write/Erase calls until the operation has completed.
This module is designed for use with an external SPI NOR Flash device.
Ensure that the flash page size, sector size, and total capacity configured in the driver match the connected SPI flash device.
This module is not thread safe.
This is a basic example of LittleFS on external SPI Flash in an application.
| fsp_err_t RM_LITTLEFS_SPI_FLASH_W_Open | ( | rm_littlefs_ctrl_t *const | p_ctrl, |
| rm_littlefs_cfg_t const *const | p_cfg | ||
| ) |
Opens the driver and initializes lower layer SPI driver.
Implements rm_littlefs_api_t::open().
| FSP_SUCCESS | Success. |
| FSP_ERR_ASSERTION | An input parameter was invalid. |
| FSP_ERR_ALREADY_OPEN | Module is already open. |
| FSP_ERR_INVALID_SIZE | The provided block size is invalid. |
| FSP_ERR_INVALID_ARGUMENT | Invalid configuration parameter. |
| FSP_ERR_INTERNAL | Failed to create the semaphore. |
| fsp_err_t RM_LITTLEFS_SPI_FLASH_W_Close | ( | rm_littlefs_ctrl_t *const | p_ctrl | ) |
Closes the driver and the lower level SPI driver.
Implements rm_littlefs_api_t::close().
| FSP_SUCCESS | The driver was closed successfully. |
| FSP_ERR_ASSERTION | An input parameter was invalid. |
| FSP_ERR_NOT_OPEN | Module is not open. |
| int rm_littlefs_spi_flash_w_read | ( | const struct lfs_config * | c, |
| lfs_block_t | block, | ||
| lfs_off_t | off, | ||
| void * | buffer, | ||
| lfs_size_t | size | ||
| ) |
Read data from SPI flash for LittleFS.
| [in] | c | Pointer to LittleFS configuration. |
| [in] | block | Block to read from. |
| [in] | off | Offset within block. |
| [out] | buffer | Buffer to store read data. |
| [in] | size | Size of data to read. |
| 0 | Success. |
| Non-zero | Error occurred. |
| int rm_littlefs_spi_flash_w_write | ( | const struct lfs_config * | c, |
| lfs_block_t | block, | ||
| lfs_off_t | off, | ||
| const void * | buffer, | ||
| lfs_size_t | size | ||
| ) |
Write data to SPI flash for LittleFS.
| [in] | c | Pointer to LittleFS configuration. |
| [in] | block | Block to write to. |
| [in] | off | Offset within block. |
| [in] | buffer | Buffer containing data to write. |
| [in] | size | Size of data to write. |
| 0 | Success. |
| Non-zero | Error occurred. |
| int rm_littlefs_spi_flash_w_erase | ( | const struct lfs_config * | c, |
| lfs_block_t | block | ||
| ) |
Erase block from SPI flash for LittleFS.
| [in] | c | Pointer to LittleFS configuration. |
| [in] | block | Block to erase. |
| 0 | Success. |
| Non-zero | Error occurred. |
| int rm_littlefs_spi_flash_w_lock | ( | const struct lfs_config * | c | ) |
Lock access to SPI flash.
| [in] | c | Pointer to LittleFS configuration. |
| 0 | Success. |
| int rm_littlefs_spi_flash_w_unlock | ( | const struct lfs_config * | c | ) |
Unlock access to SPI flash.
| [in] | c | Pointer to LittleFS configuration. |
| 0 | Success. |
| int rm_littlefs_spi_flash_w_sync | ( | const struct lfs_config * | c | ) |
Sync SPI flash operations.
| [in] | c | Pointer to LittleFS configuration. |
| 0 | Success. |