temp

Dependencies:   mbed SDFileSystem MS5607 ADXL345_I2C FATFileSystem

Committer:
IKobayashi
Date:
Mon Mar 16 23:37:42 2020 +0900
Revision:
0:c88c3b616c00
copy

Who changed what in which revision?

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