diff --git a/arch/arm/src/armv7-m/mpu.h b/arch/arm/src/armv7-m/mpu.h index 2e3770ffb67..310c21a9091 100644 --- a/arch/arm/src/armv7-m/mpu.h +++ b/arch/arm/src/armv7-m/mpu.h @@ -1,4 +1,4 @@ -/************************************************************************************ +/***************************************************************************** * arch/arm/src/armv7-m/mpu.h * * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. @@ -31,14 +31,14 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ #ifndef __ARCH_ARM_SRC_ARMV7M_MPU_H #define __ARCH_ARM_SRC_ARMV7M_MPU_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -46,14 +46,15 @@ # include # include # include +# include # include # include "up_arch.h" #endif -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ /* MPU Register Addresses */ @@ -86,14 +87,16 @@ /* MPU Region Number Register Bit Definitions */ -#if CONFIG_ARM_MPU_NREGIONS <= 8 -# define MPU_RNR_MASK (0x00000007) -#elif CONFIG_ARM_MPU_NREGIONS <= 16 -# define MPU_RNR_MASK (0x0000000f) -#elif CONFIG_ARM_MPU_NREGIONS <= 32 -# define MPU_RNR_MASK (0x0000001f) -#else -# error "FIXME: Unsupported number of MPU regions" +#if defined(CONFIG_ARM_MPU_NREGIONS) +# if CONFIG_ARM_MPU_NREGIONS <= 8 +# define MPU_RNR_MASK (0x00000007) +# elif CONFIG_ARM_MPU_NREGIONS <= 16 +# define MPU_RNR_MASK (0x0000000f) +# elif CONFIG_ARM_MPU_NREGIONS <= 32 +# define MPU_RNR_MASK (0x0000001f) +# else +# error "FIXME: Unsupported number of MPU regions" +# endif #endif /* MPU Region Base Address Register Bit Definitions */ @@ -136,9 +139,9 @@ # define MPU_RASR_AP_RORO (6 << MPU_RASR_AP_SHIFT) /* P:RO U:RO */ # define MPU_RASR_XN (1 << 28) /* Bit 28: Instruction access disable */ -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN @@ -202,9 +205,9 @@ uint8_t mpu_log2regionfloor(size_t size); uint32_t mpu_subregion(uintptr_t base, size_t size, uint8_t l2size); -/************************************************************************************ +/**************************************************************************** * Inline Functions - ************************************************************************************/ + ****************************************************************************/ /**************************************************************************** * Name: mpu_showtype @@ -255,6 +258,7 @@ static inline void mpu_control(bool enable, bool hfnmiena, bool privdefena) putreg32(regval, MPU_CTRL); } + /**************************************************************************** * Name: mpu_priv_stronglyordered * diff --git a/arch/arm/src/armv7-r/mpu.h b/arch/arm/src/armv7-r/mpu.h index 4cd962b9f73..67aeb2e94a2 100644 --- a/arch/arm/src/armv7-r/mpu.h +++ b/arch/arm/src/armv7-r/mpu.h @@ -1,4 +1,4 @@ -/************************************************************************************ +/**************************************************************************** * arch/arm/src/armv7-r/mpu.h * * Copyright (C) 2015 Gregory Nutt. All rights reserved. @@ -31,14 +31,14 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ #ifndef __ARCH_ARM_SRC_ARMV7R_MPU_H #define __ARCH_ARM_SRC_ARMV7R_MPU_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -52,9 +52,9 @@ # include "cp15.h" #endif -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ /* MPU Type Register Bit Definitions */ @@ -106,19 +106,21 @@ /* MPU Region Number Register */ -#if CONFIG_ARM_MPU_NREGIONS <= 8 -# define MPU_RGNR_MASK (0x00000007) -#elif CONFIG_ARM_MPU_NREGIONS <= 16 -# define MPU_RGNR_MASK (0x0000000f) -#elif CONFIG_ARM_MPU_NREGIONS <= 32 -# define MPU_RGNR_MASK (0x0000001f) -#else +#if defined(CONFIG_ARM_MPU_NREGIONS) +# if CONFIG_ARM_MPU_NREGIONS <= 8 +# define MPU_RGNR_MASK (0x00000007) +# elif CONFIG_ARM_MPU_NREGIONS <= 16 +# define MPU_RGNR_MASK (0x0000000f) +# elif CONFIG_ARM_MPU_NREGIONS <= 32 +# define MPU_RGNR_MASK (0x0000001f) +# else # error "FIXME: Unsupported number of MPU regions" +# endif #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN @@ -182,9 +184,9 @@ uint8_t mpu_log2regionfloor(size_t size); uint32_t mpu_subregion(uintptr_t base, size_t size, uint8_t l2size); -/************************************************************************************ +/**************************************************************************** * Inline Functions - ************************************************************************************/ + ****************************************************************************/ /**************************************************************************** * Name: mpu_get_mpuir