AFBR-S50 API Reference Manual v1.5.6
AFBR-S50 Time-of-Flight Sensor SDK for Embedded Software
|
Non-Volatile Memory Layer. More...
Macros | |
#define | ARGUS_NVM_BLOCK_SIZE 0x300 |
Functions | |
status_t | NVM_WriteBlock (uint32_t id, uint32_t block_size, uint8_t const *buf) |
Write a block of data to the non-volatile memory. | |
status_t | NVM_ReadBlock (uint32_t id, uint32_t block_size, uint8_t *buf) |
Reads a block of data from the non-volatile memory. | |
Non-Volatile Memory Layer.
This module provides functionality to access the non-volatile memory (e.g. flash) on the underlying platform.
This module is optional and only required if calibration data needs to be stored within the API.
#define ARGUS_NVM_BLOCK_SIZE 0x300 |
The NVM block size in the non-volatile memory.
status_t NVM_ReadBlock | ( | uint32_t | id, |
uint32_t | block_size, | ||
uint8_t * | buf | ||
) |
Reads a block of data from the non-volatile memory.
The function is called whenever the API wants to read data from non-volatile memory, e.g. flash. The data will be previously stored using the NVM_WriteBlock function. Otherwise, the function must return a corresponding error code, namely ERROR_NVM_EMPTY.
The data shall be read from a specified memory block that is uniquely dedicated to each individual device. The /p id parameter is passed to the function that identifies the device. The /p id is composed of the device ID and module type, i.e. it is unique among all devices. If only a single device is used anyway, the /p id parameter can be ignored.
If no NVM module is available, the function can return with error ERROR_NOT_IMPLEMENTED and the API ignores the NVM.
If read fails, e.g. if data has not been written previously, a negative status must be returned, e.g. ERROR_NVM_EMPTY if no data has been written yet or any other negative error else-wise.
The block size is fixed for a single device. The actual block size is defined with ARGUS_NVM_BLOCK_SIZE.
id | The 32-bit ID number to identify the corresponding memory block. |
block_size | The number of bytes to be read. Note that this value is fixed, i.e. the API always reads the same data size. The size is defined here: ARGUS_NVM_BLOCK_SIZE. |
buf | The pointer to the data buffer of size /p block_size to copy the data to. |
status_t NVM_WriteBlock | ( | uint32_t | id, |
uint32_t | block_size, | ||
uint8_t const * | buf | ||
) |
Write a block of data to the non-volatile memory.
The function is called whenever the API wants to write data into non-volatile memory, e.g. flash. Later, the API reads the written data via the NVM_ReadBlock function.
The data shall be written to a specified memory block that is uniquely dedicated to each individual device. The /p id parameter is passed to the function that identifies the device. The /p id is composed of the device ID and module type, i.e. it is unique among all devices. If only a single device is used anyway, the /p id parameter can be ignored.
If no NVM module is available, the function can return with error ERROR_NOT_IMPLEMENTED and the API ignores the NVM.
If write fails, e.g. due to lack of memory, a negative status must be returned, e.g. ERROR_NVM_OUT_OF_RANGE.
The block size is fixed for a single device. The actual block size is defined with ARGUS_NVM_BLOCK_SIZE.
id | The 32-bit ID number to identify the corresponding memory block. |
block_size | The number of bytes to be written. Note that this value is fixed, i.e. the API always writes the same data size. The size is defined here: ARGUS_NVM_BLOCK_SIZE. |
buf | The pointer to the data buffer of size /p block_size that needs to be written to the NVM. |