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