EFM32 Happy Gecko Software Documentation  efm32hg-doc-5.1.2
nvm.h
Go to the documentation of this file.
1 /***************************************************************************/
16 #ifndef __NVM_H
17 #define __NVM_H
18 
19 #include <stdint.h>
20 #include <stdbool.h>
21 #include "em_device.h"
22 #include "nvm_hal.h"
23 #include "nvm_config.h"
24 #include "ecode.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 /***************************************************************************/
35 /***************************************************************************/
40 /*******************************************************************************
41  ******************************* DEFINES ***********************************
42  ******************************************************************************/
43 
45 #define ECODE_EMDRV_NVM_OK ( ECODE_OK )
46 #define ECODE_EMDRV_NVM_ADDR_INVALID ( ECODE_EMDRV_NVM_BASE | 0x00000001 )
47 #define ECODE_EMDRV_NVM_ALIGNMENT_INVALID ( ECODE_EMDRV_NVM_BASE | 0x00000002 )
48 #define ECODE_EMDRV_NVM_DATA_INVALID ( ECODE_EMDRV_NVM_BASE | 0x00000003 )
49 #define ECODE_EMDRV_NVM_WRITE_LOCK ( ECODE_EMDRV_NVM_BASE | 0x00000004 )
50 #define ECODE_EMDRV_NVM_NO_PAGES_AVAILABLE ( ECODE_EMDRV_NVM_BASE | 0x00000005 )
51 #define ECODE_EMDRV_NVM_PAGE_INVALID ( ECODE_EMDRV_NVM_BASE | 0x00000006 )
52 #define ECODE_EMDRV_NVM_ERROR ( ECODE_EMDRV_NVM_BASE | 0x00000007 )
53 
54 
55 #define NVM_WRITE_ALL_CMD 0xff
56 
57 #define NVM_WRITE_NONE_CMD 0xfe
58 
59 #define NVM_READ_ALL_CMD 0xff
60 
62 #define NVM_ERASE_RETAINCOUNT 0xffffffffUL
63 
65 #define NVM_PAGE_TERMINATION { NULL, 0, (NVM_Object_Ids) 0 }
66 
67 
68 /*******************************************************************************
69  *************************** PROTOTYPES ************************************
70  ******************************************************************************/
71 
72 Ecode_t NVM_Init(NVM_Config_t const *nvmConfig);
73 Ecode_t NVM_Erase(uint32_t eraseCount);
74 Ecode_t NVM_Write(uint16_t pageId, uint8_t objectId);
75 Ecode_t NVM_Read(uint16_t pageId, uint8_t objectId);
76 
78 #ifndef NVM_FEATURE_WEARLEVELGET_ENABLED
79 #define NVM_FEATURE_WEARLEVELGET_ENABLED true
80 #endif
81 
82 #if (NVM_FEATURE_WEARLEVELGET_ENABLED)
83 uint32_t NVM_WearLevelGet(void);
84 #endif
85 
89 #ifdef __cplusplus
90 }
91 #endif
92 
93 #endif /* __NVM_H */
Ecode_t NVM_Read(uint16_t pageId, uint8_t objectId)
Read an object or an entire page.
Definition: nvm.c:834
Energy Aware drivers error code definitions.
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
Ecode_t NVM_Erase(uint32_t eraseCount)
Erase the entire allocated NVM area.
Definition: nvm.c:382
Ecode_t NVM_Init(NVM_Config_t const *nvmConfig)
Initialize the NVM manager.
Definition: nvm.c:185
Ecode_t NVM_Write(uint16_t pageId, uint8_t objectId)
Write an object or a page.
Definition: nvm.c:460
uint32_t Ecode_t
Typedef for API function error code return values.
Definition: ecode.h:51
Non-Volatile Memory Wear-Leveling driver HAL.