|
|
|
@ -426,7 +426,7 @@ uint32_t radio_init(uint8_t sca, uint8_t connection_count_max,
|
|
|
|
|
(void *)&_radio.link_rx_tail);
|
|
|
|
|
|
|
|
|
|
/* after rx queue allocation, one link mem should still be available */
|
|
|
|
|
ASSERT(link);
|
|
|
|
|
BT_ASSERT(link);
|
|
|
|
|
|
|
|
|
|
return retcode;
|
|
|
|
|
}
|
|
|
|
@ -474,7 +474,7 @@ static inline void isr_radio_state_tx(void)
|
|
|
|
|
|
|
|
|
|
case ROLE_NONE:
|
|
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -645,7 +645,7 @@ static inline uint32_t isr_rx_adv(uint8_t devmatch_ok, uint8_t irkmatch_ok,
|
|
|
|
|
RADIO_TICKER_USER_ID_WORKER,
|
|
|
|
|
RADIO_TICKER_ID_ADV,
|
|
|
|
|
ticker_success_assert, (void *)__LINE__);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
|
|
|
|
|
/* Stop Direct Adv Stopper */
|
|
|
|
@ -659,7 +659,7 @@ static inline uint32_t isr_rx_adv(uint8_t devmatch_ok, uint8_t irkmatch_ok,
|
|
|
|
|
RADIO_TICKER_ID_ADV_STOP,
|
|
|
|
|
0, /* @todo ticker_success_assert */
|
|
|
|
|
0 /* @todo (void *) __LINE__*/);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -677,7 +677,7 @@ static inline uint32_t isr_rx_adv(uint8_t devmatch_ok, uint8_t irkmatch_ok,
|
|
|
|
|
(ticks_slot_offset + conn->hdr.ticks_slot),
|
|
|
|
|
event_slave_prepare, conn, ticker_success_assert,
|
|
|
|
|
(void *)__LINE__);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
@ -794,7 +794,7 @@ static inline uint32_t isr_rx_obs(uint8_t irkmatch_id, uint8_t rssi_ready)
|
|
|
|
|
|
|
|
|
|
radio_pkt_tx_set(pdu_adv_tx);
|
|
|
|
|
|
|
|
|
|
ASSERT(!radio_is_ready());
|
|
|
|
|
BT_ASSERT(!radio_is_ready());
|
|
|
|
|
|
|
|
|
|
radio_tmr_end_capture();
|
|
|
|
|
|
|
|
|
@ -857,14 +857,14 @@ static inline uint32_t isr_rx_obs(uint8_t irkmatch_id, uint8_t rssi_ready)
|
|
|
|
|
RADIO_TICKER_ID_OBS,
|
|
|
|
|
ticker_success_assert,
|
|
|
|
|
(void *)__LINE__);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
ticker_status = ticker_stop(RADIO_TICKER_INSTANCE_ID_RADIO,
|
|
|
|
|
RADIO_TICKER_USER_ID_WORKER,
|
|
|
|
|
RADIO_TICKER_ID_OBS_STOP,
|
|
|
|
|
0, /* @todo ticker_success_assert */
|
|
|
|
|
0 /* @todo (void *) __LINE__ */);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
ticker_status =
|
|
|
|
|
ticker_start(RADIO_TICKER_INSTANCE_ID_RADIO,
|
|
|
|
@ -879,7 +879,7 @@ static inline uint32_t isr_rx_obs(uint8_t irkmatch_id, uint8_t rssi_ready)
|
|
|
|
|
(ticks_slot_offset + conn->hdr.ticks_slot),
|
|
|
|
|
event_master_prepare, conn,
|
|
|
|
|
ticker_success_assert, (void *)__LINE__);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
@ -1107,7 +1107,7 @@ isr_rx_conn_pkt_ctrl_rej(struct radio_pdu_node_rx *radio_pdu_node_rx,
|
|
|
|
|
|
|
|
|
|
switch (_radio.conn_curr->llcp_type) {
|
|
|
|
|
case LLCP_CONNECTION_UPDATE:
|
|
|
|
|
ASSERT(_radio.conn_upd == _radio.conn_curr);
|
|
|
|
|
BT_ASSERT(_radio.conn_upd == _radio.conn_curr);
|
|
|
|
|
|
|
|
|
|
/* reset mutex */
|
|
|
|
|
_radio.conn_upd = NULL;
|
|
|
|
@ -1147,7 +1147,7 @@ isr_rx_conn_pkt_ctrl_rej(struct radio_pdu_node_rx *radio_pdu_node_rx,
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1212,7 +1212,7 @@ static inline void isr_rx_conn_pkt_ctrl_dle(struct pdu_data *pdu_data_rx,
|
|
|
|
|
|
|
|
|
|
free_count_rx = packet_rx_acquired_count_get()
|
|
|
|
|
+ mem_free_count_get(_radio.pkt_rx_data_free);
|
|
|
|
|
ASSERT(free_count_rx <= 0xFF);
|
|
|
|
|
BT_ASSERT(free_count_rx <= 0xFF);
|
|
|
|
|
|
|
|
|
|
if (_radio.packet_rx_data_count == free_count_rx) {
|
|
|
|
|
|
|
|
|
@ -1265,7 +1265,7 @@ static inline void isr_rx_conn_pkt_ctrl_dle(struct pdu_data *pdu_data_rx,
|
|
|
|
|
*rx_enqueue = 1;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((PDU_DATA_LLCTRL_TYPE_LENGTH_REQ ==
|
|
|
|
@ -1352,7 +1352,7 @@ isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *radio_pdu_node_rx,
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PDU_DATA_LLCTRL_TYPE_START_ENC_REQ:
|
|
|
|
|
ASSERT(_radio.conn_curr->llcp_req ==
|
|
|
|
|
BT_ASSERT(_radio.conn_curr->llcp_req ==
|
|
|
|
|
_radio.conn_curr->llcp_ack);
|
|
|
|
|
|
|
|
|
|
/* start enc rsp to be scheduled in master prepare */
|
|
|
|
@ -1589,7 +1589,7 @@ isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *radio_pdu_node_rx,
|
|
|
|
|
/* 1. conn update in progress, instant not reached */
|
|
|
|
|
/* 2. some other ctrl procedure in progress */
|
|
|
|
|
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
@ -1606,7 +1606,7 @@ isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *radio_pdu_node_rx,
|
|
|
|
|
/* By spec. slave shall not generate a conn update
|
|
|
|
|
* complete on reject from master.
|
|
|
|
|
*/
|
|
|
|
|
ASSERT(_radio.conn_curr->role.slave.role != 0);
|
|
|
|
|
BT_ASSERT(_radio.conn_curr->role.slave.role);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
@ -1626,7 +1626,7 @@ isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *radio_pdu_node_rx,
|
|
|
|
|
|
|
|
|
|
switch (_radio.conn_curr->llcp_type) {
|
|
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else if (_radio.conn_curr->llcp_length.req !=
|
|
|
|
@ -1754,7 +1754,7 @@ isr_rx_conn_pkt(struct radio_pdu_node_rx *radio_pdu_node_rx,
|
|
|
|
|
uint32_t done;
|
|
|
|
|
|
|
|
|
|
done = radio_ccm_is_done();
|
|
|
|
|
ASSERT(done);
|
|
|
|
|
BT_ASSERT(done);
|
|
|
|
|
|
|
|
|
|
_radio.conn_curr->ccm_rx.counter++;
|
|
|
|
|
}
|
|
|
|
@ -1793,7 +1793,7 @@ isr_rx_conn_pkt(struct radio_pdu_node_rx *radio_pdu_node_rx,
|
|
|
|
|
break;
|
|
|
|
|
case PDU_DATA_LLID_RESV:
|
|
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1994,7 +1994,7 @@ static inline void isr_radio_state_rx(uint8_t trx_done, uint8_t crc_ok,
|
|
|
|
|
|
|
|
|
|
case ROLE_NONE:
|
|
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2038,7 +2038,7 @@ static inline uint32_t isr_close_adv(void)
|
|
|
|
|
0, 0, 0, 0, 0,
|
|
|
|
|
ticker_success_assert,
|
|
|
|
|
(void *)__LINE__);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2079,7 +2079,7 @@ static inline uint32_t isr_close_obs(void)
|
|
|
|
|
RADIO_TICKER_ID_OBS_STOP,
|
|
|
|
|
0 /** @todo ticker_success_assert */,
|
|
|
|
|
0 /** @todo (void *) __LINE__ */);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2281,7 +2281,8 @@ static inline void isr_close_conn(void)
|
|
|
|
|
|
|
|
|
|
/* Prepare the rx packet structure */
|
|
|
|
|
radio_pdu_node_rx = packet_rx_reserve_get(2);
|
|
|
|
|
ASSERT(radio_pdu_node_rx);
|
|
|
|
|
BT_ASSERT(radio_pdu_node_rx);
|
|
|
|
|
|
|
|
|
|
radio_pdu_node_rx->hdr.handle = _radio.conn_curr->handle;
|
|
|
|
|
radio_pdu_node_rx->hdr.type = NODE_RX_TYPE_APTO;
|
|
|
|
|
|
|
|
|
@ -2360,7 +2361,7 @@ static inline void isr_close_conn(void)
|
|
|
|
|
lazy, force,
|
|
|
|
|
0 /** @todo ticker_success_assert */,
|
|
|
|
|
0 /** @todo (void *) __LINE__ */);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2385,7 +2386,7 @@ static inline void isr_radio_state_close(void)
|
|
|
|
|
|
|
|
|
|
case ROLE_NONE:
|
|
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2462,11 +2463,11 @@ static void isr(void)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ASSERT(((_radio.state != STATE_RX) && (_radio.state != STATE_TX)) ||
|
|
|
|
|
BT_ASSERT(((_radio.state != STATE_RX) && (_radio.state != STATE_TX)) ||
|
|
|
|
|
(!radio_is_ready()));
|
|
|
|
|
|
|
|
|
|
DEBUG_RADIO_ISR(0);
|
|
|
|
@ -2493,7 +2494,7 @@ static void ticker_success_assert(uint32_t status, void *params)
|
|
|
|
|
{
|
|
|
|
|
ARG_UNUSED(params);
|
|
|
|
|
|
|
|
|
|
ASSERT(status == TICKER_STATUS_SUCCESS);
|
|
|
|
|
BT_ASSERT(status == TICKER_STATUS_SUCCESS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void work_radio_active(void *params)
|
|
|
|
@ -2509,7 +2510,7 @@ static void work_radio_active(void *params)
|
|
|
|
|
|
|
|
|
|
radio_active_callback(1);
|
|
|
|
|
} else {
|
|
|
|
|
ASSERT(s_active);
|
|
|
|
|
BT_ASSERT(s_active);
|
|
|
|
|
|
|
|
|
|
if (--s_active) {
|
|
|
|
|
return;
|
|
|
|
@ -2535,7 +2536,7 @@ static void event_active(uint32_t ticks_at_expire, uint32_t remainder,
|
|
|
|
|
ARG_UNUSED(context);
|
|
|
|
|
|
|
|
|
|
retval = work_schedule(&s_work_radio_active, 0);
|
|
|
|
|
ASSERT(!retval);
|
|
|
|
|
BT_ASSERT(!retval);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void work_radio_inactive(void *params)
|
|
|
|
@ -2560,7 +2561,7 @@ static void event_inactive(uint32_t ticks_at_expire, uint32_t remainder,
|
|
|
|
|
ARG_UNUSED(context);
|
|
|
|
|
|
|
|
|
|
retval = work_schedule(&s_work_radio_inactive, 0);
|
|
|
|
|
ASSERT(!retval);
|
|
|
|
|
BT_ASSERT(!retval);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void work_xtal_start(void *params)
|
|
|
|
@ -2583,7 +2584,7 @@ static void event_xtal(uint32_t ticks_at_expire, uint32_t remainder,
|
|
|
|
|
ARG_UNUSED(context);
|
|
|
|
|
|
|
|
|
|
retval = work_schedule(&s_work_xtal_start, 0);
|
|
|
|
|
ASSERT(!retval);
|
|
|
|
|
BT_ASSERT(!retval);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void work_xtal_stop(void *params)
|
|
|
|
@ -2610,7 +2611,7 @@ static void work_xtal_retain(uint8_t retain)
|
|
|
|
|
s_xtal_retained = 1;
|
|
|
|
|
|
|
|
|
|
retval = work_schedule(&s_work_xtal_start, 0);
|
|
|
|
|
ASSERT(!retval);
|
|
|
|
|
BT_ASSERT(!retval);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (s_xtal_retained) {
|
|
|
|
@ -2622,7 +2623,7 @@ static void work_xtal_retain(uint8_t retain)
|
|
|
|
|
s_xtal_retained = 0;
|
|
|
|
|
|
|
|
|
|
retval = work_schedule(&s_work_xtal_stop, 0);
|
|
|
|
|
ASSERT(!retval);
|
|
|
|
|
BT_ASSERT(!retval);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2673,8 +2674,8 @@ static void prepare_normal_set(struct shdr *hdr,
|
|
|
|
|
ticker_id, 0, ticks_drift_minus,
|
|
|
|
|
ticks_drift_minus, 0, 0, 0,
|
|
|
|
|
prepare_normal, hdr);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS)
|
|
|
|
|
|| (ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2731,7 +2732,7 @@ static void work_xtal_stop_calc(void *params)
|
|
|
|
|
ticker_job_sched(RADIO_TICKER_INSTANCE_ID_RADIO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ASSERT(ticker_status == TICKER_STATUS_SUCCESS);
|
|
|
|
|
BT_ASSERT(ticker_status == TICKER_STATUS_SUCCESS);
|
|
|
|
|
|
|
|
|
|
if ((ticker_id != 0xff) &&
|
|
|
|
|
(ticks_to_expire < TICKER_US_TO_TICKS(10000))) {
|
|
|
|
@ -2756,7 +2757,7 @@ static void work_xtal_stop_calc(void *params)
|
|
|
|
|
} else if (ticker_id == RADIO_TICKER_ID_OBS) {
|
|
|
|
|
hdr = &_radio.observer.hdr;
|
|
|
|
|
} else {
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* compensate for reduced next ticker's prepare or
|
|
|
|
@ -2791,7 +2792,7 @@ static void work_xtal_stop_calc(void *params)
|
|
|
|
|
0, 0,
|
|
|
|
|
prepare_reduced,
|
|
|
|
|
hdr);
|
|
|
|
|
ASSERT((TICKER_STATUS_SUCCESS ==
|
|
|
|
|
BT_ASSERT((TICKER_STATUS_SUCCESS ==
|
|
|
|
|
ticker_status) ||
|
|
|
|
|
(TICKER_STATUS_BUSY ==
|
|
|
|
|
ticker_status));
|
|
|
|
@ -2890,7 +2891,7 @@ static void work_xtal_stop_calc(void *params)
|
|
|
|
|
} else if (ticker_id == RADIO_TICKER_ID_OBS) {
|
|
|
|
|
hdr = &_radio.observer.hdr;
|
|
|
|
|
} else {
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Use normal prepare */
|
|
|
|
@ -2930,7 +2931,7 @@ static void sched_after_master_free_slot_get(uint8_t user_id,
|
|
|
|
|
ticker_job_sched(RADIO_TICKER_INSTANCE_ID_RADIO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ASSERT(ticker_status == TICKER_STATUS_SUCCESS);
|
|
|
|
|
BT_ASSERT(ticker_status == TICKER_STATUS_SUCCESS);
|
|
|
|
|
|
|
|
|
|
if (ticker_id == 0xff) {
|
|
|
|
|
break;
|
|
|
|
@ -3082,7 +3083,7 @@ static void sched_free_win_offset_calc(struct connection *conn_curr,
|
|
|
|
|
ticker_job_sched(RADIO_TICKER_INSTANCE_ID_RADIO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ASSERT(ticker_status == TICKER_STATUS_SUCCESS);
|
|
|
|
|
BT_ASSERT(ticker_status == TICKER_STATUS_SUCCESS);
|
|
|
|
|
|
|
|
|
|
if (ticker_id == 0xff) {
|
|
|
|
|
break;
|
|
|
|
@ -3090,7 +3091,7 @@ static void sched_free_win_offset_calc(struct connection *conn_curr,
|
|
|
|
|
|
|
|
|
|
if ((ticker_id_prev != 0xff) &&
|
|
|
|
|
(ticks_anchor != ticks_anchor_prev)) {
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ticker_id < RADIO_TICKER_ID_ADV) {
|
|
|
|
@ -3307,7 +3308,7 @@ static void work_radio_stop(void *params)
|
|
|
|
|
enum state state = (enum state)((uint32_t)params & 0xff);
|
|
|
|
|
uint32_t radio_used;
|
|
|
|
|
|
|
|
|
|
ASSERT((state == STATE_STOP) || (state == STATE_ABORT));
|
|
|
|
|
BT_ASSERT((state == STATE_STOP) || (state == STATE_ABORT));
|
|
|
|
|
|
|
|
|
|
radio_used = ((_radio.state != STATE_NONE) &&
|
|
|
|
|
(_radio.state != STATE_STOP) &&
|
|
|
|
@ -3340,7 +3341,7 @@ static void event_stop(uint32_t ticks_at_expire, uint32_t remainder,
|
|
|
|
|
|
|
|
|
|
/* Stop Radio Tx/Rx */
|
|
|
|
|
retval = work_schedule(&s_work_radio_stop, 0);
|
|
|
|
|
ASSERT(!retval);
|
|
|
|
|
BT_ASSERT(!retval);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void event_common_prepare(uint32_t ticks_at_expire,
|
|
|
|
@ -3386,7 +3387,7 @@ static void event_common_prepare(uint32_t ticks_at_expire,
|
|
|
|
|
TICKER_NULL_REMAINDER, TICKER_NULL_LAZY,
|
|
|
|
|
TICKER_NULL_SLOT, event_active, 0,
|
|
|
|
|
ticker_success_assert, (void *)__LINE__);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
|
|
|
|
|
event_xtal(0, 0, 0, 0);
|
|
|
|
@ -3407,7 +3408,7 @@ static void event_common_prepare(uint32_t ticks_at_expire,
|
|
|
|
|
TICKER_NULL_REMAINDER, TICKER_NULL_LAZY,
|
|
|
|
|
TICKER_NULL_SLOT, event_xtal, 0,
|
|
|
|
|
ticker_success_assert, (void *)__LINE__);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
} else {
|
|
|
|
|
/* Active and XTAL are at the same time,
|
|
|
|
@ -3431,7 +3432,7 @@ static void event_common_prepare(uint32_t ticks_at_expire,
|
|
|
|
|
TICKER_NULL_LAZY, TICKER_NULL_SLOT,
|
|
|
|
|
ticker_timeout_fp, context, ticker_success_assert,
|
|
|
|
|
(void *)__LINE__);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
|
|
|
|
|
#define RADIO_DEFERRED_PREEMPT 0
|
|
|
|
@ -3447,7 +3448,7 @@ static void event_common_prepare(uint32_t ticks_at_expire,
|
|
|
|
|
TICKER_NULL_LAZY, TICKER_NULL_SLOT,
|
|
|
|
|
event_stop, (void *)STATE_ABORT,
|
|
|
|
|
ticker_success_assert, (void *)__LINE__);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
@ -3476,7 +3477,7 @@ static void event_common_prepare(uint32_t ticks_at_expire,
|
|
|
|
|
ticks_to_start, ticks_to_start_new,
|
|
|
|
|
ticks_to_start_new, ticks_to_start, 0, 0,
|
|
|
|
|
ticker_success_assert, (void *)__LINE__);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3494,7 +3495,7 @@ static void event_common_prepare(uint32_t ticks_at_expire,
|
|
|
|
|
s_work_xtal_stop_calc.params = (void *)(uint32_t)ticker_id;
|
|
|
|
|
|
|
|
|
|
retval = work_schedule(&s_work_xtal_stop_calc, 1);
|
|
|
|
|
ASSERT(!retval);
|
|
|
|
|
BT_ASSERT(!retval);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
@ -3567,7 +3568,7 @@ static void channel_set(uint32_t channel)
|
|
|
|
|
} else if (channel < 40) {
|
|
|
|
|
radio_freq_chnl_set(28 + (2 * (channel - 11)));
|
|
|
|
|
} else {
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -3733,8 +3734,8 @@ static void event_adv(uint32_t ticks_at_expire, uint32_t remainder,
|
|
|
|
|
|
|
|
|
|
DEBUG_RADIO_START_A(1);
|
|
|
|
|
|
|
|
|
|
ASSERT(_radio.role == ROLE_NONE);
|
|
|
|
|
ASSERT(_radio.ticker_id_prepare == RADIO_TICKER_ID_ADV);
|
|
|
|
|
BT_ASSERT(_radio.role == ROLE_NONE);
|
|
|
|
|
BT_ASSERT(_radio.ticker_id_prepare == RADIO_TICKER_ID_ADV);
|
|
|
|
|
|
|
|
|
|
/** @todo check if XTAL is started,
|
|
|
|
|
* options 1: abort Radio Start,
|
|
|
|
@ -3783,7 +3784,7 @@ static void event_adv(uint32_t ticks_at_expire, uint32_t remainder,
|
|
|
|
|
ticker_job_idle_get(RADIO_TICKER_INSTANCE_ID_RADIO,
|
|
|
|
|
RADIO_TICKER_USER_ID_WORKER,
|
|
|
|
|
ticker_job_disable, 0);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
@ -3809,7 +3810,7 @@ void event_adv_stop(uint32_t ticks_at_expire, uint32_t remainder,
|
|
|
|
|
ticker_stop(RADIO_TICKER_INSTANCE_ID_RADIO,
|
|
|
|
|
RADIO_TICKER_USER_ID_WORKER, RADIO_TICKER_ID_ADV,
|
|
|
|
|
ticker_success_assert, (void *)__LINE__);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
/** @todo synchronize stopping of scanner, i.e. pre-event and event
|
|
|
|
|
* needs to complete
|
|
|
|
@ -3819,17 +3820,17 @@ void event_adv_stop(uint32_t ticks_at_expire, uint32_t remainder,
|
|
|
|
|
RADIO_TICKER_USER_ID_WORKER,
|
|
|
|
|
RADIO_TICKER_ID_MARKER_0,
|
|
|
|
|
ticker_success_assert, (void *)__LINE__);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
ticker_status = ticker_stop(RADIO_TICKER_INSTANCE_ID_RADIO,
|
|
|
|
|
RADIO_TICKER_USER_ID_WORKER, RADIO_TICKER_ID_EVENT,
|
|
|
|
|
ticker_success_assert, (void *)__LINE__);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
|
|
|
|
|
/* Prepare the rx packet structure */
|
|
|
|
|
radio_pdu_node_rx = packet_rx_reserve_get(1);
|
|
|
|
|
ASSERT(radio_pdu_node_rx);
|
|
|
|
|
BT_ASSERT(radio_pdu_node_rx);
|
|
|
|
|
|
|
|
|
|
/** Connection handle */
|
|
|
|
|
radio_pdu_node_rx->hdr.handle = 0xffff;
|
|
|
|
@ -3892,7 +3893,7 @@ static void event_obs_prepare(uint32_t ticks_at_expire, uint32_t remainder,
|
|
|
|
|
|
|
|
|
|
retval = work_schedule(&_work_sched_after_master_free_offset_get,
|
|
|
|
|
1);
|
|
|
|
|
ASSERT(!retval);
|
|
|
|
|
BT_ASSERT(!retval);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
@ -3910,8 +3911,8 @@ static void event_obs(uint32_t ticks_at_expire, uint32_t remainder,
|
|
|
|
|
|
|
|
|
|
DEBUG_RADIO_START_O(1);
|
|
|
|
|
|
|
|
|
|
ASSERT(_radio.role == ROLE_NONE);
|
|
|
|
|
ASSERT(_radio.ticker_id_prepare == RADIO_TICKER_ID_OBS);
|
|
|
|
|
BT_ASSERT(_radio.role == ROLE_NONE);
|
|
|
|
|
BT_ASSERT(_radio.ticker_id_prepare == RADIO_TICKER_ID_OBS);
|
|
|
|
|
|
|
|
|
|
/** @todo check if XTAL is started, options 1: abort Radio Start,
|
|
|
|
|
* 2: wait for XTAL start
|
|
|
|
@ -3973,7 +3974,7 @@ static void event_obs(uint32_t ticks_at_expire, uint32_t remainder,
|
|
|
|
|
event_stop, (void *)STATE_STOP,
|
|
|
|
|
ticker_success_assert, (void *)__LINE__);
|
|
|
|
|
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
|
|
|
|
|
/* Ticker Job Silence */
|
|
|
|
@ -3986,7 +3987,7 @@ static void event_obs(uint32_t ticks_at_expire, uint32_t remainder,
|
|
|
|
|
RADIO_TICKER_USER_ID_WORKER,
|
|
|
|
|
ticker_job_disable, 0);
|
|
|
|
|
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
@ -4056,7 +4057,7 @@ static inline void event_conn_update_st_init(struct connection *conn,
|
|
|
|
|
work_sched_offset->params = (void *)conn;
|
|
|
|
|
|
|
|
|
|
retval = work_schedule(work_sched_offset, 1);
|
|
|
|
|
ASSERT(!retval);
|
|
|
|
|
BT_ASSERT(!retval);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
@ -4121,7 +4122,7 @@ static inline void event_conn_update_st_req(struct connection *conn,
|
|
|
|
|
work_sched_offset->params = (void *)conn;
|
|
|
|
|
|
|
|
|
|
retval = work_schedule(work_sched_offset, 1);
|
|
|
|
|
ASSERT(!retval);
|
|
|
|
|
BT_ASSERT(!retval);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
@ -4245,7 +4246,7 @@ static inline uint32_t event_conn_update_prep(struct connection *conn,
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -4285,7 +4286,8 @@ static inline uint32_t event_conn_update_prep(struct connection *conn,
|
|
|
|
|
(conn->llcp.connection_update.timeout !=
|
|
|
|
|
(conn->conn_interval * conn->supervision_reload * 125 / 1000))) {
|
|
|
|
|
radio_pdu_node_rx = packet_rx_reserve_get(2);
|
|
|
|
|
ASSERT(radio_pdu_node_rx);
|
|
|
|
|
BT_ASSERT(radio_pdu_node_rx);
|
|
|
|
|
|
|
|
|
|
radio_pdu_node_rx->hdr.handle = conn->handle;
|
|
|
|
|
radio_pdu_node_rx->hdr.type = NODE_RX_TYPE_CONN_UPDATE;
|
|
|
|
|
|
|
|
|
@ -4417,7 +4419,7 @@ static inline uint32_t event_conn_update_prep(struct connection *conn,
|
|
|
|
|
RADIO_TICKER_ID_FIRST_CONNECTION +
|
|
|
|
|
conn->handle, ticker_success_assert,
|
|
|
|
|
(void *)__LINE__);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
ticker_status =
|
|
|
|
|
ticker_start(RADIO_TICKER_INSTANCE_ID_RADIO,
|
|
|
|
@ -4433,7 +4435,7 @@ static inline uint32_t event_conn_update_prep(struct connection *conn,
|
|
|
|
|
event_slave_prepare : event_master_prepare,
|
|
|
|
|
conn, ticker_success_assert,
|
|
|
|
|
(void *)__LINE__);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
|
|
|
|
|
/* enable ticker job, if disabled in this function */
|
|
|
|
@ -4694,7 +4696,8 @@ static inline void event_vex_prep(struct connection *conn)
|
|
|
|
|
|
|
|
|
|
/* Prepare the rx packet structure */
|
|
|
|
|
radio_pdu_node_rx = packet_rx_reserve_get(2);
|
|
|
|
|
ASSERT(radio_pdu_node_rx);
|
|
|
|
|
BT_ASSERT(radio_pdu_node_rx);
|
|
|
|
|
|
|
|
|
|
radio_pdu_node_rx->hdr.handle = conn->handle;
|
|
|
|
|
radio_pdu_node_rx->hdr.type = NODE_RX_TYPE_DC_PDU;
|
|
|
|
|
|
|
|
|
@ -4716,7 +4719,7 @@ static inline void event_vex_prep(struct connection *conn)
|
|
|
|
|
packet_rx_enqueue();
|
|
|
|
|
} else {
|
|
|
|
|
/* tx-ed but no rx, and new request placed */
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -4761,7 +4764,7 @@ static inline void event_len_prep(struct connection *conn)
|
|
|
|
|
|
|
|
|
|
free_count_rx = packet_rx_acquired_count_get() +
|
|
|
|
|
mem_free_count_get(_radio.pkt_rx_data_free);
|
|
|
|
|
ASSERT(free_count_rx <= 0xFF);
|
|
|
|
|
BT_ASSERT(free_count_rx <= 0xFF);
|
|
|
|
|
|
|
|
|
|
if (_radio.packet_rx_data_count != free_count_rx) {
|
|
|
|
|
break;
|
|
|
|
@ -4811,10 +4814,10 @@ static inline void event_len_prep(struct connection *conn)
|
|
|
|
|
|
|
|
|
|
free_count_rx = packet_rx_acquired_count_get() +
|
|
|
|
|
mem_free_count_get(_radio.pkt_rx_data_free);
|
|
|
|
|
ASSERT(free_count_rx <= 0xFF);
|
|
|
|
|
BT_ASSERT(free_count_rx <= 0xFF);
|
|
|
|
|
|
|
|
|
|
if (_radio.packet_rx_data_count != free_count_rx) {
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Procedure complete */
|
|
|
|
@ -4853,7 +4856,7 @@ static inline void event_len_prep(struct connection *conn)
|
|
|
|
|
mem_release(node_rx->hdr.onion.link,
|
|
|
|
|
&_radio.link_rx_free);
|
|
|
|
|
|
|
|
|
|
ASSERT(_radio.link_rx_data_quota <
|
|
|
|
|
BT_ASSERT(_radio.link_rx_data_quota <
|
|
|
|
|
(_radio.packet_rx_count - 1));
|
|
|
|
|
_radio.link_rx_data_quota++;
|
|
|
|
|
|
|
|
|
@ -4878,7 +4881,7 @@ static inline void event_len_prep(struct connection *conn)
|
|
|
|
|
_radio.packet_rx_data_count =
|
|
|
|
|
_radio.packet_rx_data_pool_size /
|
|
|
|
|
_radio.packet_rx_data_size;
|
|
|
|
|
ASSERT(_radio.packet_rx_data_count);
|
|
|
|
|
BT_ASSERT(_radio.packet_rx_data_count);
|
|
|
|
|
|
|
|
|
|
/* re-size (re-init) the free rx pool */
|
|
|
|
|
mem_init(_radio.pkt_rx_data_pool,
|
|
|
|
@ -4894,7 +4897,7 @@ static inline void event_len_prep(struct connection *conn)
|
|
|
|
|
|
|
|
|
|
/* Prepare the rx packet structure */
|
|
|
|
|
node_rx = packet_rx_reserve_get(2);
|
|
|
|
|
ASSERT(node_rx);
|
|
|
|
|
BT_ASSERT(node_rx);
|
|
|
|
|
node_rx->hdr.handle = conn->handle;
|
|
|
|
|
node_rx->hdr.type = NODE_RX_TYPE_DC_PDU;
|
|
|
|
|
|
|
|
|
@ -4925,7 +4928,7 @@ static inline void event_len_prep(struct connection *conn)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -4992,7 +4995,7 @@ static void event_connection_prepare(uint32_t ticks_at_expire,
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -5092,10 +5095,10 @@ static void event_slave(uint32_t ticks_at_expire, uint32_t remainder,
|
|
|
|
|
|
|
|
|
|
DEBUG_RADIO_START_S(1);
|
|
|
|
|
|
|
|
|
|
ASSERT(_radio.role == ROLE_NONE);
|
|
|
|
|
BT_ASSERT(_radio.role == ROLE_NONE);
|
|
|
|
|
|
|
|
|
|
conn = (struct connection *)context;
|
|
|
|
|
ASSERT(_radio.ticker_id_prepare ==
|
|
|
|
|
BT_ASSERT(_radio.ticker_id_prepare ==
|
|
|
|
|
(RADIO_TICKER_ID_FIRST_CONNECTION + conn->handle));
|
|
|
|
|
|
|
|
|
|
_radio.role = ROLE_SLAVE;
|
|
|
|
@ -5174,7 +5177,7 @@ static void event_slave(uint32_t ticks_at_expire, uint32_t remainder,
|
|
|
|
|
ticker_job_idle_get(RADIO_TICKER_INSTANCE_ID_RADIO,
|
|
|
|
|
RADIO_TICKER_USER_ID_WORKER,
|
|
|
|
|
ticker_job_disable, 0);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
@ -5207,10 +5210,10 @@ static void event_master(uint32_t ticks_at_expire, uint32_t remainder,
|
|
|
|
|
|
|
|
|
|
DEBUG_RADIO_START_M(1);
|
|
|
|
|
|
|
|
|
|
ASSERT(_radio.role == ROLE_NONE);
|
|
|
|
|
BT_ASSERT(_radio.role == ROLE_NONE);
|
|
|
|
|
|
|
|
|
|
conn = (struct connection *)context;
|
|
|
|
|
ASSERT(_radio.ticker_id_prepare ==
|
|
|
|
|
BT_ASSERT(_radio.ticker_id_prepare ==
|
|
|
|
|
(RADIO_TICKER_ID_FIRST_CONNECTION + conn->handle));
|
|
|
|
|
|
|
|
|
|
_radio.role = ROLE_MASTER;
|
|
|
|
@ -5311,7 +5314,7 @@ static void event_master(uint32_t ticks_at_expire, uint32_t remainder,
|
|
|
|
|
ticker_job_idle_get(RADIO_TICKER_INSTANCE_ID_RADIO,
|
|
|
|
|
RADIO_TICKER_USER_ID_WORKER,
|
|
|
|
|
ticker_job_disable, 0);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
@ -5515,7 +5518,7 @@ static void packet_rx_enqueue(void)
|
|
|
|
|
struct radio_pdu_node_rx *radio_pdu_node_rx;
|
|
|
|
|
uint8_t last;
|
|
|
|
|
|
|
|
|
|
ASSERT(_radio.packet_rx_last != _radio.packet_rx_acquire);
|
|
|
|
|
BT_ASSERT(_radio.packet_rx_last != _radio.packet_rx_acquire);
|
|
|
|
|
|
|
|
|
|
/* Remember the rx node and acquired link mem */
|
|
|
|
|
radio_pdu_node_rx = _radio.packet_rx[_radio.packet_rx_last];
|
|
|
|
@ -5537,7 +5540,7 @@ static void packet_rx_enqueue(void)
|
|
|
|
|
/* Enqueue into event-cum-data queue */
|
|
|
|
|
link = memq_enqueue(radio_pdu_node_rx, link,
|
|
|
|
|
(void *)&_radio.link_rx_tail);
|
|
|
|
|
ASSERT(link);
|
|
|
|
|
BT_ASSERT(link);
|
|
|
|
|
|
|
|
|
|
/* callback to trigger application action */
|
|
|
|
|
radio_event_callback();
|
|
|
|
@ -5645,7 +5648,7 @@ static void ctrl_tx_enqueue(struct connection *conn,
|
|
|
|
|
conn->pkt_tx_ctrl = node_tx;
|
|
|
|
|
} else {
|
|
|
|
|
/* More than 2 pending ctrl not supported */
|
|
|
|
|
ASSERT(conn->pkt_tx_ctrl->next == conn->pkt_tx_data);
|
|
|
|
|
BT_ASSERT(conn->pkt_tx_ctrl->next == conn->pkt_tx_data);
|
|
|
|
|
|
|
|
|
|
node_tx->next = conn->pkt_tx_ctrl->next;
|
|
|
|
|
conn->pkt_tx_ctrl->next = node_tx;
|
|
|
|
@ -5680,7 +5683,7 @@ static void pdu_node_tx_release(uint16_t handle,
|
|
|
|
|
last = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ASSERT(last != _radio.packet_release_first);
|
|
|
|
|
BT_ASSERT(last != _radio.packet_release_first);
|
|
|
|
|
|
|
|
|
|
/* Enqueue app mem for release */
|
|
|
|
|
_radio.pkt_release[_radio.packet_release_last].handle = handle;
|
|
|
|
@ -5709,7 +5712,7 @@ static void connection_release(struct connection *conn)
|
|
|
|
|
RADIO_TICKER_USER_ID_WORKER,
|
|
|
|
|
(RADIO_TICKER_ID_FIRST_CONNECTION + conn->handle),
|
|
|
|
|
ticker_success_assert, (void *)__LINE__);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
|
|
|
|
|
/* Stop Marker 0 and event single-shot tickers */
|
|
|
|
@ -5721,14 +5724,14 @@ static void connection_release(struct connection *conn)
|
|
|
|
|
RADIO_TICKER_USER_ID_WORKER,
|
|
|
|
|
RADIO_TICKER_ID_MARKER_0,
|
|
|
|
|
ticker_success_assert, (void *)__LINE__);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
ticker_status =
|
|
|
|
|
ticker_stop(RADIO_TICKER_INSTANCE_ID_RADIO,
|
|
|
|
|
RADIO_TICKER_USER_ID_WORKER,
|
|
|
|
|
RADIO_TICKER_ID_EVENT,
|
|
|
|
|
ticker_success_assert, (void *)__LINE__);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -5797,7 +5800,8 @@ static void terminate_ind_rx_enqueue(struct connection *conn, uint8_t reason)
|
|
|
|
|
/* Prepare the rx packet structure */
|
|
|
|
|
radio_pdu_node_rx =
|
|
|
|
|
(struct radio_pdu_node_rx *)&conn->llcp_terminate.radio_pdu_node_rx;
|
|
|
|
|
ASSERT(radio_pdu_node_rx->hdr.onion.link);
|
|
|
|
|
BT_ASSERT(radio_pdu_node_rx->hdr.onion.link);
|
|
|
|
|
|
|
|
|
|
radio_pdu_node_rx->hdr.handle = conn->handle;
|
|
|
|
|
radio_pdu_node_rx->hdr.type = NODE_RX_TYPE_TERMINATE;
|
|
|
|
|
*((uint8_t *)radio_pdu_node_rx->pdu_data) = reason;
|
|
|
|
@ -5814,7 +5818,7 @@ static void terminate_ind_rx_enqueue(struct connection *conn, uint8_t reason)
|
|
|
|
|
/* Enqueue into event-cum-data queue */
|
|
|
|
|
link = memq_enqueue(radio_pdu_node_rx, link,
|
|
|
|
|
(void *)&_radio.link_rx_tail);
|
|
|
|
|
ASSERT(link);
|
|
|
|
|
BT_ASSERT(link);
|
|
|
|
|
|
|
|
|
|
/* callback to trigger application action */
|
|
|
|
|
radio_event_callback();
|
|
|
|
@ -5828,7 +5832,7 @@ static uint32_t conn_update(struct connection *conn,
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ASSERT((conn->llcp_req == conn->llcp_ack) ||
|
|
|
|
|
BT_ASSERT((conn->llcp_req == conn->llcp_ack) ||
|
|
|
|
|
((conn->llcp_type == LLCP_CONNECTION_UPDATE) &&
|
|
|
|
|
(conn->llcp.connection_update.state ==
|
|
|
|
|
LLCP_CONN_STATE_RSP_WAIT)));
|
|
|
|
@ -5837,7 +5841,7 @@ static uint32_t conn_update(struct connection *conn,
|
|
|
|
|
* be set, but a slave we accept it as new 'set' of mutex.
|
|
|
|
|
*/
|
|
|
|
|
if (_radio.conn_upd == 0) {
|
|
|
|
|
ASSERT(conn->role.slave.role != 0);
|
|
|
|
|
BT_ASSERT(conn->role.slave.role != 0);
|
|
|
|
|
|
|
|
|
|
_radio.conn_upd = conn;
|
|
|
|
|
}
|
|
|
|
@ -5909,7 +5913,7 @@ static uint32_t channel_map_update(struct connection *conn,
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ASSERT(conn->llcp_req == conn->llcp_ack);
|
|
|
|
|
BT_ASSERT(conn->llcp_req == conn->llcp_ack);
|
|
|
|
|
|
|
|
|
|
memcpy(&conn->llcp.channel_map.chm[0],
|
|
|
|
|
&pdu_data_rx->payload.llctrl.ctrldata.channel_map_req.chm[0],
|
|
|
|
@ -5956,7 +5960,7 @@ static void enc_rsp_send(struct connection *conn)
|
|
|
|
|
|
|
|
|
|
/* acquire tx mem */
|
|
|
|
|
node_tx = mem_acquire(&_radio.pkt_tx_ctrl_free);
|
|
|
|
|
ASSERT(node_tx);
|
|
|
|
|
BT_ASSERT(node_tx);
|
|
|
|
|
|
|
|
|
|
pdu_ctrl_tx = (struct pdu_data *)node_tx->pdu_data;
|
|
|
|
|
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
|
|
|
|
@ -5987,7 +5991,7 @@ static void start_enc_rsp_send(struct connection *conn,
|
|
|
|
|
if (!pdu_ctrl_tx) {
|
|
|
|
|
/* acquire tx mem */
|
|
|
|
|
node_tx = mem_acquire(&_radio.pkt_tx_ctrl_free);
|
|
|
|
|
ASSERT(node_tx);
|
|
|
|
|
BT_ASSERT(node_tx);
|
|
|
|
|
|
|
|
|
|
pdu_ctrl_tx = (struct pdu_data *)node_tx->pdu_data;
|
|
|
|
|
}
|
|
|
|
@ -6009,7 +6013,7 @@ static void unknown_rsp_send(struct connection *conn, uint8_t type)
|
|
|
|
|
|
|
|
|
|
/* acquire tx mem */
|
|
|
|
|
node_tx = mem_acquire(&_radio.pkt_tx_ctrl_free);
|
|
|
|
|
ASSERT(node_tx);
|
|
|
|
|
BT_ASSERT(node_tx);
|
|
|
|
|
|
|
|
|
|
pdu_ctrl_tx = (struct pdu_data *)node_tx->pdu_data;
|
|
|
|
|
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
|
|
|
|
@ -6028,7 +6032,7 @@ static void feature_rsp_send(struct connection *conn)
|
|
|
|
|
|
|
|
|
|
/* acquire tx mem */
|
|
|
|
|
node_tx = mem_acquire(&_radio.pkt_tx_ctrl_free);
|
|
|
|
|
ASSERT(node_tx);
|
|
|
|
|
BT_ASSERT(node_tx);
|
|
|
|
|
|
|
|
|
|
pdu_ctrl_tx = (struct pdu_data *)node_tx->pdu_data;
|
|
|
|
|
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
|
|
|
|
@ -6051,7 +6055,7 @@ static void pause_enc_rsp_send(struct connection *conn)
|
|
|
|
|
|
|
|
|
|
/* acquire tx mem */
|
|
|
|
|
node_tx = mem_acquire(&_radio.pkt_tx_ctrl_free);
|
|
|
|
|
ASSERT(node_tx);
|
|
|
|
|
BT_ASSERT(node_tx);
|
|
|
|
|
|
|
|
|
|
pdu_ctrl_tx = (struct pdu_data *)node_tx->pdu_data;
|
|
|
|
|
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
|
|
|
|
@ -6069,7 +6073,7 @@ static void version_ind_send(struct connection *conn)
|
|
|
|
|
|
|
|
|
|
/* acquire tx mem */
|
|
|
|
|
node_tx = mem_acquire(&_radio.pkt_tx_ctrl_free);
|
|
|
|
|
ASSERT(node_tx);
|
|
|
|
|
BT_ASSERT(node_tx);
|
|
|
|
|
|
|
|
|
|
pdu_ctrl_tx = (struct pdu_data *)node_tx->pdu_data;
|
|
|
|
|
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
|
|
|
|
@ -6096,7 +6100,7 @@ static void ping_resp_send(struct connection *conn)
|
|
|
|
|
|
|
|
|
|
/* acquire tx mem */
|
|
|
|
|
node_tx = mem_acquire(&_radio.pkt_tx_ctrl_free);
|
|
|
|
|
ASSERT(node_tx);
|
|
|
|
|
BT_ASSERT(node_tx);
|
|
|
|
|
|
|
|
|
|
pdu_ctrl_tx = (struct pdu_data *)node_tx->pdu_data;
|
|
|
|
|
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
|
|
|
|
@ -6114,7 +6118,7 @@ static void reject_ind_ext_send(struct connection *conn,
|
|
|
|
|
|
|
|
|
|
/* acquire tx mem */
|
|
|
|
|
node_tx = mem_acquire(&_radio.pkt_tx_ctrl_free);
|
|
|
|
|
ASSERT(node_tx);
|
|
|
|
|
BT_ASSERT(node_tx);
|
|
|
|
|
|
|
|
|
|
pdu_ctrl_tx = (struct pdu_data *)node_tx->pdu_data;
|
|
|
|
|
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
|
|
|
|
@ -6137,7 +6141,7 @@ static void length_resp_send(struct connection *conn, uint16_t eff_rx_octets,
|
|
|
|
|
struct pdu_data *pdu_ctrl_tx;
|
|
|
|
|
|
|
|
|
|
node_tx = mem_acquire(&_radio.pkt_tx_ctrl_free);
|
|
|
|
|
ASSERT(node_tx);
|
|
|
|
|
BT_ASSERT(node_tx);
|
|
|
|
|
|
|
|
|
|
pdu_ctrl_tx = (struct pdu_data *) node_tx->pdu_data;
|
|
|
|
|
pdu_ctrl_tx->ll_id = PDU_DATA_LLID_CTRL;
|
|
|
|
@ -6232,7 +6236,7 @@ static inline void do_adv_scan_disable(uint8_t ticker_id_stop,
|
|
|
|
|
if (ticker_status_event == TICKER_STATUS_BUSY) {
|
|
|
|
|
work_enable(WORK_TICKER_JOB0_IRQ);
|
|
|
|
|
|
|
|
|
|
ASSERT(ticker_status_event != TICKER_STATUS_BUSY);
|
|
|
|
|
BT_ASSERT(ticker_status_event != TICKER_STATUS_BUSY);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ticker_status_event == TICKER_STATUS_SUCCESS) {
|
|
|
|
@ -6253,7 +6257,7 @@ static inline void do_adv_scan_disable(uint8_t ticker_id_stop,
|
|
|
|
|
if (ticker_status_pre_event == TICKER_STATUS_BUSY) {
|
|
|
|
|
work_enable(WORK_TICKER_JOB0_IRQ);
|
|
|
|
|
|
|
|
|
|
ASSERT(ticker_status_event != TICKER_STATUS_BUSY);
|
|
|
|
|
BT_ASSERT(ticker_status_event != TICKER_STATUS_BUSY);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ticker_status_pre_event == TICKER_STATUS_SUCCESS) {
|
|
|
|
@ -6268,13 +6272,13 @@ static inline void do_adv_scan_disable(uint8_t ticker_id_stop,
|
|
|
|
|
*/
|
|
|
|
|
retval = work_schedule(&s_work_radio_inactive,
|
|
|
|
|
0);
|
|
|
|
|
ASSERT(!retval);
|
|
|
|
|
BT_ASSERT(!retval);
|
|
|
|
|
} else {
|
|
|
|
|
uint32_t retval;
|
|
|
|
|
|
|
|
|
|
/* XTAL started, handle XTAL stop here */
|
|
|
|
|
retval = work_schedule(&s_work_xtal_stop, 0);
|
|
|
|
|
ASSERT(!retval);
|
|
|
|
|
BT_ASSERT(!retval);
|
|
|
|
|
}
|
|
|
|
|
} else if (ticker_status_pre_event == TICKER_STATUS_FAILURE) {
|
|
|
|
|
uint32_t retval;
|
|
|
|
@ -6283,13 +6287,13 @@ static inline void do_adv_scan_disable(uint8_t ticker_id_stop,
|
|
|
|
|
|
|
|
|
|
/* radio active asserted, handle deasserting here */
|
|
|
|
|
retval = work_schedule(&s_work_radio_inactive, 0);
|
|
|
|
|
ASSERT(!retval);
|
|
|
|
|
BT_ASSERT(!retval);
|
|
|
|
|
|
|
|
|
|
/* XTAL started, handle XTAL stop here */
|
|
|
|
|
retval = work_schedule(&s_work_xtal_stop, 0);
|
|
|
|
|
ASSERT(!retval);
|
|
|
|
|
BT_ASSERT(!retval);
|
|
|
|
|
} else {
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
} else if (ticker_status_event == TICKER_STATUS_FAILURE) {
|
|
|
|
|
uint32_t volatile ticker_status_stop;
|
|
|
|
@ -6309,10 +6313,10 @@ static inline void do_adv_scan_disable(uint8_t ticker_id_stop,
|
|
|
|
|
if (ticker_status_stop == TICKER_STATUS_BUSY) {
|
|
|
|
|
work_enable(WORK_TICKER_JOB0_IRQ);
|
|
|
|
|
|
|
|
|
|
ASSERT(ticker_status_event != TICKER_STATUS_BUSY);
|
|
|
|
|
BT_ASSERT(ticker_status_event != TICKER_STATUS_BUSY);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ASSERT((ticker_status_stop == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status_stop == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status_stop == TICKER_STATUS_FAILURE));
|
|
|
|
|
|
|
|
|
|
if (_radio.role != ROLE_NONE) {
|
|
|
|
@ -6326,7 +6330,7 @@ static inline void do_adv_scan_disable(uint8_t ticker_id_stop,
|
|
|
|
|
|
|
|
|
|
/* Stop Radio Tx/Rx */
|
|
|
|
|
retval = work_schedule(&s_work_radio_stop, 0);
|
|
|
|
|
ASSERT(!retval);
|
|
|
|
|
BT_ASSERT(!retval);
|
|
|
|
|
|
|
|
|
|
/* wait for radio ISR to exit */
|
|
|
|
|
while (_radio.role != ROLE_NONE) {
|
|
|
|
@ -6334,7 +6338,7 @@ static inline void do_adv_scan_disable(uint8_t ticker_id_stop,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -7199,7 +7203,7 @@ void radio_rx_dequeue(void)
|
|
|
|
|
|
|
|
|
|
link = memq_dequeue(_radio.link_rx_tail, &_radio.link_rx_head,
|
|
|
|
|
(void **)&radio_pdu_node_rx);
|
|
|
|
|
ASSERT(link);
|
|
|
|
|
BT_ASSERT(link);
|
|
|
|
|
|
|
|
|
|
mem_release(link, &_radio.link_rx_free);
|
|
|
|
|
|
|
|
|
@ -7213,7 +7217,7 @@ void radio_rx_dequeue(void)
|
|
|
|
|
case NODE_RX_TYPE_APTO:
|
|
|
|
|
case NODE_RX_TYPE_RSSI:
|
|
|
|
|
/* release data link credit quota */
|
|
|
|
|
ASSERT(_radio.link_rx_data_quota <
|
|
|
|
|
BT_ASSERT(_radio.link_rx_data_quota <
|
|
|
|
|
(_radio.packet_rx_count - 1));
|
|
|
|
|
|
|
|
|
|
_radio.link_rx_data_quota++;
|
|
|
|
@ -7224,7 +7228,7 @@ void radio_rx_dequeue(void)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -7262,7 +7266,7 @@ void radio_rx_mem_release(struct radio_pdu_node_rx **radio_pdu_node_rx)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
BT_ASSERT(0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -7357,7 +7361,7 @@ static void ticker_op_latency_cancelled(uint32_t ticker_status,
|
|
|
|
|
{
|
|
|
|
|
struct connection *conn;
|
|
|
|
|
|
|
|
|
|
ASSERT(ticker_status == TICKER_STATUS_SUCCESS);
|
|
|
|
|
BT_ASSERT(ticker_status == TICKER_STATUS_SUCCESS);
|
|
|
|
|
|
|
|
|
|
conn = (struct connection *)params;
|
|
|
|
|
conn->role.slave.latency_cancel = 0;
|
|
|
|
@ -7399,7 +7403,7 @@ uint32_t radio_tx_mem_enqueue(uint16_t handle,
|
|
|
|
|
conn->handle, 0, 0, 0, 0, 1, 0,
|
|
|
|
|
ticker_op_latency_cancelled,
|
|
|
|
|
(void *)conn);
|
|
|
|
|
ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
BT_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) ||
|
|
|
|
|
(ticker_status == TICKER_STATUS_BUSY));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|