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