yu.dong | c33b307 | 2024-08-21 23:14:49 -0700 | [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) 2005 |
| 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 | * l1audio.h |
| 40 | * |
| 41 | * Project: |
| 42 | * -------- |
| 43 | * MTK6208 |
| 44 | * |
| 45 | * Description: |
| 46 | * ------------ |
| 47 | * Audio Task interface definition |
| 48 | * |
| 49 | * Author: |
| 50 | * ------- |
| 51 | * ------- |
| 52 | * |
| 53 | *------------------------------------------------------------------------------ |
| 54 | * removed! |
| 55 | * removed! |
| 56 | * removed! |
| 57 | * |
| 58 | * removed! |
| 59 | * removed! |
| 60 | * removed! |
| 61 | * removed! |
| 62 | * |
| 63 | * removed! |
| 64 | * removed! |
| 65 | * |
| 66 | * removed! |
| 67 | * removed! |
| 68 | * removed! |
| 69 | * removed! |
| 70 | * |
| 71 | * removed! |
| 72 | * removed! |
| 73 | * removed! |
| 74 | * removed! |
| 75 | * |
| 76 | * removed! |
| 77 | * removed! |
| 78 | * removed! |
| 79 | * removed! |
| 80 | * |
| 81 | * removed! |
| 82 | * removed! |
| 83 | * removed! |
| 84 | * |
| 85 | * removed! |
| 86 | * removed! |
| 87 | * |
| 88 | * removed! |
| 89 | * removed! |
| 90 | * removed! |
| 91 | * removed! |
| 92 | * |
| 93 | * removed! |
| 94 | * removed! |
| 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 | * |
| 114 | * removed! |
| 115 | * removed! |
| 116 | * removed! |
| 117 | * removed! |
| 118 | * |
| 119 | * removed! |
| 120 | * removed! |
| 121 | * removed! |
| 122 | * removed! |
| 123 | * |
| 124 | * removed! |
| 125 | * removed! |
| 126 | * removed! |
| 127 | * |
| 128 | * removed! |
| 129 | * removed! |
| 130 | * removed! |
| 131 | * |
| 132 | * removed! |
| 133 | * removed! |
| 134 | * removed! |
| 135 | * removed! |
| 136 | * removed! |
| 137 | * removed! |
| 138 | * |
| 139 | * removed! |
| 140 | * removed! |
| 141 | * removed! |
| 142 | * removed! |
| 143 | * |
| 144 | * removed! |
| 145 | * removed! |
| 146 | * removed! |
| 147 | * |
| 148 | * removed! |
| 149 | * removed! |
| 150 | * removed! |
| 151 | * |
| 152 | * removed! |
| 153 | * removed! |
| 154 | * removed! |
| 155 | * |
| 156 | * removed! |
| 157 | * removed! |
| 158 | * removed! |
| 159 | * removed! |
| 160 | * |
| 161 | * removed! |
| 162 | * removed! |
| 163 | * removed! |
| 164 | * removed! |
| 165 | * |
| 166 | * removed! |
| 167 | * removed! |
| 168 | * removed! |
| 169 | * |
| 170 | * removed! |
| 171 | * removed! |
| 172 | * removed! |
| 173 | * |
| 174 | * removed! |
| 175 | * removed! |
| 176 | * removed! |
| 177 | * |
| 178 | * removed! |
| 179 | * removed! |
| 180 | * removed! |
| 181 | * removed! |
| 182 | * removed! |
| 183 | * removed! |
| 184 | * |
| 185 | * removed! |
| 186 | * removed! |
| 187 | * removed! |
| 188 | * |
| 189 | * removed! |
| 190 | * removed! |
| 191 | * removed! |
| 192 | * |
| 193 | * removed! |
| 194 | * removed! |
| 195 | * removed! |
| 196 | * removed! |
| 197 | * |
| 198 | * removed! |
| 199 | * removed! |
| 200 | * removed! |
| 201 | * |
| 202 | * removed! |
| 203 | * removed! |
| 204 | * removed! |
| 205 | * |
| 206 | * removed! |
| 207 | * removed! |
| 208 | * removed! |
| 209 | * removed! |
| 210 | * |
| 211 | * removed! |
| 212 | * removed! |
| 213 | * removed! |
| 214 | * removed! |
| 215 | * removed! |
| 216 | * removed! |
| 217 | * |
| 218 | * removed! |
| 219 | * removed! |
| 220 | * removed! |
| 221 | * |
| 222 | * removed! |
| 223 | * removed! |
| 224 | * removed! |
| 225 | * removed! |
| 226 | * |
| 227 | * removed! |
| 228 | * removed! |
| 229 | * removed! |
| 230 | * |
| 231 | * removed! |
| 232 | * removed! |
| 233 | * removed! |
| 234 | * |
| 235 | * removed! |
| 236 | * removed! |
| 237 | * removed! |
| 238 | * |
| 239 | * removed! |
| 240 | * removed! |
| 241 | * removed! |
| 242 | * |
| 243 | * removed! |
| 244 | * removed! |
| 245 | * removed! |
| 246 | * |
| 247 | * removed! |
| 248 | * removed! |
| 249 | * removed! |
| 250 | * |
| 251 | * removed! |
| 252 | * removed! |
| 253 | * removed! |
| 254 | * |
| 255 | * removed! |
| 256 | * removed! |
| 257 | * removed! |
| 258 | * |
| 259 | * removed! |
| 260 | * removed! |
| 261 | * removed! |
| 262 | * |
| 263 | * removed! |
| 264 | * removed! |
| 265 | * removed! |
| 266 | * |
| 267 | * removed! |
| 268 | * removed! |
| 269 | * removed! |
| 270 | * |
| 271 | *------------------------------------------------------------------------------ |
| 272 | * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 273 | *============================================================================== |
| 274 | *******************************************************************************/ |
| 275 | |
| 276 | #ifndef L1AUDIO_H |
| 277 | #define L1AUDIO_H |
| 278 | |
| 279 | |
| 280 | #include "kal_general_types.h" |
| 281 | #include "kal_public_defs.h" |
| 282 | |
| 283 | |
| 284 | #define MED_STAT_AUDIO_START 200 |
| 285 | |
| 286 | |
| 287 | /* ------------------------------------------------------------------------------ */ |
| 288 | /* Function ptr prototype [HAL rule] */ |
| 289 | /* ------------------------------------------------------------------------------ */ |
| 290 | // For In Process Call |
| 291 | typedef void (*in_proc_call_type)( kal_uint32 arg1, void* arg2 ); |
| 292 | |
| 293 | typedef void* (*fp_audio_alloc_aud_mem)(kal_uint32 size, char* file_p, long line_p); |
| 294 | typedef void (*fp_audio_free_aud_mem)(void** ptr, char* file_p, long line_p); |
| 295 | typedef void (*fp_audio_set_path_volume)(kal_uint8 audio_mode); |
| 296 | typedef kal_uint8 (*fp_audio_get_active_mode)(void); |
| 297 | typedef void (*fp_send_proc_call_req)(module_type src_mod_id, in_proc_call_type func, kal_uint32 func_arg1, void *func_arg2); |
| 298 | typedef kal_bool (*fp_get_meta_data_file)(kal_wchar *filename, void *aud_info_p); |
| 299 | typedef kal_bool (*fp_get_meta_data_array)(kal_char *ptr, kal_uint32 size, void *aud_info_p); |
| 300 | |
| 301 | |
| 302 | extern void *audio_alloc_ext_mem (kal_int32 size,char* file_p, long line_p); |
| 303 | extern void *audio_alloc_ext_mem_cacheable (kal_int32 size,char* file_p, long line_p); |
| 304 | extern void audio_free_ext_mem (void **ptr,char* file_p, long line_p); |
| 305 | |
| 306 | #define audio_alloc_mem(size) audio_alloc_ext_mem(size,__FILE__,__LINE__) |
| 307 | #define audio_alloc_mem_cacheable(size) audio_alloc_ext_mem_cacheable(size,__FILE__,__LINE__) |
| 308 | #define audio_free_mem(ptr) audio_free_ext_mem(ptr,__FILE__,__LINE__) |
| 309 | |
| 310 | |
| 311 | typedef struct { |
| 312 | fp_audio_alloc_aud_mem alloc_mem; |
| 313 | fp_audio_alloc_aud_mem alloc_mem_cacheable; |
| 314 | fp_audio_free_aud_mem free_mem; |
| 315 | fp_audio_set_path_volume set_path_volume; |
| 316 | fp_audio_get_active_mode get_active_mode; |
| 317 | fp_send_proc_call_req send_proc_call; |
| 318 | fp_send_proc_call_req send_proc_call2; |
| 319 | fp_get_meta_data_file get_meta_file; |
| 320 | fp_get_meta_data_array get_meta_array; |
| 321 | } Media_Func_Reg_Type; |
| 322 | |
| 323 | void Audio_MedFuncReg(Media_Func_Reg_Type *func); |
| 324 | |
| 325 | typedef void (*fp_a2dp_set_br_from_qos_init)(kal_uint32 bit_rate_cur); |
| 326 | typedef kal_uint32 (*fp_a2dp_set_br_from_qos)(kal_uint8 qos, kal_uint32 bit_rate_prev, kal_uint32 (*SetCodecBitRate)(kal_uint32)); |
| 327 | |
| 328 | |
| 329 | /* ------------------------------------------------------------------------------ */ |
| 330 | /* Audio memory allocation. */ |
| 331 | /* ------------------------------------------------------------------------------ */ |
| 332 | //for new tone interface, MD-DSP and MD-MCU can generate tone at the same time. |
| 333 | #define MAX_AUDIO_FUNCTIONS 25 |
| 334 | |
| 335 | /* ------------------------------------------------------------------------------ */ |
| 336 | /* Audio Function Definition */ |
| 337 | /* ------------------------------------------------------------------------------ */ |
| 338 | #define L1SP_KEYTONE 0 |
| 339 | #define L1SP_TONE 1 |
| 340 | #define L1SP_SPEECH 2 |
| 341 | #define L1SP_SND_EFFECT 3 |
| 342 | #define L1SP_AUDIO 4 |
| 343 | #define L1SP_VOICE 5 |
| 344 | #define L1SP_DAI 6 |
| 345 | #define L1SP_LINEIN 7 |
| 346 | #define L1SP_MAX_AUDIO 8 |
| 347 | |
| 348 | #define SRC_VOICE_DAC 0 |
| 349 | #define SRC_AUDIO_DAC 1 |
| 350 | #define SRC_EXT_INPUT 2 |
| 351 | |
| 352 | |
| 353 | #define INVALID_AUDIO_ID MAX_AUDIO_FUNCTIONS |
| 354 | |
| 355 | typedef void (*L1Audio_EventHandler)(void*); |
| 356 | |
| 357 | // kal_int8 L1Audio_Disable_DSPSlowIdle(void); |
| 358 | // kal_int8 L1Audio_Enable_DSPSlowIdle(void); |
| 359 | |
| 360 | // void L1Audio_SendILM(kal_uint16 msg_id, module_type src_module, module_type dst_module, void *local_param_ptr, void *peer_buf_ptr); |
| 361 | kal_uint16 L1Audio_GetAudioID( void ); |
| 362 | void L1Audio_FreeAudioID( kal_uint16 aud_id ); |
| 363 | kal_bool L1Audio_CheckAudioID( kal_uint16 audio_id ); |
| 364 | void L1Audio_SetEventHandler( kal_uint16 audio_id, L1Audio_EventHandler handler ); |
| 365 | void L1Audio_SetEvent( kal_uint16 audio_id, void *data ); |
| 366 | void L1Audio_LSetEvent( kal_uint16 audio_id, void *data ); |
| 367 | kal_bool L1Audio_CheckFlag( kal_uint16 audio_id ); |
| 368 | void L1Audio_SetFlag( kal_uint16 audio_id ); |
| 369 | void L1Audio_ClearFlag( kal_uint16 audio_id ); |
| 370 | void L1Audio_AllowSleep( kal_uint16 audio_id ); |
| 371 | void L1Audio_DisallowSleep( kal_uint16 audio_id ); |
| 372 | void L1Audio_HookHisrHandler( kal_uint16 magic_no, L1Audio_EventHandler handler, void *userData ); |
| 373 | void L1Audio_UnhookHisrHandler( kal_uint16 magic_no ); |
| 374 | // void L1Audio_SetPostHisrHandler( L1Audio_EventHandler handler ); |
| 375 | // void L1Audio_ResetPostHisrHandler( void ); |
| 376 | |
| 377 | void L1Audio_ResetDevice( void ); |
| 378 | |
| 379 | void L1Audio_SetDebugInfoN( kal_uint16 index, kal_uint16 debug_info ); |
| 380 | |
| 381 | #define NUM_DEBUG_INFO 16 |
| 382 | #define VM_DEBUG_INFO 0 |
| 383 | #define VOIPEVL_DEBUG_INFO 1 |
| 384 | #define AMR_REC_DEBUG_INFO 2 |
| 385 | #define AWB_REC_DEBUG_INFO 3 |
| 386 | #define APM_DEBUG_INFO 4 |
| 387 | #define STEREO_RECORD_INFO 5 |
| 388 | #define AUDIO_DEBUG_MISC 6 // factory mode audio debug parameter 6 |
| 389 | #define CTM_DEBUG_INFO 7 |
| 390 | #define AVB_DEBUG_INFO 8 |
| 391 | |
| 392 | |
| 393 | void L1Audio_SetDebugInfo( kal_uint16 debug_info[NUM_DEBUG_INFO]); |
| 394 | kal_uint16 L1Audio_GetDebugInfo( kal_uint8 index ); |
| 395 | /* ------------------------------------------------------------------------------ */ |
| 396 | /* Audio Front End Interface */ |
| 397 | /* ------------------------------------------------------------------------------ */ |
| 398 | #if 0 |
| 399 | /* under construction !*/ |
| 400 | /* under construction !*/ |
| 401 | /* under construction !*/ |
| 402 | /* under construction !*/ |
| 403 | /* under construction !*/ |
| 404 | /* under construction !*/ |
| 405 | /* under construction !*/ |
| 406 | /* under construction !*/ |
| 407 | /* under construction !*/ |
| 408 | /* under construction !*/ |
| 409 | /* under construction !*/ |
| 410 | /* under construction !*/ |
| 411 | /* under construction !*/ |
| 412 | /* under construction !*/ |
| 413 | /* under construction !*/ |
| 414 | /* under construction !*/ |
| 415 | /* under construction !*/ |
| 416 | /* under construction !*/ |
| 417 | /* under construction !*/ |
| 418 | /* under construction !*/ |
| 419 | /* under construction !*/ |
| 420 | /* under construction !*/ |
| 421 | /* under construction !*/ |
| 422 | #endif |
| 423 | |
| 424 | #if 0 |
| 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 | #endif |
| 440 | |
| 441 | /* ------------------------------------------------------------------------------ */ |
| 442 | /* Audio Related Global Variables */ |
| 443 | /* ------------------------------------------------------------------------------ */ |
| 444 | extern const signed short Speech_Input_FIR_Coeff[6][45]; |
| 445 | extern const signed short Speech_Output_FIR_Coeff[6][45]; |
| 446 | extern const signed short WB_Speech_Input_FIR_Coeff[6][90]; |
| 447 | extern const signed short WB_Speech_Output_FIR_Coeff[6][90]; |
| 448 | |
| 449 | |
| 450 | // extern const unsigned short Media_Playback_Maximum_Swing; |
| 451 | // extern const signed short Melody_FIR[25]; |
| 452 | |
| 453 | #if 0 |
| 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 | #endif |
| 463 | /* ------------------------------------------------------------------------------ */ |
| 464 | /* Key Tone Interface */ |
| 465 | /* ------------------------------------------------------------------------------ */ |
| 466 | typedef enum { |
| 467 | DSP_TONE = 0, |
| 468 | MCU_TONE, |
| 469 | TOTAL_TONE_NUM |
| 470 | }TONE_TYPE; |
| 471 | |
| 472 | void KT_SetOutputDevice( kal_uint8 device ); |
| 473 | void KT_SetOutputVolume( kal_uint8 volume1, kal_int8 digital_gain_index ); |
| 474 | void KT_Play( kal_uint16 freq1, kal_uint16 freq2, kal_uint16 duration, TONE_TYPE type); |
| 475 | void KT_Stop( TONE_TYPE type ); |
| 476 | void KT_StopAndWait(void); |
| 477 | void KT_SetAmplitude( kal_int16 amp ); |
| 478 | void KT_SetFIR( kal_bool enable ); |
| 479 | kal_bool KT_IsPlayable(void); |
| 480 | |
| 481 | /* ------------------------------------------------------------------------------ */ |
| 482 | /* Tone Interface */ |
| 483 | /* ------------------------------------------------------------------------------ */ |
| 484 | typedef struct { |
| 485 | kal_uint16 freq1; /* First frequency */ |
| 486 | kal_uint16 freq2; /* Second frequency */ |
| 487 | kal_uint16 on_duration; /* Tone on duation(ms), 0 for continuous tone */ |
| 488 | kal_uint16 off_duration; /* Tone off duation(ms), 0 for end of playing */ |
| 489 | kal_int8 next_tone; /* Index of the next tone */ |
| 490 | } L1SP_Tones; |
| 491 | |
| 492 | typedef struct { |
| 493 | kal_uint16 freq1; /* First frequency */ |
| 494 | kal_uint16 freq2; /* Second frequency */ |
| 495 | kal_uint16 on_duration; /* Tone on duation(ms), 0 for continuous tone */ |
| 496 | kal_uint16 off_duration; /* Tone off duation(ms), 0 for end of playing */ |
| 497 | kal_int8 next_tone; /* Index of the next tone */ |
| 498 | kal_uint16 freq3; /* Third frequency */ |
| 499 | kal_uint16 freq4; /* Fourth frequency */ |
| 500 | } L1SP_QTMF; |
| 501 | |
| 502 | /* -------------------------------- */ |
| 503 | /* Example of Tone Definition */ |
| 504 | /* -------------------------------- */ |
| 505 | /* |
| 506 | static const L1SP_Tones tone1_gsm[] = { { 425, 0, 0, 0, 0 } }; |
| 507 | static const L1SP_Tones tone1_pcs[] = { { 350, 440, 0, 0, 0 } }; |
| 508 | static const L1SP_Tones tone2_gsm[] = { { 425, 0, 500, 500, 0 } }; |
| 509 | static const L1SP_Tones tone2_pcs[] = { { 480, 620, 500, 500, 0 } }; |
| 510 | static const L1SP_Tones tone3_gsm[] = { { 425, 0, 200, 200, 0 } }; |
| 511 | static const L1SP_Tones tone3_pcs[] = { { 480, 620, 200, 200, 0 } }; |
| 512 | static const L1SP_Tones tone4[] = { { 425, 0, 200, 0, 0 } }; |
| 513 | static const L1SP_Tones tone5[] = { { 425, 0, 200, 200, 1 }, |
| 514 | { 425, 0, 200, 200, 2 }, |
| 515 | { 425, 0, 200, 0, 0 } }; |
| 516 | static const L1SP_Tones tone61[] = { { 950, 0, 330,1000, 0 } }; |
| 517 | static const L1SP_Tones tone62[] = { {1400, 0, 330,1000, 0 } }; |
| 518 | static const L1SP_Tones tone63[] = { {1800, 0, 330,1000, 0 } }; |
| 519 | static const L1SP_Tones tone7[] = { { 425, 0, 200, 600, 1 }, |
| 520 | { 425, 0, 200,3000, 2 }, |
| 521 | { 425, 0, 200, 600, 3 }, |
| 522 | { 425, 0, 200, 0, 0 } }; |
| 523 | */ |
| 524 | |
| 525 | void TONE_SetOutputDevice( kal_uint8 device ); |
| 526 | void TONE_SetOutputVolume( kal_uint8 volume1, kal_int8 digital_gain_index ); |
| 527 | void TONE_Play( const L1SP_Tones *tonelist, TONE_TYPE type ); |
| 528 | void TONE_Stop( TONE_TYPE type ); |
| 529 | void TONE_StopAndWait( void ); |
| 530 | void TONE_SetAmplitude( kal_int16 amp ); |
| 531 | void TONE_SetFIR( kal_bool enable ); |
| 532 | void TONE_SetHandler( void (*handler)(void), TONE_TYPE type ); |
| 533 | void TONE_PlayQTMF( const L1SP_QTMF *tonelist ); /* QTMF Play Interface */ |
| 534 | |
| 535 | void SP4G_PSR_DL_KT_Play(kal_int16 freq1, kal_int16 freq2, kal_int16 duration); |
| 536 | void SP4G_PSR_DL_KT_Stop( void ); |
| 537 | void SP4G_PSR_UL_KT_Play(kal_int16 freq1, kal_int16 freq2, kal_int16 duration); |
| 538 | void SP4G_PSR_UL_KT_Stop( void ); |
| 539 | |
| 540 | void SP4G_PSR_UL_Tone_Play(const L1SP_Tones *pToneList ); |
| 541 | void SP4G_PSR_UL_Tone_Stop( void ); |
| 542 | void SP4G_PSR_DL_Tone_Play(const L1SP_Tones *pToneList ); |
| 543 | void SP4G_PSR_DL_Tone_Stop( void ); |
| 544 | |
| 545 | /* ------------------------------------------------------------------------------ */ |
| 546 | /* Speech Interface */ |
| 547 | /* ------------------------------------------------------------------------------ */ |
| 548 | typedef enum { |
| 549 | L1SP_NVRAM_INFO_INDEX_UNDEF = 0, |
| 550 | L1SP_NVRAM_INFO_INDEX_PARAM, |
| 551 | L1SP_NVRAM_INFO_INDEX_WB_SPEECH_INPUT_FIR, |
| 552 | L1SP_NVRAM_INFO_INDEX_WB_SPEECH_OUTPUT_FIR, |
| 553 | L1SP_NVRAM_INFO_INDEX_WB_SPEECH_MODE_PARAM, |
| 554 | L1SP_NVRAM_INFO_INDEX_HD_RECORD, |
| 555 | } L1SP_NVRAM_INFO_INDEX; |
| 556 | |
| 557 | void L1SP_SetNvramInfoByIndex(L1SP_NVRAM_INFO_INDEX index,kal_uint8* buffer, kal_uint16 len); |
| 558 | |
| 559 | void L1SP_SetOutputDevice( kal_uint8 device ); |
| 560 | void L1SP_SetOutputVolume( kal_uint8 volume1, kal_int8 digital_gain_index ); |
| 561 | void L1SP_Speech_On( kal_uint8 RAT_Mode ); |
| 562 | void L1SP_Speech_Off( void ); |
| 563 | void L1SP_SetInputSource( kal_uint8 src ); |
| 564 | kal_uint8 L1SP_GetInputSource( void ); |
| 565 | void L1SP_SetMicrophoneVolume( kal_uint8 mic_volume ); |
| 566 | kal_uint8 L1SP_GetMicrophoneVolume( void ); |
| 567 | void L1SP_MuteSpeaker( kal_bool mute ); |
| 568 | void L1SP_MutePCMOuputPort ( kal_bool fMute ); |
| 569 | void L1SP_SetSidetoneVolume( kal_uint8 sidetone ); |
| 570 | kal_uint8 L1SP_GetSidetoneVolume( void ); |
| 571 | void L1SP_MuteMicrophone( kal_bool mute ); |
| 572 | kal_bool L1SP_IsMicrophoneMuted( void ); |
| 573 | void L1SP_SetFIR( kal_bool enable ); |
| 574 | void L1SP_Set_DAI_Mode( kal_uint8 mode ); |
| 575 | // void l1sp_Write_Audio_Coefficients( const kal_int16 in_coeff[30], const kal_int16 out_coeff[30] ); |
| 576 | // void L1SP_Write_Audio_Coefficients_ByFirIndex( const kal_uint8 inOrOut2FirIndex, const kal_uint8 outFirIndex); |
| 577 | |
| 578 | void L1SP_SetAfeLoopback( kal_bool enable ); |
| 579 | |
| 580 | kal_bool L1SP_IsBluetoothOn( void ); |
| 581 | kal_bool L1SP_IsSpeechOn( void ); |
| 582 | // void L1SP_EnableSpeechEnhancement( kal_bool enable ); |
| 583 | #define FIRST_MIC (0) |
| 584 | |
| 585 | // void l1sp_Write_WB_Audio_Coefficients( const kal_int16 in_coeff[90], const kal_int16 out_coeff[90] ); |
| 586 | // void L1SP_UpdateSpeechPara(kal_uint16 sph_m_para[16] );//NUM_MAX_MODE_PARAS |
| 587 | void L1SP_LoadSpeechPara( void ); |
| 588 | |
| 589 | |
| 590 | #define NUM_DMNR_PARAM (44) |
| 591 | #define NUM_WB_DMNR_PARAM (76) |
| 592 | #define NUM_SWB_DMNR_PARAM (120) |
| 593 | #define NUM_ABF_PARAM (44) |
| 594 | #define NUM_MAGI_CLARITY_PARAM (32) |
| 595 | void L1SP_SetDMNRPara( const kal_int16 DMNR_para[NUM_DMNR_PARAM] ); |
| 596 | void L1SP_SetLSpkDMNRPara( const kal_int16 LSpk_DMNR_para[NUM_DMNR_PARAM] ); |
| 597 | void L1SP_SetWbDMNRPara( const kal_int16 WB_DMNR_para[NUM_WB_DMNR_PARAM] ); |
| 598 | void L1SP_SetSWbDMNRPara( const kal_int16 SWB_DMNR_para[NUM_SWB_DMNR_PARAM] ); |
| 599 | void L1SP_SetLSpkWbDMNRPara( const kal_int16 LSpk_Wb_DMNR_para[NUM_WB_DMNR_PARAM] ); |
| 600 | void L1SP_SetLSpkSWbDMNRPara( const kal_int16 LSpk_SWb_DMNR_para[NUM_SWB_DMNR_PARAM] ); |
| 601 | |
| 602 | /* -------------------------------e-call modem ---------------------------------------- */ |
| 603 | // eCall modem interface |
| 604 | typedef enum { |
| 605 | eCALL_OPERATION_SUCCESS, |
| 606 | eCALL_OPERATION_FAIL, |
| 607 | eCALL_OPERATION_ALREADY_OPEN, |
| 608 | eCALL_OPERATION_ALREADY_CLOSE, |
| 609 | eCALL_OPERATION_DURING_TRANSMISSION, |
| 610 | eCALL_OPERATION_STOP |
| 611 | } eCall_Modem_Status; |
| 612 | |
| 613 | typedef enum { |
| 614 | eCALL_EVENT_SEND_START, |
| 615 | eCALL_EVENT_RECV_START, |
| 616 | eCALL_EVENT_RECV_NACK, |
| 617 | eCALL_EVENT_RECV_LL_ACK, |
| 618 | eCALL_EVENT_RECV_HL_ACK_CORRECT, |
| 619 | eCALL_EVENT_RECV_HL_ACK_MISMATCH, |
| 620 | eCALL_EVENT_PSAP_RECV_MSD |
| 621 | } eCall_Modem_Event; |
| 622 | |
| 623 | typedef void (*eCall_Callback)(eCall_Modem_Event event, void *param); |
| 624 | void eCall_Init(void); |
| 625 | eCall_Modem_Status eCall_IVS_Open(eCall_Callback handler); |
| 626 | eCall_Modem_Status eCall_IVS_Close(void); |
| 627 | eCall_Modem_Status eCall_IVS_PutMSD(const kal_uint8 *pMSD, const kal_uint32 uLen, kal_uint8 from); |
| 628 | eCall_Modem_Status eCall_IVS_SendStart(void); |
| 629 | eCall_Modem_Status eCall_PSAP_Open(eCall_Callback handler); |
| 630 | eCall_Modem_Status eCall_PSAP_Close(void); |
| 631 | eCall_Modem_Status eCall_PSAP_SendStart(void); |
| 632 | void Set_eCall_Par_Crtl_Switch(kal_uint8 Switch); |
| 633 | |
| 634 | |
| 635 | /* ------------------------------------------------------------------------------ */ |
| 636 | |
| 637 | |
| 638 | /*******************************************************************/ |
| 639 | /* The new interface for DSP speech enhancement function / Bluetooth */ |
| 640 | /*******************************************************************/ |
| 641 | #define SPH_MODE_NORMAL 0 |
| 642 | #define SPH_MODE_EARPHONE 1 |
| 643 | #define SPH_MODE_LOUDSPK 2 |
| 644 | #define SPH_MODE_BT_EARPHONE 3 |
| 645 | #define SPH_MODE_BT_CORDLESS 4 |
| 646 | #define SPH_MODE_BT_CARKIT 5 |
| 647 | #define SPH_MODE_AUX1 6 |
| 648 | #define SPH_MODE_AUX2 7 |
| 649 | #define SPH_MODE_HAC 8 |
| 650 | #define SPH_MODE_USB 9 |
| 651 | #define SPH_MODE_LINEIN_VIA_BT_CORDLESS 10 |
| 652 | #define SPH_MODE_UNDEFINED 11 |
| 653 | |
| 654 | #define NUM_SPH_MODE 8 |
| 655 | #define NUM_SPH_INPUT_FIR 6 |
| 656 | #define NUM_SPH_OUTPUT_FIR 6 |
| 657 | |
| 658 | #define SPH_FIR_COEFF_NORMAL 0 |
| 659 | #define SPH_FIR_COEFF_HEADSET 1 |
| 660 | #define SPH_FIR_COEFF_HANDFREE 2 |
| 661 | #define SPH_FIR_COEFF_BT 3 |
| 662 | #define SPH_FIR_COEFF_VOIP_NORMAL 4 |
| 663 | #define SPH_FIR_COEFF_VOIP_HANDFREE 5 |
| 664 | #define SPH_FIR_COEFF_HAC 6 |
| 665 | #define SPH_FIR_COEFF_USB 7 |
| 666 | |
| 667 | |
| 668 | |
| 669 | #define NUM_COMMON_PARAS 12 |
| 670 | |
| 671 | |
| 672 | |
| 673 | #define NUM_MODE_PARAS 48 |
| 674 | |
| 675 | #define NUM_VOL_PARAS 4 |
| 676 | |
| 677 | #define NUM_FIR_COEFFS 90 |
| 678 | #define NUM_WB_FIR_COEFFS 90 |
| 679 | #define NUM_SWB_FIR_COEFFS 90 |
| 680 | #define NUM_IIR_COEFFS 42 |
| 681 | #define NUM_MIC1_IIR_COEFFS 20 |
| 682 | #define NUM_MIC2_IIR_COEFFS 20 |
| 683 | |
| 684 | #define TOTAL_NETWORK_NUMBER 5 //GSM WCDMA CDMA VOLTE |
| 685 | |
| 686 | /* ------------------------------------------------------------------------------ */ |
| 687 | /* Network defined for audio tuning tool */ |
| 688 | /* ------------------------------------------------------------------------------ */ |
| 689 | #define NETWORK_GSM 0 |
| 690 | #define NETWORK_WCDMA_TDD 1 |
| 691 | #define NETWORK_WCDMA_FDD 2 |
| 692 | #define NETWORK_VOLTE 3 |
| 693 | #define NETWORK_C2K 4 |
| 694 | #define NETWORK_3GVT 5 |
| 695 | #define NETWORK_VILTE 6 |
| 696 | #define NETWORK_VOWIFI 7 |
| 697 | #define NETWORK_VIWIFI 8 |
| 698 | |
| 699 | |
| 700 | void L1SP_LoadCommonSpeechPara( kal_uint16 c_para[NUM_COMMON_PARAS] ); |
| 701 | |
| 702 | // void L1SP_SetSpeechVolumeLevel( kal_uint8 level, kal_uint16 v_para[NUM_VOL_PARAS] ); |
| 703 | // kal_uint8 L1SP_GetSpeechMode( void ); |
| 704 | |
| 705 | /** |
| 706 | this function is to replace L1SP_SetSpeechVolumeLevel() |
| 707 | |
| 708 | @level: [input] speech volume level for speech |
| 709 | @v_paraIndex: [input] volume paramter (saving in nvram) index |
| 710 | */ |
| 711 | void L1SP_SetSpeechVolumeLevelByIndex(kal_uint8 level, kal_uint8 v_paraIndex); |
| 712 | |
| 713 | typedef enum { |
| 714 | SPH_ENH_AND_FIR_SCENE_NORMAL = 0, //from 0 to 8, it is one to one mapping to speech mode. ie. SPH_MODE_NORMAL to SPH_MODE_LINEIN_VIA_BT_CORDLESS |
| 715 | SPH_ENH_AND_FIR_SCENE_EARPHONE, |
| 716 | SPH_ENH_AND_FIR_SCENE_LOUDSPK, |
| 717 | SPH_ENH_AND_FIR_SCENE_BT_EARPHONE, |
| 718 | SPH_ENH_AND_FIR_SCENE_BT_CORDLESS, |
| 719 | SPH_ENH_AND_FIR_SCENE_BT_CARKIT, |
| 720 | SPH_ENH_AND_FIR_SCENE_AUX1, |
| 721 | SPH_ENH_AND_FIR_SCENE_AUX2, |
| 722 | SPH_ENH_AND_FIR_SCENE_HAC, |
| 723 | SPH_ENH_AND_FIR_SCENE_USB, |
| 724 | |
| 725 | SPH_ENH_AND_FIR_SCENE_UNDEF = 0xFFFF, |
| 726 | } SPH_ENH_AND_FIR_SCENE; |
| 727 | |
| 728 | typedef enum { |
| 729 | SPH_ENH_AND_FIR_UPDATE_TYPE_ALL = 0, |
| 730 | SPH_ENH_AND_FIR_UPDATE_TYPE_NB_ENH_MODE = 0x2, |
| 731 | SPH_ENH_AND_FIR_UPDATE_TYPE_NB_FIR = 0x4, |
| 732 | SPH_ENH_AND_FIR_UPDATE_TYPE_WB_ENH_MODE = 0x8, |
| 733 | SPH_ENH_AND_FIR_UPDATE_TYPE_WB_FIR = 0x10, |
| 734 | |
| 735 | } SPH_ENH_AND_FIR_UPDATE_TYPE; |
| 736 | |
| 737 | /** |
| 738 | new interface to replace L1SP_SetSpeechMode(), L1SP_Write_Audio_Coefficients(), |
| 739 | L1SP_Write_WB_Audio_Coefficients() in the same time. |
| 740 | |
| 741 | if you want to use personal configuration, you can use original interfaces. |
| 742 | |
| 743 | @scene: [Input] scenario for different enhancement and fir combination. Please refer to "SPH_ENH_AND_FIR_SCENE" |
| 744 | @updatedCoeff: [Input] Please refer to "SPH_ENH_AND_FIR_UPDATE_TYPE" |
| 745 | */ |
| 746 | void L1SP_SetSpeechEnhanceAndFir(kal_uint32 scene, kal_uint32 updatedCoeff); |
| 747 | |
| 748 | /** |
| 749 | MED can get nvram values from this function. |
| 750 | |
| 751 | @index: [Input] Identify which LID is going to provide |
| 752 | @buffer: [Output] Buffer with the contain the result |
| 753 | @len: [Input] Length of the output buffer |
| 754 | */ |
| 755 | void L1SP_GetNvramInfoByIndex(L1SP_NVRAM_INFO_INDEX index, void *buffer, kal_uint16 len); |
| 756 | #define LEN_OF_ENHANCEMENT_MODE_NAME 30 |
| 757 | |
| 758 | #define LEN_OF_ENHANCEMENT_CATEGORY_NAME 20 |
| 759 | /** |
| 760 | user: should be META only |
| 761 | (realted to customer folder) |
| 762 | |
| 763 | @return: number of all enhancement category |
| 764 | */ |
| 765 | kal_int16 L1SP_GetNumOfAllEnhancementCategory(void); |
| 766 | |
| 767 | |
| 768 | |
| 769 | typedef struct { |
| 770 | kal_uint32 fc_format; |
| 771 | kal_uint8 *rb_base; // Pointer to the ring buffer |
| 772 | kal_int32 rb_size; // Size of the ring buffer |
| 773 | kal_int32 write; |
| 774 | kal_int32 read; |
| 775 | void *param; // Extend parameter or information |
| 776 | kal_uint8 fc_operation; |
| 777 | } AUD_RB_INFO; |
| 778 | |
| 779 | // void Media_MuteSpeaker( kal_bool mute ); |
| 780 | // void Media_SetMelodyFilter( kal_uint16 len, const kal_int16 *filter ); |
| 781 | /* ------------------------------------------------------------------------------ */ |
| 782 | // L1CTM interface |
| 783 | /* |
| 784 | // Due to CTM is not use in the outside, so mode the interface in to ctm_drv.h to prevent redeclaration |
| 785 | typedef enum{ |
| 786 | DIRECT_MODE, |
| 787 | BAUDOT_MODE |
| 788 | } L1Ctm_Interface; |
| 789 | |
| 790 | typedef enum{ |
| 791 | CTM_MO_SUCCESS, |
| 792 | CTM_MO_FAIL, |
| 793 | CTM_MT_DETECTED, |
| 794 | CTM_CHAR_SENT, |
| 795 | CTM_CHAR_RECEIVED, |
| 796 | CTM_TX_BURST_START, |
| 797 | CTM_TX_BURST_END |
| 798 | } L1Ctm_Event; |
| 799 | |
| 800 | typedef struct |
| 801 | { |
| 802 | kal_int16 cprm_tone_demod_down_samp; // 1 (0, 1) |
| 803 | } CTM_Param; |
| 804 | |
| 805 | typedef void (*L1Ctm_Callback)(L1Ctm_Event , void*); |
| 806 | kal_uint32 L1Ctm_GetMemReq(void); |
| 807 | void L1Ctm_Open(L1Ctm_Interface a, L1Ctm_Callback handler, kal_uint8 *buf, kal_uint32 buf_len, CTM_Param *ctm_param); |
| 808 | void L1Ctm_Close(void); |
| 809 | void L1Ctm_StartNegotiation(void); |
| 810 | kal_uint32 L1Ctm_TxPutText(const kal_uint8 *text, kal_uint32 len, kal_uint32 *left_space); |
| 811 | kal_uint32 L1Ctm_RxGetText(kal_uint8 *text, kal_uint32 len, kal_uint32 *left_count); |
| 812 | */ |
| 813 | |
| 814 | |
| 815 | kal_bool BT_PcmLoopbackTest(void); |
| 816 | |
| 817 | /* Ket tone detection interface*/ |
| 818 | void KtDetectStart(void (*callback)(kal_int16 key)); |
| 819 | void KtDetectStop( void ); |
| 820 | |
| 821 | typedef enum { |
| 822 | L1SP_L4C_NONE = 0x0000, |
| 823 | L1SP_L4C_QCELP13K = 0x0001, |
| 824 | L1SP_L4C_EVRC = 0x0002, |
| 825 | L1SP_L4C_EVRC_B = 0x0003, |
| 826 | L1SP_L4C_EVRC_WB = 0x0004, |
| 827 | L1SP_L4C_EVRC_NW = 0x0005, |
| 828 | L1SP_L4C_AMR_NB = 0x0006, |
| 829 | L1SP_L4C_AMR_WB = 0x0007, |
| 830 | L1SP_L4C_GSM_EFR = 0x0008, |
| 831 | L1SP_L4C_GSM_FR = 0x0009, |
| 832 | L1SP_L4C_GSM_HR = 0x000A, |
| 833 | |
| 834 | L1SP_L4C_EVS_NB = 0x0017, |
| 835 | L1SP_L4C_EVS_WB = 0x0018, |
| 836 | L1SP_L4C_EVS_SW = 0x0019, |
| 837 | L1SP_L4C_EVS_FB = 0x0020, |
| 838 | L1SP_L4C_EVS_AWB = 0x0021, |
| 839 | } L1SP_L4C_Codec; |
| 840 | |
| 841 | typedef enum { |
| 842 | L1SP_C2K_LINK_ESTABLISH, |
| 843 | L1SP_C2K_LINK_DEESTABLISH, |
| 844 | L1SP_C2K_LINK_INTRARAT, |
| 845 | } L1SP_C2K_Event; |
| 846 | |
| 847 | typedef enum { |
| 848 | L1SP_L4C_ESPEECH_0, |
| 849 | L1SP_L4C_ESPEECH_1, |
| 850 | L1SP_L4C_START_GENERATE_SID, |
| 851 | L1SP_L4C_STOP_GENERATE_SID, |
| 852 | } L1SP_L4C_Event; |
| 853 | |
| 854 | typedef enum { |
| 855 | L1SP_L4C_EVENT_NONE, |
| 856 | L1SP_L4C_EVENT_CS, |
| 857 | L1SP_L4C_EVENT_PS, |
| 858 | } L1SP_L4C_Event_Mode; |
| 859 | |
| 860 | void SP_L4C_SetEvent(L1SP_L4C_Event event, L1SP_L4C_Event_Mode mode); |
| 861 | |
| 862 | //L5ECALL |
| 863 | #if defined(__ECALL_SUPPORT__) |
| 864 | #if defined(__L5_SUPPORT__) |
| 865 | typedef enum { |
| 866 | L1SP_L5ECALL_INITIAL, |
| 867 | L1SP_L5ECALL_UPDATE_MSD, |
| 868 | L1SP_L5ECALL_RESET, |
| 869 | } L1SP_L5ECALL_Event; |
| 870 | |
| 871 | void SP_L5ECALL_SetEvent(L1SP_L5ECALL_Event event, kal_uint8 *data); |
| 872 | |
| 873 | typedef struct { |
| 874 | LOCAL_PARA_HDR |
| 875 | kal_uint16 Status; |
| 876 | kal_uint32 Data; |
| 877 | }ilm_SP_L5ECALL_Status_INFO_t; |
| 878 | #endif |
| 879 | #endif |
| 880 | /*====================start of 3G interface ===================*/ |
| 881 | //[REMIND] The following definition is related to L1SP_STATE_2G_SPEECH_ON, please use L1SP_GetState() to search the relationship |
| 882 | #define RAT_2G_MODE 0 |
| 883 | #define RAT_3G_MODE 1 |
| 884 | #define RAT_3G324M_MODE 2 |
| 885 | #define RAT_4G_MODE 3 |
| 886 | #define RAT_C2K_MODE 4 |
| 887 | #define RAT_NONE_MODE 0xF |
| 888 | |
| 889 | typedef enum { |
| 890 | SP3G_CODEC_READY, |
| 891 | SP3G_CODEC_CLOSED, |
| 892 | SP3G_UL_DATA_NOTIFY, |
| 893 | SP3G_UL_DATA_DEALY_TICK |
| 894 | } SP3G_Event; |
| 895 | |
| 896 | void SP3G_Request(void); |
| 897 | void SP3G_UL_SetFrameType(kal_uint8 amr_frame_type); |
| 898 | void SP3G_UL_GetSpeechFrame(kal_uint16*frame_index, kal_uint8 *frame_type, kal_uint8 *rab_byte_array, kal_uint8 *len); |
| 899 | void SP3G_DL_PutSpeechFrame(kal_uint32 CFN, kal_uint8 sub_flow_id, kal_uint8 frame_type, kal_bool crc_status, kal_uint8 *subflow); |
| 900 | void SP3G_Closed_Confirm( void ); |
| 901 | void SP3G_Rab_Deest( void ); |
| 902 | void SP3G_Rab_Est( kal_uint32 rab_id, kal_uint8 default_speech_codec ); //Cosine_NAS_Sync_Ind |
| 903 | void SP3G_SetDTX(kal_bool on); |
| 904 | //void SP3GVT_DL_PutSpeechFrame(kal_uint8 *dl_data, kal_uint32 size, kal_bool error_flag); |
| 905 | kal_uint8 SP3GVT_DL_PutSpeechFrame(kal_uint8 *dl_data, kal_uint32 size, kal_bool error_flag, kal_uint8 *dl_frame_number); |
| 906 | kal_uint8 SP3GVT_DL_DropSpeechFrame(kal_uint32 number, kal_uint8 *dl_frame_number); |
| 907 | void SP3GVT_UL_GetSpeechFrame(kal_uint8 *ul_data, kal_uint32 ul_space, kal_uint32 *size); |
| 908 | void SP3GVT_SetDelayValue(kal_uint32 delay); |
| 909 | void SP3G_UpdateL1AInFo( kal_uint8 bitmap, kal_uint8 value ); |
| 910 | /*====================end of 3G interface =====================*/ |
| 911 | |
| 912 | /* ------------------------------------------------------------------------------ */ |
| 913 | typedef enum { |
| 914 | SP4G_CODEC_READY, |
| 915 | SP4G_CODEC_CLOSED, |
| 916 | SP4G_UL_DATA_NOTIFY, |
| 917 | SP4G_UL_MUTE_NOTIFY, |
| 918 | SP4G_UL_DATA_DEALY_TICK, |
| 919 | SP4G_DL_DATA_NOTIFY, |
| 920 | SP4G_DL_MUTE_NOTIFY, |
| 921 | SP4G_DL_DATA_DEALY_TICK |
| 922 | } SP4G_Event; |
| 923 | |
| 924 | typedef enum{ |
| 925 | SP4G_PSR_AMR, |
| 926 | SP4G_PSR_WBAMR, |
| 927 | SP4G_PSR_G711, |
| 928 | SP4G_PSR_G722, |
| 929 | SP4G_PSR_G723_1, |
| 930 | SP4G_PSR_G726, |
| 931 | SP4G_PSR_G729, |
| 932 | SP4G_PSR_EVS_NB, |
| 933 | SP4G_PSR_EVS_WB, |
| 934 | SP4G_PSR_EVS_SWB, |
| 935 | SP4G_PSR_EVS_FB, |
| 936 | SP4G_PSR_EVS_WBAMR, |
| 937 | }SP4G_PSR_Codec; |
| 938 | |
| 939 | #define SP4G_CODEC_ID_BITSHIFT (0x4) |
| 940 | #define SP4G_CODEC_NON_EVS_ID_MASK (0xF0) |
| 941 | #define SP4G_CODEC_AMR_ID (0x00) |
| 942 | #define SP4G_CODEC_AMR_WB_ID (0x10) |
| 943 | #define SP4G_CODEC_AMR_WB_LOST_FRAME_ID (0x40) |
| 944 | #define SP4G_CODEC_GSERISE_ID (0x60) |
| 945 | |
| 946 | #define SP4G_CODEC_EVS_ID_MASK (0xC0) |
| 947 | #define SP4G_CODEC_EVS_SAMPLE_RATE_MASK (0x30) |
| 948 | #define SP4G_CODEC_EVS_CODEC_RATE_MASK (0x0F) |
| 949 | |
| 950 | #define SP4G_CODEC_EVS_ID (0x80) |
| 951 | #define SP4G_CODEC_EVS_AWB_ID (0xC0) |
| 952 | |
| 953 | #define SP4G_CODEC_EVS_BW_BITSHIFT (0x4) |
| 954 | #define SP4G_CODEC_EVS_08K (0x00) |
| 955 | #define SP4G_CODEC_EVS_16K (0x10) |
| 956 | #define SP4G_CODEC_EVS_32K (0x20) |
| 957 | #define SP4G_CODEC_EVS_48K (0x30) |
| 958 | |
| 959 | #define SP4G_CODEC_EVS_005_9 (0x00) |
| 960 | #define SP4G_CODEC_EVS_002_8 (0x00) |
| 961 | #define SP4G_CODEC_EVS_007_2 (0x01) |
| 962 | #define SP4G_CODEC_EVS_008_0 (0x02) |
| 963 | #define SP4G_CODEC_EVS_009_6 (0x03) |
| 964 | #define SP4G_CODEC_EVS_013_2 (0x04) |
| 965 | #define SP4G_CODEC_EVS_016_4 (0x05) |
| 966 | #define SP4G_CODEC_EVS_024_4 (0x06) |
| 967 | #define SP4G_CODEC_EVS_032_0 (0x07) |
| 968 | #define SP4G_CODEC_EVS_048_0 (0x08) |
| 969 | #define SP4G_CODEC_EVS_064_0 (0x09) |
| 970 | #define SP4G_CODEC_EVS_096_0 (0x0A) |
| 971 | #define SP4G_CODEC_EVS_128_0 (0x0B) |
| 972 | #define SP4G_CODEC_EVS_002_4_SID (0x0C) |
| 973 | #define SP4G_CODEC_EVS_000_0_REV (0x0D) |
| 974 | #define SP4G_CODEC_EVS_000_0_LOST (0x0E) |
| 975 | #define SP4G_CODEC_EVS_000_0_NODATA (0x0F) |
| 976 | |
| 977 | #define SP4G_CODEC_EVS_AWB_RATE_06_60 (0x00) |
| 978 | #define SP4G_CODEC_EVS_AWB_RATE_08_85 (0x01) |
| 979 | #define SP4G_CODEC_EVS_AWB_RATE_12_65 (0x02) |
| 980 | #define SP4G_CODEC_EVS_AWB_RATE_14_25 (0x03) |
| 981 | #define SP4G_CODEC_EVS_AWB_RATE_15_85 (0x04) |
| 982 | #define SP4G_CODEC_EVS_AWB_RATE_18_25 (0x05) |
| 983 | #define SP4G_CODEC_EVS_AWB_RATE_19_85 (0x06) |
| 984 | #define SP4G_CODEC_EVS_AWB_RATE_23_05 (0x07) |
| 985 | #define SP4G_CODEC_EVS_AWB_RATE_23_85 (0x08) |
| 986 | #define SP4G_CODEC_EVS_AWB_RATE_02_00_SID (0x09) |
| 987 | #define SP4G_CODEC_EVS_AWB_RATE_00_00_REV0 (0x0A) |
| 988 | #define SP4G_CODEC_EVS_AWB_RATE_00_00_REV1 (0x0B) |
| 989 | #define SP4G_CODEC_EVS_AWB_RATE_00_00_REV2 (0x0C) |
| 990 | #define SP4G_CODEC_EVS_AWB_RATE_00_00_REV3 (0x0D) |
| 991 | #define SP4G_CODEC_EVS_AWB_RATE_00_00_LOST (0x0E) |
| 992 | #define SP4G_CODEC_EVS_AWB_RATE_00_00_NODATA (0x0F) |
| 993 | |
| 994 | typedef enum{ |
| 995 | SP4G_CODEC_AMR_4_75=0x00, |
| 996 | SP4G_CODEC_AMR_5_15, |
| 997 | SP4G_CODEC_AMR_5_9, |
| 998 | SP4G_CODEC_AMR_6_7, |
| 999 | SP4G_CODEC_AMR_7_4, |
| 1000 | SP4G_CODEC_AMR_7_95, |
| 1001 | SP4G_CODEC_AMR_10_2, |
| 1002 | SP4G_CODEC_AMR_12_2, |
| 1003 | SP4G_CODEC_AMR_SID, |
| 1004 | SP4G_CODEC_AMR_NO_DATA=0xF, |
| 1005 | SP4G_CODEC_WBAMR_6_6=0x10, |
| 1006 | SP4G_CODEC_WBAMR_8_85, |
| 1007 | SP4G_CODEC_WBAMR_12_65, |
| 1008 | SP4G_CODEC_WBAMR_14_25, |
| 1009 | SP4G_CODEC_WBAMR_15_85, |
| 1010 | SP4G_CODEC_WBAMR_18_25, |
| 1011 | SP4G_CODEC_WBAMR_19_85, |
| 1012 | SP4G_CODEC_WBAMR_23_05, |
| 1013 | SP4G_CODEC_WBAMR_23_85, |
| 1014 | SP4G_CODEC_WBAMR_SID, |
| 1015 | SP4G_CODEC_LOST_FRAME, |
| 1016 | SP4G_CODEC_G711=0x60, |
| 1017 | SP4G_CODEC_G722, |
| 1018 | SP4G_CODEC_G723_1, |
| 1019 | SP4G_CODEC_G726, |
| 1020 | SP4G_CODEC_G729, |
| 1021 | |
| 1022 | //bit[7:6]=10: EVS |
| 1023 | //bit[7:6]=11: EVS AMR-WB |
| 1024 | //bit[5:4]=00: 08k sample rate, NB |
| 1025 | //bit[5:4]=01: 16k sample rate, WB |
| 1026 | //bit[5:4]=10: 32k sample rate, SWB |
| 1027 | //bit[5:4]=11: 48k sample rate, FB |
| 1028 | //bit[3:0]: bit rate from low to high |
| 1029 | SP4G_CODEC_EVS_08K_005_9 =0x80, |
| 1030 | SP4G_CODEC_EVS_08K_002_8 =0x80, |
| 1031 | SP4G_CODEC_EVS_08K_007_2 =0x81, |
| 1032 | SP4G_CODEC_EVS_08K_008_0 =0x82, |
| 1033 | SP4G_CODEC_EVS_08K_009_6 =0x83, |
| 1034 | SP4G_CODEC_EVS_08K_013_2 =0x84, |
| 1035 | SP4G_CODEC_EVS_08K_016_4 =0x85, |
| 1036 | SP4G_CODEC_EVS_08K_024_4 =0x86, |
| 1037 | SP4G_CODEC_EVS_08K_032_0 =0x87, |
| 1038 | SP4G_CODEC_EVS_08K_048_0 =0x88, |
| 1039 | SP4G_CODEC_EVS_08K_064_0 =0x89, |
| 1040 | SP4G_CODEC_EVS_08K_096_0 =0x8A, |
| 1041 | SP4G_CODEC_EVS_08K_128_0 =0x8B, |
| 1042 | SP4G_CODEC_EVS_08K_002_4_SID =0x8C, |
| 1043 | SP4G_CODEC_EVS_08K_000_0_REV =0x8D, |
| 1044 | SP4G_CODEC_EVS_08K_000_0_LOST =0x8E, |
| 1045 | SP4G_CODEC_EVS_08K_000_0_NODATA=0x8F, |
| 1046 | |
| 1047 | SP4G_CODEC_EVS_16K_005_9 =0x90, |
| 1048 | SP4G_CODEC_EVS_16K_002_8 =0x90, |
| 1049 | SP4G_CODEC_EVS_16K_007_2 =0x91, |
| 1050 | SP4G_CODEC_EVS_16K_008_0 =0x92, |
| 1051 | SP4G_CODEC_EVS_16K_009_6 =0x93, |
| 1052 | SP4G_CODEC_EVS_16K_013_2 =0x94, |
| 1053 | SP4G_CODEC_EVS_16K_016_4 =0x95, |
| 1054 | SP4G_CODEC_EVS_16K_024_4 =0x96, |
| 1055 | SP4G_CODEC_EVS_16K_032_0 =0x97, |
| 1056 | SP4G_CODEC_EVS_16K_048_0 =0x98, |
| 1057 | SP4G_CODEC_EVS_16K_064_0 =0x99, |
| 1058 | SP4G_CODEC_EVS_16K_096_0 =0x9A, |
| 1059 | SP4G_CODEC_EVS_16K_128_0 =0x9B, |
| 1060 | SP4G_CODEC_EVS_16K_002_4_SID =0x9C, |
| 1061 | SP4G_CODEC_EVS_16K_000_0_REV =0x9D, |
| 1062 | SP4G_CODEC_EVS_16K_000_0_LOST =0x9E, |
| 1063 | SP4G_CODEC_EVS_16K_000_0_NODATA=0x9F, |
| 1064 | |
| 1065 | SP4G_CODEC_EVS_32K_005_9 =0xA0, |
| 1066 | SP4G_CODEC_EVS_32K_002_8 =0xA0, |
| 1067 | SP4G_CODEC_EVS_32K_007_2 =0xA1, |
| 1068 | SP4G_CODEC_EVS_32K_008_0 =0xA2, |
| 1069 | SP4G_CODEC_EVS_32K_009_6 =0xA3, |
| 1070 | SP4G_CODEC_EVS_32K_013_2 =0xA4, |
| 1071 | SP4G_CODEC_EVS_32K_016_4 =0xA5, |
| 1072 | SP4G_CODEC_EVS_32K_024_4 =0xA6, |
| 1073 | SP4G_CODEC_EVS_32K_032_0 =0xA7, |
| 1074 | SP4G_CODEC_EVS_32K_048_0 =0xA8, |
| 1075 | SP4G_CODEC_EVS_32K_064_0 =0xA9, |
| 1076 | SP4G_CODEC_EVS_32K_096_0 =0xAA, |
| 1077 | SP4G_CODEC_EVS_32K_128_0 =0xAB, |
| 1078 | SP4G_CODEC_EVS_32K_002_4_SID =0xAC, |
| 1079 | SP4G_CODEC_EVS_32K_000_0_REV =0xAD, |
| 1080 | SP4G_CODEC_EVS_32K_000_0_LOST =0xAE, |
| 1081 | SP4G_CODEC_EVS_32K_000_0_NODATA=0xAF, |
| 1082 | |
| 1083 | SP4G_CODEC_EVS_48K_005_9 =0xB0, |
| 1084 | SP4G_CODEC_EVS_48K_002_8 =0xB0, |
| 1085 | SP4G_CODEC_EVS_48K_007_2 =0xB1, |
| 1086 | SP4G_CODEC_EVS_48K_008_0 =0xB2, |
| 1087 | SP4G_CODEC_EVS_48K_009_6 =0xB3, |
| 1088 | SP4G_CODEC_EVS_48K_013_2 =0xB4, |
| 1089 | SP4G_CODEC_EVS_48K_016_4 =0xB5, |
| 1090 | SP4G_CODEC_EVS_48K_024_4 =0xB6, |
| 1091 | SP4G_CODEC_EVS_48K_032_0 =0xB7, |
| 1092 | SP4G_CODEC_EVS_48K_048_0 =0xB8, |
| 1093 | SP4G_CODEC_EVS_48K_064_0 =0xB9, |
| 1094 | SP4G_CODEC_EVS_48K_096_0 =0xBA, |
| 1095 | SP4G_CODEC_EVS_48K_128_0 =0xBB, |
| 1096 | SP4G_CODEC_EVS_48K_002_4_SID =0xBC, |
| 1097 | SP4G_CODEC_EVS_48K_000_0_REV =0xBD, |
| 1098 | SP4G_CODEC_EVS_48K_000_0_LOST =0xBE, |
| 1099 | SP4G_CODEC_EVS_48K_000_0_NODATA=0xBF, |
| 1100 | |
| 1101 | SP4G_CODEC_EVS_AWB_06_60 =0xD0, |
| 1102 | SP4G_CODEC_EVS_AWB_08_85 =0xD1, |
| 1103 | SP4G_CODEC_EVS_AWB_12_65 =0xD2, |
| 1104 | SP4G_CODEC_EVS_AWB_14_25 =0xD3, |
| 1105 | SP4G_CODEC_EVS_AWB_15_85 =0xD4, |
| 1106 | SP4G_CODEC_EVS_AWB_18_25 =0xD5, |
| 1107 | SP4G_CODEC_EVS_AWB_19_85 =0xD6, |
| 1108 | SP4G_CODEC_EVS_AWB_23_05 =0xD7, |
| 1109 | SP4G_CODEC_EVS_AWB_23_85 =0xD8, |
| 1110 | SP4G_CODEC_EVS_AWB_02_00_SID =0xD9, |
| 1111 | SP4G_CODEC_EVS_AWB_00_00_REV0 =0xDA, |
| 1112 | SP4G_CODEC_EVS_AWB_00_00_REV1 =0xDB, |
| 1113 | SP4G_CODEC_EVS_AWB_00_00_REV2 =0xDC, |
| 1114 | SP4G_CODEC_EVS_AWB_00_00_REV3 =0xDD, |
| 1115 | SP4G_CODEC_EVS_AWB_00_00_LOST =0xDE, |
| 1116 | SP4G_CODEC_EVS_AWB_00_00_NODATA=0xDF, |
| 1117 | |
| 1118 | SP4G_CODEC_NONE =0xFF, |
| 1119 | }SP4G_Codec; |
| 1120 | |
| 1121 | typedef enum{ |
| 1122 | SP4G_CODEC_EVS_AWB_SID_TYPE_FIRST = 0x00, |
| 1123 | SP4G_CODEC_EVS_AWB_SID_TYPE_UPDATE = 0x01, |
| 1124 | SP4G_CODEC_EVS_AWB_SID_TYPE_NONSID = 0x02 |
| 1125 | }SP4G_CODEC_EVS_AWB_SID_TYPE; |
| 1126 | |
| 1127 | |
| 1128 | /*==================== |
| 1129 | JBM 2.0 - start |
| 1130 | =====================*/ |
| 1131 | #define JBM_TS_RESERVE (16) |
| 1132 | |
| 1133 | typedef enum |
| 1134 | { |
| 1135 | JBM_NODATA_NORMAL = 0, |
| 1136 | JBM_NODATA_JBM_DROP, |
| 1137 | JBM_NODATA_JBM_QUEUE, |
| 1138 | JBM_NODATA_BUF_EMPTY, |
| 1139 | JBM_NODATA_PKT_LOSS, |
| 1140 | JBM_NODATA_DSP_REMAIN |
| 1141 | } JBM_NODATA_TYPE; |
| 1142 | |
| 1143 | typedef struct VoLTE_JBM_TS_Info_Struct |
| 1144 | { |
| 1145 | kal_uint8 TS_Switch; |
| 1146 | kal_uint8 TS_HB_Frm_Num; |
| 1147 | kal_uint8 TS_Frm_ID; |
| 1148 | kal_uint8 TS_isRemainFrame; |
| 1149 | kal_int16 TS_Scale; |
| 1150 | kal_int16 TS_Max_Scale; |
| 1151 | kal_uint8 TS_JBM_Reset_Flag; |
| 1152 | kal_uint8 TS_DSP_Reset_Flag; |
| 1153 | kal_int16 TS_Remain_Length_ms; |
| 1154 | kal_int16 TS_Total_Length_ms; |
| 1155 | kal_int16 TS_Reserve[JBM_TS_RESERVE]; |
| 1156 | JBM_NODATA_TYPE Nodata_Type; |
| 1157 | } VoLTE_JBM_TS_Info_t; |
| 1158 | #if 0 |
| 1159 | /* under construction !*/ |
| 1160 | /* under construction !*/ |
| 1161 | /* under construction !*/ |
| 1162 | /* under construction !*/ |
| 1163 | /* under construction !*/ |
| 1164 | /* under construction !*/ |
| 1165 | /* under construction !*/ |
| 1166 | /* under construction !*/ |
| 1167 | /* under construction !*/ |
| 1168 | /* under construction !*/ |
| 1169 | /* under construction !*/ |
| 1170 | /* under construction !*/ |
| 1171 | /* under construction !*/ |
| 1172 | /* under construction !*/ |
| 1173 | /* under construction !*/ |
| 1174 | /* under construction !*/ |
| 1175 | /* under construction !*/ |
| 1176 | /* under construction !*/ |
| 1177 | /* under construction !*/ |
| 1178 | /* under construction !*/ |
| 1179 | /* under construction !*/ |
| 1180 | /* under construction !*/ |
| 1181 | #endif //#if 0 |
| 1182 | /*==================== |
| 1183 | JBM 2.0 - end |
| 1184 | =====================*/ |
| 1185 | typedef struct { |
| 1186 | LOCAL_PARA_HDR |
| 1187 | VoLTE_JBM_TS_Info_t JBM_info; |
| 1188 | }ilm_SP4G_PSR_DL_INFO_t; |
| 1189 | |
| 1190 | typedef enum{ |
| 1191 | SP4G_PSR_CallType_VoLTE = 0x00, |
| 1192 | SP4G_PSR_CallType_ViLTE = 0x01, |
| 1193 | SP4G_PSR_CallType_VoWiFi = 0x02, |
| 1194 | SP4G_PSR_CallType_ViWiFi = 0x03, |
| 1195 | SP4G_PSR_CallType_None = 0xFF, |
| 1196 | }SP4G_PSR_CallType; |
| 1197 | void SP4G_PSR_SetCallType(SP4G_PSR_CallType type); |
| 1198 | SP4G_PSR_CallType SP4G_PSR_GetCallType(void); |
| 1199 | |
| 1200 | |
| 1201 | void SP4G_PSR_UL_AMR_GetSpeechFrame(SP4G_Codec *frame_type, kal_uint8 *encodebits, kal_uint8 *bitlen, VoLTE_JBM_TS_Info_t *JBM_info); |
| 1202 | void SP4G_PSR_DL_AMR_PutSpeechFrame(kal_uint32 CFN, SP4G_PSR_Codec codec, SP4G_Codec frame_type, kal_bool crc_status, kal_uint8 *encodebits, VoLTE_JBM_TS_Info_t *JBM_info); |
| 1203 | void SP4G_PSR_UL_GSeries_GetSpeechFrame(SP4G_Codec *codec, kal_uint8 *encodebits, kal_uint8 *bitlen); |
| 1204 | void SP4G_PSR_DL_GSeries_PutSpeechFrame(SP4G_Codec codec, kal_uint8 *encodebits, kal_uint8 *bitlen); |
| 1205 | int SP4G_PSR_UL_GSeries_IsMoreData(void); |
| 1206 | |
| 1207 | void SP4G_PSR_UL_SetFrameType(SP4G_Codec codec); |
| 1208 | |
| 1209 | kal_uint32 SP4G_PSR_Link_Est( SP4G_Codec default_speech_codec ); |
| 1210 | void SP4G_PSR_Link_Deest(kal_uint32 id); |
| 1211 | |
| 1212 | kal_uint16 SP4G_PSR_GetCodecBitLength(SP4G_Codec codec); |
| 1213 | |
| 1214 | kal_uint32 SP4G_JBM_GetDLVADFlag(void); |
| 1215 | |
| 1216 | /* law: |
| 1217 | 1: G711_ALAW |
| 1218 | 2: G711_ULAW |
| 1219 | dec_init_CNG_enable: |
| 1220 | 0: disable (default) |
| 1221 | 1: enable */ |
| 1222 | void SP4G_Set_G711Parameters(kal_int32 law, kal_int32 dec_init_CNG_enable); |
| 1223 | |
| 1224 | /*====================start of PCM2WAY interface =====================*/ |
| 1225 | |
| 1226 | |
| 1227 | void PCM2WAY_Start(void (*pcm2way_hdlr)(void), kal_uint32 type); //@type please refer to P2W_App_Type |
| 1228 | void PCM2WAY_Stop(kal_uint32 type); |
| 1229 | |
| 1230 | // void PCM2Way_SetFormat(kal_uint32 format); |
| 1231 | |
| 1232 | kal_uint16 PCM2WAY_GetFromMic(kal_uint16 *ul_buf); |
| 1233 | kal_uint16 PCM2WAY_PutToSpk(const kal_uint16 *dl_data); |
| 1234 | kal_uint16 PCM2WAY_FillSpk(kal_uint16 value); |
| 1235 | // void PCM2WAY_QueryBufSize(P2W_Format format, kal_uint32 *mic_bufsize, kal_uint32 *spk_bufsize); |
| 1236 | /*====================end of PCM2WAY interface =====================*/ |
| 1237 | |
| 1238 | /* ------------------------------------------------------------------------- */ |
| 1239 | |
| 1240 | |
| 1241 | /*====================start of AFE =====================*/ |
| 1242 | |
| 1243 | void L1SP_SetOutputGainControl(kal_uint32 vol); |
| 1244 | void l1audio_consoleDVT(kal_char *string); |
| 1245 | |
| 1246 | /*====================end of AFE =====================*/ |
| 1247 | |
| 1248 | /* ------------------------------------------------------------------------- */ |
| 1249 | |
| 1250 | void SP_Strm_Audl_Handler( ilm_struct *ilm_ptr ); |
| 1251 | void SpcIO_Msg_Handler_inAudL(ilm_struct *ilm_ptr); |
| 1252 | kal_bool SP_Drv_Init_Bootup(void); |
| 1253 | kal_bool SP_Drv_Init_Task(void); |
| 1254 | |
| 1255 | /*====================start of EPOF =====================*/ |
| 1256 | typedef enum{ |
| 1257 | ENUM_EPOF_DO_FORCEENDALLAPP = 0x0001, |
| 1258 | ENUM_EPOF_MD1_L4C_NOTIFY = 0x0002, |
| 1259 | ENUM_EPOF_C2K_NOTIFY = 0x0004, |
| 1260 | ENUM_EPOF_AP_ACK_NOTIFY = 0x0008, |
| 1261 | }enum_EPOF_event; |
| 1262 | kal_uint16 get_spcGetEpofTimes(enum_EPOF_event EPOF_event); |
| 1263 | void set_spcGetEpofTimes(enum_EPOF_event EPOF_event, int on); |
| 1264 | /*====================end of EPOF =====================*/ |
| 1265 | |
| 1266 | |
| 1267 | |
| 1268 | /*====================Start of EVS codec =====================*/ |
| 1269 | typedef enum{ |
| 1270 | FRAMEMODE_NORMAL = 0x0, /**< frame available */ |
| 1271 | FRAMEMODE_MISSING = 0x1, /**< frame missing => conceal */ |
| 1272 | FRAMEMODE_FUTURE = 0x2, |
| 1273 | }frameMode_fx; |
| 1274 | |
| 1275 | typedef struct { |
| 1276 | kal_int32 enable; |
| 1277 | kal_int32 rf_fec_indicator; // 0: Low(frame error rate < 5%). 1: High(frame error rate > 5%) |
| 1278 | kal_int32 rf_fec_offset; |
| 1279 | kal_int32 rev3; |
| 1280 | kal_int32 rev4; |
| 1281 | kal_int32 rev5; |
| 1282 | } EVS_ENC_CA_PARAMETER; |
| 1283 | |
| 1284 | typedef struct { |
| 1285 | frameMode_fx FrameMode; |
| 1286 | kal_int32 rev1; |
| 1287 | kal_int32 rev2; |
| 1288 | kal_int32 rev3; |
| 1289 | kal_int32 rev4; |
| 1290 | kal_int32 rev5; |
| 1291 | } EVS_DEC_CA_PARAMETER; |
| 1292 | |
| 1293 | typedef struct { |
| 1294 | SP4G_Codec codec; |
| 1295 | kal_int32 DTX; |
| 1296 | kal_int32 EVS_network_request_bw; |
| 1297 | kal_int32 EVS_capability_bw; |
| 1298 | kal_int32 EVS_PCM_bw; |
| 1299 | EVS_ENC_CA_PARAMETER EVS_CA_Par; |
| 1300 | } EVS_ENCODER_PARAMETER; |
| 1301 | |
| 1302 | |
| 1303 | typedef struct { |
| 1304 | SP4G_Codec codec; |
| 1305 | kal_int32 EVS_network_request_bw; |
| 1306 | kal_int32 EVS_capability_bw; |
| 1307 | kal_int32 EVS_PCM_bw; |
| 1308 | kal_int32 EVS_HBLen; |
| 1309 | kal_int32 EVS_BFI; |
| 1310 | EVS_DEC_CA_PARAMETER EVS_CA_Par; |
| 1311 | } EVS_DECODER_PARAMETER; |
| 1312 | |
| 1313 | #define GET_SP4G_CODEC_ENUM_NON_EVS_ID(SP4GCodecEnum) ((SP4GCodecEnum)&SP4G_CODEC_NON_EVS_ID_MASK) |
| 1314 | |
| 1315 | #define GET_SP4G_CODEC_ENUM_EVS_ID(SP4GCodecEnum) ((SP4GCodecEnum)&SP4G_CODEC_EVS_ID_MASK) |
| 1316 | #define GET_SP4G_CODEC_ENUM_EVS_BW(SP4GCodecEnum) ((SP4GCodecEnum)&SP4G_CODEC_EVS_SAMPLE_RATE_MASK) |
| 1317 | #define GET_SP4G_CODEC_ENUM_EVS_RATE(SP4GCodecEnum) ((SP4GCodecEnum)&SP4G_CODEC_EVS_CODEC_RATE_MASK) |
| 1318 | |
| 1319 | #define SET_SP4G_CODEC_ENUM_EVS_ID(SP4GCodecEnum, newID) ( ((SP4GCodecEnum)&(~SP4G_CODEC_EVS_ID_MASK)) | (newID) ) |
| 1320 | #define SET_SP4G_CODEC_ENUM_EVS_BW(SP4GCodecEnum, newBW) ( ((SP4GCodecEnum)&(~SP4G_CODEC_EVS_SAMPLE_RATE_MASK)) | (newBW) ) |
| 1321 | #define SET_SP4G_CODEC_ENUM_EVS_RATE(SP4GCodecEnum, newRATE) ( ((SP4GCodecEnum)&(~SP4G_CODEC_EVS_CODEC_RATE_MASK)) | (newRATE) ) |
| 1322 | |
| 1323 | #define GET_IS_SP4G_CODEC_ENUM_EVS_PRIMARY_ID(SP4GCodecEnum) (GET_SP4G_CODEC_ENUM_EVS_ID(SP4GCodecEnum)==SP4G_CODEC_EVS_ID) |
| 1324 | #define GET_IS_SP4G_CODEC_ENUM_EVS_AMRIO_ID(SP4GCodecEnum) (GET_SP4G_CODEC_ENUM_EVS_ID(SP4GCodecEnum)==SP4G_CODEC_EVS_AWB_ID) |
| 1325 | #define GET_IS_SP4G_CODEC_ENUM_EVS_ID(SP4GCodecEnum) ( GET_IS_SP4G_CODEC_ENUM_EVS_PRIMARY_ID(SP4GCodecEnum) || GET_IS_SP4G_CODEC_ENUM_EVS_AMRIO_ID(SP4GCodecEnum) ) |
| 1326 | |
| 1327 | #define GET_IS_SP4G_CODEC_ENUM_AMR_ID(SP4GCodecEnum) ( GET_SP4G_CODEC_ENUM_NON_EVS_ID(SP4GCodecEnum)==SP4G_CODEC_AMR_ID ) |
| 1328 | #define GET_IS_SP4G_CODEC_ENUM_AMR_WB_ID(SP4GCodecEnum) ( GET_SP4G_CODEC_ENUM_NON_EVS_ID(SP4GCodecEnum)==SP4G_CODEC_AMR_WB_ID ) |
| 1329 | #define GET_IS_SP4G_CODEC_ENUM_AMR_WB_LOST_FRAME_ID(SP4GCodecEnum) ( GET_SP4G_CODEC_ENUM_NON_EVS_ID(SP4GCodecEnum)==SP4G_CODEC_AMR_WB_LOST_FRAME_ID ) |
| 1330 | #define GET_IS_SP4G_CODEC_ENUM_AMR_NO_DATA_ID(SP4GCodecEnum) ( SP4GCodecEnum==SP4G_CODEC_AMR_NO_DATA ) |
| 1331 | #define GET_IS_SP4G_CODEC_ENUM_GSERIES_ID(SP4GCodecEnum) ( GET_SP4G_CODEC_ENUM_NON_EVS_ID(SP4GCodecEnum)==SP4G_CODEC_GSERISE_ID ) |
| 1332 | |
| 1333 | #define GET_SP4G_CODEC_ENUM_EVS_BW_to_SAL(SP4GCodecEnum) (((SP4GCodecEnum)&SP4G_CODEC_EVS_SAMPLE_RATE_MASK)>>4) |
| 1334 | #define GET_SP4G_CODEC_ENUM_EVS_BW_from_SAL(SAL_BW) ((SAL_BW<<4)&SP4G_CODEC_EVS_SAMPLE_RATE_MASK) |
| 1335 | |
| 1336 | void SP4G_PSR_SetEVSEncCAPara(EVS_ENC_CA_PARAMETER *pEVS_CA_Par); |
| 1337 | kal_bool SP4G_PSR_GetEVSDecCAPara(kal_uint8* CA_RF_Flag, kal_uint8* CA_RF_Offset, SP4G_Codec codec, kal_uint8* frame_pt, kal_uint8 offset); |
| 1338 | kal_uint32 SP4G_Get_Bit_Value(kal_uint8* frame_pt, kal_uint32 offset, kal_uint8 size); |
| 1339 | void SP4G_PSR_UL_EVS_GetSpeechFrame(SP4G_Codec *frame_type, kal_uint8 *encodebits, kal_uint32 *bitlen, VoLTE_JBM_TS_Info_t *JBM_info); |
| 1340 | void SP4G_PSR_DL_EVS_PutSpeechFrame(kal_uint32 CFN, SP4G_Codec frame_type, kal_uint8 *encodebits, EVS_DEC_CA_PARAMETER *pEVS_Dec_CA_Par, kal_bool crc_status, VoLTE_JBM_TS_Info_t *JBM_info); |
| 1341 | kal_bool convert_EVSHeaderFullCMR_to_SP4GCodecEnum(kal_uint8 CMR_value, SP4G_Codec *pSP4G_Codec, EVS_ENC_CA_PARAMETER *pEVS_ENC_CA_PARAMETER); |
| 1342 | kal_bool convert_EVSHeaderFullTOC_to_SP4GCodecEnum(kal_uint8 TOC_value, kal_uint8 EVS_band, SP4G_Codec *pSP4G_Codec); |
| 1343 | kal_bool convert_EVSCompactFormatCMR_to_SP4GCodecEnum(kal_uint8 CMR_value, SP4G_Codec *pSP4G_Codec); |
| 1344 | |
| 1345 | /*====================End of EVS codec =====================*/ |
| 1346 | |
| 1347 | void SP_L2P_Handler(ilm_struct *ilm_ptr); |
| 1348 | void spc_setLoopback_dl_ul(kal_bool enable); |
| 1349 | |
| 1350 | /*===================start of 4G TTY =====================*/ |
| 1351 | kal_uint8 TTY_LTE_PSR_UL_Get(void); |
| 1352 | kal_uint16 TTY_LTE_PSR_UL_Queue_Size(void); |
| 1353 | |
| 1354 | void TTY_LTE_PSR_DL_Put(kal_uint8 tty_char); |
| 1355 | kal_uint16 TTY_LTE_PSR_DL_Queue_Size(void); |
| 1356 | void TTY_LTE_PSR_UL_Queue_Init(); |
| 1357 | void TTY_LTE_PSR_DL_Queue_Init(); |
| 1358 | void SP_L4C_SetERTTSTR(kal_uint8 call_id, kal_uint8 string[256], kal_uint16 length); |
| 1359 | void TTY_LTE_PSR_DL_PutString(kal_uint8 call_id, kal_uint8 string[256], kal_uint16 length); |
| 1360 | kal_uint16 TTY_LTE_PSR_UL_GetString(kal_uint8 call_id, kal_uint8 *buf, kal_uint16 *length); |
| 1361 | kal_uint16 TTY_LTE_PSR_UL_GetChar(kal_uint8 call_id, kal_uint8 *buf); |
| 1362 | |
| 1363 | |
| 1364 | typedef struct { |
| 1365 | LOCAL_PARA_HDR |
| 1366 | kal_uint8 call_id; |
| 1367 | kal_uint8 string[256]; |
| 1368 | kal_uint16 length; |
| 1369 | } ilm_L4C_ERTT_STRING_t; |
| 1370 | |
| 1371 | /*====================end of 4G TTY ======================*/ |
| 1372 | /*===================start of sp_4g_opt =====================*/ |
| 1373 | kal_int32 SP4G_PSR_getToneDeteResult(void); |
| 1374 | kal_int32 SP4G_PSR_getEarPhone(void); |
| 1375 | /*====================end of sp_4g_opt ======================*/ |
| 1376 | |
| 1377 | |
| 1378 | typedef enum{ |
| 1379 | SP_PS_RADIO_TYPE_UNKNOWN = 0x00, |
| 1380 | SP_PS_RADIO_TYPE_LTE = 0x01, |
| 1381 | SP_PS_RADIO_TYPE_NR = 0x02, |
| 1382 | SP_PS_RADIO_TYPE_WIFI = 0x04, |
| 1383 | } SP_PS_RADIO_TYPE; |
| 1384 | |
| 1385 | |
| 1386 | #if defined(ATEST_ENABLE) |
| 1387 | #define SP_SetUSIP_MPU_Info() |
| 1388 | #else |
| 1389 | void SP_SetUSIP_MPU_Info(void); |
| 1390 | #endif // #if defined(ATEST_ENABLE) |
| 1391 | #endif |
| 1392 | |
| 1393 | // ============================================================================ |
| 1394 | // EM related |
| 1395 | // ============================================================================ |
| 1396 | |
| 1397 | void SP_setEmCodecNotifyOff(kal_bool isOff); |
| 1398 | void SP_setEmVoiceQualityEvent(kal_bool isOn); |
| 1399 | |
| 1400 | // ============================================================================ |
| 1401 | |