1.30.10.7 NVMCTRL_RegionLock Function

C

The prototype of NVMCTRL_RegionLock() varies based on device family. Refer to the generated header file for the actual prototype to be used.

void NVMCTRL_RegionLock (uint32_t address);

void NVMCTRL_RegionLock (NVMCTRL_MEMORY_REGION region);

Summary

Locks a NVMCTRL region.

Description

This function locks the region that contains the address specified in address parameter or the region parameter. Locking a region prevents write and erase operations on all pages in the region. A region is unlocked by either calling the NVMCTRL_RegionUnlock() function or by device reset. The size of each region is device dependant. Refer to the device specific datasheet for more details.

Precondition

Validate if NVM controller is ready to accept new request by calling NVMCTRL_IsBusy()

Parameters

Param Description
address Any address in the region to be locked.
region Region to be locked.

Returns

None.

Example

// Wait till the NVMCTRL module is available and then lock the region containing address 0x30000.

while(NVMCTRL_IsBusy());

NVMCTRL_RegionLock(0x00030000);

while(NVMCTRL_IsBusy());
// Wait till the NVMCTRL module is available and then lock the application region

while(NVMCTRL_IsBusy());

NVMCTRL_RegionLock(NVMCTRL_MEMORY_REGION_APPLICATION);

while(NVMCTRL_IsBusy());

Remarks

None.