Skip to content

Commit 3b48d3f

Browse files
committed
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.
1 parent a707fd1 commit 3b48d3f

File tree

1 file changed

+0
-31
lines changed

1 file changed

+0
-31
lines changed

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NORDIC_CORDIO/TARGET_NRF5x/NRFCordioHCIDriver.cpp

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
// mbed Includes
2323
#include "mbed_assert.h"
24-
#include "rtos/source/rtos_idle.h"
2524
#include "platform/mbed_power_mgmt.h"
2625
#include "mbed_critical.h"
2726

@@ -183,30 +182,6 @@ const LlRtCfg_t NRFCordioHCIDriver::_ll_cfg = {
183182

184183
extern "C" void TIMER0_IRQHandler(void);
185184

186-
static void idle_hook(void)
187-
{
188-
wsfTimerTicks_t nextExpiration;
189-
bool_t timerRunning;
190-
191-
nextExpiration = WsfTimerNextExpiration(&timerRunning);
192-
if(timerRunning && nextExpiration > 0)
193-
{
194-
// Make sure we hae enough time to go to sleep
195-
if( nextExpiration < 1 /* 10 ms per tick which is long enough to got to sleep */ )
196-
{
197-
// Bail
198-
return;
199-
}
200-
}
201-
202-
// critical section to complete sleep with locked deepsleep
203-
core_util_critical_section_enter();
204-
sleep_manager_lock_deep_sleep();
205-
sleep();
206-
sleep_manager_unlock_deep_sleep();
207-
core_util_critical_section_exit();
208-
}
209-
210185
NRFCordioHCIDriver::NRFCordioHCIDriver(CordioHCITransportDriver& transport_driver) : cordio::CordioHCIDriver(transport_driver), _is_init(false), _stack_buffer(NULL)
211186
{
212187
_stack_buffer = (uint8_t*)malloc(CORDIO_LL_MEMORY_FOOTPRINT);
@@ -234,9 +209,6 @@ NRFCordioHCIDriver::~NRFCordioHCIDriver()
234209
free(_stack_buffer);
235210
_stack_buffer = NULL;
236211

237-
// Restore RTOS idle thread
238-
rtos_attach_idle_hook(NULL);
239-
240212
MBED_ASSERT(_stack_buffer == NULL);
241213
}
242214

@@ -281,9 +253,6 @@ void NRFCordioHCIDriver::do_initialize()
281253
.freeMemAvail = CORDIO_LL_MEMORY_FOOTPRINT
282254
};
283255

284-
// Override RTOS idle thread
285-
rtos_attach_idle_hook(idle_hook);
286-
287256
/* switch to more accurate 16 MHz crystal oscillator (system starts up using 16MHz RC oscillator) */
288257
NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
289258
NRF_CLOCK->TASKS_HFCLKSTART = 1;

0 commit comments

Comments
 (0)