This module implements unified block device API. It could used as a middle layer between filesystems and memories.
More...
This module implements unified block device API. It could used as a middle layer between filesystems and memories.
#define NFR_BLOCK_DEV_INFO_CONFIG |
( |
|
vendor, |
|
|
|
product, |
|
|
|
revision |
|
) |
| |
Value:( { \
.p_vendor = vendor, \
.p_product = product, \
.p_revision = 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 |
|
) |
| |
Value:
.blk_count = block_count, \
.p_buff = 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 |
Block device event handler.
- Parameters
-
[in] | p_blk_dev | Block device handle |
[in] | p_event | Block device event |
Block device events.
Events are propagated when event handler is defined (nrf_blk_dev_init)
Enumerator |
---|
NRF_BLOCK_DEV_EVT_INIT |
Passed to event handler when init is done
|
NRF_BLOCK_DEV_EVT_UNINIT |
Passed to event handler when uninit is done
|
NRF_BLOCK_DEV_EVT_BLK_READ_DONE |
Passed to event handler block read operation is done
|
NRF_BLOCK_DEV_EVT_BLK_WRITE_DONE |
Passed to event handler block write operation is done
|
Block device IOCTL requests.
Enumerator |
---|
NRF_BLOCK_DEV_IOCTL_REQ_CACHE_FLUSH |
Cache flush IOCTL request
|
NRF_BLOCK_DEV_IOCTL_REQ_INFO_STRINGS |
Get info strings IOCTL request
|
Enumerator |
---|
NRF_BLOCK_DEV_RESULT_SUCCESS |
Operation completed succsefully
|
NRF_BLOCK_DEV_RESULT_IO_ERROR |
I/O error
|
NRF_BLOCK_DEV_RESULT_TIMEOUT |
Device timeout
|
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
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
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
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
Un-initializes a block device.
- Parameters
-
[in] | p_blk_dev | Block device handle |
- Returns
- Standard error code
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