hpm_ewdg_drv.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. /*
  2. * Copyright (c) 2023-2024 HPMicro
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #ifndef HPM_EWDG_DRV_H
  8. #define HPM_EWDG_DRV_H
  9. #include "hpm_common.h"
  10. #include "hpm_ewdg_regs.h"
  11. #include "hpm_soc_feature.h"
  12. /**
  13. * @brief EWDG driver APIs
  14. * @defgroup ewdg_interface EWDG driver APIs
  15. * @addtogroup ewdg_interface
  16. * @{
  17. */
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. /**
  22. * @brief EWDG error codes
  23. */
  24. enum {
  25. status_ewdg_tick_out_of_range = MAKE_STATUS(status_group_ewdg, 0), /*!< The tick is out of range */
  26. status_ewdg_div_out_of_range = MAKE_STATUS(status_group_ewdg, 1), /*!< Clock Divider is out of range */
  27. status_ewdg_feature_unsupported = MAKE_STATUS(status_group_ewdg, 2), /*!< Feature is not supported */
  28. };
  29. /**
  30. * @brief EWDG Password Definitions
  31. *
  32. * @defgroup ewdg_password_def EWDG Password definitions
  33. * @{
  34. */
  35. #define EWDG_REFRESH_UNLOCK_PASSWORD_DEFAULT (0xED09U) /*!< Default EWDG Refresh Password */
  36. #define EWDG_UPDATE_PASSWORD_DEFAULT (0xECF9U) /*!< Default EWDG Update Password */
  37. #define EWDG_REFRESH_UNLOCK_FIXED_KEY (0x55AAU) /*!< EWDG Unlock Fixed key */
  38. #define EWDG_REFRESH_KEY (0x5A45524FUL) /*!< EWDG Refresh key */
  39. /**
  40. * @}
  41. */
  42. /**
  43. * @brief EWDG Events
  44. *
  45. * @defgroup ewdg_event EWDG Event definitions
  46. * @{
  47. */
  48. #define EWDG_EVENT_PARITY_ERROR (1UL << 6) /*!< Parity Error Event */
  49. #define EWDG_EVENT_TIMEOUT_RESET (1UL << 5) /*!< Timeout Reset Event */
  50. #define EWDG_EVENT_TIMEOUT_INTERRUPT (1UL << 4) /*!< Timeout Interrupt Event */
  51. #define EWDG_EVENT_CFG_REG_UPDATE_UNLOCK_FAIL (1UL << 3) /*!< Update Unlock Fail Event */
  52. #define EWDG_EVENT_CFG_REG_UPDATE_VIOLATION (1UL << 2) /*!< Update Violation Event */
  53. #define EWDG_EVENT_REFRESH_UNLOCK_FAIL (1UL << 1) /*!< Refresh Unlock Fail Event */
  54. #define EWDG_EVENT_REFRESH_VIOLATION (1UL << 0) /*!< Refresh Violation Event */
  55. /**
  56. * @}
  57. */
  58. /**
  59. * @brief EWDG Interrupts
  60. * @defgroup ewdg_interrupt EWDG interrupt definitions
  61. * @{
  62. */
  63. #define EWDG_INT_PARITY_FAIL (1UL << 2) /*!< Parity Error Interrupt */
  64. #define EWDG_INT_CTRL_REG_UNLOCK_FAIL (1UL << 4) /*!< Unlock Control Register Fail Interrupt */
  65. #define EWDG_INT_CTRL_REG_UPDATE_FAIL (1UL << 6) /*!< Update Control Register Violation Interrupt */
  66. #define EWDG_INT_TIMEOUT (1UL << 16) /*!< Watchdog Timeout Interrupt */
  67. #define EWDG_INT_REFRESH_UNLOCK_FAIL (1UL << 20) /*!< Refresh Register Unlock Fail interrupt */
  68. #define EWDG_INT_REFRESH_VIOLATION (1UL << 22) /*!< Refresh Register Violation interrupt */
  69. /*! All Interrupt masks */
  70. #define EWDG_INT_ALL (EWDG_INT_PARITY_FAIL | EWDG_INT_CTRL_REG_UNLOCK_FAIL | EWDG_INT_CTRL_REG_UPDATE_FAIL | \
  71. EWDG_INT_TIMEOUT | EWDG_INT_REFRESH_UNLOCK_FAIL | EWDG_INT_REFRESH_VIOLATION)
  72. /**
  73. * @}
  74. */
  75. /**
  76. * @brief EWDG Resets
  77. *
  78. * @defgroup ewdg_reset_source EWDG reset source definitions
  79. * @{
  80. */
  81. #define EWDG_RST_PARITY_FAIL (1UL << 3) /*!< Parity Error Reset */
  82. #define EWDG_RST_CTRL_REG_UNLOCK_FAIL (1UL << 5) /*!< Unlock Control Register Fail Reset */
  83. #define EWDG_RST_CTRL_REG_UPDATE_FAIL (1UL << 7) /*!< Update Control Register Violation Reset */
  84. #define EWDG_RST_TIMEOUT (1UL << 17) /*!< Watchdog Timeout Reset */
  85. #define EWDG_RST_REFRESH_UNLOCK_FAIL (1UL << 21) /*!< Refresh Register Unlock Fail Reset */
  86. #define EWDG_RST_REFRESH_VIOLATION (1UL << 23) /*!< Refresh Register Violation Reset */
  87. /*! All Reset masks */
  88. #define EWDG_RST_ALL (EWDG_RST_PARITY_FAIL | EWDG_RST_CTRL_REG_UNLOCK_FAIL | EWDG_RST_CTRL_REG_UPDATE_FAIL | \
  89. EWDG_RST_TIMEOUT | EWDG_RST_REFRESH_UNLOCK_FAIL | EWDG_RST_REFRESH_VIOLATION)
  90. /**
  91. * @}
  92. */
  93. /**
  94. * @brief EWDG Refresh Unlock Methods
  95. */
  96. typedef enum {
  97. /*! Use the Unlock Password directly */
  98. ewdg_refresh_unlock_method_password = 0,
  99. /*! Use password[14:0] | password[15] */
  100. ewdg_refresh_unlock_method_ring_left_shift_password_by_1 = 1,
  101. /*! Use fixed key: 0x55AA */
  102. ewdg_refresh_unlock_method_fixed_key = 2,
  103. /*! Use last_password[14:0] | (last_password[15] ^ password[0]) */
  104. ewdg_refresh_unlock_method_ring_left_shift_password_by_1_bit0_xor_password_bit0 = 3,
  105. /*! Max allowed range */
  106. ewdg_refresh_unlock_method_max = ewdg_refresh_unlock_method_ring_left_shift_password_by_1_bit0_xor_password_bit0
  107. } ewdg_refresh_unlock_method_t;
  108. /**
  109. * @brief EWDG Clock source for internal counter
  110. */
  111. typedef enum {
  112. ewdg_cnt_clk_src_bus_clk, /*!< Clock is from BUS clock */
  113. ewdg_cnt_clk_src_ext_osc_clk, /*!< Clock is from External OSC */
  114. } ewdg_cnt_clk_sel_t;
  115. /**
  116. * @brief EWDG Lower Window Limitations
  117. */
  118. typedef enum {
  119. /*! Refresh should be issued after 8/16 of timeout period */
  120. ewdg_window_lower_timeout_period_8_div_16 = 0,
  121. /*! Refresh should be issued after 10/16 of timeout period */
  122. ewdg_window_lower_timeout_period_10_div_16 = 1,
  123. /*! Refresh should be issued after 12/16 of timeout period */
  124. ewdg_window_lower_timeout_period_12_div_16 = 2,
  125. /*! Refresh should be issued after 14/16 of timeout period */
  126. ewdg_window_lower_timeout_period_14_div_16 = 3,
  127. /*! Maximum allowed limit value */
  128. ewdg_window_lower_timeout_period_max = ewdg_window_lower_timeout_period_14_div_16
  129. } ewdg_window_low_limit_t;
  130. /**
  131. * @brief EWDG Upper Window Limitations
  132. *
  133. * The Actual Upper Window = Lower Window + Upper Window Limit
  134. */
  135. typedef enum {
  136. ewdg_window_upper_timeout_period_8_div_16 = 0, /*!< 8/16 of timeout_reset_val */
  137. ewdg_window_upper_timeout_period_1_div_16 = 1, /*!< 1/16 of timeout_reset_val */
  138. ewdg_window_upper_timeout_period_2_div_16 = 2, /*!< 2/16 of timeout_reset_val */
  139. ewdg_window_upper_timeout_period_3_div_16 = 3, /*!< 3/16 of timeout_reset_val */
  140. ewdg_window_upper_timeout_period_4_div_16 = 4, /*!< 4/16 of timeout_reset_val */
  141. ewdg_window_upper_timeout_period_5_div_16 = 5, /*!< 5/16 of timeout_reset_val */
  142. ewdg_window_upper_timeout_period_6_div_16 = 6, /*!< 6/16 of timeout_reset_val */
  143. ewdg_window_upper_timeout_period_7_div_16 = 8, /*!< 7/16 of timeout_reset_val */
  144. /*! Maximum allowed upper limit */
  145. ewdg_window_upper_timeout_period_max = ewdg_window_upper_timeout_period_7_div_16
  146. } ewdg_window_upper_limit_t;
  147. typedef enum {
  148. ewdg_low_power_mode_halt = 0, /*!< Watchdog is halted in low power mode */
  149. ewdg_low_power_mode_work_clock_normal = 1, /*!< Watchdog is will work with normal clock in low power mode */
  150. } ewdg_low_power_mode_t;
  151. /***
  152. * @brief EWDG Function Control Configurations
  153. */
  154. typedef struct {
  155. ewdg_cnt_clk_sel_t cnt_clk_sel; /*!< Clock source for counter */
  156. bool enable_window_mode; /*!< Enable window mode */
  157. ewdg_window_low_limit_t window_lower_limit; /*!< Lower limit of the window */
  158. /*! Upper limit of the window
  159. * The real upper window = (window_lower_limit/8 + window_upper_limit/16) * timeout_reset_val
  160. */
  161. ewdg_window_upper_limit_t window_upper_limit;
  162. bool enable_config_lock; /*!< Enable Lock for the Configuration Registers */
  163. bool enable_refresh_period; /*!< Enable Refresh period */
  164. bool enable_refresh_lock; /*!< Enable Refresh lock */
  165. ewdg_refresh_unlock_method_t refresh_unlock_method; /*!< Method to unlock REFRESH_REG */
  166. bool enable_overtime_self_clear; /*!< Enable Over time self clear */
  167. bool keep_running_in_debug_mode; /*!< Keep running even in debug mode */
  168. ewdg_low_power_mode_t low_power_mode; /*!< Watchdog behavior in low power mode */
  169. /*!
  170. * Select timeout value type
  171. * - true: use the IP-level value (in terms of EWDG counter ticks)
  172. * - false: Use the user friendly timeout value (in terms of microseconds)
  173. */
  174. bool use_lowlevel_timeout;
  175. union {
  176. struct {
  177. uint32_t timeout_interrupt_us; /*!< Timeout value for interrupt (in terms of microseconds) */
  178. uint32_t timeout_reset_us; /*!< Timeout value for reset (in terms of microseconds */
  179. };
  180. struct {
  181. uint32_t timeout_interrupt_val; /*!< Timeout value for interrupt (in terms of counter ticks) */
  182. /*! Timeout value for reset (in terms of counter ticks
  183. * Note: timeout_reset_val must > timeout_interrupt_val
  184. */
  185. uint32_t timeout_reset_val;
  186. uint32_t clock_div_by_power_of_2; /*!< Power of 2 Divider */
  187. };
  188. };
  189. uint16_t refresh_period_in_bus_cycles; /*!< Refresh period */
  190. uint16_t refresh_unlock_password; /*!< Password for unlocking write to REFRESH_REG */
  191. uint16_t ctrl_reg_update_password; /*!< Update Password */
  192. uint16_t ctrl_reg_update_period_bus_clk_x_128; /*!< Update Period */
  193. } ewdg_func_ctrl_config_t;
  194. /**
  195. * @brief EWDG Reset and Interrupt Configurations
  196. */
  197. typedef struct {
  198. bool enable_ctrl_parity_fail_interrupt; /*!< Enable Parity Fail Interrupt */
  199. bool enable_ctrl_parity_fail_reset; /*!< Enable Parity Fail Reset */
  200. bool enable_ctrl_unlock_fail_interrupt; /*!< Enable Control Register Unlock Fail Interrupt */
  201. bool enable_ctrl_unlock_fail_reset; /*!< Enable Control Register Unlock Fail Reset */
  202. bool enable_ctrl_update_violation_interrupt; /*!< Enable Control Register Update Violation Interrupt */
  203. bool enable_ctrl_update_violation_reset; /*!< Enable Control Register Update Violation Reset */
  204. bool enable_timeout_interrupt; /*!< Enable Timeout Interrupt */
  205. bool enable_timeout_reset; /*!< Enable Timeout Reset */
  206. bool enable_refresh_unlock_fail_interrupt; /*!< Enable Refresh Unlock Fail Interrupt */
  207. bool enable_refresh_unlock_fail_reset; /*!< Enable Refresh Unlock Fail Reset */
  208. bool enable_refresh_violation_interrupt; /*!< Enable Refresh Violation Interrupt */
  209. bool enable_refresh_violation_reset; /*!< Enable Refresh Violation Reset */
  210. } ewdg_interrupt_reset_config_t;
  211. /**
  212. * @brief Enhanced Watchdog Configuration Structure
  213. */
  214. typedef struct {
  215. ewdg_interrupt_reset_config_t int_rst_config; /*!< Error Control Configuration */
  216. ewdg_func_ctrl_config_t ctrl_config; /*!< Function Control Configuration */
  217. bool enable_watchdog; /*!< Enable Watchdog */
  218. uint32_t cnt_src_freq; /*!< Frequency for the clock used as the counter clock source */
  219. } ewdg_config_t;
  220. /**
  221. * @brief Check whether the Control Registers are locked
  222. *
  223. * @param [in] ptr EWDG base
  224. *
  225. * @retval true Control Registers are locked
  226. * @retval false Control Registers are unlocked
  227. */
  228. static inline bool ewdg_is_ctrl_reg_locked(EWDG_Type *ptr)
  229. {
  230. return ((ptr->CTRL0 & EWDG_CTRL0_CFG_LOCK_MASK) != 0U);
  231. }
  232. /**
  233. * @brief Get the Divider for Counter Clock
  234. *
  235. * @param [in] ptr EWDG base
  236. *
  237. * @return divider value
  238. */
  239. static inline uint32_t ewdg_get_count_clk_divider(EWDG_Type *ptr)
  240. {
  241. return (1UL << EWDG_CTRL0_DIV_VALUE_GET(ptr->CTRL0));
  242. }
  243. /**
  244. * @brief Check whether the Refresh register is locked
  245. *
  246. * @param [in] ptr EWDG base
  247. *
  248. * @retval true Control Registers are locked
  249. * @retval false Control Registers are unlocked
  250. */
  251. static inline bool ewdg_is_refresh_locked(EWDG_Type *ptr)
  252. {
  253. return ((ptr->CTRL0 & EWDG_CTRL0_REF_LOCK_MASK) != 0U);
  254. }
  255. /**
  256. * @brief Unlock Write to Control Registers
  257. *
  258. * @param [in] ptr EWDG base
  259. */
  260. static inline void ewdg_unlock_ctrl_regs(EWDG_Type *ptr)
  261. {
  262. uint32_t ctrl_update_prot = ptr->CFG_PROT;
  263. ptr->CFG_PROT = ctrl_update_prot;
  264. }
  265. /**
  266. * @brief Write Refresh Magic Number to EWDG Refresh register
  267. * @param [in] ptr EWDG base
  268. */
  269. static inline void ewdg_write_refresh_reg(EWDG_Type *ptr)
  270. {
  271. ptr->WDT_REFRESH_REG = EWDG_REFRESH_KEY;
  272. }
  273. /**
  274. * @brief Get the Timeout Reset ticks
  275. * @param [in] ptr EWDG base
  276. * @return Timeout Reset ticks
  277. */
  278. static inline uint32_t ewdg_get_timeout_reset_ticks(EWDG_Type *ptr)
  279. {
  280. return ptr->OT_RST_VAL;
  281. }
  282. #if !defined(EWDG_SOC_SUPPORT_TIMEOUT_INTERRUPT) || (EWDG_SOC_SUPPORT_TIMEOUT_INTERRUPT == 1)
  283. /**
  284. * @brief Get the Timeout Interrupt ticks
  285. * @param [in] ptr EWDG base
  286. * @return Timeout Interrupt ticks
  287. */
  288. static inline uint32_t ewdg_get_timeout_interrupt_ticks(EWDG_Type *ptr)
  289. {
  290. return ptr->OT_INT_VAL;
  291. }
  292. #endif
  293. /**
  294. * @brief Clear Interrupt Status for EWDG
  295. *
  296. * @note The TIMEOUT_INT_EVENT cannot be cleared directly, it needs to be cleared by the refresh sequence
  297. *
  298. * @param [in] ptr EWDG base
  299. * @param [in] mask Status Mask Bits, @ref ewdg_event
  300. */
  301. static inline void ewdg_clear_status_flags(EWDG_Type *ptr, uint32_t mask)
  302. {
  303. ptr->WDT_STATUS = mask;
  304. }
  305. /**
  306. * @brief Get the Status of EWDG
  307. *
  308. * @param [in] ptr EWDG base
  309. *
  310. * @return STATUS register value
  311. */
  312. static inline uint32_t ewdg_get_status_flags(EWDG_Type *ptr)
  313. {
  314. return ptr->WDT_STATUS;
  315. }
  316. /**
  317. * @brief Get the Refresh Unlock Mechanism
  318. * @param [in] ptr EWDG base
  319. * @return EWDG refresh unlock method
  320. */
  321. static inline ewdg_refresh_unlock_method_t ewdg_get_refresh_unlock_method(EWDG_Type *ptr)
  322. {
  323. return (ewdg_refresh_unlock_method_t) (EWDG_CTRL0_REF_UNLOCK_MEC_GET(ptr->CTRL0));
  324. }
  325. /**
  326. * @brief Enable EWDG
  327. *
  328. * This function enables the functionality of the EWDG and start the watchdog timer
  329. *
  330. * @param [in] ptr EWDG base
  331. *
  332. * @note Once the EWDG is enabled,
  333. * - if the software needs to update the control register, the update unlock must be
  334. * performed first if the control register lock is enabled.
  335. *
  336. */
  337. void ewdg_enable(EWDG_Type *ptr);
  338. /**
  339. * @brief Disable EWDG
  340. * @param [in] ptr EWDG base
  341. */
  342. void ewdg_disable(EWDG_Type *ptr);
  343. /**
  344. * @brief Initialize the Control function for EWDG
  345. *
  346. * @param [in] ptr EWDG base
  347. * @param [in] config Control Function Configuration
  348. * @param [in] cnt_src_freq Source frequency for EWDG counter
  349. *
  350. * @retval status_invalid_argument Invalid argument was detected
  351. * @retval status_success No error happened
  352. */
  353. hpm_stat_t ewdg_init_ctrl_func(EWDG_Type *ptr, ewdg_func_ctrl_config_t *config, uint32_t cnt_src_freq);
  354. /**
  355. * @brief Initialize the Error function for EWDG
  356. *
  357. * @param [in] ptr EWDG base
  358. * @param [in] config Error Function Configuration
  359. *
  360. * @retval status_invalid_argument Invalid argument was detected
  361. * @retval status_success No error happened
  362. */
  363. hpm_stat_t ewdg_init_interrupt_reset(EWDG_Type *ptr, ewdg_interrupt_reset_config_t *config);
  364. /**
  365. * @brief Get default configuration for EWDG
  366. * @param [in] ptr EWDG base
  367. * @param [out] config EWDG Configuration
  368. */
  369. void ewdg_get_default_config(EWDG_Type *ptr, ewdg_config_t *config);
  370. /**
  371. * @brief Initialize the EWDG module
  372. *
  373. * @param [in] ptr EWDG base
  374. * @param [in] config EWDG configuration
  375. *
  376. * @retval status_invalid_argument Invalid argument was detected
  377. * @retval status_success No error happened
  378. */
  379. hpm_stat_t ewdg_init(EWDG_Type *ptr, ewdg_config_t *config);
  380. /**
  381. * @brief Unlock the write to refresh register
  382. *
  383. * @param [in] ptr EWDG base
  384. *
  385. * @retval status_invalid_argument Invalid argument was detected
  386. * @retval status_success No error happened
  387. */
  388. hpm_stat_t ewdg_unlock_refresh(EWDG_Type *ptr);
  389. /**
  390. * @brief Refresh EWDG
  391. *
  392. * @param [in] ptr EWDG base
  393. *
  394. * @retval status_invalid_argument Invalid argument was detected
  395. * @retval status_success No error happened
  396. */
  397. hpm_stat_t ewdg_refresh(EWDG_Type *ptr);
  398. /**
  399. * @brief Get the Divided Counter Clock Frequency for EWDG
  400. *
  401. * @param [in] ptr EWDG base
  402. * @param [in] src_clk_freq Source clock of the Counter clock
  403. *
  404. * @return divided Counter clock Frequency
  405. */
  406. uint32_t ewdg_get_count_clock_freq(EWDG_Type *ptr, uint32_t src_clk_freq);
  407. /**
  408. * @brief Convert the timeout in terms of microseconds to the timeout in terms of timeout ticks
  409. *
  410. * @param [in] src_clk_freq Clock Frequency of the counter clock source
  411. * @param [in] timeout_us Timeout in terms of microseconds
  412. *
  413. * @return timeout in terms of counter clock ticks
  414. */
  415. uint64_t ewdg_convert_timeout_us_to_timeout_ticks(uint32_t src_clk_freq, uint32_t timeout_us);
  416. /**
  417. * @brief Convert the timeout in terms of timeout ticks to the timeout in terms of microseconds
  418. *
  419. * @param [in] ptr EWDG base
  420. * @param [in] src_clk_freq Clock Frequency of the counter clock source
  421. * @param [in] timeout_ticks Timeout in terms of ticks
  422. *
  423. * @return timeout in terms of counter clock ticks
  424. */
  425. uint32_t ewdg_convert_timeout_ticks_to_timeout_us(EWDG_Type *ptr, uint32_t src_clk_freq, uint32_t timeout_ticks);
  426. /**
  427. * @brief Enable EWDG interrupt
  428. * @param [in] ptr EWDG base
  429. * @param [in] mask Interrupt Mask, valid value refer to @ref ewdg_interrupt
  430. */
  431. void ewdg_enable_interrupt(EWDG_Type *ptr, uint32_t mask);
  432. /**
  433. * @brief Disable EWDG interrupt
  434. * @param [in] ptr EWDG base
  435. * @param [in] mask Interrupt Mask, valid value refer to @ref ewdg_interrupt
  436. */
  437. void ewdg_disable_interrupt(EWDG_Type *ptr, uint32_t mask);
  438. /**
  439. * @brief Enable EWDG Reset
  440. * @param [in] ptr EWDG base
  441. * @param [in] mask Reset Mask, valid value refer to @ref ewdg_reset_source
  442. */
  443. void ewdg_enable_reset(EWDG_Type *ptr, uint32_t mask);
  444. /**
  445. * @brief Disable EWDG Reset
  446. * @param [in] ptr EWDG base
  447. * @param [in] mask Reset Mask, valid value refer to @ref ewdg_reset_source
  448. */
  449. void ewdg_disable_reset(EWDG_Type *ptr, uint32_t mask);
  450. /**
  451. * @brief Switch the EWDG clock source
  452. * @param [in] ptr EWDG base
  453. * @param [in] clk_sel Clock source selection for EWDG counter
  454. */
  455. void ewdg_switch_clock_source(EWDG_Type *ptr, ewdg_cnt_clk_sel_t clk_sel);
  456. #ifdef __cplusplus
  457. }
  458. #endif
  459. /**
  460. * @}
  461. */
  462. #endif /* HPM_EWDG_DRV_H */