mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-09-04 16:20:00 +00:00
nimble/ll: Simplify connsm flags
Since we no longer use union with uint32_t to clear flags, there's no point in having union so let's just convert it to regular struct.
This commit is contained in:
@@ -98,47 +98,46 @@ struct ble_ll_conn_enc_data
|
||||
#endif
|
||||
|
||||
/* Connection state machine flags. */
|
||||
union ble_ll_conn_sm_flags {
|
||||
struct {
|
||||
uint32_t pkt_rxd:1;
|
||||
uint32_t terminate_ind_txd:1;
|
||||
uint32_t terminate_ind_rxd:1;
|
||||
uint32_t terminate_ind_rxd_acked:1;
|
||||
uint32_t allow_periph_latency:1;
|
||||
uint32_t periph_set_last_anchor:1;
|
||||
uint32_t awaiting_host_reply:1;
|
||||
uint32_t terminate_started:1;
|
||||
uint32_t conn_update_sched:1;
|
||||
uint32_t conn_update_use_cp:1;
|
||||
uint32_t host_expects_upd_event:1;
|
||||
uint32_t version_ind_sent:1;
|
||||
uint32_t rxd_version_ind:1;
|
||||
uint32_t chanmap_update_scheduled:1;
|
||||
uint32_t conn_empty_pdu_txd:1;
|
||||
uint32_t last_txd_md:1;
|
||||
uint32_t conn_req_txd:1;
|
||||
uint32_t send_ltk_req:1;
|
||||
uint32_t encrypted:1;
|
||||
uint32_t encrypt_chg_sent:1;
|
||||
uint32_t le_ping_supp:1;
|
||||
uint32_t csa2_supp:1;
|
||||
uint32_t host_phy_update: 1;
|
||||
uint32_t phy_update_sched: 1;
|
||||
uint32_t ctrlr_phy_update: 1;
|
||||
uint32_t phy_update_event: 1;
|
||||
uint32_t peer_phy_update: 1; /* XXX:combine with ctrlr udpate bit? */
|
||||
uint32_t aux_conn_req: 1;
|
||||
uint32_t rxd_features:1;
|
||||
uint32_t pending_hci_rd_features:1;
|
||||
struct ble_ll_conn_sm_flags {
|
||||
uint32_t pkt_rxd : 1;
|
||||
uint32_t terminate_ind_txd : 1;
|
||||
uint32_t terminate_ind_rxd : 1;
|
||||
uint32_t terminate_ind_rxd_acked : 1;
|
||||
uint32_t allow_periph_latency : 1;
|
||||
uint32_t periph_set_last_anchor : 1;
|
||||
uint32_t awaiting_host_reply : 1;
|
||||
uint32_t terminate_started : 1;
|
||||
uint32_t conn_update_sched : 1;
|
||||
uint32_t conn_update_use_cp : 1;
|
||||
uint32_t host_expects_upd_event : 1;
|
||||
uint32_t version_ind_sent : 1;
|
||||
uint32_t rxd_version_ind : 1;
|
||||
uint32_t chanmap_update_scheduled : 1;
|
||||
uint32_t conn_empty_pdu_txd : 1;
|
||||
uint32_t last_txd_md : 1;
|
||||
uint32_t conn_req_txd : 1;
|
||||
uint32_t send_ltk_req : 1;
|
||||
uint32_t encrypted : 1;
|
||||
uint32_t encrypt_chg_sent : 1;
|
||||
uint32_t le_ping_supp : 1;
|
||||
uint32_t csa2_supp : 1;
|
||||
uint32_t host_phy_update: 1;
|
||||
uint32_t phy_update_sched: 1;
|
||||
uint32_t ctrlr_phy_update: 1;
|
||||
uint32_t phy_update_event: 1;
|
||||
uint32_t peer_phy_update: 1; /* XXX:combine with ctrlr udpate bit? */
|
||||
uint32_t aux_conn_req: 1;
|
||||
uint32_t rxd_features : 1;
|
||||
uint32_t pending_hci_rd_features : 1;
|
||||
#if MYNEWT_VAL(BLE_LL_CONN_INIT_AUTO_DLE)
|
||||
uint32_t pending_initiate_dle:1;
|
||||
uint32_t pending_initiate_dle : 1;
|
||||
#endif
|
||||
uint32_t subrate_trans:1;
|
||||
uint32_t subrate_ind_txd:1;
|
||||
uint32_t subrate_host_req:1;
|
||||
} cfbit;
|
||||
uint32_t conn_flags;
|
||||
} __attribute__((packed));
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_ENHANCED_CONN_UPDATE)
|
||||
uint8_t subrate_trans : 1;
|
||||
uint8_t subrate_ind_txd : 1;
|
||||
uint8_t subrate_host_req : 1;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* Structure used for PHY data inside a connection.
|
||||
@@ -207,7 +206,7 @@ struct ble_ll_conn_subrate_req_params {
|
||||
struct ble_ll_conn_sm
|
||||
{
|
||||
/* Connection state machine flags */
|
||||
union ble_ll_conn_sm_flags csmflags;
|
||||
struct ble_ll_conn_sm_flags flags;
|
||||
|
||||
/* Current connection handle, state and role */
|
||||
uint16_t conn_handle;
|
||||
@@ -402,21 +401,21 @@ struct ble_ll_conn_sm
|
||||
};
|
||||
|
||||
/* Flags */
|
||||
#define CONN_F_UPDATE_SCHED(csm) ((csm)->csmflags.cfbit.conn_update_sched)
|
||||
#define CONN_F_EMPTY_PDU_TXD(csm) ((csm)->csmflags.cfbit.conn_empty_pdu_txd)
|
||||
#define CONN_F_LAST_TXD_MD(csm) ((csm)->csmflags.cfbit.last_txd_md)
|
||||
#define CONN_F_CONN_REQ_TXD(csm) ((csm)->csmflags.cfbit.conn_req_txd)
|
||||
#define CONN_F_ENCRYPTED(csm) ((csm)->csmflags.cfbit.encrypted)
|
||||
#define CONN_F_ENC_CHANGE_SENT(csm) ((csm)->csmflags.cfbit.encrypt_chg_sent)
|
||||
#define CONN_F_LE_PING_SUPP(csm) ((csm)->csmflags.cfbit.le_ping_supp)
|
||||
#define CONN_F_TERMINATE_STARTED(csm) ((csm)->csmflags.cfbit.terminate_started)
|
||||
#define CONN_F_CSA2_SUPP(csm) ((csm)->csmflags.cfbit.csa2_supp)
|
||||
#define CONN_F_HOST_PHY_UPDATE(csm) ((csm)->csmflags.cfbit.host_phy_update)
|
||||
#define CONN_F_PHY_UPDATE_SCHED(csm) ((csm)->csmflags.cfbit.phy_update_sched)
|
||||
#define CONN_F_CTRLR_PHY_UPDATE(csm) ((csm)->csmflags.cfbit.ctrlr_phy_update)
|
||||
#define CONN_F_PHY_UPDATE_EVENT(csm) ((csm)->csmflags.cfbit.phy_update_event)
|
||||
#define CONN_F_PEER_PHY_UPDATE(csm) ((csm)->csmflags.cfbit.peer_phy_update)
|
||||
#define CONN_F_AUX_CONN_REQ(csm) ((csm)->csmflags.cfbit.aux_conn_req)
|
||||
#define CONN_F_UPDATE_SCHED(csm) ((csm)->csmflags.conn_update_sched)
|
||||
#define CONN_F_EMPTY_PDU_TXD(csm) ((csm)->flags.conn_empty_pdu_txd)
|
||||
#define CONN_F_LAST_TXD_MD(csm) ((csm)->flags.last_txd_md)
|
||||
#define CONN_F_CONN_REQ_TXD(csm) ((csm)->csmflags.conn_req_txd)
|
||||
#define CONN_F_ENCRYPTED(csm) ((csm)->flags.encrypted)
|
||||
#define CONN_F_ENC_CHANGE_SENT(csm) ((csm)->flags.encrypt_chg_sent)
|
||||
#define CONN_F_LE_PING_SUPP(csm) ((csm)->flags.le_ping_supp)
|
||||
#define CONN_F_TERMINATE_STARTED(csm) ((csm)->flags.terminate_started)
|
||||
#define CONN_F_CSA2_SUPP(csm) ((csm)->flags.csa2_supp)
|
||||
#define CONN_F_HOST_PHY_UPDATE(csm) ((csm)->flags.host_phy_update)
|
||||
#define CONN_F_PHY_UPDATE_SCHED(csm) ((csm)->flags.phy_update_sched)
|
||||
#define CONN_F_CTRLR_PHY_UPDATE(csm) ((csm)->flags.ctrlr_phy_update)
|
||||
#define CONN_F_PHY_UPDATE_EVENT(csm) ((csm)->flags.phy_update_event)
|
||||
#define CONN_F_PEER_PHY_UPDATE(csm) ((csm)->flags.peer_phy_update)
|
||||
#define CONN_F_AUX_CONN_REQ(csm) ((csm)->csmflags.aux_conn_req)
|
||||
|
||||
/* Role */
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL)
|
||||
|
||||
@@ -969,7 +969,7 @@ ble_ll_conn_chk_csm_flags(struct ble_ll_conn_sm *connsm)
|
||||
uint8_t update_status;
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION)
|
||||
if (connsm->csmflags.cfbit.send_ltk_req) {
|
||||
if (connsm->flags.send_ltk_req) {
|
||||
/*
|
||||
* Send Long term key request event to host. If masked, we need to
|
||||
* send a REJECT_IND.
|
||||
@@ -978,7 +978,7 @@ ble_ll_conn_chk_csm_flags(struct ble_ll_conn_sm *connsm)
|
||||
ble_ll_ctrl_reject_ind_send(connsm, BLE_LL_CTRL_ENC_REQ,
|
||||
BLE_ERR_PINKEY_MISSING);
|
||||
}
|
||||
connsm->csmflags.cfbit.send_ltk_req = 0;
|
||||
connsm->flags.send_ltk_req = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -988,7 +988,7 @@ ble_ll_conn_chk_csm_flags(struct ble_ll_conn_sm *connsm)
|
||||
* has passed the instant.
|
||||
* 2) We successfully sent the reject reason.
|
||||
*/
|
||||
if (connsm->csmflags.cfbit.host_expects_upd_event) {
|
||||
if (connsm->flags.host_expects_upd_event) {
|
||||
update_status = BLE_ERR_SUCCESS;
|
||||
if (IS_PENDING_CTRL_PROC(connsm, BLE_LL_CTRL_PROC_CONN_UPDATE)) {
|
||||
ble_ll_ctrl_proc_stop(connsm, BLE_LL_CTRL_PROC_CONN_UPDATE);
|
||||
@@ -999,7 +999,7 @@ ble_ll_conn_chk_csm_flags(struct ble_ll_conn_sm *connsm)
|
||||
}
|
||||
}
|
||||
ble_ll_hci_ev_conn_update(connsm, update_status);
|
||||
connsm->csmflags.cfbit.host_expects_upd_event = 0;
|
||||
connsm->flags.host_expects_upd_event = 0;
|
||||
}
|
||||
|
||||
/* Check if we need to send PHY update complete event */
|
||||
@@ -1014,12 +1014,12 @@ ble_ll_conn_chk_csm_flags(struct ble_ll_conn_sm *connsm)
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_ENHANCED_CONN_UPDATE)
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL)
|
||||
if (connsm->csmflags.cfbit.subrate_ind_txd) {
|
||||
if (connsm->flags.subrate_ind_txd) {
|
||||
ble_ll_conn_subrate_set(connsm, &connsm->subrate_trans);
|
||||
connsm->subrate_trans.subrate_factor = 0;
|
||||
ble_ll_ctrl_proc_stop(connsm, BLE_LL_CTRL_PROC_SUBRATE_UPDATE);
|
||||
connsm->csmflags.cfbit.subrate_ind_txd = 0;
|
||||
connsm->csmflags.cfbit.subrate_host_req = 0;
|
||||
connsm->flags.subrate_ind_txd = 0;
|
||||
connsm->flags.subrate_host_req = 0;
|
||||
}
|
||||
#endif /* BLE_LL_CTRL_SUBRATE_IND */
|
||||
#endif /* BLE_LL_CFG_FEAT_LL_ENHANCED_CONN_UPDATE */
|
||||
@@ -1109,7 +1109,7 @@ ble_ll_conn_tx_pdu(struct ble_ll_conn_sm *connsm)
|
||||
md = 0;
|
||||
hdr_byte = BLE_LL_LLID_DATA_FRAG;
|
||||
|
||||
if (connsm->csmflags.cfbit.terminate_ind_rxd) {
|
||||
if (connsm->flags.terminate_ind_rxd) {
|
||||
/* We just received terminate indication.
|
||||
* Just send empty packet as an ACK
|
||||
*/
|
||||
@@ -1337,7 +1337,7 @@ conn_tx_pdu:
|
||||
* We could do this. Now, we just keep going and hope that we dont
|
||||
* overrun next scheduled item.
|
||||
*/
|
||||
if ((connsm->csmflags.cfbit.terminate_ind_rxd) ||
|
||||
if ((connsm->flags.terminate_ind_rxd) ||
|
||||
(CONN_IS_PERIPHERAL(connsm) && (md == 0) &&
|
||||
(connsm->cons_rxd_bad_crc == 0) &&
|
||||
((connsm->last_rxd_hdr_byte & BLE_LL_DATA_HDR_MD_MASK) == 0) &&
|
||||
@@ -1449,8 +1449,8 @@ conn_tx_pdu:
|
||||
|
||||
/* Increment packets transmitted */
|
||||
if (CONN_F_EMPTY_PDU_TXD(connsm)) {
|
||||
if (connsm->csmflags.cfbit.terminate_ind_rxd) {
|
||||
connsm->csmflags.cfbit.terminate_ind_rxd_acked = 1;
|
||||
if (connsm->flags.terminate_ind_rxd) {
|
||||
connsm->flags.terminate_ind_rxd_acked = 1;
|
||||
}
|
||||
STATS_INC(ble_ll_conn_stats, tx_empty_pdus);
|
||||
} else if ((hdr_byte & BLE_LL_DATA_HDR_LLID_MASK) == BLE_LL_LLID_CTRL) {
|
||||
@@ -1582,7 +1582,7 @@ ble_ll_conn_event_start_cb(struct ble_ll_sched_item *sch)
|
||||
* Set flag that tells peripheral to set last anchor point if a packet
|
||||
* has been received.
|
||||
*/
|
||||
connsm->csmflags.cfbit.periph_set_last_anchor = 1;
|
||||
connsm->flags.periph_set_last_anchor = 1;
|
||||
|
||||
/*
|
||||
* Set the wait for response time. The anchor point is when we
|
||||
@@ -1976,7 +1976,7 @@ ble_ll_conn_sm_new(struct ble_ll_conn_sm *connsm)
|
||||
struct ble_ll_conn_global_params *conn_params;
|
||||
|
||||
/* Reset following elements */
|
||||
memset(&connsm->csmflags, 0, sizeof(connsm->csmflags));
|
||||
memset(&connsm->flags, 0, sizeof(connsm->flags));
|
||||
connsm->event_cntr = 0;
|
||||
connsm->conn_state = BLE_LL_CONN_STATE_IDLE;
|
||||
connsm->disconnect_reason = 0;
|
||||
@@ -2239,19 +2239,19 @@ ble_ll_conn_end(struct ble_ll_conn_sm *connsm, uint8_t ble_err)
|
||||
* If we have features and there's pending HCI command, send an event before
|
||||
* disconnection event so it does make sense to host.
|
||||
*/
|
||||
if (connsm->csmflags.cfbit.pending_hci_rd_features &&
|
||||
connsm->csmflags.cfbit.rxd_features) {
|
||||
if (connsm->flags.pending_hci_rd_features &&
|
||||
connsm->flags.rxd_features) {
|
||||
ble_ll_hci_ev_rd_rem_used_feat(connsm, BLE_ERR_SUCCESS);
|
||||
connsm->csmflags.cfbit.pending_hci_rd_features = 0;
|
||||
connsm->flags.pending_hci_rd_features = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* If there is still pending read features request HCI command, send an
|
||||
* event to complete it.
|
||||
*/
|
||||
if (connsm->csmflags.cfbit.pending_hci_rd_features) {
|
||||
if (connsm->flags.pending_hci_rd_features) {
|
||||
ble_ll_hci_ev_rd_rem_used_feat(connsm, ble_err);
|
||||
connsm->csmflags.cfbit.pending_hci_rd_features = 0;
|
||||
connsm->flags.pending_hci_rd_features = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2263,7 +2263,7 @@ ble_ll_conn_end(struct ble_ll_conn_sm *connsm, uint8_t ble_err)
|
||||
* received and we should not send an event.
|
||||
*/
|
||||
if (ble_err && (ble_err != BLE_ERR_UNK_CONN_ID ||
|
||||
connsm->csmflags.cfbit.terminate_ind_rxd)) {
|
||||
connsm->flags.terminate_ind_rxd)) {
|
||||
ble_ll_disconn_comp_event_send(connsm, ble_err);
|
||||
}
|
||||
|
||||
@@ -2413,11 +2413,11 @@ ble_ll_conn_next_event(struct ble_ll_conn_sm *connsm)
|
||||
/* Set event counter to the next connection event that we will tx/rx in */
|
||||
|
||||
use_periph_latency = next_is_subrated &&
|
||||
connsm->csmflags.cfbit.allow_periph_latency &&
|
||||
!connsm->csmflags.cfbit.conn_update_sched &&
|
||||
!connsm->csmflags.cfbit.phy_update_sched &&
|
||||
!connsm->csmflags.cfbit.chanmap_update_scheduled &&
|
||||
connsm->csmflags.cfbit.pkt_rxd;
|
||||
connsm->flags.allow_periph_latency &&
|
||||
!connsm->flags.conn_update_sched &&
|
||||
!connsm->flags.phy_update_sched &&
|
||||
!connsm->flags.chanmap_update_scheduled &&
|
||||
connsm->flags.pkt_rxd;
|
||||
|
||||
if (next_is_subrated) {
|
||||
next_event_cntr = base_event_cntr + subrate_factor;
|
||||
@@ -2429,7 +2429,7 @@ ble_ll_conn_next_event(struct ble_ll_conn_sm *connsm)
|
||||
/* If we are in subrate transition mode, we should also listen on
|
||||
* subrated connection events based on new parameters.
|
||||
*/
|
||||
if (connsm->csmflags.cfbit.subrate_trans) {
|
||||
if (connsm->flags.subrate_trans) {
|
||||
BLE_LL_ASSERT(CONN_IS_CENTRAL(connsm));
|
||||
|
||||
cstp = &connsm->subrate_trans;
|
||||
@@ -2455,7 +2455,7 @@ ble_ll_conn_next_event(struct ble_ll_conn_sm *connsm)
|
||||
* and one connection event before instant regardless of subrating.
|
||||
*/
|
||||
if (CONN_IS_PERIPHERAL(connsm) &&
|
||||
connsm->csmflags.cfbit.conn_update_sched &&
|
||||
connsm->flags.conn_update_sched &&
|
||||
(connsm->subrate_factor > 1)) {
|
||||
subrate_conn_upd_event_cntr = connsm->conn_update_req.instant - 1;
|
||||
if (connsm->event_cntr == subrate_conn_upd_event_cntr) {
|
||||
@@ -2524,7 +2524,7 @@ ble_ll_conn_next_event(struct ble_ll_conn_sm *connsm)
|
||||
* connection by the the transmit window offset. We also copy in the
|
||||
* update parameters as they now should take effect.
|
||||
*/
|
||||
if (connsm->csmflags.cfbit.conn_update_sched &&
|
||||
if (connsm->flags.conn_update_sched &&
|
||||
(connsm->event_cntr == connsm->conn_update_req.instant)) {
|
||||
|
||||
/* Set flag so we send connection update event */
|
||||
@@ -2535,7 +2535,7 @@ ble_ll_conn_next_event(struct ble_ll_conn_sm *connsm)
|
||||
(connsm->conn_itvl != upd->interval) ||
|
||||
(connsm->periph_latency != upd->latency) ||
|
||||
(connsm->supervision_tmo != upd->timeout)) {
|
||||
connsm->csmflags.cfbit.host_expects_upd_event = 1;
|
||||
connsm->flags.host_expects_upd_event = 1;
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_ENHANCED_CONN_UPDATE)
|
||||
@@ -2602,7 +2602,7 @@ ble_ll_conn_next_event(struct ble_ll_conn_sm *connsm)
|
||||
connsm->last_rxd_pdu_cputime = connsm->anchor_point;
|
||||
|
||||
/* Reset update scheduled flag */
|
||||
connsm->csmflags.cfbit.conn_update_sched = 0;
|
||||
connsm->flags.conn_update_sched = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2614,7 +2614,7 @@ ble_ll_conn_next_event(struct ble_ll_conn_sm *connsm)
|
||||
* new channel map once the event counter equals or has passed channel
|
||||
* map update instant.
|
||||
*/
|
||||
if (connsm->csmflags.cfbit.chanmap_update_scheduled &&
|
||||
if (connsm->flags.chanmap_update_scheduled &&
|
||||
((int16_t)(connsm->chanmap_instant - connsm->event_cntr) <= 0)) {
|
||||
|
||||
/* XXX: there is a chance that the control packet is still on
|
||||
@@ -2625,7 +2625,7 @@ ble_ll_conn_next_event(struct ble_ll_conn_sm *connsm)
|
||||
ble_ll_utils_chan_map_used_get(connsm->req_chanmap);
|
||||
memcpy(connsm->chan_map, connsm->req_chanmap, BLE_LL_CHAN_MAP_LEN);
|
||||
|
||||
connsm->csmflags.cfbit.chanmap_update_scheduled = 0;
|
||||
connsm->flags.chanmap_update_scheduled = 0;
|
||||
|
||||
ble_ll_ctrl_proc_stop(connsm, BLE_LL_CTRL_PROC_CHAN_MAP_UPD);
|
||||
|
||||
@@ -2773,7 +2773,7 @@ ble_ll_conn_created(struct ble_ll_conn_sm *connsm, struct ble_mbuf_hdr *rxhdr)
|
||||
connsm->conn_state = BLE_LL_CONN_STATE_CREATED;
|
||||
|
||||
/* Clear packet received flag */
|
||||
connsm->csmflags.cfbit.pkt_rxd = 0;
|
||||
connsm->flags.pkt_rxd = 0;
|
||||
|
||||
/* Consider time created the last scheduled time */
|
||||
connsm->last_scheduled = ble_ll_tmr_get();
|
||||
@@ -2929,10 +2929,10 @@ ble_ll_conn_event_end(struct ble_npl_event *ev)
|
||||
ble_ll_scan_chk_resume();
|
||||
|
||||
/* If we have transmitted the terminate IND successfully, we are done */
|
||||
if ((connsm->csmflags.cfbit.terminate_ind_txd) ||
|
||||
(connsm->csmflags.cfbit.terminate_ind_rxd &&
|
||||
connsm->csmflags.cfbit.terminate_ind_rxd_acked)) {
|
||||
if (connsm->csmflags.cfbit.terminate_ind_txd) {
|
||||
if ((connsm->flags.terminate_ind_txd) ||
|
||||
(connsm->flags.terminate_ind_rxd &&
|
||||
connsm->flags.terminate_ind_rxd_acked)) {
|
||||
if (connsm->flags.terminate_ind_txd) {
|
||||
ble_err = BLE_ERR_CONN_TERM_LOCAL;
|
||||
} else {
|
||||
/* Make sure the disconnect reason is valid! */
|
||||
@@ -2952,7 +2952,7 @@ ble_ll_conn_event_end(struct ble_npl_event *ev)
|
||||
* If we have received a packet, we can set the current transmit window
|
||||
* usecs to 0 since we dont need to listen in the transmit window.
|
||||
*/
|
||||
if (connsm->csmflags.cfbit.pkt_rxd) {
|
||||
if (connsm->flags.pkt_rxd) {
|
||||
connsm->periph_cur_tx_win_usecs = 0;
|
||||
}
|
||||
|
||||
@@ -2979,7 +2979,7 @@ ble_ll_conn_event_end(struct ble_npl_event *ev)
|
||||
|
||||
/* Reset "per connection event" variables */
|
||||
connsm->cons_rxd_bad_crc = 0;
|
||||
connsm->csmflags.cfbit.pkt_rxd = 0;
|
||||
connsm->flags.pkt_rxd = 0;
|
||||
|
||||
/* See if we need to start any control procedures */
|
||||
ble_ll_ctrl_chk_proc_start(connsm);
|
||||
@@ -3030,10 +3030,10 @@ ble_ll_conn_event_end(struct ble_npl_event *ev)
|
||||
ble_ll_conn_num_comp_pkts_event_send(connsm);
|
||||
|
||||
/* If we have features and there's pending HCI command, send an event */
|
||||
if (connsm->csmflags.cfbit.pending_hci_rd_features &&
|
||||
connsm->csmflags.cfbit.rxd_features) {
|
||||
if (connsm->flags.pending_hci_rd_features &&
|
||||
connsm->flags.rxd_features) {
|
||||
ble_ll_hci_ev_rd_rem_used_feat(connsm, BLE_ERR_SUCCESS);
|
||||
connsm->csmflags.cfbit.pending_hci_rd_features = 0;
|
||||
connsm->flags.pending_hci_rd_features = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3192,7 +3192,7 @@ ble_ll_conn_event_halt(void)
|
||||
{
|
||||
ble_ll_state_set(BLE_LL_STATE_STANDBY);
|
||||
if (g_ble_ll_conn_cur_sm) {
|
||||
g_ble_ll_conn_cur_sm->csmflags.cfbit.pkt_rxd = 0;
|
||||
g_ble_ll_conn_cur_sm->flags.pkt_rxd = 0;
|
||||
ble_ll_event_add(&g_ble_ll_conn_cur_sm->conn_ev_end);
|
||||
g_ble_ll_conn_cur_sm = NULL;
|
||||
}
|
||||
@@ -3400,14 +3400,14 @@ ble_ll_conn_rx_isr_start(struct ble_mbuf_hdr *rxhdr, uint32_t aa)
|
||||
rxhdr->rxinfo.handle = connsm->conn_handle;
|
||||
|
||||
/* Set flag denoting we have received a packet in connection event */
|
||||
connsm->csmflags.cfbit.pkt_rxd = 1;
|
||||
connsm->flags.pkt_rxd = 1;
|
||||
|
||||
/* Connection is established */
|
||||
connsm->conn_state = BLE_LL_CONN_STATE_ESTABLISHED;
|
||||
|
||||
/* Set anchor point (and last) if 1st rxd frame in connection event */
|
||||
if (connsm->csmflags.cfbit.periph_set_last_anchor) {
|
||||
connsm->csmflags.cfbit.periph_set_last_anchor = 0;
|
||||
if (connsm->flags.periph_set_last_anchor) {
|
||||
connsm->flags.periph_set_last_anchor = 0;
|
||||
connsm->last_anchor_point = rxhdr->beg_cputime;
|
||||
connsm->anchor_point = connsm->last_anchor_point;
|
||||
connsm->anchor_point_usecs = rxhdr->rem_usecs;
|
||||
@@ -3519,7 +3519,7 @@ ble_ll_conn_rx_data_pdu(struct os_mbuf *rxpdu, struct ble_mbuf_hdr *hdr)
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_PERIPHERAL)
|
||||
if (connsm->conn_role == BLE_LL_CONN_ROLE_PERIPHERAL) {
|
||||
if (hdr_byte & BLE_LL_DATA_HDR_NESN_MASK) {
|
||||
connsm->csmflags.cfbit.allow_periph_latency = 1;
|
||||
connsm->flags.allow_periph_latency = 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -3857,7 +3857,7 @@ chk_rx_terminate_ind:
|
||||
if (BLE_LL_LLID_IS_CTRL(hdr_byte) &&
|
||||
(opcode == BLE_LL_CTRL_TERMINATE_IND) &&
|
||||
(rx_pyld_len == (1 + BLE_LL_CTRL_TERMINATE_IND_LEN))) {
|
||||
connsm->csmflags.cfbit.terminate_ind_rxd = 1;
|
||||
connsm->flags.terminate_ind_rxd = 1;
|
||||
connsm->rxd_disconnect_reason = rxbuf[3];
|
||||
}
|
||||
|
||||
@@ -4244,14 +4244,14 @@ ble_ll_conn_subrate_req_hci(struct ble_ll_conn_sm *connsm,
|
||||
connsm->subrate_trans.periph_latency = srp->max_latency;
|
||||
connsm->subrate_trans.cont_num = srp->cont_num;
|
||||
connsm->subrate_trans.supervision_tmo = srp->supervision_tmo;
|
||||
connsm->csmflags.cfbit.subrate_host_req = 1;
|
||||
connsm->flags.subrate_host_req = 1;
|
||||
ble_ll_ctrl_proc_start(connsm, BLE_LL_CTRL_PROC_SUBRATE_UPDATE, NULL);
|
||||
break;
|
||||
#endif
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_PERIPHERAL)
|
||||
case BLE_LL_CONN_ROLE_PERIPHERAL:
|
||||
connsm->subrate_req = *srp;
|
||||
connsm->csmflags.cfbit.subrate_host_req = 1;
|
||||
connsm->flags.subrate_host_req = 1;
|
||||
ble_ll_ctrl_proc_start(connsm, BLE_LL_CTRL_PROC_SUBRATE_REQ, NULL);
|
||||
break;
|
||||
#endif
|
||||
@@ -4316,7 +4316,7 @@ ble_ll_conn_subrate_set(struct ble_ll_conn_sm *connsm,
|
||||
|
||||
/* Assume parameters were checked by caller */
|
||||
|
||||
send_ev = connsm->csmflags.cfbit.subrate_host_req ||
|
||||
send_ev = connsm->flags.subrate_host_req ||
|
||||
(connsm->subrate_factor != sp->subrate_factor) ||
|
||||
(connsm->periph_latency != sp->periph_latency) ||
|
||||
(connsm->cont_num != sp->cont_num) ||
|
||||
|
||||
@@ -921,7 +921,7 @@ ble_ll_conn_hci_read_rem_features(const uint8_t *cmdbuf, uint8_t len)
|
||||
}
|
||||
|
||||
/* If already pending exit with error */
|
||||
if (connsm->csmflags.cfbit.pending_hci_rd_features) {
|
||||
if (connsm->flags.pending_hci_rd_features) {
|
||||
return BLE_ERR_CMD_DISALLOWED;
|
||||
}
|
||||
|
||||
@@ -929,8 +929,8 @@ ble_ll_conn_hci_read_rem_features(const uint8_t *cmdbuf, uint8_t len)
|
||||
* Start control procedure if we did not receive peer's features and did not
|
||||
* start procedure already.
|
||||
*/
|
||||
if (!connsm->csmflags.cfbit.rxd_features &&
|
||||
!IS_PENDING_CTRL_PROC(connsm, BLE_LL_CTRL_PROC_FEATURE_XCHG)) {
|
||||
if (!connsm->flags.rxd_features &&
|
||||
!IS_PENDING_CTRL_PROC(connsm, BLE_LL_CTRL_PROC_FEATURE_XCHG)) {
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_PERIPHERAL)
|
||||
if ((connsm->conn_role == BLE_LL_CONN_ROLE_PERIPHERAL) &&
|
||||
!(ble_ll_read_supp_features() & BLE_LL_FEAT_PERIPH_INIT)) {
|
||||
@@ -941,7 +941,7 @@ ble_ll_conn_hci_read_rem_features(const uint8_t *cmdbuf, uint8_t len)
|
||||
ble_ll_ctrl_proc_start(connsm, BLE_LL_CTRL_PROC_FEATURE_XCHG, NULL);
|
||||
}
|
||||
|
||||
connsm->csmflags.cfbit.pending_hci_rd_features = 1;
|
||||
connsm->flags.pending_hci_rd_features = 1;
|
||||
|
||||
return BLE_ERR_SUCCESS;
|
||||
}
|
||||
@@ -1062,11 +1062,11 @@ ble_ll_conn_hci_update(const uint8_t *cmdbuf, uint8_t len)
|
||||
* peripheral has initiated the procedure, we need to send a reject to the
|
||||
* peripheral.
|
||||
*/
|
||||
if (connsm->csmflags.cfbit.awaiting_host_reply) {
|
||||
if (connsm->flags.awaiting_host_reply) {
|
||||
switch (connsm->conn_role) {
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL)
|
||||
case BLE_LL_CONN_ROLE_CENTRAL:
|
||||
connsm->csmflags.cfbit.awaiting_host_reply = 0;
|
||||
connsm->flags.awaiting_host_reply = 0;
|
||||
|
||||
/* XXX: If this fails no reject ind will be sent! */
|
||||
ble_ll_ctrl_reject_ind_send(connsm, connsm->host_reply_opcode,
|
||||
@@ -1089,7 +1089,7 @@ ble_ll_conn_hci_update(const uint8_t *cmdbuf, uint8_t len)
|
||||
* update procedure we should deny the peripheral request for now.
|
||||
*/
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_PERIPHERAL)
|
||||
if (connsm->csmflags.cfbit.chanmap_update_scheduled) {
|
||||
if (connsm->flags.chanmap_update_scheduled) {
|
||||
if (connsm->conn_role == BLE_LL_CONN_ROLE_PERIPHERAL) {
|
||||
return BLE_ERR_DIFF_TRANS_COLL;
|
||||
}
|
||||
@@ -1159,7 +1159,7 @@ ble_ll_conn_hci_param_rr(const uint8_t *cmdbuf, uint8_t len,
|
||||
rc = ble_ll_conn_process_conn_params(cmd, connsm);
|
||||
|
||||
/* The connection should be awaiting a reply. If not, just discard */
|
||||
if (connsm->csmflags.cfbit.awaiting_host_reply) {
|
||||
if (connsm->flags.awaiting_host_reply) {
|
||||
/* Get a control packet buffer */
|
||||
if (rc == BLE_ERR_SUCCESS) {
|
||||
om = os_msys_get_pkthdr(BLE_LL_CTRL_MAX_PDU_LEN,
|
||||
@@ -1177,7 +1177,7 @@ ble_ll_conn_hci_param_rr(const uint8_t *cmdbuf, uint8_t len,
|
||||
ble_ll_ctrl_reject_ind_send(connsm, connsm->host_reply_opcode,
|
||||
BLE_ERR_CONN_PARMS);
|
||||
}
|
||||
connsm->csmflags.cfbit.awaiting_host_reply = 0;
|
||||
connsm->flags.awaiting_host_reply = 0;
|
||||
|
||||
/* XXX: if we cant get a buffer, what do we do? We need to remember
|
||||
* reason if it was a negative reply. We also would need to have
|
||||
@@ -1224,11 +1224,11 @@ ble_ll_conn_hci_param_nrr(const uint8_t *cmdbuf, uint8_t len,
|
||||
rc = BLE_ERR_SUCCESS;
|
||||
|
||||
/* The connection should be awaiting a reply. If not, just discard */
|
||||
if (connsm->csmflags.cfbit.awaiting_host_reply) {
|
||||
if (connsm->flags.awaiting_host_reply) {
|
||||
/* XXX: check return code and deal */
|
||||
ble_ll_ctrl_reject_ind_send(connsm, connsm->host_reply_opcode,
|
||||
cmd->reason);
|
||||
connsm->csmflags.cfbit.awaiting_host_reply = 0;
|
||||
connsm->flags.awaiting_host_reply = 0;
|
||||
|
||||
/* XXX: if we cant get a buffer, what do we do? We need to remember
|
||||
* reason if it was a negative reply. We also would need to have
|
||||
@@ -1393,7 +1393,7 @@ ble_ll_conn_hci_rd_rem_ver_cmd(const uint8_t *cmdbuf, uint8_t len)
|
||||
* NOTE: we cant just send the event here. That would cause the event to
|
||||
* be queued before the command status.
|
||||
*/
|
||||
if (!connsm->csmflags.cfbit.version_ind_sent) {
|
||||
if (!connsm->flags.version_ind_sent) {
|
||||
ble_ll_ctrl_proc_start(connsm, BLE_LL_CTRL_PROC_VERSION_XCHG, NULL);
|
||||
} else {
|
||||
connsm->pending_ctrl_procs |= (1 << BLE_LL_CTRL_PROC_VERSION_XCHG);
|
||||
@@ -1468,7 +1468,7 @@ ble_ll_conn_hci_rd_chan_map(const uint8_t *cmdbuf, uint8_t len,
|
||||
rc = BLE_ERR_UNK_CONN_ID;
|
||||
memset(rsp->chan_map, 0, sizeof(rsp->chan_map));
|
||||
} else {
|
||||
if (connsm->csmflags.cfbit.chanmap_update_scheduled) {
|
||||
if (connsm->flags.chanmap_update_scheduled) {
|
||||
memcpy(rsp->chan_map, connsm->req_chanmap, BLE_LL_CHAN_MAP_LEN);
|
||||
} else {
|
||||
memcpy(rsp->chan_map, connsm->chan_map, BLE_LL_CHAN_MAP_LEN);
|
||||
|
||||
@@ -367,7 +367,7 @@ conn_parm_req_do_indicate:
|
||||
*/
|
||||
ble_ll_hci_ev_rem_conn_parm_req(connsm, req);
|
||||
connsm->host_reply_opcode = opcode;
|
||||
connsm->csmflags.cfbit.awaiting_host_reply = 1;
|
||||
connsm->flags.awaiting_host_reply = 1;
|
||||
rsp_opcode = 255;
|
||||
} else {
|
||||
/* Create reply to connection request */
|
||||
@@ -392,8 +392,8 @@ ble_ll_ctrl_conn_update_init_proc(struct ble_ll_conn_sm *connsm,
|
||||
* instant is in the future.
|
||||
*/
|
||||
|
||||
connsm->csmflags.cfbit.conn_update_sched = 0;
|
||||
connsm->csmflags.cfbit.conn_update_use_cp = (cp != NULL);
|
||||
connsm->flags.conn_update_sched = 0;
|
||||
connsm->flags.conn_update_use_cp = (cp != NULL);
|
||||
|
||||
if (cp) {
|
||||
connsm->conn_cp = *cp;
|
||||
@@ -414,7 +414,7 @@ ble_ll_ctrl_conn_update_make_ind_pdu(struct ble_ll_conn_sm *connsm,
|
||||
struct hci_conn_update *hcu;
|
||||
struct ble_ll_conn_upd_req *req;
|
||||
|
||||
if (connsm->csmflags.cfbit.conn_update_use_cp) {
|
||||
if (connsm->flags.conn_update_use_cp) {
|
||||
cp = &connsm->conn_cp;
|
||||
}
|
||||
|
||||
@@ -570,11 +570,11 @@ ble_ll_ctrl_proc_unk_rsp(struct ble_ll_conn_sm *connsm, uint8_t *dptr, uint8_t *
|
||||
if (ctrl_proc == BLE_LL_CTRL_PROC_CONN_PARAM_REQ) {
|
||||
ble_ll_hci_ev_conn_update(connsm, BLE_ERR_UNSUPP_REM_FEATURE);
|
||||
} else if (ctrl_proc == BLE_LL_CTRL_PROC_FEATURE_XCHG) {
|
||||
if (connsm->csmflags.cfbit.pending_hci_rd_features) {
|
||||
if (connsm->flags.pending_hci_rd_features) {
|
||||
ble_ll_hci_ev_rd_rem_used_feat(connsm,
|
||||
BLE_ERR_UNSUPP_REM_FEATURE);
|
||||
}
|
||||
connsm->csmflags.cfbit.pending_hci_rd_features = 0;
|
||||
connsm->flags.pending_hci_rd_features = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1290,7 +1290,7 @@ ble_ll_ctrl_rx_subrate_ind(struct ble_ll_conn_sm *connsm, uint8_t *req,
|
||||
|
||||
ble_ll_conn_subrate_set(connsm, sp);
|
||||
ble_ll_ctrl_proc_stop(connsm, BLE_LL_CTRL_PROC_SUBRATE_REQ);
|
||||
connsm->csmflags.cfbit.subrate_host_req = 0;
|
||||
connsm->flags.subrate_host_req = 0;
|
||||
|
||||
return BLE_ERR_MAX;
|
||||
}
|
||||
@@ -1875,7 +1875,7 @@ static void
|
||||
ble_ll_ctrl_version_ind_make(struct ble_ll_conn_sm *connsm, uint8_t *pyld)
|
||||
{
|
||||
/* Set flag to denote we have sent/received this */
|
||||
connsm->csmflags.cfbit.version_ind_sent = 1;
|
||||
connsm->flags.version_ind_sent = 1;
|
||||
|
||||
/* Fill out response */
|
||||
pyld[0] = BLE_HCI_VER_BCS;
|
||||
@@ -1901,7 +1901,7 @@ ble_ll_ctrl_chanmap_req_make(struct ble_ll_conn_sm *connsm, uint8_t *pyld)
|
||||
put_le16(pyld + BLE_LL_CHAN_MAP_LEN, connsm->chanmap_instant);
|
||||
|
||||
/* Set scheduled flag */
|
||||
connsm->csmflags.cfbit.chanmap_update_scheduled = 1;
|
||||
connsm->flags.chanmap_update_scheduled = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2073,7 +2073,7 @@ ble_ll_ctrl_rx_conn_update(struct ble_ll_conn_sm *connsm, uint8_t *dptr)
|
||||
if (conn_events >= 32767) {
|
||||
ble_ll_conn_timeout(connsm, BLE_ERR_INSTANT_PASSED);
|
||||
} else {
|
||||
connsm->csmflags.cfbit.conn_update_sched = 1;
|
||||
connsm->flags.conn_update_sched = 1;
|
||||
|
||||
/*
|
||||
* Errata says that receiving a connection update when the event
|
||||
@@ -2125,7 +2125,7 @@ ble_ll_ctrl_update_features(struct ble_ll_conn_sm *connsm, uint8_t *feat)
|
||||
memcpy(connsm->remote_features, feat + 1, 7);
|
||||
|
||||
/* If we received peer's features for the 1st time, we should try DLE */
|
||||
if (!connsm->csmflags.cfbit.rxd_features) {
|
||||
if (!connsm->flags.rxd_features) {
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_CODED_PHY)
|
||||
/*
|
||||
* If connection was established on uncoded PHY, by default we use
|
||||
@@ -2151,10 +2151,10 @@ ble_ll_ctrl_update_features(struct ble_ll_conn_sm *connsm, uint8_t *feat)
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_CONN_INIT_AUTO_DLE)
|
||||
connsm->csmflags.cfbit.pending_initiate_dle = 1;
|
||||
connsm->flags.pending_initiate_dle = 1;
|
||||
#endif
|
||||
|
||||
connsm->csmflags.cfbit.rxd_features = 1;
|
||||
connsm->flags.rxd_features = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2234,9 +2234,9 @@ ble_ll_ctrl_rx_feature_rsp(struct ble_ll_conn_sm *connsm, uint8_t *dptr)
|
||||
}
|
||||
|
||||
/* Send event to host if pending features read */
|
||||
if (connsm->csmflags.cfbit.pending_hci_rd_features) {
|
||||
if (connsm->flags.pending_hci_rd_features) {
|
||||
ble_ll_hci_ev_rd_rem_used_feat(connsm, BLE_ERR_SUCCESS);
|
||||
connsm->csmflags.cfbit.pending_hci_rd_features = 0;
|
||||
connsm->flags.pending_hci_rd_features = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2265,7 +2265,7 @@ ble_ll_ctrl_rx_conn_param_req(struct ble_ll_conn_sm *connsm, uint8_t *dptr,
|
||||
* well. This is not expected to happen anyway. A return of BLE_ERR_MAX
|
||||
* means that we will simply discard the connection parameter request
|
||||
*/
|
||||
if (connsm->csmflags.cfbit.awaiting_host_reply) {
|
||||
if (connsm->flags.awaiting_host_reply) {
|
||||
return BLE_ERR_MAX;
|
||||
}
|
||||
|
||||
@@ -2326,7 +2326,7 @@ ble_ll_ctrl_rx_conn_param_req(struct ble_ll_conn_sm *connsm, uint8_t *dptr,
|
||||
*/
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL)
|
||||
if ((connsm->conn_role == BLE_LL_CONN_ROLE_CENTRAL) &&
|
||||
(connsm->csmflags.cfbit.chanmap_update_scheduled)) {
|
||||
(connsm->flags.chanmap_update_scheduled)) {
|
||||
rsp_opcode = BLE_LL_CTRL_REJECT_IND_EXT;
|
||||
rspbuf[1] = BLE_LL_CTRL_CONN_PARM_REQ;
|
||||
rspbuf[2] = BLE_ERR_DIFF_TRANS_COLL;
|
||||
@@ -2359,8 +2359,8 @@ ble_ll_ctrl_rx_conn_param_rsp(struct ble_ll_conn_sm *connsm, uint8_t *dptr,
|
||||
* state just clear the awaiting reply. The peripheral will hopefully stop its
|
||||
* procedure when we reply.
|
||||
*/
|
||||
if (connsm->csmflags.cfbit.awaiting_host_reply) {
|
||||
connsm->csmflags.cfbit.awaiting_host_reply = 0;
|
||||
if (connsm->flags.awaiting_host_reply) {
|
||||
connsm->flags.awaiting_host_reply = 0;
|
||||
}
|
||||
|
||||
/* If we receive a response and no procedure is pending, just leave */
|
||||
@@ -2395,10 +2395,10 @@ ble_ll_ctrl_rx_version_ind(struct ble_ll_conn_sm *connsm, uint8_t *dptr,
|
||||
connsm->vers_nr = dptr[0];
|
||||
connsm->comp_id = get_le16(dptr + 1);
|
||||
connsm->sub_vers_nr = get_le16(dptr + 3);
|
||||
connsm->csmflags.cfbit.rxd_version_ind = 1;
|
||||
connsm->flags.rxd_version_ind = 1;
|
||||
|
||||
rsp_opcode = BLE_ERR_MAX;
|
||||
if (!connsm->csmflags.cfbit.version_ind_sent) {
|
||||
if (!connsm->flags.version_ind_sent) {
|
||||
rsp_opcode = BLE_LL_CTRL_VERSION_IND;
|
||||
ble_ll_ctrl_version_ind_make(connsm, rspbuf);
|
||||
}
|
||||
@@ -2439,7 +2439,7 @@ ble_ll_ctrl_rx_chanmap_req(struct ble_ll_conn_sm *connsm, uint8_t *dptr)
|
||||
} else {
|
||||
connsm->chanmap_instant = instant;
|
||||
memcpy(connsm->req_chanmap, dptr, BLE_LL_CHAN_MAP_LEN);
|
||||
connsm->csmflags.cfbit.chanmap_update_scheduled = 1;
|
||||
connsm->flags.chanmap_update_scheduled = 1;
|
||||
}
|
||||
|
||||
return BLE_ERR_MAX;
|
||||
@@ -2734,7 +2734,7 @@ ble_ll_ctrl_chk_proc_start(struct ble_ll_conn_sm *connsm)
|
||||
* received the information dont start it.
|
||||
*/
|
||||
if ((i == BLE_LL_CTRL_PROC_VERSION_XCHG) &&
|
||||
(connsm->csmflags.cfbit.rxd_version_ind)) {
|
||||
(connsm->flags.rxd_version_ind)) {
|
||||
ble_ll_hci_ev_rd_rem_ver(connsm, BLE_ERR_SUCCESS);
|
||||
CLR_PENDING_CTRL_PROC(connsm, i);
|
||||
} else {
|
||||
@@ -3067,8 +3067,8 @@ ll_ctrl_send_rsp:
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_CONN_INIT_AUTO_DLE)
|
||||
if (connsm->csmflags.cfbit.pending_initiate_dle) {
|
||||
connsm->csmflags.cfbit.pending_initiate_dle = 0;
|
||||
if (connsm->flags.pending_initiate_dle) {
|
||||
connsm->flags.pending_initiate_dle = 0;
|
||||
ble_ll_ctrl_initiate_dle(connsm, true);
|
||||
}
|
||||
#endif
|
||||
@@ -3134,11 +3134,13 @@ ble_ll_ctrl_tx_start(struct ble_ll_conn_sm *connsm, struct os_mbuf *txpdu)
|
||||
switch (opcode) {
|
||||
case BLE_LL_CTRL_CONN_UPDATE_IND:
|
||||
ble_ll_ctrl_conn_update_make_ind_pdu(connsm, ctrdata);
|
||||
connsm->csmflags.cfbit.conn_update_sched = 1;
|
||||
connsm->flags.conn_update_sched = 1;
|
||||
break;
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_ENHANCED_CONN_UPDATE)
|
||||
case BLE_LL_CTRL_SUBRATE_IND:
|
||||
connsm->csmflags.cfbit.subrate_trans = 1;
|
||||
connsm->flags.subrate_trans = 1;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -3170,7 +3172,7 @@ ble_ll_ctrl_tx_done(struct os_mbuf *txpdu, struct ble_ll_conn_sm *connsm)
|
||||
opcode = txpdu->om_data[0];
|
||||
switch (opcode) {
|
||||
case BLE_LL_CTRL_TERMINATE_IND:
|
||||
connsm->csmflags.cfbit.terminate_ind_txd = 1;
|
||||
connsm->flags.terminate_ind_txd = 1;
|
||||
rc = -1;
|
||||
break;
|
||||
case BLE_LL_CTRL_REJECT_IND_EXT:
|
||||
@@ -3182,7 +3184,7 @@ ble_ll_ctrl_tx_done(struct os_mbuf *txpdu, struct ble_ll_conn_sm *connsm)
|
||||
if (txpdu->om_data[1] == BLE_LL_CTRL_CONN_PARM_REQ &&
|
||||
txpdu->om_data[2] != BLE_ERR_LMP_COLLISION) {
|
||||
connsm->reject_reason = txpdu->om_data[2];
|
||||
connsm->csmflags.cfbit.host_expects_upd_event = 1;
|
||||
connsm->flags.host_expects_upd_event = 1;
|
||||
}
|
||||
}
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION)
|
||||
@@ -3204,7 +3206,7 @@ ble_ll_ctrl_tx_done(struct os_mbuf *txpdu, struct ble_ll_conn_sm *connsm)
|
||||
break;
|
||||
case BLE_LL_CTRL_ENC_RSP:
|
||||
connsm->enc_data.enc_state = CONN_ENC_S_LTK_REQ_WAIT;
|
||||
connsm->csmflags.cfbit.send_ltk_req = 1;
|
||||
connsm->flags.send_ltk_req = 1;
|
||||
break;
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_PERIPHERAL)
|
||||
case BLE_LL_CTRL_START_ENC_RSP:
|
||||
@@ -3240,8 +3242,8 @@ ble_ll_ctrl_tx_done(struct os_mbuf *txpdu, struct ble_ll_conn_sm *connsm)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_ENHANCED_CONN_UPDATE)
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL)
|
||||
case BLE_LL_CTRL_SUBRATE_IND:
|
||||
connsm->csmflags.cfbit.subrate_trans = 0;
|
||||
connsm->csmflags.cfbit.subrate_ind_txd = 1;
|
||||
connsm->flags.subrate_trans = 0;
|
||||
connsm->flags.subrate_ind_txd = 1;
|
||||
break;
|
||||
#endif /* BLE_LL_CTRL_SUBRATE_IND */
|
||||
#endif /* BLE_LL_CFG_FEAT_LL_ENHANCED_CONN_UPDATE */
|
||||
|
||||
@@ -331,7 +331,7 @@ ble_ll_hci_ev_le_csa(struct ble_ll_conn_sm *connsm)
|
||||
|
||||
ev->subev_code = BLE_HCI_LE_SUBEV_CHAN_SEL_ALG;
|
||||
ev->conn_handle = htole16(connsm->conn_handle);
|
||||
ev->csa = connsm->csmflags.cfbit.csa2_supp ? 0x01 : 0x00;
|
||||
ev->csa = connsm->flags.csa2_supp ? 0x01 : 0x00;
|
||||
|
||||
ble_ll_hci_event_send(hci_ev);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user