Eliminate a warning due to a range check on an undefined pre-processar variable

This commit is contained in:
Gregory Nutt 2015-12-22 13:20:03 -06:00
parent 3e4fb7a60d
commit 663d2b0127
2 changed files with 41 additions and 35 deletions

View File

@ -1,4 +1,4 @@
/************************************************************************************ /*****************************************************************************
* arch/arm/src/armv7-m/mpu.h * arch/arm/src/armv7-m/mpu.h
* *
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * 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 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
************************************************************************************/ ****************************************************************************/
#ifndef __ARCH_ARM_SRC_ARMV7M_MPU_H #ifndef __ARCH_ARM_SRC_ARMV7M_MPU_H
#define __ARCH_ARM_SRC_ARMV7M_MPU_H #define __ARCH_ARM_SRC_ARMV7M_MPU_H
/************************************************************************************ /****************************************************************************
* Included Files * Included Files
************************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
@ -46,14 +46,15 @@
# include <sys/types.h> # include <sys/types.h>
# include <stdint.h> # include <stdint.h>
# include <stdbool.h> # include <stdbool.h>
# include <assert.h>
# include <debug.h> # include <debug.h>
# include "up_arch.h" # include "up_arch.h"
#endif #endif
/************************************************************************************ /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
************************************************************************************/ ****************************************************************************/
/* MPU Register Addresses */ /* MPU Register Addresses */
@ -86,14 +87,16 @@
/* MPU Region Number Register Bit Definitions */ /* MPU Region Number Register Bit Definitions */
#if CONFIG_ARM_MPU_NREGIONS <= 8 #if defined(CONFIG_ARM_MPU_NREGIONS)
# define MPU_RNR_MASK (0x00000007) # if CONFIG_ARM_MPU_NREGIONS <= 8
#elif CONFIG_ARM_MPU_NREGIONS <= 16 # define MPU_RNR_MASK (0x00000007)
# define MPU_RNR_MASK (0x0000000f) # elif CONFIG_ARM_MPU_NREGIONS <= 16
#elif CONFIG_ARM_MPU_NREGIONS <= 32 # define MPU_RNR_MASK (0x0000000f)
# define MPU_RNR_MASK (0x0000001f) # elif CONFIG_ARM_MPU_NREGIONS <= 32
#else # define MPU_RNR_MASK (0x0000001f)
# error "FIXME: Unsupported number of MPU regions" # else
# error "FIXME: Unsupported number of MPU regions"
# endif
#endif #endif
/* MPU Region Base Address Register Bit Definitions */ /* 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_AP_RORO (6 << MPU_RASR_AP_SHIFT) /* P:RO U:RO */
# define MPU_RASR_XN (1 << 28) /* Bit 28: Instruction access disable */ # define MPU_RASR_XN (1 << 28) /* Bit 28: Instruction access disable */
/************************************************************************************ /****************************************************************************
* Public Function Prototypes * Public Function Prototypes
************************************************************************************/ ****************************************************************************/
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#undef EXTERN #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); uint32_t mpu_subregion(uintptr_t base, size_t size, uint8_t l2size);
/************************************************************************************ /****************************************************************************
* Inline Functions * Inline Functions
************************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: mpu_showtype * Name: mpu_showtype
@ -255,6 +258,7 @@ static inline void mpu_control(bool enable, bool hfnmiena, bool privdefena)
putreg32(regval, MPU_CTRL); putreg32(regval, MPU_CTRL);
} }
/**************************************************************************** /****************************************************************************
* Name: mpu_priv_stronglyordered * Name: mpu_priv_stronglyordered
* *

View File

@ -1,4 +1,4 @@
/************************************************************************************ /****************************************************************************
* arch/arm/src/armv7-r/mpu.h * arch/arm/src/armv7-r/mpu.h
* *
* Copyright (C) 2015 Gregory Nutt. All rights reserved. * 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 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
************************************************************************************/ ****************************************************************************/
#ifndef __ARCH_ARM_SRC_ARMV7R_MPU_H #ifndef __ARCH_ARM_SRC_ARMV7R_MPU_H
#define __ARCH_ARM_SRC_ARMV7R_MPU_H #define __ARCH_ARM_SRC_ARMV7R_MPU_H
/************************************************************************************ /****************************************************************************
* Included Files * Included Files
************************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
@ -52,9 +52,9 @@
# include "cp15.h" # include "cp15.h"
#endif #endif
/************************************************************************************ /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
************************************************************************************/ ****************************************************************************/
/* MPU Type Register Bit Definitions */ /* MPU Type Register Bit Definitions */
@ -106,19 +106,21 @@
/* MPU Region Number Register */ /* MPU Region Number Register */
#if CONFIG_ARM_MPU_NREGIONS <= 8 #if defined(CONFIG_ARM_MPU_NREGIONS)
# define MPU_RGNR_MASK (0x00000007) # if CONFIG_ARM_MPU_NREGIONS <= 8
#elif CONFIG_ARM_MPU_NREGIONS <= 16 # define MPU_RGNR_MASK (0x00000007)
# define MPU_RGNR_MASK (0x0000000f) # elif CONFIG_ARM_MPU_NREGIONS <= 16
#elif CONFIG_ARM_MPU_NREGIONS <= 32 # define MPU_RGNR_MASK (0x0000000f)
# define MPU_RGNR_MASK (0x0000001f) # elif CONFIG_ARM_MPU_NREGIONS <= 32
#else # define MPU_RGNR_MASK (0x0000001f)
# else
# error "FIXME: Unsupported number of MPU regions" # error "FIXME: Unsupported number of MPU regions"
# endif
#endif #endif
/************************************************************************************ /****************************************************************************
* Public Function Prototypes * Public Function Prototypes
************************************************************************************/ ****************************************************************************/
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#undef EXTERN #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); uint32_t mpu_subregion(uintptr_t base, size_t size, uint8_t l2size);
/************************************************************************************ /****************************************************************************
* Inline Functions * Inline Functions
************************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: mpu_get_mpuir * Name: mpu_get_mpuir