Skip to content

Commit

Permalink
[nrf fromtree] drivers: clock_control: nrf: add zero-latency-isr safe…
Browse files Browse the repository at this point in the history
… 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]>
  • Loading branch information
bjarki-andreasen authored and jukkar committed Dec 19, 2024
1 parent 2d9da2a commit bd64dc9
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions include/zephyr/drivers/clock_control/nrf_clock_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,30 @@ int nrf_clock_control_cancel_or_release(const struct device *dev,
return api->cancel_or_release(dev, spec, cli);
}

/** @brief Request the HFXO from Zero Latency Interrupt context.
*
* Function is optimized for use in Zero Latency Interrupt context.
* It does not give notification when the HFXO is ready, so each
* user must put the request early enough to make sure the HFXO
* ramp-up has finished on time.
*
* This function uses reference counting so the caller must ensure
* that every nrf_clock_control_hfxo_request() call has a matching
* nrf_clock_control_hfxo_release() call.
*/
void nrf_clock_control_hfxo_request(void);

/** @brief Release the HFXO from Zero Latency Interrupt context.
*
* Function is optimized for use in Zero Latency Interrupt context.
*
* Calls to this function must be coupled with prior calls
* to nrf_clock_control_hfxo_request(), because it uses basic
* reference counting to make sure the HFXO is released when
* there are no more pending requests.
*/
void nrf_clock_control_hfxo_release(void);

#endif /* defined(CONFIG_CLOCK_CONTROL_NRF2) */

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

0 comments on commit bd64dc9

Please sign in to comment.