Lines Matching +full:cs +full:- +full:interval

2  * Copyright (c) 2016-2018 Nordic Semiconductor ASA
5 * SPDX-License-Identifier: Apache-2.0
110 * 0 - Non-Connectable Non-Scannable advertising report
111 * 1 - Connectable Non-Scannable advertising report
112 * 2 - Non-Connectable Scannable advertisig report
113 * 3 - Connectable Scannable advertising report
116 * cycle. If advertiser changes between Connectable Non-Scannable,
122 * 4 - Periodic Advertising report
154 #define DUP_FILTER_DISABLED (-1)
162 /* Helper function to reset non-periodic advertising entries in filter table */
234 return -EINVAL; in ll_adv_cmds_set()
266 err = -EINVAL; in adv_cmds_legacy_check()
304 hdr->evt = evt; in hci_evt_create()
305 hdr->len = len; in hci_evt_create()
327 ccst->status = status; in cmd_complete_status()
338 me->subevent = subevt; in meta_evt()
350 evt->subevent = subevt; in vs_event()
363 me->prefix = BT_HCI_MESH_EVT_PREFIX; in mesh_evt()
364 me->subevent = subevt; in mesh_evt()
373 struct bt_hci_cp_disconnect *cmd = (void *)buf->data; in disconnect()
377 handle = sys_le16_to_cpu(cmd->handle); in disconnect()
378 status = ll_terminate_ind_send(handle, cmd->reason); in disconnect()
385 struct bt_hci_cp_read_remote_version_info *cmd = (void *)buf->data; in read_remote_ver_info()
389 handle = sys_le16_to_cpu(cmd->handle); in read_remote_ver_info()
409 return -EINVAL; in link_control_cmd_handle()
417 struct bt_hci_cp_set_event_mask *cmd = (void *)buf->data; in set_event_mask()
419 event_mask = sys_get_le64(cmd->events); in set_event_mask()
426 struct bt_hci_cp_set_event_mask_page_2 *cmd = (void *)buf->data; in set_event_mask_page_2()
428 event_mask_page_2 = sys_get_le64(cmd->events_page_2); in set_event_mask_page_2()
486 struct bt_hci_cp_set_ctl_to_host_flow *cmd = (void *)buf->data; in set_ctl_to_host_flow()
487 uint8_t flow_enable = cmd->flow_enable; in set_ctl_to_host_flow()
496 ccst->status = BT_HCI_ERR_CMD_DISALLOWED; in set_ctl_to_host_flow()
499 ccst->status = 0x00; in set_ctl_to_host_flow()
516 ccst->status = BT_HCI_ERR_INVALID_PARAM; in set_ctl_to_host_flow()
523 hci_hbuf_total = -hci_hbuf_total; in set_ctl_to_host_flow()
528 struct bt_hci_cp_host_buffer_size *cmd = (void *)buf->data; in host_buffer_size()
529 uint16_t acl_pkts = sys_le16_to_cpu(cmd->acl_pkts); in host_buffer_size()
530 uint16_t acl_mtu = sys_le16_to_cpu(cmd->acl_mtu); in host_buffer_size()
536 ccst->status = BT_HCI_ERR_CMD_DISALLOWED; in host_buffer_size()
543 ccst->status = BT_HCI_ERR_INVALID_PARAM; in host_buffer_size()
548 hci_hbuf_total = -acl_pkts; in host_buffer_size()
554 struct bt_hci_cp_host_num_completed_packets *cmd = (void *)buf->data; in host_num_completed_packets()
561 ccst->status = BT_HCI_ERR_CMD_DISALLOWED; in host_num_completed_packets()
565 ccst->status = BT_HCI_ERR_INVALID_PARAM; in host_num_completed_packets()
570 for (uint8_t i = 0; i < cmd->num_handles; i++) { in host_num_completed_packets()
571 uint16_t h = sys_le16_to_cpu(cmd->h[i].handle); in host_num_completed_packets()
572 uint16_t c = sys_le16_to_cpu(cmd->h[i].count); in host_num_completed_packets()
577 ccst->status = BT_HCI_ERR_INVALID_PARAM; in host_num_completed_packets()
581 hci_hbuf_pend[h] -= c; in host_num_completed_packets()
594 struct bt_hci_cp_read_auth_payload_timeout *cmd = (void *)buf->data; in read_auth_payload_timeout()
600 handle = sys_le16_to_cpu(cmd->handle); in read_auth_payload_timeout()
605 rp->status = status; in read_auth_payload_timeout()
606 rp->handle = sys_cpu_to_le16(handle); in read_auth_payload_timeout()
607 rp->auth_payload_timeout = sys_cpu_to_le16(auth_payload_timeout); in read_auth_payload_timeout()
613 struct bt_hci_cp_write_auth_payload_timeout *cmd = (void *)buf->data; in write_auth_payload_timeout()
619 handle = sys_le16_to_cpu(cmd->handle); in write_auth_payload_timeout()
620 auth_payload_timeout = sys_le16_to_cpu(cmd->auth_payload_timeout); in write_auth_payload_timeout()
625 rp->status = status; in write_auth_payload_timeout()
626 rp->handle = sys_cpu_to_le16(handle); in write_auth_payload_timeout()
634 struct bt_hci_cp_configure_data_path *cmd = (void *)buf->data; in configure_data_path()
640 vs_config = &cmd->vs_config[0]; in configure_data_path()
643 status = ll_configure_data_path(cmd->data_path_dir, in configure_data_path()
644 cmd->data_path_id, in configure_data_path()
645 cmd->vs_config_len, in configure_data_path()
652 rp->status = status; in configure_data_path()
666 rp->status = ll_conn_iso_accept_timeout_get(&timeout); in read_conn_accept_timeout()
667 rp->conn_accept_timeout = sys_cpu_to_le16(timeout); in read_conn_accept_timeout()
672 struct bt_hci_cp_write_conn_accept_timeout *cmd = (void *)buf->data; in write_conn_accept_timeout()
676 timeout = sys_le16_to_cpu(cmd->conn_accept_timeout); in write_conn_accept_timeout()
680 rp->status = ll_conn_iso_accept_timeout_set(timeout); in write_conn_accept_timeout()
687 struct bt_hci_cp_read_tx_power_level *cmd = (void *)buf->data; in read_tx_power_level()
693 handle = sys_le16_to_cpu(cmd->handle); in read_tx_power_level()
694 type = cmd->type; in read_tx_power_level()
699 handle, type, &rp->tx_power_level); in read_tx_power_level()
701 rp->status = status; in read_tx_power_level()
702 rp->handle = sys_cpu_to_le16(handle); in read_tx_power_level()
769 return -EINVAL; in ctrl_bb_cmd_handle()
781 rp->status = 0x00; in read_local_version_info()
782 rp->hci_version = LL_VERSION_NUMBER; in read_local_version_info()
783 rp->hci_revision = sys_cpu_to_le16(0); in read_local_version_info()
784 rp->lmp_version = LL_VERSION_NUMBER; in read_local_version_info()
785 rp->manufacturer = sys_cpu_to_le16(ll_settings_company_id()); in read_local_version_info()
786 rp->lmp_subversion = sys_cpu_to_le16(ll_settings_subversion_number()); in read_local_version_info()
795 rp->status = 0x00; in read_supported_commands()
796 (void)memset(&rp->commands[0], 0, sizeof(rp->commands)); in read_supported_commands()
800 rp->commands[2] |= BIT(7); in read_supported_commands()
803 rp->commands[5] |= BIT(6) | BIT(7); in read_supported_commands()
807 rp->commands[7] |= BIT(2) | BIT(3); in read_supported_commands()
811 rp->commands[10] |= BIT(2); in read_supported_commands()
815 rp->commands[10] |= BIT(5) | BIT(6) | BIT(7); in read_supported_commands()
819 rp->commands[14] |= BIT(3) | BIT(5); in read_supported_commands()
821 rp->commands[15] |= BIT(1); in read_supported_commands()
825 rp->commands[15] |= BIT(5); in read_supported_commands()
829 rp->commands[22] |= BIT(2); in read_supported_commands()
833 rp->commands[25] |= BIT(0) | BIT(1) | BIT(2) | BIT(4); in read_supported_commands()
837 rp->commands[26] |= BIT(6) | BIT(7); in read_supported_commands()
839 rp->commands[27] |= BIT(0) | BIT(1); in read_supported_commands()
843 rp->commands[27] |= BIT(6) | BIT(7); in read_supported_commands()
845 rp->commands[28] |= BIT(3); in read_supported_commands()
849 rp->commands[25] |= BIT(5) | BIT(6) | BIT(7); in read_supported_commands()
851 rp->commands[26] |= BIT(0) | BIT(1); in read_supported_commands()
858 rp->commands[36] |= BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5) | in read_supported_commands()
861 rp->commands[37] |= BIT(0) | BIT(1); in read_supported_commands()
864 rp->commands[37] |= BIT(2) | BIT(3) | BIT(4); in read_supported_commands()
867 rp->commands[42] |= BIT(5) | BIT(6) | BIT(7); in read_supported_commands()
875 rp->commands[26] |= BIT(2) | BIT(3); in read_supported_commands()
879 rp->commands[37] |= BIT(5) | BIT(6); in read_supported_commands()
882 rp->commands[38] |= BIT(0) | BIT(1) | BIT(2); in read_supported_commands()
889 rp->commands[38] |= BIT(3) | BIT(4) | BIT(5) | BIT(6); in read_supported_commands()
893 rp->commands[40] |= BIT(5); in read_supported_commands()
897 rp->commands[43] |= BIT(0) | BIT(1); in read_supported_commands()
907 rp->commands[26] |= BIT(4) | BIT(5); in read_supported_commands()
909 rp->commands[27] |= BIT(3); in read_supported_commands()
913 rp->commands[37] |= BIT(7); in read_supported_commands()
918 rp->commands[28] |= BIT(0); in read_supported_commands()
923 rp->commands[41] |= BIT(7); in read_supported_commands()
925 rp->commands[42] |= BIT(0) | BIT(1) | BIT(2); in read_supported_commands()
932 rp->commands[28] |= BIT(1) | BIT(2); in read_supported_commands()
936 rp->commands[42] |= BIT(3) | BIT(4); in read_supported_commands()
941 rp->commands[0] |= BIT(5); in read_supported_commands()
943 rp->commands[27] |= BIT(2) | BIT(4) | BIT(5); in read_supported_commands()
947 rp->commands[33] |= BIT(4) | BIT(5); in read_supported_commands()
952 rp->commands[32] |= BIT(4) | BIT(5); in read_supported_commands()
957 rp->commands[33] |= BIT(6) | BIT(7); in read_supported_commands()
959 rp->commands[34] |= BIT(0); in read_supported_commands()
961 rp->commands[35] |= BIT(3); in read_supported_commands()
966 rp->commands[35] |= BIT(4); in read_supported_commands()
968 rp->commands[35] |= BIT(5); in read_supported_commands()
970 rp->commands[35] |= BIT(6); in read_supported_commands()
974 rp->commands[43] |= BIT(2); in read_supported_commands()
980 rp->commands[28] |= BIT(4) | BIT(5) | BIT(6); in read_supported_commands()
982 rp->commands[35] |= BIT(7); in read_supported_commands()
984 rp->commands[36] |= BIT(0); in read_supported_commands()
986 rp->commands[39] |= BIT(3); in read_supported_commands()
990 rp->commands[39] |= BIT(4); in read_supported_commands()
994 rp->commands[45] |= BIT(0); in read_supported_commands()
1000 rp->commands[34] |= BIT(3) | BIT(4) | BIT(5) | BIT(6) | BIT(7); in read_supported_commands()
1002 rp->commands[35] |= BIT(0) | BIT(1) | BIT(2); in read_supported_commands()
1004 rp->commands[39] |= BIT(2); in read_supported_commands()
1012 rp->commands[39] |= BIT(5) | BIT(6); in read_supported_commands()
1016 rp->commands[39] |= BIT(7); in read_supported_commands()
1019 rp->commands[40] |= BIT(4); in read_supported_commands()
1022 rp->commands[40] |= BIT(1); in read_supported_commands()
1026 rp->commands[40] |= BIT(0); in read_supported_commands()
1030 rp->commands[40] |= BIT(2); in read_supported_commands()
1034 rp->commands[40] |= BIT(3); in read_supported_commands()
1041 rp->commands[40] |= BIT(6); in read_supported_commands()
1043 rp->commands[40] |= BIT(7); in read_supported_commands()
1047 rp->commands[41] |= BIT(0); in read_supported_commands()
1049 rp->commands[41] |= BIT(1); in read_supported_commands()
1053 bt_hci_ecc_supported_commands(rp->commands); in read_supported_commands()
1057 rp->commands[38] |= BIT(7); in read_supported_commands()
1061 rp->commands[41] |= BIT(5) | BIT(6); in read_supported_commands()
1063 rp->commands[43] |= BIT(5); in read_supported_commands()
1068 rp->commands[43] |= BIT(6) | BIT(7); in read_supported_commands()
1072 rp->commands[44] |= BIT(2); in read_supported_commands()
1078 rp->commands[43] |= BIT(3) | BIT(4); in read_supported_commands()
1080 rp->commands[44] |= BIT(0); in read_supported_commands()
1085 rp->commands[44] |= BIT(1); in read_supported_commands()
1090 rp->commands[45] |= BIT(2) | BIT(3) | BIT(4) | BIT(5); in read_supported_commands()
1100 rp->status = 0x00; in read_local_features()
1101 (void)memset(&rp->features[0], 0x00, sizeof(rp->features)); in read_local_features()
1103 rp->features[4] = (1 << 5) | (1 << 6); in read_local_features()
1112 rp->status = 0x00; in read_bd_addr()
1114 (void)ll_addr_read(0, &rp->bdaddr.val[0]); in read_bd_addr()
1159 /* read vendor-specific codec information */ in read_codecs_v2()
1168 rp->status = 0x00; in read_codecs_v2()
1171 std_codecs = (struct bt_hci_std_codecs_v2 *)&rp->codecs[0]; in read_codecs_v2()
1172 std_codecs->num_codecs = num_std_codecs; in read_codecs_v2()
1176 codec = &std_codecs->codec_info[i]; in read_codecs_v2()
1177 codec->codec_id = std_codec_info[i].codec_id; in read_codecs_v2()
1178 codec->transports = std_codec_info[i].transports; in read_codecs_v2()
1182 vs_codecs = (struct bt_hci_vs_codecs_v2 *)&rp->codecs[std_codecs_bytes]; in read_codecs_v2()
1183 vs_codecs->num_codecs = num_vs_codecs; in read_codecs_v2()
1187 codec = &vs_codecs->codec_info[i]; in read_codecs_v2()
1188 codec->company_id = in read_codecs_v2()
1190 codec->codec_id = sys_cpu_to_le16(vs_codec_info[i].codec_id); in read_codecs_v2()
1191 codec->transports = vs_codec_info[i].transports; in read_codecs_v2()
1220 struct bt_hci_cp_read_codec_capabilities *cmd = (void *)buf->data; in read_codec_capabilities()
1229 company_id = sys_le16_to_cpu(cmd->codec_id.company_id); in read_codec_capabilities()
1230 vs_codec_id = sys_le16_to_cpu(cmd->codec_id.vs_codec_id); in read_codec_capabilities()
1233 status = hci_vendor_read_codec_capabilities(cmd->codec_id.coding_format, in read_codec_capabilities()
1236 cmd->transport, in read_codec_capabilities()
1237 cmd->direction, in read_codec_capabilities()
1244 rp->status = status; in read_codec_capabilities()
1247 rp->num_capabilities = num_capabilities; in read_codec_capabilities()
1248 memcpy(&rp->capabilities, capabilities, capabilities_bytes); in read_codec_capabilities()
1278 struct bt_hci_cp_read_ctlr_delay *cmd = (void *)buf->data; in read_ctlr_delay()
1286 company_id = sys_le16_to_cpu(cmd->codec_id.company_id); in read_ctlr_delay()
1287 vs_codec_id = sys_le16_to_cpu(cmd->codec_id.vs_codec_id); in read_ctlr_delay()
1289 status = hci_vendor_read_ctlr_delay(cmd->codec_id.coding_format, in read_ctlr_delay()
1292 cmd->transport, in read_ctlr_delay()
1293 cmd->direction, in read_ctlr_delay()
1294 cmd->codec_config_len, in read_ctlr_delay()
1295 cmd->codec_config, in read_ctlr_delay()
1300 rp->status = status; in read_ctlr_delay()
1301 sys_put_le24(min_delay, rp->min_ctlr_delay); in read_ctlr_delay()
1302 sys_put_le24(max_delay, rp->max_ctlr_delay); in read_ctlr_delay()
1341 return -EINVAL; in info_cmd_handle()
1350 struct bt_hci_cp_read_rssi *cmd = (void *)buf->data; in read_rssi()
1354 handle = sys_le16_to_cpu(cmd->handle); in read_rssi()
1358 rp->status = ll_rssi_get(handle, &rp->rssi); in read_rssi()
1360 rp->handle = sys_cpu_to_le16(handle); in read_rssi()
1362 rp->rssi = (!rp->status) ? -rp->rssi : 127; in read_rssi()
1377 return -EINVAL; in status_cmd_handle()
1385 struct bt_hci_cp_set_event_mask *cmd = (void *)buf->data; in le_set_event_mask()
1387 le_event_mask = sys_get_le64(cmd->events); in le_set_event_mask()
1398 rp->status = 0x00; in le_read_buffer_size()
1400 rp->le_max_len = sys_cpu_to_le16(LL_LENGTH_OCTETS_TX_MAX); in le_read_buffer_size()
1401 rp->le_max_num = CONFIG_BT_BUF_ACL_TX_COUNT; in le_read_buffer_size()
1411 rp->status = 0x00; in le_read_buffer_size_v2()
1413 rp->acl_max_len = sys_cpu_to_le16(LL_LENGTH_OCTETS_TX_MAX); in le_read_buffer_size_v2()
1414 rp->acl_max_num = CONFIG_BT_BUF_ACL_TX_COUNT; in le_read_buffer_size_v2()
1415 rp->iso_max_len = sys_cpu_to_le16(BT_CTLR_ISO_TX_BUFFER_SIZE); in le_read_buffer_size_v2()
1416 rp->iso_max_num = CONFIG_BT_CTLR_ISO_TX_BUFFERS; in le_read_buffer_size_v2()
1426 rp->status = 0x00; in le_read_local_features()
1428 (void)memset(&rp->features[0], 0x00, sizeof(rp->features)); in le_read_local_features()
1429 sys_put_le64(ll_feat_get(), rp->features); in le_read_local_features()
1434 struct bt_hci_cp_le_set_random_address *cmd = (void *)buf->data; in le_set_random_address()
1437 status = ll_addr_set(1, &cmd->bdaddr.val[0]); in le_set_random_address()
1448 rp->status = 0x00; in le_read_fal_size()
1450 rp->fal_size = ll_fal_size_get(); in le_read_fal_size()
1464 struct bt_hci_cp_le_add_dev_to_fal *cmd = (void *)buf->data; in le_add_dev_to_fal()
1467 status = ll_fal_add(&cmd->addr); in le_add_dev_to_fal()
1474 struct bt_hci_cp_le_rem_dev_from_fal *cmd = (void *)buf->data; in le_rem_dev_from_fal()
1477 status = ll_fal_remove(&cmd->addr); in le_rem_dev_from_fal()
1486 struct bt_hci_cp_le_encrypt *cmd = (void *)buf->data; in le_encrypt()
1490 ecb_encrypt(cmd->key, cmd->plaintext, enc_data, NULL); in le_encrypt()
1494 rp->status = 0x00; in le_encrypt()
1495 memcpy(rp->enc_data, enc_data, 16); in le_encrypt()
1502 uint8_t count = sizeof(rp->rand); in le_rand()
1505 rp->status = 0x00; in le_rand()
1507 lll_csrand_get(rp->rand, count); in le_rand()
1516 rp->status = 0x00; in le_read_supp_states()
1564 sys_put_le64(states, rp->le_states); in le_read_supp_states()
1570 struct bt_hci_cp_le_set_adv_param *cmd = (void *)buf->data; in le_set_adv_param()
1578 min_interval = sys_le16_to_cpu(cmd->min_interval); in le_set_adv_param()
1581 (cmd->type != BT_HCI_ADV_DIRECT_IND)) { in le_set_adv_param()
1582 uint16_t max_interval = sys_le16_to_cpu(cmd->max_interval); in le_set_adv_param()
1593 status = ll_adv_params_set(0, 0, min_interval, cmd->type, in le_set_adv_param()
1594 cmd->own_addr_type, cmd->direct_addr.type, in le_set_adv_param()
1595 &cmd->direct_addr.a.val[0], cmd->channel_map, in le_set_adv_param()
1596 cmd->filter_policy, 0, 0, 0, 0, 0, 0); in le_set_adv_param()
1598 status = ll_adv_params_set(min_interval, cmd->type, in le_set_adv_param()
1599 cmd->own_addr_type, cmd->direct_addr.type, in le_set_adv_param()
1600 &cmd->direct_addr.a.val[0], cmd->channel_map, in le_set_adv_param()
1601 cmd->filter_policy); in le_set_adv_param()
1617 rp->status = 0x00; in le_read_adv_chan_tx_power()
1619 rp->tx_power_level = 0; in le_read_adv_chan_tx_power()
1624 struct bt_hci_cp_le_set_adv_data *cmd = (void *)buf->data; in le_set_adv_data()
1632 status = ll_adv_data_set(0, cmd->len, &cmd->data[0]); in le_set_adv_data()
1634 status = ll_adv_data_set(cmd->len, &cmd->data[0]); in le_set_adv_data()
1642 struct bt_hci_cp_le_set_scan_rsp_data *cmd = (void *)buf->data; in le_set_scan_rsp_data()
1650 status = ll_adv_scan_rsp_set(0, cmd->len, &cmd->data[0]); in le_set_scan_rsp_data()
1652 status = ll_adv_scan_rsp_set(cmd->len, &cmd->data[0]); in le_set_scan_rsp_data()
1660 struct bt_hci_cp_le_set_adv_enable *cmd = (void *)buf->data; in le_set_adv_enable()
1669 status = ll_adv_enable(0, cmd->enable, 0, 0, 0, 0, 0); in le_set_adv_enable()
1671 status = ll_adv_enable(0, cmd->enable, 0, 0); in le_set_adv_enable()
1674 status = ll_adv_enable(cmd->enable); in le_set_adv_enable()
1683 struct bt_hci_cp_le_create_big *cmd = (void *)buf->data; in le_create_big()
1691 status = ll_adv_iso_by_hci_handle_new(cmd->big_handle, &big_handle); in le_create_big()
1697 status = ll_adv_set_by_hci_handle_get(cmd->adv_handle, &adv_handle); in le_create_big()
1703 sdu_interval = sys_get_le24(cmd->sdu_interval); in le_create_big()
1704 max_sdu = sys_le16_to_cpu(cmd->max_sdu); in le_create_big()
1705 max_latency = sys_le16_to_cpu(cmd->max_latency); in le_create_big()
1707 status = ll_big_create(big_handle, adv_handle, cmd->num_bis, in le_create_big()
1708 sdu_interval, max_sdu, max_latency, cmd->rtn, in le_create_big()
1709 cmd->phy, cmd->packing, cmd->framing, in le_create_big()
1710 cmd->encryption, cmd->bcode); in le_create_big()
1717 struct bt_hci_cp_le_create_big_test *cmd = (void *)buf->data; in le_create_big_test()
1724 sdu_interval = sys_get_le24(cmd->sdu_interval); in le_create_big_test()
1725 iso_interval = sys_le16_to_cpu(cmd->iso_interval); in le_create_big_test()
1726 max_sdu = sys_le16_to_cpu(cmd->max_sdu); in le_create_big_test()
1727 max_pdu = sys_le16_to_cpu(cmd->max_pdu); in le_create_big_test()
1729 status = ll_big_test_create(cmd->big_handle, cmd->adv_handle, in le_create_big_test()
1730 cmd->num_bis, sdu_interval, iso_interval, in le_create_big_test()
1731 cmd->nse, max_sdu, max_pdu, cmd->phy, in le_create_big_test()
1732 cmd->packing, cmd->framing, cmd->bn, in le_create_big_test()
1733 cmd->irc, cmd->pto, cmd->encryption, in le_create_big_test()
1734 cmd->bcode); in le_create_big_test()
1741 struct bt_hci_cp_le_terminate_big *cmd = (void *)buf->data; in le_terminate_big()
1744 status = ll_big_terminate(cmd->big_handle, cmd->reason); in le_terminate_big()
1754 struct bt_hci_cp_le_set_scan_param *cmd = (void *)buf->data; in le_set_scan_param()
1755 uint16_t interval; in le_set_scan_param() local
1763 interval = sys_le16_to_cpu(cmd->interval); in le_set_scan_param()
1764 window = sys_le16_to_cpu(cmd->window); in le_set_scan_param()
1766 status = ll_scan_params_set(cmd->scan_type, interval, window, in le_set_scan_param()
1767 cmd->addr_type, cmd->filter_policy); in le_set_scan_param()
1774 struct bt_hci_cp_le_set_scan_enable *cmd = (void *)buf->data; in le_set_scan_enable()
1783 if (cmd->enable && cmd->filter_dup) { in le_set_scan_enable()
1813 status = ll_scan_enable(cmd->enable, 0, 0); in le_set_scan_enable()
1815 status = ll_scan_enable(cmd->enable); in le_set_scan_enable()
1834 struct bt_hci_cp_le_big_create_sync *cmd = (void *)buf->data; in le_big_create_sync()
1839 sync_handle = sys_le16_to_cpu(cmd->sync_handle); in le_big_create_sync()
1840 sync_timeout = sys_le16_to_cpu(cmd->sync_timeout); in le_big_create_sync()
1842 status = ll_big_sync_create(cmd->big_handle, sync_handle, in le_big_create_sync()
1843 cmd->encryption, cmd->bcode, cmd->mse, in le_big_create_sync()
1844 sync_timeout, cmd->num_bis, cmd->bis); in le_big_create_sync()
1853 struct bt_hci_cp_le_big_terminate_sync *cmd = (void *)buf->data; in le_big_terminate_sync()
1858 big_handle = cmd->big_handle; in le_big_terminate_sync()
1862 rp->status = status; in le_big_terminate_sync()
1863 rp->big_handle = big_handle; in le_big_terminate_sync()
1907 struct bt_hci_cp_le_create_conn *cmd = (void *)buf->data; in le_create_connection()
1920 scan_interval = sys_le16_to_cpu(cmd->scan_interval); in le_create_connection()
1921 scan_window = sys_le16_to_cpu(cmd->scan_window); in le_create_connection()
1922 conn_interval_max = sys_le16_to_cpu(cmd->conn_interval_max); in le_create_connection()
1923 conn_latency = sys_le16_to_cpu(cmd->conn_latency); in le_create_connection()
1924 supervision_timeout = sys_le16_to_cpu(cmd->supervision_timeout); in le_create_connection()
1940 cmd->filter_policy, in le_create_connection()
1941 cmd->peer_addr.type, in le_create_connection()
1942 &cmd->peer_addr.a.val[0], in le_create_connection()
1943 cmd->own_addr_type, conn_interval_max, in le_create_connection()
1955 cmd->filter_policy, in le_create_connection()
1956 cmd->peer_addr.type, in le_create_connection()
1957 &cmd->peer_addr.a.val[0], in le_create_connection()
1958 cmd->own_addr_type, conn_interval_max, in le_create_connection()
1977 struct bt_hci_cp_le_set_host_chan_classif *cmd = (void *)buf->data; in le_set_host_chan_classif()
1980 status = ll_chm_update(&cmd->ch_map[0]); in le_set_host_chan_classif()
1988 struct bt_hci_cp_le_start_encryption *cmd = (void *)buf->data; in le_start_encryption()
1992 handle = sys_le16_to_cpu(cmd->handle); in le_start_encryption()
1994 (uint8_t *)&cmd->rand, in le_start_encryption()
1995 (uint8_t *)&cmd->ediv, in le_start_encryption()
1996 &cmd->ltk[0]); in le_start_encryption()
2005 struct bt_hci_cp_le_set_cig_params *cmd = (void *)buf->data; in le_set_cig_parameters()
2016 c_interval = sys_get_le24(cmd->c_interval); in le_set_cig_parameters()
2017 p_interval = sys_get_le24(cmd->p_interval); in le_set_cig_parameters()
2018 c_latency = sys_le16_to_cpu(cmd->c_latency); in le_set_cig_parameters()
2019 p_latency = sys_le16_to_cpu(cmd->p_latency); in le_set_cig_parameters()
2021 cig_id = cmd->cig_id; in le_set_cig_parameters()
2022 cis_count = cmd->num_cis; in le_set_cig_parameters()
2026 cmd->sca, cmd->packing, cmd->framing, in le_set_cig_parameters()
2031 struct bt_hci_cis_params *params = &cmd->cis[i]; in le_set_cig_parameters()
2035 c_sdu = sys_le16_to_cpu(params->c_sdu); in le_set_cig_parameters()
2036 p_sdu = sys_le16_to_cpu(params->p_sdu); in le_set_cig_parameters()
2038 status = ll_cis_parameters_set(params->cis_id, c_sdu, p_sdu, in le_set_cig_parameters()
2039 params->c_phy, params->p_phy, in le_set_cig_parameters()
2040 params->c_rtn, params->p_rtn); in le_set_cig_parameters()
2044 rp->cig_id = cig_id; in le_set_cig_parameters()
2054 rp->handle[j] = sys_cpu_to_le16(handles[j]); in le_set_cig_parameters()
2059 rp->num_handles = status ? 0U : cis_count; in le_set_cig_parameters()
2060 rp->status = status; in le_set_cig_parameters()
2065 struct bt_hci_cp_le_set_cig_params_test *cmd = (void *)buf->data; in le_set_cig_params_test()
2076 c_interval = sys_get_le24(cmd->c_interval); in le_set_cig_params_test()
2077 p_interval = sys_get_le24(cmd->p_interval); in le_set_cig_params_test()
2078 iso_interval = sys_le16_to_cpu(cmd->iso_interval); in le_set_cig_params_test()
2080 cig_id = cmd->cig_id; in le_set_cig_params_test()
2081 cis_count = cmd->num_cis; in le_set_cig_params_test()
2085 p_interval, cmd->c_ft, in le_set_cig_params_test()
2086 cmd->p_ft, iso_interval, in le_set_cig_params_test()
2087 cmd->sca, cmd->packing, in le_set_cig_params_test()
2088 cmd->framing, in le_set_cig_params_test()
2093 struct bt_hci_cis_params_test *params = &cmd->cis[i]; in le_set_cig_params_test()
2100 nse = params->nse; in le_set_cig_params_test()
2101 c_sdu = sys_le16_to_cpu(params->c_sdu); in le_set_cig_params_test()
2102 p_sdu = sys_le16_to_cpu(params->p_sdu); in le_set_cig_params_test()
2103 c_pdu = sys_le16_to_cpu(params->c_pdu); in le_set_cig_params_test()
2104 p_pdu = sys_le16_to_cpu(params->p_pdu); in le_set_cig_params_test()
2106 status = ll_cis_parameters_test_set(params->cis_id, nse, in le_set_cig_params_test()
2109 params->c_phy, in le_set_cig_params_test()
2110 params->p_phy, in le_set_cig_params_test()
2111 params->c_bn, in le_set_cig_params_test()
2112 params->p_bn); in le_set_cig_params_test()
2116 rp->cig_id = cig_id; in le_set_cig_params_test()
2126 rp->handle[j] = sys_cpu_to_le16(handles[j]); in le_set_cig_params_test()
2131 rp->num_handles = status ? 0U : cis_count; in le_set_cig_params_test()
2132 rp->status = status; in le_set_cig_params_test()
2138 struct bt_hci_cp_le_create_cis *cmd = (void *)buf->data; in le_create_cis()
2162 for (i = 0; !status && i < cmd->num_cis; i++) { in le_create_cis()
2167 cis_handle = sys_le16_to_cpu(cmd->cis[i].cis_handle); in le_create_cis()
2168 acl_handle = sys_le16_to_cpu(cmd->cis[i].acl_handle); in le_create_cis()
2190 cis_pending_count = cmd->num_cis; in le_create_cis()
2191 for (i = 0; i < cmd->num_cis; i++) { in le_create_cis()
2195 cis_handle = sys_le16_to_cpu(cmd->cis[i].cis_handle); in le_create_cis()
2196 acl_handle = sys_le16_to_cpu(cmd->cis[i].acl_handle); in le_create_cis()
2205 struct bt_hci_cp_le_remove_cig *cmd = (void *)buf->data; in le_remove_cig()
2209 status = ll_cig_remove(cmd->cig_id); in le_remove_cig()
2212 rp->status = status; in le_remove_cig()
2213 rp->cig_id = cmd->cig_id; in le_remove_cig()
2222 struct bt_hci_cp_le_iso_transmit_test *cmd = (void *)buf->data; in le_iso_transmit_test()
2227 handle = sys_le16_to_cpu(cmd->handle); in le_iso_transmit_test()
2229 status = ll_iso_transmit_test(handle, cmd->payload_type); in le_iso_transmit_test()
2232 rp->status = status; in le_iso_transmit_test()
2233 rp->handle = sys_cpu_to_le16(handle); in le_iso_transmit_test()
2238 struct bt_hci_cp_le_read_iso_tx_sync *cmd = (void *)buf->data; in le_read_iso_tx_sync()
2247 handle_le16 = cmd->handle; in le_read_iso_tx_sync()
2253 rp->status = status; in le_read_iso_tx_sync()
2254 rp->handle = handle_le16; in le_read_iso_tx_sync()
2255 rp->seq = sys_cpu_to_le16(seq); in le_read_iso_tx_sync()
2256 rp->timestamp = sys_cpu_to_le32(timestamp); in le_read_iso_tx_sync()
2257 sys_put_le24(offset, rp->offset); in le_read_iso_tx_sync()
2264 struct bt_hci_cp_le_iso_receive_test *cmd = (void *)buf->data; in le_iso_receive_test()
2269 handle = sys_le16_to_cpu(cmd->handle); in le_iso_receive_test()
2271 status = ll_iso_receive_test(handle, cmd->payload_type); in le_iso_receive_test()
2274 rp->status = status; in le_iso_receive_test()
2275 rp->handle = sys_cpu_to_le16(handle); in le_iso_receive_test()
2280 struct bt_hci_cp_le_read_test_counters *cmd = (void *)buf->data; in le_iso_read_test_counters()
2288 handle = sys_le16_to_cpu(cmd->handle); in le_iso_read_test_counters()
2293 rp->status = status; in le_iso_read_test_counters()
2294 rp->handle = sys_cpu_to_le16(handle); in le_iso_read_test_counters()
2295 rp->received_cnt = sys_cpu_to_le32(received_cnt); in le_iso_read_test_counters()
2296 rp->missed_cnt = sys_cpu_to_le32(missed_cnt); in le_iso_read_test_counters()
2297 rp->failed_cnt = sys_cpu_to_le32(failed_cnt); in le_iso_read_test_counters()
2303 struct bt_hci_cp_le_read_iso_link_quality *cmd = (void *)buf->data; in le_read_iso_link_quality()
2316 handle_le16 = cmd->handle; in le_read_iso_link_quality()
2327 rp->status = status; in le_read_iso_link_quality()
2328 rp->handle = handle_le16; in le_read_iso_link_quality()
2329 rp->tx_unacked_packets = sys_cpu_to_le32(tx_unacked_packets); in le_read_iso_link_quality()
2330 rp->tx_flushed_packets = sys_cpu_to_le32(tx_flushed_packets); in le_read_iso_link_quality()
2331 rp->tx_last_subevent_packets = in le_read_iso_link_quality()
2333 rp->retransmitted_packets = sys_cpu_to_le32(retransmitted_packets); in le_read_iso_link_quality()
2334 rp->crc_error_packets = sys_cpu_to_le32(crc_error_packets); in le_read_iso_link_quality()
2335 rp->rx_unreceived_packets = sys_cpu_to_le32(rx_unreceived_packets); in le_read_iso_link_quality()
2336 rp->duplicate_packets = sys_cpu_to_le32(duplicate_packets); in le_read_iso_link_quality()
2345 struct bt_hci_cp_le_setup_iso_path *cmd = (void *)buf->data; in le_setup_iso_path()
2355 handle = sys_le16_to_cpu(cmd->handle); in le_setup_iso_path()
2356 coding_format = cmd->codec_id.coding_format; in le_setup_iso_path()
2357 company_id = sys_le16_to_cpu(cmd->codec_id.company_id); in le_setup_iso_path()
2358 vs_codec_id = sys_le16_to_cpu(cmd->codec_id.vs_codec_id); in le_setup_iso_path()
2359 controller_delay = sys_get_le24(cmd->controller_delay); in le_setup_iso_path()
2360 codec_config = &cmd->codec_config[0]; in le_setup_iso_path()
2362 status = ll_setup_iso_path(handle, cmd->path_dir, cmd->path_id, in le_setup_iso_path()
2364 controller_delay, cmd->codec_config_len, in le_setup_iso_path()
2368 rp->status = status; in le_setup_iso_path()
2369 rp->handle = sys_cpu_to_le16(handle); in le_setup_iso_path()
2374 struct bt_hci_cp_le_remove_iso_path *cmd = (void *)buf->data; in le_remove_iso_path()
2379 handle = sys_le16_to_cpu(cmd->handle); in le_remove_iso_path()
2381 status = ll_remove_iso_path(handle, cmd->path_dir); in le_remove_iso_path()
2384 rp->status = status; in le_remove_iso_path()
2385 rp->handle = sys_cpu_to_le16(handle); in le_remove_iso_path()
2390 struct bt_hci_cp_le_iso_test_end *cmd = (void *)buf->data; in le_iso_test_end()
2398 handle = sys_le16_to_cpu(cmd->handle); in le_iso_test_end()
2403 rp->status = status; in le_iso_test_end()
2404 rp->handle = sys_cpu_to_le16(handle); in le_iso_test_end()
2405 rp->received_cnt = sys_cpu_to_le32(received_cnt); in le_iso_test_end()
2406 rp->missed_cnt = sys_cpu_to_le32(missed_cnt); in le_iso_test_end()
2407 rp->failed_cnt = sys_cpu_to_le32(failed_cnt); in le_iso_test_end()
2414 struct bt_hci_cp_le_set_host_feature *cmd = (void *)buf->data; in le_set_host_feature()
2418 status = ll_set_host_feature(cmd->bit_number, cmd->bit_value); in le_set_host_feature()
2421 rp->status = status; in le_set_host_feature()
2429 struct bt_hci_cp_le_ltk_req_reply *cmd = (void *)buf->data; in le_ltk_req_reply()
2434 handle = sys_le16_to_cpu(cmd->handle); in le_ltk_req_reply()
2435 status = ll_start_enc_req_send(handle, 0x00, &cmd->ltk[0]); in le_ltk_req_reply()
2438 rp->status = status; in le_ltk_req_reply()
2439 rp->handle = sys_cpu_to_le16(handle); in le_ltk_req_reply()
2444 struct bt_hci_cp_le_ltk_req_neg_reply *cmd = (void *)buf->data; in le_ltk_req_neg_reply()
2449 handle = sys_le16_to_cpu(cmd->handle); in le_ltk_req_neg_reply()
2454 rp->status = status; in le_ltk_req_neg_reply()
2455 rp->handle = sys_le16_to_cpu(handle); in le_ltk_req_neg_reply()
2462 struct bt_hci_cp_le_accept_cis *cmd = (void *)buf->data; in le_accept_cis()
2466 handle = sys_le16_to_cpu(cmd->handle); in le_accept_cis()
2473 struct bt_hci_cp_le_reject_cis *cmd = (void *)buf->data; in le_reject_cis()
2478 handle = sys_le16_to_cpu(cmd->handle); in le_reject_cis()
2479 status = ll_cis_reject(handle, cmd->reason); in le_reject_cis()
2482 rp->status = status; in le_reject_cis()
2483 rp->handle = sys_cpu_to_le16(handle); in le_reject_cis()
2493 struct bt_hci_cp_le_req_peer_sca *cmd = (void *)buf->data; in le_req_peer_sca()
2497 handle = sys_le16_to_cpu(cmd->handle); in le_req_peer_sca()
2507 struct bt_hci_cp_le_read_remote_features *cmd = (void *)buf->data; in le_read_remote_features()
2511 handle = sys_le16_to_cpu(cmd->handle); in le_read_remote_features()
2520 struct bt_hci_cp_le_read_chan_map *cmd = (void *)buf->data; in le_read_chan_map()
2525 handle = sys_le16_to_cpu(cmd->handle); in le_read_chan_map()
2529 status = ll_chm_get(handle, rp->ch_map); in le_read_chan_map()
2531 rp->status = status; in le_read_chan_map()
2532 rp->handle = sys_le16_to_cpu(handle); in le_read_chan_map()
2537 struct hci_cp_le_conn_update *cmd = (void *)buf->data; in le_conn_update()
2545 handle = sys_le16_to_cpu(cmd->handle); in le_conn_update()
2546 conn_interval_min = sys_le16_to_cpu(cmd->conn_interval_min); in le_conn_update()
2547 conn_interval_max = sys_le16_to_cpu(cmd->conn_interval_max); in le_conn_update()
2548 conn_latency = sys_le16_to_cpu(cmd->conn_latency); in le_conn_update()
2549 supervision_timeout = sys_le16_to_cpu(cmd->supervision_timeout); in le_conn_update()
2561 struct bt_hci_cp_le_conn_param_req_reply *cmd = (void *)buf->data; in le_conn_param_req_reply()
2570 handle = sys_le16_to_cpu(cmd->handle); in le_conn_param_req_reply()
2571 interval_min = sys_le16_to_cpu(cmd->interval_min); in le_conn_param_req_reply()
2572 interval_max = sys_le16_to_cpu(cmd->interval_max); in le_conn_param_req_reply()
2573 latency = sys_le16_to_cpu(cmd->latency); in le_conn_param_req_reply()
2574 timeout = sys_le16_to_cpu(cmd->timeout); in le_conn_param_req_reply()
2580 rp->status = status; in le_conn_param_req_reply()
2581 rp->handle = sys_cpu_to_le16(handle); in le_conn_param_req_reply()
2587 struct bt_hci_cp_le_conn_param_req_neg_reply *cmd = (void *)buf->data; in le_conn_param_req_neg_reply()
2592 handle = sys_le16_to_cpu(cmd->handle); in le_conn_param_req_neg_reply()
2593 status = ll_conn_update(handle, 2, cmd->reason, 0, 0, 0, 0, NULL); in le_conn_param_req_neg_reply()
2596 rp->status = status; in le_conn_param_req_neg_reply()
2597 rp->handle = sys_cpu_to_le16(handle); in le_conn_param_req_neg_reply()
2604 struct bt_hci_cp_le_set_data_len *cmd = (void *)buf->data; in le_set_data_len()
2611 handle = sys_le16_to_cpu(cmd->handle); in le_set_data_len()
2612 tx_octets = sys_le16_to_cpu(cmd->tx_octets); in le_set_data_len()
2613 tx_time = sys_le16_to_cpu(cmd->tx_time); in le_set_data_len()
2617 rp->status = status; in le_set_data_len()
2618 rp->handle = sys_cpu_to_le16(handle); in le_set_data_len()
2631 rp->max_tx_octets = sys_cpu_to_le16(max_tx_octets); in le_read_default_data_len()
2632 rp->max_tx_time = sys_cpu_to_le16(max_tx_time); in le_read_default_data_len()
2633 rp->status = 0x00; in le_read_default_data_len()
2639 struct bt_hci_cp_le_write_default_data_len *cmd = (void *)buf->data; in le_write_default_data_len()
2644 max_tx_octets = sys_le16_to_cpu(cmd->max_tx_octets); in le_write_default_data_len()
2645 max_tx_time = sys_le16_to_cpu(cmd->max_tx_time); in le_write_default_data_len()
2664 rp->max_tx_octets = sys_cpu_to_le16(max_tx_octets); in le_read_max_data_len()
2665 rp->max_tx_time = sys_cpu_to_le16(max_tx_time); in le_read_max_data_len()
2666 rp->max_rx_octets = sys_cpu_to_le16(max_rx_octets); in le_read_max_data_len()
2667 rp->max_rx_time = sys_cpu_to_le16(max_rx_time); in le_read_max_data_len()
2668 rp->status = 0x00; in le_read_max_data_len()
2675 struct bt_hci_cp_le_read_phy *cmd = (void *)buf->data; in le_read_phy()
2680 handle = sys_le16_to_cpu(cmd->handle); in le_read_phy()
2684 status = ll_phy_get(handle, &rp->tx_phy, &rp->rx_phy); in le_read_phy()
2686 rp->status = status; in le_read_phy()
2687 rp->handle = sys_cpu_to_le16(handle); in le_read_phy()
2688 rp->tx_phy = find_lsb_set(rp->tx_phy); in le_read_phy()
2689 rp->rx_phy = find_lsb_set(rp->rx_phy); in le_read_phy()
2694 struct bt_hci_cp_le_set_default_phy *cmd = (void *)buf->data; in le_set_default_phy()
2697 if (cmd->all_phys & BT_HCI_LE_PHY_TX_ANY) { in le_set_default_phy()
2698 cmd->tx_phys = 0x07; in le_set_default_phy()
2700 if (cmd->all_phys & BT_HCI_LE_PHY_RX_ANY) { in le_set_default_phy()
2701 cmd->rx_phys = 0x07; in le_set_default_phy()
2704 status = ll_phy_default_set(cmd->tx_phys, cmd->rx_phys); in le_set_default_phy()
2711 struct bt_hci_cp_le_set_phy *cmd = (void *)buf->data; in le_set_phy()
2717 handle = sys_le16_to_cpu(cmd->handle); in le_set_phy()
2718 phy_opts = sys_le16_to_cpu(cmd->phy_opts); in le_set_phy()
2728 if (cmd->all_phys & BT_HCI_LE_PHY_TX_ANY) { in le_set_phy()
2729 cmd->tx_phys |= mask_phys; in le_set_phy()
2731 if (cmd->all_phys & BT_HCI_LE_PHY_RX_ANY) { in le_set_phy()
2732 cmd->rx_phys |= mask_phys; in le_set_phy()
2735 if ((cmd->tx_phys | cmd->rx_phys) & ~mask_phys) { in le_set_phy()
2741 if (!(cmd->tx_phys & 0x07) || in le_set_phy()
2742 !(cmd->rx_phys & 0x07)) { in le_set_phy()
2749 phy_opts -= 1U; in le_set_phy()
2755 status = ll_phy_req_send(handle, cmd->tx_phys, phy_opts, in le_set_phy()
2756 cmd->rx_phys); in le_set_phy()
2766 struct bt_hci_cp_le_add_dev_to_rl *cmd = (void *)buf->data; in le_add_dev_to_rl()
2769 status = ll_rl_add(&cmd->peer_id_addr, cmd->peer_irk, cmd->local_irk); in le_add_dev_to_rl()
2776 struct bt_hci_cp_le_rem_dev_from_rl *cmd = (void *)buf->data; in le_rem_dev_from_rl()
2779 status = ll_rl_remove(&cmd->peer_id_addr); in le_rem_dev_from_rl()
2799 rp->rl_size = ll_rl_size_get(); in le_read_rl_size()
2800 rp->status = 0x00; in le_read_rl_size()
2805 struct bt_hci_cp_le_read_peer_rpa *cmd = (void *)buf->data; in le_read_peer_rpa()
2809 bt_addr_le_copy(&peer_id_addr, &cmd->peer_id_addr); in le_read_peer_rpa()
2812 rp->status = ll_rl_crpa_get(&peer_id_addr, &rp->peer_rpa); in le_read_peer_rpa()
2817 struct bt_hci_cp_le_read_local_rpa *cmd = (void *)buf->data; in le_read_local_rpa()
2821 bt_addr_le_copy(&peer_id_addr, &cmd->peer_id_addr); in le_read_local_rpa()
2824 rp->status = ll_rl_lrpa_get(&peer_id_addr, &rp->local_rpa); in le_read_local_rpa()
2829 struct bt_hci_cp_le_set_addr_res_enable *cmd = (void *)buf->data; in le_set_addr_res_enable()
2832 status = ll_rl_enable(cmd->enable); in le_set_addr_res_enable()
2839 struct bt_hci_cp_le_set_rpa_timeout *cmd = (void *)buf->data; in le_set_rpa_timeout()
2840 uint16_t timeout = sys_le16_to_cpu(cmd->rpa_timeout); in le_set_rpa_timeout()
2849 struct bt_hci_cp_le_set_privacy_mode *cmd = (void *)buf->data; in le_set_privacy_mode()
2852 status = ll_priv_mode_set(&cmd->id_addr, cmd->mode); in le_set_privacy_mode()
2863 rp->status = 0x00; in le_read_tx_power()
2864 ll_tx_pwr_get(&rp->min_tx_power, &rp->max_tx_power); in le_read_tx_power()
2872 struct bt_hci_cp_le_set_cl_cte_tx_params *cmd = (void *)buf->data; in le_df_set_cl_cte_tx_params()
2880 status = ll_adv_set_by_hci_handle_get(cmd->handle, &adv_handle); in le_df_set_cl_cte_tx_params()
2886 status = ll_df_set_cl_cte_tx_params(adv_handle, cmd->cte_len, in le_df_set_cl_cte_tx_params()
2887 cmd->cte_type, cmd->cte_count, in le_df_set_cl_cte_tx_params()
2888 cmd->switch_pattern_len, in le_df_set_cl_cte_tx_params()
2889 cmd->ant_ids); in le_df_set_cl_cte_tx_params()
2896 struct bt_hci_cp_le_set_cl_cte_tx_enable *cmd = (void *)buf->data; in le_df_set_cl_cte_enable()
2904 status = ll_adv_set_by_hci_handle_get(cmd->handle, &handle); in le_df_set_cl_cte_enable()
2910 status = ll_df_set_cl_cte_tx_enable(handle, cmd->cte_enable); in le_df_set_cl_cte_enable()
2919 struct bt_hci_cp_le_set_cl_cte_sampling_enable *cmd = (void *)buf->data; in le_df_set_cl_iq_sampling_enable()
2924 sync_handle = sys_le16_to_cpu(cmd->sync_handle); in le_df_set_cl_iq_sampling_enable()
2927 cmd->sampling_enable, in le_df_set_cl_iq_sampling_enable()
2928 cmd->slot_durations, in le_df_set_cl_iq_sampling_enable()
2929 cmd->max_sampled_cte, in le_df_set_cl_iq_sampling_enable()
2930 cmd->switch_pattern_len, in le_df_set_cl_iq_sampling_enable()
2931 cmd->ant_ids); in le_df_set_cl_iq_sampling_enable()
2935 rp->status = status; in le_df_set_cl_iq_sampling_enable()
2936 rp->sync_handle = sys_cpu_to_le16(sync_handle); in le_df_set_cl_iq_sampling_enable()
2985 lll = iq_report->rx.rx_ftr.param; in le_df_connectionless_iq_report()
3009 if (ull_df_sync_cfg_is_not_enabled(&lll->df_cfg) || in le_df_connectionless_iq_report()
3010 !sync->timeout_reload) { in le_df_connectionless_iq_report()
3019 per_evt_counter = iq_report->event_counter; in le_df_connectionless_iq_report()
3027 if (iq_report->packet_status == BT_HCI_LE_CTE_INSUFFICIENT_RESOURCES) { in le_df_connectionless_iq_report()
3030 samples_cnt = MAX(1, iq_report->sample_count); in le_df_connectionless_iq_report()
3037 rssi = RSSI_DBM_TO_DECI_DBM(iq_report->rx.rx_ftr.rssi); in le_df_connectionless_iq_report()
3040 sep->sync_handle = sys_cpu_to_le16(sync_handle); in le_df_connectionless_iq_report()
3041 sep->rssi = sys_cpu_to_le16(rssi); in le_df_connectionless_iq_report()
3042 sep->rssi_ant_id = iq_report->rssi_ant_id; in le_df_connectionless_iq_report()
3043 sep->cte_type = iq_report->cte_info.type; in le_df_connectionless_iq_report()
3045 sep->chan_idx = iq_report->chan_idx; in le_df_connectionless_iq_report()
3046 sep->per_evt_counter = sys_cpu_to_le16(per_evt_counter); in le_df_connectionless_iq_report()
3048 if (sep->cte_type == BT_HCI_LE_AOA_CTE) { in le_df_connectionless_iq_report()
3049 sep->slot_durations = iq_report->local_slot_durations; in le_df_connectionless_iq_report()
3050 } else if (sep->cte_type == BT_HCI_LE_AOD_CTE_1US) { in le_df_connectionless_iq_report()
3051 sep->slot_durations = BT_HCI_LE_ANTENNA_SWITCHING_SLOT_1US; in le_df_connectionless_iq_report()
3053 sep->slot_durations = BT_HCI_LE_ANTENNA_SWITCHING_SLOT_2US; in le_df_connectionless_iq_report()
3056 sep->packet_status = iq_report->packet_status; in le_df_connectionless_iq_report()
3058 if (iq_report->packet_status != BT_HCI_LE_CTE_INSUFFICIENT_RESOURCES) { in le_df_connectionless_iq_report()
3059 if (iq_report->sample_count == 0U) { in le_df_connectionless_iq_report()
3060 sep->sample[0].i = BT_HCI_LE_CTE_REPORT_NO_VALID_SAMPLE; in le_df_connectionless_iq_report()
3061 sep->sample[0].q = BT_HCI_LE_CTE_REPORT_NO_VALID_SAMPLE; in le_df_connectionless_iq_report()
3064 sep->sample[idx].i = in le_df_connectionless_iq_report()
3065 iq_convert_12_to_8_bits(iq_report->sample[idx].i); in le_df_connectionless_iq_report()
3066 sep->sample[idx].q = in le_df_connectionless_iq_report()
3067 iq_convert_12_to_8_bits(iq_report->sample[idx].q); in le_df_connectionless_iq_report()
3072 sep->sample_count = samples_cnt; in le_df_connectionless_iq_report()
3080 struct bt_hci_cp_le_set_conn_cte_tx_params *cmd = (void *)buf->data; in le_df_set_conn_cte_tx_params()
3085 handle_le16 = cmd->handle; in le_df_set_conn_cte_tx_params()
3088 status = ll_df_set_conn_cte_tx_params(handle, cmd->cte_types, in le_df_set_conn_cte_tx_params()
3089 cmd->switch_pattern_len, in le_df_set_conn_cte_tx_params()
3090 cmd->ant_ids); in le_df_set_conn_cte_tx_params()
3094 rp->status = status; in le_df_set_conn_cte_tx_params()
3095 rp->handle = handle_le16; in le_df_set_conn_cte_tx_params()
3102 struct bt_hci_cp_le_set_conn_cte_rx_params *cmd = (void *)buf->data; in le_df_set_conn_cte_rx_params()
3107 handle_le16 = cmd->handle; in le_df_set_conn_cte_rx_params()
3110 status = ll_df_set_conn_cte_rx_params(handle, cmd->sampling_enable, cmd->slot_durations, in le_df_set_conn_cte_rx_params()
3111 cmd->switch_pattern_len, cmd->ant_ids); in le_df_set_conn_cte_rx_params()
3115 rp->status = status; in le_df_set_conn_cte_rx_params()
3116 rp->handle = handle_le16; in le_df_set_conn_cte_rx_params()
3135 lll = iq_report->rx.rx_ftr.param; in le_df_connection_iq_report()
3138 phy_rx = lll->phy_rx; in le_df_connection_iq_report()
3150 if (ull_df_conn_cfg_is_not_enabled(&lll->df_rx_cfg)) { in le_df_connection_iq_report()
3159 if (iq_report->packet_status == BT_HCI_LE_CTE_INSUFFICIENT_RESOURCES) { in le_df_connection_iq_report()
3162 samples_cnt = MAX(1, iq_report->sample_count); in le_df_connection_iq_report()
3168 rssi = RSSI_DBM_TO_DECI_DBM(iq_report->rx.rx_ftr.rssi); in le_df_connection_iq_report()
3170 sep->conn_handle = sys_cpu_to_le16(iq_report->rx.hdr.handle); in le_df_connection_iq_report()
3171 sep->rx_phy = phy_rx; in le_df_connection_iq_report()
3172 sep->rssi = sys_cpu_to_le16(rssi); in le_df_connection_iq_report()
3173 sep->rssi_ant_id = iq_report->rssi_ant_id; in le_df_connection_iq_report()
3174 sep->cte_type = iq_report->cte_info.type; in le_df_connection_iq_report()
3176 sep->data_chan_idx = iq_report->chan_idx; in le_df_connection_iq_report()
3177 sep->conn_evt_counter = sys_cpu_to_le16(iq_report->event_counter); in le_df_connection_iq_report()
3179 if (sep->cte_type == BT_HCI_LE_AOA_CTE) { in le_df_connection_iq_report()
3180 sep->slot_durations = iq_report->local_slot_durations; in le_df_connection_iq_report()
3181 } else if (sep->cte_type == BT_HCI_LE_AOD_CTE_1US) { in le_df_connection_iq_report()
3182 sep->slot_durations = BT_HCI_LE_ANTENNA_SWITCHING_SLOT_1US; in le_df_connection_iq_report()
3184 sep->slot_durations = BT_HCI_LE_ANTENNA_SWITCHING_SLOT_2US; in le_df_connection_iq_report()
3187 sep->packet_status = iq_report->packet_status; in le_df_connection_iq_report()
3189 if (iq_report->packet_status != BT_HCI_LE_CTE_INSUFFICIENT_RESOURCES) { in le_df_connection_iq_report()
3190 if (iq_report->sample_count == 0U) { in le_df_connection_iq_report()
3191 sep->sample[0].i = BT_HCI_LE_CTE_REPORT_NO_VALID_SAMPLE; in le_df_connection_iq_report()
3192 sep->sample[0].q = BT_HCI_LE_CTE_REPORT_NO_VALID_SAMPLE; in le_df_connection_iq_report()
3195 sep->sample[idx].i = in le_df_connection_iq_report()
3196 iq_convert_12_to_8_bits(iq_report->sample[idx].i); in le_df_connection_iq_report()
3197 sep->sample[idx].q = in le_df_connection_iq_report()
3198 iq_convert_12_to_8_bits(iq_report->sample[idx].q); in le_df_connection_iq_report()
3203 sep->sample_count = samples_cnt; in le_df_connection_iq_report()
3210 struct bt_hci_cp_le_conn_cte_req_enable *cmd = (void *)buf->data; in le_df_set_conn_cte_req_enable()
3215 handle_le16 = cmd->handle; in le_df_set_conn_cte_req_enable()
3218 status = ll_df_set_conn_cte_req_enable(handle, cmd->enable, in le_df_set_conn_cte_req_enable()
3219 sys_le16_to_cpu(cmd->cte_request_interval), in le_df_set_conn_cte_req_enable()
3220 cmd->requested_cte_length, cmd->requested_cte_type); in le_df_set_conn_cte_req_enable()
3223 rp->status = status; in le_df_set_conn_cte_req_enable()
3224 rp->handle = handle_le16; in le_df_set_conn_cte_req_enable()
3238 sep->status = error_code; in le_df_cte_req_failed()
3239 sep->conn_handle = sys_cpu_to_le16(handle); in le_df_cte_req_failed()
3246 struct bt_hci_cp_le_conn_cte_rsp_enable *cmd = (void *)buf->data; in le_df_set_conn_cte_rsp_enable()
3251 handle_le16 = cmd->handle; in le_df_set_conn_cte_rsp_enable()
3254 status = ll_df_set_conn_cte_rsp_enable(handle, cmd->enable); in le_df_set_conn_cte_rsp_enable()
3257 rp->status = status; in le_df_set_conn_cte_rsp_enable()
3258 rp->handle = handle_le16; in le_df_set_conn_cte_rsp_enable()
3275 rp->max_switch_pattern_len = max_switch_pattern_len; in le_df_read_ant_inf()
3276 rp->switch_sample_rates = switch_sample_rates; in le_df_read_ant_inf()
3277 rp->max_cte_len = max_cte_len; in le_df_read_ant_inf()
3278 rp->num_ant = num_ant; in le_df_read_ant_inf()
3279 rp->status = 0x00; in le_df_read_ant_inf()
3286 struct bt_hci_cp_le_rx_test *cmd = (void *)buf->data; in le_rx_test()
3289 status = ll_test_rx(cmd->rx_ch, BT_HCI_LE_RX_PHY_1M, BT_HCI_LE_MOD_INDEX_STANDARD, in le_rx_test()
3299 struct bt_hci_cp_le_tx_test *cmd = (void *)buf->data; in le_tx_test()
3302 status = ll_test_tx(cmd->tx_ch, cmd->test_data_len, cmd->pkt_payload, in le_tx_test()
3319 rp->status = status; in le_test_end()
3320 rp->rx_pkt_count = sys_cpu_to_le16(rx_pkt_count); in le_test_end()
3325 struct bt_hci_cp_le_enh_rx_test *cmd = (void *)buf->data; in le_enh_rx_test()
3328 status = ll_test_rx(cmd->rx_ch, cmd->phy, cmd->mod_index, BT_HCI_LE_TEST_CTE_DISABLED, in le_enh_rx_test()
3338 struct bt_hci_cp_le_rx_test_v3 *cmd = (void *)buf->data; in le_rx_test_v3()
3341 status = ll_test_rx(cmd->rx_ch, cmd->phy, cmd->mod_index, cmd->expected_cte_len, in le_rx_test_v3()
3342 cmd->expected_cte_type, cmd->slot_durations, cmd->switch_pattern_len, in le_rx_test_v3()
3343 cmd->ant_ids); in le_rx_test_v3()
3351 struct bt_hci_cp_le_enh_tx_test *cmd = (void *)buf->data; in le_enh_tx_test()
3354 status = ll_test_tx(cmd->tx_ch, cmd->test_data_len, cmd->pkt_payload, cmd->phy, in le_enh_tx_test()
3365 struct bt_hci_cp_le_tx_test_v3 *cmd = (void *)buf->data; in le_tx_test_v3()
3368 status = ll_test_tx(cmd->tx_ch, cmd->test_data_len, cmd->pkt_payload, cmd->phy, in le_tx_test_v3()
3369 cmd->cte_len, cmd->cte_type, cmd->switch_pattern_len, cmd->ant_ids, in le_tx_test_v3()
3379 struct bt_hci_cp_le_tx_test_v4 *cmd = (void *)buf->data; in le_tx_test_v4()
3380 struct bt_hci_cp_le_tx_test_v4_tx_power *tx_power = (void *)(buf->data + in le_tx_test_v4()
3381 sizeof(struct bt_hci_cp_le_tx_test_v4) + cmd->switch_pattern_len); in le_tx_test_v4()
3384 status = ll_test_tx(cmd->tx_ch, cmd->test_data_len, cmd->pkt_payload, cmd->phy, in le_tx_test_v4()
3385 cmd->cte_len, cmd->cte_type, cmd->switch_pattern_len, cmd->ant_ids, in le_tx_test_v4()
3386 tx_power->tx_power); in le_tx_test_v4()
3399 struct bt_hci_cp_le_set_adv_set_random_addr *cmd = (void *)buf->data; in le_set_adv_set_random_addr()
3407 status = ll_adv_set_by_hci_handle_get(cmd->handle, &handle); in le_set_adv_set_random_addr()
3413 status = ll_adv_aux_random_addr_set(handle, &cmd->bdaddr.val[0]); in le_set_adv_set_random_addr()
3420 struct bt_hci_cp_le_set_ext_adv_param *cmd = (void *)buf->data; in le_set_ext_adv_param()
3434 if (cmd->handle > BT_HCI_LE_ADV_HANDLE_MAX) { in le_set_ext_adv_param()
3439 evt_prop = sys_le16_to_cpu(cmd->props); in le_set_ext_adv_param()
3440 min_interval = sys_get_le24(cmd->prim_min_interval); in le_set_ext_adv_param()
3444 sys_get_le24(cmd->prim_max_interval); in le_set_ext_adv_param()
3446 /* Compare advertising interval maximum with implementation in le_set_ext_adv_param()
3447 * supported advertising interval maximum value defined in the in le_set_ext_adv_param()
3459 if ((cmd->prim_adv_phy > BT_HCI_LE_PHY_CODED) || in le_set_ext_adv_param()
3460 (cmd->sec_adv_phy > BT_HCI_LE_PHY_CODED) || in le_set_ext_adv_param()
3462 ((cmd->prim_adv_phy == BT_HCI_LE_PHY_CODED) || in le_set_ext_adv_param()
3463 (cmd->sec_adv_phy == BT_HCI_LE_PHY_CODED)))) { in le_set_ext_adv_param()
3469 status = ll_adv_set_by_hci_handle_get_or_new(cmd->handle, &handle); in le_set_ext_adv_param()
3475 tx_pwr = cmd->tx_power; in le_set_ext_adv_param()
3476 phy_p = BIT(cmd->prim_adv_phy - 1); in le_set_ext_adv_param()
3477 phy_s = BIT(cmd->sec_adv_phy - 1); in le_set_ext_adv_param()
3480 PDU_ADV_TYPE_EXT_IND, cmd->own_addr_type, in le_set_ext_adv_param()
3481 cmd->peer_addr.type, cmd->peer_addr.a.val, in le_set_ext_adv_param()
3482 cmd->prim_channel_map, cmd->filter_policy, in le_set_ext_adv_param()
3483 &tx_pwr, phy_p, cmd->sec_adv_max_skip, phy_s, in le_set_ext_adv_param()
3484 cmd->sid, cmd->scan_req_notify_enable); in le_set_ext_adv_param()
3487 rp->status = status; in le_set_ext_adv_param()
3488 rp->tx_power = tx_pwr; in le_set_ext_adv_param()
3493 struct bt_hci_cp_le_set_ext_adv_data *cmd = (void *)buf->data; in le_set_ext_adv_data()
3501 status = ll_adv_set_by_hci_handle_get(cmd->handle, &handle); in le_set_ext_adv_data()
3507 status = ll_adv_aux_ad_data_set(handle, cmd->op, cmd->frag_pref, in le_set_ext_adv_data()
3508 cmd->len, cmd->data); in le_set_ext_adv_data()
3515 struct bt_hci_cp_le_set_ext_scan_rsp_data *cmd = (void *)buf->data; in le_set_ext_scan_rsp_data()
3523 status = ll_adv_set_by_hci_handle_get(cmd->handle, &handle); in le_set_ext_scan_rsp_data()
3529 status = ll_adv_aux_sr_data_set(handle, cmd->op, cmd->frag_pref, in le_set_ext_scan_rsp_data()
3530 cmd->len, cmd->data); in le_set_ext_scan_rsp_data()
3537 struct bt_hci_cp_le_set_ext_adv_enable *cmd = (void *)buf->data; in le_set_ext_adv_enable()
3547 set_num = cmd->set_num; in le_set_ext_adv_enable()
3549 if (cmd->enable) { in le_set_ext_adv_enable()
3563 for (uint8_t i = 0U; i < set_num - 1; i++) { in le_set_ext_adv_enable()
3565 if (cmd->s[i].handle == cmd->s[j].handle) { in le_set_ext_adv_enable()
3573 s = (void *) cmd->s; in le_set_ext_adv_enable()
3575 status = ll_adv_set_by_hci_handle_get(s->handle, &handle); in le_set_ext_adv_enable()
3582 status = ll_adv_enable(handle, cmd->enable, 0, 0, 0, 0, 0); in le_set_ext_adv_enable()
3584 status = ll_adv_enable(handle, cmd->enable, in le_set_ext_adv_enable()
3585 sys_le16_to_cpu(s->duration), s->max_ext_adv_evts); in le_set_ext_adv_enable()
3595 } while (--set_num); in le_set_ext_adv_enable()
3613 rp->max_adv_data_len = sys_cpu_to_le16(max_adv_data_len); in le_read_max_adv_data_len()
3614 rp->status = 0x00; in le_read_max_adv_data_len()
3627 rp->num_sets = ll_adv_aux_set_count_get(); in le_read_num_adv_sets()
3628 rp->status = 0x00; in le_read_num_adv_sets()
3633 struct bt_hci_cp_le_remove_adv_set *cmd = (void *)buf->data; in le_remove_adv_set()
3641 status = ll_adv_set_by_hci_handle_get(cmd->handle, &handle); in le_remove_adv_set()
3668 struct bt_hci_cp_le_set_per_adv_param *cmd = (void *)buf->data; in le_set_per_adv_param()
3678 max_interval = sys_le16_to_cpu(cmd->max_interval); in le_set_per_adv_param()
3682 sys_le16_to_cpu(cmd->min_interval); in le_set_per_adv_param()
3690 /* Compare periodic advertising interval with in le_set_per_adv_param()
3691 * implementation supported periodic advertising interval in le_set_per_adv_param()
3705 status = ll_adv_set_by_hci_handle_get(cmd->handle, &handle); in le_set_per_adv_param()
3711 flags = sys_le16_to_cpu(cmd->props); in le_set_per_adv_param()
3720 struct bt_hci_cp_le_set_per_adv_data *cmd = (void *)buf->data; in le_set_per_adv_data()
3728 status = ll_adv_set_by_hci_handle_get(cmd->handle, &handle); in le_set_per_adv_data()
3734 status = ll_adv_sync_ad_data_set(handle, cmd->op, cmd->len, in le_set_per_adv_data()
3735 cmd->data); in le_set_per_adv_data()
3742 struct bt_hci_cp_le_set_per_adv_enable *cmd = (void *)buf->data; in le_set_per_adv_enable()
3750 status = ll_adv_set_by_hci_handle_get(cmd->handle, &handle); in le_set_per_adv_enable()
3756 status = ll_adv_sync_enable(handle, cmd->enable); in le_set_per_adv_enable()
3766 struct bt_hci_cp_le_set_ext_scan_param *cmd = (void *)buf->data; in le_set_ext_scan_param()
3786 phys = cmd->phys; in le_set_ext_scan_param()
3794 own_addr_type = cmd->own_addr_type; in le_set_ext_scan_param()
3795 filter_policy = cmd->filter_policy; in le_set_ext_scan_param()
3796 p = cmd->p; in le_set_ext_scan_param()
3800 * Passing interval and window as 0, disable the particular scan set in le_set_ext_scan_param()
3804 uint16_t interval; in le_set_ext_scan_param() local
3810 phy = BIT(find_lsb_set(phys_bitmask) - 1); in le_set_ext_scan_param()
3818 * pick the supplied scan type, interval and window. in le_set_ext_scan_param()
3821 type |= (p->type & 0x01); in le_set_ext_scan_param()
3822 interval = sys_le16_to_cpu(p->interval); in le_set_ext_scan_param()
3823 window = sys_le16_to_cpu(p->window); in le_set_ext_scan_param()
3826 interval = 0U; in le_set_ext_scan_param()
3830 status = ll_scan_params_set(type, interval, window, in le_set_ext_scan_param()
3836 phys_bitmask &= (phys_bitmask - 1); in le_set_ext_scan_param()
3844 struct bt_hci_cp_le_set_ext_scan_enable *cmd = (void *)buf->data; in le_set_ext_scan_enable()
3853 if (cmd->enable && cmd->filter_dup) { in le_set_ext_scan_enable()
3882 status = ll_scan_enable(cmd->enable, sys_le16_to_cpu(cmd->duration), in le_set_ext_scan_enable()
3883 sys_le16_to_cpu(cmd->period)); in le_set_ext_scan_enable()
3901 struct bt_hci_cp_le_per_adv_create_sync *cmd = (void *)buf->data;
3912 (cmd->options & BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_USE_LIST)) {
3918 (cmd->options &
3934 if (cmd->options & BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_FILTER_DUPLICATE) {
3948 skip = sys_le16_to_cpu(cmd->skip);
3949 sync_timeout = sys_le16_to_cpu(cmd->sync_timeout);
3952 if ((cmd->cte_type & BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_INVALID_VALUE) != 0) {
3955 if (cmd->cte_type != BT_HCI_LE_PER_ADV_CREATE_SYNC_CTE_TYPE_NO_FILTERING) {
3959 status = ll_sync_create(cmd->options, cmd->sid, cmd->addr.type, cmd->addr.a.val,
3960 skip, sync_timeout, cmd->cte_type);
3978 ccst->status = status;
3983 struct bt_hci_cp_le_per_adv_terminate_sync *cmd = (void *)buf->data;
3992 handle = sys_le16_to_cpu(cmd->handle);
3997 ccst->status = status;
4002 struct bt_hci_cp_le_set_per_adv_recv_enable *cmd = (void *)buf->data;
4011 handle = sys_le16_to_cpu(cmd->handle);
4013 status = ll_sync_recv_enable(handle, cmd->enable);
4017 if (cmd->enable &
4035 ccst->status = status;
4041 struct bt_hci_cp_le_add_dev_to_per_adv_list *cmd = (void *)buf->data;
4048 status = ll_pal_add(&cmd->addr, cmd->sid);
4055 struct bt_hci_cp_le_rem_dev_from_per_adv_list *cmd = (void *)buf->data;
4062 status = ll_pal_remove(&cmd->addr, cmd->sid);
4089 rp->status = 0x00;
4091 rp->list_size = ll_pal_size_get();
4100 struct bt_hci_cp_le_per_adv_sync_transfer *cmd = (void *)buf->data;
4107 conn_handle_le16 = cmd->conn_handle;
4109 conn_handle = sys_le16_to_cpu(cmd->conn_handle);
4110 service_data = sys_le16_to_cpu(cmd->service_data);
4111 sync_handle = sys_le16_to_cpu(cmd->sync_handle);
4116 rp->conn_handle = conn_handle_le16;
4117 rp->status = status;
4122 struct bt_hci_cp_le_per_adv_set_info_transfer *cmd = (void *)buf->data;
4129 conn_handle_le16 = cmd->conn_handle;
4131 conn_handle = sys_le16_to_cpu(cmd->conn_handle);
4132 service_data = sys_le16_to_cpu(cmd->service_data);
4133 adv_handle = cmd->adv_handle;
4138 rp->conn_handle = conn_handle_le16;
4139 rp->status = status;
4146 struct bt_hci_cp_le_past_param *cmd = (void *)buf->data;
4160 conn_handle_le16 = cmd->conn_handle;
4162 conn_handle = sys_le16_to_cpu(cmd->conn_handle);
4163 mode = cmd->mode;
4164 skip = sys_le16_to_cpu(cmd->skip);
4165 timeout = sys_le16_to_cpu(cmd->timeout);
4166 cte_type = cmd->cte_type;
4171 rp->conn_handle = conn_handle_le16;
4172 rp->status = status;
4177 struct bt_hci_cp_le_default_past_param *cmd = (void *)buf->data;
4189 mode = cmd->mode;
4190 skip = sys_le16_to_cpu(cmd->skip);
4191 timeout = sys_le16_to_cpu(cmd->timeout);
4192 cte_type = cmd->cte_type;
4197 rp->status = status;
4204 struct bt_hci_cp_le_ext_create_conn *cmd = (void *)buf->data;
4227 phys = cmd->phys;
4229 /* Ignore Scan Interval and Scan Window, and ignore scanning if
4244 filter_policy = cmd->filter_policy;
4245 own_addr_type = cmd->own_addr_type;
4246 peer_addr_type = cmd->peer_addr.type;
4247 peer_addr = cmd->peer_addr.a.val;
4248 p = cmd->p;
4258 phy = BIT(find_lsb_set(phys_bitmask) - 1);
4261 scan_interval = sys_le16_to_cpu(p->scan_interval);
4262 scan_window = sys_le16_to_cpu(p->scan_window);
4264 sys_le16_to_cpu(p->conn_interval_max);
4265 conn_latency = sys_le16_to_cpu(p->conn_latency);
4267 sys_le16_to_cpu(p->supervision_timeout);
4296 /* NOTE: Pass invalid interval value to reset the PHY
4308 phys_bitmask &= (phys_bitmask - 1);
4337 ll_cis_reject(req->cis_handle, BT_HCI_ERR_UNSUPP_REMOTE_FEATURE);
4342 sep->acl_handle = sys_cpu_to_le16(node_rx->hdr.handle);
4343 sep->cis_handle = sys_cpu_to_le16(req->cis_handle);
4344 sep->cig_id = req->cig_id;
4345 sep->cis_id = req->cis_id;
4369 cis = node_rx->rx_ftr.param;
4370 cig = cis->group;
4381 sep->status = est->status;
4382 sep->conn_handle = sys_cpu_to_le16(est->cis_handle);
4389 lll_cis = &cis->lll;
4390 is_central = cig->lll.role == BT_CONN_ROLE_CENTRAL;
4391 lll_cis_c = is_central ? &lll_cis->tx : &lll_cis->rx;
4392 lll_cis_p = is_central ? &lll_cis->rx : &lll_cis->tx;
4394 sys_put_le24(cig->sync_delay, sep->cig_sync_delay);
4395 sys_put_le24(cis->sync_delay, sep->cis_sync_delay);
4396 sys_put_le24(cig->c_latency, sep->c_latency);
4397 sys_put_le24(cig->p_latency, sep->p_latency);
4398 sep->c_phy = find_lsb_set(lll_cis_c->phy);
4399 sep->p_phy = find_lsb_set(lll_cis_p->phy);
4400 sep->nse = lll_cis->nse;
4401 sep->c_bn = lll_cis_c->bn;
4402 sep->p_bn = lll_cis_p->bn;
4403 sep->c_ft = lll_cis_c->ft;
4404 sep->p_ft = lll_cis_p->ft;
4405 sep->c_max_pdu = sys_cpu_to_le16(lll_cis_c->max_pdu);
4406 sep->p_max_pdu = sys_cpu_to_le16(lll_cis_p->max_pdu);
4407 sep->interval = sys_cpu_to_le16(cig->iso_interval);
4411 cis_pending_count--;
4440 sep->status = se->rx_sync.status;
4442 sync = node_rx->rx_ftr.param;
4445 sep->addr.type = sync->peer_id_addr_type;
4446 if (sync->peer_addr_resolved) {
4448 MARK_AS_IDENTITY_ADDR(sep->addr.type);
4450 (void)memcpy(sep->addr.a.val, sync->peer_id_addr, BDADDR_SIZE);
4452 sep->adv_sid = sync->sid;
4453 sep->phy = find_lsb_set(se->rx_sync.phy);
4454 sep->interval = sys_cpu_to_le16(se->rx_sync.interval);
4455 sep->clock_accuracy = se->rx_sync.sca;
4456 sep->conn_handle = sys_cpu_to_le16(se->conn_handle);
4457 sep->service_data = sys_cpu_to_le16(se->service_data);
4458 sep->sync_handle = sys_cpu_to_le16(node_rx->hdr.handle);
4972 return -EINVAL;
4985 rp->status = 0x00;
4986 rp->hw_platform = sys_cpu_to_le16(BT_HCI_VS_HW_PLAT);
4987 rp->hw_variant = sys_cpu_to_le16(BT_HCI_VS_HW_VAR);
4989 rp->fw_variant = 0U;
4990 rp->fw_version = (KERNEL_VERSION_MAJOR & 0xff);
4991 rp->fw_revision = sys_cpu_to_le16(KERNEL_VERSION_MINOR);
4992 rp->fw_build = sys_cpu_to_le32(KERNEL_PATCHLEVEL & 0xffff);
5002 rp->status = 0x00;
5003 (void)memset(&rp->commands[0], 0, sizeof(rp->commands));
5006 rp->commands[0] |= BIT(0) | BIT(1) | BIT(2);
5008 rp->commands[0] |= BIT(5) | BIT(7);
5010 rp->commands[1] |= BIT(0) | BIT(1);
5013 rp->commands[1] |= BIT(4);
5017 rp->commands[1] |= BIT(5) | BIT(6);
5021 rp->commands[1] |= BIT(7);
5023 rp->commands[2] |= BIT(0);
5034 rp->status = 0x00;
5035 (void)memset(&rp->features[0], 0x00, sizeof(rp->features));
5049 struct bt_hci_cp_vs_write_bd_addr *cmd = (void *)buf->data;
5051 ll_addr_set(0, &cmd->bdaddr.val[0]);
5073 rp->status = 0x00;
5074 memcpy(rp->info, build_info, sizeof(build_info));
5092 rp->status = 0x00;
5093 rp->num_addrs = hci_vendor_read_static_addr(rp->a, 1);
5102 rp->status = 0x00;
5103 hci_vendor_read_key_hierarchy_roots(rp->ir, rp->er);
5109 struct bt_hci_cp_vs_set_min_num_used_chans *cmd = (void *)buf->data;
5110 uint16_t handle = sys_le16_to_cpu(cmd->handle);
5113 status = ll_set_min_used_chans(handle, cmd->phys, cmd->min_used_chans);
5122 struct bt_hci_cp_vs_set_scan_req_reports *cmd = (void *)buf->data;
5124 if (cmd->enable) {
5136 struct bt_hci_cp_vs_write_tx_power_level *cmd = (void *)buf->data;
5142 handle_type = cmd->handle_type;
5143 handle = sys_le16_to_cpu(cmd->handle);
5146 rp->selected_tx_power = cmd->tx_power_level;
5148 status = ll_tx_pwr_lvl_set(handle_type, handle, &rp->selected_tx_power);
5150 rp->status = status;
5151 rp->handle_type = handle_type;
5152 rp->handle = sys_cpu_to_le16(handle);
5157 struct bt_hci_cp_vs_read_tx_power_level *cmd = (void *)buf->data;
5163 handle_type = cmd->handle_type;
5164 handle = sys_le16_to_cpu(cmd->handle);
5168 status = ll_tx_pwr_lvl_get(handle_type, handle, 0, &rp->tx_power_level);
5170 rp->status = status;
5171 rp->handle_type = handle_type;
5172 rp->handle = sys_cpu_to_le16(handle);
5193 cpu_data->a1 = sys_cpu_to_le32(esf->basic.a1);
5194 cpu_data->a2 = sys_cpu_to_le32(esf->basic.a2);
5195 cpu_data->a3 = sys_cpu_to_le32(esf->basic.a3);
5196 cpu_data->a4 = sys_cpu_to_le32(esf->basic.a4);
5197 cpu_data->ip = sys_cpu_to_le32(esf->basic.ip);
5198 cpu_data->lr = sys_cpu_to_le32(esf->basic.lr);
5199 cpu_data->xpsr = sys_cpu_to_le32(esf->basic.xpsr);
5216 hdr->evt = BT_HCI_EVT_VENDOR;
5217 hdr->len = len + sizeof(*me);
5220 me->subevent = subevt;
5237 sf->reason = sys_cpu_to_le32(reason);
5238 sf->cpu_type = BT_HCI_EVT_VS_ERROR_CPU_TYPE_CORTEX_M;
5241 (bt_hci_vs_fatal_error_cpu_data *)sf->cpu_data, esf);
5265 file_name_len -= pos;
5286 file_name_len + data_len - BT_BUF_EVT_RX_SIZE;
5289 file_name_len -= overflow_len;
5344 lll = iq_report->rx.rx_ftr.param;
5353 if (ull_df_sync_cfg_is_not_enabled(&lll->df_cfg) || !sync->timeout_reload) {
5362 per_evt_counter = iq_report->event_counter;
5369 if (iq_report->packet_status == BT_HCI_LE_CTE_INSUFFICIENT_RESOURCES) {
5372 samples_cnt = MAX(1, iq_report->sample_count);
5378 rssi = RSSI_DBM_TO_DECI_DBM(iq_report->rx.rx_ftr.rssi);
5380 sep->sync_handle = sys_cpu_to_le16(sync_handle);
5381 sep->rssi = sys_cpu_to_le16(rssi);
5382 sep->rssi_ant_id = iq_report->rssi_ant_id;
5383 sep->cte_type = iq_report->cte_info.type;
5385 sep->chan_idx = iq_report->chan_idx;
5386 sep->per_evt_counter = sys_cpu_to_le16(per_evt_counter);
5388 if (sep->cte_type == BT_HCI_LE_AOA_CTE) {
5389 sep->slot_durations = iq_report->local_slot_durations;
5390 } else if (sep->cte_type == BT_HCI_LE_AOD_CTE_1US) {
5391 sep->slot_durations = BT_HCI_LE_ANTENNA_SWITCHING_SLOT_1US;
5393 sep->slot_durations = BT_HCI_LE_ANTENNA_SWITCHING_SLOT_2US;
5396 sep->packet_status = iq_report->packet_status;
5398 if (iq_report->packet_status != BT_HCI_LE_CTE_INSUFFICIENT_RESOURCES) {
5399 if (iq_report->sample_count == 0U) {
5400 sep->sample[0].i = sys_cpu_to_le16(BT_HCI_VS_LE_CTE_REPORT_NO_VALID_SAMPLE);
5401 sep->sample[0].q = sys_cpu_to_le16(BT_HCI_VS_LE_CTE_REPORT_NO_VALID_SAMPLE);
5404 sep->sample[idx].i = sys_cpu_to_le16(iq_report->sample[idx].i);
5405 sep->sample[idx].q = sys_cpu_to_le16(iq_report->sample[idx].q);
5410 sep->sample_count = samples_cnt;
5430 lll = iq_report->rx.rx_ftr.param;
5433 phy_rx = lll->phy_rx;
5445 if (ull_df_conn_cfg_is_not_enabled(&lll->df_rx_cfg)) {
5454 if (iq_report->packet_status == BT_HCI_LE_CTE_INSUFFICIENT_RESOURCES) {
5457 samples_cnt = MAX(1, iq_report->sample_count);
5463 rssi = RSSI_DBM_TO_DECI_DBM(iq_report->rx.rx_ftr.rssi);
5465 sep->conn_handle = sys_cpu_to_le16(iq_report->rx.hdr.handle);
5466 sep->rx_phy = phy_rx;
5467 sep->rssi = sys_cpu_to_le16(rssi);
5468 sep->rssi_ant_id = iq_report->rssi_ant_id;
5469 sep->cte_type = iq_report->cte_info.type;
5471 sep->data_chan_idx = iq_report->chan_idx;
5472 sep->conn_evt_counter = sys_cpu_to_le16(iq_report->event_counter);
5474 if (sep->cte_type == BT_HCI_LE_AOA_CTE) {
5475 sep->slot_durations = iq_report->local_slot_durations;
5476 } else if (sep->cte_type == BT_HCI_LE_AOD_CTE_1US) {
5477 sep->slot_durations = BT_HCI_LE_ANTENNA_SWITCHING_SLOT_1US;
5479 sep->slot_durations = BT_HCI_LE_ANTENNA_SWITCHING_SLOT_2US;
5482 sep->packet_status = iq_report->packet_status;
5484 if (iq_report->packet_status != BT_HCI_LE_CTE_INSUFFICIENT_RESOURCES) {
5485 if (iq_report->sample_count == 0U) {
5486 sep->sample[0].i = sys_cpu_to_le16(BT_HCI_VS_LE_CTE_REPORT_NO_VALID_SAMPLE);
5487 sep->sample[0].q = sys_cpu_to_le16(BT_HCI_VS_LE_CTE_REPORT_NO_VALID_SAMPLE);
5490 sep->sample[idx].i = sys_cpu_to_le16(iq_report->sample[idx].i);
5491 sep->sample[idx].q = sys_cpu_to_le16(iq_report->sample[idx].q);
5496 sep->sample_count = samples_cnt;
5507 rp->status = 0x00;
5508 rp->opcode = BT_HCI_OC_MESH_GET_OPTS;
5510 rp->revision = BT_HCI_MESH_REVISION;
5511 rp->ch_map = 0x7;
5513 rp->min_tx_power = -30;
5515 rp->max_tx_power = 4;
5516 rp->max_scan_filter = CONFIG_BT_CTLR_MESH_SCAN_FILTERS;
5517 rp->max_filter_pattern = CONFIG_BT_CTLR_MESH_SF_PATTERNS;
5518 rp->max_adv_slot = 1U;
5519 rp->evt_prefix_len = 0x01;
5520 rp->evt_prefix = BT_HCI_MESH_EVT_PREFIX;
5525 struct bt_hci_cp_mesh_set_scan_filter *cmd = (void *)buf->data;
5527 uint8_t filter = cmd->scan_filter - 1;
5533 cmd->num_patterns > CONFIG_BT_CTLR_MESH_SF_PATTERNS) {
5544 if (cmd->filter_dup) {
5550 for (i = 0U; i < cmd->num_patterns; i++) {
5551 if (!cmd->patterns[i].pattern_len ||
5552 cmd->patterns[i].pattern_len >
5557 f->lengths[i] = cmd->patterns[i].pattern_len;
5558 memcpy(f->patterns[i], cmd->patterns[i].pattern, f->lengths[i]);
5561 f->count = cmd->num_patterns;
5565 rp->status = status;
5566 rp->opcode = BT_HCI_OC_MESH_SET_SCAN_FILTER;
5567 rp->scan_filter = filter + 1;
5572 struct bt_hci_cp_mesh_advertise *cmd = (void *)buf->data;
5574 uint8_t adv_slot = cmd->adv_slot;
5578 cmd->own_addr_type, cmd->random_addr.val,
5579 cmd->ch_map, cmd->tx_power,
5580 cmd->min_tx_delay, cmd->max_tx_delay,
5581 cmd->retx_count, cmd->retx_interval,
5582 cmd->scan_duration, cmd->scan_delay,
5583 cmd->scan_filter, cmd->data_len, cmd->data);
5586 sf_curr = cmd->scan_filter - 1;
5590 rp->status = status;
5591 rp->opcode = BT_HCI_OC_MESH_ADVERTISE;
5592 rp->adv_slot = adv_slot;
5597 struct bt_hci_cp_mesh_advertise_cancel *cmd = (void *)buf->data;
5599 uint8_t adv_slot = cmd->adv_slot;
5609 rp->status = status;
5610 rp->opcode = BT_HCI_OC_MESH_ADVERTISE_CANCEL;
5611 rp->adv_slot = adv_slot;
5619 if (cmd->len < sizeof(*cp_mesh)) {
5621 return -EINVAL;
5625 mesh_op = cp_mesh->opcode;
5645 return -EINVAL;
5721 return -EINVAL;
5735 if (cmd->len < sizeof(*chdr)) {
5741 if (cmd->len < chdr->param_len) {
5746 /* store in a global for later CC/CS event creation */
5747 _opcode = sys_le16_to_cpu(chdr->opcode);
5773 err = -EINVAL;
5777 if (err == -EINVAL) {
5798 ep->link_type = link_type;
5816 if (buf->len < sizeof(*acl)) {
5818 return -EINVAL;
5822 len = sys_le16_to_cpu(acl->len);
5823 handle = sys_le16_to_cpu(acl->handle);
5825 if (buf->len < len) {
5827 return -EINVAL;
5832 return -EINVAL;
5843 return -ENOBUFS;
5846 pdu_data = (void *)node_tx->pdu;
5849 return -EINVAL;
5854 pdu_data->ll_id = PDU_DATA_LLID_DATA_START;
5857 pdu_data->ll_id = PDU_DATA_LLID_DATA_CONTINUE;
5860 /* BT_ACL_START and BT_ACL_COMPLETE not allowed on LE-U
5863 return -EINVAL;
5866 pdu_data->len = len;
5867 memcpy(&pdu_data->lldata[0], buf->data, len);
5872 return -EINVAL;
5895 if (buf->len < sizeof(*iso_hdr)) {
5897 return -EINVAL;
5901 handle = sys_le16_to_cpu(iso_hdr->handle);
5902 len = bt_iso_hdr_len(sys_le16_to_cpu(iso_hdr->len));
5904 if (buf->len < len) {
5906 return -EINVAL;
5917 * BT Core V5.3 : Vol 6 Low Energy Controller : Part G IS0-AL:
5921 * -- A captured time stamp of the SDU
5922 * -- A time stamp provided by the higher layer
5923 * -- A computed time stamp based on a sequence counter provided by the
5925 * -- Any other method of determining Time_Offset
5934 len -= sizeof(*time_stamp);
5944 len -= sizeof(*iso_sdu_hdr);
5945 sdu_frag_tx.packet_sn = sys_le16_to_cpu(iso_sdu_hdr->sn);
5947 sys_le16_to_cpu(bt_iso_pkt_len(iso_sdu_hdr->slen));
5961 sdu_frag_tx.dbuf = buf->data;
5979 return -EINVAL;
5982 cig = cis->group;
5984 /* We must ensure sufficient time for ISO-AL to fragment SDU and
5998 event_offset = ull_ref_get(&cig->ull) ? 1 : 2;
6000 if (cis->lll.tx.ft > 1) {
6002 event_offset -= 1;
6010 event_count = cis->lll.event_count + event_offset;
6016 * to last recorded number in cis->pkt_seq_num.
6018 * When (pkt_seq_num - stream->pkt_seq_num) is negative then
6022 * stream->pkt_seq_num. This calculation is valid for when value
6026 (((pkt_seq_num - cis->pkt_seq_num) &
6028 cis->pkt_seq_num = pkt_seq_num;
6030 pkt_seq_num = cis->pkt_seq_num;
6033 /* Pre-increment, when pg_flag is BT_ISO_SINGLE (0b10) or
6038 cis->pkt_seq_num++;
6047 isoal_get_wrapped_time_us(cig->cig_ref_point,
6048 ((pkt_seq_num - event_count) *
6049 cig->iso_interval *
6053 sdu_frag_tx.target_event = cis->lll.event_count + event_offset;
6055 isoal_get_wrapped_time_us(cig->cig_ref_point,
6057 cig->iso_interval *
6062 hdr = &cis->hdr;
6063 dp_in = hdr->datapath_in;
6064 if (!dp_in || dp_in->path_id != BT_HCI_DATAPATH_ID_HCI) {
6066 return -EINVAL;
6070 isoal_source_handle_t source = dp_in->source_hdl;
6079 return -ENOBUFS;
6082 return -EINVAL;
6102 if (!stream || !stream->dp) {
6104 return -EINVAL;
6110 return -EINVAL;
6113 lll_iso = &adv_iso->lll;
6119 * dropped for a said SDU interval. i.e. upper layer is not
6130 * by one additional ISO interval.
6132 target_event = lll_iso->payload_count / lll_iso->bn;
6133 latency_prepare = lll_iso->latency_prepare;
6136 * hasn't been updated yet - increment target_event to
6141 event_offset = ull_ref_get(&adv_iso->ull) ? 0U : 1U;
6154 * to last recorded number in cis->pkt_seq_num.
6156 * When (pkt_seq_num - stream->pkt_seq_num) is negative then
6160 * stream->pkt_seq_num. This calculation is valid for when value
6164 (((pkt_seq_num - stream->pkt_seq_num) &
6166 stream->pkt_seq_num = pkt_seq_num;
6168 pkt_seq_num = stream->pkt_seq_num;
6171 /* Pre-increment, when pg_flag is BT_ISO_SINGLE (0b10) or
6176 stream->pkt_seq_num++;
6196 isoal_get_wrapped_time_us(adv_iso->big_ref_point,
6197 (((pkt_seq_num + 1U) -
6199 lll_iso->iso_interval *
6205 isoal_get_wrapped_time_us(adv_iso->big_ref_point,
6207 lll_iso->iso_interval *
6212 /* FIXME: need to ensure ISO-AL returns proper isoal_status.
6213 * Currently there are cases where ISO-AL calls LL_ASSERT.
6216 isoal_tx_sdu_fragment(stream->dp->source_hdl, &sdu_frag_tx);
6221 return -ENOBUFS;
6224 return -EINVAL;
6232 return -EINVAL;
6244 adv_set = &dup_mode->set[dup_mode->set_curr];
6246 adv_set->data_cmplt = (data_status ==
6251 (void)memcpy(&adv_set->adi, adi, sizeof(*adi));
6253 (void)memset(&adv_set->adi, 0U, sizeof(*adi));
6256 if (dup_mode->set_count < CONFIG_BT_CTLR_DUP_FILTER_ADV_SET_MAX) {
6257 dup_mode->set_count++;
6258 dup_mode->set_curr = dup_mode->set_count;
6260 dup_mode->set_curr++;
6263 if (dup_mode->set_curr == CONFIG_BT_CTLR_DUP_FILTER_ADV_SET_MAX) {
6264 dup_mode->set_curr = 0U;
6277 dup_mode->set_count = 0U;
6278 dup_mode->set_curr = 0U;
6289 dup->mask = 0U;
6290 dup_ext_adv_mode_reset(dup->adv_mode);
6302 if (memcmp(addr, dup->addr.a.val, sizeof(bt_addr_t)) ||
6303 (addr_type != dup->addr.type)) {
6307 dup_mode = &dup->adv_mode[DUP_EXT_ADV_MODE_PERIODIC];
6308 for (uint16_t set_idx = 0; set_idx < dup_mode->set_count;
6312 adv_set = &dup_mode->set[set_idx];
6313 if (PDU_ADV_ADI_SID_GET(&adv_set->adi) != sid) {
6318 adv_set->data_cmplt = 0U;
6334 if (!(dup->mask & BIT(adv_type))) {
6336 dup->mask |= BIT(adv_type);
6339 dup_ext_adv_adi_store(&dup->adv_mode[adv_mode], adi,
6346 } else if (dup->adv_mode[adv_mode].set_count == 0U) {
6348 dup_ext_adv_adi_store(&dup->adv_mode[adv_mode], adi,
6355 dup_mode = &dup->adv_mode[adv_mode];
6356 for (j = 0; j < dup_mode->set_count; j++) {
6359 adv_set = &dup_mode->set[j];
6360 if (PDU_ADV_ADI_SID_GET(&adv_set->adi) != PDU_ADV_ADI_SID_GET(adi)) {
6364 if (PDU_ADV_ADI_DID_GET(&adv_set->adi) != PDU_ADV_ADI_DID_GET(adi)) {
6366 adv_set->adi.did_sid_packed[0] = adi->did_sid_packed[0];
6367 adv_set->adi.did_sid_packed[1] = adi->did_sid_packed[1];
6370 adv_set->data_cmplt = 1U;
6372 adv_set->data_cmplt = 0U;
6376 } else if (!adv_set->data_cmplt &&
6380 adv_set->data_cmplt = 1U;
6382 } else if (!adv_set->data_cmplt) {
6390 dup_ext_adv_adi_store(&dup->adv_mode[adv_mode], adi,
6410 "adv_mode index out-of-bound");
6416 if (memcmp(addr, &dup->addr.a.val[0],
6418 (addr_type != dup->addr.type)) {
6429 (void)memcpy(&dup->addr.a.val[0], addr, sizeof(bt_addr_t));
6430 dup->addr.type = addr_type;
6431 dup->mask = BIT(adv_type);
6434 dup_ext_adv_mode_reset(dup->adv_mode);
6435 dup_ext_adv_adi_store(&dup->adv_mode[adv_mode], adi,
6467 LL_ASSERT(adv->type == PDU_ADV_TYPE_DIRECT_IND);
6471 dup_found(adv->type, adv->tx_addr, adv->adv_ind.addr, 0, NULL, 0)) {
6479 drp->num_reports = 1U;
6483 dir_info->evt_type = BT_HCI_ADV_DIRECT_IND;
6488 ll_rl_id_addr_get(rl_idx, &dir_info->addr.type,
6489 &dir_info->addr.a.val[0]);
6491 MARK_AS_IDENTITY_ADDR(dir_info->addr.type);
6496 dir_info->addr.type = adv->tx_addr;
6497 memcpy(&dir_info->addr.a.val[0], &adv->direct_ind.adv_addr[0],
6501 dir_info->dir_addr.type = adv->rx_addr;
6502 memcpy(&dir_info->dir_addr.a.val[0],
6503 &adv->direct_ind.tgt_addr[0], sizeof(bt_addr_t));
6505 dir_info->rssi = rssi;
6516 for (uint8_t i = 0; i < f->count; i++) {
6518 if (len >= f->lengths[i] &&
6519 !memcmp(data, f->patterns[i], f->lengths[i])) {
6531 uint8_t data_len = (adv->len - BDADDR_SIZE);
6537 LL_ASSERT(adv->type == PDU_ADV_TYPE_NONCONN_IND);
6541 !scan_filter_apply(sf_curr, &adv->adv_ind.data[0], data_len)) {
6546 chan = node_rx->rx_ftr.chan;
6547 instant = node_rx->rx_ftr.anchor_ticks;
6552 mep->num_reports = 1U;
6554 sr->addr.type = adv->tx_addr;
6555 memcpy(&sr->addr.a.val[0], &adv->adv_ind.addr[0], sizeof(bt_addr_t));
6556 sr->chan = chan;
6557 sr->rssi = rssi;
6558 sys_put_le32(instant, (uint8_t *)&sr->instant);
6560 sr->data_len = data_len;
6561 memcpy(&sr->data[0], &adv->adv_ind.data[0], data_len);
6585 rssi = -(node_rx->rx_ftr.rssi);
6587 rl_idx = node_rx->rx_ftr.rl_idx;
6590 direct_report = node_rx->rx_ftr.direct;
6594 if (adv->tx_addr) {
6596 ll_rl_crpa_set(0x00, NULL, rl_idx, &adv->adv_ind.addr[0]);
6612 if (node_rx->hdr.type == NODE_RX_TYPE_MESH_REPORT) {
6625 dup_found(adv->type, adv->tx_addr, adv->adv_ind.addr, 0, NULL, 0)) {
6630 if (adv->type != PDU_ADV_TYPE_DIRECT_IND) {
6631 data_len = (adv->len - BDADDR_SIZE);
6640 sep->num_reports = 1U;
6643 adv_info->evt_type = c_adv_type[adv->type];
6648 ll_rl_id_addr_get(rl_idx, &adv_info->addr.type,
6649 &adv_info->addr.a.val[0]);
6651 MARK_AS_IDENTITY_ADDR(adv_info->addr.type);
6657 adv_info->addr.type = adv->tx_addr;
6658 memcpy(&adv_info->addr.a.val[0], &adv->adv_ind.addr[0],
6662 adv_info->length = data_len;
6663 memcpy(&adv_info->data[0], &adv->adv_ind.data[0], data_len);
6665 prssi = &adv_info->data[0] + data_len;
6714 rssi = -(node_rx->rx_ftr.rssi);
6717 rl_idx = node_rx->rx_ftr.rl_idx;
6721 if (adv->tx_addr) {
6723 ll_rl_crpa_set(0x00, NULL, rl_idx, &adv->adv_ind.addr[0]);
6729 dup_found(adv->type, adv->tx_addr, adv->adv_ind.addr, 0, NULL, 0)) {
6734 if (adv->type != PDU_ADV_TYPE_DIRECT_IND) {
6735 data_len = (adv->len - BDADDR_SIZE);
6745 sep->num_reports = 1U;
6748 adv_info->evt_type = sys_cpu_to_le16((uint16_t)evt_type_lookup[adv->type]);
6753 ll_rl_id_addr_get(rl_idx, &adv_info->addr.type,
6754 &adv_info->addr.a.val[0]);
6756 MARK_AS_IDENTITY_ADDR(adv_info->addr.type);
6760 adv_info->addr.type = adv->tx_addr;
6761 memcpy(&adv_info->addr.a.val[0], &adv->adv_ind.addr[0],
6765 adv_info->prim_phy = BT_HCI_LE_EXT_SCAN_PHY_1M;
6766 adv_info->sec_phy = 0U;
6767 adv_info->sid = 0xff;
6768 adv_info->tx_power = BT_HCI_LE_ADV_TX_POWER_NO_PREF;
6769 adv_info->rssi = rssi;
6770 adv_info->interval = 0U;
6772 if (adv->type == PDU_ADV_TYPE_DIRECT_IND) {
6773 adv_info->direct_addr.type = adv->rx_addr;
6774 bt_addr_copy(&adv_info->direct_addr.a,
6775 (void *)adv->direct_ind.tgt_addr);
6777 adv_info->direct_addr.type = 0U;
6778 (void)memset(adv_info->direct_addr.a.val, 0U,
6779 sizeof(adv_info->direct_addr.a.val));
6782 adv_info->length = data_len;
6783 memcpy(&adv_info->data[0], &adv->adv_ind.data[0], data_len);
6805 if ((rx_addr_type == lll->init_addr_type) &&
6806 !memcmp(lll->init_addr, rx_addr, BDADDR_SIZE)) {
6810 return scan->own_addr_type;
6817 return scan->own_addr_type | BIT(1);
6827 return scan->own_addr_type;
6835 const struct pdu_adv *adv = (void *)node_rx_data->pdu;
6844 p = (void *)&adv->adv_ext_ind;
6845 h = (void *)p->ext_hdr_adv_data;
6848 if (!p->ext_hdr_len) {
6854 ptr = h->data;
6856 if (h->adv_addr) {
6860 if (h->tgt_addr) {
6864 if (h->adi) {
6868 if (h->aux_ptr) {
6877 if (h->sync_info) {
6881 if (h->tx_pwr) {
6886 hdr_len = ptr - (uint8_t *)p;
6887 hdr_buf_len = PDU_AC_EXT_HEADER_SIZE_MIN + p->ext_hdr_len;
6889 uint8_t acad_len = hdr_buf_len - hdr_len;
6896 if (hdr_len < adv->len) {
6899 return adv->len - hdr_len;
6911 node_rx_extra = node_rx_curr->rx_ftr.extra;
6913 node_rx_curr->hdr.next = NULL;
6936 sep->num_reports = 1U;
6939 adv_info->evt_type = sys_cpu_to_le16((uint16_t)evt_type);
6945 ll_rl_id_addr_get(rl_idx, &adv_info->addr.type,
6946 adv_info->addr.a.val);
6948 MARK_AS_IDENTITY_ADDR(adv_info->addr.type);
6953 adv_info->addr.type = adv_addr_type;
6954 (void)memcpy(adv_info->addr.a.val, adv_addr, sizeof(bt_addr_t));
6956 adv_info->addr.type = 0U;
6957 (void)memset(adv_info->addr.a.val, 0, sizeof(bt_addr_t));
6960 adv_info->prim_phy = find_lsb_set(phy);
6961 adv_info->sec_phy = sec_phy;
6962 adv_info->sid = (adi) ? PDU_ADV_ADI_SID_GET(adi) : BT_HCI_LE_EXT_ADV_SID_INVALID;
6963 adv_info->tx_power = tx_pwr;
6964 adv_info->rssi = rssi;
6965 adv_info->interval = interval_le16;
6968 adv_info->direct_addr.type = direct_addr_type;
6969 (void)memcpy(adv_info->direct_addr.a.val, direct_addr,
6972 adv_info->direct_addr.type = 0U;
6973 (void)memset(adv_info->direct_addr.a.val, 0, sizeof(bt_addr_t));
6976 adv_info->length = data_len;
6977 (void)memcpy(adv_info->data, data, data_len);
7002 *data_len -= data_len_frag;
7003 *data_len_total -= data_len_frag;
7040 node_rx_data = node_rx_data->rx_ftr.extra;
7117 node_rx_extra_list_release(node_rx->rx_ftr.extra);
7127 node_rx_next = node_rx_curr->rx_ftr.extra;
7147 bool direct_report_curr = node_rx_curr->rx_ftr.direct;
7151 uint8_t rl_idx_curr = node_rx_curr->rx_ftr.rl_idx;
7153 direct_resolved_curr = node_rx_curr->rx_ftr.direct_resolved;
7158 const bool devmatch_curr = node_rx_curr->rx_ftr.devmatch;
7162 rssi = -(node_rx_curr->rx_ftr.rssi);
7165 " rssi=%d dB", phy, adv->type, adv->len, adv->tx_addr,
7166 adv->rx_addr, rssi);
7168 p = (void *)&adv->adv_ext_ind;
7169 h = (void *)p->ext_hdr_adv_data;
7172 LOG_DBG(" Ext. adv mode= 0x%x, hdr len= %u", p->adv_mode, p->ext_hdr_len);
7174 evt_type_curr = p->adv_mode;
7176 if (!p->ext_hdr_len) {
7182 ptr = h->data;
7184 if (h->adv_addr) {
7187 node_rx_curr == node_rx->rx_ftr.extra) {
7190 adv_addr_type_curr = adv->tx_addr;
7193 addr.type = adv->tx_addr;
7202 if (h->tgt_addr) {
7205 node_rx_curr == node_rx->rx_ftr.extra) {
7209 lll = node_rx->rx_ftr.param;
7216 adv->rx_addr, ptr);
7221 false, adv->rx_addr,
7227 addr.type = adv->rx_addr;
7237 if (h->cte_info) {
7242 if (h->adi) {
7251 if (h->aux_ptr) {
7255 if (node_rx_curr != node_rx->rx_ftr.extra ||
7270 ftr = &node_rx->rx_ftr;
7271 node_rx_extra_list_release(ftr->extra);
7283 aux_ptr->chan_idx, aux_ptr->ca,
7284 aux_ptr->offs_units, PDU_ADV_AUX_PTR_OFFSET_GET(aux_ptr),
7291 if (h->sync_info) {
7297 interval_le16 = si->interval;
7300 "interval = 0x%x, sca = 0x%x, "
7306 sys_le16_to_cpu(si->interval),
7307 ((si->sca_chm[PDU_SYNC_INFO_SCA_CHM_SCA_BYTE_OFFSET] &
7310 si->sca_chm[0], si->sca_chm[1], si->sca_chm[2],
7311 si->sca_chm[3],
7312 (si->sca_chm[PDU_SYNC_INFO_SCA_CHM_SCA_BYTE_OFFSET] &
7314 si->aa[3], si->aa[2], si->aa[1], si->aa[0],
7315 si->crc_init[0], si->crc_init[1],
7316 si->crc_init[2], sys_le16_to_cpu(si->evt_cntr));
7319 if (h->tx_pwr) {
7326 hdr_len = ptr - (uint8_t *)p;
7327 hdr_buf_len = PDU_AC_EXT_HEADER_SIZE_MIN + p->ext_hdr_len;
7329 LOG_WRN(" Header length %u/%u, INVALID.", hdr_len, p->ext_hdr_len);
7331 uint8_t acad_len = hdr_buf_len - hdr_len;
7340 if (hdr_len < adv->len) {
7341 data_len_curr = adv->len - hdr_len;
7389 if (node_rx_curr->rx_ftr.scan_rsp) {
7454 node_rx_next = node_rx_curr->rx_ftr.extra;
7455 adv = (void *)node_rx_curr->pdu;
7461 node_rx_extra_list_release(node_rx->rx_ftr.extra);
7470 node_rx_extra_list_release(node_rx->rx_ftr.extra);
7489 node_rx_extra_list_release(node_rx->rx_ftr.extra);
7501 data_len_max = CONFIG_BT_BUF_EVT_RX_SIZE -
7502 sizeof(struct bt_hci_evt_le_meta_event) -
7503 sizeof(struct bt_hci_evt_le_ext_advertising_report) -
7528 node_rx_extra_list_release(node_rx->rx_ftr.extra);
7569 node_rx_extra_list_release(node_rx->rx_ftr.extra);
7578 if ((adv->type == PDU_ADV_TYPE_EXT_IND) && adv->len) {
7642 sep->status = se->status;
7644 if (se->status == BT_HCI_ERR_OP_CANCELLED_BY_HOST) {
7648 sync = node_rx->rx_ftr.param;
7652 dup_periodic_adv_reset(sync->peer_id_addr_type, sync->peer_id_addr, sync->sid);
7657 sep->handle = sys_cpu_to_le16(node_rx->hdr.handle);
7660 sep->adv_addr.type = sync->peer_id_addr_type;
7661 if (sync->peer_addr_resolved) {
7663 MARK_AS_IDENTITY_ADDR(sep->adv_addr.type);
7665 (void)memcpy(sep->adv_addr.a.val, sync->peer_id_addr, BDADDR_SIZE);
7667 sep->sid = sync->sid;
7668 sep->phy = find_lsb_set(se->phy);
7669 sep->interval = sys_cpu_to_le16(se->interval);
7670 sep->clock_accuracy = se->sca;
7677 struct node_rx_ftr *ftr = &node_rx->rx_ftr;
7716 sync = HDR_LLL2ULL(ftr->param);
7717 if (unlikely(!sync->timeout_reload)) {
7721 data_len_total = ftr->aux_data_len;
7724 (ftr->aux_failed || data_len_total > CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX)) {
7731 sep->handle = sys_cpu_to_le16(node_rx->hdr.handle);
7732 sep->tx_power = BT_HCI_LE_ADV_TX_POWER_NO_PREF;
7733 sep->rssi = BT_HCI_LE_RSSI_NOT_AVAILABLE;
7734 sep->cte_type = BT_HCI_LE_NO_CTE;
7735 sep->data_status = BT_HCI_LE_ADV_EVT_TYPE_DATA_STATUS_INCOMPLETE;
7736 sep->length = 0;
7742 rssi = -(ftr->rssi);
7744 LOG_DBG("len = %u, rssi = %d", adv->len, rssi);
7746 p = (void *)&adv->adv_ext_ind;
7747 h = (void *)p->ext_hdr_adv_data;
7750 LOG_DBG(" Per. adv mode= 0x%x, hdr len= %u", p->adv_mode, p->ext_hdr_len);
7752 if (!p->ext_hdr_len) {
7758 ptr = h->data;
7760 if (h->adv_addr) {
7764 if (h->tgt_addr) {
7768 if (h->cte_info) {
7772 cte_type = cte_info->type;
7778 if (h->adi) {
7785 if (h->aux_ptr) {
7799 aux_ptr->chan_idx, aux_ptr->ca,
7800 aux_ptr->offs_units, PDU_ADV_AUX_PTR_OFFSET_GET(aux_ptr), aux_phy);
7804 if (h->sync_info) {
7809 if (h->tx_pwr) {
7816 hdr_len = ptr - (uint8_t *)p;
7817 hdr_buf_len = PDU_AC_EXT_HEADER_SIZE_MIN + p->ext_hdr_len;
7819 LOG_WRN(" Header length %u/%u, INVALID.", hdr_len, p->ext_hdr_len);
7821 acad_len = hdr_buf_len - hdr_len;
7831 if (hdr_len < adv->len) {
7832 data_len = adv->len - hdr_len;
7850 accept = sync->rx_enable && ftr->sync_rx_enabled &&
7851 (!sync->nodups ||
7853 sync->peer_id_addr_type,
7854 sync->peer_id_addr,
7862 accept = sync->rx_enable && ftr->sync_rx_enabled;
7865 data_len_max = CONFIG_BT_BUF_EVT_RX_SIZE -
7866 sizeof(struct bt_hci_evt_le_meta_event) -
7904 sep->handle = sys_cpu_to_le16(node_rx->hdr.handle);
7905 sep->tx_power = tx_pwr;
7906 sep->rssi = rssi;
7907 sep->cte_type = cte_type;
7908 sep->length = data_len_frag;
7909 memcpy(&sep->data[0], data, data_len_frag);
7912 data_len -= data_len_frag;
7927 } else if (ftr->aux_sched &&
7940 sep->data_status = data_status;
7963 phy = (bi->chm_phy[4] >> 5);
7984 sep->sync_handle = sys_cpu_to_le16(node_rx->hdr.handle);
7986 /* NOTE: both sep and bi struct store little-endian values.
7987 * Multi-byte variables extracted using
7989 * value in host-endianness, require conversion.
7991 sep->num_bis = PDU_BIG_INFO_NUM_BIS_GET(bi);
7992 sep->nse = PDU_BIG_INFO_NSE_GET(bi);
7993 sep->iso_interval =
7995 sep->bn = PDU_BIG_INFO_BN_GET(bi);
7996 sep->pto = PDU_BIG_INFO_PTO_GET(bi);
7997 sep->irc = PDU_BIG_INFO_IRC_GET(bi);
7999 sep->max_pdu = sys_cpu_to_le16(bi->max_pdu);
8001 sep->sdu_interval);
8002 sep->max_sdu = sys_cpu_to_le16(PDU_BIG_INFO_MAX_SDU_GET(bi));
8003 sep->phy = HCI_AUX_PHY_TO_HCI_PHY(bi->chm_phy[4] >> 5);
8004 sep->framing = (bi->payload_count_framing[4] >> 7) & 0x01;
8006 sep->encryption = 1U;
8008 sep->encryption = 0U;
8025 sep->handle = sys_cpu_to_le16(node_rx->hdr.handle);
8048 sync_iso = node_rx->rx_ftr.param;
8049 lll = &sync_iso->lll;
8051 evt_size = sizeof(*sep) + (lll->stream_count * sizeof(uint16_t));
8054 sep->big_handle = (uint8_t)node_rx->hdr.handle;
8063 sep->status = se->status;
8064 if (sep->status) {
8068 /* BT Core v5.4 - Vol 6, Part B, Section 4.4.6.4:
8071 * BT Core v5.4 - Vol 6, Part G, Section 3.2.1: (Framed)
8075 * BT Core v5.4 - Vol 6, Part G, Section 3.2.2: (Unframed)
8076 * Transport_Latenct_BIG = BIG_Sync_Delay + (PTO × (NSE / BN – IRC) + 1) * ISO_Interval -
8079 iso_interval_us = lll->iso_interval * ISO_INT_UNIT_US;
8080 big_sync_delay = ull_iso_big_sync_delay(lll->num_bis, lll->bis_spacing, lll->nse,
8081 lll->sub_interval, lll->phy, lll->max_pdu,
8082 lll->enc);
8083 if (lll->framing) {
8086 lll->pto * (lll->nse / lll->bn - lll->irc) *
8087 iso_interval_us + iso_interval_us + lll->sdu_interval;
8091 (lll->pto * (lll->nse / lll->bn - lll->irc) + 1) *
8092 iso_interval_us - lll->sdu_interval;
8095 sys_put_le24(transport_latency_big, sep->latency);
8096 sep->nse = lll->nse;
8097 sep->bn = lll->bn;
8098 sep->pto = lll->pto;
8099 sep->irc = lll->irc;
8100 sep->max_pdu = sys_cpu_to_le16(lll->max_pdu);
8101 sep->iso_interval = sys_cpu_to_le16(lll->iso_interval);
8102 sep->num_bis = lll->stream_count;
8105 for (uint8_t i = 0U; i < lll->stream_count; i++) {
8108 handle = LL_BIS_SYNC_HANDLE_FROM_IDX(lll->stream_handle[i]);
8109 sep->handle[i] = sys_cpu_to_le16(handle);
8125 sep->big_handle = (uint8_t)node_rx->hdr.handle;
8126 sep->reason = *((uint8_t *)pdu);
8147 sep->status = node_rx->rx_ftr.param_adv_term.status;
8148 sep->adv_handle = ll_adv_set_hci_handle_get(node_rx->hdr.handle & 0xff);
8149 sep->conn_handle =
8150 sys_cpu_to_le16(node_rx->rx_ftr.param_adv_term.conn_handle);
8151 sep->num_completed_ext_adv_evts =
8152 node_rx->rx_ftr.param_adv_term.num_events;
8165 adv_iso = node_rx->rx_ftr.param;
8166 lll = &adv_iso->lll;
8168 evt_size = sizeof(*sep) + (lll->num_bis * sizeof(uint16_t));
8172 sep->status = BT_HCI_ERR_SUCCESS;
8173 sep->big_handle = (uint8_t)node_rx->hdr.handle;
8175 if (sep->status) {
8180 sys_put_le24(0, sep->sync_delay);
8181 sys_put_le24(0, sep->latency);
8183 sep->phy = find_lsb_set(lll->phy);
8184 sep->nse = lll->nse;
8185 sep->bn = lll->bn;
8186 sep->pto = lll->pto;
8187 sep->irc = lll->irc;
8188 sep->max_pdu = sys_cpu_to_le16(lll->max_pdu);
8189 sep->num_bis = lll->num_bis;
8192 for (uint8_t i = 0U; i < lll->num_bis; i++) {
8195 handle = LL_BIS_ADV_HANDLE_FROM_IDX(lll->stream_handle[i]);
8196 sep->handle[i] = sys_cpu_to_le16(handle);
8212 sep->big_handle = (uint8_t)node_rx->hdr.handle;
8213 sep->reason = *((uint8_t *)pdu);
8238 handle = ll_adv_set_hci_handle_get(node_rx->hdr.handle & 0xff);
8239 addr.type = adv->tx_addr;
8240 memcpy(&addr.a.val[0], &adv->scan_req.scan_addr[0],
8244 rssi = -(node_rx->rx_ftr.rssi);
8252 sep->handle = ll_adv_set_hci_handle_get(node_rx->hdr.handle & 0xff);
8253 sep->addr.type = adv->tx_addr;
8254 memcpy(&sep->addr.a.val[0], &adv->scan_req.scan_addr[0],
8258 rl_idx = node_rx->rx_ftr.rl_idx;
8261 ll_rl_id_addr_get(rl_idx, &sep->addr.type,
8262 &sep->addr.a.val[0]);
8264 MARK_AS_IDENTITY_ADDR(sep->addr.type);
8269 sep->addr.type = adv->tx_addr;
8270 memcpy(&sep->addr.a.val[0], &adv->adv_ind.addr[0],
8293 sep->addr.type = adv->tx_addr;
8294 memcpy(&sep->addr.a.val[0], &adv->scan_req.scan_addr[0],
8298 rl_idx = node_rx->rx_ftr.rl_idx;
8301 ll_rl_id_addr_get(rl_idx, &sep->addr.type,
8302 &sep->addr.a.val[0]);
8304 MARK_AS_IDENTITY_ADDR(sep->addr.type);
8309 sep->addr.type = adv->tx_addr;
8310 memcpy(&sep->addr.a.val[0], &adv->adv_ind.addr[0],
8315 sep->rssi = -(node_rx->rx_ftr.rssi);
8336 status = cc->status;
8341 ll_rl_crpa_set(cc->peer_addr_type,
8342 &cc->peer_addr[0], 0xff,
8343 &cc->peer_rpa[0]);
8370 leecc->status = status;
8374 leecc->status = 0x00;
8375 leecc->handle = sys_cpu_to_le16(handle);
8376 leecc->role = cc->role;
8378 leecc->peer_addr.type = cc->peer_addr_type;
8379 memcpy(&leecc->peer_addr.a.val[0], &cc->peer_addr[0],
8383 memcpy(&leecc->local_rpa.val[0], &cc->local_rpa[0],
8385 memcpy(&leecc->peer_rpa.val[0], &cc->peer_rpa[0],
8388 memset(&leecc->local_rpa.val[0], 0, BDADDR_SIZE);
8389 memset(&leecc->peer_rpa.val[0], 0, BDADDR_SIZE);
8392 leecc->interval = sys_cpu_to_le16(cc->interval);
8393 leecc->latency = sys_cpu_to_le16(cc->latency);
8394 leecc->supv_timeout = sys_cpu_to_le16(cc->timeout);
8395 leecc->clock_accuracy = cc->sca;
8404 lecc->status = status;
8408 lecc->status = 0x00;
8409 lecc->handle = sys_cpu_to_le16(handle);
8410 lecc->role = cc->role;
8411 lecc->peer_addr.type = cc->peer_addr_type & 0x1;
8412 memcpy(&lecc->peer_addr.a.val[0], &cc->peer_addr[0], BDADDR_SIZE);
8413 lecc->interval = sys_cpu_to_le16(cc->interval);
8414 lecc->latency = sys_cpu_to_le16(cc->latency);
8415 lecc->supv_timeout = sys_cpu_to_le16(cc->timeout);
8416 lecc->clock_accuracy = cc->sca;
8431 ep->status = 0x00;
8432 ep->handle = sys_cpu_to_le16(handle);
8433 ep->reason = *((uint8_t *)pdu_data);
8449 conn_count--;
8473 sep->status = cu->status;
8474 sep->handle = sys_cpu_to_le16(handle);
8475 sep->interval = sys_cpu_to_le16(cu->interval);
8476 sep->latency = sys_cpu_to_le16(cu->latency);
8477 sep->supv_timeout = sys_cpu_to_le16(cu->timeout);
8494 ep->status = 0x00;
8495 ep->handle = sys_cpu_to_le16(handle);
8512 ep->handle = sys_cpu_to_le16(handle);
8521 struct node_rx_cs *cs; local
8523 cs = (void *)pdu_data;
8527 LOG_DBG("handle: 0x%04x, CSA: %x.", handle, cs->csa);
8533 sep->handle = sys_cpu_to_le16(handle);
8534 sep->chan_sel_algo = cs->csa;
8549 LOG_WRN("handle: 0x%04x, status: %x, tx: %x, rx: %x.", handle, pu->status,
8550 find_lsb_set(pu->tx), find_lsb_set(pu->rx));
8556 sep->status = pu->status;
8557 sep->handle = sys_cpu_to_le16(handle);
8558 sep->tx_phy = find_lsb_set(pu->tx);
8559 sep->rx_phy = find_lsb_set(pu->rx);
8575 scau->status,
8576 scau->sca);
8582 sep->status = scau->status;
8583 sep->handle = sys_cpu_to_le16(handle);
8584 sep->sca = scau->sca;
8597 mep->adv_slot = ((uint8_t *)pdu_data)[0];
8602 * @brief Encode a control-PDU into an HCI buffer
8606 * @param pdu_data[in] PDU. Same as node_rx_pdu->pdu, but more convenient
8607 * @param net_buf[out] Upwards-going HCI buffer to fill
8614 handle = node_rx->hdr.handle;
8616 switch (node_rx->hdr.type) {
8749 LOG_INF("handle: 0x%04x, rssi: -%d dB.", handle, pdu_data->rssi);
8797 pdu_data->profile.lcur, pdu_data->profile.lmin, pdu_data->profile.lmax,
8798 pdu_data->profile.cur, pdu_data->profile.min, pdu_data->profile.max,
8799 pdu_data->profile.radio, pdu_data->profile.radio_ticks,
8800 pdu_data->profile.lll, pdu_data->profile.lll_ticks,
8801 pdu_data->profile.ull_high, pdu_data->profile.ull_high_ticks,
8802 pdu_data->profile.ull_low, pdu_data->profile.ull_low_ticks);
8823 case NODE_RX_TYPE_USER_START ... NODE_RX_TYPE_USER_END - 1:
8847 sep->handle = sys_cpu_to_le16(handle);
8848 memcpy(&sep->rand, pdu_data->llctrl.enc_req.rand, sizeof(uint64_t));
8849 memcpy(&sep->ediv, pdu_data->llctrl.enc_req.ediv, sizeof(uint16_t));
8864 ep->status = err ? err : (encryption_on ? err : BT_HCI_ERR_UNSPECIFIED);
8865 ep->handle = sys_cpu_to_le16(handle);
8866 ep->encrypt = encryption_on ? 1 : 0;
8882 sep->status = status;
8883 sep->handle = sys_cpu_to_le16(handle);
8885 memcpy(&sep->features[0],
8886 &pdu_data->llctrl.feature_rsp.features[0],
8887 sizeof(sep->features));
8889 (void)memset(&sep->features[0], 0x00, sizeof(sep->features));
8897 switch (pdu_data->llctrl.unknown_rsp.type) {
8908 LOG_WRN("type: 0x%02x", pdu_data->llctrl.unknown_rsp.type);
8915 switch (pdu->llctrl.reject_ext_ind.reject_opcode) {
8918 le_df_cte_req_failed(pdu->llctrl.reject_ext_ind.error_code, handle, buf);
8922 LOG_WRN("reject opcode: 0x%02x", pdu->llctrl.reject_ext_ind.reject_opcode);
8943 sep->handle = sys_cpu_to_le16(handle);
8944 sep->interval_min = pdu_data->llctrl.conn_param_req.interval_min;
8945 sep->interval_max = pdu_data->llctrl.conn_param_req.interval_max;
8946 sep->latency = pdu_data->llctrl.conn_param_req.latency;
8947 sep->timeout = pdu_data->llctrl.conn_param_req.timeout;
8964 sep->handle = sys_cpu_to_le16(handle);
8965 sep->max_tx_octets = pdu_data->llctrl.length_rsp.max_tx_octets;
8966 sep->max_tx_time = pdu_data->llctrl.length_rsp.max_tx_time;
8967 sep->max_rx_octets = pdu_data->llctrl.length_rsp.max_rx_octets;
8968 sep->max_rx_time = pdu_data->llctrl.length_rsp.max_rx_time;
8986 ver_ind = &pdu_data->llctrl.version_ind;
8987 ep->status = 0x00;
8988 ep->handle = sys_cpu_to_le16(handle);
8989 ep->version = ver_ind->version_number;
8990 ep->manufacturer = ver_ind->company_id;
8991 ep->subversion = ver_ind->sub_version_number;
8998 uint16_t handle = node_rx->hdr.handle;
9000 switch (pdu_data->llctrl.opcode) {
9024 encrypt_change(pdu_data->llctrl.reject_ind.error_code, handle,
9065 struct pdu_data *pdu_data = (void *)node_rx->pdu;
9071 handle = node_rx->hdr.handle;
9073 switch (pdu_data->ll_id) {
9077 if (pdu_data->ll_id == PDU_DATA_LLID_DATA_START) {
9082 acl->handle = sys_cpu_to_le16(handle_flags);
9083 acl->len = sys_cpu_to_le16(pdu_data->len);
9084 data = (void *)net_buf_add(buf, pdu_data->len);
9085 memcpy(data, pdu_data->lldata, pdu_data->len);
9088 LL_ASSERT((hci_hbuf_sent - hci_hbuf_acked) <
9109 struct pdu_data *pdu_data = (void *)node_rx->pdu;
9111 if (node_rx->hdr.type != NODE_RX_TYPE_DC_PDU) {
9133 ep->num_handles = num_handles;
9134 hc = &ep->h[0];
9135 hc->handle = sys_cpu_to_le16(handle);
9136 hc->count = sys_cpu_to_le16(num);
9143 struct pdu_data *pdu_data = (void *)node_rx->pdu;
9146 if (node_rx->hdr.type != NODE_RX_TYPE_DC_PDU) {
9148 switch (node_rx->hdr.type) {
9278 case NODE_RX_TYPE_USER_START ... NODE_RX_TYPE_USER_END - 1:
9287 } else if (pdu_data->ll_id == PDU_DATA_LLID_CTRL) {