rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame^] | 1 | /***************************************************************************** |
| 2 | * Copyright Statement: |
| 3 | * -------------------- |
| 4 | * This software is protected by Copyright and the information contained |
| 5 | * herein is confidential. The software may not be copied and the information |
| 6 | * contained herein may not be used or disclosed except with the written |
| 7 | * permission of MediaTek Inc. (C) 2012 |
| 8 | * |
| 9 | * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 10 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 11 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 12 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 13 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 14 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 15 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 16 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 17 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 18 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 19 | * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 20 | * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 21 | * |
| 22 | * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 23 | * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 24 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 25 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 26 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 27 | * |
| 28 | * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 29 | * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 30 | * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 31 | * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 32 | * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 33 | * |
| 34 | *****************************************************************************/ |
| 35 | |
| 36 | /******************************************************************************* |
| 37 | * Filename: |
| 38 | * --------- |
| 39 | * med_main.c |
| 40 | * |
| 41 | * Project: |
| 42 | * -------- |
| 43 | * Maui |
| 44 | * |
| 45 | * Description: |
| 46 | * ------------ |
| 47 | * This file includes primary functions of media task. |
| 48 | * |
| 49 | * Author: |
| 50 | * ------- |
| 51 | * ------- |
| 52 | * |
| 53 | *============================================================================== |
| 54 | * HISTORY |
| 55 | * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 56 | *------------------------------------------------------------------------------ |
| 57 | * removed! |
| 58 | * |
| 59 | * removed! |
| 60 | * removed! |
| 61 | * removed! |
| 62 | * |
| 63 | * removed! |
| 64 | * removed! |
| 65 | * removed! |
| 66 | * removed! |
| 67 | * |
| 68 | * removed! |
| 69 | * removed! |
| 70 | * removed! |
| 71 | * removed! |
| 72 | * removed! |
| 73 | * removed! |
| 74 | * |
| 75 | * removed! |
| 76 | * removed! |
| 77 | * removed! |
| 78 | * |
| 79 | * removed! |
| 80 | * removed! |
| 81 | * removed! |
| 82 | * |
| 83 | * removed! |
| 84 | * removed! |
| 85 | * removed! |
| 86 | * |
| 87 | * removed! |
| 88 | * removed! |
| 89 | * removed! |
| 90 | * |
| 91 | * removed! |
| 92 | * removed! |
| 93 | * removed! |
| 94 | * |
| 95 | * removed! |
| 96 | * removed! |
| 97 | * removed! |
| 98 | * |
| 99 | * removed! |
| 100 | * removed! |
| 101 | * removed! |
| 102 | * |
| 103 | * removed! |
| 104 | * removed! |
| 105 | * removed! |
| 106 | * |
| 107 | * removed! |
| 108 | * removed! |
| 109 | * removed! |
| 110 | * |
| 111 | * removed! |
| 112 | * removed! |
| 113 | * removed! |
| 114 | * |
| 115 | * removed! |
| 116 | * removed! |
| 117 | * removed! |
| 118 | * |
| 119 | * removed! |
| 120 | * removed! |
| 121 | * removed! |
| 122 | * |
| 123 | * removed! |
| 124 | * removed! |
| 125 | * removed! |
| 126 | * |
| 127 | * removed! |
| 128 | * removed! |
| 129 | * removed! |
| 130 | * |
| 131 | * removed! |
| 132 | * removed! |
| 133 | * removed! |
| 134 | * |
| 135 | * removed! |
| 136 | * removed! |
| 137 | * removed! |
| 138 | * |
| 139 | * removed! |
| 140 | * removed! |
| 141 | * removed! |
| 142 | * |
| 143 | * removed! |
| 144 | * removed! |
| 145 | * removed! |
| 146 | * |
| 147 | * removed! |
| 148 | * removed! |
| 149 | * removed! |
| 150 | * |
| 151 | * removed! |
| 152 | * removed! |
| 153 | * removed! |
| 154 | * removed! |
| 155 | * removed! |
| 156 | * removed! |
| 157 | * removed! |
| 158 | * removed! |
| 159 | * removed! |
| 160 | * removed! |
| 161 | * removed! |
| 162 | * removed! |
| 163 | * removed! |
| 164 | * removed! |
| 165 | * removed! |
| 166 | * removed! |
| 167 | * removed! |
| 168 | * removed! |
| 169 | * removed! |
| 170 | * removed! |
| 171 | * removed! |
| 172 | * removed! |
| 173 | * removed! |
| 174 | * removed! |
| 175 | * removed! |
| 176 | * removed! |
| 177 | * removed! |
| 178 | * removed! |
| 179 | * removed! |
| 180 | * removed! |
| 181 | * removed! |
| 182 | * removed! |
| 183 | * removed! |
| 184 | * |
| 185 | * removed! |
| 186 | * removed! |
| 187 | * removed! |
| 188 | * removed! |
| 189 | * |
| 190 | *------------------------------------------------------------------------------ |
| 191 | * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 192 | *============================================================================== |
| 193 | *******************************************************************************/ |
| 194 | |
| 195 | /*==== INCLUDES =========*/ |
| 196 | |
| 197 | /* system includes */ |
| 198 | |
| 199 | #include "kal_public_defs.h" |
| 200 | #include "kal_general_types.h" |
| 201 | #include "kal_public_api.h" |
| 202 | #include "kal_trace.h" |
| 203 | #include "syscomp_config.h" |
| 204 | #include "task_config.h" |
| 205 | #include "nvram_msgid.h" |
| 206 | #include "sysservice_msgid.h" |
| 207 | #include "tst_msgid.h" |
| 208 | #include "med_msgid.h" |
| 209 | #include "drv_msgid.h" |
| 210 | #include "cmux_msgid.h" |
| 211 | #include "audio_msgid.h" |
| 212 | #include "em_msgid.h" |
| 213 | |
| 214 | #include "tst_sap.h" |
| 215 | #include "drv_sap.h" |
| 216 | |
| 217 | |
| 218 | /* global includes */ |
| 219 | #include "l1audio.h" |
| 220 | #include "nvram_struct.h" |
| 221 | #include "audio_nvram_def.h" |
| 222 | #include "nvram_editor_data_item.h" |
| 223 | // #include "aud_common_config.h" |
| 224 | |
| 225 | /* local include */ |
| 226 | #include "med_global.h" |
| 227 | #include "med_mem.h" |
| 228 | #include "med_struct.h" |
| 229 | #include "med_context.h" |
| 230 | #include "med_utility.h" |
| 231 | |
| 232 | #include "aud_main.h" |
| 233 | #include "med_main.h" |
| 234 | |
| 235 | #ifdef __SPEECH_MODE_TABLE_SUPPORT__ |
| 236 | #include "speech_mode_table.h" |
| 237 | #endif |
| 238 | |
| 239 | //Only for AUDIO_DEVICE_MICROPHONE |
| 240 | #include "device.h" |
| 241 | |
| 242 | #include "em_struct.h" |
| 243 | |
| 244 | #if defined(__VOLTE_SUPPORT__) |
| 245 | #include "ltecsr_msgid.h" |
| 246 | #endif //#if defined(__VOLTE_SUPPORT__) |
| 247 | |
| 248 | |
| 249 | /* global variables */ |
| 250 | med_context_struct med_context; |
| 251 | med_context_struct *med_context_p = &med_context; |
| 252 | |
| 253 | #ifdef __MTK_TARGET__ |
| 254 | #if defined(__DYNAMIC_SWITCH_CACHEABILITY__) |
| 255 | __attribute__ ((section ("DYNAMICCACHEABLEZI_NC_MMIPOOL"))) |
| 256 | __attribute__((aligned(4))) |
| 257 | kal_uint8 med_aud_mem[MED_AUD_MEM_SIZE]; |
| 258 | #else |
| 259 | __attribute__ ((section ("LARGEPOOL_ZI"))) |
| 260 | __attribute__((aligned(4))) |
| 261 | kal_uint8 med_aud_mem[MED_AUD_MEM_SIZE]; |
| 262 | #endif |
| 263 | #else |
| 264 | kal_uint8 med_aud_mem[MED_AUD_MEM_SIZE]; |
| 265 | #endif |
| 266 | |
| 267 | |
| 268 | #if !defined(MED_NOT_PRESENT) |
| 269 | |
| 270 | /*==== FUNCTIONS ===========*/ |
| 271 | extern void med_timer_expiry_hdlr(ilm_struct *ilm_ptr); |
| 272 | |
| 273 | /***************************************************************************** |
| 274 | * FUNCTION |
| 275 | * med_nvram_read_data_cnf_hdlr |
| 276 | * DESCRIPTION |
| 277 | * This function is to handle nvram read data confirm. |
| 278 | * PARAMETERS |
| 279 | * local_para_ptr [?] |
| 280 | * peer_buff_ptr [?] |
| 281 | * RETURNS |
| 282 | * void |
| 283 | *****************************************************************************/ |
| 284 | #if 0 |
| 285 | /* under construction !*/ |
| 286 | /* under construction !*/ |
| 287 | /* under construction !*/ |
| 288 | /* under construction !*/ |
| 289 | /* under construction !*/ |
| 290 | /* under construction !*/ |
| 291 | /* under construction !*/ |
| 292 | /* under construction !*/ |
| 293 | /* under construction !*/ |
| 294 | /* under construction !*/ |
| 295 | /* under construction !*/ |
| 296 | /* under construction !*/ |
| 297 | /* under construction !*/ |
| 298 | /* under construction !*/ |
| 299 | /* under construction !*/ |
| 300 | /* under construction !*/ |
| 301 | /* under construction !*/ |
| 302 | /* under construction !*/ |
| 303 | /* under construction !*/ |
| 304 | /* under construction !*/ |
| 305 | /* under construction !*/ |
| 306 | /* under construction !*/ |
| 307 | /* under construction !*/ |
| 308 | /* under construction !*/ |
| 309 | /* under construction !*/ |
| 310 | /* under construction !*/ |
| 311 | /* under construction !*/ |
| 312 | /* under construction !*/ |
| 313 | /* under construction !*/ |
| 314 | /* under construction !*/ |
| 315 | /* under construction !*/ |
| 316 | /* under construction !*/ |
| 317 | /* under construction !*/ |
| 318 | /* under construction !*/ |
| 319 | #if defined(__SPEECH_MODE_TABLE_SUPPORT__) |
| 320 | /* under construction !*/ |
| 321 | #elif defined(__AMRWB_LINK_SUPPORT__) |
| 322 | /* under construction !*/ |
| 323 | #elif defined(__DUAL_MIC_SUPPORT__) |
| 324 | /* under construction !*/ |
| 325 | #else |
| 326 | /* under construction !*/ |
| 327 | #endif |
| 328 | /* under construction !*/ |
| 329 | /* under construction !*/ |
| 330 | /* under construction !*/ |
| 331 | /* under construction !*/ |
| 332 | #ifdef __SPEECH_MODE_TABLE_SUPPORT__ |
| 333 | /* under construction !*/ |
| 334 | /* under construction !*/ |
| 335 | /* under construction !*/ |
| 336 | /* under construction !*/ |
| 337 | /* under construction !*/ |
| 338 | /* under construction !*/ |
| 339 | /* under construction !*/ |
| 340 | /* under construction !*/ |
| 341 | #if defined(__AMRWB_LINK_SUPPORT__) |
| 342 | /* under construction !*/ |
| 343 | #elif defined( __DUAL_MIC_SUPPORT__) |
| 344 | /* under construction !*/ |
| 345 | #else |
| 346 | /* under construction !*/ |
| 347 | #endif |
| 348 | /* under construction !*/ |
| 349 | /* under construction !*/ |
| 350 | #endif /* __SPEECH_MODE_TABLE_SUPPORT__ */ |
| 351 | /* under construction !*/ |
| 352 | #ifdef __AMRWB_LINK_SUPPORT__ |
| 353 | /* under construction !*/ |
| 354 | /* under construction !*/ |
| 355 | /* under construction !*/ |
| 356 | /* under construction !*/ |
| 357 | /* under construction !*/ |
| 358 | /* under construction !*/ |
| 359 | /* under construction !*/ |
| 360 | /* under construction !*/ |
| 361 | /* under construction !*/ |
| 362 | /* under construction !*/ |
| 363 | /* under construction !*/ |
| 364 | /* under construction !*/ |
| 365 | /* under construction !*/ |
| 366 | /* under construction !*/ |
| 367 | /* under construction !*/ |
| 368 | /* under construction !*/ |
| 369 | /* under construction !*/ |
| 370 | /* under construction !*/ |
| 371 | /* under construction !*/ |
| 372 | /* under construction !*/ |
| 373 | /* under construction !*/ |
| 374 | /* under construction !*/ |
| 375 | /* under construction !*/ |
| 376 | /* under construction !*/ |
| 377 | /* under construction !*/ |
| 378 | /* under construction !*/ |
| 379 | /* under construction !*/ |
| 380 | /* under construction !*/ |
| 381 | /* under construction !*/ |
| 382 | /* under construction !*/ |
| 383 | /* under construction !*/ |
| 384 | /* under construction !*/ |
| 385 | #if defined(__DUAL_MIC_SUPPORT__) |
| 386 | /* under construction !*/ |
| 387 | #else |
| 388 | /* under construction !*/ |
| 389 | #endif |
| 390 | /* under construction !*/ |
| 391 | /* under construction !*/ |
| 392 | #endif /* __AMRWB_LINK_SUPPORT__ */ |
| 393 | /* under construction !*/ |
| 394 | #ifdef __DUAL_MIC_SUPPORT__ |
| 395 | /* under construction !*/ |
| 396 | /* under construction !*/ |
| 397 | /* under construction !*/ |
| 398 | /* under construction !*/ |
| 399 | /* under construction !*/ |
| 400 | /* under construction !*/ |
| 401 | /* under construction !*/ |
| 402 | /* under construction !*/ |
| 403 | #ifdef __AMRWB_LINK_SUPPORT__ |
| 404 | /* under construction !*/ |
| 405 | #endif |
| 406 | /* under construction !*/ |
| 407 | /* under construction !*/ |
| 408 | /* under construction !*/ |
| 409 | #ifdef __AMRWB_LINK_SUPPORT__ |
| 410 | /* under construction !*/ |
| 411 | #endif |
| 412 | /* under construction !*/ |
| 413 | /* under construction !*/ |
| 414 | /* under construction !*/ |
| 415 | /* under construction !*/ |
| 416 | /* under construction !*/ |
| 417 | /* under construction !*/ |
| 418 | #endif |
| 419 | /* under construction !*/ |
| 420 | /* under construction !*/ |
| 421 | /* under construction !*/ |
| 422 | /* under construction !*/ |
| 423 | /* under construction !*/ |
| 424 | /* under construction !*/ |
| 425 | /* under construction !*/ |
| 426 | /* under construction !*/ |
| 427 | /* under construction !*/ |
| 428 | /* under construction !*/ |
| 429 | /* under construction !*/ |
| 430 | /* under construction !*/ |
| 431 | /* under construction !*/ |
| 432 | /* under construction !*/ |
| 433 | /* under construction !*/ |
| 434 | /* under construction !*/ |
| 435 | /* under construction !*/ |
| 436 | /* under construction !*/ |
| 437 | /* under construction !*/ |
| 438 | /* under construction !*/ |
| 439 | /* under construction !*/ |
| 440 | /* under construction !*/ |
| 441 | /* under construction !*/ |
| 442 | /* under construction !*/ |
| 443 | /* under construction !*/ |
| 444 | /* under construction !*/ |
| 445 | /* under construction !*/ |
| 446 | /* under construction !*/ |
| 447 | /* under construction !*/ |
| 448 | /* under construction !*/ |
| 449 | /* under construction !*/ |
| 450 | /* under construction !*/ |
| 451 | /* under construction !*/ |
| 452 | /* under construction !*/ |
| 453 | /* under construction !*/ |
| 454 | /* under construction !*/ |
| 455 | /* under construction !*/ |
| 456 | /* under construction !*/ |
| 457 | /* under construction !*/ |
| 458 | /* under construction !*/ |
| 459 | /* under construction !*/ |
| 460 | /* under construction !*/ |
| 461 | /* under construction !*/ |
| 462 | /* under construction !*/ |
| 463 | /* under construction !*/ |
| 464 | /* under construction !*/ |
| 465 | /* under construction !*/ |
| 466 | /* under construction !*/ |
| 467 | /* under construction !*/ |
| 468 | /* under construction !*/ |
| 469 | /* under construction !*/ |
| 470 | /* under construction !*/ |
| 471 | /* under construction !*/ |
| 472 | /* under construction !*/ |
| 473 | /* under construction !*/ |
| 474 | /* under construction !*/ |
| 475 | /* under construction !*/ |
| 476 | /* under construction !*/ |
| 477 | /* under construction !*/ |
| 478 | /* under construction !*/ |
| 479 | /* under construction !*/ |
| 480 | /* under construction !*/ |
| 481 | /* under construction !*/ |
| 482 | /* under construction !*/ |
| 483 | /* under construction !*/ |
| 484 | /* under construction !*/ |
| 485 | /* under construction !*/ |
| 486 | /* under construction !*/ |
| 487 | /* under construction !*/ |
| 488 | /* under construction !*/ |
| 489 | /* under construction !*/ |
| 490 | #ifdef __AMRWB_LINK_SUPPORT__ |
| 491 | /* under construction !*/ |
| 492 | /* under construction !*/ |
| 493 | /* under construction !*/ |
| 494 | /* under construction !*/ |
| 495 | /* under construction !*/ |
| 496 | /* under construction !*/ |
| 497 | /* under construction !*/ |
| 498 | /* under construction !*/ |
| 499 | /* under construction !*/ |
| 500 | #endif |
| 501 | /* under construction !*/ |
| 502 | /* under construction !*/ |
| 503 | /* under construction !*/ |
| 504 | /* under construction !*/ |
| 505 | /* under construction !*/ |
| 506 | /* under construction !*/ |
| 507 | /* under construction !*/ |
| 508 | /* under construction !*/ |
| 509 | /* under construction !*/ |
| 510 | /* under construction !*/ |
| 511 | /* under construction !*/ |
| 512 | /* under construction !*/ |
| 513 | /* under construction !*/ |
| 514 | /* under construction !*/ |
| 515 | /* under construction !*/ |
| 516 | /* under construction !*/ |
| 517 | /* under construction !*/ |
| 518 | /* under construction !*/ |
| 519 | /* under construction !*/ |
| 520 | /* under construction !*/ |
| 521 | /* under construction !*/ |
| 522 | /* under construction !*/ |
| 523 | /* under construction !*/ |
| 524 | /* under construction !*/ |
| 525 | /* under construction !*/ |
| 526 | /* under construction !*/ |
| 527 | /* under construction !*/ |
| 528 | /* under construction !*/ |
| 529 | /* under construction !*/ |
| 530 | /* under construction !*/ |
| 531 | /* under construction !*/ |
| 532 | /* under construction !*/ |
| 533 | /* under construction !*/ |
| 534 | /* under construction !*/ |
| 535 | #endif // #if 0 |
| 536 | #endif // #if !defined(MED_NOT_PRESENT) |
| 537 | |
| 538 | //#if !defined(MED_NOT_PRESENT) |
| 539 | //extern void l1audio_console_handler(kal_char *string); |
| 540 | //#endif // |
| 541 | /***************************************************************************** |
| 542 | * FUNCTION |
| 543 | * med_main |
| 544 | * DESCRIPTION |
| 545 | * This function is main message dispatching function of media task. |
| 546 | * PARAMETERS |
| 547 | * ilm_ptr [?] |
| 548 | * RETURNS |
| 549 | * void |
| 550 | *****************************************************************************/ |
| 551 | void med_main(ilm_struct *ilm_ptr) |
| 552 | { |
| 553 | /*----------------------------------------------------------------*/ |
| 554 | /* Local Variables */ |
| 555 | /*----------------------------------------------------------------*/ |
| 556 | |
| 557 | /*----------------------------------------------------------------*/ |
| 558 | /* Code Body */ |
| 559 | /*----------------------------------------------------------------*/ |
| 560 | |
| 561 | #if defined(__VOLTE_SUPPORT__) |
| 562 | if (ilm_ptr->msg_id == MSG_ID_LTECSR_VOICE_UL_DATA_NOTIFY) |
| 563 | { |
| 564 | #ifndef __MTK_TARGET__ |
| 565 | return; |
| 566 | #else //#ifndef __MTK_TARGET__ |
| 567 | void sp4g_fake_loopback(void); |
| 568 | sp4g_fake_loopback(); |
| 569 | #endif //#ifndef __MTK_TARGET__ |
| 570 | } |
| 571 | if (ilm_ptr->msg_id == MSG_ID_LTECSR_VOICE_UL_MUTE_NOTIFY) |
| 572 | { |
| 573 | return; |
| 574 | } |
| 575 | #endif //#if defined(__VOLTE_SUPPORT__) |
| 576 | |
| 577 | #if !defined(MED_NOT_PRESENT) |
| 578 | if (ilm_ptr->msg_id == MSG_ID_TIMER_EXPIRY) |
| 579 | { |
| 580 | ASSERT(0); |
| 581 | //med_timer_expiry_hdlr(ilm_ptr); |
| 582 | } |
| 583 | /*else if (ilm_ptr->msg_id == MSG_ID_MED_STARTUP_REQ) |
| 584 | { |
| 585 | med_startup_hdlr(ilm_ptr); |
| 586 | } |
| 587 | else if (ilm_ptr->msg_id == MSG_ID_NVRAM_READ_CNF) |
| 588 | { |
| 589 | med_nvram_read_data_cnf_hdlr(ilm_ptr->local_para_ptr, ilm_ptr->peer_buff_ptr); |
| 590 | } |
| 591 | else if (ilm_ptr->msg_id == MSG_ID_NVRAM_WRITE_CNF) |
| 592 | { |
| 593 | med_nvram_write_data_cnf_hdlr(ilm_ptr->local_para_ptr, ilm_ptr->peer_buff_ptr); |
| 594 | } |
| 595 | else if ( (ilm_ptr->msg_id >= MSG_ID_MED_CODE_BEGIN) && (ilm_ptr->msg_id <= MSG_ID_MED_CODE_TAIL) ) |
| 596 | { |
| 597 | aud_main(ilm_ptr); |
| 598 | }*/ |
| 599 | else if(ilm_ptr->msg_id == MSG_ID_MEDIA_AUD_SP_SET_MODE_REQ) |
| 600 | { |
| 601 | meida_aud_sp_set_mode_req_struct *req_p; |
| 602 | req_p = (meida_aud_sp_set_mode_req_struct*) ilm_ptr->local_para_ptr; |
| 603 | if (req_p->speech_on) |
| 604 | { |
| 605 | L1SP_Speech_On(req_p->rat_mode); |
| 606 | } |
| 607 | else |
| 608 | { |
| 609 | L1SP_Speech_Off(); |
| 610 | } |
| 611 | } |
| 612 | |
| 613 | else |
| 614 | #endif |
| 615 | if (ilm_ptr->msg_id == MSG_ID_TST_INJECT_STRING) { |
| 616 | tst_module_string_inject_struct *tstInj = (tst_module_string_inject_struct *)ilm_ptr->local_para_ptr; |
| 617 | if(tstInj->index == 99 ) { |
| 618 | void l1audio_console_handler(kal_char *string); |
| 619 | l1audio_console_handler((kal_char *)(tstInj->string)); |
| 620 | } else { |
| 621 | kal_prompt_trace(MOD_MED, "unused inject string index = %d ", tstInj->index); |
| 622 | } |
| 623 | } else if(ilm_ptr->msg_id == MSG_ID_L4CPS_EM_UPDATE_REQ ) { |
| 624 | l4cps_em_update_req_struct * em_update_ptr = (l4cps_em_update_req_struct *) ilm_ptr->local_para_ptr; |
| 625 | if(em_update_ptr->em_src == EM_FROM_ELT) { |
| 626 | void SP_setEmCodecNotifyOff(kal_bool isOff); |
| 627 | if(EM_OFF == em_update_ptr->info_request[EM_SPEECH_INFO_SPH_CODEC]) { |
| 628 | SP_setEmCodecNotifyOff(KAL_TRUE); |
| 629 | } else if(EM_ON == em_update_ptr->info_request[EM_SPEECH_INFO_SPH_CODEC]) { |
| 630 | SP_setEmCodecNotifyOff(KAL_FALSE); |
| 631 | } // EM_NC, no change do nothing |
| 632 | } // else from AT do nothing |
| 633 | } |
| 634 | |
| 635 | if (ilm_ptr->msg_id == MSG_ID_AUDIO_L4C_EPOF_NOTIFY) { |
| 636 | #if defined( __SMART_PHONE_MODEM__ ) |
| 637 | kal_prompt_trace(MOD_L1SP, "[EPOF]med_main receive L4C EPOF notify"); |
| 638 | set_spcGetEpofTimes(ENUM_EPOF_MD1_L4C_NOTIFY, 1); |
| 639 | if( 0 == get_spcGetEpofTimes(ENUM_EPOF_DO_FORCEENDALLAPP) ) |
| 640 | { |
| 641 | void Spc_ForceEndAllApp(void); |
| 642 | Spc_ForceEndAllApp(); |
| 643 | } |
| 644 | if(get_spcGetEpofTimes(ENUM_EPOF_AP_ACK_NOTIFY)) |
| 645 | { |
| 646 | //Notify L4C: speech driver enter EPOF done |
| 647 | msg_send6(MOD_MED, MOD_L4C, AUDIO_SAP, MSG_ID_AUDIO_L4C_EPOF_ACK, (local_para_struct *)NULL, NULL); |
| 648 | kal_prompt_trace(MOD_L1SP, "[EPOF]med_main notify L4C done"); |
| 649 | } |
| 650 | #else // #if defined( __SMART_PHONE_MODEM__ ) |
| 651 | //Notify L4C: speech driver enter EPOF done |
| 652 | msg_send6(MOD_MED, MOD_L4C, AUDIO_SAP, MSG_ID_AUDIO_L4C_EPOF_ACK, (local_para_struct *)NULL, NULL); |
| 653 | kal_prompt_trace(MOD_L1SP, "[EPOF]med_main notify L4C done 2"); |
| 654 | #endif // #if defined( __SMART_PHONE_MODEM__ ) |
| 655 | } |
| 656 | |
| 657 | #if defined(SHASTA_L) |
| 658 | if (ilm_ptr->msg_id == MSG_ID_AUDIO_C2K_EPOF_NOTIFY) { |
| 659 | #if defined( __SMART_PHONE_MODEM__ ) |
| 660 | kal_prompt_trace(MOD_L1SP, "[EPOF]med_main receive C2K EPOF notify"); |
| 661 | set_spcGetEpofTimes(ENUM_EPOF_C2K_NOTIFY, 1); |
| 662 | if( 0 == get_spcGetEpofTimes(ENUM_EPOF_DO_FORCEENDALLAPP) ) |
| 663 | { |
| 664 | Spc_ForceEndAllApp(); |
| 665 | } |
| 666 | #endif // #if defined( __SMART_PHONE_MODEM__ ) |
| 667 | } |
| 668 | #endif //#if defined(SHASTA_L) |
| 669 | |
| 670 | if(ilm_ptr->msg_id == MSG_ID_AUDIO_CUST_DUMP_REQ) { |
| 671 | #if defined( __SMART_PHONE_MODEM__ ) |
| 672 | void spc_sendCustomDump(void *ilm); |
| 673 | spc_sendCustomDump(ilm_ptr->local_para_ptr); |
| 674 | #endif |
| 675 | } |
| 676 | #if !defined(L1_NOT_PRESENT) && !defined(__UE_SIMULATOR__) |
| 677 | #if defined( __DATA_CARD_SPEECH__ ) |
| 678 | if ( ( (ilm_ptr->msg_id >= CMUX_MSG_CODE_BEGIN) && (ilm_ptr->msg_id <= MSG_ID_CMUX_CODE_TAIL) ) |
| 679 | || ( (ilm_ptr->msg_id >= MSG_ID_SPEECH_ON_ACK) && (ilm_ptr->msg_id <= MSG_ID_STRM_SPEECH_UL_DATA_REQUEST ) ) |
| 680 | || ( (ilm_ptr->msg_id >= DRIVER_MSG_CODE_BEGIN) && (ilm_ptr->msg_id <= MSG_ID_DRIVER_CODE_TAIL) ) ) |
| 681 | { |
| 682 | SP_Strm_Audl_Handler(ilm_ptr); |
| 683 | } |
| 684 | #endif |
| 685 | #if defined( __SMART_PHONE_MODEM__ ) |
| 686 | if (ilm_ptr->msg_id == MSG_ID_AUDIO_A2M_CCCI) |
| 687 | { |
| 688 | SpcIO_Msg_Handler_inAudL(ilm_ptr); |
| 689 | } else if (ilm_ptr->msg_id == MSG_ID_MEDIA_AUD_MUTE_REQ) { |
| 690 | /*----------------------------------------------------------------*/ |
| 691 | /* Local Variables */ |
| 692 | /*----------------------------------------------------------------*/ |
| 693 | kal_uint16 cnf_msg_id; |
| 694 | void *cnf_p = NULL; |
| 695 | |
| 696 | media_aud_mute_req_struct *req_p; |
| 697 | |
| 698 | /*----------------------------------------------------------------*/ |
| 699 | /* Code Body */ |
| 700 | /*----------------------------------------------------------------*/ |
| 701 | req_p = (media_aud_mute_req_struct*) ilm_ptr->local_para_ptr; |
| 702 | |
| 703 | switch (req_p->device) |
| 704 | { |
| 705 | case AUDIO_DEVICE_MICROPHONE: |
| 706 | /* call L1AUD to set microphone mute */ |
| 707 | L1SP_MuteMicrophone(req_p->mute); |
| 708 | // aud_context_p->audio_mute = req_p->mute; |
| 709 | break; |
| 710 | default: |
| 711 | break; |
| 712 | } |
| 713 | |
| 714 | cnf_p = (media_aud_mute_cnf_struct*) construct_local_para(sizeof(media_aud_mute_cnf_struct), TD_CTRL); |
| 715 | |
| 716 | cnf_msg_id = MSG_ID_MEDIA_AUD_MUTE_CNF; |
| 717 | |
| 718 | // aud_send_ilm(ilm_ptr->src_mod_id, cnf_msg_id, cnf_p, NULL); |
| 719 | msg_send6(kal_get_active_module_id(),ilm_ptr->src_mod_id,AUDIO_SAP,cnf_msg_id,cnf_p, NULL); |
| 720 | } |
| 721 | #endif |
| 722 | #endif |
| 723 | |
| 724 | if ((ilm_ptr->msg_id > MSG_ID_AUDIO_M2M_BEGIN) && (ilm_ptr->msg_id < MSG_ID_AUDIO_M2M_TAIL)) |
| 725 | { |
| 726 | #ifdef __MTK_TARGET__ |
| 727 | void SP_M2M_Handler(ilm_struct *ilm_ptr); |
| 728 | SP_M2M_Handler(ilm_ptr); |
| 729 | #endif //#ifdef __MTK_TARGET__ |
| 730 | } |
| 731 | #if !defined(__L1_STANDALONE__) |
| 732 | if ((ilm_ptr->msg_id > MSG_ID_AUDIO_L2P_BEGIN) && (ilm_ptr->msg_id < MSG_ID_AUDIO_L2P_TAIL)) |
| 733 | { |
| 734 | #ifdef __MTK_TARGET__ |
| 735 | void SP_L2P_Handler(ilm_struct *ilm_ptr); |
| 736 | SP_L2P_Handler(ilm_ptr); |
| 737 | #endif //#ifdef __MTK_TARGET__ |
| 738 | } |
| 739 | #endif |
| 740 | #if defined(__VOLTE_SUPPORT__) |
| 741 | if ( ilm_ptr->msg_id == MSG_ID_MEDIA_IN_PROC_CALL_REQ ) |
| 742 | { |
| 743 | #ifdef __MTK_TARGET__ |
| 744 | void aud_util_in_proc_call_req_hdlr(ilm_struct *ilm_ptr); |
| 745 | kal_prompt_trace(MOD_L1SP, "[TONEDEBUG]MSG_ID_MEDIA_IN_PROC_CALL_REQ1"); |
| 746 | aud_util_in_proc_call_req_hdlr(ilm_ptr); |
| 747 | #endif //#ifdef __MTK_TARGET__ |
| 748 | } |
| 749 | #endif |
| 750 | } |
| 751 | |
| 752 | |
| 753 | /***************************************************************************** |
| 754 | * FUNCTION |
| 755 | * med_task_main |
| 756 | * DESCRIPTION |
| 757 | * This function is main function of media task. |
| 758 | * PARAMETERS |
| 759 | * task_entry_ptr [?] |
| 760 | * RETURNS |
| 761 | * void |
| 762 | *****************************************************************************/ |
| 763 | void med_task_main(task_entry_struct *task_entry_ptr) |
| 764 | { |
| 765 | /*----------------------------------------------------------------*/ |
| 766 | /* Local Variables */ |
| 767 | /*----------------------------------------------------------------*/ |
| 768 | ilm_struct current_ilm; |
| 769 | |
| 770 | /*----------------------------------------------------------------*/ |
| 771 | /* Code Body */ |
| 772 | /*----------------------------------------------------------------*/ |
| 773 | |
| 774 | #if !defined(L1_NOT_PRESENT) && !defined(__UE_SIMULATOR__) |
| 775 | SP_Drv_Init_Task(); |
| 776 | #endif |
| 777 | |
| 778 | while (1) |
| 779 | { |
| 780 | msg_receive_extq(¤t_ilm); |
| 781 | |
| 782 | kal_set_active_module_id(current_ilm.dest_mod_id); |
| 783 | |
| 784 | med_main((void*)¤t_ilm); |
| 785 | |
| 786 | destroy_ilm(¤t_ilm); |
| 787 | } |
| 788 | |
| 789 | } |
| 790 | |
| 791 | |
| 792 | /***************************************************************************** |
| 793 | * FUNCTION |
| 794 | * med_init |
| 795 | * DESCRIPTION |
| 796 | * This function is used to init media task. |
| 797 | * PARAMETERS |
| 798 | * task_indx [IN] |
| 799 | * RETURNS |
| 800 | * |
| 801 | *****************************************************************************/ |
| 802 | kal_bool med_init(void) |
| 803 | { |
| 804 | /*----------------------------------------------------------------*/ |
| 805 | /* Local Variables */ |
| 806 | /*----------------------------------------------------------------*/ |
| 807 | |
| 808 | /*----------------------------------------------------------------*/ |
| 809 | /* Code Body */ |
| 810 | /*----------------------------------------------------------------*/ |
| 811 | #if !defined(MED_NOT_PRESENT) |
| 812 | med_context_p->aud_mem_p = med_aud_mem; |
| 813 | |
| 814 | /*if (!aud_init()) |
| 815 | { |
| 816 | return KAL_FALSE; |
| 817 | }*/ |
| 818 | #else //#if !defined(MED_NOT_PRESENT) |
| 819 | #if defined(__MCU_DTMF_SUPPORT__) |
| 820 | med_context_p->aud_mem_p = med_aud_mem; |
| 821 | #endif //#if defined(__MCU_DTMF_SUPPORT__) |
| 822 | #endif //#if !defined(MED_NOT_PRESENT) |
| 823 | |
| 824 | if (!med_utility_init()) |
| 825 | { |
| 826 | return KAL_FALSE; |
| 827 | } |
| 828 | |
| 829 | #if !defined(L1_NOT_PRESENT) && !defined(__UE_SIMULATOR__) |
| 830 | if (!SP_Drv_Init_Bootup()) |
| 831 | { |
| 832 | return KAL_FALSE; |
| 833 | } |
| 834 | #endif |
| 835 | |
| 836 | return KAL_TRUE; |
| 837 | } |
| 838 | |
| 839 | |
| 840 | /***************************************************************************** |
| 841 | * FUNCTION |
| 842 | * med_reset |
| 843 | * DESCRIPTION |
| 844 | * This function is used to reset media task. |
| 845 | * PARAMETERS |
| 846 | * task_indx [IN] |
| 847 | * RETURNS |
| 848 | * |
| 849 | *****************************************************************************/ |
| 850 | kal_bool med_reset(void) |
| 851 | { |
| 852 | /*----------------------------------------------------------------*/ |
| 853 | /* Local Variables */ |
| 854 | /*----------------------------------------------------------------*/ |
| 855 | |
| 856 | /*----------------------------------------------------------------*/ |
| 857 | /* Code Body */ |
| 858 | /*----------------------------------------------------------------*/ |
| 859 | return KAL_TRUE; |
| 860 | } |
| 861 | |
| 862 | |
| 863 | /***************************************************************************** |
| 864 | * FUNCTION |
| 865 | * med_create |
| 866 | * DESCRIPTION |
| 867 | * This function is used to create media task configuration info. |
| 868 | * PARAMETERS |
| 869 | * handle [IN] |
| 870 | * RETURNS |
| 871 | * |
| 872 | *****************************************************************************/ |
| 873 | kal_bool med_create(comptask_handler_struct **handle) |
| 874 | { |
| 875 | /*----------------------------------------------------------------*/ |
| 876 | /* Local Variables */ |
| 877 | /*----------------------------------------------------------------*/ |
| 878 | static const comptask_handler_struct med_handler_info = |
| 879 | { |
| 880 | med_task_main, /* task entry function */ |
| 881 | med_init, /* task initialization function */ |
| 882 | med_reset /* task reset handler */ |
| 883 | }; |
| 884 | |
| 885 | /*----------------------------------------------------------------*/ |
| 886 | /* Code Body */ |
| 887 | /*----------------------------------------------------------------*/ |
| 888 | *handle = (comptask_handler_struct*) & med_handler_info; |
| 889 | |
| 890 | return KAL_TRUE; |
| 891 | } |
| 892 | |