blob: 391acd7a67d4a70a08009047d4945e765193a268 [file] [log] [blame]
Andrei Emeltchenko9740e492012-05-29 13:59:02 +03001/*
2 Copyright (c) 2010,2011 Code Aurora Forum. All rights reserved.
3 Copyright (c) 2011,2012 Intel Corp.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License version 2 and
7 only version 2 as published by the Free Software Foundation.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13*/
14
15#ifndef __A2MP_H
16#define __A2MP_H
17
18struct amp_mgr {
19 struct l2cap_conn *l2cap_conn;
20 struct l2cap_chan *a2mp_chan;
21 struct kref kref;
22 __u8 ident;
23 __u8 handle;
24 unsigned long flags;
25};
26
Andrei Emeltchenkof6d3c6e2012-05-29 13:59:03 +030027struct a2mp_cmd {
28 __u8 code;
29 __u8 ident;
30 __le16 len;
31 __u8 data[0];
32} __packed;
33
Andrei Emeltchenkob9058fb2012-05-29 13:59:05 +030034/* A2MP command codes */
35#define A2MP_COMMAND_REJ 0x01
36struct a2mp_cmd_rej {
37 __le16 reason;
38 __u8 data[0];
39} __packed;
40
41#define A2MP_DISCOVER_REQ 0x02
42struct a2mp_discov_req {
43 __le16 mtu;
44 __le16 ext_feat;
45} __packed;
46
47struct a2mp_cl {
48 __u8 id;
49 __u8 type;
50 __u8 status;
51} __packed;
52
53#define A2MP_DISCOVER_RSP 0x03
54struct a2mp_discov_rsp {
55 __le16 mtu;
56 __le16 ext_feat;
57 struct a2mp_cl cl[0];
58} __packed;
59
60#define A2MP_CHANGE_NOTIFY 0x04
61#define A2MP_CHANGE_RSP 0x05
62
63#define A2MP_GETINFO_REQ 0x06
64struct a2mp_info_req {
65 __u8 id;
66} __packed;
67
68#define A2MP_GETINFO_RSP 0x07
69struct a2mp_info_rsp {
70 __u8 id;
71 __u8 status;
72 __le32 total_bw;
73 __le32 max_bw;
74 __le32 min_latency;
75 __le16 pal_cap;
76 __le16 assoc_size;
77} __packed;
78
79#define A2MP_GETAMPASSOC_REQ 0x08
80struct a2mp_amp_assoc_req {
81 __u8 id;
82} __packed;
83
84#define A2MP_GETAMPASSOC_RSP 0x09
85struct a2mp_amp_assoc_rsp {
86 __u8 id;
87 __u8 status;
88 __u8 amp_assoc[0];
89} __packed;
90
91#define A2MP_CREATEPHYSLINK_REQ 0x0A
92#define A2MP_DISCONNPHYSLINK_REQ 0x0C
93struct a2mp_physlink_req {
94 __u8 local_id;
95 __u8 remote_id;
96 __u8 amp_assoc[0];
97} __packed;
98
99#define A2MP_CREATEPHYSLINK_RSP 0x0B
100#define A2MP_DISCONNPHYSLINK_RSP 0x0D
101struct a2mp_physlink_rsp {
102 __u8 local_id;
103 __u8 remote_id;
104 __u8 status;
105} __packed;
106
Andrei Emeltchenkoe7af522e2012-05-29 13:59:06 +0300107/* A2MP response status */
108#define A2MP_STATUS_SUCCESS 0x00
109#define A2MP_STATUS_INVALID_CTRL_ID 0x01
110#define A2MP_STATUS_UNABLE_START_LINK_CREATION 0x02
111#define A2MP_STATUS_NO_PHYSICAL_LINK_EXISTS 0x02
112#define A2MP_STATUS_COLLISION_OCCURED 0x03
113#define A2MP_STATUS_DISCONN_REQ_RECVD 0x04
114#define A2MP_STATUS_PHYS_LINK_EXISTS 0x05
115#define A2MP_STATUS_SECURITY_VIOLATION 0x06
116
Andrei Emeltchenko9740e492012-05-29 13:59:02 +0300117void amp_mgr_get(struct amp_mgr *mgr);
118int amp_mgr_put(struct amp_mgr *mgr);
119
120#endif /* __A2MP_H */