37
37
38
38
static int init_reset (void );
39
39
static void isr_done (void * param );
40
- static int isr_rx_pdu (struct lll_conn * lll , struct pdu_data * pdu_data_rx ,
41
- struct node_tx * * tx_release , uint8_t * is_rx_enqueue );
40
+ static inline int isr_rx_pdu (struct lll_conn * lll , struct pdu_data * pdu_data_rx ,
41
+ uint8_t * is_rx_enqueue ,
42
+ struct node_tx * * tx_release , uint8_t * is_done );
42
43
static struct pdu_data * empty_tx_enqueue (struct lll_conn * lll );
43
44
44
45
static uint16_t const sca_ppm_lut [] = {500 , 250 , 150 , 100 , 75 , 50 , 30 , 20 };
@@ -132,12 +133,11 @@ void lll_conn_isr_rx(void *param)
132
133
struct pdu_data * pdu_data_tx ;
133
134
struct node_rx_pdu * node_rx ;
134
135
uint8_t is_empty_pdu_tx_retry ;
135
- uint8_t is_crc_backoff = 0U ;
136
136
uint8_t is_rx_enqueue = 0U ;
137
137
uint8_t is_ull_rx = 0U ;
138
+ uint8_t is_done = 0U ;
138
139
uint8_t rssi_ready ;
139
140
uint8_t trx_done ;
140
- uint8_t is_done ;
141
141
uint8_t crc_ok ;
142
142
143
143
#if defined(CONFIG_BT_CTLR_PROFILE_ISR )
@@ -174,7 +174,8 @@ void lll_conn_isr_rx(void *param)
174
174
if (crc_ok ) {
175
175
uint32_t err ;
176
176
177
- err = isr_rx_pdu (lll , pdu_data_rx , & tx_release , & is_rx_enqueue );
177
+ err = isr_rx_pdu (lll , pdu_data_rx , & is_rx_enqueue , & tx_release ,
178
+ & is_done );
178
179
if (err ) {
179
180
goto lll_conn_isr_rx_exit ;
180
181
}
@@ -192,16 +193,16 @@ void lll_conn_isr_rx(void *param)
192
193
193
194
/* CRC error countdown */
194
195
crc_expire -- ;
195
- is_crc_backoff = (crc_expire == 0U );
196
+ is_done = (crc_expire == 0U );
196
197
}
197
198
198
199
/* prepare tx packet */
199
200
is_empty_pdu_tx_retry = lll -> empty ;
200
201
lll_conn_pdu_tx_prep (lll , & pdu_data_tx );
201
202
202
203
/* Decide on event continuation and hence Radio Shorts to use */
203
- is_done = is_crc_backoff || ((crc_ok ) && (pdu_data_rx -> md == 0 ) &&
204
- (pdu_data_tx -> len == 0 ));
204
+ is_done = is_done || ((crc_ok ) && (pdu_data_rx -> md == 0 ) &&
205
+ (pdu_data_tx -> len == 0 ));
205
206
206
207
if (is_done ) {
207
208
radio_isr_set (isr_done , param );
@@ -607,8 +608,9 @@ static inline bool ctrl_pdu_len_check(uint8_t len)
607
608
608
609
}
609
610
610
- static int isr_rx_pdu (struct lll_conn * lll , struct pdu_data * pdu_data_rx ,
611
- struct node_tx * * tx_release , uint8_t * is_rx_enqueue )
611
+ static inline int isr_rx_pdu (struct lll_conn * lll , struct pdu_data * pdu_data_rx ,
612
+ uint8_t * is_rx_enqueue ,
613
+ struct node_tx * * tx_release , uint8_t * is_done )
612
614
{
613
615
#if defined(CONFIG_SOC_COMPATIBLE_NRF52832 ) && \
614
616
defined(CONFIG_BT_CTLR_LE_ENC ) && \
@@ -625,10 +627,11 @@ static int isr_rx_pdu(struct lll_conn *lll, struct pdu_data *pdu_data_rx,
625
627
626
628
/* Ack for tx-ed data */
627
629
if (pdu_data_rx -> nesn != lll -> sn ) {
630
+ struct pdu_data * pdu_data_tx ;
628
631
struct node_tx * tx ;
629
632
memq_link_t * link ;
630
633
631
- /* Increment serial number */
634
+ /* Increment sequence number */
632
635
lll -> sn ++ ;
633
636
634
637
#if defined(CONFIG_BT_PERIPHERAL )
@@ -645,11 +648,16 @@ static int isr_rx_pdu(struct lll_conn *lll, struct pdu_data *pdu_data_rx,
645
648
(void * * )& tx );
646
649
} else {
647
650
lll -> empty = 0 ;
651
+
652
+ pdu_data_tx = (void * )radio_pkt_empty_get ();
653
+ if (IS_ENABLED (CONFIG_BT_CENTRAL ) && !lll -> role ) {
654
+ * is_done = !pdu_data_tx -> md ;
655
+ }
656
+
648
657
link = NULL ;
649
658
}
650
659
651
660
if (link ) {
652
- struct pdu_data * pdu_data_tx ;
653
661
uint8_t pdu_data_tx_len ;
654
662
uint8_t offset ;
655
663
@@ -684,6 +692,10 @@ static int isr_rx_pdu(struct lll_conn *lll, struct pdu_data *pdu_data_rx,
684
692
685
693
* tx_release = tx ;
686
694
}
695
+
696
+ if (IS_ENABLED (CONFIG_BT_CENTRAL ) && !lll -> role ) {
697
+ * is_done = !pdu_data_tx -> md ;
698
+ }
687
699
}
688
700
}
689
701
0 commit comments