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