This module implements unified block device API. It could used as a middle layer between filesystems and memories. More...
Modules |
|
| Empty implementation | |
| QSPI implementation | |
| Serial flash memory parameters | |
| RAM implementation | |
|
This module implements block device API. It should be used as a reference block device.
|
|
| SDC implementation | |
Data Structures |
|
| struct | nrf_block_req_t |
|
Block device request descriptor item.
More...
|
|
| struct | nrf_block_dev_event_t |
|
Block device event.
More...
|
|
| struct | nrf_block_dev_geometry_t |
|
Block device geometry.
More...
|
|
| struct | nrf_block_dev_info_strings_t |
|
Block device information strings.
More...
|
|
| struct | nrf_block_dev_s |
|
Block device API.
More...
|
|
Macros |
|
| #define | NRF_BLOCK_DEV_REQUEST (name, block_start, block_count, buff) |
|
Helper macro to create block device read/write request item.
More...
|
|
| #define | NFR_BLOCK_DEV_INFO_CONFIG (vendor, product, revision) |
|
Block device information config.
More...
|
|
| #define | NFR_BLOCK_DEV_INFO_CONFIG_EMPTY NFR_BLOCK_DEV_INFO_CONFIG (NULL, NULL, NULL) |
|
Empty info string initializer.
|
|
| #define | NRF_BLOCKDEV_BASE_ADDR (instance, member) &(instance).member |
|
Helper macro to get block device address from specific instance.
More...
|
|
Typedefs |
|
| typedef void(* | nrf_block_dev_ev_handler )(struct nrf_block_dev_s const *p_blk_dev, nrf_block_dev_event_t const *p_event) |
|
Block device event handler.
More...
|
|
| typedef struct nrf_block_dev_s | nrf_block_dev_t |
|
Block device API.
|
|
| typedef struct nrf_block_dev_ops_s | nrf_block_dev_ops_t |
|
Internals of
nrf_block_dev_t
.
|
|
Enumerations |
|
| enum |
nrf_block_dev_event_type_t
{
NRF_BLOCK_DEV_EVT_INIT , NRF_BLOCK_DEV_EVT_UNINIT , NRF_BLOCK_DEV_EVT_BLK_READ_DONE , NRF_BLOCK_DEV_EVT_BLK_WRITE_DONE } |
|
Block device events.
More...
|
|
| enum |
nrf_block_dev_result_t
{
NRF_BLOCK_DEV_RESULT_SUCCESS = 0, NRF_BLOCK_DEV_RESULT_IO_ERROR , NRF_BLOCK_DEV_RESULT_TIMEOUT } |
| enum |
nrf_block_dev_ioctl_req_t
{
NRF_BLOCK_DEV_IOCTL_REQ_CACHE_FLUSH = 0, NRF_BLOCK_DEV_IOCTL_REQ_INFO_STRINGS } |
|
Block device IOCTL requests.
More...
|
|
Functions |
|
| static ret_code_t | nrf_blk_dev_init ( nrf_block_dev_t const *p_blk_dev, nrf_block_dev_ev_handler ev_handler, void const *p_context) |
|
Initializes a block device.
More...
|
|
| static ret_code_t | nrf_blk_dev_uninit ( nrf_block_dev_t const *p_blk_dev) |
|
Un-initializes a block device.
More...
|
|
| static ret_code_t | nrf_blk_dev_read_req ( nrf_block_dev_t const *p_blk_dev, nrf_block_req_t const *p_blk) |
|
Block read request.
More...
|
|
| static ret_code_t | nrf_blk_dev_write_req ( nrf_block_dev_t const *p_blk_dev, nrf_block_req_t const *p_blk) |
|
Block write request.
More...
|
|
| static ret_code_t | nrf_blk_dev_ioctl ( nrf_block_dev_t const *p_blk_dev, nrf_block_dev_ioctl_req_t req, void *p_data) |
|
IO control function.
More...
|
|
|
static
nrf_block_dev_geometry_t const * |
nrf_blk_dev_geometry ( nrf_block_dev_t const *p_blk_dev) |
|
Return a geometry of a block device.
More...
|
|
Detailed Description
This module implements unified block device API. It could used as a middle layer between filesystems and memories.
Macro Definition Documentation
| #define NFR_BLOCK_DEV_INFO_CONFIG | ( | vendor, | |
| product, | |||
| revision | |||
| ) |
Block device information config.
- Parameters
-
vendor Vendor string product Product string revision Revision string
| #define NRF_BLOCK_DEV_REQUEST | ( | name, | |
| block_start, | |||
| block_count, | |||
| buff | |||
| ) |
Helper macro to create block device read/write request item.
- Parameters
-
name Instance name block_start Block number start block_count Number of blocks buff Buffer to read/write
| #define NRF_BLOCKDEV_BASE_ADDR | ( | instance, | |
| member | |||
| ) | &(instance).member |
Helper macro to get block device address from specific instance.
- Parameters
-
instance Block device instance member Block device member name
Typedef Documentation
| typedef void(* nrf_block_dev_ev_handler)(struct nrf_block_dev_s const *p_blk_dev, nrf_block_dev_event_t const *p_event) |
Block device event handler.
- Parameters
-
[in] p_blk_dev Block device handle [in] p_event Block device event
Enumeration Type Documentation
Block device events.
Events are propagated when event handler is defined ( nrf_blk_dev_init )
Function Documentation
|
inline static |
Return a geometry of a block device.
- Parameters
-
[in] p_blk_dev Block device handle
- Returns
- Block size and count nrf_block_dev_geometry_t
|
inline static |
Initializes a block device.
- Parameters
-
[in] p_blk_dev Block device handle [in] ev_handler Event handler (pass NULL to work in synchronous mode) [in] p_context Context passed to event handler
- Returns
- Standard error code
|
inline static |
IO control function.
- Parameters
-
[in] p_blk_dev Block device handle [in] req Block device ioctl request [in] p_data Block device ioctl data
- Returns
- Standard error code
|
inline static |
Block read request.
In synchronous mode this function will execute the read operation and wait for its completion. In asynchronous mode the function will only request the operation and return immediately. Then, the NRF_BLOCK_DEV_EVT_BLK_READ_DONE event will signal that operation has been completed and the specified buffer contains valid data.
- Parameters
-
[in] p_blk_dev Block device handle [in] p_blk Block device request
- Returns
- Standard error code
|
inline static |
Un-initializes a block device.
- Parameters
-
[in] p_blk_dev Block device handle
- Returns
- Standard error code
|
inline static |
Block write request.
In synchronous mode this function will execute the write operation and wait for its completion. In asynchronous mode the function will only request the operation and return immediately. Then, the NRF_BLOCK_DEV_EVT_BLK_WRITE_DONE event will signal that operation has been completed and the specified buffer can be freed.
- Parameters
-
[in] p_blk_dev Block device handle [in] p_blk Block device request
- Returns
- Standard error code