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_cm7.h
2
 * @file     core_cm7.h
3
 * @brief    CMSIS Cortex-M7 Core Peripheral Access Layer Header File
3
 * @brief    CMSIS Cortex-M7 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_CM7_H_GENERIC
31
#ifndef __CORE_CM7_H_GENERIC
42
#define __CORE_CM7_H_GENERIC
32
#define __CORE_CM7_H_GENERIC
Line 68... Line 58...
68
/**
58
/**
69
  \ingroup Cortex_M7
59
  \ingroup Cortex_M7
70
  @{
60
  @{
71
 */
61
 */
72
 
62
 
73
/*  CMSIS CM7 definitions */
-
 
74
#define __CM7_CMSIS_VERSION_MAIN  (0x04U)                                      /*!< [31:16] CMSIS HAL main version */
-
 
75
#define __CM7_CMSIS_VERSION_SUB   (0x1EU)                                      /*!< [15:0]  CMSIS HAL sub version */
-
 
76
#define __CM7_CMSIS_VERSION       ((__CM7_CMSIS_VERSION_MAIN << 16U) | \
-
 
77
                                    __CM7_CMSIS_VERSION_SUB           )        /*!< CMSIS HAL version number */
-
 
78
 
-
 
79
#define __CORTEX_M                (0x07U)                                      /*!< 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 CM7 definitions */
93
  #define __ASM            __asm                                      /*!< asm keyword for GNU Compiler */
66
#define __CM7_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 __CM7_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 __CM7_CMSIS_VERSION       ((__CM7_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
                                    __CM7_CMSIS_VERSION_SUB           )      /*!< \deprecated CMSIS HAL version number */
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
 
70
 
117
#else
-
 
118
  #error Unknown compiler
71
#define __CORTEX_M                (7U)                                       /*!< Cortex-M Core */
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 380... Line 331...
380
typedef union
331
typedef union
381
{
332
{
382
  struct
333
  struct
383
  {
334
  {
384
    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number */
335
    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number */
385
    uint32_t _reserved0:7;               /*!< bit:  9..15  Reserved */
336
    uint32_t _reserved0:1;               /*!< bit:      9  Reserved */
-
 
337
    uint32_t ICI_IT_1:6;                 /*!< bit: 10..15  ICI/IT part 1 */
386
    uint32_t GE:4;                       /*!< bit: 16..19  Greater than or Equal flags */
338
    uint32_t GE:4;                       /*!< bit: 16..19  Greater than or Equal flags */
387
    uint32_t _reserved1:4;               /*!< bit: 20..23  Reserved */
339
    uint32_t _reserved1:4;               /*!< bit: 20..23  Reserved */
388
    uint32_t T:1;                        /*!< bit:     24  Thumb bit        (read 0) */
340
    uint32_t T:1;                        /*!< bit:     24  Thumb bit */
389
    uint32_t IT:2;                       /*!< bit: 25..26  saved IT state   (read 0) */
341
    uint32_t ICI_IT_2:2;                 /*!< bit: 25..26  ICI/IT part 2 */
390
    uint32_t Q:1;                        /*!< bit:     27  Saturation condition flag */
342
    uint32_t Q:1;                        /*!< bit:     27  Saturation condition flag */
391
    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag */
343
    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag */
392
    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag */
344
    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag */
393
    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag */
345
    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag */
394
    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag */
346
    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag */
Line 410... Line 362...
410
#define xPSR_V_Msk                         (1UL << xPSR_V_Pos)                            /*!< xPSR: V Mask */
362
#define xPSR_V_Msk                         (1UL << xPSR_V_Pos)                            /*!< xPSR: V Mask */
411
 
363
 
412
#define xPSR_Q_Pos                         27U                                            /*!< xPSR: Q Position */
364
#define xPSR_Q_Pos                         27U                                            /*!< xPSR: Q Position */
413
#define xPSR_Q_Msk                         (1UL << xPSR_Q_Pos)                            /*!< xPSR: Q Mask */
365
#define xPSR_Q_Msk                         (1UL << xPSR_Q_Pos)                            /*!< xPSR: Q Mask */
414
 
366
 
415
#define xPSR_IT_Pos                        25U                                            /*!< xPSR: IT Position */
367
#define xPSR_ICI_IT_2_Pos                  25U                                            /*!< xPSR: ICI/IT part 2 Position */
416
#define xPSR_IT_Msk                        (3UL << xPSR_IT_Pos)                           /*!< xPSR: IT Mask */
368
#define xPSR_ICI_IT_2_Msk                  (3UL << xPSR_ICI_IT_2_Pos)                     /*!< xPSR: ICI/IT part 2 Mask */
417
 
369
 
418
#define xPSR_T_Pos                         24U                                            /*!< xPSR: T Position */
370
#define xPSR_T_Pos                         24U                                            /*!< xPSR: T Position */
419
#define xPSR_T_Msk                         (1UL << xPSR_T_Pos)                            /*!< xPSR: T Mask */
371
#define xPSR_T_Msk                         (1UL << xPSR_T_Pos)                            /*!< xPSR: T Mask */
420
 
372
 
421
#define xPSR_GE_Pos                        16U                                            /*!< xPSR: GE Position */
373
#define xPSR_GE_Pos                        16U                                            /*!< xPSR: GE Position */
422
#define xPSR_GE_Msk                        (0xFUL << xPSR_GE_Pos)                         /*!< xPSR: GE Mask */
374
#define xPSR_GE_Msk                        (0xFUL << xPSR_GE_Pos)                         /*!< xPSR: GE Mask */
423
 
375
 
-
 
376
#define xPSR_ICI_IT_1_Pos                  10U                                            /*!< xPSR: ICI/IT part 1 Position */
-
 
377
#define xPSR_ICI_IT_1_Msk                  (0x3FUL << xPSR_ICI_IT_1_Pos)                  /*!< xPSR: ICI/IT part 1 Mask */
-
 
378
 
424
#define xPSR_ISR_Pos                        0U                                            /*!< xPSR: ISR Position */
379
#define xPSR_ISR_Pos                        0U                                            /*!< xPSR: ISR Position */
425
#define xPSR_ISR_Msk                       (0x1FFUL /*<< xPSR_ISR_Pos*/)                  /*!< xPSR: ISR Mask */
380
#define xPSR_ISR_Msk                       (0x1FFUL /*<< xPSR_ISR_Pos*/)                  /*!< xPSR: ISR Mask */
426
 
381
 
427
 
382
 
428
/**
383
/**
Line 527... Line 482...
527
        uint32_t RESERVED3[93U];
482
        uint32_t RESERVED3[93U];
528
  __OM  uint32_t STIR;                   /*!< Offset: 0x200 ( /W)  Software Triggered Interrupt Register */
483
  __OM  uint32_t STIR;                   /*!< Offset: 0x200 ( /W)  Software Triggered Interrupt Register */
529
        uint32_t RESERVED4[15U];
484
        uint32_t RESERVED4[15U];
530
  __IM  uint32_t MVFR0;                  /*!< Offset: 0x240 (R/ )  Media and VFP Feature Register 0 */
485
  __IM  uint32_t MVFR0;                  /*!< Offset: 0x240 (R/ )  Media and VFP Feature Register 0 */
531
  __IM  uint32_t MVFR1;                  /*!< Offset: 0x244 (R/ )  Media and VFP Feature Register 1 */
486
  __IM  uint32_t MVFR1;                  /*!< Offset: 0x244 (R/ )  Media and VFP Feature Register 1 */
532
  __IM  uint32_t MVFR2;                  /*!< Offset: 0x248 (R/ )  Media and VFP Feature Register 1 */
487
  __IM  uint32_t MVFR2;                  /*!< Offset: 0x248 (R/ )  Media and VFP Feature Register 2 */
533
        uint32_t RESERVED5[1U];
488
        uint32_t RESERVED5[1U];
534
  __OM  uint32_t ICIALLU;                /*!< Offset: 0x250 ( /W)  I-Cache Invalidate All to PoU */
489
  __OM  uint32_t ICIALLU;                /*!< Offset: 0x250 ( /W)  I-Cache Invalidate All to PoU */
535
        uint32_t RESERVED6[1U];
490
        uint32_t RESERVED6[1U];
536
  __OM  uint32_t ICIMVAU;                /*!< Offset: 0x258 ( /W)  I-Cache Invalidate by MVA to PoU */
491
  __OM  uint32_t ICIMVAU;                /*!< Offset: 0x258 ( /W)  I-Cache Invalidate by MVA to PoU */
537
  __OM  uint32_t DCIMVAC;                /*!< Offset: 0x25C ( /W)  D-Cache Invalidate by MVA to PoC */
492
  __OM  uint32_t DCIMVAC;                /*!< Offset: 0x25C ( /W)  D-Cache Invalidate by MVA to PoC */
Line 713... Line 668...
713
#define SCB_CFSR_BUSFAULTSR_Msk            (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos)            /*!< SCB CFSR: Bus Fault Status Register Mask */
668
#define SCB_CFSR_BUSFAULTSR_Msk            (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos)            /*!< SCB CFSR: Bus Fault Status Register Mask */
714
 
669
 
715
#define SCB_CFSR_MEMFAULTSR_Pos             0U                                            /*!< SCB CFSR: Memory Manage Fault Status Register Position */
670
#define SCB_CFSR_MEMFAULTSR_Pos             0U                                            /*!< SCB CFSR: Memory Manage Fault Status Register Position */
716
#define SCB_CFSR_MEMFAULTSR_Msk            (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/)        /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
671
#define SCB_CFSR_MEMFAULTSR_Msk            (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/)        /*!< SCB CFSR: Memory Manage Fault Status Register Mask */
717
 
672
 
-
 
673
/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */
-
 
674
#define SCB_CFSR_MMARVALID_Pos             (SCB_SHCSR_MEMFAULTACT_Pos + 7U)               /*!< SCB CFSR (MMFSR): MMARVALID Position */
-
 
675
#define SCB_CFSR_MMARVALID_Msk             (1UL << SCB_CFSR_MMARVALID_Pos)                /*!< SCB CFSR (MMFSR): MMARVALID Mask */
-
 
676
 
-
 
677
#define SCB_CFSR_MLSPERR_Pos               (SCB_SHCSR_MEMFAULTACT_Pos + 5U)               /*!< SCB CFSR (MMFSR): MLSPERR Position */
-
 
678
#define SCB_CFSR_MLSPERR_Msk               (1UL << SCB_CFSR_MLSPERR_Pos)                  /*!< SCB CFSR (MMFSR): MLSPERR Mask */
-
 
679
 
-
 
680
#define SCB_CFSR_MSTKERR_Pos               (SCB_SHCSR_MEMFAULTACT_Pos + 4U)               /*!< SCB CFSR (MMFSR): MSTKERR Position */
-
 
681
#define SCB_CFSR_MSTKERR_Msk               (1UL << SCB_CFSR_MSTKERR_Pos)                  /*!< SCB CFSR (MMFSR): MSTKERR Mask */
-
 
682
 
-
 
683
#define SCB_CFSR_MUNSTKERR_Pos             (SCB_SHCSR_MEMFAULTACT_Pos + 3U)               /*!< SCB CFSR (MMFSR): MUNSTKERR Position */
-
 
684
#define SCB_CFSR_MUNSTKERR_Msk             (1UL << SCB_CFSR_MUNSTKERR_Pos)                /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */
-
 
685
 
-
 
686
#define SCB_CFSR_DACCVIOL_Pos              (SCB_SHCSR_MEMFAULTACT_Pos + 1U)               /*!< SCB CFSR (MMFSR): DACCVIOL Position */
-
 
687
#define SCB_CFSR_DACCVIOL_Msk              (1UL << SCB_CFSR_DACCVIOL_Pos)                 /*!< SCB CFSR (MMFSR): DACCVIOL Mask */
-
 
688
 
-
 
689
#define SCB_CFSR_IACCVIOL_Pos              (SCB_SHCSR_MEMFAULTACT_Pos + 0U)               /*!< SCB CFSR (MMFSR): IACCVIOL Position */
-
 
690
#define SCB_CFSR_IACCVIOL_Msk              (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/)             /*!< SCB CFSR (MMFSR): IACCVIOL Mask */
-
 
691
 
-
 
692
/* BusFault Status Register (part of SCB Configurable Fault Status Register) */
-
 
693
#define SCB_CFSR_BFARVALID_Pos            (SCB_CFSR_BUSFAULTSR_Pos + 7U)                  /*!< SCB CFSR (BFSR): BFARVALID Position */
-
 
694
#define SCB_CFSR_BFARVALID_Msk            (1UL << SCB_CFSR_BFARVALID_Pos)                 /*!< SCB CFSR (BFSR): BFARVALID Mask */
-
 
695
 
-
 
696
#define SCB_CFSR_LSPERR_Pos               (SCB_CFSR_BUSFAULTSR_Pos + 5U)                  /*!< SCB CFSR (BFSR): LSPERR Position */
-
 
697
#define SCB_CFSR_LSPERR_Msk               (1UL << SCB_CFSR_LSPERR_Pos)                    /*!< SCB CFSR (BFSR): LSPERR Mask */
-
 
698
 
-
 
699
#define SCB_CFSR_STKERR_Pos               (SCB_CFSR_BUSFAULTSR_Pos + 4U)                  /*!< SCB CFSR (BFSR): STKERR Position */
-
 
700
#define SCB_CFSR_STKERR_Msk               (1UL << SCB_CFSR_STKERR_Pos)                    /*!< SCB CFSR (BFSR): STKERR Mask */
-
 
701
 
-
 
702
#define SCB_CFSR_UNSTKERR_Pos             (SCB_CFSR_BUSFAULTSR_Pos + 3U)                  /*!< SCB CFSR (BFSR): UNSTKERR Position */
-
 
703
#define SCB_CFSR_UNSTKERR_Msk             (1UL << SCB_CFSR_UNSTKERR_Pos)                  /*!< SCB CFSR (BFSR): UNSTKERR Mask */
-
 
704
 
-
 
705
#define SCB_CFSR_IMPRECISERR_Pos          (SCB_CFSR_BUSFAULTSR_Pos + 2U)                  /*!< SCB CFSR (BFSR): IMPRECISERR Position */
-
 
706
#define SCB_CFSR_IMPRECISERR_Msk          (1UL << SCB_CFSR_IMPRECISERR_Pos)               /*!< SCB CFSR (BFSR): IMPRECISERR Mask */
-
 
707
 
-
 
708
#define SCB_CFSR_PRECISERR_Pos            (SCB_CFSR_BUSFAULTSR_Pos + 1U)                  /*!< SCB CFSR (BFSR): PRECISERR Position */
-
 
709
#define SCB_CFSR_PRECISERR_Msk            (1UL << SCB_CFSR_PRECISERR_Pos)                 /*!< SCB CFSR (BFSR): PRECISERR Mask */
-
 
710
 
-
 
711
#define SCB_CFSR_IBUSERR_Pos              (SCB_CFSR_BUSFAULTSR_Pos + 0U)                  /*!< SCB CFSR (BFSR): IBUSERR Position */
-
 
712
#define SCB_CFSR_IBUSERR_Msk              (1UL << SCB_CFSR_IBUSERR_Pos)                   /*!< SCB CFSR (BFSR): IBUSERR Mask */
-
 
713
 
-
 
714
/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */
-
 
715
#define SCB_CFSR_DIVBYZERO_Pos            (SCB_CFSR_USGFAULTSR_Pos + 9U)                  /*!< SCB CFSR (UFSR): DIVBYZERO Position */
-
 
716
#define SCB_CFSR_DIVBYZERO_Msk            (1UL << SCB_CFSR_DIVBYZERO_Pos)                 /*!< SCB CFSR (UFSR): DIVBYZERO Mask */
-
 
717
 
-
 
718
#define SCB_CFSR_UNALIGNED_Pos            (SCB_CFSR_USGFAULTSR_Pos + 8U)                  /*!< SCB CFSR (UFSR): UNALIGNED Position */
-
 
719
#define SCB_CFSR_UNALIGNED_Msk            (1UL << SCB_CFSR_UNALIGNED_Pos)                 /*!< SCB CFSR (UFSR): UNALIGNED Mask */
-
 
720
 
-
 
721
#define SCB_CFSR_NOCP_Pos                 (SCB_CFSR_USGFAULTSR_Pos + 3U)                  /*!< SCB CFSR (UFSR): NOCP Position */
-
 
722
#define SCB_CFSR_NOCP_Msk                 (1UL << SCB_CFSR_NOCP_Pos)                      /*!< SCB CFSR (UFSR): NOCP Mask */
-
 
723
 
-
 
724
#define SCB_CFSR_INVPC_Pos                (SCB_CFSR_USGFAULTSR_Pos + 2U)                  /*!< SCB CFSR (UFSR): INVPC Position */
-
 
725
#define SCB_CFSR_INVPC_Msk                (1UL << SCB_CFSR_INVPC_Pos)                     /*!< SCB CFSR (UFSR): INVPC Mask */
-
 
726
 
-
 
727
#define SCB_CFSR_INVSTATE_Pos             (SCB_CFSR_USGFAULTSR_Pos + 1U)                  /*!< SCB CFSR (UFSR): INVSTATE Position */
-
 
728
#define SCB_CFSR_INVSTATE_Msk             (1UL << SCB_CFSR_INVSTATE_Pos)                  /*!< SCB CFSR (UFSR): INVSTATE Mask */
-
 
729
 
-
 
730
#define SCB_CFSR_UNDEFINSTR_Pos           (SCB_CFSR_USGFAULTSR_Pos + 0U)                  /*!< SCB CFSR (UFSR): UNDEFINSTR Position */
-
 
731
#define SCB_CFSR_UNDEFINSTR_Msk           (1UL << SCB_CFSR_UNDEFINSTR_Pos)                /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */
-
 
732
 
718
/* SCB Hard Fault Status Register Definitions */
733
/* SCB Hard Fault Status Register Definitions */
719
#define SCB_HFSR_DEBUGEVT_Pos              31U                                            /*!< SCB HFSR: DEBUGEVT Position */
734
#define SCB_HFSR_DEBUGEVT_Pos              31U                                            /*!< SCB HFSR: DEBUGEVT Position */
720
#define SCB_HFSR_DEBUGEVT_Msk              (1UL << SCB_HFSR_DEBUGEVT_Pos)                 /*!< SCB HFSR: DEBUGEVT Mask */
735
#define SCB_HFSR_DEBUGEVT_Msk              (1UL << SCB_HFSR_DEBUGEVT_Pos)                 /*!< SCB HFSR: DEBUGEVT Mask */
721
 
736
 
722
#define SCB_HFSR_FORCED_Pos                30U                                            /*!< SCB HFSR: FORCED Position */
737
#define SCB_HFSR_FORCED_Pos                30U                                            /*!< SCB HFSR: FORCED Position */
Line 1031... Line 1046...
1031
  __IM  uint32_t CID3;                   /*!< Offset: 0xFFC (R/ )  ITM Component  Identification Register #3 */
1046
  __IM  uint32_t CID3;                   /*!< Offset: 0xFFC (R/ )  ITM Component  Identification Register #3 */
1032
} ITM_Type;
1047
} ITM_Type;
1033
 
1048
 
1034
/* ITM Trace Privilege Register Definitions */
1049
/* ITM Trace Privilege Register Definitions */
1035
#define ITM_TPR_PRIVMASK_Pos                0U                                            /*!< ITM TPR: PRIVMASK Position */
1050
#define ITM_TPR_PRIVMASK_Pos                0U                                            /*!< ITM TPR: PRIVMASK Position */
1036
#define ITM_TPR_PRIVMASK_Msk               (0xFUL /*<< ITM_TPR_PRIVMASK_Pos*/)            /*!< ITM TPR: PRIVMASK Mask */
1051
#define ITM_TPR_PRIVMASK_Msk               (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/)     /*!< ITM TPR: PRIVMASK Mask */
1037
 
1052
 
1038
/* ITM Trace Control Register Definitions */
1053
/* ITM Trace Control Register Definitions */
1039
#define ITM_TCR_BUSY_Pos                   23U                                            /*!< ITM TCR: BUSY Position */
1054
#define ITM_TCR_BUSY_Pos                   23U                                            /*!< ITM TCR: BUSY Position */
1040
#define ITM_TCR_BUSY_Msk                   (1UL << ITM_TCR_BUSY_Pos)                      /*!< ITM TCR: BUSY Mask */
1055
#define ITM_TCR_BUSY_Msk                   (1UL << ITM_TCR_BUSY_Pos)                      /*!< ITM TCR: BUSY Mask */
1041
 
1056
 
Line 1248... Line 1263...
1248
/**
1263
/**
1249
  \brief  Structure type to access the Trace Port Interface Register (TPI).
1264
  \brief  Structure type to access the Trace Port Interface Register (TPI).
1250
 */
1265
 */
1251
typedef struct
1266
typedef struct
1252
{
1267
{
1253
  __IOM uint32_t SSPSR;                  /*!< Offset: 0x000 (R/ )  Supported Parallel Port Size Register */
1268
  __IM  uint32_t SSPSR;                  /*!< Offset: 0x000 (R/ )  Supported Parallel Port Size Register */
1254
  __IOM uint32_t CSPSR;                  /*!< Offset: 0x004 (R/W)  Current Parallel Port Size Register */
1269
  __IOM uint32_t CSPSR;                  /*!< Offset: 0x004 (R/W)  Current Parallel Port Size Register */
1255
        uint32_t RESERVED0[2U];
1270
        uint32_t RESERVED0[2U];
1256
  __IOM uint32_t ACPR;                   /*!< Offset: 0x010 (R/W)  Asynchronous Clock Prescaler Register */
1271
  __IOM uint32_t ACPR;                   /*!< Offset: 0x010 (R/W)  Asynchronous Clock Prescaler Register */
1257
        uint32_t RESERVED1[55U];
1272
        uint32_t RESERVED1[55U];
1258
  __IOM uint32_t SPPR;                   /*!< Offset: 0x0F0 (R/W)  Selected Pin Protocol Register */
1273
  __IOM uint32_t SPPR;                   /*!< Offset: 0x0F0 (R/W)  Selected Pin Protocol Register */
1259
        uint32_t RESERVED2[131U];
1274
        uint32_t RESERVED2[131U];
1260
  __IM  uint32_t FFSR;                   /*!< Offset: 0x300 (R/ )  Formatter and Flush Status Register */
1275
  __IM  uint32_t FFSR;                   /*!< Offset: 0x300 (R/ )  Formatter and Flush Status Register */
1261
  __IOM uint32_t FFCR;                   /*!< Offset: 0x304 (R/W)  Formatter and Flush Control Register */
1276
  __IOM uint32_t FFCR;                   /*!< Offset: 0x304 (R/W)  Formatter and Flush Control Register */
1262
  __IM  uint32_t FSCR;                   /*!< Offset: 0x308 (R/ )  Formatter Synchronization Counter Register */
1277
  __IM  uint32_t FSCR;                   /*!< Offset: 0x308 (R/ )  Formatter Synchronization Counter Register */
1263
        uint32_t RESERVED3[759U];
1278
        uint32_t RESERVED3[759U];
1264
  __IM  uint32_t TRIGGER;                /*!< Offset: 0xEE8 (R/ )  TRIGGER */
1279
  __IM  uint32_t TRIGGER;                /*!< Offset: 0xEE8 (R/ )  TRIGGER Register */
1265
  __IM  uint32_t FIFO0;                  /*!< Offset: 0xEEC (R/ )  Integration ETM Data */
1280
  __IM  uint32_t FIFO0;                  /*!< Offset: 0xEEC (R/ )  Integration ETM Data */
1266
  __IM  uint32_t ITATBCTR2;              /*!< Offset: 0xEF0 (R/ )  ITATBCTR2 */
1281
  __IM  uint32_t ITATBCTR2;              /*!< Offset: 0xEF0 (R/ )  ITATBCTR2 */
1267
        uint32_t RESERVED4[1U];
1282
        uint32_t RESERVED4[1U];
1268
  __IM  uint32_t ITATBCTR0;              /*!< Offset: 0xEF8 (R/ )  ITATBCTR0 */
1283
  __IM  uint32_t ITATBCTR0;              /*!< Offset: 0xEF8 (R/ )  ITATBCTR0 */
1269
  __IM  uint32_t FIFO1;                  /*!< Offset: 0xEFC (R/ )  Integration ITM Data */
1284
  __IM  uint32_t FIFO1;                  /*!< Offset: 0xEFC (R/ )  Integration ITM Data */
Line 1329... Line 1344...
1329
 
1344
 
1330
#define TPI_FIFO0_ETM0_Pos                  0U                                         /*!< TPI FIFO0: ETM0 Position */
1345
#define TPI_FIFO0_ETM0_Pos                  0U                                         /*!< TPI FIFO0: ETM0 Position */
1331
#define TPI_FIFO0_ETM0_Msk                 (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/)          /*!< TPI FIFO0: ETM0 Mask */
1346
#define TPI_FIFO0_ETM0_Msk                 (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/)          /*!< TPI FIFO0: ETM0 Mask */
1332
 
1347
 
1333
/* TPI ITATBCTR2 Register Definitions */
1348
/* TPI ITATBCTR2 Register Definitions */
1334
#define TPI_ITATBCTR2_ATREADY_Pos           0U                                         /*!< TPI ITATBCTR2: ATREADY Position */
1349
#define TPI_ITATBCTR2_ATREADY2_Pos          0U                                         /*!< TPI ITATBCTR2: ATREADY2 Position */
-
 
1350
#define TPI_ITATBCTR2_ATREADY2_Msk         (0x1UL /*<< TPI_ITATBCTR2_ATREADY2_Pos*/)   /*!< TPI ITATBCTR2: ATREADY2 Mask */
-
 
1351
 
-
 
1352
#define TPI_ITATBCTR2_ATREADY1_Pos          0U                                         /*!< TPI ITATBCTR2: ATREADY1 Position */
1335
#define TPI_ITATBCTR2_ATREADY_Msk          (0x1UL /*<< TPI_ITATBCTR2_ATREADY_Pos*/)    /*!< TPI ITATBCTR2: ATREADY Mask */
1353
#define TPI_ITATBCTR2_ATREADY1_Msk         (0x1UL /*<< TPI_ITATBCTR2_ATREADY1_Pos*/)   /*!< TPI ITATBCTR2: ATREADY1 Mask */
1336
 
1354
 
1337
/* TPI Integration ITM Data Register Definitions (FIFO1) */
1355
/* TPI Integration ITM Data Register Definitions (FIFO1) */
1338
#define TPI_FIFO1_ITM_ATVALID_Pos          29U                                         /*!< TPI FIFO1: ITM_ATVALID Position */
1356
#define TPI_FIFO1_ITM_ATVALID_Pos          29U                                         /*!< TPI FIFO1: ITM_ATVALID Position */
1339
#define TPI_FIFO1_ITM_ATVALID_Msk          (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos)        /*!< TPI FIFO1: ITM_ATVALID Mask */
1357
#define TPI_FIFO1_ITM_ATVALID_Msk          (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos)        /*!< TPI FIFO1: ITM_ATVALID Mask */
1340
 
1358
 
Line 1355... Line 1373...
1355
 
1373
 
1356
#define TPI_FIFO1_ITM0_Pos                  0U                                         /*!< TPI FIFO1: ITM0 Position */
1374
#define TPI_FIFO1_ITM0_Pos                  0U                                         /*!< TPI FIFO1: ITM0 Position */
1357
#define TPI_FIFO1_ITM0_Msk                 (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/)          /*!< TPI FIFO1: ITM0 Mask */
1375
#define TPI_FIFO1_ITM0_Msk                 (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/)          /*!< TPI FIFO1: ITM0 Mask */
1358
 
1376
 
1359
/* TPI ITATBCTR0 Register Definitions */
1377
/* TPI ITATBCTR0 Register Definitions */
1360
#define TPI_ITATBCTR0_ATREADY_Pos           0U                                         /*!< TPI ITATBCTR0: ATREADY Position */
1378
#define TPI_ITATBCTR0_ATREADY2_Pos          0U                                         /*!< TPI ITATBCTR0: ATREADY2 Position */
-
 
1379
#define TPI_ITATBCTR0_ATREADY2_Msk         (0x1UL /*<< TPI_ITATBCTR0_ATREADY2_Pos*/)   /*!< TPI ITATBCTR0: ATREADY2 Mask */
-
 
1380
 
-
 
1381
#define TPI_ITATBCTR0_ATREADY1_Pos          0U                                         /*!< TPI ITATBCTR0: ATREADY1 Position */
1361
#define TPI_ITATBCTR0_ATREADY_Msk          (0x1UL /*<< TPI_ITATBCTR0_ATREADY_Pos*/)    /*!< TPI ITATBCTR0: ATREADY Mask */
1382
#define TPI_ITATBCTR0_ATREADY1_Msk         (0x1UL /*<< TPI_ITATBCTR0_ATREADY1_Pos*/)   /*!< TPI ITATBCTR0: ATREADY1 Mask */
1362
 
1383
 
1363
/* TPI Integration Mode Control Register Definitions */
1384
/* TPI Integration Mode Control Register Definitions */
1364
#define TPI_ITCTRL_Mode_Pos                 0U                                         /*!< TPI ITCTRL: Mode Position */
1385
#define TPI_ITCTRL_Mode_Pos                 0U                                         /*!< TPI ITCTRL: Mode Position */
1365
#define TPI_ITCTRL_Mode_Msk                (0x1UL /*<< TPI_ITCTRL_Mode_Pos*/)          /*!< TPI ITCTRL: Mode Mask */
1386
#define TPI_ITCTRL_Mode_Msk                (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/)          /*!< TPI ITCTRL: Mode Mask */
1366
 
1387
 
1367
/* TPI DEVID Register Definitions */
1388
/* TPI DEVID Register Definitions */
1368
#define TPI_DEVID_NRZVALID_Pos             11U                                         /*!< TPI DEVID: NRZVALID Position */
1389
#define TPI_DEVID_NRZVALID_Pos             11U                                         /*!< TPI DEVID: NRZVALID Position */
1369
#define TPI_DEVID_NRZVALID_Msk             (0x1UL << TPI_DEVID_NRZVALID_Pos)           /*!< TPI DEVID: NRZVALID Mask */
1390
#define TPI_DEVID_NRZVALID_Msk             (0x1UL << TPI_DEVID_NRZVALID_Pos)           /*!< TPI DEVID: NRZVALID Mask */
1370
 
1391
 
Line 1382... Line 1403...
1382
 
1403
 
1383
#define TPI_DEVID_NrTraceInput_Pos          0U                                         /*!< TPI DEVID: NrTraceInput Position */
1404
#define TPI_DEVID_NrTraceInput_Pos          0U                                         /*!< TPI DEVID: NrTraceInput Position */
1384
#define TPI_DEVID_NrTraceInput_Msk         (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/)  /*!< TPI DEVID: NrTraceInput Mask */
1405
#define TPI_DEVID_NrTraceInput_Msk         (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/)  /*!< TPI DEVID: NrTraceInput Mask */
1385
 
1406
 
1386
/* TPI DEVTYPE Register Definitions */
1407
/* TPI DEVTYPE Register Definitions */
1387
#define TPI_DEVTYPE_MajorType_Pos           4U                                         /*!< TPI DEVTYPE: MajorType Position */
-
 
1388
#define TPI_DEVTYPE_MajorType_Msk          (0xFUL << TPI_DEVTYPE_MajorType_Pos)        /*!< TPI DEVTYPE: MajorType Mask */
-
 
1389
 
-
 
1390
#define TPI_DEVTYPE_SubType_Pos             0U                                         /*!< TPI DEVTYPE: SubType Position */
1408
#define TPI_DEVTYPE_SubType_Pos             4U                                         /*!< TPI DEVTYPE: SubType Position */
1391
#define TPI_DEVTYPE_SubType_Msk            (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/)      /*!< TPI DEVTYPE: SubType Mask */
1409
#define TPI_DEVTYPE_SubType_Msk            (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/)      /*!< TPI DEVTYPE: SubType Mask */
1392
 
1410
 
-
 
1411
#define TPI_DEVTYPE_MajorType_Pos           0U                                         /*!< TPI DEVTYPE: MajorType Position */
-
 
1412
#define TPI_DEVTYPE_MajorType_Msk          (0xFUL << TPI_DEVTYPE_MajorType_Pos)        /*!< TPI DEVTYPE: MajorType Mask */
-
 
1413
 
1393
/*@}*/ /* end of group CMSIS_TPI */
1414
/*@}*/ /* end of group CMSIS_TPI */
1394
 
1415
 
1395
 
1416
 
1396
#if (__MPU_PRESENT == 1U)
1417
#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
1397
/**
1418
/**
1398
  \ingroup  CMSIS_core_register
1419
  \ingroup  CMSIS_core_register
1399
  \defgroup CMSIS_MPU     Memory Protection Unit (MPU)
1420
  \defgroup CMSIS_MPU     Memory Protection Unit (MPU)
1400
  \brief    Type definitions for the Memory Protection Unit (MPU)
1421
  \brief    Type definitions for the Memory Protection Unit (MPU)
1401
  @{
1422
  @{
Line 1417... Line 1438...
1417
  __IOM uint32_t RASR_A2;                /*!< Offset: 0x020 (R/W)  MPU Alias 2 Region Attribute and Size Register */
1438
  __IOM uint32_t RASR_A2;                /*!< Offset: 0x020 (R/W)  MPU Alias 2 Region Attribute and Size Register */
1418
  __IOM uint32_t RBAR_A3;                /*!< Offset: 0x024 (R/W)  MPU Alias 3 Region Base Address Register */
1439
  __IOM uint32_t RBAR_A3;                /*!< Offset: 0x024 (R/W)  MPU Alias 3 Region Base Address Register */
1419
  __IOM uint32_t RASR_A3;                /*!< Offset: 0x028 (R/W)  MPU Alias 3 Region Attribute and Size Register */
1440
  __IOM uint32_t RASR_A3;                /*!< Offset: 0x028 (R/W)  MPU Alias 3 Region Attribute and Size Register */
1420
} MPU_Type;
1441
} MPU_Type;
1421
 
1442
 
-
 
1443
#define MPU_TYPE_RALIASES                  4U
-
 
1444
 
1422
/* MPU Type Register Definitions */
1445
/* MPU Type Register Definitions */
1423
#define MPU_TYPE_IREGION_Pos               16U                                            /*!< MPU TYPE: IREGION Position */
1446
#define MPU_TYPE_IREGION_Pos               16U                                            /*!< MPU TYPE: IREGION Position */
1424
#define MPU_TYPE_IREGION_Msk               (0xFFUL << MPU_TYPE_IREGION_Pos)               /*!< MPU TYPE: IREGION Mask */
1447
#define MPU_TYPE_IREGION_Msk               (0xFFUL << MPU_TYPE_IREGION_Pos)               /*!< MPU TYPE: IREGION Mask */
1425
 
1448
 
1426
#define MPU_TYPE_DREGION_Pos                8U                                            /*!< MPU TYPE: DREGION Position */
1449
#define MPU_TYPE_DREGION_Pos                8U                                            /*!< MPU TYPE: DREGION Position */
Line 1483... Line 1506...
1483
 
1506
 
1484
#define MPU_RASR_ENABLE_Pos                 0U                                            /*!< MPU RASR: Region enable bit Position */
1507
#define MPU_RASR_ENABLE_Pos                 0U                                            /*!< MPU RASR: Region enable bit Position */
1485
#define MPU_RASR_ENABLE_Msk                (1UL /*<< MPU_RASR_ENABLE_Pos*/)               /*!< MPU RASR: Region enable bit Disable Mask */
1508
#define MPU_RASR_ENABLE_Msk                (1UL /*<< MPU_RASR_ENABLE_Pos*/)               /*!< MPU RASR: Region enable bit Disable Mask */
1486
 
1509
 
1487
/*@} end of group CMSIS_MPU */
1510
/*@} end of group CMSIS_MPU */
1488
#endif
1511
#endif /* defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) */
1489
 
1512
 
1490
 
1513
 
1491
#if (__FPU_PRESENT == 1U)
-
 
1492
/**
1514
/**
1493
  \ingroup  CMSIS_core_register
1515
  \ingroup  CMSIS_core_register
1494
  \defgroup CMSIS_FPU     Floating Point Unit (FPU)
1516
  \defgroup CMSIS_FPU     Floating Point Unit (FPU)
1495
  \brief    Type definitions for the Floating Point Unit (FPU)
1517
  \brief    Type definitions for the Floating Point Unit (FPU)
1496
  @{
1518
  @{
Line 1594... Line 1616...
1594
#define FPU_MVFR1_FtZ_mode_Msk             (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/)          /*!< MVFR1: FtZ mode bits Mask */
1616
#define FPU_MVFR1_FtZ_mode_Msk             (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/)          /*!< MVFR1: FtZ mode bits Mask */
1595
 
1617
 
1596
/* Media and FP Feature Register 2 Definitions */
1618
/* Media and FP Feature Register 2 Definitions */
1597
 
1619
 
1598
/*@} end of group CMSIS_FPU */
1620
/*@} end of group CMSIS_FPU */
1599
#endif
-
 
1600
 
1621
 
1601
 
1622
 
1602
/**
1623
/**
1603
  \ingroup  CMSIS_core_register
1624
  \ingroup  CMSIS_core_register
1604
  \defgroup CMSIS_CoreDebug       Core Debug Registers (CoreDebug)
1625
  \defgroup CMSIS_CoreDebug       Core Debug Registers (CoreDebug)
Line 1712... Line 1733...
1712
 */
1733
 */
1713
 
1734
 
1714
/**
1735
/**
1715
  \brief   Mask and shift a bit field value for use in a register bit range.
1736
  \brief   Mask and shift a bit field value for use in a register bit range.
1716
  \param[in] field  Name of the register bit field.
1737
  \param[in] field  Name of the register bit field.
1717
  \param[in] value  Value of the bit field.
1738
  \param[in] value  Value of the bit field. This parameter is interpreted as an uint32_t type.
1718
  \return           Masked and shifted value.
1739
  \return           Masked and shifted value.
1719
*/
1740
*/
1720
#define _VAL2FLD(field, value)    ((value << field ## _Pos) & field ## _Msk)
1741
#define _VAL2FLD(field, value)    (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
1721
 
1742
 
1722
/**
1743
/**
1723
  \brief     Mask and shift a register value to extract a bit filed value.
1744
  \brief     Mask and shift a register value to extract a bit filed value.
1724
  \param[in] field  Name of the register bit field.
1745
  \param[in] field  Name of the register bit field.
1725
  \param[in] value  Value of register.
1746
  \param[in] value  Value of register. This parameter is interpreted as an uint32_t type.
1726
  \return           Masked and shifted bit field value.
1747
  \return           Masked and shifted bit field value.
1727
*/
1748
*/
1728
#define _FLD2VAL(field, value)    ((value & field ## _Msk) >> field ## _Pos)
1749
#define _FLD2VAL(field, value)    (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
1729
 
1750
 
1730
/*@} end of group CMSIS_core_bitfield */
1751
/*@} end of group CMSIS_core_bitfield */
1731
 
1752
 
1732
 
1753
 
1733
/**
1754
/**
Line 1735... Line 1756...
1735
  \defgroup   CMSIS_core_base     Core Definitions
1756
  \defgroup   CMSIS_core_base     Core Definitions
1736
  \brief      Definitions for base addresses, unions, and structures.
1757
  \brief      Definitions for base addresses, unions, and structures.
1737
  @{
1758
  @{
1738
 */
1759
 */
1739
 
1760
 
1740
/* Memory mapping of Cortex-M4 Hardware */
1761
/* Memory mapping of Core Hardware */
1741
#define SCS_BASE            (0xE000E000UL)                            /*!< System Control Space Base Address */
1762
#define SCS_BASE            (0xE000E000UL)                            /*!< System Control Space Base Address */
1742
#define ITM_BASE            (0xE0000000UL)                            /*!< ITM Base Address */
1763
#define ITM_BASE            (0xE0000000UL)                            /*!< ITM Base Address */
1743
#define DWT_BASE            (0xE0001000UL)                            /*!< DWT Base Address */
1764
#define DWT_BASE            (0xE0001000UL)                            /*!< DWT Base Address */
1744
#define TPI_BASE            (0xE0040000UL)                            /*!< TPI Base Address */
1765
#define TPI_BASE            (0xE0040000UL)                            /*!< TPI Base Address */
1745
#define CoreDebug_BASE      (0xE000EDF0UL)                            /*!< Core Debug Base Address */
1766
#define CoreDebug_BASE      (0xE000EDF0UL)                            /*!< Core Debug Base Address */
Line 1754... Line 1775...
1754
#define ITM                 ((ITM_Type       *)     ITM_BASE      )   /*!< ITM configuration struct */
1775
#define ITM                 ((ITM_Type       *)     ITM_BASE      )   /*!< ITM configuration struct */
1755
#define DWT                 ((DWT_Type       *)     DWT_BASE      )   /*!< DWT configuration struct */
1776
#define DWT                 ((DWT_Type       *)     DWT_BASE      )   /*!< DWT configuration struct */
1756
#define TPI                 ((TPI_Type       *)     TPI_BASE      )   /*!< TPI configuration struct */
1777
#define TPI                 ((TPI_Type       *)     TPI_BASE      )   /*!< TPI configuration struct */
1757
#define CoreDebug           ((CoreDebug_Type *)     CoreDebug_BASE)   /*!< Core Debug configuration struct */
1778
#define CoreDebug           ((CoreDebug_Type *)     CoreDebug_BASE)   /*!< Core Debug configuration struct */
1758
 
1779
 
1759
#if (__MPU_PRESENT == 1U)
1780
#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
1760
  #define MPU_BASE          (SCS_BASE +  0x0D90UL)                    /*!< Memory Protection Unit */
1781
  #define MPU_BASE          (SCS_BASE +  0x0D90UL)                    /*!< Memory Protection Unit */
1761
  #define MPU               ((MPU_Type       *)     MPU_BASE      )   /*!< Memory Protection Unit */
1782
  #define MPU               ((MPU_Type       *)     MPU_BASE      )   /*!< Memory Protection Unit */
1762
#endif
1783
#endif
1763
 
1784
 
1764
#if (__FPU_PRESENT == 1U)
-
 
1765
  #define FPU_BASE          (SCS_BASE +  0x0F30UL)                    /*!< Floating Point Unit */
1785
#define FPU_BASE            (SCS_BASE +  0x0F30UL)                    /*!< Floating Point Unit */
1766
  #define FPU               ((FPU_Type       *)     FPU_BASE      )   /*!< Floating Point Unit */
1786
#define FPU                 ((FPU_Type       *)     FPU_BASE      )   /*!< Floating Point Unit */
1767
#endif
-
 
1768
 
1787
 
1769
/*@} */
1788
/*@} */
1770
 
1789
 
1771
 
1790
 
1772
 
1791
 
Line 1790... Line 1809...
1790
  \defgroup CMSIS_Core_NVICFunctions NVIC Functions
1809
  \defgroup CMSIS_Core_NVICFunctions NVIC Functions
1791
  \brief    Functions that manage interrupts and exceptions via the NVIC.
1810
  \brief    Functions that manage interrupts and exceptions via the NVIC.
1792
  @{
1811
  @{
1793
 */
1812
 */
1794
 
1813
 
-
 
1814
#ifdef CMSIS_NVIC_VIRTUAL
-
 
1815
  #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
-
 
1816
    #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
-
 
1817
  #endif
-
 
1818
  #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
-
 
1819
#else
-
 
1820
  #define NVIC_SetPriorityGrouping    __NVIC_SetPriorityGrouping
-
 
1821
  #define NVIC_GetPriorityGrouping    __NVIC_GetPriorityGrouping
-
 
1822
  #define NVIC_EnableIRQ              __NVIC_EnableIRQ
-
 
1823
  #define NVIC_GetEnableIRQ           __NVIC_GetEnableIRQ
-
 
1824
  #define NVIC_DisableIRQ             __NVIC_DisableIRQ
-
 
1825
  #define NVIC_GetPendingIRQ          __NVIC_GetPendingIRQ
-
 
1826
  #define NVIC_SetPendingIRQ          __NVIC_SetPendingIRQ
-
 
1827
  #define NVIC_ClearPendingIRQ        __NVIC_ClearPendingIRQ
-
 
1828
  #define NVIC_GetActive              __NVIC_GetActive
-
 
1829
  #define NVIC_SetPriority            __NVIC_SetPriority
-
 
1830
  #define NVIC_GetPriority            __NVIC_GetPriority
-
 
1831
  #define NVIC_SystemReset            __NVIC_SystemReset
-
 
1832
#endif /* CMSIS_NVIC_VIRTUAL */
-
 
1833
 
-
 
1834
#ifdef CMSIS_VECTAB_VIRTUAL
-
 
1835
  #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
-
 
1836
    #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
-
 
1837
  #endif
-
 
1838
  #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
-
 
1839
#else
-
 
1840
  #define NVIC_SetVector              __NVIC_SetVector
-
 
1841
  #define NVIC_GetVector              __NVIC_GetVector
-
 
1842
#endif  /* (CMSIS_VECTAB_VIRTUAL) */
-
 
1843
 
-
 
1844
#define NVIC_USER_IRQ_OFFSET          16
-
 
1845
 
-
 
1846
 
-
 
1847
/* The following EXC_RETURN values are saved the LR on exception entry */
-
 
1848
#define EXC_RETURN_HANDLER         (0xFFFFFFF1UL)     /* return to Handler mode, uses MSP after return                               */
-
 
1849
#define EXC_RETURN_THREAD_MSP      (0xFFFFFFF9UL)     /* return to Thread mode, uses MSP after return                                */
-
 
1850
#define EXC_RETURN_THREAD_PSP      (0xFFFFFFFDUL)     /* return to Thread mode, uses PSP after return                                */
-
 
1851
#define EXC_RETURN_HANDLER_FPU     (0xFFFFFFE1UL)     /* return to Handler mode, uses MSP after return, restore floating-point state */
-
 
1852
#define EXC_RETURN_THREAD_MSP_FPU  (0xFFFFFFE9UL)     /* return to Thread mode, uses MSP after return, restore floating-point state  */
-
 
1853
#define EXC_RETURN_THREAD_PSP_FPU  (0xFFFFFFEDUL)     /* return to Thread mode, uses PSP after return, restore floating-point state  */
-
 
1854
 
-
 
1855
 
1795
/**
1856
/**
1796
  \brief   Set Priority Grouping
1857
  \brief   Set Priority Grouping
1797
  \details Sets the priority grouping field using the required unlock sequence.
1858
  \details Sets the priority grouping field using the required unlock sequence.
1798
           The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
1859
           The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
1799
           Only values from 0..7 are used.
1860
           Only values from 0..7 are used.
1800
           In case of a conflict between priority grouping and available
1861
           In case of a conflict between priority grouping and available
1801
           priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
1862
           priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
1802
  \param [in]      PriorityGroup  Priority grouping field.
1863
  \param [in]      PriorityGroup  Priority grouping field.
1803
 */
1864
 */
1804
__STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
1865
__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
1805
{
1866
{
1806
  uint32_t reg_value;
1867
  uint32_t reg_value;
1807
  uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL);             /* only values 0..7 are used          */
1868
  uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL);             /* only values 0..7 are used          */
1808
 
1869
 
1809
  reg_value  =  SCB->AIRCR;                                                   /* read old register configuration    */
1870
  reg_value  =  SCB->AIRCR;                                                   /* read old register configuration    */
1810
  reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change               */
1871
  reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change               */
1811
  reg_value  =  (reg_value                                   |
1872
  reg_value  =  (reg_value                                   |
1812
                ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
1873
                ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
1813
                (PriorityGroupTmp << 8U)                      );              /* Insert write key and priorty group */
1874
                (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos)  );              /* Insert write key and priority group */
1814
  SCB->AIRCR =  reg_value;
1875
  SCB->AIRCR =  reg_value;
1815
}
1876
}
1816
 
1877
 
1817
 
1878
 
1818
/**
1879
/**
1819
  \brief   Get Priority Grouping
1880
  \brief   Get Priority Grouping
1820
  \details Reads the priority grouping field from the NVIC Interrupt Controller.
1881
  \details Reads the priority grouping field from the NVIC Interrupt Controller.
1821
  \return                Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
1882
  \return                Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
1822
 */
1883
 */
1823
__STATIC_INLINE uint32_t NVIC_GetPriorityGrouping(void)
1884
__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void)
1824
{
1885
{
1825
  return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
1886
  return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
1826
}
1887
}
1827
 
1888
 
1828
 
1889
 
1829
/**
1890
/**
1830
  \brief   Enable External Interrupt
1891
  \brief   Enable Interrupt
1831
  \details Enables a device-specific interrupt in the NVIC interrupt controller.
1892
  \details Enables a device specific interrupt in the NVIC interrupt controller.
1832
  \param [in]      IRQn  External interrupt number. Value cannot be negative.
1893
  \param [in]      IRQn  Device specific interrupt number.
-
 
1894
  \note    IRQn must not be negative.
1833
 */
1895
 */
1834
__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
1896
__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
1835
{
1897
{
-
 
1898
  if ((int32_t)(IRQn) >= 0)
-
 
1899
  {
1836
  NVIC->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
1900
    NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
-
 
1901
  }
1837
}
1902
}
1838
 
1903
 
1839
 
1904
 
1840
/**
1905
/**
1841
  \brief   Disable External Interrupt
1906
  \brief   Get Interrupt Enable status
1842
  \details Disables a device-specific interrupt in the NVIC interrupt controller.
1907
  \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
1843
  \param [in]      IRQn  External interrupt number. Value cannot be negative.
1908
  \param [in]      IRQn  Device specific interrupt number.
-
 
1909
  \return             0  Interrupt is not enabled.
-
 
1910
  \return             1  Interrupt is enabled.
-
 
1911
  \note    IRQn must not be negative.
1844
 */
1912
 */
1845
__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
1913
__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
1846
{
1914
{
-
 
1915
  if ((int32_t)(IRQn) >= 0)
-
 
1916
  {
-
 
1917
    return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
-
 
1918
  }
-
 
1919
  else
-
 
1920
  {
-
 
1921
    return(0U);
-
 
1922
  }
-
 
1923
}
-
 
1924
 
-
 
1925
 
-
 
1926
/**
-
 
1927
  \brief   Disable Interrupt
-
 
1928
  \details Disables a device specific interrupt in the NVIC interrupt controller.
-
 
1929
  \param [in]      IRQn  Device specific interrupt number.
-
 
1930
  \note    IRQn must not be negative.
-
 
1931
 */
-
 
1932
__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
-
 
1933
{
-
 
1934
  if ((int32_t)(IRQn) >= 0)
-
 
1935
  {
1847
  NVIC->ICER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
1936
    NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
-
 
1937
    __DSB();
-
 
1938
    __ISB();
-
 
1939
  }
1848
}
1940
}
1849
 
1941
 
1850
 
1942
 
1851
/**
1943
/**
1852
  \brief   Get Pending Interrupt
1944
  \brief   Get Pending Interrupt
1853
  \details Reads the pending register in the NVIC and returns the pending bit for the specified interrupt.
1945
  \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
1854
  \param [in]      IRQn  Interrupt number.
1946
  \param [in]      IRQn  Device specific interrupt number.
1855
  \return             0  Interrupt status is not pending.
1947
  \return             0  Interrupt status is not pending.
1856
  \return             1  Interrupt status is pending.
1948
  \return             1  Interrupt status is pending.
-
 
1949
  \note    IRQn must not be negative.
1857
 */
1950
 */
1858
__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
1951
__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
1859
{
1952
{
-
 
1953
  if ((int32_t)(IRQn) >= 0)
-
 
1954
  {
1860
  return((uint32_t)(((NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
1955
    return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
-
 
1956
  }
-
 
1957
  else
-
 
1958
  {
-
 
1959
    return(0U);
-
 
1960
  }
1861
}
1961
}
1862
 
1962
 
1863
 
1963
 
1864
/**
1964
/**
1865
  \brief   Set Pending Interrupt
1965
  \brief   Set Pending Interrupt
1866
  \details Sets the pending bit of an external interrupt.
1966
  \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
1867
  \param [in]      IRQn  Interrupt number. Value cannot be negative.
1967
  \param [in]      IRQn  Device specific interrupt number.
-
 
1968
  \note    IRQn must not be negative.
1868
 */
1969
 */
1869
__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
1970
__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
1870
{
1971
{
-
 
1972
  if ((int32_t)(IRQn) >= 0)
-
 
1973
  {
1871
  NVIC->ISPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
1974
    NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
-
 
1975
  }
1872
}
1976
}
1873
 
1977
 
1874
 
1978
 
1875
/**
1979
/**
1876
  \brief   Clear Pending Interrupt
1980
  \brief   Clear Pending Interrupt
1877
  \details Clears the pending bit of an external interrupt.
1981
  \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
1878
  \param [in]      IRQn  External interrupt number. Value cannot be negative.
1982
  \param [in]      IRQn  Device specific interrupt number.
-
 
1983
  \note    IRQn must not be negative.
1879
 */
1984
 */
1880
__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
1985
__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
1881
{
1986
{
-
 
1987
  if ((int32_t)(IRQn) >= 0)
-
 
1988
  {
1882
  NVIC->ICPR[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
1989
    NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
-
 
1990
  }
1883
}
1991
}
1884
 
1992
 
1885
 
1993
 
1886
/**
1994
/**
1887
  \brief   Get Active Interrupt
1995
  \brief   Get Active Interrupt
1888
  \details Reads the active register in NVIC and returns the active bit.
1996
  \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
1889
  \param [in]      IRQn  Interrupt number.
1997
  \param [in]      IRQn  Device specific interrupt number.
1890
  \return             0  Interrupt status is not active.
1998
  \return             0  Interrupt status is not active.
1891
  \return             1  Interrupt status is active.
1999
  \return             1  Interrupt status is active.
-
 
2000
  \note    IRQn must not be negative.
1892
 */
2001
 */
1893
__STATIC_INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn)
2002
__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
1894
{
2003
{
-
 
2004
  if ((int32_t)(IRQn) >= 0)
-
 
2005
  {
1895
  return((uint32_t)(((NVIC->IABR[(((uint32_t)(int32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
2006
    return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
-
 
2007
  }
-
 
2008
  else
-
 
2009
  {
-
 
2010
    return(0U);
-
 
2011
  }
1896
}
2012
}
1897
 
2013
 
1898
 
2014
 
1899
/**
2015
/**
1900
  \brief   Set Interrupt Priority
2016
  \brief   Set Interrupt Priority
1901
  \details Sets the priority of an interrupt.
2017
  \details Sets the priority of a device specific interrupt or a processor exception.
1902
  \note    The priority cannot be set for every core interrupt.
2018
           The interrupt number can be positive to specify a device specific interrupt,
-
 
2019
           or negative to specify a processor exception.
1903
  \param [in]      IRQn  Interrupt number.
2020
  \param [in]      IRQn  Interrupt number.
1904
  \param [in]  priority  Priority to set.
2021
  \param [in]  priority  Priority to set.
-
 
2022
  \note    The priority cannot be set for every processor exception.
1905
 */
2023
 */
1906
__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
2024
__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
1907
{
2025
{
1908
  if ((int32_t)(IRQn) < 0)
2026
  if ((int32_t)(IRQn) >= 0)
1909
  {
2027
  {
1910
    SCB->SHPR[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
2028
    NVIC->IP[((uint32_t)IRQn)]                = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
1911
  }
2029
  }
1912
  else
2030
  else
1913
  {
2031
  {
1914
    NVIC->IP[((uint32_t)(int32_t)IRQn)]                = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
2032
    SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL);
1915
  }
2033
  }
1916
}
2034
}
1917
 
2035
 
1918
 
2036
 
1919
/**
2037
/**
1920
  \brief   Get Interrupt Priority
2038
  \brief   Get Interrupt Priority
1921
  \details Reads the priority of an interrupt.
2039
  \details Reads the priority of a device specific interrupt or a processor exception.
1922
           The interrupt number can be positive to specify an external (device specific) interrupt,
2040
           The interrupt number can be positive to specify a device specific interrupt,
1923
           or negative to specify an internal (core) interrupt.
2041
           or negative to specify a processor exception.
1924
  \param [in]   IRQn  Interrupt number.
2042
  \param [in]   IRQn  Interrupt number.
1925
  \return             Interrupt Priority.
2043
  \return             Interrupt Priority.
1926
                      Value is aligned automatically to the implemented priority bits of the microcontroller.
2044
                      Value is aligned automatically to the implemented priority bits of the microcontroller.
1927
 */
2045
 */
1928
__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
2046
__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
1929
{
2047
{
1930
 
2048
 
1931
  if ((int32_t)(IRQn) < 0)
2049
  if ((int32_t)(IRQn) >= 0)
1932
  {
2050
  {
1933
    return(((uint32_t)SCB->SHPR[(((uint32_t)(int32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
2051
    return(((uint32_t)NVIC->IP[((uint32_t)IRQn)]                >> (8U - __NVIC_PRIO_BITS)));
1934
  }
2052
  }
1935
  else
2053
  else
1936
  {
2054
  {
1937
    return(((uint32_t)NVIC->IP[((uint32_t)(int32_t)IRQn)]                >> (8U - __NVIC_PRIO_BITS)));
2055
    return(((uint32_t)SCB->SHPR[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS)));
1938
  }
2056
  }
1939
}
2057
}
1940
 
2058
 
1941
 
2059
 
1942
/**
2060
/**
Line 1990... Line 2108...
1990
  *pSubPriority     = (Priority                   ) & (uint32_t)((1UL << (SubPriorityBits    )) - 1UL);
2108
  *pSubPriority     = (Priority                   ) & (uint32_t)((1UL << (SubPriorityBits    )) - 1UL);
1991
}
2109
}
1992
 
2110
 
1993
 
2111
 
1994
/**
2112
/**
-
 
2113
  \brief   Set Interrupt Vector
-
 
2114
  \details Sets an interrupt vector in SRAM based interrupt vector table.
-
 
2115
           The interrupt number can be positive to specify a device specific interrupt,
-
 
2116
           or negative to specify a processor exception.
-
 
2117
           VTOR must been relocated to SRAM before.
-
 
2118
  \param [in]   IRQn      Interrupt number
-
 
2119
  \param [in]   vector    Address of interrupt handler function
-
 
2120
 */
-
 
2121
__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
-
 
2122
{
-
 
2123
  uint32_t *vectors = (uint32_t *)SCB->VTOR;
-
 
2124
  vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
-
 
2125
}
-
 
2126
 
-
 
2127
 
-
 
2128
/**
-
 
2129
  \brief   Get Interrupt Vector
-
 
2130
  \details Reads an interrupt vector from interrupt vector table.
-
 
2131
           The interrupt number can be positive to specify a device specific interrupt,
-
 
2132
           or negative to specify a processor exception.
-
 
2133
  \param [in]   IRQn      Interrupt number.
-
 
2134
  \return                 Address of interrupt handler function
-
 
2135
 */
-
 
2136
__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
-
 
2137
{
-
 
2138
  uint32_t *vectors = (uint32_t *)SCB->VTOR;
-
 
2139
  return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
-
 
2140
}
-
 
2141
 
-
 
2142
 
-
 
2143
/**
1995
  \brief   System Reset
2144
  \brief   System Reset
1996
  \details Initiates a system reset request to reset the MCU.
2145
  \details Initiates a system reset request to reset the MCU.
1997
 */
2146
 */
1998
__STATIC_INLINE void NVIC_SystemReset(void)
2147
__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
1999
{
2148
{
2000
  __DSB();                                                          /* Ensure all outstanding memory accesses included
2149
  __DSB();                                                          /* Ensure all outstanding memory accesses included
2001
                                                                       buffered write are completed before reset */
2150
                                                                       buffered write are completed before reset */
2002
  SCB->AIRCR  = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos)    |
2151
  SCB->AIRCR  = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos)    |
2003
                           (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
2152
                           (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
Line 2010... Line 2159...
2010
  }
2159
  }
2011
}
2160
}
2012
 
2161
 
2013
/*@} end of CMSIS_Core_NVICFunctions */
2162
/*@} end of CMSIS_Core_NVICFunctions */
2014
 
2163
 
-
 
2164
/* ##########################  MPU functions  #################################### */
-
 
2165
 
-
 
2166
#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
-
 
2167
 
-
 
2168
#include "mpu_armv7.h"
-
 
2169
 
-
 
2170
#endif
2015
 
2171
 
2016
/* ##########################  FPU functions  #################################### */
2172
/* ##########################  FPU functions  #################################### */
2017
/**
2173
/**
2018
  \ingroup  CMSIS_Core_FunctionInterface
2174
  \ingroup  CMSIS_Core_FunctionInterface
2019
  \defgroup CMSIS_Core_FpuFunctions FPU Functions
2175
  \defgroup CMSIS_Core_FpuFunctions FPU Functions
Line 2032... Line 2188...
2032
__STATIC_INLINE uint32_t SCB_GetFPUType(void)
2188
__STATIC_INLINE uint32_t SCB_GetFPUType(void)
2033
{
2189
{
2034
  uint32_t mvfr0;
2190
  uint32_t mvfr0;
2035
 
2191
 
2036
  mvfr0 = SCB->MVFR0;
2192
  mvfr0 = SCB->MVFR0;
2037
  if        ((mvfr0 & 0x00000FF0UL) == 0x220UL)
2193
  if      ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x220U)
2038
  {
2194
  {
2039
    return 2UL;           /* Double + Single precision FPU */
2195
    return 2U;           /* Double + Single precision FPU */
2040
  }
2196
  }
2041
  else if ((mvfr0 & 0x00000FF0UL) == 0x020UL)
2197
  else if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U)
2042
  {
2198
  {
2043
    return 1UL;           /* Single precision FPU */
2199
    return 1U;           /* Single precision FPU */
2044
  }
2200
  }
2045
  else
2201
  else
2046
  {
2202
  {
2047
    return 0UL;           /* No FPU */
2203
    return 0U;           /* No FPU */
2048
  }
2204
  }
2049
}
2205
}
2050
 
2206
 
2051
 
2207
 
2052
/*@} end of CMSIS_Core_FpuFunctions */
2208
/*@} end of CMSIS_Core_FpuFunctions */
Line 2070... Line 2226...
2070
  \brief   Enable I-Cache
2226
  \brief   Enable I-Cache
2071
  \details Turns on I-Cache
2227
  \details Turns on I-Cache
2072
  */
2228
  */
2073
__STATIC_INLINE void SCB_EnableICache (void)
2229
__STATIC_INLINE void SCB_EnableICache (void)
2074
{
2230
{
2075
  #if (__ICACHE_PRESENT == 1U)
2231
  #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U)
2076
    __DSB();
2232
    __DSB();
2077
    __ISB();
2233
    __ISB();
2078
    SCB->ICIALLU = 0UL;                     /* invalidate I-Cache */
2234
    SCB->ICIALLU = 0UL;                     /* invalidate I-Cache */
-
 
2235
    __DSB();
-
 
2236
    __ISB();
2079
    SCB->CCR |=  (uint32_t)SCB_CCR_IC_Msk;  /* enable I-Cache */
2237
    SCB->CCR |=  (uint32_t)SCB_CCR_IC_Msk;  /* enable I-Cache */
2080
    __DSB();
2238
    __DSB();
2081
    __ISB();
2239
    __ISB();
2082
  #endif
2240
  #endif
2083
}
2241
}
Line 2087... Line 2245...
2087
  \brief   Disable I-Cache
2245
  \brief   Disable I-Cache
2088
  \details Turns off I-Cache
2246
  \details Turns off I-Cache
2089
  */
2247
  */
2090
__STATIC_INLINE void SCB_DisableICache (void)
2248
__STATIC_INLINE void SCB_DisableICache (void)
2091
{
2249
{
2092
  #if (__ICACHE_PRESENT == 1U)
2250
  #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U)
2093
    __DSB();
2251
    __DSB();
2094
    __ISB();
2252
    __ISB();
2095
    SCB->CCR &= ~(uint32_t)SCB_CCR_IC_Msk;  /* disable I-Cache */
2253
    SCB->CCR &= ~(uint32_t)SCB_CCR_IC_Msk;  /* disable I-Cache */
2096
    SCB->ICIALLU = 0UL;                     /* invalidate I-Cache */
2254
    SCB->ICIALLU = 0UL;                     /* invalidate I-Cache */
2097
    __DSB();
2255
    __DSB();
Line 2104... Line 2262...
2104
  \brief   Invalidate I-Cache
2262
  \brief   Invalidate I-Cache
2105
  \details Invalidates I-Cache
2263
  \details Invalidates I-Cache
2106
  */
2264
  */
2107
__STATIC_INLINE void SCB_InvalidateICache (void)
2265
__STATIC_INLINE void SCB_InvalidateICache (void)
2108
{
2266
{
2109
  #if (__ICACHE_PRESENT == 1U)
2267
  #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U)
2110
    __DSB();
2268
    __DSB();
2111
    __ISB();
2269
    __ISB();
2112
    SCB->ICIALLU = 0UL;
2270
    SCB->ICIALLU = 0UL;
2113
    __DSB();
2271
    __DSB();
2114
    __ISB();
2272
    __ISB();
Line 2120... Line 2278...
2120
  \brief   Enable D-Cache
2278
  \brief   Enable D-Cache
2121
  \details Turns on D-Cache
2279
  \details Turns on D-Cache
2122
  */
2280
  */
2123
__STATIC_INLINE void SCB_EnableDCache (void)
2281
__STATIC_INLINE void SCB_EnableDCache (void)
2124
{
2282
{
2125
  #if (__DCACHE_PRESENT == 1U)
2283
  #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
2126
    uint32_t ccsidr;
2284
    uint32_t ccsidr;
2127
    uint32_t sets;
2285
    uint32_t sets;
2128
    uint32_t ways;
2286
    uint32_t ways;
2129
 
2287
 
2130
    SCB->CSSELR = (0U << 1U) | 0U;          /* Level 1 data cache */
2288
    SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/  /* Level 1 data cache */
2131
    __DSB();
2289
    __DSB();
2132
 
2290
 
2133
    ccsidr = SCB->CCSIDR;
2291
    ccsidr = SCB->CCSIDR;
2134
 
2292
 
2135
                                            /* invalidate D-Cache */
2293
                                            /* invalidate D-Cache */
Line 2140... Line 2298...
2140
        SCB->DCISW = (((sets << SCB_DCISW_SET_Pos) & SCB_DCISW_SET_Msk) |
2298
        SCB->DCISW = (((sets << SCB_DCISW_SET_Pos) & SCB_DCISW_SET_Msk) |
2141
                      ((ways << SCB_DCISW_WAY_Pos) & SCB_DCISW_WAY_Msk)  );
2299
                      ((ways << SCB_DCISW_WAY_Pos) & SCB_DCISW_WAY_Msk)  );
2142
        #if defined ( __CC_ARM )
2300
        #if defined ( __CC_ARM )
2143
          __schedule_barrier();
2301
          __schedule_barrier();
2144
        #endif
2302
        #endif
2145
      } while (ways--);
2303
      } while (ways-- != 0U);
2146
    } while(sets--);
2304
    } while(sets-- != 0U);
2147
    __DSB();
2305
    __DSB();
2148
 
2306
 
2149
    SCB->CCR |=  (uint32_t)SCB_CCR_DC_Msk;  /* enable D-Cache */
2307
    SCB->CCR |=  (uint32_t)SCB_CCR_DC_Msk;  /* enable D-Cache */
2150
 
2308
 
2151
    __DSB();
2309
    __DSB();
Line 2158... Line 2316...
2158
  \brief   Disable D-Cache
2316
  \brief   Disable D-Cache
2159
  \details Turns off D-Cache
2317
  \details Turns off D-Cache
2160
  */
2318
  */
2161
__STATIC_INLINE void SCB_DisableDCache (void)
2319
__STATIC_INLINE void SCB_DisableDCache (void)
2162
{
2320
{
2163
  #if (__DCACHE_PRESENT == 1U)
2321
  #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
2164
    uint32_t ccsidr;
2322
    uint32_t ccsidr;
2165
    uint32_t sets;
2323
    uint32_t sets;
2166
    uint32_t ways;
2324
    uint32_t ways;
2167
 
2325
 
2168
    SCB->CSSELR = (0U << 1U) | 0U;          /* Level 1 data cache */
2326
    SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/  /* Level 1 data cache */
2169
    __DSB();
2327
    __DSB();
2170
 
2328
 
2171
    ccsidr = SCB->CCSIDR;
-
 
2172
 
-
 
2173
    SCB->CCR &= ~(uint32_t)SCB_CCR_DC_Msk;  /* disable D-Cache */
2329
    SCB->CCR &= ~(uint32_t)SCB_CCR_DC_Msk;  /* disable D-Cache */
-
 
2330
    __DSB();
-
 
2331
 
-
 
2332
    ccsidr = SCB->CCSIDR;
2174
 
2333
 
2175
                                            /* clean & invalidate D-Cache */
2334
                                            /* clean & invalidate D-Cache */
2176
    sets = (uint32_t)(CCSIDR_SETS(ccsidr));
2335
    sets = (uint32_t)(CCSIDR_SETS(ccsidr));
2177
    do {
2336
    do {
2178
      ways = (uint32_t)(CCSIDR_WAYS(ccsidr));
2337
      ways = (uint32_t)(CCSIDR_WAYS(ccsidr));
Line 2180... Line 2339...
2180
        SCB->DCCISW = (((sets << SCB_DCCISW_SET_Pos) & SCB_DCCISW_SET_Msk) |
2339
        SCB->DCCISW = (((sets << SCB_DCCISW_SET_Pos) & SCB_DCCISW_SET_Msk) |
2181
                       ((ways << SCB_DCCISW_WAY_Pos) & SCB_DCCISW_WAY_Msk)  );
2340
                       ((ways << SCB_DCCISW_WAY_Pos) & SCB_DCCISW_WAY_Msk)  );
2182
        #if defined ( __CC_ARM )
2341
        #if defined ( __CC_ARM )
2183
          __schedule_barrier();
2342
          __schedule_barrier();
2184
        #endif
2343
        #endif
2185
      } while (ways--);
2344
      } while (ways-- != 0U);
2186
    } while(sets--);
2345
    } while(sets-- != 0U);
2187
 
2346
 
2188
    __DSB();
2347
    __DSB();
2189
    __ISB();
2348
    __ISB();
2190
  #endif
2349
  #endif
2191
}
2350
}
Line 2195... Line 2354...
2195
  \brief   Invalidate D-Cache
2354
  \brief   Invalidate D-Cache
2196
  \details Invalidates D-Cache
2355
  \details Invalidates D-Cache
2197
  */
2356
  */
2198
__STATIC_INLINE void SCB_InvalidateDCache (void)
2357
__STATIC_INLINE void SCB_InvalidateDCache (void)
2199
{
2358
{
2200
  #if (__DCACHE_PRESENT == 1U)
2359
  #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
2201
    uint32_t ccsidr;
2360
    uint32_t ccsidr;
2202
    uint32_t sets;
2361
    uint32_t sets;
2203
    uint32_t ways;
2362
    uint32_t ways;
2204
 
2363
 
2205
    SCB->CSSELR = (0U << 1U) | 0U;          /* Level 1 data cache */
2364
    SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/  /* Level 1 data cache */
2206
    __DSB();
2365
    __DSB();
2207
 
2366
 
2208
    ccsidr = SCB->CCSIDR;
2367
    ccsidr = SCB->CCSIDR;
2209
 
2368
 
2210
                                            /* invalidate D-Cache */
2369
                                            /* invalidate D-Cache */
Line 2215... Line 2374...
2215
        SCB->DCISW = (((sets << SCB_DCISW_SET_Pos) & SCB_DCISW_SET_Msk) |
2374
        SCB->DCISW = (((sets << SCB_DCISW_SET_Pos) & SCB_DCISW_SET_Msk) |
2216
                      ((ways << SCB_DCISW_WAY_Pos) & SCB_DCISW_WAY_Msk)  );
2375
                      ((ways << SCB_DCISW_WAY_Pos) & SCB_DCISW_WAY_Msk)  );
2217
        #if defined ( __CC_ARM )
2376
        #if defined ( __CC_ARM )
2218
          __schedule_barrier();
2377
          __schedule_barrier();
2219
        #endif
2378
        #endif
2220
      } while (ways--);
2379
      } while (ways-- != 0U);
2221
    } while(sets--);
2380
    } while(sets-- != 0U);
2222
 
2381
 
2223
    __DSB();
2382
    __DSB();
2224
    __ISB();
2383
    __ISB();
2225
  #endif
2384
  #endif
2226
}
2385
}
Line 2230... Line 2389...
2230
  \brief   Clean D-Cache
2389
  \brief   Clean D-Cache
2231
  \details Cleans D-Cache
2390
  \details Cleans D-Cache
2232
  */
2391
  */
2233
__STATIC_INLINE void SCB_CleanDCache (void)
2392
__STATIC_INLINE void SCB_CleanDCache (void)
2234
{
2393
{
2235
  #if (__DCACHE_PRESENT == 1U)
2394
  #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
2236
    uint32_t ccsidr;
2395
    uint32_t ccsidr;
2237
    uint32_t sets;
2396
    uint32_t sets;
2238
    uint32_t ways;
2397
    uint32_t ways;
2239
 
2398
 
2240
    SCB->CSSELR = (0U << 1U) | 0U;          /* Level 1 data cache */
2399
     SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/  /* Level 1 data cache */
2241
    __DSB();
2400
   __DSB();
2242
 
2401
 
2243
    ccsidr = SCB->CCSIDR;
2402
    ccsidr = SCB->CCSIDR;
2244
 
2403
 
2245
                                            /* clean D-Cache */
2404
                                            /* clean D-Cache */
2246
    sets = (uint32_t)(CCSIDR_SETS(ccsidr));
2405
    sets = (uint32_t)(CCSIDR_SETS(ccsidr));
Line 2250... Line 2409...
2250
        SCB->DCCSW = (((sets << SCB_DCCSW_SET_Pos) & SCB_DCCSW_SET_Msk) |
2409
        SCB->DCCSW = (((sets << SCB_DCCSW_SET_Pos) & SCB_DCCSW_SET_Msk) |
2251
                      ((ways << SCB_DCCSW_WAY_Pos) & SCB_DCCSW_WAY_Msk)  );
2410
                      ((ways << SCB_DCCSW_WAY_Pos) & SCB_DCCSW_WAY_Msk)  );
2252
        #if defined ( __CC_ARM )
2411
        #if defined ( __CC_ARM )
2253
          __schedule_barrier();
2412
          __schedule_barrier();
2254
        #endif
2413
        #endif
2255
      } while (ways--);
2414
      } while (ways-- != 0U);
2256
    } while(sets--);
2415
    } while(sets-- != 0U);
2257
 
2416
 
2258
    __DSB();
2417
    __DSB();
2259
    __ISB();
2418
    __ISB();
2260
  #endif
2419
  #endif
2261
}
2420
}
Line 2265... Line 2424...
2265
  \brief   Clean & Invalidate D-Cache
2424
  \brief   Clean & Invalidate D-Cache
2266
  \details Cleans and Invalidates D-Cache
2425
  \details Cleans and Invalidates D-Cache
2267
  */
2426
  */
2268
__STATIC_INLINE void SCB_CleanInvalidateDCache (void)
2427
__STATIC_INLINE void SCB_CleanInvalidateDCache (void)
2269
{
2428
{
2270
  #if (__DCACHE_PRESENT == 1U)
2429
  #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
2271
    uint32_t ccsidr;
2430
    uint32_t ccsidr;
2272
    uint32_t sets;
2431
    uint32_t sets;
2273
    uint32_t ways;
2432
    uint32_t ways;
2274
 
2433
 
2275
    SCB->CSSELR = (0U << 1U) | 0U;          /* Level 1 data cache */
2434
    SCB->CSSELR = 0U; /*(0U << 1U) | 0U;*/  /* Level 1 data cache */
2276
    __DSB();
2435
    __DSB();
2277
 
2436
 
2278
    ccsidr = SCB->CCSIDR;
2437
    ccsidr = SCB->CCSIDR;
2279
 
2438
 
2280
                                            /* clean & invalidate D-Cache */
2439
                                            /* clean & invalidate D-Cache */
Line 2285... Line 2444...
2285
        SCB->DCCISW = (((sets << SCB_DCCISW_SET_Pos) & SCB_DCCISW_SET_Msk) |
2444
        SCB->DCCISW = (((sets << SCB_DCCISW_SET_Pos) & SCB_DCCISW_SET_Msk) |
2286
                       ((ways << SCB_DCCISW_WAY_Pos) & SCB_DCCISW_WAY_Msk)  );
2445
                       ((ways << SCB_DCCISW_WAY_Pos) & SCB_DCCISW_WAY_Msk)  );
2287
        #if defined ( __CC_ARM )
2446
        #if defined ( __CC_ARM )
2288
          __schedule_barrier();
2447
          __schedule_barrier();
2289
        #endif
2448
        #endif
2290
      } while (ways--);
2449
      } while (ways-- != 0U);
2291
    } while(sets--);
2450
    } while(sets-- != 0U);
2292
 
2451
 
2293
    __DSB();
2452
    __DSB();
2294
    __ISB();
2453
    __ISB();
2295
  #endif
2454
  #endif
2296
}
2455
}
Line 2302... Line 2461...
2302
  \param[in]   addr    address (aligned to 32-byte boundary)
2461
  \param[in]   addr    address (aligned to 32-byte boundary)
2303
  \param[in]   dsize   size of memory block (in number of bytes)
2462
  \param[in]   dsize   size of memory block (in number of bytes)
2304
*/
2463
*/
2305
__STATIC_INLINE void SCB_InvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize)
2464
__STATIC_INLINE void SCB_InvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize)
2306
{
2465
{
2307
  #if (__DCACHE_PRESENT == 1U)
2466
  #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
2308
     int32_t op_size = dsize;
2467
     int32_t op_size = dsize;
2309
    uint32_t op_addr = (uint32_t)addr;
2468
    uint32_t op_addr = (uint32_t)addr;
2310
     int32_t linesize = 32U;                /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */
2469
     int32_t linesize = 32;                /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */
2311
 
2470
 
2312
    __DSB();
2471
    __DSB();
2313
 
2472
 
2314
    while (op_size > 0) {
2473
    while (op_size > 0) {
2315
      SCB->DCIMVAC = op_addr;
2474
      SCB->DCIMVAC = op_addr;
2316
      op_addr += linesize;
2475
      op_addr += (uint32_t)linesize;
2317
      op_size -= linesize;
2476
      op_size -=           linesize;
2318
    }
2477
    }
2319
 
2478
 
2320
    __DSB();
2479
    __DSB();
2321
    __ISB();
2480
    __ISB();
2322
  #endif
2481
  #endif
Line 2329... Line 2488...
2329
  \param[in]   addr    address (aligned to 32-byte boundary)
2488
  \param[in]   addr    address (aligned to 32-byte boundary)
2330
  \param[in]   dsize   size of memory block (in number of bytes)
2489
  \param[in]   dsize   size of memory block (in number of bytes)
2331
*/
2490
*/
2332
__STATIC_INLINE void SCB_CleanDCache_by_Addr (uint32_t *addr, int32_t dsize)
2491
__STATIC_INLINE void SCB_CleanDCache_by_Addr (uint32_t *addr, int32_t dsize)
2333
{
2492
{
2334
  #if (__DCACHE_PRESENT == 1)
2493
  #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
2335
     int32_t op_size = dsize;
2494
     int32_t op_size = dsize;
2336
    uint32_t op_addr = (uint32_t) addr;
2495
    uint32_t op_addr = (uint32_t) addr;
2337
     int32_t linesize = 32U;                /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */
2496
     int32_t linesize = 32;                /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */
2338
 
2497
 
2339
    __DSB();
2498
    __DSB();
2340
 
2499
 
2341
    while (op_size > 0) {
2500
    while (op_size > 0) {
2342
      SCB->DCCMVAC = op_addr;
2501
      SCB->DCCMVAC = op_addr;
2343
      op_addr += linesize;
2502
      op_addr += (uint32_t)linesize;
2344
      op_size -= linesize;
2503
      op_size -=           linesize;
2345
    }
2504
    }
2346
 
2505
 
2347
    __DSB();
2506
    __DSB();
2348
    __ISB();
2507
    __ISB();
2349
  #endif
2508
  #endif
Line 2356... Line 2515...
2356
  \param[in]   addr    address (aligned to 32-byte boundary)
2515
  \param[in]   addr    address (aligned to 32-byte boundary)
2357
  \param[in]   dsize   size of memory block (in number of bytes)
2516
  \param[in]   dsize   size of memory block (in number of bytes)
2358
*/
2517
*/
2359
__STATIC_INLINE void SCB_CleanInvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize)
2518
__STATIC_INLINE void SCB_CleanInvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize)
2360
{
2519
{
2361
  #if (__DCACHE_PRESENT == 1U)
2520
  #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
2362
     int32_t op_size = dsize;
2521
     int32_t op_size = dsize;
2363
    uint32_t op_addr = (uint32_t) addr;
2522
    uint32_t op_addr = (uint32_t) addr;
2364
     int32_t linesize = 32U;                /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */
2523
     int32_t linesize = 32;                /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */
2365
 
2524
 
2366
    __DSB();
2525
    __DSB();
2367
 
2526
 
2368
    while (op_size > 0) {
2527
    while (op_size > 0) {
2369
      SCB->DCCIMVAC = op_addr;
2528
      SCB->DCCIMVAC = op_addr;
2370
      op_addr += linesize;
2529
      op_addr += (uint32_t)linesize;
2371
      op_size -= linesize;
2530
      op_size -=           linesize;
2372
    }
2531
    }
2373
 
2532
 
2374
    __DSB();
2533
    __DSB();
2375
    __ISB();
2534
    __ISB();
2376
  #endif
2535
  #endif
Line 2387... Line 2546...
2387
  \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
2546
  \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
2388
  \brief    Functions that configure the System.
2547
  \brief    Functions that configure the System.
2389
  @{
2548
  @{
2390
 */
2549
 */
2391
 
2550
 
2392
#if (__Vendor_SysTickConfig == 0U)
2551
#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
2393
 
2552
 
2394
/**
2553
/**
2395
  \brief   System Tick Configuration
2554
  \brief   System Tick Configuration
2396
  \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
2555
  \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
2397
           Counter is in free running mode to generate periodic interrupts.
2556
           Counter is in free running mode to generate periodic interrupts.
Line 2430... Line 2589...
2430
  \defgroup CMSIS_core_DebugFunctions ITM Functions
2589
  \defgroup CMSIS_core_DebugFunctions ITM Functions
2431
  \brief    Functions that access the ITM debug interface.
2590
  \brief    Functions that access the ITM debug interface.
2432
  @{
2591
  @{
2433
 */
2592
 */
2434
 
2593
 
2435
extern volatile int32_t ITM_RxBuffer;                    /*!< External variable to receive characters. */
2594
extern volatile int32_t ITM_RxBuffer;                              /*!< External variable to receive characters. */
2436
#define                 ITM_RXBUFFER_EMPTY   0x5AA55AA5U /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
2595
#define                 ITM_RXBUFFER_EMPTY  ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
2437
 
2596
 
2438
 
2597
 
2439
/**
2598
/**
2440
  \brief   ITM Send Character
2599
  \brief   ITM Send Character
2441
  \details Transmits a character via the ITM channel 0, and
2600
  \details Transmits a character via the ITM channel 0, and