From 186a584d0a519f13c59c1f88d678f4d66942240f Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Thu, 12 Sep 2019 08:37:32 +0530 Subject: [PATCH] Bluetooth: controller: split: cond. compile job disable When ULL High and ULL Low are not at same execution priority level, it is not necessary to disable ULL Low execution when updating ticker using stop and start. Also, ULL Low need not be disable inside Radio Events. This commit corrects some of the conditional compiles. Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/ull_conn.c | 9 ++++----- subsys/bluetooth/controller/ll_sw/ull_master.c | 2 +- subsys/bluetooth/controller/ll_sw/ull_slave.c | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn.c b/subsys/bluetooth/controller/ll_sw/ull_conn.c index d65b7debf40..54c5c0fc46c 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn.c +++ b/subsys/bluetooth/controller/ll_sw/ull_conn.c @@ -1535,11 +1535,6 @@ static void conn_cleanup(struct ll_conn *conn, u8_t reason) /* flush demux-ed Tx buffer still in ULL context */ tx_ull_flush(conn); - /* Enable Ticker Job, we are in a radio event which disabled it if - * worker0 and job0 priority where same. - */ - mayfly_enable(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1); - /* Stop Master or Slave role ticker */ ticker_status = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, @@ -2097,6 +2092,7 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, u16_t lazy, conn->supervision_expire = 0U; } +#if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) /* disable ticker job, in order to chain stop and start * to avoid RTC being stopped if no tickers active. */ @@ -2104,6 +2100,7 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, u16_t lazy, TICKER_USER_ID_ULL_LOW); mayfly_enable(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 0); +#endif /* start slave/master with new timings */ ticker_id_conn = TICKER_ID_CONN_BASE + ll_conn_handle_get(conn); @@ -2140,11 +2137,13 @@ static inline int event_conn_upd_prep(struct ll_conn *conn, u16_t lazy, LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || (ticker_status == TICKER_STATUS_BUSY)); +#if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) /* enable ticker job, if disabled in this function */ if (mayfly_was_enabled) { mayfly_enable(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1); } +#endif return 0; } diff --git a/subsys/bluetooth/controller/ll_sw/ull_master.c b/subsys/bluetooth/controller/ll_sw/ull_master.c index 019ac37e6de..49f4558b8a8 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_master.c +++ b/subsys/bluetooth/controller/ll_sw/ull_master.c @@ -541,10 +541,10 @@ void ull_master_setup(memq_link_t *link, struct node_rx_hdr *rx, conn_offset_us -= EVENT_OVERHEAD_START_US; conn_offset_us -= ftr->us_radio_rdy; +#if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) /* disable ticker job, in order to chain stop and start to avoid RTC * being stopped if no tickers active. */ -#if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) mayfly_was_enabled = mayfly_is_enabled(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW); mayfly_enable(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 0); diff --git a/subsys/bluetooth/controller/ll_sw/ull_slave.c b/subsys/bluetooth/controller/ll_sw/ull_slave.c index e2845f1bcb9..15002b8d7cb 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_slave.c +++ b/subsys/bluetooth/controller/ll_sw/ull_slave.c @@ -236,10 +236,10 @@ void ull_slave_setup(memq_link_t *link, struct node_rx_hdr *rx, conn_offset_us -= EVENT_JITTER_US; conn_offset_us -= ftr->us_radio_rdy; +#if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) /* disable ticker job, in order to chain stop and start to avoid RTC * being stopped if no tickers active. */ -#if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) mayfly_was_enabled = mayfly_is_enabled(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW); mayfly_enable(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 0);