diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2012-09-27 10:26:11 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-09-27 16:11:52 -0400 |
commit | 3161ae1c72f03b021bc67504c13025626c26d30c (patch) | |
tree | dc75cc7e2ddb341aec63cbbabccbc31eb6bbfa13 /net/bluetooth | |
parent | aa09537d80bf7e6282103618eb496f03e76f2953 (diff) |
Bluetooth: AMP: Physical link struct and helpers
Define physical link structures. Physical links are represented by
hci_conn structure. For BR/EDR we use type ACL_LINK and for AMP
we use AMP_LINK.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/amp.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c index 2d4e79ee06a5..50a7b2fb8bf3 100644 --- a/net/bluetooth/amp.c +++ b/net/bluetooth/amp.c | |||
@@ -17,6 +17,35 @@ | |||
17 | #include <net/bluetooth/a2mp.h> | 17 | #include <net/bluetooth/a2mp.h> |
18 | #include <net/bluetooth/amp.h> | 18 | #include <net/bluetooth/amp.h> |
19 | 19 | ||
20 | /* Physical Link interface */ | ||
21 | static u8 __next_handle(struct amp_mgr *mgr) | ||
22 | { | ||
23 | if (++mgr->handle == 0) | ||
24 | mgr->handle = 1; | ||
25 | |||
26 | return mgr->handle; | ||
27 | } | ||
28 | |||
29 | struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr, | ||
30 | u8 remote_id) | ||
31 | { | ||
32 | bdaddr_t *dst = mgr->l2cap_conn->dst; | ||
33 | struct hci_conn *hcon; | ||
34 | |||
35 | hcon = hci_conn_add(hdev, AMP_LINK, dst); | ||
36 | if (!hcon) | ||
37 | return NULL; | ||
38 | |||
39 | hcon->state = BT_CONNECT; | ||
40 | hcon->out = true; | ||
41 | hcon->attempt++; | ||
42 | hcon->handle = __next_handle(mgr); | ||
43 | hcon->remote_id = remote_id; | ||
44 | hcon->amp_mgr = mgr; | ||
45 | |||
46 | return hcon; | ||
47 | } | ||
48 | |||
20 | void amp_read_loc_assoc_frag(struct hci_dev *hdev, u8 phy_handle) | 49 | void amp_read_loc_assoc_frag(struct hci_dev *hdev, u8 phy_handle) |
21 | { | 50 | { |
22 | struct hci_cp_read_local_amp_assoc cp; | 51 | struct hci_cp_read_local_amp_assoc cp; |