Skip to content

Commit f466cb5

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 a8ca36c commit f466cb5

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
@@ -292,6 +292,30 @@ int nrf_clock_control_cancel_or_release(const struct device *dev,
292292
return api->cancel_or_release(dev, spec, cli);
293293
}
294294

295+
/** @brief Request the HFXO from Zero Latency Interrupt context.
296+
*
297+
* Function is optimized for use in Zero Latency Interrupt context.
298+
* It does not give notification when the HFXO is ready, so each
299+
* user must put the request early enough to make sure the HFXO
300+
* ramp-up has finished on time.
301+
*
302+
* This function uses reference counting so the caller must ensure
303+
* that every nrf_clock_control_hfxo_request() call has a matching
304+
* nrf_clock_control_hfxo_release() call.
305+
*/
306+
void nrf_clock_control_hfxo_request(void);
307+
308+
/** @brief Release the HFXO from Zero Latency Interrupt context.
309+
*
310+
* Function is optimized for use in Zero Latency Interrupt context.
311+
*
312+
* Calls to this function must be coupled with prior calls
313+
* to nrf_clock_control_hfxo_request(), because it uses basic
314+
* reference counting to make sure the HFXO is released when
315+
* there are no more pending requests.
316+
*/
317+
void nrf_clock_control_hfxo_release(void);
318+
295319
#endif /* defined(CONFIG_CLOCK_CONTROL_NRF2) */
296320

297321
#ifdef __cplusplus

0 commit comments

Comments
 (0)