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