Skip to content

Commit d0fc307

Browse files
bjarki-andreasenppryga-nordic
authored andcommitted
[nrf fromtree] drivers: clock_control: nrf: add zero-latency-isr safe APIs
Add zero latency interrupt safe APIs to allow requesting and releasing HFXO. These will be used from components running in zero latency interrupt context, like the bluetooth stack. Co-authored-by: Piotr Pryga <[email protected]> Signed-off-by: Bjarki Arge Andreasen <[email protected]> Signed-off-by: Piotr Pryga <[email protected]> (cherry picked from commit 2aec438) Signed-off-by: Piotr Pryga <[email protected]>
1 parent b6535f5 commit d0fc307

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

include/zephyr/drivers/clock_control/nrf_clock_control.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,30 @@ int nrf_clock_control_cancel_or_release(const struct device *dev,
309309
return api->cancel_or_release(dev, spec, cli);
310310
}
311311

312+
/** @brief Request the HFXO from Zero Latency Interrupt context.
313+
*
314+
* Function is optimized for use in Zero Latency Interrupt context.
315+
* It does not give notification when the HFXO is ready, so each
316+
* user must put the request early enough to make sure the HFXO
317+
* ramp-up has finished on time.
318+
*
319+
* This function uses reference counting so the caller must ensure
320+
* that every nrf_clock_control_hfxo_request() call has a matching
321+
* nrf_clock_control_hfxo_release() call.
322+
*/
323+
void nrf_clock_control_hfxo_request(void);
324+
325+
/** @brief Release the HFXO from Zero Latency Interrupt context.
326+
*
327+
* Function is optimized for use in Zero Latency Interrupt context.
328+
*
329+
* Calls to this function must be coupled with prior calls
330+
* to nrf_clock_control_hfxo_request(), because it uses basic
331+
* reference counting to make sure the HFXO is released when
332+
* there are no more pending requests.
333+
*/
334+
void nrf_clock_control_hfxo_release(void);
335+
312336
#endif /* defined(CONFIG_CLOCK_CONTROL_NRF2) */
313337

314338
/** @brief Get clock frequency that is used for the given node.

0 commit comments

Comments
 (0)