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