|
Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
|
Non-volatile memory cells. More...
Topics | |
| NVMEM Devicetree Helpers | |
| Devicetree support for NVMEM. | |
Files | |
| file | nvmem.h |
| Public NVMEM header file. | |
Data Structures | |
| struct | nvmem_cell |
| Non-Volatile Memory cell representation. More... | |
Macros | |
| #define | NVMEM_CELL_INIT(node_id) |
| Get a static initializer for a struct nvmem_cell. | |
| #define | NVMEM_CELL_GET_BY_NAME(node_id, name) |
| Get a static initializer for a struct nvmem_cell by name. | |
| #define | NVMEM_CELL_INST_GET_BY_NAME(inst, name) |
| Get a static initializer for a struct nvmem_cell from a DT_DRV_COMPAT instance by name. | |
| #define | NVMEM_CELL_GET_BY_NAME_OR(node_id, name, default_value) |
| Get a static initializer for a struct nvmem_cell by name, with a fallback. | |
| #define | NVMEM_CELL_INST_GET_BY_NAME_OR(inst, name, default_value) |
| Get a static initializer for a struct nvmem_cell from a DT_DRV_COMPAT instance by name, with a fallback. | |
| #define | NVMEM_CELL_GET_BY_IDX(node_id, idx) |
| Get a static initializer for a struct nvmem_cell by index. | |
| #define | NVMEM_CELL_INST_GET_BY_IDX(inst, idx) |
| Get a static initializer for a struct nvmem_cell from a DT_DRV_COMPAT instance by index. | |
| #define | NVMEM_CELL_GET_BY_IDX_OR(node_id, idx, default_value) |
| Get a static initializer for a struct nvmem_cell by index, with a fallback. | |
| #define | NVMEM_CELL_INST_GET_BY_IDX_OR(inst, idx, default_value) |
| Get a static initializer for a struct nvmem_cell from a DT_DRV_COMPAT instance by index, with a fallback. | |
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) |
| Check if an NVMEM cell is ready. | |
Non-volatile memory cells.
| #define NVMEM_CELL_GET_BY_IDX | ( | node_id, | |
| idx ) |
#include <zephyr/nvmem.h>
Get a static initializer for a struct nvmem_cell by index.
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 | Node identifier for a node with an nvmem-cells property. |
| idx | Logical index into 'nvmem-cells' property. |
| #define NVMEM_CELL_GET_BY_IDX_OR | ( | node_id, | |
| idx, | |||
| default_value ) |
#include <zephyr/nvmem.h>
Get a static initializer for a struct nvmem_cell by index, with a fallback.
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 | Node identifier for a node that may have an nvmem-cells property. |
| 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>
Get a static initializer for a struct nvmem_cell by name.
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 | Node identifier for a node with an nvmem-cells property. |
| 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>
Get a static initializer for a struct nvmem_cell by name, with a fallback.
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 | Node identifier for a node that may have an nvmem-cells property. |
| 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>
Get a 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 | Node identifier for an NVMEM cell. |
| #define NVMEM_CELL_INST_GET_BY_IDX | ( | inst, | |
| idx ) |
#include <zephyr/nvmem.h>
Get a static initializer for a struct nvmem_cell from a DT_DRV_COMPAT instance by index.
| 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>
Get a static initializer for a struct nvmem_cell from a DT_DRV_COMPAT instance by index, with a fallback.
| 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>
Get a static initializer for a struct nvmem_cell from a DT_DRV_COMPAT instance by name.
| 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>
Get a static initializer for a struct nvmem_cell from a DT_DRV_COMPAT instance by name, with a fallback.
| 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>
Check if an NVMEM cell is ready.
| cell | NVMEM cell to check. May be NULL. |
| 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 | NVMEM cell to read from. | |
| [out] | data | Buffer to store the read data. Must be at least len bytes. |
| off | Offset within the cell to start reading from, in bytes. Must be less than the cell size. | |
| len | Number of bytes to read. off + len must not exceed the cell size. |
CONFIG_NVMEM.| -EINVAL | Invalid offset or length arguments. |
| -ENODEV | The controller device is not ready. |
| -ENXIO | No runtime device API available. |
| 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 | NVMEM cell to write to. Must not be read-only. |
| data | Buffer containing data to write. Must be at least len bytes. |
| off | Offset within the cell to start writing to, in bytes. Must be less than the cell size. |
| len | Number of bytes to write. off + len must not exceed the cell size. |
CONFIG_NVMEM.| -EINVAL | Invalid offset or length arguments. |
| -EROFS | Writing to a read-only NVMEM Cell. |
| -ENODEV | The controller device is not ready. |
| -ENXIO | No runtime device API available. |