Classes | Macros | Enumerations | Functions | Variables
nmflash.h File Reference

WINC Flash Interface. More...

#include "common/include/nm_common.h"
#include "driver/include/m2m_types.h"
Include dependency graph for nmflash.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tstrBackup
 
struct  tstrDataAccessInitParams
 This structure contains parameters for initializing a local data access (read, erase or write). More...
 
struct  tstrDataAccessParams
 This structure contains data for local data access (read, erase or write). More...
 
struct  tstrFlashAccess
 
struct  tstrFlashAccessPersistent
 

Macros

#define BACKUP_SIGNATURE   0x424b5550
 
#define FLASH_ACCESS_OPTION_COMPARE_AFTER   NBIT4
 
#define FLASH_ACCESS_OPTION_COMPARE_BEFORE   NBIT3
 
#define FLASH_ACCESS_OPTION_ERASE_FIRST   NBIT0
 
#define FLASH_ACCESS_OPTION_KEEP_SURROUNDING   NBIT1
 
#define FLASH_ACCESS_OPTION_USE_BACKUP   NBIT2
 
#define FLASH_ACCESS_WINC_MASK   (FLASH_ACCESS_OPTION_COMPARE_BEFORE | FLASH_ACCESS_OPTION_COMPARE_AFTER)
 
#define FLASH_BACKUP_STA_SZ   sizeof(tenuBackupStatus)
 
#define FLASH_BACKUP_STORE_OFFSET   (HOST_CONTROL_FLASH_OFFSET + HOST_CONTROL_FLASH_SZ - FLASH_BACKUP_STORE_SZ)
 
#define FLASH_BACKUP_STORE_SZ   (2*sizeof(tstrBackup))
 
#define FLASH_FN_FLAGS_BACKUP   NBIT2
 
#define FLASH_FN_FLAGS_COMPARE_AFTER   NBIT5
 
#define FLASH_FN_FLAGS_COMPARE_BEFORE   NBIT0
 
#define FLASH_FN_FLAGS_ERASE   NBIT3
 
#define FLASH_FN_FLAGS_READ   NBIT6
 
#define FLASH_FN_FLAGS_READ_SURROUNDING   NBIT1
 
#define FLASH_FN_FLAGS_WRITE   NBIT4
 
#define FLASH_MODE_FLAGS_CS   NBIT0
 
#define FLASH_MODE_FLAGS_CS_SWITCH   NBIT1
 
#define FLASH_MODE_FLAGS_CS_SWITCH_TARGET   NBIT2
 
#define FLASH_MODE_FLAGS_CS_VALIDATE_IMAGE   NBIT3
 
#define FLASH_MODE_FLAGS_DATA_IN_BACKUP   NBIT5
 
#define FLASH_MODE_FLAGS_UNCHANGED   NBIT4
 
#define FLASH_RETURN_OK   0
 
#define FLASH_SECTOR_SIZE   FLASH_SECTOR_SZ
 
#define FLASH_SIG_STA_SZ   (FLASH_SIG_SZ+FLASH_STA_SZ)
 
#define FLASH_SIG_SZ   (sizeof(uint32))
 
#define FLASH_SIGNATURE   HOST_CONTROL_FLASH_SIG
 
#define FLASH_STA_SZ   (sizeof(tenuFlashAccessStatus))
 

Enumerations

enum  tenuBackupStatus { BACKUP_STATUS_EMPTY = 0xFFFFFFFF, BACKUP_STATUS_NOT_ACTIVE = BACKUP_SIGNATURE | 0xFFFFFF00, BACKUP_STATUS_ACTIVE = BACKUP_SIGNATURE, BACKUP_STATUS_DONE = 0x00000000 }
 
enum  tenuCSOp {
  CS_INITIALIZE, CS_INVALIDATE_RB, CS_VALIDATE_RB, CS_SWITCH,
  CS_VALIDATE_SWITCH, CS_GET_ACTIVE, CS_GET_INACTIVE, CS_DEINITIALIZE
}
 
enum  tenuFlashAccessItemMode { FLASH_ITEM_ADD, FLASH_ITEM_REMOVE, FLASH_ITEM_READ, FLASH_ITEM_READIDX }
 Transfer modes available for accessing items in WINC flash stores such as TLS root certificate store. More...
 
enum  tenuFlashAccessStatus { FLASH_STATUS_EMPTY = 0xFFFFFFFF, FLASH_STATUS_NOT_ACTIVE = 0xFFFFFF00, FLASH_STATUS_ACTIVE = 0xFFFF0000, FLASH_STATUS_DONE = 0xFF000000 }
 
enum  tenuMemId { MEM_ID_WINC_FLASH = 0x80000000, MEM_ID_WINC_ACTIVE, MEM_ID_WINC_INACTIVE, MEM_ID_NONE = 0xFFFFFFFF }
 

Functions

sint8 image_get_target (uint8 *pu8Target)
 
uint8 is_internal_info (tpfDataAccessFn pfFn)
 
sint8 prepare_backup (uint32 u32Target)
 
sint8 recover_backup (void)
 
sint8 rootcert_access (tenuFlashAccessItemMode enuMode, tstrRootCertEntryHeader *pstrReferenceHdr, uint16 *pu16EntrySize, uint8 *pu8Buff, uint32 *pu32Offset)
 
sint8 rootcert_get_size (tstrRootCertEntryHeader *pstrHdr, uint16 *pu16Size)
 
void set_internal_info (tpfDataAccessFn *ppfFn, uint32 u32LocationId)
 
void set_internal_info_ptr (tpfDataAccessFn *ppfFn, uint8 *pu8Ptr)
 
sint8 transfer_run (tstrFlashAccess *pstrFlashAccess)
 
sint8 winc_flash_write_verify (uint8 *pu8Buf, uint32 u32Offset, uint32 u32Size)
 

Variables

uint16 gu16LastAccessId
 
uint8 gu8Changed
 
uint8 gu8Init
 
uint8 gu8Reset
 
uint8 gu8Success
 

Detailed Description

WINC Flash Interface.

Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.

Definition in file nmflash.h.

Macro Definition Documentation

◆ BACKUP_SIGNATURE

#define BACKUP_SIGNATURE   0x424b5550

Definition at line 48 of file nmflash.h.

◆ FLASH_ACCESS_OPTION_COMPARE_AFTER

#define FLASH_ACCESS_OPTION_COMPARE_AFTER   NBIT4

Bit 4 of u8AccessOptions parameter of various function APIs.
Request for byte-wise verification of write.
Applies to data transfer in either direction.
If set, FLASH_FN_FLAGS_COMPARE_AFTER will be set in subsequent call to function of type tpfDataAccessFn.

Definition at line 115 of file nmflash.h.

◆ FLASH_ACCESS_OPTION_COMPARE_BEFORE

#define FLASH_ACCESS_OPTION_COMPARE_BEFORE   NBIT3

Bit 3 of u8AccessOptions parameter of various function APIs.
Request to compare new data against existing data before erasing/writing, to avoid unnecessary operations.
Applies to data transfer in either direction.
If set, FLASH_FN_FLAGS_COMPARE_BEFORE will be set in subsequent call to function of type tpfDataAccessFn.

Definition at line 109 of file nmflash.h.

◆ FLASH_ACCESS_OPTION_ERASE_FIRST

#define FLASH_ACCESS_OPTION_ERASE_FIRST   NBIT0

Bit 0 of u8AccessOptions parameter of various function APIs.
Request to erase existing data before writing.
Only applies when module is providing data to the MCU application.
If set, FLASH_FN_FLAGS_ERASE will be set in subsequent call to function of type tpfDataAccessFn.

Definition at line 89 of file nmflash.h.

◆ FLASH_ACCESS_OPTION_KEEP_SURROUNDING

#define FLASH_ACCESS_OPTION_KEEP_SURROUNDING   NBIT1

Bit 1 of u8AccessOptions parameter of various function APIs.
When set with FLASH_ACCESS_OPTION_ERASE_FIRST, this is a request to do read-modify-erase-write (eg if MCU application is storing received data in flash).
Only applies when module is providing data to the MCU application.
If set, FLASH_FN_FLAGS_READ_SURROUNDING may be set in subsequent call to function of type tpfDataAccessFn.

Definition at line 96 of file nmflash.h.

◆ FLASH_ACCESS_OPTION_USE_BACKUP

#define FLASH_ACCESS_OPTION_USE_BACKUP   NBIT2

Bit 2 of u8AccessOptions parameter of various function APIs.
When set with FLASH_ACCESS_OPTION_ERASE_FIRST and FLASH_ACCESS_OPTION_KEEP_SURROUNDING, this is a request to keep a persistent backup of modified contents during read-modify-erase-write.
Only applies when module is providing data to the MCU application.
If set, FLASH_FN_FLAGS_BACKUP may be set in subsequent call to function of type tpfDataAccessFn.

Definition at line 103 of file nmflash.h.

◆ FLASH_ACCESS_WINC_MASK

When modifying WINC flash contents, the module determines most options internally. Only two options are taken from the u8AccessOptions parameter.
When providing data to the MCU application, the module takes all options from the u8AccessOptions parameter.

Definition at line 120 of file nmflash.h.

◆ FLASH_BACKUP_STA_SZ

#define FLASH_BACKUP_STA_SZ   sizeof(tenuBackupStatus)

Definition at line 207 of file nmflash.h.

◆ FLASH_BACKUP_STORE_OFFSET

#define FLASH_BACKUP_STORE_OFFSET   (HOST_CONTROL_FLASH_OFFSET + HOST_CONTROL_FLASH_SZ - FLASH_BACKUP_STORE_SZ)

Definition at line 209 of file nmflash.h.

◆ FLASH_BACKUP_STORE_SZ

#define FLASH_BACKUP_STORE_SZ   (2*sizeof(tstrBackup))

Definition at line 208 of file nmflash.h.

◆ FLASH_FN_FLAGS_BACKUP

#define FLASH_FN_FLAGS_BACKUP   NBIT2

Bit 2 of u8Flags parameter of tpfDataAccessFn.
Save buffer to a backup persistent location in case of power loss after subsequent erase. A (persistent) record of the backup status must also be kept. Typically not set unless FLASH_FN_FLAGS_READ_SURROUNDING and FLASH_FN_FLAGS_ERASE are both set.

Definition at line 68 of file nmflash.h.

◆ FLASH_FN_FLAGS_COMPARE_AFTER

#define FLASH_FN_FLAGS_COMPARE_AFTER   NBIT5

Bit 5 of u8Flags parameter of tpfDataAccessFn.
Compare buffer against written data, to provide verification. Typically not set unless FLASH_FN_FLAGS_WRITE is set.

Definition at line 78 of file nmflash.h.

◆ FLASH_FN_FLAGS_COMPARE_BEFORE

#define FLASH_FN_FLAGS_COMPARE_BEFORE   NBIT0

Bit 0 of u8Flags parameter of tpfDataAccessFn.
Compare buffer against existing data, to avoid unnecessary operation.

Definition at line 59 of file nmflash.h.

◆ FLASH_FN_FLAGS_ERASE

#define FLASH_FN_FLAGS_ERASE   NBIT3

Bit 3 of u8Flags parameter of tpfDataAccessFn.
Erase existing data before writing.

Definition at line 71 of file nmflash.h.

◆ FLASH_FN_FLAGS_READ

#define FLASH_FN_FLAGS_READ   NBIT6

Bit 6 of u8Flags parameter of tpfDataAccessFn.
Read data to buffer. Typically this would be the only flag set, meaning read the existing data. However, if other flags are set, the read should be performed at the end.

Definition at line 82 of file nmflash.h.

◆ FLASH_FN_FLAGS_READ_SURROUNDING

#define FLASH_FN_FLAGS_READ_SURROUNDING   NBIT1

Bit 1 of u8Flags parameter of tpfDataAccessFn.
Fill uninitialized portion of buffer with existing data to avoid losing it in subsequent erase. Typically not set unless FLASH_FN_FLAGS_ERASE is set.

Definition at line 63 of file nmflash.h.

◆ FLASH_FN_FLAGS_WRITE

#define FLASH_FN_FLAGS_WRITE   NBIT4

Bit 4 of u8Flags parameter of tpfDataAccessFn.
Write buffer.

Definition at line 74 of file nmflash.h.

◆ FLASH_MODE_FLAGS_CS

#define FLASH_MODE_FLAGS_CS   NBIT0

Definition at line 50 of file nmflash.h.

◆ FLASH_MODE_FLAGS_CS_SWITCH

#define FLASH_MODE_FLAGS_CS_SWITCH   NBIT1

Definition at line 51 of file nmflash.h.

◆ FLASH_MODE_FLAGS_CS_SWITCH_TARGET

#define FLASH_MODE_FLAGS_CS_SWITCH_TARGET   NBIT2

Definition at line 52 of file nmflash.h.

◆ FLASH_MODE_FLAGS_CS_VALIDATE_IMAGE

#define FLASH_MODE_FLAGS_CS_VALIDATE_IMAGE   NBIT3

Definition at line 53 of file nmflash.h.

◆ FLASH_MODE_FLAGS_DATA_IN_BACKUP

#define FLASH_MODE_FLAGS_DATA_IN_BACKUP   NBIT5

Definition at line 55 of file nmflash.h.

◆ FLASH_MODE_FLAGS_UNCHANGED

#define FLASH_MODE_FLAGS_UNCHANGED   NBIT4

Definition at line 54 of file nmflash.h.

◆ FLASH_RETURN_OK

#define FLASH_RETURN_OK   0

Definition at line 45 of file nmflash.h.

◆ FLASH_SECTOR_SIZE

#define FLASH_SECTOR_SIZE   FLASH_SECTOR_SZ

Definition at line 46 of file nmflash.h.

◆ FLASH_SIG_STA_SZ

#define FLASH_SIG_STA_SZ   (FLASH_SIG_SZ+FLASH_STA_SZ)

Definition at line 192 of file nmflash.h.

◆ FLASH_SIG_SZ

#define FLASH_SIG_SZ   (sizeof(uint32))

Definition at line 190 of file nmflash.h.

◆ FLASH_SIGNATURE

#define FLASH_SIGNATURE   HOST_CONTROL_FLASH_SIG

Definition at line 47 of file nmflash.h.

◆ FLASH_STA_SZ

#define FLASH_STA_SZ   (sizeof(tenuFlashAccessStatus))

Definition at line 191 of file nmflash.h.

Enumeration Type Documentation

◆ tenuBackupStatus

Enumerator
BACKUP_STATUS_EMPTY 
BACKUP_STATUS_NOT_ACTIVE 
BACKUP_STATUS_ACTIVE 
BACKUP_STATUS_DONE 

Definition at line 144 of file nmflash.h.

◆ tenuCSOp

enum tenuCSOp
Enumerator
CS_INITIALIZE 
CS_INVALIDATE_RB 
CS_VALIDATE_RB 
CS_SWITCH 
CS_VALIDATE_SWITCH 
CS_GET_ACTIVE 
CS_GET_INACTIVE 
CS_DEINITIALIZE 

Definition at line 123 of file nmflash.h.

◆ tenuFlashAccessItemMode

Transfer modes available for accessing items in WINC flash stores such as TLS root certificate store.

See also
m2m_flash_rootcert_access
Enumerator
FLASH_ITEM_ADD 

Add an item to the relevant WINC flash store.

FLASH_ITEM_REMOVE 

Remove an item from the relevant WINC flash store.

FLASH_ITEM_READ 

Read an item from the relevant WINC flash store, using an identifier.

FLASH_ITEM_READIDX 

Read an item from the relevant WINC flash store, using an index.

Definition at line 171 of file nmflash.h.

◆ tenuFlashAccessStatus

Enumerator
FLASH_STATUS_EMPTY 
FLASH_STATUS_NOT_ACTIVE 
FLASH_STATUS_ACTIVE 
FLASH_STATUS_DONE 

Definition at line 134 of file nmflash.h.

◆ tenuMemId

enum tenuMemId
Enumerator
MEM_ID_WINC_FLASH 
MEM_ID_WINC_ACTIVE 
MEM_ID_WINC_INACTIVE 
MEM_ID_NONE 

Definition at line 154 of file nmflash.h.

Function Documentation

◆ image_get_target()

sint8 image_get_target ( uint8 pu8Target)

Definition at line 515 of file nmflash.c.

◆ is_internal_info()

uint8 is_internal_info ( tpfDataAccessFn  pfFn)

Definition at line 436 of file nmflash.c.

◆ prepare_backup()

sint8 prepare_backup ( uint32  u32Target)

Definition at line 485 of file nmflash.c.

◆ recover_backup()

sint8 recover_backup ( void  )

Definition at line 442 of file nmflash.c.

◆ rootcert_access()

sint8 rootcert_access ( tenuFlashAccessItemMode  enuMode,
tstrRootCertEntryHeader pstrReferenceHdr,
uint16 pu16EntrySize,
uint8 pu8Buff,
uint32 pu32Offset 
)

Definition at line 570 of file nmflash.c.

◆ rootcert_get_size()

sint8 rootcert_get_size ( tstrRootCertEntryHeader pstrHdr,
uint16 pu16Size 
)

Definition at line 535 of file nmflash.c.

◆ set_internal_info()

void set_internal_info ( tpfDataAccessFn ppfFn,
uint32  u32LocationId 
)

Definition at line 430 of file nmflash.c.

◆ set_internal_info_ptr()

void set_internal_info_ptr ( tpfDataAccessFn ppfFn,
uint8 pu8Ptr 
)

Definition at line 424 of file nmflash.c.

◆ transfer_run()

sint8 transfer_run ( tstrFlashAccess pstrFlashAccess)

Definition at line 679 of file nmflash.c.

◆ winc_flash_write_verify()

sint8 winc_flash_write_verify ( uint8 pu8Buf,
uint32  u32Offset,
uint32  u32Size 
)

Definition at line 90 of file nmflash.c.

Variable Documentation

◆ gu16LastAccessId

uint16 gu16LastAccessId

Definition at line 57 of file nmflash.c.

◆ gu8Changed

uint8 gu8Changed

Definition at line 59 of file nmflash.c.

◆ gu8Init

uint8 gu8Init

Definition at line 60 of file nmflash.c.

◆ gu8Reset

uint8 gu8Reset

Definition at line 61 of file nmflash.c.

◆ gu8Success

uint8 gu8Success

Definition at line 58 of file nmflash.c.



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