hc32_ll.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. /**
  2. *******************************************************************************
  3. * @file hc32_ll.h
  4. * @brief This file contains HC32 Series Device Driver Library file call
  5. * management.
  6. @verbatim
  7. Change Logs:
  8. Date Author Notes
  9. 2022-12-31 CDT First version
  10. @endverbatim
  11. *******************************************************************************
  12. * Copyright (C) 2022, Xiaohua Semiconductor Co., Ltd. All rights reserved.
  13. *
  14. * This software component is licensed by XHSC under BSD 3-Clause license
  15. * (the "License"); You may not use this file except in compliance with the
  16. * License. You may obtain a copy of the License at:
  17. * opensource.org/licenses/BSD-3-Clause
  18. *
  19. *******************************************************************************
  20. */
  21. #ifndef __HC32_LL_H__
  22. #define __HC32_LL_H__
  23. /* C binding of definitions if building with C++ compiler */
  24. #ifdef __cplusplus
  25. extern "C"
  26. {
  27. #endif
  28. /*******************************************************************************
  29. * Include files
  30. ******************************************************************************/
  31. #include "hc32_ll_def.h"
  32. #include "hc32f4xx.h"
  33. #include "hc32f4xx_conf.h"
  34. /**********************new add at2023.4.4**************************************/
  35. #include "hc32_ll_utility.h"
  36. #include "hc32_ll_pwc.h"
  37. #include "hc32_ll_efm.h"
  38. #include "hc32_ll_gpio.h"
  39. #include "hc32_ll_sram.h"
  40. #define PWC_UNLOCK_CODE0 (0xA501U)
  41. #define PWC_UNLOCK_CODE1 (0xA502U)
  42. #define PWC_UNLOCK_CODE2 (0xA508U)
  43. /**
  44. * @addtogroup LL_Driver
  45. * @{
  46. */
  47. /**
  48. * @addtogroup LL_Global
  49. * @{
  50. */
  51. /*******************************************************************************
  52. * Global type definitions ('typedef')
  53. ******************************************************************************/
  54. /*******************************************************************************
  55. * Global pre-processor symbols/macros ('#define')
  56. ******************************************************************************/
  57. /**
  58. * @defgroup LL_Global_Macros LL Global Macros
  59. * @{
  60. */
  61. /**
  62. * @defgroup Peripheral_Register_WP_Global_Macros Peripheral Register Write Protection Global Macros
  63. * @{
  64. */
  65. #define LL_PERIPH_EFM (1UL << 0U)
  66. #define LL_PERIPH_FCG (1UL << 1U)
  67. #define LL_PERIPH_GPIO (1UL << 2U)
  68. #define LL_PERIPH_INTC (1UL << 3U)
  69. #define LL_PERIPH_LVD (1UL << 4U)
  70. #define LL_PERIPH_MPU (1UL << 5U)
  71. #define LL_PERIPH_PWC_CLK_RMU (1UL << 6U)
  72. #define LL_PERIPH_SRAM (1UL << 7U)
  73. #define LL_PERIPH_ALL (LL_PERIPH_EFM | LL_PERIPH_FCG | LL_PERIPH_GPIO | LL_PERIPH_INTC | \
  74. LL_PERIPH_LVD | LL_PERIPH_MPU | LL_PERIPH_SRAM | LL_PERIPH_PWC_CLK_RMU)
  75. /**
  76. * @}
  77. */
  78. /**
  79. * @defgroup Timer_SW_Sync_Start_Global_Macros Timer Software Sync Start Global Macros
  80. * @{
  81. */
  82. #define LL_SW_SYNC_START_TMR0_1_CH_A PERIC_TMR_SYNENR_TMR0U1A
  83. #define LL_SW_SYNC_START_TMR0_1_CH_B PERIC_TMR_SYNENR_TMR0U1B
  84. #define LL_SW_SYNC_START_TMR0_2_CH_A PERIC_TMR_SYNENR_TMR0U2A
  85. #define LL_SW_SYNC_START_TMR0_2_CH_B PERIC_TMR_SYNENR_TMR0U2B
  86. #define LL_SW_SYNC_START_TMR4_1 PERIC_TMR_SYNENR_TMR4U1
  87. #define LL_SW_SYNC_START_TMR4_2 PERIC_TMR_SYNENR_TMR4U2
  88. #define LL_SW_SYNC_START_TMR4_3 PERIC_TMR_SYNENR_TMR4U3
  89. #define LL_SW_SYNC_START_TMR6_1 PERIC_TMR_SYNENR_TMR6U1
  90. #define LL_SW_SYNC_START_TMR6_2 PERIC_TMR_SYNENR_TMR6U2
  91. #define LL_SW_SYNC_START_TMRA_1 PERIC_TMR_SYNENR_TMRAU1
  92. #define LL_SW_SYNC_START_TMRA_2 PERIC_TMR_SYNENR_TMRAU2
  93. #define LL_SW_SYNC_START_TMRA_3 PERIC_TMR_SYNENR_TMRAU3
  94. #define LL_SW_SYNC_START_TMRA_4 PERIC_TMR_SYNENR_TMRAU4
  95. #define LL_SW_SYNC_START_TMRA_5 PERIC_TMR_SYNENR_TMRAU5
  96. #define LL_SW_SYNC_START_TMR_ALL (LL_SW_SYNC_START_TMR0_1_CH_A | LL_SW_SYNC_START_TMR0_1_CH_B | \
  97. LL_SW_SYNC_START_TMR0_2_CH_A | LL_SW_SYNC_START_TMR0_2_CH_B | \
  98. LL_SW_SYNC_START_TMR4_1 | LL_SW_SYNC_START_TMR4_2 | \
  99. LL_SW_SYNC_START_TMR4_3 | LL_SW_SYNC_START_TMR6_1 | \
  100. LL_SW_SYNC_START_TMR6_2 | LL_SW_SYNC_START_TMRA_1 | \
  101. LL_SW_SYNC_START_TMRA_2 | LL_SW_SYNC_START_TMRA_3 | \
  102. LL_SW_SYNC_START_TMRA_4 | LL_SW_SYNC_START_TMRA_5)
  103. /**
  104. * @}
  105. */
  106. /* Defined use Device Driver Library */
  107. #if !defined (USE_DDL_DRIVER)
  108. /**
  109. * @brief Comment the line below if you will not use the Device Driver Library.
  110. * In this case, the application code will be based on direct access to
  111. * peripherals registers.
  112. */
  113. /* #define USE_DDL_DRIVER */
  114. #endif /* USE_DDL_DRIVER */
  115. /**
  116. * @defgroup HC32_Series_DDL_Version HC32 Series Device Driver Library Version
  117. * @{
  118. */
  119. #define HC32_DDL_VER_MAIN 0x01U /*!< [31:24] main version */
  120. #define HC32_DDL_VER_SUB1 0x03U /*!< [23:16] sub1 version */
  121. #define HC32_DDL_VER_SUB2 0x00U /*!< [15:8] sub2 version */
  122. #define HC32_DDL_VER_PATCH 0x00U /*!< [7:0] patch version */
  123. #define HC32_DDL_VER ((HC32_DDL_VER_MAIN << 24) | (HC32_DDL_VER_SUB1 << 16) | \
  124. (HC32_DDL_VER_SUB2 << 8 ) | (HC32_DDL_VER_PATCH))
  125. /**
  126. * @}
  127. */
  128. /**
  129. * @defgroup HC32_Series_DDL_Release_Version HC32 Series DDL Release Version
  130. * @{
  131. */
  132. #define HC32_DDL_REV_MAIN 0x01U /*!< [31:24] main version */
  133. #define HC32_DDL_REV_SUB1 0x00U /*!< [23:16] sub1 version */
  134. #define HC32_DDL_REV_SUB2 0x00U /*!< [15:8] sub2 version */
  135. #define HC32_DDL_REV_PATCH 0x00U /*!< [7:0] patch version */
  136. #define HC32_DDL_REV ((HC32_DDL_REV_MAIN << 24) | (HC32_DDL_REV_SUB1 << 16) | \
  137. (HC32_DDL_REV_SUB2 << 8 ) | (HC32_DDL_REV_PATCH))
  138. /**
  139. * @}
  140. */
  141. /**
  142. * @}
  143. */
  144. /* Use Device Driver Library */
  145. #if defined (USE_DDL_DRIVER)
  146. /**
  147. * @brief Include peripheral module's header file
  148. */
  149. #if (LL_ADC_ENABLE == DDL_ON)
  150. #include "hc32_ll_adc.h"
  151. #endif /* LL_ADC_ENABLE */
  152. #if (LL_AES_ENABLE == DDL_ON)
  153. #include "hc32_ll_aes.h"
  154. #endif /* LL_AES_ENABLE */
  155. #if (LL_AOS_ENABLE == DDL_ON)
  156. #include "hc32_ll_aos.h"
  157. #endif /* LL_AOS_ENABLE */
  158. #if (LL_CLK_ENABLE == DDL_ON)
  159. #include "hc32_ll_clk.h"
  160. #endif /* LL_CLK_ENABLE */
  161. #if (LL_CMP_ENABLE == DDL_ON)
  162. #include "hc32_ll_cmp.h"
  163. #endif /* LL_CMP_ENABLE */
  164. #if (LL_CRC_ENABLE == DDL_ON)
  165. #include "hc32_ll_crc.h"
  166. #endif /* LL_CRC_ENABLE */
  167. #if (LL_CTC_ENABLE == DDL_ON)
  168. #include "hc32_ll_ctc.h"
  169. #endif /* LL_CTC_ENABLE */
  170. #if (LL_DAC_ENABLE == DDL_ON)
  171. #include "hc32_ll_dac.h"
  172. #endif /* LL_DAC_ENABLE */
  173. #if (LL_DBGC_ENABLE == DDL_ON)
  174. #include "hc32_ll_dbgc.h"
  175. #endif /* LL_DBGC_ENABLE */
  176. #if (LL_DCU_ENABLE == DDL_ON)
  177. #include "hc32_ll_dcu.h"
  178. #endif /* LL_DCU_ENABLE */
  179. #if (LL_DMA_ENABLE == DDL_ON)
  180. #include "hc32_ll_dma.h"
  181. #endif /* LL_DMA_ENABLE */
  182. #if (LL_EFM_ENABLE == DDL_ON)
  183. #include "hc32_ll_efm.h"
  184. #endif /* LL_EFM_ENABLE */
  185. #if (LL_EMB_ENABLE == DDL_ON)
  186. #include "hc32_ll_emb.h"
  187. #endif /* LL_EMB_ENABLE */
  188. #if (LL_EVENT_PORT_ENABLE == DDL_ON)
  189. #include "hc32_ll_event_port.h"
  190. #endif /* LL_EVENT_PORT_ENABLE */
  191. #if (LL_FCG_ENABLE == DDL_ON)
  192. #include "hc32_ll_fcg.h"
  193. #endif /* LL_FCG_ENABLE */
  194. #if (LL_FCM_ENABLE == DDL_ON)
  195. #include "hc32_ll_fcm.h"
  196. #endif /* LL_FCM_ENABLE */
  197. #if (LL_GPIO_ENABLE == DDL_ON)
  198. #include "hc32_ll_gpio.h"
  199. #endif /* LL_GPIO_ENABLE */
  200. #if (LL_HASH_ENABLE == DDL_ON)
  201. #include "hc32_ll_hash.h"
  202. #endif /* LL_HASH_ENABLE */
  203. #if (LL_I2C_ENABLE == DDL_ON)
  204. #include "hc32_ll_i2c.h"
  205. #endif /* LL_I2C_ENABLE */
  206. #if (LL_ICG_ENABLE == DDL_ON)
  207. #include "hc32_ll_icg.h"
  208. #endif /* LL_ICG_ENABLE */
  209. #if (LL_INTERRUPTS_ENABLE == DDL_ON)
  210. #include "hc32_ll_interrupts.h"
  211. #endif /* LL_INTERRUPTS_ENABLE */
  212. #if (LL_KEYSCAN_ENABLE == DDL_ON)
  213. #include "hc32_ll_keyscan.h"
  214. #endif /* LL_KEYSCAN_ENABLE */
  215. #if (LL_MCAN_ENABLE == DDL_ON)
  216. #include "hc32_ll_mcan.h"
  217. #endif /* LL_MCAN_ENABLE */
  218. #if (LL_MPU_ENABLE == DDL_ON)
  219. #include "hc32_ll_mpu.h"
  220. #endif /* LL_MPU_ENABLE */
  221. #if (LL_PWC_ENABLE == DDL_ON)
  222. #include "hc32_ll_pwc.h"
  223. #endif /* LL_PWC_ENABLE */
  224. #if (LL_QSPI_ENABLE == DDL_ON)
  225. #include "hc32_ll_qspi.h"
  226. #endif /* LL_QSPI_ENABLE */
  227. #if (LL_RMU_ENABLE == DDL_ON)
  228. #include "hc32_ll_rmu.h"
  229. #endif /* LL_RMU_ENABLE */
  230. #if (LL_RTC_ENABLE == DDL_ON)
  231. #include "hc32_ll_rtc.h"
  232. #endif /* LL_RTC_ENABLE */
  233. #if (LL_SMC_ENABLE == DDL_ON)
  234. #include "hc32_ll_smc.h"
  235. #endif /* LL_SMC_ENABLE */
  236. #if (LL_SPI_ENABLE == DDL_ON)
  237. #include "hc32_ll_spi.h"
  238. #endif /* LL_SPI_ENABLE */
  239. #if (LL_SRAM_ENABLE == DDL_ON)
  240. #include "hc32_ll_sram.h"
  241. #endif /* LL_SRAM_ENABLE */
  242. #if (LL_SWDT_ENABLE == DDL_ON)
  243. #include "hc32_ll_swdt.h"
  244. #endif /* LL_SWDT_ENABLE */
  245. #if (LL_TMR0_ENABLE == DDL_ON)
  246. #include "hc32_ll_tmr0.h"
  247. #endif /* LL_TMR0_ENABLE */
  248. #if (LL_TMR4_ENABLE == DDL_ON)
  249. #include "hc32_ll_tmr4.h"
  250. #endif /* LL_TMR4_ENABLE */
  251. #if (LL_TMR6_ENABLE == DDL_ON)
  252. #include "hc32_ll_tmr6.h"
  253. #endif /* LL_TMR6_ENABLE */
  254. #if (LL_TMRA_ENABLE == DDL_ON)
  255. #include "hc32_ll_tmra.h"
  256. #endif /* LL_TMRA_ENABLE */
  257. #if (LL_TRNG_ENABLE == DDL_ON)
  258. #include "hc32_ll_trng.h"
  259. #endif /* LL_TRNG_ENABLE */
  260. #if (LL_USART_ENABLE == DDL_ON)
  261. #include "hc32_ll_usart.h"
  262. #endif /* LL_USART_ENABLE */
  263. #if (LL_UTILITY_ENABLE == DDL_ON)
  264. #include "hc32_ll_utility.h"
  265. #endif /* LL_UTILITY_ENABLE */
  266. #if (LL_WDT_ENABLE == DDL_ON)
  267. #include "hc32_ll_wdt.h"
  268. #endif /* LL_WDT_ENABLE */
  269. #endif /* USE_DDL_DRIVER */
  270. /*******************************************************************************
  271. * Global variable definitions ('extern')
  272. ******************************************************************************/
  273. /*******************************************************************************
  274. * Global function prototypes (definition in C source)
  275. ******************************************************************************/
  276. /**
  277. * @addtogroup LL_Global_Functions
  278. * @{
  279. */
  280. void LL_PERIPH_WE(uint32_t u32Peripheral);
  281. void LL_PERIPH_WP(uint32_t u32Peripheral);
  282. void LL_TMR_SWSyncStart(uint32_t u32Tmr);
  283. /**
  284. * @}
  285. */
  286. /**
  287. * @}
  288. */
  289. /**
  290. * @}
  291. */
  292. #ifdef __cplusplus
  293. }
  294. #endif
  295. #endif /* __HC32_DDL_H__ */
  296. /*******************************************************************************
  297. * EOF (not truncated)
  298. ******************************************************************************/