Zephyr API Documentation 4.2.99
A Scalable Open Source RTOS
|
Interfaces for NVMEM cells. More...
Files | |
file | nvmem.h |
Main header file for NVMEM API. |
Data Structures | |
struct | nvmem_cell |
Non-Volatile Memory cell representation. More... |
Macros | |
#define | NVMEM_CELL_INIT(node_id) |
Static initializer for a struct nvmem_cell. | |
#define | NVMEM_CELL_GET_BY_NAME(node_id, name) |
Static initializer for a struct nvmem_cell. | |
#define | NVMEM_CELL_INST_GET_BY_NAME(inst, name) |
Static initializer for a struct nvmem_cell from a DT_DRV_COMPAT instance. | |
#define | NVMEM_CELL_GET_BY_NAME_OR(node_id, name, default_value) |
Like NVMEM_CELL_GET_BY_NAME(), with a fallback to a default value. | |
#define | NVMEM_CELL_INST_GET_BY_NAME_OR(inst, name, default_value) |
Like NVMEM_CELL_INST_GET_BY_NAME(), with a fallback to a default value. | |
#define | NVMEM_CELL_GET_BY_IDX(node_id, idx) |
Static initializer for a struct nvmem_cell. | |
#define | NVMEM_CELL_INST_GET_BY_IDX(inst, idx) |
Static initializer for a struct nvmem_cell from a DT_DRV_COMPAT instance. | |
#define | NVMEM_CELL_GET_BY_IDX_OR(node_id, idx, default_value) |
Like NVMEM_CELL_GET_BY_IDX(), with a fallback to a default value. | |
#define | NVMEM_CELL_INST_GET_BY_IDX_OR(inst, idx, default_value) |
Like NVMEM_CELL_INST_GET_BY_IDX(), with a fallback to a default value. |
Functions | |
int | nvmem_cell_read (const struct nvmem_cell *cell, void *data, off_t off, size_t len) |
Read data from an NVMEM cell. | |
int | nvmem_cell_write (const struct nvmem_cell *cell, const void *data, off_t off, size_t len) |
Write data to an NVMEM cell. | |
static bool | nvmem_cell_is_ready (const struct nvmem_cell *cell) |
Validate that the NVMEM cell is ready. |
Interfaces for NVMEM cells.
#define NVMEM_CELL_GET_BY_IDX | ( | node_id, | |
idx ) |
#include <zephyr/nvmem.h>
Static initializer for a struct nvmem_cell.
This returns a static initializer for a struct nvmem_cell given a devicetree node identifier and an index.
Example devicetree fragment:
Example usage:
node_id | Devicetree node identifier. |
idx | Logical index into 'nvmem-cells' property. |
#define NVMEM_CELL_GET_BY_IDX_OR | ( | node_id, | |
idx, | |||
default_value ) |
#include <zephyr/nvmem.h>
Like NVMEM_CELL_GET_BY_IDX(), with a fallback to a default value.
If the devicetree node identifier 'node_id' refers to a node with a property 'nvmem-cells', this expands to NVMEM_CELL_GET_BY_IDX(node_id, idx). The default_value
parameter is not expanded in this case. Otherwise, this expands to default_value
.
node_id | Devicetree node identifier. |
idx | Logical index into 'nvmem-cells' property. |
default_value | Fallback value to expand to. |
default_value
if the node or property do not exist.#define NVMEM_CELL_GET_BY_NAME | ( | node_id, | |
name ) |
#include <zephyr/nvmem.h>
Static initializer for a struct nvmem_cell.
This returns a static initializer for a struct nvmem_cell given a devicetree node identifier and a name.
Example devicetree fragment:
Example usage:
node_id | Devicetree node identifier. |
name | Lowercase-and-underscores name of an nvmem-cells element as defined by the node's nvmem-cell-names property. |
#define NVMEM_CELL_GET_BY_NAME_OR | ( | node_id, | |
name, | |||
default_value ) |
#include <zephyr/nvmem.h>
Like NVMEM_CELL_GET_BY_NAME(), with a fallback to a default value.
If the devicetree node identifier 'node_id' refers to a node with a property 'nvmem-cells', this expands to NVMEM_CELL_GET_BY_NAME(node_id, name). The default_value
parameter is not expanded in this case. Otherwise, this expands to default_value
.
node_id | Devicetree node identifier. |
name | Lowercase-and-underscores name of an nvmem-cells element as defined by the node's nvmem-cell-names property. |
default_value | Fallback value to expand to. |
default_value
if the node or property do not exist.#define NVMEM_CELL_INIT | ( | node_id | ) |
#include <zephyr/nvmem.h>
Static initializer for a struct nvmem_cell.
This returns a static initializer for a struct nvmem_cell given a devicetree node identifier.
Example devicetree fragment:
Example usage:
node_id | Devicetree node identifier. |
#define NVMEM_CELL_INST_GET_BY_IDX | ( | inst, | |
idx ) |
#include <zephyr/nvmem.h>
Static initializer for a struct nvmem_cell from a DT_DRV_COMPAT instance.
inst | DT_DRV_COMPAT instance number |
idx | Logical index into 'nvmem-cells' property. |
#define NVMEM_CELL_INST_GET_BY_IDX_OR | ( | inst, | |
idx, | |||
default_value ) |
#include <zephyr/nvmem.h>
Like NVMEM_CELL_INST_GET_BY_IDX(), with a fallback to a default value.
inst | DT_DRV_COMPAT instance number |
idx | Logical index into 'nvmem-cells' property. |
default_value | Fallback value to expand to. |
default_value
if the node or property do not exist.#define NVMEM_CELL_INST_GET_BY_NAME | ( | inst, | |
name ) |
#include <zephyr/nvmem.h>
Static initializer for a struct nvmem_cell from a DT_DRV_COMPAT instance.
inst | DT_DRV_COMPAT instance number |
name | Lowercase-and-underscores name of an nvmem-cells element as defined by the node's nvmem-cell-names property. |
#define NVMEM_CELL_INST_GET_BY_NAME_OR | ( | inst, | |
name, | |||
default_value ) |
#include <zephyr/nvmem.h>
Like NVMEM_CELL_INST_GET_BY_NAME(), with a fallback to a default value.
inst | DT_DRV_COMPAT instance number |
name | Lowercase-and-underscores name of an nvmem-cells element as defined by the node's nvmem-cell-names property. |
default_value | Fallback value to expand to. |
default_value
if the node or property do not exist.
|
inlinestatic |
#include <zephyr/nvmem.h>
Validate that the NVMEM cell is ready.
cell | The NVMEM cell. |
int nvmem_cell_read | ( | const struct nvmem_cell * | cell, |
void * | data, | ||
off_t | off, | ||
size_t | len ) |
#include <zephyr/nvmem.h>
Read data from an NVMEM cell.
cell | The NVMEM cell. |
data | Buffer to store read data. |
off | The offset to start reading from. |
len | Number of bytes to read. |
CONFIG_NVMEM
.int nvmem_cell_write | ( | const struct nvmem_cell * | cell, |
const void * | data, | ||
off_t | off, | ||
size_t | len ) |
#include <zephyr/nvmem.h>
Write data to an NVMEM cell.
cell | The NVMEM cell. |
data | Buffer with data to write. |
off | The offset to start writing to. |
len | Number of bytes to write. |
CONFIG_NVMEM
.