Non-volatile memory class.
More...
|
| #define | PBL_NVMEM_INIT(sym, _name, _init, _deps, _ops, _size, _word_size, _stride) |
| | Initializer of a struct pbl_nvmem, for providers.
|
| |
| #define | PBL_NVMEM_CELL(_nvmem, _offset, _bytes) |
| | Initializer of a struct pbl_nvmem_cell.
|
| |
Non-volatile memory class.
Small non-volatile memories holding data the rest of the system consumes, such as eFuses. A provider exposes the memory as a flat byte address space. A consumer holds a struct pbl_nvmem_cell, what a devicetree nvmem-cells entry describes: a named data item at a fixed location in the memory.
uint8_t mac[8];
A data item in a memory, as used by a consumer.
Definition nvmem.h:87
#define PBL_NVMEM_CELL(_nvmem, _offset, _bytes)
Initializer of a struct pbl_nvmem_cell.
Definition nvmem.h:103
int pbl_nvmem_cell_read(const struct pbl_nvmem_cell *cell, void *buf, size_t len)
Read a cell.
◆ pbl_nvmem
| Data Fields |
|
struct pbl_device |
dev |
Device. |
|
const struct pbl_nvmem_ops * |
ops |
Operations. |
|
size_t |
size |
Size in bytes. |
|
uint8_t |
stride |
Minimum read alignment in bytes. |
|
uint8_t |
word_size |
Minimum read size in bytes; reads are a multiple of it. |
◆ pbl_nvmem_cell
A data item in a memory, as used by a consumer.
| Data Fields |
|
size_t |
bytes |
Size in bytes. |
|
const struct pbl_nvmem * |
nvmem |
Memory. |
|
unsigned int |
offset |
Offset in bytes. |
◆ PBL_NVMEM_CELL
| #define PBL_NVMEM_CELL |
( |
|
_nvmem, |
|
|
|
_offset, |
|
|
|
_bytes |
|
) |
| |
Value: { \
.nvmem = (_nvmem), \
.offset = (_offset), \
.bytes = (_bytes), \
}
Initializer of a struct pbl_nvmem_cell.
- Parameters
-
| _nvmem | Memory. |
| _offset | Offset in bytes. |
| _bytes | Size in bytes. |
◆ PBL_NVMEM_INIT
| #define PBL_NVMEM_INIT |
( |
|
sym, |
|
|
|
_name, |
|
|
|
_init, |
|
|
|
_deps, |
|
|
|
_ops, |
|
|
|
_size, |
|
|
|
_word_size, |
|
|
|
_stride |
|
) |
| |
Value: { \
.ops = (_ops), \
.size = (_size), \
.word_size = (_word_size), \
.stride = (_stride), \
}
#define PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, _deps, _cls)
Initializer for the struct pbl_device of device instance sym, in class _cls.
Definition device.h:143
const struct pbl_device_class pbl_nvmem_class
Class of the non-volatile memories.
Initializer of a struct pbl_nvmem, for providers.
- Parameters
-
| sym | Memory symbol, with its PBL_DEVICE_STATE_DEFINE(). |
| _name | Device name. |
| _init | Device init function, or NULL. |
| _deps | Device dependencies from PBL_DEVICE_DEPS(), or NULL. |
| _ops | Operations. |
| _size | Size in bytes. |
| _word_size | Minimum read size in bytes. |
| _stride | Minimum read alignment in bytes. |
◆ pbl_nvmem_cell_read()
| int pbl_nvmem_cell_read |
( |
const struct pbl_nvmem_cell * |
cell, |
|
|
void * |
buf, |
|
|
size_t |
len |
|
) |
| |
Read a cell.
- Parameters
-
| cell | Cell. |
| [out] | buf | Data. |
| len | Size of buf in bytes, at least the size of the cell. |
- Returns
- 0 on success, -ENODEV if the memory is not ready, -EINVAL if
buf is too small or the cell does not fit the memory's geometry, or a negative errno from the provider.
◆ pbl_nvmem_device_read()
| int pbl_nvmem_device_read |
( |
const struct pbl_nvmem * |
nvmem, |
|
|
unsigned int |
offset, |
|
|
size_t |
bytes, |
|
|
void * |
buf |
|
) |
| |
Read raw bytes from a memory.
- Parameters
-
| nvmem | Memory. |
| offset | Offset in bytes, a multiple of the stride. |
| bytes | Number of bytes, a multiple of the word size. |
| [out] | buf | Data. |
- Returns
- 0 on success, -ENODEV if the memory is not ready, -EINVAL if the access does not fit the memory's geometry, or a negative errno from the provider.
◆ pbl_nvmem_class
Class of the non-volatile memories.