Imt.Base C++ API V4.1.1.0
Loading...
Searching...
No Matches
Core_CortexM3.h
Go to the documentation of this file.
1// (c) IMT - Information Management Technology AG, CH-9470 Buchs, www.imt.ch.
2
3#ifndef CORE_CORTEXM3_H
4#define CORE_CORTEXM3_H
5
7
8#include "SystemMemoryMap.h"
9
10// System Control Block (SCB) register structure
11// Reference: Cortex-M3 Devices Generic User Guide DUI0552A Table 4-12
12typedef struct {
13 // Offset: 0x00 CPU ID Base Register
14 uint32_t volatile CPUID;
15 // Offset: 0x04 Interrupt Control State Register
16 uint32_t volatile ICSR;
17 // Offset: 0x08 Vector Table Offset Register
18 uint32_t volatile VTOR;
19 // Offset: 0x0C Application Interrupt / Reset Control Register
20 uint32_t volatile AIRCR;
21 // Offset: 0x10 System Control Register
22 uint32_t volatile SCR;
23 // Offset: 0x14 Configuration Control Register
24 uint32_t volatile CCR;
25 // Offset: 0x18 System Handlers Priority Registers (4-7, 8-11, 12-15)
26 uint8_t volatile SHPR[12];
27 // Offset: 0x24 System Handler Control and State Register
28 uint32_t volatile SHCRS;
29 // Offset: 0x28 Configurable Fault Status Register
30 uint32_t volatile CFSR;
31 // Offset: 0x2C Hard Fault Status Register
32 uint32_t volatile HFSR;
33 // Offset: 0x30 Debug Fault Status Register
34 uint32_t volatile DFSR;
35 // Offset: 0x34 Mem Manage Address Register
36 uint32_t volatile MMAR;
37 // Offset: 0x38 Bus Fault Address Register
38 uint32_t volatile BFAR;
39 // Offset: 0x3C Auxiliary Fault Status Register
40 uint32_t volatile AFSR;
41} SCB_Type;
42// SCB configuration struct
43#define SCB ((SCB_Type*)SCB_BASE)
44
45// Bit definition for SCB_ICSR register
46// Active ISR number field
47#define SCB_ICSR_VECTACTIVE ((uint32_t)0x000001FF)
48// All active exceptions minus the IPSR_current_exception yields the empty set
49#define SCB_ICSR_RETTOBASE ((uint32_t)0x00000800)
50// Pending ISR number field
51#define SCB_ICSR_VECTPENDING ((uint32_t)0x003FF000)
52// Interrupt pending flag
53#define SCB_ICSR_ISRPENDING ((uint32_t)0x00400000)
54// Clear pending SysTick bit
55#define SCB_ICSR_PENDSTCLR ((uint32_t)0x02000000)
56// Set pending SysTick bit
57#define SCB_ICSR_PENDSTSET ((uint32_t)0x04000000)
58// Clear pending pendSV bit
59#define SCB_ICSR_PENDSVCLR ((uint32_t)0x08000000)
60// Set pending pendSV bit
61#define SCB_ICSR_PENDSVSET ((uint32_t)0x10000000)
62// Set pending NMI bit
63#define SCB_ICSR_NMIPENDSET ((uint32_t)0x80000000)
64
65// Bit definition for SCB_SCR register
66// Sleep deep bit
67#define SCB_SCR_SLEEPDEEP ((uint8_t)0x04)
68
69// SCB Application Interrupt and Reset Control Register Definitions
70// SCB AIRCR: VECTKEY Position
71#define SCB_AIRCR_VECTKEY_Pos 16
72// SCB AIRCR: VECTKEY Mask
73#define SCB_AIRCR_VECTKEY_Mask (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos)
74// SCB AIRCR: PRIGROUP Position
75#define SCB_AIRCR_PRIGROUP_Pos 8
76// SCB AIRCR: PRIGROUP Mask
77#define SCB_AIRCR_PRIGROUP_Mask (7UL << SCB_AIRCR_PRIGROUP_Pos)
78// SCB AIRCR: System reset request
79#define SCB_AIRCR_SYSRESETREQ 0x4U
80
81#endif // CORE_CORTEXM3_H
unsigned __int32 uint32_t
Definition stdint.h:64
unsigned __int8 uint8_t
Definition stdint.h:62
uint32_t volatile CFSR
uint32_t volatile DFSR
uint32_t volatile AFSR
uint32_t volatile BFAR
uint32_t volatile SHCRS
uint32_t volatile MMAR
uint32_t volatile HFSR