Development mbed library for MAX32630FTHR

Dependents:   blinky_max32630fthr

Committer:
switches
Date:
Fri Dec 16 16:27:57 2016 +0000
Revision:
3:1198227e6421
Parent:
0:5c4d7b2438d3
Changed ADC scale for MAX32625 platforms to 1.2V full scale to match MAX32630 platforms

Who changed what in which revision?

UserRevisionLine numberNew contents of line
switches 0:5c4d7b2438d3 1 /**************************************************************************//**
switches 0:5c4d7b2438d3 2 * @file core_sc000.h
switches 0:5c4d7b2438d3 3 * @brief CMSIS SC000 Core Peripheral Access Layer Header File
switches 0:5c4d7b2438d3 4 * @version V4.10
switches 0:5c4d7b2438d3 5 * @date 18. March 2015
switches 0:5c4d7b2438d3 6 *
switches 0:5c4d7b2438d3 7 * @note
switches 0:5c4d7b2438d3 8 *
switches 0:5c4d7b2438d3 9 ******************************************************************************/
switches 0:5c4d7b2438d3 10 /* Copyright (c) 2009 - 2015 ARM LIMITED
switches 0:5c4d7b2438d3 11
switches 0:5c4d7b2438d3 12 All rights reserved.
switches 0:5c4d7b2438d3 13 Redistribution and use in source and binary forms, with or without
switches 0:5c4d7b2438d3 14 modification, are permitted provided that the following conditions are met:
switches 0:5c4d7b2438d3 15 - Redistributions of source code must retain the above copyright
switches 0:5c4d7b2438d3 16 notice, this list of conditions and the following disclaimer.
switches 0:5c4d7b2438d3 17 - Redistributions in binary form must reproduce the above copyright
switches 0:5c4d7b2438d3 18 notice, this list of conditions and the following disclaimer in the
switches 0:5c4d7b2438d3 19 documentation and/or other materials provided with the distribution.
switches 0:5c4d7b2438d3 20 - Neither the name of ARM nor the names of its contributors may be used
switches 0:5c4d7b2438d3 21 to endorse or promote products derived from this software without
switches 0:5c4d7b2438d3 22 specific prior written permission.
switches 0:5c4d7b2438d3 23 *
switches 0:5c4d7b2438d3 24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
switches 0:5c4d7b2438d3 25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
switches 0:5c4d7b2438d3 26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
switches 0:5c4d7b2438d3 27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
switches 0:5c4d7b2438d3 28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
switches 0:5c4d7b2438d3 29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
switches 0:5c4d7b2438d3 30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
switches 0:5c4d7b2438d3 31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
switches 0:5c4d7b2438d3 32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
switches 0:5c4d7b2438d3 33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
switches 0:5c4d7b2438d3 34 POSSIBILITY OF SUCH DAMAGE.
switches 0:5c4d7b2438d3 35 ---------------------------------------------------------------------------*/
switches 0:5c4d7b2438d3 36
switches 0:5c4d7b2438d3 37
switches 0:5c4d7b2438d3 38 #if defined ( __ICCARM__ )
switches 0:5c4d7b2438d3 39 #pragma system_include /* treat file as system include file for MISRA check */
switches 0:5c4d7b2438d3 40 #endif
switches 0:5c4d7b2438d3 41
switches 0:5c4d7b2438d3 42 #ifndef __CORE_SC000_H_GENERIC
switches 0:5c4d7b2438d3 43 #define __CORE_SC000_H_GENERIC
switches 0:5c4d7b2438d3 44
switches 0:5c4d7b2438d3 45 #ifdef __cplusplus
switches 0:5c4d7b2438d3 46 extern "C" {
switches 0:5c4d7b2438d3 47 #endif
switches 0:5c4d7b2438d3 48
switches 0:5c4d7b2438d3 49 /** \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
switches 0:5c4d7b2438d3 50 CMSIS violates the following MISRA-C:2004 rules:
switches 0:5c4d7b2438d3 51
switches 0:5c4d7b2438d3 52 \li Required Rule 8.5, object/function definition in header file.<br>
switches 0:5c4d7b2438d3 53 Function definitions in header files are used to allow 'inlining'.
switches 0:5c4d7b2438d3 54
switches 0:5c4d7b2438d3 55 \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
switches 0:5c4d7b2438d3 56 Unions are used for effective representation of core registers.
switches 0:5c4d7b2438d3 57
switches 0:5c4d7b2438d3 58 \li Advisory Rule 19.7, Function-like macro defined.<br>
switches 0:5c4d7b2438d3 59 Function-like macros are used to allow more efficient code.
switches 0:5c4d7b2438d3 60 */
switches 0:5c4d7b2438d3 61
switches 0:5c4d7b2438d3 62
switches 0:5c4d7b2438d3 63 /*******************************************************************************
switches 0:5c4d7b2438d3 64 * CMSIS definitions
switches 0:5c4d7b2438d3 65 ******************************************************************************/
switches 0:5c4d7b2438d3 66 /** \ingroup SC000
switches 0:5c4d7b2438d3 67 @{
switches 0:5c4d7b2438d3 68 */
switches 0:5c4d7b2438d3 69
switches 0:5c4d7b2438d3 70 /* CMSIS SC000 definitions */
switches 0:5c4d7b2438d3 71 #define __SC000_CMSIS_VERSION_MAIN (0x04) /*!< [31:16] CMSIS HAL main version */
switches 0:5c4d7b2438d3 72 #define __SC000_CMSIS_VERSION_SUB (0x00) /*!< [15:0] CMSIS HAL sub version */
switches 0:5c4d7b2438d3 73 #define __SC000_CMSIS_VERSION ((__SC000_CMSIS_VERSION_MAIN << 16) | \
switches 0:5c4d7b2438d3 74 __SC000_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */
switches 0:5c4d7b2438d3 75
switches 0:5c4d7b2438d3 76 #define __CORTEX_SC (000) /*!< Cortex secure core */
switches 0:5c4d7b2438d3 77
switches 0:5c4d7b2438d3 78
switches 0:5c4d7b2438d3 79 #if defined ( __CC_ARM )
switches 0:5c4d7b2438d3 80 #define __ASM __asm /*!< asm keyword for ARM Compiler */
switches 0:5c4d7b2438d3 81 #define __INLINE __inline /*!< inline keyword for ARM Compiler */
switches 0:5c4d7b2438d3 82 #define __STATIC_INLINE static __inline
switches 0:5c4d7b2438d3 83
switches 0:5c4d7b2438d3 84 #elif defined ( __GNUC__ )
switches 0:5c4d7b2438d3 85 #define __ASM __asm /*!< asm keyword for GNU Compiler */
switches 0:5c4d7b2438d3 86 #define __INLINE inline /*!< inline keyword for GNU Compiler */
switches 0:5c4d7b2438d3 87 #define __STATIC_INLINE static inline
switches 0:5c4d7b2438d3 88
switches 0:5c4d7b2438d3 89 #elif defined ( __ICCARM__ )
switches 0:5c4d7b2438d3 90 #define __ASM __asm /*!< asm keyword for IAR Compiler */
switches 0:5c4d7b2438d3 91 #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
switches 0:5c4d7b2438d3 92 #define __STATIC_INLINE static inline
switches 0:5c4d7b2438d3 93
switches 0:5c4d7b2438d3 94 #elif defined ( __TMS470__ )
switches 0:5c4d7b2438d3 95 #define __ASM __asm /*!< asm keyword for TI CCS Compiler */
switches 0:5c4d7b2438d3 96 #define __STATIC_INLINE static inline
switches 0:5c4d7b2438d3 97
switches 0:5c4d7b2438d3 98 #elif defined ( __TASKING__ )
switches 0:5c4d7b2438d3 99 #define __ASM __asm /*!< asm keyword for TASKING Compiler */
switches 0:5c4d7b2438d3 100 #define __INLINE inline /*!< inline keyword for TASKING Compiler */
switches 0:5c4d7b2438d3 101 #define __STATIC_INLINE static inline
switches 0:5c4d7b2438d3 102
switches 0:5c4d7b2438d3 103 #elif defined ( __CSMC__ )
switches 0:5c4d7b2438d3 104 #define __packed
switches 0:5c4d7b2438d3 105 #define __ASM _asm /*!< asm keyword for COSMIC Compiler */
switches 0:5c4d7b2438d3 106 #define __INLINE inline /*use -pc99 on compile line !< inline keyword for COSMIC Compiler */
switches 0:5c4d7b2438d3 107 #define __STATIC_INLINE static inline
switches 0:5c4d7b2438d3 108
switches 0:5c4d7b2438d3 109 #endif
switches 0:5c4d7b2438d3 110
switches 0:5c4d7b2438d3 111 /** __FPU_USED indicates whether an FPU is used or not.
switches 0:5c4d7b2438d3 112 This core does not support an FPU at all
switches 0:5c4d7b2438d3 113 */
switches 0:5c4d7b2438d3 114 #define __FPU_USED 0
switches 0:5c4d7b2438d3 115
switches 0:5c4d7b2438d3 116 #if defined ( __CC_ARM )
switches 0:5c4d7b2438d3 117 #if defined __TARGET_FPU_VFP
switches 0:5c4d7b2438d3 118 #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
switches 0:5c4d7b2438d3 119 #endif
switches 0:5c4d7b2438d3 120
switches 0:5c4d7b2438d3 121 #elif defined ( __GNUC__ )
switches 0:5c4d7b2438d3 122 #if defined (__VFP_FP__) && !defined(__SOFTFP__)
switches 0:5c4d7b2438d3 123 #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
switches 0:5c4d7b2438d3 124 #endif
switches 0:5c4d7b2438d3 125
switches 0:5c4d7b2438d3 126 #elif defined ( __ICCARM__ )
switches 0:5c4d7b2438d3 127 #if defined __ARMVFP__
switches 0:5c4d7b2438d3 128 #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
switches 0:5c4d7b2438d3 129 #endif
switches 0:5c4d7b2438d3 130
switches 0:5c4d7b2438d3 131 #elif defined ( __TMS470__ )
switches 0:5c4d7b2438d3 132 #if defined __TI__VFP_SUPPORT____
switches 0:5c4d7b2438d3 133 #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
switches 0:5c4d7b2438d3 134 #endif
switches 0:5c4d7b2438d3 135
switches 0:5c4d7b2438d3 136 #elif defined ( __TASKING__ )
switches 0:5c4d7b2438d3 137 #if defined __FPU_VFP__
switches 0:5c4d7b2438d3 138 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
switches 0:5c4d7b2438d3 139 #endif
switches 0:5c4d7b2438d3 140
switches 0:5c4d7b2438d3 141 #elif defined ( __CSMC__ ) /* Cosmic */
switches 0:5c4d7b2438d3 142 #if ( __CSMC__ & 0x400) // FPU present for parser
switches 0:5c4d7b2438d3 143 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
switches 0:5c4d7b2438d3 144 #endif
switches 0:5c4d7b2438d3 145 #endif
switches 0:5c4d7b2438d3 146
switches 0:5c4d7b2438d3 147 #include <stdint.h> /* standard types definitions */
switches 0:5c4d7b2438d3 148 #include <core_cmInstr.h> /* Core Instruction Access */
switches 0:5c4d7b2438d3 149 #include <core_cmFunc.h> /* Core Function Access */
switches 0:5c4d7b2438d3 150
switches 0:5c4d7b2438d3 151 #ifdef __cplusplus
switches 0:5c4d7b2438d3 152 }
switches 0:5c4d7b2438d3 153 #endif
switches 0:5c4d7b2438d3 154
switches 0:5c4d7b2438d3 155 #endif /* __CORE_SC000_H_GENERIC */
switches 0:5c4d7b2438d3 156
switches 0:5c4d7b2438d3 157 #ifndef __CMSIS_GENERIC
switches 0:5c4d7b2438d3 158
switches 0:5c4d7b2438d3 159 #ifndef __CORE_SC000_H_DEPENDANT
switches 0:5c4d7b2438d3 160 #define __CORE_SC000_H_DEPENDANT
switches 0:5c4d7b2438d3 161
switches 0:5c4d7b2438d3 162 #ifdef __cplusplus
switches 0:5c4d7b2438d3 163 extern "C" {
switches 0:5c4d7b2438d3 164 #endif
switches 0:5c4d7b2438d3 165
switches 0:5c4d7b2438d3 166 /* check device defines and use defaults */
switches 0:5c4d7b2438d3 167 #if defined __CHECK_DEVICE_DEFINES
switches 0:5c4d7b2438d3 168 #ifndef __SC000_REV
switches 0:5c4d7b2438d3 169 #define __SC000_REV 0x0000
switches 0:5c4d7b2438d3 170 #warning "__SC000_REV not defined in device header file; using default!"
switches 0:5c4d7b2438d3 171 #endif
switches 0:5c4d7b2438d3 172
switches 0:5c4d7b2438d3 173 #ifndef __MPU_PRESENT
switches 0:5c4d7b2438d3 174 #define __MPU_PRESENT 0
switches 0:5c4d7b2438d3 175 #warning "__MPU_PRESENT not defined in device header file; using default!"
switches 0:5c4d7b2438d3 176 #endif
switches 0:5c4d7b2438d3 177
switches 0:5c4d7b2438d3 178 #ifndef __NVIC_PRIO_BITS
switches 0:5c4d7b2438d3 179 #define __NVIC_PRIO_BITS 2
switches 0:5c4d7b2438d3 180 #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
switches 0:5c4d7b2438d3 181 #endif
switches 0:5c4d7b2438d3 182
switches 0:5c4d7b2438d3 183 #ifndef __Vendor_SysTickConfig
switches 0:5c4d7b2438d3 184 #define __Vendor_SysTickConfig 0
switches 0:5c4d7b2438d3 185 #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
switches 0:5c4d7b2438d3 186 #endif
switches 0:5c4d7b2438d3 187 #endif
switches 0:5c4d7b2438d3 188
switches 0:5c4d7b2438d3 189 /* IO definitions (access restrictions to peripheral registers) */
switches 0:5c4d7b2438d3 190 /**
switches 0:5c4d7b2438d3 191 \defgroup CMSIS_glob_defs CMSIS Global Defines
switches 0:5c4d7b2438d3 192
switches 0:5c4d7b2438d3 193 <strong>IO Type Qualifiers</strong> are used
switches 0:5c4d7b2438d3 194 \li to specify the access to peripheral variables.
switches 0:5c4d7b2438d3 195 \li for automatic generation of peripheral register debug information.
switches 0:5c4d7b2438d3 196 */
switches 0:5c4d7b2438d3 197 #ifdef __cplusplus
switches 0:5c4d7b2438d3 198 #define __I volatile /*!< Defines 'read only' permissions */
switches 0:5c4d7b2438d3 199 #else
switches 0:5c4d7b2438d3 200 #define __I volatile const /*!< Defines 'read only' permissions */
switches 0:5c4d7b2438d3 201 #endif
switches 0:5c4d7b2438d3 202 #define __O volatile /*!< Defines 'write only' permissions */
switches 0:5c4d7b2438d3 203 #define __IO volatile /*!< Defines 'read / write' permissions */
switches 0:5c4d7b2438d3 204
switches 0:5c4d7b2438d3 205 /*@} end of group SC000 */
switches 0:5c4d7b2438d3 206
switches 0:5c4d7b2438d3 207
switches 0:5c4d7b2438d3 208
switches 0:5c4d7b2438d3 209 /*******************************************************************************
switches 0:5c4d7b2438d3 210 * Register Abstraction
switches 0:5c4d7b2438d3 211 Core Register contain:
switches 0:5c4d7b2438d3 212 - Core Register
switches 0:5c4d7b2438d3 213 - Core NVIC Register
switches 0:5c4d7b2438d3 214 - Core SCB Register
switches 0:5c4d7b2438d3 215 - Core SysTick Register
switches 0:5c4d7b2438d3 216 - Core MPU Register
switches 0:5c4d7b2438d3 217 ******************************************************************************/
switches 0:5c4d7b2438d3 218 /** \defgroup CMSIS_core_register Defines and Type Definitions
switches 0:5c4d7b2438d3 219 \brief Type definitions and defines for Cortex-M processor based devices.
switches 0:5c4d7b2438d3 220 */
switches 0:5c4d7b2438d3 221
switches 0:5c4d7b2438d3 222 /** \ingroup CMSIS_core_register
switches 0:5c4d7b2438d3 223 \defgroup CMSIS_CORE Status and Control Registers
switches 0:5c4d7b2438d3 224 \brief Core Register type definitions.
switches 0:5c4d7b2438d3 225 @{
switches 0:5c4d7b2438d3 226 */
switches 0:5c4d7b2438d3 227
switches 0:5c4d7b2438d3 228 /** \brief Union type to access the Application Program Status Register (APSR).
switches 0:5c4d7b2438d3 229 */
switches 0:5c4d7b2438d3 230 typedef union
switches 0:5c4d7b2438d3 231 {
switches 0:5c4d7b2438d3 232 struct
switches 0:5c4d7b2438d3 233 {
switches 0:5c4d7b2438d3 234 uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
switches 0:5c4d7b2438d3 235 uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
switches 0:5c4d7b2438d3 236 uint32_t C:1; /*!< bit: 29 Carry condition code flag */
switches 0:5c4d7b2438d3 237 uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
switches 0:5c4d7b2438d3 238 uint32_t N:1; /*!< bit: 31 Negative condition code flag */
switches 0:5c4d7b2438d3 239 } b; /*!< Structure used for bit access */
switches 0:5c4d7b2438d3 240 uint32_t w; /*!< Type used for word access */
switches 0:5c4d7b2438d3 241 } APSR_Type;
switches 0:5c4d7b2438d3 242
switches 0:5c4d7b2438d3 243 /* APSR Register Definitions */
switches 0:5c4d7b2438d3 244 #define APSR_N_Pos 31 /*!< APSR: N Position */
switches 0:5c4d7b2438d3 245 #define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
switches 0:5c4d7b2438d3 246
switches 0:5c4d7b2438d3 247 #define APSR_Z_Pos 30 /*!< APSR: Z Position */
switches 0:5c4d7b2438d3 248 #define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
switches 0:5c4d7b2438d3 249
switches 0:5c4d7b2438d3 250 #define APSR_C_Pos 29 /*!< APSR: C Position */
switches 0:5c4d7b2438d3 251 #define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
switches 0:5c4d7b2438d3 252
switches 0:5c4d7b2438d3 253 #define APSR_V_Pos 28 /*!< APSR: V Position */
switches 0:5c4d7b2438d3 254 #define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
switches 0:5c4d7b2438d3 255
switches 0:5c4d7b2438d3 256
switches 0:5c4d7b2438d3 257 /** \brief Union type to access the Interrupt Program Status Register (IPSR).
switches 0:5c4d7b2438d3 258 */
switches 0:5c4d7b2438d3 259 typedef union
switches 0:5c4d7b2438d3 260 {
switches 0:5c4d7b2438d3 261 struct
switches 0:5c4d7b2438d3 262 {
switches 0:5c4d7b2438d3 263 uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
switches 0:5c4d7b2438d3 264 uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
switches 0:5c4d7b2438d3 265 } b; /*!< Structure used for bit access */
switches 0:5c4d7b2438d3 266 uint32_t w; /*!< Type used for word access */
switches 0:5c4d7b2438d3 267 } IPSR_Type;
switches 0:5c4d7b2438d3 268
switches 0:5c4d7b2438d3 269 /* IPSR Register Definitions */
switches 0:5c4d7b2438d3 270 #define IPSR_ISR_Pos 0 /*!< IPSR: ISR Position */
switches 0:5c4d7b2438d3 271 #define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
switches 0:5c4d7b2438d3 272
switches 0:5c4d7b2438d3 273
switches 0:5c4d7b2438d3 274 /** \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
switches 0:5c4d7b2438d3 275 */
switches 0:5c4d7b2438d3 276 typedef union
switches 0:5c4d7b2438d3 277 {
switches 0:5c4d7b2438d3 278 struct
switches 0:5c4d7b2438d3 279 {
switches 0:5c4d7b2438d3 280 uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
switches 0:5c4d7b2438d3 281 uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
switches 0:5c4d7b2438d3 282 uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
switches 0:5c4d7b2438d3 283 uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
switches 0:5c4d7b2438d3 284 uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
switches 0:5c4d7b2438d3 285 uint32_t C:1; /*!< bit: 29 Carry condition code flag */
switches 0:5c4d7b2438d3 286 uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
switches 0:5c4d7b2438d3 287 uint32_t N:1; /*!< bit: 31 Negative condition code flag */
switches 0:5c4d7b2438d3 288 } b; /*!< Structure used for bit access */
switches 0:5c4d7b2438d3 289 uint32_t w; /*!< Type used for word access */
switches 0:5c4d7b2438d3 290 } xPSR_Type;
switches 0:5c4d7b2438d3 291
switches 0:5c4d7b2438d3 292 /* xPSR Register Definitions */
switches 0:5c4d7b2438d3 293 #define xPSR_N_Pos 31 /*!< xPSR: N Position */
switches 0:5c4d7b2438d3 294 #define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
switches 0:5c4d7b2438d3 295
switches 0:5c4d7b2438d3 296 #define xPSR_Z_Pos 30 /*!< xPSR: Z Position */
switches 0:5c4d7b2438d3 297 #define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
switches 0:5c4d7b2438d3 298
switches 0:5c4d7b2438d3 299 #define xPSR_C_Pos 29 /*!< xPSR: C Position */
switches 0:5c4d7b2438d3 300 #define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
switches 0:5c4d7b2438d3 301
switches 0:5c4d7b2438d3 302 #define xPSR_V_Pos 28 /*!< xPSR: V Position */
switches 0:5c4d7b2438d3 303 #define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
switches 0:5c4d7b2438d3 304
switches 0:5c4d7b2438d3 305 #define xPSR_T_Pos 24 /*!< xPSR: T Position */
switches 0:5c4d7b2438d3 306 #define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
switches 0:5c4d7b2438d3 307
switches 0:5c4d7b2438d3 308 #define xPSR_ISR_Pos 0 /*!< xPSR: ISR Position */
switches 0:5c4d7b2438d3 309 #define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
switches 0:5c4d7b2438d3 310
switches 0:5c4d7b2438d3 311
switches 0:5c4d7b2438d3 312 /** \brief Union type to access the Control Registers (CONTROL).
switches 0:5c4d7b2438d3 313 */
switches 0:5c4d7b2438d3 314 typedef union
switches 0:5c4d7b2438d3 315 {
switches 0:5c4d7b2438d3 316 struct
switches 0:5c4d7b2438d3 317 {
switches 0:5c4d7b2438d3 318 uint32_t _reserved0:1; /*!< bit: 0 Reserved */
switches 0:5c4d7b2438d3 319 uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
switches 0:5c4d7b2438d3 320 uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
switches 0:5c4d7b2438d3 321 } b; /*!< Structure used for bit access */
switches 0:5c4d7b2438d3 322 uint32_t w; /*!< Type used for word access */
switches 0:5c4d7b2438d3 323 } CONTROL_Type;
switches 0:5c4d7b2438d3 324
switches 0:5c4d7b2438d3 325 /* CONTROL Register Definitions */
switches 0:5c4d7b2438d3 326 #define CONTROL_SPSEL_Pos 1 /*!< CONTROL: SPSEL Position */
switches 0:5c4d7b2438d3 327 #define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
switches 0:5c4d7b2438d3 328
switches 0:5c4d7b2438d3 329 /*@} end of group CMSIS_CORE */
switches 0:5c4d7b2438d3 330
switches 0:5c4d7b2438d3 331
switches 0:5c4d7b2438d3 332 /** \ingroup CMSIS_core_register
switches 0:5c4d7b2438d3 333 \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
switches 0:5c4d7b2438d3 334 \brief Type definitions for the NVIC Registers
switches 0:5c4d7b2438d3 335 @{
switches 0:5c4d7b2438d3 336 */
switches 0:5c4d7b2438d3 337
switches 0:5c4d7b2438d3 338 /** \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
switches 0:5c4d7b2438d3 339 */
switches 0:5c4d7b2438d3 340 typedef struct
switches 0:5c4d7b2438d3 341 {
switches 0:5c4d7b2438d3 342 __IO uint32_t ISER[1]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
switches 0:5c4d7b2438d3 343 uint32_t RESERVED0[31];
switches 0:5c4d7b2438d3 344 __IO uint32_t ICER[1]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
switches 0:5c4d7b2438d3 345 uint32_t RSERVED1[31];
switches 0:5c4d7b2438d3 346 __IO uint32_t ISPR[1]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
switches 0:5c4d7b2438d3 347 uint32_t RESERVED2[31];
switches 0:5c4d7b2438d3 348 __IO uint32_t ICPR[1]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
switches 0:5c4d7b2438d3 349 uint32_t RESERVED3[31];
switches 0:5c4d7b2438d3 350 uint32_t RESERVED4[64];
switches 0:5c4d7b2438d3 351 __IO uint32_t IP[8]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
switches 0:5c4d7b2438d3 352 } NVIC_Type;
switches 0:5c4d7b2438d3 353
switches 0:5c4d7b2438d3 354 /*@} end of group CMSIS_NVIC */
switches 0:5c4d7b2438d3 355
switches 0:5c4d7b2438d3 356
switches 0:5c4d7b2438d3 357 /** \ingroup CMSIS_core_register
switches 0:5c4d7b2438d3 358 \defgroup CMSIS_SCB System Control Block (SCB)
switches 0:5c4d7b2438d3 359 \brief Type definitions for the System Control Block Registers
switches 0:5c4d7b2438d3 360 @{
switches 0:5c4d7b2438d3 361 */
switches 0:5c4d7b2438d3 362
switches 0:5c4d7b2438d3 363 /** \brief Structure type to access the System Control Block (SCB).
switches 0:5c4d7b2438d3 364 */
switches 0:5c4d7b2438d3 365 typedef struct
switches 0:5c4d7b2438d3 366 {
switches 0:5c4d7b2438d3 367 __I uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
switches 0:5c4d7b2438d3 368 __IO uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
switches 0:5c4d7b2438d3 369 __IO uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
switches 0:5c4d7b2438d3 370 __IO uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
switches 0:5c4d7b2438d3 371 __IO uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
switches 0:5c4d7b2438d3 372 __IO uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
switches 0:5c4d7b2438d3 373 uint32_t RESERVED0[1];
switches 0:5c4d7b2438d3 374 __IO uint32_t SHP[2]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
switches 0:5c4d7b2438d3 375 __IO uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
switches 0:5c4d7b2438d3 376 uint32_t RESERVED1[154];
switches 0:5c4d7b2438d3 377 __IO uint32_t SFCR; /*!< Offset: 0x290 (R/W) Security Features Control Register */
switches 0:5c4d7b2438d3 378 } SCB_Type;
switches 0:5c4d7b2438d3 379
switches 0:5c4d7b2438d3 380 /* SCB CPUID Register Definitions */
switches 0:5c4d7b2438d3 381 #define SCB_CPUID_IMPLEMENTER_Pos 24 /*!< SCB CPUID: IMPLEMENTER Position */
switches 0:5c4d7b2438d3 382 #define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
switches 0:5c4d7b2438d3 383
switches 0:5c4d7b2438d3 384 #define SCB_CPUID_VARIANT_Pos 20 /*!< SCB CPUID: VARIANT Position */
switches 0:5c4d7b2438d3 385 #define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
switches 0:5c4d7b2438d3 386
switches 0:5c4d7b2438d3 387 #define SCB_CPUID_ARCHITECTURE_Pos 16 /*!< SCB CPUID: ARCHITECTURE Position */
switches 0:5c4d7b2438d3 388 #define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
switches 0:5c4d7b2438d3 389
switches 0:5c4d7b2438d3 390 #define SCB_CPUID_PARTNO_Pos 4 /*!< SCB CPUID: PARTNO Position */
switches 0:5c4d7b2438d3 391 #define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
switches 0:5c4d7b2438d3 392
switches 0:5c4d7b2438d3 393 #define SCB_CPUID_REVISION_Pos 0 /*!< SCB CPUID: REVISION Position */
switches 0:5c4d7b2438d3 394 #define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
switches 0:5c4d7b2438d3 395
switches 0:5c4d7b2438d3 396 /* SCB Interrupt Control State Register Definitions */
switches 0:5c4d7b2438d3 397 #define SCB_ICSR_NMIPENDSET_Pos 31 /*!< SCB ICSR: NMIPENDSET Position */
switches 0:5c4d7b2438d3 398 #define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
switches 0:5c4d7b2438d3 399
switches 0:5c4d7b2438d3 400 #define SCB_ICSR_PENDSVSET_Pos 28 /*!< SCB ICSR: PENDSVSET Position */
switches 0:5c4d7b2438d3 401 #define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
switches 0:5c4d7b2438d3 402
switches 0:5c4d7b2438d3 403 #define SCB_ICSR_PENDSVCLR_Pos 27 /*!< SCB ICSR: PENDSVCLR Position */
switches 0:5c4d7b2438d3 404 #define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
switches 0:5c4d7b2438d3 405
switches 0:5c4d7b2438d3 406 #define SCB_ICSR_PENDSTSET_Pos 26 /*!< SCB ICSR: PENDSTSET Position */
switches 0:5c4d7b2438d3 407 #define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
switches 0:5c4d7b2438d3 408
switches 0:5c4d7b2438d3 409 #define SCB_ICSR_PENDSTCLR_Pos 25 /*!< SCB ICSR: PENDSTCLR Position */
switches 0:5c4d7b2438d3 410 #define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
switches 0:5c4d7b2438d3 411
switches 0:5c4d7b2438d3 412 #define SCB_ICSR_ISRPREEMPT_Pos 23 /*!< SCB ICSR: ISRPREEMPT Position */
switches 0:5c4d7b2438d3 413 #define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
switches 0:5c4d7b2438d3 414
switches 0:5c4d7b2438d3 415 #define SCB_ICSR_ISRPENDING_Pos 22 /*!< SCB ICSR: ISRPENDING Position */
switches 0:5c4d7b2438d3 416 #define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
switches 0:5c4d7b2438d3 417
switches 0:5c4d7b2438d3 418 #define SCB_ICSR_VECTPENDING_Pos 12 /*!< SCB ICSR: VECTPENDING Position */
switches 0:5c4d7b2438d3 419 #define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
switches 0:5c4d7b2438d3 420
switches 0:5c4d7b2438d3 421 #define SCB_ICSR_VECTACTIVE_Pos 0 /*!< SCB ICSR: VECTACTIVE Position */
switches 0:5c4d7b2438d3 422 #define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
switches 0:5c4d7b2438d3 423
switches 0:5c4d7b2438d3 424 /* SCB Interrupt Control State Register Definitions */
switches 0:5c4d7b2438d3 425 #define SCB_VTOR_TBLOFF_Pos 7 /*!< SCB VTOR: TBLOFF Position */
switches 0:5c4d7b2438d3 426 #define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
switches 0:5c4d7b2438d3 427
switches 0:5c4d7b2438d3 428 /* SCB Application Interrupt and Reset Control Register Definitions */
switches 0:5c4d7b2438d3 429 #define SCB_AIRCR_VECTKEY_Pos 16 /*!< SCB AIRCR: VECTKEY Position */
switches 0:5c4d7b2438d3 430 #define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
switches 0:5c4d7b2438d3 431
switches 0:5c4d7b2438d3 432 #define SCB_AIRCR_VECTKEYSTAT_Pos 16 /*!< SCB AIRCR: VECTKEYSTAT Position */
switches 0:5c4d7b2438d3 433 #define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
switches 0:5c4d7b2438d3 434
switches 0:5c4d7b2438d3 435 #define SCB_AIRCR_ENDIANESS_Pos 15 /*!< SCB AIRCR: ENDIANESS Position */
switches 0:5c4d7b2438d3 436 #define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
switches 0:5c4d7b2438d3 437
switches 0:5c4d7b2438d3 438 #define SCB_AIRCR_SYSRESETREQ_Pos 2 /*!< SCB AIRCR: SYSRESETREQ Position */
switches 0:5c4d7b2438d3 439 #define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
switches 0:5c4d7b2438d3 440
switches 0:5c4d7b2438d3 441 #define SCB_AIRCR_VECTCLRACTIVE_Pos 1 /*!< SCB AIRCR: VECTCLRACTIVE Position */
switches 0:5c4d7b2438d3 442 #define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
switches 0:5c4d7b2438d3 443
switches 0:5c4d7b2438d3 444 /* SCB System Control Register Definitions */
switches 0:5c4d7b2438d3 445 #define SCB_SCR_SEVONPEND_Pos 4 /*!< SCB SCR: SEVONPEND Position */
switches 0:5c4d7b2438d3 446 #define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
switches 0:5c4d7b2438d3 447
switches 0:5c4d7b2438d3 448 #define SCB_SCR_SLEEPDEEP_Pos 2 /*!< SCB SCR: SLEEPDEEP Position */
switches 0:5c4d7b2438d3 449 #define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
switches 0:5c4d7b2438d3 450
switches 0:5c4d7b2438d3 451 #define SCB_SCR_SLEEPONEXIT_Pos 1 /*!< SCB SCR: SLEEPONEXIT Position */
switches 0:5c4d7b2438d3 452 #define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
switches 0:5c4d7b2438d3 453
switches 0:5c4d7b2438d3 454 /* SCB Configuration Control Register Definitions */
switches 0:5c4d7b2438d3 455 #define SCB_CCR_STKALIGN_Pos 9 /*!< SCB CCR: STKALIGN Position */
switches 0:5c4d7b2438d3 456 #define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
switches 0:5c4d7b2438d3 457
switches 0:5c4d7b2438d3 458 #define SCB_CCR_UNALIGN_TRP_Pos 3 /*!< SCB CCR: UNALIGN_TRP Position */
switches 0:5c4d7b2438d3 459 #define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
switches 0:5c4d7b2438d3 460
switches 0:5c4d7b2438d3 461 /* SCB System Handler Control and State Register Definitions */
switches 0:5c4d7b2438d3 462 #define SCB_SHCSR_SVCALLPENDED_Pos 15 /*!< SCB SHCSR: SVCALLPENDED Position */
switches 0:5c4d7b2438d3 463 #define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
switches 0:5c4d7b2438d3 464
switches 0:5c4d7b2438d3 465 /*@} end of group CMSIS_SCB */
switches 0:5c4d7b2438d3 466
switches 0:5c4d7b2438d3 467
switches 0:5c4d7b2438d3 468 /** \ingroup CMSIS_core_register
switches 0:5c4d7b2438d3 469 \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
switches 0:5c4d7b2438d3 470 \brief Type definitions for the System Control and ID Register not in the SCB
switches 0:5c4d7b2438d3 471 @{
switches 0:5c4d7b2438d3 472 */
switches 0:5c4d7b2438d3 473
switches 0:5c4d7b2438d3 474 /** \brief Structure type to access the System Control and ID Register not in the SCB.
switches 0:5c4d7b2438d3 475 */
switches 0:5c4d7b2438d3 476 typedef struct
switches 0:5c4d7b2438d3 477 {
switches 0:5c4d7b2438d3 478 uint32_t RESERVED0[2];
switches 0:5c4d7b2438d3 479 __IO uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
switches 0:5c4d7b2438d3 480 } SCnSCB_Type;
switches 0:5c4d7b2438d3 481
switches 0:5c4d7b2438d3 482 /* Auxiliary Control Register Definitions */
switches 0:5c4d7b2438d3 483 #define SCnSCB_ACTLR_DISMCYCINT_Pos 0 /*!< ACTLR: DISMCYCINT Position */
switches 0:5c4d7b2438d3 484 #define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */
switches 0:5c4d7b2438d3 485
switches 0:5c4d7b2438d3 486 /*@} end of group CMSIS_SCnotSCB */
switches 0:5c4d7b2438d3 487
switches 0:5c4d7b2438d3 488
switches 0:5c4d7b2438d3 489 /** \ingroup CMSIS_core_register
switches 0:5c4d7b2438d3 490 \defgroup CMSIS_SysTick System Tick Timer (SysTick)
switches 0:5c4d7b2438d3 491 \brief Type definitions for the System Timer Registers.
switches 0:5c4d7b2438d3 492 @{
switches 0:5c4d7b2438d3 493 */
switches 0:5c4d7b2438d3 494
switches 0:5c4d7b2438d3 495 /** \brief Structure type to access the System Timer (SysTick).
switches 0:5c4d7b2438d3 496 */
switches 0:5c4d7b2438d3 497 typedef struct
switches 0:5c4d7b2438d3 498 {
switches 0:5c4d7b2438d3 499 __IO uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
switches 0:5c4d7b2438d3 500 __IO uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
switches 0:5c4d7b2438d3 501 __IO uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
switches 0:5c4d7b2438d3 502 __I uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
switches 0:5c4d7b2438d3 503 } SysTick_Type;
switches 0:5c4d7b2438d3 504
switches 0:5c4d7b2438d3 505 /* SysTick Control / Status Register Definitions */
switches 0:5c4d7b2438d3 506 #define SysTick_CTRL_COUNTFLAG_Pos 16 /*!< SysTick CTRL: COUNTFLAG Position */
switches 0:5c4d7b2438d3 507 #define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
switches 0:5c4d7b2438d3 508
switches 0:5c4d7b2438d3 509 #define SysTick_CTRL_CLKSOURCE_Pos 2 /*!< SysTick CTRL: CLKSOURCE Position */
switches 0:5c4d7b2438d3 510 #define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
switches 0:5c4d7b2438d3 511
switches 0:5c4d7b2438d3 512 #define SysTick_CTRL_TICKINT_Pos 1 /*!< SysTick CTRL: TICKINT Position */
switches 0:5c4d7b2438d3 513 #define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
switches 0:5c4d7b2438d3 514
switches 0:5c4d7b2438d3 515 #define SysTick_CTRL_ENABLE_Pos 0 /*!< SysTick CTRL: ENABLE Position */
switches 0:5c4d7b2438d3 516 #define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
switches 0:5c4d7b2438d3 517
switches 0:5c4d7b2438d3 518 /* SysTick Reload Register Definitions */
switches 0:5c4d7b2438d3 519 #define SysTick_LOAD_RELOAD_Pos 0 /*!< SysTick LOAD: RELOAD Position */
switches 0:5c4d7b2438d3 520 #define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
switches 0:5c4d7b2438d3 521
switches 0:5c4d7b2438d3 522 /* SysTick Current Register Definitions */
switches 0:5c4d7b2438d3 523 #define SysTick_VAL_CURRENT_Pos 0 /*!< SysTick VAL: CURRENT Position */
switches 0:5c4d7b2438d3 524 #define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
switches 0:5c4d7b2438d3 525
switches 0:5c4d7b2438d3 526 /* SysTick Calibration Register Definitions */
switches 0:5c4d7b2438d3 527 #define SysTick_CALIB_NOREF_Pos 31 /*!< SysTick CALIB: NOREF Position */
switches 0:5c4d7b2438d3 528 #define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
switches 0:5c4d7b2438d3 529
switches 0:5c4d7b2438d3 530 #define SysTick_CALIB_SKEW_Pos 30 /*!< SysTick CALIB: SKEW Position */
switches 0:5c4d7b2438d3 531 #define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
switches 0:5c4d7b2438d3 532
switches 0:5c4d7b2438d3 533 #define SysTick_CALIB_TENMS_Pos 0 /*!< SysTick CALIB: TENMS Position */
switches 0:5c4d7b2438d3 534 #define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
switches 0:5c4d7b2438d3 535
switches 0:5c4d7b2438d3 536 /*@} end of group CMSIS_SysTick */
switches 0:5c4d7b2438d3 537
switches 0:5c4d7b2438d3 538 #if (__MPU_PRESENT == 1)
switches 0:5c4d7b2438d3 539 /** \ingroup CMSIS_core_register
switches 0:5c4d7b2438d3 540 \defgroup CMSIS_MPU Memory Protection Unit (MPU)
switches 0:5c4d7b2438d3 541 \brief Type definitions for the Memory Protection Unit (MPU)
switches 0:5c4d7b2438d3 542 @{
switches 0:5c4d7b2438d3 543 */
switches 0:5c4d7b2438d3 544
switches 0:5c4d7b2438d3 545 /** \brief Structure type to access the Memory Protection Unit (MPU).
switches 0:5c4d7b2438d3 546 */
switches 0:5c4d7b2438d3 547 typedef struct
switches 0:5c4d7b2438d3 548 {
switches 0:5c4d7b2438d3 549 __I uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
switches 0:5c4d7b2438d3 550 __IO uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
switches 0:5c4d7b2438d3 551 __IO uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
switches 0:5c4d7b2438d3 552 __IO uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
switches 0:5c4d7b2438d3 553 __IO uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */
switches 0:5c4d7b2438d3 554 } MPU_Type;
switches 0:5c4d7b2438d3 555
switches 0:5c4d7b2438d3 556 /* MPU Type Register */
switches 0:5c4d7b2438d3 557 #define MPU_TYPE_IREGION_Pos 16 /*!< MPU TYPE: IREGION Position */
switches 0:5c4d7b2438d3 558 #define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
switches 0:5c4d7b2438d3 559
switches 0:5c4d7b2438d3 560 #define MPU_TYPE_DREGION_Pos 8 /*!< MPU TYPE: DREGION Position */
switches 0:5c4d7b2438d3 561 #define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
switches 0:5c4d7b2438d3 562
switches 0:5c4d7b2438d3 563 #define MPU_TYPE_SEPARATE_Pos 0 /*!< MPU TYPE: SEPARATE Position */
switches 0:5c4d7b2438d3 564 #define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
switches 0:5c4d7b2438d3 565
switches 0:5c4d7b2438d3 566 /* MPU Control Register */
switches 0:5c4d7b2438d3 567 #define MPU_CTRL_PRIVDEFENA_Pos 2 /*!< MPU CTRL: PRIVDEFENA Position */
switches 0:5c4d7b2438d3 568 #define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
switches 0:5c4d7b2438d3 569
switches 0:5c4d7b2438d3 570 #define MPU_CTRL_HFNMIENA_Pos 1 /*!< MPU CTRL: HFNMIENA Position */
switches 0:5c4d7b2438d3 571 #define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
switches 0:5c4d7b2438d3 572
switches 0:5c4d7b2438d3 573 #define MPU_CTRL_ENABLE_Pos 0 /*!< MPU CTRL: ENABLE Position */
switches 0:5c4d7b2438d3 574 #define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
switches 0:5c4d7b2438d3 575
switches 0:5c4d7b2438d3 576 /* MPU Region Number Register */
switches 0:5c4d7b2438d3 577 #define MPU_RNR_REGION_Pos 0 /*!< MPU RNR: REGION Position */
switches 0:5c4d7b2438d3 578 #define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
switches 0:5c4d7b2438d3 579
switches 0:5c4d7b2438d3 580 /* MPU Region Base Address Register */
switches 0:5c4d7b2438d3 581 #define MPU_RBAR_ADDR_Pos 8 /*!< MPU RBAR: ADDR Position */
switches 0:5c4d7b2438d3 582 #define MPU_RBAR_ADDR_Msk (0xFFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
switches 0:5c4d7b2438d3 583
switches 0:5c4d7b2438d3 584 #define MPU_RBAR_VALID_Pos 4 /*!< MPU RBAR: VALID Position */
switches 0:5c4d7b2438d3 585 #define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */
switches 0:5c4d7b2438d3 586
switches 0:5c4d7b2438d3 587 #define MPU_RBAR_REGION_Pos 0 /*!< MPU RBAR: REGION Position */
switches 0:5c4d7b2438d3 588 #define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */
switches 0:5c4d7b2438d3 589
switches 0:5c4d7b2438d3 590 /* MPU Region Attribute and Size Register */
switches 0:5c4d7b2438d3 591 #define MPU_RASR_ATTRS_Pos 16 /*!< MPU RASR: MPU Region Attribute field Position */
switches 0:5c4d7b2438d3 592 #define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */
switches 0:5c4d7b2438d3 593
switches 0:5c4d7b2438d3 594 #define MPU_RASR_XN_Pos 28 /*!< MPU RASR: ATTRS.XN Position */
switches 0:5c4d7b2438d3 595 #define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */
switches 0:5c4d7b2438d3 596
switches 0:5c4d7b2438d3 597 #define MPU_RASR_AP_Pos 24 /*!< MPU RASR: ATTRS.AP Position */
switches 0:5c4d7b2438d3 598 #define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */
switches 0:5c4d7b2438d3 599
switches 0:5c4d7b2438d3 600 #define MPU_RASR_TEX_Pos 19 /*!< MPU RASR: ATTRS.TEX Position */
switches 0:5c4d7b2438d3 601 #define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */
switches 0:5c4d7b2438d3 602
switches 0:5c4d7b2438d3 603 #define MPU_RASR_S_Pos 18 /*!< MPU RASR: ATTRS.S Position */
switches 0:5c4d7b2438d3 604 #define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */
switches 0:5c4d7b2438d3 605
switches 0:5c4d7b2438d3 606 #define MPU_RASR_C_Pos 17 /*!< MPU RASR: ATTRS.C Position */
switches 0:5c4d7b2438d3 607 #define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */
switches 0:5c4d7b2438d3 608
switches 0:5c4d7b2438d3 609 #define MPU_RASR_B_Pos 16 /*!< MPU RASR: ATTRS.B Position */
switches 0:5c4d7b2438d3 610 #define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */
switches 0:5c4d7b2438d3 611
switches 0:5c4d7b2438d3 612 #define MPU_RASR_SRD_Pos 8 /*!< MPU RASR: Sub-Region Disable Position */
switches 0:5c4d7b2438d3 613 #define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */
switches 0:5c4d7b2438d3 614
switches 0:5c4d7b2438d3 615 #define MPU_RASR_SIZE_Pos 1 /*!< MPU RASR: Region Size Field Position */
switches 0:5c4d7b2438d3 616 #define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */
switches 0:5c4d7b2438d3 617
switches 0:5c4d7b2438d3 618 #define MPU_RASR_ENABLE_Pos 0 /*!< MPU RASR: Region enable bit Position */
switches 0:5c4d7b2438d3 619 #define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */
switches 0:5c4d7b2438d3 620
switches 0:5c4d7b2438d3 621 /*@} end of group CMSIS_MPU */
switches 0:5c4d7b2438d3 622 #endif
switches 0:5c4d7b2438d3 623
switches 0:5c4d7b2438d3 624
switches 0:5c4d7b2438d3 625 /** \ingroup CMSIS_core_register
switches 0:5c4d7b2438d3 626 \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
switches 0:5c4d7b2438d3 627 \brief SC000 Core Debug Registers (DCB registers, SHCSR, and DFSR)
switches 0:5c4d7b2438d3 628 are only accessible over DAP and not via processor. Therefore
switches 0:5c4d7b2438d3 629 they are not covered by the Cortex-M0 header file.
switches 0:5c4d7b2438d3 630 @{
switches 0:5c4d7b2438d3 631 */
switches 0:5c4d7b2438d3 632 /*@} end of group CMSIS_CoreDebug */
switches 0:5c4d7b2438d3 633
switches 0:5c4d7b2438d3 634
switches 0:5c4d7b2438d3 635 /** \ingroup CMSIS_core_register
switches 0:5c4d7b2438d3 636 \defgroup CMSIS_core_base Core Definitions
switches 0:5c4d7b2438d3 637 \brief Definitions for base addresses, unions, and structures.
switches 0:5c4d7b2438d3 638 @{
switches 0:5c4d7b2438d3 639 */
switches 0:5c4d7b2438d3 640
switches 0:5c4d7b2438d3 641 /* Memory mapping of SC000 Hardware */
switches 0:5c4d7b2438d3 642 #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
switches 0:5c4d7b2438d3 643 #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
switches 0:5c4d7b2438d3 644 #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
switches 0:5c4d7b2438d3 645 #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
switches 0:5c4d7b2438d3 646
switches 0:5c4d7b2438d3 647 #define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
switches 0:5c4d7b2438d3 648 #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
switches 0:5c4d7b2438d3 649 #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
switches 0:5c4d7b2438d3 650 #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
switches 0:5c4d7b2438d3 651
switches 0:5c4d7b2438d3 652 #if (__MPU_PRESENT == 1)
switches 0:5c4d7b2438d3 653 #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
switches 0:5c4d7b2438d3 654 #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
switches 0:5c4d7b2438d3 655 #endif
switches 0:5c4d7b2438d3 656
switches 0:5c4d7b2438d3 657 /*@} */
switches 0:5c4d7b2438d3 658
switches 0:5c4d7b2438d3 659
switches 0:5c4d7b2438d3 660
switches 0:5c4d7b2438d3 661 /*******************************************************************************
switches 0:5c4d7b2438d3 662 * Hardware Abstraction Layer
switches 0:5c4d7b2438d3 663 Core Function Interface contains:
switches 0:5c4d7b2438d3 664 - Core NVIC Functions
switches 0:5c4d7b2438d3 665 - Core SysTick Functions
switches 0:5c4d7b2438d3 666 - Core Register Access Functions
switches 0:5c4d7b2438d3 667 ******************************************************************************/
switches 0:5c4d7b2438d3 668 /** \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
switches 0:5c4d7b2438d3 669 */
switches 0:5c4d7b2438d3 670
switches 0:5c4d7b2438d3 671
switches 0:5c4d7b2438d3 672
switches 0:5c4d7b2438d3 673 /* ########################## NVIC functions #################################### */
switches 0:5c4d7b2438d3 674 /** \ingroup CMSIS_Core_FunctionInterface
switches 0:5c4d7b2438d3 675 \defgroup CMSIS_Core_NVICFunctions NVIC Functions
switches 0:5c4d7b2438d3 676 \brief Functions that manage interrupts and exceptions via the NVIC.
switches 0:5c4d7b2438d3 677 @{
switches 0:5c4d7b2438d3 678 */
switches 0:5c4d7b2438d3 679
switches 0:5c4d7b2438d3 680 /* Interrupt Priorities are WORD accessible only under ARMv6M */
switches 0:5c4d7b2438d3 681 /* The following MACROS handle generation of the register offset and byte masks */
switches 0:5c4d7b2438d3 682 #define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
switches 0:5c4d7b2438d3 683 #define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
switches 0:5c4d7b2438d3 684 #define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
switches 0:5c4d7b2438d3 685
switches 0:5c4d7b2438d3 686
switches 0:5c4d7b2438d3 687 /** \brief Enable External Interrupt
switches 0:5c4d7b2438d3 688
switches 0:5c4d7b2438d3 689 The function enables a device-specific interrupt in the NVIC interrupt controller.
switches 0:5c4d7b2438d3 690
switches 0:5c4d7b2438d3 691 \param [in] IRQn External interrupt number. Value cannot be negative.
switches 0:5c4d7b2438d3 692 */
switches 0:5c4d7b2438d3 693 __STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
switches 0:5c4d7b2438d3 694 {
switches 0:5c4d7b2438d3 695 NVIC->ISER[0] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
switches 0:5c4d7b2438d3 696 }
switches 0:5c4d7b2438d3 697
switches 0:5c4d7b2438d3 698
switches 0:5c4d7b2438d3 699 /** \brief Disable External Interrupt
switches 0:5c4d7b2438d3 700
switches 0:5c4d7b2438d3 701 The function disables a device-specific interrupt in the NVIC interrupt controller.
switches 0:5c4d7b2438d3 702
switches 0:5c4d7b2438d3 703 \param [in] IRQn External interrupt number. Value cannot be negative.
switches 0:5c4d7b2438d3 704 */
switches 0:5c4d7b2438d3 705 __STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
switches 0:5c4d7b2438d3 706 {
switches 0:5c4d7b2438d3 707 NVIC->ICER[0] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
switches 0:5c4d7b2438d3 708 }
switches 0:5c4d7b2438d3 709
switches 0:5c4d7b2438d3 710
switches 0:5c4d7b2438d3 711 /** \brief Get Pending Interrupt
switches 0:5c4d7b2438d3 712
switches 0:5c4d7b2438d3 713 The function reads the pending register in the NVIC and returns the pending bit
switches 0:5c4d7b2438d3 714 for the specified interrupt.
switches 0:5c4d7b2438d3 715
switches 0:5c4d7b2438d3 716 \param [in] IRQn Interrupt number.
switches 0:5c4d7b2438d3 717
switches 0:5c4d7b2438d3 718 \return 0 Interrupt status is not pending.
switches 0:5c4d7b2438d3 719 \return 1 Interrupt status is pending.
switches 0:5c4d7b2438d3 720 */
switches 0:5c4d7b2438d3 721 __STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
switches 0:5c4d7b2438d3 722 {
switches 0:5c4d7b2438d3 723 return((uint32_t)(((NVIC->ISPR[0] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
switches 0:5c4d7b2438d3 724 }
switches 0:5c4d7b2438d3 725
switches 0:5c4d7b2438d3 726
switches 0:5c4d7b2438d3 727 /** \brief Set Pending Interrupt
switches 0:5c4d7b2438d3 728
switches 0:5c4d7b2438d3 729 The function sets the pending bit of an external interrupt.
switches 0:5c4d7b2438d3 730
switches 0:5c4d7b2438d3 731 \param [in] IRQn Interrupt number. Value cannot be negative.
switches 0:5c4d7b2438d3 732 */
switches 0:5c4d7b2438d3 733 __STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
switches 0:5c4d7b2438d3 734 {
switches 0:5c4d7b2438d3 735 NVIC->ISPR[0] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
switches 0:5c4d7b2438d3 736 }
switches 0:5c4d7b2438d3 737
switches 0:5c4d7b2438d3 738
switches 0:5c4d7b2438d3 739 /** \brief Clear Pending Interrupt
switches 0:5c4d7b2438d3 740
switches 0:5c4d7b2438d3 741 The function clears the pending bit of an external interrupt.
switches 0:5c4d7b2438d3 742
switches 0:5c4d7b2438d3 743 \param [in] IRQn External interrupt number. Value cannot be negative.
switches 0:5c4d7b2438d3 744 */
switches 0:5c4d7b2438d3 745 __STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
switches 0:5c4d7b2438d3 746 {
switches 0:5c4d7b2438d3 747 NVIC->ICPR[0] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
switches 0:5c4d7b2438d3 748 }
switches 0:5c4d7b2438d3 749
switches 0:5c4d7b2438d3 750
switches 0:5c4d7b2438d3 751 /** \brief Set Interrupt Priority
switches 0:5c4d7b2438d3 752
switches 0:5c4d7b2438d3 753 The function sets the priority of an interrupt.
switches 0:5c4d7b2438d3 754
switches 0:5c4d7b2438d3 755 \note The priority cannot be set for every core interrupt.
switches 0:5c4d7b2438d3 756
switches 0:5c4d7b2438d3 757 \param [in] IRQn Interrupt number.
switches 0:5c4d7b2438d3 758 \param [in] priority Priority to set.
switches 0:5c4d7b2438d3 759 */
switches 0:5c4d7b2438d3 760 __STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
switches 0:5c4d7b2438d3 761 {
switches 0:5c4d7b2438d3 762 if((int32_t)(IRQn) < 0) {
switches 0:5c4d7b2438d3 763 SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
switches 0:5c4d7b2438d3 764 (((priority << (8 - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
switches 0:5c4d7b2438d3 765 }
switches 0:5c4d7b2438d3 766 else {
switches 0:5c4d7b2438d3 767 NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
switches 0:5c4d7b2438d3 768 (((priority << (8 - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
switches 0:5c4d7b2438d3 769 }
switches 0:5c4d7b2438d3 770 }
switches 0:5c4d7b2438d3 771
switches 0:5c4d7b2438d3 772
switches 0:5c4d7b2438d3 773 /** \brief Get Interrupt Priority
switches 0:5c4d7b2438d3 774
switches 0:5c4d7b2438d3 775 The function reads the priority of an interrupt. The interrupt
switches 0:5c4d7b2438d3 776 number can be positive to specify an external (device specific)
switches 0:5c4d7b2438d3 777 interrupt, or negative to specify an internal (core) interrupt.
switches 0:5c4d7b2438d3 778
switches 0:5c4d7b2438d3 779
switches 0:5c4d7b2438d3 780 \param [in] IRQn Interrupt number.
switches 0:5c4d7b2438d3 781 \return Interrupt Priority. Value is aligned automatically to the implemented
switches 0:5c4d7b2438d3 782 priority bits of the microcontroller.
switches 0:5c4d7b2438d3 783 */
switches 0:5c4d7b2438d3 784 __STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)
switches 0:5c4d7b2438d3 785 {
switches 0:5c4d7b2438d3 786
switches 0:5c4d7b2438d3 787 if((int32_t)(IRQn) < 0) {
switches 0:5c4d7b2438d3 788 return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8 - __NVIC_PRIO_BITS)));
switches 0:5c4d7b2438d3 789 }
switches 0:5c4d7b2438d3 790 else {
switches 0:5c4d7b2438d3 791 return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8 - __NVIC_PRIO_BITS)));
switches 0:5c4d7b2438d3 792 }
switches 0:5c4d7b2438d3 793 }
switches 0:5c4d7b2438d3 794
switches 0:5c4d7b2438d3 795
switches 0:5c4d7b2438d3 796 /** \brief System Reset
switches 0:5c4d7b2438d3 797
switches 0:5c4d7b2438d3 798 The function initiates a system reset request to reset the MCU.
switches 0:5c4d7b2438d3 799 */
switches 0:5c4d7b2438d3 800 __STATIC_INLINE void NVIC_SystemReset(void)
switches 0:5c4d7b2438d3 801 {
switches 0:5c4d7b2438d3 802 __DSB(); /* Ensure all outstanding memory accesses included
switches 0:5c4d7b2438d3 803 buffered write are completed before reset */
switches 0:5c4d7b2438d3 804 SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
switches 0:5c4d7b2438d3 805 SCB_AIRCR_SYSRESETREQ_Msk);
switches 0:5c4d7b2438d3 806 __DSB(); /* Ensure completion of memory access */
switches 0:5c4d7b2438d3 807 while(1) { __NOP(); } /* wait until reset */
switches 0:5c4d7b2438d3 808 }
switches 0:5c4d7b2438d3 809
switches 0:5c4d7b2438d3 810 /*@} end of CMSIS_Core_NVICFunctions */
switches 0:5c4d7b2438d3 811
switches 0:5c4d7b2438d3 812
switches 0:5c4d7b2438d3 813
switches 0:5c4d7b2438d3 814 /* ################################## SysTick function ############################################ */
switches 0:5c4d7b2438d3 815 /** \ingroup CMSIS_Core_FunctionInterface
switches 0:5c4d7b2438d3 816 \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
switches 0:5c4d7b2438d3 817 \brief Functions that configure the System.
switches 0:5c4d7b2438d3 818 @{
switches 0:5c4d7b2438d3 819 */
switches 0:5c4d7b2438d3 820
switches 0:5c4d7b2438d3 821 #if (__Vendor_SysTickConfig == 0)
switches 0:5c4d7b2438d3 822
switches 0:5c4d7b2438d3 823 /** \brief System Tick Configuration
switches 0:5c4d7b2438d3 824
switches 0:5c4d7b2438d3 825 The function initializes the System Timer and its interrupt, and starts the System Tick Timer.
switches 0:5c4d7b2438d3 826 Counter is in free running mode to generate periodic interrupts.
switches 0:5c4d7b2438d3 827
switches 0:5c4d7b2438d3 828 \param [in] ticks Number of ticks between two interrupts.
switches 0:5c4d7b2438d3 829
switches 0:5c4d7b2438d3 830 \return 0 Function succeeded.
switches 0:5c4d7b2438d3 831 \return 1 Function failed.
switches 0:5c4d7b2438d3 832
switches 0:5c4d7b2438d3 833 \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
switches 0:5c4d7b2438d3 834 function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
switches 0:5c4d7b2438d3 835 must contain a vendor-specific implementation of this function.
switches 0:5c4d7b2438d3 836
switches 0:5c4d7b2438d3 837 */
switches 0:5c4d7b2438d3 838 __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
switches 0:5c4d7b2438d3 839 {
switches 0:5c4d7b2438d3 840 if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) {return (1UL);} /* Reload value impossible */
switches 0:5c4d7b2438d3 841
switches 0:5c4d7b2438d3 842 SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
switches 0:5c4d7b2438d3 843 NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
switches 0:5c4d7b2438d3 844 SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
switches 0:5c4d7b2438d3 845 SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
switches 0:5c4d7b2438d3 846 SysTick_CTRL_TICKINT_Msk |
switches 0:5c4d7b2438d3 847 SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
switches 0:5c4d7b2438d3 848 return (0UL); /* Function successful */
switches 0:5c4d7b2438d3 849 }
switches 0:5c4d7b2438d3 850
switches 0:5c4d7b2438d3 851 #endif
switches 0:5c4d7b2438d3 852
switches 0:5c4d7b2438d3 853 /*@} end of CMSIS_Core_SysTickFunctions */
switches 0:5c4d7b2438d3 854
switches 0:5c4d7b2438d3 855
switches 0:5c4d7b2438d3 856
switches 0:5c4d7b2438d3 857
switches 0:5c4d7b2438d3 858 #ifdef __cplusplus
switches 0:5c4d7b2438d3 859 }
switches 0:5c4d7b2438d3 860 #endif
switches 0:5c4d7b2438d3 861
switches 0:5c4d7b2438d3 862 #endif /* __CORE_SC000_H_DEPENDANT */
switches 0:5c4d7b2438d3 863
switches 0:5c4d7b2438d3 864 #endif /* __CMSIS_GENERIC */