1 /**************************************************************************//**
\r
3 * @brief CMSIS Cortex-M3 Core Peripheral Access Layer Header File
\r
5 * @date 16. February 2010
\r
8 * Copyright (C) 2009-2010 ARM Limited. All rights reserved.
\r
11 * ARM Limited (ARM) is supplying this software for use with Cortex-M
\r
12 * processor based microcontrollers. This file can be freely distributed
\r
13 * within development tools that are supporting such ARM based processors.
\r
16 * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
\r
17 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
\r
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
\r
19 * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
\r
20 * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
\r
22 ******************************************************************************/
\r
24 #ifndef __CORE_CM3_H__
\r
25 #define __CORE_CM3_H__
\r
27 /** @addtogroup CMSIS_CM3_core_LintCinfiguration CMSIS CM3 Core Lint Configuration
\r
29 * List of Lint messages which will be suppressed and not shown:
\r
32 * Note: To re-enable a Message, insert a space before 'lint' *
\r
37 /** @addtogroup CMSIS_CM3_core_definitions CM3 Core Definitions
\r
38 This file defines all structures and symbols for CMSIS core:
\r
39 - CMSIS version number
\r
40 - Cortex-M core registers and bitfields
\r
41 - Cortex-M core peripheral base address
\r
49 #define __CM3_CMSIS_VERSION_MAIN (0x01) /*!< [31:16] CMSIS HAL main version */
\r
50 #define __CM3_CMSIS_VERSION_SUB (0x40) /*!< [15:0] CMSIS HAL sub version */
\r
51 #define __CM3_CMSIS_VERSION ((__CM3_CMSIS_VERSION_MAIN << 16) | __CM3_CMSIS_VERSION_SUB) /*!< CMSIS HAL version number */
\r
53 #define __CORTEX_M (0x03) /*!< Cortex core */
\r
55 #ifndef __NVIC_PRIO_BITS
\r
56 #define __NVIC_PRIO_BITS 4 /*!< standard definition for NVIC Priority Bits */
\r
60 #include <stdint.h> /* Include standard types */
\r
67 * define access restrictions to peripheral registers
\r
71 #define __I volatile /*!< defines 'read only' permissions */
\r
73 #define __I volatile const /*!< defines 'read only' permissions */
\r
75 #define __O volatile /*!< defines 'write only' permissions */
\r
76 #define __IO volatile /*!< defines 'read / write' permissions */
\r
80 /*******************************************************************************
\r
81 * Register Abstraction
\r
82 ******************************************************************************/
\r
83 /** @addtogroup CMSIS_CM3_core_register CMSIS CM3 Core Register
\r
87 /** @addtogroup CMSIS_ARM_CORE CMSIS ARM Core
\r
88 memory mapped structure for Nested Vectored Interrupt Controller (NVIC)
\r
95 #if (__CORTEX_M != 0x04)
\r
96 uint32_t _reserved0:27;
\r
98 uint32_t _reserved0:16;
\r
99 uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
\r
100 uint32_t _reserved1:7;
\r
102 uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
\r
103 uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
\r
104 uint32_t C:1; /*!< bit: 29 Carry condition code flag */
\r
105 uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
\r
106 uint32_t N:1; /*!< bit: 31 Negative condition code flag */
\r
115 uint32_t ISR:9; /*!< bit: 00..08 Exception number */
\r
116 uint32_t _reserved0:23;
\r
125 uint32_t ISR:9; /*!< bit: 00..08 Exception number */
\r
126 #if (__CORTEX_M != 0x04)
\r
127 uint32_t _reserved0:15;
\r
129 uint32_t _reserved0:7;
\r
130 uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
\r
131 uint32_t _reserved1:4;
\r
133 uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
\r
134 uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */
\r
135 uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
\r
136 uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
\r
137 uint32_t C:1; /*!< bit: 29 Carry condition code flag */
\r
138 uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
\r
139 uint32_t N:1; /*!< bit: 31 Negative condition code flag */
\r
148 uint32_t nPRIV:1; /*!< bit: 00 Execution privilege in Thread mode */
\r
149 uint32_t SPSEL:1; /*!< bit: 01 Stack to be used */
\r
150 uint32_t FPCA:1; /*!< bit: 02 FP extension active flag */
\r
151 uint32_t _reserved0:29;
\r
156 /*@}*/ /* end of group CMSIS_ARM_CORE */
\r
159 /** @addtogroup CMSIS_CM3_NVIC CMSIS CM3 NVIC
\r
160 memory mapped structure for Nested Vectored Interrupt Controller (NVIC)
\r
165 __IO uint32_t ISER[8]; /*!< Offset: 0x000 Interrupt Set Enable Register */
\r
166 uint32_t RESERVED0[24];
\r
167 __IO uint32_t ICER[8]; /*!< Offset: 0x080 Interrupt Clear Enable Register */
\r
168 uint32_t RSERVED1[24];
\r
169 __IO uint32_t ISPR[8]; /*!< Offset: 0x100 Interrupt Set Pending Register */
\r
170 uint32_t RESERVED2[24];
\r
171 __IO uint32_t ICPR[8]; /*!< Offset: 0x180 Interrupt Clear Pending Register */
\r
172 uint32_t RESERVED3[24];
\r
173 __IO uint32_t IABR[8]; /*!< Offset: 0x200 Interrupt Active bit Register */
\r
174 uint32_t RESERVED4[56];
\r
175 __IO uint8_t IP[240]; /*!< Offset: 0x300 Interrupt Priority Register (8Bit wide) */
\r
176 uint32_t RESERVED5[644];
\r
177 __O uint32_t STIR; /*!< Offset: 0xE00 Software Trigger Interrupt Register */
\r
179 /*@}*/ /* end of group CMSIS_CM3_NVIC */
\r
182 /** @addtogroup CMSIS_CM3_SCB CMSIS CM3 SCB
\r
183 memory mapped structure for System Control Block (SCB)
\r
188 __I uint32_t CPUID; /*!< Offset: 0x00 CPU ID Base Register */
\r
189 __IO uint32_t ICSR; /*!< Offset: 0x04 Interrupt Control State Register */
\r
190 __IO uint32_t VTOR; /*!< Offset: 0x08 Vector Table Offset Register */
\r
191 __IO uint32_t AIRCR; /*!< Offset: 0x0C Application Interrupt / Reset Control Register */
\r
192 __IO uint32_t SCR; /*!< Offset: 0x10 System Control Register */
\r
193 __IO uint32_t CCR; /*!< Offset: 0x14 Configuration Control Register */
\r
194 __IO uint8_t SHP[12]; /*!< Offset: 0x18 System Handlers Priority Registers (4-7, 8-11, 12-15) */
\r
195 __IO uint32_t SHCSR; /*!< Offset: 0x24 System Handler Control and State Register */
\r
196 __IO uint32_t CFSR; /*!< Offset: 0x28 Configurable Fault Status Register */
\r
197 __IO uint32_t HFSR; /*!< Offset: 0x2C Hard Fault Status Register */
\r
198 __IO uint32_t DFSR; /*!< Offset: 0x30 Debug Fault Status Register */
\r
199 __IO uint32_t MMFAR; /*!< Offset: 0x34 Mem Manage Address Register */
\r
200 __IO uint32_t BFAR; /*!< Offset: 0x38 Bus Fault Address Register */
\r
201 __IO uint32_t AFSR; /*!< Offset: 0x3C Auxiliary Fault Status Register */
\r
202 __I uint32_t PFR[2]; /*!< Offset: 0x40 Processor Feature Register */
\r
203 __I uint32_t DFR; /*!< Offset: 0x48 Debug Feature Register */
\r
204 __I uint32_t ADR; /*!< Offset: 0x4C Auxiliary Feature Register */
\r
205 __I uint32_t MMFR[4]; /*!< Offset: 0x50 Memory Model Feature Register */
\r
206 __I uint32_t ISAR[5]; /*!< Offset: 0x60 ISA Feature Register */
\r
209 /* SCB CPUID Register Definitions */
\r
210 #define SCB_CPUID_IMPLEMENTER_Pos 24 /*!< SCB CPUID: IMPLEMENTER Position */
\r
211 #define SCB_CPUID_IMPLEMENTER_Msk (0xFFul << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
\r
213 #define SCB_CPUID_VARIANT_Pos 20 /*!< SCB CPUID: VARIANT Position */
\r
214 #define SCB_CPUID_VARIANT_Msk (0xFul << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
\r
216 #define SCB_CPUID_PARTNO_Pos 4 /*!< SCB CPUID: PARTNO Position */
\r
217 #define SCB_CPUID_PARTNO_Msk (0xFFFul << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
\r
219 #define SCB_CPUID_REVISION_Pos 0 /*!< SCB CPUID: REVISION Position */
\r
220 #define SCB_CPUID_REVISION_Msk (0xFul << SCB_CPUID_REVISION_Pos) /*!< SCB CPUID: REVISION Mask */
\r
222 /* SCB Interrupt Control State Register Definitions */
\r
223 #define SCB_ICSR_NMIPENDSET_Pos 31 /*!< SCB ICSR: NMIPENDSET Position */
\r
224 #define SCB_ICSR_NMIPENDSET_Msk (1ul << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
\r
226 #define SCB_ICSR_PENDSVSET_Pos 28 /*!< SCB ICSR: PENDSVSET Position */
\r
227 #define SCB_ICSR_PENDSVSET_Msk (1ul << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
\r
229 #define SCB_ICSR_PENDSVCLR_Pos 27 /*!< SCB ICSR: PENDSVCLR Position */
\r
230 #define SCB_ICSR_PENDSVCLR_Msk (1ul << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
\r
232 #define SCB_ICSR_PENDSTSET_Pos 26 /*!< SCB ICSR: PENDSTSET Position */
\r
233 #define SCB_ICSR_PENDSTSET_Msk (1ul << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
\r
235 #define SCB_ICSR_PENDSTCLR_Pos 25 /*!< SCB ICSR: PENDSTCLR Position */
\r
236 #define SCB_ICSR_PENDSTCLR_Msk (1ul << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
\r
238 #define SCB_ICSR_ISRPREEMPT_Pos 23 /*!< SCB ICSR: ISRPREEMPT Position */
\r
239 #define SCB_ICSR_ISRPREEMPT_Msk (1ul << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
\r
241 #define SCB_ICSR_ISRPENDING_Pos 22 /*!< SCB ICSR: ISRPENDING Position */
\r
242 #define SCB_ICSR_ISRPENDING_Msk (1ul << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
\r
244 #define SCB_ICSR_VECTPENDING_Pos 12 /*!< SCB ICSR: VECTPENDING Position */
\r
245 #define SCB_ICSR_VECTPENDING_Msk (0x1FFul << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
\r
247 #define SCB_ICSR_RETTOBASE_Pos 11 /*!< SCB ICSR: RETTOBASE Position */
\r
248 #define SCB_ICSR_RETTOBASE_Msk (1ul << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */
\r
250 #define SCB_ICSR_VECTACTIVE_Pos 0 /*!< SCB ICSR: VECTACTIVE Position */
\r
251 #define SCB_ICSR_VECTACTIVE_Msk (0x1FFul << SCB_ICSR_VECTACTIVE_Pos) /*!< SCB ICSR: VECTACTIVE Mask */
\r
253 /* SCB Interrupt Control State Register Definitions */
\r
254 #define SCB_VTOR_TBLBASE_Pos 29 /*!< SCB VTOR: TBLBASE Position */
\r
255 #define SCB_VTOR_TBLBASE_Msk (0x1FFul << SCB_VTOR_TBLBASE_Pos) /*!< SCB VTOR: TBLBASE Mask */
\r
257 #define SCB_VTOR_TBLOFF_Pos 7 /*!< SCB VTOR: TBLOFF Position */
\r
258 #define SCB_VTOR_TBLOFF_Msk (0x3FFFFFul << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
\r
260 /* SCB Application Interrupt and Reset Control Register Definitions */
\r
261 #define SCB_AIRCR_VECTKEY_Pos 16 /*!< SCB AIRCR: VECTKEY Position */
\r
262 #define SCB_AIRCR_VECTKEY_Msk (0xFFFFul << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
\r
264 #define SCB_AIRCR_VECTKEYSTAT_Pos 16 /*!< SCB AIRCR: VECTKEYSTAT Position */
\r
265 #define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFul << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
\r
267 #define SCB_AIRCR_ENDIANESS_Pos 15 /*!< SCB AIRCR: ENDIANESS Position */
\r
268 #define SCB_AIRCR_ENDIANESS_Msk (1ul << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
\r
270 #define SCB_AIRCR_PRIGROUP_Pos 8 /*!< SCB AIRCR: PRIGROUP Position */
\r
271 #define SCB_AIRCR_PRIGROUP_Msk (7ul << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */
\r
273 #define SCB_AIRCR_SYSRESETREQ_Pos 2 /*!< SCB AIRCR: SYSRESETREQ Position */
\r
274 #define SCB_AIRCR_SYSRESETREQ_Msk (1ul << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
\r
276 #define SCB_AIRCR_VECTCLRACTIVE_Pos 1 /*!< SCB AIRCR: VECTCLRACTIVE Position */
\r
277 #define SCB_AIRCR_VECTCLRACTIVE_Msk (1ul << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
\r
279 #define SCB_AIRCR_VECTRESET_Pos 0 /*!< SCB AIRCR: VECTRESET Position */
\r
280 #define SCB_AIRCR_VECTRESET_Msk (1ul << SCB_AIRCR_VECTRESET_Pos) /*!< SCB AIRCR: VECTRESET Mask */
\r
282 /* SCB System Control Register Definitions */
\r
283 #define SCB_SCR_SEVONPEND_Pos 4 /*!< SCB SCR: SEVONPEND Position */
\r
284 #define SCB_SCR_SEVONPEND_Msk (1ul << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
\r
286 #define SCB_SCR_SLEEPDEEP_Pos 2 /*!< SCB SCR: SLEEPDEEP Position */
\r
287 #define SCB_SCR_SLEEPDEEP_Msk (1ul << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
\r
289 #define SCB_SCR_SLEEPONEXIT_Pos 1 /*!< SCB SCR: SLEEPONEXIT Position */
\r
290 #define SCB_SCR_SLEEPONEXIT_Msk (1ul << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
\r
292 /* SCB Configuration Control Register Definitions */
\r
293 #define SCB_CCR_STKALIGN_Pos 9 /*!< SCB CCR: STKALIGN Position */
\r
294 #define SCB_CCR_STKALIGN_Msk (1ul << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
\r
296 #define SCB_CCR_BFHFNMIGN_Pos 8 /*!< SCB CCR: BFHFNMIGN Position */
\r
297 #define SCB_CCR_BFHFNMIGN_Msk (1ul << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */
\r
299 #define SCB_CCR_DIV_0_TRP_Pos 4 /*!< SCB CCR: DIV_0_TRP Position */
\r
300 #define SCB_CCR_DIV_0_TRP_Msk (1ul << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */
\r
302 #define SCB_CCR_UNALIGN_TRP_Pos 3 /*!< SCB CCR: UNALIGN_TRP Position */
\r
303 #define SCB_CCR_UNALIGN_TRP_Msk (1ul << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
\r
305 #define SCB_CCR_USERSETMPEND_Pos 1 /*!< SCB CCR: USERSETMPEND Position */
\r
306 #define SCB_CCR_USERSETMPEND_Msk (1ul << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */
\r
308 #define SCB_CCR_NONBASETHRDENA_Pos 0 /*!< SCB CCR: NONBASETHRDENA Position */
\r
309 #define SCB_CCR_NONBASETHRDENA_Msk (1ul << SCB_CCR_NONBASETHRDENA_Pos) /*!< SCB CCR: NONBASETHRDENA Mask */
\r
311 /* SCB System Handler Control and State Register Definitions */
\r
312 #define SCB_SHCSR_USGFAULTENA_Pos 18 /*!< SCB SHCSR: USGFAULTENA Position */
\r
313 #define SCB_SHCSR_USGFAULTENA_Msk (1ul << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */
\r
315 #define SCB_SHCSR_BUSFAULTENA_Pos 17 /*!< SCB SHCSR: BUSFAULTENA Position */
\r
316 #define SCB_SHCSR_BUSFAULTENA_Msk (1ul << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */
\r
318 #define SCB_SHCSR_MEMFAULTENA_Pos 16 /*!< SCB SHCSR: MEMFAULTENA Position */
\r
319 #define SCB_SHCSR_MEMFAULTENA_Msk (1ul << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */
\r
321 #define SCB_SHCSR_SVCALLPENDED_Pos 15 /*!< SCB SHCSR: SVCALLPENDED Position */
\r
322 #define SCB_SHCSR_SVCALLPENDED_Msk (1ul << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
\r
324 #define SCB_SHCSR_BUSFAULTPENDED_Pos 14 /*!< SCB SHCSR: BUSFAULTPENDED Position */
\r
325 #define SCB_SHCSR_BUSFAULTPENDED_Msk (1ul << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */
\r
327 #define SCB_SHCSR_MEMFAULTPENDED_Pos 13 /*!< SCB SHCSR: MEMFAULTPENDED Position */
\r
328 #define SCB_SHCSR_MEMFAULTPENDED_Msk (1ul << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */
\r
330 #define SCB_SHCSR_USGFAULTPENDED_Pos 12 /*!< SCB SHCSR: USGFAULTPENDED Position */
\r
331 #define SCB_SHCSR_USGFAULTPENDED_Msk (1ul << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */
\r
333 #define SCB_SHCSR_SYSTICKACT_Pos 11 /*!< SCB SHCSR: SYSTICKACT Position */
\r
334 #define SCB_SHCSR_SYSTICKACT_Msk (1ul << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */
\r
336 #define SCB_SHCSR_PENDSVACT_Pos 10 /*!< SCB SHCSR: PENDSVACT Position */
\r
337 #define SCB_SHCSR_PENDSVACT_Msk (1ul << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */
\r
339 #define SCB_SHCSR_MONITORACT_Pos 8 /*!< SCB SHCSR: MONITORACT Position */
\r
340 #define SCB_SHCSR_MONITORACT_Msk (1ul << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */
\r
342 #define SCB_SHCSR_SVCALLACT_Pos 7 /*!< SCB SHCSR: SVCALLACT Position */
\r
343 #define SCB_SHCSR_SVCALLACT_Msk (1ul << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */
\r
345 #define SCB_SHCSR_USGFAULTACT_Pos 3 /*!< SCB SHCSR: USGFAULTACT Position */
\r
346 #define SCB_SHCSR_USGFAULTACT_Msk (1ul << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */
\r
348 #define SCB_SHCSR_BUSFAULTACT_Pos 1 /*!< SCB SHCSR: BUSFAULTACT Position */
\r
349 #define SCB_SHCSR_BUSFAULTACT_Msk (1ul << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */
\r
351 #define SCB_SHCSR_MEMFAULTACT_Pos 0 /*!< SCB SHCSR: MEMFAULTACT Position */
\r
352 #define SCB_SHCSR_MEMFAULTACT_Msk (1ul << SCB_SHCSR_MEMFAULTACT_Pos) /*!< SCB SHCSR: MEMFAULTACT Mask */
\r
354 /* SCB Configurable Fault Status Registers Definitions */
\r
355 #define SCB_CFSR_USGFAULTSR_Pos 16 /*!< SCB CFSR: Usage Fault Status Register Position */
\r
356 #define SCB_CFSR_USGFAULTSR_Msk (0xFFFFul << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */
\r
358 #define SCB_CFSR_BUSFAULTSR_Pos 8 /*!< SCB CFSR: Bus Fault Status Register Position */
\r
359 #define SCB_CFSR_BUSFAULTSR_Msk (0xFFul << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */
\r
361 #define SCB_CFSR_MEMFAULTSR_Pos 0 /*!< SCB CFSR: Memory Manage Fault Status Register Position */
\r
362 #define SCB_CFSR_MEMFAULTSR_Msk (0xFFul << SCB_CFSR_MEMFAULTSR_Pos) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
\r
364 /* SCB Hard Fault Status Registers Definitions */
\r
365 #define SCB_HFSR_DEBUGEVT_Pos 31 /*!< SCB HFSR: DEBUGEVT Position */
\r
366 #define SCB_HFSR_DEBUGEVT_Msk (1ul << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */
\r
368 #define SCB_HFSR_FORCED_Pos 30 /*!< SCB HFSR: FORCED Position */
\r
369 #define SCB_HFSR_FORCED_Msk (1ul << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */
\r
371 #define SCB_HFSR_VECTTBL_Pos 1 /*!< SCB HFSR: VECTTBL Position */
\r
372 #define SCB_HFSR_VECTTBL_Msk (1ul << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */
\r
374 /* SCB Debug Fault Status Register Definitions */
\r
375 #define SCB_DFSR_EXTERNAL_Pos 4 /*!< SCB DFSR: EXTERNAL Position */
\r
376 #define SCB_DFSR_EXTERNAL_Msk (1ul << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */
\r
378 #define SCB_DFSR_VCATCH_Pos 3 /*!< SCB DFSR: VCATCH Position */
\r
379 #define SCB_DFSR_VCATCH_Msk (1ul << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */
\r
381 #define SCB_DFSR_DWTTRAP_Pos 2 /*!< SCB DFSR: DWTTRAP Position */
\r
382 #define SCB_DFSR_DWTTRAP_Msk (1ul << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */
\r
384 #define SCB_DFSR_BKPT_Pos 1 /*!< SCB DFSR: BKPT Position */
\r
385 #define SCB_DFSR_BKPT_Msk (1ul << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */
\r
387 #define SCB_DFSR_HALTED_Pos 0 /*!< SCB DFSR: HALTED Position */
\r
388 #define SCB_DFSR_HALTED_Msk (1ul << SCB_DFSR_HALTED_Pos) /*!< SCB DFSR: HALTED Mask */
\r
389 /*@}*/ /* end of group CMSIS_CM3_SCB */
\r
392 /** @addtogroup CMSIS_CM3_SysTick CMSIS CM3 SysTick
\r
393 memory mapped structure for SysTick
\r
398 __IO uint32_t CTRL; /*!< Offset: 0x00 SysTick Control and Status Register */
\r
399 __IO uint32_t LOAD; /*!< Offset: 0x04 SysTick Reload Value Register */
\r
400 __IO uint32_t VAL; /*!< Offset: 0x08 SysTick Current Value Register */
\r
401 __I uint32_t CALIB; /*!< Offset: 0x0C SysTick Calibration Register */
\r
404 /* SysTick Control / Status Register Definitions */
\r
405 #define SysTick_CTRL_COUNTFLAG_Pos 16 /*!< SysTick CTRL: COUNTFLAG Position */
\r
406 #define SysTick_CTRL_COUNTFLAG_Msk (1ul << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
\r
408 #define SysTick_CTRL_CLKSOURCE_Pos 2 /*!< SysTick CTRL: CLKSOURCE Position */
\r
409 #define SysTick_CTRL_CLKSOURCE_Msk (1ul << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
\r
411 #define SysTick_CTRL_TICKINT_Pos 1 /*!< SysTick CTRL: TICKINT Position */
\r
412 #define SysTick_CTRL_TICKINT_Msk (1ul << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
\r
414 #define SysTick_CTRL_ENABLE_Pos 0 /*!< SysTick CTRL: ENABLE Position */
\r
415 #define SysTick_CTRL_ENABLE_Msk (1ul << SysTick_CTRL_ENABLE_Pos) /*!< SysTick CTRL: ENABLE Mask */
\r
417 /* SysTick Reload Register Definitions */
\r
418 #define SysTick_LOAD_RELOAD_Pos 0 /*!< SysTick LOAD: RELOAD Position */
\r
419 #define SysTick_LOAD_RELOAD_Msk (0xFFFFFFul << SysTick_LOAD_RELOAD_Pos) /*!< SysTick LOAD: RELOAD Mask */
\r
421 /* SysTick Current Register Definitions */
\r
422 #define SysTick_VAL_CURRENT_Pos 0 /*!< SysTick VAL: CURRENT Position */
\r
423 #define SysTick_VAL_CURRENT_Msk (0xFFFFFFul << SysTick_VAL_CURRENT_Pos) /*!< SysTick VAL: CURRENT Mask */
\r
425 /* SysTick Calibration Register Definitions */
\r
426 #define SysTick_CALIB_NOREF_Pos 31 /*!< SysTick CALIB: NOREF Position */
\r
427 #define SysTick_CALIB_NOREF_Msk (1ul << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
\r
429 #define SysTick_CALIB_SKEW_Pos 30 /*!< SysTick CALIB: SKEW Position */
\r
430 #define SysTick_CALIB_SKEW_Msk (1ul << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
\r
432 #define SysTick_CALIB_TENMS_Pos 0 /*!< SysTick CALIB: TENMS Position */
\r
433 #define SysTick_CALIB_TENMS_Msk (0xFFFFFFul << SysTick_VAL_CURRENT_Pos) /*!< SysTick CALIB: TENMS Mask */
\r
434 /*@}*/ /* end of group CMSIS_CM3_SysTick */
\r
437 /** @addtogroup CMSIS_CM3_ITM CMSIS CM3 ITM
\r
438 memory mapped structure for Instrumentation Trace Macrocell (ITM)
\r
445 __O uint8_t u8; /*!< Offset: ITM Stimulus Port 8-bit */
\r
446 __O uint16_t u16; /*!< Offset: ITM Stimulus Port 16-bit */
\r
447 __O uint32_t u32; /*!< Offset: ITM Stimulus Port 32-bit */
\r
448 } PORT [32]; /*!< Offset: 0x00 ITM Stimulus Port Registers */
\r
449 uint32_t RESERVED0[864];
\r
450 __IO uint32_t TER; /*!< Offset: ITM Trace Enable Register */
\r
451 uint32_t RESERVED1[15];
\r
452 __IO uint32_t TPR; /*!< Offset: ITM Trace Privilege Register */
\r
453 uint32_t RESERVED2[15];
\r
454 __IO uint32_t TCR; /*!< Offset: ITM Trace Control Register */
\r
455 uint32_t RESERVED3[29];
\r
456 __IO uint32_t IWR; /*!< Offset: ITM Integration Write Register */
\r
457 __IO uint32_t IRR; /*!< Offset: ITM Integration Read Register */
\r
458 __IO uint32_t IMCR; /*!< Offset: ITM Integration Mode Control Register */
\r
459 uint32_t RESERVED4[43];
\r
460 __IO uint32_t LAR; /*!< Offset: ITM Lock Access Register */
\r
461 __IO uint32_t LSR; /*!< Offset: ITM Lock Status Register */
\r
462 uint32_t RESERVED5[6];
\r
463 __I uint32_t PID4; /*!< Offset: ITM Peripheral Identification Register #4 */
\r
464 __I uint32_t PID5; /*!< Offset: ITM Peripheral Identification Register #5 */
\r
465 __I uint32_t PID6; /*!< Offset: ITM Peripheral Identification Register #6 */
\r
466 __I uint32_t PID7; /*!< Offset: ITM Peripheral Identification Register #7 */
\r
467 __I uint32_t PID0; /*!< Offset: ITM Peripheral Identification Register #0 */
\r
468 __I uint32_t PID1; /*!< Offset: ITM Peripheral Identification Register #1 */
\r
469 __I uint32_t PID2; /*!< Offset: ITM Peripheral Identification Register #2 */
\r
470 __I uint32_t PID3; /*!< Offset: ITM Peripheral Identification Register #3 */
\r
471 __I uint32_t CID0; /*!< Offset: ITM Component Identification Register #0 */
\r
472 __I uint32_t CID1; /*!< Offset: ITM Component Identification Register #1 */
\r
473 __I uint32_t CID2; /*!< Offset: ITM Component Identification Register #2 */
\r
474 __I uint32_t CID3; /*!< Offset: ITM Component Identification Register #3 */
\r
477 /* ITM Trace Privilege Register Definitions */
\r
478 #define ITM_TPR_PRIVMASK_Pos 0 /*!< ITM TPR: PRIVMASK Position */
\r
479 #define ITM_TPR_PRIVMASK_Msk (0xFul << ITM_TPR_PRIVMASK_Pos) /*!< ITM TPR: PRIVMASK Mask */
\r
481 /* ITM Trace Control Register Definitions */
\r
482 #define ITM_TCR_BUSY_Pos 23 /*!< ITM TCR: BUSY Position */
\r
483 #define ITM_TCR_BUSY_Msk (1ul << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */
\r
485 #define ITM_TCR_ATBID_Pos 16 /*!< ITM TCR: ATBID Position */
\r
486 #define ITM_TCR_ATBID_Msk (0x7Ful << ITM_TCR_ATBID_Pos) /*!< ITM TCR: ATBID Mask */
\r
488 #define ITM_TCR_TSPrescale_Pos 8 /*!< ITM TCR: TSPrescale Position */
\r
489 #define ITM_TCR_TSPrescale_Msk (3ul << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */
\r
491 #define ITM_TCR_SWOENA_Pos 4 /*!< ITM TCR: SWOENA Position */
\r
492 #define ITM_TCR_SWOENA_Msk (1ul << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */
\r
494 #define ITM_TCR_DWTENA_Pos 3 /*!< ITM TCR: DWTENA Position */
\r
495 #define ITM_TCR_DWTENA_Msk (1ul << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */
\r
497 #define ITM_TCR_SYNCENA_Pos 2 /*!< ITM TCR: SYNCENA Position */
\r
498 #define ITM_TCR_SYNCENA_Msk (1ul << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */
\r
500 #define ITM_TCR_TSENA_Pos 1 /*!< ITM TCR: TSENA Position */
\r
501 #define ITM_TCR_TSENA_Msk (1ul << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */
\r
503 #define ITM_TCR_ITMENA_Pos 0 /*!< ITM TCR: ITM Enable bit Position */
\r
504 #define ITM_TCR_ITMENA_Msk (1ul << ITM_TCR_ITMENA_Pos) /*!< ITM TCR: ITM Enable bit Mask */
\r
506 /* ITM Integration Write Register Definitions */
\r
507 #define ITM_IWR_ATVALIDM_Pos 0 /*!< ITM IWR: ATVALIDM Position */
\r
508 #define ITM_IWR_ATVALIDM_Msk (1ul << ITM_IWR_ATVALIDM_Pos) /*!< ITM IWR: ATVALIDM Mask */
\r
510 /* ITM Integration Read Register Definitions */
\r
511 #define ITM_IRR_ATREADYM_Pos 0 /*!< ITM IRR: ATREADYM Position */
\r
512 #define ITM_IRR_ATREADYM_Msk (1ul << ITM_IRR_ATREADYM_Pos) /*!< ITM IRR: ATREADYM Mask */
\r
514 /* ITM Integration Mode Control Register Definitions */
\r
515 #define ITM_IMCR_INTEGRATION_Pos 0 /*!< ITM IMCR: INTEGRATION Position */
\r
516 #define ITM_IMCR_INTEGRATION_Msk (1ul << ITM_IMCR_INTEGRATION_Pos) /*!< ITM IMCR: INTEGRATION Mask */
\r
518 /* ITM Lock Status Register Definitions */
\r
519 #define ITM_LSR_ByteAcc_Pos 2 /*!< ITM LSR: ByteAcc Position */
\r
520 #define ITM_LSR_ByteAcc_Msk (1ul << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */
\r
522 #define ITM_LSR_Access_Pos 1 /*!< ITM LSR: Access Position */
\r
523 #define ITM_LSR_Access_Msk (1ul << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */
\r
525 #define ITM_LSR_Present_Pos 0 /*!< ITM LSR: Present Position */
\r
526 #define ITM_LSR_Present_Msk (1ul << ITM_LSR_Present_Pos) /*!< ITM LSR: Present Mask */
\r
527 /*@}*/ /* end of group CMSIS_CM3_ITM */
\r
530 /** @addtogroup CMSIS_CM3_InterruptType CMSIS CM3 Interrupt Type
\r
531 memory mapped structure for Interrupt Type
\r
536 uint32_t RESERVED0;
\r
537 __I uint32_t ICTR; /*!< Offset: 0x04 Interrupt Control Type Register */
\r
538 __IO uint32_t ACTLR; /*!< Offset: 0x08 Auxiliary Control Register */
\r
539 } InterruptType_Type;
\r
541 /* Interrupt Controller Type Register Definitions */
\r
542 #define InterruptType_ICTR_INTLINESNUM_Pos 0 /*!< InterruptType ICTR: INTLINESNUM Position */
\r
543 #define InterruptType_ICTR_INTLINESNUM_Msk (0x1Ful << InterruptType_ICTR_INTLINESNUM_Pos) /*!< InterruptType ICTR: INTLINESNUM Mask */
\r
545 /* Auxiliary Control Register Definitions */
\r
546 #define InterruptType_ACTLR_DISFOLD_Pos 2 /*!< InterruptType ACTLR: DISFOLD Position */
\r
547 #define InterruptType_ACTLR_DISFOLD_Msk (1ul << InterruptType_ACTLR_DISFOLD_Pos) /*!< InterruptType ACTLR: DISFOLD Mask */
\r
549 #define InterruptType_ACTLR_DISDEFWBUF_Pos 1 /*!< InterruptType ACTLR: DISDEFWBUF Position */
\r
550 #define InterruptType_ACTLR_DISDEFWBUF_Msk (1ul << InterruptType_ACTLR_DISDEFWBUF_Pos) /*!< InterruptType ACTLR: DISDEFWBUF Mask */
\r
552 #define InterruptType_ACTLR_DISMCYCINT_Pos 0 /*!< InterruptType ACTLR: DISMCYCINT Position */
\r
553 #define InterruptType_ACTLR_DISMCYCINT_Msk (1ul << InterruptType_ACTLR_DISMCYCINT_Pos) /*!< InterruptType ACTLR: DISMCYCINT Mask */
\r
554 /*@}*/ /* end of group CMSIS_CM3_InterruptType */
\r
557 #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1)
\r
558 /** @addtogroup CMSIS_CM3_MPU CMSIS CM3 MPU
\r
559 memory mapped structure for Memory Protection Unit (MPU)
\r
564 __I uint32_t TYPE; /*!< Offset: 0x00 MPU Type Register */
\r
565 __IO uint32_t CTRL; /*!< Offset: 0x04 MPU Control Register */
\r
566 __IO uint32_t RNR; /*!< Offset: 0x08 MPU Region RNRber Register */
\r
567 __IO uint32_t RBAR; /*!< Offset: 0x0C MPU Region Base Address Register */
\r
568 __IO uint32_t RASR; /*!< Offset: 0x10 MPU Region Attribute and Size Register */
\r
569 __IO uint32_t RBAR_A1; /*!< Offset: 0x14 MPU Alias 1 Region Base Address Register */
\r
570 __IO uint32_t RASR_A1; /*!< Offset: 0x18 MPU Alias 1 Region Attribute and Size Register */
\r
571 __IO uint32_t RBAR_A2; /*!< Offset: 0x1C MPU Alias 2 Region Base Address Register */
\r
572 __IO uint32_t RASR_A2; /*!< Offset: 0x20 MPU Alias 2 Region Attribute and Size Register */
\r
573 __IO uint32_t RBAR_A3; /*!< Offset: 0x24 MPU Alias 3 Region Base Address Register */
\r
574 __IO uint32_t RASR_A3; /*!< Offset: 0x28 MPU Alias 3 Region Attribute and Size Register */
\r
577 /* MPU Type Register */
\r
578 #define MPU_TYPE_IREGION_Pos 16 /*!< MPU TYPE: IREGION Position */
\r
579 #define MPU_TYPE_IREGION_Msk (0xFFul << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
\r
581 #define MPU_TYPE_DREGION_Pos 8 /*!< MPU TYPE: DREGION Position */
\r
582 #define MPU_TYPE_DREGION_Msk (0xFFul << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
\r
584 #define MPU_TYPE_SEPARATE_Pos 0 /*!< MPU TYPE: SEPARATE Position */
\r
585 #define MPU_TYPE_SEPARATE_Msk (1ul << MPU_TYPE_SEPARATE_Pos) /*!< MPU TYPE: SEPARATE Mask */
\r
587 /* MPU Control Register */
\r
588 #define MPU_CTRL_PRIVDEFENA_Pos 2 /*!< MPU CTRL: PRIVDEFENA Position */
\r
589 #define MPU_CTRL_PRIVDEFENA_Msk (1ul << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
\r
591 #define MPU_CTRL_HFNMIENA_Pos 1 /*!< MPU CTRL: HFNMIENA Position */
\r
592 #define MPU_CTRL_HFNMIENA_Msk (1ul << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
\r
594 #define MPU_CTRL_ENABLE_Pos 0 /*!< MPU CTRL: ENABLE Position */
\r
595 #define MPU_CTRL_ENABLE_Msk (1ul << MPU_CTRL_ENABLE_Pos) /*!< MPU CTRL: ENABLE Mask */
\r
597 /* MPU Region Number Register */
\r
598 #define MPU_RNR_REGION_Pos 0 /*!< MPU RNR: REGION Position */
\r
599 #define MPU_RNR_REGION_Msk (0xFFul << MPU_RNR_REGION_Pos) /*!< MPU RNR: REGION Mask */
\r
601 /* MPU Region Base Address Register */
\r
602 #define MPU_RBAR_ADDR_Pos 5 /*!< MPU RBAR: ADDR Position */
\r
603 #define MPU_RBAR_ADDR_Msk (0x7FFFFFFul << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
\r
605 #define MPU_RBAR_VALID_Pos 4 /*!< MPU RBAR: VALID Position */
\r
606 #define MPU_RBAR_VALID_Msk (1ul << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */
\r
608 #define MPU_RBAR_REGION_Pos 0 /*!< MPU RBAR: REGION Position */
\r
609 #define MPU_RBAR_REGION_Msk (0xFul << MPU_RBAR_REGION_Pos) /*!< MPU RBAR: REGION Mask */
\r
611 /* MPU Region Attribute and Size Register */
\r
612 #define MPU_RASR_XN_Pos 28 /*!< MPU RASR: XN Position */
\r
613 #define MPU_RASR_XN_Msk (1ul << MPU_RASR_XN_Pos) /*!< MPU RASR: XN Mask */
\r
615 #define MPU_RASR_AP_Pos 24 /*!< MPU RASR: AP Position */
\r
616 #define MPU_RASR_AP_Msk (7ul << MPU_RASR_AP_Pos) /*!< MPU RASR: AP Mask */
\r
618 #define MPU_RASR_TEX_Pos 19 /*!< MPU RASR: TEX Position */
\r
619 #define MPU_RASR_TEX_Msk (7ul << MPU_RASR_TEX_Pos) /*!< MPU RASR: TEX Mask */
\r
621 #define MPU_RASR_S_Pos 18 /*!< MPU RASR: Shareable bit Position */
\r
622 #define MPU_RASR_S_Msk (1ul << MPU_RASR_S_Pos) /*!< MPU RASR: Shareable bit Mask */
\r
624 #define MPU_RASR_C_Pos 17 /*!< MPU RASR: Cacheable bit Position */
\r
625 #define MPU_RASR_C_Msk (1ul << MPU_RASR_C_Pos) /*!< MPU RASR: Cacheable bit Mask */
\r
627 #define MPU_RASR_B_Pos 16 /*!< MPU RASR: Bufferable bit Position */
\r
628 #define MPU_RASR_B_Msk (1ul << MPU_RASR_B_Pos) /*!< MPU RASR: Bufferable bit Mask */
\r
630 #define MPU_RASR_SRD_Pos 8 /*!< MPU RASR: Sub-Region Disable Position */
\r
631 #define MPU_RASR_SRD_Msk (0xFFul << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */
\r
633 #define MPU_RASR_SIZE_Pos 1 /*!< MPU RASR: Region Size Field Position */
\r
634 #define MPU_RASR_SIZE_Msk (0x1Ful << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */
\r
636 #define MPU_RASR_ENA_Pos 0 /*!< MPU RASR: Region enable bit Position */
\r
637 #define MPU_RASR_ENA_Msk (0x1Ful << MPU_RASR_ENA_Pos) /*!< MPU RASR: Region enable bit Disable Mask */
\r
639 /*@}*/ /* end of group CMSIS_CM3_MPU */
\r
643 /** @addtogroup CMSIS_CM3_CoreDebug CMSIS CM3 Core Debug
\r
644 memory mapped structure for Core Debug Register
\r
649 __IO uint32_t DHCSR; /*!< Offset: 0x00 Debug Halting Control and Status Register */
\r
650 __O uint32_t DCRSR; /*!< Offset: 0x04 Debug Core Register Selector Register */
\r
651 __IO uint32_t DCRDR; /*!< Offset: 0x08 Debug Core Register Data Register */
\r
652 __IO uint32_t DEMCR; /*!< Offset: 0x0C Debug Exception and Monitor Control Register */
\r
655 /* Debug Halting Control and Status Register */
\r
656 #define CoreDebug_DHCSR_DBGKEY_Pos 16 /*!< CoreDebug DHCSR: DBGKEY Position */
\r
657 #define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFul << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */
\r
659 #define CoreDebug_DHCSR_S_RESET_ST_Pos 25 /*!< CoreDebug DHCSR: S_RESET_ST Position */
\r
660 #define CoreDebug_DHCSR_S_RESET_ST_Msk (1ul << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */
\r
662 #define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24 /*!< CoreDebug DHCSR: S_RETIRE_ST Position */
\r
663 #define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1ul << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */
\r
665 #define CoreDebug_DHCSR_S_LOCKUP_Pos 19 /*!< CoreDebug DHCSR: S_LOCKUP Position */
\r
666 #define CoreDebug_DHCSR_S_LOCKUP_Msk (1ul << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */
\r
668 #define CoreDebug_DHCSR_S_SLEEP_Pos 18 /*!< CoreDebug DHCSR: S_SLEEP Position */
\r
669 #define CoreDebug_DHCSR_S_SLEEP_Msk (1ul << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */
\r
671 #define CoreDebug_DHCSR_S_HALT_Pos 17 /*!< CoreDebug DHCSR: S_HALT Position */
\r
672 #define CoreDebug_DHCSR_S_HALT_Msk (1ul << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */
\r
674 #define CoreDebug_DHCSR_S_REGRDY_Pos 16 /*!< CoreDebug DHCSR: S_REGRDY Position */
\r
675 #define CoreDebug_DHCSR_S_REGRDY_Msk (1ul << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */
\r
677 #define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5 /*!< CoreDebug DHCSR: C_SNAPSTALL Position */
\r
678 #define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1ul << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */
\r
680 #define CoreDebug_DHCSR_C_MASKINTS_Pos 3 /*!< CoreDebug DHCSR: C_MASKINTS Position */
\r
681 #define CoreDebug_DHCSR_C_MASKINTS_Msk (1ul << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */
\r
683 #define CoreDebug_DHCSR_C_STEP_Pos 2 /*!< CoreDebug DHCSR: C_STEP Position */
\r
684 #define CoreDebug_DHCSR_C_STEP_Msk (1ul << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */
\r
686 #define CoreDebug_DHCSR_C_HALT_Pos 1 /*!< CoreDebug DHCSR: C_HALT Position */
\r
687 #define CoreDebug_DHCSR_C_HALT_Msk (1ul << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */
\r
689 #define CoreDebug_DHCSR_C_DEBUGEN_Pos 0 /*!< CoreDebug DHCSR: C_DEBUGEN Position */
\r
690 #define CoreDebug_DHCSR_C_DEBUGEN_Msk (1ul << CoreDebug_DHCSR_C_DEBUGEN_Pos) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */
\r
692 /* Debug Core Register Selector Register */
\r
693 #define CoreDebug_DCRSR_REGWnR_Pos 16 /*!< CoreDebug DCRSR: REGWnR Position */
\r
694 #define CoreDebug_DCRSR_REGWnR_Msk (1ul << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */
\r
696 #define CoreDebug_DCRSR_REGSEL_Pos 0 /*!< CoreDebug DCRSR: REGSEL Position */
\r
697 #define CoreDebug_DCRSR_REGSEL_Msk (0x1Ful << CoreDebug_DCRSR_REGSEL_Pos) /*!< CoreDebug DCRSR: REGSEL Mask */
\r
699 /* Debug Exception and Monitor Control Register */
\r
700 #define CoreDebug_DEMCR_TRCENA_Pos 24 /*!< CoreDebug DEMCR: TRCENA Position */
\r
701 #define CoreDebug_DEMCR_TRCENA_Msk (1ul << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */
\r
703 #define CoreDebug_DEMCR_MON_REQ_Pos 19 /*!< CoreDebug DEMCR: MON_REQ Position */
\r
704 #define CoreDebug_DEMCR_MON_REQ_Msk (1ul << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */
\r
706 #define CoreDebug_DEMCR_MON_STEP_Pos 18 /*!< CoreDebug DEMCR: MON_STEP Position */
\r
707 #define CoreDebug_DEMCR_MON_STEP_Msk (1ul << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */
\r
709 #define CoreDebug_DEMCR_MON_PEND_Pos 17 /*!< CoreDebug DEMCR: MON_PEND Position */
\r
710 #define CoreDebug_DEMCR_MON_PEND_Msk (1ul << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */
\r
712 #define CoreDebug_DEMCR_MON_EN_Pos 16 /*!< CoreDebug DEMCR: MON_EN Position */
\r
713 #define CoreDebug_DEMCR_MON_EN_Msk (1ul << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */
\r
715 #define CoreDebug_DEMCR_VC_HARDERR_Pos 10 /*!< CoreDebug DEMCR: VC_HARDERR Position */
\r
716 #define CoreDebug_DEMCR_VC_HARDERR_Msk (1ul << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */
\r
718 #define CoreDebug_DEMCR_VC_INTERR_Pos 9 /*!< CoreDebug DEMCR: VC_INTERR Position */
\r
719 #define CoreDebug_DEMCR_VC_INTERR_Msk (1ul << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */
\r
721 #define CoreDebug_DEMCR_VC_BUSERR_Pos 8 /*!< CoreDebug DEMCR: VC_BUSERR Position */
\r
722 #define CoreDebug_DEMCR_VC_BUSERR_Msk (1ul << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */
\r
724 #define CoreDebug_DEMCR_VC_STATERR_Pos 7 /*!< CoreDebug DEMCR: VC_STATERR Position */
\r
725 #define CoreDebug_DEMCR_VC_STATERR_Msk (1ul << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */
\r
727 #define CoreDebug_DEMCR_VC_CHKERR_Pos 6 /*!< CoreDebug DEMCR: VC_CHKERR Position */
\r
728 #define CoreDebug_DEMCR_VC_CHKERR_Msk (1ul << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */
\r
730 #define CoreDebug_DEMCR_VC_NOCPERR_Pos 5 /*!< CoreDebug DEMCR: VC_NOCPERR Position */
\r
731 #define CoreDebug_DEMCR_VC_NOCPERR_Msk (1ul << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */
\r
733 #define CoreDebug_DEMCR_VC_MMERR_Pos 4 /*!< CoreDebug DEMCR: VC_MMERR Position */
\r
734 #define CoreDebug_DEMCR_VC_MMERR_Msk (1ul << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */
\r
736 #define CoreDebug_DEMCR_VC_CORERESET_Pos 0 /*!< CoreDebug DEMCR: VC_CORERESET Position */
\r
737 #define CoreDebug_DEMCR_VC_CORERESET_Msk (1ul << CoreDebug_DEMCR_VC_CORERESET_Pos) /*!< CoreDebug DEMCR: VC_CORERESET Mask */
\r
738 /*@}*/ /* end of group CMSIS_CM3_CoreDebug */
\r
741 /* Memory mapping of Cortex-M3 Hardware */
\r
742 #define SCS_BASE (0xE000E000) /*!< System Control Space Base Address */
\r
743 #define ITM_BASE (0xE0000000) /*!< ITM Base Address */
\r
744 #define CoreDebug_BASE (0xE000EDF0) /*!< Core Debug Base Address */
\r
745 #define SysTick_BASE (SCS_BASE + 0x0010) /*!< SysTick Base Address */
\r
746 #define NVIC_BASE (SCS_BASE + 0x0100) /*!< NVIC Base Address */
\r
747 #define SCB_BASE (SCS_BASE + 0x0D00) /*!< System Control Block Base Address */
\r
749 #define InterruptType ((InterruptType_Type *) SCS_BASE) /*!< Interrupt Type Register */
\r
750 #define SCB ((SCB_Type *) SCB_BASE) /*!< SCB configuration struct */
\r
751 #define SysTick ((SysTick_Type *) SysTick_BASE) /*!< SysTick configuration struct */
\r
752 #define NVIC ((NVIC_Type *) NVIC_BASE) /*!< NVIC configuration struct */
\r
753 #define ITM ((ITM_Type *) ITM_BASE) /*!< ITM configuration struct */
\r
754 #define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */
\r
756 #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1)
\r
757 #define MPU_BASE (SCS_BASE + 0x0D90) /*!< Memory Protection Unit */
\r
758 #define MPU ((MPU_Type*) MPU_BASE) /*!< Memory Protection Unit */
\r
761 /*@}*/ /* end of group CMSIS_CM3_core_register */
\r
764 /*******************************************************************************
\r
765 * Hardware Abstraction Layer
\r
766 ******************************************************************************/
\r
768 #if defined ( __CC_ARM )
\r
769 #define __ASM __asm /*!< asm keyword for ARM Compiler */
\r
770 #define __INLINE __inline /*!< inline keyword for ARM Compiler */
\r
772 #elif defined ( __ICCARM__ )
\r
773 #define __ASM __asm /*!< asm keyword for IAR Compiler */
\r
774 #define __INLINE inline /*!< inline keyword for IAR Compiler. Only avaiable in High optimization mode! */
\r
776 #elif defined ( __GNUC__ )
\r
777 #define __ASM __asm /*!< asm keyword for GNU Compiler */
\r
778 #define __INLINE inline /*!< inline keyword for GNU Compiler */
\r
780 #elif defined ( __TASKING__ )
\r
781 #define __ASM __asm /*!< asm keyword for TASKING Compiler */
\r
782 #define __INLINE inline /*!< inline keyword for TASKING Compiler */
\r
786 /* ########################## Core Instruction Access ######################### */
\r
787 #include "core_cmInstr.h"
\r
789 /* ########################### Core Function Access ########################### */
\r
790 #include "core_cmFunc.h"
\r
793 /** @addtogroup CMSIS_CM3_Core_FunctionInterface CMSIS CM3 Core Function Interface
\r
794 Core Function Interface containing:
\r
795 - Core NVIC Functions
\r
796 - Core SysTick Functions
\r
797 - Core Reset Functions
\r
801 /* ########################## NVIC functions #################################### */
\r
804 * @brief Set the Priority Grouping in NVIC Interrupt Controller
\r
806 * @param PriorityGroup is priority grouping field
\r
808 * Set the priority grouping field using the required unlock sequence.
\r
809 * The parameter priority_grouping is assigned to the field
\r
810 * SCB->AIRCR [10:8] PRIGROUP field. Only values from 0..7 are used.
\r
811 * In case of a conflict between priority grouping and available
\r
812 * priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
\r
814 static __INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
\r
816 uint32_t reg_value;
\r
817 uint32_t PriorityGroupTmp = (PriorityGroup & 0x07); /* only values 0..7 are used */
\r
819 reg_value = SCB->AIRCR; /* read old register configuration */
\r
820 reg_value &= ~(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk); /* clear bits to change */
\r
821 reg_value = (reg_value |
\r
822 (0x5FA << SCB_AIRCR_VECTKEY_Pos) |
\r
823 (PriorityGroupTmp << 8)); /* Insert write key and priorty group */
\r
824 SCB->AIRCR = reg_value;
\r
828 * @brief Get the Priority Grouping from NVIC Interrupt Controller
\r
830 * @return priority grouping field
\r
832 * Get the priority grouping from NVIC Interrupt Controller.
\r
833 * priority grouping is SCB->AIRCR [10:8] PRIGROUP field.
\r
835 static __INLINE uint32_t NVIC_GetPriorityGrouping(void)
\r
837 return ((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos); /* read priority grouping field */
\r
841 * @brief Enable Interrupt in NVIC Interrupt Controller
\r
843 * @param IRQn The positive number of the external interrupt to enable
\r
845 * Enable a device specific interupt in the NVIC interrupt controller.
\r
846 * The interrupt number cannot be a negative value.
\r
848 static __INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
\r
850 NVIC->ISER[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* enable interrupt */
\r
854 * @brief Disable the interrupt line for external interrupt specified
\r
856 * @param IRQn The positive number of the external interrupt to disable
\r
858 * Disable a device specific interupt in the NVIC interrupt controller.
\r
859 * The interrupt number cannot be a negative value.
\r
861 static __INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
\r
863 NVIC->ICER[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* disable interrupt */
\r
867 * @brief Read the interrupt pending bit for a device specific interrupt source
\r
869 * @param IRQn The number of the device specifc interrupt
\r
870 * @return 1 = interrupt pending, 0 = interrupt not pending
\r
872 * Read the pending register in NVIC and return 1 if its status is pending,
\r
873 * otherwise it returns 0
\r
875 static __INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
\r
877 return((uint32_t) ((NVIC->ISPR[(uint32_t)(IRQn) >> 5] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); /* Return 1 if pending else 0 */
\r
881 * @brief Set the pending bit for an external interrupt
\r
883 * @param IRQn The number of the interrupt for set pending
\r
885 * Set the pending bit for the specified interrupt.
\r
886 * The interrupt number cannot be a negative value.
\r
888 static __INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
\r
890 NVIC->ISPR[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* set interrupt pending */
\r
894 * @brief Clear the pending bit for an external interrupt
\r
896 * @param IRQn The number of the interrupt for clear pending
\r
898 * Clear the pending bit for the specified interrupt.
\r
899 * The interrupt number cannot be a negative value.
\r
901 static __INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
\r
903 NVIC->ICPR[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* Clear pending interrupt */
\r
907 * @brief Read the active bit for an external interrupt
\r
909 * @param IRQn The number of the interrupt for read active bit
\r
910 * @return 1 = interrupt active, 0 = interrupt not active
\r
912 * Read the active register in NVIC and returns 1 if its status is active,
\r
913 * otherwise it returns 0.
\r
915 static __INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn)
\r
917 return((uint32_t)((NVIC->IABR[(uint32_t)(IRQn) >> 5] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); /* Return 1 if active else 0 */
\r
921 * @brief Set the priority for an interrupt
\r
923 * @param IRQn The number of the interrupt for set priority
\r
924 * @param priority The priority to set
\r
926 * Set the priority for the specified interrupt. The interrupt
\r
927 * number can be positive to specify an external (device specific)
\r
928 * interrupt, or negative to specify an internal (core) interrupt.
\r
930 * Note: The priority cannot be set for every core interrupt.
\r
932 static __INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
\r
935 SCB->SHP[((uint32_t)(IRQn) & 0xF)-4] = ((priority << (8 - __NVIC_PRIO_BITS)) & 0xff); } /* set Priority for Cortex-M3 System Interrupts */
\r
937 NVIC->IP[(uint32_t)(IRQn)] = ((priority << (8 - __NVIC_PRIO_BITS)) & 0xff); } /* set Priority for device specific Interrupts */
\r
941 * @brief Read the priority for an interrupt
\r
943 * @param IRQn The number of the interrupt for get priority
\r
944 * @return The priority for the interrupt
\r
946 * Read the priority for the specified interrupt. The interrupt
\r
947 * number can be positive to specify an external (device specific)
\r
948 * interrupt, or negative to specify an internal (core) interrupt.
\r
950 * The returned priority value is automatically aligned to the implemented
\r
951 * priority bits of the microcontroller.
\r
953 * Note: The priority cannot be set for every core interrupt.
\r
955 static __INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
\r
959 return((uint32_t)(SCB->SHP[((uint32_t)(IRQn) & 0xF)-4] >> (8 - __NVIC_PRIO_BITS))); } /* get priority for Cortex-M3 system interrupts */
\r
961 return((uint32_t)(NVIC->IP[(uint32_t)(IRQn)] >> (8 - __NVIC_PRIO_BITS))); } /* get priority for device specific interrupts */
\r
966 * @brief Encode the priority for an interrupt
\r
968 * @param PriorityGroup The used priority group
\r
969 * @param PreemptPriority The preemptive priority value (starting from 0)
\r
970 * @param SubPriority The sub priority value (starting from 0)
\r
971 * @return The encoded priority for the interrupt
\r
973 * Encode the priority for an interrupt with the given priority group,
\r
974 * preemptive priority value and sub priority value.
\r
975 * In case of a conflict between priority grouping and available
\r
976 * priority bits (__NVIC_PRIO_BITS) the samllest possible priority group is set.
\r
978 * The returned priority value can be used for NVIC_SetPriority(...) function
\r
980 static __INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
\r
982 uint32_t PriorityGroupTmp = (PriorityGroup & 0x07); /* only values 0..7 are used */
\r
983 uint32_t PreemptPriorityBits;
\r
984 uint32_t SubPriorityBits;
\r
986 PreemptPriorityBits = ((7 - PriorityGroupTmp) > __NVIC_PRIO_BITS) ? __NVIC_PRIO_BITS : 7 - PriorityGroupTmp;
\r
987 SubPriorityBits = ((PriorityGroupTmp + __NVIC_PRIO_BITS) < 7) ? 0 : PriorityGroupTmp - 7 + __NVIC_PRIO_BITS;
\r
990 ((PreemptPriority & ((1 << (PreemptPriorityBits)) - 1)) << SubPriorityBits) |
\r
991 ((SubPriority & ((1 << (SubPriorityBits )) - 1)))
\r
997 * @brief Decode the priority of an interrupt
\r
999 * @param Priority The priority for the interrupt
\r
1000 * @param PriorityGroup The used priority group
\r
1001 * @param pPreemptPriority The preemptive priority value (starting from 0)
\r
1002 * @param pSubPriority The sub priority value (starting from 0)
\r
1004 * Decode an interrupt priority value with the given priority group to
\r
1005 * preemptive priority value and sub priority value.
\r
1006 * In case of a conflict between priority grouping and available
\r
1007 * priority bits (__NVIC_PRIO_BITS) the samllest possible priority group is set.
\r
1009 * The priority value can be retrieved with NVIC_GetPriority(...) function
\r
1011 static __INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority)
\r
1013 uint32_t PriorityGroupTmp = (PriorityGroup & 0x07); /* only values 0..7 are used */
\r
1014 uint32_t PreemptPriorityBits;
\r
1015 uint32_t SubPriorityBits;
\r
1017 PreemptPriorityBits = ((7 - PriorityGroupTmp) > __NVIC_PRIO_BITS) ? __NVIC_PRIO_BITS : 7 - PriorityGroupTmp;
\r
1018 SubPriorityBits = ((PriorityGroupTmp + __NVIC_PRIO_BITS) < 7) ? 0 : PriorityGroupTmp - 7 + __NVIC_PRIO_BITS;
\r
1020 *pPreemptPriority = (Priority >> SubPriorityBits) & ((1 << (PreemptPriorityBits)) - 1);
\r
1021 *pSubPriority = (Priority ) & ((1 << (SubPriorityBits )) - 1);
\r
1026 /* ################################## SysTick function ############################################ */
\r
1028 #if (!defined (__Vendor_SysTickConfig)) || (__Vendor_SysTickConfig == 0)
\r
1031 * @brief Initialize and start the SysTick counter and its interrupt.
\r
1033 * @param ticks number of ticks between two interrupts
\r
1034 * @return 1 = failed, 0 = successful
\r
1036 * Initialise the system tick timer and its interrupt and start the
\r
1037 * system tick timer / counter in free running mode to generate
\r
1038 * periodical interrupts.
\r
1040 static __INLINE uint32_t SysTick_Config(uint32_t ticks)
\r
1042 if (ticks > SysTick_LOAD_RELOAD_Msk) return (1); /* Reload value impossible */
\r
1044 SysTick->LOAD = (ticks & SysTick_LOAD_RELOAD_Msk) - 1; /* set reload register */
\r
1045 NVIC_SetPriority (SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority for Cortex-M0 System Interrupts */
\r
1046 SysTick->VAL = 0; /* Load the SysTick Counter Value */
\r
1047 SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
\r
1048 SysTick_CTRL_TICKINT_Msk |
\r
1049 SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
\r
1050 return (0); /* Function successful */
\r
1058 /* ################################## Reset function ############################################ */
\r
1061 * @brief Initiate a system reset request.
\r
1063 * Initiate a system reset request to reset the MCU
\r
1065 static __INLINE void NVIC_SystemReset(void)
\r
1067 __DSB(); /* Ensure all outstanding memory accesses included
\r
1068 buffered write are completed before reset */
\r
1069 SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) |
\r
1070 (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
\r
1071 SCB_AIRCR_SYSRESETREQ_Msk); /* Keep priority group unchanged */
\r
1072 __DSB(); /* Ensure completion of memory access */
\r
1073 while(1); /* wait until reset */
\r
1076 /*@}*/ /* end of group CMSIS_CM3_Core_FunctionInterface */
\r
1080 /* ##################################### Debug In/Output function ########################################### */
\r
1082 /** @addtogroup CMSIS_CM3_CoreDebugInterface CMSIS CM3 Core Debug Interface
\r
1083 Core Debug Interface containing:
\r
1084 - Core Debug Receive / Transmit Functions
\r
1085 - Core Debug Defines
\r
1086 - Core Debug Variables
\r
1090 extern volatile int ITM_RxBuffer; /*!< variable to receive characters */
\r
1091 #define ITM_RXBUFFER_EMPTY 0x5AA55AA5 /*!< value identifying ITM_RxBuffer is ready for next character */
\r
1095 * @brief Outputs a character via the ITM channel 0
\r
1097 * @param ch character to output
\r
1098 * @return character to output
\r
1100 * The function outputs a character via the ITM channel 0.
\r
1101 * The function returns when no debugger is connected that has booked the output.
\r
1102 * It is blocking when a debugger is connected, but the previous character send is not transmitted.
\r
1104 static __INLINE uint32_t ITM_SendChar (uint32_t ch)
\r
1106 if ((CoreDebug->DEMCR & CoreDebug_DEMCR_TRCENA_Msk) && /* Trace enabled */
\r
1107 (ITM->TCR & ITM_TCR_ITMENA_Msk) && /* ITM enabled */
\r
1108 (ITM->TER & (1ul << 0) ) ) /* ITM Port #0 enabled */
\r
1110 while (ITM->PORT[0].u32 == 0);
\r
1111 ITM->PORT[0].u8 = (uint8_t) ch;
\r
1118 * @brief Inputs a character via variable ITM_RxBuffer
\r
1120 * @return received character, -1 = no character received
\r
1122 * The function inputs a character via variable ITM_RxBuffer.
\r
1123 * The function returns when no debugger is connected that has booked the output.
\r
1124 * It is blocking when a debugger is connected, but the previous character send is not transmitted.
\r
1126 static __INLINE int ITM_ReceiveChar (void) {
\r
1127 int ch = -1; /* no character available */
\r
1129 if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) {
\r
1130 ch = ITM_RxBuffer;
\r
1131 ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */
\r
1139 * @brief Check if a character via variable ITM_RxBuffer is available
\r
1141 * @return 1 = character available, 0 = no character available
\r
1143 * The function checks variable ITM_RxBuffer whether a character is available or not.
\r
1144 * The function returns '1' if a character is available and '0' if no character is available.
\r
1146 static __INLINE int ITM_CheckChar (void) {
\r
1148 if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) {
\r
1149 return (0); /* no character available */
\r
1151 return (1); /* character available */
\r
1155 /*@}*/ /* end of group CMSIS_CM3_core_DebugInterface */
\r
1158 #ifdef __cplusplus
\r
1162 /*@}*/ /* end of group CMSIS_CM3_core_definitions */
\r
1164 #endif /* __CORE_CM3_H__ */
\r
1166 /*lint -restore */
\r