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