Subversion Repositories DashDisplay

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 5
Line 1... Line 1...
1
/**************************************************************************//**
1
/**************************************************************************//**
2
 * @file     core_cm0.h
2
 * @file     core_cm0.h
3
 * @brief    CMSIS Cortex-M0 Core Peripheral Access Layer Header File
3
 * @brief    CMSIS Cortex-M0 Core Peripheral Access Layer Header File
4
 * @version  V4.10
4
 * @version  V4.30
5
 * @date     18. March 2015
5
 * @date     20. October 2015
6
 *
-
 
7
 * @note
-
 
8
 *
-
 
9
 ******************************************************************************/
6
 ******************************************************************************/
10
/* Copyright (c) 2009 - 2015 ARM LIMITED
7
/* Copyright (c) 2009 - 2015 ARM LIMITED
11
 
8
 
12
   All rights reserved.
9
   All rights reserved.
13
   Redistribution and use in source and binary forms, with or without
10
   Redistribution and use in source and binary forms, with or without
Line 33... Line 30...
33
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
   POSSIBILITY OF SUCH DAMAGE.
31
   POSSIBILITY OF SUCH DAMAGE.
35
   ---------------------------------------------------------------------------*/
32
   ---------------------------------------------------------------------------*/
36
 
33
 
37
 
34
 
38
#if defined ( __ICCARM__ )
35
#if   defined ( __ICCARM__ )
39
 #pragma system_include  /* treat file as system include file for MISRA check */
36
 #pragma system_include         /* treat file as system include file for MISRA check */
-
 
37
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
-
 
38
  #pragma clang system_header   /* treat file as system include file */
40
#endif
39
#endif
41
 
40
 
42
#ifndef __CORE_CM0_H_GENERIC
41
#ifndef __CORE_CM0_H_GENERIC
43
#define __CORE_CM0_H_GENERIC
42
#define __CORE_CM0_H_GENERIC
44
 
43
 
-
 
44
#include <stdint.h>
-
 
45
 
45
#ifdef __cplusplus
46
#ifdef __cplusplus
46
 extern "C" {
47
 extern "C" {
47
#endif
48
#endif
48
 
49
 
-
 
50
/**
49
/** \page CMSIS_MISRA_Exceptions  MISRA-C:2004 Compliance Exceptions
51
  \page CMSIS_MISRA_Exceptions  MISRA-C:2004 Compliance Exceptions
50
  CMSIS violates the following MISRA-C:2004 rules:
52
  CMSIS violates the following MISRA-C:2004 rules:
51
 
53
 
52
   \li Required Rule 8.5, object/function definition in header file.<br>
54
   \li Required Rule 8.5, object/function definition in header file.<br>
53
     Function definitions in header files are used to allow 'inlining'.
55
     Function definitions in header files are used to allow 'inlining'.
54
 
56
 
Line 61... Line 63...
61
 
63
 
62
 
64
 
63
/*******************************************************************************
65
/*******************************************************************************
64
 *                 CMSIS definitions
66
 *                 CMSIS definitions
65
 ******************************************************************************/
67
 ******************************************************************************/
-
 
68
/**
66
/** \ingroup Cortex_M0
69
  \ingroup Cortex_M0
67
  @{
70
  @{
68
 */
71
 */
69
 
72
 
70
/*  CMSIS CM0 definitions */
73
/*  CMSIS CM0 definitions */
71
#define __CM0_CMSIS_VERSION_MAIN  (0x04)                                   /*!< [31:16] CMSIS HAL main version   */
74
#define __CM0_CMSIS_VERSION_MAIN  (0x04U)                                      /*!< [31:16] CMSIS HAL main version */
72
#define __CM0_CMSIS_VERSION_SUB   (0x00)                                   /*!< [15:0]  CMSIS HAL sub version    */
75
#define __CM0_CMSIS_VERSION_SUB   (0x1EU)                                      /*!< [15:0]  CMSIS HAL sub version */
73
#define __CM0_CMSIS_VERSION       ((__CM0_CMSIS_VERSION_MAIN << 16) | \
76
#define __CM0_CMSIS_VERSION       ((__CM0_CMSIS_VERSION_MAIN << 16U) | \
74
                                    __CM0_CMSIS_VERSION_SUB          )     /*!< CMSIS HAL version number         */
77
                                    __CM0_CMSIS_VERSION_SUB           )        /*!< CMSIS HAL version number */
75
 
78
 
76
#define __CORTEX_M                (0x00)                                   /*!< Cortex-M Core                    */
79
#define __CORTEX_M                (0x00U)                                      /*!< Cortex-M Core */
77
 
80
 
78
 
81
 
79
#if   defined ( __CC_ARM )
82
#if   defined ( __CC_ARM )
80
  #define __ASM            __asm                                      /*!< asm keyword for ARM Compiler          */
83
  #define __ASM            __asm                                      /*!< asm keyword for ARM Compiler */
-
 
84
  #define __INLINE         __inline                                   /*!< inline keyword for ARM Compiler */
-
 
85
  #define __STATIC_INLINE  static __inline
-
 
86
 
-
 
87
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
-
 
88
  #define __ASM            __asm                                      /*!< asm keyword for ARM Compiler */
81
  #define __INLINE         __inline                                   /*!< inline keyword for ARM Compiler       */
89
  #define __INLINE         __inline                                   /*!< inline keyword for ARM Compiler */
82
  #define __STATIC_INLINE  static __inline
90
  #define __STATIC_INLINE  static __inline
83
 
91
 
84
#elif defined ( __GNUC__ )
92
#elif defined ( __GNUC__ )
85
  #define __ASM            __asm                                      /*!< asm keyword for GNU Compiler          */
93
  #define __ASM            __asm                                      /*!< asm keyword for GNU Compiler */
86
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
94
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler */
87
  #define __STATIC_INLINE  static inline
95
  #define __STATIC_INLINE  static inline
88
 
96
 
89
#elif defined ( __ICCARM__ )
97
#elif defined ( __ICCARM__ )
90
  #define __ASM            __asm                                      /*!< asm keyword for IAR Compiler          */
98
  #define __ASM            __asm                                      /*!< asm keyword for IAR Compiler */
91
  #define __INLINE         inline                                     /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
99
  #define __INLINE         inline                                     /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
92
  #define __STATIC_INLINE  static inline
100
  #define __STATIC_INLINE  static inline
93
 
101
 
94
#elif defined ( __TMS470__ )
102
#elif defined ( __TMS470__ )
95
  #define __ASM            __asm                                      /*!< asm keyword for TI CCS Compiler       */
103
  #define __ASM            __asm                                      /*!< asm keyword for TI CCS Compiler */
96
  #define __STATIC_INLINE  static inline
104
  #define __STATIC_INLINE  static inline
97
 
105
 
98
#elif defined ( __TASKING__ )
106
#elif defined ( __TASKING__ )
99
  #define __ASM            __asm                                      /*!< asm keyword for TASKING Compiler      */
107
  #define __ASM            __asm                                      /*!< asm keyword for TASKING Compiler */
100
  #define __INLINE         inline                                     /*!< inline keyword for TASKING Compiler   */
108
  #define __INLINE         inline                                     /*!< inline keyword for TASKING Compiler */
101
  #define __STATIC_INLINE  static inline
109
  #define __STATIC_INLINE  static inline
102
 
110
 
103
#elif defined ( __CSMC__ )
111
#elif defined ( __CSMC__ )
104
  #define __packed
112
  #define __packed
105
  #define __ASM            _asm                                      /*!< asm keyword for COSMIC Compiler      */
113
  #define __ASM            _asm                                      /*!< asm keyword for COSMIC Compiler */
106
  #define __INLINE         inline                                    /*use -pc99 on compile line !< inline keyword for COSMIC Compiler   */
114
  #define __INLINE         inline                                    /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */
107
  #define __STATIC_INLINE  static inline
115
  #define __STATIC_INLINE  static inline
108
 
116
 
-
 
117
#else
-
 
118
  #error Unknown compiler
109
#endif
119
#endif
110
 
120
 
111
/** __FPU_USED indicates whether an FPU is used or not.
121
/** __FPU_USED indicates whether an FPU is used or not.
112
    This core does not support an FPU at all
122
    This core does not support an FPU at all
113
*/
123
*/
114
#define __FPU_USED       0
124
#define __FPU_USED       0U
115
 
125
 
116
#if defined ( __CC_ARM )
126
#if defined ( __CC_ARM )
117
  #if defined __TARGET_FPU_VFP
127
  #if defined __TARGET_FPU_VFP
118
    #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
128
    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
-
 
129
  #endif
-
 
130
 
-
 
131
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
-
 
132
  #if defined __ARM_PCS_VFP
-
 
133
    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
119
  #endif
134
  #endif
120
 
135
 
121
#elif defined ( __GNUC__ )
136
#elif defined ( __GNUC__ )
122
  #if defined (__VFP_FP__) && !defined(__SOFTFP__)
137
  #if defined (__VFP_FP__) && !defined(__SOFTFP__)
123
    #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
138
    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
124
  #endif
139
  #endif
125
 
140
 
126
#elif defined ( __ICCARM__ )
141
#elif defined ( __ICCARM__ )
127
  #if defined __ARMVFP__
142
  #if defined __ARMVFP__
128
    #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
143
    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
129
  #endif
144
  #endif
130
 
145
 
131
#elif defined ( __TMS470__ )
146
#elif defined ( __TMS470__ )
132
  #if defined __TI__VFP_SUPPORT____
147
  #if defined __TI_VFP_SUPPORT__
133
    #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
148
    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
134
  #endif
149
  #endif
135
 
150
 
136
#elif defined ( __TASKING__ )
151
#elif defined ( __TASKING__ )
137
  #if defined __FPU_VFP__
152
  #if defined __FPU_VFP__
138
    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
153
    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
139
  #endif
154
  #endif
140
 
155
 
141
#elif defined ( __CSMC__ )              /* Cosmic */
156
#elif defined ( __CSMC__ )
142
  #if ( __CSMC__ & 0x400)               // FPU present for parser
157
  #if ( __CSMC__ & 0x400U)
143
    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
158
    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
144
  #endif
159
  #endif
-
 
160
 
145
#endif
161
#endif
146
 
162
 
147
#include <stdint.h>                      /* standard types definitions                      */
-
 
148
#include <core_cmInstr.h>                /* Core Instruction Access                         */
163
#include "core_cmInstr.h"                /* Core Instruction Access */
149
#include <core_cmFunc.h>                 /* Core Function Access                            */
164
#include "core_cmFunc.h"                 /* Core Function Access */
150
 
165
 
151
#ifdef __cplusplus
166
#ifdef __cplusplus
152
}
167
}
153
#endif
168
#endif
154
 
169
 
Line 164... Line 179...
164
#endif
179
#endif
165
 
180
 
166
/* check device defines and use defaults */
181
/* check device defines and use defaults */
167
#if defined __CHECK_DEVICE_DEFINES
182
#if defined __CHECK_DEVICE_DEFINES
168
  #ifndef __CM0_REV
183
  #ifndef __CM0_REV
169
    #define __CM0_REV               0x0000
184
    #define __CM0_REV               0x0000U
170
    #warning "__CM0_REV not defined in device header file; using default!"
185
    #warning "__CM0_REV not defined in device header file; using default!"
171
  #endif
186
  #endif
172
 
187
 
173
  #ifndef __NVIC_PRIO_BITS
188
  #ifndef __NVIC_PRIO_BITS
174
    #define __NVIC_PRIO_BITS          2
189
    #define __NVIC_PRIO_BITS          2U
175
    #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
190
    #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
176
  #endif
191
  #endif
177
 
192
 
178
  #ifndef __Vendor_SysTickConfig
193
  #ifndef __Vendor_SysTickConfig
179
    #define __Vendor_SysTickConfig    0
194
    #define __Vendor_SysTickConfig    0U
180
    #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
195
    #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
181
  #endif
196
  #endif
182
#endif
197
#endif
183
 
198
 
184
/* IO definitions (access restrictions to peripheral registers) */
199
/* IO definitions (access restrictions to peripheral registers) */
Line 188... Line 203...
188
    <strong>IO Type Qualifiers</strong> are used
203
    <strong>IO Type Qualifiers</strong> are used
189
    \li to specify the access to peripheral variables.
204
    \li to specify the access to peripheral variables.
190
    \li for automatic generation of peripheral register debug information.
205
    \li for automatic generation of peripheral register debug information.
191
*/
206
*/
192
#ifdef __cplusplus
207
#ifdef __cplusplus
193
  #define   __I     volatile             /*!< Defines 'read only' permissions                 */
208
  #define   __I     volatile             /*!< Defines 'read only' permissions */
194
#else
209
#else
195
  #define   __I     volatile const       /*!< Defines 'read only' permissions                 */
210
  #define   __I     volatile const       /*!< Defines 'read only' permissions */
196
#endif
211
#endif
197
#define     __O     volatile             /*!< Defines 'write only' permissions                */
212
#define     __O     volatile             /*!< Defines 'write only' permissions */
198
#define     __IO    volatile             /*!< Defines 'read / write' permissions              */
213
#define     __IO    volatile             /*!< Defines 'read / write' permissions */
-
 
214
 
-
 
215
/* following defines should be used for structure members */
-
 
216
#define     __IM     volatile const      /*! Defines 'read only' structure member permissions */
-
 
217
#define     __OM     volatile            /*! Defines 'write only' structure member permissions */
-
 
218
#define     __IOM    volatile            /*! Defines 'read / write' structure member permissions */
199
 
219
 
200
/*@} end of group Cortex_M0 */
220
/*@} end of group Cortex_M0 */
201
 
221
 
202
 
222
 
203
 
223
 
Line 207... Line 227...
207
  - Core Register
227
  - Core Register
208
  - Core NVIC Register
228
  - Core NVIC Register
209
  - Core SCB Register
229
  - Core SCB Register
210
  - Core SysTick Register
230
  - Core SysTick Register
211
 ******************************************************************************/
231
 ******************************************************************************/
-
 
232
/**
212
/** \defgroup CMSIS_core_register Defines and Type Definitions
233
  \defgroup CMSIS_core_register Defines and Type Definitions
213
    \brief Type definitions and defines for Cortex-M processor based devices.
234
  \brief Type definitions and defines for Cortex-M processor based devices.
214
*/
235
*/
215
 
236
 
-
 
237
/**
216
/** \ingroup    CMSIS_core_register
238
  \ingroup    CMSIS_core_register
217
    \defgroup   CMSIS_CORE  Status and Control Registers
239
  \defgroup   CMSIS_CORE  Status and Control Registers
218
    \brief  Core Register type definitions.
240
  \brief      Core Register type definitions.
219
  @{
241
  @{
220
 */
242
 */
221
 
243
 
-
 
244
/**
222
/** \brief  Union type to access the Application Program Status Register (APSR).
245
  \brief  Union type to access the Application Program Status Register (APSR).
223
 */
246
 */
224
typedef union
247
typedef union
225
{
248
{
226
  struct
249
  struct
227
  {
250
  {
228
    uint32_t _reserved0:28;              /*!< bit:  0..27  Reserved                           */
251
    uint32_t _reserved0:28;              /*!< bit:  0..27  Reserved */
229
    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag       */
252
    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag */
230
    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag          */
253
    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag */
231
    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag           */
254
    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag */
232
    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag       */
255
    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag */
233
  } b;                                   /*!< Structure used for bit  access                  */
256
  } b;                                   /*!< Structure used for bit  access */
234
  uint32_t w;                            /*!< Type      used for word access                  */
257
  uint32_t w;                            /*!< Type      used for word access */
235
} APSR_Type;
258
} APSR_Type;
236
 
259
 
237
/* APSR Register Definitions */
260
/* APSR Register Definitions */
238
#define APSR_N_Pos                         31                                             /*!< APSR: N Position */
261
#define APSR_N_Pos                         31U                                            /*!< APSR: N Position */
239
#define APSR_N_Msk                         (1UL << APSR_N_Pos)                            /*!< APSR: N Mask */
262
#define APSR_N_Msk                         (1UL << APSR_N_Pos)                            /*!< APSR: N Mask */
240
 
263
 
241
#define APSR_Z_Pos                         30                                             /*!< APSR: Z Position */
264
#define APSR_Z_Pos                         30U                                            /*!< APSR: Z Position */
242
#define APSR_Z_Msk                         (1UL << APSR_Z_Pos)                            /*!< APSR: Z Mask */
265
#define APSR_Z_Msk                         (1UL << APSR_Z_Pos)                            /*!< APSR: Z Mask */
243
 
266
 
244
#define APSR_C_Pos                         29                                             /*!< APSR: C Position */
267
#define APSR_C_Pos                         29U                                            /*!< APSR: C Position */
245
#define APSR_C_Msk                         (1UL << APSR_C_Pos)                            /*!< APSR: C Mask */
268
#define APSR_C_Msk                         (1UL << APSR_C_Pos)                            /*!< APSR: C Mask */
246
 
269
 
247
#define APSR_V_Pos                         28                                             /*!< APSR: V Position */
270
#define APSR_V_Pos                         28U                                            /*!< APSR: V Position */
248
#define APSR_V_Msk                         (1UL << APSR_V_Pos)                            /*!< APSR: V Mask */
271
#define APSR_V_Msk                         (1UL << APSR_V_Pos)                            /*!< APSR: V Mask */
249
 
272
 
250
 
273
 
-
 
274
/**
251
/** \brief  Union type to access the Interrupt Program Status Register (IPSR).
275
  \brief  Union type to access the Interrupt Program Status Register (IPSR).
252
 */
276
 */
253
typedef union
277
typedef union
254
{
278
{
255
  struct
279
  struct
256
  {
280
  {
257
    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number                   */
281
    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number */
258
    uint32_t _reserved0:23;              /*!< bit:  9..31  Reserved                           */
282
    uint32_t _reserved0:23;              /*!< bit:  9..31  Reserved */
259
  } b;                                   /*!< Structure used for bit  access                  */
283
  } b;                                   /*!< Structure used for bit  access */
260
  uint32_t w;                            /*!< Type      used for word access                  */
284
  uint32_t w;                            /*!< Type      used for word access */
261
} IPSR_Type;
285
} IPSR_Type;
262
 
286
 
263
/* IPSR Register Definitions */
287
/* IPSR Register Definitions */
264
#define IPSR_ISR_Pos                        0                                             /*!< IPSR: ISR Position */
288
#define IPSR_ISR_Pos                        0U                                            /*!< IPSR: ISR Position */
265
#define IPSR_ISR_Msk                       (0x1FFUL /*<< IPSR_ISR_Pos*/)                  /*!< IPSR: ISR Mask */
289
#define IPSR_ISR_Msk                       (0x1FFUL /*<< IPSR_ISR_Pos*/)                  /*!< IPSR: ISR Mask */
266
 
290
 
267
 
291
 
-
 
292
/**
268
/** \brief  Union type to access the Special-Purpose Program Status Registers (xPSR).
293
  \brief  Union type to access the Special-Purpose Program Status Registers (xPSR).
269
 */
294
 */
270
typedef union
295
typedef union
271
{
296
{
272
  struct
297
  struct
273
  {
298
  {
274
    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number                   */
299
    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number */
275
    uint32_t _reserved0:15;              /*!< bit:  9..23  Reserved                           */
300
    uint32_t _reserved0:15;              /*!< bit:  9..23  Reserved */
276
    uint32_t T:1;                        /*!< bit:     24  Thumb bit        (read 0)          */
301
    uint32_t T:1;                        /*!< bit:     24  Thumb bit        (read 0) */
277
    uint32_t _reserved1:3;               /*!< bit: 25..27  Reserved                           */
302
    uint32_t _reserved1:3;               /*!< bit: 25..27  Reserved */
278
    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag       */
303
    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag */
279
    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag          */
304
    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag */
280
    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag           */
305
    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag */
281
    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag       */
306
    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag */
282
  } b;                                   /*!< Structure used for bit  access                  */
307
  } b;                                   /*!< Structure used for bit  access */
283
  uint32_t w;                            /*!< Type      used for word access                  */
308
  uint32_t w;                            /*!< Type      used for word access */
284
} xPSR_Type;
309
} xPSR_Type;
285
 
310
 
286
/* xPSR Register Definitions */
311
/* xPSR Register Definitions */
287
#define xPSR_N_Pos                         31                                             /*!< xPSR: N Position */
312
#define xPSR_N_Pos                         31U                                            /*!< xPSR: N Position */
288
#define xPSR_N_Msk                         (1UL << xPSR_N_Pos)                            /*!< xPSR: N Mask */
313
#define xPSR_N_Msk                         (1UL << xPSR_N_Pos)                            /*!< xPSR: N Mask */
289
 
314
 
290
#define xPSR_Z_Pos                         30                                             /*!< xPSR: Z Position */
315
#define xPSR_Z_Pos                         30U                                            /*!< xPSR: Z Position */
291
#define xPSR_Z_Msk                         (1UL << xPSR_Z_Pos)                            /*!< xPSR: Z Mask */
316
#define xPSR_Z_Msk                         (1UL << xPSR_Z_Pos)                            /*!< xPSR: Z Mask */
292
 
317
 
293
#define xPSR_C_Pos                         29                                             /*!< xPSR: C Position */
318
#define xPSR_C_Pos                         29U                                            /*!< xPSR: C Position */
294
#define xPSR_C_Msk                         (1UL << xPSR_C_Pos)                            /*!< xPSR: C Mask */
319
#define xPSR_C_Msk                         (1UL << xPSR_C_Pos)                            /*!< xPSR: C Mask */
295
 
320
 
296
#define xPSR_V_Pos                         28                                             /*!< xPSR: V Position */
321
#define xPSR_V_Pos                         28U                                            /*!< xPSR: V Position */
297
#define xPSR_V_Msk                         (1UL << xPSR_V_Pos)                            /*!< xPSR: V Mask */
322
#define xPSR_V_Msk                         (1UL << xPSR_V_Pos)                            /*!< xPSR: V Mask */
298
 
323
 
299
#define xPSR_T_Pos                         24                                             /*!< xPSR: T Position */
324
#define xPSR_T_Pos                         24U                                            /*!< xPSR: T Position */
300
#define xPSR_T_Msk                         (1UL << xPSR_T_Pos)                            /*!< xPSR: T Mask */
325
#define xPSR_T_Msk                         (1UL << xPSR_T_Pos)                            /*!< xPSR: T Mask */
301
 
326
 
302
#define xPSR_ISR_Pos                        0                                             /*!< xPSR: ISR Position */
327
#define xPSR_ISR_Pos                        0U                                            /*!< xPSR: ISR Position */
303
#define xPSR_ISR_Msk                       (0x1FFUL /*<< xPSR_ISR_Pos*/)                  /*!< xPSR: ISR Mask */
328
#define xPSR_ISR_Msk                       (0x1FFUL /*<< xPSR_ISR_Pos*/)                  /*!< xPSR: ISR Mask */
304
 
329
 
305
 
330
 
-
 
331
/**
306
/** \brief  Union type to access the Control Registers (CONTROL).
332
  \brief  Union type to access the Control Registers (CONTROL).
307
 */
333
 */
308
typedef union
334
typedef union
309
{
335
{
310
  struct
336
  struct
311
  {
337
  {
312
    uint32_t _reserved0:1;               /*!< bit:      0  Reserved                           */
338
    uint32_t _reserved0:1;               /*!< bit:      0  Reserved */
313
    uint32_t SPSEL:1;                    /*!< bit:      1  Stack to be used                   */
339
    uint32_t SPSEL:1;                    /*!< bit:      1  Stack to be used */
314
    uint32_t _reserved1:30;              /*!< bit:  2..31  Reserved                           */
340
    uint32_t _reserved1:30;              /*!< bit:  2..31  Reserved */
315
  } b;                                   /*!< Structure used for bit  access                  */
341
  } b;                                   /*!< Structure used for bit  access */
316
  uint32_t w;                            /*!< Type      used for word access                  */
342
  uint32_t w;                            /*!< Type      used for word access */
317
} CONTROL_Type;
343
} CONTROL_Type;
318
 
344
 
319
/* CONTROL Register Definitions */
345
/* CONTROL Register Definitions */
320
#define CONTROL_SPSEL_Pos                   1                                             /*!< CONTROL: SPSEL Position */
346
#define CONTROL_SPSEL_Pos                   1U                                            /*!< CONTROL: SPSEL Position */
321
#define CONTROL_SPSEL_Msk                  (1UL << CONTROL_SPSEL_Pos)                     /*!< CONTROL: SPSEL Mask */
347
#define CONTROL_SPSEL_Msk                  (1UL << CONTROL_SPSEL_Pos)                     /*!< CONTROL: SPSEL Mask */
322
 
348
 
323
/*@} end of group CMSIS_CORE */
349
/*@} end of group CMSIS_CORE */
324
 
350
 
325
 
351
 
-
 
352
/**
326
/** \ingroup    CMSIS_core_register
353
  \ingroup    CMSIS_core_register
327
    \defgroup   CMSIS_NVIC  Nested Vectored Interrupt Controller (NVIC)
354
  \defgroup   CMSIS_NVIC  Nested Vectored Interrupt Controller (NVIC)
328
    \brief      Type definitions for the NVIC Registers
355
  \brief      Type definitions for the NVIC Registers
329
  @{
356
  @{
330
 */
357
 */
331
 
358
 
-
 
359
/**
332
/** \brief  Structure type to access the Nested Vectored Interrupt Controller (NVIC).
360
  \brief  Structure type to access the Nested Vectored Interrupt Controller (NVIC).
333
 */
361
 */
334
typedef struct
362
typedef struct
335
{
363
{
336
  __IO uint32_t ISER[1];                 /*!< Offset: 0x000 (R/W)  Interrupt Set Enable Register           */
364
  __IOM uint32_t ISER[1U];               /*!< Offset: 0x000 (R/W)  Interrupt Set Enable Register */
337
       uint32_t RESERVED0[31];
365
        uint32_t RESERVED0[31U];
338
  __IO uint32_t ICER[1];                 /*!< Offset: 0x080 (R/W)  Interrupt Clear Enable Register          */
366
  __IOM uint32_t ICER[1U];               /*!< Offset: 0x080 (R/W)  Interrupt Clear Enable Register */
339
       uint32_t RSERVED1[31];
367
        uint32_t RSERVED1[31U];
340
  __IO uint32_t ISPR[1];                 /*!< Offset: 0x100 (R/W)  Interrupt Set Pending Register           */
368
  __IOM uint32_t ISPR[1U];               /*!< Offset: 0x100 (R/W)  Interrupt Set Pending Register */
341
       uint32_t RESERVED2[31];
369
        uint32_t RESERVED2[31U];
342
  __IO uint32_t ICPR[1];                 /*!< Offset: 0x180 (R/W)  Interrupt Clear Pending Register         */
370
  __IOM uint32_t ICPR[1U];               /*!< Offset: 0x180 (R/W)  Interrupt Clear Pending Register */
343
       uint32_t RESERVED3[31];
371
        uint32_t RESERVED3[31U];
344
       uint32_t RESERVED4[64];
372
        uint32_t RESERVED4[64U];
345
  __IO uint32_t IP[8];                   /*!< Offset: 0x300 (R/W)  Interrupt Priority Register              */
373
  __IOM uint32_t IP[8U];                 /*!< Offset: 0x300 (R/W)  Interrupt Priority Register */
346
}  NVIC_Type;
374
}  NVIC_Type;
347
 
375
 
348
/*@} end of group CMSIS_NVIC */
376
/*@} end of group CMSIS_NVIC */
349
 
377
 
350
 
378
 
-
 
379
/**
351
/** \ingroup  CMSIS_core_register
380
  \ingroup  CMSIS_core_register
352
    \defgroup CMSIS_SCB     System Control Block (SCB)
381
  \defgroup CMSIS_SCB     System Control Block (SCB)
353
    \brief      Type definitions for the System Control Block Registers
382
  \brief    Type definitions for the System Control Block Registers
354
  @{
383
  @{
355
 */
384
 */
356
 
385
 
-
 
386
/**
357
/** \brief  Structure type to access the System Control Block (SCB).
387
  \brief  Structure type to access the System Control Block (SCB).
358
 */
388
 */
359
typedef struct
389
typedef struct
360
{
390
{
361
  __I  uint32_t CPUID;                   /*!< Offset: 0x000 (R/ )  CPUID Base Register                                   */
391
  __IM  uint32_t CPUID;                  /*!< Offset: 0x000 (R/ )  CPUID Base Register */
362
  __IO uint32_t ICSR;                    /*!< Offset: 0x004 (R/W)  Interrupt Control and State Register                  */
392
  __IOM uint32_t ICSR;                   /*!< Offset: 0x004 (R/W)  Interrupt Control and State Register */
363
       uint32_t RESERVED0;
393
        uint32_t RESERVED0;
364
  __IO uint32_t AIRCR;                   /*!< Offset: 0x00C (R/W)  Application Interrupt and Reset Control Register      */
394
  __IOM uint32_t AIRCR;                  /*!< Offset: 0x00C (R/W)  Application Interrupt and Reset Control Register */
365
  __IO uint32_t SCR;                     /*!< Offset: 0x010 (R/W)  System Control Register                               */
395
  __IOM uint32_t SCR;                    /*!< Offset: 0x010 (R/W)  System Control Register */
366
  __IO uint32_t CCR;                     /*!< Offset: 0x014 (R/W)  Configuration Control Register                        */
396
  __IOM uint32_t CCR;                    /*!< Offset: 0x014 (R/W)  Configuration Control Register */
367
       uint32_t RESERVED1;
397
        uint32_t RESERVED1;
368
  __IO uint32_t SHP[2];                  /*!< Offset: 0x01C (R/W)  System Handlers Priority Registers. [0] is RESERVED   */
398
  __IOM uint32_t SHP[2U];                /*!< Offset: 0x01C (R/W)  System Handlers Priority Registers. [0] is RESERVED */
369
  __IO uint32_t SHCSR;                   /*!< Offset: 0x024 (R/W)  System Handler Control and State Register             */
399
  __IOM uint32_t SHCSR;                  /*!< Offset: 0x024 (R/W)  System Handler Control and State Register */
370
} SCB_Type;
400
} SCB_Type;
371
 
401
 
372
/* SCB CPUID Register Definitions */
402
/* SCB CPUID Register Definitions */
373
#define SCB_CPUID_IMPLEMENTER_Pos          24                                             /*!< SCB CPUID: IMPLEMENTER Position */
403
#define SCB_CPUID_IMPLEMENTER_Pos          24U                                            /*!< SCB CPUID: IMPLEMENTER Position */
374
#define SCB_CPUID_IMPLEMENTER_Msk          (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos)          /*!< SCB CPUID: IMPLEMENTER Mask */
404
#define SCB_CPUID_IMPLEMENTER_Msk          (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos)          /*!< SCB CPUID: IMPLEMENTER Mask */
375
 
405
 
376
#define SCB_CPUID_VARIANT_Pos              20                                             /*!< SCB CPUID: VARIANT Position */
406
#define SCB_CPUID_VARIANT_Pos              20U                                            /*!< SCB CPUID: VARIANT Position */
377
#define SCB_CPUID_VARIANT_Msk              (0xFUL << SCB_CPUID_VARIANT_Pos)               /*!< SCB CPUID: VARIANT Mask */
407
#define SCB_CPUID_VARIANT_Msk              (0xFUL << SCB_CPUID_VARIANT_Pos)               /*!< SCB CPUID: VARIANT Mask */
378
 
408
 
379
#define SCB_CPUID_ARCHITECTURE_Pos         16                                             /*!< SCB CPUID: ARCHITECTURE Position */
409
#define SCB_CPUID_ARCHITECTURE_Pos         16U                                            /*!< SCB CPUID: ARCHITECTURE Position */
380
#define SCB_CPUID_ARCHITECTURE_Msk         (0xFUL << SCB_CPUID_ARCHITECTURE_Pos)          /*!< SCB CPUID: ARCHITECTURE Mask */
410
#define SCB_CPUID_ARCHITECTURE_Msk         (0xFUL << SCB_CPUID_ARCHITECTURE_Pos)          /*!< SCB CPUID: ARCHITECTURE Mask */
381
 
411
 
382
#define SCB_CPUID_PARTNO_Pos                4                                             /*!< SCB CPUID: PARTNO Position */
412
#define SCB_CPUID_PARTNO_Pos                4U                                            /*!< SCB CPUID: PARTNO Position */
383
#define SCB_CPUID_PARTNO_Msk               (0xFFFUL << SCB_CPUID_PARTNO_Pos)              /*!< SCB CPUID: PARTNO Mask */
413
#define SCB_CPUID_PARTNO_Msk               (0xFFFUL << SCB_CPUID_PARTNO_Pos)              /*!< SCB CPUID: PARTNO Mask */
384
 
414
 
385
#define SCB_CPUID_REVISION_Pos              0                                             /*!< SCB CPUID: REVISION Position */
415
#define SCB_CPUID_REVISION_Pos              0U                                            /*!< SCB CPUID: REVISION Position */
386
#define SCB_CPUID_REVISION_Msk             (0xFUL /*<< SCB_CPUID_REVISION_Pos*/)          /*!< SCB CPUID: REVISION Mask */
416
#define SCB_CPUID_REVISION_Msk             (0xFUL /*<< SCB_CPUID_REVISION_Pos*/)          /*!< SCB CPUID: REVISION Mask */
387
 
417
 
388
/* SCB Interrupt Control State Register Definitions */
418
/* SCB Interrupt Control State Register Definitions */
389
#define SCB_ICSR_NMIPENDSET_Pos            31                                             /*!< SCB ICSR: NMIPENDSET Position */
419
#define SCB_ICSR_NMIPENDSET_Pos            31U                                            /*!< SCB ICSR: NMIPENDSET Position */
390
#define SCB_ICSR_NMIPENDSET_Msk            (1UL << SCB_ICSR_NMIPENDSET_Pos)               /*!< SCB ICSR: NMIPENDSET Mask */
420
#define SCB_ICSR_NMIPENDSET_Msk            (1UL << SCB_ICSR_NMIPENDSET_Pos)               /*!< SCB ICSR: NMIPENDSET Mask */
391
 
421
 
392
#define SCB_ICSR_PENDSVSET_Pos             28                                             /*!< SCB ICSR: PENDSVSET Position */
422
#define SCB_ICSR_PENDSVSET_Pos             28U                                            /*!< SCB ICSR: PENDSVSET Position */
393
#define SCB_ICSR_PENDSVSET_Msk             (1UL << SCB_ICSR_PENDSVSET_Pos)                /*!< SCB ICSR: PENDSVSET Mask */
423
#define SCB_ICSR_PENDSVSET_Msk             (1UL << SCB_ICSR_PENDSVSET_Pos)                /*!< SCB ICSR: PENDSVSET Mask */
394
 
424
 
395
#define SCB_ICSR_PENDSVCLR_Pos             27                                             /*!< SCB ICSR: PENDSVCLR Position */
425
#define SCB_ICSR_PENDSVCLR_Pos             27U                                            /*!< SCB ICSR: PENDSVCLR Position */
396
#define SCB_ICSR_PENDSVCLR_Msk             (1UL << SCB_ICSR_PENDSVCLR_Pos)                /*!< SCB ICSR: PENDSVCLR Mask */
426
#define SCB_ICSR_PENDSVCLR_Msk             (1UL << SCB_ICSR_PENDSVCLR_Pos)                /*!< SCB ICSR: PENDSVCLR Mask */
397
 
427
 
398
#define SCB_ICSR_PENDSTSET_Pos             26                                             /*!< SCB ICSR: PENDSTSET Position */
428
#define SCB_ICSR_PENDSTSET_Pos             26U                                            /*!< SCB ICSR: PENDSTSET Position */
399
#define SCB_ICSR_PENDSTSET_Msk             (1UL << SCB_ICSR_PENDSTSET_Pos)                /*!< SCB ICSR: PENDSTSET Mask */
429
#define SCB_ICSR_PENDSTSET_Msk             (1UL << SCB_ICSR_PENDSTSET_Pos)                /*!< SCB ICSR: PENDSTSET Mask */
400
 
430
 
401
#define SCB_ICSR_PENDSTCLR_Pos             25                                             /*!< SCB ICSR: PENDSTCLR Position */
431
#define SCB_ICSR_PENDSTCLR_Pos             25U                                            /*!< SCB ICSR: PENDSTCLR Position */
402
#define SCB_ICSR_PENDSTCLR_Msk             (1UL << SCB_ICSR_PENDSTCLR_Pos)                /*!< SCB ICSR: PENDSTCLR Mask */
432
#define SCB_ICSR_PENDSTCLR_Msk             (1UL << SCB_ICSR_PENDSTCLR_Pos)                /*!< SCB ICSR: PENDSTCLR Mask */
403
 
433
 
404
#define SCB_ICSR_ISRPREEMPT_Pos            23                                             /*!< SCB ICSR: ISRPREEMPT Position */
434
#define SCB_ICSR_ISRPREEMPT_Pos            23U                                            /*!< SCB ICSR: ISRPREEMPT Position */
405
#define SCB_ICSR_ISRPREEMPT_Msk            (1UL << SCB_ICSR_ISRPREEMPT_Pos)               /*!< SCB ICSR: ISRPREEMPT Mask */
435
#define SCB_ICSR_ISRPREEMPT_Msk            (1UL << SCB_ICSR_ISRPREEMPT_Pos)               /*!< SCB ICSR: ISRPREEMPT Mask */
406
 
436
 
407
#define SCB_ICSR_ISRPENDING_Pos            22                                             /*!< SCB ICSR: ISRPENDING Position */
437
#define SCB_ICSR_ISRPENDING_Pos            22U                                            /*!< SCB ICSR: ISRPENDING Position */
408
#define SCB_ICSR_ISRPENDING_Msk            (1UL << SCB_ICSR_ISRPENDING_Pos)               /*!< SCB ICSR: ISRPENDING Mask */
438
#define SCB_ICSR_ISRPENDING_Msk            (1UL << SCB_ICSR_ISRPENDING_Pos)               /*!< SCB ICSR: ISRPENDING Mask */
409
 
439
 
410
#define SCB_ICSR_VECTPENDING_Pos           12                                             /*!< SCB ICSR: VECTPENDING Position */
440
#define SCB_ICSR_VECTPENDING_Pos           12U                                            /*!< SCB ICSR: VECTPENDING Position */
411
#define SCB_ICSR_VECTPENDING_Msk           (0x1FFUL << SCB_ICSR_VECTPENDING_Pos)          /*!< SCB ICSR: VECTPENDING Mask */
441
#define SCB_ICSR_VECTPENDING_Msk           (0x1FFUL << SCB_ICSR_VECTPENDING_Pos)          /*!< SCB ICSR: VECTPENDING Mask */
412
 
442
 
413
#define SCB_ICSR_VECTACTIVE_Pos             0                                             /*!< SCB ICSR: VECTACTIVE Position */
443
#define SCB_ICSR_VECTACTIVE_Pos             0U                                            /*!< SCB ICSR: VECTACTIVE Position */
414
#define SCB_ICSR_VECTACTIVE_Msk            (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/)       /*!< SCB ICSR: VECTACTIVE Mask */
444
#define SCB_ICSR_VECTACTIVE_Msk            (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/)       /*!< SCB ICSR: VECTACTIVE Mask */
415
 
445
 
416
/* SCB Application Interrupt and Reset Control Register Definitions */
446
/* SCB Application Interrupt and Reset Control Register Definitions */
417
#define SCB_AIRCR_VECTKEY_Pos              16                                             /*!< SCB AIRCR: VECTKEY Position */
447
#define SCB_AIRCR_VECTKEY_Pos              16U                                            /*!< SCB AIRCR: VECTKEY Position */
418
#define SCB_AIRCR_VECTKEY_Msk              (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos)            /*!< SCB AIRCR: VECTKEY Mask */
448
#define SCB_AIRCR_VECTKEY_Msk              (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos)            /*!< SCB AIRCR: VECTKEY Mask */
419
 
449
 
420
#define SCB_AIRCR_VECTKEYSTAT_Pos          16                                             /*!< SCB AIRCR: VECTKEYSTAT Position */
450
#define SCB_AIRCR_VECTKEYSTAT_Pos          16U                                            /*!< SCB AIRCR: VECTKEYSTAT Position */
421
#define SCB_AIRCR_VECTKEYSTAT_Msk          (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos)        /*!< SCB AIRCR: VECTKEYSTAT Mask */
451
#define SCB_AIRCR_VECTKEYSTAT_Msk          (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos)        /*!< SCB AIRCR: VECTKEYSTAT Mask */
422
 
452
 
423
#define SCB_AIRCR_ENDIANESS_Pos            15                                             /*!< SCB AIRCR: ENDIANESS Position */
453
#define SCB_AIRCR_ENDIANESS_Pos            15U                                            /*!< SCB AIRCR: ENDIANESS Position */
424
#define SCB_AIRCR_ENDIANESS_Msk            (1UL << SCB_AIRCR_ENDIANESS_Pos)               /*!< SCB AIRCR: ENDIANESS Mask */
454
#define SCB_AIRCR_ENDIANESS_Msk            (1UL << SCB_AIRCR_ENDIANESS_Pos)               /*!< SCB AIRCR: ENDIANESS Mask */
425
 
455
 
426
#define SCB_AIRCR_SYSRESETREQ_Pos           2                                             /*!< SCB AIRCR: SYSRESETREQ Position */
456
#define SCB_AIRCR_SYSRESETREQ_Pos           2U                                            /*!< SCB AIRCR: SYSRESETREQ Position */
427
#define SCB_AIRCR_SYSRESETREQ_Msk          (1UL << SCB_AIRCR_SYSRESETREQ_Pos)             /*!< SCB AIRCR: SYSRESETREQ Mask */
457
#define SCB_AIRCR_SYSRESETREQ_Msk          (1UL << SCB_AIRCR_SYSRESETREQ_Pos)             /*!< SCB AIRCR: SYSRESETREQ Mask */
428
 
458
 
429
#define SCB_AIRCR_VECTCLRACTIVE_Pos         1                                             /*!< SCB AIRCR: VECTCLRACTIVE Position */
459
#define SCB_AIRCR_VECTCLRACTIVE_Pos         1U                                            /*!< SCB AIRCR: VECTCLRACTIVE Position */
430
#define SCB_AIRCR_VECTCLRACTIVE_Msk        (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos)           /*!< SCB AIRCR: VECTCLRACTIVE Mask */
460
#define SCB_AIRCR_VECTCLRACTIVE_Msk        (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos)           /*!< SCB AIRCR: VECTCLRACTIVE Mask */
431
 
461
 
432
/* SCB System Control Register Definitions */
462
/* SCB System Control Register Definitions */
433
#define SCB_SCR_SEVONPEND_Pos               4                                             /*!< SCB SCR: SEVONPEND Position */
463
#define SCB_SCR_SEVONPEND_Pos               4U                                            /*!< SCB SCR: SEVONPEND Position */
434
#define SCB_SCR_SEVONPEND_Msk              (1UL << SCB_SCR_SEVONPEND_Pos)                 /*!< SCB SCR: SEVONPEND Mask */
464
#define SCB_SCR_SEVONPEND_Msk              (1UL << SCB_SCR_SEVONPEND_Pos)                 /*!< SCB SCR: SEVONPEND Mask */
435
 
465
 
436
#define SCB_SCR_SLEEPDEEP_Pos               2                                             /*!< SCB SCR: SLEEPDEEP Position */
466
#define SCB_SCR_SLEEPDEEP_Pos               2U                                            /*!< SCB SCR: SLEEPDEEP Position */
437
#define SCB_SCR_SLEEPDEEP_Msk              (1UL << SCB_SCR_SLEEPDEEP_Pos)                 /*!< SCB SCR: SLEEPDEEP Mask */
467
#define SCB_SCR_SLEEPDEEP_Msk              (1UL << SCB_SCR_SLEEPDEEP_Pos)                 /*!< SCB SCR: SLEEPDEEP Mask */
438
 
468
 
439
#define SCB_SCR_SLEEPONEXIT_Pos             1                                             /*!< SCB SCR: SLEEPONEXIT Position */
469
#define SCB_SCR_SLEEPONEXIT_Pos             1U                                            /*!< SCB SCR: SLEEPONEXIT Position */
440
#define SCB_SCR_SLEEPONEXIT_Msk            (1UL << SCB_SCR_SLEEPONEXIT_Pos)               /*!< SCB SCR: SLEEPONEXIT Mask */
470
#define SCB_SCR_SLEEPONEXIT_Msk            (1UL << SCB_SCR_SLEEPONEXIT_Pos)               /*!< SCB SCR: SLEEPONEXIT Mask */
441
 
471
 
442
/* SCB Configuration Control Register Definitions */
472
/* SCB Configuration Control Register Definitions */
443
#define SCB_CCR_STKALIGN_Pos                9                                             /*!< SCB CCR: STKALIGN Position */
473
#define SCB_CCR_STKALIGN_Pos                9U                                            /*!< SCB CCR: STKALIGN Position */
444
#define SCB_CCR_STKALIGN_Msk               (1UL << SCB_CCR_STKALIGN_Pos)                  /*!< SCB CCR: STKALIGN Mask */
474
#define SCB_CCR_STKALIGN_Msk               (1UL << SCB_CCR_STKALIGN_Pos)                  /*!< SCB CCR: STKALIGN Mask */
445
 
475
 
446
#define SCB_CCR_UNALIGN_TRP_Pos             3                                             /*!< SCB CCR: UNALIGN_TRP Position */
476
#define SCB_CCR_UNALIGN_TRP_Pos             3U                                            /*!< SCB CCR: UNALIGN_TRP Position */
447
#define SCB_CCR_UNALIGN_TRP_Msk            (1UL << SCB_CCR_UNALIGN_TRP_Pos)               /*!< SCB CCR: UNALIGN_TRP Mask */
477
#define SCB_CCR_UNALIGN_TRP_Msk            (1UL << SCB_CCR_UNALIGN_TRP_Pos)               /*!< SCB CCR: UNALIGN_TRP Mask */
448
 
478
 
449
/* SCB System Handler Control and State Register Definitions */
479
/* SCB System Handler Control and State Register Definitions */
450
#define SCB_SHCSR_SVCALLPENDED_Pos         15                                             /*!< SCB SHCSR: SVCALLPENDED Position */
480
#define SCB_SHCSR_SVCALLPENDED_Pos         15U                                            /*!< SCB SHCSR: SVCALLPENDED Position */
451
#define SCB_SHCSR_SVCALLPENDED_Msk         (1UL << SCB_SHCSR_SVCALLPENDED_Pos)            /*!< SCB SHCSR: SVCALLPENDED Mask */
481
#define SCB_SHCSR_SVCALLPENDED_Msk         (1UL << SCB_SHCSR_SVCALLPENDED_Pos)            /*!< SCB SHCSR: SVCALLPENDED Mask */
452
 
482
 
453
/*@} end of group CMSIS_SCB */
483
/*@} end of group CMSIS_SCB */
454
 
484
 
455
 
485
 
-
 
486
/**
456
/** \ingroup  CMSIS_core_register
487
  \ingroup  CMSIS_core_register
457
    \defgroup CMSIS_SysTick     System Tick Timer (SysTick)
488
  \defgroup CMSIS_SysTick     System Tick Timer (SysTick)
458
    \brief      Type definitions for the System Timer Registers.
489
  \brief    Type definitions for the System Timer Registers.
459
  @{
490
  @{
460
 */
491
 */
461
 
492
 
-
 
493
/**
462
/** \brief  Structure type to access the System Timer (SysTick).
494
  \brief  Structure type to access the System Timer (SysTick).
463
 */
495
 */
464
typedef struct
496
typedef struct
465
{
497
{
466
  __IO uint32_t CTRL;                    /*!< Offset: 0x000 (R/W)  SysTick Control and Status Register */
498
  __IOM uint32_t CTRL;                   /*!< Offset: 0x000 (R/W)  SysTick Control and Status Register */
467
  __IO uint32_t LOAD;                    /*!< Offset: 0x004 (R/W)  SysTick Reload Value Register       */
499
  __IOM uint32_t LOAD;                   /*!< Offset: 0x004 (R/W)  SysTick Reload Value Register */
468
  __IO uint32_t VAL;                     /*!< Offset: 0x008 (R/W)  SysTick Current Value Register      */
500
  __IOM uint32_t VAL;                    /*!< Offset: 0x008 (R/W)  SysTick Current Value Register */
469
  __I  uint32_t CALIB;                   /*!< Offset: 0x00C (R/ )  SysTick Calibration Register        */
501
  __IM  uint32_t CALIB;                  /*!< Offset: 0x00C (R/ )  SysTick Calibration Register */
470
} SysTick_Type;
502
} SysTick_Type;
471
 
503
 
472
/* SysTick Control / Status Register Definitions */
504
/* SysTick Control / Status Register Definitions */
473
#define SysTick_CTRL_COUNTFLAG_Pos         16                                             /*!< SysTick CTRL: COUNTFLAG Position */
505
#define SysTick_CTRL_COUNTFLAG_Pos         16U                                            /*!< SysTick CTRL: COUNTFLAG Position */
474
#define SysTick_CTRL_COUNTFLAG_Msk         (1UL << SysTick_CTRL_COUNTFLAG_Pos)            /*!< SysTick CTRL: COUNTFLAG Mask */
506
#define SysTick_CTRL_COUNTFLAG_Msk         (1UL << SysTick_CTRL_COUNTFLAG_Pos)            /*!< SysTick CTRL: COUNTFLAG Mask */
475
 
507
 
476
#define SysTick_CTRL_CLKSOURCE_Pos          2                                             /*!< SysTick CTRL: CLKSOURCE Position */
508
#define SysTick_CTRL_CLKSOURCE_Pos          2U                                            /*!< SysTick CTRL: CLKSOURCE Position */
477
#define SysTick_CTRL_CLKSOURCE_Msk         (1UL << SysTick_CTRL_CLKSOURCE_Pos)            /*!< SysTick CTRL: CLKSOURCE Mask */
509
#define SysTick_CTRL_CLKSOURCE_Msk         (1UL << SysTick_CTRL_CLKSOURCE_Pos)            /*!< SysTick CTRL: CLKSOURCE Mask */
478
 
510
 
479
#define SysTick_CTRL_TICKINT_Pos            1                                             /*!< SysTick CTRL: TICKINT Position */
511
#define SysTick_CTRL_TICKINT_Pos            1U                                            /*!< SysTick CTRL: TICKINT Position */
480
#define SysTick_CTRL_TICKINT_Msk           (1UL << SysTick_CTRL_TICKINT_Pos)              /*!< SysTick CTRL: TICKINT Mask */
512
#define SysTick_CTRL_TICKINT_Msk           (1UL << SysTick_CTRL_TICKINT_Pos)              /*!< SysTick CTRL: TICKINT Mask */
481
 
513
 
482
#define SysTick_CTRL_ENABLE_Pos             0                                             /*!< SysTick CTRL: ENABLE Position */
514
#define SysTick_CTRL_ENABLE_Pos             0U                                            /*!< SysTick CTRL: ENABLE Position */
483
#define SysTick_CTRL_ENABLE_Msk            (1UL /*<< SysTick_CTRL_ENABLE_Pos*/)           /*!< SysTick CTRL: ENABLE Mask */
515
#define SysTick_CTRL_ENABLE_Msk            (1UL /*<< SysTick_CTRL_ENABLE_Pos*/)           /*!< SysTick CTRL: ENABLE Mask */
484
 
516
 
485
/* SysTick Reload Register Definitions */
517
/* SysTick Reload Register Definitions */
486
#define SysTick_LOAD_RELOAD_Pos             0                                             /*!< SysTick LOAD: RELOAD Position */
518
#define SysTick_LOAD_RELOAD_Pos             0U                                            /*!< SysTick LOAD: RELOAD Position */
487
#define SysTick_LOAD_RELOAD_Msk            (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/)    /*!< SysTick LOAD: RELOAD Mask */
519
#define SysTick_LOAD_RELOAD_Msk            (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/)    /*!< SysTick LOAD: RELOAD Mask */
488
 
520
 
489
/* SysTick Current Register Definitions */
521
/* SysTick Current Register Definitions */
490
#define SysTick_VAL_CURRENT_Pos             0                                             /*!< SysTick VAL: CURRENT Position */
522
#define SysTick_VAL_CURRENT_Pos             0U                                            /*!< SysTick VAL: CURRENT Position */
491
#define SysTick_VAL_CURRENT_Msk            (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/)    /*!< SysTick VAL: CURRENT Mask */
523
#define SysTick_VAL_CURRENT_Msk            (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/)    /*!< SysTick VAL: CURRENT Mask */
492
 
524
 
493
/* SysTick Calibration Register Definitions */
525
/* SysTick Calibration Register Definitions */
494
#define SysTick_CALIB_NOREF_Pos            31                                             /*!< SysTick CALIB: NOREF Position */
526
#define SysTick_CALIB_NOREF_Pos            31U                                            /*!< SysTick CALIB: NOREF Position */
495
#define SysTick_CALIB_NOREF_Msk            (1UL << SysTick_CALIB_NOREF_Pos)               /*!< SysTick CALIB: NOREF Mask */
527
#define SysTick_CALIB_NOREF_Msk            (1UL << SysTick_CALIB_NOREF_Pos)               /*!< SysTick CALIB: NOREF Mask */
496
 
528
 
497
#define SysTick_CALIB_SKEW_Pos             30                                             /*!< SysTick CALIB: SKEW Position */
529
#define SysTick_CALIB_SKEW_Pos             30U                                            /*!< SysTick CALIB: SKEW Position */
498
#define SysTick_CALIB_SKEW_Msk             (1UL << SysTick_CALIB_SKEW_Pos)                /*!< SysTick CALIB: SKEW Mask */
530
#define SysTick_CALIB_SKEW_Msk             (1UL << SysTick_CALIB_SKEW_Pos)                /*!< SysTick CALIB: SKEW Mask */
499
 
531
 
500
#define SysTick_CALIB_TENMS_Pos             0                                             /*!< SysTick CALIB: TENMS Position */
532
#define SysTick_CALIB_TENMS_Pos             0U                                            /*!< SysTick CALIB: TENMS Position */
501
#define SysTick_CALIB_TENMS_Msk            (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/)    /*!< SysTick CALIB: TENMS Mask */
533
#define SysTick_CALIB_TENMS_Msk            (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/)    /*!< SysTick CALIB: TENMS Mask */
502
 
534
 
503
/*@} end of group CMSIS_SysTick */
535
/*@} end of group CMSIS_SysTick */
504
 
536
 
505
 
537
 
-
 
538
/**
506
/** \ingroup  CMSIS_core_register
539
  \ingroup  CMSIS_core_register
507
    \defgroup CMSIS_CoreDebug       Core Debug Registers (CoreDebug)
540
  \defgroup CMSIS_CoreDebug       Core Debug Registers (CoreDebug)
508
    \brief      Cortex-M0 Core Debug Registers (DCB registers, SHCSR, and DFSR)
541
  \brief    Cortex-M0 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor.
509
                are only accessible over DAP and not via processor. Therefore
-
 
510
                they are not covered by the Cortex-M0 header file.
542
            Therefore they are not covered by the Cortex-M0 header file.
511
  @{
543
  @{
512
 */
544
 */
513
/*@} end of group CMSIS_CoreDebug */
545
/*@} end of group CMSIS_CoreDebug */
514
 
546
 
515
 
547
 
-
 
548
/**
516
/** \ingroup    CMSIS_core_register
549
  \ingroup    CMSIS_core_register
-
 
550
  \defgroup   CMSIS_core_bitfield     Core register bit field macros
-
 
551
  \brief      Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
-
 
552
  @{
-
 
553
 */
-
 
554
 
-
 
555
/**
-
 
556
  \brief   Mask and shift a bit field value for use in a register bit range.
-
 
557
  \param[in] field  Name of the register bit field.
-
 
558
  \param[in] value  Value of the bit field.
-
 
559
  \return           Masked and shifted value.
-
 
560
*/
-
 
561
#define _VAL2FLD(field, value)    ((value << field ## _Pos) & field ## _Msk)
-
 
562
 
-
 
563
/**
-
 
564
  \brief     Mask and shift a register value to extract a bit filed value.
-
 
565
  \param[in] field  Name of the register bit field.
-
 
566
  \param[in] value  Value of register.
-
 
567
  \return           Masked and shifted bit field value.
-
 
568
*/
-
 
569
#define _FLD2VAL(field, value)    ((value & field ## _Msk) >> field ## _Pos)
-
 
570
 
-
 
571
/*@} end of group CMSIS_core_bitfield */
-
 
572
 
-
 
573
 
-
 
574
/**
-
 
575
  \ingroup    CMSIS_core_register
517
    \defgroup   CMSIS_core_base     Core Definitions
576
  \defgroup   CMSIS_core_base     Core Definitions
518
    \brief      Definitions for base addresses, unions, and structures.
577
  \brief      Definitions for base addresses, unions, and structures.
519
  @{
578
  @{
520
 */
579
 */
521
 
580
 
522
/* Memory mapping of Cortex-M0 Hardware */
581
/* Memory mapping of Cortex-M0 Hardware */
523
#define SCS_BASE            (0xE000E000UL)                            /*!< System Control Space Base Address */
582
#define SCS_BASE            (0xE000E000UL)                            /*!< System Control Space Base Address */
524
#define SysTick_BASE        (SCS_BASE +  0x0010UL)                    /*!< SysTick Base Address              */
583
#define SysTick_BASE        (SCS_BASE +  0x0010UL)                    /*!< SysTick Base Address */
525
#define NVIC_BASE           (SCS_BASE +  0x0100UL)                    /*!< NVIC Base Address                 */
584
#define NVIC_BASE           (SCS_BASE +  0x0100UL)                    /*!< NVIC Base Address */
526
#define SCB_BASE            (SCS_BASE +  0x0D00UL)                    /*!< System Control Block Base Address */
585
#define SCB_BASE            (SCS_BASE +  0x0D00UL)                    /*!< System Control Block Base Address */
527
 
586
 
528
#define SCB                 ((SCB_Type       *)     SCB_BASE      )   /*!< SCB configuration struct           */
587
#define SCB                 ((SCB_Type       *)     SCB_BASE      )   /*!< SCB configuration struct */
529
#define SysTick             ((SysTick_Type   *)     SysTick_BASE  )   /*!< SysTick configuration struct       */
588
#define SysTick             ((SysTick_Type   *)     SysTick_BASE  )   /*!< SysTick configuration struct */
530
#define NVIC                ((NVIC_Type      *)     NVIC_BASE     )   /*!< NVIC configuration struct          */
589
#define NVIC                ((NVIC_Type      *)     NVIC_BASE     )   /*!< NVIC configuration struct */
531
 
590
 
532
 
591
 
533
/*@} */
592
/*@} */
534
 
593
 
535
 
594
 
Line 539... Line 598...
539
  Core Function Interface contains:
598
  Core Function Interface contains:
540
  - Core NVIC Functions
599
  - Core NVIC Functions
541
  - Core SysTick Functions
600
  - Core SysTick Functions
542
  - Core Register Access Functions
601
  - Core Register Access Functions
543
 ******************************************************************************/
602
 ******************************************************************************/
-
 
603
/**
544
/** \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
604
  \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
545
*/
605
*/
546
 
606
 
547
 
607
 
548
 
608
 
549
/* ##########################   NVIC functions  #################################### */
609
/* ##########################   NVIC functions  #################################### */
-
 
610
/**
550
/** \ingroup  CMSIS_Core_FunctionInterface
611
  \ingroup  CMSIS_Core_FunctionInterface
551
    \defgroup CMSIS_Core_NVICFunctions NVIC Functions
612
  \defgroup CMSIS_Core_NVICFunctions NVIC Functions
552
    \brief      Functions that manage interrupts and exceptions via the NVIC.
613
  \brief    Functions that manage interrupts and exceptions via the NVIC.
553
    @{
614
  @{
554
 */
615
 */
555
 
616
 
556
/* Interrupt Priorities are WORD accessible only under ARMv6M                   */
617
/* Interrupt Priorities are WORD accessible only under ARMv6M                   */
557
/* The following MACROS handle generation of the register offset and byte masks */
618
/* The following MACROS handle generation of the register offset and byte masks */
558
#define _BIT_SHIFT(IRQn)         (  ((((uint32_t)(int32_t)(IRQn))         )      &  0x03UL) * 8UL)
619
#define _BIT_SHIFT(IRQn)         (  ((((uint32_t)(int32_t)(IRQn))         )      &  0x03UL) * 8UL)
559
#define _SHP_IDX(IRQn)           ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >>    2UL)      )
620
#define _SHP_IDX(IRQn)           ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >>    2UL)      )
560
#define _IP_IDX(IRQn)            (   (((uint32_t)(int32_t)(IRQn))                >>    2UL)      )
621
#define _IP_IDX(IRQn)            (   (((uint32_t)(int32_t)(IRQn))                >>    2UL)      )
561
 
622
 
562
 
623
 
-
 
624
/**
563
/** \brief  Enable External Interrupt
625
  \brief   Enable External Interrupt
564
 
-
 
565
    The function enables a device-specific interrupt in the NVIC interrupt controller.
626
  \details Enables a device-specific interrupt in the NVIC interrupt controller.
566
 
-
 
567
    \param [in]      IRQn  External interrupt number. Value cannot be negative.
627
  \param [in]      IRQn  External interrupt number. Value cannot be negative.
568
 */
628
 */
569
__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
629
__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
570
{
630
{
571
  NVIC->ISER[0] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
631
  NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
572
}
632
}
573
 
633
 
574
 
634
 
-
 
635
/**
575
/** \brief  Disable External Interrupt
636
  \brief   Disable External Interrupt
576
 
-
 
577
    The function disables a device-specific interrupt in the NVIC interrupt controller.
637
  \details Disables a device-specific interrupt in the NVIC interrupt controller.
578
 
-
 
579
    \param [in]      IRQn  External interrupt number. Value cannot be negative.
638
  \param [in]      IRQn  External interrupt number. Value cannot be negative.
580
 */
639
 */
581
__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
640
__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
582
{
641
{
583
  NVIC->ICER[0] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
642
  NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
584
}
643
}
585
 
644
 
586
 
645
 
-
 
646
/**
587
/** \brief  Get Pending Interrupt
647
  \brief   Get Pending Interrupt
588
 
-
 
589
    The function reads the pending register in the NVIC and returns the pending bit
648
  \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt.
590
    for the specified interrupt.
-
 
591
 
-
 
592
    \param [in]      IRQn  Interrupt number.
649
  \param [in]      IRQn  Interrupt number.
593
 
-
 
594
    \return             0  Interrupt status is not pending.
650
  \return             0  Interrupt status is not pending.
595
    \return             1  Interrupt status is pending.
651
  \return             1  Interrupt status is pending.
596
 */
652
 */
597
__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
653
__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
598
{
654
{
599
  return((uint32_t)(((NVIC->ISPR[0] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
655
  return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
600
}
656
}
601
 
657
 
602
 
658
 
-
 
659
/**
603
/** \brief  Set Pending Interrupt
660
  \brief   Set Pending Interrupt
604
 
-
 
605
    The function sets the pending bit of an external interrupt.
661
  \details Sets the pending bit of an external interrupt.
606
 
-
 
607
    \param [in]      IRQn  Interrupt number. Value cannot be negative.
662
  \param [in]      IRQn  Interrupt number. Value cannot be negative.
608
 */
663
 */
609
__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
664
__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
610
{
665
{
611
  NVIC->ISPR[0] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
666
  NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
612
}
667
}
613
 
668
 
614
 
669
 
-
 
670
/**
615
/** \brief  Clear Pending Interrupt
671
  \brief   Clear Pending Interrupt
616
 
-
 
617
    The function clears the pending bit of an external interrupt.
672
  \details Clears the pending bit of an external interrupt.
618
 
-
 
619
    \param [in]      IRQn  External interrupt number. Value cannot be negative.
673
  \param [in]      IRQn  External interrupt number. Value cannot be negative.
620
 */
674
 */
621
__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
675
__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
622
{
676
{
623
  NVIC->ICPR[0] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
677
  NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
624
}
678
}
625
 
679
 
626
 
680
 
-
 
681
/**
627
/** \brief  Set Interrupt Priority
682
  \brief   Set Interrupt Priority
628
 
-
 
629
    The function sets the priority of an interrupt.
683
  \details Sets the priority of an interrupt.
630
 
-
 
631
    \note The priority cannot be set for every core interrupt.
684
  \note    The priority cannot be set for every core interrupt.
632
 
-
 
633
    \param [in]      IRQn  Interrupt number.
685
  \param [in]      IRQn  Interrupt number.
634
    \param [in]  priority  Priority to set.
686
  \param [in]  priority  Priority to set.
635
 */
687
 */
636
__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
688
__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
637
{
689
{
638
  if((int32_t)(IRQn) < 0) {
690
  if ((int32_t)(IRQn) < 0)
-
 
691
  {
639
    SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
692
    SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
640
       (((priority << (8 - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
693
       (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
641
  }
694
  }
642
  else {
695
  else
-
 
696
  {
643
    NVIC->IP[_IP_IDX(IRQn)]  = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)]  & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
697
    NVIC->IP[_IP_IDX(IRQn)]  = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)]  & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
644
       (((priority << (8 - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
698
       (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
645
  }
699
  }
646
}
700
}
647
 
701
 
648
 
702
 
-
 
703
/**
649
/** \brief  Get Interrupt Priority
704
  \brief   Get Interrupt Priority
650
 
-
 
651
    The function reads the priority of an interrupt. The interrupt
705
  \details Reads the priority of an interrupt.
652
    number can be positive to specify an external (device specific)
706
           The interrupt number can be positive to specify an external (device specific) interrupt,
653
    interrupt, or negative to specify an internal (core) interrupt.
707
           or negative to specify an internal (core) interrupt.
654
 
-
 
655
 
-
 
656
    \param [in]   IRQn  Interrupt number.
708
  \param [in]   IRQn  Interrupt number.
657
    \return             Interrupt Priority. Value is aligned automatically to the implemented
709
  \return             Interrupt Priority.
658
                        priority bits of the microcontroller.
710
                      Value is aligned automatically to the implemented priority bits of the microcontroller.
659
 */
711
 */
660
__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
712
__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
661
{
713
{
662
 
714
 
663
  if((int32_t)(IRQn) < 0) {
715
  if ((int32_t)(IRQn) < 0)
-
 
716
  {
664
    return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8 - __NVIC_PRIO_BITS)));
717
    return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
665
  }
718
  }
666
  else {
719
  else
-
 
720
  {
667
    return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8 - __NVIC_PRIO_BITS)));
721
    return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
668
  }
722
  }
669
}
723
}
670
 
724
 
671
 
725
 
-
 
726
/**
672
/** \brief  System Reset
727
  \brief   System Reset
673
 
-
 
674
    The function initiates a system reset request to reset the MCU.
728
  \details Initiates a system reset request to reset the MCU.
675
 */
729
 */
676
__STATIC_INLINE void NVIC_SystemReset(void)
730
__STATIC_INLINE void NVIC_SystemReset(void)
677
{
731
{
678
  __DSB();                                                     /* Ensure all outstanding memory accesses included
732
  __DSB();                                                          /* Ensure all outstanding memory accesses included
679
                                                                  buffered write are completed before reset */
733
                                                                       buffered write are completed before reset */
680
  SCB->AIRCR  = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
734
  SCB->AIRCR  = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
681
                 SCB_AIRCR_SYSRESETREQ_Msk);
735
                 SCB_AIRCR_SYSRESETREQ_Msk);
682
  __DSB();                                                     /* Ensure completion of memory access */
736
  __DSB();                                                          /* Ensure completion of memory access */
-
 
737
 
683
  while(1) { __NOP(); }                                        /* wait until reset */
738
  for(;;)                                                           /* wait until reset */
-
 
739
  {
-
 
740
    __NOP();
-
 
741
  }
684
}
742
}
685
 
743
 
686
/*@} end of CMSIS_Core_NVICFunctions */
744
/*@} end of CMSIS_Core_NVICFunctions */
687
 
745
 
688
 
746
 
689
 
747
 
690
/* ##################################    SysTick function  ############################################ */
748
/* ##################################    SysTick function  ############################################ */
-
 
749
/**
691
/** \ingroup  CMSIS_Core_FunctionInterface
750
  \ingroup  CMSIS_Core_FunctionInterface
692
    \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
751
  \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
693
    \brief      Functions that configure the System.
752
  \brief    Functions that configure the System.
694
  @{
753
  @{
695
 */
754
 */
696
 
755
 
697
#if (__Vendor_SysTickConfig == 0)
756
#if (__Vendor_SysTickConfig == 0U)
698
 
-
 
699
/** \brief  System Tick Configuration
-
 
700
 
-
 
701
    The function initializes the System Timer and its interrupt, and starts the System Tick Timer.
-
 
702
    Counter is in free running mode to generate periodic interrupts.
-
 
703
 
-
 
704
    \param [in]  ticks  Number of ticks between two interrupts.
-
 
705
 
-
 
706
    \return          0  Function succeeded.
-
 
707
    \return          1  Function failed.
-
 
708
 
-
 
709
    \note     When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
-
 
710
    function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
-
 
711
    must contain a vendor-specific implementation of this function.
-
 
712
 
757
 
-
 
758
/**
-
 
759
  \brief   System Tick Configuration
-
 
760
  \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
-
 
761
           Counter is in free running mode to generate periodic interrupts.
-
 
762
  \param [in]  ticks  Number of ticks between two interrupts.
-
 
763
  \return          0  Function succeeded.
-
 
764
  \return          1  Function failed.
-
 
765
  \note    When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
-
 
766
           function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
-
 
767
           must contain a vendor-specific implementation of this function.
713
 */
768
 */
714
__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
769
__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
715
{
770
{
-
 
771
  if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
-
 
772
  {
716
  if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) { return (1UL); }    /* Reload value impossible */
773
    return (1UL);                                                   /* Reload value impossible */
-
 
774
  }
717
 
775
 
718
  SysTick->LOAD  = (uint32_t)(ticks - 1UL);                         /* set reload register */
776
  SysTick->LOAD  = (uint32_t)(ticks - 1UL);                         /* set reload register */
719
  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
777
  NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
720
  SysTick->VAL   = 0UL;                                             /* Load the SysTick Counter Value */
778
  SysTick->VAL   = 0UL;                                             /* Load the SysTick Counter Value */
721
  SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
779
  SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |