Skip to content
Permalink
Browse files

bluetooth: controller: Update to use new EVENT_IFS_US define

Added a new define (EVENT_IFS_US) to pdu.h - this is now used instead of
previous TIFS_US from vendor specific header

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
  • Loading branch information...
erbr-ot authored and aescolar committed Apr 8, 2019
1 parent 1090b45 commit 1618c1b885ac1629b5fcb8f9fa6d0a46343c8643
@@ -327,7 +327,7 @@ static void isr_tx(void *param)
/* TODO: MOVE ^^ */

radio_isr_set(isr_rx, param);
radio_tmr_tifs_set(TIFS_US);
radio_tmr_tifs_set(EVENT_IFS_US);
radio_switch_complete_and_tx(0, 0, 0, 0);
radio_pkt_rx_set(radio_pkt_scratch_get());

@@ -347,7 +347,7 @@ static void isr_tx(void *param)
#endif /* CONFIG_BT_CTLR_PRIVACY */

/* +/- 2us active clock jitter, +1 us hcto compensation */
hcto = radio_tmr_tifs_base_get() + TIFS_US + 4 + 1;
hcto = radio_tmr_tifs_base_get() + EVENT_IFS_US + 4 + 1;
hcto += radio_rx_chain_delay_get(0, 0);
hcto += addr_us_get(0);
hcto -= radio_tx_chain_delay_get(0, 0);
@@ -371,7 +371,7 @@ static void isr_tx(void *param)
#endif /* CONFIG_BT_CTLR_PROFILE_ISR */

radio_gpio_lna_setup();
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + TIFS_US - 4 -
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + EVENT_IFS_US - 4 -
radio_tx_chain_delay_get(0, 0) -
CONFIG_BT_CTLR_GPIO_LNA_OFFSET);
#endif /* CONFIG_BT_CTLR_GPIO_LNA_PIN */
@@ -593,7 +593,7 @@ static void chan_prepare(struct lll_adv *lll)
(!IS_ENABLED(CONFIG_BT_CTLR_ADV_EXT) ||
(pdu->type != PDU_ADV_TYPE_EXT_IND))) {
radio_isr_set(isr_tx, lll);
radio_tmr_tifs_set(TIFS_US);
radio_tmr_tifs_set(EVENT_IFS_US);
radio_switch_complete_and_rx(0);
} else {
radio_isr_set(isr_done, lll);
@@ -661,7 +661,8 @@ static inline int isr_rx_pdu(struct lll_adv *lll,
#endif /* CONFIG_BT_CTLR_PROFILE_ISR */

radio_gpio_pa_setup();
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + TIFS_US -
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() +
EVENT_IFS_US -
radio_rx_chain_delay_get(0, 0) -
CONFIG_BT_CTLR_GPIO_PA_OFFSET);
#endif /* CONFIG_BT_CTLR_GPIO_PA_PIN */
@@ -247,7 +247,7 @@ void lll_conn_isr_rx(void *param)
}
} else {
radio_isr_set(lll_conn_isr_tx, param);
radio_tmr_tifs_set(TIFS_US);
radio_tmr_tifs_set(EVENT_IFS_US);

#if defined(CONFIG_BT_CTLR_PHY)
radio_switch_complete_and_rx(lll->phy_rx);
@@ -278,11 +278,11 @@ void lll_conn_isr_rx(void *param)
radio_gpio_pa_setup();

#if defined(CONFIG_BT_CTLR_PHY)
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + TIFS_US -
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + EVENT_IFS_US -
radio_rx_chain_delay_get(lll->phy_rx, 1) -
CONFIG_BT_CTLR_GPIO_PA_OFFSET);
#else /* !CONFIG_BT_CTLR_PHY */
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + TIFS_US -
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + EVENT_IFS_US -
radio_rx_chain_delay_get(0, 0) -
CONFIG_BT_CTLR_GPIO_PA_OFFSET);
#endif /* !CONFIG_BT_CTLR_PHY */
@@ -376,7 +376,7 @@ void lll_conn_isr_tx(void *param)
/* TODO: MOVE ^^ */

radio_isr_set(lll_conn_isr_rx, param);
radio_tmr_tifs_set(TIFS_US);
radio_tmr_tifs_set(EVENT_IFS_US);
#if defined(CONFIG_BT_CTLR_PHY)
radio_switch_complete_and_tx(lll->phy_rx, 0,
lll->phy_tx,
@@ -391,7 +391,8 @@ void lll_conn_isr_tx(void *param)
LL_ASSERT(!radio_is_ready());

/* +/- 2us active clock jitter, +1 us hcto compensation */
hcto = radio_tmr_tifs_base_get() + TIFS_US + 4 + RANGE_DELAY_US + 1;
hcto = radio_tmr_tifs_base_get() + EVENT_IFS_US + 4 +
RANGE_DELAY_US + 1;
#if defined(CONFIG_BT_CTLR_PHY)
hcto += radio_rx_chain_delay_get(lll->phy_rx, 1);
hcto += addr_us_get(lll->phy_rx);
@@ -418,12 +419,12 @@ void lll_conn_isr_tx(void *param)
#if defined(CONFIG_BT_CTLR_GPIO_LNA_PIN)
radio_gpio_lna_setup();
#if defined(CONFIG_BT_CTLR_PHY)
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + TIFS_US - 4 -
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + EVENT_IFS_US - 4 -
radio_tx_chain_delay_get(lll->phy_tx,
lll->phy_flags) -
CONFIG_BT_CTLR_GPIO_LNA_OFFSET);
#else /* !CONFIG_BT_CTLR_PHY */
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + TIFS_US - 4 -
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + EVENT_IFS_US - 4 -
radio_tx_chain_delay_get(0, 0) -
CONFIG_BT_CTLR_GPIO_LNA_OFFSET);
#endif /* !CONFIG_BT_CTLR_PHY */
@@ -151,7 +151,7 @@ static int prepare_cb(struct lll_prepare_param *prepare_param)

radio_isr_set(lll_conn_isr_tx, lll);

radio_tmr_tifs_set(TIFS_US);
radio_tmr_tifs_set(EVENT_IFS_US);

#if defined(CONFIG_BT_CTLR_PHY)
radio_switch_complete_and_rx(lll->phy_rx);
@@ -167,7 +167,7 @@ static int prepare_cb(struct lll_prepare_param *prepare_param)

radio_isr_set(isr_rx, lll);

radio_tmr_tifs_set(TIFS_US);
radio_tmr_tifs_set(EVENT_IFS_US);
radio_switch_complete_and_tx(0, 0, 0, 0);

#if defined(CONFIG_BT_CTLR_PRIVACY)
@@ -432,7 +432,7 @@ static void isr_tx(void *param)
LL_ASSERT(node_rx);

radio_isr_set(isr_rx, param);
radio_tmr_tifs_set(TIFS_US);
radio_tmr_tifs_set(EVENT_IFS_US);
radio_switch_complete_and_tx(0, 0, 0, 0);
radio_pkt_rx_set(node_rx->pdu);

@@ -448,7 +448,7 @@ static void isr_tx(void *param)
#endif /* CONFIG_BT_CTLR_PRIVACY */

/* +/- 2us active clock jitter, +1 us hcto compensation */
hcto = radio_tmr_tifs_base_get() + TIFS_US + 4 + 1;
hcto = radio_tmr_tifs_base_get() + EVENT_IFS_US + 4 + 1;
hcto += radio_rx_chain_delay_get(0, 0);
hcto += addr_us_get(0);
hcto -= radio_tx_chain_delay_get(0, 0);
@@ -459,7 +459,7 @@ static void isr_tx(void *param)

#if defined(CONFIG_BT_CTLR_GPIO_LNA_PIN)
radio_gpio_lna_setup();
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + TIFS_US - 4 -
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + EVENT_IFS_US - 4 -
radio_tx_chain_delay_get(0, 0) -
CONFIG_BT_CTLR_GPIO_LNA_OFFSET);
#endif /* CONFIG_BT_CTLR_GPIO_LNA_PIN */
@@ -487,7 +487,7 @@ static void isr_done(void *param)
node_rx = ull_pdu_rx_alloc_peek(1);
LL_ASSERT(node_rx);

radio_tmr_tifs_set(TIFS_US);
radio_tmr_tifs_set(EVENT_IFS_US);
radio_switch_complete_and_tx(0, 0, 0, 0);
radio_pkt_rx_set(node_rx->pdu);
radio_rssi_measure();
@@ -746,7 +746,8 @@ static inline u32_t isr_rx_pdu(struct lll_scan *lll, u8_t devmatch_ok,
#endif /* CONFIG_BT_CTLR_PROFILE_ISR */

radio_gpio_pa_setup();
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + TIFS_US -
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() +
EVENT_IFS_US -
radio_rx_chain_delay_get(0, 0) -
CONFIG_BT_CTLR_GPIO_PA_OFFSET);
#endif /* CONFIG_BT_CTLR_GPIO_PA_PIN */
@@ -837,7 +838,7 @@ static inline u32_t isr_rx_pdu(struct lll_scan *lll, u8_t devmatch_ok,
lll->state = 1U;
radio_isr_set(isr_tx, lll);

radio_tmr_tifs_set(TIFS_US);
radio_tmr_tifs_set(EVENT_IFS_US);
radio_switch_complete_and_rx(0);
radio_pkt_tx_set(pdu_tx);

@@ -860,7 +861,8 @@ static inline u32_t isr_rx_pdu(struct lll_scan *lll, u8_t devmatch_ok,
#endif /* CONFIG_BT_CTLR_PROFILE_ISR */

radio_gpio_pa_setup();
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + TIFS_US -
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() +
EVENT_IFS_US -
radio_rx_chain_delay_get(0, 0) -
CONFIG_BT_CTLR_GPIO_PA_OFFSET);
#endif /* CONFIG_BT_CTLR_GPIO_PA_PIN */
@@ -173,7 +173,7 @@ static int prepare_cb(struct lll_prepare_param *prepare_param)

radio_isr_set(lll_conn_isr_rx, lll);

radio_tmr_tifs_set(TIFS_US);
radio_tmr_tifs_set(EVENT_IFS_US);

#if defined(CONFIG_BT_CTLR_PHY)
radio_switch_complete_and_tx(lll->phy_rx, 0, lll->phy_tx,
@@ -4,8 +4,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

#define TIFS_US 150

/* Range Delay
* Refer to BT Spec v5.1 Vol.6, Part B, Section 4.2.3 Range Delay
* "4 / 1000" is an approximation of the propagation time in us of the
@@ -1742,7 +1742,7 @@ static inline int event_conn_upd_prep(struct ll_conn *conn,
lll_conn_ppm_get(lll->slave.sca)) *
conn_interval_us) + (1000000 - 1)) / 1000000U;
lll->slave.window_widening_max_us =
(conn_interval_us >> 1) - TIFS_US;
(conn_interval_us >> 1) - EVENT_IFS_US;
lll->slave.window_size_prepare_us =
conn->llcp.conn_upd.win_size * 1250U;
conn->slave.ticks_to_offset = 0U;
@@ -492,7 +492,7 @@ void ull_master_setup(memq_link_t *link, struct node_rx_hdr *rx,
HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_PREEMPT_MIN_US);
conn->evt.ticks_slot =
HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_START_US +
ftr->us_radio_rdy + 328 + TIFS_US +
ftr->us_radio_rdy + 328 + EVENT_IFS_US +
328);

ticks_slot_offset = MAX(conn->evt.ticks_active_to_start,
@@ -91,7 +91,8 @@ void ull_slave_setup(memq_link_t *link, struct node_rx_hdr *rx,
(((lll_conn_ppm_local_get() +
lll_conn_ppm_get(lll->slave.sca)) *
conn_interval_us) + (1000000 - 1)) / 1000000U;
lll->slave.window_widening_max_us = (conn_interval_us >> 1) - TIFS_US;
lll->slave.window_widening_max_us = (conn_interval_us >> 1) -
EVENT_IFS_US;
lll->slave.window_size_event_us = pdu_adv->connect_ind.win_size * 1250U;

/* procedure timeouts */
@@ -270,7 +271,7 @@ void ull_slave_setup(memq_link_t *link, struct node_rx_hdr *rx,
HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_PREEMPT_MIN_US);
conn->evt.ticks_slot =
HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_START_US +
ftr->us_radio_rdy + 328 + TIFS_US +
ftr->us_radio_rdy + 328 + EVENT_IFS_US +
328);

ticks_slot_offset = MAX(conn->evt.ticks_active_to_start,

0 comments on commit 1618c1b

Please sign in to comment.
You can’t perform that action at this time.