Zephyr API Documentation  2.7.0-rc2
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 */
67} IRQn_Type;
68
69#if defined(CONFIG_CPU_CORTEX_M0)
70#define __CM0_REV 0
71#elif defined(CONFIG_CPU_CORTEX_M0PLUS)
72#define __CM0PLUS_REV 0
73#elif defined(CONFIG_CPU_CORTEX_M1)
74#define __CM1_REV 0
75#elif defined(CONFIG_CPU_CORTEX_M3)
76#define __CM3_REV 0
77#elif defined(CONFIG_CPU_CORTEX_M4)
78#define __CM4_REV 0
79#elif defined(CONFIG_CPU_CORTEX_M7)
80#define __CM7_REV 0
81#elif defined(CONFIG_CPU_CORTEX_M23)
82#define __CM23_REV 0
83#elif defined(CONFIG_CPU_CORTEX_M33)
84#define __CM33_REV 0
85#elif defined(CONFIG_CPU_CORTEX_M55)
86#define __CM55_REV 0
87#else
88#error "Unknown Cortex-M device"
89#endif
90
91#ifndef __MPU_PRESENT
92#define __MPU_PRESENT 0U
93#endif
94#define __NVIC_PRIO_BITS NUM_IRQ_PRIO_BITS
95#define __Vendor_SysTickConfig 0 /* Default to standard SysTick */
96#endif /* __NVIC_PRIO_BITS */
97
98#if __NVIC_PRIO_BITS != NUM_IRQ_PRIO_BITS
99#error "NUM_IRQ_PRIO_BITS and __NVIC_PRIO_BITS are not set to the same value"
100#endif
101
102#ifdef __cplusplus
103}
104#endif
105
106#if defined(CONFIG_CPU_CORTEX_M0)
107#include <core_cm0.h>
108#elif defined(CONFIG_CPU_CORTEX_M0PLUS)
109#include <core_cm0plus.h>
110#elif defined(CONFIG_CPU_CORTEX_M1)
111#include <core_cm1.h>
112#elif defined(CONFIG_CPU_CORTEX_M3)
113#include <core_cm3.h>
114#elif defined(CONFIG_CPU_CORTEX_M4)
115#include <core_cm4.h>
116#elif defined(CONFIG_CPU_CORTEX_M7)
117#include <core_cm7.h>
118#elif defined(CONFIG_CPU_CORTEX_M23)
119#include <core_cm23.h>
120#elif defined(CONFIG_CPU_CORTEX_M33)
121#include <core_cm33.h>
122#elif defined(CONFIG_CPU_CORTEX_M55)
123#include <core_cm55.h>
124#else
125#error "Unknown Cortex-M device"
126#endif
127
128#endif /* ZEPHYR_INCLUDE_ARCH_ARM_AARCH32_CORTEX_M_CMSIS_H_ */
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
@ HardFault_IRQn
Definition: cmsis.h:54
@ NonMaskableInt_IRQn
Definition: cmsis.h:53