nmflash.h
Go to the documentation of this file.
1 
36 #ifndef __NM_FLASH_H__
37 #define __NM_FLASH_H__
38 
39 /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
40 INCLUDES
41 *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
44 
45 #define FLASH_RETURN_OK 0
46 #define FLASH_SECTOR_SIZE FLASH_SECTOR_SZ
47 #define FLASH_SIGNATURE HOST_CONTROL_FLASH_SIG
48 #define BACKUP_SIGNATURE 0x424b5550
49 
50 #define FLASH_MODE_FLAGS_CS NBIT0
51 #define FLASH_MODE_FLAGS_CS_SWITCH NBIT1
52 #define FLASH_MODE_FLAGS_CS_SWITCH_TARGET NBIT2
53 #define FLASH_MODE_FLAGS_CS_VALIDATE_IMAGE NBIT3
54 #define FLASH_MODE_FLAGS_UNCHANGED NBIT4
55 #define FLASH_MODE_FLAGS_DATA_IN_BACKUP NBIT5
56 
59 #define FLASH_FN_FLAGS_COMPARE_BEFORE NBIT0
60 
63 #define FLASH_FN_FLAGS_READ_SURROUNDING NBIT1
64 
68 #define FLASH_FN_FLAGS_BACKUP NBIT2
69 
71 #define FLASH_FN_FLAGS_ERASE NBIT3
72 
74 #define FLASH_FN_FLAGS_WRITE NBIT4
75 
78 #define FLASH_FN_FLAGS_COMPARE_AFTER NBIT5
79 
82 #define FLASH_FN_FLAGS_READ NBIT6
83 
89 #define FLASH_ACCESS_OPTION_ERASE_FIRST NBIT0
90 
96 #define FLASH_ACCESS_OPTION_KEEP_SURROUNDING NBIT1
97 
103 #define FLASH_ACCESS_OPTION_USE_BACKUP NBIT2
104 
109 #define FLASH_ACCESS_OPTION_COMPARE_BEFORE NBIT3
110 
115 #define FLASH_ACCESS_OPTION_COMPARE_AFTER NBIT4
116 
120 #define FLASH_ACCESS_WINC_MASK (FLASH_ACCESS_OPTION_COMPARE_BEFORE | FLASH_ACCESS_OPTION_COMPARE_AFTER)
121 
122 
123 typedef enum {
132 }tenuCSOp;
133 
134 typedef enum {
135  /*
136  * Status values arranged so that status can be updated without any erase operation.
137  */
138  FLASH_STATUS_EMPTY = 0xFFFFFFFF,
140  FLASH_STATUS_ACTIVE = 0xFFFF0000,
141  FLASH_STATUS_DONE = 0xFF000000
143 
144 typedef enum {
145  /*
146  * Status values arranged so that status can be updated without any erase operation.
147  */
148  BACKUP_STATUS_EMPTY = 0xFFFFFFFF,
151  BACKUP_STATUS_DONE = 0x00000000
153 
154 typedef enum {
155  /*
156  * Special location ID values. If top bit is not set, the location ID is interpreted as flash address.
157  */
158  MEM_ID_WINC_FLASH = 0x80000000,
161  MEM_ID_NONE = 0xFFFFFFFF
162 }tenuMemId;
163 
171 typedef enum {
181 
182 
183 typedef struct {
187  uint8 u8AccessFlags; // These correspond bitwise to application access options.
188  uint8 u8ModeFlags; // These are set internally, with reference to application mode options.
190 #define FLASH_SIG_SZ (sizeof(uint32))
191 #define FLASH_STA_SZ (sizeof(tenuFlashAccessStatus))
192 #define FLASH_SIG_STA_SZ (FLASH_SIG_SZ+FLASH_STA_SZ)
193 
194 typedef struct {
200 
201 typedef struct {
206 }tstrBackup;
207 #define FLASH_BACKUP_STA_SZ sizeof(tenuBackupStatus)
208 #define FLASH_BACKUP_STORE_SZ (2*sizeof(tstrBackup))
209 #define FLASH_BACKUP_STORE_OFFSET (HOST_CONTROL_FLASH_OFFSET + HOST_CONTROL_FLASH_SZ - FLASH_BACKUP_STORE_SZ)
210 
226 typedef struct {
243 
251 typedef struct {
256  /* Offset of data within the buffer. */
258  /* Size of data to be written or read. */
261 
262 extern uint16 gu16LastAccessId;
263 extern uint8 gu8Success;
264 extern uint8 gu8Changed;
265 extern uint8 gu8Init;
266 extern uint8 gu8Reset;
267 
268 /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
269 FUNCTION PROTOTYPES
270 *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
271 
272 sint8 winc_flash_write_verify(uint8 *pu8Buf, uint32 u32Offset, uint32 u32Size);
273 void set_internal_info(tpfDataAccessFn *ppfFn, uint32 u32LocationId);
274 void set_internal_info_ptr(tpfDataAccessFn *ppfFn, uint8 *pu8Ptr);
276 sint8 recover_backup(void);
277 sint8 prepare_backup(uint32 u32Target);
278 sint8 image_get_target(uint8 *pu8Target);
280 sint8 rootcert_access(tenuFlashAccessItemMode enuMode, tstrRootCertEntryHeader *pstrReferenceHdr, uint16 *pu16EntrySize, uint8 *pu8Buff, uint32 *pu32Offset);
281 sint8 transfer_run(tstrFlashAccess *pstrFlashAccess);
282 
283 
284 #endif /* __NM_FLASH_H__ */
This module contains common APIs declarations.
signed char sint8
Range of values between -128 to 127.
Definition: nm_bsp.h:111
sint8 prepare_backup(uint32 u32Target)
Definition: nmflash.c:485
sint8 rootcert_access(tenuFlashAccessItemMode enuMode, tstrRootCertEntryHeader *pstrReferenceHdr, uint16 *pu16EntrySize, uint8 *pu8Buff, uint32 *pu32Offset)
Definition: nmflash.c:570
tenuFlashAccessStatus
Definition: nmflash.h:134
tenuBackupStatus
Definition: nmflash.h:144
tpfDataAccessFn pfDestinationFn
Definition: nmflash.h:196
uint8 gu8Reset
Definition: nmflash.c:61
Header of a root certificate entry in flash.
Definition: m2m_types.h:1907
tenuCSOp
Definition: nmflash.h:123
uint8 gu8Success
Definition: nmflash.c:58
uint8 gu8Init
Definition: nmflash.c:60
WINC3400 IoT Application Interface Internal Types.
tenuMemId
Definition: nmflash.h:154
tenuFlashAccessStatus enuTransferStatus
Definition: nmflash.h:185
tenuFlashAccessItemMode
Transfer modes available for accessing items in WINC flash stores such as TLS root certificate store...
Definition: nmflash.h:171
unsigned short uint16
Range of values between 0 to 65535.
Definition: nm_bsp.h:96
uint32 u32SourceAddr
Definition: nmflash.h:204
uint8 gu8Changed
Definition: nmflash.c:59
#define BACKUP_SIGNATURE
Definition: nmflash.h:48
This structure contains data for local data access (read, erase or write).
Definition: nmflash.h:251
sint8 winc_flash_write_verify(uint8 *pu8Buf, uint32 u32Offset, uint32 u32Size)
Definition: nmflash.c:90
tpfDataAccessFn pfSourceFn
Definition: nmflash.h:197
void set_internal_info_ptr(tpfDataAccessFn *ppfFn, uint8 *pu8Ptr)
Definition: nmflash.c:424
sint8 image_get_target(uint8 *pu8Target)
Definition: nmflash.c:515
uint32 u32Size
Definition: nmflash.h:198
tenuBackupStatus enuTransferStatus
Definition: nmflash.h:202
tstrFlashAccessPersistent strPersistentInfo
Definition: nmflash.h:195
uint32 u32DataOffset
Definition: nmflash.h:257
sint8 recover_backup(void)
Definition: nmflash.c:442
sint8 transfer_run(tstrFlashAccess *pstrFlashAccess)
Definition: nmflash.c:679
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...
Definition: m2m_flash.h:229
uint32 u32Size
Definition: nmflash.h:205
unsigned long uint32
Range of values between 0 to 4294967295.
Definition: nm_bsp.h:103
uint16 gu16LastAccessId
Definition: nmflash.c:57
unsigned char uint8
Range of values between 0 to 255.
Definition: nm_bsp.h:89
uint8 is_internal_info(tpfDataAccessFn pfFn)
Definition: nmflash.c:436
uint32 u32DestinationAddr
Definition: nmflash.h:203
void set_internal_info(tpfDataAccessFn *ppfFn, uint32 u32LocationId)
Definition: nmflash.c:430
sint8 rootcert_get_size(tstrRootCertEntryHeader *pstrHdr, uint16 *pu16Size)
Definition: nmflash.c:535
This structure contains parameters for initializing a local data access (read, erase or write)...
Definition: nmflash.h:226


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