NVM3 HAL#
NVM3 Hardware Abstraction Layer.
This module provides the NVM3 interface to the EFM and EFR Flash NVM.
Note
The features available through the handle are used by the NVM3 and should not be used directly by any applications.
This module provides the interface to the NVM. By having all NVM access functions in a separate file, it is possible to support different hardware by substituting the functions in this module.
Note
These functions are used by the NVM3 and should not be used by any applications.
Modules#
Typedefs#
Pointer to NVM.
Definition of the access data type.
Open the NVM3 HAL for usage.
Close the NVM3 HAL for usage.
Retrieve device information.
Control read and write access to the NVM.
Erase a page in the NVM.
Read data from NVM.
Write data to the NVM.
Variables#
The HAL flash handle.
The HAL flash handle.
The HAL flash handle.
Functions#
Open the NVM3 HAL for usage.
Close the NVM3 HAL.
Retrieve device information.
This function is used to read data from the NVM.
This function is used to write data to the NVM.
This function is used to erase an NVM page.
Macros#
Only single writes are allowed.
Two writes are allowed.
No access.
Read access.
Read and write access.
Ignore.
Macro defining if data should be checked.
Macro defining if data should be checked.
Typedef Documentation#
nvm3_HalOpen_t#
typedef sl_status_t(* nvm3_HalOpen_t) (nvm3_HalPtr_t nvmAdr, size_t nvmSize) )(nvm3_HalPtr_t nvmAdr, size_t nvmSize)
Open the NVM3 HAL for usage.
Type | Direction | Argument Name | Description |
---|---|---|---|
[in] | nvmAdr | A pointer to the destination in NVM. | |
[in] | nvmSize | The total size of the NVM. |
This function must be run at initialization, before any other functions are called. It is used to call necessary startup routines before the hardware can be accessed.
Returns
The result of the open call. SL_STATUS_OK on success or a NVM3 sl_status_t on failure.
nvm3_HalClose_t#
typedef void(* nvm3_HalClose_t) (void) )(void)
Close the NVM3 HAL for usage.
This function should be called at program termination. Should be done before any graceful halts.
nvm3_HalGetInfo_t#
typedef sl_status_t(* nvm3_HalGetInfo_t) (nvm3_HalInfo_t *info) )(nvm3_HalInfo_t *info)
Retrieve device information.
Type | Direction | Argument Name | Description |
---|---|---|---|
[in] | info | A pointer to a structure that will receive the device information. |
This function is used to retrieve information about the device properties, such as the device family, write size, whether the NVM is memory mapped or not, and finally the NVM page size.
nvm3_HalNvmAccess_t#
typedef void(* nvm3_HalNvmAccess_t) (nvm3_HalNvmAccessCode_t access) )(nvm3_HalNvmAccessCode_t access)
Control read and write access to the NVM.
Type | Direction | Argument Name | Description |
---|---|---|---|
[in] | access | The requested access. |
This function is used to control the access to the NVM. It can be either read, write, or none.
nvm3_HalPageErase_t#
typedef sl_status_t(* nvm3_HalPageErase_t) (nvm3_HalPtr_t nvmAdr) )(nvm3_HalPtr_t nvmAdr)
Erase a page in the NVM.
Type | Direction | Argument Name | Description |
---|---|---|---|
[in] | nvmAdr | A memory address pointing to the start of the page to erase. |
This function is used to erase an NVM page.
Returns
The result of the erase operation.
nvm3_HalReadWords_t#
typedef sl_status_t(* nvm3_HalReadWords_t) (nvm3_HalPtr_t nvmAdr, void *dst, size_t wordCnt) )(nvm3_HalPtr_t nvmAdr, void *dst, size_t wordCnt)
Read data from NVM.
Type | Direction | Argument Name | Description |
---|---|---|---|
[in] | nvmAdr | A memory address in NVM where data will be read. | |
[in] | *dst | A pointer to the destination buffer. | |
[in] | wordCnt | The number of words to read. |
This function is used to read data from the NVM. It will be a blocking call, since the thread asking for data to be read cannot continue without the data.
nvm3_HalWriteWords_t#
typedef sl_status_t(* nvm3_HalWriteWords_t) (nvm3_HalPtr_t nvmAdr, void const *pSrc, size_t cnt) )(nvm3_HalPtr_t nvmAdr, void const *pSrc, size_t cnt)
Write data to the NVM.
Type | Direction | Argument Name | Description |
---|---|---|---|
[in] | nvmAdr | A memory address in NVM where data will be written. | |
[in] | *pSrc | A pointer to the source data. | |
[in] | cnt | The number of words to write. |
This function is used to write data to the NVM. This is a blocking function.
Returns
The result of the write operation. SL_STATUS_OK on success or a NVM3 sl_status_t on failure.
Variable Documentation#
Function Documentation#
nvm3_halFlashOpen#
static sl_status_t nvm3_halFlashOpen (nvm3_HalPtr_t nvmAdr, size_t flashSize)
Type | Direction | Argument Name | Description |
---|---|---|---|
nvm3_HalPtr_t | N/A | nvmAdr | |
size_t | N/A | flashSize |
nvm3_halFlashClose#
static void nvm3_halFlashClose (void )
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
nvm3_halFlashGetInfo#
static sl_status_t nvm3_halFlashGetInfo (nvm3_HalInfo_t * halInfo)
Type | Direction | Argument Name | Description |
---|---|---|---|
nvm3_HalInfo_t * | N/A | halInfo |
nvm3_halFlashAccess#
static void nvm3_halFlashAccess (nvm3_HalNvmAccessCode_t access)
Type | Direction | Argument Name | Description |
---|---|---|---|
nvm3_HalNvmAccessCode_t | N/A | access |
nvm3_halFlashReadWords#
static sl_status_t nvm3_halFlashReadWords (nvm3_HalPtr_t nvmAdr, void * dst, size_t wordCnt)
Type | Direction | Argument Name | Description |
---|---|---|---|
nvm3_HalPtr_t | N/A | nvmAdr | |
void * | N/A | dst | |
size_t | N/A | wordCnt |
nvm3_halFlashWriteWords#
static sl_status_t nvm3_halFlashWriteWords (nvm3_HalPtr_t nvmAdr, void const * src, size_t wordCnt)
Type | Direction | Argument Name | Description |
---|---|---|---|
nvm3_HalPtr_t | N/A | nvmAdr | |
void const * | N/A | src | |
size_t | N/A | wordCnt |
nvm3_halFlashPageErase#
static sl_status_t nvm3_halFlashPageErase (nvm3_HalPtr_t nvmAdr)
Type | Direction | Argument Name | Description |
---|---|---|---|
nvm3_HalPtr_t | N/A | nvmAdr |
nvm3_halFlashExtOpen#
static sl_status_t nvm3_halFlashExtOpen (nvm3_HalPtr_t nvmAdr, size_t nvmSize)
Open the NVM3 HAL for usage.
Type | Direction | Argument Name | Description |
---|---|---|---|
nvm3_HalPtr_t | N/A | nvmAdr | |
size_t | N/A | nvmSize |
SE will take care of clocking the external flash. This function initializes the SE lock mutex and checks if NVM3 start and end addresses are within the data region or not.
nvm3_halFlashExtClose#
static void nvm3_halFlashExtClose (void )
Close the NVM3 HAL.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This function de-initializes the SE lock mutex.
nvm3_halFlashExtGetInfo#
static sl_status_t nvm3_halFlashExtGetInfo (nvm3_HalInfo_t * halInfo)
Retrieve device information.
Type | Direction | Argument Name | Description |
---|---|---|---|
nvm3_HalInfo_t * | N/A | halInfo |
nvm3_halFlashExtAccess#
static void nvm3_halFlashExtAccess (nvm3_HalNvmAccessCode_t access)
Type | Direction | Argument Name | Description |
---|---|---|---|
nvm3_HalNvmAccessCode_t | N/A | access |
nvm3_halFlashExtReadWords#
static sl_status_t nvm3_halFlashExtReadWords (nvm3_HalPtr_t nvmAdr, void * dst, size_t wordCnt)
This function is used to read data from the NVM.
Type | Direction | Argument Name | Description |
---|---|---|---|
nvm3_HalPtr_t | N/A | nvmAdr | |
void * | N/A | dst | |
size_t | N/A | wordCnt |
nvm3_halFlashExtWriteWords#
static sl_status_t nvm3_halFlashExtWriteWords (nvm3_HalPtr_t nvmAdr, void const * src, size_t wordCnt)
This function is used to write data to the NVM.
Type | Direction | Argument Name | Description |
---|---|---|---|
nvm3_HalPtr_t | N/A | nvmAdr | |
void const * | N/A | src | |
size_t | N/A | wordCnt |
nvm3_halFlashExtPageErase#
static sl_status_t nvm3_halFlashExtPageErase (nvm3_HalPtr_t nvmAdr)
This function is used to erase an NVM page.
Type | Direction | Argument Name | Description |
---|---|---|---|
nvm3_HalPtr_t | N/A | nvmAdr |