66
66
#define RADIO_PKT_TIME (octets , phy ) \
67
67
(((phy) & BIT(2)) ? \
68
68
(80 + 256 + 16 + 24 + ((((2 + (octets) + 4) * 8) + 24 + 3) * 8)) : \
69
- (((octets) + 14) * 8 / BIT(((phy) & 0x03) >> 1)))
69
+ (((octets) + 13 + PREAMBLE_SIZE(phy)) * 8 / \
70
+ BIT(((phy) & 0x03) >> 1)))
70
71
#else /* !CONFIG_BT_CTLR_PHY_CODED */
71
72
#define RADIO_PKT_TIME (octets , phy ) \
72
- (((octets) + 14 ) * 8 / BIT(((phy) & 0x03) >> 1))
73
+ (((octets) + 13 + PREAMBLE_SIZE(phy) ) * 8 / BIT(((phy) & 0x03) >> 1))
73
74
#endif /* !CONFIG_BT_CTLR_PHY_CODED */
74
75
75
76
/* Inter Frame Space */
@@ -641,7 +642,8 @@ static void common_init(void)
641
642
#if defined(CONFIG_BT_CTLR_DATA_LENGTH )
642
643
/* Initialize the DLE defaults */
643
644
_radio .default_tx_octets = PDU_DC_PAYLOAD_SIZE_MIN ;
644
- _radio .default_tx_time = RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , 0 );
645
+ _radio .default_tx_time =
646
+ RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , BIT (0 ));
645
647
#endif /* CONFIG_BT_CTLR_DATA_LENGTH */
646
648
647
649
#if defined(CONFIG_BT_CTLR_PHY )
@@ -2245,8 +2247,8 @@ isr_rx_conn_pkt_ctrl_rej_dle(struct radio_pdu_node_rx *node_rx,
2245
2247
lr -> max_rx_octets = conn -> max_rx_octets ;
2246
2248
lr -> max_tx_octets = conn -> max_tx_octets ;
2247
2249
#if !defined(CONFIG_BT_CTLR_PHY )
2248
- lr -> max_rx_time = RADIO_PKT_TIME (conn -> max_rx_octets , 0 );
2249
- lr -> max_tx_time = RADIO_PKT_TIME (conn -> max_tx_octets , 0 );
2250
+ lr -> max_rx_time = RADIO_PKT_TIME (conn -> max_rx_octets , BIT ( 0 ) );
2251
+ lr -> max_tx_time = RADIO_PKT_TIME (conn -> max_tx_octets , BIT ( 0 ) );
2250
2252
#else /* CONFIG_BT_CTLR_PHY */
2251
2253
lr -> max_rx_time = conn -> max_rx_time ;
2252
2254
lr -> max_tx_time = conn -> max_tx_time ;
@@ -2464,7 +2466,7 @@ static inline u8_t isr_rx_conn_pkt_ctrl_dle(struct pdu_data *pdu_data_rx,
2464
2466
* peer max_rx_time
2465
2467
*/
2466
2468
if (lr -> max_rx_time >=
2467
- RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , 0 )) {
2469
+ RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , BIT ( 0 ) )) {
2468
2470
eff_tx_time =
2469
2471
MIN (lr -> max_rx_time ,
2470
2472
_radio .conn_curr -> default_tx_time );
@@ -2480,7 +2482,7 @@ static inline u8_t isr_rx_conn_pkt_ctrl_dle(struct pdu_data *pdu_data_rx,
2480
2482
* peer max_tx_time
2481
2483
*/
2482
2484
if (lr -> max_tx_time >=
2483
- RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , 0 )) {
2485
+ RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , BIT ( 0 ) )) {
2484
2486
eff_rx_time =
2485
2487
MIN (lr -> max_tx_time ,
2486
2488
RADIO_PKT_TIME (LL_LENGTH_OCTETS_RX_MAX ,
@@ -2610,8 +2612,8 @@ static inline u8_t isr_rx_conn_pkt_ctrl_dle(struct pdu_data *pdu_data_rx,
2610
2612
lr -> max_tx_octets = eff_tx_octets ;
2611
2613
2612
2614
#if !defined(CONFIG_BT_CTLR_PHY )
2613
- lr -> max_rx_time = RADIO_PKT_TIME (eff_rx_octets , 0 );
2614
- lr -> max_tx_time = RADIO_PKT_TIME (eff_tx_octets , 0 );
2615
+ lr -> max_rx_time = RADIO_PKT_TIME (eff_rx_octets , BIT ( 0 ) );
2616
+ lr -> max_tx_time = RADIO_PKT_TIME (eff_tx_octets , BIT ( 0 ) );
2615
2617
#else /* CONFIG_BT_CTLR_PHY */
2616
2618
lr -> max_rx_time = eff_rx_time ;
2617
2619
lr -> max_tx_time = eff_tx_time ;
@@ -4849,23 +4851,24 @@ static inline void isr_close_conn(void)
4849
4851
rx_time = conn -> max_rx_time ;
4850
4852
}
4851
4853
#else /* !CONFIG_BT_CTLR_DATA_LENGTH */
4852
- tx_time = MAX (RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , 0 ),
4854
+ tx_time = MAX (RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , BIT ( 0 ) ),
4853
4855
RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN ,
4854
4856
conn -> phy_tx ));
4855
- rx_time = MAX (RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , 0 ),
4857
+ rx_time = MAX (RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , BIT ( 0 ) ),
4856
4858
RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN ,
4857
4859
conn -> phy_rx ));
4858
4860
#endif /* !CONFIG_BT_CTLR_DATA_LENGTH */
4859
4861
#else /* !CONFIG_BT_CTLR_PHY */
4860
4862
ready_delay = (conn -> role ) ?
4861
4863
radio_rx_ready_delay_get (0 , 0 ) :
4862
4864
radio_tx_ready_delay_get (0 , 0 );
4863
- tx_time = RADIO_PKT_TIME (conn -> max_tx_octets , 0 );
4865
+ tx_time = RADIO_PKT_TIME (conn -> max_tx_octets , BIT ( 0 ) );
4864
4866
if (conn -> evt_len_adv ) {
4865
4867
rx_time = RADIO_PKT_TIME (conn -> llcp_length .rx_octets ,
4866
- 0 );
4868
+ BIT ( 0 ) );
4867
4869
} else {
4868
- rx_time = RADIO_PKT_TIME (conn -> max_rx_octets , 0 );
4870
+ rx_time = RADIO_PKT_TIME (conn -> max_rx_octets ,
4871
+ BIT (0 ));
4869
4872
}
4870
4873
#endif /* !CONFIG_BT_CTLR_PHY */
4871
4874
@@ -8428,12 +8431,12 @@ static inline int event_len_prep(struct connection *conn)
8428
8431
#endif /* !CONFIG_BT_CTLR_PHY */
8429
8432
) {
8430
8433
lr -> max_rx_time =
8431
- RADIO_PKT_TIME (LL_LENGTH_OCTETS_RX_MAX , 0 );
8434
+ RADIO_PKT_TIME (LL_LENGTH_OCTETS_RX_MAX , BIT ( 0 ) );
8432
8435
#if defined(CONFIG_BT_CTLR_PHY )
8433
8436
lr -> max_tx_time = conn -> default_tx_time ;
8434
8437
#else /* !CONFIG_BT_CTLR_PHY */
8435
8438
lr -> max_tx_time =
8436
- RADIO_PKT_TIME (conn -> default_tx_octets , 0 );
8439
+ RADIO_PKT_TIME (conn -> default_tx_octets , BIT ( 0 ) );
8437
8440
#endif /* !CONFIG_BT_CTLR_PHY */
8438
8441
8439
8442
#if defined(CONFIG_BT_CTLR_PHY )
@@ -8637,8 +8640,8 @@ static inline int event_len_prep(struct connection *conn)
8637
8640
lr -> max_rx_octets = conn -> max_rx_octets ;
8638
8641
lr -> max_tx_octets = tx_octets ;
8639
8642
#if !defined(CONFIG_BT_CTLR_PHY )
8640
- lr -> max_rx_time = RADIO_PKT_TIME (conn -> max_rx_octets , 0 );
8641
- lr -> max_tx_time = RADIO_PKT_TIME (tx_octets , 0 );
8643
+ lr -> max_rx_time = RADIO_PKT_TIME (conn -> max_rx_octets , BIT ( 0 ) );
8644
+ lr -> max_tx_time = RADIO_PKT_TIME (tx_octets , BIT ( 0 ) );
8642
8645
#else /* CONFIG_BT_CTLR_PHY */
8643
8646
lr -> max_rx_time = conn -> max_rx_time ;
8644
8647
lr -> max_tx_time = tx_time ;
@@ -8862,7 +8865,7 @@ static inline void event_phy_upd_ind_prep(struct connection *conn,
8862
8865
u16_t tx_time = RADIO_PKT_TIME (conn -> max_tx_octets ,
8863
8866
conn -> phy_tx );
8864
8867
if (tx_time >=
8865
- RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , 0 )) {
8868
+ RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , BIT ( 0 ) )) {
8866
8869
eff_tx_time = MIN (tx_time ,
8867
8870
conn -> default_tx_time );
8868
8871
#if defined(CONFIG_BT_CTLR_PHY_CODED )
@@ -8873,7 +8876,7 @@ static inline void event_phy_upd_ind_prep(struct connection *conn,
8873
8876
} else {
8874
8877
eff_tx_time =
8875
8878
RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN ,
8876
- 0 );
8879
+ BIT ( 0 ) );
8877
8880
}
8878
8881
#endif /* CONFIG_BT_CTLR_DATA_LENGTH */
8879
8882
}
@@ -8885,7 +8888,7 @@ static inline void event_phy_upd_ind_prep(struct connection *conn,
8885
8888
u16_t rx_time = RADIO_PKT_TIME (conn -> max_rx_octets ,
8886
8889
conn -> phy_rx );
8887
8890
if (rx_time >=
8888
- RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , 0 )) {
8891
+ RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , BIT ( 0 ) )) {
8889
8892
eff_rx_time = MIN (rx_time ,
8890
8893
RADIO_PKT_TIME (LL_LENGTH_OCTETS_RX_MAX ,
8891
8894
BIT (2 )));
@@ -8897,7 +8900,7 @@ static inline void event_phy_upd_ind_prep(struct connection *conn,
8897
8900
} else {
8898
8901
eff_rx_time =
8899
8902
RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN ,
8900
- 0 );
8903
+ BIT ( 0 ) );
8901
8904
}
8902
8905
#endif /* CONFIG_BT_CTLR_DATA_LENGTH */
8903
8906
}
@@ -11043,9 +11046,9 @@ static void length_resp_send(struct connection *conn,
11043
11046
11044
11047
#if !defined(CONFIG_BT_CTLR_PHY )
11045
11048
pdu_ctrl_tx -> llctrl .length_rsp .max_rx_time =
11046
- RADIO_PKT_TIME (eff_rx_octets , 0 );
11049
+ RADIO_PKT_TIME (eff_rx_octets , BIT ( 0 ) );
11047
11050
pdu_ctrl_tx -> llctrl .length_rsp .max_tx_time =
11048
- RADIO_PKT_TIME (eff_tx_octets , 0 );
11051
+ RADIO_PKT_TIME (eff_tx_octets , BIT ( 0 ) );
11049
11052
#else /* CONFIG_BT_CTLR_PHY */
11050
11053
pdu_ctrl_tx -> llctrl .length_rsp .max_rx_time = eff_rx_time ;
11051
11054
pdu_ctrl_tx -> llctrl .length_rsp .max_tx_time = eff_tx_time ;
@@ -11536,9 +11539,9 @@ u32_t radio_adv_enable(u16_t interval, u8_t chan_map, u8_t filter_policy,
11536
11539
#if defined(CONFIG_BT_CTLR_PHY )
11537
11540
conn -> default_tx_time = _radio .default_tx_time ;
11538
11541
conn -> max_tx_time =
11539
- RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , 0 );
11542
+ RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , BIT ( 0 ) );
11540
11543
conn -> max_rx_time =
11541
- RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , 0 );
11544
+ RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , BIT ( 0 ) );
11542
11545
#endif /* CONFIG_BT_CTLR_PHY */
11543
11546
#endif /* CONFIG_BT_CTLR_DATA_LENGTH */
11544
11547
@@ -12075,8 +12078,8 @@ u32_t radio_connect_enable(u8_t adv_addr_type, u8_t *adv_addr, u16_t interval,
12075
12078
12076
12079
#if defined(CONFIG_BT_CTLR_PHY )
12077
12080
conn -> default_tx_time = _radio .default_tx_time ;
12078
- conn -> max_tx_time = RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , 0 );
12079
- conn -> max_rx_time = RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , 0 );
12081
+ conn -> max_tx_time = RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , BIT ( 0 ) );
12082
+ conn -> max_rx_time = RADIO_PKT_TIME (PDU_DC_PAYLOAD_SIZE_MIN , BIT ( 0 ) );
12080
12083
#endif /* CONFIG_BT_CTLR_PHY */
12081
12084
#endif /* CONFIG_BT_CTLR_DATA_LENGTH */
12082
12085
0 commit comments