STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
Loading...
Searching...
No Matches
scb_reg.h
Go to the documentation of this file.
1
11#ifndef SCB_REG_H
12#define SCB_REG_H
13
14#include <stdint.h>
15
20
21#define SCB_BASE (0xE000ED00UL)
22
24
29
30#define FPU_BASE (0xE000EF34UL)
31
33
38
40typedef struct ScbRegisters_t
41{
42 volatile const uint32_t CPUID;
43 volatile uint32_t ICSR;
44 volatile uint32_t VTOR;
45 volatile uint32_t AIRCR;
46 volatile uint32_t SCR;
47 volatile uint32_t CCR;
48 volatile uint32_t SHPR1;
49 volatile uint32_t SHPR2;
50 volatile uint32_t SHPR3;
51 volatile uint32_t SHCSR;
52 volatile uint32_t CFSR;
53 volatile uint32_t HFSR;
54 volatile uint32_t DFSR;
55 volatile uint32_t MMFAR;
56 volatile uint32_t BFAR;
57 volatile uint32_t AFSR;
58 volatile uint32_t RESERVED0[18];
59 volatile uint32_t CPACR;
61
62#define SCB ((ScbRegisters_t *)SCB_BASE)
63
65
70
72typedef struct FpuRegisters_t
73{
74 volatile uint32_t FPCCR;
75 volatile uint32_t FPCAR;
76 volatile uint32_t FPDSCR;
78
79#define FPU ((FpuRegisters_t *)FPU_BASE)
80
82
87
91#define SCB_AIRCR_VECTRESET_Pos (0U)
93#define SCB_AIRCR_VECTRESET ((uint32_t)1U << SCB_AIRCR_VECTRESET_Pos)
94#define SCB_AIRCR_SYSRESETREQ_Pos (2U)
96#define SCB_AIRCR_SYSRESETREQ ((uint32_t)1U << SCB_AIRCR_SYSRESETREQ_Pos)
97#define SCB_AIRCR_PRIGROUP_Pos (8U)
99#define SCB_AIRCR_PRIGROUP_Msk ((uint32_t)0x7U << SCB_AIRCR_PRIGROUP_Pos)
100#define SCB_AIRCR_VECTKEY_Pos (16U)
102#define SCB_AIRCR_VECTKEY_Msk ((uint32_t)0xFFFFU << SCB_AIRCR_VECTKEY_Pos)
104#define SCB_AIRCR_VECTKEY_WRITE ((uint32_t)0x5FAU << SCB_AIRCR_VECTKEY_Pos)
106
109#define SCB_ICSR_VECTACTIVE_Pos (0U)
111#define SCB_ICSR_VECTACTIVE_Msk ((uint32_t)0x1FFU << SCB_ICSR_VECTACTIVE_Pos)
112#define SCB_ICSR_PENDSTCLR_Pos (25U)
114#define SCB_ICSR_PENDSTCLR ((uint32_t)1U << SCB_ICSR_PENDSTCLR_Pos)
115#define SCB_ICSR_PENDSTSET_Pos (26U)
117#define SCB_ICSR_PENDSTSET ((uint32_t)1U << SCB_ICSR_PENDSTSET_Pos)
118#define SCB_ICSR_PENDSVCLR_Pos (27U)
120#define SCB_ICSR_PENDSVCLR ((uint32_t)1U << SCB_ICSR_PENDSVCLR_Pos)
121#define SCB_ICSR_PENDSVSET_Pos (28U)
123#define SCB_ICSR_PENDSVSET ((uint32_t)1U << SCB_ICSR_PENDSVSET_Pos)
125
129#define SCB_SCR_SLEEPONEXIT_Pos (1U)
131#define SCB_SCR_SLEEPONEXIT ((uint32_t)1U << SCB_SCR_SLEEPONEXIT_Pos)
132#define SCB_SCR_SLEEPDEEP_Pos (2U)
133#define SCB_SCR_SLEEPDEEP ((uint32_t)1U << SCB_SCR_SLEEPDEEP_Pos)
134#define SCB_SCR_SEVONPEND_Pos (4U)
135#define SCB_SCR_SEVONPEND ((uint32_t)1U << SCB_SCR_SEVONPEND_Pos)
137
141#define SCB_CCR_NONBASETHRDENA_Pos (0U)
143#define SCB_CCR_NONBASETHRDENA ((uint32_t)1U << SCB_CCR_NONBASETHRDENA_Pos)
144#define SCB_CCR_USERSETMPEND_Pos (1U)
146#define SCB_CCR_USERSETMPEND ((uint32_t)1U << SCB_CCR_USERSETMPEND_Pos)
147#define SCB_CCR_UNALIGN_TRP_Pos (3U)
148#define SCB_CCR_UNALIGN_TRP ((uint32_t)1U << SCB_CCR_UNALIGN_TRP_Pos)
149#define SCB_CCR_DIV_0_TRP_Pos (4U)
150#define SCB_CCR_DIV_0_TRP ((uint32_t)1U << SCB_CCR_DIV_0_TRP_Pos)
151#define SCB_CCR_BFHFNMIGN_Pos (8U)
153#define SCB_CCR_BFHFNMIGN ((uint32_t)1U << SCB_CCR_BFHFNMIGN_Pos)
154#define SCB_CCR_STKALIGN_Pos (9U)
156#define SCB_CCR_STKALIGN ((uint32_t)1U << SCB_CCR_STKALIGN_Pos)
158
162#define SCB_SHCSR_MEMFAULTACT_Pos (0U)
164#define SCB_SHCSR_MEMFAULTACT ((uint32_t)1U << SCB_SHCSR_MEMFAULTACT_Pos)
165#define SCB_SHCSR_BUSFAULTACT_Pos (1U)
167#define SCB_SHCSR_BUSFAULTACT ((uint32_t)1U << SCB_SHCSR_BUSFAULTACT_Pos)
168#define SCB_SHCSR_USGFAULTACT_Pos (3U)
170#define SCB_SHCSR_USGFAULTACT ((uint32_t)1U << SCB_SHCSR_USGFAULTACT_Pos)
171#define SCB_SHCSR_SVCALLACT_Pos (7U)
172#define SCB_SHCSR_SVCALLACT ((uint32_t)1U << SCB_SHCSR_SVCALLACT_Pos)
173#define SCB_SHCSR_PENDSVACT_Pos (10U)
174#define SCB_SHCSR_PENDSVACT ((uint32_t)1U << SCB_SHCSR_PENDSVACT_Pos)
175#define SCB_SHCSR_SYSTICKACT_Pos (11U)
177#define SCB_SHCSR_SYSTICKACT ((uint32_t)1U << SCB_SHCSR_SYSTICKACT_Pos)
178#define SCB_SHCSR_USGFAULTPENDED_Pos (12U)
180#define SCB_SHCSR_USGFAULTPENDED ((uint32_t)1U << SCB_SHCSR_USGFAULTPENDED_Pos)
181#define SCB_SHCSR_MEMFAULTPENDED_Pos (13U)
183#define SCB_SHCSR_MEMFAULTPENDED ((uint32_t)1U << SCB_SHCSR_MEMFAULTPENDED_Pos)
184#define SCB_SHCSR_BUSFAULTPENDED_Pos (14U)
186#define SCB_SHCSR_BUSFAULTPENDED ((uint32_t)1U << SCB_SHCSR_BUSFAULTPENDED_Pos)
187#define SCB_SHCSR_SVCALLPENDED_Pos (15U)
189#define SCB_SHCSR_SVCALLPENDED ((uint32_t)1U << SCB_SHCSR_SVCALLPENDED_Pos)
190#define SCB_SHCSR_MEMFAULTENA_Pos (16U)
192#define SCB_SHCSR_MEMFAULTENA ((uint32_t)1U << SCB_SHCSR_MEMFAULTENA_Pos)
193#define SCB_SHCSR_BUSFAULTENA_Pos (17U)
195#define SCB_SHCSR_BUSFAULTENA ((uint32_t)1U << SCB_SHCSR_BUSFAULTENA_Pos)
196#define SCB_SHCSR_USGFAULTENA_Pos (18U)
198#define SCB_SHCSR_USGFAULTENA ((uint32_t)1U << SCB_SHCSR_USGFAULTENA_Pos)
200
204#define SCB_CFSR_IACCVIOL_Pos (0U)
206#define SCB_CFSR_IACCVIOL ((uint32_t)1U << SCB_CFSR_IACCVIOL_Pos)
207#define SCB_CFSR_DACCVIOL_Pos (1U)
209#define SCB_CFSR_DACCVIOL ((uint32_t)1U << SCB_CFSR_DACCVIOL_Pos)
210#define SCB_CFSR_MUNSTKERR_Pos (3U)
212#define SCB_CFSR_MUNSTKERR ((uint32_t)1U << SCB_CFSR_MUNSTKERR_Pos)
213#define SCB_CFSR_MSTKERR_Pos (4U)
215#define SCB_CFSR_MSTKERR ((uint32_t)1U << SCB_CFSR_MSTKERR_Pos)
216#define SCB_CFSR_MLSPERR_Pos (5U)
218#define SCB_CFSR_MLSPERR ((uint32_t)1U << SCB_CFSR_MLSPERR_Pos)
219#define SCB_CFSR_MMARVALID_Pos (7U)
221#define SCB_CFSR_MMARVALID ((uint32_t)1U << SCB_CFSR_MMARVALID_Pos)
222#define SCB_CFSR_IBUSERR_Pos (8U)
224#define SCB_CFSR_IBUSERR ((uint32_t)1U << SCB_CFSR_IBUSERR_Pos)
225#define SCB_CFSR_PRECISERR_Pos (9U)
227#define SCB_CFSR_PRECISERR ((uint32_t)1U << SCB_CFSR_PRECISERR_Pos)
228#define SCB_CFSR_IMPRECISERR_Pos (10U)
230#define SCB_CFSR_IMPRECISERR ((uint32_t)1U << SCB_CFSR_IMPRECISERR_Pos)
231#define SCB_CFSR_UNSTKERR_Pos (11U)
233#define SCB_CFSR_UNSTKERR ((uint32_t)1U << SCB_CFSR_UNSTKERR_Pos)
234#define SCB_CFSR_STKERR_Pos (12U)
236#define SCB_CFSR_STKERR ((uint32_t)1U << SCB_CFSR_STKERR_Pos)
237#define SCB_CFSR_LSPERR_Pos (13U)
239#define SCB_CFSR_LSPERR ((uint32_t)1U << SCB_CFSR_LSPERR_Pos)
240#define SCB_CFSR_BFARVALID_Pos (15U)
242#define SCB_CFSR_BFARVALID ((uint32_t)1U << SCB_CFSR_BFARVALID_Pos)
243#define SCB_CFSR_UNDEFINSTR_Pos (16U)
245#define SCB_CFSR_UNDEFINSTR ((uint32_t)1U << SCB_CFSR_UNDEFINSTR_Pos)
246#define SCB_CFSR_INVSTATE_Pos (17U)
248#define SCB_CFSR_INVSTATE ((uint32_t)1U << SCB_CFSR_INVSTATE_Pos)
249#define SCB_CFSR_INVPC_Pos (18U)
251#define SCB_CFSR_INVPC ((uint32_t)1U << SCB_CFSR_INVPC_Pos)
252#define SCB_CFSR_NOCP_Pos (19U)
254#define SCB_CFSR_NOCP ((uint32_t)1U << SCB_CFSR_NOCP_Pos)
255#define SCB_CFSR_UNALIGNED_Pos (24U)
257#define SCB_CFSR_UNALIGNED ((uint32_t)1U << SCB_CFSR_UNALIGNED_Pos)
258#define SCB_CFSR_DIVBYZERO_Pos (25U)
260#define SCB_CFSR_DIVBYZERO ((uint32_t)1U << SCB_CFSR_DIVBYZERO_Pos)
262
266#define SCB_HFSR_VECTTBL_Pos (1U)
268#define SCB_HFSR_VECTTBL ((uint32_t)1U << SCB_HFSR_VECTTBL_Pos)
269#define SCB_HFSR_FORCED_Pos (30U)
271#define SCB_HFSR_FORCED ((uint32_t)1U << SCB_HFSR_FORCED_Pos)
272#define SCB_HFSR_DEBUGEVT_Pos (31U)
273#define SCB_HFSR_DEBUGEVT ((uint32_t)1U << SCB_HFSR_DEBUGEVT_Pos)
275
279#define SCB_SHPR1_PRI_4_Pos (0U)
280#define SCB_SHPR1_PRI_4_Msk ((uint32_t)0xFFU << SCB_SHPR1_PRI_4_Pos)
281#define SCB_SHPR1_PRI_5_Pos (8U)
282#define SCB_SHPR1_PRI_5_Msk ((uint32_t)0xFFU << SCB_SHPR1_PRI_5_Pos)
283#define SCB_SHPR1_PRI_6_Pos (16U)
284#define SCB_SHPR1_PRI_6_Msk ((uint32_t)0xFFU << SCB_SHPR1_PRI_6_Pos)
285#define SCB_SHPR2_PRI_11_Pos (24U)
286#define SCB_SHPR2_PRI_11_Msk ((uint32_t)0xFFU << SCB_SHPR2_PRI_11_Pos)
287#define SCB_SHPR3_PRI_14_Pos (16U)
288#define SCB_SHPR3_PRI_14_Msk ((uint32_t)0xFFU << SCB_SHPR3_PRI_14_Pos)
289#define SCB_SHPR3_PRI_15_Pos (24U)
290#define SCB_SHPR3_PRI_15_Msk ((uint32_t)0xFFU << SCB_SHPR3_PRI_15_Pos)
292
295#define SCB_CPACR_CP10_Pos (20U)
297#define SCB_CPACR_CP10_Msk ((uint32_t)0x3U << SCB_CPACR_CP10_Pos)
298#define SCB_CPACR_CP11_Pos (22U)
300#define SCB_CPACR_CP11_Msk ((uint32_t)0x3U << SCB_CPACR_CP11_Pos)
302
307#define EXC_RETURN_HANDLER (0xFFFFFFF1UL)
308#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL)
309#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL)
310#define EXC_RETURN_HANDLER_FPU (0xFFFFFFE1UL)
311#define EXC_RETURN_THREAD_MSP_FPU (0xFFFFFFE9UL)
312#define EXC_RETURN_THREAD_PSP_FPU (0xFFFFFFEDUL)
314
316
321
324#define FPU_FPCCR_LSPACT_Pos (0U)
326#define FPU_FPCCR_LSPACT ((uint32_t)1U << FPU_FPCCR_LSPACT_Pos)
327#define FPU_FPCCR_LSPEN_Pos (30U)
329#define FPU_FPCCR_LSPEN ((uint32_t)1U << FPU_FPCCR_LSPEN_Pos)
330#define FPU_FPCCR_ASPEN_Pos (31U)
332#define FPU_FPCCR_ASPEN ((uint32_t)1U << FPU_FPCCR_ASPEN_Pos)
334
336
337#endif /* SCB_REG_H */
FPU context-control register block.
Definition scb_reg.h:73
volatile uint32_t FPCAR
0x04 (0xE000EF38): context address
Definition scb_reg.h:75
volatile uint32_t FPCCR
0x00 (0xE000EF34): context control
Definition scb_reg.h:74
volatile uint32_t FPDSCR
0x08 (0xE000EF3C): default status control
Definition scb_reg.h:76
SCB register block.
Definition scb_reg.h:41
volatile uint32_t AIRCR
0x0C: application interrupt and reset control
Definition scb_reg.h:45
volatile uint32_t VTOR
0x08: vector table offset
Definition scb_reg.h:44
volatile uint32_t SHPR1
0x18: priority of MemManage, BusFault, UsageFault
Definition scb_reg.h:48
volatile uint32_t BFAR
0x38: BusFault address
Definition scb_reg.h:56
volatile uint32_t SHPR3
0x20: priority of PendSV, SysTick
Definition scb_reg.h:50
volatile uint32_t CCR
0x14: configuration and control
Definition scb_reg.h:47
volatile uint32_t MMFAR
0x34: MemManage fault address
Definition scb_reg.h:55
volatile uint32_t RESERVED0[18]
0x40-0x84: CPU feature registers, not modelled
Definition scb_reg.h:58
volatile uint32_t SCR
0x10: system control (sleep)
Definition scb_reg.h:46
volatile uint32_t DFSR
0x30: debug fault status
Definition scb_reg.h:54
volatile uint32_t SHPR2
0x1C: priority of SVCall
Definition scb_reg.h:49
volatile uint32_t HFSR
0x2C: HardFault status
Definition scb_reg.h:53
volatile uint32_t CFSR
0x28: configurable fault status (MMFSR, BFSR, UFSR)
Definition scb_reg.h:52
volatile const uint32_t CPUID
0x00: CPU ID, <span class="regaccess">ro</span>
Definition scb_reg.h:42
volatile uint32_t AFSR
0x3C: auxiliary fault status
Definition scb_reg.h:57
volatile uint32_t CPACR
0x88: coprocessor access control (FPU enable)
Definition scb_reg.h:59
volatile uint32_t ICSR
0x04: interrupt control and state
Definition scb_reg.h:43
volatile uint32_t SHCSR
0x24: system handler control and state
Definition scb_reg.h:51