blob: 8d454180ec11ad3d3286d038daf7ebf377a3692a [file] [log] [blame]
The Android Open Source Project5738f832012-12-12 16:00:35 -08001/******************************************************************************
2 *
3 * Copyright (C) 2002-2012 Broadcom Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 ******************************************************************************/
18
19/******************************************************************************
20 *
21 * This file contains interfaces which are internal to AVDTP.
22 *
23 ******************************************************************************/
24#ifndef AVDT_INT_H
25#define AVDT_INT_H
26
Myles Watson911d1ae2016-11-28 16:44:40 -080027#include "avdt_api.h"
28#include "avdt_defs.h"
29#include "avdtc_api.h"
30#include "bt_common.h"
31#include "btm_api.h"
32#include "l2c_api.h"
Pavlin Radoslavov78bcff72015-12-04 17:36:34 -080033#include "osi/include/alarm.h"
Pavlin Radoslavov1a3844f2015-09-25 11:21:15 -070034#include "osi/include/fixed_queue.h"
The Android Open Source Project5738f832012-12-12 16:00:35 -080035
36#ifndef AVDT_DEBUG
Pavlin Radoslavov5ce01162016-12-05 13:02:26 -080037#define AVDT_DEBUG FALSE
The Android Open Source Project5738f832012-12-12 16:00:35 -080038#endif
The Android Open Source Project5738f832012-12-12 16:00:35 -080039
40/*****************************************************************************
Myles Watsonee96a3c2016-11-23 14:49:54 -080041 * constants
42 ****************************************************************************/
The Android Open Source Project5738f832012-12-12 16:00:35 -080043
44/* channel types */
45enum {
Myles Watson911d1ae2016-11-28 16:44:40 -080046 AVDT_CHAN_SIG, /* signaling channel */
47 AVDT_CHAN_MEDIA, /* media channel */
Marie Janssend19e0782016-07-15 12:48:27 -070048#if (AVDT_REPORTING == TRUE)
Myles Watson911d1ae2016-11-28 16:44:40 -080049 AVDT_CHAN_REPORT, /* reporting channel */
The Android Open Source Project5738f832012-12-12 16:00:35 -080050#endif
Myles Watson911d1ae2016-11-28 16:44:40 -080051 AVDT_CHAN_NUM_TYPES
The Android Open Source Project5738f832012-12-12 16:00:35 -080052};
53
54/* protocol service capabilities of this AVDTP implementation */
The Android Open Source Project5738f832012-12-12 16:00:35 -080055#if (AVDT_REPORTING == TRUE)
Myles Watson911d1ae2016-11-28 16:44:40 -080056#define AVDT_PSC (AVDT_PSC_TRANS | AVDT_PSC_REPORT | AVDT_PSC_DELAY_RPT)
57#define AVDT_LEG_PSC (AVDT_PSC_TRANS | AVDT_PSC_REPORT)
The Android Open Source Project5738f832012-12-12 16:00:35 -080058#else /* AVDT_REPORTING */
Myles Watson911d1ae2016-11-28 16:44:40 -080059#define AVDT_PSC (AVDT_PSC_TRANS | AVDT_PSC_DELAY_RPT)
60#define AVDT_LEG_PSC (AVDT_PSC_TRANS)
The Android Open Source Project5738f832012-12-12 16:00:35 -080061#endif /* AVDT_REPORTING */
62
The Android Open Source Project5738f832012-12-12 16:00:35 -080063/* initiator/acceptor signaling roles */
Myles Watson911d1ae2016-11-28 16:44:40 -080064#define AVDT_CLOSE_ACP 0
65#define AVDT_CLOSE_INT 1
66#define AVDT_OPEN_ACP 2
67#define AVDT_OPEN_INT 3
The Android Open Source Project5738f832012-12-12 16:00:35 -080068
69/* states for avdt_scb_verify */
Myles Watson911d1ae2016-11-28 16:44:40 -080070#define AVDT_VERIFY_OPEN 0
71#define AVDT_VERIFY_STREAMING 1
72#define AVDT_VERIFY_SUSPEND 2
73#define AVDT_VERIFY_START 3
The Android Open Source Project5738f832012-12-12 16:00:35 -080074
75/* to distinguish CCB events from SCB events */
Myles Watson911d1ae2016-11-28 16:44:40 -080076#define AVDT_CCB_MKR 0x80
The Android Open Source Project5738f832012-12-12 16:00:35 -080077
The Android Open Source Project5738f832012-12-12 16:00:35 -080078/* offset where AVDTP signaling message content starts;
Myles Watsonee96a3c2016-11-23 14:49:54 -080079 * use the size of a start header since it's the largest possible
80 * layout of signaling message in a buffer is:
81 *
82 * | BT_HDR | SCB handles | L2CAP + HCI header | AVDTP header | data ... |
83 *
84 * Note that we "hide" the scb handles at the top of the message buffer.
The Android Open Source Project5738f832012-12-12 16:00:35 -080085*/
Myles Watson911d1ae2016-11-28 16:44:40 -080086#define AVDT_MSG_OFFSET (L2CAP_MIN_OFFSET + AVDT_NUM_SEPS + AVDT_LEN_TYPE_START)
The Android Open Source Project5738f832012-12-12 16:00:35 -080087
Pavlin Radoslavov78bcff72015-12-04 17:36:34 -080088/* scb transport channel connect timeout value (in milliseconds) */
Myles Watson911d1ae2016-11-28 16:44:40 -080089#define AVDT_SCB_TC_CONN_TIMEOUT_MS (10 * 1000)
The Android Open Source Project5738f832012-12-12 16:00:35 -080090
Pavlin Radoslavov78bcff72015-12-04 17:36:34 -080091/* scb transport channel disconnect timeout value (in milliseconds) */
Myles Watson911d1ae2016-11-28 16:44:40 -080092#define AVDT_SCB_TC_DISC_TIMEOUT_MS (10 * 1000)
The Android Open Source Project5738f832012-12-12 16:00:35 -080093
94/* maximum number of command retransmissions */
95#ifndef AVDT_RET_MAX
Myles Watson911d1ae2016-11-28 16:44:40 -080096#define AVDT_RET_MAX 1
The Android Open Source Project5738f832012-12-12 16:00:35 -080097#endif
98
The Android Open Source Project5738f832012-12-12 16:00:35 -080099/* ccb state machine states */
100enum {
Myles Watson911d1ae2016-11-28 16:44:40 -0800101 AVDT_CCB_IDLE_ST,
102 AVDT_CCB_OPENING_ST,
103 AVDT_CCB_OPEN_ST,
104 AVDT_CCB_CLOSING_ST
The Android Open Source Project5738f832012-12-12 16:00:35 -0800105};
106
107/* state machine action enumeration list */
108enum {
Myles Watson911d1ae2016-11-28 16:44:40 -0800109 AVDT_CCB_CHAN_OPEN,
110 AVDT_CCB_CHAN_CLOSE,
111 AVDT_CCB_CHK_CLOSE,
112 AVDT_CCB_HDL_DISCOVER_CMD,
113 AVDT_CCB_HDL_DISCOVER_RSP,
114 AVDT_CCB_HDL_GETCAP_CMD,
115 AVDT_CCB_HDL_GETCAP_RSP,
116 AVDT_CCB_HDL_START_CMD,
117 AVDT_CCB_HDL_START_RSP,
118 AVDT_CCB_HDL_SUSPEND_CMD,
119 AVDT_CCB_HDL_SUSPEND_RSP,
120 AVDT_CCB_SND_DISCOVER_CMD,
121 AVDT_CCB_SND_DISCOVER_RSP,
122 AVDT_CCB_SND_GETCAP_CMD,
123 AVDT_CCB_SND_GETCAP_RSP,
124 AVDT_CCB_SND_START_CMD,
125 AVDT_CCB_SND_START_RSP,
126 AVDT_CCB_SND_SUSPEND_CMD,
127 AVDT_CCB_SND_SUSPEND_RSP,
128 AVDT_CCB_CLEAR_CMDS,
129 AVDT_CCB_CMD_FAIL,
130 AVDT_CCB_FREE_CMD,
131 AVDT_CCB_CONG_STATE,
132 AVDT_CCB_RET_CMD,
133 AVDT_CCB_SND_CMD,
134 AVDT_CCB_SND_MSG,
135 AVDT_CCB_SET_RECONN,
136 AVDT_CCB_CLR_RECONN,
137 AVDT_CCB_CHK_RECONN,
138 AVDT_CCB_CHK_TIMER,
139 AVDT_CCB_SET_CONN,
140 AVDT_CCB_SET_DISCONN,
141 AVDT_CCB_DO_DISCONN,
142 AVDT_CCB_LL_CLOSED,
143 AVDT_CCB_LL_OPENED,
144 AVDT_CCB_DEALLOC,
145 AVDT_CCB_NUM_ACTIONS
The Android Open Source Project5738f832012-12-12 16:00:35 -0800146};
147
Myles Watson911d1ae2016-11-28 16:44:40 -0800148#define AVDT_CCB_IGNORE AVDT_CCB_NUM_ACTIONS
The Android Open Source Project5738f832012-12-12 16:00:35 -0800149
150/* ccb state machine events */
151enum {
Myles Watson911d1ae2016-11-28 16:44:40 -0800152 AVDT_CCB_API_DISCOVER_REQ_EVT,
153 AVDT_CCB_API_GETCAP_REQ_EVT,
154 AVDT_CCB_API_START_REQ_EVT,
155 AVDT_CCB_API_SUSPEND_REQ_EVT,
156 AVDT_CCB_API_DISCOVER_RSP_EVT,
157 AVDT_CCB_API_GETCAP_RSP_EVT,
158 AVDT_CCB_API_START_RSP_EVT,
159 AVDT_CCB_API_SUSPEND_RSP_EVT,
160 AVDT_CCB_API_CONNECT_REQ_EVT,
161 AVDT_CCB_API_DISCONNECT_REQ_EVT,
162 AVDT_CCB_MSG_DISCOVER_CMD_EVT,
163 AVDT_CCB_MSG_GETCAP_CMD_EVT,
164 AVDT_CCB_MSG_START_CMD_EVT,
165 AVDT_CCB_MSG_SUSPEND_CMD_EVT,
166 AVDT_CCB_MSG_DISCOVER_RSP_EVT,
167 AVDT_CCB_MSG_GETCAP_RSP_EVT,
168 AVDT_CCB_MSG_START_RSP_EVT,
169 AVDT_CCB_MSG_SUSPEND_RSP_EVT,
170 AVDT_CCB_RCVRSP_EVT,
171 AVDT_CCB_SENDMSG_EVT,
172 AVDT_CCB_RET_TOUT_EVT,
173 AVDT_CCB_RSP_TOUT_EVT,
174 AVDT_CCB_IDLE_TOUT_EVT,
175 AVDT_CCB_UL_OPEN_EVT,
176 AVDT_CCB_UL_CLOSE_EVT,
177 AVDT_CCB_LL_OPEN_EVT,
178 AVDT_CCB_LL_CLOSE_EVT,
179 AVDT_CCB_LL_CONG_EVT
The Android Open Source Project5738f832012-12-12 16:00:35 -0800180};
181
The Android Open Source Project5738f832012-12-12 16:00:35 -0800182/* scb state machine states; these state values are private to this module so
Myles Watsonee96a3c2016-11-23 14:49:54 -0800183 * the scb state cannot be read or set by actions functions
The Android Open Source Project5738f832012-12-12 16:00:35 -0800184*/
185enum {
Myles Watson911d1ae2016-11-28 16:44:40 -0800186 AVDT_SCB_IDLE_ST,
187 AVDT_SCB_CONF_ST,
188 AVDT_SCB_OPENING_ST,
189 AVDT_SCB_OPEN_ST,
190 AVDT_SCB_STREAM_ST,
191 AVDT_SCB_CLOSING_ST
The Android Open Source Project5738f832012-12-12 16:00:35 -0800192};
193
194/* state machine action enumeration list */
195enum {
Myles Watson911d1ae2016-11-28 16:44:40 -0800196 AVDT_SCB_HDL_ABORT_CMD,
197 AVDT_SCB_HDL_ABORT_RSP,
198 AVDT_SCB_HDL_CLOSE_CMD,
199 AVDT_SCB_HDL_CLOSE_RSP,
200 AVDT_SCB_HDL_GETCONFIG_CMD,
201 AVDT_SCB_HDL_GETCONFIG_RSP,
202 AVDT_SCB_HDL_OPEN_CMD,
203 AVDT_SCB_HDL_OPEN_REJ,
204 AVDT_SCB_HDL_OPEN_RSP,
205 AVDT_SCB_HDL_PKT,
206 AVDT_SCB_DROP_PKT,
207 AVDT_SCB_HDL_RECONFIG_CMD,
208 AVDT_SCB_HDL_RECONFIG_RSP,
209 AVDT_SCB_HDL_SECURITY_CMD,
210 AVDT_SCB_HDL_SECURITY_RSP,
211 AVDT_SCB_HDL_SETCONFIG_CMD,
212 AVDT_SCB_HDL_SETCONFIG_REJ,
213 AVDT_SCB_HDL_SETCONFIG_RSP,
214 AVDT_SCB_HDL_START_CMD,
215 AVDT_SCB_HDL_START_RSP,
216 AVDT_SCB_HDL_SUSPEND_CMD,
217 AVDT_SCB_HDL_SUSPEND_RSP,
218 AVDT_SCB_HDL_TC_CLOSE,
Marie Janssend19e0782016-07-15 12:48:27 -0700219#if (AVDT_REPORTING == TRUE)
Myles Watson911d1ae2016-11-28 16:44:40 -0800220 AVDT_SCB_HDL_TC_CLOSE_STO,
The Android Open Source Project5738f832012-12-12 16:00:35 -0800221#endif
Myles Watson911d1ae2016-11-28 16:44:40 -0800222 AVDT_SCB_HDL_TC_OPEN,
Marie Janssend19e0782016-07-15 12:48:27 -0700223#if (AVDT_REPORTING == TRUE)
Myles Watson911d1ae2016-11-28 16:44:40 -0800224 AVDT_SCB_HDL_TC_OPEN_STO,
The Android Open Source Project5738f832012-12-12 16:00:35 -0800225#endif
Myles Watson911d1ae2016-11-28 16:44:40 -0800226 AVDT_SCB_SND_DELAY_RPT_REQ,
227 AVDT_SCB_HDL_DELAY_RPT_CMD,
228 AVDT_SCB_HDL_DELAY_RPT_RSP,
229 AVDT_SCB_HDL_WRITE_REQ,
230 AVDT_SCB_SND_ABORT_REQ,
231 AVDT_SCB_SND_ABORT_RSP,
232 AVDT_SCB_SND_CLOSE_REQ,
233 AVDT_SCB_SND_STREAM_CLOSE,
234 AVDT_SCB_SND_CLOSE_RSP,
235 AVDT_SCB_SND_GETCONFIG_REQ,
236 AVDT_SCB_SND_GETCONFIG_RSP,
237 AVDT_SCB_SND_OPEN_REQ,
238 AVDT_SCB_SND_OPEN_RSP,
239 AVDT_SCB_SND_RECONFIG_REQ,
240 AVDT_SCB_SND_RECONFIG_RSP,
241 AVDT_SCB_SND_SECURITY_REQ,
242 AVDT_SCB_SND_SECURITY_RSP,
243 AVDT_SCB_SND_SETCONFIG_REQ,
244 AVDT_SCB_SND_SETCONFIG_REJ,
245 AVDT_SCB_SND_SETCONFIG_RSP,
246 AVDT_SCB_SND_TC_CLOSE,
247 AVDT_SCB_CB_ERR,
248 AVDT_SCB_CONG_STATE,
249 AVDT_SCB_REJ_STATE,
250 AVDT_SCB_REJ_IN_USE,
251 AVDT_SCB_REJ_NOT_IN_USE,
252 AVDT_SCB_SET_REMOVE,
253 AVDT_SCB_FREE_PKT,
254 AVDT_SCB_CLR_PKT,
255 AVDT_SCB_CHK_SND_PKT,
256 AVDT_SCB_TC_TIMER,
257 AVDT_SCB_CLR_VARS,
258 AVDT_SCB_DEALLOC,
259 AVDT_SCB_NUM_ACTIONS
The Android Open Source Project5738f832012-12-12 16:00:35 -0800260};
261
Myles Watson911d1ae2016-11-28 16:44:40 -0800262#define AVDT_SCB_IGNORE AVDT_SCB_NUM_ACTIONS
The Android Open Source Project5738f832012-12-12 16:00:35 -0800263
264/* scb state machine events */
265enum {
Myles Watson911d1ae2016-11-28 16:44:40 -0800266 AVDT_SCB_API_REMOVE_EVT,
267 AVDT_SCB_API_WRITE_REQ_EVT,
268 AVDT_SCB_API_GETCONFIG_REQ_EVT,
269 AVDT_SCB_API_DELAY_RPT_REQ_EVT,
270 AVDT_SCB_API_SETCONFIG_REQ_EVT,
271 AVDT_SCB_API_OPEN_REQ_EVT,
272 AVDT_SCB_API_CLOSE_REQ_EVT,
273 AVDT_SCB_API_RECONFIG_REQ_EVT,
274 AVDT_SCB_API_SECURITY_REQ_EVT,
275 AVDT_SCB_API_ABORT_REQ_EVT,
276 AVDT_SCB_API_GETCONFIG_RSP_EVT,
277 AVDT_SCB_API_SETCONFIG_RSP_EVT,
278 AVDT_SCB_API_SETCONFIG_REJ_EVT,
279 AVDT_SCB_API_OPEN_RSP_EVT,
280 AVDT_SCB_API_CLOSE_RSP_EVT,
281 AVDT_SCB_API_RECONFIG_RSP_EVT,
282 AVDT_SCB_API_SECURITY_RSP_EVT,
283 AVDT_SCB_API_ABORT_RSP_EVT,
284 AVDT_SCB_MSG_SETCONFIG_CMD_EVT,
285 AVDT_SCB_MSG_GETCONFIG_CMD_EVT,
286 AVDT_SCB_MSG_OPEN_CMD_EVT,
287 AVDT_SCB_MSG_START_CMD_EVT,
288 AVDT_SCB_MSG_SUSPEND_CMD_EVT,
289 AVDT_SCB_MSG_CLOSE_CMD_EVT,
290 AVDT_SCB_MSG_ABORT_CMD_EVT,
291 AVDT_SCB_MSG_RECONFIG_CMD_EVT,
292 AVDT_SCB_MSG_SECURITY_CMD_EVT,
293 AVDT_SCB_MSG_DELAY_RPT_CMD_EVT,
294 AVDT_SCB_MSG_DELAY_RPT_RSP_EVT,
295 AVDT_SCB_MSG_SETCONFIG_RSP_EVT,
296 AVDT_SCB_MSG_GETCONFIG_RSP_EVT,
297 AVDT_SCB_MSG_OPEN_RSP_EVT,
298 AVDT_SCB_MSG_START_RSP_EVT,
299 AVDT_SCB_MSG_SUSPEND_RSP_EVT,
300 AVDT_SCB_MSG_CLOSE_RSP_EVT,
301 AVDT_SCB_MSG_ABORT_RSP_EVT,
302 AVDT_SCB_MSG_RECONFIG_RSP_EVT,
303 AVDT_SCB_MSG_SECURITY_RSP_EVT,
304 AVDT_SCB_MSG_SETCONFIG_REJ_EVT,
305 AVDT_SCB_MSG_OPEN_REJ_EVT,
306 AVDT_SCB_MSG_START_REJ_EVT,
307 AVDT_SCB_MSG_SUSPEND_REJ_EVT,
308 AVDT_SCB_TC_TOUT_EVT,
309 AVDT_SCB_TC_OPEN_EVT,
310 AVDT_SCB_TC_CLOSE_EVT,
311 AVDT_SCB_TC_CONG_EVT,
312 AVDT_SCB_TC_DATA_EVT,
313 AVDT_SCB_CC_CLOSE_EVT
The Android Open Source Project5738f832012-12-12 16:00:35 -0800314};
315
316/* adaption layer number of stream routing table entries */
Marie Janssend19e0782016-07-15 12:48:27 -0700317#if (AVDT_REPORTING == TRUE)
The Android Open Source Project5738f832012-12-12 16:00:35 -0800318/* 2 channels(1 media, 1 report) for each SEP and one for signalling */
Myles Watson911d1ae2016-11-28 16:44:40 -0800319#define AVDT_NUM_RT_TBL ((AVDT_NUM_SEPS << 1) + 1)
The Android Open Source Project5738f832012-12-12 16:00:35 -0800320#else
Myles Watson911d1ae2016-11-28 16:44:40 -0800321#define AVDT_NUM_RT_TBL (AVDT_NUM_SEPS + 1)
The Android Open Source Project5738f832012-12-12 16:00:35 -0800322#endif
323
324/* adaption layer number of transport channel table entries - moved to target.h
325#define AVDT_NUM_TC_TBL (AVDT_NUM_SEPS + AVDT_NUM_LINKS) */
326
327/* "states" used in transport channel table */
Myles Watson911d1ae2016-11-28 16:44:40 -0800328#define AVDT_AD_ST_UNUSED 0 /* Unused - unallocated */
329#define AVDT_AD_ST_IDLE 1 /* No connection */
330#define AVDT_AD_ST_ACP 2 /* Waiting to accept a connection */
331#define AVDT_AD_ST_INT 3 /* Initiating a connection */
332#define AVDT_AD_ST_CONN 4 /* Waiting for connection confirm */
333#define AVDT_AD_ST_CFG 5 /* Waiting for configuration complete */
334#define AVDT_AD_ST_OPEN 6 /* Channel opened */
335#define AVDT_AD_ST_SEC_INT 7 /* Security process as INT */
336#define AVDT_AD_ST_SEC_ACP 8 /* Security process as ACP */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800337
338/* Configuration flags. tAVDT_TC_TBL.cfg_flags */
Myles Watson911d1ae2016-11-28 16:44:40 -0800339#define AVDT_L2C_CFG_IND_DONE (1 << 0)
340#define AVDT_L2C_CFG_CFM_DONE (1 << 1)
341#define AVDT_L2C_CFG_CONN_INT (1 << 2)
342#define AVDT_L2C_CFG_CONN_ACP (1 << 3)
The Android Open Source Project5738f832012-12-12 16:00:35 -0800343
344/* result code for avdt_ad_write_req() (L2CA_DataWrite()) */
Myles Watson911d1ae2016-11-28 16:44:40 -0800345#define AVDT_AD_FAILED L2CAP_DW_FAILED /* FALSE */
346#define AVDT_AD_SUCCESS L2CAP_DW_SUCCESS /* TRUE */
347#define AVDT_AD_CONGESTED L2CAP_DW_CONGESTED /* 2 */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800348
349/*****************************************************************************
Myles Watsonee96a3c2016-11-23 14:49:54 -0800350 * data types
351 ****************************************************************************/
The Android Open Source Project5738f832012-12-12 16:00:35 -0800352
353/* msg union of all message parameter types */
354typedef union {
Myles Watson911d1ae2016-11-28 16:44:40 -0800355 tAVDT_EVT_HDR hdr;
356 tAVDT_EVT_HDR single;
357 tAVDT_SETCONFIG config_cmd;
358 tAVDT_CONFIG reconfig_cmd;
359 tAVDT_MULTI multi;
360 tAVDT_SECURITY security_cmd;
361 tAVDT_DISCOVER discover_rsp;
362 tAVDT_CONFIG svccap;
363 tAVDT_SECURITY security_rsp;
364 tAVDT_DELAY_RPT delay_rpt_cmd;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800365} tAVDT_MSG;
366
367/* data type for AVDT_CCB_API_DISCOVER_REQ_EVT */
368typedef struct {
Myles Watson911d1ae2016-11-28 16:44:40 -0800369 tAVDT_CTRL_CBACK* p_cback;
370 tAVDT_SEP_INFO* p_sep_info;
371 uint8_t num_seps;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800372} tAVDT_CCB_API_DISCOVER;
373
374/* data type for AVDT_CCB_API_GETCAP_REQ_EVT */
375typedef struct {
Myles Watson911d1ae2016-11-28 16:44:40 -0800376 tAVDT_EVT_HDR single;
377 tAVDT_CTRL_CBACK* p_cback;
378 tAVDT_CFG* p_cfg;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800379} tAVDT_CCB_API_GETCAP;
380
381/* data type for AVDT_CCB_API_CONNECT_REQ_EVT */
382typedef struct {
Myles Watson911d1ae2016-11-28 16:44:40 -0800383 tAVDT_CTRL_CBACK* p_cback;
384 uint8_t sec_mask;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800385} tAVDT_CCB_API_CONNECT;
386
387/* data type for AVDT_CCB_API_DISCONNECT_REQ_EVT */
Myles Watson911d1ae2016-11-28 16:44:40 -0800388typedef struct { tAVDT_CTRL_CBACK* p_cback; } tAVDT_CCB_API_DISCONNECT;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800389
390/* union associated with ccb state machine events */
391typedef union {
Myles Watson911d1ae2016-11-28 16:44:40 -0800392 tAVDT_CCB_API_DISCOVER discover;
393 tAVDT_CCB_API_GETCAP getcap;
394 tAVDT_CCB_API_CONNECT connect;
395 tAVDT_CCB_API_DISCONNECT disconnect;
396 tAVDT_MSG msg;
397 bool llcong;
398 uint8_t err_code;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800399} tAVDT_CCB_EVT;
400
401/* channel control block type */
402typedef struct {
Myles Watson911d1ae2016-11-28 16:44:40 -0800403 BD_ADDR peer_addr; /* BD address of peer */
404 /*
405 * NOTE: idle_ccb_timer, ret_ccb_timer and rsp_ccb_timer are mutually
406 * exclusive - no more than one timer should be running at the same time.
407 */
408 alarm_t* idle_ccb_timer; /* Idle CCB timer entry */
409 alarm_t* ret_ccb_timer; /* Ret CCB timer entry */
410 alarm_t* rsp_ccb_timer; /* Rsp CCB timer entry */
411 fixed_queue_t* cmd_q; /* Queue for outgoing command messages */
412 fixed_queue_t* rsp_q; /* Queue for outgoing response and reject messages */
413 tAVDT_CTRL_CBACK* proc_cback; /* Procedure callback function */
414 tAVDT_CTRL_CBACK*
415 p_conn_cback; /* Connection/disconnection callback function */
416 void* p_proc_data; /* Pointer to data storage for procedure */
417 BT_HDR* p_curr_cmd; /* Current command being sent awaiting response */
418 BT_HDR* p_curr_msg; /* Current message being sent */
419 BT_HDR* p_rx_msg; /* Current message being received */
420 bool allocated; /* Whether ccb is allocated */
421 uint8_t state; /* The CCB state machine state */
422 bool ll_opened; /* true if LL is opened */
423 bool proc_busy; /* true when a discover or get capabilities procedure in
424 progress */
425 uint8_t proc_param; /* Procedure parameter; either SEID for get capabilities
426 or number of SEPS for discover */
427 bool cong; /* Whether signaling channel is congested */
428 uint8_t label; /* Message header "label" (sequence number) */
429 bool reconn; /* If true, reinitiate connection after transitioning from
430 CLOSING to IDLE state */
431 uint8_t ret_count; /* Command retransmission count */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800432} tAVDT_CCB;
433
434/* type for action functions */
Myles Watson911d1ae2016-11-28 16:44:40 -0800435typedef void (*tAVDT_CCB_ACTION)(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800436
437/* type for AVDT_SCB_API_WRITE_REQ_EVT */
438typedef struct {
Myles Watson911d1ae2016-11-28 16:44:40 -0800439 BT_HDR* p_buf;
440 uint32_t time_stamp;
441 uint8_t m_pt;
442 tAVDT_DATA_OPT_MASK opt;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800443} tAVDT_SCB_APIWRITE;
444
445/* type for AVDT_SCB_TC_CLOSE_EVT */
446typedef struct {
Myles Watson911d1ae2016-11-28 16:44:40 -0800447 uint8_t old_tc_state; /* channel state before closed */
448 uint8_t tcid; /* TCID */
449 uint8_t type; /* channel type */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800450} tAVDT_SCB_TC_CLOSE;
451
452/* type for scb event data */
453typedef union {
Myles Watson911d1ae2016-11-28 16:44:40 -0800454 tAVDT_MSG msg;
455 tAVDT_SCB_APIWRITE apiwrite;
456 tAVDT_DELAY_RPT apidelay;
457 tAVDT_OPEN open;
458 tAVDT_SCB_TC_CLOSE close;
459 bool llcong;
460 BT_HDR* p_pkt;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800461} tAVDT_SCB_EVT;
462
463/* stream control block type */
464typedef struct {
Myles Watson911d1ae2016-11-28 16:44:40 -0800465 tAVDT_CS cs; /* stream creation struct */
466 tAVDT_CFG curr_cfg; /* current configuration */
467 tAVDT_CFG req_cfg; /* requested configuration */
468 alarm_t* transport_channel_timer; /* transport channel connect timer */
469 BT_HDR* p_pkt; /* packet waiting to be sent */
470 tAVDT_CCB* p_ccb; /* ccb associated with this scb */
471 uint16_t media_seq; /* media packet sequence number */
472 bool allocated; /* whether scb is allocated or unused */
473 bool in_use; /* whether stream being used by peer */
474 uint8_t role; /* initiator/acceptor role in current procedure */
475 bool remove; /* whether CB is marked for removal */
476 uint8_t state; /* state machine state */
477 uint8_t peer_seid; /* SEID of peer stream */
478 uint8_t curr_evt; /* current event; set only by state machine */
479 bool cong; /* Whether media transport channel is congested */
480 uint8_t close_code; /* Error code received in close response */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800481} tAVDT_SCB;
482
483/* type for action functions */
Myles Watson911d1ae2016-11-28 16:44:40 -0800484typedef void (*tAVDT_SCB_ACTION)(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800485
486/* adaption layer type for transport channel table */
487typedef struct {
Myles Watson911d1ae2016-11-28 16:44:40 -0800488 uint16_t peer_mtu; /* L2CAP mtu of the peer device */
489 uint16_t my_mtu; /* Our MTU for this channel */
490 uint16_t my_flush_to; /* Our flush timeout for this channel */
491 uint16_t lcid;
492 uint8_t tcid; /* transport channel id */
493 uint8_t ccb_idx; /* channel control block associated with this tc */
494 uint8_t state; /* transport channel state */
495 uint8_t cfg_flags; /* L2CAP configuration flags */
496 uint8_t id;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800497} tAVDT_TC_TBL;
498
499/* adaption layer type for stream routing table */
500typedef struct {
Myles Watson911d1ae2016-11-28 16:44:40 -0800501 uint16_t lcid; /* L2CAP LCID of the associated transport channel */
502 uint8_t scb_hdl; /* stream control block associated with this tc */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800503} tAVDT_RT_TBL;
504
The Android Open Source Project5738f832012-12-12 16:00:35 -0800505/* adaption layer control block */
506typedef struct {
Myles Watson911d1ae2016-11-28 16:44:40 -0800507 tAVDT_RT_TBL rt_tbl[AVDT_NUM_LINKS][AVDT_NUM_RT_TBL];
508 tAVDT_TC_TBL tc_tbl[AVDT_NUM_TC_TBL];
509 uint8_t lcid_tbl[MAX_L2CAP_CHANNELS]; /* map LCID to tc_tbl index */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800510} tAVDT_AD;
511
512/* Control block for AVDT */
513typedef struct {
Myles Watson911d1ae2016-11-28 16:44:40 -0800514 tAVDT_REG rcb; /* registration control block */
515 tAVDT_CCB ccb[AVDT_NUM_LINKS]; /* channel control blocks */
516 tAVDT_SCB scb[AVDT_NUM_SEPS]; /* stream control blocks */
517 tAVDT_AD ad; /* adaption layer control block */
518 tAVDTC_CTRL_CBACK* p_conf_cback; /* conformance callback function */
519 tAVDT_CCB_ACTION* p_ccb_act; /* pointer to CCB action functions */
520 tAVDT_SCB_ACTION* p_scb_act; /* pointer to SCB action functions */
521 tAVDT_CTRL_CBACK* p_conn_cback; /* connection callback function */
522 uint8_t trace_level; /* trace level */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800523} tAVDT_CB;
524
The Android Open Source Project5738f832012-12-12 16:00:35 -0800525/*****************************************************************************
Myles Watsonee96a3c2016-11-23 14:49:54 -0800526 * function declarations
527 ****************************************************************************/
The Android Open Source Project5738f832012-12-12 16:00:35 -0800528
529/* CCB function declarations */
530extern void avdt_ccb_init(void);
Myles Watson911d1ae2016-11-28 16:44:40 -0800531extern void avdt_ccb_event(tAVDT_CCB* p_ccb, uint8_t event,
532 tAVDT_CCB_EVT* p_data);
533extern tAVDT_CCB* avdt_ccb_by_bd(BD_ADDR bd_addr);
534extern tAVDT_CCB* avdt_ccb_alloc(BD_ADDR bd_addr);
535extern void avdt_ccb_dealloc(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
536extern uint8_t avdt_ccb_to_idx(tAVDT_CCB* p_ccb);
537extern tAVDT_CCB* avdt_ccb_by_idx(uint8_t idx);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800538
539/* CCB action functions */
Myles Watson911d1ae2016-11-28 16:44:40 -0800540extern void avdt_ccb_chan_open(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
541extern void avdt_ccb_chan_close(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
542extern void avdt_ccb_chk_close(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
543extern void avdt_ccb_hdl_discover_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
544extern void avdt_ccb_hdl_discover_rsp(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
545extern void avdt_ccb_hdl_getcap_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
546extern void avdt_ccb_hdl_getcap_rsp(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
547extern void avdt_ccb_hdl_start_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
548extern void avdt_ccb_hdl_start_rsp(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
549extern void avdt_ccb_hdl_suspend_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
550extern void avdt_ccb_hdl_suspend_rsp(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
551extern void avdt_ccb_snd_discover_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
552extern void avdt_ccb_snd_discover_rsp(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
553extern void avdt_ccb_snd_getcap_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
554extern void avdt_ccb_snd_getcap_rsp(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
555extern void avdt_ccb_snd_start_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
556extern void avdt_ccb_snd_start_rsp(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
557extern void avdt_ccb_snd_suspend_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
558extern void avdt_ccb_snd_suspend_rsp(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
559extern void avdt_ccb_clear_cmds(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
560extern void avdt_ccb_cmd_fail(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
561extern void avdt_ccb_free_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
562extern void avdt_ccb_cong_state(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
563extern void avdt_ccb_ret_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
564extern void avdt_ccb_snd_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
565extern void avdt_ccb_snd_msg(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
566extern void avdt_ccb_set_reconn(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
567extern void avdt_ccb_clr_reconn(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
568extern void avdt_ccb_chk_reconn(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
569extern void avdt_ccb_chk_timer(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
570extern void avdt_ccb_set_conn(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
571extern void avdt_ccb_set_disconn(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
572extern void avdt_ccb_do_disconn(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
573extern void avdt_ccb_ll_closed(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
574extern void avdt_ccb_ll_opened(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800575
576/* SCB function prototypes */
Myles Watson911d1ae2016-11-28 16:44:40 -0800577extern void avdt_scb_event(tAVDT_SCB* p_scb, uint8_t event,
578 tAVDT_SCB_EVT* p_data);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800579extern void avdt_scb_init(void);
Myles Watson911d1ae2016-11-28 16:44:40 -0800580extern tAVDT_SCB* avdt_scb_alloc(tAVDT_CS* p_cs);
581extern void avdt_scb_dealloc(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
582extern uint8_t avdt_scb_to_hdl(tAVDT_SCB* p_scb);
583extern tAVDT_SCB* avdt_scb_by_hdl(uint8_t hdl);
584extern uint8_t avdt_scb_verify(tAVDT_CCB* p_ccb, uint8_t state, uint8_t* p_seid,
585 uint16_t num_seid, uint8_t* p_err_code);
586extern void avdt_scb_peer_seid_list(tAVDT_MULTI* p_multi);
587extern uint32_t avdt_scb_gen_ssrc(tAVDT_SCB* p_scb);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800588
589/* SCB action functions */
Myles Watson911d1ae2016-11-28 16:44:40 -0800590extern void avdt_scb_hdl_abort_cmd(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
591extern void avdt_scb_hdl_abort_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
592extern void avdt_scb_hdl_close_cmd(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
593extern void avdt_scb_hdl_close_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
594extern void avdt_scb_hdl_getconfig_cmd(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
595extern void avdt_scb_hdl_getconfig_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
596extern void avdt_scb_hdl_open_cmd(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
597extern void avdt_scb_hdl_open_rej(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
598extern void avdt_scb_hdl_open_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
599extern void avdt_scb_hdl_pkt(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
600extern void avdt_scb_drop_pkt(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
601extern void avdt_scb_hdl_reconfig_cmd(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
602extern void avdt_scb_hdl_reconfig_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
603extern void avdt_scb_hdl_security_cmd(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
604extern void avdt_scb_hdl_security_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
605extern void avdt_scb_hdl_setconfig_cmd(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
606extern void avdt_scb_hdl_setconfig_rej(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
607extern void avdt_scb_hdl_setconfig_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
608extern void avdt_scb_hdl_start_cmd(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
609extern void avdt_scb_hdl_start_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
610extern void avdt_scb_hdl_suspend_cmd(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
611extern void avdt_scb_hdl_suspend_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
612extern void avdt_scb_snd_delay_rpt_req(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
613extern void avdt_scb_hdl_delay_rpt_cmd(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
614extern void avdt_scb_hdl_delay_rpt_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
615extern void avdt_scb_hdl_tc_close(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
616extern void avdt_scb_hdl_tc_open(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
617extern void avdt_scb_hdl_tc_close_sto(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
618extern void avdt_scb_hdl_tc_open_sto(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
619extern void avdt_scb_hdl_write_req(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
620extern void avdt_scb_snd_abort_req(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
621extern void avdt_scb_snd_abort_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
622extern void avdt_scb_snd_close_req(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
623extern void avdt_scb_snd_stream_close(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
624extern void avdt_scb_snd_close_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
625extern void avdt_scb_snd_getconfig_req(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
626extern void avdt_scb_snd_getconfig_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
627extern void avdt_scb_snd_open_req(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
628extern void avdt_scb_snd_open_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
629extern void avdt_scb_snd_reconfig_req(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
630extern void avdt_scb_snd_reconfig_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
631extern void avdt_scb_snd_security_req(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
632extern void avdt_scb_snd_security_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
633extern void avdt_scb_snd_setconfig_req(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
634extern void avdt_scb_snd_setconfig_rej(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
635extern void avdt_scb_snd_setconfig_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
636extern void avdt_scb_snd_tc_close(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
637extern void avdt_scb_cb_err(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
638extern void avdt_scb_cong_state(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
639extern void avdt_scb_rej_state(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
640extern void avdt_scb_rej_in_use(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
641extern void avdt_scb_rej_not_in_use(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
642extern void avdt_scb_set_remove(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
643extern void avdt_scb_free_pkt(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
644extern void avdt_scb_chk_snd_pkt(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
645extern void avdt_scb_clr_pkt(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
646extern void avdt_scb_transport_channel_timer(tAVDT_SCB* p_scb,
647 tAVDT_SCB_EVT* p_data);
648extern void avdt_scb_clr_vars(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800649
650/* msg function declarations */
Myles Watson911d1ae2016-11-28 16:44:40 -0800651extern bool avdt_msg_send(tAVDT_CCB* p_ccb, BT_HDR* p_msg);
652extern void avdt_msg_send_cmd(tAVDT_CCB* p_ccb, void* p_scb, uint8_t sig_id,
653 tAVDT_MSG* p_params);
654extern void avdt_msg_send_rsp(tAVDT_CCB* p_ccb, uint8_t sig_id,
655 tAVDT_MSG* p_params);
656extern void avdt_msg_send_rej(tAVDT_CCB* p_ccb, uint8_t sig_id,
657 tAVDT_MSG* p_params);
658extern void avdt_msg_send_grej(tAVDT_CCB* p_ccb, uint8_t sig_id,
659 tAVDT_MSG* p_params);
660extern void avdt_msg_ind(tAVDT_CCB* p_ccb, BT_HDR* p_buf);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800661
662/* adaption layer function declarations */
663extern void avdt_ad_init(void);
Myles Watson911d1ae2016-11-28 16:44:40 -0800664extern uint8_t avdt_ad_type_to_tcid(uint8_t type, tAVDT_SCB* p_scb);
665extern tAVDT_TC_TBL* avdt_ad_tc_tbl_by_st(uint8_t type, tAVDT_CCB* p_ccb,
666 uint8_t state);
667extern tAVDT_TC_TBL* avdt_ad_tc_tbl_by_lcid(uint16_t lcid);
668extern tAVDT_TC_TBL* avdt_ad_tc_tbl_alloc(tAVDT_CCB* p_ccb);
669extern uint8_t avdt_ad_tc_tbl_to_idx(tAVDT_TC_TBL* p_tbl);
670extern void avdt_ad_tc_close_ind(tAVDT_TC_TBL* p_tbl, uint16_t reason);
671extern void avdt_ad_tc_open_ind(tAVDT_TC_TBL* p_tbl);
672extern void avdt_ad_tc_cong_ind(tAVDT_TC_TBL* p_tbl, bool is_congested);
673extern void avdt_ad_tc_data_ind(tAVDT_TC_TBL* p_tbl, BT_HDR* p_buf);
674extern tAVDT_TC_TBL* avdt_ad_tc_tbl_by_type(uint8_t type, tAVDT_CCB* p_ccb,
675 tAVDT_SCB* p_scb);
676extern uint8_t avdt_ad_write_req(uint8_t type, tAVDT_CCB* p_ccb,
677 tAVDT_SCB* p_scb, BT_HDR* p_buf);
678extern void avdt_ad_open_req(uint8_t type, tAVDT_CCB* p_ccb, tAVDT_SCB* p_scb,
679 uint8_t role);
680extern void avdt_ad_close_req(uint8_t type, tAVDT_CCB* p_ccb, tAVDT_SCB* p_scb);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800681
Myles Watson911d1ae2016-11-28 16:44:40 -0800682extern void avdt_ccb_idle_ccb_timer_timeout(void* data);
683extern void avdt_ccb_ret_ccb_timer_timeout(void* data);
684extern void avdt_ccb_rsp_ccb_timer_timeout(void* data);
685extern void avdt_scb_transport_channel_timer_timeout(void* data);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800686
687/*****************************************************************************
Myles Watsonee96a3c2016-11-23 14:49:54 -0800688 * macros
689 ****************************************************************************/
The Android Open Source Project5738f832012-12-12 16:00:35 -0800690
691/* we store the scb and the label in the layer_specific field of the
Myles Watsonee96a3c2016-11-23 14:49:54 -0800692 * current cmd
The Android Open Source Project5738f832012-12-12 16:00:35 -0800693*/
Myles Watson911d1ae2016-11-28 16:44:40 -0800694#define AVDT_BLD_LAYERSPEC(ls, msg, label) ls = (((label) << 4) | (msg))
The Android Open Source Project5738f832012-12-12 16:00:35 -0800695
Myles Watson911d1ae2016-11-28 16:44:40 -0800696#define AVDT_LAYERSPEC_LABEL(ls) ((uint8_t)((ls) >> 4))
The Android Open Source Project5738f832012-12-12 16:00:35 -0800697
Myles Watson911d1ae2016-11-28 16:44:40 -0800698#define AVDT_LAYERSPEC_MSG(ls) ((uint8_t)((ls)&0x000F))
The Android Open Source Project5738f832012-12-12 16:00:35 -0800699
700/*****************************************************************************
Myles Watsonee96a3c2016-11-23 14:49:54 -0800701 * global data
702 ****************************************************************************/
The Android Open Source Project5738f832012-12-12 16:00:35 -0800703
704/******************************************************************************
Myles Watsonee96a3c2016-11-23 14:49:54 -0800705 * Main Control Block
706 ******************************************************************************/
Pavlin Radoslavov37c1b5f2016-10-14 15:47:27 -0700707extern tAVDT_CB avdt_cb;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800708
709/* L2CAP callback registration structure */
710extern const tL2CAP_APPL_INFO avdt_l2c_appl;
711
712/* reject message event lookup table */
Marie Janssend19e0782016-07-15 12:48:27 -0700713extern const uint8_t avdt_msg_rej_2_evt[];
The Android Open Source Project5738f832012-12-12 16:00:35 -0800714
715#endif /* AVDT_INT_H */