Integrating the ublox LISA C200 modem

Fork of SprintUSBModemHTTPClientTest by Donatien Garnier

Committer:
sam_grove
Date:
Thu Sep 26 00:44:20 2013 -0500
Revision:
5:3f93dd1d4cb3
Exported program and replaced contents of the repo with the source
to build and debug using keil mdk. Libs NOT upto date are lwip, lwip-sys
and socket. these have newer versions under mbed_official but were starting
from a know working point

Who changed what in which revision?

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