@@ -276,6 +276,23 @@ NRF_STATIC_INLINE bool nrf_clock_event_check(NRF_CLOCK_Type const * p_reg, nrf_c
276276NRF_STATIC_INLINE bool nrf_clock_start_task_check(NRF_CLOCK_Type const * p_reg,
277277 nrf_clock_domain_t domain);
278278
279+ /**
280+ * @brief Function for retrieving the state of the clock.
281+ *
282+ * @param[in] p_reg Pointer to the structure of registers of the peripheral.
283+ * @param[in] domain Clock domain.
284+ * @param[out] p_clk_src Pointer to clock source that is running. Set to NULL if not needed.
285+ * Ignored for HFCLKAUDIO domain. Variable pointed by @p p_clk_src
286+ * must be of either @ref nrf_clock_lfclk_t type for LFCLK
287+ * or @ref nrf_clock_hfclk_t type for HFCLK and HFCLK192M.
288+ *
289+ * @retval false The clock is not running.
290+ * @retval true The clock is running.
291+ */
292+ NRF_STATIC_INLINE bool nrf_clock_is_running(NRF_CLOCK_Type const * p_reg,
293+ nrf_clock_domain_t domain,
294+ void * p_clk_src);
295+
279296/**
280297 * @brief Function for changing the low-frequency clock source.
281298 * @details This function cannot be called when the low-frequency clock is running.
@@ -329,6 +346,20 @@ NRF_STATIC_INLINE nrf_clock_lfclk_t nrf_clock_lf_srccopy_get(NRF_CLOCK_Type cons
329346 */
330347NRF_STATIC_INLINE nrf_clock_hfclk_t nrf_clock_hf_src_get(NRF_CLOCK_Type const * p_reg);
331348
349+ /**
350+ * @brief Function for retrieving the state of the HFCLK clock.
351+ *
352+ * @note This function is deprecated. Use @ref nrf_clock_is_running instead.
353+ *
354+ * @param[in] p_reg Pointer to the structure of registers of the peripheral.
355+ * @param[in] clk_src Clock source to be checked.
356+ *
357+ * @retval false The HFCLK clock is not running.
358+ * @retval true The HFCLK clock is running.
359+ */
360+ NRF_STATIC_INLINE bool nrf_clock_hf_is_running(NRF_CLOCK_Type const * p_reg,
361+ nrf_clock_hfclk_t clk_src);
362+
332363/**
333364 * @brief Function for changing the calibration timer interval.
334365 *
@@ -379,8 +410,8 @@ NRF_STATIC_INLINE nrf_clock_lfclk_t nrf_clock_lf_src_get(NRF_CLOCK_Type const *
379410}
380411
381412NRF_STATIC_INLINE bool nrf_clock_is_running(NRF_CLOCK_Type const * p_reg,
382- nrf_clock_domain_t domain,
383- void * p_clk_src)
413+ nrf_clock_domain_t domain,
414+ void * p_clk_src)
384415{
385416 switch (domain)
386417 {
@@ -450,6 +481,14 @@ NRF_STATIC_INLINE nrf_clock_hfclk_t nrf_clock_hf_src_get(NRF_CLOCK_Type const *
450481 >> CLOCK_HFCLKSTAT_SRC_Pos);
451482}
452483
484+ NRF_STATIC_INLINE bool nrf_clock_hf_is_running(NRF_CLOCK_Type const * p_reg,
485+ nrf_clock_hfclk_t clk_src)
486+ {
487+ nrf_clock_hfclk_t active_clk_src;
488+ bool ret = nrf_clock_is_running(p_reg, NRF_CLOCK_DOMAIN_HFCLK, &active_clk_src);
489+ return (ret && (active_clk_src == clk_src));
490+ }
491+
453492#ifdef __cplusplus
454493}
455494#endif
0 commit comments