17#include "platform/nrf_802154_clock.h"
21static volatile bool hfclk_running;
22static volatile bool lfclk_running;
25set_constant_latency(
bool enable)
27#if defined(POWER_TASKS_CONSTLAT_TASKS_CONSTLAT_Msk) && defined(POWER_TASKS_LOWPWR_TASKS_LOWPWR_Msk)
29 NRF_POWER->TASKS_CONSTLAT = POWER_TASKS_CONSTLAT_TASKS_CONSTLAT_Trigger;
31 NRF_POWER->TASKS_LOWPWR = POWER_TASKS_LOWPWR_TASKS_LOWPWR_Trigger;
39nrf_802154_clock_init(
void)
42 set_constant_latency(
false);
46 NRF_CLOCK->EVENTS_XOSTARTED = 0;
47 NRF_CLOCK->TASKS_XOSTART = 1;
48 while(NRF_CLOCK->EVENTS_XOSTARTED == 0) {
50 NRF_CLOCK->EVENTS_XOSTARTED = 0;
52 NRF_CLOCK->EVENTS_PLLSTARTED = 0;
53 NRF_CLOCK->TASKS_PLLSTART = 1;
54 while(NRF_CLOCK->EVENTS_PLLSTARTED == 0) {
56 NRF_CLOCK->EVENTS_PLLSTARTED = 0;
62nrf_802154_clock_deinit(
void)
68nrf_802154_clock_hfclk_start(
void)
77 NRF_CLOCK->EVENTS_XOSTARTED = 0;
78 NRF_CLOCK->TASKS_XOSTART = 1;
79 while(NRF_CLOCK->EVENTS_XOSTARTED == 0) {
81 NRF_CLOCK->EVENTS_XOSTARTED = 0;
83 NRF_CLOCK->EVENTS_PLLSTARTED = 0;
84 NRF_CLOCK->TASKS_PLLSTART = 1;
85 while(NRF_CLOCK->EVENTS_PLLSTARTED == 0) {
87 NRF_CLOCK->EVENTS_PLLSTARTED = 0;
91 set_constant_latency(
true);
92 nrf_802154_clock_hfclk_ready();
96nrf_802154_clock_hfclk_stop(
void)
100 set_constant_latency(
false);
104nrf_802154_clock_hfclk_is_running(
void)
106 return hfclk_running;
110nrf_802154_clock_lfclk_start(
void)
115 lfclk_running =
true;
116 nrf_802154_clock_lfclk_ready();
120nrf_802154_clock_lfclk_stop(
void)
126nrf_802154_clock_lfclk_is_running(
void)
128 return lfclk_running;