Contains the entities to be defined by each storage client. The storage module uses these members to update the storage states.
|
void * | arg |
| Custom arguments used by the relevant client.
|
|
uint32_t | dataWordLen |
| No of 32-bit words required for the client storage.
|
|
void(* | InitStatesFromStorage )(uint32_t *data, bool isDataValid) |
| This callback initiates the storage for the relevant client.
|
|
uint32_t(* | RefreshStates )(uint32_t *data, uint32_t *indexPtr) |
| This callback is used to refresh the states in the data buffer for the client.
|
|
◆ InitStatesFromStorage
void(* state_storage_client_t::InitStatesFromStorage) (uint32_t *data, bool isDataValid) |
{
dest_data_t* src = (dest_data_t*)data;
src_data_t* dest = (src_data_t*)&srcData;
if (isDataValid)
src->value = dest->value;
else
src->value = 0;
}
void(* InitStatesFromStorage)(uint32_t *data, bool isDataValid)
This callback initiates the storage for the relevant client.
Definition state_storage_lib.h:81
- Parameters
-
data | Buffer containing stored states at startup used for data initialization by the client. |
isDataValid | Contains the validity state of the data. If not valid, start with default values. |
◆ RefreshStates
uint32_t(* state_storage_client_t::RefreshStates) (uint32_t *data, uint32_t *indexPtr) |
static uint32_t
RefreshStates(uint32_t* data, uint32_t* indexPtr)
{
uint32_t len = 0;
dest_data_t* dest = (dest_data_t*)data;
src_data_t* src = (src_data_t*)&srcData;
if (dest->value != src->value)
{
dest->value = src->value;
len = storageWordLen;
}
*indexPtr = 0;
return len;
}
uint32_t(* RefreshStates)(uint32_t *data, uint32_t *indexPtr)
This callback is used to refresh the states in the data buffer for the client.
Definition state_storage_lib.h:100
- Parameters
-
data | Buffer to be updated by the client if states have been updated. |
indexPtr | Pointer for the initial index of the client, used in case of multiple blocks of state storages by a single client. |
- Returns
- uint32_t Word count if the data is updated by the client, else 0