NVM3HalEMDRV > NVM3
Detailed Description
NVM3 hal module.
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 just substituting the functions in this module.
- Note
- These functions are used by the NVM3 and should not be used by any applications.
Macros |
|
#define | CHECK_DATA 1 |
Macro defining if data should be checked.
|
|
#define | NVM3_HAL_WRITE_SIZE_16 1 |
Two writes are allowed.
|
|
#define | NVM3_HAL_WRITE_SIZE_32 0 |
Only single writes are allowed.
|
|
Typedefs |
|
typedef void * | nvm3_HalPtr_t |
Pointer to NVM.
|
|
typedef uint32_t | nvm3_HalWriteSize_t |
Write size capabilities in the NVM.
|
|
Functions |
|
void | nvm3_halClose (void) |
Close the NVM3 hal for usage.
|
|
uint8_t | nvm3_halGetDeviceId (void) |
Retrieve the device id.
|
|
size_t | nvm3_halGetPageSize (void) |
Retrieve the page size.
|
|
nvm3_HalWriteSize_t | nvm3_halGetWriteSize (void) |
Retrieve the write size.
|
|
Ecode_t | nvm3_halOpen ( nvm3_HalPtr_t nvmAdr, size_t nvmSize) |
Open the NVM3 hal for usage.
|
|
Ecode_t | nvm3_halPageErase ( nvm3_HalPtr_t nvmAdr) |
Erase a page in the NVM.
|
|
void | nvm3_halReadBytes ( nvm3_HalPtr_t nvmAdr, uint8_t *pDst, size_t cnt) |
Read data from NVM.
|
|
void | nvm3_halReadWords ( nvm3_HalPtr_t nvmAdr, uint32_t *pDst, size_t cnt) |
Read data from NVM.
|
|
Ecode_t | nvm3_halWriteBytes ( nvm3_HalPtr_t nvmAdr, void const *pSrc, size_t cnt) |
Write data to NVM.
|
|
Ecode_t | nvm3_halWriteWords ( nvm3_HalPtr_t nvmAdr, void const *pSrc, size_t cnt) |
Write data to NVM.
|
|
Variables |
|
static uint32_t | openCnt = 0 |
A variable that keeps track of the open count.
|
|
Function Documentation
void nvm3_halClose | ( | void |
|
) |
Close the NVM3 hal for usage.
This function should be called at program termination. Should be done before any graceful halts.
Definition at line
123
of file
nvm3_hal_flash.c
.
References MSC_Deinit() , and openCnt .
uint8_t nvm3_halGetDeviceId | ( | void |
|
) |
Retrieve the device id.
This function is used to retrieve the device id.
- Returns
- The device id.
Definition at line
148
of file
nvm3_hal_flash.c
.
References _SILICON_LABS_GECKO_INTERNAL_SDID .
size_t nvm3_halGetPageSize | ( | void |
|
) |
Retrieve the page size.
This function is used to retrieve the page size.
- Returns
- The page size.
Definition at line
133
of file
nvm3_hal_flash.c
.
References SYSTEM_GetFlashPageSize() .
Referenced by nvm3_halPageErase() .
nvm3_HalWriteSize_t nvm3_halGetWriteSize | ( | void |
|
) |
Retrieve the write size.
This function is used to retrieve the write size for the device. It could be either NVM3_HAL_WRITE_SIZE_32 or NVM3_HAL_WRITE_SIZE_16 .
- Returns
- The write size.
Definition at line
139
of file
nvm3_hal_flash.c
.
References NVM3_HAL_WRITE_SIZE_16 , and NVM3_HAL_WRITE_SIZE_32 .
Ecode_t nvm3_halOpen | ( | nvm3_HalPtr_t |
nvmAdr,
|
size_t |
nvmSize
|
||
) |
Open the NVM3 hal for usage.
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.
- Parameters
-
[in] nvmAdr
A pointer to the destination in NVM. [in] nvmSize
The total size of the NVM.
- Returns
- The result of the open call. ECODE_NVM3_OK on success or a NVM3 Ecode_t on failure.
Definition at line
111
of file
nvm3_hal_flash.c
.
References ECODE_NVM3_OK , MSC_Init() , and openCnt .
Ecode_t nvm3_halPageErase | ( | nvm3_HalPtr_t |
nvmAdr
|
) |
Erase a page in the NVM.
This function is used to erase an NVM page.
- Parameters
-
[in] nvmAdr
A memory address pointing to the start of the page to erase.
- Returns
- The result of the erase operation.
Definition at line
226
of file
nvm3_hal_flash.c
.
References ECODE_NVM3_ERR_ERASE_FAILED , ECODE_NVM3_OK , MSC_ErasePage() , and nvm3_halGetPageSize() .
void nvm3_halReadBytes | ( | nvm3_HalPtr_t |
nvmAdr,
|
uint8_t * |
pDst,
|
||
size_t |
cnt
|
||
) |
Read data from NVM.
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.
- Parameters
-
[in] nvmAdr
A memory address in NVM where the data shall be read. [in] *pDst
A pointer to the destination buffer. [in] cnt
The number of bytes to read.
Definition at line
153
of file
nvm3_hal_flash.c
.
void nvm3_halReadWords | ( | nvm3_HalPtr_t |
nvmAdr,
|
uint32_t * |
pDst,
|
||
size_t |
cnt
|
||
) |
Read data from NVM.
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.
- Parameters
-
[in] nvmAdr
A memory address in NVM where the data shall be read. [in] *pDst
A pointer to the destination buffer. [in] cnt
The number of words to read.
Definition at line
163
of file
nvm3_hal_flash.c
.
Ecode_t nvm3_halWriteBytes | ( | nvm3_HalPtr_t |
nvmAdr,
|
void const * |
pSrc,
|
||
size_t |
cnt
|
||
) |
Write data to NVM.
- Parameters
-
[in] nvmAdr
A memory address in NVM where the data shall be written. [in] pSrc
A pointer to the source data. [in] cnt
The number of bytes to write.
- Returns
- The result of the write operation. ECODE_NVM3_OK on success or a NVM3 Ecode_t on failure.
Definition at line
173
of file
nvm3_hal_flash.c
.
References ECODE_NVM3_OK , and nvm3_halWriteWords() .
Ecode_t nvm3_halWriteWords | ( | nvm3_HalPtr_t |
nvmAdr,
|
void const * |
pSrc,
|
||
size_t |
cnt
|
||
) |
Write data to NVM.
This function is used to write data to the NVM. This is a blocking function.
- Parameters
-
[in] nvmAdr
A memory address in NVM where the data shall be written. [in] *pSrc
A pointer to the source data. [in] cnt
The number of words to write.
- Returns
- The result of the write operation. ECODE_NVM3_OK on success or a NVM3 Ecode_t on failure.
Definition at line
197
of file
nvm3_hal_flash.c
.
References ECODE_NVM3_ERR_INT_WRITE_TO_NOT_ERASED , ECODE_NVM3_ERR_WRITE_FAILED , ECODE_NVM3_OK , and MSC_WriteWord() .
Referenced by nvm3_halWriteBytes() .