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

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

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

Committer:
Kojto
Date:
Wed Jul 19 16:46:19 2017 +0100
Revision:
147:a97add6d7e64
Parent:
145:64910690c574
Release 147 of the mbed library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 78:ed8466a608b4 1 /**************************************************************************//**
emilmont 78:ed8466a608b4 2 * @file core_cm0plus.h
emilmont 78:ed8466a608b4 3 * @brief CMSIS Cortex-M0+ Core Peripheral Access Layer Header File
AnnaBridge 145:64910690c574 4 * @version V5.0.2
AnnaBridge 145:64910690c574 5 * @date 13. February 2017
AnnaBridge 145:64910690c574 6 ******************************************************************************/
AnnaBridge 145:64910690c574 7 /*
AnnaBridge 145:64910690c574 8 * Copyright (c) 2009-2017 ARM Limited. All rights reserved.
AnnaBridge 145:64910690c574 9 *
AnnaBridge 145:64910690c574 10 * SPDX-License-Identifier: Apache-2.0
emilmont 78:ed8466a608b4 11 *
AnnaBridge 145:64910690c574 12 * Licensed under the Apache License, Version 2.0 (the License); you may
AnnaBridge 145:64910690c574 13 * not use this file except in compliance with the License.
AnnaBridge 145:64910690c574 14 * You may obtain a copy of the License at
AnnaBridge 145:64910690c574 15 *
AnnaBridge 145:64910690c574 16 * www.apache.org/licenses/LICENSE-2.0
emilmont 78:ed8466a608b4 17 *
AnnaBridge 145:64910690c574 18 * Unless required by applicable law or agreed to in writing, software
AnnaBridge 145:64910690c574 19 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
AnnaBridge 145:64910690c574 20 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
AnnaBridge 145:64910690c574 21 * See the License for the specific language governing permissions and
AnnaBridge 145:64910690c574 22 * limitations under the License.
AnnaBridge 145:64910690c574 23 */
emilmont 78:ed8466a608b4 24
AnnaBridge 145:64910690c574 25 #if defined ( __ICCARM__ )
AnnaBridge 145:64910690c574 26 #pragma system_include /* treat file as system include file for MISRA check */
AnnaBridge 145:64910690c574 27 #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
AnnaBridge 145:64910690c574 28 #pragma clang system_header /* treat file as system include file */
emilmont 78:ed8466a608b4 29 #endif
emilmont 78:ed8466a608b4 30
Kojto 110:165afa46840b 31 #ifndef __CORE_CM0PLUS_H_GENERIC
Kojto 110:165afa46840b 32 #define __CORE_CM0PLUS_H_GENERIC
Kojto 110:165afa46840b 33
AnnaBridge 145:64910690c574 34 #include <stdint.h>
AnnaBridge 145:64910690c574 35
emilmont 78:ed8466a608b4 36 #ifdef __cplusplus
emilmont 78:ed8466a608b4 37 extern "C" {
emilmont 78:ed8466a608b4 38 #endif
emilmont 78:ed8466a608b4 39
AnnaBridge 145:64910690c574 40 /**
AnnaBridge 145:64910690c574 41 \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
emilmont 78:ed8466a608b4 42 CMSIS violates the following MISRA-C:2004 rules:
emilmont 78:ed8466a608b4 43
emilmont 78:ed8466a608b4 44 \li Required Rule 8.5, object/function definition in header file.<br>
emilmont 78:ed8466a608b4 45 Function definitions in header files are used to allow 'inlining'.
emilmont 78:ed8466a608b4 46
emilmont 78:ed8466a608b4 47 \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
emilmont 78:ed8466a608b4 48 Unions are used for effective representation of core registers.
emilmont 78:ed8466a608b4 49
emilmont 78:ed8466a608b4 50 \li Advisory Rule 19.7, Function-like macro defined.<br>
emilmont 78:ed8466a608b4 51 Function-like macros are used to allow more efficient code.
emilmont 78:ed8466a608b4 52 */
emilmont 78:ed8466a608b4 53
emilmont 78:ed8466a608b4 54
emilmont 78:ed8466a608b4 55 /*******************************************************************************
emilmont 78:ed8466a608b4 56 * CMSIS definitions
emilmont 78:ed8466a608b4 57 ******************************************************************************/
AnnaBridge 145:64910690c574 58 /**
AnnaBridge 145:64910690c574 59 \ingroup Cortex-M0+
emilmont 78:ed8466a608b4 60 @{
emilmont 78:ed8466a608b4 61 */
emilmont 78:ed8466a608b4 62
AnnaBridge 145:64910690c574 63 /* CMSIS CM0+ definitions */
AnnaBridge 145:64910690c574 64 #define __CM0PLUS_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS HAL main version */
AnnaBridge 145:64910690c574 65 #define __CM0PLUS_CMSIS_VERSION_SUB ( 0U) /*!< [15:0] CMSIS HAL sub version */
AnnaBridge 145:64910690c574 66 #define __CM0PLUS_CMSIS_VERSION ((__CM0PLUS_CMSIS_VERSION_MAIN << 16U) | \
AnnaBridge 145:64910690c574 67 __CM0PLUS_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */
Kojto 110:165afa46840b 68
AnnaBridge 145:64910690c574 69 #define __CORTEX_M (0U) /*!< Cortex-M Core */
emilmont 78:ed8466a608b4 70
Kojto 110:165afa46840b 71 /** __FPU_USED indicates whether an FPU is used or not.
Kojto 110:165afa46840b 72 This core does not support an FPU at all
emilmont 78:ed8466a608b4 73 */
AnnaBridge 145:64910690c574 74 #define __FPU_USED 0U
emilmont 78:ed8466a608b4 75
emilmont 78:ed8466a608b4 76 #if defined ( __CC_ARM )
emilmont 78:ed8466a608b4 77 #if defined __TARGET_FPU_VFP
AnnaBridge 145:64910690c574 78 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
AnnaBridge 145:64910690c574 79 #endif
AnnaBridge 145:64910690c574 80
AnnaBridge 145:64910690c574 81 #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
AnnaBridge 145:64910690c574 82 #if defined __ARM_PCS_VFP
AnnaBridge 145:64910690c574 83 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
emilmont 78:ed8466a608b4 84 #endif
emilmont 78:ed8466a608b4 85
Kojto 110:165afa46840b 86 #elif defined ( __GNUC__ )
Kojto 110:165afa46840b 87 #if defined (__VFP_FP__) && !defined(__SOFTFP__)
AnnaBridge 145:64910690c574 88 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
Kojto 110:165afa46840b 89 #endif
Kojto 110:165afa46840b 90
emilmont 78:ed8466a608b4 91 #elif defined ( __ICCARM__ )
emilmont 78:ed8466a608b4 92 #if defined __ARMVFP__
AnnaBridge 145:64910690c574 93 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
emilmont 78:ed8466a608b4 94 #endif
emilmont 78:ed8466a608b4 95
AnnaBridge 145:64910690c574 96 #elif defined ( __TI_ARM__ )
AnnaBridge 145:64910690c574 97 #if defined __TI_VFP_SUPPORT__
AnnaBridge 145:64910690c574 98 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
emilmont 78:ed8466a608b4 99 #endif
emilmont 78:ed8466a608b4 100
emilmont 78:ed8466a608b4 101 #elif defined ( __TASKING__ )
emilmont 78:ed8466a608b4 102 #if defined __FPU_VFP__
emilmont 78:ed8466a608b4 103 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
emilmont 78:ed8466a608b4 104 #endif
Kojto 110:165afa46840b 105
AnnaBridge 145:64910690c574 106 #elif defined ( __CSMC__ )
AnnaBridge 145:64910690c574 107 #if ( __CSMC__ & 0x400U)
Kojto 110:165afa46840b 108 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
Kojto 110:165afa46840b 109 #endif
AnnaBridge 145:64910690c574 110
emilmont 78:ed8466a608b4 111 #endif
emilmont 78:ed8466a608b4 112
AnnaBridge 145:64910690c574 113 #include "cmsis_compiler.h" /* CMSIS compiler specific defines */
AnnaBridge 145:64910690c574 114
emilmont 78:ed8466a608b4 115
Kojto 110:165afa46840b 116 #ifdef __cplusplus
Kojto 110:165afa46840b 117 }
Kojto 110:165afa46840b 118 #endif
Kojto 110:165afa46840b 119
emilmont 78:ed8466a608b4 120 #endif /* __CORE_CM0PLUS_H_GENERIC */
emilmont 78:ed8466a608b4 121
emilmont 78:ed8466a608b4 122 #ifndef __CMSIS_GENERIC
emilmont 78:ed8466a608b4 123
emilmont 78:ed8466a608b4 124 #ifndef __CORE_CM0PLUS_H_DEPENDANT
emilmont 78:ed8466a608b4 125 #define __CORE_CM0PLUS_H_DEPENDANT
emilmont 78:ed8466a608b4 126
Kojto 110:165afa46840b 127 #ifdef __cplusplus
Kojto 110:165afa46840b 128 extern "C" {
Kojto 110:165afa46840b 129 #endif
Kojto 110:165afa46840b 130
emilmont 78:ed8466a608b4 131 /* check device defines and use defaults */
emilmont 78:ed8466a608b4 132 #if defined __CHECK_DEVICE_DEFINES
emilmont 78:ed8466a608b4 133 #ifndef __CM0PLUS_REV
AnnaBridge 145:64910690c574 134 #define __CM0PLUS_REV 0x0000U
emilmont 78:ed8466a608b4 135 #warning "__CM0PLUS_REV not defined in device header file; using default!"
emilmont 78:ed8466a608b4 136 #endif
emilmont 78:ed8466a608b4 137
emilmont 78:ed8466a608b4 138 #ifndef __MPU_PRESENT
AnnaBridge 145:64910690c574 139 #define __MPU_PRESENT 0U
emilmont 78:ed8466a608b4 140 #warning "__MPU_PRESENT not defined in device header file; using default!"
emilmont 78:ed8466a608b4 141 #endif
emilmont 78:ed8466a608b4 142
emilmont 78:ed8466a608b4 143 #ifndef __VTOR_PRESENT
AnnaBridge 145:64910690c574 144 #define __VTOR_PRESENT 0U
emilmont 78:ed8466a608b4 145 #warning "__VTOR_PRESENT not defined in device header file; using default!"
emilmont 78:ed8466a608b4 146 #endif
emilmont 78:ed8466a608b4 147
emilmont 78:ed8466a608b4 148 #ifndef __NVIC_PRIO_BITS
AnnaBridge 145:64910690c574 149 #define __NVIC_PRIO_BITS 2U
emilmont 78:ed8466a608b4 150 #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
emilmont 78:ed8466a608b4 151 #endif
emilmont 78:ed8466a608b4 152
emilmont 78:ed8466a608b4 153 #ifndef __Vendor_SysTickConfig
AnnaBridge 145:64910690c574 154 #define __Vendor_SysTickConfig 0U
emilmont 78:ed8466a608b4 155 #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
emilmont 78:ed8466a608b4 156 #endif
emilmont 78:ed8466a608b4 157 #endif
emilmont 78:ed8466a608b4 158
emilmont 78:ed8466a608b4 159 /* IO definitions (access restrictions to peripheral registers) */
emilmont 78:ed8466a608b4 160 /**
emilmont 78:ed8466a608b4 161 \defgroup CMSIS_glob_defs CMSIS Global Defines
emilmont 78:ed8466a608b4 162
emilmont 78:ed8466a608b4 163 <strong>IO Type Qualifiers</strong> are used
emilmont 78:ed8466a608b4 164 \li to specify the access to peripheral variables.
emilmont 78:ed8466a608b4 165 \li for automatic generation of peripheral register debug information.
emilmont 78:ed8466a608b4 166 */
emilmont 78:ed8466a608b4 167 #ifdef __cplusplus
AnnaBridge 145:64910690c574 168 #define __I volatile /*!< Defines 'read only' permissions */
emilmont 78:ed8466a608b4 169 #else
AnnaBridge 145:64910690c574 170 #define __I volatile const /*!< Defines 'read only' permissions */
emilmont 78:ed8466a608b4 171 #endif
AnnaBridge 145:64910690c574 172 #define __O volatile /*!< Defines 'write only' permissions */
AnnaBridge 145:64910690c574 173 #define __IO volatile /*!< Defines 'read / write' permissions */
emilmont 78:ed8466a608b4 174
AnnaBridge 145:64910690c574 175 /* following defines should be used for structure members */
AnnaBridge 145:64910690c574 176 #define __IM volatile const /*! Defines 'read only' structure member permissions */
AnnaBridge 145:64910690c574 177 #define __OM volatile /*! Defines 'write only' structure member permissions */
AnnaBridge 145:64910690c574 178 #define __IOM volatile /*! Defines 'read / write' structure member permissions */
<> 128:9bcdf88f62b0 179
emilmont 78:ed8466a608b4 180 /*@} end of group Cortex-M0+ */
emilmont 78:ed8466a608b4 181
emilmont 78:ed8466a608b4 182
emilmont 78:ed8466a608b4 183
emilmont 78:ed8466a608b4 184 /*******************************************************************************
emilmont 78:ed8466a608b4 185 * Register Abstraction
emilmont 78:ed8466a608b4 186 Core Register contain:
emilmont 78:ed8466a608b4 187 - Core Register
emilmont 78:ed8466a608b4 188 - Core NVIC Register
emilmont 78:ed8466a608b4 189 - Core SCB Register
emilmont 78:ed8466a608b4 190 - Core SysTick Register
emilmont 78:ed8466a608b4 191 - Core MPU Register
emilmont 78:ed8466a608b4 192 ******************************************************************************/
AnnaBridge 145:64910690c574 193 /**
AnnaBridge 145:64910690c574 194 \defgroup CMSIS_core_register Defines and Type Definitions
AnnaBridge 145:64910690c574 195 \brief Type definitions and defines for Cortex-M processor based devices.
emilmont 78:ed8466a608b4 196 */
emilmont 78:ed8466a608b4 197
AnnaBridge 145:64910690c574 198 /**
AnnaBridge 145:64910690c574 199 \ingroup CMSIS_core_register
AnnaBridge 145:64910690c574 200 \defgroup CMSIS_CORE Status and Control Registers
AnnaBridge 145:64910690c574 201 \brief Core Register type definitions.
emilmont 78:ed8466a608b4 202 @{
emilmont 78:ed8466a608b4 203 */
emilmont 78:ed8466a608b4 204
AnnaBridge 145:64910690c574 205 /**
AnnaBridge 145:64910690c574 206 \brief Union type to access the Application Program Status Register (APSR).
emilmont 78:ed8466a608b4 207 */
emilmont 78:ed8466a608b4 208 typedef union
emilmont 78:ed8466a608b4 209 {
emilmont 78:ed8466a608b4 210 struct
emilmont 78:ed8466a608b4 211 {
AnnaBridge 145:64910690c574 212 uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
AnnaBridge 145:64910690c574 213 uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
AnnaBridge 145:64910690c574 214 uint32_t C:1; /*!< bit: 29 Carry condition code flag */
AnnaBridge 145:64910690c574 215 uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
AnnaBridge 145:64910690c574 216 uint32_t N:1; /*!< bit: 31 Negative condition code flag */
AnnaBridge 145:64910690c574 217 } b; /*!< Structure used for bit access */
AnnaBridge 145:64910690c574 218 uint32_t w; /*!< Type used for word access */
emilmont 78:ed8466a608b4 219 } APSR_Type;
emilmont 78:ed8466a608b4 220
Kojto 110:165afa46840b 221 /* APSR Register Definitions */
AnnaBridge 145:64910690c574 222 #define APSR_N_Pos 31U /*!< APSR: N Position */
Kojto 110:165afa46840b 223 #define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
Kojto 110:165afa46840b 224
AnnaBridge 145:64910690c574 225 #define APSR_Z_Pos 30U /*!< APSR: Z Position */
Kojto 110:165afa46840b 226 #define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
Kojto 110:165afa46840b 227
AnnaBridge 145:64910690c574 228 #define APSR_C_Pos 29U /*!< APSR: C Position */
Kojto 110:165afa46840b 229 #define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
Kojto 110:165afa46840b 230
AnnaBridge 145:64910690c574 231 #define APSR_V_Pos 28U /*!< APSR: V Position */
Kojto 110:165afa46840b 232 #define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
Kojto 110:165afa46840b 233
emilmont 78:ed8466a608b4 234
AnnaBridge 145:64910690c574 235 /**
AnnaBridge 145:64910690c574 236 \brief Union type to access the Interrupt Program Status Register (IPSR).
emilmont 78:ed8466a608b4 237 */
emilmont 78:ed8466a608b4 238 typedef union
emilmont 78:ed8466a608b4 239 {
emilmont 78:ed8466a608b4 240 struct
emilmont 78:ed8466a608b4 241 {
AnnaBridge 145:64910690c574 242 uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
AnnaBridge 145:64910690c574 243 uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
AnnaBridge 145:64910690c574 244 } b; /*!< Structure used for bit access */
AnnaBridge 145:64910690c574 245 uint32_t w; /*!< Type used for word access */
emilmont 78:ed8466a608b4 246 } IPSR_Type;
emilmont 78:ed8466a608b4 247
Kojto 110:165afa46840b 248 /* IPSR Register Definitions */
AnnaBridge 145:64910690c574 249 #define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
Kojto 110:165afa46840b 250 #define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
Kojto 110:165afa46840b 251
emilmont 78:ed8466a608b4 252
AnnaBridge 145:64910690c574 253 /**
AnnaBridge 145:64910690c574 254 \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
emilmont 78:ed8466a608b4 255 */
emilmont 78:ed8466a608b4 256 typedef union
emilmont 78:ed8466a608b4 257 {
emilmont 78:ed8466a608b4 258 struct
emilmont 78:ed8466a608b4 259 {
AnnaBridge 145:64910690c574 260 uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
AnnaBridge 145:64910690c574 261 uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
AnnaBridge 145:64910690c574 262 uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
AnnaBridge 145:64910690c574 263 uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
AnnaBridge 145:64910690c574 264 uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
AnnaBridge 145:64910690c574 265 uint32_t C:1; /*!< bit: 29 Carry condition code flag */
AnnaBridge 145:64910690c574 266 uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
AnnaBridge 145:64910690c574 267 uint32_t N:1; /*!< bit: 31 Negative condition code flag */
AnnaBridge 145:64910690c574 268 } b; /*!< Structure used for bit access */
AnnaBridge 145:64910690c574 269 uint32_t w; /*!< Type used for word access */
emilmont 78:ed8466a608b4 270 } xPSR_Type;
emilmont 78:ed8466a608b4 271
Kojto 110:165afa46840b 272 /* xPSR Register Definitions */
AnnaBridge 145:64910690c574 273 #define xPSR_N_Pos 31U /*!< xPSR: N Position */
Kojto 110:165afa46840b 274 #define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
Kojto 110:165afa46840b 275
AnnaBridge 145:64910690c574 276 #define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
Kojto 110:165afa46840b 277 #define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
Kojto 110:165afa46840b 278
AnnaBridge 145:64910690c574 279 #define xPSR_C_Pos 29U /*!< xPSR: C Position */
Kojto 110:165afa46840b 280 #define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
Kojto 110:165afa46840b 281
AnnaBridge 145:64910690c574 282 #define xPSR_V_Pos 28U /*!< xPSR: V Position */
Kojto 110:165afa46840b 283 #define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
Kojto 110:165afa46840b 284
AnnaBridge 145:64910690c574 285 #define xPSR_T_Pos 24U /*!< xPSR: T Position */
Kojto 110:165afa46840b 286 #define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
Kojto 110:165afa46840b 287
AnnaBridge 145:64910690c574 288 #define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
Kojto 110:165afa46840b 289 #define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
Kojto 110:165afa46840b 290
emilmont 78:ed8466a608b4 291
AnnaBridge 145:64910690c574 292 /**
AnnaBridge 145:64910690c574 293 \brief Union type to access the Control Registers (CONTROL).
emilmont 78:ed8466a608b4 294 */
emilmont 78:ed8466a608b4 295 typedef union
emilmont 78:ed8466a608b4 296 {
emilmont 78:ed8466a608b4 297 struct
emilmont 78:ed8466a608b4 298 {
emilmont 78:ed8466a608b4 299 uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */
AnnaBridge 145:64910690c574 300 uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
AnnaBridge 145:64910690c574 301 uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
AnnaBridge 145:64910690c574 302 } b; /*!< Structure used for bit access */
AnnaBridge 145:64910690c574 303 uint32_t w; /*!< Type used for word access */
emilmont 78:ed8466a608b4 304 } CONTROL_Type;
emilmont 78:ed8466a608b4 305
Kojto 110:165afa46840b 306 /* CONTROL Register Definitions */
AnnaBridge 145:64910690c574 307 #define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
Kojto 110:165afa46840b 308 #define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
Kojto 110:165afa46840b 309
AnnaBridge 145:64910690c574 310 #define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */
Kojto 110:165afa46840b 311 #define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */
Kojto 110:165afa46840b 312
emilmont 78:ed8466a608b4 313 /*@} end of group CMSIS_CORE */
emilmont 78:ed8466a608b4 314
emilmont 78:ed8466a608b4 315
AnnaBridge 145:64910690c574 316 /**
AnnaBridge 145:64910690c574 317 \ingroup CMSIS_core_register
AnnaBridge 145:64910690c574 318 \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
AnnaBridge 145:64910690c574 319 \brief Type definitions for the NVIC Registers
emilmont 78:ed8466a608b4 320 @{
emilmont 78:ed8466a608b4 321 */
emilmont 78:ed8466a608b4 322
AnnaBridge 145:64910690c574 323 /**
AnnaBridge 145:64910690c574 324 \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
emilmont 78:ed8466a608b4 325 */
emilmont 78:ed8466a608b4 326 typedef struct
emilmont 78:ed8466a608b4 327 {
AnnaBridge 145:64910690c574 328 __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
AnnaBridge 145:64910690c574 329 uint32_t RESERVED0[31U];
AnnaBridge 145:64910690c574 330 __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
AnnaBridge 145:64910690c574 331 uint32_t RSERVED1[31U];
AnnaBridge 145:64910690c574 332 __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
AnnaBridge 145:64910690c574 333 uint32_t RESERVED2[31U];
AnnaBridge 145:64910690c574 334 __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
AnnaBridge 145:64910690c574 335 uint32_t RESERVED3[31U];
AnnaBridge 145:64910690c574 336 uint32_t RESERVED4[64U];
AnnaBridge 145:64910690c574 337 __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
emilmont 78:ed8466a608b4 338 } NVIC_Type;
emilmont 78:ed8466a608b4 339
emilmont 78:ed8466a608b4 340 /*@} end of group CMSIS_NVIC */
emilmont 78:ed8466a608b4 341
emilmont 78:ed8466a608b4 342
AnnaBridge 145:64910690c574 343 /**
AnnaBridge 145:64910690c574 344 \ingroup CMSIS_core_register
AnnaBridge 145:64910690c574 345 \defgroup CMSIS_SCB System Control Block (SCB)
AnnaBridge 145:64910690c574 346 \brief Type definitions for the System Control Block Registers
emilmont 78:ed8466a608b4 347 @{
emilmont 78:ed8466a608b4 348 */
emilmont 78:ed8466a608b4 349
AnnaBridge 145:64910690c574 350 /**
AnnaBridge 145:64910690c574 351 \brief Structure type to access the System Control Block (SCB).
emilmont 78:ed8466a608b4 352 */
emilmont 78:ed8466a608b4 353 typedef struct
emilmont 78:ed8466a608b4 354 {
AnnaBridge 145:64910690c574 355 __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
AnnaBridge 145:64910690c574 356 __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
AnnaBridge 145:64910690c574 357 #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
AnnaBridge 145:64910690c574 358 __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
emilmont 78:ed8466a608b4 359 #else
AnnaBridge 145:64910690c574 360 uint32_t RESERVED0;
emilmont 78:ed8466a608b4 361 #endif
AnnaBridge 145:64910690c574 362 __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
AnnaBridge 145:64910690c574 363 __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
AnnaBridge 145:64910690c574 364 __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
AnnaBridge 145:64910690c574 365 uint32_t RESERVED1;
AnnaBridge 145:64910690c574 366 __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
AnnaBridge 145:64910690c574 367 __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
emilmont 78:ed8466a608b4 368 } SCB_Type;
emilmont 78:ed8466a608b4 369
emilmont 78:ed8466a608b4 370 /* SCB CPUID Register Definitions */
AnnaBridge 145:64910690c574 371 #define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
emilmont 78:ed8466a608b4 372 #define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
emilmont 78:ed8466a608b4 373
AnnaBridge 145:64910690c574 374 #define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
emilmont 78:ed8466a608b4 375 #define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
emilmont 78:ed8466a608b4 376
AnnaBridge 145:64910690c574 377 #define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
emilmont 78:ed8466a608b4 378 #define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
emilmont 78:ed8466a608b4 379
AnnaBridge 145:64910690c574 380 #define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
emilmont 78:ed8466a608b4 381 #define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
emilmont 78:ed8466a608b4 382
AnnaBridge 145:64910690c574 383 #define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
Kojto 110:165afa46840b 384 #define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
emilmont 78:ed8466a608b4 385
emilmont 78:ed8466a608b4 386 /* SCB Interrupt Control State Register Definitions */
AnnaBridge 145:64910690c574 387 #define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */
emilmont 78:ed8466a608b4 388 #define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
emilmont 78:ed8466a608b4 389
AnnaBridge 145:64910690c574 390 #define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
emilmont 78:ed8466a608b4 391 #define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
emilmont 78:ed8466a608b4 392
AnnaBridge 145:64910690c574 393 #define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
emilmont 78:ed8466a608b4 394 #define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
emilmont 78:ed8466a608b4 395
AnnaBridge 145:64910690c574 396 #define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
emilmont 78:ed8466a608b4 397 #define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
emilmont 78:ed8466a608b4 398
AnnaBridge 145:64910690c574 399 #define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
emilmont 78:ed8466a608b4 400 #define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
emilmont 78:ed8466a608b4 401
AnnaBridge 145:64910690c574 402 #define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
emilmont 78:ed8466a608b4 403 #define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
emilmont 78:ed8466a608b4 404
AnnaBridge 145:64910690c574 405 #define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
emilmont 78:ed8466a608b4 406 #define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
emilmont 78:ed8466a608b4 407
AnnaBridge 145:64910690c574 408 #define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
emilmont 78:ed8466a608b4 409 #define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
emilmont 78:ed8466a608b4 410
AnnaBridge 145:64910690c574 411 #define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
Kojto 110:165afa46840b 412 #define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
emilmont 78:ed8466a608b4 413
AnnaBridge 145:64910690c574 414 #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
emilmont 78:ed8466a608b4 415 /* SCB Interrupt Control State Register Definitions */
AnnaBridge 145:64910690c574 416 #define SCB_VTOR_TBLOFF_Pos 8U /*!< SCB VTOR: TBLOFF Position */
emilmont 78:ed8466a608b4 417 #define SCB_VTOR_TBLOFF_Msk (0xFFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */
emilmont 78:ed8466a608b4 418 #endif
emilmont 78:ed8466a608b4 419
emilmont 78:ed8466a608b4 420 /* SCB Application Interrupt and Reset Control Register Definitions */
AnnaBridge 145:64910690c574 421 #define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
emilmont 78:ed8466a608b4 422 #define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
emilmont 78:ed8466a608b4 423
AnnaBridge 145:64910690c574 424 #define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
emilmont 78:ed8466a608b4 425 #define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
emilmont 78:ed8466a608b4 426
AnnaBridge 145:64910690c574 427 #define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
emilmont 78:ed8466a608b4 428 #define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
emilmont 78:ed8466a608b4 429
AnnaBridge 145:64910690c574 430 #define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
emilmont 78:ed8466a608b4 431 #define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
emilmont 78:ed8466a608b4 432
AnnaBridge 145:64910690c574 433 #define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
emilmont 78:ed8466a608b4 434 #define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
emilmont 78:ed8466a608b4 435
emilmont 78:ed8466a608b4 436 /* SCB System Control Register Definitions */
AnnaBridge 145:64910690c574 437 #define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
emilmont 78:ed8466a608b4 438 #define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
emilmont 78:ed8466a608b4 439
AnnaBridge 145:64910690c574 440 #define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
emilmont 78:ed8466a608b4 441 #define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
emilmont 78:ed8466a608b4 442
AnnaBridge 145:64910690c574 443 #define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
emilmont 78:ed8466a608b4 444 #define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
emilmont 78:ed8466a608b4 445
emilmont 78:ed8466a608b4 446 /* SCB Configuration Control Register Definitions */
AnnaBridge 145:64910690c574 447 #define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */
emilmont 78:ed8466a608b4 448 #define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
emilmont 78:ed8466a608b4 449
AnnaBridge 145:64910690c574 450 #define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
emilmont 78:ed8466a608b4 451 #define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
emilmont 78:ed8466a608b4 452
emilmont 78:ed8466a608b4 453 /* SCB System Handler Control and State Register Definitions */
AnnaBridge 145:64910690c574 454 #define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
emilmont 78:ed8466a608b4 455 #define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
emilmont 78:ed8466a608b4 456
emilmont 78:ed8466a608b4 457 /*@} end of group CMSIS_SCB */
emilmont 78:ed8466a608b4 458
emilmont 78:ed8466a608b4 459
AnnaBridge 145:64910690c574 460 /**
AnnaBridge 145:64910690c574 461 \ingroup CMSIS_core_register
AnnaBridge 145:64910690c574 462 \defgroup CMSIS_SysTick System Tick Timer (SysTick)
AnnaBridge 145:64910690c574 463 \brief Type definitions for the System Timer Registers.
emilmont 78:ed8466a608b4 464 @{
emilmont 78:ed8466a608b4 465 */
emilmont 78:ed8466a608b4 466
AnnaBridge 145:64910690c574 467 /**
AnnaBridge 145:64910690c574 468 \brief Structure type to access the System Timer (SysTick).
emilmont 78:ed8466a608b4 469 */
emilmont 78:ed8466a608b4 470 typedef struct
emilmont 78:ed8466a608b4 471 {
AnnaBridge 145:64910690c574 472 __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
AnnaBridge 145:64910690c574 473 __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
AnnaBridge 145:64910690c574 474 __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
AnnaBridge 145:64910690c574 475 __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
emilmont 78:ed8466a608b4 476 } SysTick_Type;
emilmont 78:ed8466a608b4 477
emilmont 78:ed8466a608b4 478 /* SysTick Control / Status Register Definitions */
AnnaBridge 145:64910690c574 479 #define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
emilmont 78:ed8466a608b4 480 #define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
emilmont 78:ed8466a608b4 481
AnnaBridge 145:64910690c574 482 #define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
emilmont 78:ed8466a608b4 483 #define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
emilmont 78:ed8466a608b4 484
AnnaBridge 145:64910690c574 485 #define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
emilmont 78:ed8466a608b4 486 #define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
emilmont 78:ed8466a608b4 487
AnnaBridge 145:64910690c574 488 #define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
Kojto 110:165afa46840b 489 #define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
emilmont 78:ed8466a608b4 490
emilmont 78:ed8466a608b4 491 /* SysTick Reload Register Definitions */
AnnaBridge 145:64910690c574 492 #define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
Kojto 110:165afa46840b 493 #define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
emilmont 78:ed8466a608b4 494
emilmont 78:ed8466a608b4 495 /* SysTick Current Register Definitions */
AnnaBridge 145:64910690c574 496 #define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
Kojto 110:165afa46840b 497 #define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
emilmont 78:ed8466a608b4 498
emilmont 78:ed8466a608b4 499 /* SysTick Calibration Register Definitions */
AnnaBridge 145:64910690c574 500 #define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
emilmont 78:ed8466a608b4 501 #define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
emilmont 78:ed8466a608b4 502
AnnaBridge 145:64910690c574 503 #define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
emilmont 78:ed8466a608b4 504 #define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
emilmont 78:ed8466a608b4 505
AnnaBridge 145:64910690c574 506 #define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
Kojto 110:165afa46840b 507 #define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
emilmont 78:ed8466a608b4 508
emilmont 78:ed8466a608b4 509 /*@} end of group CMSIS_SysTick */
emilmont 78:ed8466a608b4 510
AnnaBridge 145:64910690c574 511 #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
AnnaBridge 145:64910690c574 512 /**
AnnaBridge 145:64910690c574 513 \ingroup CMSIS_core_register
AnnaBridge 145:64910690c574 514 \defgroup CMSIS_MPU Memory Protection Unit (MPU)
AnnaBridge 145:64910690c574 515 \brief Type definitions for the Memory Protection Unit (MPU)
emilmont 78:ed8466a608b4 516 @{
emilmont 78:ed8466a608b4 517 */
emilmont 78:ed8466a608b4 518
AnnaBridge 145:64910690c574 519 /**
AnnaBridge 145:64910690c574 520 \brief Structure type to access the Memory Protection Unit (MPU).
emilmont 78:ed8466a608b4 521 */
emilmont 78:ed8466a608b4 522 typedef struct
emilmont 78:ed8466a608b4 523 {
AnnaBridge 145:64910690c574 524 __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
AnnaBridge 145:64910690c574 525 __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
AnnaBridge 145:64910690c574 526 __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
AnnaBridge 145:64910690c574 527 __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */
AnnaBridge 145:64910690c574 528 __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */
emilmont 78:ed8466a608b4 529 } MPU_Type;
emilmont 78:ed8466a608b4 530
AnnaBridge 145:64910690c574 531 /* MPU Type Register Definitions */
AnnaBridge 145:64910690c574 532 #define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */
emilmont 78:ed8466a608b4 533 #define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */
emilmont 78:ed8466a608b4 534
AnnaBridge 145:64910690c574 535 #define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */
emilmont 78:ed8466a608b4 536 #define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */
emilmont 78:ed8466a608b4 537
AnnaBridge 145:64910690c574 538 #define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */
Kojto 110:165afa46840b 539 #define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */
emilmont 78:ed8466a608b4 540
AnnaBridge 145:64910690c574 541 /* MPU Control Register Definitions */
AnnaBridge 145:64910690c574 542 #define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */
emilmont 78:ed8466a608b4 543 #define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */
emilmont 78:ed8466a608b4 544
AnnaBridge 145:64910690c574 545 #define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */
emilmont 78:ed8466a608b4 546 #define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */
emilmont 78:ed8466a608b4 547
AnnaBridge 145:64910690c574 548 #define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */
Kojto 110:165afa46840b 549 #define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */
emilmont 78:ed8466a608b4 550
AnnaBridge 145:64910690c574 551 /* MPU Region Number Register Definitions */
AnnaBridge 145:64910690c574 552 #define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */
Kojto 110:165afa46840b 553 #define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */
emilmont 78:ed8466a608b4 554
AnnaBridge 145:64910690c574 555 /* MPU Region Base Address Register Definitions */
AnnaBridge 145:64910690c574 556 #define MPU_RBAR_ADDR_Pos 8U /*!< MPU RBAR: ADDR Position */
emilmont 78:ed8466a608b4 557 #define MPU_RBAR_ADDR_Msk (0xFFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */
emilmont 78:ed8466a608b4 558
AnnaBridge 145:64910690c574 559 #define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */
emilmont 78:ed8466a608b4 560 #define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */
emilmont 78:ed8466a608b4 561
AnnaBridge 145:64910690c574 562 #define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */
Kojto 110:165afa46840b 563 #define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */
emilmont 78:ed8466a608b4 564
AnnaBridge 145:64910690c574 565 /* MPU Region Attribute and Size Register Definitions */
AnnaBridge 145:64910690c574 566 #define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */
emilmont 78:ed8466a608b4 567 #define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */
emilmont 78:ed8466a608b4 568
AnnaBridge 145:64910690c574 569 #define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */
emilmont 78:ed8466a608b4 570 #define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */
emilmont 78:ed8466a608b4 571
AnnaBridge 145:64910690c574 572 #define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */
emilmont 78:ed8466a608b4 573 #define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */
emilmont 78:ed8466a608b4 574
AnnaBridge 145:64910690c574 575 #define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */
emilmont 78:ed8466a608b4 576 #define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */
emilmont 78:ed8466a608b4 577
AnnaBridge 145:64910690c574 578 #define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */
emilmont 78:ed8466a608b4 579 #define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */
emilmont 78:ed8466a608b4 580
AnnaBridge 145:64910690c574 581 #define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */
emilmont 78:ed8466a608b4 582 #define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */
emilmont 78:ed8466a608b4 583
AnnaBridge 145:64910690c574 584 #define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */
emilmont 78:ed8466a608b4 585 #define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */
emilmont 78:ed8466a608b4 586
AnnaBridge 145:64910690c574 587 #define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */
emilmont 78:ed8466a608b4 588 #define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */
emilmont 78:ed8466a608b4 589
AnnaBridge 145:64910690c574 590 #define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */
emilmont 78:ed8466a608b4 591 #define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */
emilmont 78:ed8466a608b4 592
AnnaBridge 145:64910690c574 593 #define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */
Kojto 110:165afa46840b 594 #define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */
emilmont 78:ed8466a608b4 595
emilmont 78:ed8466a608b4 596 /*@} end of group CMSIS_MPU */
emilmont 78:ed8466a608b4 597 #endif
emilmont 78:ed8466a608b4 598
emilmont 78:ed8466a608b4 599
AnnaBridge 145:64910690c574 600 /**
AnnaBridge 145:64910690c574 601 \ingroup CMSIS_core_register
AnnaBridge 145:64910690c574 602 \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
AnnaBridge 145:64910690c574 603 \brief Cortex-M0+ Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor.
AnnaBridge 145:64910690c574 604 Therefore they are not covered by the Cortex-M0+ header file.
emilmont 78:ed8466a608b4 605 @{
emilmont 78:ed8466a608b4 606 */
emilmont 78:ed8466a608b4 607 /*@} end of group CMSIS_CoreDebug */
emilmont 78:ed8466a608b4 608
emilmont 78:ed8466a608b4 609
AnnaBridge 145:64910690c574 610 /**
AnnaBridge 145:64910690c574 611 \ingroup CMSIS_core_register
AnnaBridge 145:64910690c574 612 \defgroup CMSIS_core_bitfield Core register bit field macros
AnnaBridge 145:64910690c574 613 \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
emilmont 78:ed8466a608b4 614 @{
emilmont 78:ed8466a608b4 615 */
emilmont 78:ed8466a608b4 616
AnnaBridge 145:64910690c574 617 /**
AnnaBridge 145:64910690c574 618 \brief Mask and shift a bit field value for use in a register bit range.
AnnaBridge 145:64910690c574 619 \param[in] field Name of the register bit field.
AnnaBridge 145:64910690c574 620 \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
AnnaBridge 145:64910690c574 621 \return Masked and shifted value.
AnnaBridge 145:64910690c574 622 */
AnnaBridge 145:64910690c574 623 #define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
AnnaBridge 145:64910690c574 624
AnnaBridge 145:64910690c574 625 /**
AnnaBridge 145:64910690c574 626 \brief Mask and shift a register value to extract a bit filed value.
AnnaBridge 145:64910690c574 627 \param[in] field Name of the register bit field.
AnnaBridge 145:64910690c574 628 \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
AnnaBridge 145:64910690c574 629 \return Masked and shifted bit field value.
AnnaBridge 145:64910690c574 630 */
AnnaBridge 145:64910690c574 631 #define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
AnnaBridge 145:64910690c574 632
AnnaBridge 145:64910690c574 633 /*@} end of group CMSIS_core_bitfield */
AnnaBridge 145:64910690c574 634
AnnaBridge 145:64910690c574 635
AnnaBridge 145:64910690c574 636 /**
AnnaBridge 145:64910690c574 637 \ingroup CMSIS_core_register
AnnaBridge 145:64910690c574 638 \defgroup CMSIS_core_base Core Definitions
AnnaBridge 145:64910690c574 639 \brief Definitions for base addresses, unions, and structures.
AnnaBridge 145:64910690c574 640 @{
AnnaBridge 145:64910690c574 641 */
AnnaBridge 145:64910690c574 642
AnnaBridge 145:64910690c574 643 /* Memory mapping of Core Hardware */
emilmont 78:ed8466a608b4 644 #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
AnnaBridge 145:64910690c574 645 #define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
AnnaBridge 145:64910690c574 646 #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
emilmont 78:ed8466a608b4 647 #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
emilmont 78:ed8466a608b4 648
AnnaBridge 145:64910690c574 649 #define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
AnnaBridge 145:64910690c574 650 #define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
AnnaBridge 145:64910690c574 651 #define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
emilmont 78:ed8466a608b4 652
AnnaBridge 145:64910690c574 653 #if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
AnnaBridge 145:64910690c574 654 #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
AnnaBridge 145:64910690c574 655 #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */
emilmont 78:ed8466a608b4 656 #endif
emilmont 78:ed8466a608b4 657
emilmont 78:ed8466a608b4 658 /*@} */
emilmont 78:ed8466a608b4 659
emilmont 78:ed8466a608b4 660
emilmont 78:ed8466a608b4 661
emilmont 78:ed8466a608b4 662 /*******************************************************************************
emilmont 78:ed8466a608b4 663 * Hardware Abstraction Layer
emilmont 78:ed8466a608b4 664 Core Function Interface contains:
emilmont 78:ed8466a608b4 665 - Core NVIC Functions
emilmont 78:ed8466a608b4 666 - Core SysTick Functions
emilmont 78:ed8466a608b4 667 - Core Register Access Functions
emilmont 78:ed8466a608b4 668 ******************************************************************************/
AnnaBridge 145:64910690c574 669 /**
AnnaBridge 145:64910690c574 670 \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
emilmont 78:ed8466a608b4 671 */
emilmont 78:ed8466a608b4 672
emilmont 78:ed8466a608b4 673
emilmont 78:ed8466a608b4 674
emilmont 78:ed8466a608b4 675 /* ########################## NVIC functions #################################### */
AnnaBridge 145:64910690c574 676 /**
AnnaBridge 145:64910690c574 677 \ingroup CMSIS_Core_FunctionInterface
AnnaBridge 145:64910690c574 678 \defgroup CMSIS_Core_NVICFunctions NVIC Functions
AnnaBridge 145:64910690c574 679 \brief Functions that manage interrupts and exceptions via the NVIC.
AnnaBridge 145:64910690c574 680 @{
emilmont 78:ed8466a608b4 681 */
emilmont 78:ed8466a608b4 682
AnnaBridge 145:64910690c574 683 #ifdef CMSIS_NVIC_VIRTUAL
AnnaBridge 145:64910690c574 684 #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
AnnaBridge 145:64910690c574 685 #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
AnnaBridge 145:64910690c574 686 #endif
AnnaBridge 145:64910690c574 687 #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
AnnaBridge 145:64910690c574 688 #else
AnnaBridge 145:64910690c574 689 /*#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping not available for Cortex-M0+ */
AnnaBridge 145:64910690c574 690 /*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for Cortex-M0+ */
AnnaBridge 145:64910690c574 691 #define NVIC_EnableIRQ __NVIC_EnableIRQ
AnnaBridge 145:64910690c574 692 #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
AnnaBridge 145:64910690c574 693 #define NVIC_DisableIRQ __NVIC_DisableIRQ
AnnaBridge 145:64910690c574 694 #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
AnnaBridge 145:64910690c574 695 #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
AnnaBridge 145:64910690c574 696 #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
AnnaBridge 145:64910690c574 697 /*#define NVIC_GetActive __NVIC_GetActive not available for Cortex-M0+ */
AnnaBridge 145:64910690c574 698 #define NVIC_SetPriority __NVIC_SetPriority
AnnaBridge 145:64910690c574 699 #define NVIC_GetPriority __NVIC_GetPriority
AnnaBridge 145:64910690c574 700 #define NVIC_SystemReset __NVIC_SystemReset
AnnaBridge 145:64910690c574 701 #endif /* CMSIS_NVIC_VIRTUAL */
AnnaBridge 145:64910690c574 702
AnnaBridge 145:64910690c574 703 #ifdef CMSIS_VECTAB_VIRTUAL
AnnaBridge 145:64910690c574 704 #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
AnnaBridge 145:64910690c574 705 #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
AnnaBridge 145:64910690c574 706 #endif
AnnaBridge 145:64910690c574 707 #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
AnnaBridge 145:64910690c574 708 #else
AnnaBridge 145:64910690c574 709 #define NVIC_SetVector __NVIC_SetVector
AnnaBridge 145:64910690c574 710 #define NVIC_GetVector __NVIC_GetVector
AnnaBridge 145:64910690c574 711 #endif /* (CMSIS_VECTAB_VIRTUAL) */
AnnaBridge 145:64910690c574 712
AnnaBridge 145:64910690c574 713 #define NVIC_USER_IRQ_OFFSET 16
AnnaBridge 145:64910690c574 714
AnnaBridge 145:64910690c574 715
emilmont 78:ed8466a608b4 716 /* Interrupt Priorities are WORD accessible only under ARMv6M */
emilmont 78:ed8466a608b4 717 /* The following MACROS handle generation of the register offset and byte masks */
Kojto 110:165afa46840b 718 #define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
Kojto 110:165afa46840b 719 #define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
Kojto 110:165afa46840b 720 #define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
emilmont 78:ed8466a608b4 721
emilmont 78:ed8466a608b4 722
AnnaBridge 145:64910690c574 723 /**
AnnaBridge 145:64910690c574 724 \brief Enable Interrupt
AnnaBridge 145:64910690c574 725 \details Enables a device specific interrupt in the NVIC interrupt controller.
AnnaBridge 145:64910690c574 726 \param [in] IRQn Device specific interrupt number.
AnnaBridge 145:64910690c574 727 \note IRQn must not be negative.
emilmont 78:ed8466a608b4 728 */
AnnaBridge 145:64910690c574 729 __STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
emilmont 78:ed8466a608b4 730 {
AnnaBridge 145:64910690c574 731 if ((int32_t)(IRQn) >= 0)
AnnaBridge 145:64910690c574 732 {
AnnaBridge 145:64910690c574 733 NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
AnnaBridge 145:64910690c574 734 }
emilmont 78:ed8466a608b4 735 }
emilmont 78:ed8466a608b4 736
emilmont 78:ed8466a608b4 737
AnnaBridge 145:64910690c574 738 /**
AnnaBridge 145:64910690c574 739 \brief Get Interrupt Enable status
AnnaBridge 145:64910690c574 740 \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
AnnaBridge 145:64910690c574 741 \param [in] IRQn Device specific interrupt number.
AnnaBridge 145:64910690c574 742 \return 0 Interrupt is not enabled.
AnnaBridge 145:64910690c574 743 \return 1 Interrupt is enabled.
AnnaBridge 145:64910690c574 744 \note IRQn must not be negative.
emilmont 78:ed8466a608b4 745 */
AnnaBridge 145:64910690c574 746 __STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
emilmont 78:ed8466a608b4 747 {
AnnaBridge 145:64910690c574 748 if ((int32_t)(IRQn) >= 0)
AnnaBridge 145:64910690c574 749 {
AnnaBridge 145:64910690c574 750 return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
AnnaBridge 145:64910690c574 751 }
AnnaBridge 145:64910690c574 752 else
AnnaBridge 145:64910690c574 753 {
AnnaBridge 145:64910690c574 754 return(0U);
AnnaBridge 145:64910690c574 755 }
emilmont 78:ed8466a608b4 756 }
emilmont 78:ed8466a608b4 757
emilmont 78:ed8466a608b4 758
AnnaBridge 145:64910690c574 759 /**
AnnaBridge 145:64910690c574 760 \brief Disable Interrupt
AnnaBridge 145:64910690c574 761 \details Disables a device specific interrupt in the NVIC interrupt controller.
AnnaBridge 145:64910690c574 762 \param [in] IRQn Device specific interrupt number.
AnnaBridge 145:64910690c574 763 \note IRQn must not be negative.
emilmont 78:ed8466a608b4 764 */
AnnaBridge 145:64910690c574 765 __STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
emilmont 78:ed8466a608b4 766 {
AnnaBridge 145:64910690c574 767 if ((int32_t)(IRQn) >= 0)
AnnaBridge 145:64910690c574 768 {
AnnaBridge 145:64910690c574 769 NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
AnnaBridge 145:64910690c574 770 __DSB();
AnnaBridge 145:64910690c574 771 __ISB();
AnnaBridge 145:64910690c574 772 }
emilmont 78:ed8466a608b4 773 }
emilmont 78:ed8466a608b4 774
emilmont 78:ed8466a608b4 775
AnnaBridge 145:64910690c574 776 /**
AnnaBridge 145:64910690c574 777 \brief Get Pending Interrupt
AnnaBridge 145:64910690c574 778 \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
AnnaBridge 145:64910690c574 779 \param [in] IRQn Device specific interrupt number.
AnnaBridge 145:64910690c574 780 \return 0 Interrupt status is not pending.
AnnaBridge 145:64910690c574 781 \return 1 Interrupt status is pending.
AnnaBridge 145:64910690c574 782 \note IRQn must not be negative.
emilmont 78:ed8466a608b4 783 */
AnnaBridge 145:64910690c574 784 __STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
emilmont 78:ed8466a608b4 785 {
AnnaBridge 145:64910690c574 786 if ((int32_t)(IRQn) >= 0)
AnnaBridge 145:64910690c574 787 {
AnnaBridge 145:64910690c574 788 return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
AnnaBridge 145:64910690c574 789 }
AnnaBridge 145:64910690c574 790 else
AnnaBridge 145:64910690c574 791 {
AnnaBridge 145:64910690c574 792 return(0U);
AnnaBridge 145:64910690c574 793 }
emilmont 78:ed8466a608b4 794 }
emilmont 78:ed8466a608b4 795
emilmont 78:ed8466a608b4 796
AnnaBridge 145:64910690c574 797 /**
AnnaBridge 145:64910690c574 798 \brief Set Pending Interrupt
AnnaBridge 145:64910690c574 799 \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
AnnaBridge 145:64910690c574 800 \param [in] IRQn Device specific interrupt number.
AnnaBridge 145:64910690c574 801 \note IRQn must not be negative.
emilmont 78:ed8466a608b4 802 */
AnnaBridge 145:64910690c574 803 __STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
emilmont 78:ed8466a608b4 804 {
AnnaBridge 145:64910690c574 805 if ((int32_t)(IRQn) >= 0)
AnnaBridge 145:64910690c574 806 {
AnnaBridge 145:64910690c574 807 NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
Kojto 110:165afa46840b 808 }
AnnaBridge 145:64910690c574 809 }
AnnaBridge 145:64910690c574 810
AnnaBridge 145:64910690c574 811
AnnaBridge 145:64910690c574 812 /**
AnnaBridge 145:64910690c574 813 \brief Clear Pending Interrupt
AnnaBridge 145:64910690c574 814 \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
AnnaBridge 145:64910690c574 815 \param [in] IRQn Device specific interrupt number.
AnnaBridge 145:64910690c574 816 \note IRQn must not be negative.
AnnaBridge 145:64910690c574 817 */
AnnaBridge 145:64910690c574 818 __STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
AnnaBridge 145:64910690c574 819 {
AnnaBridge 145:64910690c574 820 if ((int32_t)(IRQn) >= 0)
AnnaBridge 145:64910690c574 821 {
AnnaBridge 145:64910690c574 822 NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL));
Kojto 110:165afa46840b 823 }
emilmont 78:ed8466a608b4 824 }
emilmont 78:ed8466a608b4 825
emilmont 78:ed8466a608b4 826
AnnaBridge 145:64910690c574 827 /**
AnnaBridge 145:64910690c574 828 \brief Set Interrupt Priority
AnnaBridge 145:64910690c574 829 \details Sets the priority of a device specific interrupt or a processor exception.
AnnaBridge 145:64910690c574 830 The interrupt number can be positive to specify a device specific interrupt,
AnnaBridge 145:64910690c574 831 or negative to specify a processor exception.
AnnaBridge 145:64910690c574 832 \param [in] IRQn Interrupt number.
AnnaBridge 145:64910690c574 833 \param [in] priority Priority to set.
AnnaBridge 145:64910690c574 834 \note The priority cannot be set for every processor exception.
AnnaBridge 145:64910690c574 835 */
AnnaBridge 145:64910690c574 836 __STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
AnnaBridge 145:64910690c574 837 {
AnnaBridge 145:64910690c574 838 if ((int32_t)(IRQn) >= 0)
AnnaBridge 145:64910690c574 839 {
AnnaBridge 145:64910690c574 840 NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
AnnaBridge 145:64910690c574 841 (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
AnnaBridge 145:64910690c574 842 }
AnnaBridge 145:64910690c574 843 else
AnnaBridge 145:64910690c574 844 {
AnnaBridge 145:64910690c574 845 SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
AnnaBridge 145:64910690c574 846 (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
AnnaBridge 145:64910690c574 847 }
AnnaBridge 145:64910690c574 848 }
emilmont 78:ed8466a608b4 849
emilmont 78:ed8466a608b4 850
AnnaBridge 145:64910690c574 851 /**
AnnaBridge 145:64910690c574 852 \brief Get Interrupt Priority
AnnaBridge 145:64910690c574 853 \details Reads the priority of a device specific interrupt or a processor exception.
AnnaBridge 145:64910690c574 854 The interrupt number can be positive to specify a device specific interrupt,
AnnaBridge 145:64910690c574 855 or negative to specify a processor exception.
AnnaBridge 145:64910690c574 856 \param [in] IRQn Interrupt number.
AnnaBridge 145:64910690c574 857 \return Interrupt Priority.
AnnaBridge 145:64910690c574 858 Value is aligned automatically to the implemented priority bits of the microcontroller.
emilmont 78:ed8466a608b4 859 */
AnnaBridge 145:64910690c574 860 __STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
emilmont 78:ed8466a608b4 861 {
emilmont 78:ed8466a608b4 862
AnnaBridge 145:64910690c574 863 if ((int32_t)(IRQn) >= 0)
AnnaBridge 145:64910690c574 864 {
AnnaBridge 145:64910690c574 865 return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
Kojto 110:165afa46840b 866 }
AnnaBridge 145:64910690c574 867 else
AnnaBridge 145:64910690c574 868 {
AnnaBridge 145:64910690c574 869 return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
Kojto 110:165afa46840b 870 }
emilmont 78:ed8466a608b4 871 }
emilmont 78:ed8466a608b4 872
emilmont 78:ed8466a608b4 873
AnnaBridge 145:64910690c574 874 /**
AnnaBridge 145:64910690c574 875 \brief Set Interrupt Vector
AnnaBridge 145:64910690c574 876 \details Sets an interrupt vector in SRAM based interrupt vector table.
AnnaBridge 145:64910690c574 877 The interrupt number can be positive to specify a device specific interrupt,
AnnaBridge 145:64910690c574 878 or negative to specify a processor exception.
AnnaBridge 145:64910690c574 879 VTOR must been relocated to SRAM before.
AnnaBridge 145:64910690c574 880 If VTOR is not present address 0 must be mapped to SRAM.
AnnaBridge 145:64910690c574 881 \param [in] IRQn Interrupt number
AnnaBridge 145:64910690c574 882 \param [in] vector Address of interrupt handler function
emilmont 78:ed8466a608b4 883 */
AnnaBridge 145:64910690c574 884 __STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
emilmont 78:ed8466a608b4 885 {
AnnaBridge 145:64910690c574 886 #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
AnnaBridge 145:64910690c574 887 uint32_t *vectors = (uint32_t *)SCB->VTOR;
AnnaBridge 145:64910690c574 888 #else
AnnaBridge 145:64910690c574 889 uint32_t *vectors = (uint32_t *)0x0U;
AnnaBridge 145:64910690c574 890 #endif
AnnaBridge 145:64910690c574 891 vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
AnnaBridge 145:64910690c574 892 }
AnnaBridge 145:64910690c574 893
AnnaBridge 145:64910690c574 894
AnnaBridge 145:64910690c574 895 /**
AnnaBridge 145:64910690c574 896 \brief Get Interrupt Vector
AnnaBridge 145:64910690c574 897 \details Reads an interrupt vector from interrupt vector table.
AnnaBridge 145:64910690c574 898 The interrupt number can be positive to specify a device specific interrupt,
AnnaBridge 145:64910690c574 899 or negative to specify a processor exception.
AnnaBridge 145:64910690c574 900 \param [in] IRQn Interrupt number.
AnnaBridge 145:64910690c574 901 \return Address of interrupt handler function
AnnaBridge 145:64910690c574 902 */
AnnaBridge 145:64910690c574 903 __STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
AnnaBridge 145:64910690c574 904 {
AnnaBridge 145:64910690c574 905 #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
AnnaBridge 145:64910690c574 906 uint32_t *vectors = (uint32_t *)SCB->VTOR;
AnnaBridge 145:64910690c574 907 #else
AnnaBridge 145:64910690c574 908 uint32_t *vectors = (uint32_t *)0x0U;
AnnaBridge 145:64910690c574 909 #endif
AnnaBridge 145:64910690c574 910 return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
AnnaBridge 145:64910690c574 911
AnnaBridge 145:64910690c574 912 }
AnnaBridge 145:64910690c574 913
AnnaBridge 145:64910690c574 914
AnnaBridge 145:64910690c574 915 /**
AnnaBridge 145:64910690c574 916 \brief System Reset
AnnaBridge 145:64910690c574 917 \details Initiates a system reset request to reset the MCU.
AnnaBridge 145:64910690c574 918 */
AnnaBridge 145:64910690c574 919 __STATIC_INLINE void __NVIC_SystemReset(void)
AnnaBridge 145:64910690c574 920 {
AnnaBridge 145:64910690c574 921 __DSB(); /* Ensure all outstanding memory accesses included
AnnaBridge 145:64910690c574 922 buffered write are completed before reset */
Kojto 110:165afa46840b 923 SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
emilmont 78:ed8466a608b4 924 SCB_AIRCR_SYSRESETREQ_Msk);
AnnaBridge 145:64910690c574 925 __DSB(); /* Ensure completion of memory access */
AnnaBridge 145:64910690c574 926
AnnaBridge 145:64910690c574 927 for(;;) /* wait until reset */
AnnaBridge 145:64910690c574 928 {
AnnaBridge 145:64910690c574 929 __NOP();
AnnaBridge 145:64910690c574 930 }
emilmont 78:ed8466a608b4 931 }
emilmont 78:ed8466a608b4 932
emilmont 78:ed8466a608b4 933 /*@} end of CMSIS_Core_NVICFunctions */
emilmont 78:ed8466a608b4 934
emilmont 78:ed8466a608b4 935
AnnaBridge 145:64910690c574 936 /* ########################## FPU functions #################################### */
AnnaBridge 145:64910690c574 937 /**
AnnaBridge 145:64910690c574 938 \ingroup CMSIS_Core_FunctionInterface
AnnaBridge 145:64910690c574 939 \defgroup CMSIS_Core_FpuFunctions FPU Functions
AnnaBridge 145:64910690c574 940 \brief Function that provides FPU type.
emilmont 78:ed8466a608b4 941 @{
emilmont 78:ed8466a608b4 942 */
emilmont 78:ed8466a608b4 943
AnnaBridge 145:64910690c574 944 /**
AnnaBridge 145:64910690c574 945 \brief get FPU type
AnnaBridge 145:64910690c574 946 \details returns the FPU type
AnnaBridge 145:64910690c574 947 \returns
AnnaBridge 145:64910690c574 948 - \b 0: No FPU
AnnaBridge 145:64910690c574 949 - \b 1: Single precision FPU
AnnaBridge 145:64910690c574 950 - \b 2: Double + Single precision FPU
AnnaBridge 145:64910690c574 951 */
AnnaBridge 145:64910690c574 952 __STATIC_INLINE uint32_t SCB_GetFPUType(void)
AnnaBridge 145:64910690c574 953 {
AnnaBridge 145:64910690c574 954 return 0U; /* No FPU */
AnnaBridge 145:64910690c574 955 }
emilmont 78:ed8466a608b4 956
emilmont 78:ed8466a608b4 957
AnnaBridge 145:64910690c574 958 /*@} end of CMSIS_Core_FpuFunctions */
AnnaBridge 145:64910690c574 959
AnnaBridge 145:64910690c574 960
emilmont 78:ed8466a608b4 961
AnnaBridge 145:64910690c574 962 /* ################################## SysTick function ############################################ */
AnnaBridge 145:64910690c574 963 /**
AnnaBridge 145:64910690c574 964 \ingroup CMSIS_Core_FunctionInterface
AnnaBridge 145:64910690c574 965 \defgroup CMSIS_Core_SysTickFunctions SysTick Functions
AnnaBridge 145:64910690c574 966 \brief Functions that configure the System.
AnnaBridge 145:64910690c574 967 @{
AnnaBridge 145:64910690c574 968 */
emilmont 78:ed8466a608b4 969
AnnaBridge 145:64910690c574 970 #if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
emilmont 78:ed8466a608b4 971
AnnaBridge 145:64910690c574 972 /**
AnnaBridge 145:64910690c574 973 \brief System Tick Configuration
AnnaBridge 145:64910690c574 974 \details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
AnnaBridge 145:64910690c574 975 Counter is in free running mode to generate periodic interrupts.
AnnaBridge 145:64910690c574 976 \param [in] ticks Number of ticks between two interrupts.
AnnaBridge 145:64910690c574 977 \return 0 Function succeeded.
AnnaBridge 145:64910690c574 978 \return 1 Function failed.
AnnaBridge 145:64910690c574 979 \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
AnnaBridge 145:64910690c574 980 function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
AnnaBridge 145:64910690c574 981 must contain a vendor-specific implementation of this function.
emilmont 78:ed8466a608b4 982 */
emilmont 78:ed8466a608b4 983 __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
emilmont 78:ed8466a608b4 984 {
AnnaBridge 145:64910690c574 985 if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
AnnaBridge 145:64910690c574 986 {
AnnaBridge 145:64910690c574 987 return (1UL); /* Reload value impossible */
AnnaBridge 145:64910690c574 988 }
emilmont 78:ed8466a608b4 989
Kojto 110:165afa46840b 990 SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
Kojto 110:165afa46840b 991 NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
Kojto 110:165afa46840b 992 SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
emilmont 78:ed8466a608b4 993 SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
emilmont 78:ed8466a608b4 994 SysTick_CTRL_TICKINT_Msk |
Kojto 110:165afa46840b 995 SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
Kojto 110:165afa46840b 996 return (0UL); /* Function successful */
emilmont 78:ed8466a608b4 997 }
emilmont 78:ed8466a608b4 998
emilmont 78:ed8466a608b4 999 #endif
emilmont 78:ed8466a608b4 1000
emilmont 78:ed8466a608b4 1001 /*@} end of CMSIS_Core_SysTickFunctions */
emilmont 78:ed8466a608b4 1002
emilmont 78:ed8466a608b4 1003
emilmont 78:ed8466a608b4 1004
emilmont 78:ed8466a608b4 1005
Kojto 110:165afa46840b 1006 #ifdef __cplusplus
Kojto 110:165afa46840b 1007 }
Kojto 110:165afa46840b 1008 #endif
Kojto 110:165afa46840b 1009
emilmont 78:ed8466a608b4 1010 #endif /* __CORE_CM0PLUS_H_DEPENDANT */
emilmont 78:ed8466a608b4 1011
emilmont 78:ed8466a608b4 1012 #endif /* __CMSIS_GENERIC */