|
35 | 35 | #include "hci_internal.h" |
36 | 36 | #include "hci_vendor.h" |
37 | 37 |
|
| 38 | +#if (!defined(CONFIG_BT_LL_SW_SPLIT)) |
| 39 | +#include "ll_sw/ctrl.h" |
| 40 | +#endif /* CONFIG_BT_LL_SW_SPLIT */ |
| 41 | + |
38 | 42 | #if defined(CONFIG_BT_HCI_MESH_EXT) |
39 | 43 | #include "ll_sw/ll_mesh.h" |
40 | 44 | #endif /* CONFIG_BT_HCI_MESH_EXT */ |
@@ -1309,7 +1313,7 @@ static void le_read_max_data_len(struct net_buf *buf, struct net_buf **evt) |
1309 | 1313 | #if defined(CONFIG_BT_CTLR_PHY) |
1310 | 1314 | static void le_read_phy(struct net_buf *buf, struct net_buf **evt) |
1311 | 1315 | { |
1312 | | - struct bt_hci_cp_le_read_phy *cmd = (void *) buf->data; |
| 1316 | + struct bt_hci_cp_le_read_phy *cmd = (void *)buf->data; |
1313 | 1317 | struct bt_hci_rp_le_read_phy *rp; |
1314 | 1318 | u16_t handle; |
1315 | 1319 | u8_t status; |
@@ -1427,6 +1431,7 @@ static void le_rem_dev_from_rl(struct net_buf *buf, struct net_buf **evt) |
1427 | 1431 | static void le_clear_rl(struct net_buf *buf, struct net_buf **evt) |
1428 | 1432 | { |
1429 | 1433 | struct bt_hci_evt_cc_status *ccst; |
| 1434 | + |
1430 | 1435 | ccst = hci_cmd_complete(evt, sizeof(*ccst)); |
1431 | 1436 |
|
1432 | 1437 | ccst->status = ll_rl_clear(); |
@@ -2499,8 +2504,15 @@ static void le_advertising_report(struct pdu_data *pdu_data, u8_t *b, |
2499 | 2504 | #endif /* CONFIG_BT_CTLR_EXT_SCAN_FP */ |
2500 | 2505 | s8_t *prssi; |
2501 | 2506 |
|
2502 | | - extra = &b[offsetof(struct node_rx_pdu, pdu) + |
2503 | | - offsetof(struct pdu_adv, payload) + adv->len]; |
| 2507 | +#if defined(CONFIG_BT_LL_SW_SPLIT) |
| 2508 | + struct node_rx_pdu *node_rx; |
| 2509 | + |
| 2510 | + node_rx = (struct node_rx_pdu *)b; |
| 2511 | + extra = (u8_t *)&(node_rx->hdr.rx_ftr.param); |
| 2512 | +#else |
| 2513 | + extra = (u8_t *)&b[offsetof(struct radio_pdu_node_rx, pdu_data) + |
| 2514 | + offsetof(struct pdu_adv, payload) + adv->len]; |
| 2515 | +#endif /* CONFIG_BT_LL_SW_SPLIT */ |
2504 | 2516 |
|
2505 | 2517 | /* The Link Layer currently returns RSSI as an absolute value */ |
2506 | 2518 | rssi = -(*extra); |
@@ -2592,10 +2604,19 @@ static void le_adv_ext_report(struct pdu_data *pdu_data, u8_t *b, |
2592 | 2604 | { |
2593 | 2605 | struct pdu_adv *adv = (void *)pdu_data; |
2594 | 2606 | s8_t rssi; |
| 2607 | + u8_t *extra; |
| 2608 | + |
| 2609 | +#if defined(CONFIG_BT_LL_SW_SPLIT) |
| 2610 | + struct node_rx_pdu *node_rx; |
2595 | 2611 |
|
| 2612 | + node_rx = (struct node_rx_pdu *)b; |
| 2613 | + extra = (u8_t *)&(node_rx->hdr.rx_ftr.param); |
| 2614 | +#else |
| 2615 | + extra = (u8_t *)&b[offsetof(struct radio_pdu_node_rx, pdu_data) + |
| 2616 | + offsetof(struct pdu_adv, payload) + adv->len]; |
| 2617 | +#endif /* CONFIG_BT_LL_SW_SPLIT */ |
2596 | 2618 | /* The Link Layer currently returns RSSI as an absolute value */ |
2597 | | - rssi = -b[offsetof(struct node_rx_pdu, pdu) + |
2598 | | - offsetof(struct pdu_adv, payload) + adv->len]; |
| 2619 | + rssi = -(*extra); |
2599 | 2620 |
|
2600 | 2621 | BT_DBG("phy= 0x%x, type= 0x%x, len= %u, tat= %u, rat= %u, rssi=%d dB", |
2601 | 2622 | phy, adv->type, adv->len, adv->tx_addr, adv->rx_addr, rssi); |
@@ -2674,15 +2695,28 @@ static void le_scan_req_received(struct pdu_data *pdu_data, u8_t *b, |
2674 | 2695 | char addr_str[BT_ADDR_LE_STR_LEN]; |
2675 | 2696 | bt_addr_le_t addr; |
2676 | 2697 | u8_t handle; |
| 2698 | + u8_t *extra; |
2677 | 2699 | s8_t rssi; |
2678 | 2700 |
|
2679 | 2701 | handle = 0U; |
2680 | 2702 | addr.type = adv->tx_addr; |
2681 | 2703 | memcpy(&addr.a.val[0], &adv->scan_req.scan_addr[0], |
2682 | 2704 | sizeof(bt_addr_t)); |
| 2705 | + |
| 2706 | +#if defined(CONFIG_BT_LL_SW_SPLIT) |
| 2707 | + struct node_rx_pdu *node_rx; |
| 2708 | + |
| 2709 | + node_rx = (struct node_rx_pdu *)b; |
| 2710 | + extra = (u8_t *)&(node_rx->hdr.rx_ftr.param); |
| 2711 | +#else |
| 2712 | + extra = (u8_t *)&b[offsetof(struct radio_pdu_node_rx, |
| 2713 | + pdu_data) + |
| 2714 | + offsetof(struct pdu_adv, payload) + |
| 2715 | + adv->len]; |
| 2716 | +#endif /* CONFIG_BT_LL_SW_SPLIT */ |
| 2717 | + |
2683 | 2718 | /* The Link Layer currently returns RSSI as an absolute value */ |
2684 | | - rssi = -b[offsetof(struct node_rx_pdu, pdu) + |
2685 | | - offsetof(struct pdu_adv, payload) + adv->len]; |
| 2719 | + rssi = -(*extra); |
2686 | 2720 |
|
2687 | 2721 | bt_addr_le_to_str(&addr, addr_str, sizeof(addr_str)); |
2688 | 2722 |
|
@@ -2754,7 +2788,8 @@ static void le_conn_complete(struct pdu_data *pdu_data, u16_t handle, |
2754 | 2788 |
|
2755 | 2789 | /* Note: this could be an RPA set as the random address by |
2756 | 2790 | * the Host instead of generated by the controller. That said, |
2757 | | - * this should make no difference. */ |
| 2791 | + * this should make no difference. |
| 2792 | + */ |
2758 | 2793 | if ((node_rx->own_addr_type) && |
2759 | 2794 | ((node_rx->own_addr[5] & 0xc0) == 0x40)) { |
2760 | 2795 | memcpy(&leecc->local_rpa.val[0], &node_rx->own_addr[0], |
@@ -3262,9 +3297,16 @@ void hci_acl_encode(struct node_rx_pdu *node_rx, struct net_buf *buf) |
3262 | 3297 | u16_t handle; |
3263 | 3298 | u8_t *data; |
3264 | 3299 |
|
3265 | | - pdu_data = (void *)node_rx->pdu; |
3266 | 3300 | handle = node_rx->hdr.handle; |
3267 | 3301 |
|
| 3302 | +#if defined(CONFIG_BT_LL_SW_SPLIT) |
| 3303 | + pdu_data = (void *)node_rx->pdu; |
| 3304 | +#else |
| 3305 | + u8_t *b = (u8_t *)node_rx; |
| 3306 | + |
| 3307 | + pdu_data = (void *)&b[offsetof(struct radio_pdu_node_rx, pdu_data)]; |
| 3308 | +#endif /* CONFIG_BT_LL_SW_SPLIT */ |
| 3309 | + |
3268 | 3310 | switch (pdu_data->ll_id) { |
3269 | 3311 | case PDU_DATA_LLID_DATA_CONTINUE: |
3270 | 3312 | case PDU_DATA_LLID_DATA_START: |
@@ -3304,7 +3346,13 @@ void hci_evt_encode(struct node_rx_pdu *node_rx, struct net_buf *buf) |
3304 | 3346 | { |
3305 | 3347 | struct pdu_data *pdu_data; |
3306 | 3348 |
|
| 3349 | +#if defined(CONFIG_BT_LL_SW_SPLIT) |
3307 | 3350 | pdu_data = (void *)node_rx->pdu; |
| 3351 | +#else |
| 3352 | + u8_t *b = (u8_t *)node_rx; |
| 3353 | + |
| 3354 | + pdu_data = (void *)&b[offsetof(struct radio_pdu_node_rx, pdu_data)]; |
| 3355 | +#endif /* CONFIG_BT_LL_SW_SPLIT */ |
3308 | 3356 |
|
3309 | 3357 | if (node_rx->hdr.type != NODE_RX_TYPE_DC_PDU) { |
3310 | 3358 | encode_control(node_rx, pdu_data, buf); |
@@ -3336,7 +3384,13 @@ s8_t hci_get_class(struct node_rx_pdu *node_rx) |
3336 | 3384 | { |
3337 | 3385 | struct pdu_data *pdu_data; |
3338 | 3386 |
|
| 3387 | +#if defined(CONFIG_BT_LL_SW_SPLIT) |
3339 | 3388 | pdu_data = (void *)node_rx->pdu; |
| 3389 | +#else |
| 3390 | + u8_t *b = (u8_t *)node_rx; |
| 3391 | + |
| 3392 | + pdu_data = (void *)&b[offsetof(struct radio_pdu_node_rx, pdu_data)]; |
| 3393 | +#endif /* CONFIG_BT_LL_SW_SPLIT */ |
3340 | 3394 |
|
3341 | 3395 | if (node_rx->hdr.type != NODE_RX_TYPE_DC_PDU) { |
3342 | 3396 |
|
|
0 commit comments