00

Committer:
ganlikun
Date:
Sun Jun 12 14:02:44 2022 +0000
Revision:
0:13413ea9a877
00

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ganlikun 0:13413ea9a877 1 /**************************************************************************//**
ganlikun 0:13413ea9a877 2 * @file core_sc000.h
ganlikun 0:13413ea9a877 3 * @brief CMSIS SC000 Core Peripheral Access Layer Header File
ganlikun 0:13413ea9a877 4 * @version V5.0.2
ganlikun 0:13413ea9a877 5 * @date 13. February 2017
ganlikun 0:13413ea9a877 6 ******************************************************************************/
ganlikun 0:13413ea9a877 7 /*
ganlikun 0:13413ea9a877 8 * Copyright (c) 2009-2017 ARM Limited. All rights reserved.
ganlikun 0:13413ea9a877 9 *
ganlikun 0:13413ea9a877 10 * SPDX-License-Identifier: Apache-2.0
ganlikun 0:13413ea9a877 11 *
ganlikun 0:13413ea9a877 12 * Licensed under the Apache License, Version 2.0 (the License); you may
ganlikun 0:13413ea9a877 13 * not use this file except in compliance with the License.
ganlikun 0:13413ea9a877 14 * You may obtain a copy of the License at
ganlikun 0:13413ea9a877 15 *
ganlikun 0:13413ea9a877 16 * www.apache.org/licenses/LICENSE-2.0
ganlikun 0:13413ea9a877 17 *
ganlikun 0:13413ea9a877 18 * Unless required by applicable law or agreed to in writing, software
ganlikun 0:13413ea9a877 19 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
ganlikun 0:13413ea9a877 20 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ganlikun 0:13413ea9a877 21 * See the License for the specific language governing permissions and
ganlikun 0:13413ea9a877 22 * limitations under the License.
ganlikun 0:13413ea9a877 23 */
ganlikun 0:13413ea9a877 24
ganlikun 0:13413ea9a877 25 #if defined ( __ICCARM__ )
ganlikun 0:13413ea9a877 26 #pragma system_include /* treat file as system include file for MISRA check */
ganlikun 0:13413ea9a877 27 #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
ganlikun 0:13413ea9a877 28 #pragma clang system_header /* treat file as system include file */
ganlikun 0:13413ea9a877 29 #endif
ganlikun 0:13413ea9a877 30
ganlikun 0:13413ea9a877 31 #ifndef __CORE_SC000_H_GENERIC
ganlikun 0:13413ea9a877 32 #define __CORE_SC000_H_GENERIC
ganlikun 0:13413ea9a877 33
ganlikun 0:13413ea9a877 34 #include <stdint.h>
ganlikun 0:13413ea9a877 35
ganlikun 0:13413ea9a877 36 #ifdef __cplusplus
ganlikun 0:13413ea9a877 37 extern "C" {
ganlikun 0:13413ea9a877 38 #endif
ganlikun 0:13413ea9a877 39
ganlikun 0:13413ea9a877 40 /**
ganlikun 0:13413ea9a877 41 \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
ganlikun 0:13413ea9a877 42 CMSIS violates the following MISRA-C:2004 rules:
ganlikun 0:13413ea9a877 43
ganlikun 0:13413ea9a877 44 \li Required Rule 8.5, object/function definition in header file.<br>
ganlikun 0:13413ea9a877 45 Function definitions in header files are used to allow 'inlining'.
ganlikun 0:13413ea9a877 46
ganlikun 0:13413ea9a877 47 \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
ganlikun 0:13413ea9a877 48 Unions are used for effective representation of core registers.
ganlikun 0:13413ea9a877 49
ganlikun 0:13413ea9a877 50 \li Advisory Rule 19.7, Function-like macro defined.<br>
ganlikun 0:13413ea9a877 51 Function-like macros are used to allow more efficient code.
ganlikun 0:13413ea9a877 52 */
ganlikun 0:13413ea9a877 53
ganlikun 0:13413ea9a877 54
ganlikun 0:13413ea9a877 55 /*******************************************************************************
ganlikun 0:13413ea9a877 56 * CMSIS definitions
ganlikun 0:13413ea9a877 57 ******************************************************************************/
ganlikun 0:13413ea9a877 58 /**
ganlikun 0:13413ea9a877 59 \ingroup SC000
ganlikun 0:13413ea9a877 60 @{
ganlikun 0:13413ea9a877 61 */
ganlikun 0:13413ea9a877 62
ganlikun 0:13413ea9a877 63 /* CMSIS SC000 definitions */
ganlikun 0:13413ea9a877 64 #define __SC000_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS HAL main version */
ganlikun 0:13413ea9a877 65 #define __SC000_CMSIS_VERSION_SUB ( 0U) /*!< [15:0] CMSIS HAL sub version */
ganlikun 0:13413ea9a877 66 #define __SC000_CMSIS_VERSION ((__SC000_CMSIS_VERSION_MAIN << 16U) | \
ganlikun 0:13413ea9a877 67 __SC000_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */
ganlikun 0:13413ea9a877 68
ganlikun 0:13413ea9a877 69 #define __CORTEX_SC (000U) /*!< Cortex secure core */
ganlikun 0:13413ea9a877 70
ganlikun 0:13413ea9a877 71 /** __FPU_USED indicates whether an FPU is used or not.
ganlikun 0:13413ea9a877 72 This core does not support an FPU at all
ganlikun 0:13413ea9a877 73 */
ganlikun 0:13413ea9a877 74 #define __FPU_USED 0U
ganlikun 0:13413ea9a877 75
ganlikun 0:13413ea9a877 76 #if defined ( __CC_ARM )
ganlikun 0:13413ea9a877 77 #if defined __TARGET_FPU_VFP
ganlikun 0:13413ea9a877 78 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
ganlikun 0:13413ea9a877 79 #endif
ganlikun 0:13413ea9a877 80
ganlikun 0:13413ea9a877 81 #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
ganlikun 0:13413ea9a877 82 #if defined __ARM_PCS_VFP
ganlikun 0:13413ea9a877 83 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
ganlikun 0:13413ea9a877 84 #endif
ganlikun 0:13413ea9a877 85
ganlikun 0:13413ea9a877 86 #elif defined ( __GNUC__ )
ganlikun 0:13413ea9a877 87 #if defined (__VFP_FP__) && !defined(__SOFTFP__)
ganlikun 0:13413ea9a877 88 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
ganlikun 0:13413ea9a877 89 #endif
ganlikun 0:13413ea9a877 90
ganlikun 0:13413ea9a877 91 #elif defined ( __ICCARM__ )
ganlikun 0:13413ea9a877 92 #if defined __ARMVFP__
ganlikun 0:13413ea9a877 93 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
ganlikun 0:13413ea9a877 94 #endif
ganlikun 0:13413ea9a877 95
ganlikun 0:13413ea9a877 96 #elif defined ( __TI_ARM__ )
ganlikun 0:13413ea9a877 97 #if defined __TI_VFP_SUPPORT__
ganlikun 0:13413ea9a877 98 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
ganlikun 0:13413ea9a877 99 #endif
ganlikun 0:13413ea9a877 100
ganlikun 0:13413ea9a877 101 #elif defined ( __TASKING__ )
ganlikun 0:13413ea9a877 102 #if defined __FPU_VFP__
ganlikun 0:13413ea9a877 103 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
ganlikun 0:13413ea9a877 104 #endif
ganlikun 0:13413ea9a877 105
ganlikun 0:13413ea9a877 106 #elif defined ( __CSMC__ )
ganlikun 0:13413ea9a877 107 #if ( __CSMC__ & 0x400U)
ganlikun 0:13413ea9a877 108 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
ganlikun 0:13413ea9a877 109 #endif
ganlikun 0:13413ea9a877 110
ganlikun 0:13413ea9a877 111 #endif
ganlikun 0:13413ea9a877 112
ganlikun 0:13413ea9a877 113 #include "cmsis_compiler.h" /* CMSIS compiler specific defines */
ganlikun 0:13413ea9a877 114
ganlikun 0:13413ea9a877 115
ganlikun 0:13413ea9a877 116 #ifdef __cplusplus
ganlikun 0:13413ea9a877 117 }
ganlikun 0:13413ea9a877 118 #endif
ganlikun 0:13413ea9a877 119
ganlikun 0:13413ea9a877 120 #endif /* __CORE_SC000_H_GENERIC */
ganlikun 0:13413ea9a877 121
ganlikun 0:13413ea9a877 122 #ifndef __CMSIS_GENERIC
ganlikun 0:13413ea9a877 123
ganlikun 0:13413ea9a877 124 #ifndef __CORE_SC000_H_DEPENDANT
ganlikun 0:13413ea9a877 125 #define __CORE_SC000_H_DEPENDANT
ganlikun 0:13413ea9a877 126
ganlikun 0:13413ea9a877 127 #ifdef __cplusplus
ganlikun 0:13413ea9a877 128 extern "C" {
ganlikun 0:13413ea9a877 129 #endif
ganlikun 0:13413ea9a877 130
ganlikun 0:13413ea9a877 131 /* check device defines and use defaults */
ganlikun 0:13413ea9a877 132 #if defined __CHECK_DEVICE_DEFINES
ganlikun 0:13413ea9a877 133 #ifndef __SC000_REV
ganlikun 0:13413ea9a877 134 #define __SC000_REV 0x0000U
ganlikun 0:13413ea9a877 135 #warning "__SC000_REV not defined in device header file; using default!"
ganlikun 0:13413ea9a877 136 #endif
ganlikun 0:13413ea9a877 137
ganlikun 0:13413ea9a877 138 #ifndef __MPU_PRESENT
ganlikun 0:13413ea9a877 139 #define __MPU_PRESENT 0U
ganlikun 0:13413ea9a877 140 #warning "__MPU_PRESENT not defined in device header file; using default!"
ganlikun 0:13413ea9a877 141 #endif
ganlikun 0:13413ea9a877 142
ganlikun 0:13413ea9a877 143 #ifndef __NVIC_PRIO_BITS
ganlikun 0:13413ea9a877 144 #define __NVIC_PRIO_BITS 2U
ganlikun 0:13413ea9a877 145 #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
ganlikun 0:13413ea9a877 146 #endif
ganlikun 0:13413ea9a877 147
ganlikun 0:13413ea9a877 148 #ifndef __Vendor_SysTickConfig
ganlikun 0:13413ea9a877 149 #define __Vendor_SysTickConfig 0U
ganlikun 0:13413ea9a877 150 #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
ganlikun 0:13413ea9a877 151 #endif
ganlikun 0:13413ea9a877 152 #endif
ganlikun 0:13413ea9a877 153
ganlikun 0:13413ea9a877 154 /* IO definitions (access restrictions to peripheral registers) */
ganlikun 0:13413ea9a877 155 /**
ganlikun 0:13413ea9a877 156 \defgroup CMSIS_glob_defs CMSIS Global Defines
ganlikun 0:13413ea9a877 157
ganlikun 0:13413ea9a877 158 <strong>IO Type Qualifiers</strong> are used
ganlikun 0:13413ea9a877 159 \li to specify the access to peripheral variables.
ganlikun 0:13413ea9a877 160 \li for automatic generation of peripheral register debug information.
ganlikun 0:13413ea9a877 161 */
ganlikun 0:13413ea9a877 162 #ifdef __cplusplus
ganlikun 0:13413ea9a877 163 #define __I volatile /*!< Defines 'read only' permissions */
ganlikun 0:13413ea9a877 164 #else
ganlikun 0:13413ea9a877 165 #define __I volatile const /*!< Defines 'read only' permissions */
ganlikun 0:13413ea9a877 166 #endif
ganlikun 0:13413ea9a877 167 #define __O volatile /*!< Defines 'write only' permissions */
ganlikun 0:13413ea9a877 168 #define __IO volatile /*!< Defines 'read / write' permissions */
ganlikun 0:13413ea9a877 169
ganlikun 0:13413ea9a877 170 /* following defines should be used for structure members */
ganlikun 0:13413ea9a877 171 #define __IM volatile const /*! Defines 'read only' structure member permissions */
ganlikun 0:13413ea9a877 172 #define __OM volatile /*! Defines 'write only' structure member permissions */
ganlikun 0:13413ea9a877 173 #define __IOM volatile /*! Defines 'read / write' structure member permissions */
ganlikun 0:13413ea9a877 174
ganlikun 0:13413ea9a877 175 /*@} end of group SC000 */
ganlikun 0:13413ea9a877 176
ganlikun 0:13413ea9a877 177
ganlikun 0:13413ea9a877 178
ganlikun 0:13413ea9a877 179 /*******************************************************************************
ganlikun 0:13413ea9a877 180 * Register Abstraction
ganlikun 0:13413ea9a877 181 Core Register contain:
ganlikun 0:13413ea9a877 182 - Core Register
ganlikun 0:13413ea9a877 183 - Core NVIC Register
ganlikun 0:13413ea9a877 184 - Core SCB Register
ganlikun 0:13413ea9a877 185 - Core SysTick Register
ganlikun 0:13413ea9a877 186 - Core MPU Register
ganlikun 0:13413ea9a877 187 ******************************************************************************/
ganlikun 0:13413ea9a877 188 /**
ganlikun 0:13413ea9a877 189 \defgroup CMSIS_core_register Defines and Type Definitions
ganlikun 0:13413ea9a877 190 \brief Type definitions and defines for Cortex-M processor based devices.
ganlikun 0:13413ea9a877 191 */
ganlikun 0:13413ea9a877 192
ganlikun 0:13413ea9a877 193 /**
ganlikun 0:13413ea9a877 194 \ingroup CMSIS_core_register
ganlikun 0:13413ea9a877 195 \defgroup CMSIS_CORE Status and Control Registers
ganlikun 0:13413ea9a877 196 \brief Core Register type definitions.
ganlikun 0:13413ea9a877 197 @{
ganlikun 0:13413ea9a877 198 */
ganlikun 0:13413ea9a877 199
ganlikun 0:13413ea9a877 200 /**
ganlikun 0:13413ea9a877 201 \brief Union type to access the Application Program Status Register (APSR).
ganlikun 0:13413ea9a877 202 */
ganlikun 0:13413ea9a877 203 typedef union
ganlikun 0:13413ea9a877 204 {
ganlikun 0:13413ea9a877 205 struct
ganlikun 0:13413ea9a877 206 {
ganlikun 0:13413ea9a877 207 uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
ganlikun 0:13413ea9a877 208 uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
ganlikun 0:13413ea9a877 209 uint32_t C:1; /*!< bit: 29 Carry condition code flag */
ganlikun 0:13413ea9a877 210 uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
ganlikun 0:13413ea9a877 211 uint32_t N:1; /*!< bit: 31 Negative condition code flag */
ganlikun 0:13413ea9a877 212 } b; /*!< Structure used for bit access */
ganlikun 0:13413ea9a877 213 uint32_t w; /*!< Type used for word access */
ganlikun 0:13413ea9a877 214 } APSR_Type;
ganlikun 0:13413ea9a877 215
ganlikun 0:13413ea9a877 216 /* APSR Register Definitions */
ganlikun 0:13413ea9a877 217 #define APSR_N_Pos 31U /*!< APSR: N Position */
ganlikun 0:13413ea9a877 218 #define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
ganlikun 0:13413ea9a877 219
ganlikun 0:13413ea9a877 220 #define APSR_Z_Pos 30U /*!< APSR: Z Position */
ganlikun 0:13413ea9a877 221 #define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
ganlikun 0:13413ea9a877 222
ganlikun 0:13413ea9a877 223 #define APSR_C_Pos 29U /*!< APSR: C Position */
ganlikun 0:13413ea9a877 224 #define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
ganlikun 0:13413ea9a877 225
ganlikun 0:13413ea9a877 226 #define APSR_V_Pos 28U /*!< APSR: V Position */
ganlikun 0:13413ea9a877 227 #define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
ganlikun 0:13413ea9a877 228
ganlikun 0:13413ea9a877 229
ganlikun 0:13413ea9a877 230 /**
ganlikun 0:13413ea9a877 231 \brief Union type to access the Interrupt Program Status Register (IPSR).
ganlikun 0:13413ea9a877 232 */
ganlikun 0:13413ea9a877 233 typedef union
ganlikun 0:13413ea9a877 234 {
ganlikun 0:13413ea9a877 235 struct
ganlikun 0:13413ea9a877 236 {
ganlikun 0:13413ea9a877 237 uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
ganlikun 0:13413ea9a877 238 uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
ganlikun 0:13413ea9a877 239 } b; /*!< Structure used for bit access */
ganlikun 0:13413ea9a877 240 uint32_t w; /*!< Type used for word access */
ganlikun 0:13413ea9a877 241 } IPSR_Type;
ganlikun 0:13413ea9a877 242
ganlikun 0:13413ea9a877 243 /* IPSR Register Definitions */
ganlikun 0:13413ea9a877 244 #define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
ganlikun 0:13413ea9a877 245 #define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
ganlikun 0:13413ea9a877 246
ganlikun 0:13413ea9a877 247
ganlikun 0:13413ea9a877 248 /**
ganlikun 0:13413ea9a877 249 \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
ganlikun 0:13413ea9a877 250 */
ganlikun 0:13413ea9a877 251 typedef union
ganlikun 0:13413ea9a877 252 {
ganlikun 0:13413ea9a877 253 struct
ganlikun 0:13413ea9a877 254 {
ganlikun 0:13413ea9a877 255 uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
ganlikun 0:13413ea9a877 256 uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
ganlikun 0:13413ea9a877 257 uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
ganlikun 0:13413ea9a877 258 uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
ganlikun 0:13413ea9a877 259 uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
ganlikun 0:13413ea9a877 260 uint32_t C:1; /*!< bit: 29 Carry condition code flag */
ganlikun 0:13413ea9a877 261 uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
ganlikun 0:13413ea9a877 262 uint32_t N:1; /*!< bit: 31 Negative condition code flag */
ganlikun 0:13413ea9a877 263 } b; /*!< Structure used for bit access */
ganlikun 0:13413ea9a877 264 uint32_t w; /*!< Type used for word access */
ganlikun 0:13413ea9a877 265 } xPSR_Type;
ganlikun 0:13413ea9a877 266
ganlikun 0:13413ea9a877 267 /* xPSR Register Definitions */
ganlikun 0:13413ea9a877 268 #define xPSR_N_Pos 31U /*!< xPSR: N Position */
ganlikun 0:13413ea9a877 269 #define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
ganlikun 0:13413ea9a877 270
ganlikun 0:13413ea9a877 271 #define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
ganlikun 0:13413ea9a877 272 #define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
ganlikun 0:13413ea9a877 273
ganlikun 0:13413ea9a877 274 #define xPSR_C_Pos 29U /*!< xPSR: C Position */
ganlikun 0:13413ea9a877 275 #define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
ganlikun 0:13413ea9a877 276
ganlikun 0:13413ea9a877 277 #define xPSR_V_Pos 28U /*!< xPSR: V Position */
ganlikun 0:13413ea9a877 278 #define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
ganlikun 0:13413ea9a877 279
ganlikun 0:13413ea9a877 280 #define xPSR_T_Pos 24U /*!< xPSR: T Position */
ganlikun 0:13413ea9a877 281 #define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
ganlikun 0:13413ea9a877 282
ganlikun 0:13413ea9a877 283 #define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
ganlikun 0:13413ea9a877 284 #define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
ganlikun 0:13413ea9a877 285
ganlikun 0:13413ea9a877 286
ganlikun 0:13413ea9a877 287 /**
ganlikun 0:13413ea9a877 288 \brief Union type to access the Control Registers (CONTROL).
ganlikun 0:13413ea9a877 289 */
ganlikun 0:13413ea9a877 290 typedef union
ganlikun 0:13413ea9a877 291 {
ganlikun 0:13413ea9a877 292 struct
ganlikun 0:13413ea9a877 293 {
ganlikun 0:13413ea9a877 294 uint32_t _reserved0:1; /*!< bit: 0 Reserved */
ganlikun 0:13413ea9a877 295 uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
ganlikun 0:13413ea9a877 296 uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
ganlikun 0:13413ea9a877 297 } b; /*!< Structure used for bit access */
ganlikun 0:13413ea9a877 298 uint32_t w; /*!< Type used for word access */
ganlikun 0:13413ea9a877 299 } CONTROL_Type;
ganlikun 0:13413ea9a877 300
ganlikun 0:13413ea9a877 301 /* CONTROL Register Definitions */
ganlikun 0:13413ea9a877 302 #define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
ganlikun 0:13413ea9a877 303 #define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
ganlikun 0:13413ea9a877 304
ganlikun 0:13413ea9a877 305 /*@} end of group CMSIS_CORE */
ganlikun 0:13413ea9a877 306
ganlikun 0:13413ea9a877 307
ganlikun 0:13413ea9a877 308 /**
ganlikun 0:13413ea9a877 309 \ingroup CMSIS_core_register
ganlikun 0:13413ea9a877 310 \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
ganlikun 0:13413ea9a877 311 \brief Type definitions for the NVIC Registers
ganlikun 0:13413ea9a877 312 @{
ganlikun 0:13413ea9a877 313 */
ganlikun 0:13413ea9a877 314
ganlikun 0:13413ea9a877 315 /**
ganlikun 0:13413ea9a877 316 \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
ganlikun 0:13413ea9a877 317 */
ganlikun 0:13413ea9a877 318 typedef struct
ganlikun 0:13413ea9a877 319 {
ganlikun 0:13413ea9a877 320 __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
ganlikun 0:13413ea9a877 321 uint32_t RESERVED0[31U];
ganlikun 0:13413ea9a877 322 __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
ganlikun 0:13413ea9a877 323 uint32_t RSERVED1[31U];
ganlikun 0:13413ea9a877 324 __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
ganlikun 0:13413ea9a877 325 uint32_t RESERVED2[31U];
ganlikun 0:13413ea9a877 326 __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
ganlikun 0:13413ea9a877 327 uint32_t RESERVED3[31U];
ganlikun 0:13413ea9a877 328 uint32_t RESERVED4[64U];
ganlikun 0:13413ea9a877 329 __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
ganlikun 0:13413ea9a877 330 } NVIC_Type;
ganlikun 0:13413ea9a877 331
ganlikun 0:13413ea9a877 332 /*@} end of group CMSIS_NVIC */
ganlikun 0:13413ea9a877 333
ganlikun 0:13413ea9a877 334
ganlikun 0:13413ea9a877 335 /**
ganlikun 0:13413ea9a877 336 \ingroup CMSIS_core_register
ganlikun 0:13413ea9a877 337 \defgroup CMSIS_SCB System Control Block (SCB)
ganlikun 0:13413ea9a877 338 \brief Type definitions for the System Control Block Registers
ganlikun 0:13413ea9a877 339 @{
ganlikun 0:13413ea9a877 340 */
ganlikun 0:13413ea9a877 341
ganlikun 0:13413ea9a877 342 /**
ganlikun 0:13413ea9a877 343 \brief Structure type to access the System Control Block (SCB).
ganlikun 0:13413ea9a877 344 */
ganlikun 0:13413ea9a877 345 typedef struct
ganlikun 0:13413ea9a877 346 {
ganlikun 0:13413ea9a877 347 __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
ganlikun 0:13413ea9a877 348 __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
ganlikun 0:13413ea9a877 349 __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
ganlikun 0:13413ea9a877 350 __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
ganlikun 0:13413ea9a877 351 __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
ganlikun 0:13413ea9a877 352 __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
ganlikun 0:13413ea9a877 353 uint32_t RESERVED0[1U];
ganlikun 0:13413ea9a877 354 __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
ganlikun 0:13413ea9a877 355 __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
ganlikun 0:13413ea9a877 356 uint32_t RESERVED1[154U];
ganlikun 0:13413ea9a877 357 __IOM uint32_t SFCR; /*!< Offset: 0x290 (R/W) Security Features Control Register */
ganlikun 0:13413ea9a877 358 } SCB_Type;
ganlikun 0:13413ea9a877 359
ganlikun 0:13413ea9a877 360 /* SCB CPUID Register Definitions */
ganlikun 0:13413ea9a877 361 #define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
ganlikun 0:13413ea9a877 362 #define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
ganlikun 0:13413ea9a877 363
ganlikun 0:13413ea9a877 364 #define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
ganlikun 0:13413ea9a877 365 #define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
ganlikun 0:13413ea9a877 366
ganlikun 0:13413ea9a877 367 #define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
ganlikun 0:13413ea9a877 368 #define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
ganlikun 0:13413ea9a877 369
ganlikun 0:13413ea9a877 370 #define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
ganlikun 0:13413ea9a877 371 #define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
ganlikun 0:13413ea9a877 372
ganlikun 0:13413ea9a877 373 #define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
ganlikun 0:13413ea9a877 374 #define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
ganlikun 0:13413ea9a877 375
ganlikun 0:13413ea9a877 376 /* SCB Interrupt Control State Register Definitions */
ganlikun 0:13413ea9a877 377 #define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */
ganlikun 0:13413ea9a877 378 #define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
ganlikun 0:13413ea9a877 379
ganlikun 0:13413ea9a877 380 #define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
ganlikun 0:13413ea9a877 381 #define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
ganlikun 0:13413ea9a877 382
ganlikun 0:13413ea9a877 383 #define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
ganlikun 0:13413ea9a877 384 #define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
ganlikun 0:13413ea9a877 385
ganlikun 0:13413ea9a877 386 #define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
ganlikun 0:13413ea9a877 387 #define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
ganlikun 0:13413ea9a877 388
ganlikun 0:13413ea9a877 389 #define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
ganlikun 0:13413ea9a877 390 #define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
ganlikun 0:13413ea9a877 391
ganlikun 0:13413ea9a877 392 #define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
ganlikun 0:13413ea9a877 393 #define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
ganlikun 0:13413ea9a877 394
ganlikun 0:13413ea9a877 395 #define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
ganlikun 0:13413ea9a877 396 #define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
ganlikun 0:13413ea9a877 397
ganlikun 0:13413ea9a877 398 #define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
ganlikun 0:13413ea9a877 399 #define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
ganlikun 0:13413ea9a877 400
ganlikun 0:13413ea9a877 401 #define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
ganlikun 0:13413ea9a877 402 #define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
ganlikun 0:13413ea9a877 403
ganlikun 0:13413ea9a877 404 /* SCB Interrupt Control State Register Definitions */
ganlikun 0:13413ea9a877 405 #define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */
ganlikun 0:13413ea9a877 406 #define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
ganlikun 0:13413ea9a877 407
ganlikun 0:13413ea9a877 408 /* SCB Application Interrupt and Reset Control Register Definitions */
ganlikun 0:13413ea9a877 409 #define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
ganlikun 0:13413ea9a877 410 #define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
ganlikun 0:13413ea9a877 411
ganlikun 0:13413ea9a877 412 #define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
ganlikun 0:13413ea9a877 413 #define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
ganlikun 0:13413ea9a877 414
ganlikun 0:13413ea9a877 415 #define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
ganlikun 0:13413ea9a877 416 #define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
ganlikun 0:13413ea9a877 417
ganlikun 0:13413ea9a877 418 #define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
ganlikun 0:13413ea9a877 419 #define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
ganlikun 0:13413ea9a877 420
ganlikun 0:13413ea9a877 421 #define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
ganlikun 0:13413ea9a877 422 #define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
ganlikun 0:13413ea9a877 423
ganlikun 0:13413ea9a877 424 /* SCB System Control Register Definitions */
ganlikun 0:13413ea9a877 425 #define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
ganlikun 0:13413ea9a877 426 #define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
ganlikun 0:13413ea9a877 427
ganlikun 0:13413ea9a877 428 #define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
ganlikun 0:13413ea9a877 429 #define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
ganlikun 0:13413ea9a877 430
ganlikun 0:13413ea9a877 431 #define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
ganlikun 0:13413ea9a877 432 #define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
ganlikun 0:13413ea9a877 433
ganlikun 0:13413ea9a877 434 /* SCB Configuration Control Register Definitions */
ganlikun 0:13413ea9a877 435 #define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */
ganlikun 0:13413ea9a877 436 #define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
ganlikun 0:13413ea9a877 437
ganlikun 0:13413ea9a877 438 #define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
ganlikun 0:13413ea9a877 439 #define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
ganlikun 0:13413ea9a877 440
ganlikun 0:13413ea9a877 441 /* SCB System Handler Control and State Register Definitions */
ganlikun 0:13413ea9a877 442 #define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
ganlikun 0:13413ea9a877 443 #define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
ganlikun 0:13413ea9a877 444
ganlikun 0:13413ea9a877 445 /*@} end of group CMSIS_SCB */
ganlikun 0:13413ea9a877 446
ganlikun 0:13413ea9a877 447
ganlikun 0:13413ea9a877 448 /**
ganlikun 0:13413ea9a877 449 \ingroup CMSIS_core_register
ganlikun 0:13413ea9a877 450 \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
ganlikun 0:13413ea9a877 451 \brief Type definitions for the System Control and ID Register not in the SCB
ganlikun 0:13413ea9a877 452 @{
ganlikun 0:13413ea9a877 453 */
ganlikun 0:13413ea9a877 454
ganlikun 0:13413ea9a877 455 /**
ganlikun 0:13413ea9a877 456 \brief Structure type to access the System Control and ID Register not in the SCB.
ganlikun 0:13413ea9a877 457 */
ganlikun 0:13413ea9a877 458 typedef struct
ganlikun 0:13413ea9a877 459 {
ganlikun 0:13413ea9a877 460 uint32_t RESERVED0[2U];
ganlikun 0:13413ea9a877 461 __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
ganlikun 0:13413ea9a877 462 } SCnSCB_Type;
ganlikun 0:13413ea9a877 463
ganlikun 0:13413ea9a877 464 /* Auxiliary Control Register Definitions */
ganlikun 0:13413ea9a877 465 #define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */
ganlikun 0:13413ea9a877 466 #define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */
ganlikun 0:13413ea9a877 467
ganlikun 0:13413ea9a877 468 /*@} end of group CMSIS_SCnotSCB */
ganlikun 0:13413ea9a877 469
ganlikun 0:13413ea9a877 470
ganlikun 0:13413ea9a877 471 /**
ganlikun 0:13413ea9a877 472 \ingroup CMSIS_core_register
ganlikun 0:13413ea9a877 473 \defgroup CMSIS_SysTick System Tick Timer (SysTick)
ganlikun 0:13413ea9a877 474 \brief Type definitions for the System Timer Registers.
ganlikun 0:13413ea9a877 475 @{
ganlikun 0:13413ea9a877 476 */
ganlikun 0:13413ea9a877 477
ganlikun 0:13413ea9a877 478 /**
ganlikun 0:13413ea9a877 479 \brief Structure type to access the System Timer (SysTick).
ganlikun 0:13413ea9a877 480 */
ganlikun 0:13413ea9a877 481 typedef struct
ganlikun 0:13413ea9a877 482 {
ganlikun 0:13413ea9a877 483 __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
ganlikun 0:13413ea9a877 484 __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
ganlikun 0:13413ea9a877 485 __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
ganlikun 0:13413ea9a877 486 __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
ganlikun 0:13413ea9a877 487 } SysTick_Type;
ganlikun 0:13413ea9a877 488
ganlikun 0:13413ea9a877 489 /* SysTick Control / Status Register Definitions */
ganlikun 0:13413ea9a877 490 #define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
ganlikun 0:13413ea9a877 491 #define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
ganlikun 0:13413ea9a877 492
ganlikun 0:13413ea9a877 493 #define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
ganlikun 0:13413ea9a877 494 #define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
ganlikun 0:13413ea9a877 495
ganlikun 0:13413ea9a877 496 #define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
ganlikun 0:13413ea9a877 497 #define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
ganlikun 0:13413ea9a877 498
ganlikun 0:13413ea9a877 499 #define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
ganlikun 0:13413ea9a877 500 #define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
ganlikun 0:13413ea9a877 501
ganlikun 0:13413ea9a877 502 /* SysTick Reload Register Definitions */
ganlikun 0:13413ea9a877 503 #define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
ganlikun 0:13413ea9a877 504 #define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
ganlikun 0:13413ea9a877 505
ganlikun 0:13413ea9a877 506 /* SysTick Current Register Definitions */
ganlikun 0:13413ea9a877 507 #define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
ganlikun 0:13413ea9a877 508 #define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
ganlikun 0:13413ea9a877 509
ganlikun 0:13413ea9a877 510 /* SysTick Calibration Register Definitions */
ganlikun 0:13413ea9a877 511 #define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
ganlikun 0:13413ea9a877 512 #define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
ganlikun 0:13413ea9a877 513
ganlikun 0:13413ea9a877 514 #define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
ganlikun 0:13413ea9a877 515 #define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
ganlikun 0:13413ea9a877 516
ganlikun 0:13413ea9a877 517 #define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
ganlikun 0:13413ea9a877 518 #define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
ganlikun 0:13413ea9a877 519
ganlikun 0:13413ea9a877 520 /*@} end of group CMSIS_SysTick */
ganlikun 0:13413ea9a877 521
ganlikun 0:13413ea9a877 522 #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
ganlikun 0:13413ea9a877 523 /**
ganlikun 0:13413ea9a877 524 \ingroup CMSIS_core_register
ganlikun 0:13413ea9a877 525 \defgroup CMSIS_MPU Memory Protection Unit (MPU)
ganlikun 0:13413ea9a877 526 \brief Type definitions for the Memory Protection Unit (MPU)
ganlikun 0:13413ea9a877 527 @{
ganlikun 0:13413ea9a877 528 */
ganlikun 0:13413ea9a877 529
ganlikun 0:13413ea9a877 530 /**
ganlikun 0:13413ea9a877 531 \brief Structure type to access the Memory Protection Unit (MPU).
ganlikun 0:13413ea9a877 532 */
ganlikun 0:13413ea9a877 533 typedef struct
ganlikun 0:13413ea9a877 534 {
ganlikun 0:13413ea9a877 535 __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
ganlikun 0:13413ea9a877 536 __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
ganlikun 0:13413ea9a877 537 __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
ganlikun 0:13413ea9a877 538 __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
ganlikun 0:13413ea9a877 539 __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */
ganlikun 0:13413ea9a877 540 } MPU_Type;
ganlikun 0:13413ea9a877 541
ganlikun 0:13413ea9a877 542 /* MPU Type Register Definitions */
ganlikun 0:13413ea9a877 543 #define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
ganlikun 0:13413ea9a877 544 #define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
ganlikun 0:13413ea9a877 545
ganlikun 0:13413ea9a877 546 #define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
ganlikun 0:13413ea9a877 547 #define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
ganlikun 0:13413ea9a877 548
ganlikun 0:13413ea9a877 549 #define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
ganlikun 0:13413ea9a877 550 #define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
ganlikun 0:13413ea9a877 551
ganlikun 0:13413ea9a877 552 /* MPU Control Register Definitions */
ganlikun 0:13413ea9a877 553 #define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
ganlikun 0:13413ea9a877 554 #define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
ganlikun 0:13413ea9a877 555
ganlikun 0:13413ea9a877 556 #define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
ganlikun 0:13413ea9a877 557 #define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
ganlikun 0:13413ea9a877 558
ganlikun 0:13413ea9a877 559 #define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
ganlikun 0:13413ea9a877 560 #define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
ganlikun 0:13413ea9a877 561
ganlikun 0:13413ea9a877 562 /* MPU Region Number Register Definitions */
ganlikun 0:13413ea9a877 563 #define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
ganlikun 0:13413ea9a877 564 #define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
ganlikun 0:13413ea9a877 565
ganlikun 0:13413ea9a877 566 /* MPU Region Base Address Register Definitions */
ganlikun 0:13413ea9a877 567 #define MPU_RBAR_ADDR_Pos 8U /*!< MPU RBAR: ADDR Position */
ganlikun 0:13413ea9a877 568 #define MPU_RBAR_ADDR_Msk (0xFFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
ganlikun 0:13413ea9a877 569
ganlikun 0:13413ea9a877 570 #define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */
ganlikun 0:13413ea9a877 571 #define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */
ganlikun 0:13413ea9a877 572
ganlikun 0:13413ea9a877 573 #define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */
ganlikun 0:13413ea9a877 574 #define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */
ganlikun 0:13413ea9a877 575
ganlikun 0:13413ea9a877 576 /* MPU Region Attribute and Size Register Definitions */
ganlikun 0:13413ea9a877 577 #define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */
ganlikun 0:13413ea9a877 578 #define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */
ganlikun 0:13413ea9a877 579
ganlikun 0:13413ea9a877 580 #define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */
ganlikun 0:13413ea9a877 581 #define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */
ganlikun 0:13413ea9a877 582
ganlikun 0:13413ea9a877 583 #define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */
ganlikun 0:13413ea9a877 584 #define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */
ganlikun 0:13413ea9a877 585
ganlikun 0:13413ea9a877 586 #define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */
ganlikun 0:13413ea9a877 587 #define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */
ganlikun 0:13413ea9a877 588
ganlikun 0:13413ea9a877 589 #define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */
ganlikun 0:13413ea9a877 590 #define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */
ganlikun 0:13413ea9a877 591
ganlikun 0:13413ea9a877 592 #define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */
ganlikun 0:13413ea9a877 593 #define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */
ganlikun 0:13413ea9a877 594
ganlikun 0:13413ea9a877 595 #define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */
ganlikun 0:13413ea9a877 596 #define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */
ganlikun 0:13413ea9a877 597
ganlikun 0:13413ea9a877 598 #define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */
ganlikun 0:13413ea9a877 599 #define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */
ganlikun 0:13413ea9a877 600
ganlikun 0:13413ea9a877 601 #define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */
ganlikun 0:13413ea9a877 602 #define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */
ganlikun 0:13413ea9a877 603
ganlikun 0:13413ea9a877 604 #define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */
ganlikun 0:13413ea9a877 605 #define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */
ganlikun 0:13413ea9a877 606
ganlikun 0:13413ea9a877 607 /*@} end of group CMSIS_MPU */
ganlikun 0:13413ea9a877 608 #endif
ganlikun 0:13413ea9a877 609
ganlikun 0:13413ea9a877 610
ganlikun 0:13413ea9a877 611 /**
ganlikun 0:13413ea9a877 612 \ingroup CMSIS_core_register
ganlikun 0:13413ea9a877 613 \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
ganlikun 0:13413ea9a877 614 \brief SC000 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor.
ganlikun 0:13413ea9a877 615 Therefore they are not covered by the SC000 header file.
ganlikun 0:13413ea9a877 616 @{
ganlikun 0:13413ea9a877 617 */
ganlikun 0:13413ea9a877 618 /*@} end of group CMSIS_CoreDebug */
ganlikun 0:13413ea9a877 619
ganlikun 0:13413ea9a877 620
ganlikun 0:13413ea9a877 621 /**
ganlikun 0:13413ea9a877 622 \ingroup CMSIS_core_register
ganlikun 0:13413ea9a877 623 \defgroup CMSIS_core_bitfield Core register bit field macros
ganlikun 0:13413ea9a877 624 \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
ganlikun 0:13413ea9a877 625 @{
ganlikun 0:13413ea9a877 626 */
ganlikun 0:13413ea9a877 627
ganlikun 0:13413ea9a877 628 /**
ganlikun 0:13413ea9a877 629 \brief Mask and shift a bit field value for use in a register bit range.
ganlikun 0:13413ea9a877 630 \param[in] field Name of the register bit field.
ganlikun 0:13413ea9a877 631 \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
ganlikun 0:13413ea9a877 632 \return Masked and shifted value.
ganlikun 0:13413ea9a877 633 */
ganlikun 0:13413ea9a877 634 #define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
ganlikun 0:13413ea9a877 635
ganlikun 0:13413ea9a877 636 /**
ganlikun 0:13413ea9a877 637 \brief Mask and shift a register value to extract a bit filed value.
ganlikun 0:13413ea9a877 638 \param[in] field Name of the register bit field.
ganlikun 0:13413ea9a877 639 \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
ganlikun 0:13413ea9a877 640 \return Masked and shifted bit field value.
ganlikun 0:13413ea9a877 641 */
ganlikun 0:13413ea9a877 642 #define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
ganlikun 0:13413ea9a877 643
ganlikun 0:13413ea9a877 644 /*@} end of group CMSIS_core_bitfield */
ganlikun 0:13413ea9a877 645
ganlikun 0:13413ea9a877 646
ganlikun 0:13413ea9a877 647 /**
ganlikun 0:13413ea9a877 648 \ingroup CMSIS_core_register
ganlikun 0:13413ea9a877 649 \defgroup CMSIS_core_base Core Definitions
ganlikun 0:13413ea9a877 650 \brief Definitions for base addresses, unions, and structures.
ganlikun 0:13413ea9a877 651 @{
ganlikun 0:13413ea9a877 652 */
ganlikun 0:13413ea9a877 653
ganlikun 0:13413ea9a877 654 /* Memory mapping of Core Hardware */
ganlikun 0:13413ea9a877 655 #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
ganlikun 0:13413ea9a877 656 #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
ganlikun 0:13413ea9a877 657 #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
ganlikun 0:13413ea9a877 658 #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
ganlikun 0:13413ea9a877 659
ganlikun 0:13413ea9a877 660 #define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
ganlikun 0:13413ea9a877 661 #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
ganlikun 0:13413ea9a877 662 #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
ganlikun 0:13413ea9a877 663 #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
ganlikun 0:13413ea9a877 664
ganlikun 0:13413ea9a877 665 #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
ganlikun 0:13413ea9a877 666 #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
ganlikun 0:13413ea9a877 667 #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
ganlikun 0:13413ea9a877 668 #endif
ganlikun 0:13413ea9a877 669
ganlikun 0:13413ea9a877 670 /*@} */
ganlikun 0:13413ea9a877 671
ganlikun 0:13413ea9a877 672
ganlikun 0:13413ea9a877 673
ganlikun 0:13413ea9a877 674 /*******************************************************************************
ganlikun 0:13413ea9a877 675 * Hardware Abstraction Layer
ganlikun 0:13413ea9a877 676 Core Function Interface contains:
ganlikun 0:13413ea9a877 677 - Core NVIC Functions
ganlikun 0:13413ea9a877 678 - Core SysTick Functions
ganlikun 0:13413ea9a877 679 - Core Register Access Functions
ganlikun 0:13413ea9a877 680 ******************************************************************************/
ganlikun 0:13413ea9a877 681 /**
ganlikun 0:13413ea9a877 682 \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
ganlikun 0:13413ea9a877 683 */
ganlikun 0:13413ea9a877 684
ganlikun 0:13413ea9a877 685
ganlikun 0:13413ea9a877 686
ganlikun 0:13413ea9a877 687 /* ########################## NVIC functions #################################### */
ganlikun 0:13413ea9a877 688 /**
ganlikun 0:13413ea9a877 689 \ingroup CMSIS_Core_FunctionInterface
ganlikun 0:13413ea9a877 690 \defgroup CMSIS_Core_NVICFunctions NVIC Functions
ganlikun 0:13413ea9a877 691 \brief Functions that manage interrupts and exceptions via the NVIC.
ganlikun 0:13413ea9a877 692 @{
ganlikun 0:13413ea9a877 693 */
ganlikun 0:13413ea9a877 694
ganlikun 0:13413ea9a877 695 #ifdef CMSIS_NVIC_VIRTUAL
ganlikun 0:13413ea9a877 696 #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
ganlikun 0:13413ea9a877 697 #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
ganlikun 0:13413ea9a877 698 #endif
ganlikun 0:13413ea9a877 699 #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
ganlikun 0:13413ea9a877 700 #else
ganlikun 0:13413ea9a877 701 /*#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping not available for SC000 */
ganlikun 0:13413ea9a877 702 /*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for SC000 */
ganlikun 0:13413ea9a877 703 #define NVIC_EnableIRQ __NVIC_EnableIRQ
ganlikun 0:13413ea9a877 704 #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
ganlikun 0:13413ea9a877 705 #define NVIC_DisableIRQ __NVIC_DisableIRQ
ganlikun 0:13413ea9a877 706 #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
ganlikun 0:13413ea9a877 707 #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
ganlikun 0:13413ea9a877 708 #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
ganlikun 0:13413ea9a877 709 /*#define NVIC_GetActive __NVIC_GetActive not available for SC000 */
ganlikun 0:13413ea9a877 710 #define NVIC_SetPriority __NVIC_SetPriority
ganlikun 0:13413ea9a877 711 #define NVIC_GetPriority __NVIC_GetPriority
ganlikun 0:13413ea9a877 712 #define NVIC_SystemReset __NVIC_SystemReset
ganlikun 0:13413ea9a877 713 #endif /* CMSIS_NVIC_VIRTUAL */
ganlikun 0:13413ea9a877 714
ganlikun 0:13413ea9a877 715 #ifdef CMSIS_VECTAB_VIRTUAL
ganlikun 0:13413ea9a877 716 #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
ganlikun 0:13413ea9a877 717 #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
ganlikun 0:13413ea9a877 718 #endif
ganlikun 0:13413ea9a877 719 #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
ganlikun 0:13413ea9a877 720 #else
ganlikun 0:13413ea9a877 721 #define NVIC_SetVector __NVIC_SetVector
ganlikun 0:13413ea9a877 722 #define NVIC_GetVector __NVIC_GetVector
ganlikun 0:13413ea9a877 723 #endif /* (CMSIS_VECTAB_VIRTUAL) */
ganlikun 0:13413ea9a877 724
ganlikun 0:13413ea9a877 725 #define NVIC_USER_IRQ_OFFSET 16
ganlikun 0:13413ea9a877 726
ganlikun 0:13413ea9a877 727
ganlikun 0:13413ea9a877 728 /* Interrupt Priorities are WORD accessible only under ARMv6M */
ganlikun 0:13413ea9a877 729 /* The following MACROS handle generation of the register offset and byte masks */
ganlikun 0:13413ea9a877 730 #define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
ganlikun 0:13413ea9a877 731 #define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
ganlikun 0:13413ea9a877 732 #define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
ganlikun 0:13413ea9a877 733
ganlikun 0:13413ea9a877 734
ganlikun 0:13413ea9a877 735 /**
ganlikun 0:13413ea9a877 736 \brief Enable Interrupt
ganlikun 0:13413ea9a877 737 \details Enables a device specific interrupt in the NVIC interrupt controller.
ganlikun 0:13413ea9a877 738 \param [in] IRQn Device specific interrupt number.
ganlikun 0:13413ea9a877 739 \note IRQn must not be negative.
ganlikun 0:13413ea9a877 740 */
ganlikun 0:13413ea9a877 741 __STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
ganlikun 0:13413ea9a877 742 {
ganlikun 0:13413ea9a877 743 if ((int32_t)(IRQn) >= 0)
ganlikun 0:13413ea9a877 744 {
ganlikun 0:13413ea9a877 745 NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
ganlikun 0:13413ea9a877 746 }
ganlikun 0:13413ea9a877 747 }
ganlikun 0:13413ea9a877 748
ganlikun 0:13413ea9a877 749
ganlikun 0:13413ea9a877 750 /**
ganlikun 0:13413ea9a877 751 \brief Get Interrupt Enable status
ganlikun 0:13413ea9a877 752 \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
ganlikun 0:13413ea9a877 753 \param [in] IRQn Device specific interrupt number.
ganlikun 0:13413ea9a877 754 \return 0 Interrupt is not enabled.
ganlikun 0:13413ea9a877 755 \return 1 Interrupt is enabled.
ganlikun 0:13413ea9a877 756 \note IRQn must not be negative.
ganlikun 0:13413ea9a877 757 */
ganlikun 0:13413ea9a877 758 __STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
ganlikun 0:13413ea9a877 759 {
ganlikun 0:13413ea9a877 760 if ((int32_t)(IRQn) >= 0)
ganlikun 0:13413ea9a877 761 {
ganlikun 0:13413ea9a877 762 return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
ganlikun 0:13413ea9a877 763 }
ganlikun 0:13413ea9a877 764 else
ganlikun 0:13413ea9a877 765 {
ganlikun 0:13413ea9a877 766 return(0U);
ganlikun 0:13413ea9a877 767 }
ganlikun 0:13413ea9a877 768 }
ganlikun 0:13413ea9a877 769
ganlikun 0:13413ea9a877 770
ganlikun 0:13413ea9a877 771 /**
ganlikun 0:13413ea9a877 772 \brief Disable Interrupt
ganlikun 0:13413ea9a877 773 \details Disables a device specific interrupt in the NVIC interrupt controller.
ganlikun 0:13413ea9a877 774 \param [in] IRQn Device specific interrupt number.
ganlikun 0:13413ea9a877 775 \note IRQn must not be negative.
ganlikun 0:13413ea9a877 776 */
ganlikun 0:13413ea9a877 777 __STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
ganlikun 0:13413ea9a877 778 {
ganlikun 0:13413ea9a877 779 if ((int32_t)(IRQn) >= 0)
ganlikun 0:13413ea9a877 780 {
ganlikun 0:13413ea9a877 781 NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
ganlikun 0:13413ea9a877 782 __DSB();
ganlikun 0:13413ea9a877 783 __ISB();
ganlikun 0:13413ea9a877 784 }
ganlikun 0:13413ea9a877 785 }
ganlikun 0:13413ea9a877 786
ganlikun 0:13413ea9a877 787
ganlikun 0:13413ea9a877 788 /**
ganlikun 0:13413ea9a877 789 \brief Get Pending Interrupt
ganlikun 0:13413ea9a877 790 \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
ganlikun 0:13413ea9a877 791 \param [in] IRQn Device specific interrupt number.
ganlikun 0:13413ea9a877 792 \return 0 Interrupt status is not pending.
ganlikun 0:13413ea9a877 793 \return 1 Interrupt status is pending.
ganlikun 0:13413ea9a877 794 \note IRQn must not be negative.
ganlikun 0:13413ea9a877 795 */
ganlikun 0:13413ea9a877 796 __STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
ganlikun 0:13413ea9a877 797 {
ganlikun 0:13413ea9a877 798 if ((int32_t)(IRQn) >= 0)
ganlikun 0:13413ea9a877 799 {
ganlikun 0:13413ea9a877 800 return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
ganlikun 0:13413ea9a877 801 }
ganlikun 0:13413ea9a877 802 else
ganlikun 0:13413ea9a877 803 {
ganlikun 0:13413ea9a877 804 return(0U);
ganlikun 0:13413ea9a877 805 }
ganlikun 0:13413ea9a877 806 }
ganlikun 0:13413ea9a877 807
ganlikun 0:13413ea9a877 808
ganlikun 0:13413ea9a877 809 /**
ganlikun 0:13413ea9a877 810 \brief Set Pending Interrupt
ganlikun 0:13413ea9a877 811 \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
ganlikun 0:13413ea9a877 812 \param [in] IRQn Device specific interrupt number.
ganlikun 0:13413ea9a877 813 \note IRQn must not be negative.
ganlikun 0:13413ea9a877 814 */
ganlikun 0:13413ea9a877 815 __STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
ganlikun 0:13413ea9a877 816 {
ganlikun 0:13413ea9a877 817 if ((int32_t)(IRQn) >= 0)
ganlikun 0:13413ea9a877 818 {
ganlikun 0:13413ea9a877 819 NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
ganlikun 0:13413ea9a877 820 }
ganlikun 0:13413ea9a877 821 }
ganlikun 0:13413ea9a877 822
ganlikun 0:13413ea9a877 823
ganlikun 0:13413ea9a877 824 /**
ganlikun 0:13413ea9a877 825 \brief Clear Pending Interrupt
ganlikun 0:13413ea9a877 826 \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
ganlikun 0:13413ea9a877 827 \param [in] IRQn Device specific interrupt number.
ganlikun 0:13413ea9a877 828 \note IRQn must not be negative.
ganlikun 0:13413ea9a877 829 */
ganlikun 0:13413ea9a877 830 __STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
ganlikun 0:13413ea9a877 831 {
ganlikun 0:13413ea9a877 832 if ((int32_t)(IRQn) >= 0)
ganlikun 0:13413ea9a877 833 {
ganlikun 0:13413ea9a877 834 NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
ganlikun 0:13413ea9a877 835 }
ganlikun 0:13413ea9a877 836 }
ganlikun 0:13413ea9a877 837
ganlikun 0:13413ea9a877 838
ganlikun 0:13413ea9a877 839 /**
ganlikun 0:13413ea9a877 840 \brief Set Interrupt Priority
ganlikun 0:13413ea9a877 841 \details Sets the priority of a device specific interrupt or a processor exception.
ganlikun 0:13413ea9a877 842 The interrupt number can be positive to specify a device specific interrupt,
ganlikun 0:13413ea9a877 843 or negative to specify a processor exception.
ganlikun 0:13413ea9a877 844 \param [in] IRQn Interrupt number.
ganlikun 0:13413ea9a877 845 \param [in] priority Priority to set.
ganlikun 0:13413ea9a877 846 \note The priority cannot be set for every processor exception.
ganlikun 0:13413ea9a877 847 */
ganlikun 0:13413ea9a877 848 __STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
ganlikun 0:13413ea9a877 849 {
ganlikun 0:13413ea9a877 850 if ((int32_t)(IRQn) >= 0)
ganlikun 0:13413ea9a877 851 {
ganlikun 0:13413ea9a877 852 NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
ganlikun 0:13413ea9a877 853 (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
ganlikun 0:13413ea9a877 854 }
ganlikun 0:13413ea9a877 855 else
ganlikun 0:13413ea9a877 856 {
ganlikun 0:13413ea9a877 857 SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
ganlikun 0:13413ea9a877 858 (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
ganlikun 0:13413ea9a877 859 }
ganlikun 0:13413ea9a877 860 }
ganlikun 0:13413ea9a877 861
ganlikun 0:13413ea9a877 862
ganlikun 0:13413ea9a877 863 /**
ganlikun 0:13413ea9a877 864 \brief Get Interrupt Priority
ganlikun 0:13413ea9a877 865 \details Reads the priority of a device specific interrupt or a processor exception.
ganlikun 0:13413ea9a877 866 The interrupt number can be positive to specify a device specific interrupt,
ganlikun 0:13413ea9a877 867 or negative to specify a processor exception.
ganlikun 0:13413ea9a877 868 \param [in] IRQn Interrupt number.
ganlikun 0:13413ea9a877 869 \return Interrupt Priority.
ganlikun 0:13413ea9a877 870 Value is aligned automatically to the implemented priority bits of the microcontroller.
ganlikun 0:13413ea9a877 871 */
ganlikun 0:13413ea9a877 872 __STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
ganlikun 0:13413ea9a877 873 {
ganlikun 0:13413ea9a877 874
ganlikun 0:13413ea9a877 875 if ((int32_t)(IRQn) >= 0)
ganlikun 0:13413ea9a877 876 {
ganlikun 0:13413ea9a877 877 return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
ganlikun 0:13413ea9a877 878 }
ganlikun 0:13413ea9a877 879 else
ganlikun 0:13413ea9a877 880 {
ganlikun 0:13413ea9a877 881 return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
ganlikun 0:13413ea9a877 882 }
ganlikun 0:13413ea9a877 883 }
ganlikun 0:13413ea9a877 884
ganlikun 0:13413ea9a877 885
ganlikun 0:13413ea9a877 886 /**
ganlikun 0:13413ea9a877 887 \brief Set Interrupt Vector
ganlikun 0:13413ea9a877 888 \details Sets an interrupt vector in SRAM based interrupt vector table.
ganlikun 0:13413ea9a877 889 The interrupt number can be positive to specify a device specific interrupt,
ganlikun 0:13413ea9a877 890 or negative to specify a processor exception.
ganlikun 0:13413ea9a877 891 VTOR must been relocated to SRAM before.
ganlikun 0:13413ea9a877 892 \param [in] IRQn Interrupt number
ganlikun 0:13413ea9a877 893 \param [in] vector Address of interrupt handler function
ganlikun 0:13413ea9a877 894 */
ganlikun 0:13413ea9a877 895 __STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
ganlikun 0:13413ea9a877 896 {
ganlikun 0:13413ea9a877 897 uint32_t *vectors = (uint32_t *)SCB->VTOR;
ganlikun 0:13413ea9a877 898 vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
ganlikun 0:13413ea9a877 899 }
ganlikun 0:13413ea9a877 900
ganlikun 0:13413ea9a877 901
ganlikun 0:13413ea9a877 902 /**
ganlikun 0:13413ea9a877 903 \brief Get Interrupt Vector
ganlikun 0:13413ea9a877 904 \details Reads an interrupt vector from interrupt vector table.
ganlikun 0:13413ea9a877 905 The interrupt number can be positive to specify a device specific interrupt,
ganlikun 0:13413ea9a877 906 or negative to specify a processor exception.
ganlikun 0:13413ea9a877 907 \param [in] IRQn Interrupt number.
ganlikun 0:13413ea9a877 908 \return Address of interrupt handler function
ganlikun 0:13413ea9a877 909 */
ganlikun 0:13413ea9a877 910 __STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
ganlikun 0:13413ea9a877 911 {
ganlikun 0:13413ea9a877 912 uint32_t *vectors = (uint32_t *)SCB->VTOR;
ganlikun 0:13413ea9a877 913 return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
ganlikun 0:13413ea9a877 914 }
ganlikun 0:13413ea9a877 915
ganlikun 0:13413ea9a877 916
ganlikun 0:13413ea9a877 917 /**
ganlikun 0:13413ea9a877 918 \brief System Reset
ganlikun 0:13413ea9a877 919 \details Initiates a system reset request to reset the MCU.
ganlikun 0:13413ea9a877 920 */
ganlikun 0:13413ea9a877 921 __STATIC_INLINE void __NVIC_SystemReset(void)
ganlikun 0:13413ea9a877 922 {
ganlikun 0:13413ea9a877 923 __DSB(); /* Ensure all outstanding memory accesses included
ganlikun 0:13413ea9a877 924 buffered write are completed before reset */
ganlikun 0:13413ea9a877 925 SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
ganlikun 0:13413ea9a877 926 SCB_AIRCR_SYSRESETREQ_Msk);
ganlikun 0:13413ea9a877 927 __DSB(); /* Ensure completion of memory access */
ganlikun 0:13413ea9a877 928
ganlikun 0:13413ea9a877 929 for(;;) /* wait until reset */
ganlikun 0:13413ea9a877 930 {
ganlikun 0:13413ea9a877 931 __NOP();
ganlikun 0:13413ea9a877 932 }
ganlikun 0:13413ea9a877 933 }
ganlikun 0:13413ea9a877 934
ganlikun 0:13413ea9a877 935 /*@} end of CMSIS_Core_NVICFunctions */
ganlikun 0:13413ea9a877 936
ganlikun 0:13413ea9a877 937
ganlikun 0:13413ea9a877 938 /* ########################## FPU functions #################################### */
ganlikun 0:13413ea9a877 939 /**
ganlikun 0:13413ea9a877 940 \ingroup CMSIS_Core_FunctionInterface
ganlikun 0:13413ea9a877 941 \defgroup CMSIS_Core_FpuFunctions FPU Functions
ganlikun 0:13413ea9a877 942 \brief Function that provides FPU type.
ganlikun 0:13413ea9a877 943 @{
ganlikun 0:13413ea9a877 944 */
ganlikun 0:13413ea9a877 945
ganlikun 0:13413ea9a877 946 /**
ganlikun 0:13413ea9a877 947 \brief get FPU type
ganlikun 0:13413ea9a877 948 \details returns the FPU type
ganlikun 0:13413ea9a877 949 \returns
ganlikun 0:13413ea9a877 950 - \b 0: No FPU
ganlikun 0:13413ea9a877 951 - \b 1: Single precision FPU
ganlikun 0:13413ea9a877 952 - \b 2: Double + Single precision FPU
ganlikun 0:13413ea9a877 953 */
ganlikun 0:13413ea9a877 954 __STATIC_INLINE uint32_t SCB_GetFPUType(void)
ganlikun 0:13413ea9a877 955 {
ganlikun 0:13413ea9a877 956 return 0U; /* No FPU */
ganlikun 0:13413ea9a877 957 }
ganlikun 0:13413ea9a877 958
ganlikun 0:13413ea9a877 959
ganlikun 0:13413ea9a877 960 /*@} end of CMSIS_Core_FpuFunctions */
ganlikun 0:13413ea9a877 961
ganlikun 0:13413ea9a877 962
ganlikun 0:13413ea9a877 963
ganlikun 0:13413ea9a877 964 /* ################################## SysTick function ############################################ */
ganlikun 0:13413ea9a877 965 /**
ganlikun 0:13413ea9a877 966 \ingroup CMSIS_Core_FunctionInterface
ganlikun 0:13413ea9a877 967 \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
ganlikun 0:13413ea9a877 968 \brief Functions that configure the System.
ganlikun 0:13413ea9a877 969 @{
ganlikun 0:13413ea9a877 970 */
ganlikun 0:13413ea9a877 971
ganlikun 0:13413ea9a877 972 #if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
ganlikun 0:13413ea9a877 973
ganlikun 0:13413ea9a877 974 /**
ganlikun 0:13413ea9a877 975 \brief System Tick Configuration
ganlikun 0:13413ea9a877 976 \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
ganlikun 0:13413ea9a877 977 Counter is in free running mode to generate periodic interrupts.
ganlikun 0:13413ea9a877 978 \param [in] ticks Number of ticks between two interrupts.
ganlikun 0:13413ea9a877 979 \return 0 Function succeeded.
ganlikun 0:13413ea9a877 980 \return 1 Function failed.
ganlikun 0:13413ea9a877 981 \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
ganlikun 0:13413ea9a877 982 function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
ganlikun 0:13413ea9a877 983 must contain a vendor-specific implementation of this function.
ganlikun 0:13413ea9a877 984 */
ganlikun 0:13413ea9a877 985 __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
ganlikun 0:13413ea9a877 986 {
ganlikun 0:13413ea9a877 987 if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
ganlikun 0:13413ea9a877 988 {
ganlikun 0:13413ea9a877 989 return (1UL); /* Reload value impossible */
ganlikun 0:13413ea9a877 990 }
ganlikun 0:13413ea9a877 991
ganlikun 0:13413ea9a877 992 SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
ganlikun 0:13413ea9a877 993 NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
ganlikun 0:13413ea9a877 994 SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
ganlikun 0:13413ea9a877 995 SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
ganlikun 0:13413ea9a877 996 SysTick_CTRL_TICKINT_Msk |
ganlikun 0:13413ea9a877 997 SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
ganlikun 0:13413ea9a877 998 return (0UL); /* Function successful */
ganlikun 0:13413ea9a877 999 }
ganlikun 0:13413ea9a877 1000
ganlikun 0:13413ea9a877 1001 #endif
ganlikun 0:13413ea9a877 1002
ganlikun 0:13413ea9a877 1003 /*@} end of CMSIS_Core_SysTickFunctions */
ganlikun 0:13413ea9a877 1004
ganlikun 0:13413ea9a877 1005
ganlikun 0:13413ea9a877 1006
ganlikun 0:13413ea9a877 1007
ganlikun 0:13413ea9a877 1008 #ifdef __cplusplus
ganlikun 0:13413ea9a877 1009 }
ganlikun 0:13413ea9a877 1010 #endif
ganlikun 0:13413ea9a877 1011
ganlikun 0:13413ea9a877 1012 #endif /* __CORE_SC000_H_DEPENDANT */
ganlikun 0:13413ea9a877 1013
ganlikun 0:13413ea9a877 1014 #endif /* __CMSIS_GENERIC */
ganlikun 0:13413ea9a877 1015