.

Dependents:   RTC

Committer:
jhon309
Date:
Thu Aug 13 00:20:09 2015 +0000
Revision:
0:88e313c910d0
RTC Example

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jhon309 0:88e313c910d0 1 /**************************************************************************//**
jhon309 0:88e313c910d0 2 * @file core_ca9.h
jhon309 0:88e313c910d0 3 * @brief CMSIS Cortex-A9 Core Peripheral Access Layer Header File
jhon309 0:88e313c910d0 4 * @version
jhon309 0:88e313c910d0 5 * @date 25 March 2013
jhon309 0:88e313c910d0 6 *
jhon309 0:88e313c910d0 7 * @note
jhon309 0:88e313c910d0 8 *
jhon309 0:88e313c910d0 9 ******************************************************************************/
jhon309 0:88e313c910d0 10 /* Copyright (c) 2009 - 2012 ARM LIMITED
jhon309 0:88e313c910d0 11
jhon309 0:88e313c910d0 12 All rights reserved.
jhon309 0:88e313c910d0 13 Redistribution and use in source and binary forms, with or without
jhon309 0:88e313c910d0 14 modification, are permitted provided that the following conditions are met:
jhon309 0:88e313c910d0 15 - Redistributions of source code must retain the above copyright
jhon309 0:88e313c910d0 16 notice, this list of conditions and the following disclaimer.
jhon309 0:88e313c910d0 17 - Redistributions in binary form must reproduce the above copyright
jhon309 0:88e313c910d0 18 notice, this list of conditions and the following disclaimer in the
jhon309 0:88e313c910d0 19 documentation and/or other materials provided with the distribution.
jhon309 0:88e313c910d0 20 - Neither the name of ARM nor the names of its contributors may be used
jhon309 0:88e313c910d0 21 to endorse or promote products derived from this software without
jhon309 0:88e313c910d0 22 specific prior written permission.
jhon309 0:88e313c910d0 23 *
jhon309 0:88e313c910d0 24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
jhon309 0:88e313c910d0 25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
jhon309 0:88e313c910d0 26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
jhon309 0:88e313c910d0 27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
jhon309 0:88e313c910d0 28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
jhon309 0:88e313c910d0 29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
jhon309 0:88e313c910d0 30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
jhon309 0:88e313c910d0 31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
jhon309 0:88e313c910d0 32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
jhon309 0:88e313c910d0 33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
jhon309 0:88e313c910d0 34 POSSIBILITY OF SUCH DAMAGE.
jhon309 0:88e313c910d0 35 ---------------------------------------------------------------------------*/
jhon309 0:88e313c910d0 36
jhon309 0:88e313c910d0 37
jhon309 0:88e313c910d0 38 #if defined ( __ICCARM__ )
jhon309 0:88e313c910d0 39 #pragma system_include /* treat file as system include file for MISRA check */
jhon309 0:88e313c910d0 40 #endif
jhon309 0:88e313c910d0 41
jhon309 0:88e313c910d0 42 #ifdef __cplusplus
jhon309 0:88e313c910d0 43 extern "C" {
jhon309 0:88e313c910d0 44 #endif
jhon309 0:88e313c910d0 45
jhon309 0:88e313c910d0 46 #ifndef __CORE_CA9_H_GENERIC
jhon309 0:88e313c910d0 47 #define __CORE_CA9_H_GENERIC
jhon309 0:88e313c910d0 48
jhon309 0:88e313c910d0 49
jhon309 0:88e313c910d0 50 /** \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
jhon309 0:88e313c910d0 51 CMSIS violates the following MISRA-C:2004 rules:
jhon309 0:88e313c910d0 52
jhon309 0:88e313c910d0 53 \li Required Rule 8.5, object/function definition in header file.<br>
jhon309 0:88e313c910d0 54 Function definitions in header files are used to allow 'inlining'.
jhon309 0:88e313c910d0 55
jhon309 0:88e313c910d0 56 \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
jhon309 0:88e313c910d0 57 Unions are used for effective representation of core registers.
jhon309 0:88e313c910d0 58
jhon309 0:88e313c910d0 59 \li Advisory Rule 19.7, Function-like macro defined.<br>
jhon309 0:88e313c910d0 60 Function-like macros are used to allow more efficient code.
jhon309 0:88e313c910d0 61 */
jhon309 0:88e313c910d0 62
jhon309 0:88e313c910d0 63
jhon309 0:88e313c910d0 64 /*******************************************************************************
jhon309 0:88e313c910d0 65 * CMSIS definitions
jhon309 0:88e313c910d0 66 ******************************************************************************/
jhon309 0:88e313c910d0 67 /** \ingroup Cortex_A9
jhon309 0:88e313c910d0 68 @{
jhon309 0:88e313c910d0 69 */
jhon309 0:88e313c910d0 70
jhon309 0:88e313c910d0 71 /* CMSIS CA9 definitions */
jhon309 0:88e313c910d0 72 #define __CA9_CMSIS_VERSION_MAIN (0x03) /*!< [31:16] CMSIS HAL main version */
jhon309 0:88e313c910d0 73 #define __CA9_CMSIS_VERSION_SUB (0x10) /*!< [15:0] CMSIS HAL sub version */
jhon309 0:88e313c910d0 74 #define __CA9_CMSIS_VERSION ((__CA9_CMSIS_VERSION_MAIN << 16) | \
jhon309 0:88e313c910d0 75 __CA9_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */
jhon309 0:88e313c910d0 76
jhon309 0:88e313c910d0 77 #define __CORTEX_A (0x09) /*!< Cortex-A Core */
jhon309 0:88e313c910d0 78
jhon309 0:88e313c910d0 79
jhon309 0:88e313c910d0 80 #if defined ( __CC_ARM )
jhon309 0:88e313c910d0 81 #define __ASM __asm /*!< asm keyword for ARM Compiler */
jhon309 0:88e313c910d0 82 #define __INLINE __inline /*!< inline keyword for ARM Compiler */
jhon309 0:88e313c910d0 83 #define __STATIC_INLINE static __inline
jhon309 0:88e313c910d0 84 #define __STATIC_ASM static __asm
jhon309 0:88e313c910d0 85
jhon309 0:88e313c910d0 86 #elif defined ( __ICCARM__ )
jhon309 0:88e313c910d0 87 #define __ASM __asm /*!< asm keyword for IAR Compiler */
jhon309 0:88e313c910d0 88 #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
jhon309 0:88e313c910d0 89 #define __STATIC_INLINE static inline
jhon309 0:88e313c910d0 90 #define __STATIC_ASM static __asm
jhon309 0:88e313c910d0 91
jhon309 0:88e313c910d0 92 #elif defined ( __TMS470__ )
jhon309 0:88e313c910d0 93 #define __ASM __asm /*!< asm keyword for TI CCS Compiler */
jhon309 0:88e313c910d0 94 #define __STATIC_INLINE static inline
jhon309 0:88e313c910d0 95 #define __STATIC_ASM static __asm
jhon309 0:88e313c910d0 96
jhon309 0:88e313c910d0 97 #elif defined ( __GNUC__ )
jhon309 0:88e313c910d0 98 #define __ASM __asm /*!< asm keyword for GNU Compiler */
jhon309 0:88e313c910d0 99 #define __INLINE inline /*!< inline keyword for GNU Compiler */
jhon309 0:88e313c910d0 100 #define __STATIC_INLINE static inline
jhon309 0:88e313c910d0 101 #define __STATIC_ASM static __asm
jhon309 0:88e313c910d0 102
jhon309 0:88e313c910d0 103 #elif defined ( __TASKING__ )
jhon309 0:88e313c910d0 104 #define __ASM __asm /*!< asm keyword for TASKING Compiler */
jhon309 0:88e313c910d0 105 #define __INLINE inline /*!< inline keyword for TASKING Compiler */
jhon309 0:88e313c910d0 106 #define __STATIC_INLINE static inline
jhon309 0:88e313c910d0 107 #define __STATIC_ASM static __asm
jhon309 0:88e313c910d0 108
jhon309 0:88e313c910d0 109 #endif
jhon309 0:88e313c910d0 110
jhon309 0:88e313c910d0 111 /** __FPU_USED indicates whether an FPU is used or not. For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions.
jhon309 0:88e313c910d0 112 */
jhon309 0:88e313c910d0 113 #if defined ( __CC_ARM )
jhon309 0:88e313c910d0 114 #if defined __TARGET_FPU_VFP
jhon309 0:88e313c910d0 115 #if (__FPU_PRESENT == 1)
jhon309 0:88e313c910d0 116 #define __FPU_USED 1
jhon309 0:88e313c910d0 117 #else
jhon309 0:88e313c910d0 118 #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
jhon309 0:88e313c910d0 119 #define __FPU_USED 0
jhon309 0:88e313c910d0 120 #endif
jhon309 0:88e313c910d0 121 #else
jhon309 0:88e313c910d0 122 #define __FPU_USED 0
jhon309 0:88e313c910d0 123 #endif
jhon309 0:88e313c910d0 124
jhon309 0:88e313c910d0 125 #elif defined ( __ICCARM__ )
jhon309 0:88e313c910d0 126 #if defined __ARMVFP__
jhon309 0:88e313c910d0 127 #if (__FPU_PRESENT == 1)
jhon309 0:88e313c910d0 128 #define __FPU_USED 1
jhon309 0:88e313c910d0 129 #else
jhon309 0:88e313c910d0 130 #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
jhon309 0:88e313c910d0 131 #define __FPU_USED 0
jhon309 0:88e313c910d0 132 #endif
jhon309 0:88e313c910d0 133 #else
jhon309 0:88e313c910d0 134 #define __FPU_USED 0
jhon309 0:88e313c910d0 135 #endif
jhon309 0:88e313c910d0 136
jhon309 0:88e313c910d0 137 #elif defined ( __TMS470__ )
jhon309 0:88e313c910d0 138 #if defined __TI_VFP_SUPPORT__
jhon309 0:88e313c910d0 139 #if (__FPU_PRESENT == 1)
jhon309 0:88e313c910d0 140 #define __FPU_USED 1
jhon309 0:88e313c910d0 141 #else
jhon309 0:88e313c910d0 142 #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
jhon309 0:88e313c910d0 143 #define __FPU_USED 0
jhon309 0:88e313c910d0 144 #endif
jhon309 0:88e313c910d0 145 #else
jhon309 0:88e313c910d0 146 #define __FPU_USED 0
jhon309 0:88e313c910d0 147 #endif
jhon309 0:88e313c910d0 148
jhon309 0:88e313c910d0 149 #elif defined ( __GNUC__ )
jhon309 0:88e313c910d0 150 #if defined (__VFP_FP__) && !defined(__SOFTFP__)
jhon309 0:88e313c910d0 151 #if (__FPU_PRESENT == 1)
jhon309 0:88e313c910d0 152 #define __FPU_USED 1
jhon309 0:88e313c910d0 153 #else
jhon309 0:88e313c910d0 154 #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
jhon309 0:88e313c910d0 155 #define __FPU_USED 0
jhon309 0:88e313c910d0 156 #endif
jhon309 0:88e313c910d0 157 #else
jhon309 0:88e313c910d0 158 #define __FPU_USED 0
jhon309 0:88e313c910d0 159 #endif
jhon309 0:88e313c910d0 160
jhon309 0:88e313c910d0 161 #elif defined ( __TASKING__ )
jhon309 0:88e313c910d0 162 #if defined __FPU_VFP__
jhon309 0:88e313c910d0 163 #if (__FPU_PRESENT == 1)
jhon309 0:88e313c910d0 164 #define __FPU_USED 1
jhon309 0:88e313c910d0 165 #else
jhon309 0:88e313c910d0 166 #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
jhon309 0:88e313c910d0 167 #define __FPU_USED 0
jhon309 0:88e313c910d0 168 #endif
jhon309 0:88e313c910d0 169 #else
jhon309 0:88e313c910d0 170 #define __FPU_USED 0
jhon309 0:88e313c910d0 171 #endif
jhon309 0:88e313c910d0 172 #endif
jhon309 0:88e313c910d0 173
jhon309 0:88e313c910d0 174 #include <stdint.h> /*!< standard types definitions */
jhon309 0:88e313c910d0 175 #include "core_caInstr.h" /*!< Core Instruction Access */
jhon309 0:88e313c910d0 176 #include "core_caFunc.h" /*!< Core Function Access */
jhon309 0:88e313c910d0 177 #include "core_cm4_simd.h" /*!< Compiler specific SIMD Intrinsics */
jhon309 0:88e313c910d0 178
jhon309 0:88e313c910d0 179 #endif /* __CORE_CA9_H_GENERIC */
jhon309 0:88e313c910d0 180
jhon309 0:88e313c910d0 181 #ifndef __CMSIS_GENERIC
jhon309 0:88e313c910d0 182
jhon309 0:88e313c910d0 183 #ifndef __CORE_CA9_H_DEPENDANT
jhon309 0:88e313c910d0 184 #define __CORE_CA9_H_DEPENDANT
jhon309 0:88e313c910d0 185
jhon309 0:88e313c910d0 186 /* check device defines and use defaults */
jhon309 0:88e313c910d0 187 #if defined __CHECK_DEVICE_DEFINES
jhon309 0:88e313c910d0 188 #ifndef __CA9_REV
jhon309 0:88e313c910d0 189 #define __CA9_REV 0x0000
jhon309 0:88e313c910d0 190 #warning "__CA9_REV not defined in device header file; using default!"
jhon309 0:88e313c910d0 191 #endif
jhon309 0:88e313c910d0 192
jhon309 0:88e313c910d0 193 #ifndef __FPU_PRESENT
jhon309 0:88e313c910d0 194 #define __FPU_PRESENT 1
jhon309 0:88e313c910d0 195 #warning "__FPU_PRESENT not defined in device header file; using default!"
jhon309 0:88e313c910d0 196 #endif
jhon309 0:88e313c910d0 197
jhon309 0:88e313c910d0 198 #ifndef __Vendor_SysTickConfig
jhon309 0:88e313c910d0 199 #define __Vendor_SysTickConfig 1
jhon309 0:88e313c910d0 200 #endif
jhon309 0:88e313c910d0 201
jhon309 0:88e313c910d0 202 #if __Vendor_SysTickConfig == 0
jhon309 0:88e313c910d0 203 #error "__Vendor_SysTickConfig set to 0, but vendor systick timer must be supplied for Cortex-A9"
jhon309 0:88e313c910d0 204 #endif
jhon309 0:88e313c910d0 205 #endif
jhon309 0:88e313c910d0 206
jhon309 0:88e313c910d0 207 /* IO definitions (access restrictions to peripheral registers) */
jhon309 0:88e313c910d0 208 /**
jhon309 0:88e313c910d0 209 \defgroup CMSIS_glob_defs CMSIS Global Defines
jhon309 0:88e313c910d0 210
jhon309 0:88e313c910d0 211 <strong>IO Type Qualifiers</strong> are used
jhon309 0:88e313c910d0 212 \li to specify the access to peripheral variables.
jhon309 0:88e313c910d0 213 \li for automatic generation of peripheral register debug information.
jhon309 0:88e313c910d0 214 */
jhon309 0:88e313c910d0 215 #ifdef __cplusplus
jhon309 0:88e313c910d0 216 #define __I volatile /*!< Defines 'read only' permissions */
jhon309 0:88e313c910d0 217 #else
jhon309 0:88e313c910d0 218 #define __I volatile const /*!< Defines 'read only' permissions */
jhon309 0:88e313c910d0 219 #endif
jhon309 0:88e313c910d0 220 #define __O volatile /*!< Defines 'write only' permissions */
jhon309 0:88e313c910d0 221 #define __IO volatile /*!< Defines 'read / write' permissions */
jhon309 0:88e313c910d0 222
jhon309 0:88e313c910d0 223 /*@} end of group Cortex_A9 */
jhon309 0:88e313c910d0 224
jhon309 0:88e313c910d0 225
jhon309 0:88e313c910d0 226 /*******************************************************************************
jhon309 0:88e313c910d0 227 * Register Abstraction
jhon309 0:88e313c910d0 228 ******************************************************************************/
jhon309 0:88e313c910d0 229 /** \defgroup CMSIS_core_register Defines and Type Definitions
jhon309 0:88e313c910d0 230 \brief Type definitions and defines for Cortex-A processor based devices.
jhon309 0:88e313c910d0 231 */
jhon309 0:88e313c910d0 232
jhon309 0:88e313c910d0 233 /** \ingroup CMSIS_core_register
jhon309 0:88e313c910d0 234 \defgroup CMSIS_CORE Status and Control Registers
jhon309 0:88e313c910d0 235 \brief Core Register type definitions.
jhon309 0:88e313c910d0 236 @{
jhon309 0:88e313c910d0 237 */
jhon309 0:88e313c910d0 238
jhon309 0:88e313c910d0 239 /** \brief Union type to access the Application Program Status Register (APSR).
jhon309 0:88e313c910d0 240 */
jhon309 0:88e313c910d0 241 typedef union
jhon309 0:88e313c910d0 242 {
jhon309 0:88e313c910d0 243 struct
jhon309 0:88e313c910d0 244 {
jhon309 0:88e313c910d0 245 uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */
jhon309 0:88e313c910d0 246 uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */
jhon309 0:88e313c910d0 247 uint32_t reserved1:7; /*!< bit: 20..23 Reserved */
jhon309 0:88e313c910d0 248 uint32_t Q:1; /*!< bit: 27 Saturation condition flag */
jhon309 0:88e313c910d0 249 uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
jhon309 0:88e313c910d0 250 uint32_t C:1; /*!< bit: 29 Carry condition code flag */
jhon309 0:88e313c910d0 251 uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
jhon309 0:88e313c910d0 252 uint32_t N:1; /*!< bit: 31 Negative condition code flag */
jhon309 0:88e313c910d0 253 } b; /*!< Structure used for bit access */
jhon309 0:88e313c910d0 254 uint32_t w; /*!< Type used for word access */
jhon309 0:88e313c910d0 255 } APSR_Type;
jhon309 0:88e313c910d0 256
jhon309 0:88e313c910d0 257
jhon309 0:88e313c910d0 258 /*@} end of group CMSIS_CORE */
jhon309 0:88e313c910d0 259
jhon309 0:88e313c910d0 260 /*@} end of CMSIS_Core_FPUFunctions */
jhon309 0:88e313c910d0 261
jhon309 0:88e313c910d0 262
jhon309 0:88e313c910d0 263 #endif /* __CORE_CA9_H_GENERIC */
jhon309 0:88e313c910d0 264
jhon309 0:88e313c910d0 265 #endif /* __CMSIS_GENERIC */
jhon309 0:88e313c910d0 266
jhon309 0:88e313c910d0 267 #ifdef __cplusplus
jhon309 0:88e313c910d0 268 }
jhon309 0:88e313c910d0 269
jhon309 0:88e313c910d0 270
jhon309 0:88e313c910d0 271 #endif