ARMCM0plus.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. /**************************************************************************//**
  2. * @file ARMCM0plus.h
  3. * @brief CMSIS Core Peripheral Access Layer Header File for
  4. * ARMCM0plus Device Series
  5. * @version V5.00
  6. * @date 10. January 2018
  7. ******************************************************************************/
  8. /*
  9. * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
  10. *
  11. * SPDX-License-Identifier: Apache-2.0
  12. *
  13. * Licensed under the Apache License, Version 2.0 (the License); you may
  14. * not use this file except in compliance with the License.
  15. * You may obtain a copy of the License at
  16. *
  17. * www.apache.org/licenses/LICENSE-2.0
  18. *
  19. * Unless required by applicable law or agreed to in writing, software
  20. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  21. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the License for the specific language governing permissions and
  23. * limitations under the License.
  24. */
  25. #ifndef ARMCM0plus_H
  26. #define ARMCM0plus_H
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /* ------------------------- Interrupt Number Definition ------------------------ */
  31. typedef enum IRQn
  32. {
  33. /* ------------------- Cortex-M0+ Processor Exceptions Numbers ------------------ */
  34. NonMaskableInt_IRQn = -14, /* 2 Non Maskable Interrupt */
  35. HardFault_IRQn = -13, /* 3 HardFault Interrupt */
  36. SVCall_IRQn = -5, /* 11 SV Call Interrupt */
  37. PendSV_IRQn = -2, /* 14 Pend SV Interrupt */
  38. SysTick_IRQn = -1, /* 15 System Tick Interrupt */
  39. /* ---------------------- ARMCM0 Specific Interrupt Numbers --------------------- */
  40. WDT_IRQn = 0, /* Watchdog Timer Interrupt */
  41. RTC_IRQn = 1, /* Real Time Clock Interrupt */
  42. TIM0_IRQn = 2, /* Timer0 / Timer1 Interrupt */
  43. TIM2_IRQn = 3, /* Timer2 / Timer3 Interrupt */
  44. MCIA_IRQn = 4, /* MCIa Interrupt */
  45. MCIB_IRQn = 5, /* MCIb Interrupt */
  46. UART0_IRQn = 6, /* UART0 Interrupt */
  47. UART1_IRQn = 7, /* UART1 Interrupt */
  48. UART2_IRQn = 8, /* UART2 Interrupt */
  49. UART4_IRQn = 9, /* UART4 Interrupt */
  50. AACI_IRQn = 10, /* AACI / AC97 Interrupt */
  51. CLCD_IRQn = 11, /* CLCD Combined Interrupt */
  52. ENET_IRQn = 12, /* Ethernet Interrupt */
  53. USBDC_IRQn = 13, /* USB Device Interrupt */
  54. USBHC_IRQn = 14, /* USB Host Controller Interrupt */
  55. CHLCD_IRQn = 15, /* Character LCD Interrupt */
  56. FLEXRAY_IRQn = 16, /* Flexray Interrupt */
  57. CAN_IRQn = 17, /* CAN Interrupt */
  58. LIN_IRQn = 18, /* LIN Interrupt */
  59. I2C_IRQn = 19, /* I2C ADC/DAC Interrupt */
  60. CPU_CLCD_IRQn = 28, /* CPU CLCD Combined Interrupt */
  61. UART3_IRQn = 30, /* UART3 Interrupt */
  62. SPI_IRQn = 31 /* SPI Touchscreen Interrupt */
  63. } IRQn_Type;
  64. /* ================================================================================ */
  65. /* ================ Processor and Core Peripheral Section ================ */
  66. /* ================================================================================ */
  67. /* ------- Start of section using anonymous unions and disabling warnings ------- */
  68. #if defined (__CC_ARM)
  69. #pragma push
  70. #pragma anon_unions
  71. #elif defined (__ICCARM__)
  72. #pragma language=extended
  73. #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
  74. #pragma clang diagnostic push
  75. #pragma clang diagnostic ignored "-Wc11-extensions"
  76. #pragma clang diagnostic ignored "-Wreserved-id-macro"
  77. #elif defined (__GNUC__)
  78. /* anonymous unions are enabled by default */
  79. #elif defined (__TMS470__)
  80. /* anonymous unions are enabled by default */
  81. #elif defined (__TASKING__)
  82. #pragma warning 586
  83. #elif defined (__CSMC__)
  84. /* anonymous unions are enabled by default */
  85. #else
  86. #warning Not supported compiler type
  87. #endif
  88. /* -------- Configuration of the Cortex-M0+ Processor and Core Peripherals ------ */
  89. #define __CM0PLUS_REV 0x0000U /* Core revision r0p0 */
  90. #define __MPU_PRESENT 0U /* MPU present or not */
  91. #define __VTOR_PRESENT 0U /* VTOR present or not */
  92. #define __NVIC_PRIO_BITS 2U /* Number of Bits used for Priority Levels */
  93. #define __Vendor_SysTickConfig 0U /* Set to 1 if different SysTick Config is used */
  94. #include "core_cm0plus.h" /* Processor and core peripherals */
  95. #include "system_ARMCM0plus.h" /* System Header */
  96. /* ================================================================================ */
  97. /* ================ Device Specific Peripheral Section ================ */
  98. /* ================================================================================ */
  99. /* ================================================================================ */
  100. /* ================ CPU FPGA System (CPU_SYS) ================ */
  101. /* ================================================================================ */
  102. typedef struct
  103. {
  104. __IM uint32_t ID; /* Offset: 0x000 (R/ ) Board and FPGA Identifier */
  105. __IOM uint32_t MEMCFG; /* Offset: 0x004 (R/W) Remap and Alias Memory Control */
  106. __IM uint32_t SW; /* Offset: 0x008 (R/ ) Switch States */
  107. __IOM uint32_t LED; /* Offset: 0x00C (R/W) LED Output States */
  108. __IM uint32_t TS; /* Offset: 0x010 (R/ ) Touchscreen Register */
  109. __IOM uint32_t CTRL1; /* Offset: 0x014 (R/W) Misc Control Functions */
  110. uint32_t RESERVED0[2U];
  111. __IOM uint32_t CLKCFG; /* Offset: 0x020 (R/W) System Clock Configuration */
  112. __IOM uint32_t WSCFG; /* Offset: 0x024 (R/W) Flash Waitstate Configuration */
  113. __IOM uint32_t CPUCFG; /* Offset: 0x028 (R/W) Processor Configuration */
  114. uint32_t RESERVED1[3U];
  115. __IOM uint32_t BASE; /* Offset: 0x038 (R/W) ROM Table base Address */
  116. __IOM uint32_t ID2; /* Offset: 0x03C (R/W) Secondary Identification Register */
  117. } ARM_CPU_SYS_TypeDef;
  118. /* ================================================================================ */
  119. /* ================ DUT FPGA System (DUT_SYS) ================ */
  120. /* ================================================================================ */
  121. typedef struct
  122. {
  123. __IM uint32_t ID; /* Offset: 0x000 (R/ ) Board and FPGA Identifier */
  124. __IOM uint32_t PERCFG; /* Offset: 0x004 (R/W) Peripheral Control Signals */
  125. __IM uint32_t SW; /* Offset: 0x008 (R/ ) Switch States */
  126. __IOM uint32_t LED; /* Offset: 0x00C (R/W) LED Output States */
  127. __IOM uint32_t SEG7; /* Offset: 0x010 (R/W) 7-segment LED Output States */
  128. __IM uint32_t CNT25MHz; /* Offset: 0x014 (R/ ) Freerunning counter incrementing at 25MHz */
  129. __IM uint32_t CNT100Hz; /* Offset: 0x018 (R/ ) Freerunning counter incrementing at 100Hz */
  130. } ARM_DUT_SYS_TypeDef;
  131. /* ================================================================================ */
  132. /* ================ Timer (TIM) ================ */
  133. /* ================================================================================ */
  134. typedef struct
  135. {
  136. __IOM uint32_t Timer1Load; /* Offset: 0x000 (R/W) Timer 1 Load */
  137. __IM uint32_t Timer1Value; /* Offset: 0x004 (R/ ) Timer 1 Counter Current Value */
  138. __IOM uint32_t Timer1Control; /* Offset: 0x008 (R/W) Timer 1 Control */
  139. __OM uint32_t Timer1IntClr; /* Offset: 0x00C ( /W) Timer 1 Interrupt Clear */
  140. __IM uint32_t Timer1RIS; /* Offset: 0x010 (R/ ) Timer 1 Raw Interrupt Status */
  141. __IM uint32_t Timer1MIS; /* Offset: 0x014 (R/ ) Timer 1 Masked Interrupt Status */
  142. __IOM uint32_t Timer1BGLoad; /* Offset: 0x018 (R/W) Background Load Register */
  143. uint32_t RESERVED0[1U];
  144. __IOM uint32_t Timer2Load; /* Offset: 0x020 (R/W) Timer 2 Load */
  145. __IM uint32_t Timer2Value; /* Offset: 0x024 (R/ ) Timer 2 Counter Current Value */
  146. __IOM uint32_t Timer2Control; /* Offset: 0x028 (R/W) Timer 2 Control */
  147. __OM uint32_t Timer2IntClr; /* Offset: 0x02C ( /W) Timer 2 Interrupt Clear */
  148. __IM uint32_t Timer2RIS; /* Offset: 0x030 (R/ ) Timer 2 Raw Interrupt Status */
  149. __IM uint32_t Timer2MIS; /* Offset: 0x034 (R/ ) Timer 2 Masked Interrupt Status */
  150. __IOM uint32_t Timer2BGLoad; /* Offset: 0x038 (R/W) Background Load Register */
  151. } ARM_TIM_TypeDef;
  152. /* ================================================================================ */
  153. /* ============== Universal Asyncronous Receiver / Transmitter (UART) ============= */
  154. /* ================================================================================ */
  155. typedef struct
  156. {
  157. __IOM uint32_t DR; /* Offset: 0x000 (R/W) Data */
  158. union {
  159. __IM uint32_t RSR; /* Offset: 0x000 (R/ ) Receive Status */
  160. __OM uint32_t ECR; /* Offset: 0x000 ( /W) Error Clear */
  161. };
  162. uint32_t RESERVED0[4U];
  163. __IOM uint32_t FR; /* Offset: 0x018 (R/W) Flags */
  164. uint32_t RESERVED1[1U];
  165. __IOM uint32_t ILPR; /* Offset: 0x020 (R/W) IrDA Low-power Counter */
  166. __IOM uint32_t IBRD; /* Offset: 0x024 (R/W) Interger Baud Rate */
  167. __IOM uint32_t FBRD; /* Offset: 0x028 (R/W) Fractional Baud Rate */
  168. __IOM uint32_t LCR_H; /* Offset: 0x02C (R/W) Line Control */
  169. __IOM uint32_t CR; /* Offset: 0x030 (R/W) Control */
  170. __IOM uint32_t IFLS; /* Offset: 0x034 (R/W) Interrupt FIFO Level Select */
  171. __IOM uint32_t IMSC; /* Offset: 0x038 (R/W) Interrupt Mask Set / Clear */
  172. __IOM uint32_t RIS; /* Offset: 0x03C (R/W) Raw Interrupt Status */
  173. __IOM uint32_t MIS; /* Offset: 0x040 (R/W) Masked Interrupt Status */
  174. __OM uint32_t ICR; /* Offset: 0x044 ( /W) Interrupt Clear */
  175. __IOM uint32_t DMACR; /* Offset: 0x048 (R/W) DMA Control */
  176. } ARM_UART_TypeDef;
  177. /* -------- End of section using anonymous unions and disabling warnings -------- */
  178. #if defined (__CC_ARM)
  179. #pragma pop
  180. #elif defined (__ICCARM__)
  181. /* leave anonymous unions enabled */
  182. #elif (__ARMCC_VERSION >= 6010050)
  183. #pragma clang diagnostic pop
  184. #elif defined (__GNUC__)
  185. /* anonymous unions are enabled by default */
  186. #elif defined (__TMS470__)
  187. /* anonymous unions are enabled by default */
  188. #elif defined (__TASKING__)
  189. #pragma warning restore
  190. #elif defined (__CSMC__)
  191. /* anonymous unions are enabled by default */
  192. #else
  193. #warning Not supported compiler type
  194. #endif
  195. /* ================================================================================ */
  196. /* ================ Peripheral memory map ================ */
  197. /* ================================================================================ */
  198. /* -------------------------- CPU FPGA memory map ------------------------------- */
  199. #define ARM_FLASH_BASE (0x00000000UL)
  200. #define ARM_RAM_BASE (0x20000000UL)
  201. #define ARM_RAM_FPGA_BASE (0x1EFF0000UL)
  202. #define ARM_CPU_CFG_BASE (0xDFFF0000UL)
  203. #define ARM_CPU_SYS_BASE (ARM_CPU_CFG_BASE + 0x00000UL)
  204. #define ARM_UART3_BASE (ARM_CPU_CFG_BASE + 0x05000UL)
  205. /* -------------------------- DUT FPGA memory map ------------------------------- */
  206. #define ARM_APB_BASE (0x40000000UL)
  207. #define ARM_AHB_BASE (0x4FF00000UL)
  208. #define ARM_DMC_BASE (0x60000000UL)
  209. #define ARM_SMC_BASE (0xA0000000UL)
  210. #define ARM_TIM0_BASE (ARM_APB_BASE + 0x02000UL)
  211. #define ARM_TIM2_BASE (ARM_APB_BASE + 0x03000UL)
  212. #define ARM_DUT_SYS_BASE (ARM_APB_BASE + 0x04000UL)
  213. #define ARM_UART0_BASE (ARM_APB_BASE + 0x06000UL)
  214. #define ARM_UART1_BASE (ARM_APB_BASE + 0x07000UL)
  215. #define ARM_UART2_BASE (ARM_APB_BASE + 0x08000UL)
  216. #define ARM_UART4_BASE (ARM_APB_BASE + 0x09000UL)
  217. /* ================================================================================ */
  218. /* ================ Peripheral declaration ================ */
  219. /* ================================================================================ */
  220. /* -------------------------- CPU FPGA Peripherals ------------------------------ */
  221. #define ARM_CPU_SYS ((ARM_CPU_SYS_TypeDef *) ARM_CPU_SYS_BASE)
  222. #define ARM_UART3 (( ARM_UART_TypeDef *) ARM_UART3_BASE)
  223. /* -------------------------- DUT FPGA Peripherals ------------------------------ */
  224. #define ARM_DUT_SYS ((ARM_DUT_SYS_TypeDef *) ARM_DUT_SYS_BASE)
  225. #define ARM_TIM0 (( ARM_TIM_TypeDef *) ARM_TIM0_BASE)
  226. #define ARM_TIM2 (( ARM_TIM_TypeDef *) ARM_TIM2_BASE)
  227. #define ARM_UART0 (( ARM_UART_TypeDef *) ARM_UART0_BASE)
  228. #define ARM_UART1 (( ARM_UART_TypeDef *) ARM_UART1_BASE)
  229. #define ARM_UART2 (( ARM_UART_TypeDef *) ARM_UART2_BASE)
  230. #define ARM_UART4 (( ARM_UART_TypeDef *) ARM_UART4_BASE)
  231. #ifdef __cplusplus
  232. }
  233. #endif
  234. #endif /* ARMCM0plus_H */