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#

nvm3_HalInfo_t

nvm3_HalHandle_t

Typedefs#

typedef void *

Pointer to NVM.

typedef uint8_t

Definition of the access data type.

typedef Ecode_t(*
nvm3_HalOpen_t)(nvm3_HalPtr_t nvmAdr, size_t nvmSize)

Open the NVM3 HAL for usage.

typedef void(*

Close the NVM3 HAL for usage.

typedef Ecode_t(*
nvm3_HalGetInfo_t)(nvm3_HalInfo_t *info)

Retrieve device information.

typedef void(*
nvm3_HalNvmAccess_t)(nvm3_HalNvmAccessCode_t access)

Control read and write access to the NVM.

typedef Ecode_t(*
nvm3_HalPageErase_t)(nvm3_HalPtr_t nvmAdr)

Erase a page in the NVM.

typedef Ecode_t(*
nvm3_HalReadWords_t)(nvm3_HalPtr_t nvmAdr, void *dst, size_t wordCnt)

Read data from NVM.

typedef Ecode_t(*
nvm3_HalWriteWords_t)(nvm3_HalPtr_t nvmAdr, void const *pSrc, size_t cnt)

Write data to the NVM.

Variables#

The HAL flash handle.

The HAL flash handle.

Functions#

nvm3_halFlashOpen(nvm3_HalPtr_t nvmAdr, size_t flashSize)
nvm3_halFlashGetInfo(nvm3_HalInfo_t *halInfo)
void
nvm3_halFlashAccess(nvm3_HalNvmAccessCode_t access)
nvm3_halFlashReadWords(nvm3_HalPtr_t nvmAdr, void *dst, size_t wordCnt)
nvm3_halFlashWriteWords(nvm3_HalPtr_t nvmAdr, void const *src, size_t wordCnt)
nvm3_halFlashPageErase(nvm3_HalPtr_t nvmAdr)

Macros#

#define

Only single writes are allowed.

#define

Two writes are allowed.

#define
#define

Read access.

#define

Read and write access.

#define
#define

Macro defining if data should be checked.

Typedef Documentation#

nvm3_HalPtr_t#

typedef void* nvm3_HalPtr_t

Pointer to NVM.


Definition at line 97 of file platform/emdrv/nvm3/inc/nvm3_hal.h

nvm3_HalNvmAccessCode_t#

typedef uint8_t nvm3_HalNvmAccessCode_t

Definition of the access data type.


Definition at line 109 of file platform/emdrv/nvm3/inc/nvm3_hal.h

nvm3_HalOpen_t#

typedef Ecode_t(* nvm3_HalOpen_t) (nvm3_HalPtr_t nvmAdr, size_t nvmSize) )(nvm3_HalPtr_t nvmAdr, size_t nvmSize)

Open the NVM3 HAL for usage.

Parameters
[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


Definition at line 134 of file platform/emdrv/nvm3/inc/nvm3_hal.h

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.


Definition at line 144 of file platform/emdrv/nvm3/inc/nvm3_hal.h

nvm3_HalGetInfo_t#

typedef Ecode_t(* nvm3_HalGetInfo_t) (nvm3_HalInfo_t *info) )(nvm3_HalInfo_t *info)

Retrieve device information.

Parameters
[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.


Definition at line 158 of file platform/emdrv/nvm3/inc/nvm3_hal.h

nvm3_HalNvmAccess_t#

typedef void(* nvm3_HalNvmAccess_t) (nvm3_HalNvmAccessCode_t access) )(nvm3_HalNvmAccessCode_t access)

Control read and write access to the NVM.

Parameters
[in]access

The requested access.

This function is used to control the access to the NVM. It can be either read, write, or none.


Definition at line 171 of file platform/emdrv/nvm3/inc/nvm3_hal.h

nvm3_HalPageErase_t#

typedef Ecode_t(* nvm3_HalPageErase_t) (nvm3_HalPtr_t nvmAdr) )(nvm3_HalPtr_t nvmAdr)

Erase a page in the NVM.

Parameters
[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.


Definition at line 186 of file platform/emdrv/nvm3/inc/nvm3_hal.h

nvm3_HalReadWords_t#

typedef Ecode_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.

Parameters
[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.


Definition at line 206 of file platform/emdrv/nvm3/inc/nvm3_hal.h

nvm3_HalWriteWords_t#

typedef Ecode_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.

Parameters
[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


Definition at line 229 of file platform/emdrv/nvm3/inc/nvm3_hal.h

Variable Documentation#

nvm3_halFlashHandle#

const nvm3_HalHandle_t nvm3_halFlashHandle

The HAL flash handle.


Definition at line 59 of file platform/emdrv/nvm3/inc/nvm3_hal_flash.h

nvm3_halFlashHandle#

const nvm3_HalHandle_t nvm3_halFlashHandle

The HAL flash handle.


Definition at line 220 of file platform/emdrv/nvm3/src/nvm3_hal_flash.c

Function Documentation#

nvm3_halFlashOpen#

static Ecode_t nvm3_halFlashOpen (nvm3_HalPtr_t nvmAdr, size_t flashSize)
Parameters
N/AnvmAdr
N/AflashSize

Definition at line 117 of file platform/emdrv/nvm3/src/nvm3_hal_flash.c

nvm3_halFlashClose#

static void nvm3_halFlashClose (void )
Parameters
N/A

Definition at line 126 of file platform/emdrv/nvm3/src/nvm3_hal_flash.c

nvm3_halFlashGetInfo#

static Ecode_t nvm3_halFlashGetInfo (nvm3_HalInfo_t * halInfo)
Parameters
N/AhalInfo

Definition at line 131 of file platform/emdrv/nvm3/src/nvm3_hal_flash.c

nvm3_halFlashAccess#

static void nvm3_halFlashAccess (nvm3_HalNvmAccessCode_t access)
Parameters
N/Aaccess

Definition at line 152 of file platform/emdrv/nvm3/src/nvm3_hal_flash.c

nvm3_halFlashReadWords#

static Ecode_t nvm3_halFlashReadWords (nvm3_HalPtr_t nvmAdr, void * dst, size_t wordCnt)
Parameters
N/AnvmAdr
N/Adst
N/AwordCnt

Definition at line 157 of file platform/emdrv/nvm3/src/nvm3_hal_flash.c

nvm3_halFlashWriteWords#

static Ecode_t nvm3_halFlashWriteWords (nvm3_HalPtr_t nvmAdr, void const * src, size_t wordCnt)
Parameters
N/AnvmAdr
N/Asrc
N/AwordCnt

Definition at line 174 of file platform/emdrv/nvm3/src/nvm3_hal_flash.c

nvm3_halFlashPageErase#

static Ecode_t nvm3_halFlashPageErase (nvm3_HalPtr_t nvmAdr)
Parameters
N/AnvmAdr

Definition at line 197 of file platform/emdrv/nvm3/src/nvm3_hal_flash.c

Macro Definition Documentation#

NVM3_HAL_WRITE_SIZE_32#

#define NVM3_HAL_WRITE_SIZE_32
Value:
0

Only single writes are allowed.


Definition at line 72 of file platform/emdrv/nvm3/inc/nvm3_hal.h

NVM3_HAL_WRITE_SIZE_16#

#define NVM3_HAL_WRITE_SIZE_16
Value:
1

Two writes are allowed.


Definition at line 73 of file platform/emdrv/nvm3/inc/nvm3_hal.h

NVM3_HAL_NVM_ACCESS_NONE#

#define NVM3_HAL_NVM_ACCESS_NONE
Value:
0

No access.


Definition at line 75 of file platform/emdrv/nvm3/inc/nvm3_hal.h

NVM3_HAL_NVM_ACCESS_RD#

#define NVM3_HAL_NVM_ACCESS_RD
Value:
1

Read access.


Definition at line 76 of file platform/emdrv/nvm3/inc/nvm3_hal.h

NVM3_HAL_NVM_ACCESS_RDWR#

#define NVM3_HAL_NVM_ACCESS_RDWR
Value:
2

Read and write access.


Definition at line 77 of file platform/emdrv/nvm3/inc/nvm3_hal.h

NVM3_HAL_NVM_ACCESS_NOP#

#define NVM3_HAL_NVM_ACCESS_NOP
Value:
3

Ignore.


Definition at line 78 of file platform/emdrv/nvm3/inc/nvm3_hal.h

CHECK_DATA#

#define CHECK_DATA
Value:
1

Macro defining if data should be checked.


Definition at line 52 of file platform/emdrv/nvm3/src/nvm3_hal_flash.c