|
Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
|
Data Structures | |
| struct | flash_driver_api |
| Driver Operations Flash driver operations More... | |
Typedefs | |
| typedef int(* | flash_api_read) (const struct device *dev, off_t offset, void *data, size_t len) |
| Flash read implementation handler type. | |
| typedef int(* | flash_api_write) (const struct device *dev, off_t offset, const void *data, size_t len) |
| Flash write implementation handler type. | |
| typedef int(* | flash_api_erase) (const struct device *dev, off_t offset, size_t size) |
| Flash erase implementation handler type. | |
| typedef int(* | flash_api_get_size) (const struct device *dev, uint64_t *size) |
| Get device size in bytes. | |
| typedef const struct flash_parameters *(* | flash_api_get_parameters) (const struct device *dev) |
| Get device parameters. | |
| typedef void(* | flash_api_pages_layout) (const struct device *dev, const struct flash_pages_layout **layout, size_t *layout_size) |
| Retrieve a flash device's layout. | |
| typedef int(* | flash_api_sfdp_read) (const struct device *dev, off_t offset, void *data, size_t len) |
| Read data from Serial Flash Discoverable Parameters. | |
| typedef int(* | flash_api_read_jedec_id) (const struct device *dev, uint8_t *id) |
| Read the JEDEC ID of the device. | |
| typedef int(* | flash_api_ex_op) (const struct device *dev, uint16_t code, const uintptr_t in, void *out) |
| Perform an extended operation. | |
This group contains the API type definitions, callback signatures, and other helpers required to implement a Flash driver.
#include <zephyr/drivers/flash.h>
Flash erase implementation handler type.
The callback is optional for RAM non-volatile devices, which do not require erase by design, but may be provided if it allows device to work more effectively, or if device has a support for internal fill operation the erase in driver uses.
| typedef int(* flash_api_ex_op) (const struct device *dev, uint16_t code, const uintptr_t in, void *out) |
#include <zephyr/drivers/flash.h>
Perform an extended operation.
See flash_ex_op() for argument descriptions.
| typedef const struct flash_parameters *(* flash_api_get_parameters) (const struct device *dev) |
#include <zephyr/drivers/flash.h>
Get device parameters.
| [in] | dev | Flash device |
#include <zephyr/drivers/flash.h>
Get device size in bytes.
Returns total logical device size in bytes.
| [in] | dev | flash device. |
| [out] | size | device size in bytes. |
| typedef void(* flash_api_pages_layout) (const struct device *dev, const struct flash_pages_layout **layout, size_t *layout_size) |
#include <zephyr/drivers/flash.h>
Retrieve a flash device's layout.
A flash device layout is a run-length encoded description of the pages on the device. (Here, "page" means the smallest erasable area on the flash device.)
For flash memories which have uniform page sizes, this routine returns an array of length 1, which specifies the page size and number of pages in the memory.
Layouts for flash memories with nonuniform page sizes will be returned as an array with multiple elements, each of which describes a group of pages that all have the same size. In this case, the sequence of array elements specifies the order in which these groups occur on the device.
| dev | Flash device whose layout to retrieve. |
| layout | The flash layout will be returned in this argument. |
| layout_size | The number of elements in the returned layout. |
#include <zephyr/drivers/flash.h>
Flash read implementation handler type.
For consistency across implementations, value check len parameter equal zero and return result 0 before validating the data destination parameter.
#include <zephyr/drivers/flash.h>
Read the JEDEC ID of the device.
See flash_read_jedec_id() for argument descriptions.
#include <zephyr/drivers/flash.h>
Read data from Serial Flash Discoverable Parameters.
See flash_sfdp_read() for argument descriptions.
| typedef int(* flash_api_write) (const struct device *dev, off_t offset, const void *data, size_t len) |
#include <zephyr/drivers/flash.h>
Flash write implementation handler type.