MPC HAL

group nrf_mpc_hal

Hardware access layer for managing the Memory Privilege Controller (MPC) peripheral.

Defines

NRF_MPC_HAS_RTCHOKE

Symbol indicating whether RTCHOKE functionality is present.

NRF_MPC_HAS_SECDOM

Symbol indicating whether SECDOM functionality is present.

NRF_MPC_HAS_OVERRIDE_OFFSET

Symbol indicating whether OVERRIDE OFFSET functionality is present.

NRF_MPC_REGION_COUNT

Number of regions.

NRF_MPC_OVERRIDE_COUNT

Number of override regions.

NRF_MPC_MASTER_PORTS_COUNT

Number of master ports.

NRF_MPC_RTCHOKE_COUNT

Number of Real Time Choke slaves.

Enums

enum nrf_mpc_event_t

MPC events.

Values:

enumerator NRF_MPC_EVENT_MEMACCERR

Memory access error.

enum nrf_mpc_int_mask_t

MPC interrupts.

Values:

enumerator NRF_MPC_INT_MEMACCERR_MASK

Interrupt on MEMACCERR event.

enum nrf_mpc_errorsource_t

Error sources.

Values:

enumerator NRF_MPC_ERRORSOURCE_SLAVE

Error was triggered by an AXI slave.

enumerator NRF_MPC_ERRORSOURCE_MPC

Error was triggered by MCP module.

enum nrf_mpc_permission_mask_t

Permissions mask.

Note

This enum may be used for both permission settings and permission settings mask.

Values:

enumerator NRF_MPC_PERM_READ_MASK

Read access.

enumerator NRF_MPC_PERM_WRITE_MASK

Write access.

enumerator NRF_MPC_PERM_EXECUTE_MASK

Software execute.

enumerator NRF_MPC_PERM_SECURE_MASK

Security mapping.

enum nrf_mpc_masterport_mask_t

Masterport mask.

Values:

enumerator NRF_MPC_MASTERPORT_0_MASK

Enable master port 0.

enumerator NRF_MPC_MASTERPORT_1_MASK

Enable master port 1.

enumerator NRF_MPC_MASTERPORT_2_MASK

Enable master port 2.

enumerator NRF_MPC_MASTERPORT_3_MASK

Enable master port 3.

enumerator NRF_MPC_MASTERPORT_4_MASK

Enable master port 4.

enumerator NRF_MPC_MASTERPORT_5_MASK

Enable master port 5.

enumerator NRF_MPC_MASTERPORT_6_MASK

Enable master port 6.

enumerator NRF_MPC_MASTERPORT_7_MASK

Enable master port 7.

enumerator NRF_MPC_MASTERPORT_8_MASK

Enable master port 8.

enumerator NRF_MPC_MASTERPORT_9_MASK

Enable master port 9.

enumerator NRF_MPC_MASTERPORT_10_MASK

Enable master port 10.

enumerator NRF_MPC_MASTERPORT_11_MASK

Enable master port 11.

enumerator NRF_MPC_MASTERPORT_12_MASK

Enable master port 12.

enumerator NRF_MPC_MASTERPORT_13_MASK

Enable master port 13.

enumerator NRF_MPC_MASTERPORT_14_MASK

Enable master port 14.

Functions

NRF_STATIC_INLINE bool nrf_mpc_event_check(NRF_MPC_Type const *p_reg, nrf_mpc_event_t event)

Function for retrieving the state of the specified MPC event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event to be checked.

Return values:
  • true – The event has been generated.

  • false – The event has not been generated.

NRF_STATIC_INLINE void nrf_mpc_event_clear(NRF_MPC_Type *p_reg, nrf_mpc_event_t event)

Function for clearing the specified MPC event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event to be cleared.

NRF_STATIC_INLINE uint32_t nrf_mpc_event_address_get(NRF_MPC_Type const *p_reg, nrf_mpc_event_t event)

Function for getting the address of the specified MPC event register.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event to get the address of.

Returns:

Address of the specified event register.

NRF_STATIC_INLINE void nrf_mpc_int_enable(NRF_MPC_Type *p_reg, uint32_t mask)

Function for enabling the specified interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be enabled. Use nrf_mpc_int_mask_t values for bit masking.

NRF_STATIC_INLINE uint32_t nrf_mpc_int_enable_check(NRF_MPC_Type const *p_reg, uint32_t mask)

Function for checking if the specified interrupts are enabled.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be checked. Use nrf_mpc_int_mask_t values for bit masking.

Returns:

Mask of enabled interrupts.

NRF_STATIC_INLINE void nrf_mpc_int_disable(NRF_MPC_Type *p_reg, uint32_t mask)

Function for disabling the specified interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be disabled. Use nrf_mpc_int_mask_t values for bit masking.

NRF_STATIC_INLINE void nrf_mpc_region_config_set(NRF_MPC_Type *p_reg, uint8_t index, nrf_mpc_region_config_t const *p_config)

Function for setting configuration of the region.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Region index.

  • p_config[in] Pointer to the structure of the region configuration parameters.

NRF_STATIC_INLINE nrf_mpc_region_config_t nrf_mpc_region_config_get(NRF_MPC_Type const *p_reg, uint8_t index)

Function for getting configuration of the region.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Region index.

Returns:

Structure with configuration of the region.

NRF_STATIC_INLINE void nrf_mpc_region_startaddr_set(NRF_MPC_Type *p_reg, uint8_t index, uint32_t address)

Function for setting start address of the region.

Note

Address must be on a 4kB memory boundary.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Region index.

  • address[in] Address to be set.

NRF_STATIC_INLINE uint32_t nrf_mpc_region_startaddr_get(NRF_MPC_Type const *p_reg, uint8_t index)

Function for getting start address of the region.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Region index.

Returns:

Start address of the region.

NRF_STATIC_INLINE void nrf_mpc_region_addrmask_set(NRF_MPC_Type *p_reg, uint8_t index, uint32_t address)

Function for setting address mask of the region.

Note

Mask must be on a 4kB memory boundary.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Region index.

  • address[in] Address to be set.

NRF_STATIC_INLINE uint32_t nrf_mpc_region_addrmask_get(NRF_MPC_Type const *p_reg, uint8_t index)

Function for getting address mask of the region.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Region index.

Returns:

Address mask of the region.

NRF_STATIC_INLINE void nrf_mpc_region_masterport_set(NRF_MPC_Type *p_reg, uint8_t index, uint32_t mask)

Function for enabling the specified master ports of the region.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Region index.

  • mask[in] Mask of master ports to be enabled, constructed from nrf_mpc_masterport_mask_t enumerator values.

NRF_STATIC_INLINE uint32_t nrf_mpc_region_masterport_get(NRF_MPC_Type const *p_reg, uint8_t index)

Function for getting enabled master ports of the region.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Region index.

Returns:

Mask of enabled master ports, constructed from nrf_mpc_masterport_mask_t enumerator values.

NRF_STATIC_INLINE void nrf_mpc_override_config_set(NRF_MPC_Type *p_reg, uint8_t index, nrf_mpc_override_config_t const *p_config)

Function for setting configuration of the override region.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Override region index.

  • p_config[in] Pointer to the structure of the override region configuration parameters.

NRF_STATIC_INLINE nrf_mpc_override_config_t nrf_mpc_override_config_get(NRF_MPC_Type const *p_reg, uint8_t index)

Function for getting configuration of the override region.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Override region index.

Returns:

Structure with configuration of the override region.

NRF_STATIC_INLINE void nrf_mpc_override_startaddr_set(NRF_MPC_Type *p_reg, uint8_t index, uint32_t address)

Function for setting start address of the override region.

Note

Address must be on a 4kB memory boundary.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Override region index.

  • address[in] Address to be set.

NRF_STATIC_INLINE uint32_t nrf_mpc_override_startaddr_get(NRF_MPC_Type const *p_reg, uint8_t index)

Function for getting start address of the override region.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Override region index.

Returns:

Start address of the override region.

NRF_STATIC_INLINE void nrf_mpc_override_endaddr_set(NRF_MPC_Type *p_reg, uint8_t index, uint32_t address)

Function for setting end address of the override region.

Note

Address must be on a 4kB memory boundary.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Override region index.

  • address[in] Address to be set.

NRF_STATIC_INLINE uint32_t nrf_mpc_override_endaddr_get(NRF_MPC_Type const *p_reg, uint8_t index)

Function for getting end address of the override region.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Override region index.

Returns:

End address of the override region.

NRF_STATIC_INLINE void nrf_mpc_override_offset_set(NRF_MPC_Type *p_reg, uint8_t index, uint32_t offset)

Function for setting offset of the override region.

Note

Offset will be left shifted before applying, creating a 33-bit signed integer.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Override region index.

  • offset[in] Address offset value divided by 2.

NRF_STATIC_INLINE uint32_t nrf_mpc_override_offset_get(NRF_MPC_Type const *p_reg, uint8_t index)

Function for getting offset of the override region.

Note

Offset is left shifted before applying, creating a 33-bit signed integer.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Override region index.

Returns:

Address offset value divided by 2.

NRF_STATIC_INLINE void nrf_mpc_override_perm_set(NRF_MPC_Type *p_reg, uint8_t index, uint32_t permissions)

Function for setting permission settings for the override region.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Override region index.

  • permissions[in] Mask of permissions to be set, constructed from nrf_mpc_permission_mask_t enumerator values.

NRF_STATIC_INLINE uint32_t nrf_mpc_override_perm_get(NRF_MPC_Type const *p_reg, uint8_t index)

Function for getting permission settings of the override region.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Override region index.

Returns:

Mask of permissions, constructed from nrf_mpc_permission_mask_t enumerator values.

NRF_STATIC_INLINE void nrf_mpc_override_permmask_set(NRF_MPC_Type *p_reg, uint8_t index, uint32_t permissions)

Function for setting permission settings mask for the override region.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Override region index.

  • permissions[in] Mask of permissions settings mask to be set, constructed from nrf_mpc_permission_mask_t enumerator values.

NRF_STATIC_INLINE uint32_t nrf_mpc_override_permmask_get(NRF_MPC_Type const *p_reg, uint8_t index)

Function for getting permission settings mask of the override region.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Override region index.

Returns:

Mask of permissions settings mask, constructed from nrf_mpc_permission_mask_t enumerator values.

NRF_STATIC_INLINE void nrf_mpc_override_ownerid_set(NRF_MPC_Type *p_reg, uint8_t index, nrf_owner_t owner_id)

Function for setting owner ID for the override region.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Override region index.

  • owner_id[in] Owner ID to be set.

NRF_STATIC_INLINE nrf_owner_t nrf_mpc_override_ownerid_get(NRF_MPC_Type *p_reg, uint8_t index)

Function for getting owner ID of the override region.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Override region index.

Returns:

Owner ID of the overridde region.

NRF_STATIC_INLINE void nrf_mpc_override_masterport_set(NRF_MPC_Type *p_reg, uint8_t index, uint32_t mask)

Function for enabling the specified master ports of the override region.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Override region index.

  • mask[in] Mask of master ports to be enabled, constructed from nrf_mpc_masterport_mask_t enumerator values.

NRF_STATIC_INLINE uint32_t nrf_mpc_override_masterport_get(NRF_MPC_Type const *p_reg, uint8_t index)

Function for getting enabled master ports of the override region.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • index[in] Override region index.

Returns:

Mask of enabled master ports, constructed from nrf_mpc_masterport_mask_t enumerator values.

NRF_STATIC_INLINE uint32_t nrf_mpc_memaccerr_address_get(NRF_MPC_Type const *p_reg)

Function for getting the memory address of memory access error.

Note

Register content will not be changed as long as MEMACCERR event is active.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Target address for the errroneous access.

NRF_STATIC_INLINE nrf_owner_t nrf_mpc_memaccerr_info_ownerid_get(NRF_MPC_Type const *p_reg)

Function for getting the owner identifier of the transaction that triggered memory access error.

Note

Register content will not be changed as long as MEMACCERR event is active.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Owner identifier of the errorneous access.

NRF_STATIC_INLINE uint8_t nrf_mpc_memaccerr_info_masterport_get(NRF_MPC_Type const *p_reg)

Function for getting the master port of the transaction that triggered memory access error.

Note

Register content will not be changed as long as MEMACCERR event is active.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Master port where errorneous access is detected.

NRF_STATIC_INLINE uint32_t nrf_mpc_memaccerr_info_perm_get(NRF_MPC_Type const *p_reg)

Function for getting the permissions of the transaction that triggered memory access error.

Note

Register content will not be changed as long as MEMACCERR event is active.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Permission settings of the errorneous access.

NRF_STATIC_INLINE nrf_mpc_errorsource_t nrf_mpc_memaccerr_info_errorsource_get(NRF_MPC_Type const *p_reg)

Function for getting the source of the transaction that triggered memory access error.

Note

Register content will not be changed as long as MEMACCERR event is active.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Source of the errorneous access.

NRF_STATIC_INLINE void nrf_mpc_globalslave_masterport_set(NRF_MPC_Type *p_reg, uint32_t mask)

Function for enabling the specified master ports connection to global slave.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of master ports to be connected, constructed from nrf_mpc_masterport_mask_t enumerator values.

NRF_STATIC_INLINE uint32_t nrf_mpc_globalslave_masterport_get(NRF_MPC_Type const *p_reg)

Function for getting enabled master ports connection to global slave.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Mask of master ports connected, constructed from nrf_mpc_masterport_mask_t enumerator values.

NRF_STATIC_INLINE void nrf_mpc_globalslave_lock_enable(NRF_MPC_Type *p_reg)

Function for enabling the global slave registers lock.

Note

When global slave registers is enabled, modifying the global slave configuration is not possible.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

NRF_STATIC_INLINE bool nrf_mpc_globalslave_lock_check(NRF_MPC_Type const *p_reg)

Function for getting the status of the global slave registers lock.

Note

When global slave registers is enabled, modifying the global slave configuration is not possible.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

True if global slave registers are locked, false otherwise.

NRF_STATIC_INLINE void nrf_mpc_rtchoke_writeaccess_set(NRF_MPC_Type *p_reg, uint32_t mask)

Function for enabling the AXI Write Address Channel Real Time Choke for specified master ports.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of master ports to have the Write Real Time Choke enabled, constructed from nrf_mpc_masterport_mask_t enumerator values.

NRF_STATIC_INLINE uint32_t nrf_mpc_rtchoke_writeaccess_get(NRF_MPC_Type const *p_reg)

Function for getting master ports with enabled AXI Write Address Channel Real Time Choke.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Mask of master ports with the Write Real Time Choke enabled, constructed from nrf_mpc_masterport_mask_t enumerator values.

NRF_STATIC_INLINE void nrf_mpc_rtchoke_readaccess_set(NRF_MPC_Type *p_reg, uint32_t mask)

Function for enabling the AXI Read Address Channel Real Time Choke for specified master ports.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of master ports to have the Read Real Time Choke enabled, constructed from nrf_mpc_masterport_mask_t enumerator values.

NRF_STATIC_INLINE uint32_t nrf_mpc_rtchoke_readaccess_get(NRF_MPC_Type const *p_reg)

Function for getting master ports with enabled AXI Read Address Channel Real Time Choke.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Mask of master ports with the Read Real Time Choke enabled, constructed from nrf_mpc_masterport_mask_t enumerator values.

NRF_STATIC_INLINE void nrf_mpc_rtchoke_delay_set(NRF_MPC_Type *p_reg, uint8_t slave, uint8_t delay)

Function for setting the Real Time Choke delay for the specified slave.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • slave[in] Slave number.

  • delay[in] Delay value to be set.

NRF_STATIC_INLINE uint8_t nrf_mpc_rtchoke_delay_get(NRF_MPC_Type const *p_reg, uint8_t slave)

Function for getting the Real Time Choke delay for the specified slave.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • slave[in] Slave number.

Returns:

Delay value for slave.

struct nrf_mpc_region_config_t
#include <nrf_mpc.h>

Region configuration.

Public Members

uint8_t slave_number

Target slave number.

bool lock

Lock region until next reset.

bool enable

Enable region.

nrf_owner_t owner

Owner identifier.

uint32_t permissions

Permissions.

struct nrf_mpc_override_config_t
#include <nrf_mpc.h>

Override region configuration.

Public Members

uint8_t slave_number

Target slave number.

bool lock

Lock region until next reset.

bool enable

Enable region.

bool secdom_enable

Enable overriding of secure domain permissions.

bool secure_mask

Secure mask. Read only. If set, the bit 28 of the transaction is ignored while address matching.