Home | History | Annotate | Download | only in hw

Lines Matching refs:handle

61         } handle[HCI_HANDLES_MAX];
84 uint16_t handle; /* Local */
616 static inline int bt_hci_handle_bad(struct bt_hci_s *hci, uint16_t handle)
618 return !(handle & HCI_HANDLE_OFFSET) ||
619 handle >= (HCI_HANDLE_OFFSET | HCI_HANDLES_MAX) ||
620 !hci->lm.handle[handle & ~HCI_HANDLE_OFFSET].link;
623 static inline int bt_hci_role_master(struct bt_hci_s *hci, uint16_t handle)
625 return !!(hci->lm.role_bmp & (1 << (handle & ~HCI_HANDLE_OFFSET)));
629 uint16_t handle)
631 struct bt_link_s *link = hci->lm.handle[handle & ~HCI_HANDLE_OFFSET].link;
633 return bt_hci_role_master(hci, handle) ? link->slave : link->host;
640 hci->lm.handle[hci->lm.last_handle].link = link;
646 hci->lm.handle[hci->lm.last_handle].lmp_acl_data =
652 hci->lm.handle[hci->lm.last_handle].lmp_acl_data =
659 hci->lm.handle[hci->lm.last_handle].acl_mode_timer =
664 static void bt_hci_lmp_link_teardown(struct bt_hci_s *hci, uint16_t handle)
666 handle &= ~HCI_HANDLE_OFFSET;
667 hci->lm.handle[handle].link = NULL;
669 if (bt_hci_role_master(hci, handle)) {
670 qemu_del_timer(hci->lm.handle[handle].acl_mode_timer);
671 qemu_free_timer(hci->lm.handle[handle].acl_mode_timer);
714 params.handle = 0;
726 uint16_t handle;
730 /* Make a connection handle */
732 while (hci->lm.handle[++ hci->lm.last_handle].link && -- tries)
734 handle = hci->lm.last_handle | HCI_HANDLE_OFFSET;
735 } while ((handle == hci->asb_handle || handle == hci->psb_handle) &&
747 link->handle = handle;
754 params.handle = HNDL(handle);
830 uint16_t handle;
837 handle = 0;
843 handle = 0;
848 /* Make a connection handle */
850 while (hci->lm.handle[++ hci->lm.last_handle].link && -- tries)
852 handle = hci->lm.last_handle | HCI_HANDLE_OFFSET;
853 } while ((handle == hci->asb_handle || handle == hci->psb_handle) &&
863 link->handle = handle;
868 params.handle = HNDL(handle);
876 uint16_t handle, int reason)
879 hci->lm.handle[handle & ~HCI_HANDLE_OFFSET].link;
883 if (bt_hci_role_master(hci, handle)) {
899 bt_hci_lmp_link_teardown(hci, handle);
902 params.handle = HNDL(handle);
912 uint16_t handle = link->handle;
915 bt_hci_lmp_link_teardown(hci, handle);
918 params.handle = HNDL(handle);
928 uint16_t handle = link->handle;
933 bt_hci_lmp_link_teardown(hci, handle);
936 params.handle = HNDL(handle);
967 static int bt_hci_features_req(struct bt_hci_s *hci, uint16_t handle)
972 if (bt_hci_handle_bad(hci, handle))
975 slave = bt_hci_remote_dev(hci, handle);
980 params.handle = HNDL(handle);
995 static int bt_hci_version_req(struct bt_hci_s *hci, uint16_t handle)
999 if (bt_hci_handle_bad(hci, handle))
1002 bt_hci_remote_dev(hci, handle);
1007 params.handle = HNDL(handle);
1017 static int bt_hci_clkoffset_req(struct bt_hci_s *hci, uint16_t handle)
1022 if (bt_hci_handle_bad(hci, handle))
1025 slave = bt_hci_remote_dev(hci, handle);
1030 params.handle = HNDL(handle);
1040 uint16_t handle)
1044 .handle = HNDL(handle),
1058 bt_hci_event_mode(hci, link, link->handle);
1068 bt_hci_event_mode(hci, btlink, link->handle);
1071 static int bt_hci_mode_change(struct bt_hci_s *hci, uint16_t handle,
1076 if (bt_hci_handle_bad(hci, handle) || !bt_hci_role_master(hci, handle))
1079 link = &hci->lm.handle[handle & ~HCI_HANDLE_OFFSET];
1094 static int bt_hci_mode_cancel(struct bt_hci_s *hci, uint16_t handle, int mode)
1098 if (bt_hci_handle_bad(hci, handle) || !bt_hci_role_master(hci, handle))
1101 link = &hci->lm.handle[handle & ~HCI_HANDLE_OFFSET];
1269 static int bt_hci_link_quality_rp(struct bt_hci_s *hci, uint16_t handle)
1273 .handle = HNDL(handle),
1277 if (bt_hci_handle_bad(hci, handle))
1303 uint16_t handle)
1307 .handle = HNDL(handle),
1314 uint16_t handle, uint8_t mode)
1318 .handle = HNDL(handle),
1337 uint16_t handle)
1341 .handle = HNDL(handle),
1350 uint16_t handle)
1354 .handle = HNDL(handle),
1363 int status, uint16_t handle, int master)
1367 .handle = HNDL(handle),
1375 int status, uint16_t handle)
1379 .handle = HNDL(handle),
1451 uint16_t handle, int packets)
1457 params->connection->handle = HNDL(handle);
1488 #define PARAMHANDLE(cmd) HNDL(PARAM(cmd, handle))
1596 if (bt_hci_role_master(hci, i) && hci->lm.handle[i].link &&
1597 !bacmp(&hci->lm.handle[i].link->slave->bd_addr,
1808 &PARAM(flush, handle),
1970 static inline void bt_hci_lmp_acl_data(struct bt_hci_s *hci, uint16_t handle,
1985 pkt->handle = cpu_to_le16(
1986 acl_handle_pack(handle, start ? ACL_START : ACL_CONT));
1998 link->handle, data, start, len);
2005 link->handle, data, start, len);
2012 uint16_t handle;
2022 handle = acl_handle((data[1] << 8) | data[0]);
2028 if (bt_hci_handle_bad(hci, handle)) {
2029 fprintf(stderr, "%s: invalid ACL handle %03x\n",
2030 __FUNCTION__, handle);
2034 handle &= ~HCI_HANDLE_OFFSET;
2042 link = hci->lm.handle[handle].link;
2046 hci->asb_handle = handle;
2047 else if (handle != hci->asb_handle) {
2048 fprintf(stderr, "%s: Bad handle %03x in Active Slave Broadcast\n",
2049 __FUNCTION__, handle);
2059 hci->psb_handle = handle;
2060 else if (handle != hci->psb_handle) {
2061 fprintf(stderr, "%s: Bad handle %03x in Parked Slave Broadcast\n",
2062 __FUNCTION__, handle);
2071 bt_hci_event_num_comp_pkts(hci, handle | HCI_HANDLE_OFFSET, 1);
2074 hci->lm.handle[handle].lmp_acl_data(link, data,
2082 uint16_t handle;
2088 handle = acl_handle((data[1] << 8) | data[0]);
2092 if (bt_hci_handle_bad(hci, handle)) {
2093 fprintf(stderr, "%s: invalid SCO handle %03x\n",
2094 __FUNCTION__, handle);
2186 int handle;
2202 for (handle = HCI_HANDLE_OFFSET;
2203 handle < (HCI_HANDLE_OFFSET | HCI_HANDLES_MAX); handle ++)
2204 if (!bt_hci_handle_bad(hci, handle))
2205 bt_hci_disconnect(hci, handle, HCI_OE_POWER_OFF);