Zephyr Project API  3.1.0
A Scalable Open Source RTOS
cmsis.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
14#ifndef ZEPHYR_INCLUDE_ARCH_ARM_AARCH32_CORTEX_M_CMSIS_H_
15#define ZEPHYR_INCLUDE_ARCH_ARM_AARCH32_CORTEX_M_CMSIS_H_
16
17#include <soc.h>
18
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25
26/* CP10 Access Bits */
27#define CPACR_CP10_Pos 20U
28#define CPACR_CP10_Msk (3UL << CPACR_CP10_Pos)
29#define CPACR_CP10_NO_ACCESS (0UL << CPACR_CP10_Pos)
30#define CPACR_CP10_PRIV_ACCESS (1UL << CPACR_CP10_Pos)
31#define CPACR_CP10_RESERVED (2UL << CPACR_CP10_Pos)
32#define CPACR_CP10_FULL_ACCESS (3UL << CPACR_CP10_Pos)
33
34/* CP11 Access Bits */
35#define CPACR_CP11_Pos 22U
36#define CPACR_CP11_Msk (3UL << CPACR_CP11_Pos)
37#define CPACR_CP11_NO_ACCESS (0UL << CPACR_CP11_Pos)
38#define CPACR_CP11_PRIV_ACCESS (1UL << CPACR_CP11_Pos)
39#define CPACR_CP11_RESERVED (2UL << CPACR_CP11_Pos)
40#define CPACR_CP11_FULL_ACCESS (3UL << CPACR_CP11_Pos)
41
42#define SCB_UFSR (*((__IOM uint16_t *) &SCB->CFSR + 1))
43#define SCB_BFSR (*((__IOM uint8_t *) &SCB->CFSR + 1))
44#define SCB_MMFSR (*((__IOM uint8_t *) &SCB->CFSR))
45
46/* Fill in CMSIS required values for non-CMSIS compliant SoCs.
47 * Use __NVIC_PRIO_BITS as it is required and simple to check, but
48 * ultimately all SoCs will define their own CMSIS types and constants.
49 */
50#ifndef __NVIC_PRIO_BITS
51typedef enum {
55#if defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)
56 MemoryManagement_IRQn = -12,
57 BusFault_IRQn = -11,
58 UsageFault_IRQn = -10,
59#if defined(CONFIG_ARM_SECURE_FIRMWARE)
60 SecureFault_IRQn = -9,
61#endif /* CONFIG_ARM_SECURE_FIRMWARE */
62#endif /* CONFIG_ARMV7_M_ARMV8_M_MAINLINE */
68} IRQn_Type;
69
70#if defined(CONFIG_CPU_CORTEX_M0)
71#define __CM0_REV 0
72#elif defined(CONFIG_CPU_CORTEX_M0PLUS)
73#define __CM0PLUS_REV 0
74#elif defined(CONFIG_CPU_CORTEX_M1)
75#define __CM1_REV 0
76#elif defined(CONFIG_CPU_CORTEX_M3)
77#define __CM3_REV 0
78#elif defined(CONFIG_CPU_CORTEX_M4)
79#define __CM4_REV 0
80#elif defined(CONFIG_CPU_CORTEX_M7)
81#define __CM7_REV 0
82#elif defined(CONFIG_CPU_CORTEX_M23)
83#define __CM23_REV 0
84#elif defined(CONFIG_CPU_CORTEX_M33)
85#define __CM33_REV 0
86#elif defined(CONFIG_CPU_CORTEX_M55)
87#define __CM55_REV 0
88#else
89#error "Unknown Cortex-M device"
90#endif
91
92#ifndef __MPU_PRESENT
93#define __MPU_PRESENT 0U
94#endif
95#define __NVIC_PRIO_BITS NUM_IRQ_PRIO_BITS
96#define __Vendor_SysTickConfig 0 /* Default to standard SysTick */
97#endif /* __NVIC_PRIO_BITS */
98
99#if __NVIC_PRIO_BITS != NUM_IRQ_PRIO_BITS
100#error "NUM_IRQ_PRIO_BITS and __NVIC_PRIO_BITS are not set to the same value"
101#endif
102
103#ifdef __cplusplus
104}
105#endif
106
107#if defined(CONFIG_CPU_CORTEX_M0)
108#include <core_cm0.h>
109#elif defined(CONFIG_CPU_CORTEX_M0PLUS)
110#include <core_cm0plus.h>
111#elif defined(CONFIG_CPU_CORTEX_M1)
112#include <core_cm1.h>
113#elif defined(CONFIG_CPU_CORTEX_M3)
114#include <core_cm3.h>
115#elif defined(CONFIG_CPU_CORTEX_M4)
116#include <core_cm4.h>
117#elif defined(CONFIG_CPU_CORTEX_M7)
118#include <core_cm7.h>
119#elif defined(CONFIG_CPU_CORTEX_M23)
120#include <core_cm23.h>
121#elif defined(CONFIG_CPU_CORTEX_M33)
122#include <core_cm33.h>
123#elif defined(CONFIG_CPU_CORTEX_M55)
124#include <core_cm55.h>
125#else
126#error "Unknown Cortex-M device"
127#endif
128
129#endif /* ZEPHYR_INCLUDE_ARCH_ARM_AARCH32_CORTEX_M_CMSIS_H_ */
#define CONFIG_NUM_IRQS
Definition: irq.h:88
IRQn_Type
Definition: cmsis.h:51
@ PendSV_IRQn
Definition: cmsis.h:65
@ SVCall_IRQn
Definition: cmsis.h:63
@ Reset_IRQn
Definition: cmsis.h:52
@ SysTick_IRQn
Definition: cmsis.h:66
@ DebugMonitor_IRQn
Definition: cmsis.h:64
@ Max_IRQn
Definition: cmsis.h:67
@ HardFault_IRQn
Definition: cmsis.h:54
@ NonMaskableInt_IRQn
Definition: cmsis.h:53