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