Skip to content

Commit 92e017f

Browse files
cvinayakioannisg
authored andcommitted
Bluetooth: controller: split: Support Zero Latency IRQs
Add support for Zero Latency IRQs, which avoids any Zephyr OS or application influenced ISR latencies on the controller's ISRs. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent dab1828 commit 92e017f

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

subsys/bluetooth/controller/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ config BT_CTLR_PHY_CODED
516516

517517
config BT_CTLR_ZLI
518518
bool "Use Zero Latency IRQs"
519-
depends on ZERO_LATENCY_IRQS
519+
depends on ZERO_LATENCY_IRQS && BT_LL_SW_SPLIT
520520
help
521521
Enable support for use of Zero Latency IRQ feature. Note, applications
522522
shall not use Zero Latency IRQ themselves when this option is selected,

subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@
3333
#include "common/log.h"
3434
#include "hal/debug.h"
3535

36+
#if defined(CONFIG_BT_CTLR_ZLI)
37+
#define IRQ_CONNECT_FLAGS IRQ_ZERO_LATENCY
38+
#else
39+
#define IRQ_CONNECT_FLAGS 0
40+
#endif
41+
3642
static struct {
3743
struct {
3844
void *param;
@@ -158,11 +164,11 @@ int lll_init(void)
158164

159165
/* Connect ISRs */
160166
IRQ_DIRECT_CONNECT(RADIO_IRQn, CONFIG_BT_CTLR_LLL_PRIO,
161-
radio_nrf5_isr, 0);
167+
radio_nrf5_isr, IRQ_CONNECT_FLAGS);
162168
IRQ_CONNECT(RTC0_IRQn, CONFIG_BT_CTLR_ULL_HIGH_PRIO,
163169
rtc0_nrf5_isr, NULL, 0);
164170
IRQ_CONNECT(HAL_SWI_RADIO_IRQ, CONFIG_BT_CTLR_LLL_PRIO,
165-
swi_lll_nrf5_isr, NULL, 0);
171+
swi_lll_nrf5_isr, NULL, IRQ_CONNECT_FLAGS);
166172
#if defined(CONFIG_BT_CTLR_LOW_LAT) || \
167173
(CONFIG_BT_CTLR_ULL_HIGH_PRIO != CONFIG_BT_CTLR_ULL_LOW_PRIO)
168174
IRQ_CONNECT(HAL_SWI_JOB_IRQ, CONFIG_BT_CTLR_ULL_LOW_PRIO,

subsys/bluetooth/controller/ll_sw/ull.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,21 +406,36 @@ void ll_reset(void)
406406

407407
/* Reset LLL via mayfly */
408408
{
409-
u32_t retval;
410-
struct k_sem sem;
411409
static memq_link_t link;
412410
static struct mayfly mfy = {0, 0, &link, NULL,
413411
perform_lll_reset};
412+
u32_t retval;
413+
414+
/* NOTE: If Zero Latency Interrupt is used, then LLL context
415+
* will be the highest priority IRQ in the system, hence
416+
* mayfly_enqueue will be done running the callee inline
417+
* (vector to the callee function) in this function. Else
418+
* we use semaphore to wait for perform_lll_reset to
419+
* complete.
420+
*/
421+
422+
#if !defined(CONFIG_BT_CTLR_ZLI)
423+
struct k_sem sem;
414424

415425
k_sem_init(&sem, 0, 1);
416426
mfy.param = &sem;
427+
#endif /* !CONFIG_BT_CTLR_ZLI */
428+
417429
retval = mayfly_enqueue(TICKER_USER_ID_THREAD,
418430
TICKER_USER_ID_LLL, 0, &mfy);
419431
LL_ASSERT(!retval);
432+
433+
#if !defined(CONFIG_BT_CTLR_ZLI)
420434
/* LLL reset must complete before returning - wait for
421435
* reset completion in LLL mayfly thread
422436
*/
423437
k_sem_take(&sem, K_FOREVER);
438+
#endif /* !CONFIG_BT_CTLR_ZLI */
424439
}
425440

426441
/* Common to init and reset */
@@ -1210,7 +1225,9 @@ static void perform_lll_reset(void *param)
12101225
LL_ASSERT(!err);
12111226
#endif /* CONFIG_BT_CONN */
12121227

1228+
#if !defined(CONFIG_BT_CTLR_ZLI)
12131229
k_sem_give(param);
1230+
#endif /* !CONFIG_BT_CTLR_ZLI */
12141231
}
12151232

12161233
static inline void *mark_set(void **m, void *param)

0 commit comments

Comments
 (0)