hc32f460_pwc.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. /*****************************************************************************
  2. * Copyright (C) 2020, Huada Semiconductor Co., Ltd. All rights reserved.
  3. *
  4. * This software component is licensed by HDSC under BSD 3-Clause license
  5. * (the "License"); You may not use this file except in compliance with the
  6. * License. You may obtain a copy of the License at:
  7. * opensource.org/licenses/BSD-3-Clause
  8. */
  9. /******************************************************************************/
  10. /** \file hc32f460_pwc.h
  11. **
  12. ** A detailed description is available at
  13. ** @link PwcGroup PWC description @endlink
  14. **
  15. ** - 2018-10-28 CDT First version for Device Driver Library of PWC.
  16. **
  17. ******************************************************************************/
  18. #ifndef __HC32F460_PWC_H__
  19. #define __HC32F460_PWC_H__
  20. /*******************************************************************************
  21. * Include files
  22. ******************************************************************************/
  23. #include "hc32_common.h"
  24. #include "ddl_config.h"
  25. #if (DDL_PWC_ENABLE == DDL_ON)
  26. /* C binding of definitions if building with C++ compiler */
  27. #ifdef __cplusplus
  28. extern "C"
  29. {
  30. #endif
  31. /**
  32. *******************************************************************************
  33. ** \defgroup PwcGroup Power Control(PWC)
  34. **
  35. ******************************************************************************/
  36. //@{
  37. /*******************************************************************************
  38. * Global type definitions ('typedef')
  39. ******************************************************************************/
  40. /**
  41. *******************************************************************************
  42. ** \brief The power down mode.
  43. **
  44. ******************************************************************************/
  45. typedef enum en_pwc_powerdown_md
  46. {
  47. PowerDownMd1 = 0u, ///< Power down mode 1.
  48. PowerDownMd2 = 1u, ///< Power down mode 2.
  49. PowerDownMd3 = 2u, ///< Power down mode 3.
  50. PowerDownMd4 = 3u, ///< Power down mode 4.
  51. }en_pwc_powerdown_md_t;
  52. /**
  53. *******************************************************************************
  54. ** \brief The IO retain status under power down mode.
  55. **
  56. ******************************************************************************/
  57. typedef enum en_pwc_iortn
  58. {
  59. IoPwrDownRetain = 0u, ///< Io keep under power down mode.
  60. IoPwrRstRetain = 1u, ///< Io keep after power reset.
  61. IoHighImp = 2u, ///< IO high impedance either power down or power reset.
  62. }en_pwc_iortn_t;
  63. /**
  64. *******************************************************************************
  65. ** \brief The driver ability while different speed mode enter stop mode.
  66. **
  67. ******************************************************************************/
  68. typedef enum en_pwc_stopdas
  69. {
  70. StopHighspeed = 0u, ///< The driver ability while high speed mode enter stop mode.
  71. StopUlowspeed = 3u, ///< The driver ability while ultra_low speed mode enter stop mode.
  72. }en_pwc_stopdas_t;
  73. /**
  74. *******************************************************************************
  75. ** \brief The dynamic power driver voltage select.
  76. **
  77. ******************************************************************************/
  78. typedef enum en_pwc_rundrvs
  79. {
  80. RunUHighspeed = 0u, ///< The ultra_high speed.
  81. RunUlowspeed = 2u, ///< The ultra_low speed.
  82. RunHighspeed = 3u, ///< The high speed.
  83. }en_pwc_rundrvs_t;
  84. /**
  85. *******************************************************************************
  86. ** \brief The dynamic power driver ability scaling.
  87. **
  88. ******************************************************************************/
  89. typedef enum en_pwc_drvability_sca
  90. {
  91. Ulowspeed = 8u, ///< The ultra_low speed.
  92. HighSpeed = 15u, ///< The high speed.
  93. }en_pwc_drvability_sca_t;
  94. /**
  95. *******************************************************************************
  96. ** \brief The power down wake up time select.
  97. **
  98. ******************************************************************************/
  99. typedef enum en_pwc_waketime_sel
  100. {
  101. Vcap01 = 0u, ///< Wake up while vcap capacitance 2*0.1uf.
  102. Vcap0047 = 1u, ///< Wake up while vcap capacitance 2*0.047uf.
  103. }en_pwc_waketime_sel_t;
  104. /**
  105. *******************************************************************************
  106. ** \brief The wait or not wait flash stable while stop mode awake.
  107. **
  108. ******************************************************************************/
  109. typedef enum en_pwc_stop_flash_sel
  110. {
  111. Wait = 0u, ///< wait flash stable.
  112. NotWait = 1u, ///< Not Wait flash stable.
  113. }en_pwc_stop_flash_sel_t;
  114. /**
  115. *******************************************************************************
  116. ** \brief The clk value while stop mode awake.
  117. **
  118. ******************************************************************************/
  119. typedef enum en_pwc_stop_clk_sel
  120. {
  121. ClkFix = 0u, ///< clock fix.
  122. ClkMrc = 1u, ///< clock source is MRC, only ram code.
  123. }en_pwc_stop_clk_sel_t;
  124. /**
  125. *******************************************************************************
  126. ** \brief The power down wake up event edge select.
  127. **
  128. ******************************************************************************/
  129. typedef enum en_pwc_edge_sel
  130. {
  131. EdgeFalling = 0u, ///< Falling edge.
  132. EdgeRising = 1u, ///< Rising edge.
  133. }en_pwc_edge_sel_t;
  134. /**
  135. *******************************************************************************
  136. ** \brief The voltage detect edge select.
  137. **
  138. ******************************************************************************/
  139. typedef enum en_pwc_pvdedge_sel
  140. {
  141. OverVcc = 0u, ///< PVD > VCC.
  142. BelowVcc = 1u, ///< PVD < VCC.
  143. }en_pwc_pvdedge_sel_t;
  144. /**
  145. *******************************************************************************
  146. ** \brief The flag of wake_up timer compare result.
  147. **
  148. ******************************************************************************/
  149. typedef enum en_pwc_wkover_flag
  150. {
  151. UnEqual = 0u, ///< Timer value unequal with the wake_up compare value whitch set.
  152. Equal = 1u, ///< Timer value equal with the wake_up compare value whitch set..
  153. }en_pwc_wkover_flag_t;
  154. /**
  155. *******************************************************************************
  156. ** \brief The RAM operating mode.
  157. **
  158. ******************************************************************************/
  159. typedef enum en_pwc_ram_op_md
  160. {
  161. HighSpeedMd = 0x8043, ///< Work at high speed.
  162. UlowSpeedMd = 0x9062, ///< Work at ultra low speed.
  163. }en_pwc_ram_op_md_t;
  164. /**
  165. *******************************************************************************
  166. ** \brief The wake up clock select.
  167. **
  168. ******************************************************************************/
  169. typedef enum en_pwc_wkclk_sel
  170. {
  171. Wk64hz = 0u, ///< 64Hz.
  172. WkXtal32 = 1u, ///< Xtal32.
  173. WkLrc = 2u, ///< Lrc.
  174. }en_pwc_wkclk_sel_t;
  175. /**
  176. *******************************************************************************
  177. ** \brief The pvd digital filtering sampling clock select.
  178. **
  179. ******************************************************************************/
  180. typedef enum en_pwc_pvdfiltclk_sel
  181. {
  182. PvdLrc025 = 0u, ///< 0.25 LRC cycle.
  183. PvdLrc05 = 1u, ///< 0.5 LRC cycle.
  184. PvdLrc1 = 2u, ///< LRC 1 div.
  185. PvdLrc2 = 3u, ///< LRC 2 div.
  186. }en_pwc_pvdfiltclk_sel_t;
  187. /**
  188. *******************************************************************************
  189. ** \brief The pvd2 level select.
  190. **
  191. ******************************************************************************/
  192. typedef enum en_pwc_pvd2level_sel
  193. {
  194. Pvd2Level0 = 0u, ///< 2.1V.while high_speed & ultra_low speed mode, 2.20V.while ultra_high speed mode.
  195. Pvd2Level1 = 1u, ///< 2.3V.while high_speed & ultra_low speed mode, 2.40V.while ultra_high speed mode.
  196. Pvd2Level2 = 2u, ///< 2.5V.while high_speed & ultra_low speed mode, 2.67V.while ultra_high speed mode.
  197. Pvd2Level3 = 3u, ///< 2.6V.while high_speed & ultra_low speed mode, 2.77V.while ultra_high speed mode.
  198. Pvd2Level4 = 4u, ///< 2.7V.while high_speed & ultra_low speed mode, 2.88V.while ultra_high speed mode.
  199. Pvd2Level5 = 5u, ///< 2.8V.while high_speed & ultra_low speed mode, 2.98V.while ultra_high speed mode.
  200. Pvd2Level6 = 6u, ///< 2.9V.while high_speed & ultra_low speed mode, 3.08V.while ultra_high speed mode.
  201. Pvd2Level7 = 7u, ///< 1.1V.while high_speed & ultra_low speed mode, 1.15V.while ultra_high speed mode.
  202. }en_pwc_pvd2level_sel_t;
  203. /**
  204. *******************************************************************************
  205. ** \brief The pvd1 level select.
  206. **
  207. ******************************************************************************/
  208. typedef enum en_pwc_pvd1level_sel
  209. {
  210. Pvd1Level0 = 0u, ///< 2.0V.while high_speed & ultra_low speed mode, 2.09V.while ultra_high speed mode.
  211. Pvd1Level1 = 1u, ///< 2.1V.while high_speed & ultra_low speed mode, 2.20V.while ultra_high speed mode.
  212. Pvd1Level2 = 2u, ///< 2.3V.while high_speed & ultra_low speed mode, 2.40V.while ultra_high speed mode.
  213. Pvd1Level3 = 3u, ///< 2.5V.while high_speed & ultra_low speed mode, 2.67V.while ultra_high speed mode.
  214. Pvd1Level4 = 4u, ///< 2.6V.while high_speed & ultra_low speed mode, 2.77V.while ultra_high speed mode.
  215. Pvd1Level5 = 5u, ///< 2.7V.while high_speed & ultra_low speed mode, 2.88V.while ultra_high speed mode.
  216. Pvd1Level6 = 6u, ///< 2.8V.while high_speed & ultra_low speed mode, 2.98V.while ultra_high speed mode.
  217. Pvd1Level7 = 7u, ///< 2.9V.while high_speed & ultra_low speed mode, 3.08V.while ultra_high speed mode.
  218. }en_pwc_pvd1level_sel_t;
  219. /**
  220. *******************************************************************************
  221. ** \brief The pvd interrupt select.
  222. **
  223. ******************************************************************************/
  224. typedef enum en_pwc_pvd_int_sel
  225. {
  226. NonMskInt = 0u, ///< Non-maskable Interrupt.
  227. MskInt = 1u, ///< Maskable Interrupt.
  228. }en_pwc_pvd_int_sel_t;
  229. /**
  230. *******************************************************************************
  231. ** \brief The handle of pvd mode.
  232. **
  233. ******************************************************************************/
  234. typedef enum en_pwc_pvd_md
  235. {
  236. PvdInt = 0u, ///< The handle of pvd is interrupt.
  237. PvdReset = 1u, ///< The handle of pvd is reset.
  238. }en_pwc_pvd_md_t;
  239. /**
  240. *******************************************************************************
  241. ** \brief The unit of pvd detect.
  242. **
  243. ******************************************************************************/
  244. typedef enum en_pwc_pvd
  245. {
  246. PvdU1 = 0u, ///< The uint1 of pvd detect.
  247. PvdU2 = 1u, ///< The unit2 of pvd detect.
  248. }en_pwc_pvd_t;
  249. /**
  250. *******************************************************************************
  251. ** \brief The power mode configuration.
  252. **
  253. ******************************************************************************/
  254. typedef struct stc_pwc_pwr_mode_cfg
  255. {
  256. en_pwc_powerdown_md_t enPwrDownMd; ///< Power down mode.
  257. en_functional_state_t enRLdo; ///< Enable or disable RLDO.
  258. en_functional_state_t enRetSram; ///< Enable or disable Ret_Sram.
  259. en_pwc_iortn_t enIoRetain; ///< IO retain.
  260. en_pwc_waketime_sel_t enPwrDWkupTm; ///< The power down wake up time select.
  261. }stc_pwc_pwr_mode_cfg_t;
  262. /**
  263. *******************************************************************************
  264. ** \brief The stop mode configuration.
  265. **
  266. ******************************************************************************/
  267. typedef struct stc_pwc_stop_mode_cfg
  268. {
  269. en_pwc_stopdas_t enStpDrvAbi; ///< Driver ability while enter stop mode.
  270. en_pwc_stop_flash_sel_t enStopFlash; ///< Flash mode while stop mode awake.
  271. en_pwc_stop_clk_sel_t enStopClk; ///< Clock value while stop mode awake.
  272. en_functional_state_t enPll; ///< Whether the PLL enable or disable while enter stop mode.
  273. }stc_pwc_stop_mode_cfg_t;
  274. /**
  275. *******************************************************************************
  276. ** \brief The power down wake_up timer control.
  277. **
  278. ******************************************************************************/
  279. typedef struct stc_pwc_wktm_ctl
  280. {
  281. uint16_t u16WktmCmp; ///< The wake_up timer compare value.
  282. en_pwc_wkover_flag_t enWkOverFlag; ///< The flag of compare result.
  283. en_pwc_wkclk_sel_t enWkclk; ///< The clock of wake_up timer.
  284. en_functional_state_t enWktmEn; ///< Enable or disable wake_up timer.
  285. }stc_pwc_wktm_ctl_t;
  286. /**
  287. *******************************************************************************
  288. ** \brief The pvd control.
  289. **
  290. ******************************************************************************/
  291. typedef struct stc_pwc_pvd_ctl
  292. {
  293. en_functional_state_t enPvdIREn; ///< Enable or disable pvd interrupt(reset).
  294. en_pwc_pvd_md_t enPvdMode; ///< The handle of pvd is interrupt or reset.
  295. en_functional_state_t enPvdCmpOutEn; ///< Enable or disable pvd output compare result .
  296. }stc_pwc_pvd_ctl_t;
  297. /**
  298. *******************************************************************************
  299. ** \brief The power down wake_up event configuration.
  300. **
  301. ******************************************************************************/
  302. typedef struct stc_pwc_pvd_cfg
  303. {
  304. stc_pwc_pvd_ctl_t stcPvd1Ctl; ///< Pvd1 control configuration.
  305. stc_pwc_pvd_ctl_t stcPvd2Ctl; ///< Pvd2 control configuration.
  306. en_functional_state_t enPvd1FilterEn; ///< Pvd1 filtering enable or disable.
  307. en_functional_state_t enPvd2FilterEn; ///< Pvd2 filtering enable or disable.
  308. en_pwc_pvdfiltclk_sel_t enPvd1Filtclk; ///< Pvd1 filtering sampling clock.
  309. en_pwc_pvdfiltclk_sel_t enPvd2Filtclk; ///< Pvd2 filtering sampling clock.
  310. en_pwc_pvd1level_sel_t enPvd1Level; ///< Pvd1 voltage.
  311. en_pwc_pvd2level_sel_t enPvd2Level; ///< Pvd2 voltage.
  312. en_pwc_pvd_int_sel_t enPvd1Int; ///< Pvd1 interrupt.
  313. en_pwc_pvd_int_sel_t enPvd2Int; ///< Pvd2 interrupt.
  314. }stc_pwc_pvd_cfg_t;
  315. /*******************************************************************************
  316. * Global pre-processor symbols/macros ('#define')
  317. ******************************************************************************/
  318. #define PWC_PDWKEN0_WKUP00 ((uint8_t)0x01)
  319. #define PWC_PDWKEN0_WKUP01 ((uint8_t)0x02)
  320. #define PWC_PDWKEN0_WKUP02 ((uint8_t)0x04)
  321. #define PWC_PDWKEN0_WKUP03 ((uint8_t)0x08)
  322. #define PWC_PDWKEN0_WKUP10 ((uint8_t)0x10)
  323. #define PWC_PDWKEN0_WKUP11 ((uint8_t)0x20)
  324. #define PWC_PDWKEN0_WKUP12 ((uint8_t)0x40)
  325. #define PWC_PDWKEN0_WKUP13 ((uint8_t)0x80)
  326. #define PWC_PDWKEN1_WKUP20 ((uint8_t)0x01)
  327. #define PWC_PDWKEN1_WKUP21 ((uint8_t)0x02)
  328. #define PWC_PDWKEN1_WKUP22 ((uint8_t)0x04)
  329. #define PWC_PDWKEN1_WKUP23 ((uint8_t)0x08)
  330. #define PWC_PDWKEN1_WKUP30 ((uint8_t)0x10)
  331. #define PWC_PDWKEN1_WKUP31 ((uint8_t)0x20)
  332. #define PWC_PDWKEN1_WKUP32 ((uint8_t)0x40)
  333. #define PWC_PDWKEN1_WKUP33 ((uint8_t)0x80)
  334. #define PWC_PDWKEN2_PVD1 ((uint8_t)0x01)
  335. #define PWC_PDWKEN2_PVD2 ((uint8_t)0x02)
  336. #define PWC_PDWKEN2_NMI ((uint8_t)0x04)
  337. #define PWC_PDWKEN2_RTCPRD ((uint8_t)0x10)
  338. #define PWC_PDWKEN2_RTCAL ((uint8_t)0x20)
  339. #define PWC_PDWKEN2_WKTM ((uint8_t)0x80)
  340. #define PWC_PDWKUP_EDGE_WKP0 ((uint8_t)0x01)
  341. #define PWC_PDWKUP_EDGE_WKP1 ((uint8_t)0x02)
  342. #define PWC_PDWKUP_EDGE_WKP2 ((uint8_t)0x04)
  343. #define PWC_PDWKUP_EDGE_WKP3 ((uint8_t)0x08)
  344. #define PWC_PDWKUP_EDGE_PVD1 ((uint8_t)0x10)
  345. #define PWC_PDWKUP_EDGE_PVD2 ((uint8_t)0x20)
  346. #define PWC_PDWKUP_EDGE_NMI ((uint8_t)0x40)
  347. #define PWC_RAMPWRDOWN_SRAM1 ((uint32_t)0x00000001)
  348. #define PWC_RAMPWRDOWN_SRAM2 ((uint32_t)0x00000002)
  349. #define PWC_RAMPWRDOWN_SRAM3 ((uint32_t)0x00000004)
  350. #define PWC_RAMPWRDOWN_SRAMH ((uint32_t)0x00000008)
  351. #define PWC_RAMPWRDOWN_USBFS ((uint32_t)0x00000010)
  352. #define PWC_RAMPWRDOWN_SDIOC0 ((uint32_t)0x00000020)
  353. #define PWC_RAMPWRDOWN_SDIOC1 ((uint32_t)0x00000040)
  354. #define PWC_RAMPWRDOWN_CAN ((uint32_t)0x00000080)
  355. #define PWC_RAMPWRDOWN_CACHE ((uint32_t)0x00000100)
  356. #define PWC_RAMPWRDOWN_FULL ((uint32_t)0x000001FF)
  357. #define PWC_STOPWKUPEN_EIRQ0 ((uint32_t)0x00000001)
  358. #define PWC_STOPWKUPEN_EIRQ1 ((uint32_t)0x00000002)
  359. #define PWC_STOPWKUPEN_EIRQ2 ((uint32_t)0x00000004)
  360. #define PWC_STOPWKUPEN_EIRQ3 ((uint32_t)0x00000008)
  361. #define PWC_STOPWKUPEN_EIRQ4 ((uint32_t)0x00000010)
  362. #define PWC_STOPWKUPEN_EIRQ5 ((uint32_t)0x00000020)
  363. #define PWC_STOPWKUPEN_EIRQ6 ((uint32_t)0x00000040)
  364. #define PWC_STOPWKUPEN_EIRQ7 ((uint32_t)0x00000080)
  365. #define PWC_STOPWKUPEN_EIRQ8 ((uint32_t)0x00000100)
  366. #define PWC_STOPWKUPEN_EIRQ9 ((uint32_t)0x00000200)
  367. #define PWC_STOPWKUPEN_EIRQ10 ((uint32_t)0x00000400)
  368. #define PWC_STOPWKUPEN_EIRQ11 ((uint32_t)0x00000800)
  369. #define PWC_STOPWKUPEN_EIRQ12 ((uint32_t)0x00001000)
  370. #define PWC_STOPWKUPEN_EIRQ13 ((uint32_t)0x00002000)
  371. #define PWC_STOPWKUPEN_EIRQ14 ((uint32_t)0x00004000)
  372. #define PWC_STOPWKUPEN_EIRQ15 ((uint32_t)0x00008000)
  373. #define PWC_STOPWKUPEN_SWDT ((uint32_t)0x00010000)
  374. #define PWC_STOPWKUPEN_VDU1 ((uint32_t)0x00020000)
  375. #define PWC_STOPWKUPEN_VDU2 ((uint32_t)0x00040000)
  376. #define PWC_STOPWKUPEN_CMPI0 ((uint32_t)0x00080000)
  377. #define PWC_STOPWKUPEN_WKTM ((uint32_t)0x00100000)
  378. #define PWC_STOPWKUPEN_RTCAL ((uint32_t)0x00200000)
  379. #define PWC_STOPWKUPEN_RTCPRD ((uint32_t)0x00400000)
  380. #define PWC_STOPWKUPEN_TMR0 ((uint32_t)0x00800000)
  381. #define PWC_STOPWKUPEN_USARTRXD ((uint32_t)0x02000000)
  382. #define PWC_PTWK0_WKUPFLAG ((uint8_t)0x01)
  383. #define PWC_PTWK1_WKUPFLAG ((uint8_t)0x02)
  384. #define PWC_PTWK2_WKUPFLAG ((uint8_t)0x04)
  385. #define PWC_PTWK3_WKUPFLAG ((uint8_t)0x08)
  386. #define PWC_PVD1_WKUPFLAG ((uint8_t)0x10)
  387. #define PWC_PVD2_WKUPFLAG ((uint8_t)0x20)
  388. #define PWC_NMI_WKUPFLAG ((uint8_t)0x40)
  389. #define PWC_RTCPRD_WKUPFALG ((uint8_t)0x10)
  390. #define PWC_RTCAL_WKUPFLAG ((uint8_t)0x20)
  391. #define PWC_WKTM_WKUPFLAG ((uint8_t)0x80)
  392. #define PWC_WKTMCMP_MSK ((uint16_t)0x0FFF)
  393. #define PWC_FCG0_PERIPH_SRAMH ((uint32_t)0x00000001)
  394. #define PWC_FCG0_PERIPH_SRAM12 ((uint32_t)0x00000010)
  395. #define PWC_FCG0_PERIPH_SRAM3 ((uint32_t)0x00000100)
  396. #define PWC_FCG0_PERIPH_SRAMRET ((uint32_t)0x00000400)
  397. #define PWC_FCG0_PERIPH_DMA1 ((uint32_t)0x00004000)
  398. #define PWC_FCG0_PERIPH_DMA2 ((uint32_t)0x00008000)
  399. #define PWC_FCG0_PERIPH_FCM ((uint32_t)0x00010000)
  400. #define PWC_FCG0_PERIPH_AOS ((uint32_t)0x00020000)
  401. #define PWC_FCG0_PERIPH_AES ((uint32_t)0x00100000)
  402. #define PWC_FCG0_PERIPH_HASH ((uint32_t)0x00200000)
  403. #define PWC_FCG0_PERIPH_TRNG ((uint32_t)0x00400000)
  404. #define PWC_FCG0_PERIPH_CRC ((uint32_t)0x00800000)
  405. #define PWC_FCG0_PERIPH_DCU1 ((uint32_t)0x01000000)
  406. #define PWC_FCG0_PERIPH_DCU2 ((uint32_t)0x02000000)
  407. #define PWC_FCG0_PERIPH_DCU3 ((uint32_t)0x04000000)
  408. #define PWC_FCG0_PERIPH_DCU4 ((uint32_t)0x08000000)
  409. #define PWC_FCG0_PERIPH_KEY ((uint32_t)0x80000000)
  410. #define PWC_FCG1_PERIPH_CAN ((uint32_t)0x00000001)
  411. #define PWC_FCG1_PERIPH_QSPI ((uint32_t)0x00000008)
  412. #define PWC_FCG1_PERIPH_I2C1 ((uint32_t)0x00000010)
  413. #define PWC_FCG1_PERIPH_I2C2 ((uint32_t)0x00000020)
  414. #define PWC_FCG1_PERIPH_I2C3 ((uint32_t)0x00000040)
  415. #define PWC_FCG1_PERIPH_USBFS ((uint32_t)0x00000100)
  416. #define PWC_FCG1_PERIPH_SDIOC1 ((uint32_t)0x00000400)
  417. #define PWC_FCG1_PERIPH_SDIOC2 ((uint32_t)0x00000800)
  418. #define PWC_FCG1_PERIPH_I2S1 ((uint32_t)0x00001000)
  419. #define PWC_FCG1_PERIPH_I2S2 ((uint32_t)0x00002000)
  420. #define PWC_FCG1_PERIPH_I2S3 ((uint32_t)0x00004000)
  421. #define PWC_FCG1_PERIPH_I2S4 ((uint32_t)0x00008000)
  422. #define PWC_FCG1_PERIPH_SPI1 ((uint32_t)0x00010000)
  423. #define PWC_FCG1_PERIPH_SPI2 ((uint32_t)0x00020000)
  424. #define PWC_FCG1_PERIPH_SPI3 ((uint32_t)0x00040000)
  425. #define PWC_FCG1_PERIPH_SPI4 ((uint32_t)0x00080000)
  426. #define PWC_FCG1_PERIPH_USART1 ((uint32_t)0x01000000)
  427. #define PWC_FCG1_PERIPH_USART2 ((uint32_t)0x02000000)
  428. #define PWC_FCG1_PERIPH_USART3 ((uint32_t)0x04000000)
  429. #define PWC_FCG1_PERIPH_USART4 ((uint32_t)0x08000000)
  430. #define PWC_FCG2_PERIPH_TIM01 ((uint32_t)0x00000001)
  431. #define PWC_FCG2_PERIPH_TIM02 ((uint32_t)0x00000002)
  432. #define PWC_FCG2_PERIPH_TIMA1 ((uint32_t)0x00000004)
  433. #define PWC_FCG2_PERIPH_TIMA2 ((uint32_t)0x00000008)
  434. #define PWC_FCG2_PERIPH_TIMA3 ((uint32_t)0x00000010)
  435. #define PWC_FCG2_PERIPH_TIMA4 ((uint32_t)0x00000020)
  436. #define PWC_FCG2_PERIPH_TIMA5 ((uint32_t)0x00000040)
  437. #define PWC_FCG2_PERIPH_TIMA6 ((uint32_t)0x00000080)
  438. #define PWC_FCG2_PERIPH_TIM41 ((uint32_t)0x00000100)
  439. #define PWC_FCG2_PERIPH_TIM42 ((uint32_t)0x00000200)
  440. #define PWC_FCG2_PERIPH_TIM43 ((uint32_t)0x00000400)
  441. #define PWC_FCG2_PERIPH_EMB ((uint32_t)0x00008000)
  442. #define PWC_FCG2_PERIPH_TIM61 ((uint32_t)0x00010000)
  443. #define PWC_FCG2_PERIPH_TIM62 ((uint32_t)0x00020000)
  444. #define PWC_FCG2_PERIPH_TIM63 ((uint32_t)0x00040000)
  445. #define PWC_FCG3_PERIPH_ADC1 ((uint32_t)0x00000001)
  446. #define PWC_FCG3_PERIPH_ADC2 ((uint32_t)0x00000002)
  447. #define PWC_FCG3_PERIPH_CMP ((uint32_t)0x00000100)
  448. #define PWC_FCG3_PERIPH_OTS ((uint32_t)0x00001000)
  449. /*******************************************************************************
  450. * Global variable definitions ('extern')
  451. ******************************************************************************/
  452. /*******************************************************************************
  453. * Global function prototypes (definition in C source)
  454. ******************************************************************************/
  455. void PWC_PowerModeCfg(const stc_pwc_pwr_mode_cfg_t* pstcPwrMdCfg);
  456. void PWC_EnterPowerDownMd(void);
  457. void PWC_PdWakeup0Cmd(uint32_t u32Wkup0Event, en_functional_state_t enNewState);
  458. void PWC_PdWakeup1Cmd(uint32_t u32Wkup1Event, en_functional_state_t enNewState);
  459. void PWC_PdWakeup2Cmd(uint32_t u32Wkup2Event, en_functional_state_t enNewState);
  460. void PWC_PdWakeupEvtEdgeCfg(uint8_t u8WkupEvent, en_pwc_edge_sel_t enEdge);
  461. en_flag_status_t PWC_GetWakeup0Flag(uint8_t u8WkupFlag);
  462. en_flag_status_t PWC_GetWakeup1Flag(uint8_t u8WkupFlag);
  463. void PWC_ClearWakeup0Flag(uint8_t u8WkupFlag);
  464. void PWC_ClearWakeup1Flag(uint8_t u8WkupFlag);
  465. void PWC_PwrMonitorCmd(en_functional_state_t enNewState);
  466. void PWC_Fcg0PeriphClockCmd(uint32_t u32Fcg0Periph, en_functional_state_t enNewState);
  467. void PWC_Fcg1PeriphClockCmd(uint32_t u32Fcg1Periph, en_functional_state_t enNewState);
  468. void PWC_Fcg2PeriphClockCmd(uint32_t u32Fcg2Periph, en_functional_state_t enNewState);
  469. void PWC_Fcg3PeriphClockCmd(uint32_t u32Fcg3Periph, en_functional_state_t enNewState);
  470. en_result_t PWC_StopModeCfg(const stc_pwc_stop_mode_cfg_t* pstcStpMdCfg);
  471. void PWC_StopWkupCmd(uint32_t u32Wkup0Event, en_functional_state_t enNewState);
  472. void PWC_EnterStopMd(void);
  473. void PWC_EnterSleepMd(void);
  474. void PWC_Xtal32CsCmd(en_functional_state_t enNewState);
  475. void PWC_HrcPwrCmd(en_functional_state_t enNewState);
  476. void PWC_PllPwrCmd(en_functional_state_t enNewState);
  477. void PWC_RamPwrdownCmd(uint32_t u32RamCtlBit, en_functional_state_t enNewState);
  478. void PWC_RamOpMdConfig(en_pwc_ram_op_md_t enRamOpMd);
  479. void PWC_WktmControl(const stc_pwc_wktm_ctl_t* pstcWktmCtl);
  480. void PWC_PvdCfg(const stc_pwc_pvd_cfg_t* pstcPvdCfg);
  481. void PWC_Pvd1Cmd(en_functional_state_t enNewState);
  482. void PWC_Pvd2Cmd(en_functional_state_t enNewState);
  483. void PWC_ExVccCmd(en_functional_state_t enNewState);
  484. void PWC_ClearPvdFlag(en_pwc_pvd_t enPvd);
  485. en_flag_status_t PWC_GetPvdFlag(en_pwc_pvd_t enPvd);
  486. en_flag_status_t PWC_GetPvdStatus(en_pwc_pvd_t enPvd);
  487. void PWC_enNvicBackup(void);
  488. void PWC_enNvicRecover(void);
  489. void PWC_ClkBackup(void);
  490. void PWC_ClkRecover(void);
  491. void PWC_IrqClkBackup(void);
  492. void PWC_IrqClkRecover(void);
  493. en_result_t PWC_HS2LS(void);
  494. en_result_t PWC_LS2HS(void);
  495. en_result_t PWC_HS2HP(void);
  496. en_result_t PWC_HP2HS(void);
  497. en_result_t PWC_LS2HP(void);
  498. en_result_t PWC_HP2LS(void);
  499. //@} // PwcGroup
  500. #ifdef __cplusplus
  501. }
  502. #endif
  503. #endif /* DDL_PWC_ENABLE */
  504. #endif /* __HC32F460_PWC_H__ */
  505. /*******************************************************************************
  506. * EOF (not truncated)
  507. ******************************************************************************/