NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
bta_av_int.h
1/******************************************************************************
2 *
3 * Copyright (C) 2004-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 is the private interface file for the BTA advanced audio/video.
22 *
23 ******************************************************************************/
24#ifndef BTA_AV_INT_H
25#define BTA_AV_INT_H
26
27#include "bta_sys.h"
28#include "bta_api.h"
29#include "bta_av_api.h"
30#include "avdt_api.h"
31#include "bta_av_co.h"
32
33#define BTA_AV_DEBUG TRUE
34/*****************************************************************************
35** Constants
36*****************************************************************************/
37
38enum
39{
40 /* these events are handled by the AV main state machine */
41 BTA_AV_API_DISABLE_EVT = BTA_SYS_EVT_START(BTA_ID_AV),
42 BTA_AV_API_REMOTE_CMD_EVT,
43 BTA_AV_API_VENDOR_CMD_EVT,
44 BTA_AV_API_VENDOR_RSP_EVT,
45 BTA_AV_API_META_RSP_EVT,
46 BTA_AV_API_RC_CLOSE_EVT,
47 BTA_AV_AVRC_OPEN_EVT,
48 BTA_AV_AVRC_MSG_EVT,
49 BTA_AV_AVRC_NONE_EVT,
50
51 /* these events are handled by the AV stream state machine */
52 BTA_AV_API_OPEN_EVT,
53 BTA_AV_API_CLOSE_EVT,
54 BTA_AV_AP_START_EVT, /* the following 2 events must be in the same order as the *API_*EVT */
55 BTA_AV_AP_STOP_EVT,
56 BTA_AV_API_RECONFIG_EVT,
57 BTA_AV_API_PROTECT_REQ_EVT,
58 BTA_AV_API_PROTECT_RSP_EVT,
59 BTA_AV_API_RC_OPEN_EVT,
60 BTA_AV_SRC_DATA_READY_EVT,
61 BTA_AV_CI_SETCONFIG_OK_EVT,
62 BTA_AV_CI_SETCONFIG_FAIL_EVT,
63 BTA_AV_SDP_DISC_OK_EVT,
64 BTA_AV_SDP_DISC_FAIL_EVT,
65 BTA_AV_STR_DISC_OK_EVT,
66 BTA_AV_STR_DISC_FAIL_EVT,
67 BTA_AV_STR_GETCAP_OK_EVT,
68 BTA_AV_STR_GETCAP_FAIL_EVT,
69 BTA_AV_STR_OPEN_OK_EVT,
70 BTA_AV_STR_OPEN_FAIL_EVT,
71 BTA_AV_STR_START_OK_EVT,
72 BTA_AV_STR_START_FAIL_EVT,
73 BTA_AV_STR_CLOSE_EVT,
74 BTA_AV_STR_CONFIG_IND_EVT,
75 BTA_AV_STR_SECURITY_IND_EVT,
76 BTA_AV_STR_SECURITY_CFM_EVT,
77 BTA_AV_STR_WRITE_CFM_EVT,
78 BTA_AV_STR_SUSPEND_CFM_EVT,
79 BTA_AV_STR_RECONFIG_CFM_EVT,
80 BTA_AV_AVRC_TIMER_EVT,
81 BTA_AV_AVDT_CONNECT_EVT,
82 BTA_AV_AVDT_DISCONNECT_EVT,
83 BTA_AV_ROLE_CHANGE_EVT,
84 BTA_AV_AVDT_DELAY_RPT_EVT,
85 BTA_AV_ACP_CONNECT_EVT,
86
87 /* these events are handled outside of the state machine */
88 BTA_AV_API_ENABLE_EVT,
89 BTA_AV_API_REGISTER_EVT,
90 BTA_AV_API_DEREGISTER_EVT,
91 BTA_AV_API_DISCONNECT_EVT,
92 BTA_AV_CI_SRC_DATA_READY_EVT,
93 BTA_AV_SIG_CHG_EVT,
94 BTA_AV_SIG_TIMER_EVT,
95 BTA_AV_SDP_AVRC_DISC_EVT,
96 BTA_AV_AVRC_CLOSE_EVT,
97 BTA_AV_CONN_CHG_EVT,
98 BTA_AV_DEREG_COMP_EVT,
99#if (AVDT_REPORTING == TRUE)
100 BTA_AV_AVDT_RPT_CONN_EVT,
101#endif
102 BTA_AV_API_START_EVT, /* the following 2 events must be in the same order as the *AP_*EVT */
103 BTA_AV_API_STOP_EVT
104};
105
106/* events for AV control block state machine */
107#define BTA_AV_FIRST_SM_EVT BTA_AV_API_DISABLE_EVT
108#define BTA_AV_LAST_SM_EVT BTA_AV_AVRC_NONE_EVT
109
110/* events for AV stream control block state machine */
111#define BTA_AV_FIRST_SSM_EVT BTA_AV_API_OPEN_EVT
112
113/* events that do not go through state machine */
114#define BTA_AV_FIRST_NSM_EVT BTA_AV_API_ENABLE_EVT
115#define BTA_AV_LAST_NSM_EVT BTA_AV_API_STOP_EVT
116
117/* API events passed to both SSMs (by bta_av_api_to_ssm) */
118#define BTA_AV_FIRST_A2S_API_EVT BTA_AV_API_START_EVT
119#define BTA_AV_FIRST_A2S_SSM_EVT BTA_AV_AP_START_EVT
120
121#define BTA_AV_LAST_EVT BTA_AV_API_STOP_EVT
122
123/* maximum number of SEPS in stream discovery results */
124#define BTA_AV_NUM_SEPS 32
125
126/* initialization value for AVRC handle */
127#define BTA_AV_RC_HANDLE_NONE 0xFF
128
129/* size of database for service discovery */
130#define BTA_AV_DISC_BUF_SIZE 1000
131
132/* offset of media type in codec info byte array */
133#define BTA_AV_MEDIA_TYPE_IDX 1
134
135/* maximum length of AVDTP security data */
136#define BTA_AV_SECURITY_MAX_LEN 400
137
138/* check number of buffers queued at L2CAP when this amount of buffers are queued to L2CAP */
139#define BTA_AV_QUEUE_DATA_CHK_NUM 5
140
141/* the number of ACL links with AVDT */
142#define BTA_AV_NUM_LINKS AVDT_NUM_LINKS
143
144#define BTA_AV_CO_ID_TO_BE_STREAM(p, u32) {*(p)++ = (UINT8)((u32) >> 16); *(p)++ = (UINT8)((u32) >> 8); *(p)++ = (UINT8)(u32); }
145#define BTA_AV_BE_STREAM_TO_CO_ID(u32, p) {u32 = (((UINT32)(*((p) + 2))) + (((UINT32)(*((p) + 1))) << 8) + (((UINT32)(*(p))) << 16)); (p) += 3;}
146
147/* these bits are defined for bta_av_cb.multi_av */
148#define BTA_AV_MULTI_AV_SUPPORTED 0x01
149#define BTA_AV_MULTI_AV_IN_USE 0x02
150
151
152/*****************************************************************************
153** Data types
154*****************************************************************************/
155
156/* function types for call-out functions */
157typedef BOOLEAN (*tBTA_AV_CO_INIT) (UINT8 *p_codec_type, UINT8 *p_codec_info,
158 UINT8 *p_num_protect, UINT8 *p_protect_info, UINT8 index);
159
160typedef void (*tBTA_AV_CO_DISC_RES) (tBTA_AV_HNDL hndl, UINT8 num_seps,
161 UINT8 num_snk, BD_ADDR addr);
162
163typedef UINT8 (*tBTA_AV_CO_GETCFG) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
164 UINT8 *p_codec_info, UINT8 *p_sep_info_idx, UINT8 seid,
165 UINT8 *p_num_protect, UINT8 *p_protect_info);
166typedef void (*tBTA_AV_CO_SETCFG) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
167 UINT8 *p_codec_info, UINT8 seid, BD_ADDR addr,
168 UINT8 num_protect, UINT8 *p_protect_info);
169typedef void (*tBTA_AV_CO_OPEN) (tBTA_AV_HNDL hndl,
170 tBTA_AV_CODEC codec_type, UINT8 *p_codec_info,
171 UINT16 mtu);
172typedef void (*tBTA_AV_CO_CLOSE) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type, UINT16 mtu);
173typedef void (*tBTA_AV_CO_START) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type);
174typedef void (*tBTA_AV_CO_STOP) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type);
175typedef void * (*tBTA_AV_CO_DATAPATH) (tBTA_AV_CODEC codec_type,
176 UINT32 *p_len, UINT32 *p_timestamp);
177typedef void (*tBTA_AV_CO_DELAY) (tBTA_AV_HNDL hndl, UINT16 delay);
178
179/* the call-out functions for one stream */
180typedef struct
181{
182 tBTA_AV_CO_INIT init;
183 tBTA_AV_CO_DISC_RES disc_res;
184 tBTA_AV_CO_GETCFG getcfg;
185 tBTA_AV_CO_SETCFG setcfg;
186 tBTA_AV_CO_OPEN open;
187 tBTA_AV_CO_CLOSE close;
188 tBTA_AV_CO_START start;
189 tBTA_AV_CO_STOP stop;
190 tBTA_AV_CO_DATAPATH data;
191 tBTA_AV_CO_DELAY delay;
193
194/* data type for BTA_AV_API_ENABLE_EVT */
195typedef struct
196{
197 BT_HDR hdr;
198 tBTA_AV_CBACK *p_cback;
199 tBTA_AV_FEAT features;
200 tBTA_SEC sec_mask;
202
203/* data type for BTA_AV_API_REG_EVT */
204typedef struct
205{
206 BT_HDR hdr;
207 char p_service_name[BTA_SERVICE_NAME_LEN+1];
208 UINT8 app_id;
210
211
212enum
213{
214 BTA_AV_RS_NONE, /* straight API call */
215 BTA_AV_RS_OK, /* the role switch result - successful */
216 BTA_AV_RS_FAIL, /* the role switch result - failed */
217 BTA_AV_RS_DONE /* the role switch is done - continue */
218};
219typedef UINT8 tBTA_AV_RS_RES;
220/* data type for BTA_AV_API_OPEN_EVT */
221typedef struct
222{
223 BT_HDR hdr;
224 BD_ADDR bd_addr;
225 BOOLEAN use_rc;
226 tBTA_SEC sec_mask;
227 tBTA_AV_RS_RES switch_res;
229
230/* data type for BTA_AV_API_STOP_EVT */
231typedef struct
232{
233 BT_HDR hdr;
234 BOOLEAN suspend;
235 BOOLEAN flush;
237
238/* data type for BTA_AV_API_DISCONNECT_EVT */
239typedef struct
240{
241 BT_HDR hdr;
242 BD_ADDR bd_addr;
244
245/* data type for BTA_AV_API_PROTECT_REQ_EVT */
246typedef struct
247{
248 BT_HDR hdr;
249 UINT8 *p_data;
250 UINT16 len;
252
253/* data type for BTA_AV_API_PROTECT_RSP_EVT */
254typedef struct
255{
256 BT_HDR hdr;
257 UINT8 *p_data;
258 UINT16 len;
259 UINT8 error_code;
261
262/* data type for BTA_AV_API_REMOTE_CMD_EVT */
263typedef struct
264{
265 BT_HDR hdr;
266 tAVRC_MSG_PASS msg;
267 UINT8 label;
269
270/* data type for BTA_AV_API_VENDOR_CMD_EVT and RSP */
271typedef struct
272{
273 BT_HDR hdr;
275 UINT8 label;
277
278/* data type for BTA_AV_API_RC_OPEN_EVT */
279typedef struct
280{
281 BT_HDR hdr;
283
284/* data type for BTA_AV_API_RC_CLOSE_EVT */
285typedef struct
286{
287 BT_HDR hdr;
289
290/* data type for BTA_AV_API_META_RSP_EVT */
291typedef struct
292{
293 BT_HDR hdr;
294 BOOLEAN is_rsp;
295 UINT8 label;
296 tBTA_AV_CODE rsp_code;
297 BT_HDR *p_pkt;
299
300
301/* data type for BTA_AV_API_RECONFIG_EVT */
302typedef struct
303{
304 BT_HDR hdr;
305 UINT8 codec_info[AVDT_CODEC_SIZE]; /* codec configuration */
306 UINT8 *p_protect_info;
307 UINT8 num_protect;
308 BOOLEAN suspend;
309 UINT8 sep_info_idx;
311
312/* data type for BTA_AV_CI_SETCONFIG_OK_EVT and BTA_AV_CI_SETCONFIG_FAIL_EVT */
313typedef struct
314{
315 BT_HDR hdr;
316 tBTA_AV_HNDL hndl;
317 UINT8 err_code;
318 UINT8 category;
319 UINT8 num_seid;
320 UINT8 *p_seid;
321 BOOLEAN recfg_needed;
323
324/* data type for all stream events from AVDTP */
325typedef struct {
326 BT_HDR hdr;
327 tAVDT_CFG cfg; /* configuration/capabilities parameters */
328 tAVDT_CTRL msg; /* AVDTP callback message parameters */
329 BD_ADDR bd_addr; /* bd address */
330 UINT8 handle;
331 UINT8 avdt_event;
332 BOOLEAN initiator; /* TRUE, if local device initiates the SUSPEND */
334
335/* data type for BTA_AV_AVRC_MSG_EVT */
336typedef struct
337{
338 BT_HDR hdr;
339 tAVRC_MSG msg;
340 UINT8 handle;
341 UINT8 label;
342 UINT8 opcode;
344
345/* data type for BTA_AV_AVRC_OPEN_EVT, BTA_AV_AVRC_CLOSE_EVT */
346typedef struct
347{
348 BT_HDR hdr;
349 BD_ADDR peer_addr;
350 UINT8 handle;
352
353/* data type for BTA_AV_CONN_CHG_EVT */
354typedef struct
355{
356 BT_HDR hdr;
357 BD_ADDR peer_addr;
358 BOOLEAN is_up;
360
361/* data type for BTA_AV_ROLE_CHANGE_EVT */
362typedef struct
363{
364 BT_HDR hdr;
365 UINT8 new_role;
366 UINT8 hci_status;
368
369/* data type for BTA_AV_SDP_DISC_OK_EVT */
370typedef struct
371{
372 BT_HDR hdr;
373 UINT16 avdt_version; /* AVDTP protocol version */
375
376/* type for SEP control block */
377typedef struct
378{
379 UINT8 av_handle; /* AVDTP handle */
380 tBTA_AV_CODEC codec_type; /* codec type */
382
383
384/* initiator/acceptor role for adaption */
385#define BTA_AV_ROLE_AD_INT 0x00 /* initiator */
386#define BTA_AV_ROLE_AD_ACP 0x01 /* acceptor */
387
388/* initiator/acceptor signaling roles */
389#define BTA_AV_ROLE_START_ACP 0x00
390#define BTA_AV_ROLE_START_INT 0x10 /* do not change this value */
391
392#define BTA_AV_ROLE_SUSPEND 0x20 /* suspending on start */
393#define BTA_AV_ROLE_SUSPEND_OPT 0x40 /* Suspend on Start option is set */
394
395/* union of all event datatypes */
396typedef union
397{
398 BT_HDR hdr;
399 tBTA_AV_API_ENABLE api_enable;
400 tBTA_AV_API_REG api_reg;
401 tBTA_AV_API_OPEN api_open;
402 tBTA_AV_API_STOP api_stop;
403 tBTA_AV_API_DISCNT api_discnt;
404 tBTA_AV_API_PROTECT_REQ api_protect_req;
405 tBTA_AV_API_PROTECT_RSP api_protect_rsp;
406 tBTA_AV_API_REMOTE_CMD api_remote_cmd;
407 tBTA_AV_API_VENDOR api_vendor;
408 tBTA_AV_API_RCFG api_reconfig;
409 tBTA_AV_CI_SETCONFIG ci_setconfig;
410 tBTA_AV_STR_MSG str_msg;
411 tBTA_AV_RC_MSG rc_msg;
412 tBTA_AV_RC_CONN_CHG rc_conn_chg;
413 tBTA_AV_CONN_CHG conn_chg;
414 tBTA_AV_ROLE_RES role_res;
415 tBTA_AV_SDP_RES sdp_res;
416 tBTA_AV_API_META_RSP api_meta_rsp;
418
419typedef void (tBTA_AV_VDP_DATA_ACT)(void *p_scb);
420
421typedef struct
422{
423 tBTA_AV_VDP_DATA_ACT *p_act;
424 UINT8 *p_frame;
425 UINT16 buf_size;
426 UINT32 len;
427 UINT32 offset;
428 UINT32 timestamp;
430
431typedef union
432{
433 BUFFER_Q a2d; /* used for audio channels only */
434 tBTA_AV_VF_INFO vdp; /* used for video channels only */
435 tBTA_AV_API_OPEN open; /* used only before open and role switch
436 is needed on another AV channel */
438
439#define BTA_AV_Q_TAG_OPEN 0x01 /* after API_OPEN, before STR_OPENED */
440#define BTA_AV_Q_TAG_START 0x02 /* before start sending media packets */
441#define BTA_AV_Q_TAG_STREAM 0x03 /* during streaming */
442
443#define BTA_AV_WAIT_ACP_CAPS_ON 0x01 /* retriving the peer capabilities */
444#define BTA_AV_WAIT_ACP_CAPS_STARTED 0x02 /* started while retriving peer capabilities */
445#define BTA_AV_WAIT_ROLE_SW_RES_OPEN 0x04 /* waiting for role switch result after API_OPEN, before STR_OPENED */
446#define BTA_AV_WAIT_ROLE_SW_RES_START 0x08 /* waiting for role switch result before streaming */
447#define BTA_AV_WAIT_ROLE_SW_STARTED 0x10 /* started while waiting for role switch result */
448#define BTA_AV_WAIT_ROLE_SW_RETRY 0x20 /* set when retry on timeout */
449#define BTA_AV_WAIT_CHECK_RC 0x40 /* set when the timer is used by role switch */
450#define BTA_AV_WAIT_ROLE_SW_FAILED 0x80 /* role switch failed */
451
452#define BTA_AV_WAIT_ROLE_SW_BITS (BTA_AV_WAIT_ROLE_SW_RES_OPEN|BTA_AV_WAIT_ROLE_SW_RES_START|BTA_AV_WAIT_ROLE_SW_STARTED|BTA_AV_WAIT_ROLE_SW_RETRY)
453
454/* Bitmap for collision, coll_mask */
455#define BTA_AV_COLL_INC_TMR 0x01 /* Timer is running for incoming L2C connection */
456#define BTA_AV_COLL_API_CALLED 0x02 /* API open was called while incoming timer is running */
457
458/* type for AV stream control block */
459typedef struct
460{
461 const tBTA_AV_ACT *p_act_tbl; /* the action table for stream state machine */
462 const tBTA_AV_CO_FUNCTS *p_cos; /* the associated callout functions */
463 tSDP_DISCOVERY_DB *p_disc_db; /* pointer to discovery database */
464 tBTA_AV_SEP seps[BTA_AV_MAX_SEPS];
465 tAVDT_CFG *p_cap; /* buffer used for get capabilities */
466 tBTA_AV_Q_INFO q_info;
467 tAVDT_SEP_INFO sep_info[BTA_AV_NUM_SEPS]; /* stream discovery results */
468 tAVDT_CFG cfg; /* local SEP configuration */
469 TIMER_LIST_ENT timer; /* delay timer for AVRC CT */
470 BD_ADDR peer_addr; /* peer BD address */
471 UINT16 l2c_cid; /* L2CAP channel ID */
472 UINT16 stream_mtu; /* MTU of stream */
473 UINT16 avdt_version; /* the avdt version of peer device */
474 tBTA_SEC sec_mask; /* security mask */
475 tBTA_AV_CODEC codec_type; /* codec type */
476 UINT8 media_type; /* Media type */
477 BOOLEAN cong; /* TRUE if AVDTP congested */
478 tBTA_AV_STATUS open_status; /* open failure status */
479 tBTA_AV_CHNL chnl; /* the channel: audio/video */
480 tBTA_AV_HNDL hndl; /* the handle: ((hdi + 1)|chnl) */
481 UINT16 cur_psc_mask; /* Protocol service capabilities mask for current connection */
482 UINT8 avdt_handle; /* AVDTP handle */
483 UINT8 hdi; /* the index to SCB[] */
484 UINT8 num_seps; /* number of seps returned by stream discovery */
485 UINT8 num_disc_snks; /* number of discovered snks */
486 UINT8 sep_info_idx; /* current index into sep_info */
487 UINT8 sep_idx; /* current index into local seps[] */
488 UINT8 rcfg_idx; /* reconfig requested index into sep_info */
489 UINT8 state; /* state machine state */
490 UINT8 avdt_label; /* AVDTP label */
491 UINT8 app_id; /* application id */
492 UINT8 num_recfg; /* number of reconfigure sent */
493 UINT8 role;
494 UINT8 l2c_bufs; /* the number of buffers queued to L2CAP */
495 UINT8 rc_handle; /* connected AVRCP handle */
496 BOOLEAN use_rc; /* TRUE if AVRCP is allowed */
497 BOOLEAN started; /* TRUE if stream started */
498 UINT8 co_started; /* non-zero, if stream started from call-out perspective */
499 BOOLEAN recfg_sup; /* TRUE if the first attempt to reconfigure the stream was successfull, else False if command fails */
500 BOOLEAN suspend_sup; /* TRUE if Suspend stream is supported, else FALSE if suspend command fails */
501 BOOLEAN deregistring; /* TRUE if deregistering */
502 BOOLEAN sco_suspend; /* TRUE if SUSPEND is issued automatically for SCO */
503 UINT8 coll_mask; /* Mask to check incoming and outgoing collision */
504 tBTA_AV_API_OPEN open_api; /* Saved OPEN api message */
505 UINT8 wait; /* set 0x1, when getting Caps as ACP, set 0x2, when started */
506 UINT8 q_tag; /* identify the associated q_info union member */
508
509#define BTA_AV_RC_ROLE_MASK 0x10
510#define BTA_AV_RC_ROLE_INT 0x00
511#define BTA_AV_RC_ROLE_ACP 0x10
512
513#define BTA_AV_RC_CONN_MASK 0x20
514
515/* type for AV RCP control block */
516/* index to this control block is the rc handle */
517typedef struct
518{
519 UINT8 status;
520 UINT8 handle;
521 UINT8 shdl; /* stream handle (hdi + 1) */
522 UINT8 lidx; /* (index+1) to LCB */
523 tBTA_AV_FEAT peer_features; /* peer features mask */
525#define BTA_AV_NUM_RCB (BTA_AV_NUM_STRS + 2)
526
527enum
528{
529 BTA_AV_LCB_FREE,
530 BTA_AV_LCB_FIND
531};
532
533/* type for AV ACL Link control block */
534typedef struct
535{
536 BD_ADDR addr; /* peer BD address */
537 UINT8 conn_msk; /* handle mask of connected stream handle */
538 UINT8 lidx; /* index + 1 */
540
541/* type for stream state machine action functions */
542typedef void (*tBTA_AV_SACT)(tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
543
544
545/* type for AV control block */
546typedef struct
547{
548 tBTA_AV_SCB *p_scb[BTA_AV_NUM_STRS]; /* stream control block */
549 tSDP_DISCOVERY_DB *p_disc_db; /* pointer to discovery database */
550 tBTA_AV_CBACK *p_cback; /* application callback function */
551 tBTA_AV_RCB rcb[BTA_AV_NUM_RCB]; /* RCB control block */
552 tBTA_AV_LCB lcb[BTA_AV_NUM_LINKS+1]; /* link control block */
553 TIMER_LIST_ENT sig_tmr; /* link timer */
554 TIMER_LIST_ENT acp_sig_tmr; /* timer to monitor signalling when accepting */
555 UINT32 sdp_a2d_handle; /* SDP record handle for audio src */
556 UINT32 sdp_vdp_handle; /* SDP record handle for video src */
557 tBTA_AV_FEAT features; /* features mask */
558 tBTA_SEC sec_mask; /* security mask */
559 tBTA_AV_HNDL handle; /* the handle for SDP activity */
560 BOOLEAN disabling; /* TRUE if api disabled called */
561 UINT8 disc; /* (hdi+1) or (rc_handle|BTA_AV_CHNL_MSK) if p_disc_db is in use */
562 UINT8 state; /* state machine state */
563 UINT8 conn_rc; /* handle mask of connected RCP channels */
564 UINT8 conn_audio; /* handle mask of connected audio channels */
565 UINT8 conn_video; /* handle mask of connected video channels */
566 UINT8 conn_lcb; /* index mask of used LCBs */
567 UINT8 audio_open_cnt; /* number of connected audio channels */
568 UINT8 reg_audio; /* handle mask of registered audio channels */
569 UINT8 reg_video; /* handle mask of registered video channels */
570 UINT8 rc_acp_handle;
571 UINT8 rc_acp_idx; /* (index + 1) to RCB */
572 UINT8 rs_idx; /* (index + 1) to SCB for the one waiting for RS on open */
573 BOOLEAN sco_occupied; /* TRUE if SCO is being used or call is in progress */
574 UINT8 audio_streams; /* handle mask of streaming audio channels */
575 UINT8 video_streams; /* handle mask of streaming video channels */
576} tBTA_AV_CB;
577
578
579
580/*****************************************************************************
581** Global data
582*****************************************************************************/
583
584/* control block declaration */
585#if BTA_DYNAMIC_MEMORY == FALSE
586extern tBTA_AV_CB bta_av_cb;
587#else
588extern tBTA_AV_CB *bta_av_cb_ptr;
589#define bta_av_cb (*bta_av_cb_ptr)
590#endif
591
592/* config struct */
593extern tBTA_AV_CFG *p_bta_av_cfg;
594
595/* rc id config struct */
596extern UINT16 *p_bta_av_rc_id;
597extern UINT16 *p_bta_av_rc_id_ac;
598
599extern const tBTA_AV_SACT bta_av_a2d_action[];
600extern const tBTA_AV_CO_FUNCTS bta_av_a2d_cos;
601extern const tBTA_AV_SACT bta_av_vdp_action[];
602extern tAVDT_CTRL_CBACK * const bta_av_dt_cback[];
603
604/*****************************************************************************
605** Function prototypes
606*****************************************************************************/
607/* utility functions */
608extern tBTA_AV_SCB *bta_av_hndl_to_scb(UINT16 handle);
609extern BOOLEAN bta_av_chk_start(tBTA_AV_SCB *p_scb);
610extern void bta_av_restore_switch (void);
611extern UINT16 bta_av_chk_mtu(tBTA_AV_SCB *p_scb, UINT16 mtu);
612extern void bta_av_conn_cback(UINT8 handle, BD_ADDR bd_addr, UINT8 event, tAVDT_CTRL *p_data);
613extern UINT8 bta_av_rc_create(tBTA_AV_CB *p_cb, UINT8 role, UINT8 shdl, UINT8 lidx);
614extern void bta_av_proc_stream_evt(UINT8 handle, BD_ADDR bd_addr, UINT8 event, tAVDT_CTRL *p_data, int index);
615extern void bta_av_stream_chg(tBTA_AV_SCB *p_scb, BOOLEAN started);
616extern BOOLEAN bta_av_is_scb_opening (tBTA_AV_SCB *p_scb);
617extern BOOLEAN bta_av_is_scb_incoming (tBTA_AV_SCB *p_scb);
618extern void bta_av_set_scb_sst_init (tBTA_AV_SCB *p_scb);
619extern BOOLEAN bta_av_is_scb_init (tBTA_AV_SCB *p_scb);
620extern void bta_av_set_scb_sst_incoming (tBTA_AV_SCB *p_scb);
621extern tBTA_AV_LCB * bta_av_find_lcb(BD_ADDR addr, UINT8 op);
622
623
624/* main functions */
625extern void bta_av_api_deregister(tBTA_AV_DATA *p_data);
626extern void bta_av_dup_audio_buf(tBTA_AV_SCB *p_scb, BT_HDR *p_buf);
627extern void bta_av_sm_execute(tBTA_AV_CB *p_cb, UINT16 event, tBTA_AV_DATA *p_data);
628extern void bta_av_ssm_execute(tBTA_AV_SCB *p_scb, UINT16 event, tBTA_AV_DATA *p_data);
629extern BOOLEAN bta_av_hdl_event(BT_HDR *p_msg);
630#if (defined(BTA_AV_DEBUG) && BTA_AV_DEBUG == TRUE)
631extern char *bta_av_evt_code(UINT16 evt_code);
632#endif
633extern BOOLEAN bta_av_switch_if_needed(tBTA_AV_SCB *p_scb);
634extern BOOLEAN bta_av_link_role_ok(tBTA_AV_SCB *p_scb, UINT8 bits);
635extern BOOLEAN bta_av_is_rcfg_sst(tBTA_AV_SCB *p_scb);
636
637/* nsm action functions */
638extern void bta_av_api_disconnect(tBTA_AV_DATA *p_data);
639extern void bta_av_sig_chg(tBTA_AV_DATA *p_data);
640extern void bta_av_sig_timer(tBTA_AV_DATA *p_data);
641extern void bta_av_rc_disc_done(tBTA_AV_DATA *p_data);
642extern void bta_av_rc_closed(tBTA_AV_DATA *p_data);
643extern void bta_av_rc_disc(UINT8 disc);
644extern void bta_av_conn_chg(tBTA_AV_DATA *p_data);
645extern void bta_av_dereg_comp(tBTA_AV_DATA *p_data);
646
647/* sm action functions */
648extern void bta_av_disable (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
649extern void bta_av_rc_opened (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
650extern void bta_av_rc_remote_cmd (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
651extern void bta_av_rc_vendor_cmd (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
652extern void bta_av_rc_vendor_rsp (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
653extern void bta_av_rc_msg (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
654extern void bta_av_rc_close (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
655extern void bta_av_rc_meta_rsp (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
656extern void bta_av_rc_free_rsp (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
657extern void bta_av_rc_free_msg (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
658
659extern tBTA_AV_RCB * bta_av_get_rcb_by_shdl(UINT8 shdl);
660extern void bta_av_del_rc(tBTA_AV_RCB *p_rcb);
661
662/* ssm action functions */
663extern void bta_av_do_disc_a2d (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
664extern void bta_av_cleanup (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
665extern void bta_av_free_sdb (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
666extern void bta_av_config_ind (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
667extern void bta_av_disconnect_req (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
668extern void bta_av_security_req (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
669extern void bta_av_security_rsp (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
670extern void bta_av_setconfig_rsp (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
671extern void bta_av_st_rc_timer(tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
672extern void bta_av_str_opened (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
673extern void bta_av_security_ind (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
674extern void bta_av_security_cfm (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
675extern void bta_av_do_close (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
676extern void bta_av_connect_req (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
677extern void bta_av_sdp_failed (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
678extern void bta_av_disc_results (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
679extern void bta_av_disc_res_as_acp (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
680extern void bta_av_open_failed (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
681extern void bta_av_getcap_results (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
682extern void bta_av_setconfig_rej (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
683extern void bta_av_discover_req (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
684extern void bta_av_conn_failed (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
685extern void bta_av_do_start (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
686extern void bta_av_str_stopped (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
687extern void bta_av_reconfig (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
688extern void bta_av_data_path (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
689extern void bta_av_start_ok (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
690extern void bta_av_start_failed (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
691extern void bta_av_str_closed (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
692extern void bta_av_clr_cong (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
693extern void bta_av_suspend_cfm (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
694extern void bta_av_rcfg_str_ok (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
695extern void bta_av_rcfg_failed (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
696extern void bta_av_rcfg_connect (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
697extern void bta_av_rcfg_discntd (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
698extern void bta_av_suspend_cont (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
699extern void bta_av_rcfg_cfm (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
700extern void bta_av_rcfg_open (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
701extern void bta_av_security_rej (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
702extern void bta_av_open_rc (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
703extern void bta_av_chk_2nd_start (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
704extern void bta_av_save_caps (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
705extern void bta_av_rej_conn (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
706extern void bta_av_rej_conn (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
707extern void bta_av_set_use_rc (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
708extern void bta_av_cco_close (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
709extern void bta_av_switch_role (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
710extern void bta_av_role_res (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
711extern void bta_av_delay_co (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
712extern void bta_av_open_at_inc (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
713
714/* ssm action functions - vdp specific */
715extern void bta_av_do_disc_vdp (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
716extern void bta_av_vdp_str_opened (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
717extern void bta_av_reg_vdp (tAVDT_CS *p_cs, char *p_service_name, void *p_data);
718
719#endif /* BTA_AV_INT_H */