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 <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2019-10-08 12:00:21 +05:30 committed by Ioannis Glaropoulos
commit 92e017fd70
3 changed files with 28 additions and 5 deletions

View file

@ -516,7 +516,7 @@ config BT_CTLR_PHY_CODED
config BT_CTLR_ZLI
bool "Use Zero Latency IRQs"
depends on ZERO_LATENCY_IRQS
depends on ZERO_LATENCY_IRQS && BT_LL_SW_SPLIT
help
Enable support for use of Zero Latency IRQ feature. Note, applications
shall not use Zero Latency IRQ themselves when this option is selected,

View file

@ -33,6 +33,12 @@
#include "common/log.h"
#include "hal/debug.h"
#if defined(CONFIG_BT_CTLR_ZLI)
#define IRQ_CONNECT_FLAGS IRQ_ZERO_LATENCY
#else
#define IRQ_CONNECT_FLAGS 0
#endif
static struct {
struct {
void *param;
@ -158,11 +164,11 @@ int lll_init(void)
/* Connect ISRs */
IRQ_DIRECT_CONNECT(RADIO_IRQn, CONFIG_BT_CTLR_LLL_PRIO,
radio_nrf5_isr, 0);
radio_nrf5_isr, IRQ_CONNECT_FLAGS);
IRQ_CONNECT(RTC0_IRQn, CONFIG_BT_CTLR_ULL_HIGH_PRIO,
rtc0_nrf5_isr, NULL, 0);
IRQ_CONNECT(HAL_SWI_RADIO_IRQ, CONFIG_BT_CTLR_LLL_PRIO,
swi_lll_nrf5_isr, NULL, 0);
swi_lll_nrf5_isr, NULL, IRQ_CONNECT_FLAGS);
#if defined(CONFIG_BT_CTLR_LOW_LAT) || \
(CONFIG_BT_CTLR_ULL_HIGH_PRIO != CONFIG_BT_CTLR_ULL_LOW_PRIO)
IRQ_CONNECT(HAL_SWI_JOB_IRQ, CONFIG_BT_CTLR_ULL_LOW_PRIO,

View file

@ -406,21 +406,36 @@ void ll_reset(void)
/* Reset LLL via mayfly */
{
u32_t retval;
struct k_sem sem;
static memq_link_t link;
static struct mayfly mfy = {0, 0, &link, NULL,
perform_lll_reset};
u32_t retval;
/* NOTE: If Zero Latency Interrupt is used, then LLL context
* will be the highest priority IRQ in the system, hence
* mayfly_enqueue will be done running the callee inline
* (vector to the callee function) in this function. Else
* we use semaphore to wait for perform_lll_reset to
* complete.
*/
#if !defined(CONFIG_BT_CTLR_ZLI)
struct k_sem sem;
k_sem_init(&sem, 0, 1);
mfy.param = &sem;
#endif /* !CONFIG_BT_CTLR_ZLI */
retval = mayfly_enqueue(TICKER_USER_ID_THREAD,
TICKER_USER_ID_LLL, 0, &mfy);
LL_ASSERT(!retval);
#if !defined(CONFIG_BT_CTLR_ZLI)
/* LLL reset must complete before returning - wait for
* reset completion in LLL mayfly thread
*/
k_sem_take(&sem, K_FOREVER);
#endif /* !CONFIG_BT_CTLR_ZLI */
}
/* Common to init and reset */
@ -1210,7 +1225,9 @@ static void perform_lll_reset(void *param)
LL_ASSERT(!err);
#endif /* CONFIG_BT_CONN */
#if !defined(CONFIG_BT_CTLR_ZLI)
k_sem_give(param);
#endif /* !CONFIG_BT_CTLR_ZLI */
}
static inline void *mark_set(void **m, void *param)