PokittoLib with changes to lcd refresh etc.

Dependents:   Pokittris

Fork of Pokitto by Pokitto Community Team

This is a fork by user @Spinal, and is used in Pokittris for testing. Do not import this to your own program.

Committer:
spinal
Date:
Sun Oct 15 18:03:02 2017 +0000
Revision:
11:02ad9c807a21
Parent:
5:7e5c566b1760
fixed 4color refreshRegion code

Who changed what in which revision?

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