USB Serial application

Fork of USBSerial_HelloWorld by Samuel Mokrani

Committer:
Zaitsev
Date:
Tue Jan 10 20:42:26 2017 +0000
Revision:
10:41552d038a69
USB Serial bi-directional bridge

Who changed what in which revision?

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