Naze32 clone with Frysky receiver
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

core_ca9.h 11KB

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