NRFCordioHCIDriver: remove idle_hook

In PR #8876 when we added Cordio support for nRF52* targets,
we attempted to use an RTOS idle hook to workaround sleep
latency issues. However, the condition to bypass sleeps
never gets satisfied, and BLE nRF52* targets have generally
worked fine over the past year.

This commit removes the hook to avoid dependency on RTOS,
enabling BLE on bare metal.
pull/12956/head
Lingkai Dong 2020-05-11 17:34:03 +01:00
parent a707fd133e
commit 3b48d3f198
1 changed files with 0 additions and 31 deletions

View File

@ -21,7 +21,6 @@
// mbed Includes
#include "mbed_assert.h"
#include "rtos/source/rtos_idle.h"
#include "platform/mbed_power_mgmt.h"
#include "mbed_critical.h"
@ -183,30 +182,6 @@ const LlRtCfg_t NRFCordioHCIDriver::_ll_cfg = {
extern "C" void TIMER0_IRQHandler(void);
static void idle_hook(void)
{
wsfTimerTicks_t nextExpiration;
bool_t timerRunning;
nextExpiration = WsfTimerNextExpiration(&timerRunning);
if(timerRunning && nextExpiration > 0)
{
// Make sure we hae enough time to go to sleep
if( nextExpiration < 1 /* 10 ms per tick which is long enough to got to sleep */ )
{
// Bail
return;
}
}
// critical section to complete sleep with locked deepsleep
core_util_critical_section_enter();
sleep_manager_lock_deep_sleep();
sleep();
sleep_manager_unlock_deep_sleep();
core_util_critical_section_exit();
}
NRFCordioHCIDriver::NRFCordioHCIDriver(CordioHCITransportDriver& transport_driver) : cordio::CordioHCIDriver(transport_driver), _is_init(false), _stack_buffer(NULL)
{
_stack_buffer = (uint8_t*)malloc(CORDIO_LL_MEMORY_FOOTPRINT);
@ -234,9 +209,6 @@ NRFCordioHCIDriver::~NRFCordioHCIDriver()
free(_stack_buffer);
_stack_buffer = NULL;
// Restore RTOS idle thread
rtos_attach_idle_hook(NULL);
MBED_ASSERT(_stack_buffer == NULL);
}
@ -281,9 +253,6 @@ void NRFCordioHCIDriver::do_initialize()
.freeMemAvail = CORDIO_LL_MEMORY_FOOTPRINT
};
// Override RTOS idle thread
rtos_attach_idle_hook(idle_hook);
/* switch to more accurate 16 MHz crystal oscillator (system starts up using 16MHz RC oscillator) */
NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
NRF_CLOCK->TASKS_HFCLKSTART = 1;