STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
Loading...
Searching...
No Matches

Memory Protection Unit. More...

Collaboration diagram for MPU:

Data Structures

struct  MpuRegisters_t
 MPU register block. More...

Macros

#define MPU_BASE   (0xE000ED90UL)
 MPU base address (System Control Space).
#define MPU   ((MpuRegisters_t *)MPU_BASE)
 The MPU instance.

Typedefs

typedef struct MpuRegisters_t MpuRegisters_t
 MPU register block.

TYPE - MPU type (0x00)

#define MPU_TYPE_SEPARATE_Pos   (0U)
 Bit 0.
#define MPU_TYPE_SEPARATE   ((uint32_t)1U << MPU_TYPE_SEPARATE_Pos)
  ro Separate instruction and data maps (0 on the Cortex-M4).
#define MPU_TYPE_DREGION_Pos   (8U)
 Bits 15:8.
#define MPU_TYPE_DREGION_Msk   ((uint32_t)0xFFU << MPU_TYPE_DREGION_Pos)
  ro Number of regions.

CTRL - control (0x04)

#define MPU_CTRL_ENABLE_Pos   (0U)
 Bit 0.
#define MPU_CTRL_ENABLE   ((uint32_t)1U << MPU_CTRL_ENABLE_Pos)
  rw Enable the MPU.
#define MPU_CTRL_HFNMIENA_Pos   (1U)
 Bit 1.
#define MPU_CTRL_HFNMIENA   ((uint32_t)1U << MPU_CTRL_HFNMIENA_Pos)
  rw Keep the MPU on in HardFault, NMI and FAULTMASK handlers.
#define MPU_CTRL_PRIVDEFENA_Pos   (2U)
 Bit 2.
#define MPU_CTRL_PRIVDEFENA   ((uint32_t)1U << MPU_CTRL_PRIVDEFENA_Pos)
  rw Privileged code may use the default memory map as a background region.

RNR - region number (0x08)

#define MPU_RNR_REGION_Pos   (0U)
 Bits 7:0.
#define MPU_RNR_REGION_Msk   ((uint32_t)0xFFU << MPU_RNR_REGION_Pos)
  rw Region that RBAR and RASR access.

RBAR - region base address (0x0C)

#define MPU_RBAR_REGION_Pos   (0U)
 Bits 3:0.
#define MPU_RBAR_REGION_Msk   ((uint32_t)0xFU << MPU_RBAR_REGION_Pos)
  rw Region number, used when VALID is set.
#define MPU_RBAR_VALID_Pos   (4U)
 Bit 4.
#define MPU_RBAR_VALID   ((uint32_t)1U << MPU_RBAR_VALID_Pos)
  wo Write REGION into RNR as part of this write.
#define MPU_RBAR_ADDR_Pos   (5U)
 Bits 31:5.
#define MPU_RBAR_ADDR_Msk   ((uint32_t)0x7FFFFFFU << MPU_RBAR_ADDR_Pos)
  rw Region base address, aligned to the region size.

RASR - region attribute and size (0x10)

Every field is rw.

#define MPU_RASR_ENABLE_Pos   (0U)
 Bit 0.
#define MPU_RASR_ENABLE   ((uint32_t)1U << MPU_RASR_ENABLE_Pos)
 Enable this region.
#define MPU_RASR_SIZE_Pos   (1U)
 Bits 5:1.
#define MPU_RASR_SIZE_Msk   ((uint32_t)0x1FU << MPU_RASR_SIZE_Pos)
 Region size: 2^(SIZE + 1) bytes, minimum 32.
#define MPU_RASR_SRD_Pos   (8U)
 Bits 15:8.
#define MPU_RASR_SRD_Msk   ((uint32_t)0xFFU << MPU_RASR_SRD_Pos)
 Subregion disable: one bit per eighth of the region.
#define MPU_RASR_B_Pos   (16U)
 Bit 16.
#define MPU_RASR_B   ((uint32_t)1U << MPU_RASR_B_Pos)
 Bufferable.
#define MPU_RASR_C_Pos   (17U)
 Bit 17.
#define MPU_RASR_C   ((uint32_t)1U << MPU_RASR_C_Pos)
 Cacheable.
#define MPU_RASR_S_Pos   (18U)
 Bit 18.
#define MPU_RASR_S   ((uint32_t)1U << MPU_RASR_S_Pos)
 Shareable.
#define MPU_RASR_TEX_Pos   (19U)
 Bits 21:19.
#define MPU_RASR_TEX_Msk   ((uint32_t)0x7U << MPU_RASR_TEX_Pos)
 Type extension.
#define MPU_RASR_AP_Pos   (24U)
 Bits 26:24.
#define MPU_RASR_AP_Msk   ((uint32_t)0x7U << MPU_RASR_AP_Pos)
 Access permission; values below.
#define MPU_RASR_XN_Pos   (28U)
 Bit 28.
#define MPU_RASR_XN   ((uint32_t)1U << MPU_RASR_XN_Pos)
 Execute never.

RASR.AP values

#define MPU_RASR_AP_NONE   (0x0U)
 No access.
#define MPU_RASR_AP_PRIV_RW   (0x1U)
 Privileged read/write only.
#define MPU_RASR_AP_PRIV_RW_UNPRIV_RO   (0x2U)
 Privileged read/write, unprivileged read.
#define MPU_RASR_AP_FULL_RW   (0x3U)
 Full read/write.
#define MPU_RASR_AP_PRIV_RO   (0x5U)
 Privileged read only.
#define MPU_RASR_AP_FULL_RO   (0x6U)
 Read only.

Detailed Description

Memory Protection Unit.

Macro Definition Documentation

◆ MPU_BASE

#define MPU_BASE   (0xE000ED90UL)

MPU base address (System Control Space).

Definition at line 19 of file mpu_reg.h.

◆ MPU

#define MPU   ((MpuRegisters_t *)MPU_BASE)

The MPU instance.

Definition at line 37 of file mpu_reg.h.

◆ MPU_TYPE_SEPARATE_Pos

#define MPU_TYPE_SEPARATE_Pos   (0U)

Bit 0.

Definition at line 41 of file mpu_reg.h.

◆ MPU_TYPE_SEPARATE

#define MPU_TYPE_SEPARATE   ((uint32_t)1U << MPU_TYPE_SEPARATE_Pos)

ro Separate instruction and data maps (0 on the Cortex-M4).

Definition at line 43 of file mpu_reg.h.

◆ MPU_TYPE_DREGION_Pos

#define MPU_TYPE_DREGION_Pos   (8U)

Bits 15:8.

Definition at line 44 of file mpu_reg.h.

◆ MPU_TYPE_DREGION_Msk

#define MPU_TYPE_DREGION_Msk   ((uint32_t)0xFFU << MPU_TYPE_DREGION_Pos)

ro Number of regions.

Definition at line 46 of file mpu_reg.h.

◆ MPU_CTRL_ENABLE_Pos

#define MPU_CTRL_ENABLE_Pos   (0U)

Bit 0.

Definition at line 51 of file mpu_reg.h.

◆ MPU_CTRL_ENABLE

#define MPU_CTRL_ENABLE   ((uint32_t)1U << MPU_CTRL_ENABLE_Pos)

rw Enable the MPU.

Definition at line 53 of file mpu_reg.h.

◆ MPU_CTRL_HFNMIENA_Pos

#define MPU_CTRL_HFNMIENA_Pos   (1U)

Bit 1.

Definition at line 54 of file mpu_reg.h.

◆ MPU_CTRL_HFNMIENA

#define MPU_CTRL_HFNMIENA   ((uint32_t)1U << MPU_CTRL_HFNMIENA_Pos)

rw Keep the MPU on in HardFault, NMI and FAULTMASK handlers.

Definition at line 56 of file mpu_reg.h.

◆ MPU_CTRL_PRIVDEFENA_Pos

#define MPU_CTRL_PRIVDEFENA_Pos   (2U)

Bit 2.

Definition at line 57 of file mpu_reg.h.

◆ MPU_CTRL_PRIVDEFENA

#define MPU_CTRL_PRIVDEFENA   ((uint32_t)1U << MPU_CTRL_PRIVDEFENA_Pos)

rw Privileged code may use the default memory map as a background region.

Definition at line 59 of file mpu_reg.h.

◆ MPU_RNR_REGION_Pos

#define MPU_RNR_REGION_Pos   (0U)

Bits 7:0.

Definition at line 64 of file mpu_reg.h.

◆ MPU_RNR_REGION_Msk

#define MPU_RNR_REGION_Msk   ((uint32_t)0xFFU << MPU_RNR_REGION_Pos)

rw Region that RBAR and RASR access.

Definition at line 66 of file mpu_reg.h.

◆ MPU_RBAR_REGION_Pos

#define MPU_RBAR_REGION_Pos   (0U)

Bits 3:0.

Definition at line 71 of file mpu_reg.h.

◆ MPU_RBAR_REGION_Msk

#define MPU_RBAR_REGION_Msk   ((uint32_t)0xFU << MPU_RBAR_REGION_Pos)

rw Region number, used when VALID is set.

Definition at line 73 of file mpu_reg.h.

◆ MPU_RBAR_VALID_Pos

#define MPU_RBAR_VALID_Pos   (4U)

Bit 4.

Definition at line 74 of file mpu_reg.h.

◆ MPU_RBAR_VALID

#define MPU_RBAR_VALID   ((uint32_t)1U << MPU_RBAR_VALID_Pos)

wo Write REGION into RNR as part of this write.

Definition at line 76 of file mpu_reg.h.

◆ MPU_RBAR_ADDR_Pos

#define MPU_RBAR_ADDR_Pos   (5U)

Bits 31:5.

Definition at line 77 of file mpu_reg.h.

◆ MPU_RBAR_ADDR_Msk

#define MPU_RBAR_ADDR_Msk   ((uint32_t)0x7FFFFFFU << MPU_RBAR_ADDR_Pos)

rw Region base address, aligned to the region size.

Definition at line 79 of file mpu_reg.h.

◆ MPU_RASR_ENABLE_Pos

#define MPU_RASR_ENABLE_Pos   (0U)

Bit 0.

Definition at line 85 of file mpu_reg.h.

◆ MPU_RASR_ENABLE

#define MPU_RASR_ENABLE   ((uint32_t)1U << MPU_RASR_ENABLE_Pos)

Enable this region.

Definition at line 86 of file mpu_reg.h.

◆ MPU_RASR_SIZE_Pos

#define MPU_RASR_SIZE_Pos   (1U)

Bits 5:1.

Definition at line 87 of file mpu_reg.h.

◆ MPU_RASR_SIZE_Msk

#define MPU_RASR_SIZE_Msk   ((uint32_t)0x1FU << MPU_RASR_SIZE_Pos)

Region size: 2^(SIZE + 1) bytes, minimum 32.

Definition at line 89 of file mpu_reg.h.

◆ MPU_RASR_SRD_Pos

#define MPU_RASR_SRD_Pos   (8U)

Bits 15:8.

Definition at line 90 of file mpu_reg.h.

◆ MPU_RASR_SRD_Msk

#define MPU_RASR_SRD_Msk   ((uint32_t)0xFFU << MPU_RASR_SRD_Pos)

Subregion disable: one bit per eighth of the region.

Definition at line 92 of file mpu_reg.h.

◆ MPU_RASR_B_Pos

#define MPU_RASR_B_Pos   (16U)

Bit 16.

Definition at line 93 of file mpu_reg.h.

◆ MPU_RASR_B

#define MPU_RASR_B   ((uint32_t)1U << MPU_RASR_B_Pos)

Bufferable.

Definition at line 94 of file mpu_reg.h.

◆ MPU_RASR_C_Pos

#define MPU_RASR_C_Pos   (17U)

Bit 17.

Definition at line 95 of file mpu_reg.h.

◆ MPU_RASR_C

#define MPU_RASR_C   ((uint32_t)1U << MPU_RASR_C_Pos)

Cacheable.

Definition at line 96 of file mpu_reg.h.

◆ MPU_RASR_S_Pos

#define MPU_RASR_S_Pos   (18U)

Bit 18.

Definition at line 97 of file mpu_reg.h.

◆ MPU_RASR_S

#define MPU_RASR_S   ((uint32_t)1U << MPU_RASR_S_Pos)

Shareable.

Definition at line 98 of file mpu_reg.h.

◆ MPU_RASR_TEX_Pos

#define MPU_RASR_TEX_Pos   (19U)

Bits 21:19.

Definition at line 99 of file mpu_reg.h.

◆ MPU_RASR_TEX_Msk

#define MPU_RASR_TEX_Msk   ((uint32_t)0x7U << MPU_RASR_TEX_Pos)

Type extension.

Definition at line 100 of file mpu_reg.h.

◆ MPU_RASR_AP_Pos

#define MPU_RASR_AP_Pos   (24U)

Bits 26:24.

Definition at line 101 of file mpu_reg.h.

◆ MPU_RASR_AP_Msk

#define MPU_RASR_AP_Msk   ((uint32_t)0x7U << MPU_RASR_AP_Pos)

Access permission; values below.

Definition at line 102 of file mpu_reg.h.

◆ MPU_RASR_XN_Pos

#define MPU_RASR_XN_Pos   (28U)

Bit 28.

Definition at line 103 of file mpu_reg.h.

◆ MPU_RASR_XN

#define MPU_RASR_XN   ((uint32_t)1U << MPU_RASR_XN_Pos)

Execute never.

Definition at line 104 of file mpu_reg.h.

◆ MPU_RASR_AP_NONE

#define MPU_RASR_AP_NONE   (0x0U)

No access.

Definition at line 109 of file mpu_reg.h.

◆ MPU_RASR_AP_PRIV_RW

#define MPU_RASR_AP_PRIV_RW   (0x1U)

Privileged read/write only.

Definition at line 110 of file mpu_reg.h.

◆ MPU_RASR_AP_PRIV_RW_UNPRIV_RO

#define MPU_RASR_AP_PRIV_RW_UNPRIV_RO   (0x2U)

Privileged read/write, unprivileged read.

Definition at line 111 of file mpu_reg.h.

◆ MPU_RASR_AP_FULL_RW

#define MPU_RASR_AP_FULL_RW   (0x3U)

Full read/write.

Definition at line 112 of file mpu_reg.h.

◆ MPU_RASR_AP_PRIV_RO

#define MPU_RASR_AP_PRIV_RO   (0x5U)

Privileged read only.

Definition at line 113 of file mpu_reg.h.

◆ MPU_RASR_AP_FULL_RO

#define MPU_RASR_AP_FULL_RO   (0x6U)

Read only.

Definition at line 114 of file mpu_reg.h.