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 substituting the functions in this module.

Note
These functions are used by the NVM3 and should not be used by any applications.

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 NVM3 interface to the EFM and EFR external Flash NVM.

Note
The features available through the handle are used by the NVM3 and should not be used directly by any applications.

Data Structures

struct nvm3_HalHandle_t
struct nvm3_HalInfo
Device NVM capabilities.

Macros

#define CACHE_ADR_INVALID (void *)(-1)
#define CACHE_SIZE (64)
#define CHECK_DATA 1
Macro defining if data should be checked.
#define NVM3_HAL_NVM_ACCESS_NONE 0
#define NVM3_HAL_NVM_ACCESS_NOP 3
#define NVM3_HAL_NVM_ACCESS_RD 1
#define NVM3_HAL_NVM_ACCESS_RDWR 2
#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_HalClose_t ) (void)
Close the NVM3 HAL for usage.
typedef Ecode_t (* nvm3_HalGetInfo_t ) ( nvm3_HalInfo_t *info)
Retrieve device information.
typedef struct nvm3_HalInfo nvm3_HalInfo_t
Device NVM capabilities.
typedef void(* nvm3_HalNvmAccess_t ) (nvm3_HalNvmAccessCode_t access)
Control read and write access to the NVM.
typedef uint8_t nvm3_HalNvmAccessCode_t
typedef Ecode_t (* nvm3_HalOpen_t ) ( nvm3_HalPtr_t nvmAdr, size_t nvmSize)
Open the NVM3 HAL for usage.
typedef Ecode_t (* nvm3_HalPageErase_t ) ( nvm3_HalPtr_t nvmAdr)
Erase a page in the NVM.
typedef void * nvm3_HalPtr_t
Pointer to 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.

Functions

static void halExtFlashClose (void)
static Ecode_t halExtFlashGetInfo ( nvm3_HalInfo_t *halInfo)
static Ecode_t halExtFlashOpen ( nvm3_HalPtr_t nvmAdr, size_t flashSize)
static Ecode_t halExtFlashPageErase ( nvm3_HalPtr_t nvmAdr)
Ecode_t halExtFlashReadWords ( nvm3_HalPtr_t nvmAdr, void *dst, size_t wordCnt)
static Ecode_t halExtFlashWriteWords ( nvm3_HalPtr_t nvmAdr, void const *src, size_t wordCnt)
static void nvm3_halExtFlashAccess (nvm3_HalNvmAccessCode_t access)
static void nvm3_halFlashAccess (nvm3_HalNvmAccessCode_t access)
static void nvm3_halFlashClose (void)
static Ecode_t nvm3_halFlashGetInfo ( nvm3_HalInfo_t *halInfo)
static Ecode_t nvm3_halFlashOpen ( nvm3_HalPtr_t nvmAdr, size_t flashSize)
static Ecode_t nvm3_halFlashPageErase ( nvm3_HalPtr_t nvmAdr)
Ecode_t nvm3_halFlashReadWords ( nvm3_HalPtr_t nvmAdr, void *dst, size_t wordCnt)
static Ecode_t nvm3_halFlashWriteWords ( nvm3_HalPtr_t nvmAdr, void const *src, size_t wordCnt)

Variables

static BootloaderInformation_t btlInfo
Bootloader information.
static BootloaderStorageInformation_t btlStorageInfo
Bootloader storage information.
static void * cacheAdr
static uint8_t cacheBuf [CACHE_SIZE]
const nvm3_HalHandle_t nvm3_halExtFlashHandle
const nvm3_HalHandle_t nvm3_halExtFlashHandle
const nvm3_HalHandle_t nvm3_halFlashHandle
const nvm3_HalHandle_t nvm3_halFlashHandle

Typedef Documentation

typedef void(* nvm3_HalClose_t) (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 136 of file nvm3_hal.h .

typedef Ecode_t (* nvm3_HalGetInfo_t) ( nvm3_HalInfo_t *info)

Retrieve 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.

Parameters
[in] deviceInfo A pointer to a structure that will receive the device information.

Definition at line 150 of file nvm3_hal.h .

typedef void(* nvm3_HalNvmAccess_t) (nvm3_HalNvmAccessCode_t access)

Control read and write access to the NVM.

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

Parameters
[in] access The requested access.

Definition at line 163 of file nvm3_hal.h .

typedef Ecode_t (* nvm3_HalOpen_t) ( 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 126 of file nvm3_hal.h .

typedef Ecode_t (* nvm3_HalPageErase_t) ( 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 178 of file nvm3_hal.h .

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

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 data will be read.
[in] *pDst A pointer to the destination buffer.
[in] cnt The number of words to read.

Definition at line 198 of file nvm3_hal.h .

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

Write data to the 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 data will 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 221 of file nvm3_hal.h .

Variable Documentation

const nvm3_HalHandle_t nvm3_halExtFlashHandle
Initial value:
= {
.open = halExtFlashOpen,
.close = halExtFlashClose,
.getInfo = halExtFlashGetInfo,
.access = nvm3_halExtFlashAccess,
.pageErase = halExtFlashPageErase,
.readWords = halExtFlashReadWords,
.writeWords = halExtFlashWriteWords,
}

Definition at line 258 of file nvm3_hal_extflash.c .

const nvm3_HalHandle_t nvm3_halFlashHandle
Initial value:
= {
.open = nvm3_halFlashOpen,
.close = nvm3_halFlashClose,
.getInfo = nvm3_halFlashGetInfo,
.access = nvm3_halFlashAccess,
.pageErase = nvm3_halFlashPageErase,
.readWords = nvm3_halFlashReadWords,
.writeWords = nvm3_halFlashWriteWords,
}

Definition at line 205 of file nvm3_hal_flash.c .