hc32_ll_emb.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. /**
  2. *******************************************************************************
  3. * @file hc32_ll_emb.h
  4. * @brief This file contains all the functions prototypes of the EMB
  5. * (Emergency Brake) driver library.
  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_EMB_H__
  22. #define __HC32_LL_EMB_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. /**
  35. * @addtogroup LL_Driver
  36. * @{
  37. */
  38. /**
  39. * @addtogroup LL_EMB
  40. * @{
  41. */
  42. #if (LL_EMB_ENABLE == DDL_ON)
  43. /*******************************************************************************
  44. * Global type definitions ('typedef')
  45. ******************************************************************************/
  46. /**
  47. * @defgroup EMB_Global_Types EMB Global Types
  48. * @{
  49. */
  50. /**
  51. * @brief EMB monitor OSC failure configuration
  52. */
  53. typedef struct {
  54. uint32_t u32OscState; /*!< Enable or disable EMB detect OSC failure function
  55. This parameter can be a value of @ref EMB_OSC_Selection */
  56. } stc_emb_monitor_osc_t;
  57. /**
  58. * @brief EMB monitor EMB port configuration
  59. */
  60. typedef struct {
  61. uint32_t u32PortState; /*!< Enable or disable EMB detect port in control function
  62. This parameter can be a value of @ref EMB_Port_Selection */
  63. uint32_t u32PortLevel; /*!< EMB detect port level
  64. This parameter can be a value of @ref EMB_Detect_Port_Level */
  65. uint32_t u32PortFilterDiv; /*!< EMB port filter division
  66. This parameter can be a value of @ref EMB_Port_Filter_Clock_Division */
  67. uint32_t u32PortFilterState; /*!< EMB port filter division
  68. This parameter can be a value of @ref EMB_Port_Filter_Selection */
  69. } stc_emb_monitor_port_config_t;
  70. /**
  71. * @brief EMB monitor PWM configuration
  72. */
  73. typedef struct {
  74. uint32_t u32PwmState; /*!< Enable or disable EMB detect timer same phase function
  75. This parameter can be a value of @ref EMB_Detect_PWM state. */
  76. uint32_t u32PwmLevel; /*!< Detect timer polarity level
  77. This parameter can be a value of @ref EMB_Detect_PWM level */
  78. } stc_emb_monitor_tmr_pwm_t;
  79. /**
  80. * @brief EMB monitor port in configuration
  81. */
  82. typedef struct {
  83. stc_emb_monitor_port_config_t stcPort1; /*!< EMB detect EMB port in function
  84. This parameter details refer @ref stc_emb_monitor_port_config_t structure */
  85. stc_emb_monitor_port_config_t stcPort2; /*!< EMB detect EMB port in function
  86. This parameter details refer @ref stc_emb_monitor_port_config_t structure */
  87. stc_emb_monitor_port_config_t stcPort3; /*!< EMB detect EMB port in function
  88. This parameter details refer @ref stc_emb_monitor_port_config_t structure */
  89. stc_emb_monitor_port_config_t stcPort4; /*!< EMB detect EMB port in function
  90. This parameter details refer @ref stc_emb_monitor_port_config_t structure */
  91. } stc_emb_monitor_port_t;
  92. /**
  93. * @brief EMB monitor CMP configuration
  94. */
  95. typedef struct {
  96. uint32_t u32Cmp1State; /*!< Enable or disable EMB detect CMP1 result function
  97. This parameter can be a value of @ref EMB_CMP_Selection */
  98. uint32_t u32Cmp2State; /*!< Enable or disable EMB detect CMP2 result function
  99. This parameter can be a value of @ref EMB_CMP_Selection */
  100. uint32_t u32Cmp3State; /*!< Enable or disable EMB detect CMP3 result function
  101. This parameter can be a value of @ref EMB_CMP_Selection */
  102. uint32_t u32Cmp4State; /*!< Enable or disable EMB detect CMP4 result function
  103. This parameter can be a value of @ref EMB_CMP_Selection */
  104. } stc_emb_monitor_cmp_t;
  105. /**
  106. * @brief EMB monitor TMR4 configuration
  107. */
  108. typedef struct {
  109. stc_emb_monitor_tmr_pwm_t stcTmr4PwmU; /*!< EMB detect TMR4 function
  110. This parameter details refer @ref stc_emb_monitor_tmr_pwm_t structure */
  111. stc_emb_monitor_tmr_pwm_t stcTmr4PwmV; /*!< EMB detect TMR4 function
  112. This parameter details refer @ref stc_emb_monitor_tmr_pwm_t structure */
  113. stc_emb_monitor_tmr_pwm_t stcTmr4PwmW; /*!< EMB detect TMR4 function
  114. This parameter details refer @ref stc_emb_monitor_tmr_pwm_t structure */
  115. stc_emb_monitor_tmr_pwm_t stcTmr4PwmX; /*!< EMB detect TMR4 function
  116. This parameter details refer @ref stc_emb_monitor_tmr_pwm_t structure */
  117. } stc_emb_monitor_tmr4_t;
  118. /**
  119. * @brief EMB monitor TMR6 configuration
  120. */
  121. typedef struct {
  122. stc_emb_monitor_tmr_pwm_t stcTmr6_1; /*!< EMB detect TMR6 function
  123. This parameter details refer @ref stc_emb_monitor_tmr_pwm_t structure */
  124. stc_emb_monitor_tmr_pwm_t stcTmr6_2; /*!< EMB detect TMR6 function
  125. This parameter details refer @ref stc_emb_monitor_tmr_pwm_t structure */
  126. } stc_emb_monitor_tmr6_t;
  127. /**
  128. * @brief EMB control TMR4 initialization configuration
  129. */
  130. typedef struct {
  131. stc_emb_monitor_cmp_t stcCmp; /*!< EMB detect CMP function
  132. This parameter details refer @ref stc_emb_monitor_cmp_t structure */
  133. stc_emb_monitor_osc_t stcOsc; /*!< EMB detect OSC function
  134. This parameter details refer @ref stc_emb_monitor_osc_t structure */
  135. stc_emb_monitor_port_t stcPort; /*!< EMB detect EMB port function
  136. This parameter details refer @ref stc_emb_monitor_port_t structure */
  137. stc_emb_monitor_tmr4_t stcTmr4; /*!< EMB detect TMR4 function
  138. This parameter details refer @ref stc_emb_monitor_tmr4_t structure */
  139. uint32_t u32SramEccError; /*!< EMB detect SRAM ECC error function
  140. This parameter can be a value of @ref EMB_SRAM_ECC_Error_Selection */
  141. uint32_t u32SramParityError; /*!< EMB detect SRAM parity error function
  142. This parameter can be a value of @ref EMB_SRAM_Parity_Error_Selection */
  143. uint32_t u32Lockup; /*!< EMB detect lockup function
  144. This parameter can be a value of @ref EMB_Lockup_Selection */
  145. uint32_t u32Lvd; /*!< EMB detect LVD function
  146. This parameter can be a value of @ref EMB_LVD_Selection */
  147. } stc_emb_tmr4_init_t;
  148. /**
  149. * @brief EMB control TMR6 initialization configuration
  150. */
  151. typedef struct {
  152. stc_emb_monitor_cmp_t stcCmp; /*!< EMB detect CMP function
  153. This parameter details refer @ref stc_emb_monitor_cmp_t structure */
  154. stc_emb_monitor_osc_t stcOsc; /*!< EMB detect OSC function
  155. This parameter details refer @ref stc_emb_monitor_osc_t structure */
  156. stc_emb_monitor_port_t stcPort; /*!< EMB detect EMB port function
  157. This parameter details refer @ref stc_emb_monitor_port_t structure */
  158. stc_emb_monitor_tmr6_t stcTmr6; /*!< EMB detect TMR6 function
  159. This parameter details refer @ref stc_emb_monitor_tmr6_t structure */
  160. uint32_t u32SramEccError; /*!< EMB detect SRAM ECC error function
  161. This parameter can be a value of @ref EMB_SRAM_ECC_Error_Selection */
  162. uint32_t u32SramParityError; /*!< EMB detect SRAM parity error function
  163. This parameter can be a value of @ref EMB_SRAM_Parity_Error_Selection */
  164. uint32_t u32Lockup; /*!< EMB detect lockup function
  165. This parameter can be a value of @ref EMB_Lockup_Selection */
  166. uint32_t u32Lvd; /*!< EMB detect LVD function
  167. This parameter can be a value of @ref EMB_LVD_Selection */
  168. } stc_emb_tmr6_init_t;
  169. /**
  170. * @}
  171. */
  172. /*******************************************************************************
  173. * Global pre-processor symbols/macros ('#define')
  174. ******************************************************************************/
  175. /**
  176. * @defgroup EMB_Global_Macros EMB Global Macros
  177. * @{
  178. */
  179. /**
  180. * @defgroup EMB_CMP_Selection EMB CMP Selection
  181. * @{
  182. */
  183. #define EMB_CMP1_DISABLE (0UL)
  184. #define EMB_CMP2_DISABLE (0UL)
  185. #define EMB_CMP3_DISABLE (0UL)
  186. #define EMB_CMP4_DISABLE (0UL)
  187. #define EMB_CMP1_ENABLE (EMB_CTL1_CMPEN0)
  188. #define EMB_CMP2_ENABLE (EMB_CTL1_CMPEN1)
  189. #define EMB_CMP3_ENABLE (EMB_CTL1_CMPEN2)
  190. #define EMB_CMP4_ENABLE (EMB_CTL1_CMPEN3)
  191. /**
  192. * @}
  193. */
  194. /**
  195. * @defgroup EMB_OSC_Selection EMB OSC Selection
  196. * @{
  197. */
  198. #define EMB_OSC_DISABLE (0UL)
  199. #define EMB_OSC_ENABLE (EMB_CTL1_OSCSTPEN)
  200. /**
  201. * @}
  202. */
  203. /**
  204. * @defgroup EMB_SRAM_ECC_Error_Selection EMB SRAM ECC Error Selection
  205. * @{
  206. */
  207. #define EMB_SRAM_ECC_ERR_DISABLE (0UL)
  208. #define EMB_SRAM_ECC_ERR_ENABLE (EMB_CTL1_SRAMERREN)
  209. /**
  210. * @}
  211. */
  212. /**
  213. * @defgroup EMB_SRAM_Parity_Error_Selection EMB SRAM Parity Error Selection
  214. * @{
  215. */
  216. #define EMB_SRAM_PARITY_ERR_DISABLE (0UL)
  217. #define EMB_SRAM_PARITY_ERR_ENABLE (EMB_CTL1_SRAMPYERREN)
  218. /**
  219. * @}
  220. */
  221. /**
  222. * @defgroup EMB_Lockup_Selection EMB Lockup Selection
  223. * @{
  224. */
  225. #define EMB_LOCKUP_DISABLE (0UL)
  226. #define EMB_LOCKUP_ENABLE (EMB_CTL1_LOCKUPEN)
  227. /**
  228. * @}
  229. */
  230. /**
  231. * @defgroup EMB_LVD_Selection EMB LVD Selection
  232. * @{
  233. */
  234. #define EMB_LVD_DISABLE (0UL)
  235. #define EMB_LVD_ENABLE (EMB_CTL1_PVDEN)
  236. /**
  237. * @}
  238. */
  239. /**
  240. * @defgroup EMB_Detect_PWM EMB Detect PWM
  241. * @{
  242. */
  243. /**
  244. * @defgroup EMB_TMR4_PWM_Selection EMB TMR4 PWM Selection
  245. * @{
  246. */
  247. #define EMB_TMR4_PWM_X_DISABLE (0UL)
  248. #define EMB_TMR4_PWM_W_DISABLE (0UL)
  249. #define EMB_TMR4_PWM_V_DISABLE (0UL)
  250. #define EMB_TMR4_PWM_U_DISABLE (0UL)
  251. #define EMB_TMR4_PWM_X_ENABLE (EMB_CTL1_PWMSEN3)
  252. #define EMB_TMR4_PWM_W_ENABLE (EMB_CTL1_PWMSEN0)
  253. #define EMB_TMR4_PWM_V_ENABLE (EMB_CTL1_PWMSEN1)
  254. #define EMB_TMR4_PWM_U_ENABLE (EMB_CTL1_PWMSEN2)
  255. /**
  256. * @}
  257. */
  258. /**
  259. * @defgroup EMB_Detect_TMR4_PWM_Level EMB Detect TMR4 PWM Level
  260. * @{
  261. */
  262. #define EMB_DETECT_TMR4_PWM_X_BOTH_LOW (0UL)
  263. #define EMB_DETECT_TMR4_PWM_W_BOTH_LOW (0UL)
  264. #define EMB_DETECT_TMR4_PWM_V_BOTH_LOW (0UL)
  265. #define EMB_DETECT_TMR4_PWM_U_BOTH_LOW (0UL)
  266. #define EMB_DETECT_TMR4_PWM_X_BOTH_HIGH (EMB_CTL2_PWMLV3)
  267. #define EMB_DETECT_TMR4_PWM_W_BOTH_HIGH (EMB_CTL2_PWMLV0)
  268. #define EMB_DETECT_TMR4_PWM_V_BOTH_HIGH (EMB_CTL2_PWMLV1)
  269. #define EMB_DETECT_TMR4_PWM_U_BOTH_HIGH (EMB_CTL2_PWMLV2)
  270. /**
  271. * @}
  272. */
  273. /**
  274. * @defgroup EMB_TMR6_PWM_Selection EMB TMR6 PWM Selection
  275. * @{
  276. */
  277. #define EMB_TMR6_1_PWM_DISABLE (0UL)
  278. #define EMB_TMR6_2_PWM_DISABLE (0UL)
  279. #define EMB_TMR6_1_PWM_ENABLE (EMB_CTL1_PWMSEN0)
  280. #define EMB_TMR6_2_PWM_ENABLE (EMB_CTL1_PWMSEN1)
  281. /**
  282. * @}
  283. */
  284. /**
  285. * @defgroup EMB_Detect_TMR6_PWM_Level EMB Detect TMR6 PWM Level
  286. * @{
  287. */
  288. #define EMB_DETECT_TMR6_1_PWM_BOTH_LOW (0UL)
  289. #define EMB_DETECT_TMR6_2_PWM_BOTH_LOW (0UL)
  290. #define EMB_DETECT_TMR6_1_PWM_BOTH_HIGH (EMB_CTL2_PWMLV0)
  291. #define EMB_DETECT_TMR6_2_PWM_BOTH_HIGH (EMB_CTL2_PWMLV1)
  292. /**
  293. * @}
  294. */
  295. /**
  296. * @}
  297. */
  298. /**
  299. * @defgroup EMB_Port_Selection EMB Port Selection
  300. * @{
  301. */
  302. #define EMB_PORT1_DISABLE (0UL)
  303. #define EMB_PORT2_DISABLE (0UL)
  304. #define EMB_PORT3_DISABLE (0UL)
  305. #define EMB_PORT4_DISABLE (0UL)
  306. #define EMB_PORT1_ENABLE (EMB_CTL1_PORTINEN1)
  307. #define EMB_PORT2_ENABLE (EMB_CTL1_PORTINEN2)
  308. #define EMB_PORT3_ENABLE (EMB_CTL1_PORTINEN3)
  309. #define EMB_PORT4_ENABLE (EMB_CTL1_PORTINEN4)
  310. /**
  311. * @}
  312. */
  313. /**
  314. * @defgroup EMB_Detect_Port_Level EMB Detect Port Level
  315. * @{
  316. */
  317. #define EMB_PORT1_DETECT_LVL_HIGH (0UL)
  318. #define EMB_PORT2_DETECT_LVL_HIGH (0UL)
  319. #define EMB_PORT3_DETECT_LVL_HIGH (0UL)
  320. #define EMB_PORT4_DETECT_LVL_HIGH (0UL)
  321. #define EMB_PORT1_DETECT_LVL_LOW (EMB_CTL1_INVSEL1)
  322. #define EMB_PORT2_DETECT_LVL_LOW (EMB_CTL1_INVSEL2)
  323. #define EMB_PORT3_DETECT_LVL_LOW (EMB_CTL1_INVSEL3)
  324. #define EMB_PORT4_DETECT_LVL_LOW (EMB_CTL1_INVSEL4)
  325. /**
  326. * @}
  327. */
  328. /**
  329. * @defgroup EMB_Port_Filter_Selection EMB Port Filter Selection
  330. * @{
  331. */
  332. #define EMB_PORT1_FILTER_DISABLE (0UL)
  333. #define EMB_PORT2_FILTER_DISABLE (0UL)
  334. #define EMB_PORT3_FILTER_DISABLE (0UL)
  335. #define EMB_PORT4_FILTER_DISABLE (0UL)
  336. #define EMB_PORT1_FILTER_ENABLE (EMB_CTL2_NFEN1)
  337. #define EMB_PORT2_FILTER_ENABLE (EMB_CTL2_NFEN2)
  338. #define EMB_PORT3_FILTER_ENABLE (EMB_CTL2_NFEN3)
  339. #define EMB_PORT4_FILTER_ENABLE (EMB_CTL2_NFEN4)
  340. /**
  341. * @}
  342. */
  343. /**
  344. * @defgroup EMB_Port_Filter_Clock_Division EMB Port Filter Clock Division
  345. * @{
  346. */
  347. #define EMB_PORT1_FILTER_CLK_DIV1 (0UL << EMB_CTL2_NFSEL1_POS)
  348. #define EMB_PORT1_FILTER_CLK_DIV8 (1UL << EMB_CTL2_NFSEL1_POS)
  349. #define EMB_PORT1_FILTER_CLK_DIV32 (2UL << EMB_CTL2_NFSEL1_POS)
  350. #define EMB_PORT1_FILTER_CLK_DIV128 (3UL << EMB_CTL2_NFSEL1_POS)
  351. #define EMB_PORT2_FILTER_CLK_DIV1 (0UL << EMB_CTL2_NFSEL2_POS)
  352. #define EMB_PORT2_FILTER_CLK_DIV8 (1UL << EMB_CTL2_NFSEL2_POS)
  353. #define EMB_PORT2_FILTER_CLK_DIV32 (2UL << EMB_CTL2_NFSEL2_POS)
  354. #define EMB_PORT2_FILTER_CLK_DIV128 (3UL << EMB_CTL2_NFSEL2_POS)
  355. #define EMB_PORT3_FILTER_CLK_DIV1 (0UL << EMB_CTL2_NFSEL3_POS)
  356. #define EMB_PORT3_FILTER_CLK_DIV8 (1UL << EMB_CTL2_NFSEL3_POS)
  357. #define EMB_PORT3_FILTER_CLK_DIV32 (2UL << EMB_CTL2_NFSEL3_POS)
  358. #define EMB_PORT3_FILTER_CLK_DIV128 (3UL << EMB_CTL2_NFSEL3_POS)
  359. #define EMB_PORT4_FILTER_CLK_DIV1 (0UL << EMB_CTL2_NFSEL4_POS)
  360. #define EMB_PORT4_FILTER_CLK_DIV8 (1UL << EMB_CTL2_NFSEL4_POS)
  361. #define EMB_PORT4_FILTER_CLK_DIV32 (2UL << EMB_CTL2_NFSEL4_POS)
  362. #define EMB_PORT4_FILTER_CLK_DIV128 (3UL << EMB_CTL2_NFSEL4_POS)
  363. /**
  364. * @}
  365. */
  366. /**
  367. * @defgroup EMB_Flag_State EMB Flag State
  368. * @{
  369. */
  370. #define EMB_FLAG_PWMS (EMB_STAT_PWMSF)
  371. #define EMB_FLAG_CMP (EMB_STAT_CMPF)
  372. #define EMB_FLAG_SYS (EMB_STAT_SYSF)
  373. #define EMB_FLAG_PORT1 (EMB_STAT_PORTINF1)
  374. #define EMB_FLAG_PORT2 (EMB_STAT_PORTINF2)
  375. #define EMB_FLAG_PORT3 (EMB_STAT_PORTINF3)
  376. #define EMB_FLAG_PORT4 (EMB_STAT_PORTINF4)
  377. #define EMB_STAT_PWMS (EMB_STAT_PWMST)
  378. #define EMB_STAT_CMP (EMB_STAT_CMPST)
  379. #define EMB_STAT_SYS (EMB_STAT_SYSST)
  380. #define EMB_STAT_PORT1 (EMB_STAT_PORTINST1)
  381. #define EMB_STAT_PORT2 (EMB_STAT_PORTINST2)
  382. #define EMB_STAT_PORT3 (EMB_STAT_PORTINST3)
  383. #define EMB_STAT_PORT4 (EMB_STAT_PORTINST4)
  384. #define EMB_FLAG_ALL (EMB_FLAG_PWMS | EMB_FLAG_CMP | EMB_FLAG_SYS | EMB_FLAG_PORT1 | \
  385. EMB_FLAG_PORT2 | EMB_FLAG_PORT3 | EMB_FLAG_PORT4 | EMB_STAT_PWMS | \
  386. EMB_STAT_CMP | EMB_STAT_SYS | EMB_STAT_PORT1 | EMB_STAT_PORT2 | \
  387. EMB_STAT_PORT3 | EMB_STAT_PORT4)
  388. /**
  389. * @}
  390. */
  391. /**
  392. * @defgroup EMB_Interrupt EMB Interrupt
  393. * @{
  394. */
  395. #define EMB_INT_PWMS (EMB_INTEN_PWMSINTEN)
  396. #define EMB_INT_CMP (EMB_INTEN_CMPINTEN)
  397. #define EMB_INT_SYS (EMB_INTEN_SYSINTEN)
  398. #define EMB_INT_PORT1 (EMB_INTEN_PORTININTEN1)
  399. #define EMB_INT_PORT2 (EMB_INTEN_PORTININTEN2)
  400. #define EMB_INT_PORT3 (EMB_INTEN_PORTININTEN3)
  401. #define EMB_INT_PORT4 (EMB_INTEN_PORTININTEN4)
  402. #define EMB_INT_ALL (EMB_INT_PWMS | EMB_INT_CMP | EMB_INT_SYS | EMB_INT_PORT1 | \
  403. EMB_INT_PORT2 | EMB_INT_PORT3 | EMB_INT_PORT4)
  404. /**
  405. * @}
  406. */
  407. /**
  408. * @defgroup EMB_Release_TMR_PWM_Condition EMB Release TMR PWM Condition
  409. * @{
  410. */
  411. #define EMB_RELEASE_PWM_COND_FLAG_ZERO (0UL)
  412. #define EMB_RELEASE_PWM_COND_STAT_ZERO (1UL)
  413. /**
  414. * @}
  415. */
  416. /**
  417. * @defgroup EMB_Monitor_Event EMB Monitor Event
  418. * @{
  419. */
  420. #define EMB_EVT_PWMS (EMB_RLSSEL_PWMRSEL)
  421. #define EMB_EVT_CMP (EMB_RLSSEL_CMPRSEL)
  422. #define EMB_EVT_SYS (EMB_RLSSEL_SYSRSEL)
  423. #define EMB_EVT_PORT1 (EMB_RLSSEL_PORTINRSEL1)
  424. #define EMB_EVT_PORT2 (EMB_RLSSEL_PORTINRSEL2)
  425. #define EMB_EVT_PORT3 (EMB_RLSSEL_PORTINRSEL3)
  426. #define EMB_EVT_PORT4 (EMB_RLSSEL_PORTINRSEL4)
  427. /**
  428. * @}
  429. */
  430. /**
  431. * @}
  432. */
  433. /*******************************************************************************
  434. * Global variable definitions ('extern')
  435. ******************************************************************************/
  436. /*******************************************************************************
  437. Global function prototypes (definition in C source)
  438. ******************************************************************************/
  439. /**
  440. * @addtogroup EMB_Global_Functions
  441. * @{
  442. */
  443. int32_t EMB_TMR4_StructInit(stc_emb_tmr4_init_t *pstcEmbInit);
  444. int32_t EMB_TMR4_Init(CM_EMB_TypeDef *EMBx, const stc_emb_tmr4_init_t *pstcEmbInit);
  445. int32_t EMB_TMR6_StructInit(stc_emb_tmr6_init_t *pstcEmbInit);
  446. int32_t EMB_TMR6_Init(CM_EMB_TypeDef *EMBx, const stc_emb_tmr6_init_t *pstcEmbInit);
  447. void EMB_DeInit(CM_EMB_TypeDef *EMBx);
  448. void EMB_IntCmd(CM_EMB_TypeDef *EMBx, uint32_t u32IntType, en_functional_state_t enNewState);
  449. void EMB_ClearStatus(CM_EMB_TypeDef *EMBx, uint32_t u32Flag);
  450. en_flag_status_t EMB_GetStatus(const CM_EMB_TypeDef *EMBx, uint32_t u32Flag);
  451. void EMB_SWBrake(CM_EMB_TypeDef *EMBx, en_functional_state_t enNewState);
  452. void EMB_SetReleasePwmCond(CM_EMB_TypeDef *EMBx, uint32_t u32Event, uint32_t u32Cond);
  453. /**
  454. * @}
  455. */
  456. #endif /* LL_EMB_ENABLE */
  457. /**
  458. * @}
  459. */
  460. /**
  461. * @}
  462. */
  463. #ifdef __cplusplus
  464. }
  465. #endif
  466. #endif /* __HC32_LL_EMB_H__ */
  467. /*******************************************************************************
  468. * EOF (not truncated)
  469. ******************************************************************************/