OSDN Git Service

build: Add --enable-midi to bootstrap-configure
[android-x86/external-bluetooth-bluez.git] / lib / a2mp.h
1 /*
2  *
3  *  BlueZ - Bluetooth protocol stack for Linux
4  *
5  *  Copyright (C) 2012  Intel Corporation. All rights reserved.
6  *  Copyright (c) 2012  Code Aurora Forum. All rights reserved.
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21  *
22  */
23
24 #ifndef __A2MP_H
25 #define __A2MP_H
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 /* A2MP Protocol */
32
33 /* A2MP command codes */
34
35 #define A2MP_COMMAND_REJ        0x01
36 #define A2MP_DISCOVER_REQ       0x02
37 #define A2MP_DISCOVER_RSP       0x03
38 #define A2MP_CHANGE_NOTIFY      0x04
39 #define A2MP_CHANGE_RSP         0x05
40 #define A2MP_INFO_REQ           0x06
41 #define A2MP_INFO_RSP           0x07
42 #define A2MP_ASSOC_REQ          0x08
43 #define A2MP_ASSOC_RSP          0x09
44 #define A2MP_CREATE_REQ         0x0a
45 #define A2MP_CREATE_RSP         0x0b
46 #define A2MP_DISCONN_REQ        0x0c
47 #define A2MP_DISCONN_RSP        0x0d
48
49 struct a2mp_hdr {
50         uint8_t         code;
51         uint8_t         ident;
52         uint16_t        len;
53 } __attribute__ ((packed));
54 #define A2MP_HDR_SIZE 4
55
56 struct a2mp_command_rej {
57         uint16_t        reason;
58 } __attribute__ ((packed));
59
60 struct a2mp_discover_req {
61         uint16_t        mtu;
62         uint16_t        mask;
63 } __attribute__ ((packed));
64
65 struct a2mp_ctrl {
66         uint8_t         id;
67         uint8_t         type;
68         uint8_t         status;
69 } __attribute__ ((packed));
70
71 struct a2mp_discover_rsp {
72         uint16_t        mtu;
73         uint16_t        mask;
74         struct a2mp_ctrl ctrl_list[0];
75 } __attribute__ ((packed));
76
77 struct a2mp_info_req {
78         uint8_t         id;
79 } __attribute__ ((packed));
80
81 struct a2mp_info_rsp {
82         uint8_t         id;
83         uint8_t         status;
84         uint32_t        total_bw;
85         uint32_t        max_bw;
86         uint32_t        min_latency;
87         uint16_t        pal_caps;
88         uint16_t        assoc_size;
89 } __attribute__ ((packed));
90
91 struct a2mp_assoc_req {
92         uint8_t         id;
93 } __attribute__ ((packed));
94
95 struct a2mp_assoc_rsp {
96         uint8_t         id;
97         uint8_t         status;
98         uint8_t         assoc_data[0];
99 } __attribute__ ((packed));
100
101 struct a2mp_create_req {
102         uint8_t         local_id;
103         uint8_t         remote_id;
104         uint8_t         assoc_data[0];
105 } __attribute__ ((packed));
106
107 struct a2mp_create_rsp {
108         uint8_t         local_id;
109         uint8_t         remote_id;
110         uint8_t         status;
111 } __attribute__ ((packed));
112
113 struct a2mp_disconn_req {
114         uint8_t         local_id;
115         uint8_t         remote_id;
116 } __attribute__ ((packed));
117
118 struct a2mp_disconn_rsp {
119         uint8_t         local_id;
120         uint8_t         remote_id;
121         uint8_t         status;
122 } __attribute__ ((packed));
123
124 #define A2MP_COMMAND_NOT_RECOGNIZED 0x0000
125
126 /* AMP controller status */
127 #define AMP_CTRL_POWERED_DOWN           0x00
128 #define AMP_CTRL_BLUETOOTH_ONLY         0x01
129 #define AMP_CTRL_NO_CAPACITY            0x02
130 #define AMP_CTRL_LOW_CAPACITY           0x03
131 #define AMP_CTRL_MEDIUM_CAPACITY        0x04
132 #define AMP_CTRL_HIGH_CAPACITY          0x05
133 #define AMP_CTRL_FULL_CAPACITY          0x06
134
135 /* A2MP response status */
136 #define A2MP_STATUS_SUCCESS                             0x00
137 #define A2MP_STATUS_INVALID_CTRL_ID                     0x01
138 #define A2MP_STATUS_UNABLE_START_LINK_CREATION          0x02
139 #define A2MP_STATUS_NO_PHYSICAL_LINK_EXISTS             0x02
140 #define A2MP_STATUS_COLLISION_OCCURED                   0x03
141 #define A2MP_STATUS_DISCONN_REQ_RECVD                   0x04
142 #define A2MP_STATUS_PHYS_LINK_EXISTS                    0x05
143 #define A2MP_STATUS_SECURITY_VIOLATION                  0x06
144
145 #ifdef __cplusplus
146 }
147 #endif
148
149 #endif /* __A2MP_H */