nimble/ll: Add hfxo request/release API

Per code review, the new nrfx API are now only used if MYNEWT
is set to a non-zero value. For non-MYNEWT builds the nordic
clock register is accessed directly.
This commit is contained in:
William San Filippo
2018-11-12 16:02:18 -08:00
parent 4df479f2c8
commit 7ebe68fbc6
2 changed files with 22 additions and 3 deletions
+12 -1
View File
@@ -30,7 +30,10 @@
#include "controller/ble_phy_trace.h"
#include "controller/ble_ll.h"
#include "nrfx.h"
#if MYNEWT
#include "mcu/nrf51_clock.h"
#endif
/* XXX: 4) Make sure RF is higher priority interrupt than schedule */
@@ -817,7 +820,7 @@ ble_phy_init(void)
#if !defined(BLE_XCVR_RFCLK)
/* BLE wants the HFXO on all the time in this case */
nrf51_clock_hfxo_request();
ble_phy_rfclk_enable();
/*
* XXX: I do not think we need to wait for settling time here since
@@ -1474,12 +1477,20 @@ ble_phy_resolv_list_disable(void)
void
ble_phy_rfclk_enable(void)
{
#if MYNEWT
nrf51_clock_hfxo_request();
#else
NRF_CLOCK->TASKS_HFCLKSTART = 1;
#endif
}
void
ble_phy_rfclk_disable(void)
{
#if MYNEWT
nrf51_clock_hfxo_release();
#else
NRF_CLOCK->TASKS_HFCLKSTOP = 1;
#endif
}
#endif
+10 -2
View File
@@ -30,8 +30,8 @@
#include "controller/ble_phy_trace.h"
#include "controller/ble_ll.h"
#include "nrfx.h"
#include "mcu/nrf52_clock.h"
#if MYNEWT
#include "mcu/nrf52_clock.h"
#include "mcu/cmsis_nvic.h"
#include "hal/hal_gpio.h"
#else
@@ -1353,7 +1353,7 @@ ble_phy_init(void)
#if !defined(BLE_XCVR_RFCLK)
/* BLE wants the HFXO on all the time in this case */
nrf52_clock_hfxo_request();
ble_phy_rfclk_enable();
/*
* XXX: I do not think we need to wait for settling time here since
@@ -2035,12 +2035,20 @@ void ble_phy_disable_dtm(void)
void
ble_phy_rfclk_enable(void)
{
#if MYNEWT
nrf52_clock_hfxo_request();
#else
NRF_CLOCK->TASKS_HFCLKSTART = 1;
#endif
}
void
ble_phy_rfclk_disable(void)
{
#if MYNEWT
nrf52_clock_hfxo_release();
#else
NRF_CLOCK->TASKS_HFCLKSTOP = 1;
#endif
}
#endif