amp.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. Copyright (c) 2011,2012 Intel Corp.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License version 2 and
  5. only version 2 as published by the Free Software Foundation.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. */
  11. #include <net/bluetooth/bluetooth.h>
  12. #include <net/bluetooth/hci.h>
  13. #include <net/bluetooth/hci_core.h>
  14. #include <net/bluetooth/a2mp.h>
  15. #include <net/bluetooth/amp.h>
  16. void amp_read_loc_assoc_frag(struct hci_dev *hdev, u8 phy_handle)
  17. {
  18. struct hci_cp_read_local_amp_assoc cp;
  19. struct amp_assoc *loc_assoc = &hdev->loc_assoc;
  20. BT_DBG("%s handle %d", hdev->name, phy_handle);
  21. cp.phy_handle = phy_handle;
  22. cp.max_len = cpu_to_le16(hdev->amp_assoc_size);
  23. cp.len_so_far = cpu_to_le16(loc_assoc->offset);
  24. hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_ASSOC, sizeof(cp), &cp);
  25. }
  26. void amp_read_loc_assoc(struct hci_dev *hdev, struct amp_mgr *mgr)
  27. {
  28. struct hci_cp_read_local_amp_assoc cp;
  29. memset(&hdev->loc_assoc, 0, sizeof(struct amp_assoc));
  30. memset(&cp, 0, sizeof(cp));
  31. cp.max_len = cpu_to_le16(hdev->amp_assoc_size);
  32. mgr->state = READ_LOC_AMP_ASSOC;
  33. hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_ASSOC, sizeof(cp), &cp);
  34. }