Bluetooth: controller: Use anonymous structs and unions in PDUs
Take advantage to cleanup code by using anonymous struct and union definitions. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
parent
b7819ccab6
commit
4cd9ba7813
6 changed files with 373 additions and 431 deletions
|
@ -2022,7 +2022,7 @@ int hci_acl_handle(struct net_buf *buf, struct net_buf **evt)
|
|||
pdu_data->ll_id = PDU_DATA_LLID_DATA_CONTINUE;
|
||||
}
|
||||
pdu_data->len = len;
|
||||
memcpy(&pdu_data->payload.lldata[0], buf->data, len);
|
||||
memcpy(&pdu_data->lldata[0], buf->data, len);
|
||||
|
||||
if (ll_tx_mem_enqueue(handle, node_tx)) {
|
||||
BT_ERR("Invalid Tx Enqueue");
|
||||
|
@ -2041,7 +2041,7 @@ static inline bool dup_found(struct pdu_adv *adv)
|
|||
int i;
|
||||
|
||||
for (i = 0; i < dup_count; i++) {
|
||||
if (!memcmp(&adv->payload.adv_ind.addr[0],
|
||||
if (!memcmp(&adv->adv_ind.addr[0],
|
||||
&dup_filter[i].addr.a.val[0],
|
||||
sizeof(bt_addr_t)) &&
|
||||
adv->tx_addr == dup_filter[i].addr.type) {
|
||||
|
@ -2058,7 +2058,7 @@ static inline bool dup_found(struct pdu_adv *adv)
|
|||
|
||||
/* insert into the duplicate filter */
|
||||
memcpy(&dup_filter[dup_curr].addr.a.val[0],
|
||||
&adv->payload.adv_ind.addr[0], sizeof(bt_addr_t));
|
||||
&adv->adv_ind.addr[0], sizeof(bt_addr_t));
|
||||
dup_filter[dup_curr].addr.type = adv->tx_addr;
|
||||
dup_filter[dup_curr].mask = BIT(adv->type);
|
||||
|
||||
|
@ -2102,8 +2102,7 @@ static void le_advertising_report(struct pdu_data *pdu_data, u8_t *b,
|
|||
offsetof(struct pdu_adv, payload) + adv->len + 1];
|
||||
/* Update current RPA */
|
||||
if (adv->tx_addr) {
|
||||
ll_rl_crpa_set(0x00, NULL, rl_idx,
|
||||
&adv->payload.adv_ind.addr[0]);
|
||||
ll_rl_crpa_set(0x00, NULL, rl_idx, &adv->adv_ind.addr[0]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2169,13 +2168,13 @@ static void le_advertising_report(struct pdu_data *pdu_data, u8_t *b,
|
|||
#endif /* CONFIG_BT_CTLR_PRIVACY */
|
||||
dir_info->addr.type = adv->tx_addr;
|
||||
memcpy(&dir_info->addr.a.val[0],
|
||||
&adv->payload.direct_ind.adv_addr[0],
|
||||
&adv->direct_ind.adv_addr[0],
|
||||
sizeof(bt_addr_t));
|
||||
}
|
||||
|
||||
dir_info->dir_addr.type = 0x1;
|
||||
memcpy(&dir_info->dir_addr.a.val[0],
|
||||
&adv->payload.direct_ind.tgt_addr[0], sizeof(bt_addr_t));
|
||||
&adv->direct_ind.tgt_addr[0], sizeof(bt_addr_t));
|
||||
|
||||
dir_info->rssi = rssi;
|
||||
|
||||
|
@ -2208,12 +2207,12 @@ static void le_advertising_report(struct pdu_data *pdu_data, u8_t *b,
|
|||
#endif /* CONFIG_BT_CTLR_PRIVACY */
|
||||
|
||||
adv_info->addr.type = adv->tx_addr;
|
||||
memcpy(&adv_info->addr.a.val[0], &adv->payload.adv_ind.addr[0],
|
||||
memcpy(&adv_info->addr.a.val[0], &adv->adv_ind.addr[0],
|
||||
sizeof(bt_addr_t));
|
||||
}
|
||||
|
||||
adv_info->length = data_len;
|
||||
memcpy(&adv_info->data[0], &adv->payload.adv_ind.data[0], data_len);
|
||||
memcpy(&adv_info->data[0], &adv->adv_ind.data[0], data_len);
|
||||
/* RSSI */
|
||||
prssi = &adv_info->data[0] + data_len;
|
||||
*prssi = rssi;
|
||||
|
@ -2238,7 +2237,7 @@ static void le_adv_ext_report(struct pdu_data *pdu_data, u8_t *b,
|
|||
struct ext_adv_hdr *h;
|
||||
u8_t *ptr;
|
||||
|
||||
p = (void *)&adv->payload.adv_ext_ind;
|
||||
p = (void *)&adv->adv_ext_ind;
|
||||
h = (void *)p->ext_hdr_adi_adv_data;
|
||||
ptr = (u8_t *)h + sizeof(*h);
|
||||
|
||||
|
@ -2310,7 +2309,7 @@ static void le_scan_req_received(struct pdu_data *pdu_data, u8_t *b,
|
|||
|
||||
handle = 0;
|
||||
addr.type = adv->tx_addr;
|
||||
memcpy(&addr.a.val[0], &adv->payload.scan_req.scan_addr[0],
|
||||
memcpy(&addr.a.val[0], &adv->scan_req.scan_addr[0],
|
||||
sizeof(bt_addr_t));
|
||||
/* The Link Layer currently returns RSSI as an absolute value */
|
||||
rssi = -b[offsetof(struct radio_pdu_node_rx, pdu_data) +
|
||||
|
@ -2327,7 +2326,7 @@ static void le_scan_req_received(struct pdu_data *pdu_data, u8_t *b,
|
|||
sep = meta_evt(buf, BT_HCI_EVT_LE_SCAN_REQ_RECEIVED, sizeof(*sep));
|
||||
sep->handle = 0;
|
||||
sep->addr.type = adv->tx_addr;
|
||||
memcpy(&sep->addr.a.val[0], &adv->payload.scan_req.scan_addr[0],
|
||||
memcpy(&sep->addr.a.val[0], &adv->scan_req.scan_addr[0],
|
||||
sizeof(bt_addr_t));
|
||||
}
|
||||
#endif /* CONFIG_BT_CTLR_SCAN_REQ_NOTIFY */
|
||||
|
@ -2339,7 +2338,7 @@ static void le_conn_complete(struct pdu_data *pdu_data, u16_t handle,
|
|||
struct bt_hci_evt_le_conn_complete *lecc;
|
||||
struct radio_le_conn_cmplt *radio_cc;
|
||||
|
||||
radio_cc = (struct radio_le_conn_cmplt *) (pdu_data->payload.lldata);
|
||||
radio_cc = (void *)pdu_data->lldata;
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_PRIVACY)
|
||||
/* Update current RPA */
|
||||
|
@ -2447,8 +2446,7 @@ static void le_conn_update_complete(struct pdu_data *pdu_data, u16_t handle,
|
|||
return;
|
||||
}
|
||||
|
||||
radio_cu = (struct radio_le_conn_update_cmplt *)
|
||||
(pdu_data->payload.lldata);
|
||||
radio_cu = (void *)pdu_data->lldata;
|
||||
|
||||
sep = meta_evt(buf, BT_HCI_EVT_LE_CONN_UPDATE_COMPLETE, sizeof(*sep));
|
||||
|
||||
|
@ -2506,8 +2504,7 @@ static void le_chan_sel_algo(struct pdu_data *pdu_data, u16_t handle,
|
|||
return;
|
||||
}
|
||||
|
||||
radio_le_chan_sel_algo = (struct radio_le_chan_sel_algo *)
|
||||
pdu_data->payload.lldata;
|
||||
radio_le_chan_sel_algo = (void *)pdu_data->lldata;
|
||||
|
||||
sep = meta_evt(buf, BT_HCI_EVT_LE_CHAN_SEL_ALGO, sizeof(*sep));
|
||||
|
||||
|
@ -2523,8 +2520,7 @@ static void le_phy_upd_complete(struct pdu_data *pdu_data, u16_t handle,
|
|||
struct bt_hci_evt_le_phy_update_complete *sep;
|
||||
struct radio_le_phy_upd_cmplt *radio_le_phy_upd_cmplt;
|
||||
|
||||
radio_le_phy_upd_cmplt = (struct radio_le_phy_upd_cmplt *)
|
||||
pdu_data->payload.lldata;
|
||||
radio_le_phy_upd_cmplt = (void *)pdu_data->lldata;
|
||||
|
||||
if (!(event_mask & BT_EVT_MASK_LE_META_EVENT) ||
|
||||
!(le_event_mask & BT_EVT_MASK_LE_PHY_UPDATE_COMPLETE)) {
|
||||
|
@ -2614,7 +2610,7 @@ static void encode_control(struct radio_pdu_node_rx *node_rx,
|
|||
#if defined(CONFIG_BT_CTLR_CONN_RSSI)
|
||||
case NODE_RX_TYPE_RSSI:
|
||||
BT_INFO("handle: 0x%04x, rssi: -%d dB.", handle,
|
||||
pdu_data->payload.rssi);
|
||||
pdu_data->rssi);
|
||||
return;
|
||||
#endif /* CONFIG_BT_CTLR_CONN_RSSI */
|
||||
#endif /* CONFIG_BT_CONN */
|
||||
|
@ -2628,12 +2624,12 @@ static void encode_control(struct radio_pdu_node_rx *node_rx,
|
|||
#if defined(CONFIG_BT_CTLR_PROFILE_ISR)
|
||||
case NODE_RX_TYPE_PROFILE:
|
||||
BT_INFO("l: %d, %d, %d; t: %d, %d, %d.",
|
||||
pdu_data->payload.profile.lcur,
|
||||
pdu_data->payload.profile.lmin,
|
||||
pdu_data->payload.profile.lmax,
|
||||
pdu_data->payload.profile.cur,
|
||||
pdu_data->payload.profile.min,
|
||||
pdu_data->payload.profile.max);
|
||||
pdu_data->profile.lcur,
|
||||
pdu_data->profile.lmin,
|
||||
pdu_data->profile.lmax,
|
||||
pdu_data->profile.cur,
|
||||
pdu_data->profile.min,
|
||||
pdu_data->profile.max);
|
||||
return;
|
||||
#endif /* CONFIG_BT_CTLR_PROFILE_ISR */
|
||||
|
||||
|
@ -2657,10 +2653,8 @@ static void le_ltk_request(struct pdu_data *pdu_data, u16_t handle,
|
|||
sep = meta_evt(buf, BT_HCI_EVT_LE_LTK_REQUEST, sizeof(*sep));
|
||||
|
||||
sep->handle = sys_cpu_to_le16(handle);
|
||||
memcpy(&sep->rand, pdu_data->payload.llctrl.ctrldata.enc_req.rand,
|
||||
sizeof(u64_t));
|
||||
memcpy(&sep->ediv, pdu_data->payload.llctrl.ctrldata.enc_req.ediv,
|
||||
sizeof(u16_t));
|
||||
memcpy(&sep->rand, pdu_data->llctrl.enc_req.rand, sizeof(u64_t));
|
||||
memcpy(&sep->ediv, pdu_data->llctrl.enc_req.ediv, sizeof(u16_t));
|
||||
}
|
||||
|
||||
static void encrypt_change(u8_t err, u16_t handle,
|
||||
|
@ -2697,7 +2691,7 @@ static void le_remote_feat_complete(u8_t status, struct pdu_data *pdu_data,
|
|||
sep->handle = sys_cpu_to_le16(handle);
|
||||
if (!status) {
|
||||
memcpy(&sep->features[0],
|
||||
&pdu_data->payload.llctrl.ctrldata.feature_rsp.features[0],
|
||||
&pdu_data->llctrl.feature_rsp.features[0],
|
||||
sizeof(sep->features));
|
||||
} else {
|
||||
memset(&sep->features[0], 0x00, sizeof(sep->features));
|
||||
|
@ -2708,15 +2702,14 @@ static void le_unknown_rsp(struct pdu_data *pdu_data, u16_t handle,
|
|||
struct net_buf *buf)
|
||||
{
|
||||
|
||||
switch (pdu_data->payload.llctrl.ctrldata.unknown_rsp.type) {
|
||||
switch (pdu_data->llctrl.unknown_rsp.type) {
|
||||
case PDU_DATA_LLCTRL_TYPE_SLAVE_FEATURE_REQ:
|
||||
le_remote_feat_complete(BT_HCI_ERR_UNSUPP_REMOTE_FEATURE,
|
||||
NULL, handle, buf);
|
||||
break;
|
||||
|
||||
default:
|
||||
BT_WARN("type: 0x%02x",
|
||||
pdu_data->payload.llctrl.ctrldata.unknown_rsp.type);
|
||||
BT_WARN("type: 0x%02x", pdu_data->llctrl.unknown_rsp.type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2734,7 +2727,7 @@ static void remote_version_info(struct pdu_data *pdu_data, u16_t handle,
|
|||
evt_create(buf, BT_HCI_EVT_REMOTE_VERSION_INFO, sizeof(*ep));
|
||||
ep = net_buf_add(buf, sizeof(*ep));
|
||||
|
||||
ver_ind = &pdu_data->payload.llctrl.ctrldata.version_ind;
|
||||
ver_ind = &pdu_data->llctrl.version_ind;
|
||||
ep->status = 0x00;
|
||||
ep->handle = sys_cpu_to_le16(handle);
|
||||
ep->version = ver_ind->version_number;
|
||||
|
@ -2760,12 +2753,10 @@ static void le_conn_param_req(struct pdu_data *pdu_data, u16_t handle,
|
|||
sep = meta_evt(buf, BT_HCI_EVT_LE_CONN_PARAM_REQ, sizeof(*sep));
|
||||
|
||||
sep->handle = sys_cpu_to_le16(handle);
|
||||
sep->interval_min =
|
||||
pdu_data->payload.llctrl.ctrldata.conn_param_req.interval_min;
|
||||
sep->interval_max =
|
||||
pdu_data->payload.llctrl.ctrldata.conn_param_req.interval_max;
|
||||
sep->latency = pdu_data->payload.llctrl.ctrldata.conn_param_req.latency;
|
||||
sep->timeout = pdu_data->payload.llctrl.ctrldata.conn_param_req.timeout;
|
||||
sep->interval_min = pdu_data->llctrl.conn_param_req.interval_min;
|
||||
sep->interval_max = pdu_data->llctrl.conn_param_req.interval_max;
|
||||
sep->latency = pdu_data->llctrl.conn_param_req.latency;
|
||||
sep->timeout = pdu_data->llctrl.conn_param_req.timeout;
|
||||
}
|
||||
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
|
||||
|
||||
|
@ -2783,14 +2774,10 @@ static void le_data_len_change(struct pdu_data *pdu_data, u16_t handle,
|
|||
sep = meta_evt(buf, BT_HCI_EVT_LE_DATA_LEN_CHANGE, sizeof(*sep));
|
||||
|
||||
sep->handle = sys_cpu_to_le16(handle);
|
||||
sep->max_tx_octets =
|
||||
pdu_data->payload.llctrl.ctrldata.length_rsp.max_tx_octets;
|
||||
sep->max_tx_time =
|
||||
pdu_data->payload.llctrl.ctrldata.length_rsp.max_tx_time;
|
||||
sep->max_rx_octets =
|
||||
pdu_data->payload.llctrl.ctrldata.length_rsp.max_rx_octets;
|
||||
sep->max_rx_time =
|
||||
pdu_data->payload.llctrl.ctrldata.length_rsp.max_rx_time;
|
||||
sep->max_tx_octets = pdu_data->llctrl.length_rsp.max_tx_octets;
|
||||
sep->max_tx_time = pdu_data->llctrl.length_rsp.max_tx_time;
|
||||
sep->max_rx_octets = pdu_data->llctrl.length_rsp.max_rx_octets;
|
||||
sep->max_rx_time = pdu_data->llctrl.length_rsp.max_rx_time;
|
||||
}
|
||||
#endif /* CONFIG_BT_CTLR_DATA_LENGTH */
|
||||
|
||||
|
@ -2799,7 +2786,7 @@ static void encode_data_ctrl(struct radio_pdu_node_rx *node_rx,
|
|||
{
|
||||
u16_t handle = node_rx->hdr.handle;
|
||||
|
||||
switch (pdu_data->payload.llctrl.opcode) {
|
||||
switch (pdu_data->llctrl.opcode) {
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_LE_ENC)
|
||||
case PDU_DATA_LLCTRL_TYPE_ENC_REQ:
|
||||
|
@ -2821,9 +2808,8 @@ static void encode_data_ctrl(struct radio_pdu_node_rx *node_rx,
|
|||
|
||||
#if defined(CONFIG_BT_CTLR_LE_ENC)
|
||||
case PDU_DATA_LLCTRL_TYPE_REJECT_IND:
|
||||
encrypt_change(pdu_data->payload.llctrl.ctrldata.reject_ind.
|
||||
error_code,
|
||||
handle, buf);
|
||||
encrypt_change(pdu_data->llctrl.reject_ind.error_code, handle,
|
||||
buf);
|
||||
break;
|
||||
#endif /* CONFIG_BT_CTLR_LE_ENC */
|
||||
|
||||
|
@ -2874,7 +2860,7 @@ void hci_acl_encode(struct radio_pdu_node_rx *node_rx, struct net_buf *buf)
|
|||
acl->handle = sys_cpu_to_le16(handle_flags);
|
||||
acl->len = sys_cpu_to_le16(pdu_data->len);
|
||||
data = (void *)net_buf_add(buf, pdu_data->len);
|
||||
memcpy(data, &pdu_data->payload.lldata[0], pdu_data->len);
|
||||
memcpy(data, pdu_data->lldata, pdu_data->len);
|
||||
#if defined(CONFIG_BT_HCI_ACL_FLOW_CONTROL)
|
||||
if (hci_hbuf_total > 0) {
|
||||
LL_ASSERT((hci_hbuf_sent - hci_hbuf_acked) <
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -314,7 +314,7 @@ struct pdu_data_q_tx {
|
|||
/* Minimum Tx Ctrl allocation size */
|
||||
#define PACKET_TX_CTRL_SIZE_MIN \
|
||||
MROUND(offsetof(struct radio_pdu_node_tx, pdu_data) + \
|
||||
offsetof(struct pdu_data, payload) + 27)
|
||||
offsetof(struct pdu_data, lldata) + 27)
|
||||
|
||||
/** @todo fix starvation when ctrl rx in radio ISR
|
||||
* for multiple connections needs to tx back to peer.
|
||||
|
@ -330,9 +330,9 @@ struct pdu_data_q_tx {
|
|||
#define LL_MEM_RX_POOL_SZ (MROUND(offsetof(struct radio_pdu_node_rx,\
|
||||
pdu_data) + ((\
|
||||
(PDU_AC_SIZE_MAX + PDU_AC_SIZE_EXTRA) < \
|
||||
(offsetof(struct pdu_data, payload) + \
|
||||
(offsetof(struct pdu_data, lldata) + \
|
||||
RADIO_LL_LENGTH_OCTETS_RX_MAX)) ? \
|
||||
(offsetof(struct pdu_data, payload) + \
|
||||
(offsetof(struct pdu_data, lldata) + \
|
||||
RADIO_LL_LENGTH_OCTETS_RX_MAX) \
|
||||
: \
|
||||
(PDU_AC_SIZE_MAX + PDU_AC_SIZE_EXTRA))) * \
|
||||
|
@ -344,7 +344,7 @@ struct pdu_data_q_tx {
|
|||
#define LL_MEM_TX_CTRL_POOL (PACKET_TX_CTRL_SIZE_MIN * PACKET_MEM_COUNT_TX_CTRL)
|
||||
#define LL_MEM_TX_DATA_POOL ((MROUND(offsetof( \
|
||||
struct radio_pdu_node_tx, pdu_data) + \
|
||||
offsetof(struct pdu_data, payload) + \
|
||||
offsetof(struct pdu_data, lldata) + \
|
||||
RADIO_PACKET_TX_DATA_SIZE)) \
|
||||
* (RADIO_PACKET_COUNT_TX_MAX + 1))
|
||||
|
||||
|
|
|
@ -135,8 +135,7 @@ u32_t ll_adv_params_set(u16_t interval, u8_t adv_type,
|
|||
pdu->rx_addr = 0;
|
||||
if (pdu->type == PDU_ADV_TYPE_DIRECT_IND) {
|
||||
pdu->rx_addr = direct_addr_type;
|
||||
memcpy(&pdu->payload.direct_ind.tgt_addr[0], direct_addr,
|
||||
BDADDR_SIZE);
|
||||
memcpy(&pdu->direct_ind.tgt_addr[0], direct_addr, BDADDR_SIZE);
|
||||
pdu->len = sizeof(struct pdu_adv_direct_ind);
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_ADV_EXT)
|
||||
|
@ -146,7 +145,7 @@ u32_t ll_adv_params_set(u16_t interval, u8_t adv_type,
|
|||
u8_t *ptr;
|
||||
u8_t len;
|
||||
|
||||
p = (void *)&pdu->payload.adv_ext_ind;
|
||||
p = (void *)&pdu->adv_ext_ind;
|
||||
h = (void *)p->ext_hdr_adi_adv_data;
|
||||
ptr = (u8_t *)h + sizeof(*h);
|
||||
|
||||
|
@ -288,9 +287,8 @@ void ll_adv_data_set(u8_t len, u8_t const *const data)
|
|||
|
||||
pdu->tx_addr = prev->tx_addr;
|
||||
pdu->rx_addr = prev->rx_addr;
|
||||
memcpy(&pdu->payload.adv_ind.addr[0],
|
||||
&prev->payload.adv_ind.addr[0], BDADDR_SIZE);
|
||||
memcpy(&pdu->payload.adv_ind.data[0], data, len);
|
||||
memcpy(&pdu->adv_ind.addr[0], &prev->adv_ind.addr[0], BDADDR_SIZE);
|
||||
memcpy(&pdu->adv_ind.data[0], data, len);
|
||||
pdu->len = BDADDR_SIZE + len;
|
||||
|
||||
/* commit the update so controller picks it. */
|
||||
|
@ -325,9 +323,8 @@ void ll_scan_data_set(u8_t len, u8_t const *const data)
|
|||
pdu->tx_addr = prev->tx_addr;
|
||||
pdu->rx_addr = 0;
|
||||
pdu->len = BDADDR_SIZE + len;
|
||||
memcpy(&pdu->payload.scan_rsp.addr[0],
|
||||
&prev->payload.scan_rsp.addr[0], BDADDR_SIZE);
|
||||
memcpy(&pdu->payload.scan_rsp.data[0], data, len);
|
||||
memcpy(&pdu->scan_rsp.addr[0], &prev->scan_rsp.addr[0], BDADDR_SIZE);
|
||||
memcpy(&pdu->scan_rsp.data[0], data, len);
|
||||
|
||||
/* commit the update so controller picks it. */
|
||||
radio_scan_data->last = last;
|
||||
|
@ -371,7 +368,7 @@ u32_t ll_adv_enable(u8_t enable)
|
|||
struct ext_adv_hdr *h;
|
||||
u8_t *ptr;
|
||||
|
||||
p = (void *)&pdu_adv->payload.adv_ext_ind;
|
||||
p = (void *)&pdu_adv->adv_ext_ind;
|
||||
h = (void *)p->ext_hdr_adi_adv_data;
|
||||
ptr = (u8_t *)h + sizeof(*h);
|
||||
|
||||
|
@ -406,10 +403,12 @@ u32_t ll_adv_enable(u8_t enable)
|
|||
}
|
||||
#endif /* !CONFIG_BT_CTLR_PRIVACY */
|
||||
if (!priv) {
|
||||
memcpy(&pdu_adv->payload.adv_ind.addr[0],
|
||||
ll_addr_get(pdu_adv->tx_addr, NULL), BDADDR_SIZE);
|
||||
memcpy(&pdu_scan->payload.scan_rsp.addr[0],
|
||||
ll_addr_get(pdu_adv->tx_addr, NULL), BDADDR_SIZE);
|
||||
memcpy(&pdu_adv->adv_ind.addr[0],
|
||||
ll_addr_get(pdu_adv->tx_addr, NULL),
|
||||
BDADDR_SIZE);
|
||||
memcpy(&pdu_scan->scan_rsp.addr[0],
|
||||
ll_addr_get(pdu_adv->tx_addr, NULL),
|
||||
BDADDR_SIZE);
|
||||
}
|
||||
}
|
||||
#if defined(CONFIG_BT_CTLR_ADV_EXT)
|
||||
|
|
|
@ -511,8 +511,8 @@ bool ctrl_rl_enabled(void)
|
|||
void ll_rl_pdu_adv_update(u8_t idx, struct pdu_adv *pdu)
|
||||
{
|
||||
u8_t *adva = pdu->type == PDU_ADV_TYPE_SCAN_RSP ?
|
||||
&pdu->payload.scan_rsp.addr[0] :
|
||||
&pdu->payload.adv_ind.addr[0];
|
||||
&pdu->scan_rsp.addr[0] :
|
||||
&pdu->adv_ind.addr[0];
|
||||
|
||||
struct ll_adv_set *ll_adv = ll_adv_set_get();
|
||||
|
||||
|
@ -530,11 +530,11 @@ void ll_rl_pdu_adv_update(u8_t idx, struct pdu_adv *pdu)
|
|||
if (pdu->type == PDU_ADV_TYPE_DIRECT_IND) {
|
||||
if (idx < ARRAY_SIZE(rl) && rl[idx].pirk) {
|
||||
pdu->rx_addr = 1;
|
||||
memcpy(&pdu->payload.direct_ind.tgt_addr[0],
|
||||
memcpy(&pdu->direct_ind.tgt_addr[0],
|
||||
rl[idx].peer_rpa.val, BDADDR_SIZE);
|
||||
} else {
|
||||
pdu->rx_addr = ll_adv->id_addr_type;
|
||||
memcpy(&pdu->payload.direct_ind.tgt_addr[0],
|
||||
memcpy(&pdu->direct_ind.tgt_addr[0],
|
||||
ll_adv->id_addr, BDADDR_SIZE);
|
||||
}
|
||||
}
|
||||
|
@ -583,7 +583,7 @@ static void rpa_adv_refresh(void)
|
|||
LL_ASSERT(idx < ARRAY_SIZE(rl));
|
||||
ll_rl_pdu_adv_update(idx, pdu);
|
||||
|
||||
memcpy(&pdu->payload.adv_ind.data[0], &prev->payload.adv_ind.data[0],
|
||||
memcpy(&pdu->adv_ind.data[0], &prev->adv_ind.data[0],
|
||||
prev->len - BDADDR_SIZE);
|
||||
pdu->len = prev->len;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#define PDU_AC_PAYLOAD_SIZE_MAX 37
|
||||
#define PDU_AC_SIZE_MAX (offsetof(struct pdu_adv, payload) + \
|
||||
PDU_AC_PAYLOAD_SIZE_MAX)
|
||||
#define PDU_EM_SIZE_MAX offsetof(struct pdu_data, payload)
|
||||
#define PDU_EM_SIZE_MAX offsetof(struct pdu_data, lldata)
|
||||
|
||||
struct pdu_adv_adv_ind {
|
||||
u8_t addr[BDADDR_SIZE];
|
||||
|
@ -50,7 +50,7 @@ struct pdu_adv_connect_ind {
|
|||
u8_t chan_map[5];
|
||||
u8_t hop:5;
|
||||
u8_t sca:3;
|
||||
} __packed lldata;
|
||||
} __packed;
|
||||
} __packed;
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_ADV_EXT)
|
||||
|
@ -146,6 +146,7 @@ struct pdu_adv {
|
|||
u8_t len:8;
|
||||
|
||||
union {
|
||||
u8_t payload[0];
|
||||
struct pdu_adv_adv_ind adv_ind;
|
||||
struct pdu_adv_direct_ind direct_ind;
|
||||
struct pdu_adv_scan_req scan_req;
|
||||
|
@ -155,7 +156,7 @@ struct pdu_adv {
|
|||
#if defined(CONFIG_BT_CTLR_ADV_EXT)
|
||||
struct pdu_adv_com_ext_adv adv_ext_ind;
|
||||
#endif /* CONFIG_BT_CTLR_ADV_EXT */
|
||||
} __packed payload;
|
||||
} __packed;
|
||||
} __packed;
|
||||
|
||||
enum pdu_data_llid {
|
||||
|
@ -373,7 +374,7 @@ struct pdu_data_llctrl {
|
|||
struct pdu_data_llctrl_phy_rsp phy_rsp;
|
||||
struct pdu_data_llctrl_phy_upd_ind phy_upd_ind;
|
||||
struct pdu_data_llctrl_min_used_chans_ind min_used_chans_ind;
|
||||
} __packed ctrldata;
|
||||
} __packed;
|
||||
} __packed;
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_PROFILE_ISR)
|
||||
|
@ -401,17 +402,17 @@ struct pdu_data {
|
|||
#endif /* !CONFIG_BT_CTLR_DATA_LENGTH_CLEAR */
|
||||
|
||||
union {
|
||||
u8_t lldata[1];
|
||||
struct pdu_data_llctrl llctrl;
|
||||
u8_t lldata[0];
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_CONN_RSSI)
|
||||
u8_t rssi;
|
||||
u8_t rssi;
|
||||
#endif /* CONFIG_BT_CTLR_CONN_RSSI */
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_PROFILE_ISR)
|
||||
struct profile profile;
|
||||
struct profile profile;
|
||||
#endif /* CONFIG_BT_CTLR_PROFILE_ISR */
|
||||
} __packed payload;
|
||||
} __packed;
|
||||
} __packed;
|
||||
|
||||
#endif /* _PDU_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue