Skip to content

Commit 643084d

Browse files
Bradley Bolennashif
authored andcommitted
arch: arm: core: aarch32: Use cmsis functions
These functions help the code to be more self-documenting. Use them to make the code's intent clearer. Signed-off-by: Bradley Bolen <[email protected]>
1 parent 4704f59 commit 643084d

File tree

2 files changed

+12
-12
lines changed
  • arch/arm/core/aarch32/mpu
  • include/arch/arm/aarch32/cortex_a_r

2 files changed

+12
-12
lines changed

arch/arm/core/aarch32/mpu/arm_mpu.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,12 @@ void arm_core_mpu_enable(void)
146146
{
147147
uint32_t val;
148148

149-
__asm__ volatile ("mrc p15, 0, %0, c1, c0, 0" : "=r" (val) ::);
150-
val |= SCTRL_MPU_ENABLE;
149+
val = __get_SCTLR();
150+
val |= SCTLR_MPU_ENABLE;
151151
/* Make sure that all the registers are set before proceeding */
152-
__asm__ volatile ("dsb");
153-
__asm__ volatile ("mcr p15, 0, %0, c1, c0, 0" :: "r" (val) :);
154-
__asm__ volatile ("isb");
152+
__DSB();
153+
__set_SCTLR(val);
154+
__ISB();
155155
}
156156

157157
/**
@@ -161,12 +161,12 @@ void arm_core_mpu_disable(void)
161161
{
162162
uint32_t val;
163163

164-
__asm__ volatile ("mrc p15, 0, %0, c1, c0, 0" : "=r" (val) ::);
165-
val &= ~SCTRL_MPU_ENABLE;
164+
val = __get_SCTLR();
165+
val &= ~SCTLR_MPU_ENABLE;
166166
/* Force any outstanding transfers to complete before disabling MPU */
167-
__asm__ volatile ("dsb");
168-
__asm__ volatile ("mcr p15, 0, %0, c1, c0, 0" :: "r" (val) :);
169-
__asm__ volatile ("isb");
167+
__DSB();
168+
__set_SCTLR(val);
169+
__ISB();
170170
}
171171
#else
172172
/**

include/arch/arm/aarch32/cortex_a_r/cpu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
#endif
1313

1414
/*
15-
* SCTRL register bit assignments
15+
* SCTLR register bit assignments
1616
*/
17-
#define SCTRL_MPU_ENABLE (1 << 0)
17+
#define SCTLR_MPU_ENABLE (1 << 0)
1818

1919
#define MODE_USR 0x10
2020
#define MODE_FIQ 0x11

0 commit comments

Comments
 (0)