CMSIS-Driver_PIC32CM-PL  
Peripheral Library (PLIB) Documentation
 
Loading...
Searching...
No Matches
NVMCTRL Interface

Driver API for NVMCTRL (plib_nvmctrl.h) More...

Macros

#define NVMCTRL_FLASH_START_ADDRESS   (0x0c000000U)
 
#define NVMCTRL_FLASH_PAGESIZE   (512U)
 
#define NVMCTRL_FLASH_ROWSIZE   (2048U)
 
#define NVMCTRL_ERROR_NONE   ( 0x0U )
 
#define NVMCTRL_ERROR_PROG   ( 0x4U )
 
#define NVMCTRL_ERROR_LOCK   ( 0x8U )
 
#define NVMCTRL_ERROR_NVM   (<TBA>)
 
#define NVMCTRL_BOOTCFG_START_ADDRESS   (0x0D000400U)
 
#define NVMCTRL_BOOTCFG_SIZE   (0x512U)
 

Typedefs

typedef uint16_t NVMCTRL_ERROR
 
typedef void(* NVMCTRL_CALLBACK) (void)
 NVMCTRL callback type.
 

Functions

void NVMCTRL_Initialize (void)
 Initializes the NVMCTRL module.
 
bool NVMCTRL_Read (const uint32_t address, uint32_t *data, uint32_t length)
 Reads data from flash memory.
 
bool NVMCTRL_WordWrite (const uint32_t *data, uint32_t address)
 Writes a 32-bit word to flash.
 
bool NVMCTRL_WordsWrite (const uint32_t *data, uint32_t address, uint32_t word_count)
 Writes multiple 32-bit words to flash memory.
 
bool NVMCTRL_PageErase (uint32_t address)
 Erases a single flash page.
 
bool NVMCTRL_MultiPageErase (uint32_t address, uint8_t num_pages)
 Erases multiple flash pages.
 
NVMCTRL_ERROR NVMCTRL_ErrorGet (void)
 Gets the current NVM error status.
 
bool NVMCTRL_IsBusy (void)
 Checks if the NVM controller is busy.
 
void NVMCTRL_RegionLock (uint32_t address)
 Locks the specified memory region.
 
void NVMCTRL_RegionUnlock (uint32_t address)
 Unlocks the specified memory region.
 
void NVMCTRL_CallbackRegister (NVMCTRL_CALLBACK callback)
 Registers a callback function with NVMCTRL.
 
bool NVMCTRL_BOOTCFG_WordWrite (const uint32_t *data, uint32_t address)
 Writes a word to Boot Configuration memory.
 
bool NVMCTRL_BOOTCFG_PageErase (uint32_t address)
 Erases a Boot Configuration page.
 
void NVMCTRL_EnableWriteProtection (void)
 Enable write protection in NVMCTRL.
 
void NVMCTRL_DisableWriteProtection (void)
 Disable write protection in NVMCTRL.
 
void NVMCTRL_WriteProtectionLock (void)
 Lock write protection in NVMCTRL until next reset.
 
void NVMCTRL_ClearCMD (void)
 clears previous command in NVMCTRL.
 

Description

Driver API for NVMCTRL (plib_nvmctrl.h)

Macro Definition Documentation

◆ NVMCTRL_BOOTCFG_SIZE

#define NVMCTRL_BOOTCFG_SIZE   (0x512U)

◆ NVMCTRL_BOOTCFG_START_ADDRESS

#define NVMCTRL_BOOTCFG_START_ADDRESS   (0x0D000400U)

◆ NVMCTRL_ERROR_LOCK

#define NVMCTRL_ERROR_LOCK   ( 0x8U )

◆ NVMCTRL_ERROR_NONE

#define NVMCTRL_ERROR_NONE   ( 0x0U )

◆ NVMCTRL_ERROR_NVM

#define NVMCTRL_ERROR_NVM   (<TBA>)

◆ NVMCTRL_ERROR_PROG

#define NVMCTRL_ERROR_PROG   ( 0x4U )

◆ NVMCTRL_FLASH_PAGESIZE

#define NVMCTRL_FLASH_PAGESIZE   (512U)

◆ NVMCTRL_FLASH_ROWSIZE

#define NVMCTRL_FLASH_ROWSIZE   (2048U)

◆ NVMCTRL_FLASH_START_ADDRESS

#define NVMCTRL_FLASH_START_ADDRESS   (0x0c000000U)

Typedef Documentation

◆ NVMCTRL_CALLBACK

typedef void(* NVMCTRL_CALLBACK) (void)

NVMCTRL callback type.

◆ NVMCTRL_ERROR

typedef uint16_t NVMCTRL_ERROR

Function Documentation

◆ NVMCTRL_BOOTCFG_PageErase()

bool NVMCTRL_BOOTCFG_PageErase ( uint32_t address)

Erases a Boot Configuration page.

Parameters
addressAddress within the BootCFG page to erase.
Returns
true if erase is successful, false otherwise.

◆ NVMCTRL_BOOTCFG_WordWrite()

bool NVMCTRL_BOOTCFG_WordWrite ( const uint32_t * data,
uint32_t address )

Writes a word to Boot Configuration memory.

Parameters
dataPointer to word data.
addressBoot configuration address to write to.
Returns
true if write is successful, false otherwise.

◆ NVMCTRL_CallbackRegister()

void NVMCTRL_CallbackRegister ( NVMCTRL_CALLBACK callback)

Registers a callback function with NVMCTRL.

Parameters
callbackCallback function pointer.
Returns
void

◆ NVMCTRL_ClearCMD()

void NVMCTRL_ClearCMD ( void )

clears previous command in NVMCTRL.

◆ NVMCTRL_DisableWriteProtection()

void NVMCTRL_DisableWriteProtection ( void )

Disable write protection in NVMCTRL.

◆ NVMCTRL_EnableWriteProtection()

void NVMCTRL_EnableWriteProtection ( void )

Enable write protection in NVMCTRL.

◆ NVMCTRL_ErrorGet()

NVMCTRL_ERROR NVMCTRL_ErrorGet ( void )

Gets the current NVM error status.

Returns
NVMCTRL_ERROR Error code.

◆ NVMCTRL_Initialize()

void NVMCTRL_Initialize ( void )

Initializes the NVMCTRL module.

Sets up the NVM controller for read/write/erase operations.

Returns
void

◆ NVMCTRL_IsBusy()

bool NVMCTRL_IsBusy ( void )

Checks if the NVM controller is busy.

Returns
true if busy, false otherwise.

◆ NVMCTRL_MultiPageErase()

bool NVMCTRL_MultiPageErase ( uint32_t address,
uint8_t num_pages )

Erases multiple flash pages.

Parameters
addressStart address of erase operation.
num_pagesNumber of pages to erase.
Returns
true if erase is successful, false otherwise.

◆ NVMCTRL_PageErase()

bool NVMCTRL_PageErase ( uint32_t address)

Erases a single flash page.

Parameters
addressAddress within the page to erase.
Returns
true if erase is successful, false otherwise.

◆ NVMCTRL_Read()

bool NVMCTRL_Read ( const uint32_t address,
uint32_t * data,
uint32_t length )

Reads data from flash memory.

Parameters
addressFlash memory address to read from.
dataPointer to buffer to store read data.
lengthLength of data to read (in bytes).
Returns
true if read is successful, false otherwise.

◆ NVMCTRL_RegionLock()

void NVMCTRL_RegionLock ( uint32_t address)

Locks the specified memory region.

Parameters
addressAddress of the memory region to lock.
Returns
void

◆ NVMCTRL_RegionUnlock()

void NVMCTRL_RegionUnlock ( uint32_t address)

Unlocks the specified memory region.

Parameters
addressAddress of the memory region to unlock.
Returns
void

◆ NVMCTRL_WordsWrite()

bool NVMCTRL_WordsWrite ( const uint32_t * data,
uint32_t address,
uint32_t word_count )

Writes multiple 32-bit words to flash memory.

Parameters
[in]dataPointer to the source data array to be written to flash.
[in]address32-bit aligned flash start address where writing will begin.
[in]word_countNumber of 32-bit words to write.
Returns
true if write operation is successful, false on parameter errors, locked region, or hardware fault.

◆ NVMCTRL_WordWrite()

bool NVMCTRL_WordWrite ( const uint32_t * data,
uint32_t address )

Writes a 32-bit word to flash.

Parameters
dataPointer to word data.
addressFlash memory address to write to.
Returns
true if write is successful, false otherwise.

◆ NVMCTRL_WriteProtectionLock()

void NVMCTRL_WriteProtectionLock ( void )

Lock write protection in NVMCTRL until next reset.