157 pvStr = &init_params_app;
178 M2M_INFO(
"FA RdImage %d\n", enuImageId);
203 strFlashAccess.strPersistentInfo.u16AppId = u16Id;
228 M2M_INFO(
"FA Image %d\n", u8Options);
234 uint8 au8ImageStart[4];
235 uint8 au8ImageCheck[] = {
'N',
'M',
'I',
'S'};
259 if (
m2m_memcmp(au8ImageStart, au8ImageCheck,
sizeof(au8ImageStart)))
273 strFlashAccess.strPersistentInfo.u16AppId = u16Id;
274 if (u8Options & FLASH_UPDATEIMAGE_OPTION_UPDATE)
283 strFlashAccess.u32Size = 0;
303 M2M_INFO(
"FA Rootcert %d\n", enuMode);
316 if (u32Size <
sizeof(strRootCertEntry))
334 if ((status !=
M2M_SUCCESS) || (u32Size != u16EntrySz))
348 *(
uint32*)&strRootCertEntry = u8ModeOptions;
368 ret =
rootcert_access(enuMode, &strRootCertEntry, &u16EntrySz, pu8Buff, &u32Offset);
378 strFlashAccess.strPersistentInfo.u16AppId = u16Id;
379 strFlashAccess.strPersistentInfo.u8AccessFlags = u8AccessOptions;
394 u32Offset += u16EntrySz;
411 if (u32Size < u16EntrySz)
454 if ((pu8Identifier !=
NULL) && (u32IdentifierSz == 20))
469 if ((pu8Identifier !=
NULL) && (u32IdentifierSz == 20))
497 switch (strSavedFlashAccess.enuTransferStatus)
NMI_API void m2m_memcpy(uint8 *pDst, uint8 *pSrc, uint32 sz)
Copy specified number of bytes from source buffer to destination buffer.
#define FLASH_ERR_WINC_CONFLICT
sint8 rootcert_get_size(tstrRootCertEntryHeader *pstrHdr, uint16 *pu16Size)
signed char sint8
Range of values between -128 to 127.
sint8 winc_flash_write_verify(uint8 *pu8Buf, uint32 u32Offset, uint32 u32Size)
#define FLASH_UPDATEIMAGE_OPTION_SWITCH
NMI_API sint8 m2m_memcmp(uint8 *pu8Buff1, uint8 *pu8Buff2, uint32 u32Size)
Compare specified number of data bytes in pu8Buff1 and pu8Buff2 and decide if they all match...
sint8 m2m_flash_rootcert_add(uint16 u16Id, tpfDataAccessFn pfSourceFn, uint32 u32SourceSize)
Add an entry to the WINC TLS root certificate store.
tenuFlashDataFnCtl
Control parameter for tpfDataAccessFn.
sint8 m2m_flash_init(void)
Initialize the module.
This module contains WINC3400 M2M driver APIs declarations.
sint8 m2m_flash_rootcert_read(uint16 u16Id, tpfDataAccessFn pfDestFn, uint32 u32DestSize, uint8 *pu8Identifier, uint32 u32IdentifierSz)
Read an entry from the WINC TLS root certificate store, referenced by entry identifier.
#define FLASH_MODE_FLAGS_CS_SWITCH
static sint8 commit_access(tstrFlashAccess *pstrFlashAccess)
#define FLASH_MODE_FLAGS_CS_VALIDATE_IMAGE
#define FLASH_ACCESS_OPTION_COMPARE_AFTER
static sint8 init_access(void)
#define FLASH_ERR_INTERNAL
This structure contains data for local data access (read or write).
#define FLASH_MODE_FLAGS_DATA_IN_BACKUP
static uint8 gau8ItemIdentifier[20]
tenuFlashAccessItemMode
Transfer modes available for accessing items in WINC flash stores such as TLS root certificate store...
unsigned short uint16
Range of values between 0 to 65535.
sint8 m2m_flash_updateimage(uint8 u8Options, uint16 u16Id, tpfDataAccessFn pfSourceFn, uint32 u32SourceSize)
Write/validate/switch a WINC firmware image.
sint8 image_get_target(uint8 *pu8Target)
This structure contains parameters for initializing a local data access (read or write).
#define FLASH_FN_FLAGS_READ
WINC3400 IoT Application Interface.
#define FLASH_MODE_FLAGS_CS_SWITCH_TARGET
sint8 recover_backup(void)
#define FLASH_MODE_FLAGS_CS
#define HOST_CONTROL_FLASH_SZ
#define FLASH_ERR_LOCAL_ACCESS
This structure contains data for local data access (read, erase or write).
sint8 spi_flash_read(uint8 *pu8Buf, uint32 u32Addr, uint32 u32Sz)
Read a specified portion of data from SPI Flash. .
sint8 m2m_wifi_reinit_hold(void)
First part of m2m_wifi_reinit, up to the point of initializing spi for flash access.
#define FLASH_FN_FLAGS_WRITE
void m2m_flash_get_state(tstrFlashState *pstrState)
Get information about the module current state and about the most recent access attempt.
NMI_API void m2m_memset(uint8 *pBuf, uint8 val, uint32 sz)
Set specified number of data bytes in specified data buffer to specified value.
sint8 rootcert_access(tenuFlashAccessItemMode enuMode, tstrRootCertEntryHeader *pstrReferenceHdr, uint16 *pu16EntrySize, uint8 *pu8Buff, uint32 *pu32Offset)
sint8 spi_flash_erase(uint32 u32Offset, uint32 u32Sz)
Erase a specified portion of SPI Flash. .
static sint8 m2m_flash_rootcert_access(tenuFlashAccessItemMode enuMode, uint8 u8ModeOptions, uint8 u8AccessOptions, uint16 u16Id, tpfDataAccessFn pfFn, uint32 u32Size)
#define M2M_TLS_ROOTCER_FLASH_OFFSET
static sint8 app_data_access(tenuFlashDataFnCtl enuCtl, void *pvStr)
tstrFlashAccessPersistent strPersistentInfo
#define HOST_CONTROL_FLASH_OFFSET
sint8 m2m_flash_readimage(uint8 enuImageId, uint16 u16Id, tpfDataAccessFn pfDestFn, uint32 u32DestSize)
static tpfDataAccessFn gpfAppFn
#define FLASH_ACCESS_WINC_MASK
#define FLASH_ACCESS_OPTION_ERASE_FIRST
sint8 m2m_flash_rootcert_readidx(uint16 u16Id, tpfDataAccessFn pfDestFn, uint32 u32DestSize, uint8 u8Index)
Read an entry from the WINC TLS root certificate store, referenced by entry index.
#define M2M_TLS_ROOTCER_FLASH_SZ
sint8 m2m_flash_rootcert_remove(uint16 u16Id, uint8 *pu8Identifier, uint32 u32IdentifierSz)
Remove an entry from the WINC TLS root certificate store.
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 acc...
#define FLASH_UPDATEIMAGE_OPTION_UPDATE
#define M2M_BACKUP_FLASH_OFFSET
#define M2M_BACKUP_FLASH_SZ
unsigned long uint32
Range of values between 0 to 4294967295.
unsigned char uint8
Range of values between 0 to 255.
void set_internal_info(tpfDataAccessFn *ppfFn, uint32 u32LocationId)
static sint8 register_app_fn(tpfDataAccessFn pfFn)
#define FLASH_ERR_WINC_ACCESS
#define FLASH_MODE_FLAGS_UNCHANGED
#define FLASH_UPDATEIMAGE_OPTION_VALIDATE
This module contains M2M host interface APIs implementation.
sint8 transfer_run(tstrFlashAccess *pstrFlashAccess)
This structure contains parameters for initializing a local data access (read, erase or write)...
This structure contains information about an attempted transfer.
static sint8 transfer_init(void)
WINC3400 Flash Interface.