nrfx 2.5
Macros | Functions
MPU HAL

Hardware access layer for managing the Memory Protection Unit (MPU) peripheral. More...

Macros

#define NRF_MPU_PERIPHERAL_MASK_GET(base_addr)   (1UL << NRFX_PERIPHERAL_ID_GET(base_addr))
 Macro for getting MPU region configuration mask for the specified peripheral. More...
 

Functions

NRF_STATIC_INLINE void nrf_mpu_region0_ram_size_set (NRF_MPU_Type *p_reg, uint32_t size)
 Function for setting the size of the RAM region 0. More...
 
NRF_STATIC_INLINE void nrf_mpu_region0_peripherals_set (NRF_MPU_Type *p_reg, uint32_t peripheral_mask)
 Function for configuring specified peripherals in the memory region 0. More...
 
NRF_STATIC_INLINE uint32_t nrf_mpu_region0_peripherals_get (NRF_MPU_Type const *p_reg)
 Function for getting the bitmask that specifies peripherals configured in the memory region 0. More...
 
NRF_STATIC_INLINE void nrf_mpu_nvm_blocks_protection_enable (NRF_MPU_Type *p_reg, uint8_t group_idx, uint32_t block_mask)
 Function for enabling protection for specified non-volatile memory blocks. More...
 
NRF_STATIC_INLINE void nrf_mpu_nvm_protection_in_debug_set (NRF_MPU_Type *p_reg, bool enable)
 Function for setting the non-volatile memory (NVM) protection during debug. More...
 

Detailed Description

Hardware access layer for managing the Memory Protection Unit (MPU) peripheral.

Macro Definition Documentation

◆ NRF_MPU_PERIPHERAL_MASK_GET

#define NRF_MPU_PERIPHERAL_MASK_GET (   base_addr)    (1UL << NRFX_PERIPHERAL_ID_GET(base_addr))

Macro for getting MPU region configuration mask for the specified peripheral.

Parameters
[in]base_addrPeripheral base address.
Returns
MPU configuration mask for the specified peripheral.

Function Documentation

◆ nrf_mpu_nvm_blocks_protection_enable()

NRF_STATIC_INLINE void nrf_mpu_nvm_blocks_protection_enable ( NRF_MPU_Type *  p_reg,
uint8_t  group_idx,
uint32_t  block_mask 
)

Function for enabling protection for specified non-volatile memory blocks.

Blocks are arranged into groups of 32 blocks each. Each block size is 4 kB. Any attempt to write or erase a protected block will result in hard fault. The memory block protection can be disabled only by resetting the device.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]group_idxNon-volatile memory group containing memory blocks to protect.
[in]block_maskNon-volatile memory blocks to protect. Each bit in bitmask represents one memory block in the specified group.

◆ nrf_mpu_nvm_protection_in_debug_set()

NRF_STATIC_INLINE void nrf_mpu_nvm_protection_in_debug_set ( NRF_MPU_Type *  p_reg,
bool  enable 
)

Function for setting the non-volatile memory (NVM) protection during debug.

NVM protection during debug is disabled by default.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]enableTrue if NVM protection during debug is to be enabled, false otherwise.

◆ nrf_mpu_region0_peripherals_get()

NRF_STATIC_INLINE uint32_t nrf_mpu_region0_peripherals_get ( NRF_MPU_Type const *  p_reg)

Function for getting the bitmask that specifies peripherals configured in the memory region 0.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Bitmask representing peripherals configured in region 0.

◆ nrf_mpu_region0_peripherals_set()

NRF_STATIC_INLINE void nrf_mpu_region0_peripherals_set ( NRF_MPU_Type *  p_reg,
uint32_t  peripheral_mask 
)

Function for configuring specified peripherals in the memory region 0.

When the memory protection is enabled, the Memory Protection Unit enforces runtime protection and readback protection of resources classified as region 0. See the product specification for more information.

After reset, all peripherals are configured as not assigned to region 0.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]peripheral_maskMask that specifies peripherals to be configured in the memory region 0. Compose this mask using NRF_MPU_PERIPHERAL_MASK_GET macro.

◆ nrf_mpu_region0_ram_size_set()

NRF_STATIC_INLINE void nrf_mpu_region0_ram_size_set ( NRF_MPU_Type *  p_reg,
uint32_t  size 
)

Function for setting the size of the RAM region 0.

When memory protection is enabled, the Memory Protection Unit enforces runtime protection and readback protection of resources classified as region 0. See the product specification for more information.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]sizeSize of the RAM region 0, in bytes. Must be word-aligned.

Documentation feedback | Developer Zone | Subscribe | Updated