From 167eac7df3f7b0b6db71b09a0bef40e0df748702 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Mon, 19 Dec 2016 12:07:30 +0100 Subject: [PATCH] Bluetooth: controller: Move call to k_sem_give() out of the ISR The execution time of k_sem_give() increased slightly recently, and since it was being called from the radio ISR this had an impact in the deadlines not being met. This change moves the actual call to k_sem_give() to a lower-priority job and thus out of the ISR to avoid its execution time affecting the ISR's timing. Change-id: I76c82df895c6daaffef52786b0c900ee15acb0aa Signed-off-by: Vinayak Chettimada Signed-off-by: Carles Cufi --- subsys/bluetooth/controller/ll/ctrl.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/controller/ll/ctrl.c b/subsys/bluetooth/controller/ll/ctrl.c index 7b4ebd4571e..ceda331108e 100644 --- a/subsys/bluetooth/controller/ll/ctrl.c +++ b/subsys/bluetooth/controller/ll/ctrl.c @@ -5700,6 +5700,14 @@ static struct radio_pdu_node_rx *packet_rx_reserve_get(uint8_t count) return radio_pdu_node_rx; } +static void event_callback(void) +{ + static struct work work_event_callback = { 0, 0, 0, + WORK_TICKER_JOB0_IRQ, (work_fp) radio_event_callback, 0 }; + + work_schedule(&work_event_callback, 1); +} + static void packet_rx_enqueue(void) { void *link; @@ -5731,7 +5739,7 @@ static void packet_rx_enqueue(void) LL_ASSERT(link); /* callback to trigger application action */ - radio_event_callback(); + event_callback(); } static void packet_tx_enqueue(uint8_t max) @@ -5883,7 +5891,8 @@ static void pdu_node_tx_release(uint16_t handle, _radio.pkt_release[_radio.packet_release_last].node_tx = node_tx; _radio.packet_release_last = last; - radio_event_callback(); + /* callback to trigger application action */ + event_callback(); } static void connection_release(struct connection *conn) @@ -6014,7 +6023,7 @@ static void terminate_ind_rx_enqueue(struct connection *conn, uint8_t reason) LL_ASSERT(link); /* callback to trigger application action */ - radio_event_callback(); + event_callback(); } static uint32_t conn_update(struct connection *conn,