37#ifndef RTEMS_SCORE_ARMV7M_H
38#define RTEMS_SCORE_ARMV7M_H
40#include <rtems/score/cpu.h>
49#ifdef ARM_MULTILIB_ARCH_V7M
52#define ARMV7M_CPACR 0xe000ed88
63typedef void (*ARMV7M_Exception_handler)(void);
70 uint32_t register_r12;
73 uint32_t register_xpsr;
74#ifdef ARM_MULTILIB_VFP
85 uint32_t register_s10;
86 uint32_t register_s11;
87 uint32_t register_s12;
88 uint32_t register_s13;
89 uint32_t register_s14;
90 uint32_t register_s15;
91 uint32_t register_fpscr;
94} ARMV7M_Exception_frame;
101} ARMV7M_DWT_comparator;
104#define ARMV7M_DWT_CTRL_NOCYCCNT (1U << 25)
105#define ARMV7M_DWT_CTRL_CYCCNTENA (1U << 0)
114 ARMV7M_DWT_comparator comparator[249];
115#define ARMV7M_DWT_LAR_UNLOCK_MAGIC 0xc5acce55U
123#define ARMV7M_SCB_ICSR_NMIPENDSET (1U << 31)
124#define ARMV7M_SCB_ICSR_PENDSVSET (1U << 28)
125#define ARMV7M_SCB_ICSR_PENDSVCLR (1U << 27)
126#define ARMV7M_SCB_ICSR_PENDSTSET (1U << 26)
127#define ARMV7M_SCB_ICSR_PENDSTCLR (1U << 25)
128#define ARMV7M_SCB_ICSR_ISRPREEMPT (1U << 23)
129#define ARMV7M_SCB_ICSR_ISRPENDING (1U << 22)
130#define ARMV7M_SCB_ICSR_VECTPENDING_GET(reg) (((reg) >> 12) & 0x1ffU)
131#define ARMV7M_SCB_ICSR_RETTOBASE (1U << 11)
132#define ARMV7M_SCB_ICSR_VECTACTIVE_GET(reg) ((reg) & 0x1ffU)
135 ARMV7M_Exception_handler *vtor;
137#define ARMV7M_SCB_AIRCR_VECTKEY (0x05fa << 16)
138#define ARMV7M_SCB_AIRCR_ENDIANESS (1U << 15)
139#define ARMV7M_SCB_AIRCR_PRIGROUP_SHIFT 8
140#define ARMV7M_SCB_AIRCR_PRIGROUP_MASK \
141 ((0x7U) << ARMV7M_SCB_AIRCR_PRIGROUP_SHIFT)
142#define ARMV7M_SCB_AIRCR_PRIGROUP(val) \
143 (((val) << ARMV7M_SCB_AIRCR_PRIGROUP_SHIFT) & ARMV7M_SCB_AIRCR_PRIGROUP_MASK)
144#define ARMV7M_SCB_AIRCR_PRIGROUP_GET(reg) \
145 (((val) & ARMV7M_SCB_AIRCR_PRIGROUP_MASK) >> ARMV7M_SCB_AIRCR_PRIGROUP_SHIFT)
146#define ARMV7M_SCB_AIRCR_PRIGROUP_SET(reg, val) \
147 (((reg) & ~ARMV7M_SCB_AIRCR_PRIGROUP_MASK) | ARMV7M_SCB_AIRCR_PRIGROUP(val))
148#define ARMV7M_SCB_AIRCR_SYSRESETREQ (1U << 2)
149#define ARMV7M_SCB_AIRCR_VECTCLRACTIVE (1U << 1)
150#define ARMV7M_SCB_AIRCR_VECTRESET (1U << 0)
157#define ARMV7M_SCB_SHCSR_USGFAULTENA (1U << 18)
158#define ARMV7M_SCB_SHCSR_BUSFAULTENA (1U << 17)
159#define ARMV7M_SCB_SHCSR_MEMFAULTENA (1U << 16)
162#define ARMV7M_SCB_CFSR_MMFSR_MASK 0xff
163#define ARMV7M_SCB_CFSR_MMFSR_GET(n) (n & ARMV7M_SCB_CFSR_MMFSR_MASK)
164#define ARMV7M_SCB_CFSR_BFSR_MASK 0xff00
165#define ARMV7M_SCB_CFSR_BFSR_GET(n) (n & ARMV7M_SCB_CFSR_BFSR_MASK)
166#define ARMV7M_SCB_CFSR_UFSR_MASK 0xffff0000
167#define ARMV7M_SCB_CFSR_UFSR_GET(n) (n & ARMV7M_SCB_CFSR_UFSR_MASK)
170#define ARMV7M_SCB_HFSR_VECTTBL_MASK 0x2
171#define ARMV7M_SCB_HFSR_FORCED_MASK (1U << 30)
172#define ARMV7M_SCB_HFSR_DEBUGEVT_MASK (1U << 31)
179 uint32_t reserved_e000ed40[18];
181 uint32_t reserved_e000ed8c[106];
190#define ARMV7M_SYSTICK_CSR_COUNTFLAG (1U << 16)
191#define ARMV7M_SYSTICK_CSR_CLKSOURCE (1U << 2)
192#define ARMV7M_SYSTICK_CSR_TICKINT (1U << 1)
193#define ARMV7M_SYSTICK_CSR_ENABLE (1U << 0)
199#define ARMV7M_SYSTICK_CALIB_NOREF (1U << 31)
200#define ARMV7M_SYSTICK_CALIB_SKEW (1U << 30)
201#define ARMV7M_SYSTICK_CALIB_TENMS_GET(reg) ((reg) & 0xffffffU)
207 uint32_t reserved_0 [24];
209 uint32_t reserved_1 [24];
211 uint32_t reserved_2 [24];
213 uint32_t reserved_3 [24];
215 uint32_t reserved_4 [56];
217 uint32_t reserved_5 [644];
222#define ARMV7M_MPU_TYPE_IREGION_GET(reg) (((reg) >> 16) & 0xffU)
223#define ARMV7M_MPU_TYPE_DREGION_GET(reg) (((reg) >> 8) & 0xffU)
224#define ARMV7M_MPU_TYPE_SEPARATE (1U << 0)
227#define ARMV7M_MPU_CTRL_PRIVDEFENA (1U << 2)
228#define ARMV7M_MPU_CTRL_HFNMIENA (1U << 1)
229#define ARMV7M_MPU_CTRL_ENABLE (1U << 0)
234#define ARMV7M_MPU_RBAR_ADDR_SHIFT 5
235#define ARMV7M_MPU_RBAR_ADDR_MASK \
236 ((0x7ffffffU) << ARMV7M_MPU_RBAR_ADDR_SHIFT)
237#define ARMV7M_MPU_RBAR_ADDR(val) \
238 (((val) << ARMV7M_MPU_RBAR_ADDR_SHIFT) & ARMV7M_MPU_RBAR_ADDR_MASK)
239#define ARMV7M_MPU_RBAR_ADDR_GET(reg) \
240 (((val) & ARMV7M_MPU_RBAR_ADDR_MASK) >> ARMV7M_MPU_RBAR_ADDR_SHIFT)
241#define ARMV7M_MPU_RBAR_ADDR_SET(reg, val) \
242 (((reg) & ~ARMV7M_MPU_RBAR_ADDR_MASK) | ARMV7M_MPU_RBAR_ADDR(val))
243#define ARMV7M_MPU_RBAR_VALID (1U << 4)
244#define ARMV7M_MPU_RBAR_REGION_SHIFT 0
245#define ARMV7M_MPU_RBAR_REGION_MASK \
246 ((0xfU) << ARMV7M_MPU_RBAR_REGION_SHIFT)
247#define ARMV7M_MPU_RBAR_REGION(val) \
248 (((val) << ARMV7M_MPU_RBAR_REGION_SHIFT) & ARMV7M_MPU_RBAR_REGION_MASK)
249#define ARMV7M_MPU_RBAR_REGION_GET(reg) \
250 (((val) & ARMV7M_MPU_RBAR_REGION_MASK) >> ARMV7M_MPU_RBAR_REGION_SHIFT)
251#define ARMV7M_MPU_RBAR_REGION_SET(reg, val) \
252 (((reg) & ~ARMV7M_MPU_RBAR_REGION_MASK) | ARMV7M_MPU_RBAR_REGION(val))
255#define ARMV7M_MPU_RASR_XN (1U << 28)
256#define ARMV7M_MPU_RASR_AP_SHIFT 24
257#define ARMV7M_MPU_RASR_AP_MASK \
258 ((0x7U) << ARMV7M_MPU_RASR_AP_SHIFT)
259#define ARMV7M_MPU_RASR_AP(val) \
260 (((val) << ARMV7M_MPU_RASR_AP_SHIFT) & ARMV7M_MPU_RASR_AP_MASK)
261#define ARMV7M_MPU_RASR_AP_GET(reg) \
262 (((val) & ARMV7M_MPU_RASR_AP_MASK) >> ARMV7M_MPU_RASR_AP_SHIFT)
263#define ARMV7M_MPU_RASR_AP_SET(reg, val) \
264 (((reg) & ~ARMV7M_MPU_RASR_AP_MASK) | ARMV7M_MPU_RASR_AP(val))
265#define ARMV7M_MPU_RASR_TEX_SHIFT 19
266#define ARMV7M_MPU_RASR_TEX_MASK \
267 ((0x7U) << ARMV7M_MPU_RASR_TEX_SHIFT)
268#define ARMV7M_MPU_RASR_TEX(val) \
269 (((val) << ARMV7M_MPU_RASR_TEX_SHIFT) & ARMV7M_MPU_RASR_TEX_MASK)
270#define ARMV7M_MPU_RASR_TEX_GET(reg) \
271 (((val) & ARMV7M_MPU_RASR_TEX_MASK) >> ARMV7M_MPU_RASR_TEX_SHIFT)
272#define ARMV7M_MPU_RASR_TEX_SET(reg, val) \
273 (((reg) & ~ARMV7M_MPU_RASR_TEX_MASK) | ARMV7M_MPU_RASR_TEX(val))
274#define ARMV7M_MPU_RASR_S (1U << 18)
275#define ARMV7M_MPU_RASR_C (1U << 17)
276#define ARMV7M_MPU_RASR_B (1U << 16)
277#define ARMV7M_MPU_RASR_SRD_SHIFT 8
278#define ARMV7M_MPU_RASR_SRD_MASK \
279 ((0xffU) << ARMV7M_MPU_RASR_SRD_SHIFT)
280#define ARMV7M_MPU_RASR_SRD(val) \
281 (((val) << ARMV7M_MPU_RASR_SRD_SHIFT) & ARMV7M_MPU_RASR_SRD_MASK)
282#define ARMV7M_MPU_RASR_SRD_GET(reg) \
283 (((val) & ARMV7M_MPU_RASR_SRD_MASK) >> ARMV7M_MPU_RASR_SRD_SHIFT)
284#define ARMV7M_MPU_RASR_SRD_SET(reg, val) \
285 (((reg) & ~ARMV7M_MPU_RASR_SRD_MASK) | ARMV7M_MPU_RASR_SRD(val))
286#define ARMV7M_MPU_RASR_SIZE_SHIFT 1
287#define ARMV7M_MPU_RASR_SIZE_MASK \
288 ((0x1fU) << ARMV7M_MPU_RASR_SIZE_SHIFT)
289#define ARMV7M_MPU_RASR_SIZE(val) \
290 (((val) << ARMV7M_MPU_RASR_SIZE_SHIFT) & ARMV7M_MPU_RASR_SIZE_MASK)
291#define ARMV7M_MPU_RASR_SIZE_GET(reg) \
292 (((val) & ARMV7M_MPU_RASR_SIZE_MASK) >> ARMV7M_MPU_RASR_SIZE_SHIFT)
293#define ARMV7M_MPU_RASR_SIZE_SET(reg, val) \
294 (((reg) & ~ARMV7M_MPU_RASR_SIZE_MASK) | ARMV7M_MPU_RASR_SIZE(val))
295#define ARMV7M_MPU_RASR_ENABLE (1U << 0)
307 ARMV7M_MPU_AP_PRIV_NO_USER_NO,
308 ARMV7M_MPU_AP_PRIV_RW_USER_NO,
309 ARMV7M_MPU_AP_PRIV_RW_USER_RO,
310 ARMV7M_MPU_AP_PRIV_RW_USER_RW,
311 ARMV7M_MPU_AP_PRIV_RO_USER_NO = 0x5,
312 ARMV7M_MPU_AP_PRIV_RO_USER_RO,
313} ARMV7M_MPU_Access_permissions;
316 ARMV7M_MPU_ATTR_R = ARMV7M_MPU_RASR_AP(ARMV7M_MPU_AP_PRIV_RO_USER_NO)
317 | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_XN,
318 ARMV7M_MPU_ATTR_RW = ARMV7M_MPU_RASR_AP(ARMV7M_MPU_AP_PRIV_RW_USER_NO)
319 | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_XN | ARMV7M_MPU_RASR_B,
320 ARMV7M_MPU_ATTR_RWX = ARMV7M_MPU_RASR_AP(ARMV7M_MPU_AP_PRIV_RW_USER_NO)
321 | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_B,
322 ARMV7M_MPU_ATTR_X = ARMV7M_MPU_RASR_AP(ARMV7M_MPU_AP_PRIV_NO_USER_NO)
324 ARMV7M_MPU_ATTR_RX = ARMV7M_MPU_RASR_AP(ARMV7M_MPU_AP_PRIV_RO_USER_NO)
326 ARMV7M_MPU_ATTR_IO = ARMV7M_MPU_RASR_AP(ARMV7M_MPU_AP_PRIV_RW_USER_NO)
327 | ARMV7M_MPU_RASR_XN,
328} ARMV7M_MPU_Attributes;
331 ARMV7M_MPU_SIZE_32_B = 0x4,
332 ARMV7M_MPU_SIZE_64_B,
333 ARMV7M_MPU_SIZE_128_B,
334 ARMV7M_MPU_SIZE_256_B,
335 ARMV7M_MPU_SIZE_512_B,
336 ARMV7M_MPU_SIZE_1_KB,
337 ARMV7M_MPU_SIZE_2_KB,
338 ARMV7M_MPU_SIZE_4_KB,
339 ARMV7M_MPU_SIZE_8_KB,
340 ARMV7M_MPU_SIZE_16_KB,
341 ARMV7M_MPU_SIZE_32_KB,
342 ARMV7M_MPU_SIZE_64_KB,
343 ARMV7M_MPU_SIZE_128_KB,
344 ARMV7M_MPU_SIZE_256_KB,
345 ARMV7M_MPU_SIZE_512_KB,
346 ARMV7M_MPU_SIZE_1_MB,
347 ARMV7M_MPU_SIZE_2_MB,
348 ARMV7M_MPU_SIZE_4_MB,
349 ARMV7M_MPU_SIZE_8_MB,
350 ARMV7M_MPU_SIZE_16_MB,
351 ARMV7M_MPU_SIZE_32_MB,
352 ARMV7M_MPU_SIZE_64_MB,
353 ARMV7M_MPU_SIZE_128_MB,
354 ARMV7M_MPU_SIZE_256_MB,
355 ARMV7M_MPU_SIZE_512_MB,
356 ARMV7M_MPU_SIZE_1_GB,
357 ARMV7M_MPU_SIZE_2_GB,
366#define ARMV7M_MPU_REGION_INITIALIZER(idx, addr, size, attr) \
368 ((addr) & ARMV7M_MPU_RBAR_ADDR_MASK) \
369 | ARMV7M_MPU_RBAR_VALID \
370 | ARMV7M_MPU_RBAR_REGION(idx), \
371 ARMV7M_MPU_RASR_SIZE(size) | (attr) | ARMV7M_MPU_RASR_ENABLE \
374#define ARMV7M_MPU_REGION_DISABLED_INITIALIZER(idx) \
376 ARMV7M_MPU_RBAR_VALID | ARMV7M_MPU_RBAR_REGION(idx), \
396} ARMV7M_MPU_Region_config;
402#define ARMV7M_DEBUG_DEMCR_VC_CORERESET (1U << 0)
403#define ARMV7M_DEBUG_DEMCR_VC_MMERR (1U << 4)
404#define ARMV7M_DEBUG_DEMCR_VC_NOCPERR (1U << 5)
405#define ARMV7M_DEBUG_DEMCR_VC_CHKERR (1U << 6)
406#define ARMV7M_DEBUG_DEMCR_VC_STATERR (1U << 7)
407#define ARMV7M_DEBUG_DEMCR_VC_BUSERR (1U << 8)
408#define ARMV7M_DEBUG_DEMCR_VC_INTERR (1U << 9)
409#define ARMV7M_DEBUG_DEMCR_VC_HARDERR (1U << 10)
410#define ARMV7M_DEBUG_DEMCR_MON_EN (1U << 16)
411#define ARMV7M_DEBUG_DEMCR_MON_PEND (1U << 17)
412#define ARMV7M_DEBUG_DEMCR_MON_STEP (1U << 18)
413#define ARMV7M_DEBUG_DEMCR_MON_REQ (1U << 19)
414#define ARMV7M_DEBUG_DEMCR_TRCENA (1U << 24)
418#define ARMV7M_DWT_BASE 0xe0001000
419#define ARMV7M_SCS_BASE 0xe000e000
420#define ARMV7M_ICTAC_BASE (ARMV7M_SCS_BASE + 0x0)
421#define ARMV7M_SYSTICK_BASE (ARMV7M_SCS_BASE + 0x10)
422#define ARMV7M_NVIC_BASE (ARMV7M_SCS_BASE + 0x100)
423#define ARMV7M_SCB_BASE (ARMV7M_SCS_BASE + 0xd00)
424#define ARMV7M_MPU_BASE (ARMV7M_SCS_BASE + 0xd90)
425#define ARMV7M_DEBUG_BASE (ARMV7M_SCS_BASE + 0xdf0)
428 ((volatile ARMV7M_DWT *) ARMV7M_DWT_BASE)
429#define _ARMV7M_ICTAC \
430 ((volatile ARMV7M_ICTAC *) ARMV7M_ICTAC_BASE)
432 ((volatile ARMV7M_SCB *) ARMV7M_SCB_BASE)
433#define _ARMV7M_Systick \
434 ((volatile ARMV7M_Systick *) ARMV7M_SYSTICK_BASE)
435#define _ARMV7M_NVIC \
436 ((volatile ARMV7M_NVIC *) ARMV7M_NVIC_BASE)
438 ((volatile ARMV7M_MPU *) ARMV7M_MPU_BASE)
439#define _ARMV7M_DEBUG \
440 ((volatile ARMV7M_DEBUG *) ARMV7M_DEBUG_BASE)
442#define ARMV7M_VECTOR_MSP 0
443#define ARMV7M_VECTOR_RESET 1
444#define ARMV7M_VECTOR_NMI 2
445#define ARMV7M_VECTOR_HARD_FAULT 3
446#define ARMV7M_VECTOR_MEM_MANAGE 4
447#define ARMV7M_VECTOR_BUS_FAULT 5
448#define ARMV7M_VECTOR_USAGE_FAULT 6
449#define ARMV7M_VECTOR_SVC 11
450#define ARMV7M_VECTOR_DEBUG_MONITOR 12
451#define ARMV7M_VECTOR_PENDSV 14
452#define ARMV7M_VECTOR_SYSTICK 15
453#define ARMV7M_VECTOR_IRQ(n) ((n) + 16)
454#define ARMV7M_IRQ_OF_VECTOR(n) ((n) - 16)
456#define ARMV7M_EXCEPTION_PRIORITY_LOWEST 255
458static inline bool _ARMV7M_Is_vector_an_irq(
int vector )
461 return vector > ARMV7M_VECTOR_SYSTICK;
464static inline uint32_t _ARMV7M_Get_basepri(
void)
467 __asm__
volatile (
"mrs %[val], basepri\n" : [val]
"=&r" (val));
471static inline void _ARMV7M_Set_basepri(uint32_t val)
473 __asm__
volatile (
"msr basepri, %[val]\n" : : [val]
"r" (val));
476static inline uint32_t _ARMV7M_Get_primask(
void)
479 __asm__
volatile (
"mrs %[val], primask\n" : [val]
"=&r" (val));
483static inline void _ARMV7M_Set_primask(uint32_t val)
485 __asm__
volatile (
"msr primask, %[val]\n" : : [val]
"r" (val));
488static inline uint32_t _ARMV7M_Get_faultmask(
void)
491 __asm__
volatile (
"mrs %[val], faultmask\n" : [val]
"=&r" (val));
495static inline void _ARMV7M_Set_faultmask(uint32_t val)
497 __asm__
volatile (
"msr faultmask, %[val]\n" : : [val]
"r" (val));
500static inline uint32_t _ARMV7M_Get_control(
void)
503 __asm__
volatile (
"mrs %[val], control\n" : [val]
"=&r" (val));
507static inline void _ARMV7M_Set_control(uint32_t val)
509 __asm__
volatile (
"msr control, %[val]\n" : : [val]
"r" (val));
512static inline uint32_t _ARMV7M_Get_MSP(
void)
515 __asm__
volatile (
"mrs %[val], msp\n" : [val]
"=&r" (val));
519static inline void _ARMV7M_Set_MSP(uint32_t val)
521 __asm__
volatile (
"msr msp, %[val]\n" : : [val]
"r" (val));
524static inline uint32_t _ARMV7M_Get_PSP(
void)
527 __asm__
volatile (
"mrs %[val], psp\n" : [val]
"=&r" (val));
531static inline void _ARMV7M_Set_PSP(uint32_t val)
533 __asm__
volatile (
"msr psp, %[val]\n" : : [val]
"r" (val));
536static inline uint32_t _ARMV7M_Get_XPSR(
void)
539 __asm__
volatile (
"mrs %[val], xpsr\n" : [val]
"=&r" (val));
543static inline bool _ARMV7M_NVIC_Is_enabled(
int irq )
545 int index = irq >> 5;
546 uint32_t bit = 1U << (irq & 0x1f);
548 return (_ARMV7M_NVIC->iser [index] & bit) != 0;
551static inline void _ARMV7M_NVIC_Set_enable(
int irq )
553 int index = irq >> 5;
554 uint32_t bit = 1U << (irq & 0x1f);
556 _ARMV7M_NVIC->iser [index] = bit;
559static inline void _ARMV7M_NVIC_Clear_enable(
int irq )
561 int index = irq >> 5;
562 uint32_t bit = 1U << (irq & 0x1f);
564 _ARMV7M_NVIC->icer [index] = bit;
567static inline bool _ARMV7M_NVIC_Is_pending(
int irq )
569 int index = irq >> 5;
570 uint32_t bit = 1U << (irq & 0x1f);
572 return (_ARMV7M_NVIC->ispr [index] & bit) != 0;
575static inline void _ARMV7M_NVIC_Set_pending(
int irq )
577 int index = irq >> 5;
578 uint32_t bit = 1U << (irq & 0x1f);
580 _ARMV7M_NVIC->ispr [index] = bit;
583static inline void _ARMV7M_NVIC_Clear_pending(
int irq )
585 int index = irq >> 5;
586 uint32_t bit = 1U << (irq & 0x1f);
588 _ARMV7M_NVIC->icpr [index] = bit;
591static inline bool _ARMV7M_NVIC_Is_active(
int irq )
593 int index = irq >> 5;
594 uint32_t bit = 1U << (irq & 0x1f);
596 return (_ARMV7M_NVIC->iabr [index] & bit) != 0;
599static inline void _ARMV7M_NVIC_Set_priority(
int irq,
int priority )
601 _ARMV7M_NVIC->ipr [irq] = (uint8_t) priority;
604static inline int _ARMV7M_NVIC_Get_priority(
int irq )
606 return _ARMV7M_NVIC->ipr [irq];
609static inline bool _ARMV7M_DWT_Enable_CYCCNT(
void )
614 demcr = _ARMV7M_DEBUG->demcr;
615 _ARMV7M_DEBUG->demcr = demcr | ARMV7M_DEBUG_DEMCR_TRCENA;
616 _ARM_Data_synchronization_barrier();
618 dwt_ctrl = _ARMV7M_DWT->ctrl;
619 if ((dwt_ctrl & ARMV7M_DWT_CTRL_NOCYCCNT) == 0) {
620 _ARMV7M_DWT->lar = ARMV7M_DWT_LAR_UNLOCK_MAGIC;
621 _ARM_Data_synchronization_barrier();
622 _ARMV7M_DWT->ctrl = dwt_ctrl | ARMV7M_DWT_CTRL_CYCCNTENA;
625 _ARMV7M_DEBUG->demcr = demcr;
630int _ARMV7M_Get_exception_priority(
int vector );
632void _ARMV7M_Set_exception_priority(
int vector,
int priority );
634ARMV7M_Exception_handler _ARMV7M_Get_exception_handler(
int index );
636void _ARMV7M_Set_exception_handler(
638 ARMV7M_Exception_handler handler
644void _ARMV7M_Set_exception_priority_and_handler(
647 ARMV7M_Exception_handler handler
650void _ARMV7M_Exception_default(
void );
652void _ARMV7M_Interrupt_service_enter(
void );
654void _ARMV7M_Interrupt_service_leave(
void );
656void _ARMV7M_Pendable_service_call(
void );
658void _ARMV7M_Supervisor_call(
void );
660void _ARMV7M_Clock_handler(
void );
662static inline uint32_t _ARMV7M_MPU_Get_region_size(uintptr_t size)
664 if ((size & (size - 1)) == 0) {
665 return ARMV7M_MPU_RASR_SIZE(30 - __builtin_clz(size));
667 return ARMV7M_MPU_RASR_SIZE(31 - __builtin_clz(size));
671static inline void _ARMV7M_MPU_Set_region(
672 volatile ARMV7M_MPU *mpu,
684 size = (uintptr_t) end - (uintptr_t) begin;
686 if ( (uintptr_t) end > (uintptr_t) begin ) {
687 rbar = (uintptr_t) begin | region | ARMV7M_MPU_RBAR_VALID;
688 rasr |= _ARMV7M_MPU_Get_region_size(size);
690 rbar = ARMV7M_MPU_RBAR_VALID | region;
698static inline void _ARMV7M_MPU_Disable_region(
699 volatile ARMV7M_MPU *mpu,
703 mpu->rbar = ARMV7M_MPU_RBAR_VALID | region;
707static inline void _ARMV7M_MPU_Setup(
709 const ARMV7M_MPU_Region_config *cfg,
713 volatile ARMV7M_MPU *mpu;
714 volatile ARMV7M_SCB *scb;
715 uint32_t region_count;
723 _ARM_Data_synchronization_barrier();
724 _ARM_Instruction_synchronization_barrier();
726 region_count = ARMV7M_MPU_TYPE_DREGION_GET(mpu->type);
728 _Assert(cfg_count <= region_count);
730 for (region = 0; region < cfg_count; ++region) {
731 _ARMV7M_MPU_Set_region(
740 for (region = cfg_count; region < region_count; ++region) {
741 _ARMV7M_MPU_Disable_region(mpu, region);
745 scb->shcsr |= ARMV7M_SCB_SHCSR_MEMFAULTENA;
747 _ARM_Data_synchronization_barrier();
748 _ARM_Instruction_synchronization_barrier();
This header file provides the interfaces of the Assert Handler.
#define RTEMS_OBFUSCATE_VARIABLE(_var)
Obfuscates the variable so that the compiler cannot perform optimizations based on the variable value...
Definition: basedefs.h:690
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG and static analysis runs.
Definition: assert.h:96