Skip to content

Commit

Permalink
arch: arm: use CMSIS defines for MPU_RBAR register bit setting
Browse files Browse the repository at this point in the history
This commit removes the macro definitions for MPU_RBAR register
bitmasks, defined in arm_mpu.h, and modifies the MPU driver to
directly use the equivalent macros defined in ARM CMSIS.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
  • Loading branch information
ioannisg authored and MaureenHelm committed Jun 19, 2018
1 parent 0a41e23 commit 8d52c17
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
6 changes: 3 additions & 3 deletions arch/arm/core/cortex_m/mpu/arm_mpu.c
Expand Up @@ -110,8 +110,8 @@ static void _region_init(u32_t index, u32_t region_addr,
/* Select the region you want to access */
ARM_MPU_DEV->rnr = index;
/* Configure the region */
ARM_MPU_DEV->rbar = (region_addr & REGION_BASE_ADDR_MASK)
| REGION_VALID | index;
ARM_MPU_DEV->rbar = (region_addr & MPU_RBAR_ADDR_Msk)
| MPU_RBAR_VALID_Msk | index;
ARM_MPU_DEV->rasr = region_attr | REGION_ENABLE;
SYS_LOG_DBG("[%d] 0x%08x 0x%08x", index, region_addr, region_attr);
}
Expand Down Expand Up @@ -200,7 +200,7 @@ static inline int _is_in_region(u32_t r_index, u32_t start, u32_t size)
u32_t r_addr_end;

ARM_MPU_DEV->rnr = r_index;
r_addr_start = ARM_MPU_DEV->rbar & REGION_BASE_ADDR_MASK;
r_addr_start = ARM_MPU_DEV->rbar & MPU_RBAR_ADDR_Msk;
r_size_lshift = ((ARM_MPU_DEV->rasr & REGION_SIZE_MASK) >>
REGION_SIZE_OFFSET) + 1;
r_addr_end = r_addr_start + (1 << r_size_lshift) - 1;
Expand Down
5 changes: 0 additions & 5 deletions include/arch/arm/cortex_m/mpu/arm_mpu.h
Expand Up @@ -35,11 +35,6 @@ struct arm_mpu {

#define ARM_MPU_BASE 0xE000ED90

#define REGION_VALID (1 << 4)
/* ARM MPU RBAR Register */
/* Region base address mask */
#define REGION_BASE_ADDR_MASK 0xFFFFFFE0

/* ARM MPU RASR Register */
/* Region enable bit offset */
#define REGION_ENABLE_OFFSET (0)
Expand Down

0 comments on commit 8d52c17

Please sign in to comment.