Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame^] | 1 | /* Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | #ifndef __QDSP6VOICE_H__ |
| 13 | #define __QDSP6VOICE_H__ |
| 14 | |
| 15 | #include <mach/qdsp6v2/apr.h> |
| 16 | |
| 17 | #define MAX_VOC_PKT_SIZE 322 |
| 18 | |
| 19 | struct voice_header { |
| 20 | uint32_t id; |
| 21 | uint32_t data_len; |
| 22 | }; |
| 23 | |
| 24 | struct voice_init { |
| 25 | struct voice_header hdr; |
| 26 | void *cb_handle; |
| 27 | }; |
| 28 | |
| 29 | /* Device information payload structure */ |
| 30 | |
| 31 | struct device_data { |
| 32 | uint32_t volume; /* in index */ |
| 33 | uint32_t mute; |
| 34 | uint32_t sample; |
| 35 | uint32_t enabled; |
| 36 | uint32_t dev_id; |
| 37 | uint32_t port_id; |
| 38 | }; |
| 39 | |
| 40 | struct voice_dev_route_state { |
| 41 | u16 rx_route_flag; |
| 42 | u16 tx_route_flag; |
| 43 | }; |
| 44 | |
| 45 | enum { |
| 46 | VOC_INIT = 0, |
| 47 | VOC_RUN, |
| 48 | VOC_CHANGE, |
| 49 | VOC_RELEASE, |
| 50 | }; |
| 51 | |
| 52 | /* TO MVM commands */ |
| 53 | #define VSS_IMVM_CMD_CREATE_PASSIVE_CONTROL_SESSION 0x000110FF |
| 54 | /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 55 | |
| 56 | #define VSS_IMVM_CMD_CREATE_FULL_CONTROL_SESSION 0x000110FE |
| 57 | /* Create a new full control MVM session. */ |
| 58 | |
| 59 | #define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C |
| 60 | /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 61 | |
| 62 | #define VSS_IMVM_CMD_ATTACH_STREAM 0x0001123C |
| 63 | /* Attach a stream to the MVM. */ |
| 64 | |
| 65 | #define VSS_IMVM_CMD_DETACH_STREAM 0x0001123D |
| 66 | /* Detach a stream from the MVM. */ |
| 67 | |
| 68 | #define VSS_IMVM_CMD_START_VOICE 0x00011190 |
| 69 | /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 70 | |
| 71 | #define VSS_IMVM_CMD_STOP_VOICE 0x00011192 |
| 72 | /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 73 | |
| 74 | #define VSS_ISTREAM_CMD_ATTACH_VOCPROC 0x000110F8 |
| 75 | /**< Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 76 | |
| 77 | #define VSS_ISTREAM_CMD_DETACH_VOCPROC 0x000110F9 |
| 78 | /**< Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 79 | |
| 80 | |
| 81 | #define VSS_ISTREAM_CMD_SET_TTY_MODE 0x00011196 |
| 82 | /**< Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 83 | |
| 84 | #define VSS_ICOMMON_CMD_SET_NETWORK 0x0001119C |
| 85 | /* Set the network type. */ |
| 86 | |
| 87 | #define VSS_ICOMMON_CMD_SET_VOICE_TIMING 0x000111E0 |
| 88 | /* Set the voice timing parameters. */ |
| 89 | |
| 90 | struct vss_istream_cmd_set_tty_mode_t { |
| 91 | uint32_t mode; |
| 92 | /**< |
| 93 | * TTY mode. |
| 94 | * |
| 95 | * 0 : TTY disabled |
| 96 | * 1 : HCO |
| 97 | * 2 : VCO |
| 98 | * 3 : FULL |
| 99 | */ |
| 100 | } __packed; |
| 101 | |
| 102 | struct vss_istream_cmd_attach_vocproc_t { |
| 103 | uint16_t handle; |
| 104 | /**< Handle of vocproc being attached. */ |
| 105 | } __packed; |
| 106 | |
| 107 | struct vss_istream_cmd_detach_vocproc_t { |
| 108 | uint16_t handle; |
| 109 | /**< Handle of vocproc being detached. */ |
| 110 | } __packed; |
| 111 | |
| 112 | struct vss_imvm_cmd_attach_stream_t { |
| 113 | uint16_t handle; |
| 114 | /* The stream handle to attach. */ |
| 115 | } __packed; |
| 116 | |
| 117 | struct vss_imvm_cmd_detach_stream_t { |
| 118 | uint16_t handle; |
| 119 | /* The stream handle to detach. */ |
| 120 | } __packed; |
| 121 | |
| 122 | struct vss_icommon_cmd_set_network_t { |
| 123 | uint32_t network_id; |
| 124 | /* Network ID. (Refer to VSS_NETWORK_ID_XXX). */ |
| 125 | } __packed; |
| 126 | |
| 127 | struct vss_icommon_cmd_set_voice_timing_t { |
| 128 | uint16_t mode; |
| 129 | /* |
| 130 | * The vocoder frame synchronization mode. |
| 131 | * |
| 132 | * 0 : No frame sync. |
| 133 | * 1 : Hard VFR (20ms Vocoder Frame Reference interrupt). |
| 134 | */ |
| 135 | uint16_t enc_offset; |
| 136 | /* |
| 137 | * The offset in microseconds from the VFR to deliver a Tx vocoder |
| 138 | * packet. The offset should be less than 20000us. |
| 139 | */ |
| 140 | uint16_t dec_req_offset; |
| 141 | /* |
| 142 | * The offset in microseconds from the VFR to request for an Rx vocoder |
| 143 | * packet. The offset should be less than 20000us. |
| 144 | */ |
| 145 | uint16_t dec_offset; |
| 146 | /* |
| 147 | * The offset in microseconds from the VFR to indicate the deadline to |
| 148 | * receive an Rx vocoder packet. The offset should be less than 20000us. |
| 149 | * Rx vocoder packets received after this deadline are not guaranteed to |
| 150 | * be processed. |
| 151 | */ |
| 152 | } __packed; |
| 153 | |
| 154 | struct vss_imvm_cmd_create_full_control_session_t { |
| 155 | char name[20]; |
| 156 | /* |
| 157 | * A variable-sized stream name. |
| 158 | * |
| 159 | * The stream name size is the payload size minus the size of the other |
| 160 | * fields. |
| 161 | */ |
| 162 | } __packed; |
| 163 | |
| 164 | |
| 165 | struct mvm_attach_vocproc_cmd { |
| 166 | struct apr_hdr hdr; |
| 167 | struct vss_istream_cmd_attach_vocproc_t mvm_attach_cvp_handle; |
| 168 | } __packed; |
| 169 | |
| 170 | struct mvm_detach_vocproc_cmd { |
| 171 | struct apr_hdr hdr; |
| 172 | struct vss_istream_cmd_detach_vocproc_t mvm_detach_cvp_handle; |
| 173 | } __packed; |
| 174 | |
| 175 | struct mvm_create_passive_ctl_session_cmd { |
| 176 | struct apr_hdr hdr; |
| 177 | } __packed; |
| 178 | |
| 179 | struct mvm_create_full_ctl_session_cmd { |
| 180 | struct apr_hdr hdr; |
| 181 | struct vss_imvm_cmd_create_full_control_session_t mvm_session; |
| 182 | } __packed; |
| 183 | |
| 184 | struct mvm_set_tty_mode_cmd { |
| 185 | struct apr_hdr hdr; |
| 186 | struct vss_istream_cmd_set_tty_mode_t tty_mode; |
| 187 | } __packed; |
| 188 | |
| 189 | struct mvm_attach_stream_cmd { |
| 190 | struct apr_hdr hdr; |
| 191 | struct vss_imvm_cmd_attach_stream_t attach_stream; |
| 192 | } __packed; |
| 193 | |
| 194 | struct mvm_detach_stream_cmd { |
| 195 | struct apr_hdr hdr; |
| 196 | struct vss_imvm_cmd_detach_stream_t detach_stream; |
| 197 | } __packed; |
| 198 | |
| 199 | struct mvm_set_network_cmd { |
| 200 | struct apr_hdr hdr; |
| 201 | struct vss_icommon_cmd_set_network_t network; |
| 202 | } __packed; |
| 203 | |
| 204 | struct mvm_set_voice_timing_cmd { |
| 205 | struct apr_hdr hdr; |
| 206 | struct vss_icommon_cmd_set_voice_timing_t timing; |
| 207 | } __packed; |
| 208 | |
| 209 | /* TO CVS commands */ |
| 210 | #define VSS_ISTREAM_CMD_CREATE_PASSIVE_CONTROL_SESSION 0x00011140 |
| 211 | /**< Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 212 | |
| 213 | #define VSS_ISTREAM_CMD_CREATE_FULL_CONTROL_SESSION 0x000110F7 |
| 214 | /* Create a new full control stream session. */ |
| 215 | |
| 216 | #define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C |
| 217 | |
| 218 | #define VSS_ISTREAM_CMD_SET_MUTE 0x00011022 |
| 219 | |
| 220 | #define VSS_ISTREAM_CMD_SET_MEDIA_TYPE 0x00011186 |
| 221 | /* Set media type on the stream. */ |
| 222 | |
| 223 | #define VSS_ISTREAM_EVT_SEND_ENC_BUFFER 0x00011015 |
| 224 | /* Event sent by the stream to its client to provide an encoded packet. */ |
| 225 | |
| 226 | #define VSS_ISTREAM_EVT_REQUEST_DEC_BUFFER 0x00011017 |
| 227 | /* Event sent by the stream to its client requesting for a decoder packet. |
| 228 | * The client should respond with a VSS_ISTREAM_EVT_SEND_DEC_BUFFER event. |
| 229 | */ |
| 230 | |
| 231 | #define VSS_ISTREAM_EVT_SEND_DEC_BUFFER 0x00011016 |
| 232 | /* Event sent by the client to the stream in response to a |
| 233 | * VSS_ISTREAM_EVT_REQUEST_DEC_BUFFER event, providing a decoder packet. |
| 234 | */ |
| 235 | |
| 236 | #define VSS_ISTREAM_CMD_VOC_AMR_SET_ENC_RATE 0x0001113E |
| 237 | /* Set AMR encoder rate. */ |
| 238 | |
| 239 | #define VSS_ISTREAM_CMD_VOC_AMRWB_SET_ENC_RATE 0x0001113F |
| 240 | /* Set AMR-WB encoder rate. */ |
| 241 | |
| 242 | #define VSS_ISTREAM_CMD_CDMA_SET_ENC_MINMAX_RATE 0x00011019 |
| 243 | /* Set encoder minimum and maximum rate. */ |
| 244 | |
| 245 | #define VSS_ISTREAM_CMD_SET_ENC_DTX_MODE 0x0001101D |
| 246 | /* Set encoder DTX mode. */ |
| 247 | |
| 248 | struct vss_istream_cmd_create_passive_control_session_t { |
| 249 | char name[20]; |
| 250 | /**< |
| 251 | * A variable-sized stream name. |
| 252 | * |
| 253 | * The stream name size is the payload size minus the size of the other |
| 254 | * fields. |
| 255 | */ |
| 256 | } __packed; |
| 257 | |
| 258 | struct vss_istream_cmd_set_mute_t { |
| 259 | uint16_t direction; |
| 260 | /**< |
| 261 | * 0 : TX only |
| 262 | * 1 : RX only |
| 263 | * 2 : TX and Rx |
| 264 | */ |
| 265 | uint16_t mute_flag; |
| 266 | /**< |
| 267 | * Mute, un-mute. |
| 268 | * |
| 269 | * 0 : Silence disable |
| 270 | * 1 : Silence enable |
| 271 | * 2 : CNG enable. Applicable to TX only. If set on RX behavior |
| 272 | * will be the same as 1 |
| 273 | */ |
| 274 | } __packed; |
| 275 | |
| 276 | struct vss_istream_cmd_create_full_control_session_t { |
| 277 | uint16_t direction; |
| 278 | /* |
| 279 | * Stream direction. |
| 280 | * |
| 281 | * 0 : TX only |
| 282 | * 1 : RX only |
| 283 | * 2 : TX and RX |
| 284 | * 3 : TX and RX loopback |
| 285 | */ |
| 286 | uint32_t enc_media_type; |
| 287 | /* Tx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */ |
| 288 | uint32_t dec_media_type; |
| 289 | /* Rx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */ |
| 290 | uint32_t network_id; |
| 291 | /* Network ID. (Refer to VSS_NETWORK_ID_XXX). */ |
| 292 | char name[20]; |
| 293 | /* |
| 294 | * A variable-sized stream name. |
| 295 | * |
| 296 | * The stream name size is the payload size minus the size of the other |
| 297 | * fields. |
| 298 | */ |
| 299 | } __packed; |
| 300 | |
| 301 | struct vss_istream_cmd_set_media_type_t { |
| 302 | uint32_t rx_media_id; |
| 303 | /* Set the Rx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */ |
| 304 | uint32_t tx_media_id; |
| 305 | /* Set the Tx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */ |
| 306 | } __packed; |
| 307 | |
| 308 | struct vss_istream_evt_send_enc_buffer_t { |
| 309 | uint32_t media_id; |
| 310 | /* Media ID of the packet. */ |
| 311 | uint8_t packet_data[MAX_VOC_PKT_SIZE]; |
| 312 | /* Packet data buffer. */ |
| 313 | } __packed; |
| 314 | |
| 315 | struct vss_istream_evt_send_dec_buffer_t { |
| 316 | uint32_t media_id; |
| 317 | /* Media ID of the packet. */ |
| 318 | uint8_t packet_data[MAX_VOC_PKT_SIZE]; |
| 319 | /* Packet data. */ |
| 320 | } __packed; |
| 321 | |
| 322 | struct vss_istream_cmd_voc_amr_set_enc_rate_t { |
| 323 | uint32_t mode; |
| 324 | /* Set the AMR encoder rate. |
| 325 | * |
| 326 | * 0x00000000 : 4.75 kbps |
| 327 | * 0x00000001 : 5.15 kbps |
| 328 | * 0x00000002 : 5.90 kbps |
| 329 | * 0x00000003 : 6.70 kbps |
| 330 | * 0x00000004 : 7.40 kbps |
| 331 | * 0x00000005 : 7.95 kbps |
| 332 | * 0x00000006 : 10.2 kbps |
| 333 | * 0x00000007 : 12.2 kbps |
| 334 | */ |
| 335 | } __packed; |
| 336 | |
| 337 | struct vss_istream_cmd_voc_amrwb_set_enc_rate_t { |
| 338 | uint32_t mode; |
| 339 | /* Set the AMR-WB encoder rate. |
| 340 | * |
| 341 | * 0x00000000 : 6.60 kbps |
| 342 | * 0x00000001 : 8.85 kbps |
| 343 | * 0x00000002 : 12.65 kbps |
| 344 | * 0x00000003 : 14.25 kbps |
| 345 | * 0x00000004 : 15.85 kbps |
| 346 | * 0x00000005 : 18.25 kbps |
| 347 | * 0x00000006 : 19.85 kbps |
| 348 | * 0x00000007 : 23.05 kbps |
| 349 | * 0x00000008 : 23.85 kbps |
| 350 | */ |
| 351 | } __packed; |
| 352 | |
| 353 | struct vss_istream_cmd_cdma_set_enc_minmax_rate_t { |
| 354 | uint16_t min_rate; |
| 355 | /* Set the lower bound encoder rate. |
| 356 | * |
| 357 | * 0x0000 : Blank frame |
| 358 | * 0x0001 : Eighth rate |
| 359 | * 0x0002 : Quarter rate |
| 360 | * 0x0003 : Half rate |
| 361 | * 0x0004 : Full rate |
| 362 | */ |
| 363 | uint16_t max_rate; |
| 364 | /* Set the upper bound encoder rate. |
| 365 | * |
| 366 | * 0x0000 : Blank frame |
| 367 | * 0x0001 : Eighth rate |
| 368 | * 0x0002 : Quarter rate |
| 369 | * 0x0003 : Half rate |
| 370 | * 0x0004 : Full rate |
| 371 | */ |
| 372 | } __packed; |
| 373 | |
| 374 | struct vss_istream_cmd_set_enc_dtx_mode_t { |
| 375 | uint32_t enable; |
| 376 | /* Toggle DTX on or off. |
| 377 | * |
| 378 | * 0 : Disables DTX |
| 379 | * 1 : Enables DTX |
| 380 | */ |
| 381 | } __packed; |
| 382 | |
| 383 | struct cvs_create_passive_ctl_session_cmd { |
| 384 | struct apr_hdr hdr; |
| 385 | struct vss_istream_cmd_create_passive_control_session_t cvs_session; |
| 386 | } __packed; |
| 387 | |
| 388 | struct cvs_create_full_ctl_session_cmd { |
| 389 | struct apr_hdr hdr; |
| 390 | struct vss_istream_cmd_create_full_control_session_t cvs_session; |
| 391 | }; |
| 392 | |
| 393 | struct cvs_destroy_session_cmd { |
| 394 | struct apr_hdr hdr; |
| 395 | } __packed; |
| 396 | |
| 397 | struct cvs_set_mute_cmd { |
| 398 | struct apr_hdr hdr; |
| 399 | struct vss_istream_cmd_set_mute_t cvs_set_mute; |
| 400 | } __packed; |
| 401 | |
| 402 | struct cvs_set_media_type_cmd { |
| 403 | struct apr_hdr hdr; |
| 404 | struct vss_istream_cmd_set_media_type_t media_type; |
| 405 | } __packed; |
| 406 | |
| 407 | struct cvs_send_dec_buf_cmd { |
| 408 | struct apr_hdr hdr; |
| 409 | struct vss_istream_evt_send_dec_buffer_t dec_buf; |
| 410 | } __packed; |
| 411 | |
| 412 | struct cvs_set_amr_enc_rate_cmd { |
| 413 | struct apr_hdr hdr; |
| 414 | struct vss_istream_cmd_voc_amr_set_enc_rate_t amr_rate; |
| 415 | } __packed; |
| 416 | |
| 417 | struct cvs_set_amrwb_enc_rate_cmd { |
| 418 | struct apr_hdr hdr; |
| 419 | struct vss_istream_cmd_voc_amrwb_set_enc_rate_t amrwb_rate; |
| 420 | } __packed; |
| 421 | |
| 422 | struct cvs_set_cdma_enc_minmax_rate_cmd { |
| 423 | struct apr_hdr hdr; |
| 424 | struct vss_istream_cmd_cdma_set_enc_minmax_rate_t cdma_rate; |
| 425 | } __packed; |
| 426 | |
| 427 | struct cvs_set_enc_dtx_mode_cmd { |
| 428 | struct apr_hdr hdr; |
| 429 | struct vss_istream_cmd_set_enc_dtx_mode_t dtx_mode; |
| 430 | } __packed; |
| 431 | |
| 432 | /* TO CVP commands */ |
| 433 | |
| 434 | #define VSS_IVOCPROC_CMD_CREATE_FULL_CONTROL_SESSION 0x000100C3 |
| 435 | /**< Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 436 | |
| 437 | #define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C |
| 438 | |
| 439 | #define VSS_IVOCPROC_CMD_SET_DEVICE 0x000100C4 |
| 440 | |
| 441 | #define VSS_IVOCPROC_CMD_SET_VP3_DATA 0x000110EB |
| 442 | |
| 443 | #define VSS_IVOCPROC_CMD_SET_RX_VOLUME_INDEX 0x000110EE |
| 444 | |
| 445 | #define VSS_IVOCPROC_CMD_ENABLE 0x000100C6 |
| 446 | /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 447 | |
| 448 | #define VSS_IVOCPROC_CMD_DISABLE 0x000110E1 |
| 449 | /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */ |
| 450 | |
| 451 | #define VSS_IVOCPROC_TOPOLOGY_ID_NONE 0x00010F70 |
| 452 | #define VSS_IVOCPROC_TOPOLOGY_ID_TX_SM_ECNS 0x00010F71 |
| 453 | #define VSS_IVOCPROC_TOPOLOGY_ID_TX_DM_FLUENCE 0x00010F72 |
| 454 | |
| 455 | #define VSS_IVOCPROC_TOPOLOGY_ID_RX_DEFAULT 0x00010F77 |
| 456 | |
| 457 | /* Newtwork IDs */ |
| 458 | #define VSS_NETWORK_ID_DEFAULT 0x00010037 |
| 459 | #define VSS_NETWORK_ID_VOIP_NB 0x00011240 |
| 460 | #define VSS_NETWORK_ID_VOIP_WB 0x00011241 |
| 461 | #define VSS_NETWORK_ID_VOIP_WV 0x00011242 |
| 462 | |
| 463 | /* Media types */ |
| 464 | #define VSS_MEDIA_ID_EVRC_MODEM 0x00010FC2 |
| 465 | /* 80-VF690-47 CDMA enhanced variable rate vocoder modem format. */ |
| 466 | #define VSS_MEDIA_ID_AMR_NB_MODEM 0x00010FC6 |
| 467 | /* 80-VF690-47 UMTS AMR-NB vocoder modem format. */ |
| 468 | #define VSS_MEDIA_ID_AMR_WB_MODEM 0x00010FC7 |
| 469 | /* 80-VF690-47 UMTS AMR-WB vocoder modem format. */ |
| 470 | #define VSS_MEDIA_ID_PCM_NB 0x00010FCB |
| 471 | #define VSS_MEDIA_ID_PCM_WB 0x00010FCC |
| 472 | /* Linear PCM (16-bit, little-endian). */ |
| 473 | #define VSS_MEDIA_ID_G711_ALAW 0x00010FCD |
| 474 | /* G.711 a-law (contains two 10ms vocoder frames). */ |
| 475 | #define VSS_MEDIA_ID_G711_MULAW 0x00010FCE |
| 476 | /* G.711 mu-law (contains two 10ms vocoder frames). */ |
| 477 | #define VSS_MEDIA_ID_G729 0x00010FD0 |
| 478 | /* G.729AB (contains two 10ms vocoder frames. */ |
| 479 | |
| 480 | #define VOICE_CMD_SET_PARAM 0x00011006 |
| 481 | #define VOICE_CMD_GET_PARAM 0x00011007 |
| 482 | #define VOICE_EVT_GET_PARAM_ACK 0x00011008 |
| 483 | |
| 484 | struct vss_ivocproc_cmd_create_full_control_session_t { |
| 485 | uint16_t direction; |
| 486 | /* |
| 487 | * stream direction. |
| 488 | * 0 : TX only |
| 489 | * 1 : RX only |
| 490 | * 2 : TX and RX |
| 491 | */ |
| 492 | uint32_t tx_port_id; |
| 493 | /* |
| 494 | * TX device port ID which vocproc will connect to. If not supplying a |
| 495 | * port ID set to VSS_IVOCPROC_PORT_ID_NONE. |
| 496 | */ |
| 497 | uint32_t tx_topology_id; |
| 498 | /* |
| 499 | * Tx leg topology ID. If not supplying a topology ID set to |
| 500 | * VSS_IVOCPROC_TOPOLOGY_ID_NONE. |
| 501 | */ |
| 502 | uint32_t rx_port_id; |
| 503 | /* |
| 504 | * RX device port ID which vocproc will connect to. If not supplying a |
| 505 | * port ID set to VSS_IVOCPROC_PORT_ID_NONE. |
| 506 | */ |
| 507 | uint32_t rx_topology_id; |
| 508 | /* |
| 509 | * Rx leg topology ID. If not supplying a topology ID set to |
| 510 | * VSS_IVOCPROC_TOPOLOGY_ID_NONE. |
| 511 | */ |
| 512 | int32_t network_id; |
| 513 | /* |
| 514 | * Network ID. (Refer to VSS_NETWORK_ID_XXX). If not supplying a network |
| 515 | * ID set to VSS_NETWORK_ID_DEFAULT. |
| 516 | */ |
| 517 | } __packed; |
| 518 | |
| 519 | struct vss_ivocproc_cmd_set_volume_index_t { |
| 520 | uint16_t vol_index; |
| 521 | /**< |
| 522 | * Volume index utilized by the vocproc to index into the volume table |
| 523 | * provided in VSS_IVOCPROC_CMD_CACHE_VOLUME_CALIBRATION_TABLE and set |
| 524 | * volume on the VDSP. |
| 525 | */ |
| 526 | } __packed; |
| 527 | |
| 528 | struct vss_ivocproc_cmd_set_device_t { |
| 529 | uint32_t tx_port_id; |
| 530 | /**< |
| 531 | * TX device port ID which vocproc will connect to. |
| 532 | * VSS_IVOCPROC_PORT_ID_NONE means vocproc will not connect to any port. |
| 533 | */ |
| 534 | uint32_t tx_topology_id; |
| 535 | /**< |
| 536 | * TX leg topology ID. |
| 537 | * VSS_IVOCPROC_TOPOLOGY_ID_NONE means vocproc does not contain any |
| 538 | * pre/post-processing blocks and is pass-through. |
| 539 | */ |
| 540 | int32_t rx_port_id; |
| 541 | /**< |
| 542 | * RX device port ID which vocproc will connect to. |
| 543 | * VSS_IVOCPROC_PORT_ID_NONE means vocproc will not connect to any port. |
| 544 | */ |
| 545 | uint32_t rx_topology_id; |
| 546 | /**< |
| 547 | * RX leg topology ID. |
| 548 | * VSS_IVOCPROC_TOPOLOGY_ID_NONE means vocproc does not contain any |
| 549 | * pre/post-processing blocks and is pass-through. |
| 550 | */ |
| 551 | } __packed; |
| 552 | |
| 553 | struct cvp_create_full_ctl_session_cmd { |
| 554 | struct apr_hdr hdr; |
| 555 | struct vss_ivocproc_cmd_create_full_control_session_t cvp_session; |
| 556 | } __packed; |
| 557 | |
| 558 | struct cvp_command { |
| 559 | struct apr_hdr hdr; |
| 560 | } __packed; |
| 561 | |
| 562 | struct cvp_set_device_cmd { |
| 563 | struct apr_hdr hdr; |
| 564 | struct vss_ivocproc_cmd_set_device_t cvp_set_device; |
| 565 | } __packed; |
| 566 | |
| 567 | struct cvp_set_vp3_data_cmd { |
| 568 | struct apr_hdr hdr; |
| 569 | } __packed; |
| 570 | |
| 571 | struct cvp_set_rx_volume_index_cmd { |
| 572 | struct apr_hdr hdr; |
| 573 | struct vss_ivocproc_cmd_set_volume_index_t cvp_set_vol_idx; |
| 574 | } __packed; |
| 575 | |
| 576 | /* CB for up-link packets. */ |
| 577 | typedef void (*ul_cb_fn)(uint8_t *voc_pkt, |
| 578 | uint32_t pkt_len, |
| 579 | void *private_data); |
| 580 | |
| 581 | /* CB for down-link packets. */ |
| 582 | typedef void (*dl_cb_fn)(uint8_t *voc_pkt, |
| 583 | uint32_t *pkt_len, |
| 584 | void *private_data); |
| 585 | |
| 586 | |
| 587 | struct mvs_driver_info { |
| 588 | uint32_t media_type; |
| 589 | uint32_t rate; |
| 590 | uint32_t network_type; |
| 591 | ul_cb_fn ul_cb; |
| 592 | dl_cb_fn dl_cb; |
| 593 | void *private_data; |
| 594 | }; |
| 595 | |
| 596 | struct incall_rec_info { |
| 597 | uint32_t pending; |
| 598 | uint32_t rec_mode; |
| 599 | }; |
| 600 | |
| 601 | struct incall_music_info { |
| 602 | uint32_t pending; |
| 603 | uint32_t playing; |
| 604 | }; |
| 605 | |
| 606 | struct voice_data { |
| 607 | int voc_state;/*INIT, CHANGE, RELEASE, RUN */ |
| 608 | uint32_t voc_path; |
| 609 | |
| 610 | wait_queue_head_t mvm_wait; |
| 611 | wait_queue_head_t cvs_wait; |
| 612 | wait_queue_head_t cvp_wait; |
| 613 | |
| 614 | uint32_t device_events; |
| 615 | |
| 616 | /* cache the values related to Rx and Tx */ |
| 617 | struct device_data dev_rx; |
| 618 | struct device_data dev_tx; |
| 619 | |
| 620 | /* these default values are for all devices */ |
| 621 | uint32_t default_mute_val; |
| 622 | uint32_t default_vol_val; |
| 623 | uint32_t default_sample_val; |
| 624 | |
| 625 | /* APR to MVM in the Q6 */ |
| 626 | void *apr_q6_mvm; |
| 627 | /* APR to CVS in the Q6 */ |
| 628 | void *apr_q6_cvs; |
| 629 | /* APR to CVP in the Q6 */ |
| 630 | void *apr_q6_cvp; |
| 631 | |
| 632 | u32 mvm_state; |
| 633 | u32 cvs_state; |
| 634 | u32 cvp_state; |
| 635 | |
| 636 | /* Handle to MVM in the Q6 */ |
| 637 | u16 mvm_passive_handle; /* for cs call */ |
| 638 | u16 mvm_full_handle; /* for voip */ |
| 639 | /* Handle to CVS in the Q6 */ |
| 640 | u16 cvs_passive_handle; |
| 641 | u16 cvs_full_handle; |
| 642 | /* Handle to CVP in the Q6 */ |
| 643 | u16 cvp_passive_handle; |
| 644 | u16 cvp_full_handle; |
| 645 | |
| 646 | struct mutex lock; |
| 647 | |
| 648 | struct mvs_driver_info mvs_info; |
| 649 | |
| 650 | uint16_t sidetone_gain; |
| 651 | |
| 652 | struct voice_dev_route_state voc_route_state; |
| 653 | }; |
| 654 | |
| 655 | int voc_set_voc_path_full(uint32_t set); |
| 656 | |
| 657 | void voc_register_mvs_cb(ul_cb_fn ul_cb, |
| 658 | dl_cb_fn dl_cb, |
| 659 | void *private_data); |
| 660 | |
| 661 | void voc_config_vocoder(uint32_t media_type, |
| 662 | uint32_t rate, |
| 663 | uint32_t network_type); |
| 664 | |
| 665 | enum { |
| 666 | DEV_RX = 0, |
| 667 | DEV_TX, |
| 668 | }; |
| 669 | |
| 670 | enum { |
| 671 | RX_PATH = 0, |
| 672 | TX_PATH, |
| 673 | }; |
| 674 | |
| 675 | /* called by alsa driver */ |
| 676 | int voc_start_voice_call(void); |
| 677 | int voc_end_voice_call(void); |
| 678 | void voc_set_rxtx_port(uint32_t dev_port_id, uint32_t dev_type); |
| 679 | int voc_set_rx_vol_index(uint32_t dir, uint32_t voc_idx); |
| 680 | int voc_set_tx_mute(uint32_t dir, uint32_t mute); |
| 681 | int voc_disable_cvp(void); |
| 682 | int voc_enable_cvp(void); |
| 683 | void voc_set_route_flag(uint8_t path_dir, uint8_t set); |
| 684 | uint8_t voc_get_route_flag(uint8_t path_dir); |
| 685 | |
| 686 | #endif |