The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
<>
Date:
Wed Apr 12 16:07:08 2017 +0100
Revision:
140:97feb9bacc10
Parent:
131:faff56e089b2
Child:
145:64910690c574
Release 140 of the mbed library

Ports for Upcoming Targets

3841: Add nRf52840 target https://github.com/ARMmbed/mbed-os/pull/3841
3992: Introducing UBLOX_C030 platform. https://github.com/ARMmbed/mbed-os/pull/3992

Fixes and Changes

3951: [NUCLEO_F303ZE] Correct ARDUINO pin https://github.com/ARMmbed/mbed-os/pull/3951
4021: Fixing a macro to detect when RTOS was in use for the NRF52840_DK https://github.com/ARMmbed/mbed-os/pull/4021
3979: KW24D: Add missing SPI defines and Arduino connector definitions https://github.com/ARMmbed/mbed-os/pull/3979
3990: UBLOX_C027: construct a ticker-based wait, rather than calling wait_ms(), in the https://github.com/ARMmbed/mbed-os/pull/3990
4003: Fixed OBOE in async serial tx for NRF52 target, fixes #4002 https://github.com/ARMmbed/mbed-os/pull/4003
4012: STM32: Correct I2C master error handling https://github.com/ARMmbed/mbed-os/pull/4012
4020: NUCLEO_L011K4 remove unsupported tool chain files https://github.com/ARMmbed/mbed-os/pull/4020
4065: K66F: Move bss section to m_data_2 Section https://github.com/ARMmbed/mbed-os/pull/4065
4014: Issue 3763: Reduce heap allocation in the GCC linker file https://github.com/ARMmbed/mbed-os/pull/4014
4030: [STM32L0] reduce IAR heap and stack size for small targets https://github.com/ARMmbed/mbed-os/pull/4030
4109: NUCLEO_L476RG : minor serial pin update https://github.com/ARMmbed/mbed-os/pull/4109
3982: Ticker - kl25z bugfix for handling events in the past https://github.com/ARMmbed/mbed-os/pull/3982

Who changed what in which revision?

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