Classes | Typedefs | Enumerations
Enumeration/Typedefs
Collaboration diagram for Enumeration/Typedefs:

Classes

struct  tstrDataAccessInitParamsApp
 This structure contains parameters for initializing a local data access (read or write). More...
 
struct  tstrDataAccessParamsApp
 This structure contains data for local data access (read or write). More...
 
struct  tstrFlashState
 This structure contains information about an attempted transfer. More...
 

Typedefs

typedef sint8(* tpfDataAccessFn) (tenuFlashDataFnCtl enuCtl, void *pvStr)
 A function of this type is used for local data access. It can be implemented to handle simple RAM access with pointer/length, or it can be implemented to handle access to external memory. Functions of this type are provided to the module via various function APIs. More...
 

Enumerations

enum  tenuDataFnRW { FLASH_DATA_FN_READ, FLASH_DATA_FN_WRITE }
 Indicates whether data is to be read or written. More...
 
enum  tenuFlashDataFnCtl { FLASH_DATA_FN_INITIALIZE, FLASH_DATA_FN_DATA, FLASH_DATA_FN_TERMINATE, FLASH_DATA_FN_COMPLETE }
 Control parameter for tpfDataAccessFn. More...
 
enum  tenuImageId { FLASH_IMAGE_INACTIVE, FLASH_IMAGE_ACTIVE }
 Indicates which image to access in WINC flash. More...
 

Detailed Description

Typedef Documentation

◆ tpfDataAccessFn

tpfDataAccessFn

A function of this type is used for local data access. It can be implemented to handle simple RAM access with pointer/length, or it can be implemented to handle access to external memory. Functions of this type are provided to the module via various function APIs.

See also
m2m_flash_rootcert_add
m2m_flash_rootcert_read
m2m_flash_rootcert_readidx
m2m_flash_updateimage
m2m_flash_readimage
Parameters
[in]enuCtlControl parameter.
[in]pvStrGeneric pointer to structure. The structure type depends on enuCtl:
Note
The function is typically called by the module multiple times during a data transfer: Once with FLASH_DATA_FN_INITIALIZE, then multiple times with FLASH_DATA_FN_DATA, then once with FLASH_DATA_FN_COMPLETE.
Returns
Zero for success. Non-zero otherwise.

Example

This example illustrates an implementation of a function of type tpfDataAccessFn.
This example assumes the application's data buffer is in RAM, so we can use memcpy. Alternatively memcpy can be replaced by dedicated functions which read/write the application buffer.

gpu8DataLocation is a pointer to the data buffer in RAM, set by the application.
gu32DataSize is the size of the data buffer, set by the application.

sint8 data_access_ptr(tenuFlashDataFnCtl enuCtl, void *pvStr)
{
// Return value.
sint8 s8Ret = -1;
// Fixed variables, set in case FLASH_DATA_FN_INITIALIZE, reset in case FLASH_DATA_FN_COMPLETE.
static tenuDataFnRW enuRW;
static uint8 *pu8Location = NULL;
static uint32 u32BytesRemaining = 0;
switch (enuCtl)
{
if (pvStr != NULL)
{
if (init_params->u32TotalSize > gu32DataSize)
break;
// Set fixed variables.
enuRW = init_params->enuRW;
pu8Location = gpu8DataLocation;
u32BytesRemaining = init_params->u32TotalSize;
s8Ret = 0;
}
break;
if ((pvStr != NULL) && (pu8Location != NULL))
{
// Some sanity checks which should never fail.
if (u32BytesRemaining < params->u32DataSize)
break;
if (params->pu8Data == NULL)
break;
switch (enuRW)
{
memcpy(pu8Location, params->pu8Data, params->u32DataSize);
s8Ret = 0;
break;
memcpy(params->pu8Data, pu8Location, params->u32DataSize);
s8Ret = 0;
break;
}
// Update fixed variables for sequential access.
pu8Location += params->u32DataSize;
u32BytesRemaining -= params->u32DataSize;
}
break;
// Reset fixed variables.
pu8Location = NULL;
u32BytesRemaining = 0;
s8Ret = 0;
break;
}
return s8Ret;
}

Definition at line 229 of file m2m_flash.h.

Enumeration Type Documentation

◆ tenuDataFnRW

Indicates whether data is to be read or written.

Enumerator
FLASH_DATA_FN_READ 

Read data from application memory.

FLASH_DATA_FN_WRITE 

Write data to application memory.

Definition at line 111 of file m2m_flash.h.

◆ tenuFlashDataFnCtl

Control parameter for tpfDataAccessFn.

Enumerator
FLASH_DATA_FN_INITIALIZE 

Data access about to start. Check and save parameters as required, ready for subsequent data accesses.

FLASH_DATA_FN_DATA 

Sequential data access, using parameters previously provided by FLASH_DATA_FN_INITIALIZE.

FLASH_DATA_FN_TERMINATE 

Data access aborted. Did not complete and will not be continued.

FLASH_DATA_FN_COMPLETE 

Data access complete.

Definition at line 94 of file m2m_flash.h.

◆ tenuImageId

Indicates which image to access in WINC flash.

Enumerator
FLASH_IMAGE_INACTIVE 

Access the image in the inactive partition.

FLASH_IMAGE_ACTIVE 

Access the image in the active partition.

Definition at line 123 of file m2m_flash.h.



inertial_sense_ros
Author(s):
autogenerated on Sat Sep 19 2020 03:19:07