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