Subversion Repositories EngineBay2

Rev

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

Rev 2 Rev 28
Line 1... Line 1...
1
/**************************************************************************//**
1
/**************************************************************************//**
2
 * @file     core_cm3.h
2
 * @file     core_cm3.h
3
 * @brief    CMSIS Cortex-M3 Core Peripheral Access Layer Header File
3
 * @brief    CMSIS Cortex-M3 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_CM3_H_GENERIC
31
#ifndef __CORE_CM3_H_GENERIC
42
#define __CORE_CM3_H_GENERIC
32
#define __CORE_CM3_H_GENERIC
Line 68... Line 58...
68
/**
58
/**
69
  \ingroup Cortex_M3
59
  \ingroup Cortex_M3
70
  @{
60
  @{
71
 */
61
 */
72
 
62
 
-
 
63
#include "cmsis_version.h"
-
 
64
 
73
/*  CMSIS CM3 definitions */
65
/*  CMSIS CM3 definitions */
74
#define __CM3_CMSIS_VERSION_MAIN  (0x04U)                                      /*!< [31:16] CMSIS HAL main version */
66
#define __CM3_CMSIS_VERSION_MAIN  (__CM_CMSIS_VERSION_MAIN)              /*!< \deprecated [31:16] CMSIS HAL main version */
75
#define __CM3_CMSIS_VERSION_SUB   (0x1EU)                                      /*!< [15:0]  CMSIS HAL sub version */
67
#define __CM3_CMSIS_VERSION_SUB   (__CM_CMSIS_VERSION_SUB)               /*!< \deprecated [15:0]  CMSIS HAL sub version */
76
#define __CM3_CMSIS_VERSION       ((__CM3_CMSIS_VERSION_MAIN << 16U) | \
68
#define __CM3_CMSIS_VERSION       ((__CM3_CMSIS_VERSION_MAIN << 16U) | \
77
                                    __CM3_CMSIS_VERSION_SUB           )        /*!< CMSIS HAL version number */
69
                                    __CM3_CMSIS_VERSION_SUB           )  /*!< \deprecated CMSIS HAL version number */
78
 
-
 
79
#define __CORTEX_M                (0x03U)                                      /*!< Cortex-M Core */
-
 
80
 
-
 
81
 
-
 
82
#if   defined ( __CC_ARM )
-
 
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
 
70
 
92
#elif defined ( __GNUC__ )
-
 
93
  #define __ASM            __asm                                      /*!< asm keyword for GNU Compiler */
71
#define __CORTEX_M                (3U)                                   /*!< Cortex-M Core */
94
  #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler */
-
 
95
  #define __STATIC_INLINE  static inline
-
 
96
 
-
 
97
#elif defined ( __ICCARM__ )
-
 
98
  #define __ASM            __asm                                      /*!< asm keyword for IAR Compiler */
-
 
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 */
-
 
108
  #define __INLINE         inline                                     /*!< inline keyword for TASKING Compiler */
-
 
109
  #define __STATIC_INLINE  static inline
-
 
110
 
-
 
111
#elif defined ( __CSMC__ )
-
 
112
  #define __packed
-
 
113
  #define __ASM            _asm                                      /*!< asm keyword for COSMIC Compiler */
-
 
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
    This core does not support an FPU at all
74
    This core does not support an FPU at all
123
*/
75
*/
124
#define __FPU_USED       0U
76
#define __FPU_USED       0U
Line 126... Line 78...
126
#if defined ( __CC_ARM )
78
#if defined ( __CC_ARM )
127
  #if defined __TARGET_FPU_VFP
79
  #if defined __TARGET_FPU_VFP
128
    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
80
    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
129
  #endif
81
  #endif
130
 
82
 
131
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
83
#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
132
  #if defined __ARM_PCS_VFP
84
  #if defined __ARM_PCS_VFP
133
    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
85
    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
134
  #endif
86
  #endif
135
 
87
 
136
#elif defined ( __GNUC__ )
88
#elif defined ( __GNUC__ )
Line 141... Line 93...
141
#elif defined ( __ICCARM__ )
93
#elif defined ( __ICCARM__ )
142
  #if defined __ARMVFP__
94
  #if defined __ARMVFP__
143
    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
95
    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
144
  #endif
96
  #endif
145
 
97
 
146
#elif defined ( __TMS470__ )
98
#elif defined ( __TI_ARM__ )
147
  #if defined __TI_VFP_SUPPORT__
99
  #if defined __TI_VFP_SUPPORT__
148
    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
100
    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
149
  #endif
101
  #endif
150
 
102
 
151
#elif defined ( __TASKING__ )
103
#elif defined ( __TASKING__ )
Line 158... Line 110...
158
    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
110
    #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
159
  #endif
111
  #endif
160
 
112
 
161
#endif
113
#endif
162
 
114
 
163
#include "core_cmInstr.h"                /* Core Instruction Access */
115
#include "cmsis_compiler.h"               /* CMSIS compiler specific defines */
164
#include "core_cmFunc.h"                 /* Core Function Access */
-
 
-
 
116
 
165
 
117
 
166
#ifdef __cplusplus
118
#ifdef __cplusplus
167
}
119
}
168
#endif
120
#endif
169
 
121
 
Line 189... Line 141...
189
    #define __MPU_PRESENT             0U
141
    #define __MPU_PRESENT             0U
190
    #warning "__MPU_PRESENT not defined in device header file; using default!"
142
    #warning "__MPU_PRESENT not defined in device header file; using default!"
191
  #endif
143
  #endif
192
 
144
 
193
  #ifndef __NVIC_PRIO_BITS
145
  #ifndef __NVIC_PRIO_BITS
194
    #define __NVIC_PRIO_BITS          4U
146
    #define __NVIC_PRIO_BITS          3U
195
    #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
147
    #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
196
  #endif
148
  #endif
197
 
149
 
198
  #ifndef __Vendor_SysTickConfig
150
  #ifndef __Vendor_SysTickConfig
199
    #define __Vendor_SysTickConfig    0U
151
    #define __Vendor_SysTickConfig    0U
Line 306... Line 258...
306
typedef union
258
typedef union
307
{
259
{
308
  struct
260
  struct
309
  {
261
  {
310
    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number */
262
    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number */
-
 
263
    uint32_t _reserved0:1;               /*!< bit:      9  Reserved */
-
 
264
    uint32_t ICI_IT_1:6;                 /*!< bit: 10..15  ICI/IT part 1 */
311
    uint32_t _reserved0:15;              /*!< bit:  9..23  Reserved */
265
    uint32_t _reserved1:8;               /*!< bit: 16..23  Reserved */
312
    uint32_t T:1;                        /*!< bit:     24  Thumb bit        (read 0) */
266
    uint32_t T:1;                        /*!< bit:     24  Thumb bit */
313
    uint32_t IT:2;                       /*!< bit: 25..26  saved IT state   (read 0) */
267
    uint32_t ICI_IT_2:2;                 /*!< bit: 25..26  ICI/IT part 2 */
314
    uint32_t Q:1;                        /*!< bit:     27  Saturation condition flag */
268
    uint32_t Q:1;                        /*!< bit:     27  Saturation condition flag */
315
    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag */
269
    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag */
316
    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag */
270
    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag */
317
    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag */
271
    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag */
318
    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag */
272
    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag */
Line 334... Line 288...
334
#define xPSR_V_Msk                         (1UL << xPSR_V_Pos)                            /*!< xPSR: V Mask */
288
#define xPSR_V_Msk                         (1UL << xPSR_V_Pos)                            /*!< xPSR: V Mask */
335
 
289
 
336
#define xPSR_Q_Pos                         27U                                            /*!< xPSR: Q Position */
290
#define xPSR_Q_Pos                         27U                                            /*!< xPSR: Q Position */
337
#define xPSR_Q_Msk                         (1UL << xPSR_Q_Pos)                            /*!< xPSR: Q Mask */
291
#define xPSR_Q_Msk                         (1UL << xPSR_Q_Pos)                            /*!< xPSR: Q Mask */
338
 
292
 
339
#define xPSR_IT_Pos                        25U                                            /*!< xPSR: IT Position */
293
#define xPSR_ICI_IT_2_Pos                  25U                                            /*!< xPSR: ICI/IT part 2 Position */
340
#define xPSR_IT_Msk                        (3UL << xPSR_IT_Pos)                           /*!< xPSR: IT Mask */
294
#define xPSR_ICI_IT_2_Msk                  (3UL << xPSR_ICI_IT_2_Pos)                     /*!< xPSR: ICI/IT part 2 Mask */
341
 
295
 
342
#define xPSR_T_Pos                         24U                                            /*!< xPSR: T Position */
296
#define xPSR_T_Pos                         24U                                            /*!< xPSR: T Position */
343
#define xPSR_T_Msk                         (1UL << xPSR_T_Pos)                            /*!< xPSR: T Mask */
297
#define xPSR_T_Msk                         (1UL << xPSR_T_Pos)                            /*!< xPSR: T Mask */
344
 
298
 
-
 
299
#define xPSR_ICI_IT_1_Pos                  10U                                            /*!< xPSR: ICI/IT part 1 Position */
-
 
300
#define xPSR_ICI_IT_1_Msk                  (0x3FUL << xPSR_ICI_IT_1_Pos)                  /*!< xPSR: ICI/IT part 1 Mask */
-
 
301
 
345
#define xPSR_ISR_Pos                        0U                                            /*!< xPSR: ISR Position */
302
#define xPSR_ISR_Pos                        0U                                            /*!< xPSR: ISR Position */
346
#define xPSR_ISR_Msk                       (0x1FFUL /*<< xPSR_ISR_Pos*/)                  /*!< xPSR: ISR Mask */
303
#define xPSR_ISR_Msk                       (0x1FFUL /*<< xPSR_ISR_Pos*/)                  /*!< xPSR: ISR Mask */
347
 
304
 
348
 
305
 
349
/**
306
/**
Line 485... Line 442...
485
 
442
 
486
#define SCB_ICSR_VECTACTIVE_Pos             0U                                            /*!< SCB ICSR: VECTACTIVE Position */
443
#define SCB_ICSR_VECTACTIVE_Pos             0U                                            /*!< SCB ICSR: VECTACTIVE Position */
487
#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 */
488
 
445
 
489
/* SCB Vector Table Offset Register Definitions */
446
/* SCB Vector Table Offset Register Definitions */
490
#if (__CM3_REV < 0x0201U)                   /* core r2p1 */
447
#if defined (__CM3_REV) && (__CM3_REV < 0x0201U)                   /* core r2p1 */
491
#define SCB_VTOR_TBLBASE_Pos               29U                                            /*!< SCB VTOR: TBLBASE Position */
448
#define SCB_VTOR_TBLBASE_Pos               29U                                            /*!< SCB VTOR: TBLBASE Position */
492
#define SCB_VTOR_TBLBASE_Msk               (1UL << SCB_VTOR_TBLBASE_Pos)                  /*!< SCB VTOR: TBLBASE Mask */
449
#define SCB_VTOR_TBLBASE_Msk               (1UL << SCB_VTOR_TBLBASE_Pos)                  /*!< SCB VTOR: TBLBASE Mask */
493
 
450
 
494
#define SCB_VTOR_TBLOFF_Pos                 7U                                            /*!< SCB VTOR: TBLOFF Position */
451
#define SCB_VTOR_TBLOFF_Pos                 7U                                            /*!< SCB VTOR: TBLOFF Position */
495
#define SCB_VTOR_TBLOFF_Msk                (0x3FFFFFUL << SCB_VTOR_TBLOFF_Pos)            /*!< SCB VTOR: TBLOFF Mask */
452
#define SCB_VTOR_TBLOFF_Msk                (0x3FFFFFUL << SCB_VTOR_TBLOFF_Pos)            /*!< SCB VTOR: TBLOFF Mask */
Line 600... Line 557...
600
#define SCB_CFSR_BUSFAULTSR_Msk            (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos)            /*!< SCB CFSR: Bus Fault Status Register Mask */
557
#define SCB_CFSR_BUSFAULTSR_Msk            (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos)            /*!< SCB CFSR: Bus Fault Status Register Mask */
601
 
558
 
602
#define SCB_CFSR_MEMFAULTSR_Pos             0U                                            /*!< SCB CFSR: Memory Manage Fault Status Register Position */
559
#define SCB_CFSR_MEMFAULTSR_Pos             0U                                            /*!< SCB CFSR: Memory Manage Fault Status Register Position */
603
#define SCB_CFSR_MEMFAULTSR_Msk            (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/)        /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
560
#define SCB_CFSR_MEMFAULTSR_Msk            (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/)        /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
604
 
561
 
-
 
562
/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */
-
 
563
#define SCB_CFSR_MMARVALID_Pos             (SCB_SHCSR_MEMFAULTACT_Pos + 7U)               /*!< SCB CFSR (MMFSR): MMARVALID Position */
-
 
564
#define SCB_CFSR_MMARVALID_Msk             (1UL << SCB_CFSR_MMARVALID_Pos)                /*!< SCB CFSR (MMFSR): MMARVALID Mask */
-
 
565
 
-
 
566
#define SCB_CFSR_MSTKERR_Pos               (SCB_SHCSR_MEMFAULTACT_Pos + 4U)               /*!< SCB CFSR (MMFSR): MSTKERR Position */
-
 
567
#define SCB_CFSR_MSTKERR_Msk               (1UL << SCB_CFSR_MSTKERR_Pos)                  /*!< SCB CFSR (MMFSR): MSTKERR Mask */
-
 
568
 
-
 
569
#define SCB_CFSR_MUNSTKERR_Pos             (SCB_SHCSR_MEMFAULTACT_Pos + 3U)               /*!< SCB CFSR (MMFSR): MUNSTKERR Position */
-
 
570
#define SCB_CFSR_MUNSTKERR_Msk             (1UL << SCB_CFSR_MUNSTKERR_Pos)                /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */
-
 
571
 
-
 
572
#define SCB_CFSR_DACCVIOL_Pos              (SCB_SHCSR_MEMFAULTACT_Pos + 1U)               /*!< SCB CFSR (MMFSR): DACCVIOL Position */
-
 
573
#define SCB_CFSR_DACCVIOL_Msk              (1UL << SCB_CFSR_DACCVIOL_Pos)                 /*!< SCB CFSR (MMFSR): DACCVIOL Mask */
-
 
574
 
-
 
575
#define SCB_CFSR_IACCVIOL_Pos              (SCB_SHCSR_MEMFAULTACT_Pos + 0U)               /*!< SCB CFSR (MMFSR): IACCVIOL Position */
-
 
576
#define SCB_CFSR_IACCVIOL_Msk              (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/)             /*!< SCB CFSR (MMFSR): IACCVIOL Mask */
-
 
577
 
-
 
578
/* BusFault Status Register (part of SCB Configurable Fault Status Register) */
-
 
579
#define SCB_CFSR_BFARVALID_Pos            (SCB_CFSR_BUSFAULTSR_Pos + 7U)                  /*!< SCB CFSR (BFSR): BFARVALID Position */
-
 
580
#define SCB_CFSR_BFARVALID_Msk            (1UL << SCB_CFSR_BFARVALID_Pos)                 /*!< SCB CFSR (BFSR): BFARVALID Mask */
-
 
581
 
-
 
582
#define SCB_CFSR_STKERR_Pos               (SCB_CFSR_BUSFAULTSR_Pos + 4U)                  /*!< SCB CFSR (BFSR): STKERR Position */
-
 
583
#define SCB_CFSR_STKERR_Msk               (1UL << SCB_CFSR_STKERR_Pos)                    /*!< SCB CFSR (BFSR): STKERR Mask */
-
 
584
 
-
 
585
#define SCB_CFSR_UNSTKERR_Pos             (SCB_CFSR_BUSFAULTSR_Pos + 3U)                  /*!< SCB CFSR (BFSR): UNSTKERR Position */
-
 
586
#define SCB_CFSR_UNSTKERR_Msk             (1UL << SCB_CFSR_UNSTKERR_Pos)                  /*!< SCB CFSR (BFSR): UNSTKERR Mask */
-
 
587
 
-
 
588
#define SCB_CFSR_IMPRECISERR_Pos          (SCB_CFSR_BUSFAULTSR_Pos + 2U)                  /*!< SCB CFSR (BFSR): IMPRECISERR Position */
-
 
589
#define SCB_CFSR_IMPRECISERR_Msk          (1UL << SCB_CFSR_IMPRECISERR_Pos)               /*!< SCB CFSR (BFSR): IMPRECISERR Mask */
-
 
590
 
-
 
591
#define SCB_CFSR_PRECISERR_Pos            (SCB_CFSR_BUSFAULTSR_Pos + 1U)                  /*!< SCB CFSR (BFSR): PRECISERR Position */
-
 
592
#define SCB_CFSR_PRECISERR_Msk            (1UL << SCB_CFSR_PRECISERR_Pos)                 /*!< SCB CFSR (BFSR): PRECISERR Mask */
-
 
593
 
-
 
594
#define SCB_CFSR_IBUSERR_Pos              (SCB_CFSR_BUSFAULTSR_Pos + 0U)                  /*!< SCB CFSR (BFSR): IBUSERR Position */
-
 
595
#define SCB_CFSR_IBUSERR_Msk              (1UL << SCB_CFSR_IBUSERR_Pos)                   /*!< SCB CFSR (BFSR): IBUSERR Mask */
-
 
596
 
-
 
597
/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */
-
 
598
#define SCB_CFSR_DIVBYZERO_Pos            (SCB_CFSR_USGFAULTSR_Pos + 9U)                  /*!< SCB CFSR (UFSR): DIVBYZERO Position */
-
 
599
#define SCB_CFSR_DIVBYZERO_Msk            (1UL << SCB_CFSR_DIVBYZERO_Pos)                 /*!< SCB CFSR (UFSR): DIVBYZERO Mask */
-
 
600
 
-
 
601
#define SCB_CFSR_UNALIGNED_Pos            (SCB_CFSR_USGFAULTSR_Pos + 8U)                  /*!< SCB CFSR (UFSR): UNALIGNED Position */
-
 
602
#define SCB_CFSR_UNALIGNED_Msk            (1UL << SCB_CFSR_UNALIGNED_Pos)                 /*!< SCB CFSR (UFSR): UNALIGNED Mask */
-
 
603
 
-
 
604
#define SCB_CFSR_NOCP_Pos                 (SCB_CFSR_USGFAULTSR_Pos + 3U)                  /*!< SCB CFSR (UFSR): NOCP Position */
-
 
605
#define SCB_CFSR_NOCP_Msk                 (1UL << SCB_CFSR_NOCP_Pos)                      /*!< SCB CFSR (UFSR): NOCP Mask */
-
 
606
 
-
 
607
#define SCB_CFSR_INVPC_Pos                (SCB_CFSR_USGFAULTSR_Pos + 2U)                  /*!< SCB CFSR (UFSR): INVPC Position */
-
 
608
#define SCB_CFSR_INVPC_Msk                (1UL << SCB_CFSR_INVPC_Pos)                     /*!< SCB CFSR (UFSR): INVPC Mask */
-
 
609
 
-
 
610
#define SCB_CFSR_INVSTATE_Pos             (SCB_CFSR_USGFAULTSR_Pos + 1U)                  /*!< SCB CFSR (UFSR): INVSTATE Position */
-
 
611
#define SCB_CFSR_INVSTATE_Msk             (1UL << SCB_CFSR_INVSTATE_Pos)                  /*!< SCB CFSR (UFSR): INVSTATE Mask */
-
 
612
 
-
 
613
#define SCB_CFSR_UNDEFINSTR_Pos           (SCB_CFSR_USGFAULTSR_Pos + 0U)                  /*!< SCB CFSR (UFSR): UNDEFINSTR Position */
-
 
614
#define SCB_CFSR_UNDEFINSTR_Msk           (1UL << SCB_CFSR_UNDEFINSTR_Pos)                /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */
-
 
615
 
605
/* SCB Hard Fault Status Register Definitions */
616
/* SCB Hard Fault Status Register Definitions */
606
#define SCB_HFSR_DEBUGEVT_Pos              31U                                            /*!< SCB HFSR: DEBUGEVT Position */
617
#define SCB_HFSR_DEBUGEVT_Pos              31U                                            /*!< SCB HFSR: DEBUGEVT Position */
607
#define SCB_HFSR_DEBUGEVT_Msk              (1UL << SCB_HFSR_DEBUGEVT_Pos)                 /*!< SCB HFSR: DEBUGEVT Mask */
618
#define SCB_HFSR_DEBUGEVT_Msk              (1UL << SCB_HFSR_DEBUGEVT_Pos)                 /*!< SCB HFSR: DEBUGEVT Mask */
608
 
619
 
609
#define SCB_HFSR_FORCED_Pos                30U                                            /*!< SCB HFSR: FORCED Position */
620
#define SCB_HFSR_FORCED_Pos                30U                                            /*!< SCB HFSR: FORCED Position */
Line 643... Line 654...
643
 */
654
 */
644
typedef struct
655
typedef struct
645
{
656
{
646
        uint32_t RESERVED0[1U];
657
        uint32_t RESERVED0[1U];
647
  __IM  uint32_t ICTR;                   /*!< Offset: 0x004 (R/ )  Interrupt Controller Type Register */
658
  __IM  uint32_t ICTR;                   /*!< Offset: 0x004 (R/ )  Interrupt Controller Type Register */
648
#if ((defined __CM3_REV) && (__CM3_REV >= 0x200U))
659
#if defined (__CM3_REV) && (__CM3_REV >= 0x200U)
649
  __IOM uint32_t ACTLR;                  /*!< Offset: 0x008 (R/W)  Auxiliary Control Register */
660
  __IOM uint32_t ACTLR;                  /*!< Offset: 0x008 (R/W)  Auxiliary Control Register */
650
#else
661
#else
651
        uint32_t RESERVED1[1U];
662
        uint32_t RESERVED1[1U];
652
#endif
663
#endif
653
} SCnSCB_Type;
664
} SCnSCB_Type;
Line 768... Line 779...
768
  __IM  uint32_t CID3;                   /*!< Offset: 0xFFC (R/ )  ITM Component  Identification Register #3 */
779
  __IM  uint32_t CID3;                   /*!< Offset: 0xFFC (R/ )  ITM Component  Identification Register #3 */
769
} ITM_Type;
780
} ITM_Type;
770
 
781
 
771
/* ITM Trace Privilege Register Definitions */
782
/* ITM Trace Privilege Register Definitions */
772
#define ITM_TPR_PRIVMASK_Pos                0U                                            /*!< ITM TPR: PRIVMASK Position */
783
#define ITM_TPR_PRIVMASK_Pos                0U                                            /*!< ITM TPR: PRIVMASK Position */
773
#define ITM_TPR_PRIVMASK_Msk               (0xFUL /*<< ITM_TPR_PRIVMASK_Pos*/)            /*!< ITM TPR: PRIVMASK Mask */
784
#define ITM_TPR_PRIVMASK_Msk               (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/)     /*!< ITM TPR: PRIVMASK Mask */
774
 
785
 
775
/* ITM Trace Control Register Definitions */
786
/* ITM Trace Control Register Definitions */
776
#define ITM_TCR_BUSY_Pos                   23U                                            /*!< ITM TCR: BUSY Position */
787
#define ITM_TCR_BUSY_Pos                   23U                                            /*!< ITM TCR: BUSY Position */
777
#define ITM_TCR_BUSY_Msk                   (1UL << ITM_TCR_BUSY_Pos)                      /*!< ITM TCR: BUSY Mask */
788
#define ITM_TCR_BUSY_Msk                   (1UL << ITM_TCR_BUSY_Pos)                      /*!< ITM TCR: BUSY Mask */
778
 
789
 
Line 982... Line 993...
982
/**
993
/**
983
  \brief  Structure type to access the Trace Port Interface Register (TPI).
994
  \brief  Structure type to access the Trace Port Interface Register (TPI).
984
 */
995
 */
985
typedef struct
996
typedef struct
986
{
997
{
987
  __IOM uint32_t SSPSR;                  /*!< Offset: 0x000 (R/ )  Supported Parallel Port Size Register */
998
  __IM  uint32_t SSPSR;                  /*!< Offset: 0x000 (R/ )  Supported Parallel Port Size Register */
988
  __IOM uint32_t CSPSR;                  /*!< Offset: 0x004 (R/W)  Current Parallel Port Size Register */
999
  __IOM uint32_t CSPSR;                  /*!< Offset: 0x004 (R/W)  Current Parallel Port Size Register */
989
        uint32_t RESERVED0[2U];
1000
        uint32_t RESERVED0[2U];
990
  __IOM uint32_t ACPR;                   /*!< Offset: 0x010 (R/W)  Asynchronous Clock Prescaler Register */
1001
  __IOM uint32_t ACPR;                   /*!< Offset: 0x010 (R/W)  Asynchronous Clock Prescaler Register */
991
        uint32_t RESERVED1[55U];
1002
        uint32_t RESERVED1[55U];
992
  __IOM uint32_t SPPR;                   /*!< Offset: 0x0F0 (R/W)  Selected Pin Protocol Register */
1003
  __IOM uint32_t SPPR;                   /*!< Offset: 0x0F0 (R/W)  Selected Pin Protocol Register */
993
        uint32_t RESERVED2[131U];
1004
        uint32_t RESERVED2[131U];
994
  __IM  uint32_t FFSR;                   /*!< Offset: 0x300 (R/ )  Formatter and Flush Status Register */
1005
  __IM  uint32_t FFSR;                   /*!< Offset: 0x300 (R/ )  Formatter and Flush Status Register */
995
  __IOM uint32_t FFCR;                   /*!< Offset: 0x304 (R/W)  Formatter and Flush Control Register */
1006
  __IOM uint32_t FFCR;                   /*!< Offset: 0x304 (R/W)  Formatter and Flush Control Register */
996
  __IM  uint32_t FSCR;                   /*!< Offset: 0x308 (R/ )  Formatter Synchronization Counter Register */
1007
  __IM  uint32_t FSCR;                   /*!< Offset: 0x308 (R/ )  Formatter Synchronization Counter Register */
997
        uint32_t RESERVED3[759U];
1008
        uint32_t RESERVED3[759U];
998
  __IM  uint32_t TRIGGER;                /*!< Offset: 0xEE8 (R/ )  TRIGGER */
1009
  __IM  uint32_t TRIGGER;                /*!< Offset: 0xEE8 (R/ )  TRIGGER Register */
999
  __IM  uint32_t FIFO0;                  /*!< Offset: 0xEEC (R/ )  Integration ETM Data */
1010
  __IM  uint32_t FIFO0;                  /*!< Offset: 0xEEC (R/ )  Integration ETM Data */
1000
  __IM  uint32_t ITATBCTR2;              /*!< Offset: 0xEF0 (R/ )  ITATBCTR2 */
1011
  __IM  uint32_t ITATBCTR2;              /*!< Offset: 0xEF0 (R/ )  ITATBCTR2 */
1001
        uint32_t RESERVED4[1U];
1012
        uint32_t RESERVED4[1U];
1002
  __IM  uint32_t ITATBCTR0;              /*!< Offset: 0xEF8 (R/ )  ITATBCTR0 */
1013
  __IM  uint32_t ITATBCTR0;              /*!< Offset: 0xEF8 (R/ )  ITATBCTR0 */
1003
  __IM  uint32_t FIFO1;                  /*!< Offset: 0xEFC (R/ )  Integration ITM Data */
1014
  __IM  uint32_t FIFO1;                  /*!< Offset: 0xEFC (R/ )  Integration ITM Data */
Line 1063... Line 1074...
1063
 
1074
 
1064
#define TPI_FIFO0_ETM0_Pos                  0U                                         /*!< TPI FIFO0: ETM0 Position */
1075
#define TPI_FIFO0_ETM0_Pos                  0U                                         /*!< TPI FIFO0: ETM0 Position */
1065
#define TPI_FIFO0_ETM0_Msk                 (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/)          /*!< TPI FIFO0: ETM0 Mask */
1076
#define TPI_FIFO0_ETM0_Msk                 (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/)          /*!< TPI FIFO0: ETM0 Mask */
1066
 
1077
 
1067
/* TPI ITATBCTR2 Register Definitions */
1078
/* TPI ITATBCTR2 Register Definitions */
1068
#define TPI_ITATBCTR2_ATREADY_Pos           0U                                         /*!< TPI ITATBCTR2: ATREADY Position */
1079
#define TPI_ITATBCTR2_ATREADY2_Pos          0U                                         /*!< TPI ITATBCTR2: ATREADY2 Position */
-
 
1080
#define TPI_ITATBCTR2_ATREADY2_Msk         (0x1UL /*<< TPI_ITATBCTR2_ATREADY2_Pos*/)   /*!< TPI ITATBCTR2: ATREADY2 Mask */
-
 
1081
 
-
 
1082
#define TPI_ITATBCTR2_ATREADY1_Pos          0U                                         /*!< TPI ITATBCTR2: ATREADY1 Position */
1069
#define TPI_ITATBCTR2_ATREADY_Msk          (0x1UL /*<< TPI_ITATBCTR2_ATREADY_Pos*/)    /*!< TPI ITATBCTR2: ATREADY Mask */
1083
#define TPI_ITATBCTR2_ATREADY1_Msk         (0x1UL /*<< TPI_ITATBCTR2_ATREADY1_Pos*/)   /*!< TPI ITATBCTR2: ATREADY1 Mask */
1070
 
1084
 
1071
/* TPI Integration ITM Data Register Definitions (FIFO1) */
1085
/* TPI Integration ITM Data Register Definitions (FIFO1) */
1072
#define TPI_FIFO1_ITM_ATVALID_Pos          29U                                         /*!< TPI FIFO1: ITM_ATVALID Position */
1086
#define TPI_FIFO1_ITM_ATVALID_Pos          29U                                         /*!< TPI FIFO1: ITM_ATVALID Position */
1073
#define TPI_FIFO1_ITM_ATVALID_Msk          (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos)        /*!< TPI FIFO1: ITM_ATVALID Mask */
1087
#define TPI_FIFO1_ITM_ATVALID_Msk          (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos)        /*!< TPI FIFO1: ITM_ATVALID Mask */
1074
 
1088
 
Line 1089... Line 1103...
1089
 
1103
 
1090
#define TPI_FIFO1_ITM0_Pos                  0U                                         /*!< TPI FIFO1: ITM0 Position */
1104
#define TPI_FIFO1_ITM0_Pos                  0U                                         /*!< TPI FIFO1: ITM0 Position */
1091
#define TPI_FIFO1_ITM0_Msk                 (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/)          /*!< TPI FIFO1: ITM0 Mask */
1105
#define TPI_FIFO1_ITM0_Msk                 (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/)          /*!< TPI FIFO1: ITM0 Mask */
1092
 
1106
 
1093
/* TPI ITATBCTR0 Register Definitions */
1107
/* TPI ITATBCTR0 Register Definitions */
1094
#define TPI_ITATBCTR0_ATREADY_Pos           0U                                         /*!< TPI ITATBCTR0: ATREADY Position */
1108
#define TPI_ITATBCTR0_ATREADY2_Pos          0U                                         /*!< TPI ITATBCTR0: ATREADY2 Position */
-
 
1109
#define TPI_ITATBCTR0_ATREADY2_Msk         (0x1UL /*<< TPI_ITATBCTR0_ATREADY2_Pos*/)   /*!< TPI ITATBCTR0: ATREADY2 Mask */
-
 
1110
 
-
 
1111
#define TPI_ITATBCTR0_ATREADY1_Pos          0U                                         /*!< TPI ITATBCTR0: ATREADY1 Position */
1095
#define TPI_ITATBCTR0_ATREADY_Msk          (0x1UL /*<< TPI_ITATBCTR0_ATREADY_Pos*/)    /*!< TPI ITATBCTR0: ATREADY Mask */
1112
#define TPI_ITATBCTR0_ATREADY1_Msk         (0x1UL /*<< TPI_ITATBCTR0_ATREADY1_Pos*/)   /*!< TPI ITATBCTR0: ATREADY1 Mask */
1096
 
1113
 
1097
/* TPI Integration Mode Control Register Definitions */
1114
/* TPI Integration Mode Control Register Definitions */
1098
#define TPI_ITCTRL_Mode_Pos                 0U                                         /*!< TPI ITCTRL: Mode Position */
1115
#define TPI_ITCTRL_Mode_Pos                 0U                                         /*!< TPI ITCTRL: Mode Position */
1099
#define TPI_ITCTRL_Mode_Msk                (0x1UL /*<< TPI_ITCTRL_Mode_Pos*/)          /*!< TPI ITCTRL: Mode Mask */
1116
#define TPI_ITCTRL_Mode_Msk                (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/)          /*!< TPI ITCTRL: Mode Mask */
1100
 
1117
 
1101
/* TPI DEVID Register Definitions */
1118
/* TPI DEVID Register Definitions */
1102
#define TPI_DEVID_NRZVALID_Pos             11U                                         /*!< TPI DEVID: NRZVALID Position */
1119
#define TPI_DEVID_NRZVALID_Pos             11U                                         /*!< TPI DEVID: NRZVALID Position */
1103
#define TPI_DEVID_NRZVALID_Msk             (0x1UL << TPI_DEVID_NRZVALID_Pos)           /*!< TPI DEVID: NRZVALID Mask */
1120
#define TPI_DEVID_NRZVALID_Msk             (0x1UL << TPI_DEVID_NRZVALID_Pos)           /*!< TPI DEVID: NRZVALID Mask */
1104
 
1121
 
Line 1116... Line 1133...
1116
 
1133
 
1117
#define TPI_DEVID_NrTraceInput_Pos          0U                                         /*!< TPI DEVID: NrTraceInput Position */
1134
#define TPI_DEVID_NrTraceInput_Pos          0U                                         /*!< TPI DEVID: NrTraceInput Position */
1118
#define TPI_DEVID_NrTraceInput_Msk         (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/)  /*!< TPI DEVID: NrTraceInput Mask */
1135
#define TPI_DEVID_NrTraceInput_Msk         (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/)  /*!< TPI DEVID: NrTraceInput Mask */
1119
 
1136
 
1120
/* TPI DEVTYPE Register Definitions */
1137
/* TPI DEVTYPE Register Definitions */
1121
#define TPI_DEVTYPE_MajorType_Pos           4U                                         /*!< TPI DEVTYPE: MajorType Position */
-
 
1122
#define TPI_DEVTYPE_MajorType_Msk          (0xFUL << TPI_DEVTYPE_MajorType_Pos)        /*!< TPI DEVTYPE: MajorType Mask */
-
 
1123
 
-
 
1124
#define TPI_DEVTYPE_SubType_Pos             0U                                         /*!< TPI DEVTYPE: SubType Position */
1138
#define TPI_DEVTYPE_SubType_Pos             4U                                         /*!< TPI DEVTYPE: SubType Position */
1125
#define TPI_DEVTYPE_SubType_Msk            (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/)      /*!< TPI DEVTYPE: SubType Mask */
1139
#define TPI_DEVTYPE_SubType_Msk            (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/)      /*!< TPI DEVTYPE: SubType Mask */
1126
 
1140
 
-
 
1141
#define TPI_DEVTYPE_MajorType_Pos           0U                                         /*!< TPI DEVTYPE: MajorType Position */
-
 
1142
#define TPI_DEVTYPE_MajorType_Msk          (0xFUL << TPI_DEVTYPE_MajorType_Pos)        /*!< TPI DEVTYPE: MajorType Mask */
-
 
1143
 
1127
/*@}*/ /* end of group CMSIS_TPI */
1144
/*@}*/ /* end of group CMSIS_TPI */
1128
 
1145
 
1129
 
1146
 
1130
#if (__MPU_PRESENT == 1U)
1147
#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
1131
/**
1148
/**
1132
  \ingroup  CMSIS_core_register
1149
  \ingroup  CMSIS_core_register
1133
  \defgroup CMSIS_MPU     Memory Protection Unit (MPU)
1150
  \defgroup CMSIS_MPU     Memory Protection Unit (MPU)
1134
  \brief    Type definitions for the Memory Protection Unit (MPU)
1151
  \brief    Type definitions for the Memory Protection Unit (MPU)
1135
  @{
1152
  @{
Line 1151... Line 1168...
1151
  __IOM uint32_t RASR_A2;                /*!< Offset: 0x020 (R/W)  MPU Alias 2 Region Attribute and Size Register */
1168
  __IOM uint32_t RASR_A2;                /*!< Offset: 0x020 (R/W)  MPU Alias 2 Region Attribute and Size Register */
1152
  __IOM uint32_t RBAR_A3;                /*!< Offset: 0x024 (R/W)  MPU Alias 3 Region Base Address Register */
1169
  __IOM uint32_t RBAR_A3;                /*!< Offset: 0x024 (R/W)  MPU Alias 3 Region Base Address Register */
1153
  __IOM uint32_t RASR_A3;                /*!< Offset: 0x028 (R/W)  MPU Alias 3 Region Attribute and Size Register */
1170
  __IOM uint32_t RASR_A3;                /*!< Offset: 0x028 (R/W)  MPU Alias 3 Region Attribute and Size Register */
1154
} MPU_Type;
1171
} MPU_Type;
1155
 
1172
 
-
 
1173
#define MPU_TYPE_RALIASES                  4U
-
 
1174
 
1156
/* MPU Type Register Definitions */
1175
/* MPU Type Register Definitions */
1157
#define MPU_TYPE_IREGION_Pos               16U                                            /*!< MPU TYPE: IREGION Position */
1176
#define MPU_TYPE_IREGION_Pos               16U                                            /*!< MPU TYPE: IREGION Position */
1158
#define MPU_TYPE_IREGION_Msk               (0xFFUL << MPU_TYPE_IREGION_Pos)               /*!< MPU TYPE: IREGION Mask */
1177
#define MPU_TYPE_IREGION_Msk               (0xFFUL << MPU_TYPE_IREGION_Pos)               /*!< MPU TYPE: IREGION Mask */
1159
 
1178
 
1160
#define MPU_TYPE_DREGION_Pos                8U                                            /*!< MPU TYPE: DREGION Position */
1179
#define MPU_TYPE_DREGION_Pos                8U                                            /*!< MPU TYPE: DREGION Position */
Line 1335... Line 1354...
1335
 */
1354
 */
1336
 
1355
 
1337
/**
1356
/**
1338
  \brief   Mask and shift a bit field value for use in a register bit range.
1357
  \brief   Mask and shift a bit field value for use in a register bit range.
1339
  \param[in] field  Name of the register bit field.
1358
  \param[in] field  Name of the register bit field.
1340
  \param[in] value  Value of the bit field.
1359
  \param[in] value  Value of the bit field. This parameter is interpreted as an uint32_t type.
1341
  \return           Masked and shifted value.
1360
  \return           Masked and shifted value.
1342
*/
1361
*/
1343
#define _VAL2FLD(field, value)    ((value << field ## _Pos) & field ## _Msk)
1362
#define _VAL2FLD(field, value)    (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
1344
 
1363
 
1345
/**
1364
/**
1346
  \brief     Mask and shift a register value to extract a bit filed value.
1365
  \brief     Mask and shift a register value to extract a bit filed value.
1347
  \param[in] field  Name of the register bit field.
1366
  \param[in] field  Name of the register bit field.
1348
  \param[in] value  Value of register.
1367
  \param[in] value  Value of register. This parameter is interpreted as an uint32_t type.
1349
  \return           Masked and shifted bit field value.
1368
  \return           Masked and shifted bit field value.
1350
*/
1369
*/
1351
#define _FLD2VAL(field, value)    ((value & field ## _Msk) >> field ## _Pos)
1370
#define _FLD2VAL(field, value)    (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
1352
 
1371
 
1353
/*@} end of group CMSIS_core_bitfield */
1372
/*@} end of group CMSIS_core_bitfield */
1354
 
1373
 
1355
 
1374
 
1356
/**
1375
/**
Line 1358... Line 1377...
1358
  \defgroup   CMSIS_core_base     Core Definitions
1377
  \defgroup   CMSIS_core_base     Core Definitions
1359
  \brief      Definitions for base addresses, unions, and structures.
1378
  \brief      Definitions for base addresses, unions, and structures.
1360
  @{
1379
  @{
1361
 */
1380
 */
1362
 
1381
 
1363
/* Memory mapping of Cortex-M3 Hardware */
1382
/* Memory mapping of Core Hardware */
1364
#define SCS_BASE            (0xE000E000UL)                            /*!< System Control Space Base Address */
1383
#define SCS_BASE            (0xE000E000UL)                            /*!< System Control Space Base Address */
1365
#define ITM_BASE            (0xE0000000UL)                            /*!< ITM Base Address */
1384
#define ITM_BASE            (0xE0000000UL)                            /*!< ITM Base Address */
1366
#define DWT_BASE            (0xE0001000UL)                            /*!< DWT Base Address */
1385
#define DWT_BASE            (0xE0001000UL)                            /*!< DWT Base Address */
1367
#define TPI_BASE            (0xE0040000UL)                            /*!< TPI Base Address */
1386
#define TPI_BASE            (0xE0040000UL)                            /*!< TPI Base Address */
1368
#define CoreDebug_BASE      (0xE000EDF0UL)                            /*!< Core Debug Base Address */
1387
#define CoreDebug_BASE      (0xE000EDF0UL)                            /*!< Core Debug Base Address */
Line 1377... Line 1396...
1377
#define ITM                 ((ITM_Type       *)     ITM_BASE      )   /*!< ITM configuration struct */
1396
#define ITM                 ((ITM_Type       *)     ITM_BASE      )   /*!< ITM configuration struct */
1378
#define DWT                 ((DWT_Type       *)     DWT_BASE      )   /*!< DWT configuration struct */
1397
#define DWT                 ((DWT_Type       *)     DWT_BASE      )   /*!< DWT configuration struct */
1379
#define TPI                 ((TPI_Type       *)     TPI_BASE      )   /*!< TPI configuration struct */
1398
#define TPI                 ((TPI_Type       *)     TPI_BASE      )   /*!< TPI configuration struct */
1380
#define CoreDebug           ((CoreDebug_Type *)     CoreDebug_BASE)   /*!< Core Debug configuration struct */
1399
#define CoreDebug           ((CoreDebug_Type *)     CoreDebug_BASE)   /*!< Core Debug configuration struct */
1381
 
1400
 
1382
#if (__MPU_PRESENT == 1U)
1401
#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
1383
  #define MPU_BASE          (SCS_BASE +  0x0D90UL)                    /*!< Memory Protection Unit */
1402
  #define MPU_BASE          (SCS_BASE +  0x0D90UL)                    /*!< Memory Protection Unit */
1384
  #define MPU               ((MPU_Type       *)     MPU_BASE      )   /*!< Memory Protection Unit */
1403
  #define MPU               ((MPU_Type       *)     MPU_BASE      )   /*!< Memory Protection Unit */
1385
#endif
1404
#endif
1386
 
1405
 
1387
/*@} */
1406
/*@} */
Line 1408... Line 1427...
1408
  \defgroup CMSIS_Core_NVICFunctions NVIC Functions
1427
  \defgroup CMSIS_Core_NVICFunctions NVIC Functions
1409
  \brief    Functions that manage interrupts and exceptions via the NVIC.
1428
  \brief    Functions that manage interrupts and exceptions via the NVIC.
1410
  @{
1429
  @{
1411
 */
1430
 */
1412
 
1431
 
-
 
1432
#ifdef CMSIS_NVIC_VIRTUAL
-
 
1433
  #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
-
 
1434
    #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
-
 
1435
  #endif
-
 
1436
  #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
-
 
1437
#else
-
 
1438
  #define NVIC_SetPriorityGrouping    __NVIC_SetPriorityGrouping
-
 
1439
  #define NVIC_GetPriorityGrouping    __NVIC_GetPriorityGrouping
-
 
1440
  #define NVIC_EnableIRQ              __NVIC_EnableIRQ
-
 
1441
  #define NVIC_GetEnableIRQ           __NVIC_GetEnableIRQ
-
 
1442
  #define NVIC_DisableIRQ             __NVIC_DisableIRQ
-
 
1443
  #define NVIC_GetPendingIRQ          __NVIC_GetPendingIRQ
-
 
1444
  #define NVIC_SetPendingIRQ          __NVIC_SetPendingIRQ
-
 
1445
  #define NVIC_ClearPendingIRQ        __NVIC_ClearPendingIRQ
-
 
1446
  #define NVIC_GetActive              __NVIC_GetActive
-
 
1447
  #define NVIC_SetPriority            __NVIC_SetPriority
-
 
1448
  #define NVIC_GetPriority            __NVIC_GetPriority
-
 
1449
  #define NVIC_SystemReset            __NVIC_SystemReset
-
 
1450
#endif /* CMSIS_NVIC_VIRTUAL */
-
 
1451
 
-
 
1452
#ifdef CMSIS_VECTAB_VIRTUAL
-
 
1453
  #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
-
 
1454
   #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
-
 
1455
  #endif
-
 
1456
  #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
-
 
1457
#else
-
 
1458
  #define NVIC_SetVector              __NVIC_SetVector
-
 
1459
  #define NVIC_GetVector              __NVIC_GetVector
-
 
1460
#endif  /* (CMSIS_VECTAB_VIRTUAL) */
-
 
1461
 
-
 
1462
#define NVIC_USER_IRQ_OFFSET          16
-
 
1463
 
-
 
1464
 
-
 
1465
/* The following EXC_RETURN values are saved the LR on exception entry */
-
 
1466
#define EXC_RETURN_HANDLER         (0xFFFFFFF1UL)     /* return to Handler mode, uses MSP after return                               */
-
 
1467
#define EXC_RETURN_THREAD_MSP      (0xFFFFFFF9UL)     /* return to Thread mode, uses MSP after return                                */
-
 
1468
#define EXC_RETURN_THREAD_PSP      (0xFFFFFFFDUL)     /* return to Thread mode, uses PSP after return                                */
-
 
1469
 
-
 
1470
 
1413
/**
1471
/**
1414
  \brief   Set Priority Grouping
1472
  \brief   Set Priority Grouping
1415
  \details Sets the priority grouping field using the required unlock sequence.
1473
  \details Sets the priority grouping field using the required unlock sequence.
1416
           The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
1474
           The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
1417
           Only values from 0..7 are used.
1475
           Only values from 0..7 are used.
1418
           In case of a conflict between priority grouping and available
1476
           In case of a conflict between priority grouping and available
1419
           priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
1477
           priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
1420
  \param [in]      PriorityGroup  Priority grouping field.
1478
  \param [in]      PriorityGroup  Priority grouping field.
1421
 */
1479
 */
1422
__STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
1480
__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
1423
{
1481
{
1424
  uint32_t reg_value;
1482
  uint32_t reg_value;
1425
  uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL);             /* only values 0..7 are used          */
1483
  uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL);             /* only values 0..7 are used          */
1426
 
1484
 
1427
  reg_value  =  SCB->AIRCR;                                                   /* read old register configuration    */
1485
  reg_value  =  SCB->AIRCR;                                                   /* read old register configuration    */
1428
  reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change               */
1486
  reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change               */
1429
  reg_value  =  (reg_value                                   |
1487
  reg_value  =  (reg_value                                   |
1430
                ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
1488
                ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
1431
                (PriorityGroupTmp << 8U)                      );              /* Insert write key and priorty group */
1489
                (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) );               /* Insert write key and priority group */
1432
  SCB->AIRCR =  reg_value;
1490
  SCB->AIRCR =  reg_value;
1433
}
1491
}
1434
 
1492
 
1435
 
1493
 
1436
/**
1494
/**
1437
  \brief   Get Priority Grouping
1495
  \brief   Get Priority Grouping
1438
  \details Reads the priority grouping field from the NVIC Interrupt Controller.
1496
  \details Reads the priority grouping field from the NVIC Interrupt Controller.
1439
  \return                Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
1497
  \return                Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
1440
 */
1498
 */
1441
__STATIC_INLINE uint32_t NVIC_GetPriorityGrouping(void)
1499
__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void)
1442
{
1500
{
1443
  return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
1501
  return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
1444
}
1502
}
1445
 
1503
 
1446
 
1504
 
1447
/**
1505
/**
1448
  \brief   Enable External Interrupt
1506
  \brief   Enable Interrupt
1449
  \details Enables a device-specific interrupt in the NVIC interrupt controller.
1507
  \details Enables a device specific interrupt in the NVIC interrupt controller.
1450
  \param [in]      IRQn  External interrupt number. Value cannot be negative.
1508
  \param [in]      IRQn  Device specific interrupt number.
-
 
1509
  \note    IRQn must not be negative.
1451
 */
1510
 */
1452
__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
1511
__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
1453
{
1512
{
-
 
1513
  if ((int32_t)(IRQn) >= 0)
-
 
1514
  {
1454
  NVIC->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
1515
    NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
-
 
1516
  }
1455
}
1517
}
1456
 
1518
 
1457
 
1519
 
1458
/**
1520
/**
1459
  \brief   Disable External Interrupt
1521
  \brief   Get Interrupt Enable status
1460
  \details Disables a device-specific interrupt in the NVIC interrupt controller.
1522
  \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
1461
  \param [in]      IRQn  External interrupt number. Value cannot be negative.
1523
  \param [in]      IRQn  Device specific interrupt number.
-
 
1524
  \return             0  Interrupt is not enabled.
-
 
1525
  \return             1  Interrupt is enabled.
-
 
1526
  \note    IRQn must not be negative.
1462
 */
1527
 */
1463
__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
1528
__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
1464
{
1529
{
-
 
1530
  if ((int32_t)(IRQn) >= 0)
-
 
1531
  {
-
 
1532
    return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
-
 
1533
  }
-
 
1534
  else
-
 
1535
  {
-
 
1536
    return(0U);
-
 
1537
  }
-
 
1538
}
-
 
1539
 
-
 
1540
 
-
 
1541
/**
-
 
1542
  \brief   Disable Interrupt
-
 
1543
  \details Disables a device specific interrupt in the NVIC interrupt controller.
-
 
1544
  \param [in]      IRQn  Device specific interrupt number.
-
 
1545
  \note    IRQn must not be negative.
-
 
1546
 */
-
 
1547
__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
-
 
1548
{
-
 
1549
  if ((int32_t)(IRQn) >= 0)
-
 
1550
  {
1465
  NVIC->ICER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
1551
    NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
-
 
1552
    __DSB();
-
 
1553
    __ISB();
-
 
1554
  }
1466
}
1555
}
1467
 
1556
 
1468
 
1557
 
1469
/**
1558
/**
1470
  \brief   Get Pending Interrupt
1559
  \brief   Get Pending Interrupt
1471
  \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt.
1560
  \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
1472
  \param [in]      IRQn  Interrupt number.
1561
  \param [in]      IRQn  Device specific interrupt number.
1473
  \return             0  Interrupt status is not pending.
1562
  \return             0  Interrupt status is not pending.
1474
  \return             1  Interrupt status is pending.
1563
  \return             1  Interrupt status is pending.
-
 
1564
  \note    IRQn must not be negative.
1475
 */
1565
 */
1476
__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
1566
__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
1477
{
1567
{
-
 
1568
  if ((int32_t)(IRQn) >= 0)
-
 
1569
  {
1478
  return((uint32_t)(((NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
1570
    return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
-
 
1571
  }
-
 
1572
  else
-
 
1573
  {
-
 
1574
    return(0U);
-
 
1575
  }
1479
}
1576
}
1480
 
1577
 
1481
 
1578
 
1482
/**
1579
/**
1483
  \brief   Set Pending Interrupt
1580
  \brief   Set Pending Interrupt
1484
  \details Sets the pending bit of an external interrupt.
1581
  \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
1485
  \param [in]      IRQn  Interrupt number. Value cannot be negative.
1582
  \param [in]      IRQn  Device specific interrupt number.
-
 
1583
  \note    IRQn must not be negative.
1486
 */
1584
 */
1487
__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
1585
__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
1488
{
1586
{
-
 
1587
  if ((int32_t)(IRQn) >= 0)
-
 
1588
  {
1489
  NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
1589
    NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
-
 
1590
  }
1490
}
1591
}
1491
 
1592
 
1492
 
1593
 
1493
/**
1594
/**
1494
  \brief   Clear Pending Interrupt
1595
  \brief   Clear Pending Interrupt
1495
  \details Clears the pending bit of an external interrupt.
1596
  \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
1496
  \param [in]      IRQn  External interrupt number. Value cannot be negative.
1597
  \param [in]      IRQn  Device specific interrupt number.
-
 
1598
  \note    IRQn must not be negative.
1497
 */
1599
 */
1498
__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
1600
__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
1499
{
1601
{
-
 
1602
  if ((int32_t)(IRQn) >= 0)
-
 
1603
  {
1500
  NVIC->ICPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
1604
    NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
-
 
1605
  }
1501
}
1606
}
1502
 
1607
 
1503
 
1608
 
1504
/**
1609
/**
1505
  \brief   Get Active Interrupt
1610
  \brief   Get Active Interrupt
1506
  \details Reads the active register in NVIC and returns the active bit.
1611
  \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
1507
  \param [in]      IRQn  Interrupt number.
1612
  \param [in]      IRQn  Device specific interrupt number.
1508
  \return             0  Interrupt status is not active.
1613
  \return             0  Interrupt status is not active.
1509
  \return             1  Interrupt status is active.
1614
  \return             1  Interrupt status is active.
-
 
1615
  \note    IRQn must not be negative.
1510
 */
1616
 */
1511
__STATIC_INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn)
1617
__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
1512
{
1618
{
-
 
1619
  if ((int32_t)(IRQn) >= 0)
-
 
1620
  {
1513
  return((uint32_t)(((NVIC->IABR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
1621
    return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
-
 
1622
  }
-
 
1623
  else
-
 
1624
  {
-
 
1625
    return(0U);
-
 
1626
  }
1514
}
1627
}
1515
 
1628
 
1516
 
1629
 
1517
/**
1630
/**
1518
  \brief   Set Interrupt Priority
1631
  \brief   Set Interrupt Priority
1519
  \details Sets the priority of an interrupt.
1632
  \details Sets the priority of a device specific interrupt or a processor exception.
1520
  \note    The priority cannot be set for every core interrupt.
1633
           The interrupt number can be positive to specify a device specific interrupt,
-
 
1634
           or negative to specify a processor exception.
1521
  \param [in]      IRQn  Interrupt number.
1635
  \param [in]      IRQn  Interrupt number.
1522
  \param [in]  priority  Priority to set.
1636
  \param [in]  priority  Priority to set.
-
 
1637
  \note    The priority cannot be set for every processor exception.
1523
 */
1638
 */
1524
__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
1639
__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
1525
{
1640
{
1526
  if ((int32_t)(IRQn) < 0)
1641
  if ((int32_t)(IRQn) >= 0)
1527
  {
1642
  {
1528
    SCB->SHP[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
1643
    NVIC->IP[((uint32_t)IRQn)]               = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
1529
  }
1644
  }
1530
  else
1645
  else
1531
  {
1646
  {
1532
    NVIC->IP[((uint32_t)(int32_t)IRQn)]               = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
1647
    SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
1533
  }
1648
  }
1534
}
1649
}
1535
 
1650
 
1536
 
1651
 
1537
/**
1652
/**
1538
  \brief   Get Interrupt Priority
1653
  \brief   Get Interrupt Priority
1539
  \details Reads the priority of an interrupt.
1654
  \details Reads the priority of a device specific interrupt or a processor exception.
1540
           The interrupt number can be positive to specify an external (device specific) interrupt,
1655
           The interrupt number can be positive to specify a device specific interrupt,
1541
           or negative to specify an internal (core) interrupt.
1656
           or negative to specify a processor exception.
1542
  \param [in]   IRQn  Interrupt number.
1657
  \param [in]   IRQn  Interrupt number.
1543
  \return             Interrupt Priority.
1658
  \return             Interrupt Priority.
1544
                      Value is aligned automatically to the implemented priority bits of the microcontroller.
1659
                      Value is aligned automatically to the implemented priority bits of the microcontroller.
1545
 */
1660
 */
1546
__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
1661
__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
1547
{
1662
{
1548
 
1663
 
1549
  if ((int32_t)(IRQn) < 0)
1664
  if ((int32_t)(IRQn) >= 0)
1550
  {
1665
  {
1551
    return(((uint32_t)SCB->SHP[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
1666
    return(((uint32_t)NVIC->IP[((uint32_t)IRQn)]               >> (8U - __NVIC_PRIO_BITS)));
1552
  }
1667
  }
1553
  else
1668
  else
1554
  {
1669
  {
1555
    return(((uint32_t)NVIC->IP[((uint32_t)(int32_t)IRQn)]               >> (8U - __NVIC_PRIO_BITS)));
1670
    return(((uint32_t)SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
1556
  }
1671
  }
1557
}
1672
}
1558
 
1673
 
1559
 
1674
 
1560
/**
1675
/**
Line 1608... Line 1723...
1608
  *pSubPriority     = (Priority                   ) & (uint32_t)((1UL << (SubPriorityBits    )) - 1UL);
1723
  *pSubPriority     = (Priority                   ) & (uint32_t)((1UL << (SubPriorityBits    )) - 1UL);
1609
}
1724
}
1610
 
1725
 
1611
 
1726
 
1612
/**
1727
/**
-
 
1728
  \brief   Set Interrupt Vector
-
 
1729
  \details Sets an interrupt vector in SRAM based interrupt vector table.
-
 
1730
           The interrupt number can be positive to specify a device specific interrupt,
-
 
1731
           or negative to specify a processor exception.
-
 
1732
           VTOR must been relocated to SRAM before.
-
 
1733
  \param [in]   IRQn      Interrupt number
-
 
1734
  \param [in]   vector    Address of interrupt handler function
-
 
1735
 */
-
 
1736
__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
-
 
1737
{
-
 
1738
  uint32_t *vectors = (uint32_t *)SCB->VTOR;
-
 
1739
  vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
-
 
1740
}
-
 
1741
 
-
 
1742
 
-
 
1743
/**
-
 
1744
  \brief   Get Interrupt Vector
-
 
1745
  \details Reads an interrupt vector from interrupt vector table.
-
 
1746
           The interrupt number can be positive to specify a device specific interrupt,
-
 
1747
           or negative to specify a processor exception.
-
 
1748
  \param [in]   IRQn      Interrupt number.
-
 
1749
  \return                 Address of interrupt handler function
-
 
1750
 */
-
 
1751
__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
-
 
1752
{
-
 
1753
  uint32_t *vectors = (uint32_t *)SCB->VTOR;
-
 
1754
  return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
-
 
1755
}
-
 
1756
 
-
 
1757
 
-
 
1758
/**
1613
  \brief   System Reset
1759
  \brief   System Reset
1614
  \details Initiates a system reset request to reset the MCU.
1760
  \details Initiates a system reset request to reset the MCU.
1615
 */
1761
 */
1616
__STATIC_INLINE void NVIC_SystemReset(void)
1762
__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
1617
{
1763
{
1618
  __DSB();                                                          /* Ensure all outstanding memory accesses included
1764
  __DSB();                                                          /* Ensure all outstanding memory accesses included
1619
                                                                       buffered write are completed before reset */
1765
                                                                       buffered write are completed before reset */
1620
  SCB->AIRCR  = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos)    |
1766
  SCB->AIRCR  = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos)    |
1621
                           (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
1767
                           (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
Line 1628... Line 1774...
1628
  }
1774
  }
1629
}
1775
}
1630
 
1776
 
1631
/*@} end of CMSIS_Core_NVICFunctions */
1777
/*@} end of CMSIS_Core_NVICFunctions */
1632
 
1778
 
-
 
1779
/* ##########################  MPU functions  #################################### */
-
 
1780
 
-
 
1781
#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
-
 
1782
 
-
 
1783
#include "mpu_armv7.h"
-
 
1784
 
-
 
1785
#endif
-
 
1786
 
-
 
1787
/* ##########################  FPU functions  #################################### */
-
 
1788
/**
-
 
1789
  \ingroup  CMSIS_Core_FunctionInterface
-
 
1790
  \defgroup CMSIS_Core_FpuFunctions FPU Functions
-
 
1791
  \brief    Function that provides FPU type.
-
 
1792
  @{
-
 
1793
 */
-
 
1794
 
-
 
1795
/**
-
 
1796
  \brief   get FPU type
-
 
1797
  \details returns the FPU type
-
 
1798
  \returns
-
 
1799
   - \b  0: No FPU
-
 
1800
   - \b  1: Single precision FPU
-
 
1801
   - \b  2: Double + Single precision FPU
-
 
1802
 */
-
 
1803
__STATIC_INLINE uint32_t SCB_GetFPUType(void)
-
 
1804
{
-
 
1805
    return 0U;           /* No FPU */
-
 
1806
}
-
 
1807
 
-
 
1808
 
-
 
1809
/*@} end of CMSIS_Core_FpuFunctions */
-
 
1810
 
1633
 
1811
 
1634
 
1812
 
1635
/* ##################################    SysTick function  ############################################ */
1813
/* ##################################    SysTick function  ############################################ */
1636
/**
1814
/**
1637
  \ingroup  CMSIS_Core_FunctionInterface
1815
  \ingroup  CMSIS_Core_FunctionInterface
1638
  \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
1816
  \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
1639
  \brief    Functions that configure the System.
1817
  \brief    Functions that configure the System.
1640
  @{
1818
  @{
1641
 */
1819
 */
1642
 
1820
 
1643
#if (__Vendor_SysTickConfig == 0U)
1821
#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
1644
 
1822
 
1645
/**
1823
/**
1646
  \brief   System Tick Configuration
1824
  \brief   System Tick Configuration
1647
  \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
1825
  \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
1648
           Counter is in free running mode to generate periodic interrupts.
1826
           Counter is in free running mode to generate periodic interrupts.
Line 1681... Line 1859...
1681
  \defgroup CMSIS_core_DebugFunctions ITM Functions
1859
  \defgroup CMSIS_core_DebugFunctions ITM Functions
1682
  \brief    Functions that access the ITM debug interface.
1860
  \brief    Functions that access the ITM debug interface.
1683
  @{
1861
  @{
1684
 */
1862
 */
1685
 
1863
 
1686
extern volatile int32_t ITM_RxBuffer;                    /*!< External variable to receive characters. */
1864
extern volatile int32_t ITM_RxBuffer;                              /*!< External variable to receive characters. */
1687
#define                 ITM_RXBUFFER_EMPTY   0x5AA55AA5U /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
1865
#define                 ITM_RXBUFFER_EMPTY  ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
1688
 
1866
 
1689
 
1867
 
1690
/**
1868
/**
1691
  \brief   ITM Send Character
1869
  \brief   ITM Send Character
1692
  \details Transmits a character via the ITM channel 0, and
1870
  \details Transmits a character via the ITM channel 0, and