1/******************************************************************************
2 *
3 *  Copyright (C) 1999-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 sync message over UIPC
22 *
23 ******************************************************************************/
24
25#ifndef BT_VENDOR_UIPC_MSG_H
26#define BT_VENDOR_UIPC_MSG_H
27
28#include "bt_types.h"
29
30/****************************************************************************/
31/*                            UIPC version number: 1.0                      */
32/****************************************************************************/
33#define UIPC_VERSION_MAJOR 0x0001
34#define UIPC_VERSION_MINOR 0x0000
35
36/********************************
37
38    UIPC Management Messages
39
40********************************/
41
42/* tUIPC_STATUS codes */
43enum {
44    UIPC_STATUS_SUCCESS,
45    UIPC_STATUS_FAIL
46};
47
48/* op_code */
49#define UIPC_OPEN_REQ 0x00
50#define UIPC_OPEN_RSP 0x01
51#define UIPC_CLOSE_REQ 0x02
52#define UIPC_CLOSE_RSP 0x03
53
54#pragma pack(push) /* push current alignment to stack */
55#pragma pack(1)    /* set alignment to 1 byte boundary to allow for offset mappings */
56
57/* Structure of UIPC_OPEN_REQ message */
58typedef struct {
59    uint8_t opcode; /* UIPC_OPEN_REQ */
60} tUIPC_OPEN_REQ;
61#define UIPC_OPEN_REQ_MSGLEN (1)
62
63/* Structure of UIPC_OPEN_RSP message */
64typedef struct {
65    uint8_t opcode;         /* UIPC_OPEN_RESP */
66    uint8_t status;         /* UIPC_STATUS */
67    uint16_t version_major; /* UIPC_VERSION_MAJOR */
68    uint16_t version_minor; /* UIPC_VERSION_MINOR */
69    uint8_t num_streams;    /* Number of simultaneous streams supported by the light stack */
70} tUIPC_OPEN_RSP;
71#define UIPC_OPEN_RSP_MSGLEN (7)
72
73/* Structure of UIPC_CLOSE_REQ message */
74typedef struct t_uipc_close_req {
75    uint8_t opcode; /* UIPC_CLOSE_REQ */
76} tUIPC_CLOSE_REQ;
77#define UIPC_CLOSE_REQ_MSGLEN (1)
78
79/* Structure of UIPC_CLOSE_RSP message, only for BTC, full stack may ignore it */
80typedef struct t_uipc_close_rsp {
81    uint8_t opcode; /* UIPC_CLOSE_RSP */
82} tUIPC_CLOSE_RSP;
83#define UIPC_CLOSE_RSP_MSGLEN (1)
84
85/* UIPC management message structures */
86typedef union {
87    uint8_t opcode;
88    tUIPC_OPEN_REQ open_req;
89    tUIPC_OPEN_RSP open_resp;
90    tUIPC_CLOSE_REQ close_req;
91} tUIPC_MSG;
92
93#define UIPC_MGMT_MSG_MAXLEN (sizeof(tUIPC_MSG))
94
95#define IPC_LOG_MSG_LEN 100
96typedef struct t_uipc_log_msg {
97    uint32_t trace_set_mask;
98    uint8_t msg[IPC_LOG_MSG_LEN];
99} tUIPC_LOG_MSG;
100#define UIPC_LOG_MSGLEN (IPC_LOG_MSG_LEN + 4)
101
102/********************************
103
104    H5 Sync Message
105
106********************************/
107
108/* op_code */
109#define SLIP_SYNC_TO_LITE_REQ 0
110#define SLIP_SYNC_TO_LITE_RESP 1
111#define SLIP_SYNC_TO_FULL_REQ 2
112#define SLIP_SYNC_TO_FULL_RESP 3
113#define SLIP_SYNC_NOTIFY 4
114
115/* status */
116#define SLIP_SYNC_SUCCESS 0
117#define SLIP_SYNC_FAILURE 1
118
119typedef struct {
120    uint8_t op_code;
121    uint8_t status;
122    uint16_t acl_pkt_size;
123    uint8_t state;
124    uint8_t lp_state;            /* Low Power state */
125    uint8_t next_seqno;          /* next send seq */
126    uint8_t ack;                 /* next ack seq, expected seq from peer */
127    uint8_t sent_ack;            /* last sent ack */
128    uint8_t sliding_window_size; /* window size */
129    bool oof_flow_control;       /* Out of Frame SW Flow Control */
130    bool data_integrity_type;    /* Level of Data Integrity Check */
131    uint8_t rx_state;            /* rx state for incoming packet processing */
132} tSLIP_SYNC_INFO;
133
134/********************************
135
136    L2CAP Sync Message
137
138********************************/
139
140/* op_code */
141#define L2C_SYNC_TO_LITE_REQ 0
142#define L2C_SYNC_TO_LITE_RESP 1
143#define L2C_REMOVE_TO_LITE_REQ 2
144#define L2C_REMOVE_TO_LITE_RESP 3
145#define L2C_FLUSH_TO_FULL_IND 4
146
147/* status */
148#define L2C_SYNC_SUCCESS 0
149#define L2C_SYNC_FAILURE 1
150
151typedef struct t_l2c_stream_info {
152    uint16_t local_cid;       /* Local CID                        */
153    uint16_t remote_cid;      /* Remote CID                       */
154    uint16_t out_mtu;         /* Max MTU we will send             */
155    uint16_t handle;          /* The handle used with LM          */
156    uint16_t link_xmit_quota; /* Num outstanding pkts allowed     */
157    bool is_flushable;        /* TRUE if flushable channel        */
158} tL2C_STREAM_INFO;
159
160typedef struct t_l2c_sync_to_lite_req {
161    uint8_t op_code;                    /* L2C_SYNC_TO_LITE_REQ */
162    uint16_t light_xmit_quota;          /* Total quota for light stack    */
163    uint16_t acl_data_size;             /* Max ACL data size across HCI transport    */
164    uint16_t non_flushable_pbf;         /* L2CAP_PKT_START_NON_FLUSHABLE if controller supports */
165                                        /* Otherwise, L2CAP_PKT_START */
166    uint8_t multi_av_data_cong_start;   /* Multi-AV queue size to start congestion */
167    uint8_t multi_av_data_cong_end;     /* Multi-AV queue size to end congestion */
168    uint8_t multi_av_data_cong_discard; /* Multi-AV queue size to discard */
169    uint8_t num_stream;
170    tL2C_STREAM_INFO stream;
171} tL2C_SYNC_TO_LITE_REQ;
172
173typedef struct t_l2c_sync_to_lite_resp_stream {
174    uint16_t lcid;
175    uint8_t status;
176} tL2C_SYNC_TO_LITE_RESP_STREAM;
177
178typedef struct t_l2c_sync_to_lite_resp {
179    uint8_t op_code;             /* L2C_SYNC_TO_LITE_RESP */
180    uint16_t light_xmit_unacked; /* unacked packet more than quota in light stack    */
181    uint8_t num_stream;
182    tL2C_SYNC_TO_LITE_RESP_STREAM stream;
183} tL2C_SYNC_TO_LITE_RESP;
184
185typedef struct t_l2c_remove_to_lite_req {
186    uint8_t op_code;           /* L2C_REMOVE_TO_LITE_REQ */
187    uint16_t light_xmit_quota; /* Total quota for light stack    */
188    uint8_t num_stream;
189    uint16_t lcid;
190} tL2C_REMOVE_TO_LITE_REQ;
191
192typedef tL2C_SYNC_TO_LITE_RESP tL2C_REMOVE_TO_LITE_RESP;
193typedef tL2C_REMOVE_TO_LITE_REQ tL2C_FLUSH_TO_FULL_IND;
194
195typedef union t_l2c_sync_msg {
196    uint8_t op_code;
197    tL2C_SYNC_TO_LITE_REQ sync_req;
198    tL2C_SYNC_TO_LITE_RESP sync_resp;
199    tL2C_REMOVE_TO_LITE_REQ remove_req;
200    tL2C_REMOVE_TO_LITE_RESP remove_resp;
201    tL2C_FLUSH_TO_FULL_IND flush_ind;
202} tL2C_SYNC_MSG;
203
204/********************************
205
206    AVDTP Sync Message
207
208********************************/
209
210/* op_code */
211#define AVDT_SYNC_TO_LITE_REQ 0
212#define AVDT_SYNC_TO_LITE_RESP 1
213#define AVDT_RESYNC_TO_LITE_REQ 2
214#define AVDT_RESYNC_TO_LITE_RESP 3
215#define AVDT_SYNC_TO_FULL_REQ 4
216#define AVDT_SYNC_TO_FULL_RESP 5
217#define AVDT_REMOVE_TO_LITE_REQ 6
218#define AVDT_REMOVE_TO_LITE_RESP 7
219#define AVDT_SYNC_TO_BTC_LITE_REQ 8
220#define AVDT_SYNC_TO_BTC_LITE_RESP 9
221
222/* status */
223#define AVDT_SYNC_SUCCESS 0
224#define AVDT_SYNC_FAILURE 1
225
226typedef struct {
227    uint16_t lcid;
228    uint32_t ssrc;
229} tAVDT_SYNC_TO_BTC_LITE_REQ_STREAM;
230
231typedef struct {
232    uint8_t opcode; /* AVDT_SYNC_TO_BTC_LITE_REQ */
233    uint8_t num_stream;
234    tAVDT_SYNC_TO_BTC_LITE_REQ_STREAM stream;
235} tAVDT_SYNC_TO_BTC_LITE_REQ;
236
237typedef struct {
238    uint8_t opcode; /* AVDT_SYNC_TO_BTC_LITE_RESP */
239    uint8_t status;
240} tAVDT_SYNC_TO_BTC_LITE_RESP;
241
242typedef struct t_avdt_scb_sync_info {
243    uint8_t handle;         /* SCB handle */
244    BD_ADDR peer_addr;      /* BD address of peer */
245    uint16_t local_cid;     /* Local CID                        */
246    uint16_t peer_mtu;      /* L2CAP mtu of the peer device */
247    uint8_t mux_tsid_media; /* TSID for media transport session */
248    uint16_t media_seq;     /* media packet sequence number */
249} tAVDT_SCB_SYNC_INFO;
250
251typedef struct t_avdt_sync_info {
252    uint8_t op_code;
253    uint8_t status;
254    tAVDT_SCB_SYNC_INFO scb_info;
255} tAVDT_SYNC_INFO;
256
257typedef union t_avdt_sync_msg {
258    uint8_t op_code;
259    tAVDT_SYNC_INFO sync_info;
260    tAVDT_SYNC_TO_BTC_LITE_REQ btc_sync_req;
261    tAVDT_SYNC_TO_BTC_LITE_RESP btc_sync_resp;
262} tAVDT_SYNC_MSG;
263
264/********************************
265
266    BTA AV Sync Message
267
268********************************/
269
270/* op_code for MM light stack */
271#define BTA_AV_SYNC_TO_LITE_REQ 0
272#define BTA_AV_SYNC_TO_LITE_RESP 1
273#define BTA_AV_STR_START_TO_LITE_REQ 2
274#define BTA_AV_STR_START_TO_LITE_RESP 3
275#define BTA_AV_STR_STOP_TO_LITE_REQ 4
276#define BTA_AV_STR_STOP_TO_LITE_RESP 5
277#define BTA_AV_STR_CLEANUP_TO_LITE_REQ 6
278#define BTA_AV_STR_CLEANUP_TO_LITE_RESP 7
279#define BTA_AV_STR_SUSPEND_TO_LITE_REQ 8
280#define BTA_AV_STR_SUSPEND_TO_LITE_RESP 9
281#define BTA_AV_SYNC_ERROR_RESP 10
282
283/* op_code for BTC light stack */
284#define A2DP_START_REQ 11
285#define A2DP_START_RESP 12
286#define A2DP_STOP_REQ 13
287#define A2DP_STOP_RESP 14
288#define A2DP_CLEANUP_REQ 15
289#define A2DP_CLEANUP_RESP 16
290#define A2DP_SUSPEND_REQ 17
291#define A2DP_SUSPEND_RESP 18
292
293#define A2DP_JITTER_DONE_IND 41 /* For BTSNK */
294
295#define AUDIO_CODEC_CONFIG_REQ 19
296#define AUDIO_CODEC_CONFIG_RESP 20
297#define AUDIO_CODEC_SET_BITRATE_REQ 21
298#define AUDIO_CODEC_FLUSH_REQ 22
299#define AUDIO_ROUTE_CONFIG_REQ 23
300#define AUDIO_ROUTE_CONFIG_RESP 24
301#define AUDIO_MIX_CONFIG_REQ 25
302#define AUDIO_MIX_CONFIG_RESP 26
303#define AUDIO_BURST_FRAMES_IND 27
304#define AUDIO_BURST_END_IND 28
305#define AUDIO_EQ_MODE_CONFIG_REQ 29
306#define AUDIO_SCALE_CONFIG_REQ 30
307
308/* For TIVO, only applicable for I2S -> DAC */
309#define AUDIO_SUB_ROUTE_REQ 51
310#define AUDIO_SUB_ROUTE_RESP 52
311
312typedef struct {
313    uint8_t opcode; /* A2DP_START_REQ */
314    uint16_t lcid;
315    uint16_t curr_mtu;
316} tA2DP_START_REQ;
317
318typedef struct {
319    uint8_t opcode; /* A2DP_STOP_REQ */
320    uint16_t lcid;
321} tA2DP_STOP_REQ;
322
323typedef struct {
324    uint8_t opcode; /* A2DP_SUSPEND_REQ */
325    uint16_t lcid;
326} tA2DP_SUSPEND_REQ;
327
328typedef struct {
329    uint8_t opcode; /* A2DP_CLEANUP_REQ */
330    uint16_t lcid;
331    uint16_t curr_mtu;
332} tA2DP_CLEANUP_REQ;
333
334typedef struct {
335    uint8_t opcode; /* A2DP_START_RESP, A2DP_STOP_RESP, A2DP_CLEANUP_RESP, A2DP_SUSPEND_RESP */
336    uint16_t lcid;
337} tA2DP_GENERIC_RESP;
338
339#define AUDIO_CODEC_NONE 0x0000
340#define AUDIO_CODEC_SBC_ENC 0x0001
341#define AUDIO_CODEC_SBC_DEC 0x0002
342#define AUDIO_CODEC_MP3_ENC 0x0004
343#define AUDIO_CODEC_MP3_DEC 0x0008
344#define AUDIO_CODEC_AAC_ENC 0x0010
345#define AUDIO_CODEC_AAC_DEC 0x0020
346#define AUDIO_CODEC_AAC_PLUS_ENC 0x0040
347#define AUDIO_CODEC_AAC_PLUS_DEC 0x0080
348#define AUDIO_CODEC_MP2_ENC 0x0100
349#define AUDIO_CODEC_MP2_DEC 0x0200
350#define AUDIO_CODEC_MP2_5_ENC 0x0400
351#define AUDIO_CODEC_MP2_5_DEC 0x0800
352
353/* SBC CODEC Parameters */
354
355#define CODEC_INFO_SBC_SF_16K 0x00
356#define CODEC_INFO_SBC_SF_32K 0x01
357#define CODEC_INFO_SBC_SF_44K 0x02
358#define CODEC_INFO_SBC_SF_48K 0x03
359
360#define CODEC_INFO_SBC_BLOCK_4 0x00
361#define CODEC_INFO_SBC_BLOCK_8 0x01
362#define CODEC_INFO_SBC_BLOCK_12 0x02
363#define CODEC_INFO_SBC_BLOCK_16 0x03
364
365#define CODEC_INFO_SBC_CH_MONO 0x00
366#define CODEC_INFO_SBC_CH_DUAL 0x01
367#define CODEC_INFO_SBC_CH_STEREO 0x02
368#define CODEC_INFO_SBC_CH_JS 0x03
369
370#define CODEC_INFO_SBC_ALLOC_LOUDNESS 0x00
371#define CODEC_INFO_SBC_ALLOC_SNR 0x01
372
373#define CODEC_INFO_SBC_SUBBAND_4 0x00
374#define CODEC_INFO_SBC_SUBBAND_8 0x01
375
376/* MPEG audio version ID */
377#define CODEC_INFO_MP25_ID 0x00
378#define CODEC_INFO_RESERVE 0x01
379#define CODEC_INFO_MP2_ID 0x02
380#define CODEC_INFO_MP3_ID 0x03
381
382#define CODEC_INFO_MP3_PROTECTION_ON 0x00
383#define CODEC_INFO_MP3_PROTECTION_OFF 0x01
384
385#define CODEC_INFO_MP3_BR_IDX_FREE 0x00
386#define CODEC_INFO_MP3_BR_IDX_32K 0x01
387#define CODEC_INFO_MP3_BR_IDX_40K 0x02
388#define CODEC_INFO_MP3_BR_IDX_48K 0x03
389#define CODEC_INFO_MP3_BR_IDX_56K 0x04
390#define CODEC_INFO_MP3_BR_IDX_64K 0x05
391#define CODEC_INFO_MP3_BR_IDX_80K 0x06
392#define CODEC_INFO_MP3_BR_IDX_96K 0x07
393#define CODEC_INFO_MP3_BR_IDX_112K 0x08
394#define CODEC_INFO_MP3_BR_IDX_128K 0x09
395#define CODEC_INFO_MP3_BR_IDX_160K 0x0A
396#define CODEC_INFO_MP3_BR_IDX_192K 0x0B
397#define CODEC_INFO_MP3_BR_IDX_224K 0x0C
398#define CODEC_INFO_MP3_BR_IDX_256K 0x0D
399#define CODEC_INFO_MP3_BR_IDX_320K 0x0E
400
401#define CODEC_INFO_MP3_SF_44K 0x00
402#define CODEC_INFO_MP3_SF_48K 0x01
403#define CODEC_INFO_MP3_SF_32K 0x02
404
405#define CODEC_INFO_MP3_MODE_STEREO 0x00
406#define CODEC_INFO_MP3_MODE_JS 0x01
407#define CODEC_INFO_MP3_MODE_DUAL 0x02
408#define CODEC_INFO_MP3_MODE_SINGLE 0x03
409
410/* layer 3, type of joint stereo coding method (intensity and ms) */
411#define CODEC_INFO_MP3_MODE_EXT_OFF_OFF 0x00
412#define CODEC_INFO_MP3_MODE_EXT_ON_OFF 0x01
413#define CODEC_INFO_MP3_MODE_EXT_OFF_ON 0x02
414#define CODEC_INFO_MP3_MODE_EXT_ON_ON 0x03
415
416#define CODEC_INFO_MP2_PROTECTION_ON 0x00
417#define CODEC_INFO_MP2_PROTECTION_OFF 0x01
418
419#define CODEC_INFO_MP2_BR_IDX_FREE 0x00
420#define CODEC_INFO_MP2_BR_IDX_8K 0x01
421#define CODEC_INFO_MP2_BR_IDX_16K 0x02
422#define CODEC_INFO_MP2_BR_IDX_24K 0x03
423#define CODEC_INFO_MP2_BR_IDX_32K 0x04
424#define CODEC_INFO_MP2_BR_IDX_40K 0x05
425#define CODEC_INFO_MP2_BR_IDX_48K 0x06
426#define CODEC_INFO_MP2_BR_IDX_56K 0x07
427#define CODEC_INFO_MP2_BR_IDX_64K 0x08
428#define CODEC_INFO_MP2_BR_IDX_80K 0x09
429#define CODEC_INFO_MP2_BR_IDX_96K 0x0A
430#define CODEC_INFO_MP2_BR_IDX_112K 0x0B
431#define CODEC_INFO_MP2_BR_IDX_128K 0x0C
432#define CODEC_INFO_MP2_BR_IDX_144K 0x0D
433#define CODEC_INFO_MP2_BR_IDX_160K 0x0E
434
435#define CODEC_INFO_MP2_SF_22K 0x00
436#define CODEC_INFO_MP2_SF_24K 0x01
437#define CODEC_INFO_MP2_SF_16K 0x02
438
439#define CODEC_INFO_MP2_MODE_STEREO 0x00
440#define CODEC_INFO_MP2_MODE_JS 0x01
441#define CODEC_INFO_MP2_MODE_DUAL 0x02
442#define CODEC_INFO_MP2_MODE_SINGLE 0x03
443
444/* layer 3, type of joint stereo coding method (intensity and ms) */
445#define CODEC_INFO_MP2_MODE_EXT_OFF_OFF 0x00
446#define CODEC_INFO_MP2_MODE_EXT_ON_OFF 0x01
447#define CODEC_INFO_MP2_MODE_EXT_OFF_ON 0x02
448#define CODEC_INFO_MP2_MODE_EXT_ON_ON 0x03
449
450#define CODEC_INFO_MP2_SAMPLE_PER_FRAME 576
451
452/* mpeg 2.5 layer 3 decoder */
453
454#define CODEC_INFO_MP25_PROTECTION_ON 0x00
455#define CODEC_INFO_MP25_PROTECTION_OFF 0x01
456
457#define CODEC_INFO_MP25_BR_IDX_FREE 0x00
458#define CODEC_INFO_MP25_BR_IDX_8K 0x01
459#define CODEC_INFO_MP25_BR_IDX_16K 0x02
460#define CODEC_INFO_MP25_BR_IDX_24K 0x03
461#define CODEC_INFO_MP25_BR_IDX_32K 0x04
462#define CODEC_INFO_MP25_BR_IDX_40K 0x05
463#define CODEC_INFO_MP25_BR_IDX_48K 0x06
464#define CODEC_INFO_MP25_BR_IDX_56K 0x07
465#define CODEC_INFO_MP25_BR_IDX_64K 0x08
466#define CODEC_INFO_MP25_BR_IDX_80K 0x09
467#define CODEC_INFO_MP25_BR_IDX_96K 0x0A
468#define CODEC_INFO_MP25_BR_IDX_112K 0x0B
469#define CODEC_INFO_MP25_BR_IDX_128K 0x0C
470#define CODEC_INFO_MP25_BR_IDX_144K 0x0D
471#define CODEC_INFO_MP25_BR_IDX_160K 0x0E
472
473#define CODEC_INFO_MP25_SF_11K 0x00
474#define CODEC_INFO_MP25_SF_12K 0x01
475#define CODEC_INFO_MP25_SF_8K 0x02
476
477#define CODEC_INFO_MP25_MODE_STEREO 0x00
478#define CODEC_INFO_MP25_MODE_JS 0x01
479#define CODEC_INFO_MP25_MODE_DUAL 0x02
480#define CODEC_INFO_MP25_MODE_SINGLE 0x03
481
482/* layer 3, type of joint stereo coding method (intensity and ms) */
483#define CODEC_INFO_MP25_MODE_EXT_OFF_OFF 0x00
484#define CODEC_INFO_MP25_MODE_EXT_ON_OFF 0x01
485#define CODEC_INFO_MP25_MODE_EXT_OFF_ON 0x02
486#define CODEC_INFO_MP25_MODE_EXT_ON_ON 0x03
487
488#define CODEC_INFO_MP25_SAMPLE_PER_FRAME 576
489
490/* AAC/AAC+ CODEC Parameters */
491#define CODEC_INFO_AAC_SF_IDX_96K 0x0
492#define CODEC_INFO_AAC_SF_IDX_88K 0x1
493#define CODEC_INFO_AAC_SF_IDX_64K 0x2
494#define CODEC_INFO_AAC_SF_IDX_48K 0x3
495#define CODEC_INFO_AAC_SF_IDX_44K 0x4
496#define CODEC_INFO_AAC_SF_IDX_32K 0x5
497#define CODEC_INFO_AAC_SF_IDX_24K 0x6
498#define CODEC_INFO_AAC_SF_IDX_22K 0x7
499#define CODEC_INFO_AAC_SF_IDX_16K 0x8
500#define CODEC_INFO_AAC_SF_IDX_12K 0x9
501#define CODEC_INFO_AAC_SF_IDX_11K 0xA
502#define CODEC_INFO_AAC_SF_IDX_08K 0xB
503#define CODEC_INFO_AAC_SF_IDX_RESERVE 0xC
504
505#define CODEC_INFO_AAC_BR_RATE_48K 288000
506#define CODEC_INFO_AAC_BR_RATE_44K 264600
507#define CODEC_INFO_AAC_BR_RATE_32K 192000
508
509#define CODEC_INFO_AAC_1_CH 1 /* center front speaker */
510#define CODEC_INFO_AAC_2_CH 2 /* left, right front speaker */
511#define CODEC_INFO_AAC_3_CH 3 /* center front speaker, left right front speaker */
512#define CODEC_INFO_AAC_4_CH 4 /* center/rear front speaker, left/right front speaker */
513#define CODEC_INFO_AAC_5_CH 5 /* center, left, right front speaker, left/right surround */
514#define CODEC_INFO_AAC_6_CH 6 /* center, left, right front speaker, left/right surround, LFE */
515#define CODEC_INFO_AAC_7_CH 7 /* (left, right)center/left,right front speaker, left/right surround, LFE */
516
517typedef struct {
518    uint8_t sampling_freq;
519    uint8_t channel_mode;
520    uint8_t block_length;
521    uint8_t num_subbands;
522    uint8_t alloc_method;
523    uint8_t bitpool_size; /* 2 - 250 */
524} tCODEC_INFO_SBC;
525
526typedef struct {
527    uint8_t ch_mode;
528    uint8_t sampling_freq;
529    uint8_t bitrate_index; /* 0 - 14 */
530} tCODEC_INFO_MP3;
531
532typedef struct {
533    uint8_t ch_mode;
534    uint8_t sampling_freq;
535    uint8_t bitrate_index; /* 0 - 14 */
536} tCODEC_INFO_MP2;
537
538typedef struct {
539    uint8_t ch_mode;
540    uint8_t sampling_freq;
541    uint8_t bitrate_index; /* 0 - 14 */
542} tCODEC_INFO_MP2_5;
543
544typedef struct {
545    uint16_t sampling_freq;
546    uint8_t channel_mode; /* 0x02:mono, 0x01:dual */
547    uint32_t bitrate;     /* 0 - 320K */
548    uint32_t sbr_profile; /* 1: ON, 0: OFF */
549} tCODEC_INFO_AAC;
550
551typedef union {
552    tCODEC_INFO_SBC sbc;
553    tCODEC_INFO_MP3 mp3;
554    tCODEC_INFO_MP2 mp2;
555    tCODEC_INFO_MP2_5 mp2_5;
556    tCODEC_INFO_AAC aac;
557} tCODEC_INFO;
558
559typedef struct {
560    uint8_t opcode; /* AUDIO_CODEC_CONFIG_REQ */
561    uint16_t codec_type;
562    tCODEC_INFO codec_info;
563} tAUDIO_CODEC_CONFIG_REQ;
564
565#define AUDIO_CONFIG_SUCCESS 0x00
566#define AUDIO_CONFIG_NOT_SUPPORTED 0x01
567#define AUDIO_CONFIG_FAIL_OUT_OF_MEMORY 0x02
568#define AUDIO_CONFIG_FAIL_CODEC_USED 0x03
569#define AUDIO_CONFIG_FAIL_ROUTE 0x04
570
571typedef struct {
572    uint8_t opcode; /* AUDIO_CODEC_CONFIG_RESP */
573    uint8_t status;
574} tAUDIO_CODEC_CONFIG_RESP;
575
576typedef struct {
577    uint8_t opcode; /* AUDIO_CODEC_SET_BITRATE_REQ */
578    uint16_t codec_type;
579    union {
580        uint8_t sbc;
581        uint8_t mp3;
582        uint32_t aac;
583    } codec_bitrate;
584} tAUDIO_CODEC_SET_BITRATE_REQ;
585
586#define AUDIO_ROUTE_SRC_FMRX 0x00
587#define AUDIO_ROUTE_SRC_I2S 0x01
588#define AUDIO_ROUTE_SRC_ADC 0x02
589#define AUDIO_ROUTE_SRC_HOST 0x03
590#define AUDIO_ROUTE_SRC_PTU 0x04
591#define AUDIO_ROUTE_SRC_BTSNK 0x05
592#define AUDIO_ROUTE_SRC_NONE 0x80
593#define MAX_AUDIO_ROUTE_SRC 6
594
595#define AUDIO_ROUTE_MIX_NONE 0x00
596#define AUDIO_ROUTE_MIX_HOST 0x01
597#define AUDIO_ROUTE_MIX_PCM 0x02
598#define AUDIO_ROUTE_MIX_CHIRP 0x03
599#define AUDIO_ROUTE_MIX_I2S 0x04
600#define AUDIO_ROUTE_MIX_ADC 0x05
601#define AUDIO_ROUTE_MIX_RESERVED 0x06
602#define MAX_AUDIO_ROUTE_MIX 7
603
604#define AUDIO_ROUTE_OUT_NONE 0x0000
605#define AUDIO_ROUTE_OUT_BTA2DP 0x0001
606#define AUDIO_ROUTE_OUT_FMTX 0x0002
607#define AUDIO_ROUTE_OUT_BTSCO 0x0004
608#define AUDIO_ROUTE_OUT_HOST 0x0008
609#define AUDIO_ROUTE_OUT_DAC 0x0010
610#define AUDIO_ROUTE_OUT_I2S 0x0020
611#define AUDIO_ROUTE_OUT_BTA2DP_DAC 0x0040
612#define AUDIO_ROUTE_OUT_BTA2DP_I2S 0x0080
613#define AUDIO_ROUTE_OUT_BTSCO_DAC 0x0100
614#define AUDIO_ROUTE_OUT_BTSCO_I2S 0x0200
615#define AUDIO_ROUTE_OUT_HOST_BTA2DP 0x0400
616#define AUDIO_ROUTE_OUT_HOST_BTSCO 0x0800
617#define AUDIO_ROUTE_OUT_HOST_DAC 0x1000
618#define AUDIO_ROUTE_OUT_HOST_I2S 0x2000
619#define AUDIO_ROUTE_OUT_DAC_I2S 0x4000
620#define AUDIO_ROUTE_OUT_RESERVED_2 0x8000
621
622#define MAX_AUDIO_SINGLE_ROUTE_OUT 6
623#define MAX_AUDIO_MULTI_ROUTE_OUT 16
624
625#define AUDIO_ROUTE_SF_8K 0x00
626#define AUDIO_ROUTE_SF_16K 0x01
627#define AUDIO_ROUTE_SF_32K 0x02
628#define AUDIO_ROUTE_SF_44_1K 0x03
629#define AUDIO_ROUTE_SF_48K 0x04
630#define AUDIO_ROUTE_SF_11K 0x05
631#define AUDIO_ROUTE_SF_12K 0x06
632#define AUDIO_ROUTE_SF_22K 0x07
633#define AUDIO_ROUTE_SF_24K 0x08
634#define AUDIO_ROUTE_SF_NA 0xFF
635
636#define AUDIO_ROUTE_EQ_BASS_BOOST 0x00
637#define AUDIO_ROUTE_EQ_CLASSIC 0x01
638#define AUDIO_ROUTE_EQ_JAZZ 0x02
639#define AUDIO_ROUTE_EQ_LIVE 0x03
640#define AUDIO_ROUTE_EQ_NORMAL 0x04
641#define AUDIO_ROUTE_EQ_ROCK 0x05
642#define AUDIO_ROUTE_EQ_BYPASS 0x06
643
644#define AUDIO_ROUTE_DIGITAL_VOLUME_CONTROL 0x07
645
646#define AUDIO_ROUTE_EQ_CONFIG_GAIN 0xFF /* Custion Gain Config */
647
648typedef struct {
649    uint8_t opcode; /* AUDIO_ROUTE_CONFIG_REQ */
650    uint8_t src;
651    uint8_t src_sf;
652    uint8_t out;
653    uint8_t out_codec_sf;
654    uint8_t out_i2s_sf;
655    uint8_t eq_mode;
656} tAUDIO_ROUTE_CONFIG_REQ;
657
658typedef struct {
659    uint8_t opcode; /* AUDIO_ROUTE_CONFIG_RESP */
660    uint8_t status;
661} tAUDIO_ROUTE_CONFIG_RESP;
662
663typedef struct {
664    uint16_t amp[2];   /* left/right 15 bit amplitude value        */
665    uint16_t tone[2];  /* left/right 12 bit frequency 0 - 4096Hz   */
666    uint16_t mark[2];  /* left/right 16 bit mark time 0 - 65535ms  */
667    uint16_t space[2]; /* left/right 16 bit space time 0 - 65535ms */
668} tCHIRP_CONFIG;
669
670typedef struct {
671    uint8_t pri_l; /* Primary Left scale : 0 ~ 255     */
672    uint8_t mix_l; /* Mixing Left scale : 0 ~ 255      */
673    uint8_t pri_r; /* Primary Right scale : 0 ~ 255    */
674    uint8_t mix_r; /* Mixing Right scale : 0 ~ 255     */
675} tMIX_SCALE_CONFIG;
676
677/* For custon equalizer gain configuration */
678typedef struct {
679    uint32_t audio_l_g0; /* IIR biquad filter left ch gain 0 */
680    uint32_t audio_l_g1; /* IIR biquad filter left ch gain 1 */
681    uint32_t audio_l_g2; /* IIR biquad filter left ch gain 2 */
682    uint32_t audio_l_g3; /* IIR biquad filter left ch gain 3 */
683    uint32_t audio_l_g4; /* IIR biquad filter left ch gain 4 */
684    uint32_t audio_l_gl; /* IIR biquad filter left ch global gain  */
685    uint32_t audio_r_g0; /* IIR biquad filter left ch gain 0 */
686    uint32_t audio_r_g1; /* IIR biquad filter left ch gain 1 */
687    uint32_t audio_r_g2; /* IIR biquad filter left ch gain 2 */
688    uint32_t audio_r_g3; /* IIR biquad filter left ch gain 3 */
689    uint32_t audio_r_g4; /* IIR biquad filter left ch gain 4 */
690    uint32_t audio_r_gl; /* IIR biquad filter left ch global gain */
691} tEQ_GAIN_CONFIG;
692
693typedef struct {
694    uint8_t opcode; /* AUDIO_MIX_CONFIG_REQ */
695    uint8_t mix_src;
696    uint8_t mix_src_sf;
697    tMIX_SCALE_CONFIG mix_scale;
698    tCHIRP_CONFIG chirp_config;
699} tAUDIO_MIX_CONFIG_REQ;
700
701typedef struct {
702    uint8_t opcode; /* AUDIO_MIX_CONFIG_RESP */
703    uint8_t status;
704} tAUDIO_MIX_CONFIG_RESP;
705
706typedef struct {
707    uint8_t opcode;      /* AUDIO_BURST_FRAMES_IND */
708    uint32_t burst_size; /* in bytes */
709} tAUDIO_BURST_FRAMES_IND;
710
711typedef struct {
712    uint8_t opcode; /* AUDIO_BURST_END_IND */
713} tAUDIO_BURST_END_IND;
714
715typedef struct {
716    uint8_t opcode; /* AUDIO_CODEC_FLUSH_REQ */
717} tAUDIO_CODEC_FLUSH_REQ;
718
719typedef struct {
720    uint8_t opcode; /* AUDIO_EQ_MODE_CONFIG_REQ */
721    uint8_t eq_mode;
722    tEQ_GAIN_CONFIG filter_gain; /* Valid only when eq_mode is 0xFF */
723} tAUDIO_EQ_MODE_CONFIG_REQ;
724
725typedef struct {
726    uint8_t opcode; /* AUDIO_SCALE_CONFIG_REQ */
727    tMIX_SCALE_CONFIG mix_scale;
728} tAUDIO_SCALE_CONFIG_REQ;
729
730#pragma pack(pop) /* pop saved alignment to stack */
731
732#endif /* BT_VENDOR_UIPC_MSG_H */
733