Skip to content

Commit e27abee

Browse files
cvinayakcarlescufi
authored andcommitted
Bluetooth: controller: split: Schedule first conn event ASAP
Enable ticker job mayfly as soon as possible when establishing connection. This is required so as to not miss the first connection event in slow CPU like in nRF51 series. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 6b31d67 commit e27abee

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

subsys/bluetooth/controller/ll_sw/ull_master.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,6 @@ void ull_master_setup(memq_link_t *link, struct node_rx_hdr *rx,
417417
u32_t conn_offset_us, conn_interval_us;
418418
u8_t ticker_id_scan, ticker_id_conn;
419419
u32_t ticks_slot_overhead;
420-
u32_t mayfly_was_enabled;
421420
u32_t ticks_slot_offset;
422421
struct ll_scan_set *scan;
423422
struct node_rx_cc *cc;
@@ -551,8 +550,6 @@ void ull_master_setup(memq_link_t *link, struct node_rx_hdr *rx,
551550
/* disable ticker job, in order to chain stop and start to avoid RTC
552551
* being stopped if no tickers active.
553552
*/
554-
mayfly_was_enabled = mayfly_is_enabled(TICKER_USER_ID_ULL_HIGH,
555-
TICKER_USER_ID_ULL_LOW);
556553
mayfly_enable(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 0);
557554
#endif
558555

@@ -589,13 +586,10 @@ void ull_master_setup(memq_link_t *link, struct node_rx_hdr *rx,
589586
(ticker_status == TICKER_STATUS_BUSY));
590587

591588
#if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO)
592-
/* enable ticker job, if disabled in this function */
593-
if (mayfly_was_enabled) {
594-
mayfly_enable(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW,
595-
1);
596-
}
597-
#else
598-
ARG_UNUSED(mayfly_was_enabled);
589+
/* enable ticker job, irrespective of disabled in this function so
590+
* first connection event can be scheduled as soon as possible.
591+
*/
592+
mayfly_enable(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1);
599593
#endif
600594
}
601595

subsys/bluetooth/controller/ll_sw/ull_slave.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ void ull_slave_setup(memq_link_t *link, struct node_rx_hdr *rx,
5252
u8_t ticker_id_adv, ticker_id_conn;
5353
u8_t peer_addr[BDADDR_SIZE];
5454
u32_t ticks_slot_overhead;
55-
u32_t mayfly_was_enabled;
5655
u32_t ticks_slot_offset;
5756
struct pdu_adv *pdu_adv;
5857
struct ll_adv_set *adv;
@@ -240,8 +239,6 @@ void ull_slave_setup(memq_link_t *link, struct node_rx_hdr *rx,
240239
/* disable ticker job, in order to chain stop and start to avoid RTC
241240
* being stopped if no tickers active.
242241
*/
243-
mayfly_was_enabled = mayfly_is_enabled(TICKER_USER_ID_ULL_HIGH,
244-
TICKER_USER_ID_ULL_LOW);
245242
mayfly_enable(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 0);
246243
#endif
247244

@@ -284,13 +281,10 @@ void ull_slave_setup(memq_link_t *link, struct node_rx_hdr *rx,
284281
(ticker_status == TICKER_STATUS_BUSY));
285282

286283
#if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO)
287-
/* enable ticker job, if disabled in this function */
288-
if (mayfly_was_enabled) {
289-
mayfly_enable(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW,
290-
1);
291-
}
292-
#else
293-
ARG_UNUSED(mayfly_was_enabled);
284+
/* enable ticker job, irrespective of disabled in this function so
285+
* first connection event can be scheduled as soon as possible.
286+
*/
287+
mayfly_enable(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1);
294288
#endif
295289
}
296290

0 commit comments

Comments
 (0)