Configuration¶
Functions¶
mira_config_get_size¶
Get size of non-volatile configuration memory.
Return value¶
The available size.
mira_config_read¶
Read from non-volatile configuration memory.
This is useful to store per-unit configuration and identification parameters, such as product type or network parameters.
Parameters¶
Name | Description |
---|---|
dst | Pointer to where the read data should be stored. |
size | Number of bytes to read. |
Return value¶
Name | Description |
---|---|
MIRA_SUCCESS | The operation was successful. |
MIRA_ERROR_RESOURCE_NOT_AVAILABLE | Memory controller is busy. |
MIRA_ERROR_INVALID_VALUE | Base + size is out of memory region. |
mira_config_read_partition¶
mira_status_t mira_config_read_partition(void *dst, mira_size_t data_size, mira_size_t partition_start);
Read from a partition within non-volatile configuration memory.
This is useful to read configuration parameters which have been stored at a specific place in config memory.
Parameters¶
Name | Description |
---|---|
dst | Pointer to where the read data should be stored. |
data_size | Number of bytes to read. |
partition_start | Offset within the configuration memory where the partition starts. |
Return value¶
Name | Description |
---|---|
MIRA_SUCCESS | The operation was successful. |
MIRA_ERROR_RESOURCE_NOT_AVAILABLE | Memory controller is busy. |
MIRA_ERROR_INVALID_VALUE | Offset + size is out of memory region. |
mira_config_write¶
Write to non-volatile configuration memory.
This is useful to store per-unit configuration and identification parameters, such as product type or network parameters. Writing will erase any previous data in the non-volatile configuration memory. Writing is non-blocking. The process calling this function will be polled upon write completion.
Note
The flash writing can become very slow unless the src and size values are 32-bit aligned.
Parameters¶
Name | Description |
---|---|
src | Pointer to the data to be written. Data on this address must not be changed until configuration memory controller is no longer busy. |
size | Number of bytes to write. |
Return value¶
Name | Description |
---|---|
MIRA_SUCCESS | The operation started successfully. |
MIRA_ERROR_INVALID_VALUE | Base + size is out of memory region. |
mira_config_write_partition¶
mira_status_t mira_config_write_partition(mira_size_t partition_start, mira_size_t partition_size, void *src, mira_size_t data_size);
Write to an application defined partition in user config.
This is useful to write configuration data to a specific place in config memory while retaining previous config outside of the specified partition. Writing is non-blocking. The process calling this function will be polled upon write completion.
Note
The flash writing can become very slow unless the src, partition_start and data_size values are 32-bit aligned.
Parameters¶
Name | Description |
---|---|
partition_start | Offset within the configuration memory where the partition starts. |
partition_size | Size of partition. |
src | Pointer to the data to be written. Data on this address must not be changed until configuration memory controller is no longer busy. |
data_size | Number of bytes to write. |
Return value¶
Name | Description |
---|---|
MIRA_SUCCESS | The operation started successfully. |
MIRA_ERROR_INVALID_VALUE | Base + size is out of memory region. |
mira_config_is_working¶
Check if the non-volatile configuration memory controller is busy.
Used to wait for write completion as in the following example:
Note
Calling mira_config_write() and waiting on mira_config_is_working() has to be done in the same process, as the process mira_config_write() is called from is the one being polled when the write operation is completed.
Return value¶
Name | Description |
---|---|
MIRA_TRUE | Configuration memory controller is busy working. |
MIRA_FALSE | Configuration memory controller is not busy working. |