Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
FLASH internal Interface

FLASH internal Interface . More...

Data Structures

struct  flash_pages_layout
 
struct  flash_driver_api
 

Typedefs

typedef int(* flash_api_read) (const struct device *dev, off_t offset, void *data, size_t len)
 
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)
 
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)
 
typedef int(* flash_api_read_jedec_id) (const struct device *dev, uint8_t *id)
 
typedef int(* flash_api_ex_op) (const struct device *dev, uint16_t code, const uintptr_t in, void *out)
 

Detailed Description

FLASH internal Interface .

Typedef Documentation

◆ flash_api_erase

typedef int(* flash_api_erase) (const struct device *dev, off_t offset, size_t size)

#include <zephyr/drivers/flash.h>

Flash erase implementation handler type.

Note
Any necessary erase protection management must be performed by the driver, with the driver responsible for ensuring the "erase-protect" after the operation completes (successfully or not) matches the erase-protect state when the operation was started.

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.

◆ flash_api_ex_op

typedef int(* flash_api_ex_op) (const struct device *dev, uint16_t code, const uintptr_t in, void *out)

◆ flash_api_get_parameters

typedef const struct flash_parameters *(* flash_api_get_parameters) (const struct device *dev)

◆ flash_api_get_size

typedef int(* flash_api_get_size) (const struct device *dev, uint64_t *size)

#include <zephyr/drivers/flash.h>

Get device size in bytes.

Returns total logical device size in bytes.

Parameters
[in]devflash device.
[out]sizedevice size in bytes.
Returns
0 on success, negative errno code on error.

◆ flash_api_pages_layout

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.

Parameters
devFlash device whose layout to retrieve.
layoutThe flash layout will be returned in this argument.
layout_sizeThe number of elements in the returned layout.

◆ flash_api_read

typedef int(* flash_api_read) (const struct device *dev, off_t offset, void *data, size_t len)

◆ flash_api_read_jedec_id

typedef int(* flash_api_read_jedec_id) (const struct device *dev, uint8_t *id)

◆ flash_api_sfdp_read

typedef int(* flash_api_sfdp_read) (const struct device *dev, off_t offset, void *data, size_t len)

◆ flash_api_write

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.

Note
Any necessary write protection management must be performed by the driver, with the driver responsible for ensuring the "write-protect" after the operation completes (successfully or not) matches the write-protect state when the operation was started.