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