mbed.h library with any bug fixes AV finds.
Dependents: micromouse4_encoder_testing PID_Test Lab1_Test WorkingPID ... more
targets/cmsis/core_cm0.h@0:ba7650f404af, 2015-11-02 (annotated)
- Committer:
- aravindsv
- Date:
- Mon Nov 02 02:26:59 2015 +0000
- Revision:
- 0:ba7650f404af
Reduced HSE_STARTUP_TIMEOUT to 500 ms, fixed some compiler warnings
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aravindsv | 0:ba7650f404af | 1 | /**************************************************************************//** |
aravindsv | 0:ba7650f404af | 2 | * @file core_cm0.h |
aravindsv | 0:ba7650f404af | 3 | * @brief CMSIS Cortex-M0 Core Peripheral Access Layer Header File |
aravindsv | 0:ba7650f404af | 4 | * @version V3.20 |
aravindsv | 0:ba7650f404af | 5 | * @date 25. February 2013 |
aravindsv | 0:ba7650f404af | 6 | * |
aravindsv | 0:ba7650f404af | 7 | * @note |
aravindsv | 0:ba7650f404af | 8 | * |
aravindsv | 0:ba7650f404af | 9 | ******************************************************************************/ |
aravindsv | 0:ba7650f404af | 10 | /* Copyright (c) 2009 - 2013 ARM LIMITED |
aravindsv | 0:ba7650f404af | 11 | |
aravindsv | 0:ba7650f404af | 12 | All rights reserved. |
aravindsv | 0:ba7650f404af | 13 | Redistribution and use in source and binary forms, with or without |
aravindsv | 0:ba7650f404af | 14 | modification, are permitted provided that the following conditions are met: |
aravindsv | 0:ba7650f404af | 15 | - Redistributions of source code must retain the above copyright |
aravindsv | 0:ba7650f404af | 16 | notice, this list of conditions and the following disclaimer. |
aravindsv | 0:ba7650f404af | 17 | - Redistributions in binary form must reproduce the above copyright |
aravindsv | 0:ba7650f404af | 18 | notice, this list of conditions and the following disclaimer in the |
aravindsv | 0:ba7650f404af | 19 | documentation and/or other materials provided with the distribution. |
aravindsv | 0:ba7650f404af | 20 | - Neither the name of ARM nor the names of its contributors may be used |
aravindsv | 0:ba7650f404af | 21 | to endorse or promote products derived from this software without |
aravindsv | 0:ba7650f404af | 22 | specific prior written permission. |
aravindsv | 0:ba7650f404af | 23 | * |
aravindsv | 0:ba7650f404af | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
aravindsv | 0:ba7650f404af | 25 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
aravindsv | 0:ba7650f404af | 26 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
aravindsv | 0:ba7650f404af | 27 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE |
aravindsv | 0:ba7650f404af | 28 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
aravindsv | 0:ba7650f404af | 29 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
aravindsv | 0:ba7650f404af | 30 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
aravindsv | 0:ba7650f404af | 31 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
aravindsv | 0:ba7650f404af | 32 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
aravindsv | 0:ba7650f404af | 33 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
aravindsv | 0:ba7650f404af | 34 | POSSIBILITY OF SUCH DAMAGE. |
aravindsv | 0:ba7650f404af | 35 | ---------------------------------------------------------------------------*/ |
aravindsv | 0:ba7650f404af | 36 | |
aravindsv | 0:ba7650f404af | 37 | |
aravindsv | 0:ba7650f404af | 38 | #if defined ( __ICCARM__ ) |
aravindsv | 0:ba7650f404af | 39 | #pragma system_include /* treat file as system include file for MISRA check */ |
aravindsv | 0:ba7650f404af | 40 | #endif |
aravindsv | 0:ba7650f404af | 41 | |
aravindsv | 0:ba7650f404af | 42 | #ifdef __cplusplus |
aravindsv | 0:ba7650f404af | 43 | extern "C" { |
aravindsv | 0:ba7650f404af | 44 | #endif |
aravindsv | 0:ba7650f404af | 45 | |
aravindsv | 0:ba7650f404af | 46 | #ifndef __CORE_CM0_H_GENERIC |
aravindsv | 0:ba7650f404af | 47 | #define __CORE_CM0_H_GENERIC |
aravindsv | 0:ba7650f404af | 48 | |
aravindsv | 0:ba7650f404af | 49 | /** \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions |
aravindsv | 0:ba7650f404af | 50 | CMSIS violates the following MISRA-C:2004 rules: |
aravindsv | 0:ba7650f404af | 51 | |
aravindsv | 0:ba7650f404af | 52 | \li Required Rule 8.5, object/function definition in header file.<br> |
aravindsv | 0:ba7650f404af | 53 | Function definitions in header files are used to allow 'inlining'. |
aravindsv | 0:ba7650f404af | 54 | |
aravindsv | 0:ba7650f404af | 55 | \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br> |
aravindsv | 0:ba7650f404af | 56 | Unions are used for effective representation of core registers. |
aravindsv | 0:ba7650f404af | 57 | |
aravindsv | 0:ba7650f404af | 58 | \li Advisory Rule 19.7, Function-like macro defined.<br> |
aravindsv | 0:ba7650f404af | 59 | Function-like macros are used to allow more efficient code. |
aravindsv | 0:ba7650f404af | 60 | */ |
aravindsv | 0:ba7650f404af | 61 | |
aravindsv | 0:ba7650f404af | 62 | |
aravindsv | 0:ba7650f404af | 63 | /******************************************************************************* |
aravindsv | 0:ba7650f404af | 64 | * CMSIS definitions |
aravindsv | 0:ba7650f404af | 65 | ******************************************************************************/ |
aravindsv | 0:ba7650f404af | 66 | /** \ingroup Cortex_M0 |
aravindsv | 0:ba7650f404af | 67 | @{ |
aravindsv | 0:ba7650f404af | 68 | */ |
aravindsv | 0:ba7650f404af | 69 | |
aravindsv | 0:ba7650f404af | 70 | /* CMSIS CM0 definitions */ |
aravindsv | 0:ba7650f404af | 71 | #define __CM0_CMSIS_VERSION_MAIN (0x03) /*!< [31:16] CMSIS HAL main version */ |
aravindsv | 0:ba7650f404af | 72 | #define __CM0_CMSIS_VERSION_SUB (0x20) /*!< [15:0] CMSIS HAL sub version */ |
aravindsv | 0:ba7650f404af | 73 | #define __CM0_CMSIS_VERSION ((__CM0_CMSIS_VERSION_MAIN << 16) | \ |
aravindsv | 0:ba7650f404af | 74 | __CM0_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */ |
aravindsv | 0:ba7650f404af | 75 | |
aravindsv | 0:ba7650f404af | 76 | #define __CORTEX_M (0x00) /*!< Cortex-M Core */ |
aravindsv | 0:ba7650f404af | 77 | |
aravindsv | 0:ba7650f404af | 78 | |
aravindsv | 0:ba7650f404af | 79 | #if defined ( __CC_ARM ) |
aravindsv | 0:ba7650f404af | 80 | #define __ASM __asm /*!< asm keyword for ARM Compiler */ |
aravindsv | 0:ba7650f404af | 81 | #define __INLINE __inline /*!< inline keyword for ARM Compiler */ |
aravindsv | 0:ba7650f404af | 82 | #define __STATIC_INLINE static __inline |
aravindsv | 0:ba7650f404af | 83 | |
aravindsv | 0:ba7650f404af | 84 | #elif defined ( __ICCARM__ ) |
aravindsv | 0:ba7650f404af | 85 | #define __ASM __asm /*!< asm keyword for IAR Compiler */ |
aravindsv | 0:ba7650f404af | 86 | #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ |
aravindsv | 0:ba7650f404af | 87 | #define __STATIC_INLINE static inline |
aravindsv | 0:ba7650f404af | 88 | |
aravindsv | 0:ba7650f404af | 89 | #elif defined ( __GNUC__ ) |
aravindsv | 0:ba7650f404af | 90 | #define __ASM __asm /*!< asm keyword for GNU Compiler */ |
aravindsv | 0:ba7650f404af | 91 | #define __INLINE inline /*!< inline keyword for GNU Compiler */ |
aravindsv | 0:ba7650f404af | 92 | #define __STATIC_INLINE static inline |
aravindsv | 0:ba7650f404af | 93 | |
aravindsv | 0:ba7650f404af | 94 | #elif defined ( __TASKING__ ) |
aravindsv | 0:ba7650f404af | 95 | #define __ASM __asm /*!< asm keyword for TASKING Compiler */ |
aravindsv | 0:ba7650f404af | 96 | #define __INLINE inline /*!< inline keyword for TASKING Compiler */ |
aravindsv | 0:ba7650f404af | 97 | #define __STATIC_INLINE static inline |
aravindsv | 0:ba7650f404af | 98 | |
aravindsv | 0:ba7650f404af | 99 | #endif |
aravindsv | 0:ba7650f404af | 100 | |
aravindsv | 0:ba7650f404af | 101 | /** __FPU_USED indicates whether an FPU is used or not. This core does not support an FPU at all |
aravindsv | 0:ba7650f404af | 102 | */ |
aravindsv | 0:ba7650f404af | 103 | #define __FPU_USED 0 |
aravindsv | 0:ba7650f404af | 104 | |
aravindsv | 0:ba7650f404af | 105 | #if defined ( __CC_ARM ) |
aravindsv | 0:ba7650f404af | 106 | #if defined __TARGET_FPU_VFP |
aravindsv | 0:ba7650f404af | 107 | #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" |
aravindsv | 0:ba7650f404af | 108 | #endif |
aravindsv | 0:ba7650f404af | 109 | |
aravindsv | 0:ba7650f404af | 110 | #elif defined ( __ICCARM__ ) |
aravindsv | 0:ba7650f404af | 111 | #if defined __ARMVFP__ |
aravindsv | 0:ba7650f404af | 112 | #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" |
aravindsv | 0:ba7650f404af | 113 | #endif |
aravindsv | 0:ba7650f404af | 114 | |
aravindsv | 0:ba7650f404af | 115 | #elif defined ( __GNUC__ ) |
aravindsv | 0:ba7650f404af | 116 | #if defined (__VFP_FP__) && !defined(__SOFTFP__) |
aravindsv | 0:ba7650f404af | 117 | #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" |
aravindsv | 0:ba7650f404af | 118 | #endif |
aravindsv | 0:ba7650f404af | 119 | |
aravindsv | 0:ba7650f404af | 120 | #elif defined ( __TASKING__ ) |
aravindsv | 0:ba7650f404af | 121 | #if defined __FPU_VFP__ |
aravindsv | 0:ba7650f404af | 122 | #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" |
aravindsv | 0:ba7650f404af | 123 | #endif |
aravindsv | 0:ba7650f404af | 124 | #endif |
aravindsv | 0:ba7650f404af | 125 | |
aravindsv | 0:ba7650f404af | 126 | #include <stdint.h> /* standard types definitions */ |
aravindsv | 0:ba7650f404af | 127 | #include <core_cmInstr.h> /* Core Instruction Access */ |
aravindsv | 0:ba7650f404af | 128 | #include <core_cmFunc.h> /* Core Function Access */ |
aravindsv | 0:ba7650f404af | 129 | |
aravindsv | 0:ba7650f404af | 130 | #endif /* __CORE_CM0_H_GENERIC */ |
aravindsv | 0:ba7650f404af | 131 | |
aravindsv | 0:ba7650f404af | 132 | #ifndef __CMSIS_GENERIC |
aravindsv | 0:ba7650f404af | 133 | |
aravindsv | 0:ba7650f404af | 134 | #ifndef __CORE_CM0_H_DEPENDANT |
aravindsv | 0:ba7650f404af | 135 | #define __CORE_CM0_H_DEPENDANT |
aravindsv | 0:ba7650f404af | 136 | |
aravindsv | 0:ba7650f404af | 137 | /* check device defines and use defaults */ |
aravindsv | 0:ba7650f404af | 138 | #if defined __CHECK_DEVICE_DEFINES |
aravindsv | 0:ba7650f404af | 139 | #ifndef __CM0_REV |
aravindsv | 0:ba7650f404af | 140 | #define __CM0_REV 0x0000 |
aravindsv | 0:ba7650f404af | 141 | #warning "__CM0_REV not defined in device header file; using default!" |
aravindsv | 0:ba7650f404af | 142 | #endif |
aravindsv | 0:ba7650f404af | 143 | |
aravindsv | 0:ba7650f404af | 144 | #ifndef __NVIC_PRIO_BITS |
aravindsv | 0:ba7650f404af | 145 | #define __NVIC_PRIO_BITS 2 |
aravindsv | 0:ba7650f404af | 146 | #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" |
aravindsv | 0:ba7650f404af | 147 | #endif |
aravindsv | 0:ba7650f404af | 148 | |
aravindsv | 0:ba7650f404af | 149 | #ifndef __Vendor_SysTickConfig |
aravindsv | 0:ba7650f404af | 150 | #define __Vendor_SysTickConfig 0 |
aravindsv | 0:ba7650f404af | 151 | #warning "__Vendor_SysTickConfig not defined in device header file; using default!" |
aravindsv | 0:ba7650f404af | 152 | #endif |
aravindsv | 0:ba7650f404af | 153 | #endif |
aravindsv | 0:ba7650f404af | 154 | |
aravindsv | 0:ba7650f404af | 155 | /* IO definitions (access restrictions to peripheral registers) */ |
aravindsv | 0:ba7650f404af | 156 | /** |
aravindsv | 0:ba7650f404af | 157 | \defgroup CMSIS_glob_defs CMSIS Global Defines |
aravindsv | 0:ba7650f404af | 158 | |
aravindsv | 0:ba7650f404af | 159 | <strong>IO Type Qualifiers</strong> are used |
aravindsv | 0:ba7650f404af | 160 | \li to specify the access to peripheral variables. |
aravindsv | 0:ba7650f404af | 161 | \li for automatic generation of peripheral register debug information. |
aravindsv | 0:ba7650f404af | 162 | */ |
aravindsv | 0:ba7650f404af | 163 | #ifdef __cplusplus |
aravindsv | 0:ba7650f404af | 164 | #define __I volatile /*!< Defines 'read only' permissions */ |
aravindsv | 0:ba7650f404af | 165 | #else |
aravindsv | 0:ba7650f404af | 166 | #define __I volatile const /*!< Defines 'read only' permissions */ |
aravindsv | 0:ba7650f404af | 167 | #endif |
aravindsv | 0:ba7650f404af | 168 | #define __O volatile /*!< Defines 'write only' permissions */ |
aravindsv | 0:ba7650f404af | 169 | #define __IO volatile /*!< Defines 'read / write' permissions */ |
aravindsv | 0:ba7650f404af | 170 | |
aravindsv | 0:ba7650f404af | 171 | /*@} end of group Cortex_M0 */ |
aravindsv | 0:ba7650f404af | 172 | |
aravindsv | 0:ba7650f404af | 173 | |
aravindsv | 0:ba7650f404af | 174 | |
aravindsv | 0:ba7650f404af | 175 | /******************************************************************************* |
aravindsv | 0:ba7650f404af | 176 | * Register Abstraction |
aravindsv | 0:ba7650f404af | 177 | Core Register contain: |
aravindsv | 0:ba7650f404af | 178 | - Core Register |
aravindsv | 0:ba7650f404af | 179 | - Core NVIC Register |
aravindsv | 0:ba7650f404af | 180 | - Core SCB Register |
aravindsv | 0:ba7650f404af | 181 | - Core SysTick Register |
aravindsv | 0:ba7650f404af | 182 | ******************************************************************************/ |
aravindsv | 0:ba7650f404af | 183 | /** \defgroup CMSIS_core_register Defines and Type Definitions |
aravindsv | 0:ba7650f404af | 184 | \brief Type definitions and defines for Cortex-M processor based devices. |
aravindsv | 0:ba7650f404af | 185 | */ |
aravindsv | 0:ba7650f404af | 186 | |
aravindsv | 0:ba7650f404af | 187 | /** \ingroup CMSIS_core_register |
aravindsv | 0:ba7650f404af | 188 | \defgroup CMSIS_CORE Status and Control Registers |
aravindsv | 0:ba7650f404af | 189 | \brief Core Register type definitions. |
aravindsv | 0:ba7650f404af | 190 | @{ |
aravindsv | 0:ba7650f404af | 191 | */ |
aravindsv | 0:ba7650f404af | 192 | |
aravindsv | 0:ba7650f404af | 193 | /** \brief Union type to access the Application Program Status Register (APSR). |
aravindsv | 0:ba7650f404af | 194 | */ |
aravindsv | 0:ba7650f404af | 195 | typedef union |
aravindsv | 0:ba7650f404af | 196 | { |
aravindsv | 0:ba7650f404af | 197 | struct |
aravindsv | 0:ba7650f404af | 198 | { |
aravindsv | 0:ba7650f404af | 199 | #if (__CORTEX_M != 0x04) |
aravindsv | 0:ba7650f404af | 200 | uint32_t _reserved0:27; /*!< bit: 0..26 Reserved */ |
aravindsv | 0:ba7650f404af | 201 | #else |
aravindsv | 0:ba7650f404af | 202 | uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */ |
aravindsv | 0:ba7650f404af | 203 | uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ |
aravindsv | 0:ba7650f404af | 204 | uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */ |
aravindsv | 0:ba7650f404af | 205 | #endif |
aravindsv | 0:ba7650f404af | 206 | uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ |
aravindsv | 0:ba7650f404af | 207 | uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ |
aravindsv | 0:ba7650f404af | 208 | uint32_t C:1; /*!< bit: 29 Carry condition code flag */ |
aravindsv | 0:ba7650f404af | 209 | uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ |
aravindsv | 0:ba7650f404af | 210 | uint32_t N:1; /*!< bit: 31 Negative condition code flag */ |
aravindsv | 0:ba7650f404af | 211 | } b; /*!< Structure used for bit access */ |
aravindsv | 0:ba7650f404af | 212 | uint32_t w; /*!< Type used for word access */ |
aravindsv | 0:ba7650f404af | 213 | } APSR_Type; |
aravindsv | 0:ba7650f404af | 214 | |
aravindsv | 0:ba7650f404af | 215 | |
aravindsv | 0:ba7650f404af | 216 | /** \brief Union type to access the Interrupt Program Status Register (IPSR). |
aravindsv | 0:ba7650f404af | 217 | */ |
aravindsv | 0:ba7650f404af | 218 | typedef union |
aravindsv | 0:ba7650f404af | 219 | { |
aravindsv | 0:ba7650f404af | 220 | struct |
aravindsv | 0:ba7650f404af | 221 | { |
aravindsv | 0:ba7650f404af | 222 | uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ |
aravindsv | 0:ba7650f404af | 223 | uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ |
aravindsv | 0:ba7650f404af | 224 | } b; /*!< Structure used for bit access */ |
aravindsv | 0:ba7650f404af | 225 | uint32_t w; /*!< Type used for word access */ |
aravindsv | 0:ba7650f404af | 226 | } IPSR_Type; |
aravindsv | 0:ba7650f404af | 227 | |
aravindsv | 0:ba7650f404af | 228 | |
aravindsv | 0:ba7650f404af | 229 | /** \brief Union type to access the Special-Purpose Program Status Registers (xPSR). |
aravindsv | 0:ba7650f404af | 230 | */ |
aravindsv | 0:ba7650f404af | 231 | typedef union |
aravindsv | 0:ba7650f404af | 232 | { |
aravindsv | 0:ba7650f404af | 233 | struct |
aravindsv | 0:ba7650f404af | 234 | { |
aravindsv | 0:ba7650f404af | 235 | uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ |
aravindsv | 0:ba7650f404af | 236 | #if (__CORTEX_M != 0x04) |
aravindsv | 0:ba7650f404af | 237 | uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ |
aravindsv | 0:ba7650f404af | 238 | #else |
aravindsv | 0:ba7650f404af | 239 | uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */ |
aravindsv | 0:ba7650f404af | 240 | uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ |
aravindsv | 0:ba7650f404af | 241 | uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */ |
aravindsv | 0:ba7650f404af | 242 | #endif |
aravindsv | 0:ba7650f404af | 243 | uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ |
aravindsv | 0:ba7650f404af | 244 | uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */ |
aravindsv | 0:ba7650f404af | 245 | uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ |
aravindsv | 0:ba7650f404af | 246 | uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ |
aravindsv | 0:ba7650f404af | 247 | uint32_t C:1; /*!< bit: 29 Carry condition code flag */ |
aravindsv | 0:ba7650f404af | 248 | uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ |
aravindsv | 0:ba7650f404af | 249 | uint32_t N:1; /*!< bit: 31 Negative condition code flag */ |
aravindsv | 0:ba7650f404af | 250 | } b; /*!< Structure used for bit access */ |
aravindsv | 0:ba7650f404af | 251 | uint32_t w; /*!< Type used for word access */ |
aravindsv | 0:ba7650f404af | 252 | } xPSR_Type; |
aravindsv | 0:ba7650f404af | 253 | |
aravindsv | 0:ba7650f404af | 254 | |
aravindsv | 0:ba7650f404af | 255 | /** \brief Union type to access the Control Registers (CONTROL). |
aravindsv | 0:ba7650f404af | 256 | */ |
aravindsv | 0:ba7650f404af | 257 | typedef union |
aravindsv | 0:ba7650f404af | 258 | { |
aravindsv | 0:ba7650f404af | 259 | struct |
aravindsv | 0:ba7650f404af | 260 | { |
aravindsv | 0:ba7650f404af | 261 | uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ |
aravindsv | 0:ba7650f404af | 262 | uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ |
aravindsv | 0:ba7650f404af | 263 | uint32_t FPCA:1; /*!< bit: 2 FP extension active flag */ |
aravindsv | 0:ba7650f404af | 264 | uint32_t _reserved0:29; /*!< bit: 3..31 Reserved */ |
aravindsv | 0:ba7650f404af | 265 | } b; /*!< Structure used for bit access */ |
aravindsv | 0:ba7650f404af | 266 | uint32_t w; /*!< Type used for word access */ |
aravindsv | 0:ba7650f404af | 267 | } CONTROL_Type; |
aravindsv | 0:ba7650f404af | 268 | |
aravindsv | 0:ba7650f404af | 269 | /*@} end of group CMSIS_CORE */ |
aravindsv | 0:ba7650f404af | 270 | |
aravindsv | 0:ba7650f404af | 271 | |
aravindsv | 0:ba7650f404af | 272 | /** \ingroup CMSIS_core_register |
aravindsv | 0:ba7650f404af | 273 | \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) |
aravindsv | 0:ba7650f404af | 274 | \brief Type definitions for the NVIC Registers |
aravindsv | 0:ba7650f404af | 275 | @{ |
aravindsv | 0:ba7650f404af | 276 | */ |
aravindsv | 0:ba7650f404af | 277 | |
aravindsv | 0:ba7650f404af | 278 | /** \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). |
aravindsv | 0:ba7650f404af | 279 | */ |
aravindsv | 0:ba7650f404af | 280 | typedef struct |
aravindsv | 0:ba7650f404af | 281 | { |
aravindsv | 0:ba7650f404af | 282 | __IO uint32_t ISER[1]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ |
aravindsv | 0:ba7650f404af | 283 | uint32_t RESERVED0[31]; |
aravindsv | 0:ba7650f404af | 284 | __IO uint32_t ICER[1]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ |
aravindsv | 0:ba7650f404af | 285 | uint32_t RSERVED1[31]; |
aravindsv | 0:ba7650f404af | 286 | __IO uint32_t ISPR[1]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ |
aravindsv | 0:ba7650f404af | 287 | uint32_t RESERVED2[31]; |
aravindsv | 0:ba7650f404af | 288 | __IO uint32_t ICPR[1]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ |
aravindsv | 0:ba7650f404af | 289 | uint32_t RESERVED3[31]; |
aravindsv | 0:ba7650f404af | 290 | uint32_t RESERVED4[64]; |
aravindsv | 0:ba7650f404af | 291 | __IO uint32_t IP[8]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ |
aravindsv | 0:ba7650f404af | 292 | } NVIC_Type; |
aravindsv | 0:ba7650f404af | 293 | |
aravindsv | 0:ba7650f404af | 294 | /*@} end of group CMSIS_NVIC */ |
aravindsv | 0:ba7650f404af | 295 | |
aravindsv | 0:ba7650f404af | 296 | |
aravindsv | 0:ba7650f404af | 297 | /** \ingroup CMSIS_core_register |
aravindsv | 0:ba7650f404af | 298 | \defgroup CMSIS_SCB System Control Block (SCB) |
aravindsv | 0:ba7650f404af | 299 | \brief Type definitions for the System Control Block Registers |
aravindsv | 0:ba7650f404af | 300 | @{ |
aravindsv | 0:ba7650f404af | 301 | */ |
aravindsv | 0:ba7650f404af | 302 | |
aravindsv | 0:ba7650f404af | 303 | /** \brief Structure type to access the System Control Block (SCB). |
aravindsv | 0:ba7650f404af | 304 | */ |
aravindsv | 0:ba7650f404af | 305 | typedef struct |
aravindsv | 0:ba7650f404af | 306 | { |
aravindsv | 0:ba7650f404af | 307 | __I uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ |
aravindsv | 0:ba7650f404af | 308 | __IO uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ |
aravindsv | 0:ba7650f404af | 309 | uint32_t RESERVED0; |
aravindsv | 0:ba7650f404af | 310 | __IO uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ |
aravindsv | 0:ba7650f404af | 311 | __IO uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ |
aravindsv | 0:ba7650f404af | 312 | __IO uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ |
aravindsv | 0:ba7650f404af | 313 | uint32_t RESERVED1; |
aravindsv | 0:ba7650f404af | 314 | __IO uint32_t SHP[2]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ |
aravindsv | 0:ba7650f404af | 315 | __IO uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ |
aravindsv | 0:ba7650f404af | 316 | } SCB_Type; |
aravindsv | 0:ba7650f404af | 317 | |
aravindsv | 0:ba7650f404af | 318 | /* SCB CPUID Register Definitions */ |
aravindsv | 0:ba7650f404af | 319 | #define SCB_CPUID_IMPLEMENTER_Pos 24 /*!< SCB CPUID: IMPLEMENTER Position */ |
aravindsv | 0:ba7650f404af | 320 | #define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ |
aravindsv | 0:ba7650f404af | 321 | |
aravindsv | 0:ba7650f404af | 322 | #define SCB_CPUID_VARIANT_Pos 20 /*!< SCB CPUID: VARIANT Position */ |
aravindsv | 0:ba7650f404af | 323 | #define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ |
aravindsv | 0:ba7650f404af | 324 | |
aravindsv | 0:ba7650f404af | 325 | #define SCB_CPUID_ARCHITECTURE_Pos 16 /*!< SCB CPUID: ARCHITECTURE Position */ |
aravindsv | 0:ba7650f404af | 326 | #define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ |
aravindsv | 0:ba7650f404af | 327 | |
aravindsv | 0:ba7650f404af | 328 | #define SCB_CPUID_PARTNO_Pos 4 /*!< SCB CPUID: PARTNO Position */ |
aravindsv | 0:ba7650f404af | 329 | #define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ |
aravindsv | 0:ba7650f404af | 330 | |
aravindsv | 0:ba7650f404af | 331 | #define SCB_CPUID_REVISION_Pos 0 /*!< SCB CPUID: REVISION Position */ |
aravindsv | 0:ba7650f404af | 332 | #define SCB_CPUID_REVISION_Msk (0xFUL << SCB_CPUID_REVISION_Pos) /*!< SCB CPUID: REVISION Mask */ |
aravindsv | 0:ba7650f404af | 333 | |
aravindsv | 0:ba7650f404af | 334 | /* SCB Interrupt Control State Register Definitions */ |
aravindsv | 0:ba7650f404af | 335 | #define SCB_ICSR_NMIPENDSET_Pos 31 /*!< SCB ICSR: NMIPENDSET Position */ |
aravindsv | 0:ba7650f404af | 336 | #define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ |
aravindsv | 0:ba7650f404af | 337 | |
aravindsv | 0:ba7650f404af | 338 | #define SCB_ICSR_PENDSVSET_Pos 28 /*!< SCB ICSR: PENDSVSET Position */ |
aravindsv | 0:ba7650f404af | 339 | #define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ |
aravindsv | 0:ba7650f404af | 340 | |
aravindsv | 0:ba7650f404af | 341 | #define SCB_ICSR_PENDSVCLR_Pos 27 /*!< SCB ICSR: PENDSVCLR Position */ |
aravindsv | 0:ba7650f404af | 342 | #define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ |
aravindsv | 0:ba7650f404af | 343 | |
aravindsv | 0:ba7650f404af | 344 | #define SCB_ICSR_PENDSTSET_Pos 26 /*!< SCB ICSR: PENDSTSET Position */ |
aravindsv | 0:ba7650f404af | 345 | #define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ |
aravindsv | 0:ba7650f404af | 346 | |
aravindsv | 0:ba7650f404af | 347 | #define SCB_ICSR_PENDSTCLR_Pos 25 /*!< SCB ICSR: PENDSTCLR Position */ |
aravindsv | 0:ba7650f404af | 348 | #define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ |
aravindsv | 0:ba7650f404af | 349 | |
aravindsv | 0:ba7650f404af | 350 | #define SCB_ICSR_ISRPREEMPT_Pos 23 /*!< SCB ICSR: ISRPREEMPT Position */ |
aravindsv | 0:ba7650f404af | 351 | #define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ |
aravindsv | 0:ba7650f404af | 352 | |
aravindsv | 0:ba7650f404af | 353 | #define SCB_ICSR_ISRPENDING_Pos 22 /*!< SCB ICSR: ISRPENDING Position */ |
aravindsv | 0:ba7650f404af | 354 | #define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ |
aravindsv | 0:ba7650f404af | 355 | |
aravindsv | 0:ba7650f404af | 356 | #define SCB_ICSR_VECTPENDING_Pos 12 /*!< SCB ICSR: VECTPENDING Position */ |
aravindsv | 0:ba7650f404af | 357 | #define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ |
aravindsv | 0:ba7650f404af | 358 | |
aravindsv | 0:ba7650f404af | 359 | #define SCB_ICSR_VECTACTIVE_Pos 0 /*!< SCB ICSR: VECTACTIVE Position */ |
aravindsv | 0:ba7650f404af | 360 | #define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL << SCB_ICSR_VECTACTIVE_Pos) /*!< SCB ICSR: VECTACTIVE Mask */ |
aravindsv | 0:ba7650f404af | 361 | |
aravindsv | 0:ba7650f404af | 362 | /* SCB Application Interrupt and Reset Control Register Definitions */ |
aravindsv | 0:ba7650f404af | 363 | #define SCB_AIRCR_VECTKEY_Pos 16 /*!< SCB AIRCR: VECTKEY Position */ |
aravindsv | 0:ba7650f404af | 364 | #define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ |
aravindsv | 0:ba7650f404af | 365 | |
aravindsv | 0:ba7650f404af | 366 | #define SCB_AIRCR_VECTKEYSTAT_Pos 16 /*!< SCB AIRCR: VECTKEYSTAT Position */ |
aravindsv | 0:ba7650f404af | 367 | #define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ |
aravindsv | 0:ba7650f404af | 368 | |
aravindsv | 0:ba7650f404af | 369 | #define SCB_AIRCR_ENDIANESS_Pos 15 /*!< SCB AIRCR: ENDIANESS Position */ |
aravindsv | 0:ba7650f404af | 370 | #define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ |
aravindsv | 0:ba7650f404af | 371 | |
aravindsv | 0:ba7650f404af | 372 | #define SCB_AIRCR_SYSRESETREQ_Pos 2 /*!< SCB AIRCR: SYSRESETREQ Position */ |
aravindsv | 0:ba7650f404af | 373 | #define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ |
aravindsv | 0:ba7650f404af | 374 | |
aravindsv | 0:ba7650f404af | 375 | #define SCB_AIRCR_VECTCLRACTIVE_Pos 1 /*!< SCB AIRCR: VECTCLRACTIVE Position */ |
aravindsv | 0:ba7650f404af | 376 | #define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ |
aravindsv | 0:ba7650f404af | 377 | |
aravindsv | 0:ba7650f404af | 378 | /* SCB System Control Register Definitions */ |
aravindsv | 0:ba7650f404af | 379 | #define SCB_SCR_SEVONPEND_Pos 4 /*!< SCB SCR: SEVONPEND Position */ |
aravindsv | 0:ba7650f404af | 380 | #define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ |
aravindsv | 0:ba7650f404af | 381 | |
aravindsv | 0:ba7650f404af | 382 | #define SCB_SCR_SLEEPDEEP_Pos 2 /*!< SCB SCR: SLEEPDEEP Position */ |
aravindsv | 0:ba7650f404af | 383 | #define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ |
aravindsv | 0:ba7650f404af | 384 | |
aravindsv | 0:ba7650f404af | 385 | #define SCB_SCR_SLEEPONEXIT_Pos 1 /*!< SCB SCR: SLEEPONEXIT Position */ |
aravindsv | 0:ba7650f404af | 386 | #define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ |
aravindsv | 0:ba7650f404af | 387 | |
aravindsv | 0:ba7650f404af | 388 | /* SCB Configuration Control Register Definitions */ |
aravindsv | 0:ba7650f404af | 389 | #define SCB_CCR_STKALIGN_Pos 9 /*!< SCB CCR: STKALIGN Position */ |
aravindsv | 0:ba7650f404af | 390 | #define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ |
aravindsv | 0:ba7650f404af | 391 | |
aravindsv | 0:ba7650f404af | 392 | #define SCB_CCR_UNALIGN_TRP_Pos 3 /*!< SCB CCR: UNALIGN_TRP Position */ |
aravindsv | 0:ba7650f404af | 393 | #define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ |
aravindsv | 0:ba7650f404af | 394 | |
aravindsv | 0:ba7650f404af | 395 | /* SCB System Handler Control and State Register Definitions */ |
aravindsv | 0:ba7650f404af | 396 | #define SCB_SHCSR_SVCALLPENDED_Pos 15 /*!< SCB SHCSR: SVCALLPENDED Position */ |
aravindsv | 0:ba7650f404af | 397 | #define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ |
aravindsv | 0:ba7650f404af | 398 | |
aravindsv | 0:ba7650f404af | 399 | /*@} end of group CMSIS_SCB */ |
aravindsv | 0:ba7650f404af | 400 | |
aravindsv | 0:ba7650f404af | 401 | |
aravindsv | 0:ba7650f404af | 402 | /** \ingroup CMSIS_core_register |
aravindsv | 0:ba7650f404af | 403 | \defgroup CMSIS_SysTick System Tick Timer (SysTick) |
aravindsv | 0:ba7650f404af | 404 | \brief Type definitions for the System Timer Registers. |
aravindsv | 0:ba7650f404af | 405 | @{ |
aravindsv | 0:ba7650f404af | 406 | */ |
aravindsv | 0:ba7650f404af | 407 | |
aravindsv | 0:ba7650f404af | 408 | /** \brief Structure type to access the System Timer (SysTick). |
aravindsv | 0:ba7650f404af | 409 | */ |
aravindsv | 0:ba7650f404af | 410 | typedef struct |
aravindsv | 0:ba7650f404af | 411 | { |
aravindsv | 0:ba7650f404af | 412 | __IO uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ |
aravindsv | 0:ba7650f404af | 413 | __IO uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ |
aravindsv | 0:ba7650f404af | 414 | __IO uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ |
aravindsv | 0:ba7650f404af | 415 | __I uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ |
aravindsv | 0:ba7650f404af | 416 | } SysTick_Type; |
aravindsv | 0:ba7650f404af | 417 | |
aravindsv | 0:ba7650f404af | 418 | /* SysTick Control / Status Register Definitions */ |
aravindsv | 0:ba7650f404af | 419 | #define SysTick_CTRL_COUNTFLAG_Pos 16 /*!< SysTick CTRL: COUNTFLAG Position */ |
aravindsv | 0:ba7650f404af | 420 | #define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ |
aravindsv | 0:ba7650f404af | 421 | |
aravindsv | 0:ba7650f404af | 422 | #define SysTick_CTRL_CLKSOURCE_Pos 2 /*!< SysTick CTRL: CLKSOURCE Position */ |
aravindsv | 0:ba7650f404af | 423 | #define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ |
aravindsv | 0:ba7650f404af | 424 | |
aravindsv | 0:ba7650f404af | 425 | #define SysTick_CTRL_TICKINT_Pos 1 /*!< SysTick CTRL: TICKINT Position */ |
aravindsv | 0:ba7650f404af | 426 | #define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ |
aravindsv | 0:ba7650f404af | 427 | |
aravindsv | 0:ba7650f404af | 428 | #define SysTick_CTRL_ENABLE_Pos 0 /*!< SysTick CTRL: ENABLE Position */ |
aravindsv | 0:ba7650f404af | 429 | #define SysTick_CTRL_ENABLE_Msk (1UL << SysTick_CTRL_ENABLE_Pos) /*!< SysTick CTRL: ENABLE Mask */ |
aravindsv | 0:ba7650f404af | 430 | |
aravindsv | 0:ba7650f404af | 431 | /* SysTick Reload Register Definitions */ |
aravindsv | 0:ba7650f404af | 432 | #define SysTick_LOAD_RELOAD_Pos 0 /*!< SysTick LOAD: RELOAD Position */ |
aravindsv | 0:ba7650f404af | 433 | #define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL << SysTick_LOAD_RELOAD_Pos) /*!< SysTick LOAD: RELOAD Mask */ |
aravindsv | 0:ba7650f404af | 434 | |
aravindsv | 0:ba7650f404af | 435 | /* SysTick Current Register Definitions */ |
aravindsv | 0:ba7650f404af | 436 | #define SysTick_VAL_CURRENT_Pos 0 /*!< SysTick VAL: CURRENT Position */ |
aravindsv | 0:ba7650f404af | 437 | #define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos) /*!< SysTick VAL: CURRENT Mask */ |
aravindsv | 0:ba7650f404af | 438 | |
aravindsv | 0:ba7650f404af | 439 | /* SysTick Calibration Register Definitions */ |
aravindsv | 0:ba7650f404af | 440 | #define SysTick_CALIB_NOREF_Pos 31 /*!< SysTick CALIB: NOREF Position */ |
aravindsv | 0:ba7650f404af | 441 | #define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ |
aravindsv | 0:ba7650f404af | 442 | |
aravindsv | 0:ba7650f404af | 443 | #define SysTick_CALIB_SKEW_Pos 30 /*!< SysTick CALIB: SKEW Position */ |
aravindsv | 0:ba7650f404af | 444 | #define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ |
aravindsv | 0:ba7650f404af | 445 | |
aravindsv | 0:ba7650f404af | 446 | #define SysTick_CALIB_TENMS_Pos 0 /*!< SysTick CALIB: TENMS Position */ |
aravindsv | 0:ba7650f404af | 447 | #define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos) /*!< SysTick CALIB: TENMS Mask */ |
aravindsv | 0:ba7650f404af | 448 | |
aravindsv | 0:ba7650f404af | 449 | /*@} end of group CMSIS_SysTick */ |
aravindsv | 0:ba7650f404af | 450 | |
aravindsv | 0:ba7650f404af | 451 | |
aravindsv | 0:ba7650f404af | 452 | /** \ingroup CMSIS_core_register |
aravindsv | 0:ba7650f404af | 453 | \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) |
aravindsv | 0:ba7650f404af | 454 | \brief Cortex-M0 Core Debug Registers (DCB registers, SHCSR, and DFSR) |
aravindsv | 0:ba7650f404af | 455 | are only accessible over DAP and not via processor. Therefore |
aravindsv | 0:ba7650f404af | 456 | they are not covered by the Cortex-M0 header file. |
aravindsv | 0:ba7650f404af | 457 | @{ |
aravindsv | 0:ba7650f404af | 458 | */ |
aravindsv | 0:ba7650f404af | 459 | /*@} end of group CMSIS_CoreDebug */ |
aravindsv | 0:ba7650f404af | 460 | |
aravindsv | 0:ba7650f404af | 461 | |
aravindsv | 0:ba7650f404af | 462 | /** \ingroup CMSIS_core_register |
aravindsv | 0:ba7650f404af | 463 | \defgroup CMSIS_core_base Core Definitions |
aravindsv | 0:ba7650f404af | 464 | \brief Definitions for base addresses, unions, and structures. |
aravindsv | 0:ba7650f404af | 465 | @{ |
aravindsv | 0:ba7650f404af | 466 | */ |
aravindsv | 0:ba7650f404af | 467 | |
aravindsv | 0:ba7650f404af | 468 | /* Memory mapping of Cortex-M0 Hardware */ |
aravindsv | 0:ba7650f404af | 469 | #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ |
aravindsv | 0:ba7650f404af | 470 | #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ |
aravindsv | 0:ba7650f404af | 471 | #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ |
aravindsv | 0:ba7650f404af | 472 | #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ |
aravindsv | 0:ba7650f404af | 473 | |
aravindsv | 0:ba7650f404af | 474 | #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ |
aravindsv | 0:ba7650f404af | 475 | #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ |
aravindsv | 0:ba7650f404af | 476 | #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ |
aravindsv | 0:ba7650f404af | 477 | |
aravindsv | 0:ba7650f404af | 478 | |
aravindsv | 0:ba7650f404af | 479 | /*@} */ |
aravindsv | 0:ba7650f404af | 480 | |
aravindsv | 0:ba7650f404af | 481 | |
aravindsv | 0:ba7650f404af | 482 | |
aravindsv | 0:ba7650f404af | 483 | /******************************************************************************* |
aravindsv | 0:ba7650f404af | 484 | * Hardware Abstraction Layer |
aravindsv | 0:ba7650f404af | 485 | Core Function Interface contains: |
aravindsv | 0:ba7650f404af | 486 | - Core NVIC Functions |
aravindsv | 0:ba7650f404af | 487 | - Core SysTick Functions |
aravindsv | 0:ba7650f404af | 488 | - Core Register Access Functions |
aravindsv | 0:ba7650f404af | 489 | ******************************************************************************/ |
aravindsv | 0:ba7650f404af | 490 | /** \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference |
aravindsv | 0:ba7650f404af | 491 | */ |
aravindsv | 0:ba7650f404af | 492 | |
aravindsv | 0:ba7650f404af | 493 | |
aravindsv | 0:ba7650f404af | 494 | |
aravindsv | 0:ba7650f404af | 495 | /* ########################## NVIC functions #################################### */ |
aravindsv | 0:ba7650f404af | 496 | /** \ingroup CMSIS_Core_FunctionInterface |
aravindsv | 0:ba7650f404af | 497 | \defgroup CMSIS_Core_NVICFunctions NVIC Functions |
aravindsv | 0:ba7650f404af | 498 | \brief Functions that manage interrupts and exceptions via the NVIC. |
aravindsv | 0:ba7650f404af | 499 | @{ |
aravindsv | 0:ba7650f404af | 500 | */ |
aravindsv | 0:ba7650f404af | 501 | |
aravindsv | 0:ba7650f404af | 502 | /* Interrupt Priorities are WORD accessible only under ARMv6M */ |
aravindsv | 0:ba7650f404af | 503 | /* The following MACROS handle generation of the register offset and byte masks */ |
aravindsv | 0:ba7650f404af | 504 | #define _BIT_SHIFT(IRQn) ( (((uint32_t)(IRQn) ) & 0x03) * 8 ) |
aravindsv | 0:ba7650f404af | 505 | #define _SHP_IDX(IRQn) ( ((((uint32_t)(IRQn) & 0x0F)-8) >> 2) ) |
aravindsv | 0:ba7650f404af | 506 | #define _IP_IDX(IRQn) ( ((uint32_t)(IRQn) >> 2) ) |
aravindsv | 0:ba7650f404af | 507 | |
aravindsv | 0:ba7650f404af | 508 | |
aravindsv | 0:ba7650f404af | 509 | /** \brief Enable External Interrupt |
aravindsv | 0:ba7650f404af | 510 | |
aravindsv | 0:ba7650f404af | 511 | The function enables a device-specific interrupt in the NVIC interrupt controller. |
aravindsv | 0:ba7650f404af | 512 | |
aravindsv | 0:ba7650f404af | 513 | \param [in] IRQn External interrupt number. Value cannot be negative. |
aravindsv | 0:ba7650f404af | 514 | */ |
aravindsv | 0:ba7650f404af | 515 | __STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn) |
aravindsv | 0:ba7650f404af | 516 | { |
aravindsv | 0:ba7650f404af | 517 | NVIC->ISER[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); |
aravindsv | 0:ba7650f404af | 518 | } |
aravindsv | 0:ba7650f404af | 519 | |
aravindsv | 0:ba7650f404af | 520 | |
aravindsv | 0:ba7650f404af | 521 | /** \brief Disable External Interrupt |
aravindsv | 0:ba7650f404af | 522 | |
aravindsv | 0:ba7650f404af | 523 | The function disables a device-specific interrupt in the NVIC interrupt controller. |
aravindsv | 0:ba7650f404af | 524 | |
aravindsv | 0:ba7650f404af | 525 | \param [in] IRQn External interrupt number. Value cannot be negative. |
aravindsv | 0:ba7650f404af | 526 | */ |
aravindsv | 0:ba7650f404af | 527 | __STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn) |
aravindsv | 0:ba7650f404af | 528 | { |
aravindsv | 0:ba7650f404af | 529 | NVIC->ICER[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); |
aravindsv | 0:ba7650f404af | 530 | } |
aravindsv | 0:ba7650f404af | 531 | |
aravindsv | 0:ba7650f404af | 532 | |
aravindsv | 0:ba7650f404af | 533 | /** \brief Get Pending Interrupt |
aravindsv | 0:ba7650f404af | 534 | |
aravindsv | 0:ba7650f404af | 535 | The function reads the pending register in the NVIC and returns the pending bit |
aravindsv | 0:ba7650f404af | 536 | for the specified interrupt. |
aravindsv | 0:ba7650f404af | 537 | |
aravindsv | 0:ba7650f404af | 538 | \param [in] IRQn Interrupt number. |
aravindsv | 0:ba7650f404af | 539 | |
aravindsv | 0:ba7650f404af | 540 | \return 0 Interrupt status is not pending. |
aravindsv | 0:ba7650f404af | 541 | \return 1 Interrupt status is pending. |
aravindsv | 0:ba7650f404af | 542 | */ |
aravindsv | 0:ba7650f404af | 543 | __STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn) |
aravindsv | 0:ba7650f404af | 544 | { |
aravindsv | 0:ba7650f404af | 545 | return((uint32_t) ((NVIC->ISPR[0] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); |
aravindsv | 0:ba7650f404af | 546 | } |
aravindsv | 0:ba7650f404af | 547 | |
aravindsv | 0:ba7650f404af | 548 | |
aravindsv | 0:ba7650f404af | 549 | /** \brief Set Pending Interrupt |
aravindsv | 0:ba7650f404af | 550 | |
aravindsv | 0:ba7650f404af | 551 | The function sets the pending bit of an external interrupt. |
aravindsv | 0:ba7650f404af | 552 | |
aravindsv | 0:ba7650f404af | 553 | \param [in] IRQn Interrupt number. Value cannot be negative. |
aravindsv | 0:ba7650f404af | 554 | */ |
aravindsv | 0:ba7650f404af | 555 | __STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn) |
aravindsv | 0:ba7650f404af | 556 | { |
aravindsv | 0:ba7650f404af | 557 | NVIC->ISPR[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); |
aravindsv | 0:ba7650f404af | 558 | } |
aravindsv | 0:ba7650f404af | 559 | |
aravindsv | 0:ba7650f404af | 560 | |
aravindsv | 0:ba7650f404af | 561 | /** \brief Clear Pending Interrupt |
aravindsv | 0:ba7650f404af | 562 | |
aravindsv | 0:ba7650f404af | 563 | The function clears the pending bit of an external interrupt. |
aravindsv | 0:ba7650f404af | 564 | |
aravindsv | 0:ba7650f404af | 565 | \param [in] IRQn External interrupt number. Value cannot be negative. |
aravindsv | 0:ba7650f404af | 566 | */ |
aravindsv | 0:ba7650f404af | 567 | __STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn) |
aravindsv | 0:ba7650f404af | 568 | { |
aravindsv | 0:ba7650f404af | 569 | NVIC->ICPR[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* Clear pending interrupt */ |
aravindsv | 0:ba7650f404af | 570 | } |
aravindsv | 0:ba7650f404af | 571 | |
aravindsv | 0:ba7650f404af | 572 | |
aravindsv | 0:ba7650f404af | 573 | /** \brief Set Interrupt Priority |
aravindsv | 0:ba7650f404af | 574 | |
aravindsv | 0:ba7650f404af | 575 | The function sets the priority of an interrupt. |
aravindsv | 0:ba7650f404af | 576 | |
aravindsv | 0:ba7650f404af | 577 | \note The priority cannot be set for every core interrupt. |
aravindsv | 0:ba7650f404af | 578 | |
aravindsv | 0:ba7650f404af | 579 | \param [in] IRQn Interrupt number. |
aravindsv | 0:ba7650f404af | 580 | \param [in] priority Priority to set. |
aravindsv | 0:ba7650f404af | 581 | */ |
aravindsv | 0:ba7650f404af | 582 | __STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) |
aravindsv | 0:ba7650f404af | 583 | { |
aravindsv | 0:ba7650f404af | 584 | if(IRQn < 0) { |
aravindsv | 0:ba7650f404af | 585 | SCB->SHP[_SHP_IDX(IRQn)] = (SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFF << _BIT_SHIFT(IRQn))) | |
aravindsv | 0:ba7650f404af | 586 | (((priority << (8 - __NVIC_PRIO_BITS)) & 0xFF) << _BIT_SHIFT(IRQn)); } |
aravindsv | 0:ba7650f404af | 587 | else { |
aravindsv | 0:ba7650f404af | 588 | NVIC->IP[_IP_IDX(IRQn)] = (NVIC->IP[_IP_IDX(IRQn)] & ~(0xFF << _BIT_SHIFT(IRQn))) | |
aravindsv | 0:ba7650f404af | 589 | (((priority << (8 - __NVIC_PRIO_BITS)) & 0xFF) << _BIT_SHIFT(IRQn)); } |
aravindsv | 0:ba7650f404af | 590 | } |
aravindsv | 0:ba7650f404af | 591 | |
aravindsv | 0:ba7650f404af | 592 | |
aravindsv | 0:ba7650f404af | 593 | /** \brief Get Interrupt Priority |
aravindsv | 0:ba7650f404af | 594 | |
aravindsv | 0:ba7650f404af | 595 | The function reads the priority of an interrupt. The interrupt |
aravindsv | 0:ba7650f404af | 596 | number can be positive to specify an external (device specific) |
aravindsv | 0:ba7650f404af | 597 | interrupt, or negative to specify an internal (core) interrupt. |
aravindsv | 0:ba7650f404af | 598 | |
aravindsv | 0:ba7650f404af | 599 | |
aravindsv | 0:ba7650f404af | 600 | \param [in] IRQn Interrupt number. |
aravindsv | 0:ba7650f404af | 601 | \return Interrupt Priority. Value is aligned automatically to the implemented |
aravindsv | 0:ba7650f404af | 602 | priority bits of the microcontroller. |
aravindsv | 0:ba7650f404af | 603 | */ |
aravindsv | 0:ba7650f404af | 604 | __STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn) |
aravindsv | 0:ba7650f404af | 605 | { |
aravindsv | 0:ba7650f404af | 606 | |
aravindsv | 0:ba7650f404af | 607 | if(IRQn < 0) { |
aravindsv | 0:ba7650f404af | 608 | return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & 0xFF) >> (8 - __NVIC_PRIO_BITS))); } /* get priority for Cortex-M0 system interrupts */ |
aravindsv | 0:ba7650f404af | 609 | else { |
aravindsv | 0:ba7650f404af | 610 | return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & 0xFF) >> (8 - __NVIC_PRIO_BITS))); } /* get priority for device specific interrupts */ |
aravindsv | 0:ba7650f404af | 611 | } |
aravindsv | 0:ba7650f404af | 612 | |
aravindsv | 0:ba7650f404af | 613 | |
aravindsv | 0:ba7650f404af | 614 | /** \brief System Reset |
aravindsv | 0:ba7650f404af | 615 | |
aravindsv | 0:ba7650f404af | 616 | The function initiates a system reset request to reset the MCU. |
aravindsv | 0:ba7650f404af | 617 | */ |
aravindsv | 0:ba7650f404af | 618 | __STATIC_INLINE void NVIC_SystemReset(void) |
aravindsv | 0:ba7650f404af | 619 | { |
aravindsv | 0:ba7650f404af | 620 | __DSB(); /* Ensure all outstanding memory accesses included |
aravindsv | 0:ba7650f404af | 621 | buffered write are completed before reset */ |
aravindsv | 0:ba7650f404af | 622 | SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) | |
aravindsv | 0:ba7650f404af | 623 | SCB_AIRCR_SYSRESETREQ_Msk); |
aravindsv | 0:ba7650f404af | 624 | __DSB(); /* Ensure completion of memory access */ |
aravindsv | 0:ba7650f404af | 625 | while(1); /* wait until reset */ |
aravindsv | 0:ba7650f404af | 626 | } |
aravindsv | 0:ba7650f404af | 627 | |
aravindsv | 0:ba7650f404af | 628 | /*@} end of CMSIS_Core_NVICFunctions */ |
aravindsv | 0:ba7650f404af | 629 | |
aravindsv | 0:ba7650f404af | 630 | |
aravindsv | 0:ba7650f404af | 631 | |
aravindsv | 0:ba7650f404af | 632 | /* ################################## SysTick function ############################################ */ |
aravindsv | 0:ba7650f404af | 633 | /** \ingroup CMSIS_Core_FunctionInterface |
aravindsv | 0:ba7650f404af | 634 | \defgroup CMSIS_Core_SysTickFunctions SysTick Functions |
aravindsv | 0:ba7650f404af | 635 | \brief Functions that configure the System. |
aravindsv | 0:ba7650f404af | 636 | @{ |
aravindsv | 0:ba7650f404af | 637 | */ |
aravindsv | 0:ba7650f404af | 638 | |
aravindsv | 0:ba7650f404af | 639 | #if (__Vendor_SysTickConfig == 0) |
aravindsv | 0:ba7650f404af | 640 | |
aravindsv | 0:ba7650f404af | 641 | /** \brief System Tick Configuration |
aravindsv | 0:ba7650f404af | 642 | |
aravindsv | 0:ba7650f404af | 643 | The function initializes the System Timer and its interrupt, and starts the System Tick Timer. |
aravindsv | 0:ba7650f404af | 644 | Counter is in free running mode to generate periodic interrupts. |
aravindsv | 0:ba7650f404af | 645 | |
aravindsv | 0:ba7650f404af | 646 | \param [in] ticks Number of ticks between two interrupts. |
aravindsv | 0:ba7650f404af | 647 | |
aravindsv | 0:ba7650f404af | 648 | \return 0 Function succeeded. |
aravindsv | 0:ba7650f404af | 649 | \return 1 Function failed. |
aravindsv | 0:ba7650f404af | 650 | |
aravindsv | 0:ba7650f404af | 651 | \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the |
aravindsv | 0:ba7650f404af | 652 | function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b> |
aravindsv | 0:ba7650f404af | 653 | must contain a vendor-specific implementation of this function. |
aravindsv | 0:ba7650f404af | 654 | |
aravindsv | 0:ba7650f404af | 655 | */ |
aravindsv | 0:ba7650f404af | 656 | __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) |
aravindsv | 0:ba7650f404af | 657 | { |
aravindsv | 0:ba7650f404af | 658 | if ((ticks - 1) > SysTick_LOAD_RELOAD_Msk) return (1); /* Reload value impossible */ |
aravindsv | 0:ba7650f404af | 659 | |
aravindsv | 0:ba7650f404af | 660 | SysTick->LOAD = ticks - 1; /* set reload register */ |
aravindsv | 0:ba7650f404af | 661 | NVIC_SetPriority (SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority for Systick Interrupt */ |
aravindsv | 0:ba7650f404af | 662 | SysTick->VAL = 0; /* Load the SysTick Counter Value */ |
aravindsv | 0:ba7650f404af | 663 | SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | |
aravindsv | 0:ba7650f404af | 664 | SysTick_CTRL_TICKINT_Msk | |
aravindsv | 0:ba7650f404af | 665 | SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ |
aravindsv | 0:ba7650f404af | 666 | return (0); /* Function successful */ |
aravindsv | 0:ba7650f404af | 667 | } |
aravindsv | 0:ba7650f404af | 668 | |
aravindsv | 0:ba7650f404af | 669 | #endif |
aravindsv | 0:ba7650f404af | 670 | |
aravindsv | 0:ba7650f404af | 671 | /*@} end of CMSIS_Core_SysTickFunctions */ |
aravindsv | 0:ba7650f404af | 672 | |
aravindsv | 0:ba7650f404af | 673 | |
aravindsv | 0:ba7650f404af | 674 | |
aravindsv | 0:ba7650f404af | 675 | |
aravindsv | 0:ba7650f404af | 676 | #endif /* __CORE_CM0_H_DEPENDANT */ |
aravindsv | 0:ba7650f404af | 677 | |
aravindsv | 0:ba7650f404af | 678 | #endif /* __CMSIS_GENERIC */ |
aravindsv | 0:ba7650f404af | 679 | |
aravindsv | 0:ba7650f404af | 680 | #ifdef __cplusplus |
aravindsv | 0:ba7650f404af | 681 | } |
aravindsv | 0:ba7650f404af | 682 | #endif |