gd32f30x.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. /*!
  2. \file gd32f30x.h
  3. \brief general definitions for GD32F30x
  4. \version 2017-02-10, V1.0.0, firmware for GD32F30x
  5. \version 2018-10-10, V1.1.0, firmware for GD32F30x
  6. \version 2018-12-25, V2.0.0, firmware for GD32F30x
  7. */
  8. /*
  9. Copyright (c) 2018, GigaDevice Semiconductor Inc.
  10. All rights reserved.
  11. Redistribution and use in source and binary forms, with or without modification,
  12. are permitted provided that the following conditions are met:
  13. 1. Redistributions of source code must retain the above copyright notice, this
  14. list of conditions and the following disclaimer.
  15. 2. Redistributions in binary form must reproduce the above copyright notice,
  16. this list of conditions and the following disclaimer in the documentation
  17. and/or other materials provided with the distribution.
  18. 3. Neither the name of the copyright holder nor the names of its contributors
  19. may be used to endorse or promote products derived from this software without
  20. specific prior written permission.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  22. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  23. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  24. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  25. INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  26. NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  27. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  28. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  29. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  30. OF SUCH DAMAGE.
  31. */
  32. #ifndef GD32F30X_H
  33. #define GD32F30X_H
  34. #ifdef cplusplus
  35. extern "C" {
  36. #endif
  37. /* define GD32F30x */
  38. #if !defined (GD32F30X_HD) && !defined (GD32F30X_XD) && !defined (GD32F30X_CL)
  39. /* #define GD32F30X_HD */
  40. /* #define GD32F30X_XD */
  41. /* #define GD32F30X_CL */
  42. #endif /* define GD32F30x */
  43. #if !defined (GD32F30X_HD) && !defined (GD32F30X_XD) && !defined (GD32F30X_CL)
  44. #error "Please select the target GD32F30x device in gd32f30x.h file"
  45. #endif /* undefine GD32F30x tip */
  46. /* define value of high speed crystal oscillator (HXTAL) in Hz */
  47. #if !defined HXTAL_VALUE
  48. #ifdef GD32F30X_CL
  49. #define HXTAL_VALUE ((uint32_t)25000000) /*!< value of the external oscillator in Hz */
  50. #else
  51. #define HXTAL_VALUE ((uint32_t)8000000) /* !< from 4M to 16M *!< value of the external oscillator in Hz*/
  52. #endif /* HXTAL_VALUE */
  53. #endif /* high speed crystal oscillator value */
  54. /* define startup timeout value of high speed crystal oscillator (HXTAL) */
  55. #if !defined (HXTAL_STARTUP_TIMEOUT)
  56. #define HXTAL_STARTUP_TIMEOUT ((uint16_t)0x0800)
  57. #endif /* high speed crystal oscillator startup timeout */
  58. /* define value of internal 48MHz RC oscillator (IRC48M) in Hz */
  59. #if !defined (IRC48M_VALUE)
  60. #define IRC48M_VALUE ((uint32_t)48000000)
  61. #endif /* internal 48MHz RC oscillator value */
  62. /* define value of internal 8MHz RC oscillator (IRC8M) in Hz */
  63. #if !defined (IRC8M_VALUE)
  64. #define IRC8M_VALUE ((uint32_t)8000000)
  65. #endif /* internal 8MHz RC oscillator value */
  66. /* define startup timeout value of internal 8MHz RC oscillator (IRC8M) */
  67. #if !defined (IRC8M_STARTUP_TIMEOUT)
  68. #define IRC8M_STARTUP_TIMEOUT ((uint16_t)0x0500)
  69. #endif /* internal 8MHz RC oscillator startup timeout */
  70. /* define value of internal 40KHz RC oscillator(IRC40K) in Hz */
  71. #if !defined (IRC40K_VALUE)
  72. #define IRC40K_VALUE ((uint32_t)40000)
  73. #endif /* internal 40KHz RC oscillator value */
  74. /* define value of low speed crystal oscillator (LXTAL)in Hz */
  75. #if !defined (LXTAL_VALUE)
  76. #define LXTAL_VALUE ((uint32_t)32768)
  77. #endif /* low speed crystal oscillator value */
  78. /* GD32F30x firmware library version number V1.0 */
  79. #define __GD32F30x_STDPERIPH_VERSION_MAIN (0x01) /*!< [31:24] main version */
  80. #define __GD32F30x_STDPERIPH_VERSION_SUB1 (0x00) /*!< [23:16] sub1 version */
  81. #define __GD32F30x_STDPERIPH_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
  82. #define __GD32F30x_STDPERIPH_VERSION_RC (0x00) /*!< [7:0] release candidate */
  83. #define __GD32F30x_STDPERIPH_VERSION ((__GD32F30x_STDPERIPH_VERSION_MAIN << 24)\
  84. |(__GD32F30x_STDPERIPH_VERSION_SUB1 << 16)\
  85. |(__GD32F30x_STDPERIPH_VERSION_SUB2 << 8)\
  86. |(__GD32F30x_STDPERIPH_VERSION_RC))
  87. /* configuration of the Cortex-M4 processor and core peripherals */
  88. #define __CM4_REV 0x0001 /*!< Core revision r0p1 */
  89. #define __MPU_PRESENT 1 /*!< GD32F30x do not provide MPU */
  90. #define __NVIC_PRIO_BITS 4 /*!< GD32F30x uses 4 bits for the priority levels */
  91. #define __Vendor_SysTickConfig 0 /*!< set to 1 if different sysTick config is used */
  92. /* define interrupt number */
  93. typedef enum IRQn
  94. {
  95. /* Cortex-M4 processor exceptions numbers */
  96. NonMaskableInt_IRQn = -14, /*!< 2 non maskable interrupt */
  97. MemoryManagement_IRQn = -12, /*!< 4 Cortex-M4 memory management interrupt */
  98. BusFault_IRQn = -11, /*!< 5 Cortex-M4 bus fault interrupt */
  99. UsageFault_IRQn = -10, /*!< 6 Cortex-M4 usage fault interrupt */
  100. SVCall_IRQn = -5, /*!< 11 Cortex-M4 SV call interrupt */
  101. DebugMonitor_IRQn = -4, /*!< 12 Cortex-M4 debug monitor interrupt */
  102. PendSV_IRQn = -2, /*!< 14 Cortex-M4 pend SV interrupt */
  103. SysTick_IRQn = -1, /*!< 15 Cortex-M4 system tick interrupt */
  104. /* interruput numbers */
  105. WWDGT_IRQn = 0, /*!< window watchDog timer interrupt */
  106. LVD_IRQn = 1, /*!< LVD through EXTI line detect interrupt */
  107. TAMPER_IRQn = 2, /*!< tamper through EXTI line detect */
  108. RTC_IRQn = 3, /*!< RTC through EXTI line interrupt */
  109. FMC_IRQn = 4, /*!< FMC interrupt */
  110. RCU_CTC_IRQn = 5, /*!< RCU and CTC interrupt */
  111. EXTI0_IRQn = 6, /*!< EXTI line 0 interrupts */
  112. EXTI1_IRQn = 7, /*!< EXTI line 1 interrupts */
  113. EXTI2_IRQn = 8, /*!< EXTI line 2 interrupts */
  114. EXTI3_IRQn = 9, /*!< EXTI line 3 interrupts */
  115. EXTI4_IRQn = 10, /*!< EXTI line 4 interrupts */
  116. DMA0_Channel0_IRQn = 11, /*!< DMA0 channel0 interrupt */
  117. DMA0_Channel1_IRQn = 12, /*!< DMA0 channel1 interrupt */
  118. DMA0_Channel2_IRQn = 13, /*!< DMA0 channel2 interrupt */
  119. DMA0_Channel3_IRQn = 14, /*!< DMA0 channel3 interrupt */
  120. DMA0_Channel4_IRQn = 15, /*!< DMA0 channel4 interrupt */
  121. DMA0_Channel5_IRQn = 16, /*!< DMA0 channel5 interrupt */
  122. DMA0_Channel6_IRQn = 17, /*!< DMA0 channel6 interrupt */
  123. ADC0_1_IRQn = 18, /*!< ADC0 and ADC1 interrupt */
  124. #ifdef GD32F30X_HD
  125. USBD_HP_CAN0_TX_IRQn = 19, /*!< CAN0 TX interrupts */
  126. USBD_LP_CAN0_RX0_IRQn = 20, /*!< CAN0 RX0 interrupts */
  127. CAN0_RX1_IRQn = 21, /*!< CAN0 RX1 interrupts */
  128. CAN0_EWMC_IRQn = 22, /*!< CAN0 EWMC interrupts */
  129. EXTI5_9_IRQn = 23, /*!< EXTI[9:5] interrupts */
  130. TIMER0_BRK_IRQn = 24, /*!< TIMER0 break interrupts */
  131. TIMER0_UP_IRQn = 25, /*!< TIMER0 update interrupts */
  132. TIMER0_TRG_CMT_IRQn = 26, /*!< TIMER0 trigger and commutation interrupts */
  133. TIMER0_Channel_IRQn = 27, /*!< TIMER0 channel capture compare interrupts */
  134. TIMER1_IRQn = 28, /*!< TIMER1 interrupt */
  135. TIMER2_IRQn = 29, /*!< TIMER2 interrupt */
  136. TIMER3_IRQn = 30, /*!< TIMER3 interrupts */
  137. I2C0_EV_IRQn = 31, /*!< I2C0 event interrupt */
  138. I2C0_ER_IRQn = 32, /*!< I2C0 error interrupt */
  139. I2C1_EV_IRQn = 33, /*!< I2C1 event interrupt */
  140. I2C1_ER_IRQn = 34, /*!< I2C1 error interrupt */
  141. SPI0_IRQn = 35, /*!< SPI0 interrupt */
  142. SPI1_IRQn = 36, /*!< SPI1 interrupt */
  143. USART0_IRQn = 37, /*!< USART0 interrupt */
  144. USART1_IRQn = 38, /*!< USART1 interrupt */
  145. USART2_IRQn = 39, /*!< USART2 interrupt */
  146. EXTI10_15_IRQn = 40, /*!< EXTI[15:10] interrupts */
  147. RTC_Alarm_IRQn = 41, /*!< RTC alarm interrupt */
  148. USBD_WKUP_IRQn = 42, /*!< USBD Wakeup interrupt */
  149. TIMER7_BRK_IRQn = 43, /*!< TIMER7 break interrupts */
  150. TIMER7_UP_IRQn = 44, /*!< TIMER7 update interrupts */
  151. TIMER7_TRG_CMT_IRQn = 45, /*!< TIMER7 trigger and commutation interrupts */
  152. TIMER7_Channel_IRQn = 46, /*!< TIMER7 channel capture compare interrupts */
  153. ADC2_IRQn = 47, /*!< ADC2 global interrupt */
  154. EXMC_IRQn = 48, /*!< EXMC global interrupt */
  155. SDIO_IRQn = 49, /*!< SDIO global interrupt */
  156. TIMER4_IRQn = 50, /*!< TIMER4 global interrupt */
  157. SPI2_IRQn = 51, /*!< SPI2 global interrupt */
  158. UART3_IRQn = 52, /*!< UART3 global interrupt */
  159. UART4_IRQn = 53, /*!< UART4 global interrupt */
  160. TIMER5_IRQn = 54, /*!< TIMER5 global interrupt */
  161. TIMER6_IRQn = 55, /*!< TIMER6 global interrupt */
  162. DMA1_Channel0_IRQn = 56, /*!< DMA1 channel0 global interrupt */
  163. DMA1_Channel1_IRQn = 57, /*!< DMA1 channel1 global interrupt */
  164. DMA1_Channel2_IRQn = 58, /*!< DMA1 channel2 global interrupt */
  165. DMA1_Channel3_Channel4_IRQn = 59, /*!< DMA1 channel3 and channel4 global Interrupt */
  166. #endif /* GD32F30X_HD */
  167. #ifdef GD32F30X_XD
  168. USBD_HP_CAN0_TX_IRQn = 19, /*!< CAN0 TX interrupts */
  169. USBD_LP_CAN0_RX0_IRQn = 20, /*!< CAN0 RX0 interrupts */
  170. CAN0_RX1_IRQn = 21, /*!< CAN0 RX1 interrupts */
  171. CAN0_EWMC_IRQn = 22, /*!< CAN0 EWMC interrupts */
  172. EXTI5_9_IRQn = 23, /*!< EXTI[9:5] interrupts */
  173. TIMER0_BRK_TIMER8_IRQn = 24, /*!< TIMER0 break and TIMER8 interrupts */
  174. TIMER0_UP_TIMER9_IRQn = 25, /*!< TIMER0 update and TIMER9 interrupts */
  175. TIMER0_TRG_CMT_TIMER10_IRQn = 26, /*!< TIMER0 trigger and commutation and TIMER10 interrupts */
  176. TIMER0_Channel_IRQn = 27, /*!< TIMER0 channel capture compare interrupts */
  177. TIMER1_IRQn = 28, /*!< TIMER1 interrupt */
  178. TIMER2_IRQn = 29, /*!< TIMER2 interrupt */
  179. TIMER3_IRQn = 30, /*!< TIMER3 interrupts */
  180. I2C0_EV_IRQn = 31, /*!< I2C0 event interrupt */
  181. I2C0_ER_IRQn = 32, /*!< I2C0 error interrupt */
  182. I2C1_EV_IRQn = 33, /*!< I2C1 event interrupt */
  183. I2C1_ER_IRQn = 34, /*!< I2C1 error interrupt */
  184. SPI0_IRQn = 35, /*!< SPI0 interrupt */
  185. SPI1_IRQn = 36, /*!< SPI1 interrupt */
  186. USART0_IRQn = 37, /*!< USART0 interrupt */
  187. USART1_IRQn = 38, /*!< USART1 interrupt */
  188. USART2_IRQn = 39, /*!< USART2 interrupt */
  189. EXTI10_15_IRQn = 40, /*!< EXTI[15:10] interrupts */
  190. RTC_Alarm_IRQn = 41, /*!< RTC alarm interrupt */
  191. USBD_WKUP_IRQn = 42, /*!< USBD wakeup interrupt */
  192. TIMER7_BRK_TIMER11_IRQn = 43, /*!< TIMER7 break and TIMER11 interrupts */
  193. TIMER7_UP_TIMER12_IRQn = 44, /*!< TIMER7 update and TIMER12 interrupts */
  194. TIMER7_TRG_CMT_TIMER13_IRQn = 45, /*!< TIMER7 trigger and commutation and TIMER13 interrupts */
  195. TIMER7_Channel_IRQn = 46, /*!< TIMER7 channel capture compare interrupts */
  196. ADC2_IRQn = 47, /*!< ADC2 global interrupt */
  197. EXMC_IRQn = 48, /*!< EXMC global interrupt */
  198. SDIO_IRQn = 49, /*!< SDIO global interrupt */
  199. TIMER4_IRQn = 50, /*!< TIMER4 global interrupt */
  200. SPI2_IRQn = 51, /*!< SPI2 global interrupt */
  201. UART3_IRQn = 52, /*!< UART3 global interrupt */
  202. UART4_IRQn = 53, /*!< UART4 global interrupt */
  203. TIMER5_IRQn = 54, /*!< TIMER5 global interrupt */
  204. TIMER6_IRQn = 55, /*!< TIMER6 global interrupt */
  205. DMA1_Channel0_IRQn = 56, /*!< DMA1 channel0 global interrupt */
  206. DMA1_Channel1_IRQn = 57, /*!< DMA1 channel1 global interrupt */
  207. DMA1_Channel2_IRQn = 58, /*!< DMA1 channel2 global interrupt */
  208. DMA1_Channel3_Channel4_IRQn = 59, /*!< DMA1 channel3 and channel4 global interrupt */
  209. #endif /* GD32F30X_XD */
  210. #ifdef GD32F30X_CL
  211. CAN0_TX_IRQn = 19, /*!< CAN0 TX interrupts */
  212. CAN0_RX0_IRQn = 20, /*!< CAN0 RX0 interrupts */
  213. CAN0_RX1_IRQn = 21, /*!< CAN0 RX1 interrupts */
  214. CAN0_EWMC_IRQn = 22, /*!< CAN0 EWMC interrupts */
  215. EXTI5_9_IRQn = 23, /*!< EXTI[9:5] interrupts */
  216. TIMER0_BRK_TIMER8_IRQn = 24, /*!< TIMER0 break and TIMER8 interrupts */
  217. TIMER0_UP_TIMER9_IRQn = 25, /*!< TIMER0 update and TIMER9 interrupts */
  218. TIMER0_TRG_CMT_TIMER10_IRQn = 26, /*!< TIMER0 trigger and commutation and TIMER10 interrupts */
  219. TIMER0_Channel_IRQn = 27, /*!< TIMER0 channel capture compare interrupts */
  220. TIMER1_IRQn = 28, /*!< TIMER1 interrupt */
  221. TIMER2_IRQn = 29, /*!< TIMER2 interrupt */
  222. TIMER3_IRQn = 30, /*!< TIMER3 interrupts */
  223. I2C0_EV_IRQn = 31, /*!< I2C0 event interrupt */
  224. I2C0_ER_IRQn = 32, /*!< I2C0 error interrupt */
  225. I2C1_EV_IRQn = 33, /*!< I2C1 event interrupt */
  226. I2C1_ER_IRQn = 34, /*!< I2C1 error interrupt */
  227. SPI0_IRQn = 35, /*!< SPI0 interrupt */
  228. SPI1_IRQn = 36, /*!< SPI1 interrupt */
  229. USART0_IRQn = 37, /*!< USART0 interrupt */
  230. USART1_IRQn = 38, /*!< USART1 interrupt */
  231. USART2_IRQn = 39, /*!< USART2 interrupt */
  232. EXTI10_15_IRQn = 40, /*!< EXTI[15:10] interrupts */
  233. RTC_ALARM_IRQn = 41, /*!< RTC alarm interrupt */
  234. USBFS_WKUP_IRQn = 42, /*!< USBFS wakeup interrupt */
  235. TIMER7_BRK_TIMER11_IRQn = 43, /*!< TIMER7 break and TIMER11 interrupts */
  236. TIMER7_UP_TIMER12_IRQn = 44, /*!< TIMER7 update and TIMER12 interrupts */
  237. TIMER7_TRG_CMT_TIMER13_IRQn = 45, /*!< TIMER7 trigger and commutation and TIMER13 interrupts */
  238. TIMER7_Channel_IRQn = 46, /*!< TIMER7 channel capture compare interrupts */
  239. EXMC_IRQn = 48, /*!< EXMC global interrupt */
  240. TIMER4_IRQn = 50, /*!< TIMER4 global interrupt */
  241. SPI2_IRQn = 51, /*!< SPI2 global interrupt */
  242. UART3_IRQn = 52, /*!< UART3 global interrupt */
  243. UART4_IRQn = 53, /*!< UART4 global interrupt */
  244. TIMER5_IRQn = 54, /*!< TIMER5 global interrupt */
  245. TIMER6_IRQn = 55, /*!< TIMER6 global interrupt */
  246. DMA1_Channel0_IRQn = 56, /*!< DMA1 channel0 global interrupt */
  247. DMA1_Channel1_IRQn = 57, /*!< DMA1 channel1 global interrupt */
  248. DMA1_Channel2_IRQn = 58, /*!< DMA1 channel2 global interrupt */
  249. DMA1_Channel3_IRQn = 59, /*!< DMA1 channel3 global interrupt */
  250. DMA1_Channel4_IRQn = 60, /*!< DMA1 channel3 global interrupt */
  251. ENET_IRQn = 61, /*!< ENET global interrupt */
  252. ENET_WKUP_IRQn = 62, /*!< ENET Wakeup interrupt */
  253. CAN1_TX_IRQn = 63, /*!< CAN1 TX interrupt */
  254. CAN1_RX0_IRQn = 64, /*!< CAN1 RX0 interrupt */
  255. CAN1_RX1_IRQn = 65, /*!< CAN1 RX1 interrupt */
  256. CAN1_EWMC_IRQn = 66, /*!< CAN1 EWMC interrupt */
  257. USBFS_IRQn = 67, /*!< USBFS global interrupt */
  258. #endif /* GD32F30X_CL */
  259. } IRQn_Type;
  260. /* includes */
  261. #include "core_cm4.h"
  262. #include "system_gd32f30x.h"
  263. #include <stdint.h>
  264. /* enum definitions */
  265. typedef enum {DISABLE = 0, ENABLE = !DISABLE} EventStatus, ControlStatus;
  266. typedef enum {FALSE = 0, TRUE = !FALSE} bool;
  267. typedef enum {RESET = 0, SET = !RESET} FlagStatus;
  268. typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrStatus;
  269. /* bit operations */
  270. #define REG32(addr) (*(volatile uint32_t *)(uint32_t)(addr))
  271. #define REG16(addr) (*(volatile uint16_t *)(uint32_t)(addr))
  272. #define REG8(addr) (*(volatile uint8_t *)(uint32_t)(addr))
  273. #define BIT(x) ((uint32_t)((uint32_t)0x01U<<(x)))
  274. #define BITS(start, end) ((0xFFFFFFFFUL << (start)) & (0xFFFFFFFFUL >> (31U - (uint32_t)(end))))
  275. #define GET_BITS(regval, start, end) (((regval) & BITS((start),(end))) >> (start))
  276. /* main flash and SRAM memory map */
  277. #define FLASH_BASE ((uint32_t)0x08000000U) /*!< main FLASH base address */
  278. #define SRAM_BASE ((uint32_t)0x20000000U) /*!< SRAM0 base address */
  279. #define OB_BASE ((uint32_t)0x1FFFF800U) /*!< OB base address */
  280. #define DBG_BASE ((uint32_t)0xE0042000U) /*!< DBG base address */
  281. #define EXMC_BASE ((uint32_t)0xA0000000U) /*!< EXMC register base address */
  282. /* peripheral memory map */
  283. #define APB1_BUS_BASE ((uint32_t)0x40000000U) /*!< apb1 base address */
  284. #define APB2_BUS_BASE ((uint32_t)0x40010000U) /*!< apb2 base address */
  285. #define AHB1_BUS_BASE ((uint32_t)0x40018000U) /*!< ahb1 base address */
  286. #define AHB3_BUS_BASE ((uint32_t)0x60000000U) /*!< ahb3 base address */
  287. /* advanced peripheral bus 1 memory map */
  288. #define TIMER_BASE (APB1_BUS_BASE + 0x00000000U) /*!< TIMER base address */
  289. #define RTC_BASE (APB1_BUS_BASE + 0x00002800U) /*!< RTC base address */
  290. #define WWDGT_BASE (APB1_BUS_BASE + 0x00002C00U) /*!< WWDGT base address */
  291. #define FWDGT_BASE (APB1_BUS_BASE + 0x00003000U) /*!< FWDGT base address */
  292. #define SPI_BASE (APB1_BUS_BASE + 0x00003800U) /*!< SPI base address */
  293. #define USART_BASE (APB1_BUS_BASE + 0x00004400U) /*!< USART base address */
  294. #define I2C_BASE (APB1_BUS_BASE + 0x00005400U) /*!< I2C base address */
  295. #define USBD_BASE (APB1_BUS_BASE + 0x00005C00U) /*!< USBD base address */
  296. #define CAN_BASE (APB1_BUS_BASE + 0x00006400U) /*!< CAN base address */
  297. #define BKP_BASE (APB1_BUS_BASE + 0x00006C00U) /*!< BKP base address */
  298. #define PMU_BASE (APB1_BUS_BASE + 0x00007000U) /*!< PMU base address */
  299. #define DAC_BASE (APB1_BUS_BASE + 0x00007400U) /*!< DAC base address */
  300. #define CTC_BASE (APB1_BUS_BASE + 0x0000C800U) /*!< CTC base address */
  301. /* advanced peripheral bus 2 memory map */
  302. #define AFIO_BASE (APB2_BUS_BASE + 0x00000000U) /*!< AFIO base address */
  303. #define EXTI_BASE (APB2_BUS_BASE + 0x00000400U) /*!< EXTI base address */
  304. #define GPIO_BASE (APB2_BUS_BASE + 0x00000800U) /*!< GPIO base address */
  305. #define ADC_BASE (APB2_BUS_BASE + 0x00002400U) /*!< ADC base address */
  306. /* advanced high performance bus 1 memory map */
  307. #define SDIO_BASE (AHB1_BUS_BASE + 0x00000000U) /*!< SDIO base address */
  308. #define DMA_BASE (AHB1_BUS_BASE + 0x00008000U) /*!< DMA base address */
  309. #define RCU_BASE (AHB1_BUS_BASE + 0x00009000U) /*!< RCU base address */
  310. #define FMC_BASE (AHB1_BUS_BASE + 0x0000A000U) /*!< FMC base address */
  311. #define CRC_BASE (AHB1_BUS_BASE + 0x0000B000U) /*!< CRC base address */
  312. #define ENET_BASE (AHB1_BUS_BASE + 0x00010000U) /*!< ENET base address */
  313. #define USBFS_BASE (AHB1_BUS_BASE + 0x0FFE8000U) /*!< USBFS base address */
  314. /* define marco USE_STDPERIPH_DRIVER */
  315. #if !defined USE_STDPERIPH_DRIVER
  316. #define USE_STDPERIPH_DRIVER
  317. #endif
  318. #ifdef USE_STDPERIPH_DRIVER
  319. #include "gd32f30x_libopt.h"
  320. #endif /* USE_STDPERIPH_DRIVER */
  321. #ifdef cplusplus
  322. }
  323. #endif
  324. #endif