Skip to content

Commit 56f909d

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 7c3bd68 commit 56f909d

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
@@ -317,6 +317,30 @@ int nrf_clock_control_cancel_or_release(const struct device *dev,
317317
return api->cancel_or_release(dev, spec, cli);
318318
}
319319

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

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

0 commit comments

Comments
 (0)