Subversion Repositories LedShow

Rev

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

Rev 2 Rev 9
Line 1... Line 1...
1
/**************************************************************************//**
1
/**************************************************************************//**
2
 * @file     core_cm4.h
2
 * @file     core_cm4.h
3
 * @brief    CMSIS Cortex-M4 Core Peripheral Access Layer Header File
3
 * @brief    CMSIS Cortex-M4 Core Peripheral Access Layer Header File
4
 * @version  V4.30
4
 * @version  V5.0.8
5
 * @date     20. October 2015
5
 * @date     04. June 2018
6
 ******************************************************************************/
6
 ******************************************************************************/
-
 
7
/*
7
/* Copyright (c) 2009 - 2015 ARM LIMITED
8
 * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
8
 
9
 *
9
   All rights reserved.
10
 * SPDX-License-Identifier: Apache-2.0
10
   Redistribution and use in source and binary forms, with or without
-
 
11
   modification, are permitted provided that the following conditions are met:
-
 
-
 
11
 *
12
   - Redistributions of source code must retain the above copyright
12
 * Licensed under the Apache License, Version 2.0 (the License); you may
13
     notice, this list of conditions and the following disclaimer.
13
 * not use this file except in compliance with the License.
14
   - Redistributions in binary form must reproduce the above copyright
14
 * You may obtain a copy of the License at
15
     notice, this list of conditions and the following disclaimer in the
-
 
16
     documentation and/or other materials provided with the distribution.
-
 
17
   - Neither the name of ARM nor the names of its contributors may be used
-
 
18
     to endorse or promote products derived from this software without
-
 
-
 
15
 *
19
     specific prior written permission.
16
 * www.apache.org/licenses/LICENSE-2.0
20
   *
17
 *
21
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-
 
22
   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-
 
23
   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-
 
24
   ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
-
 
25
   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-
 
26
   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-
 
27
   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
18
 * Unless required by applicable law or agreed to in writing, software
28
   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
19
 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
29
   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
20
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
21
 * See the License for the specific language governing permissions and
31
   POSSIBILITY OF SUCH DAMAGE.
22
 * limitations under the License.
32
   ---------------------------------------------------------------------------*/
-
 
33
 
23
 */
34
 
24
 
35
#if   defined ( __ICCARM__ )
25
#if   defined ( __ICCARM__ )
36
 #pragma system_include         /* treat file as system include file for MISRA check */
26
  #pragma system_include         /* treat file as system include file for MISRA check */
37
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
27
#elif defined (__clang__)
38
  #pragma clang system_header   /* treat file as system include file */
28
  #pragma clang system_header   /* treat file as system include file */
39
#endif
29
#endif
40
 
30
 
41
#ifndef __CORE_CM4_H_GENERIC
31
#ifndef __CORE_CM4_H_GENERIC
42
#define __CORE_CM4_H_GENERIC
32
#define __CORE_CM4_H_GENERIC
Line 68... Line 58...
68
/**
58
/**
69
  \ingroup Cortex_M4
59
  \ingroup Cortex_M4
70
  @{
60
  @{
71
 */
61
 */
72
 
62
 
73
/*  CMSIS CM4 definitions */
-
 
74
#define __CM4_CMSIS_VERSION_MAIN  (0x04U)                                      /*!< [31:16] CMSIS HAL main version */
-
 
75
#define __CM4_CMSIS_VERSION_SUB   (0x1EU)                                      /*!< [15:0]  CMSIS HAL sub version */
-
 
76
#define __CM4_CMSIS_VERSION       ((__CM4_CMSIS_VERSION_MAIN << 16U) | \
-
 
77
                                    __CM4_CMSIS_VERSION_SUB           )        /*!< CMSIS HAL version number */
-
 
78
 
-
 
79
#define __CORTEX_M                (0x04U)                                      /*!< Cortex-M Core */
-
 
80
 
-
 
81
 
-
 
82
#if   defined ( __CC_ARM )
63
#include "cmsis_version.h"
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 */
-
 
89
  #define __INLINE         __inline                                   /*!< inline keyword for ARM Compiler */
-
 
90
  #define __STATIC_INLINE  static __inline
-
 
91
 
64
 
92
#elif defined ( __GNUC__ )
65
/* CMSIS CM4 definitions */
93
  #define __ASM            __asm                                      /*!< asm keyword for GNU Compiler */
66
#define __CM4_CMSIS_VERSION_MAIN  (__CM_CMSIS_VERSION_MAIN)              /*!< \deprecated [31:16] CMSIS HAL main version */
94
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler */
67
#define __CM4_CMSIS_VERSION_SUB   (__CM_CMSIS_VERSION_SUB)               /*!< \deprecated [15:0]  CMSIS HAL sub version */
95
  #define __STATIC_INLINE  static inline
-
 
96
 
-
 
97
#elif defined ( __ICCARM__ )
-
 
98
  #define __ASM            __asm                                      /*!< asm keyword for IAR Compiler */
68
#define __CM4_CMSIS_VERSION       ((__CM4_CMSIS_VERSION_MAIN << 16U) | \
99
  #define __INLINE         inline                                     /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
-
 
100
  #define __STATIC_INLINE  static inline
-
 
101
 
-
 
102
#elif defined ( __TMS470__ )
-
 
103
  #define __ASM            __asm                                      /*!< asm keyword for TI CCS Compiler */
-
 
104
  #define __STATIC_INLINE  static inline
-
 
105
 
-
 
106
#elif defined ( __TASKING__ )
-
 
107
  #define __ASM            __asm                                      /*!< asm keyword for TASKING Compiler */
69
                                    __CM4_CMSIS_VERSION_SUB           )  /*!< \deprecated CMSIS HAL version number */
108
  #define __INLINE         inline                                     /*!< inline keyword for TASKING Compiler */
-
 
109
  #define __STATIC_INLINE  static inline
-
 
110
 
70
 
111
#elif defined ( __CSMC__ )
-
 
112
  #define __packed
-
 
113
  #define __ASM            _asm                                      /*!< asm keyword for COSMIC Compiler */
71
#define __CORTEX_M                (4U)                                   /*!< Cortex-M Core */
114
  #define __INLINE         inline                                    /*!< inline keyword for COSMIC Compiler. Use -pc99 on compile line */
-
 
115
  #define __STATIC_INLINE  static inline
-
 
116
 
-
 
117
#else
-
 
118
  #error Unknown compiler
-
 
119
#endif
-
 
120
 
72
 
121
/** __FPU_USED indicates whether an FPU is used or not.
73
/** __FPU_USED indicates whether an FPU is used or not.
122
    For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions.
74
    For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions.
123
*/
75
*/
124
#if defined ( __CC_ARM )
76
#if defined ( __CC_ARM )
125
  #if defined __TARGET_FPU_VFP
77
  #if defined __TARGET_FPU_VFP
126
    #if (__FPU_PRESENT == 1U)
78
    #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
127
      #define __FPU_USED       1U
79
      #define __FPU_USED       1U
128
    #else
80
    #else
129
      #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
81
      #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
130
      #define __FPU_USED       0U
82
      #define __FPU_USED       0U
131
    #endif
83
    #endif
132
  #else
84
  #else
133
    #define __FPU_USED         0U
85
    #define __FPU_USED         0U
134
  #endif
86
  #endif
135
 
87
 
136
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
88
#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
137
  #if defined __ARM_PCS_VFP
89
  #if defined __ARM_PCS_VFP
138
    #if (__FPU_PRESENT == 1)
90
    #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
139
      #define __FPU_USED       1U
91
      #define __FPU_USED       1U
140
    #else
92
    #else
141
      #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
93
      #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
142
      #define __FPU_USED       0U
94
      #define __FPU_USED       0U
143
    #endif
95
    #endif
Line 145... Line 97...
145
    #define __FPU_USED         0U
97
    #define __FPU_USED         0U
146
  #endif
98
  #endif
147
 
99
 
148
#elif defined ( __GNUC__ )
100
#elif defined ( __GNUC__ )
149
  #if defined (__VFP_FP__) && !defined(__SOFTFP__)
101
  #if defined (__VFP_FP__) && !defined(__SOFTFP__)
150
    #if (__FPU_PRESENT == 1U)
102
    #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
151
      #define __FPU_USED       1U
103
      #define __FPU_USED       1U
152
    #else
104
    #else
153
      #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
105
      #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
154
      #define __FPU_USED       0U
106
      #define __FPU_USED       0U
155
    #endif
107
    #endif
Line 157... Line 109...
157
    #define __FPU_USED         0U
109
    #define __FPU_USED         0U
158
  #endif
110
  #endif
159
 
111
 
160
#elif defined ( __ICCARM__ )
112
#elif defined ( __ICCARM__ )
161
  #if defined __ARMVFP__
113
  #if defined __ARMVFP__
162
    #if (__FPU_PRESENT == 1U)
114
    #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
163
      #define __FPU_USED       1U
115
      #define __FPU_USED       1U
164
    #else
116
    #else
165
      #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
117
      #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
166
      #define __FPU_USED       0U
118
      #define __FPU_USED       0U
167
    #endif
119
    #endif
168
  #else
120
  #else
169
    #define __FPU_USED         0U
121
    #define __FPU_USED         0U
170
  #endif
122
  #endif
171
 
123
 
172
#elif defined ( __TMS470__ )
124
#elif defined ( __TI_ARM__ )
173
  #if defined __TI_VFP_SUPPORT__
125
  #if defined __TI_VFP_SUPPORT__
174
    #if (__FPU_PRESENT == 1U)
126
    #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
175
      #define __FPU_USED       1U
127
      #define __FPU_USED       1U
176
    #else
128
    #else
177
      #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
129
      #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
178
      #define __FPU_USED       0U
130
      #define __FPU_USED       0U
179
    #endif
131
    #endif
Line 181... Line 133...
181
    #define __FPU_USED         0U
133
    #define __FPU_USED         0U
182
  #endif
134
  #endif
183
 
135
 
184
#elif defined ( __TASKING__ )
136
#elif defined ( __TASKING__ )
185
  #if defined __FPU_VFP__
137
  #if defined __FPU_VFP__
186
    #if (__FPU_PRESENT == 1U)
138
    #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
187
      #define __FPU_USED       1U
139
      #define __FPU_USED       1U
188
    #else
140
    #else
189
      #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
141
      #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
190
      #define __FPU_USED       0U
142
      #define __FPU_USED       0U
191
    #endif
143
    #endif
Line 193... Line 145...
193
    #define __FPU_USED         0U
145
    #define __FPU_USED         0U
194
  #endif
146
  #endif
195
 
147
 
196
#elif defined ( __CSMC__ )
148
#elif defined ( __CSMC__ )
197
  #if ( __CSMC__ & 0x400U)
149
  #if ( __CSMC__ & 0x400U)
198
    #if (__FPU_PRESENT == 1U)
150
    #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)
199
      #define __FPU_USED       1U
151
      #define __FPU_USED       1U
200
    #else
152
    #else
201
      #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)"
202
      #define __FPU_USED       0U
154
      #define __FPU_USED       0U
203
    #endif
155
    #endif
Line 205... Line 157...
205
    #define __FPU_USED         0U
157
    #define __FPU_USED         0U
206
  #endif
158
  #endif
207
 
159
 
208
#endif
160
#endif
209
 
161
 
210
#include "core_cmInstr.h"                /* Core Instruction Access */
-
 
211
#include "core_cmFunc.h"                 /* Core Function Access */
-
 
212
#include "core_cmSimd.h"                 /* Compiler specific SIMD Intrinsics */
162
#include "cmsis_compiler.h"               /* CMSIS compiler specific defines */
-
 
163
 
213
 
164
 
214
#ifdef __cplusplus
165
#ifdef __cplusplus
215
}
166
}
216
#endif
167
#endif
217
 
168
 
Line 242... Line 193...
242
    #define __MPU_PRESENT             0U
193
    #define __MPU_PRESENT             0U
243
    #warning "__MPU_PRESENT not defined in device header file; using default!"
194
    #warning "__MPU_PRESENT not defined in device header file; using default!"
244
  #endif
195
  #endif
245
 
196
 
246
  #ifndef __NVIC_PRIO_BITS
197
  #ifndef __NVIC_PRIO_BITS
247
    #define __NVIC_PRIO_BITS          4U
198
    #define __NVIC_PRIO_BITS          3U
248
    #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
199
    #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
249
  #endif
200
  #endif
250
 
201
 
251
  #ifndef __Vendor_SysTickConfig
202
  #ifndef __Vendor_SysTickConfig
252
    #define __Vendor_SysTickConfig    0U
203
    #define __Vendor_SysTickConfig    0U
Line 365... Line 316...
365
typedef union
316
typedef union
366
{
317
{
367
  struct
318
  struct
368
  {
319
  {
369
    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number */
320
    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number */
370
    uint32_t _reserved0:7;               /*!< bit:  9..15  Reserved */
321
    uint32_t _reserved0:1;               /*!< bit:      9  Reserved */
-
 
322
    uint32_t ICI_IT_1:6;                 /*!< bit: 10..15  ICI/IT part 1 */
371
    uint32_t GE:4;                       /*!< bit: 16..19  Greater than or Equal flags */
323
    uint32_t GE:4;                       /*!< bit: 16..19  Greater than or Equal flags */
372
    uint32_t _reserved1:4;               /*!< bit: 20..23  Reserved */
324
    uint32_t _reserved1:4;               /*!< bit: 20..23  Reserved */
373
    uint32_t T:1;                        /*!< bit:     24  Thumb bit        (read 0) */
325
    uint32_t T:1;                        /*!< bit:     24  Thumb bit */
374
    uint32_t IT:2;                       /*!< bit: 25..26  saved IT state   (read 0) */
326
    uint32_t ICI_IT_2:2;                 /*!< bit: 25..26  ICI/IT part 2 */
375
    uint32_t Q:1;                        /*!< bit:     27  Saturation condition flag */
327
    uint32_t Q:1;                        /*!< bit:     27  Saturation condition flag */
376
    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag */
328
    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag */
377
    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag */
329
    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag */
378
    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag */
330
    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag */
379
    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag */
331
    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag */
Line 395... Line 347...
395
#define xPSR_V_Msk                         (1UL << xPSR_V_Pos)                            /*!< xPSR: V Mask */
347
#define xPSR_V_Msk                         (1UL << xPSR_V_Pos)                            /*!< xPSR: V Mask */
396
 
348
 
397
#define xPSR_Q_Pos                         27U                                            /*!< xPSR: Q Position */
349
#define xPSR_Q_Pos                         27U                                            /*!< xPSR: Q Position */
398
#define xPSR_Q_Msk                         (1UL << xPSR_Q_Pos)                            /*!< xPSR: Q Mask */
350
#define xPSR_Q_Msk                         (1UL << xPSR_Q_Pos)                            /*!< xPSR: Q Mask */
399
 
351
 
400
#define xPSR_IT_Pos                        25U                                            /*!< xPSR: IT Position */
352
#define xPSR_ICI_IT_2_Pos                  25U                                            /*!< xPSR: ICI/IT part 2 Position */
401
#define xPSR_IT_Msk                        (3UL << xPSR_IT_Pos)                           /*!< xPSR: IT Mask */
353
#define xPSR_ICI_IT_2_Msk                  (3UL << xPSR_ICI_IT_2_Pos)                     /*!< xPSR: ICI/IT part 2 Mask */
402
 
354
 
403
#define xPSR_T_Pos                         24U                                            /*!< xPSR: T Position */
355
#define xPSR_T_Pos                         24U                                            /*!< xPSR: T Position */
404
#define xPSR_T_Msk                         (1UL << xPSR_T_Pos)                            /*!< xPSR: T Mask */
356
#define xPSR_T_Msk                         (1UL << xPSR_T_Pos)                            /*!< xPSR: T Mask */
405
 
357
 
406
#define xPSR_GE_Pos                        16U                                            /*!< xPSR: GE Position */
358
#define xPSR_GE_Pos                        16U                                            /*!< xPSR: GE Position */
407
#define xPSR_GE_Msk                        (0xFUL << xPSR_GE_Pos)                         /*!< xPSR: GE Mask */
359
#define xPSR_GE_Msk                        (0xFUL << xPSR_GE_Pos)                         /*!< xPSR: GE Mask */
408
 
360
 
-
 
361
#define xPSR_ICI_IT_1_Pos                  10U                                            /*!< xPSR: ICI/IT part 1 Position */
-
 
362
#define xPSR_ICI_IT_1_Msk                  (0x3FUL << xPSR_ICI_IT_1_Pos)                  /*!< xPSR: ICI/IT part 1 Mask */
-
 
363
 
409
#define xPSR_ISR_Pos                        0U                                            /*!< xPSR: ISR Position */
364
#define xPSR_ISR_Pos                        0U                                            /*!< xPSR: ISR Position */
410
#define xPSR_ISR_Msk                       (0x1FFUL /*<< xPSR_ISR_Pos*/)                  /*!< xPSR: ISR Mask */
365
#define xPSR_ISR_Msk                       (0x1FFUL /*<< xPSR_ISR_Pos*/)                  /*!< xPSR: ISR Mask */
411
 
366
 
412
 
367
 
413
/**
368
/**
Line 660... Line 615...
660
#define SCB_CFSR_BUSFAULTSR_Msk            (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos)            /*!< SCB CFSR: Bus Fault Status Register Mask */
615
#define SCB_CFSR_BUSFAULTSR_Msk            (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos)            /*!< SCB CFSR: Bus Fault Status Register Mask */
661
 
616
 
662
#define SCB_CFSR_MEMFAULTSR_Pos             0U                                            /*!< SCB CFSR: Memory Manage Fault Status Register Position */
617
#define SCB_CFSR_MEMFAULTSR_Pos             0U                                            /*!< SCB CFSR: Memory Manage Fault Status Register Position */
663
#define SCB_CFSR_MEMFAULTSR_Msk            (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/)        /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
618
#define SCB_CFSR_MEMFAULTSR_Msk            (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/)        /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
664
 
619
 
-
 
620
/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */
-
 
621
#define SCB_CFSR_MMARVALID_Pos             (SCB_SHCSR_MEMFAULTACT_Pos + 7U)               /*!< SCB CFSR (MMFSR): MMARVALID Position */
-
 
622
#define SCB_CFSR_MMARVALID_Msk             (1UL << SCB_CFSR_MMARVALID_Pos)                /*!< SCB CFSR (MMFSR): MMARVALID Mask */
-
 
623
 
-
 
624
#define SCB_CFSR_MLSPERR_Pos               (SCB_SHCSR_MEMFAULTACT_Pos + 5U)               /*!< SCB CFSR (MMFSR): MLSPERR Position */
-
 
625
#define SCB_CFSR_MLSPERR_Msk               (1UL << SCB_CFSR_MLSPERR_Pos)                  /*!< SCB CFSR (MMFSR): MLSPERR Mask */
-
 
626
 
-
 
627
#define SCB_CFSR_MSTKERR_Pos               (SCB_SHCSR_MEMFAULTACT_Pos + 4U)               /*!< SCB CFSR (MMFSR): MSTKERR Position */
-
 
628
#define SCB_CFSR_MSTKERR_Msk               (1UL << SCB_CFSR_MSTKERR_Pos)                  /*!< SCB CFSR (MMFSR): MSTKERR Mask */
-
 
629
 
-
 
630
#define SCB_CFSR_MUNSTKERR_Pos             (SCB_SHCSR_MEMFAULTACT_Pos + 3U)               /*!< SCB CFSR (MMFSR): MUNSTKERR Position */
-
 
631
#define SCB_CFSR_MUNSTKERR_Msk             (1UL << SCB_CFSR_MUNSTKERR_Pos)                /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */
-
 
632
 
-
 
633
#define SCB_CFSR_DACCVIOL_Pos              (SCB_SHCSR_MEMFAULTACT_Pos + 1U)               /*!< SCB CFSR (MMFSR): DACCVIOL Position */
-
 
634
#define SCB_CFSR_DACCVIOL_Msk              (1UL << SCB_CFSR_DACCVIOL_Pos)                 /*!< SCB CFSR (MMFSR): DACCVIOL Mask */
-
 
635
 
-
 
636
#define SCB_CFSR_IACCVIOL_Pos              (SCB_SHCSR_MEMFAULTACT_Pos + 0U)               /*!< SCB CFSR (MMFSR): IACCVIOL Position */
-
 
637
#define SCB_CFSR_IACCVIOL_Msk              (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/)             /*!< SCB CFSR (MMFSR): IACCVIOL Mask */
-
 
638
 
-
 
639
/* BusFault Status Register (part of SCB Configurable Fault Status Register) */
-
 
640
#define SCB_CFSR_BFARVALID_Pos            (SCB_CFSR_BUSFAULTSR_Pos + 7U)                  /*!< SCB CFSR (BFSR): BFARVALID Position */
-
 
641
#define SCB_CFSR_BFARVALID_Msk            (1UL << SCB_CFSR_BFARVALID_Pos)                 /*!< SCB CFSR (BFSR): BFARVALID Mask */
-
 
642
 
-
 
643
#define SCB_CFSR_LSPERR_Pos               (SCB_CFSR_BUSFAULTSR_Pos + 5U)                  /*!< SCB CFSR (BFSR): LSPERR Position */
-
 
644
#define SCB_CFSR_LSPERR_Msk               (1UL << SCB_CFSR_LSPERR_Pos)                    /*!< SCB CFSR (BFSR): LSPERR Mask */
-
 
645
 
-
 
646
#define SCB_CFSR_STKERR_Pos               (SCB_CFSR_BUSFAULTSR_Pos + 4U)                  /*!< SCB CFSR (BFSR): STKERR Position */
-
 
647
#define SCB_CFSR_STKERR_Msk               (1UL << SCB_CFSR_STKERR_Pos)                    /*!< SCB CFSR (BFSR): STKERR Mask */
-
 
648
 
-
 
649
#define SCB_CFSR_UNSTKERR_Pos             (SCB_CFSR_BUSFAULTSR_Pos + 3U)                  /*!< SCB CFSR (BFSR): UNSTKERR Position */
-
 
650
#define SCB_CFSR_UNSTKERR_Msk             (1UL << SCB_CFSR_UNSTKERR_Pos)                  /*!< SCB CFSR (BFSR): UNSTKERR Mask */
-
 
651
 
-
 
652
#define SCB_CFSR_IMPRECISERR_Pos          (SCB_CFSR_BUSFAULTSR_Pos + 2U)                  /*!< SCB CFSR (BFSR): IMPRECISERR Position */
-
 
653
#define SCB_CFSR_IMPRECISERR_Msk          (1UL << SCB_CFSR_IMPRECISERR_Pos)               /*!< SCB CFSR (BFSR): IMPRECISERR Mask */
-
 
654
 
-
 
655
#define SCB_CFSR_PRECISERR_Pos            (SCB_CFSR_BUSFAULTSR_Pos + 1U)                  /*!< SCB CFSR (BFSR): PRECISERR Position */
-
 
656
#define SCB_CFSR_PRECISERR_Msk            (1UL << SCB_CFSR_PRECISERR_Pos)                 /*!< SCB CFSR (BFSR): PRECISERR Mask */
-
 
657
 
-
 
658
#define SCB_CFSR_IBUSERR_Pos              (SCB_CFSR_BUSFAULTSR_Pos + 0U)                  /*!< SCB CFSR (BFSR): IBUSERR Position */
-
 
659
#define SCB_CFSR_IBUSERR_Msk              (1UL << SCB_CFSR_IBUSERR_Pos)                   /*!< SCB CFSR (BFSR): IBUSERR Mask */
-
 
660
 
-
 
661
/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */
-
 
662
#define SCB_CFSR_DIVBYZERO_Pos            (SCB_CFSR_USGFAULTSR_Pos + 9U)                  /*!< SCB CFSR (UFSR): DIVBYZERO Position */
-
 
663
#define SCB_CFSR_DIVBYZERO_Msk            (1UL << SCB_CFSR_DIVBYZERO_Pos)                 /*!< SCB CFSR (UFSR): DIVBYZERO Mask */
-
 
664
 
-
 
665
#define SCB_CFSR_UNALIGNED_Pos            (SCB_CFSR_USGFAULTSR_Pos + 8U)                  /*!< SCB CFSR (UFSR): UNALIGNED Position */
-
 
666
#define SCB_CFSR_UNALIGNED_Msk            (1UL << SCB_CFSR_UNALIGNED_Pos)                 /*!< SCB CFSR (UFSR): UNALIGNED Mask */
-
 
667
 
-
 
668
#define SCB_CFSR_NOCP_Pos                 (SCB_CFSR_USGFAULTSR_Pos + 3U)                  /*!< SCB CFSR (UFSR): NOCP Position */
-
 
669
#define SCB_CFSR_NOCP_Msk                 (1UL << SCB_CFSR_NOCP_Pos)                      /*!< SCB CFSR (UFSR): NOCP Mask */
-
 
670
 
-
 
671
#define SCB_CFSR_INVPC_Pos                (SCB_CFSR_USGFAULTSR_Pos + 2U)                  /*!< SCB CFSR (UFSR): INVPC Position */
-
 
672
#define SCB_CFSR_INVPC_Msk                (1UL << SCB_CFSR_INVPC_Pos)                     /*!< SCB CFSR (UFSR): INVPC Mask */
-
 
673
 
-
 
674
#define SCB_CFSR_INVSTATE_Pos             (SCB_CFSR_USGFAULTSR_Pos + 1U)                  /*!< SCB CFSR (UFSR): INVSTATE Position */
-
 
675
#define SCB_CFSR_INVSTATE_Msk             (1UL << SCB_CFSR_INVSTATE_Pos)                  /*!< SCB CFSR (UFSR): INVSTATE Mask */
-
 
676
 
-
 
677
#define SCB_CFSR_UNDEFINSTR_Pos           (SCB_CFSR_USGFAULTSR_Pos + 0U)                  /*!< SCB CFSR (UFSR): UNDEFINSTR Position */
-
 
678
#define SCB_CFSR_UNDEFINSTR_Msk           (1UL << SCB_CFSR_UNDEFINSTR_Pos)                /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */
-
 
679
 
665
/* SCB Hard Fault Status Register Definitions */
680
/* SCB Hard Fault Status Register Definitions */
666
#define SCB_HFSR_DEBUGEVT_Pos              31U                                            /*!< SCB HFSR: DEBUGEVT Position */
681
#define SCB_HFSR_DEBUGEVT_Pos              31U                                            /*!< SCB HFSR: DEBUGEVT Position */
667
#define SCB_HFSR_DEBUGEVT_Msk              (1UL << SCB_HFSR_DEBUGEVT_Pos)                 /*!< SCB HFSR: DEBUGEVT Mask */
682
#define SCB_HFSR_DEBUGEVT_Msk              (1UL << SCB_HFSR_DEBUGEVT_Pos)                 /*!< SCB HFSR: DEBUGEVT Mask */
668
 
683
 
669
#define SCB_HFSR_FORCED_Pos                30U                                            /*!< SCB HFSR: FORCED Position */
684
#define SCB_HFSR_FORCED_Pos                30U                                            /*!< SCB HFSR: FORCED Position */
Line 829... Line 844...
829
  __IM  uint32_t CID3;                   /*!< Offset: 0xFFC (R/ )  ITM Component  Identification Register #3 */
844
  __IM  uint32_t CID3;                   /*!< Offset: 0xFFC (R/ )  ITM Component  Identification Register #3 */
830
} ITM_Type;
845
} ITM_Type;
831
 
846
 
832
/* ITM Trace Privilege Register Definitions */
847
/* ITM Trace Privilege Register Definitions */
833
#define ITM_TPR_PRIVMASK_Pos                0U                                            /*!< ITM TPR: PRIVMASK Position */
848
#define ITM_TPR_PRIVMASK_Pos                0U                                            /*!< ITM TPR: PRIVMASK Position */
834
#define ITM_TPR_PRIVMASK_Msk               (0xFUL /*<< ITM_TPR_PRIVMASK_Pos*/)            /*!< ITM TPR: PRIVMASK Mask */
849
#define ITM_TPR_PRIVMASK_Msk               (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/)     /*!< ITM TPR: PRIVMASK Mask */
835
 
850
 
836
/* ITM Trace Control Register Definitions */
851
/* ITM Trace Control Register Definitions */
837
#define ITM_TCR_BUSY_Pos                   23U                                            /*!< ITM TCR: BUSY Position */
852
#define ITM_TCR_BUSY_Pos                   23U                                            /*!< ITM TCR: BUSY Position */
838
#define ITM_TCR_BUSY_Msk                   (1UL << ITM_TCR_BUSY_Pos)                      /*!< ITM TCR: BUSY Mask */
853
#define ITM_TCR_BUSY_Msk                   (1UL << ITM_TCR_BUSY_Pos)                      /*!< ITM TCR: BUSY Mask */
839
 
854
 
Line 1043... Line 1058...
1043
/**
1058
/**
1044
  \brief  Structure type to access the Trace Port Interface Register (TPI).
1059
  \brief  Structure type to access the Trace Port Interface Register (TPI).
1045
 */
1060
 */
1046
typedef struct
1061
typedef struct
1047
{
1062
{
1048
  __IOM uint32_t SSPSR;                  /*!< Offset: 0x000 (R/ )  Supported Parallel Port Size Register */
1063
  __IM  uint32_t SSPSR;                  /*!< Offset: 0x000 (R/ )  Supported Parallel Port Size Register */
1049
  __IOM uint32_t CSPSR;                  /*!< Offset: 0x004 (R/W)  Current Parallel Port Size Register */
1064
  __IOM uint32_t CSPSR;                  /*!< Offset: 0x004 (R/W)  Current Parallel Port Size Register */
1050
        uint32_t RESERVED0[2U];
1065
        uint32_t RESERVED0[2U];
1051
  __IOM uint32_t ACPR;                   /*!< Offset: 0x010 (R/W)  Asynchronous Clock Prescaler Register */
1066
  __IOM uint32_t ACPR;                   /*!< Offset: 0x010 (R/W)  Asynchronous Clock Prescaler Register */
1052
        uint32_t RESERVED1[55U];
1067
        uint32_t RESERVED1[55U];
1053
  __IOM uint32_t SPPR;                   /*!< Offset: 0x0F0 (R/W)  Selected Pin Protocol Register */
1068
  __IOM uint32_t SPPR;                   /*!< Offset: 0x0F0 (R/W)  Selected Pin Protocol Register */
1054
        uint32_t RESERVED2[131U];
1069
        uint32_t RESERVED2[131U];
1055
  __IM  uint32_t FFSR;                   /*!< Offset: 0x300 (R/ )  Formatter and Flush Status Register */
1070
  __IM  uint32_t FFSR;                   /*!< Offset: 0x300 (R/ )  Formatter and Flush Status Register */
1056
  __IOM uint32_t FFCR;                   /*!< Offset: 0x304 (R/W)  Formatter and Flush Control Register */
1071
  __IOM uint32_t FFCR;                   /*!< Offset: 0x304 (R/W)  Formatter and Flush Control Register */
1057
  __IM  uint32_t FSCR;                   /*!< Offset: 0x308 (R/ )  Formatter Synchronization Counter Register */
1072
  __IM  uint32_t FSCR;                   /*!< Offset: 0x308 (R/ )  Formatter Synchronization Counter Register */
1058
        uint32_t RESERVED3[759U];
1073
        uint32_t RESERVED3[759U];
1059
  __IM  uint32_t TRIGGER;                /*!< Offset: 0xEE8 (R/ )  TRIGGER */
1074
  __IM  uint32_t TRIGGER;                /*!< Offset: 0xEE8 (R/ )  TRIGGER Register */
1060
  __IM  uint32_t FIFO0;                  /*!< Offset: 0xEEC (R/ )  Integration ETM Data */
1075
  __IM  uint32_t FIFO0;                  /*!< Offset: 0xEEC (R/ )  Integration ETM Data */
1061
  __IM  uint32_t ITATBCTR2;              /*!< Offset: 0xEF0 (R/ )  ITATBCTR2 */
1076
  __IM  uint32_t ITATBCTR2;              /*!< Offset: 0xEF0 (R/ )  ITATBCTR2 */
1062
        uint32_t RESERVED4[1U];
1077
        uint32_t RESERVED4[1U];
1063
  __IM  uint32_t ITATBCTR0;              /*!< Offset: 0xEF8 (R/ )  ITATBCTR0 */
1078
  __IM  uint32_t ITATBCTR0;              /*!< Offset: 0xEF8 (R/ )  ITATBCTR0 */
1064
  __IM  uint32_t FIFO1;                  /*!< Offset: 0xEFC (R/ )  Integration ITM Data */
1079
  __IM  uint32_t FIFO1;                  /*!< Offset: 0xEFC (R/ )  Integration ITM Data */
Line 1124... Line 1139...
1124
 
1139
 
1125
#define TPI_FIFO0_ETM0_Pos                  0U                                         /*!< TPI FIFO0: ETM0 Position */
1140
#define TPI_FIFO0_ETM0_Pos                  0U                                         /*!< TPI FIFO0: ETM0 Position */
1126
#define TPI_FIFO0_ETM0_Msk                 (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/)          /*!< TPI FIFO0: ETM0 Mask */
1141
#define TPI_FIFO0_ETM0_Msk                 (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/)          /*!< TPI FIFO0: ETM0 Mask */
1127
 
1142
 
1128
/* TPI ITATBCTR2 Register Definitions */
1143
/* TPI ITATBCTR2 Register Definitions */
1129
#define TPI_ITATBCTR2_ATREADY_Pos           0U                                         /*!< TPI ITATBCTR2: ATREADY Position */
1144
#define TPI_ITATBCTR2_ATREADY2_Pos          0U                                         /*!< TPI ITATBCTR2: ATREADY2 Position */
-
 
1145
#define TPI_ITATBCTR2_ATREADY2_Msk         (0x1UL /*<< TPI_ITATBCTR2_ATREADY2_Pos*/)   /*!< TPI ITATBCTR2: ATREADY2 Mask */
-
 
1146
 
-
 
1147
#define TPI_ITATBCTR2_ATREADY1_Pos          0U                                         /*!< TPI ITATBCTR2: ATREADY1 Position */
1130
#define TPI_ITATBCTR2_ATREADY_Msk          (0x1UL /*<< TPI_ITATBCTR2_ATREADY_Pos*/)    /*!< TPI ITATBCTR2: ATREADY Mask */
1148
#define TPI_ITATBCTR2_ATREADY1_Msk         (0x1UL /*<< TPI_ITATBCTR2_ATREADY1_Pos*/)   /*!< TPI ITATBCTR2: ATREADY1 Mask */
1131
 
1149
 
1132
/* TPI Integration ITM Data Register Definitions (FIFO1) */
1150
/* TPI Integration ITM Data Register Definitions (FIFO1) */
1133
#define TPI_FIFO1_ITM_ATVALID_Pos          29U                                         /*!< TPI FIFO1: ITM_ATVALID Position */
1151
#define TPI_FIFO1_ITM_ATVALID_Pos          29U                                         /*!< TPI FIFO1: ITM_ATVALID Position */
1134
#define TPI_FIFO1_ITM_ATVALID_Msk          (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos)        /*!< TPI FIFO1: ITM_ATVALID Mask */
1152
#define TPI_FIFO1_ITM_ATVALID_Msk          (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos)        /*!< TPI FIFO1: ITM_ATVALID Mask */
1135
 
1153
 
Line 1150... Line 1168...
1150
 
1168
 
1151
#define TPI_FIFO1_ITM0_Pos                  0U                                         /*!< TPI FIFO1: ITM0 Position */
1169
#define TPI_FIFO1_ITM0_Pos                  0U                                         /*!< TPI FIFO1: ITM0 Position */
1152
#define TPI_FIFO1_ITM0_Msk                 (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/)          /*!< TPI FIFO1: ITM0 Mask */
1170
#define TPI_FIFO1_ITM0_Msk                 (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/)          /*!< TPI FIFO1: ITM0 Mask */
1153
 
1171
 
1154
/* TPI ITATBCTR0 Register Definitions */
1172
/* TPI ITATBCTR0 Register Definitions */
1155
#define TPI_ITATBCTR0_ATREADY_Pos           0U                                         /*!< TPI ITATBCTR0: ATREADY Position */
1173
#define TPI_ITATBCTR0_ATREADY2_Pos          0U                                         /*!< TPI ITATBCTR0: ATREADY2 Position */
-
 
1174
#define TPI_ITATBCTR0_ATREADY2_Msk         (0x1UL /*<< TPI_ITATBCTR0_ATREADY2_Pos*/)   /*!< TPI ITATBCTR0: ATREADY2 Mask */
-
 
1175
 
-
 
1176
#define TPI_ITATBCTR0_ATREADY1_Pos          0U                                         /*!< TPI ITATBCTR0: ATREADY1 Position */
1156
#define TPI_ITATBCTR0_ATREADY_Msk          (0x1UL /*<< TPI_ITATBCTR0_ATREADY_Pos*/)    /*!< TPI ITATBCTR0: ATREADY Mask */
1177
#define TPI_ITATBCTR0_ATREADY1_Msk         (0x1UL /*<< TPI_ITATBCTR0_ATREADY1_Pos*/)   /*!< TPI ITATBCTR0: ATREADY1 Mask */
1157
 
1178
 
1158
/* TPI Integration Mode Control Register Definitions */
1179
/* TPI Integration Mode Control Register Definitions */
1159
#define TPI_ITCTRL_Mode_Pos                 0U                                         /*!< TPI ITCTRL: Mode Position */
1180
#define TPI_ITCTRL_Mode_Pos                 0U                                         /*!< TPI ITCTRL: Mode Position */
1160
#define TPI_ITCTRL_Mode_Msk                (0x1UL /*<< TPI_ITCTRL_Mode_Pos*/)          /*!< TPI ITCTRL: Mode Mask */
1181
#define TPI_ITCTRL_Mode_Msk                (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/)          /*!< TPI ITCTRL: Mode Mask */
1161
 
1182
 
1162
/* TPI DEVID Register Definitions */
1183
/* TPI DEVID Register Definitions */
1163
#define TPI_DEVID_NRZVALID_Pos             11U                                         /*!< TPI DEVID: NRZVALID Position */
1184
#define TPI_DEVID_NRZVALID_Pos             11U                                         /*!< TPI DEVID: NRZVALID Position */
1164
#define TPI_DEVID_NRZVALID_Msk             (0x1UL << TPI_DEVID_NRZVALID_Pos)           /*!< TPI DEVID: NRZVALID Mask */
1185
#define TPI_DEVID_NRZVALID_Msk             (0x1UL << TPI_DEVID_NRZVALID_Pos)           /*!< TPI DEVID: NRZVALID Mask */
1165
 
1186
 
Line 1177... Line 1198...
1177
 
1198
 
1178
#define TPI_DEVID_NrTraceInput_Pos          0U                                         /*!< TPI DEVID: NrTraceInput Position */
1199
#define TPI_DEVID_NrTraceInput_Pos          0U                                         /*!< TPI DEVID: NrTraceInput Position */
1179
#define TPI_DEVID_NrTraceInput_Msk         (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/)  /*!< TPI DEVID: NrTraceInput Mask */
1200
#define TPI_DEVID_NrTraceInput_Msk         (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/)  /*!< TPI DEVID: NrTraceInput Mask */
1180
 
1201
 
1181
/* TPI DEVTYPE Register Definitions */
1202
/* TPI DEVTYPE Register Definitions */
1182
#define TPI_DEVTYPE_MajorType_Pos           4U                                         /*!< TPI DEVTYPE: MajorType Position */
-
 
1183
#define TPI_DEVTYPE_MajorType_Msk          (0xFUL << TPI_DEVTYPE_MajorType_Pos)        /*!< TPI DEVTYPE: MajorType Mask */
-
 
1184
 
-
 
1185
#define TPI_DEVTYPE_SubType_Pos             0U                                         /*!< TPI DEVTYPE: SubType Position */
1203
#define TPI_DEVTYPE_SubType_Pos             4U                                         /*!< TPI DEVTYPE: SubType Position */
1186
#define TPI_DEVTYPE_SubType_Msk            (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/)      /*!< TPI DEVTYPE: SubType Mask */
1204
#define TPI_DEVTYPE_SubType_Msk            (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/)      /*!< TPI DEVTYPE: SubType Mask */
1187
 
1205
 
-
 
1206
#define TPI_DEVTYPE_MajorType_Pos           0U                                         /*!< TPI DEVTYPE: MajorType Position */
-
 
1207
#define TPI_DEVTYPE_MajorType_Msk          (0xFUL << TPI_DEVTYPE_MajorType_Pos)        /*!< TPI DEVTYPE: MajorType Mask */
-
 
1208
 
1188
/*@}*/ /* end of group CMSIS_TPI */
1209
/*@}*/ /* end of group CMSIS_TPI */
1189
 
1210
 
1190
 
1211
 
1191
#if (__MPU_PRESENT == 1U)
1212
#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
1192
/**
1213
/**
1193
  \ingroup  CMSIS_core_register
1214
  \ingroup  CMSIS_core_register
1194
  \defgroup CMSIS_MPU     Memory Protection Unit (MPU)
1215
  \defgroup CMSIS_MPU     Memory Protection Unit (MPU)
1195
  \brief    Type definitions for the Memory Protection Unit (MPU)
1216
  \brief    Type definitions for the Memory Protection Unit (MPU)
1196
  @{
1217
  @{
Line 1212... Line 1233...
1212
  __IOM uint32_t RASR_A2;                /*!< Offset: 0x020 (R/W)  MPU Alias 2 Region Attribute and Size Register */
1233
  __IOM uint32_t RASR_A2;                /*!< Offset: 0x020 (R/W)  MPU Alias 2 Region Attribute and Size Register */
1213
  __IOM uint32_t RBAR_A3;                /*!< Offset: 0x024 (R/W)  MPU Alias 3 Region Base Address Register */
1234
  __IOM uint32_t RBAR_A3;                /*!< Offset: 0x024 (R/W)  MPU Alias 3 Region Base Address Register */
1214
  __IOM uint32_t RASR_A3;                /*!< Offset: 0x028 (R/W)  MPU Alias 3 Region Attribute and Size Register */
1235
  __IOM uint32_t RASR_A3;                /*!< Offset: 0x028 (R/W)  MPU Alias 3 Region Attribute and Size Register */
1215
} MPU_Type;
1236
} MPU_Type;
1216
 
1237
 
-
 
1238
#define MPU_TYPE_RALIASES                  4U
-
 
1239
 
1217
/* MPU Type Register Definitions */
1240
/* MPU Type Register Definitions */
1218
#define MPU_TYPE_IREGION_Pos               16U                                            /*!< MPU TYPE: IREGION Position */
1241
#define MPU_TYPE_IREGION_Pos               16U                                            /*!< MPU TYPE: IREGION Position */
1219
#define MPU_TYPE_IREGION_Msk               (0xFFUL << MPU_TYPE_IREGION_Pos)               /*!< MPU TYPE: IREGION Mask */
1242
#define MPU_TYPE_IREGION_Msk               (0xFFUL << MPU_TYPE_IREGION_Pos)               /*!< MPU TYPE: IREGION Mask */
1220
 
1243
 
1221
#define MPU_TYPE_DREGION_Pos                8U                                            /*!< MPU TYPE: DREGION Position */
1244
#define MPU_TYPE_DREGION_Pos                8U                                            /*!< MPU TYPE: DREGION Position */
Line 1278... Line 1301...
1278
 
1301
 
1279
#define MPU_RASR_ENABLE_Pos                 0U                                            /*!< MPU RASR: Region enable bit Position */
1302
#define MPU_RASR_ENABLE_Pos                 0U                                            /*!< MPU RASR: Region enable bit Position */
1280
#define MPU_RASR_ENABLE_Msk                (1UL /*<< MPU_RASR_ENABLE_Pos*/)               /*!< MPU RASR: Region enable bit Disable Mask */
1303
#define MPU_RASR_ENABLE_Msk                (1UL /*<< MPU_RASR_ENABLE_Pos*/)               /*!< MPU RASR: Region enable bit Disable Mask */
1281
 
1304
 
1282
/*@} end of group CMSIS_MPU */
1305
/*@} end of group CMSIS_MPU */
1283
#endif
1306
#endif /* defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) */
1284
 
1307
 
1285
 
1308
 
1286
#if (__FPU_PRESENT == 1U)
-
 
1287
/**
1309
/**
1288
  \ingroup  CMSIS_core_register
1310
  \ingroup  CMSIS_core_register
1289
  \defgroup CMSIS_FPU     Floating Point Unit (FPU)
1311
  \defgroup CMSIS_FPU     Floating Point Unit (FPU)
1290
  \brief    Type definitions for the Floating Point Unit (FPU)
1312
  \brief    Type definitions for the Floating Point Unit (FPU)
1291
  @{
1313
  @{
Line 1386... Line 1408...
1386
 
1408
 
1387
#define FPU_MVFR1_FtZ_mode_Pos              0U                                            /*!< MVFR1: FtZ mode bits Position */
1409
#define FPU_MVFR1_FtZ_mode_Pos              0U                                            /*!< MVFR1: FtZ mode bits Position */
1388
#define FPU_MVFR1_FtZ_mode_Msk             (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/)          /*!< MVFR1: FtZ mode bits Mask */
1410
#define FPU_MVFR1_FtZ_mode_Msk             (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/)          /*!< MVFR1: FtZ mode bits Mask */
1389
 
1411
 
1390
/*@} end of group CMSIS_FPU */
1412
/*@} end of group CMSIS_FPU */
1391
#endif
-
 
1392
 
1413
 
1393
 
1414
 
1394
/**
1415
/**
1395
  \ingroup  CMSIS_core_register
1416
  \ingroup  CMSIS_core_register
1396
  \defgroup CMSIS_CoreDebug       Core Debug Registers (CoreDebug)
1417
  \defgroup CMSIS_CoreDebug       Core Debug Registers (CoreDebug)
Line 1504... Line 1525...
1504
 */
1525
 */
1505
 
1526
 
1506
/**
1527
/**
1507
  \brief   Mask and shift a bit field value for use in a register bit range.
1528
  \brief   Mask and shift a bit field value for use in a register bit range.
1508
  \param[in] field  Name of the register bit field.
1529
  \param[in] field  Name of the register bit field.
1509
  \param[in] value  Value of the bit field.
1530
  \param[in] value  Value of the bit field. This parameter is interpreted as an uint32_t type.
1510
  \return           Masked and shifted value.
1531
  \return           Masked and shifted value.
1511
*/
1532
*/
1512
#define _VAL2FLD(field, value)    ((value << field ## _Pos) & field ## _Msk)
1533
#define _VAL2FLD(field, value)    (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
1513
 
1534
 
1514
/**
1535
/**
1515
  \brief     Mask and shift a register value to extract a bit filed value.
1536
  \brief     Mask and shift a register value to extract a bit filed value.
1516
  \param[in] field  Name of the register bit field.
1537
  \param[in] field  Name of the register bit field.
1517
  \param[in] value  Value of register.
1538
  \param[in] value  Value of register. This parameter is interpreted as an uint32_t type.
1518
  \return           Masked and shifted bit field value.
1539
  \return           Masked and shifted bit field value.
1519
*/
1540
*/
1520
#define _FLD2VAL(field, value)    ((value & field ## _Msk) >> field ## _Pos)
1541
#define _FLD2VAL(field, value)    (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
1521
 
1542
 
1522
/*@} end of group CMSIS_core_bitfield */
1543
/*@} end of group CMSIS_core_bitfield */
1523
 
1544
 
1524
 
1545
 
1525
/**
1546
/**
Line 1527... Line 1548...
1527
  \defgroup   CMSIS_core_base     Core Definitions
1548
  \defgroup   CMSIS_core_base     Core Definitions
1528
  \brief      Definitions for base addresses, unions, and structures.
1549
  \brief      Definitions for base addresses, unions, and structures.
1529
  @{
1550
  @{
1530
 */
1551
 */
1531
 
1552
 
1532
/* Memory mapping of Cortex-M4 Hardware */
1553
/* Memory mapping of Core Hardware */
1533
#define SCS_BASE            (0xE000E000UL)                            /*!< System Control Space Base Address */
1554
#define SCS_BASE            (0xE000E000UL)                            /*!< System Control Space Base Address */
1534
#define ITM_BASE            (0xE0000000UL)                            /*!< ITM Base Address */
1555
#define ITM_BASE            (0xE0000000UL)                            /*!< ITM Base Address */
1535
#define DWT_BASE            (0xE0001000UL)                            /*!< DWT Base Address */
1556
#define DWT_BASE            (0xE0001000UL)                            /*!< DWT Base Address */
1536
#define TPI_BASE            (0xE0040000UL)                            /*!< TPI Base Address */
1557
#define TPI_BASE            (0xE0040000UL)                            /*!< TPI Base Address */
1537
#define CoreDebug_BASE      (0xE000EDF0UL)                            /*!< Core Debug Base Address */
1558
#define CoreDebug_BASE      (0xE000EDF0UL)                            /*!< Core Debug Base Address */
Line 1546... Line 1567...
1546
#define ITM                 ((ITM_Type       *)     ITM_BASE      )   /*!< ITM configuration struct */
1567
#define ITM                 ((ITM_Type       *)     ITM_BASE      )   /*!< ITM configuration struct */
1547
#define DWT                 ((DWT_Type       *)     DWT_BASE      )   /*!< DWT configuration struct */
1568
#define DWT                 ((DWT_Type       *)     DWT_BASE      )   /*!< DWT configuration struct */
1548
#define TPI                 ((TPI_Type       *)     TPI_BASE      )   /*!< TPI configuration struct */
1569
#define TPI                 ((TPI_Type       *)     TPI_BASE      )   /*!< TPI configuration struct */
1549
#define CoreDebug           ((CoreDebug_Type *)     CoreDebug_BASE)   /*!< Core Debug configuration struct */
1570
#define CoreDebug           ((CoreDebug_Type *)     CoreDebug_BASE)   /*!< Core Debug configuration struct */
1550
 
1571
 
1551
#if (__MPU_PRESENT == 1U)
1572
#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
1552
  #define MPU_BASE          (SCS_BASE +  0x0D90UL)                    /*!< Memory Protection Unit */
1573
  #define MPU_BASE          (SCS_BASE +  0x0D90UL)                    /*!< Memory Protection Unit */
1553
  #define MPU               ((MPU_Type       *)     MPU_BASE      )   /*!< Memory Protection Unit */
1574
  #define MPU               ((MPU_Type       *)     MPU_BASE      )   /*!< Memory Protection Unit */
1554
#endif
1575
#endif
1555
 
1576
 
1556
#if (__FPU_PRESENT == 1U)
-
 
1557
  #define FPU_BASE          (SCS_BASE +  0x0F30UL)                    /*!< Floating Point Unit */
1577
#define FPU_BASE            (SCS_BASE +  0x0F30UL)                    /*!< Floating Point Unit */
1558
  #define FPU               ((FPU_Type       *)     FPU_BASE      )   /*!< Floating Point Unit */
1578
#define FPU                 ((FPU_Type       *)     FPU_BASE      )   /*!< Floating Point Unit */
1559
#endif
-
 
1560
 
1579
 
1561
/*@} */
1580
/*@} */
1562
 
1581
 
1563
 
1582
 
1564
 
1583
 
Line 1582... Line 1601...
1582
  \defgroup CMSIS_Core_NVICFunctions NVIC Functions
1601
  \defgroup CMSIS_Core_NVICFunctions NVIC Functions
1583
  \brief    Functions that manage interrupts and exceptions via the NVIC.
1602
  \brief    Functions that manage interrupts and exceptions via the NVIC.
1584
  @{
1603
  @{
1585
 */
1604
 */
1586
 
1605
 
-
 
1606
#ifdef CMSIS_NVIC_VIRTUAL
-
 
1607
  #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
-
 
1608
    #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
-
 
1609
  #endif
-
 
1610
  #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
-
 
1611
#else
-
 
1612
  #define NVIC_SetPriorityGrouping    __NVIC_SetPriorityGrouping
-
 
1613
  #define NVIC_GetPriorityGrouping    __NVIC_GetPriorityGrouping
-
 
1614
  #define NVIC_EnableIRQ              __NVIC_EnableIRQ
-
 
1615
  #define NVIC_GetEnableIRQ           __NVIC_GetEnableIRQ
-
 
1616
  #define NVIC_DisableIRQ             __NVIC_DisableIRQ
-
 
1617
  #define NVIC_GetPendingIRQ          __NVIC_GetPendingIRQ
-
 
1618
  #define NVIC_SetPendingIRQ          __NVIC_SetPendingIRQ
-
 
1619
  #define NVIC_ClearPendingIRQ        __NVIC_ClearPendingIRQ
-
 
1620
  #define NVIC_GetActive              __NVIC_GetActive
-
 
1621
  #define NVIC_SetPriority            __NVIC_SetPriority
-
 
1622
  #define NVIC_GetPriority            __NVIC_GetPriority
-
 
1623
  #define NVIC_SystemReset            __NVIC_SystemReset
-
 
1624
#endif /* CMSIS_NVIC_VIRTUAL */
-
 
1625
 
-
 
1626
#ifdef CMSIS_VECTAB_VIRTUAL
-
 
1627
  #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
-
 
1628
   #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
-
 
1629
  #endif
-
 
1630
  #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
-
 
1631
#else
-
 
1632
  #define NVIC_SetVector              __NVIC_SetVector
-
 
1633
  #define NVIC_GetVector              __NVIC_GetVector
-
 
1634
#endif  /* (CMSIS_VECTAB_VIRTUAL) */
-
 
1635
 
-
 
1636
#define NVIC_USER_IRQ_OFFSET          16
-
 
1637
 
-
 
1638
 
-
 
1639
/* The following EXC_RETURN values are saved the LR on exception entry */
-
 
1640
#define EXC_RETURN_HANDLER         (0xFFFFFFF1UL)     /* return to Handler mode, uses MSP after return                               */
-
 
1641
#define EXC_RETURN_THREAD_MSP      (0xFFFFFFF9UL)     /* return to Thread mode, uses MSP after return                                */
-
 
1642
#define EXC_RETURN_THREAD_PSP      (0xFFFFFFFDUL)     /* return to Thread mode, uses PSP after return                                */
-
 
1643
#define EXC_RETURN_HANDLER_FPU     (0xFFFFFFE1UL)     /* return to Handler mode, uses MSP after return, restore floating-point state */
-
 
1644
#define EXC_RETURN_THREAD_MSP_FPU  (0xFFFFFFE9UL)     /* return to Thread mode, uses MSP after return, restore floating-point state  */
-
 
1645
#define EXC_RETURN_THREAD_PSP_FPU  (0xFFFFFFEDUL)     /* return to Thread mode, uses PSP after return, restore floating-point state  */
-
 
1646
 
-
 
1647
 
1587
/**
1648
/**
1588
  \brief   Set Priority Grouping
1649
  \brief   Set Priority Grouping
1589
  \details Sets the priority grouping field using the required unlock sequence.
1650
  \details Sets the priority grouping field using the required unlock sequence.
1590
           The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
1651
           The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
1591
           Only values from 0..7 are used.
1652
           Only values from 0..7 are used.
1592
           In case of a conflict between priority grouping and available
1653
           In case of a conflict between priority grouping and available
1593
           priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
1654
           priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
1594
  \param [in]      PriorityGroup  Priority grouping field.
1655
  \param [in]      PriorityGroup  Priority grouping field.
1595
 */
1656
 */
1596
__STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
1657
__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
1597
{
1658
{
1598
  uint32_t reg_value;
1659
  uint32_t reg_value;
1599
  uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL);             /* only values 0..7 are used          */
1660
  uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL);             /* only values 0..7 are used          */
1600
 
1661
 
1601
  reg_value  =  SCB->AIRCR;                                                   /* read old register configuration    */
1662
  reg_value  =  SCB->AIRCR;                                                   /* read old register configuration    */
1602
  reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change               */
1663
  reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change               */
1603
  reg_value  =  (reg_value                                   |
1664
  reg_value  =  (reg_value                                   |
1604
                ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
1665
                ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
1605
                (PriorityGroupTmp << 8U)                      );              /* Insert write key and priorty group */
1666
                (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos)  );              /* Insert write key and priority group */
1606
  SCB->AIRCR =  reg_value;
1667
  SCB->AIRCR =  reg_value;
1607
}
1668
}
1608
 
1669
 
1609
 
1670
 
1610
/**
1671
/**
1611
  \brief   Get Priority Grouping
1672
  \brief   Get Priority Grouping
1612
  \details Reads the priority grouping field from the NVIC Interrupt Controller.
1673
  \details Reads the priority grouping field from the NVIC Interrupt Controller.
1613
  \return                Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
1674
  \return                Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
1614
 */
1675
 */
1615
__STATIC_INLINE uint32_t NVIC_GetPriorityGrouping(void)
1676
__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void)
1616
{
1677
{
1617
  return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
1678
  return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
1618
}
1679
}
1619
 
1680
 
1620
 
1681
 
1621
/**
1682
/**
1622
  \brief   Enable External Interrupt
1683
  \brief   Enable Interrupt
1623
  \details Enables a device-specific interrupt in the NVIC interrupt controller.
1684
  \details Enables a device specific interrupt in the NVIC interrupt controller.
-
 
1685
  \param [in]      IRQn  Device specific interrupt number.
-
 
1686
  \note    IRQn must not be negative.
-
 
1687
 */
-
 
1688
__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
-
 
1689
{
-
 
1690
  if ((int32_t)(IRQn) >= 0)
-
 
1691
  {
-
 
1692
    NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
-
 
1693
  }
-
 
1694
}
-
 
1695
 
-
 
1696
 
-
 
1697
/**
-
 
1698
  \brief   Get Interrupt Enable status
-
 
1699
  \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
1624
  \param [in]      IRQn  External interrupt number. Value cannot be negative.
1700
  \param [in]      IRQn  Device specific interrupt number.
-
 
1701
  \return             0  Interrupt is not enabled.
-
 
1702
  \return             1  Interrupt is enabled.
-
 
1703
  \note    IRQn must not be negative.
1625
 */
1704
 */
1626
__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
1705
__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
1627
{
1706
{
-
 
1707
  if ((int32_t)(IRQn) >= 0)
-
 
1708
  {
1628
  NVIC->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
1709
    return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
-
 
1710
  }
-
 
1711
  else
-
 
1712
  {
-
 
1713
    return(0U);
-
 
1714
  }
1629
}
1715
}
1630
 
1716
 
1631
 
1717
 
1632
/**
1718
/**
1633
  \brief   Disable External Interrupt
1719
  \brief   Disable Interrupt
1634
  \details Disables a device-specific interrupt in the NVIC interrupt controller.
1720
  \details Disables a device specific interrupt in the NVIC interrupt controller.
1635
  \param [in]      IRQn  External interrupt number. Value cannot be negative.
1721
  \param [in]      IRQn  Device specific interrupt number.
-
 
1722
  \note    IRQn must not be negative.
1636
 */
1723
 */
1637
__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
1724
__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
1638
{
1725
{
-
 
1726
  if ((int32_t)(IRQn) >= 0)
-
 
1727
  {
1639
  NVIC->ICER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
1728
    NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
-
 
1729
    __DSB();
-
 
1730
    __ISB();
-
 
1731
  }
1640
}
1732
}
1641
 
1733
 
1642
 
1734
 
1643
/**
1735
/**
1644
  \brief   Get Pending Interrupt
1736
  \brief   Get Pending Interrupt
1645
  \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt.
1737
  \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
1646
  \param [in]      IRQn  Interrupt number.
1738
  \param [in]      IRQn  Device specific interrupt number.
1647
  \return             0  Interrupt status is not pending.
1739
  \return             0  Interrupt status is not pending.
1648
  \return             1  Interrupt status is pending.
1740
  \return             1  Interrupt status is pending.
-
 
1741
  \note    IRQn must not be negative.
1649
 */
1742
 */
1650
__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
1743
__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
1651
{
1744
{
-
 
1745
  if ((int32_t)(IRQn) >= 0)
-
 
1746
  {
1652
  return((uint32_t)(((NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
1747
    return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
-
 
1748
  }
-
 
1749
  else
-
 
1750
  {
-
 
1751
    return(0U);
-
 
1752
  }
1653
}
1753
}
1654
 
1754
 
1655
 
1755
 
1656
/**
1756
/**
1657
  \brief   Set Pending Interrupt
1757
  \brief   Set Pending Interrupt
1658
  \details Sets the pending bit of an external interrupt.
1758
  \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
1659
  \param [in]      IRQn  Interrupt number. Value cannot be negative.
1759
  \param [in]      IRQn  Device specific interrupt number.
-
 
1760
  \note    IRQn must not be negative.
1660
 */
1761
 */
1661
__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
1762
__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
1662
{
1763
{
-
 
1764
  if ((int32_t)(IRQn) >= 0)
-
 
1765
  {
1663
  NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
1766
    NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
-
 
1767
  }
1664
}
1768
}
1665
 
1769
 
1666
 
1770
 
1667
/**
1771
/**
1668
  \brief   Clear Pending Interrupt
1772
  \brief   Clear Pending Interrupt
1669
  \details Clears the pending bit of an external interrupt.
1773
  \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
1670
  \param [in]      IRQn  External interrupt number. Value cannot be negative.
1774
  \param [in]      IRQn  Device specific interrupt number.
-
 
1775
  \note    IRQn must not be negative.
1671
 */
1776
 */
1672
__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
1777
__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
1673
{
1778
{
-
 
1779
  if ((int32_t)(IRQn) >= 0)
-
 
1780
  {
1674
  NVIC->ICPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
1781
    NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
-
 
1782
  }
1675
}
1783
}
1676
 
1784
 
1677
 
1785
 
1678
/**
1786
/**
1679
  \brief   Get Active Interrupt
1787
  \brief   Get Active Interrupt
1680
  \details Reads the active register in NVIC and returns the active bit.
1788
  \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
1681
  \param [in]      IRQn  Interrupt number.
1789
  \param [in]      IRQn  Device specific interrupt number.
1682
  \return             0  Interrupt status is not active.
1790
  \return             0  Interrupt status is not active.
1683
  \return             1  Interrupt status is active.
1791
  \return             1  Interrupt status is active.
-
 
1792
  \note    IRQn must not be negative.
1684
 */
1793
 */
1685
__STATIC_INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn)
1794
__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
1686
{
1795
{
-
 
1796
  if ((int32_t)(IRQn) >= 0)
-
 
1797
  {
1687
  return((uint32_t)(((NVIC->IABR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
1798
    return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
-
 
1799
  }
-
 
1800
  else
-
 
1801
  {
-
 
1802
    return(0U);
-
 
1803
  }
1688
}
1804
}
1689
 
1805
 
1690
 
1806
 
1691
/**
1807
/**
1692
  \brief   Set Interrupt Priority
1808
  \brief   Set Interrupt Priority
1693
  \details Sets the priority of an interrupt.
1809
  \details Sets the priority of a device specific interrupt or a processor exception.
1694
  \note    The priority cannot be set for every core interrupt.
1810
           The interrupt number can be positive to specify a device specific interrupt,
-
 
1811
           or negative to specify a processor exception.
1695
  \param [in]      IRQn  Interrupt number.
1812
  \param [in]      IRQn  Interrupt number.
1696
  \param [in]  priority  Priority to set.
1813
  \param [in]  priority  Priority to set.
-
 
1814
  \note    The priority cannot be set for every processor exception.
1697
 */
1815
 */
1698
__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
1816
__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
1699
{
1817
{
1700
  if ((int32_t)(IRQn) < 0)
1818
  if ((int32_t)(IRQn) >= 0)
1701
  {
1819
  {
1702
    SCB->SHP[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
1820
    NVIC->IP[((uint32_t)IRQn)]               = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
1703
  }
1821
  }
1704
  else
1822
  else
1705
  {
1823
  {
1706
    NVIC->IP[((uint32_t)(int32_t)IRQn)]               = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
1824
    SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
1707
  }
1825
  }
1708
}
1826
}
1709
 
1827
 
1710
 
1828
 
1711
/**
1829
/**
1712
  \brief   Get Interrupt Priority
1830
  \brief   Get Interrupt Priority
1713
  \details Reads the priority of an interrupt.
1831
  \details Reads the priority of a device specific interrupt or a processor exception.
1714
           The interrupt number can be positive to specify an external (device specific) interrupt,
1832
           The interrupt number can be positive to specify a device specific interrupt,
1715
           or negative to specify an internal (core) interrupt.
1833
           or negative to specify a processor exception.
1716
  \param [in]   IRQn  Interrupt number.
1834
  \param [in]   IRQn  Interrupt number.
1717
  \return             Interrupt Priority.
1835
  \return             Interrupt Priority.
1718
                      Value is aligned automatically to the implemented priority bits of the microcontroller.
1836
                      Value is aligned automatically to the implemented priority bits of the microcontroller.
1719
 */
1837
 */
1720
__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
1838
__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
1721
{
1839
{
1722
 
1840
 
1723
  if ((int32_t)(IRQn) < 0)
1841
  if ((int32_t)(IRQn) >= 0)
1724
  {
1842
  {
1725
    return(((uint32_t)SCB->SHP[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
1843
    return(((uint32_t)NVIC->IP[((uint32_t)IRQn)]               >> (8U - __NVIC_PRIO_BITS)));
1726
  }
1844
  }
1727
  else
1845
  else
1728
  {
1846
  {
1729
    return(((uint32_t)NVIC->IP[((uint32_t)(int32_t)IRQn)]               >> (8U - __NVIC_PRIO_BITS)));
1847
    return(((uint32_t)SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
1730
  }
1848
  }
1731
}
1849
}
1732
 
1850
 
1733
 
1851
 
1734
/**
1852
/**
Line 1782... Line 1900...
1782
  *pSubPriority     = (Priority                   ) & (uint32_t)((1UL << (SubPriorityBits    )) - 1UL);
1900
  *pSubPriority     = (Priority                   ) & (uint32_t)((1UL << (SubPriorityBits    )) - 1UL);
1783
}
1901
}
1784
 
1902
 
1785
 
1903
 
1786
/**
1904
/**
-
 
1905
  \brief   Set Interrupt Vector
-
 
1906
  \details Sets an interrupt vector in SRAM based interrupt vector table.
-
 
1907
           The interrupt number can be positive to specify a device specific interrupt,
-
 
1908
           or negative to specify a processor exception.
-
 
1909
           VTOR must been relocated to SRAM before.
-
 
1910
  \param [in]   IRQn      Interrupt number
-
 
1911
  \param [in]   vector    Address of interrupt handler function
-
 
1912
 */
-
 
1913
__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
-
 
1914
{
-
 
1915
  uint32_t *vectors = (uint32_t *)SCB->VTOR;
-
 
1916
  vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
-
 
1917
}
-
 
1918
 
-
 
1919
 
-
 
1920
/**
-
 
1921
  \brief   Get Interrupt Vector
-
 
1922
  \details Reads an interrupt vector from interrupt vector table.
-
 
1923
           The interrupt number can be positive to specify a device specific interrupt,
-
 
1924
           or negative to specify a processor exception.
-
 
1925
  \param [in]   IRQn      Interrupt number.
-
 
1926
  \return                 Address of interrupt handler function
-
 
1927
 */
-
 
1928
__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
-
 
1929
{
-
 
1930
  uint32_t *vectors = (uint32_t *)SCB->VTOR;
-
 
1931
  return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
-
 
1932
}
-
 
1933
 
-
 
1934
 
-
 
1935
/**
1787
  \brief   System Reset
1936
  \brief   System Reset
1788
  \details Initiates a system reset request to reset the MCU.
1937
  \details Initiates a system reset request to reset the MCU.
1789
 */
1938
 */
1790
__STATIC_INLINE void NVIC_SystemReset(void)
1939
__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
1791
{
1940
{
1792
  __DSB();                                                          /* Ensure all outstanding memory accesses included
1941
  __DSB();                                                          /* Ensure all outstanding memory accesses included
1793
                                                                       buffered write are completed before reset */
1942
                                                                       buffered write are completed before reset */
1794
  SCB->AIRCR  = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos)    |
1943
  SCB->AIRCR  = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos)    |
1795
                           (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
1944
                           (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
Line 1802... Line 1951...
1802
  }
1951
  }
1803
}
1952
}
1804
 
1953
 
1805
/*@} end of CMSIS_Core_NVICFunctions */
1954
/*@} end of CMSIS_Core_NVICFunctions */
1806
 
1955
 
-
 
1956
/* ##########################  MPU functions  #################################### */
-
 
1957
 
-
 
1958
#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
-
 
1959
 
-
 
1960
#include "mpu_armv7.h"
-
 
1961
 
-
 
1962
#endif
-
 
1963
 
-
 
1964
 
-
 
1965
/* ##########################  FPU functions  #################################### */
-
 
1966
/**
-
 
1967
  \ingroup  CMSIS_Core_FunctionInterface
-
 
1968
  \defgroup CMSIS_Core_FpuFunctions FPU Functions
-
 
1969
  \brief    Function that provides FPU type.
-
 
1970
  @{
-
 
1971
 */
-
 
1972
 
-
 
1973
/**
-
 
1974
  \brief   get FPU type
-
 
1975
  \details returns the FPU type
-
 
1976
  \returns
-
 
1977
   - \b  0: No FPU
-
 
1978
   - \b  1: Single precision FPU
-
 
1979
   - \b  2: Double + Single precision FPU
-
 
1980
 */
-
 
1981
__STATIC_INLINE uint32_t SCB_GetFPUType(void)
-
 
1982
{
-
 
1983
  uint32_t mvfr0;
-
 
1984
 
-
 
1985
  mvfr0 = FPU->MVFR0;
-
 
1986
  if      ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U)
-
 
1987
  {
-
 
1988
    return 1U;           /* Single precision FPU */
-
 
1989
  }
-
 
1990
  else
-
 
1991
  {
-
 
1992
    return 0U;           /* No FPU */
-
 
1993
  }
-
 
1994
}
-
 
1995
 
-
 
1996
 
-
 
1997
/*@} end of CMSIS_Core_FpuFunctions */
-
 
1998
 
1807
 
1999
 
1808
 
2000
 
1809
/* ##################################    SysTick function  ############################################ */
2001
/* ##################################    SysTick function  ############################################ */
1810
/**
2002
/**
1811
  \ingroup  CMSIS_Core_FunctionInterface
2003
  \ingroup  CMSIS_Core_FunctionInterface
1812
  \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
2004
  \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
1813
  \brief    Functions that configure the System.
2005
  \brief    Functions that configure the System.
1814
  @{
2006
  @{
1815
 */
2007
 */
1816
 
2008
 
1817
#if (__Vendor_SysTickConfig == 0U)
2009
#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
1818
 
2010
 
1819
/**
2011
/**
1820
  \brief   System Tick Configuration
2012
  \brief   System Tick Configuration
1821
  \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
2013
  \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
1822
           Counter is in free running mode to generate periodic interrupts.
2014
           Counter is in free running mode to generate periodic interrupts.
Line 1855... Line 2047...
1855
  \defgroup CMSIS_core_DebugFunctions ITM Functions
2047
  \defgroup CMSIS_core_DebugFunctions ITM Functions
1856
  \brief    Functions that access the ITM debug interface.
2048
  \brief    Functions that access the ITM debug interface.
1857
  @{
2049
  @{
1858
 */
2050
 */
1859
 
2051
 
1860
extern volatile int32_t ITM_RxBuffer;                    /*!< External variable to receive characters. */
2052
extern volatile int32_t ITM_RxBuffer;                              /*!< External variable to receive characters. */
1861
#define                 ITM_RXBUFFER_EMPTY   0x5AA55AA5U /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
2053
#define                 ITM_RXBUFFER_EMPTY  ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
1862
 
2054
 
1863
 
2055
 
1864
/**
2056
/**
1865
  \brief   ITM Send Character
2057
  \brief   ITM Send Character
1866
  \details Transmits a character via the ITM channel 0, and
2058
  \details Transmits a character via the ITM channel 0, and