1*2fd737d3SMatthias Ringwald /******************************************************************************
2*2fd737d3SMatthias Ringwald * @file mpu_armv7.h
3*2fd737d3SMatthias Ringwald * @brief CMSIS MPU API for Armv7-M MPU
4*2fd737d3SMatthias Ringwald * @version V5.0.4
5*2fd737d3SMatthias Ringwald * @date 10. January 2018
6*2fd737d3SMatthias Ringwald ******************************************************************************/
7*2fd737d3SMatthias Ringwald /*
8*2fd737d3SMatthias Ringwald * Copyright (c) 2017-2018 Arm Limited. All rights reserved.
9*2fd737d3SMatthias Ringwald *
10*2fd737d3SMatthias Ringwald * SPDX-License-Identifier: Apache-2.0
11*2fd737d3SMatthias Ringwald *
12*2fd737d3SMatthias Ringwald * Licensed under the Apache License, Version 2.0 (the License); you may
13*2fd737d3SMatthias Ringwald * not use this file except in compliance with the License.
14*2fd737d3SMatthias Ringwald * You may obtain a copy of the License at
15*2fd737d3SMatthias Ringwald *
16*2fd737d3SMatthias Ringwald * www.apache.org/licenses/LICENSE-2.0
17*2fd737d3SMatthias Ringwald *
18*2fd737d3SMatthias Ringwald * Unless required by applicable law or agreed to in writing, software
19*2fd737d3SMatthias Ringwald * distributed under the License is distributed on an AS IS BASIS, WITHOUT
20*2fd737d3SMatthias Ringwald * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21*2fd737d3SMatthias Ringwald * See the License for the specific language governing permissions and
22*2fd737d3SMatthias Ringwald * limitations under the License.
23*2fd737d3SMatthias Ringwald */
24*2fd737d3SMatthias Ringwald
25*2fd737d3SMatthias Ringwald #if defined ( __ICCARM__ )
26*2fd737d3SMatthias Ringwald #pragma system_include /* treat file as system include file for MISRA check */
27*2fd737d3SMatthias Ringwald #elif defined (__clang__)
28*2fd737d3SMatthias Ringwald #pragma clang system_header /* treat file as system include file */
29*2fd737d3SMatthias Ringwald #endif
30*2fd737d3SMatthias Ringwald
31*2fd737d3SMatthias Ringwald #ifndef ARM_MPU_ARMV7_H
32*2fd737d3SMatthias Ringwald #define ARM_MPU_ARMV7_H
33*2fd737d3SMatthias Ringwald
34*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_32B ((uint8_t)0x04U) ///!< MPU Region Size 32 Bytes
35*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_64B ((uint8_t)0x05U) ///!< MPU Region Size 64 Bytes
36*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_128B ((uint8_t)0x06U) ///!< MPU Region Size 128 Bytes
37*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_256B ((uint8_t)0x07U) ///!< MPU Region Size 256 Bytes
38*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_512B ((uint8_t)0x08U) ///!< MPU Region Size 512 Bytes
39*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_1KB ((uint8_t)0x09U) ///!< MPU Region Size 1 KByte
40*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_2KB ((uint8_t)0x0AU) ///!< MPU Region Size 2 KBytes
41*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_4KB ((uint8_t)0x0BU) ///!< MPU Region Size 4 KBytes
42*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_8KB ((uint8_t)0x0CU) ///!< MPU Region Size 8 KBytes
43*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_16KB ((uint8_t)0x0DU) ///!< MPU Region Size 16 KBytes
44*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_32KB ((uint8_t)0x0EU) ///!< MPU Region Size 32 KBytes
45*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_64KB ((uint8_t)0x0FU) ///!< MPU Region Size 64 KBytes
46*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_128KB ((uint8_t)0x10U) ///!< MPU Region Size 128 KBytes
47*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_256KB ((uint8_t)0x11U) ///!< MPU Region Size 256 KBytes
48*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_512KB ((uint8_t)0x12U) ///!< MPU Region Size 512 KBytes
49*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_1MB ((uint8_t)0x13U) ///!< MPU Region Size 1 MByte
50*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_2MB ((uint8_t)0x14U) ///!< MPU Region Size 2 MBytes
51*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_4MB ((uint8_t)0x15U) ///!< MPU Region Size 4 MBytes
52*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_8MB ((uint8_t)0x16U) ///!< MPU Region Size 8 MBytes
53*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_16MB ((uint8_t)0x17U) ///!< MPU Region Size 16 MBytes
54*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_32MB ((uint8_t)0x18U) ///!< MPU Region Size 32 MBytes
55*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_64MB ((uint8_t)0x19U) ///!< MPU Region Size 64 MBytes
56*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_128MB ((uint8_t)0x1AU) ///!< MPU Region Size 128 MBytes
57*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_256MB ((uint8_t)0x1BU) ///!< MPU Region Size 256 MBytes
58*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_512MB ((uint8_t)0x1CU) ///!< MPU Region Size 512 MBytes
59*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_1GB ((uint8_t)0x1DU) ///!< MPU Region Size 1 GByte
60*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_2GB ((uint8_t)0x1EU) ///!< MPU Region Size 2 GBytes
61*2fd737d3SMatthias Ringwald #define ARM_MPU_REGION_SIZE_4GB ((uint8_t)0x1FU) ///!< MPU Region Size 4 GBytes
62*2fd737d3SMatthias Ringwald
63*2fd737d3SMatthias Ringwald #define ARM_MPU_AP_NONE 0U ///!< MPU Access Permission no access
64*2fd737d3SMatthias Ringwald #define ARM_MPU_AP_PRIV 1U ///!< MPU Access Permission privileged access only
65*2fd737d3SMatthias Ringwald #define ARM_MPU_AP_URO 2U ///!< MPU Access Permission unprivileged access read-only
66*2fd737d3SMatthias Ringwald #define ARM_MPU_AP_FULL 3U ///!< MPU Access Permission full access
67*2fd737d3SMatthias Ringwald #define ARM_MPU_AP_PRO 5U ///!< MPU Access Permission privileged access read-only
68*2fd737d3SMatthias Ringwald #define ARM_MPU_AP_RO 6U ///!< MPU Access Permission read-only access
69*2fd737d3SMatthias Ringwald
70*2fd737d3SMatthias Ringwald /** MPU Region Base Address Register Value
71*2fd737d3SMatthias Ringwald *
72*2fd737d3SMatthias Ringwald * \param Region The region to be configured, number 0 to 15.
73*2fd737d3SMatthias Ringwald * \param BaseAddress The base address for the region.
74*2fd737d3SMatthias Ringwald */
75*2fd737d3SMatthias Ringwald #define ARM_MPU_RBAR(Region, BaseAddress) \
76*2fd737d3SMatthias Ringwald (((BaseAddress) & MPU_RBAR_ADDR_Msk) | \
77*2fd737d3SMatthias Ringwald ((Region) & MPU_RBAR_REGION_Msk) | \
78*2fd737d3SMatthias Ringwald (MPU_RBAR_VALID_Msk))
79*2fd737d3SMatthias Ringwald
80*2fd737d3SMatthias Ringwald /**
81*2fd737d3SMatthias Ringwald * MPU Memory Access Attributes
82*2fd737d3SMatthias Ringwald *
83*2fd737d3SMatthias Ringwald * \param TypeExtField Type extension field, allows you to configure memory access type, for example strongly ordered, peripheral.
84*2fd737d3SMatthias Ringwald * \param IsShareable Region is shareable between multiple bus masters.
85*2fd737d3SMatthias Ringwald * \param IsCacheable Region is cacheable, i.e. its value may be kept in cache.
86*2fd737d3SMatthias Ringwald * \param IsBufferable Region is bufferable, i.e. using write-back caching. Cacheable but non-bufferable regions use write-through policy.
87*2fd737d3SMatthias Ringwald */
88*2fd737d3SMatthias Ringwald #define ARM_MPU_ACCESS_(TypeExtField, IsShareable, IsCacheable, IsBufferable) \
89*2fd737d3SMatthias Ringwald ((((TypeExtField ) << MPU_RASR_TEX_Pos) & MPU_RASR_TEX_Msk) | \
90*2fd737d3SMatthias Ringwald (((IsShareable ) << MPU_RASR_S_Pos) & MPU_RASR_S_Msk) | \
91*2fd737d3SMatthias Ringwald (((IsCacheable ) << MPU_RASR_C_Pos) & MPU_RASR_C_Msk) | \
92*2fd737d3SMatthias Ringwald (((IsBufferable ) << MPU_RASR_B_Pos) & MPU_RASR_B_Msk))
93*2fd737d3SMatthias Ringwald
94*2fd737d3SMatthias Ringwald /**
95*2fd737d3SMatthias Ringwald * MPU Region Attribute and Size Register Value
96*2fd737d3SMatthias Ringwald *
97*2fd737d3SMatthias Ringwald * \param DisableExec Instruction access disable bit, 1= disable instruction fetches.
98*2fd737d3SMatthias Ringwald * \param AccessPermission Data access permissions, allows you to configure read/write access for User and Privileged mode.
99*2fd737d3SMatthias Ringwald * \param AccessAttributes Memory access attribution, see \ref ARM_MPU_ACCESS_.
100*2fd737d3SMatthias Ringwald * \param SubRegionDisable Sub-region disable field.
101*2fd737d3SMatthias Ringwald * \param Size Region size of the region to be configured, for example 4K, 8K.
102*2fd737d3SMatthias Ringwald */
103*2fd737d3SMatthias Ringwald #define ARM_MPU_RASR_EX(DisableExec, AccessPermission, AccessAttributes, SubRegionDisable, Size) \
104*2fd737d3SMatthias Ringwald ((((DisableExec ) << MPU_RASR_XN_Pos) & MPU_RASR_XN_Msk) | \
105*2fd737d3SMatthias Ringwald (((AccessPermission) << MPU_RASR_AP_Pos) & MPU_RASR_AP_Msk) | \
106*2fd737d3SMatthias Ringwald (((AccessAttributes) ) & (MPU_RASR_TEX_Msk | MPU_RASR_S_Msk | MPU_RASR_C_Msk | MPU_RASR_B_Msk)))
107*2fd737d3SMatthias Ringwald
108*2fd737d3SMatthias Ringwald /**
109*2fd737d3SMatthias Ringwald * MPU Region Attribute and Size Register Value
110*2fd737d3SMatthias Ringwald *
111*2fd737d3SMatthias Ringwald * \param DisableExec Instruction access disable bit, 1= disable instruction fetches.
112*2fd737d3SMatthias Ringwald * \param AccessPermission Data access permissions, allows you to configure read/write access for User and Privileged mode.
113*2fd737d3SMatthias Ringwald * \param TypeExtField Type extension field, allows you to configure memory access type, for example strongly ordered, peripheral.
114*2fd737d3SMatthias Ringwald * \param IsShareable Region is shareable between multiple bus masters.
115*2fd737d3SMatthias Ringwald * \param IsCacheable Region is cacheable, i.e. its value may be kept in cache.
116*2fd737d3SMatthias Ringwald * \param IsBufferable Region is bufferable, i.e. using write-back caching. Cacheable but non-bufferable regions use write-through policy.
117*2fd737d3SMatthias Ringwald * \param SubRegionDisable Sub-region disable field.
118*2fd737d3SMatthias Ringwald * \param Size Region size of the region to be configured, for example 4K, 8K.
119*2fd737d3SMatthias Ringwald */
120*2fd737d3SMatthias Ringwald #define ARM_MPU_RASR(DisableExec, AccessPermission, TypeExtField, IsShareable, IsCacheable, IsBufferable, SubRegionDisable, Size) \
121*2fd737d3SMatthias Ringwald ARM_MPU_RASR_EX(DisableExec, AccessPermission, ARM_MPU_ACCESS_(TypeExtField, IsShareable, IsCacheable, IsBufferable), SubRegionDisable, Size)
122*2fd737d3SMatthias Ringwald
123*2fd737d3SMatthias Ringwald /**
124*2fd737d3SMatthias Ringwald * MPU Memory Access Attribute for strongly ordered memory.
125*2fd737d3SMatthias Ringwald * - TEX: 000b
126*2fd737d3SMatthias Ringwald * - Shareable
127*2fd737d3SMatthias Ringwald * - Non-cacheable
128*2fd737d3SMatthias Ringwald * - Non-bufferable
129*2fd737d3SMatthias Ringwald */
130*2fd737d3SMatthias Ringwald #define ARM_MPU_ACCESS_ORDERED ARM_MPU_ACCESS_(0U, 1U, 0U, 0U)
131*2fd737d3SMatthias Ringwald
132*2fd737d3SMatthias Ringwald /**
133*2fd737d3SMatthias Ringwald * MPU Memory Access Attribute for device memory.
134*2fd737d3SMatthias Ringwald * - TEX: 000b (if non-shareable) or 010b (if shareable)
135*2fd737d3SMatthias Ringwald * - Shareable or non-shareable
136*2fd737d3SMatthias Ringwald * - Non-cacheable
137*2fd737d3SMatthias Ringwald * - Bufferable (if shareable) or non-bufferable (if non-shareable)
138*2fd737d3SMatthias Ringwald *
139*2fd737d3SMatthias Ringwald * \param IsShareable Configures the device memory as shareable or non-shareable.
140*2fd737d3SMatthias Ringwald */
141*2fd737d3SMatthias Ringwald #define ARM_MPU_ACCESS_DEVICE(IsShareable) ((IsShareable) ? ARM_MPU_ACCESS_(0U, 1U, 0U, 1U) : ARM_MPU_ACCESS_(2U, 0U, 0U, 0U))
142*2fd737d3SMatthias Ringwald
143*2fd737d3SMatthias Ringwald /**
144*2fd737d3SMatthias Ringwald * MPU Memory Access Attribute for normal memory.
145*2fd737d3SMatthias Ringwald * - TEX: 1BBb (reflecting outer cacheability rules)
146*2fd737d3SMatthias Ringwald * - Shareable or non-shareable
147*2fd737d3SMatthias Ringwald * - Cacheable or non-cacheable (reflecting inner cacheability rules)
148*2fd737d3SMatthias Ringwald * - Bufferable or non-bufferable (reflecting inner cacheability rules)
149*2fd737d3SMatthias Ringwald *
150*2fd737d3SMatthias Ringwald * \param OuterCp Configures the outer cache policy.
151*2fd737d3SMatthias Ringwald * \param InnerCp Configures the inner cache policy.
152*2fd737d3SMatthias Ringwald * \param IsShareable Configures the memory as shareable or non-shareable.
153*2fd737d3SMatthias Ringwald */
154*2fd737d3SMatthias Ringwald #define ARM_MPU_ACCESS_NORMAL(OuterCp, InnerCp, IsShareable) ARM_MPU_ACCESS_((4U | (OuterCp)), IsShareable, ((InnerCp) & 2U), ((InnerCp) & 1U))
155*2fd737d3SMatthias Ringwald
156*2fd737d3SMatthias Ringwald /**
157*2fd737d3SMatthias Ringwald * MPU Memory Access Attribute non-cacheable policy.
158*2fd737d3SMatthias Ringwald */
159*2fd737d3SMatthias Ringwald #define ARM_MPU_CACHEP_NOCACHE 0U
160*2fd737d3SMatthias Ringwald
161*2fd737d3SMatthias Ringwald /**
162*2fd737d3SMatthias Ringwald * MPU Memory Access Attribute write-back, write and read allocate policy.
163*2fd737d3SMatthias Ringwald */
164*2fd737d3SMatthias Ringwald #define ARM_MPU_CACHEP_WB_WRA 1U
165*2fd737d3SMatthias Ringwald
166*2fd737d3SMatthias Ringwald /**
167*2fd737d3SMatthias Ringwald * MPU Memory Access Attribute write-through, no write allocate policy.
168*2fd737d3SMatthias Ringwald */
169*2fd737d3SMatthias Ringwald #define ARM_MPU_CACHEP_WT_NWA 2U
170*2fd737d3SMatthias Ringwald
171*2fd737d3SMatthias Ringwald /**
172*2fd737d3SMatthias Ringwald * MPU Memory Access Attribute write-back, no write allocate policy.
173*2fd737d3SMatthias Ringwald */
174*2fd737d3SMatthias Ringwald #define ARM_MPU_CACHEP_WB_NWA 3U
175*2fd737d3SMatthias Ringwald
176*2fd737d3SMatthias Ringwald
177*2fd737d3SMatthias Ringwald /**
178*2fd737d3SMatthias Ringwald * Struct for a single MPU Region
179*2fd737d3SMatthias Ringwald */
180*2fd737d3SMatthias Ringwald typedef struct {
181*2fd737d3SMatthias Ringwald uint32_t RBAR; //!< The region base address register value (RBAR)
182*2fd737d3SMatthias Ringwald uint32_t RASR; //!< The region attribute and size register value (RASR) \ref MPU_RASR
183*2fd737d3SMatthias Ringwald } ARM_MPU_Region_t;
184*2fd737d3SMatthias Ringwald
185*2fd737d3SMatthias Ringwald /** Enable the MPU.
186*2fd737d3SMatthias Ringwald * \param MPU_Control Default access permissions for unconfigured regions.
187*2fd737d3SMatthias Ringwald */
ARM_MPU_Enable(uint32_t MPU_Control)188*2fd737d3SMatthias Ringwald __STATIC_INLINE void ARM_MPU_Enable(uint32_t MPU_Control)
189*2fd737d3SMatthias Ringwald {
190*2fd737d3SMatthias Ringwald __DSB();
191*2fd737d3SMatthias Ringwald __ISB();
192*2fd737d3SMatthias Ringwald MPU->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk;
193*2fd737d3SMatthias Ringwald #ifdef SCB_SHCSR_MEMFAULTENA_Msk
194*2fd737d3SMatthias Ringwald SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk;
195*2fd737d3SMatthias Ringwald #endif
196*2fd737d3SMatthias Ringwald }
197*2fd737d3SMatthias Ringwald
198*2fd737d3SMatthias Ringwald /** Disable the MPU.
199*2fd737d3SMatthias Ringwald */
ARM_MPU_Disable(void)200*2fd737d3SMatthias Ringwald __STATIC_INLINE void ARM_MPU_Disable(void)
201*2fd737d3SMatthias Ringwald {
202*2fd737d3SMatthias Ringwald __DSB();
203*2fd737d3SMatthias Ringwald __ISB();
204*2fd737d3SMatthias Ringwald #ifdef SCB_SHCSR_MEMFAULTENA_Msk
205*2fd737d3SMatthias Ringwald SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk;
206*2fd737d3SMatthias Ringwald #endif
207*2fd737d3SMatthias Ringwald MPU->CTRL &= ~MPU_CTRL_ENABLE_Msk;
208*2fd737d3SMatthias Ringwald }
209*2fd737d3SMatthias Ringwald
210*2fd737d3SMatthias Ringwald /** Clear and disable the given MPU region.
211*2fd737d3SMatthias Ringwald * \param rnr Region number to be cleared.
212*2fd737d3SMatthias Ringwald */
ARM_MPU_ClrRegion(uint32_t rnr)213*2fd737d3SMatthias Ringwald __STATIC_INLINE void ARM_MPU_ClrRegion(uint32_t rnr)
214*2fd737d3SMatthias Ringwald {
215*2fd737d3SMatthias Ringwald MPU->RNR = rnr;
216*2fd737d3SMatthias Ringwald MPU->RASR = 0U;
217*2fd737d3SMatthias Ringwald }
218*2fd737d3SMatthias Ringwald
219*2fd737d3SMatthias Ringwald /** Configure an MPU region.
220*2fd737d3SMatthias Ringwald * \param rbar Value for RBAR register.
221*2fd737d3SMatthias Ringwald * \param rsar Value for RSAR register.
222*2fd737d3SMatthias Ringwald */
ARM_MPU_SetRegion(uint32_t rbar,uint32_t rasr)223*2fd737d3SMatthias Ringwald __STATIC_INLINE void ARM_MPU_SetRegion(uint32_t rbar, uint32_t rasr)
224*2fd737d3SMatthias Ringwald {
225*2fd737d3SMatthias Ringwald MPU->RBAR = rbar;
226*2fd737d3SMatthias Ringwald MPU->RASR = rasr;
227*2fd737d3SMatthias Ringwald }
228*2fd737d3SMatthias Ringwald
229*2fd737d3SMatthias Ringwald /** Configure the given MPU region.
230*2fd737d3SMatthias Ringwald * \param rnr Region number to be configured.
231*2fd737d3SMatthias Ringwald * \param rbar Value for RBAR register.
232*2fd737d3SMatthias Ringwald * \param rsar Value for RSAR register.
233*2fd737d3SMatthias Ringwald */
ARM_MPU_SetRegionEx(uint32_t rnr,uint32_t rbar,uint32_t rasr)234*2fd737d3SMatthias Ringwald __STATIC_INLINE void ARM_MPU_SetRegionEx(uint32_t rnr, uint32_t rbar, uint32_t rasr)
235*2fd737d3SMatthias Ringwald {
236*2fd737d3SMatthias Ringwald MPU->RNR = rnr;
237*2fd737d3SMatthias Ringwald MPU->RBAR = rbar;
238*2fd737d3SMatthias Ringwald MPU->RASR = rasr;
239*2fd737d3SMatthias Ringwald }
240*2fd737d3SMatthias Ringwald
241*2fd737d3SMatthias Ringwald /** Memcopy with strictly ordered memory access, e.g. for register targets.
242*2fd737d3SMatthias Ringwald * \param dst Destination data is copied to.
243*2fd737d3SMatthias Ringwald * \param src Source data is copied from.
244*2fd737d3SMatthias Ringwald * \param len Amount of data words to be copied.
245*2fd737d3SMatthias Ringwald */
orderedCpy(volatile uint32_t * dst,const uint32_t * __RESTRICT src,uint32_t len)246*2fd737d3SMatthias Ringwald __STATIC_INLINE void orderedCpy(volatile uint32_t* dst, const uint32_t* __RESTRICT src, uint32_t len)
247*2fd737d3SMatthias Ringwald {
248*2fd737d3SMatthias Ringwald uint32_t i;
249*2fd737d3SMatthias Ringwald for (i = 0U; i < len; ++i)
250*2fd737d3SMatthias Ringwald {
251*2fd737d3SMatthias Ringwald dst[i] = src[i];
252*2fd737d3SMatthias Ringwald }
253*2fd737d3SMatthias Ringwald }
254*2fd737d3SMatthias Ringwald
255*2fd737d3SMatthias Ringwald /** Load the given number of MPU regions from a table.
256*2fd737d3SMatthias Ringwald * \param table Pointer to the MPU configuration table.
257*2fd737d3SMatthias Ringwald * \param cnt Amount of regions to be configured.
258*2fd737d3SMatthias Ringwald */
ARM_MPU_Load(ARM_MPU_Region_t const * table,uint32_t cnt)259*2fd737d3SMatthias Ringwald __STATIC_INLINE void ARM_MPU_Load(ARM_MPU_Region_t const* table, uint32_t cnt)
260*2fd737d3SMatthias Ringwald {
261*2fd737d3SMatthias Ringwald const uint32_t rowWordSize = sizeof(ARM_MPU_Region_t)/4U;
262*2fd737d3SMatthias Ringwald while (cnt > MPU_TYPE_RALIASES) {
263*2fd737d3SMatthias Ringwald orderedCpy(&(MPU->RBAR), &(table->RBAR), MPU_TYPE_RALIASES*rowWordSize);
264*2fd737d3SMatthias Ringwald table += MPU_TYPE_RALIASES;
265*2fd737d3SMatthias Ringwald cnt -= MPU_TYPE_RALIASES;
266*2fd737d3SMatthias Ringwald }
267*2fd737d3SMatthias Ringwald orderedCpy(&(MPU->RBAR), &(table->RBAR), cnt*rowWordSize);
268*2fd737d3SMatthias Ringwald }
269*2fd737d3SMatthias Ringwald
270*2fd737d3SMatthias Ringwald #endif
271