xref: /utopia/UTPA2-700.0.x/modules/audio/api/audio/apiAUDIO_v2.c (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1 //<MStar Software>
2 //******************************************************************************
3 // MStar Software
4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved.
5 // All software, firmware and related documentation herein ("MStar Software") are
6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by
7 // law, including, but not limited to, copyright law and international treaties.
8 // Any use, modification, reproduction, retransmission, or republication of all
9 // or part of MStar Software is expressly prohibited, unless prior written
10 // permission has been granted by MStar.
11 //
12 // By accessing, browsing and/or using MStar Software, you acknowledge that you
13 // have read, understood, and agree, to be bound by below terms ("Terms") and to
14 // comply with all applicable laws and regulations:
15 //
16 // 1. MStar shall retain any and all right, ownership and interest to MStar
17 //    Software and any modification/derivatives thereof.
18 //    No right, ownership, or interest to MStar Software and any
19 //    modification/derivatives thereof is transferred to you under Terms.
20 //
21 // 2. You understand that MStar Software might include, incorporate or be
22 //    supplied together with third party`s software and the use of MStar
23 //    Software may require additional licenses from third parties.
24 //    Therefore, you hereby agree it is your sole responsibility to separately
25 //    obtain any and all third party right and license necessary for your use of
26 //    such third party`s software.
27 //
28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as
29 //    MStar`s confidential information and you agree to keep MStar`s
30 //    confidential information in strictest confidence and not disclose to any
31 //    third party.
32 //
33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any
34 //    kind. Any warranties are hereby expressly disclaimed by MStar, including
35 //    without limitation, any warranties of merchantability, non-infringement of
36 //    intellectual property rights, fitness for a particular purpose, error free
37 //    and in conformity with any international standard.  You agree to waive any
38 //    claim against MStar for any loss, damage, cost or expense that you may
39 //    incur related to your use of MStar Software.
40 //    In no event shall MStar be liable for any direct, indirect, incidental or
41 //    consequential damages, including without limitation, lost of profit or
42 //    revenues, lost or damage of data, and unauthorized system use.
43 //    You agree that this Section 4 shall still apply without being affected
44 //    even if MStar Software has been modified by MStar in accordance with your
45 //    request or instruction for your use, except otherwise agreed by both
46 //    parties in writing.
47 //
48 // 5. If requested, MStar may from time to time provide technical supports or
49 //    services in relation with MStar Software to you for your use of
50 //    MStar Software in conjunction with your or your customer`s product
51 //    ("Services").
52 //    You understand and agree that, except otherwise agreed by both parties in
53 //    writing, Services are provided on an "AS IS" basis and the warranty
54 //    disclaimer set forth in Section 4 above shall apply.
55 //
56 // 6. Nothing contained herein shall be construed as by implication, estoppels
57 //    or otherwise:
58 //    (a) conferring any license or right to use MStar name, trademark, service
59 //        mark, symbol or any other identification;
60 //    (b) obligating MStar or any of its affiliates to furnish any person,
61 //        including without limitation, you and your customers, any assistance
62 //        of any kind whatsoever, or any information; or
63 //    (c) conferring any license or right under any intellectual property right.
64 //
65 // 7. These terms shall be governed by and construed in accordance with the laws
66 //    of Taiwan, R.O.C., excluding its conflict of law rules.
67 //    Any and all dispute arising out hereof or related hereto shall be finally
68 //    settled by arbitration referred to the Chinese Arbitration Association,
69 //    Taipei in accordance with the ROC Arbitration Law and the Arbitration
70 //    Rules of the Association by three (3) arbitrators appointed in accordance
71 //    with the said Rules.
72 //    The place of arbitration shall be in Taipei, Taiwan and the language shall
73 //    be English.
74 //    The arbitration award shall be final and binding to both parties.
75 //
76 //******************************************************************************
77 //<MStar Software>
78 ////////////////////////////////////////////////////////////////////////////////
79 //
80 // Copyright (c) 2008-2009 MStar Semiconductor, Inc.
81 // All rights reserved.
82 //
83 // Unless otherwise stipulated in writing, any and all information contained
84 // herein regardless in any format shall remain the sole proprietary of
85 // MStar Semiconductor Inc. and be kept in strict confidence
86 // ("MStar Confidential Information") by the recipient.
87 // Any unauthorized act including without limitation unauthorized disclosure,
88 // copying, use, reproduction, sale, distribution, modification, disassembling,
89 // reverse engineering and compiling of the contents of MStar Confidential
90 // Information is unlawful and strictly prohibited. MStar hereby reserves the
91 // rights to any and all damages, losses, costs and expenses resulting therefrom.
92 //
93 ////////////////////////////////////////////////////////////////////////////////
94 
95 ////////////////////////////////////////////////////////////////////////////////////////////////////
96 ///
97 /// file   apiAUDIO_v2.c
98 /// @brief  Audio 1.0 API wrapper for Audio 2.0
99 /// @author MStar Semiconductor,Inc.
100 ////////////////////////////////////////////////////////////////////////////////////////////////////
101 
102 #include "utopia.h"
103 #include "apiAUDIO_private.h"
104 #include "apiAUDIO_v2.h"
105 #include "drvMBX.h"
106 
107 #include "utopia_dapi.h"
108 //#include "util_symbol.h"
109 #include "MsTypes.h"
110 #include "MsOS.h"
111 #include "MsCommon.h"
112 #include "MsVersion.h"
113 
114 #include "../drv/audio/internal/drvAUDIO_internal.h"
115 
116 #ifdef MSOS_TYPE_LINUX_KERNEL
117 #include <linux/string.h>
118 #include <linux/slab.h>
119 #include <linux/module.h>
120 #else
121 #include <string.h>
122 #include <sys/types.h>
123 #include <unistd.h>
124 #include <stdio.h>
125 #endif
126 //#include <linux/kernel.h>
127 
128 
129 //------------------------------------------------------------------------------
130 // Local Variable
131 //------------------------------------------------------------------------------
132 #ifdef UTOPIA_20
133 static void*                        _pInstantAudio    = NULL;
134 static void*                        _pAttributeAudio  = NULL;
135 #endif
136 
137 //-------------------------------------------------------------------------------------------------
138 //  Extern Variables
139 //-------------------------------------------------------------------------------------------------
140 extern AUDIO_SHARED_VARS2 * g_AudioVars2;
141 
142 //------------------------------------------------------------------------------
143 // Internal implementation
144 //------------------------------------------------------------------------------
145 
146 #ifdef UTOPIA_20
_AUDIO_IOCtrlOpen(void)147 static MS_BOOL _AUDIO_IOCtrlOpen(void)
148 {
149 
150     if(_pInstantAudio == NULL)
151     {
152         #ifdef  AUDIO_UTOPIA2K
153         if(UtopiaOpen(MODULE_AUDIO|KERNEL_MODE, &_pInstantAudio, 0, _pAttributeAudio) !=  UTOPIA_STATUS_SUCCESS)
154         #else
155         if(UtopiaOpen(MODULE_AUDIO, &_pInstantAudio, 0, _pAttributeAudio) !=  UTOPIA_STATUS_SUCCESS)
156         #endif
157         {
158             ULOGE("AUDIO", "[MAPI AUDIO][%06d] Open Audio Lib fail\n", __LINE__);
159             return FALSE;
160         }
161     }
162 
163     return TRUE;
164 }
165 #endif
166 
167 //============================================================
168 // AUDIO_SYSTEM RELATIONAL API FUNCTION
169 //============================================================
170 
MApi_AUDIO_Initialize(void)171 void MApi_AUDIO_Initialize(void)
172 {
173 
174 #ifdef UTOPIA_20
175 
176     if(_AUDIO_IOCtrlOpen() == FALSE)
177     {
178         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Audio Init fail\n", __LINE__);
179         return;
180     }
181 
182     // add for Kdrv MBX export function
183     #if 0//def MSOS_TYPE_LINUX_KERNEL
184     MBX_CPU_ID eHKCPU;
185     MS_U32 u32TimeoutMillSecs = 10000;
186     eHKCPU = E_MBX_CPU_MIPS;
187     if ( E_MBX_SUCCESS != MApi_MBX_Init(eHKCPU, E_MBX_ROLE_HK, u32TimeoutMillSecs))
188     {
189         return FALSE;
190     }
191     MApi_MBX_Enable(TRUE);
192     #endif
193 
194     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Initialize, 0) != UTOPIA_STATUS_SUCCESS)
195     {
196         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Audio Init fail\n", __LINE__);
197         return;
198     }
199 
200     return;
201 
202 #else
203 
204     return _MApi_AUDIO_Initialize();
205 
206 #endif
207 }
208 
209 
MApi_AUDIO_SetPowerOn(MS_BOOL bFlag)210 void MApi_AUDIO_SetPowerOn(MS_BOOL bFlag)
211 {
212 
213 #ifdef UTOPIA_20
214 
215     MS_U32 u32Param = ((MS_U32)bFlag);
216 
217     if(_AUDIO_IOCtrlOpen() == FALSE)
218     {
219         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Audio Set Power on  fail\n", __LINE__);
220         return;
221     }
222 
223     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetPowerOn, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
224     {
225         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Audio Set Power on fail\n", __LINE__);
226         return;
227     }
228     return;
229 
230 #else
231 
232     return _MApi_AUDIO_SetPowerOn(bFlag);
233 
234 #endif
235 }
236 
MApi_AUDIO_SetDspBaseAddr(MS_U8 u8Index,MS_U32 u32Bin_Base_Address,MS_U32 u32Mad_Base_Buffer_Adr)237 void MApi_AUDIO_SetDspBaseAddr(MS_U8 u8Index, MS_U32 u32Bin_Base_Address, MS_U32 u32Mad_Base_Buffer_Adr)
238 {
239 
240 #ifdef UTOPIA_20
241     AUDIO_ST_SET_DSPBASEADDR Status;
242     Status.u8Index = u8Index;
243     Status.u32Bin_Base_Address = u32Bin_Base_Address;
244     Status.u32Mad_Base_Buffer_Adr = u32Mad_Base_Buffer_Adr;
245 
246     if(_AUDIO_IOCtrlOpen() == FALSE)
247     {
248         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set DSP Base Address  fail\n", __LINE__);
249         return;
250     }
251 
252     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetDSPBaseAddr, &Status) != UTOPIA_STATUS_SUCCESS)
253     {
254         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set DSP Base Address fail\n", __LINE__);
255         return;
256     }
257     return;
258 
259 #else
260 
261     return _MDrv_AUDIO_SetDspBaseAddr(u8Index, u32Bin_Base_Address, u32Mad_Base_Buffer_Adr);
262 
263 #endif
264 }
265 
MApi_AUDIO_GetDspMadBaseAddr(MS_U8 u8Index)266 MS_U32 MApi_AUDIO_GetDspMadBaseAddr(MS_U8 u8Index)
267 {
268 
269 #ifdef UTOPIA_20
270     AUDIO_ST_GET_DSPBASEADDR Status;
271     Status.u8Index = u8Index;
272     Status.u32Addr = 0;
273 
274     if(_AUDIO_IOCtrlOpen() == FALSE)
275     {
276         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get  DSP Base Address  fail\n", __LINE__);
277         //return;
278     }
279 
280     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetDSPBaseAddr, &Status) != UTOPIA_STATUS_SUCCESS)
281     {
282         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get DSP Base Address fail\n", __LINE__);
283         //return;
284     }
285     return Status.u32Addr;
286 
287 #else
288 
289     return _MDrv_AUDIO_GetDspMadBaseAddr(u8Index);
290 
291 #endif
292 }
293 
MApi_AUDIO_WriteDecMailBox(MS_U8 u8ParamNum,MS_U16 u16Data)294 void MApi_AUDIO_WriteDecMailBox(MS_U8 u8ParamNum, MS_U16 u16Data)
295 {
296 
297 #ifdef UTOPIA_20
298     AUDIO_ST_WRITE_DECMAILBOX Status;
299     Status.u8ParamNum = u8ParamNum;
300     Status.u16Data = u16Data;
301 
302     if(_AUDIO_IOCtrlOpen() == FALSE)
303     {
304         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Write Dec Mail Box  fail\n", __LINE__);
305         return;
306     }
307 
308     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_WriteDecMailBox, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
309     {
310         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Write Dec Mail Box fail\n", __LINE__);
311         return;
312     }
313     return;
314 
315 #else
316 
317     return _MDrv_AUDIO_WriteDecMailBox(u8ParamNum, u16Data);
318 
319 #endif
320 }
321 
MApi_AUDIO_TriggerSifPLL(void)322 void MApi_AUDIO_TriggerSifPLL(void)
323 {
324 
325 #ifdef UTOPIA_20
326 
327     if(_AUDIO_IOCtrlOpen() == FALSE)
328     {
329         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Trigger SIF PLL fail\n", __LINE__);
330         return;
331     }
332 
333     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_TriggerSIFPLL, 0) != UTOPIA_STATUS_SUCCESS)
334     {
335         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Trigger SIF PLL fail\n", __LINE__);
336         return;
337     }
338     return;
339 
340 #else
341 
342     return _MDrv_AUDIO_TriggerSifPLL();
343 
344 #endif
345 }
346 
347 
348 /////*******************  PATCH GROUP  ********************************////
MDrv_AUDIO_SetDspBaseAddr(MS_U8 u8Index,MS_PHY u32Bin_Base_Address,MS_PHY u32Mad_Base_Buffer_Adr)349 void MDrv_AUDIO_SetDspBaseAddr(MS_U8 u8Index, MS_PHY u32Bin_Base_Address, MS_PHY u32Mad_Base_Buffer_Adr)
350 {
351 
352 #ifdef UTOPIA_20
353     AUDIO_ST_SET_DSPBASEADDR Status;
354     Status.u8Index = u8Index;
355     Status.u32Bin_Base_Address = u32Bin_Base_Address;
356     Status.u32Mad_Base_Buffer_Adr = u32Mad_Base_Buffer_Adr;
357 
358     if(_AUDIO_IOCtrlOpen() == FALSE)
359     {
360         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set DSP Base Address  fail\n", __LINE__);
361         return;
362     }
363 
364     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetDSPBaseAddr, &Status) != UTOPIA_STATUS_SUCCESS)
365     {
366         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set DSP Base Address fail\n", __LINE__);
367         return;
368     }
369     return;
370 
371 #else
372 
373     return _MDrv_AUDIO_SetDspBaseAddr(u8Index, u32Bin_Base_Address, u32Mad_Base_Buffer_Adr);
374 
375 #endif
376 }
377 
MDrv_AUDIO_GetDspMadBaseAddr(MS_U8 u8Index)378 MS_PHY MDrv_AUDIO_GetDspMadBaseAddr(MS_U8 u8Index)
379 {
380 
381 #ifdef UTOPIA_20
382     AUDIO_ST_GET_DSPBASEADDR Status;
383     Status.u8Index = u8Index;
384     Status.u32Addr = 0;
385 
386     if(_AUDIO_IOCtrlOpen() == FALSE)
387     {
388         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get  DSP Base Address  fail\n", __LINE__);
389         //return;
390     }
391 
392     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetDSPBaseAddr, &Status) != UTOPIA_STATUS_SUCCESS)
393     {
394         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get DSP Base Address fail\n", __LINE__);
395         //return;
396     }
397     return Status.u32Addr;
398 
399 #else
400 
401     return _MDrv_AUDIO_GetDspMadBaseAddr(u8Index);
402 
403 #endif
404 }
405 
MDrv_AUDIO_WriteDecMailBox(MS_U8 u8ParamNum,MS_U16 u16Data)406 void MDrv_AUDIO_WriteDecMailBox(MS_U8 u8ParamNum, MS_U16 u16Data)
407 {
408 
409 #ifdef UTOPIA_20
410     AUDIO_ST_WRITE_DECMAILBOX Status;
411     Status.u8ParamNum = u8ParamNum;
412     Status.u16Data = u16Data;
413 
414     if(_AUDIO_IOCtrlOpen() == FALSE)
415     {
416         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Write Dec Mail Box  fail\n", __LINE__);
417         return;
418     }
419 
420     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_WriteDecMailBox, &Status) != UTOPIA_STATUS_SUCCESS)
421     {
422         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Write Dec Mail Box fail\n", __LINE__);
423         return;
424     }
425     return;
426 
427 #else
428 
429     return _MDrv_AUDIO_WriteDecMailBox(u8ParamNum, u16Data);
430 
431 #endif
432 }
433 
MDrv_AUDIO_TriggerSifPLL(void)434 void MDrv_AUDIO_TriggerSifPLL(void)
435 {
436 
437 #ifdef UTOPIA_20
438 
439     if(_AUDIO_IOCtrlOpen() == FALSE)
440     {
441         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Trigger SIF PLL fail\n", __LINE__);
442         return;
443     }
444 
445     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_TriggerSIFPLL, 0) != UTOPIA_STATUS_SUCCESS)
446     {
447         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Trigger SIF PLL fail\n", __LINE__);
448         return;
449     }
450     return;
451 
452 #else
453 
454     return _MDrv_AUDIO_TriggerSifPLL();
455 
456 #endif
457 }
458 /////*******************  PATCH GROUP End   **************************////
459 
MApi_Audio_Monitor(void)460 void MApi_Audio_Monitor(void)
461 {
462 
463 #ifdef UTOPIA_20
464 
465     if(_AUDIO_IOCtrlOpen() == FALSE)
466     {
467         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Monitor fail\n", __LINE__);
468         return;
469     }
470 
471     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Monitor, 0) != UTOPIA_STATUS_SUCCESS)
472     {
473         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Monitor fail\n", __LINE__);
474         return;
475     }
476     return;
477 
478 #else
479 
480     return _MApi_Audio_Monitor();
481 
482 #endif
483 }
484 
MApi_AUDIO_SetSystemInfo(AUDIO_INIT_INFO * pau_info)485 void MApi_AUDIO_SetSystemInfo(AUDIO_INIT_INFO *pau_info)
486 {
487 
488 #ifdef UTOPIA_20
489 
490     if(_AUDIO_IOCtrlOpen() == FALSE)
491     {
492         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set System Info fail\n", __LINE__);
493         return;
494     }
495 
496     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetSystemInfo, (void*)pau_info) != UTOPIA_STATUS_SUCCESS)
497     {
498         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set System Info fail\n", __LINE__);
499         return;
500     }
501     return;
502 
503 #else
504 
505     return _MApi_AUDIO_SetSystemInfo(pau_info);
506 
507 #endif
508 }
509 
510 /*void MApi_AUDIO_ASF_Data_To_DDR(MS_BOOL bEnable)
511 {
512 
513 #ifdef UTOPIA_20
514     MS_U32 u32Param = ((MS_U32)bEnable);
515 
516     if(_AUDIO_IOCtrlOpen() == FALSE)
517     {
518         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ASF Data to DDR fail\n", __LINE__);
519         return;
520     }
521 
522     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_ASF_Data_To_DDR, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
523     {
524         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ASF Data to DDR fail\n", __LINE__);
525         return;
526     }
527     return;
528 
529 #else
530 
531     return _MApi_AUDIO_ASF_Data_To_DDR(bEnable);
532 
533 #endif
534 }
535 
536 
537 void MApi_AUDIO_R2_DEBUG_MSG(MS_BOOL bEnable)
538 {
539 
540 #ifdef UTOPIA_20
541     MS_U32 u32Param = ((MS_U32)bEnable);
542 
543     if(_AUDIO_IOCtrlOpen() == FALSE)
544     {
545         ULOGE("AUDIO", "[MAPI AUDIO][%06d] R2 Debug MSG fail\n", __LINE__);
546         return;
547     }
548 
549     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_R2_DEBUG_MSG, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
550     {
551         ULOGE("AUDIO", "[MAPI AUDIO][%06d] R2 Debug MSG fail\n", __LINE__);
552         return;
553     }
554     return;
555 
556 #else
557 
558     return _MApi_AUDIO_R2_DEBUG_MSG(bEnable);
559 
560 #endif
561 }
562 
563 void MApi_AUDIO_R2_DDR_LATENCY_MSG(MS_BOOL bEnable)
564 {
565 
566 #ifdef UTOPIA_20
567     MS_U32 u32Param = ((MS_U32)bEnable);
568 
569     if(_AUDIO_IOCtrlOpen() == FALSE)
570     {
571         ULOGE("AUDIO", "[MAPI AUDIO][%06d] R2 DDR Latency MSG fail\n", __LINE__);
572         return;
573     }
574 
575     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_R2_DDR_LETENCY_MSG, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
576     {
577         ULOGE("AUDIO", "[MAPI AUDIO][%06d] R2 DDR Latency MSG fail\n", __LINE__);
578         return;
579     }
580     return;
581 
582 #else
583 
584     return _MApi_AUDIO_R2_DDR_LATENCY_MSG(bEnable);
585 
586 #endif
587 }*/
588 
MApi_AUDIO_SetOutConnectivity(void)589 void MApi_AUDIO_SetOutConnectivity(void)
590 {
591 
592 #ifdef UTOPIA_20
593 
594     if(_AUDIO_IOCtrlOpen() == FALSE)
595     {
596         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set out connectivity fail\n", __LINE__);
597         return;
598     }
599 
600     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetOutConnectivity, 0) != UTOPIA_STATUS_SUCCESS)
601     {
602         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set out connectivity fail\n", __LINE__);
603         return;
604     }
605     return;
606 
607 #else
608 
609     return _MApi_AUDIO_SetOutConnectivity();
610 
611 #endif
612 }
613 
MApi_AUDIO_SetPathInfo(AUDIO_PATH_INFO * path_info)614 void MApi_AUDIO_SetPathInfo(AUDIO_PATH_INFO *path_info)
615 {
616 
617 #ifdef UTOPIA_20
618 
619     if(_AUDIO_IOCtrlOpen() == FALSE)
620     {
621         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Path Info fail\n", __LINE__);
622         return;
623     }
624 
625     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetPathInfo, (void*)path_info) != UTOPIA_STATUS_SUCCESS)
626     {
627         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Path Info fai\n", __LINE__);
628         return;
629     }
630     return;
631 
632 #else
633 
634     return _MApi_AUDIO_SetPathInfo(path_info);
635 
636 #endif
637 }
638 
MApi_AUDIO_GetPathInfo(AUDIO_PATH_INFO * path_info)639 void MApi_AUDIO_GetPathInfo(AUDIO_PATH_INFO *path_info)
640 {
641 
642 #ifdef UTOPIA_20
643 
644     if(_AUDIO_IOCtrlOpen() == FALSE)
645     {
646         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Path Info fail\n", __LINE__);
647         return;
648     }
649 
650     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetPathInfo, (void*)path_info) != UTOPIA_STATUS_SUCCESS)
651     {
652         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Path Info fai\n", __LINE__);
653         return;
654     }
655     return;
656 
657 #else
658 
659     return _MApi_AUDIO_GetPathInfo(path_info);
660 
661 #endif
662 }
663 
MApi_AUDIO_SetOutputInfo(AUDIO_OUT_INFO * pout_info)664 void MApi_AUDIO_SetOutputInfo(AUDIO_OUT_INFO *pout_info)
665 {
666 
667 #ifdef UTOPIA_20
668 
669     if(_AUDIO_IOCtrlOpen() == FALSE)
670     {
671         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Output Info fail\n", __LINE__);
672         return;
673     }
674 
675     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetOutputInfo, (void*)pout_info) != UTOPIA_STATUS_SUCCESS)
676     {
677         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Output Info fai\n", __LINE__);
678         return;
679     }
680     return;
681 
682 #else
683 
684     return _MApi_AUDIO_SetOutputInfo(pout_info);
685 
686 #endif
687 }
688 
MApi_AUDIO_SetSourceInfo(AUDIO_SOURCE_INFO_TYPE eSourceType)689 void MApi_AUDIO_SetSourceInfo(AUDIO_SOURCE_INFO_TYPE eSourceType)
690 {
691 
692 #ifdef UTOPIA_20
693 
694     MS_U32 u32Param = ((MS_U32)eSourceType);
695 
696     if(_AUDIO_IOCtrlOpen() == FALSE)
697     {
698         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Source Info fail\n", __LINE__);
699         return;
700     }
701 
702     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetSourceInfo, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
703     {
704         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Source Info fai\n", __LINE__);
705         return;
706     }
707     return;
708 
709 #else
710 
711     return _MApi_AUDIO_SetSourceInfo(eSourceType);
712 
713 #endif
714 }
715 
MApi_AUDIO_InputSwitch(AUDIO_INPUT_TYPE enSource,AUDIO_SWITCH_GROUP enGroup)716 void MApi_AUDIO_InputSwitch(AUDIO_INPUT_TYPE enSource, AUDIO_SWITCH_GROUP enGroup)
717 {
718 
719 #ifdef UTOPIA_20
720     AUDIO_ST_INPUTSWITCH Status;
721     Status.eSource = enSource;
722     Status.eGroup = enGroup;
723 
724     if(_AUDIO_IOCtrlOpen() == FALSE)
725     {
726         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Input Switch fail\n", __LINE__);
727         return;
728     }
729 
730     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_InputSwitch, &Status) != UTOPIA_STATUS_SUCCESS)
731     {
732         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Input Switch fail\n", __LINE__);
733         return;
734     }
735     return;
736 
737 #else
738 
739     return _MApi_AUDIO_InputSwitch(enSource, enGroup);
740 
741 #endif
742 }
743 
744 /*void MApi_AUDIO_SetInputScale(int Step)
745 {
746 
747 #ifdef UTOPIA_20
748 
749     MS_U32 u32Param = ((MS_U32)Step);
750 
751     if(_AUDIO_IOCtrlOpen() == FALSE)
752     {
753         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Input Scale fail\n", __LINE__);
754         return;
755     }
756 
757     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Set_Input_Scale, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
758     {
759         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Input Scale fai\n", __LINE__);
760         return;
761     }
762     return;
763 
764 #else
765 
766     return _MApi_AUDIO_SetInputScale(Step);
767 
768 #endif
769 }
770 
771 void MApi_AUDIO_SetScartScale(int Step)
772 {
773 
774 #ifdef UTOPIA_20
775 
776     MS_U32 u32Param = ((MS_U32)Step);
777 
778     if(_AUDIO_IOCtrlOpen() == FALSE)
779     {
780         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Scart Scale fail\n", __LINE__);
781         return;
782     }
783 
784     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Set_Scart_Scale, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
785     {
786         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Scart Scale fai\n", __LINE__);
787         return;
788     }
789     return;
790 
791 #else
792 
793     return _MApi_AUDIO_SetScartScale(Step);
794 
795 #endif
796 }
797 
798 MS_BOOL MApi_AUDIO_Audyssey_VXT_Set_THRESH_LEVEL_TABLE(int *thresh_level_table)
799 {
800 
801 #ifdef UTOPIA_20
802     AUDIO_ST_AUDYSSEY_VXT_SET_THRESH_LEVEL_TABLE Status;
803     Status.bStatus = FALSE;
804     Status.pthresh_level_table = thresh_level_table;
805 
806     if(_AUDIO_IOCtrlOpen() == FALSE)
807     {
808         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Audyssey vxt set thresh level table fail\n", __LINE__);
809         //return;
810     }
811 
812     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_AUDYSSEY_VXT_SET_THRESH_LEVEL_TABLE, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
813     {
814         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Audyssey vxt set thresh level table fail\n", __LINE__);
815         //return;
816     }
817 
818     return Status.bStatus;
819 
820 #else
821 
822     return _MApi_AUDIO_Audyssey_VXT_Set_THRESH_LEVEL_TABLE(thresh_level_table);
823 
824 #endif
825 }
826 
827 void  MApi_AUDIO_SPDIF_SetChannelStatus(SPDIF_CS_MODE_TYPE eType, SPDIF_CS_MODE_VALUE eValue)
828 {
829 
830 
831 #ifdef UTOPIA_20
832     AUDIO_ST_SPDIF_CHANNELSTATUS Status;
833     Status.bSet = TRUE;
834     Status.eType = eType;
835     Status.eValue = eValue;
836     Status.u32Ret = 0;
837 
838     if(_AUDIO_IOCtrlOpen() == FALSE)
839     {
840         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SPDIF Set Channel Status fail\n", __LINE__);
841         //return;
842     }
843 
844     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SPDIF_CHANNELSTATUS, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
845     {
846         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SPDIF Set Channel Status fail\n", __LINE__);
847         //return;
848     }
849 
850     return;
851 
852 #else
853 
854     return _MApi_AUDIO_SPDIF_SetChannelStatus(eType, eValue);
855 
856 #endif
857 }
858 
859 MS_U16  MApi_AUDIO_SPDIF_GetChannelStatus(SPDIF_CS_MODE_TYPE eType)
860 {
861 
862 #ifdef UTOPIA_20
863     AUDIO_ST_SPDIF_CHANNELSTATUS Status;
864     Status.bSet = FALSE;
865     Status.eType = eType;
866     Status.eValue = 0;
867     Status.u32Ret = 0;
868 
869     if(_AUDIO_IOCtrlOpen() == FALSE)
870     {
871         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SPDIF Set Channel Status fail\n", __LINE__);
872         //return;
873     }
874 
875     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SPDIF_CHANNELSTATUS, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
876     {
877         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SPDIF Set Channel Status fail\n", __LINE__);
878         //return;
879     }
880 
881     return Status.u32Ret;
882 
883 #else
884 
885     return _MApi_AUDIO_SPDIF_GetChannelStatus(eType);
886 
887 #endif
888 }*/
889 
890 
MApi_AUDIO_SetDataCaptureSource(AUDIO_DEVICE_TYPE eID,AUDIO_CAPTURE_SOURCE_TYPE eSource)891 MS_BOOL MApi_AUDIO_SetDataCaptureSource(AUDIO_DEVICE_TYPE eID, AUDIO_CAPTURE_SOURCE_TYPE eSource)
892 {
893 
894 #ifdef UTOPIA_20
895     AUDIO_ST_SET_DATACAPTURESOURCE Status;
896     Status.bRet = 0;
897     Status.eID = eID;
898     Status.eSource = eSource;
899 
900     if(_AUDIO_IOCtrlOpen() == FALSE)
901     {
902         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Data Capture Source fail\n", __LINE__);
903         //return;
904     }
905 
906     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetDataCaptureSource, &Status) != UTOPIA_STATUS_SUCCESS)
907     {
908         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Data Capture Source fail\n", __LINE__);
909         //return;
910     }
911 
912     return Status.bRet;
913 
914 #else
915 
916     return _MApi_AUDIO_SetDataCaptureSource(eID, eSource);
917 
918 #endif
919 }
920 
MApi_AUDIO_SetOutputSourceInfo(OUTPUT_SOURCE_INFO * pSourceInfo)921 void MApi_AUDIO_SetOutputSourceInfo(OUTPUT_SOURCE_INFO *pSourceInfo)
922 {
923 
924 #ifdef UTOPIA_20
925     AUDIO_ST_OUTPUT_SOURCE Status;
926     Status.bSet = TRUE;
927     Status.stOutputSourceInfo = pSourceInfo;
928 
929     if(_AUDIO_IOCtrlOpen() == FALSE)
930     {
931         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Output Source Info fail\n", __LINE__);
932         return;
933     }
934 
935     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_OutputSourceInfo, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
936     {
937         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Output Source Info fail\n", __LINE__);
938         return;
939     }
940     return;
941 
942 #else
943 
944     return _MApi_AUDIO_SetOutputSourceInfo(pSourceInfo);
945 
946 #endif
947 }
948 
MApi_AUDIO_GetOutputSourceInfo(OUTPUT_SOURCE_INFO * pSourceInfo)949 void  MApi_AUDIO_GetOutputSourceInfo(OUTPUT_SOURCE_INFO *pSourceInfo)
950 {
951 
952 #ifdef UTOPIA_20
953     AUDIO_ST_OUTPUT_SOURCE Status;
954     Status.bSet = FALSE;
955     Status.stOutputSourceInfo = pSourceInfo;
956 
957     if(_AUDIO_IOCtrlOpen() == FALSE)
958     {
959         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Output Source Info fail\n", __LINE__);
960         return;
961     }
962 
963     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_OutputSourceInfo, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
964     {
965         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Output Source Info fail\n", __LINE__);
966         return;
967     }
968     return;
969 
970 #else
971 
972     return _MApi_AUDIO_GetOutputSourceInfo(pSourceInfo);
973 
974 #endif
975 }
976 
MApi_AUDIO_ReadMailBox(MS_BOOL bDspType,MS_U8 u8ParamNum)977 MS_U16 MApi_AUDIO_ReadMailBox(MS_BOOL bDspType, MS_U8 u8ParamNum)
978 {
979 
980 #ifdef UTOPIA_20
981     AUDIO_ST_READ_MAILBOX Status;
982     Status.u16Ret = 0;
983     Status.bDspType = bDspType;
984     Status.u8ParamNum = u8ParamNum;
985 
986     if(_AUDIO_IOCtrlOpen() == FALSE)
987     {
988         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Read MailBox fail\n", __LINE__);
989         //return;
990     }
991 
992     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_ReadMailBox, &Status) != UTOPIA_STATUS_SUCCESS)
993     {
994         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Read MailBox fail\n", __LINE__);
995         //return;
996     }
997 
998     return Status.u16Ret;
999 
1000 #else
1001 
1002     return _MApi_AUDIO_ReadMailBox(bDspType, u8ParamNum);
1003 
1004 #endif
1005 }
1006 
MApi_AUDIO_WriteMailBox(MS_BOOL bDspType,MS_U8 u8ParamNum,MS_U16 u16Data)1007 void MApi_AUDIO_WriteMailBox(MS_BOOL bDspType, MS_U8 u8ParamNum, MS_U16 u16Data)
1008 {
1009 
1010 #ifdef UTOPIA_20
1011     AUDIO_ST_WRITE_MAILBOX Status;
1012     Status.bDspType = bDspType;
1013     Status.u8ParamNum = u8ParamNum;
1014     Status.u16Data = u16Data;
1015 
1016     if(_AUDIO_IOCtrlOpen() == FALSE)
1017     {
1018         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Write MailBox fail\n", __LINE__);
1019         return;
1020     }
1021 
1022     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_WriteMailBox, &Status) != UTOPIA_STATUS_SUCCESS)
1023     {
1024         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Write MailBox fail\n", __LINE__);
1025         return;
1026     }
1027     return;
1028 
1029 #else
1030 
1031     return _MApi_AUDIO_WriteMailBox(bDspType, u8ParamNum, u16Data);
1032 
1033 #endif
1034 }
1035 
MApi_AUDIO_FwTriggerDSP(MS_U16 u16Cmd)1036 void MApi_AUDIO_FwTriggerDSP(MS_U16 u16Cmd)
1037 {
1038 
1039 #ifdef UTOPIA_20
1040     MS_U32 u32Param = ((MS_U32)u16Cmd);
1041 
1042     if(_AUDIO_IOCtrlOpen() == FALSE)
1043     {
1044         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Fw Trigger DSP fail\n", __LINE__);
1045         return;
1046     }
1047 
1048     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_FwTriggerDSP, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
1049     {
1050         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Fw Trigger DSP fail\n", __LINE__);
1051         return;
1052     }
1053     return;
1054 
1055 #else
1056 
1057     return _MApi_AUDIO_FwTriggerDSP(u16Cmd);
1058 
1059 #endif
1060 }
1061 
MApi_AUDIO_SetFwStatus(MS_BOOL bBootOnDDR)1062 void MApi_AUDIO_SetFwStatus(MS_BOOL bBootOnDDR)
1063 {
1064 
1065 #ifdef UTOPIA_20
1066     MS_U32 u32Param = ((MS_U32)bBootOnDDR);
1067 
1068     if(_AUDIO_IOCtrlOpen() == FALSE)
1069     {
1070         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Fw Status fail\n", __LINE__);
1071         return;
1072     }
1073 
1074     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetFwStatus, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
1075     {
1076         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Fw Status fail\n", __LINE__);
1077         return;
1078     }
1079     return;
1080 
1081 #else
1082 
1083     return _MApi_AUDIO_SetFwStatus(bBootOnDDR);
1084 
1085 #endif
1086 }
1087 
MApi_AUDIO_ExitAudioSystem(void)1088 void MApi_AUDIO_ExitAudioSystem(void)
1089 {
1090 
1091 #ifdef UTOPIA_20
1092 
1093     if(_AUDIO_IOCtrlOpen() == FALSE)
1094     {
1095         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Exit Auido system fail\n", __LINE__);
1096         return;
1097     }
1098 
1099     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_ExitAudioSystem, 0) != UTOPIA_STATUS_SUCCESS)
1100     {
1101         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Exit Auido system fail\n", __LINE__);
1102         return;
1103     }
1104     return;
1105 
1106 #else
1107 
1108     return _MApi_AUDIO_ExitAudioSystem();
1109 
1110 #endif
1111 }
1112 
MApi_AUDIO_RebootDsp(MS_BOOL bDspType)1113 void MApi_AUDIO_RebootDsp(MS_BOOL bDspType)
1114 {
1115 
1116 #ifdef UTOPIA_20
1117     MS_U32 u32Param = ((MS_U32)bDspType);
1118 
1119     if(_AUDIO_IOCtrlOpen() == FALSE)
1120     {
1121         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Reboot DSP fail\n", __LINE__);
1122         return;
1123     }
1124 
1125     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_RebootDSP, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
1126     {
1127         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Reboot DSP fail\n", __LINE__);
1128         return;
1129     }
1130     return;
1131 
1132 #else
1133 
1134     return _MApi_AUDIO_RebootDsp(bDspType);
1135 
1136 #endif
1137 }
1138 
MApi_AUDIO_SendIntrupt(MS_BOOL bDspType,MS_U8 u8Cmd)1139 void MApi_AUDIO_SendIntrupt(MS_BOOL bDspType,MS_U8 u8Cmd)
1140 {
1141 
1142 #ifdef UTOPIA_20
1143     AUDIO_ST_SEND_INTERRUPT Status;
1144     Status.bDspType = bDspType;
1145     Status.u8Cmd = u8Cmd;
1146 
1147     if(_AUDIO_IOCtrlOpen() == FALSE)
1148     {
1149         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Send Intrupt fail\n", __LINE__);
1150         return;
1151     }
1152 
1153     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SendIntrupt, &Status) != UTOPIA_STATUS_SUCCESS)
1154     {
1155         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Send Intrupt fail\n", __LINE__);
1156         return;
1157     }
1158     return;
1159 
1160 #else
1161 
1162     return _MApi_AUDIO_SendIntrupt(bDspType, u8Cmd);
1163 
1164 #endif
1165 }
1166 
MApi_AUDIO_I2S_SetMode(AUDIO_I2S_MODE_TYPE u8Mode,AUDIO_I2S_MODE_VALUE u8Val)1167 void MApi_AUDIO_I2S_SetMode(AUDIO_I2S_MODE_TYPE u8Mode, AUDIO_I2S_MODE_VALUE  u8Val)
1168 {
1169 
1170 #ifdef UTOPIA_20
1171     AUDIO_ST_I2S_SETMODE Status;
1172     Status.eMode = u8Mode;
1173     Status.eVal = u8Val;
1174 
1175     if(_AUDIO_IOCtrlOpen() == FALSE)
1176     {
1177         ULOGE("AUDIO", "[MAPI AUDIO][%06d] I2S SetMode fail\n", __LINE__);
1178         return;
1179     }
1180 
1181     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_I2S_SetMode, &Status) != UTOPIA_STATUS_SUCCESS)
1182     {
1183         ULOGE("AUDIO", "[MAPI AUDIO][%06d] I2S SetMode fail\n", __LINE__);
1184         return;
1185     }
1186     return;
1187 
1188 #else
1189 
1190     return _MApi_AUDIO_I2S_SetMode(u8Mode, u8Val);
1191 
1192 #endif
1193 }
1194 
MApi_AUDIO_WritePreInitTable(void)1195 void MApi_AUDIO_WritePreInitTable(void)
1196 {
1197 
1198 #ifdef UTOPIA_20
1199 
1200     if(_AUDIO_IOCtrlOpen() == FALSE)
1201     {
1202         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Write PreInit Table fail\n", __LINE__);
1203         return;
1204     }
1205 
1206     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_WritePreInitTable, 0) != UTOPIA_STATUS_SUCCESS)
1207     {
1208         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Write PreInit Table fail\n", __LINE__);
1209         return;
1210     }
1211     return;
1212 
1213 #else
1214 
1215     return _MApi_AUDIO_WritePreInitTable();
1216 
1217 #endif
1218 }
1219 
MApi_AUDIO_EnaEarphone_LowPower_Stage(void)1220 void MApi_AUDIO_EnaEarphone_LowPower_Stage(void)
1221 {
1222 
1223 #ifdef UTOPIA_20
1224 
1225     if(_AUDIO_IOCtrlOpen() == FALSE)
1226     {
1227         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable EarPhone LowPower Stage fail\n", __LINE__);
1228         return;
1229     }
1230 
1231     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_EnaEarphone_LowPower_Stage, 0) != UTOPIA_STATUS_SUCCESS)
1232     {
1233         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable EarPhone LowPower Stage fail\n", __LINE__);
1234         return;
1235     }
1236     return;
1237 
1238 #else
1239 
1240     return _MApi_AUDIO_EnaEarphone_LowPower_Stage();
1241 
1242 #endif
1243 }
1244 
MApi_AUDIO_EnaEarphone_HighDriving_Stage(void)1245 void MApi_AUDIO_EnaEarphone_HighDriving_Stage(void)
1246 {
1247 
1248 #ifdef UTOPIA_20
1249 
1250     if(_AUDIO_IOCtrlOpen() == FALSE)
1251     {
1252         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable EarPhone HighDriving Stage fail\n", __LINE__);
1253         return;
1254     }
1255 
1256     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_EnaEarphone_HighDriving_Stage, 0) != UTOPIA_STATUS_SUCCESS)
1257     {
1258         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable EarPhone HighDriving Stage fail\n", __LINE__);
1259         return;
1260     }
1261     return;
1262 
1263 #else
1264 
1265     return _MApi_AUDIO_EnaEarphone_HighDriving_Stage();
1266 
1267 #endif
1268 }
1269 
1270 //=============================================================
1271 // AUDIO_SOUND RELATIONAL API FUNCTION
1272 //=============================================================
MApi_SND_ProcessEnable(Sound_ENABLE_Type Type,MS_BOOL enable)1273 MS_BOOL MApi_SND_ProcessEnable(Sound_ENABLE_Type Type, MS_BOOL enable)
1274 {
1275 
1276 #ifdef UTOPIA_20
1277     AUDIO_ST_SND_PROCESSENABLE Status;
1278     Status.bRet = 0;
1279     Status.eType = Type;
1280     Status.bEnable = enable;
1281 
1282     if(_AUDIO_IOCtrlOpen() == FALSE)
1283     {
1284         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SND Process Enable fail\n", __LINE__);
1285         //return;
1286     }
1287 
1288     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_SND_ProcessEnable, &Status) != UTOPIA_STATUS_SUCCESS)
1289     {
1290         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SND Process Enable fail\n", __LINE__);
1291         //return;
1292     }
1293 
1294     return Status.bRet;
1295 
1296 #else
1297 
1298     return _MApi_SND_ProcessEnable(Type, enable);
1299 
1300 #endif
1301 }
1302 
MApi_SND_SetParam1(Sound_SET_PARAM_Type Type,MS_U16 param1,MS_U16 param2)1303 MS_BOOL MApi_SND_SetParam1( Sound_SET_PARAM_Type Type, MS_U16 param1, MS_U16 param2)
1304 {
1305 
1306 #ifdef UTOPIA_20
1307     AUDIO_ST_SND_SETPARAM1 Status;
1308     Status.bRet = 0;
1309     Status.eType = Type;
1310     Status.u16Param1 = param1;
1311     Status.u16Param2 = param2;
1312 
1313     if(_AUDIO_IOCtrlOpen() == FALSE)
1314     {
1315         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SND Set Param1 fail\n", __LINE__);
1316         //return;
1317     }
1318 
1319     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_SND_SetParam1, &Status) != UTOPIA_STATUS_SUCCESS)
1320     {
1321         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SND Set Param1 fail\n", __LINE__);
1322         //return;
1323     }
1324 
1325     return Status.bRet;
1326 
1327 #else
1328 
1329     return _MApi_SND_SetParam1(Type, param1, param2);
1330 
1331 #endif
1332 }
1333 
MApi_SND_GetParam1(Sound_GET_PARAM_Type Type,MS_U16 param1)1334 MS_U16 MApi_SND_GetParam1( Sound_GET_PARAM_Type Type, MS_U16 param1)
1335 {
1336 
1337 #ifdef UTOPIA_20
1338     AUDIO_ST_SND_GETPARAM1 Status;
1339     Status.u16Ret = 0;
1340     Status.eType = Type;
1341     Status.u16Param1 = param1;
1342 
1343     if(_AUDIO_IOCtrlOpen() == FALSE)
1344     {
1345         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SND Get Param1 fail\n", __LINE__);
1346         //return;
1347     }
1348 
1349     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_SND_GetParam1, &Status) != UTOPIA_STATUS_SUCCESS)
1350     {
1351         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SND Get Param1 fail\n", __LINE__);
1352         //return;
1353     }
1354     return Status.u16Ret;
1355 
1356 #else
1357 
1358     return _MApi_SND_GetParam1(Type, param1);
1359 
1360 #endif
1361 }
1362 
MApi_AUDIO_SOUND_SetParam(Sound_SET_Type Type,MS_U32 * p_param)1363 MS_BOOL MApi_AUDIO_SOUND_SetParam(Sound_SET_Type Type, MS_U32 *p_param )
1364 {
1365 
1366 #ifdef UTOPIA_20
1367     AUDIO_ST_SOUND_SETPARAM Status;
1368     Status.bStatus = FALSE;
1369     Status.eType = Type;
1370     Status.pParam = p_param;
1371 
1372     if(_AUDIO_IOCtrlOpen() == FALSE)
1373     {
1374         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Sound Set Param fail\n", __LINE__);
1375         //return;
1376     }
1377 
1378     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Sound_SetParam, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
1379     {
1380         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Sound Set Param fail\n", __LINE__);
1381         //return;
1382     }
1383     return Status.bStatus;
1384 
1385 #else
1386 
1387     return _MApi_AUDIO_SOUND_SetParam(Type, p_param);
1388 
1389 #endif
1390 }
1391 
MApi_AUDIO_SetAbsoluteVolume(MS_U8 u8Path,MS_U8 u8Vol1,MS_U8 u8Vol2)1392 void MApi_AUDIO_SetAbsoluteVolume(MS_U8 u8Path, MS_U8 u8Vol1, MS_U8 u8Vol2)
1393 {
1394 
1395 #ifdef UTOPIA_20
1396     AUDIO_ST_SET_ABSOLUTEVOLUME Status;
1397     Status.u8Path = u8Path;
1398     Status.u8Vol1 = u8Vol1;
1399     Status.u8Vol2 = u8Vol2;
1400 
1401     if(_AUDIO_IOCtrlOpen() == FALSE)
1402     {
1403         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Absolute Volume fail\n", __LINE__);
1404         return;
1405     }
1406 
1407     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetAbsoluteVolume, &Status) != UTOPIA_STATUS_SUCCESS)
1408     {
1409         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Absolute Volume fail\n", __LINE__);
1410         return;
1411     }
1412     return;
1413 
1414 #else
1415 
1416     return _MApi_AUDIO_SetAbsoluteVolume(u8Path, u8Vol1, u8Vol2);
1417 
1418 #endif
1419 }
1420 
MApi_AUDIO_SetPreScale(MS_U8 u8Path,MS_U8 u8PreScale)1421 void MApi_AUDIO_SetPreScale(MS_U8 u8Path, MS_U8 u8PreScale )
1422 {
1423 
1424 #ifdef UTOPIA_20
1425     MS_U32 u32Param[4] = {0,0,0,0};
1426     u32Param[0] = u8Path;
1427 	u32Param[1] = u8PreScale;
1428     AUDIO_ST_SOUND_SETPARAM Status;
1429     Status.bStatus = FALSE;
1430     Status.eType = Sound_SET_Type_SetPreScale;
1431     Status.pParam = (MS_U32*)u32Param;
1432 
1433     if(_AUDIO_IOCtrlOpen() == FALSE)
1434     {
1435         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set PreScale fail\n", __LINE__);
1436         return;
1437     }
1438 
1439     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Sound_SetParam, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
1440     {
1441         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set PreScale fail\n", __LINE__);
1442         return;
1443     }
1444     return;
1445 
1446 #else
1447 
1448     return _MApi_AUDIO_SetPreScale(u8Path, u8PreScale);
1449 
1450 #endif
1451 }
1452 
MApi_AUDIO_SetMute(MS_U8 u8Path,MS_BOOL EnMute)1453 void MApi_AUDIO_SetMute(MS_U8 u8Path, MS_BOOL EnMute )
1454 {
1455 
1456 #ifdef UTOPIA_20
1457     MS_U32 u32Param[4] = {0,0,0,0};
1458     u32Param[0] = u8Path;
1459     u32Param[1] = EnMute;
1460 
1461     AUDIO_ST_SOUND_SETPARAM Status;
1462     Status.bStatus = FALSE;
1463     Status.eType = Sound_SET_Type_SetMute;
1464     Status.pParam = (MS_U32*)u32Param;
1465 
1466     if(_AUDIO_IOCtrlOpen() == FALSE)
1467     {
1468         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Mute fail\n", __LINE__);
1469         return;
1470     }
1471 
1472     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Sound_SetParam, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
1473     {
1474         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Mute fail\n", __LINE__);
1475         return;
1476     }
1477     return;
1478 
1479 #else
1480 
1481     return _MApi_AUDIO_SetMute(u8Path, EnMute);
1482 
1483 #endif
1484 }
1485 
MApi_AUDIO_SourceConnect(AUDIO_OUTPORT_SOURCE_TYPE eConnectSourceType,MS_BOOL bConnect)1486 void MApi_AUDIO_SourceConnect(AUDIO_OUTPORT_SOURCE_TYPE eConnectSourceType, MS_BOOL bConnect )
1487 {
1488 
1489 #ifdef UTOPIA_20
1490     AUDIO_ST_SOURCECONNECT Status;
1491     Status.eConnectSourceType = eConnectSourceType;
1492     Status.bConnect = bConnect;
1493 
1494     if(_AUDIO_IOCtrlOpen() == FALSE)
1495     {
1496         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Source connect fail\n", __LINE__);
1497         return;
1498     }
1499 
1500     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SourceConnect, &Status) != UTOPIA_STATUS_SUCCESS)
1501     {
1502         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Source connect fail\n", __LINE__);
1503         return;
1504     }
1505     return;
1506 
1507 #else
1508 
1509     return _MApi_AUDIO_SourceConnect(eConnectSourceType, bConnect);
1510 
1511 #endif
1512 }
1513 
MApi_AUDIO_SetBalance(MS_U8 u8Balance)1514 void MApi_AUDIO_SetBalance(MS_U8 u8Balance)
1515 {
1516 
1517 #ifdef UTOPIA_20
1518     MS_U32 u32Param[4] = {0,0,0,0};
1519     u32Param[0] = u8Balance;
1520     AUDIO_ST_SOUND_SETPARAM Status;
1521     Status.bStatus = FALSE;
1522     Status.eType = Sound_SET_Type_SetBalance;
1523     Status.pParam = (MS_U32*)u32Param;
1524 
1525     if(_AUDIO_IOCtrlOpen() == FALSE)
1526     {
1527         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Balance fail\n", __LINE__);
1528         return;
1529     }
1530 
1531     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Sound_SetParam, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
1532     {
1533         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Balance fail\n", __LINE__);
1534         return;
1535     }
1536     return;
1537 
1538 #else
1539 
1540     return _MApi_AUDIO_SetBalance(u8Balance);
1541 
1542 #endif
1543 }
1544 
MApi_AUDIO_EnableEQ(MS_BOOL EnEQ)1545 void MApi_AUDIO_EnableEQ(MS_BOOL EnEQ)
1546 {
1547 
1548 #ifdef UTOPIA_20
1549     MS_U32 u32Param[4] = {0,0,0,0};
1550     u32Param[0] = EnEQ;
1551     AUDIO_ST_SOUND_SETPARAM Status;
1552     Status.bStatus = FALSE;
1553     Status.eType = Sound_SET_Type_EnableEQ;
1554     Status.pParam = (MS_U32*)u32Param;
1555 
1556     if(_AUDIO_IOCtrlOpen() == FALSE)
1557     {
1558         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable EQ fail\n", __LINE__);
1559         return;
1560     }
1561 
1562     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Sound_SetParam, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
1563     {
1564         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable EQ fail\n", __LINE__);
1565         return;
1566     }
1567     return;
1568 
1569 #else
1570 
1571     return _MApi_AUDIO_EnableEQ(EnEQ);
1572 
1573 #endif
1574 }
1575 
MApi_AUDIO_EnableTone(MS_BOOL EnTone)1576 void MApi_AUDIO_EnableTone(MS_BOOL EnTone)
1577 {
1578 
1579 #ifdef UTOPIA_20
1580     MS_U32 u32Param[4] = {0,0,0,0};
1581     u32Param[0] = EnTone;
1582     AUDIO_ST_SOUND_SETPARAM Status;
1583     Status.bStatus = FALSE;
1584     Status.eType = Sound_SET_Type_EnableTone;
1585     Status.pParam = (MS_U32*)u32Param;
1586 
1587     if(_AUDIO_IOCtrlOpen() == FALSE)
1588     {
1589         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable Tone fail\n", __LINE__);
1590         return;
1591     }
1592 
1593     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Sound_SetParam, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
1594     {
1595         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable Tone fail\n", __LINE__);
1596         return;
1597     }
1598     return;
1599 
1600 #else
1601 
1602     return _MApi_AUDIO_EnableTone(EnTone);
1603 
1604 #endif
1605 }
1606 
MApi_AUDIO_EnableAutoVolume(MS_BOOL EnAVC)1607 void MApi_AUDIO_EnableAutoVolume(MS_BOOL EnAVC)
1608 {
1609 
1610 #ifdef UTOPIA_20
1611     MS_U32 u32Param[4] = {0,0,0,0};
1612     u32Param[0] = EnAVC;
1613     AUDIO_ST_SOUND_SETPARAM Status;
1614     Status.bStatus = FALSE;
1615     Status.eType = Sound_SET_Type_EnableAutoVolume;
1616    	Status.pParam = (MS_U32*)u32Param;
1617 
1618     if(_AUDIO_IOCtrlOpen() == FALSE)
1619     {
1620         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable Auto Volume fail\n", __LINE__);
1621         return;
1622     }
1623 
1624     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Sound_SetParam, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
1625     {
1626         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable Auto Volume fail\n", __LINE__);
1627         return;
1628     }
1629     return;
1630 
1631 #else
1632 
1633     return _MApi_AUDIO_EnableAutoVolume(EnAVC);
1634 
1635 #endif
1636 }
1637 
MApi_AUDIO_EnableSurround(MS_BOOL EnSurround)1638 void MApi_AUDIO_EnableSurround(MS_BOOL EnSurround)
1639 {
1640 
1641 #ifdef UTOPIA_20
1642     MS_U32 u32Param[4] = {0,0,0,0};
1643     u32Param[0] = EnSurround;
1644     AUDIO_ST_SOUND_SETPARAM Status;
1645     Status.bStatus = FALSE;
1646     Status.eType = Sound_SET_Type_EnableSurround;
1647     Status.pParam = (MS_U32*)u32Param;
1648 
1649     if(_AUDIO_IOCtrlOpen() == FALSE)
1650     {
1651         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable Surround fail\n", __LINE__);
1652         return;
1653     }
1654 
1655     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Sound_SetParam, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
1656     {
1657         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable Surround fail\n", __LINE__);
1658         return;
1659     }
1660     return;
1661 
1662 #else
1663 
1664     return _MApi_AUDIO_EnableSurround(EnSurround);
1665 
1666 #endif
1667 }
1668 
MApi_AUDIO_EnableBalance(MS_BOOL EnBalance)1669 void MApi_AUDIO_EnableBalance(MS_BOOL EnBalance)
1670 {
1671 
1672 #ifdef UTOPIA_20
1673     MS_U32 u32Param[4] = {0,0,0,0};
1674     u32Param[0] = EnBalance;
1675     AUDIO_ST_SOUND_SETPARAM Status;
1676     Status.bStatus = FALSE;
1677     Status.eType = Sound_SET_Type_EnableBalance;
1678     Status.pParam = (MS_U32*)u32Param;
1679 
1680     if(_AUDIO_IOCtrlOpen() == FALSE)
1681     {
1682         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable Balance fail\n", __LINE__);
1683         return;
1684     }
1685 
1686     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Sound_SetParam, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
1687     {
1688         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable Balance fail\n", __LINE__);
1689         return;
1690     }
1691     return;
1692 
1693 #else
1694 
1695     return _MApi_AUDIO_EnableBalance(EnBalance);
1696 
1697 #endif
1698 }
1699 
MApi_AUDIO_SetDynamicBass(MS_U8 u8DynamicBass)1700 void MApi_AUDIO_SetDynamicBass(MS_U8 u8DynamicBass )
1701 {
1702 
1703 #ifdef UTOPIA_20
1704     MS_U32 u32Param = ((MS_U32)u8DynamicBass);
1705 
1706     if(_AUDIO_IOCtrlOpen() == FALSE)
1707     {
1708         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Dynamic Bass fail\n", __LINE__);
1709         return;
1710     }
1711 
1712     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetDynamicBass, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
1713     {
1714         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Dynamic Bass fail\n", __LINE__);
1715         return;
1716     }
1717     return;
1718 
1719 #else
1720 
1721     return _MApi_AUDIO_SetDynamicBass(u8DynamicBass);
1722 
1723 #endif
1724 }
1725 
MApi_AUDIO_SetBass(MS_U8 u8Bass)1726 void MApi_AUDIO_SetBass(MS_U8 u8Bass)
1727 {
1728 
1729 #ifdef UTOPIA_20
1730     MS_U32 u32Param[4] = {0,0,0,0};
1731     u32Param[0] = u8Bass;
1732     AUDIO_ST_SOUND_SETPARAM Status;
1733     Status.bStatus = FALSE;
1734     Status.eType = Sound_SET_Type_SetBass;
1735     Status.pParam = (MS_U32*)u32Param;
1736 
1737     if(_AUDIO_IOCtrlOpen() == FALSE)
1738     {
1739         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Bass fail\n", __LINE__);
1740         return;
1741     }
1742 
1743     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Sound_SetParam, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
1744     {
1745         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Bass fail\n", __LINE__);
1746         return;
1747     }
1748     return;
1749 
1750 #else
1751 
1752     return _MApi_AUDIO_SetBass(u8Bass);
1753 
1754 #endif
1755 }
1756 
MApi_AUDIO_AbsoluteBass(MS_U8 u8Bass)1757 void MApi_AUDIO_AbsoluteBass(MS_U8 u8Bass)
1758 {
1759 
1760 #ifdef UTOPIA_20
1761     MS_U32 u32Param[4] = {0,0,0,0};
1762     u32Param[0] = u8Bass;
1763 
1764     AUDIO_ST_SOUND_SETPARAM Status;
1765     Status.bStatus = FALSE;
1766     Status.eType = Sound_SET_Type_AbsoluteBass;
1767     Status.pParam = (MS_U32*)u32Param;
1768 
1769     if(_AUDIO_IOCtrlOpen() == FALSE)
1770     {
1771         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Absolute Bass fail\n", __LINE__);
1772         return;
1773     }
1774 
1775     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Sound_SetParam, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
1776     {
1777         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Absolute Bass fail\n", __LINE__);
1778         return;
1779     }
1780     return;
1781 
1782 #else
1783 
1784     return _MApi_AUDIO_AbsoluteBass(u8Bass);
1785 
1786 #endif
1787 }
1788 
MApi_AUDIO_SetTreble(MS_U8 u8Treble)1789 void MApi_AUDIO_SetTreble(MS_U8 u8Treble)
1790 {
1791 
1792 #ifdef UTOPIA_20
1793     MS_U32 u32Param[4] = {0,0,0,0};
1794     u32Param[0] = u8Treble;
1795 
1796     AUDIO_ST_SOUND_SETPARAM Status;
1797     Status.bStatus = FALSE;
1798     Status.eType = Sound_SET_Type_SetTreble;
1799     Status.pParam = (MS_U32*)u32Param;
1800 
1801     if(_AUDIO_IOCtrlOpen() == FALSE)
1802     {
1803         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Treble fail\n", __LINE__);
1804         return;
1805     }
1806 
1807     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Sound_SetParam, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
1808     {
1809         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Treble fail\n", __LINE__);
1810         return;
1811     }
1812     return;
1813 
1814 #else
1815 
1816     return _MApi_AUDIO_SetTreble(u8Treble);
1817 
1818 #endif
1819 }
1820 
MApi_AUDIO_AbsoluteTreble(MS_U8 u8Treble)1821 void MApi_AUDIO_AbsoluteTreble(MS_U8 u8Treble )
1822 {
1823 
1824 #ifdef UTOPIA_20
1825     MS_U32 u32Param = ((MS_U32)u8Treble);
1826 
1827     if(_AUDIO_IOCtrlOpen() == FALSE)
1828     {
1829         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Absolute Treble fail\n", __LINE__);
1830         return;
1831     }
1832 
1833     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_AbsoluteTreble, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
1834     {
1835         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Absolute Treble fail\n", __LINE__);
1836         return;
1837     }
1838     return;
1839 
1840 #else
1841 
1842     return _MApi_AUDIO_AbsoluteTreble(u8Treble);
1843 
1844 #endif
1845 }
1846 
MApi_AUDIO_SetEq(MS_U8 u8band,MS_U8 u8level)1847 void MApi_AUDIO_SetEq(MS_U8 u8band, MS_U8 u8level)
1848 {
1849 
1850 #ifdef UTOPIA_20
1851     MS_U32 u32Param[4] = {0,0,0,0};
1852     u32Param[0] = u8band;
1853     u32Param[1] = u8level;
1854     AUDIO_ST_SOUND_SETPARAM Status;
1855     Status.bStatus = FALSE;
1856     Status.eType = Sound_SET_Type_SetEq;
1857     Status.pParam = (MS_U32*)u32Param;
1858 
1859     if(_AUDIO_IOCtrlOpen() == FALSE)
1860     {
1861         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set EQ fail\n", __LINE__);
1862         return;
1863     }
1864 
1865     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Sound_SetParam, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
1866     {
1867         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set EQ fail\n", __LINE__);
1868         return;
1869     }
1870     return;
1871 
1872 #else
1873 
1874     return _MApi_AUDIO_SetEq(u8band, u8level);
1875 
1876 #endif
1877 }
1878 
MApi_AUDIO_SetEq_7band(MS_U8 u8band,MS_U8 u8level)1879 void MApi_AUDIO_SetEq_7band(MS_U8 u8band, MS_U8 u8level)
1880 {
1881 
1882 #ifdef UTOPIA_20
1883     AUDIO_ST_SETEQ_7BAND Status;
1884     Status.u8Band = u8band;
1885     Status.u8Level = u8level;
1886 
1887     if(_AUDIO_IOCtrlOpen() == FALSE)
1888     {
1889         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set EQ 7band fail\n", __LINE__);
1890         return;
1891     }
1892 
1893     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetEq_7band, &Status) != UTOPIA_STATUS_SUCCESS)
1894     {
1895         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set EQ 7band fail\n", __LINE__);
1896         return;
1897     }
1898     return;
1899 
1900 #else
1901 
1902     return _MApi_AUDIO_SetEq_7band(u8band, u8level);
1903 
1904 #endif
1905 }
1906 
MApi_AUDIO_SetAvcThreshold(MS_U8 Level)1907 void MApi_AUDIO_SetAvcThreshold(MS_U8 Level)
1908 {
1909 
1910 #ifdef UTOPIA_20
1911 
1912     MS_U32 u32Param = ((MS_U8)Level);
1913 
1914     if(_AUDIO_IOCtrlOpen() == FALSE)
1915     {
1916         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Avc Threshold fail\n", __LINE__);
1917         return;
1918     }
1919 
1920     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetAvcThreshold, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
1921     {
1922         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Avc Threshold fail\n", __LINE__);
1923         return;
1924     }
1925     return;
1926 
1927 #else
1928 
1929     return _MApi_AUDIO_SetAvcThreshold(Level);
1930 
1931 #endif
1932 }
1933 
MApi_AUDIO_SetAvcMode(MS_U8 AvcMode)1934 void MApi_AUDIO_SetAvcMode(MS_U8 AvcMode)
1935 {
1936 
1937 #ifdef UTOPIA_20
1938 
1939     MS_U32 u32Param = ((MS_U8)AvcMode);
1940 
1941     if(_AUDIO_IOCtrlOpen() == FALSE)
1942     {
1943         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Avc Mode fail\n", __LINE__);
1944         return;
1945     }
1946 
1947     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetAvcMode, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
1948     {
1949         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Avc Mode fail\n", __LINE__);
1950         return;
1951     }
1952     return;
1953 #else
1954 
1955     return _MApi_AUDIO_SetAvcMode(AvcMode);
1956 
1957 #endif
1958 }
1959 
MApi_AUDIO_SetAvcAT(MS_U8 AvcAT)1960 void MApi_AUDIO_SetAvcAT(MS_U8 AvcAT)
1961 {
1962 
1963 #ifdef UTOPIA_20
1964 
1965     MS_U32 u32Param = ((MS_U8)AvcAT);
1966 
1967     if(_AUDIO_IOCtrlOpen() == FALSE)
1968     {
1969         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Avc AT fail\n", __LINE__);
1970         return;
1971     }
1972 
1973     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetAvcAT, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
1974     {
1975         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Avc AT fail\n", __LINE__);
1976         return;
1977     }
1978     return;
1979 
1980 #else
1981 
1982     return _MApi_AUDIO_SetAvcAT(AvcAT);
1983 
1984 #endif
1985 }
1986 
MApi_AUDIO_SetAvcRT(MS_U8 AvcRT)1987 void MApi_AUDIO_SetAvcRT(MS_U8 AvcRT)
1988 {
1989 
1990 #ifdef UTOPIA_20
1991 
1992     MS_U32 u32Param = ((MS_U8)AvcRT);
1993 
1994     if(_AUDIO_IOCtrlOpen() == FALSE)
1995     {
1996         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Avc RT fail\n", __LINE__);
1997         return;
1998     }
1999 
2000     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetAvcRT, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
2001     {
2002         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Avc RT fail\n", __LINE__);
2003         return;
2004     }
2005     return;
2006 
2007 #else
2008 
2009     return _MApi_AUDIO_SetAvcRT(AvcRT);
2010 
2011 #endif
2012 }
2013 
MApi_AUDIO_SetBufferProcess(MS_U8 DelayTime)2014 void MApi_AUDIO_SetBufferProcess(MS_U8 DelayTime)
2015 {
2016 
2017 #ifdef UTOPIA_20
2018     MS_U32 u32Param = ((MS_U32)DelayTime);
2019 
2020     if(_AUDIO_IOCtrlOpen() == FALSE)
2021     {
2022         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Buffer Process fail\n", __LINE__);
2023         return;
2024     }
2025 
2026     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetBufferProcess, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
2027     {
2028         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Buffer Process fail\n", __LINE__);
2029         return;
2030     }
2031     return;
2032 
2033 #else
2034 
2035     return _MApi_AUDIO_SetBufferProcess(DelayTime);
2036 
2037 #endif
2038 }
2039 
MApi_AUDIO_SetSurroundXA(MS_U8 mode)2040 void MApi_AUDIO_SetSurroundXA(MS_U8 mode)
2041 {
2042 
2043 #ifdef UTOPIA_20
2044 
2045     MS_U32 u32Param = ((MS_U8)mode);
2046 
2047     if(_AUDIO_IOCtrlOpen() == FALSE)
2048     {
2049         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Surround XA fail\n", __LINE__);
2050         return;
2051     }
2052 
2053     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetSurroundXA, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
2054     {
2055         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Surround XA fail\n", __LINE__);
2056         return;
2057     }
2058     return;
2059 
2060 #else
2061 
2062     return _MApi_AUDIO_SetSurroundXA(mode);
2063 
2064 #endif
2065 }
2066 
MApi_AUDIO_SetSurroundXB(MS_U8 mode)2067 void MApi_AUDIO_SetSurroundXB(MS_U8 mode )
2068 {
2069 
2070 #ifdef UTOPIA_20
2071 
2072     MS_U32 u32Param = ((MS_U8)mode);
2073 
2074     if(_AUDIO_IOCtrlOpen() == FALSE)
2075     {
2076         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Surround XB fail\n", __LINE__);
2077         return;
2078     }
2079 
2080     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetSurroundXB, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
2081     {
2082         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Surround XB fail\n", __LINE__);
2083         return;
2084     }
2085     return;
2086 
2087 #else
2088 
2089     return _MApi_AUDIO_SetSurroundXB(mode);
2090 
2091 #endif
2092 }
2093 
MApi_AUDIO_SetSurroundXK(MS_U8 mode)2094 void MApi_AUDIO_SetSurroundXK( MS_U8 mode )
2095 {
2096 
2097 #ifdef UTOPIA_20
2098 
2099     MS_U32 u32Param = ((MS_U8)mode);
2100 
2101     if(_AUDIO_IOCtrlOpen() == FALSE)
2102     {
2103         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Surround XK fail\n", __LINE__);
2104         return;
2105     }
2106 
2107     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetSurroundXK, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
2108     {
2109         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Surround XK fail\n", __LINE__);
2110         return;
2111     }
2112     return;
2113 
2114 #else
2115 
2116     return _MApi_AUDIO_SetSurroundXK(mode);
2117 
2118 #endif
2119 }
2120 
MApi_AUDIO_SetSurroundLPFGain(MS_U8 mode)2121 void MApi_AUDIO_SetSurroundLPFGain(MS_U8 mode)
2122 {
2123 
2124 #ifdef UTOPIA_20
2125 
2126     MS_U32 u32Param = ((MS_U8)mode);
2127 
2128     if(_AUDIO_IOCtrlOpen() == FALSE)
2129     {
2130         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Surround LPF Gain fail\n", __LINE__);
2131         return;
2132     }
2133 
2134     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetSurroundLPFGain, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
2135     {
2136         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Surround LPF Gain fail\n", __LINE__);
2137         return;
2138     }
2139     return;
2140 
2141 #else
2142 
2143     return _MApi_AUDIO_SetSurroundLPFGain(mode);
2144 
2145 #endif
2146 }
2147 
MApi_AUDIO_ConvertVolumeUnit(MS_U8 UiVolume)2148 MS_U8 MApi_AUDIO_ConvertVolumeUnit(MS_U8 UiVolume)
2149 {
2150 
2151 #ifdef UTOPIA_20
2152     AUDIO_ST_CONVERT_VOLUMEUNIT Status;
2153     Status.u8Ret = 0;
2154     Status.u8Uivolume = UiVolume;
2155 
2156     if(_AUDIO_IOCtrlOpen() == FALSE)
2157     {
2158         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Convert Volume Unit fail\n", __LINE__);
2159         //return;
2160     }
2161 
2162     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_ConvertVolumeUnit, &Status) != UTOPIA_STATUS_SUCCESS)
2163     {
2164         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Convert Volume Unit fail\n", __LINE__);
2165         //return;
2166     }
2167 
2168     return Status.u8Ret;
2169 
2170 #else
2171 
2172     return _MApi_AUDIO_ConvertVolumeUnit(UiVolume);
2173 
2174 #endif
2175 }
2176 
MApi_AUDIO_SetPEQCoef(AUDIO_PEQ_COEF * peq_coef)2177 void MApi_AUDIO_SetPEQCoef(AUDIO_PEQ_COEF *peq_coef)
2178 {
2179 #ifdef UTOPIA_20
2180 
2181     if(_AUDIO_IOCtrlOpen() == FALSE)
2182     {
2183         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set PEQ Coef fail\n", __LINE__);
2184         return;
2185     }
2186 
2187     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetPEQCoef, (void*)peq_coef) != UTOPIA_STATUS_SUCCESS)
2188     {
2189         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set PEQ Coef fai\n", __LINE__);
2190         return;
2191     }
2192     return;
2193 
2194 #else
2195 
2196     return _MApi_AUDIO_SetPEQCoef(peq_coef);
2197 
2198 #endif
2199 }
2200 
MApi_AUDIO_EnablePEQ(MS_BOOL Enpeq)2201 void MApi_AUDIO_EnablePEQ(MS_BOOL Enpeq)
2202 {
2203 
2204 #ifdef UTOPIA_20
2205     MS_U32 u32Param[4] = {0,0,0,0};
2206     u32Param[0] = Enpeq;
2207     AUDIO_ST_SOUND_SETPARAM Status;
2208     Status.bStatus = FALSE;
2209     Status.eType = Sound_SET_Type_EnablePEQ;
2210     Status.pParam = (MS_U32*)u32Param;
2211 
2212     if(_AUDIO_IOCtrlOpen() == FALSE)
2213     {
2214         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable PEQ fail\n", __LINE__);
2215         return;
2216     }
2217 
2218     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Sound_SetParam, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
2219     {
2220         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable PEQ fail\n", __LINE__);
2221         return;
2222     }
2223     return;
2224 
2225 #else
2226 
2227     return _MApi_AUDIO_EnablePEQ(Enpeq);
2228 
2229 #endif
2230 }
2231 
MApi_AUDIO_EnableDcRemove(MS_BOOL EnDcRemove)2232 MS_BOOL MApi_AUDIO_EnableDcRemove(MS_BOOL EnDcRemove)
2233 {
2234 
2235 #ifdef UTOPIA_20
2236     AUDIO_ST_ENABLE_DCREMOVE Status;
2237     Status.bRet = 0;
2238     Status.bEndcremove = EnDcRemove;
2239 
2240     if(_AUDIO_IOCtrlOpen() == FALSE)
2241     {
2242         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable DC Remove fail\n", __LINE__);
2243         //return;
2244     }
2245 
2246     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_EnableDcRemove, &Status) != UTOPIA_STATUS_SUCCESS)
2247     {
2248         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable DC Remove fail\n", __LINE__);
2249         //return;
2250     }
2251 
2252     return Status.bRet;
2253 
2254 #else
2255 
2256     return _MApi_AUDIO_EnableDcRemove(EnDcRemove);
2257 
2258 #endif
2259 }
2260 //============================================================
2261 // AUDIO_DTV RELATIONAL API FUNCTION
2262 //============================================================
MApi_AUDIO_ReleaseDecodeSystem(AUDIO_DEC_ID DecId)2263 MS_BOOL MApi_AUDIO_ReleaseDecodeSystem(AUDIO_DEC_ID DecId)
2264 {
2265 
2266 #ifdef UTOPIA_20
2267     AUDIO_ST_RELEASE_DECODESYSTEM Status;
2268     Status.bStatus = FALSE;
2269     Status.DecId = DecId;
2270 
2271     if(_AUDIO_IOCtrlOpen() == FALSE)
2272     {
2273         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Release Decode System fail\n", __LINE__);
2274         //return;
2275     }
2276 
2277     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_ReleaseDecodeSystem, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
2278     {
2279         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Release Decode System fail\n", __LINE__);
2280         //return;
2281     }
2282     return (MS_BOOL)Status.bStatus;
2283 
2284 #else
2285 
2286     return _MApi_AUDIO_ReleaseDecodeSystem(DecId);
2287 
2288 #endif
2289 }
2290 
MApi_AUDIO_SetDecodeSystem(AUDIO_DEC_ID DecId,AudioDecStatus_t * p_AudioDecStatus)2291 MS_BOOL MApi_AUDIO_SetDecodeSystem(AUDIO_DEC_ID DecId,  AudioDecStatus_t * p_AudioDecStatus)
2292 {
2293 
2294 #ifdef UTOPIA_20
2295     AUDIO_ST_SET_DECODESYSTEM Status;
2296     Status.bStatus = FALSE;
2297     Status.DecId = DecId;
2298     Status.p_AudioDecStatus = p_AudioDecStatus;
2299 
2300     if(_AUDIO_IOCtrlOpen() == FALSE)
2301     {
2302         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Decode System fail\n", __LINE__);
2303         //return;
2304     }
2305 
2306     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetDecodeSystem, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
2307     {
2308         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Decode System fail\n", __LINE__);
2309         //return;
2310     }
2311     return Status.bStatus;
2312 
2313 #else
2314 
2315     return _MApi_AUDIO_SetDecodeSystem(DecId, p_AudioDecStatus);
2316 
2317 #endif
2318 }
2319 
MApi_AUDIO_GetDecodeSystem(AUDIO_DEC_ID DecId,AudioDecStatus_t * p_AudioDecStatus)2320 MS_BOOL MApi_AUDIO_GetDecodeSystem(AUDIO_DEC_ID DecId,  AudioDecStatus_t * p_AudioDecStatus)
2321 {
2322 
2323 #ifdef UTOPIA_20
2324     AUDIO_ST_GET_DECODESYSTEM Status;
2325     Status.bStatus = FALSE;
2326     Status.DecId = DecId;
2327     Status.p_AudioDecStatus = p_AudioDecStatus;
2328 
2329     if(_AUDIO_IOCtrlOpen() == FALSE)
2330     {
2331         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Decode System fail\n", __LINE__);
2332         //return;
2333     }
2334 
2335     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetDecodeSystem, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
2336     {
2337         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Decode System fail\n", __LINE__);
2338         //return;
2339     }
2340     return Status.bStatus;
2341 
2342 #else
2343 
2344     return _MApi_AUDIO_GetDecodeSystem(DecId, p_AudioDecStatus);
2345 
2346 #endif
2347 }
2348 
MApi_AUDIO_SetDecodeCmd(AUDIO_DEC_ID DecId,En_DVB_decCmdType enDecComamnd)2349 MS_BOOL MApi_AUDIO_SetDecodeCmd(AUDIO_DEC_ID DecId, En_DVB_decCmdType enDecComamnd)
2350 {
2351 
2352 #ifdef UTOPIA_20
2353     AUDIO_ST_SET_DECCMD Status;
2354     Status.bRet = 0;
2355     Status.eDecId = DecId;
2356     Status.eDecComamnd = enDecComamnd;
2357 
2358     if(_AUDIO_IOCtrlOpen() == FALSE)
2359     {
2360         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Decode Cmd fail\n", __LINE__);
2361         //return;
2362     }
2363 
2364 	if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetDecodeCmd, &Status) != UTOPIA_STATUS_SUCCESS)
2365     {
2366         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Decode Cmd fail\n", __LINE__);
2367         //return;
2368     }
2369     return Status.bRet;
2370 
2371 #else
2372 
2373     return _MApi_AUDIO_SetDecodeCmd(DecId, enDecComamnd);
2374 
2375 #endif
2376 }
2377 
MApi_AUDIO_OpenDecodeSystem(AudioDecStatus_t * p_AudioDecStatus)2378 AUDIO_DEC_ID MApi_AUDIO_OpenDecodeSystem(AudioDecStatus_t * p_AudioDecStatus)
2379 {
2380 
2381 #ifdef UTOPIA_20
2382     AUDIO_ST_OPEN_DECODESYSTEM Status;
2383     Status.DecId = AU_DEC_INVALID;
2384     Status.p_AudioDecStatus = p_AudioDecStatus;
2385 
2386     if(_AUDIO_IOCtrlOpen() == FALSE)
2387     {
2388         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Open Decode System fail\n", __LINE__);
2389         //return;
2390     }
2391 
2392     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_OpenDecodeSystem, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
2393     {
2394         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Open Decode System fail\n", __LINE__);
2395         //return;
2396     }
2397 
2398     return Status.DecId;
2399 
2400 #else
2401 
2402     return _MApi_AUDIO_OpenDecodeSystem(p_AudioDecStatus);
2403 
2404 #endif
2405 }
2406 
MApi_AUDIO_SetSystem(En_DVB_decSystemType enDecSystem)2407 MS_BOOL MApi_AUDIO_SetSystem(En_DVB_decSystemType enDecSystem)
2408 {
2409 
2410 #ifdef UTOPIA_20
2411     AUDIO_ST_SET_SYSTEM Status;
2412     Status.bRet = 0;
2413     Status.eDecSystem = enDecSystem;
2414 
2415     if(_AUDIO_IOCtrlOpen() == FALSE)
2416     {
2417         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set System fail\n", __LINE__);
2418         //return;
2419     }
2420 
2421     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetSystem, &Status) != UTOPIA_STATUS_SUCCESS)
2422     {
2423         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set System fail\n", __LINE__);
2424         //return;
2425     }
2426 
2427     return Status.bRet;
2428 
2429 #else
2430 
2431     return _MApi_AUDIO_SetSystem(enDecSystem);
2432 
2433 #endif
2434 }
2435 
MApi_AUDIO_GetDecSysSupportStatus(En_DVB_decSystemType enDecSystem)2436 MS_BOOL MApi_AUDIO_GetDecSysSupportStatus(En_DVB_decSystemType enDecSystem)
2437 {
2438 
2439 #ifdef UTOPIA_20
2440     AUDIO_ST_GET_DECSYSSUPPORTSTATUS Status;
2441     Status.bRet = 0;
2442     Status.eDecSystem = enDecSystem;
2443 
2444     if(_AUDIO_IOCtrlOpen() == FALSE)
2445     {
2446         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Dec Sys Support Status fail\n", __LINE__);
2447         //return;
2448     }
2449 
2450     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetDecSysSupportStatus, &Status) != UTOPIA_STATUS_SUCCESS)
2451     {
2452         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Dec Sys Support Status fail\n", __LINE__);
2453         //return;
2454     }
2455 
2456     return Status.bRet;
2457 
2458 #else
2459 
2460     return _MApi_AUDIO_GetDecSysSupportStatus(enDecSystem);
2461 
2462 #endif
2463 }
2464 
MApi_AUDIO_IsMadLock(void)2465 MS_BOOL MApi_AUDIO_IsMadLock(void)
2466 {
2467 
2468 #ifdef UTOPIA_20
2469     MS_U32 u32param[2] = {0, 0};
2470 
2471     if(_AUDIO_IOCtrlOpen() == FALSE)
2472     {
2473         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Is Mad Lock fail\n", __LINE__);
2474         //return;
2475     }
2476 
2477     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_IsMadLock, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
2478     {
2479         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Is Mad Lock fail\n", __LINE__);
2480         //return;
2481     }
2482     return ((MS_BOOL)u32param[1]);
2483 
2484 #else
2485 
2486     return _MApi_AUDIO_IsMadLock();
2487 
2488 #endif
2489 }
2490 
MApi_AUDIO_GetDecStatus(void)2491 En_DVB_decCmdType MApi_AUDIO_GetDecStatus(void)
2492 {
2493 
2494 #ifdef UTOPIA_20
2495     MS_U32 u32param[2] = {0, 0};
2496 
2497     if(_AUDIO_IOCtrlOpen() == FALSE)
2498     {
2499         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Dec Status fail\n", __LINE__);
2500         //return;
2501     }
2502 
2503     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetDecStatus, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
2504     {
2505         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Dec Status fail\n", __LINE__);
2506         //return;
2507     }
2508     return ((En_DVB_decCmdType)u32param[1]);
2509 
2510 #else
2511 
2512     return _MApi_AUDIO_GetDecStatus();
2513 
2514 #endif
2515 }
2516 
MApi_AUDIO_GetCommand(En_DVB_AudioDecoder AdoDecoderNo)2517 AU_DVB_DECCMD MApi_AUDIO_GetCommand(En_DVB_AudioDecoder AdoDecoderNo)
2518 {
2519 
2520 #ifdef UTOPIA_20
2521     AUDIO_ST_DECODER_COMMAND Status;
2522     Status.bSet = FALSE;
2523     Status.eDecCmd = AU_DVB_DECCMD_STOP;
2524     Status.eAdoDecoderNo = AdoDecoderNo;
2525 
2526     if(_AUDIO_IOCtrlOpen() == FALSE)
2527     {
2528         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Command fail\n", __LINE__);
2529         //return;
2530     }
2531 
2532     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Decode_Command, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
2533     {
2534         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Command fail\n", __LINE__);
2535         //return;
2536     }
2537     return Status.eDecCmd;
2538 
2539 #else
2540 
2541     return _MApi_AUDIO_GetCommand(AdoDecoderNo);
2542 
2543 #endif
2544 }
2545 
MApi_AUDIO_SetCommand(En_DVB_decCmdType enDecComamnd)2546 void MApi_AUDIO_SetCommand(En_DVB_decCmdType enDecComamnd)
2547 {
2548 
2549 #ifdef UTOPIA_20
2550     AUDIO_ST_DECODER_COMMAND Status;
2551     Status.bSet = TRUE;
2552     Status.eDecCmd = AU_DVB_DECCMD_STOP;
2553     Status.enCommandType = enDecComamnd;
2554 
2555     if(_AUDIO_IOCtrlOpen() == FALSE)
2556     {
2557         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Command fail\n", __LINE__);
2558         return;
2559     }
2560 
2561     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Decode_Command, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
2562     {
2563         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Command fail\n", __LINE__);
2564         return;
2565     }
2566     return;
2567 
2568 #else
2569 
2570     return _MApi_AUDIO_SetCommand(enDecComamnd);
2571 
2572 #endif
2573 }
2574 
MApi_AUDIO_GetMAD_LOCK(void)2575 MS_BOOL MApi_AUDIO_GetMAD_LOCK(void)
2576 {
2577 
2578 #ifdef UTOPIA_20
2579     MS_U32 u32param[2] = {0, 0};
2580 
2581     if(_AUDIO_IOCtrlOpen() == FALSE)
2582     {
2583         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get MAD Lock fail\n", __LINE__);
2584         //return;
2585     }
2586 
2587     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetMAD_Lock, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
2588     {
2589         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get MAD Lock fail\n", __LINE__);
2590         //return;
2591     }
2592     return ((MS_BOOL)u32param[1]);;
2593 
2594 #else
2595 
2596     return _MApi_AUDIO_GetMAD_LOCK();
2597 
2598 #endif
2599 }
2600 
MApi_AUDIO_SetADOutputMode(MS_U8 out_mode)2601 void MApi_AUDIO_SetADOutputMode(MS_U8 out_mode)
2602 {
2603 
2604 #ifdef UTOPIA_20
2605     AUDIO_ST_SET_AD Status;
2606     Status.eType = AD_OUTPUT_MODE;
2607     Status.u8Data = out_mode;
2608     Status.u8Data2 = 0;
2609     Status.bMute = FALSE;
2610 
2611     if(_AUDIO_IOCtrlOpen() == FALSE)
2612     {
2613         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set AD Output Mode fail\n", __LINE__);
2614         return;
2615     }
2616 
2617     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SETAD, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
2618     {
2619         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set AD Output Mode fail\n", __LINE__);
2620         return;
2621     }
2622     return;
2623 
2624 #else
2625 
2626     return _MApi_AUDIO_SetADOutputMode(out_mode);
2627 
2628 #endif
2629 }
2630 
MApi_AUDIO_SetADAbsoluteVolume(MS_U8 AbsVolume)2631 void MApi_AUDIO_SetADAbsoluteVolume(MS_U8 AbsVolume)
2632 {
2633 
2634 #ifdef UTOPIA_20
2635     AUDIO_ST_SET_AD Status;
2636     Status.eType = AD_ABSOLUTE_VOLUME;
2637     Status.u8Data = AbsVolume;
2638     Status.u8Data2 = 0;
2639     Status.bMute = FALSE;
2640 
2641     if(_AUDIO_IOCtrlOpen() == FALSE)
2642     {
2643         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set AD Absolute Volume fail\n", __LINE__);
2644         return;
2645     }
2646 
2647     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SETAD, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
2648     {
2649         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set AD Absolute Volume fail\n", __LINE__);
2650         return;
2651     }
2652     return;
2653 
2654 #else
2655 
2656     return _MApi_AUDIO_SetADAbsoluteVolume(AbsVolume);
2657 
2658 #endif
2659 }
2660 
2661 /*void MApi_AUDIO_SetMainVolumeForAD (MS_U8 u8Vol1, MS_U8 u8Vol2)
2662 {
2663 
2664 #ifdef UTOPIA_20
2665     AUDIO_ST_SET_AD Status;
2666     Status.eType = AD_SET_MAIN_VOL;
2667     Status.u8Data = u8Vol1;
2668     Status.u8Data2 = u8Vol2;
2669     Status.bMute = FALSE;
2670 
2671     if(_AUDIO_IOCtrlOpen() == FALSE)
2672     {
2673         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Main Volume For AD fail\n", __LINE__);
2674         //return;
2675     }
2676 
2677     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SETAD, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
2678     {
2679         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Main Volume For AD fail\n", __LINE__);
2680         //return;
2681     }
2682     return;
2683 
2684 #else
2685 
2686     return _MApi_AUDIO_SetMainVolumeForAD(u8Vol1, u8Vol2);
2687 
2688 #endif
2689 }*/
2690 
MApi_AUDIO_ADSetMute(MS_BOOL EnMute)2691 void MApi_AUDIO_ADSetMute(MS_BOOL EnMute)
2692 {
2693 
2694 #ifdef UTOPIA_20
2695     AUDIO_ST_SET_AD Status;
2696     Status.eType = AD_SET_MUTE;
2697     Status.u8Data = 0;
2698     Status.u8Data2 = 0;
2699     Status.bMute = EnMute;
2700 
2701     if(_AUDIO_IOCtrlOpen() == FALSE)
2702     {
2703         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set AD Mute fail\n", __LINE__);
2704         return;
2705     }
2706 
2707     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SETAD, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
2708     {
2709         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set AD Mute fail\n", __LINE__);
2710         return;
2711     }
2712     return;
2713 
2714 #else
2715 
2716     return _MApi_AUDIO_ADSetMute(EnMute);
2717 
2718 #endif
2719 }
2720 
2721 //============================================================
2722 // AUDIO_PVR RELATED FUNCTIONS
2723 //============================================================
MApi_AUDIO_SetEncInit(AU_DVB_ENCBR BitRate,MS_U8 u8EncFrameNum)2724 void MApi_AUDIO_SetEncInit(AU_DVB_ENCBR BitRate, MS_U8 u8EncFrameNum)
2725 {
2726 
2727 #ifdef UTOPIA_20
2728     AUDIO_ST_SET_ENCINIT Status;
2729     Status.eBitRate = BitRate;
2730     Status.u8EncFrameNum = u8EncFrameNum;
2731 
2732     if(_AUDIO_IOCtrlOpen() == FALSE)
2733     {
2734         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Enc Init fail\n", __LINE__);
2735         return;
2736     }
2737 
2738     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetEncInit, &Status) != UTOPIA_STATUS_SUCCESS)
2739     {
2740         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Enc Init fail\n", __LINE__);
2741         return;
2742     }
2743     return;
2744 
2745 #else
2746 
2747     return _MApi_AUDIO_SetEncInit(BitRate, u8EncFrameNum);
2748 
2749 #endif
2750 }
2751 
MApi_AUDIO_SetEncCommand(AU_DVB_ENCCMD enEncComamnd)2752 void MApi_AUDIO_SetEncCommand(AU_DVB_ENCCMD enEncComamnd)
2753 {
2754 
2755 #ifdef UTOPIA_20
2756 
2757     MS_U32 u32Param = ((MS_U32)enEncComamnd);
2758 
2759     if(_AUDIO_IOCtrlOpen() == FALSE)
2760     {
2761         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Enc Command fail\n", __LINE__);
2762         return;
2763     }
2764 
2765     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetEncCommand, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
2766     {
2767         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Enc Command fail\n", __LINE__);
2768         return;
2769     }
2770     return;
2771 
2772 #else
2773 
2774     return _MApi_AUDIO_SetEncCommand(enEncComamnd);
2775 
2776 #endif
2777 }
2778 
MApi_AUDIO_GetEncodeFrameInfo(AU_DVB_ENC_FRAME_INFO * EncFrameInfo)2779 void MApi_AUDIO_GetEncodeFrameInfo(AU_DVB_ENC_FRAME_INFO *EncFrameInfo)
2780 {
2781 
2782 #ifdef UTOPIA_20
2783 
2784     if(_AUDIO_IOCtrlOpen() == FALSE)
2785     {
2786         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Enc Frame Info fail\n", __LINE__);
2787         return;
2788     }
2789 
2790     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetEncodeFrameInfo, (void*)EncFrameInfo) != UTOPIA_STATUS_SUCCESS)
2791     {
2792         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Enc Frame Info fail\n", __LINE__);
2793         return;
2794     }
2795     return;
2796 
2797 #else
2798 
2799     return _MApi_AUDIO_GetEncodeFrameInfo(EncFrameInfo);
2800 
2801 #endif
2802 }
2803 
MApi_AUDIO_GetEncodeDoneFlag(void)2804 MS_BOOL MApi_AUDIO_GetEncodeDoneFlag(void)
2805 {
2806 
2807 #ifdef UTOPIA_20
2808     MS_U32 u32param[2] = {0, 0};
2809 
2810     if(_AUDIO_IOCtrlOpen() == FALSE)
2811     {
2812         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Encode Done Flag fail\n", __LINE__);
2813         //return;
2814     }
2815 
2816     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetEncodeDoneFlag, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
2817     {
2818         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Encode Done Flag fail\n", __LINE__);
2819         //return;
2820     }
2821     return ((MS_BOOL)u32param[1]);;
2822 
2823 #else
2824 
2825     return _MApi_AUDIO_GetEncodeDoneFlag();
2826 
2827 #endif
2828 }
2829 
2830 //============================================================
2831 // AUDIO_ATV RELATIONAL API FUNCTION
2832 //============================================================
MApi_AUDIO_SIF_SetStandard(AUDIOSTANDARD_TYPE standard_type)2833 void MApi_AUDIO_SIF_SetStandard(AUDIOSTANDARD_TYPE standard_type)
2834 {
2835 
2836 #ifdef UTOPIA_20
2837 
2838     MS_U32 u32Param = ((MS_U32)standard_type);
2839 
2840     if(_AUDIO_IOCtrlOpen() == FALSE)
2841     {
2842         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Set Standard fail\n", __LINE__);
2843         return;
2844     }
2845 
2846     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SIF_SetStandard, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
2847     {
2848         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Set Standard fail\n", __LINE__);
2849         return;
2850     }
2851     return;
2852 
2853 #else
2854 
2855     return _MApi_AUDIO_SIF_SetStandard(standard_type);
2856 
2857 #endif
2858 }
2859 
MApi_AUDIO_SIF_GetSoundMode(void)2860 MS_U8 MApi_AUDIO_SIF_GetSoundMode(void)
2861 {
2862 
2863 #ifdef UTOPIA_20
2864     MS_U32 u32param[2] = {0, 0};
2865 
2866     if(_AUDIO_IOCtrlOpen() == FALSE)
2867     {
2868         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Get Sound Mode fail\n", __LINE__);
2869         //return;
2870     }
2871 
2872     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SIF_GetSoundMode, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
2873     {
2874         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Get Sound Mode fail\n", __LINE__);
2875         //return;
2876     }
2877     return ((MS_BOOL)u32param[1]);
2878 
2879 #else
2880 
2881     return _MApi_AUDIO_SIF_GetSoundMode();
2882 
2883 #endif
2884 }
2885 
MApi_AUDIO_SIF_SetSoundMode(MS_U8 u8SifSoundMode)2886 MS_BOOL MApi_AUDIO_SIF_SetSoundMode(MS_U8 u8SifSoundMode)
2887 {
2888 
2889 #ifdef UTOPIA_20
2890     AUDIO_ST_SIF_SET_SOUNDMODE Status;
2891     Status.bRet = 0;
2892     Status.u8SifSoundMode = u8SifSoundMode;
2893 
2894     if(_AUDIO_IOCtrlOpen() == FALSE)
2895     {
2896         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Set Sound Mode fail\n", __LINE__);
2897         //return;
2898     }
2899 
2900     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SIF_SetSoundMode, &Status) != UTOPIA_STATUS_SUCCESS)
2901     {
2902         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Set Sound Mode fail\n", __LINE__);
2903         //return;
2904     }
2905 
2906     return Status.bRet;
2907 
2908 #else
2909 
2910     return _MApi_AUDIO_SIF_SetSoundMode(u8SifSoundMode);
2911 
2912 #endif
2913 }
2914 
MApi_AUDIO_SIF_GetAudioStatus(AUDIOSTATUS * eAudioStatus)2915 MS_BOOL MApi_AUDIO_SIF_GetAudioStatus(AUDIOSTATUS * eAudioStatus)
2916 {
2917 
2918 #ifdef UTOPIA_20
2919 
2920     AUDIO_ST_SIF_GET_AUDIO_STATUS Status;
2921 
2922     Status.bStatus = FALSE;
2923     Status.p_eAudioStatus = eAudioStatus;
2924 
2925     if(_AUDIO_IOCtrlOpen() == FALSE)
2926     {
2927         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Get Audio Status fail\n", __LINE__);
2928         //return;
2929     }
2930 
2931     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SIF_GetAudioStatus, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
2932     {
2933         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Get Audio Status fail\n", __LINE__);
2934         //return;
2935     }
2936 
2937     return Status.bStatus;
2938 
2939 #else
2940 
2941     return _MApi_AUDIO_SIF_GetAudioStatus(eAudioStatus);
2942 
2943 #endif
2944 }
2945 
MApi_AUDIO_SIF_StartAutoStandardDetection(void)2946 void MApi_AUDIO_SIF_StartAutoStandardDetection(void)
2947 {
2948 
2949 #ifdef UTOPIA_20
2950 
2951     if(_AUDIO_IOCtrlOpen() == FALSE)
2952     {
2953         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Start Auto standard Detection fail\n", __LINE__);
2954         return;
2955     }
2956 
2957     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SIF_StartAutoStandardDetection, 0) != UTOPIA_STATUS_SUCCESS)
2958     {
2959         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Start Auto standard Detection fail\n", __LINE__);
2960         return;
2961     }
2962     return;
2963 
2964 #else
2965 
2966     return _MApi_AUDIO_SIF_StartAutoStandardDetection();
2967 
2968 #endif
2969 }
2970 
MApi_AUDIO_SIF_GetResultOfAutoStandardDetection(void)2971 AUDIOSTANDARD_TYPE MApi_AUDIO_SIF_GetResultOfAutoStandardDetection(void)
2972 {
2973 
2974 #ifdef UTOPIA_20
2975     MS_U32 u32param[2] = {0, 0};
2976 
2977     if(_AUDIO_IOCtrlOpen() == FALSE)
2978     {
2979         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Get Result of Auto Standard Detection fail\n", __LINE__);
2980         //return;
2981     }
2982 
2983     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SIF_GetResultOfAutoStandardDetection, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
2984     {
2985         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Get Result of Auto Standard Detection fail\n", __LINE__);
2986         //return;
2987     }
2988     return ((AUDIOSTANDARD_TYPE)u32param[1]);
2989 
2990 #else
2991 
2992     return _MApi_AUDIO_SIF_GetResultOfAutoStandardDetection();
2993 
2994 #endif
2995 }
2996 
MApi_AUDIO_SIF_ConvertToBasicAudioStandard(AUDIOSTANDARD_TYPE eStandard)2997 AUDIOSTANDARD_TYPE MApi_AUDIO_SIF_ConvertToBasicAudioStandard(AUDIOSTANDARD_TYPE eStandard)
2998 {
2999 
3000 #ifdef UTOPIA_20
3001     AUDIO_ST_SIF_SIF_CONVERTTOBASICAUDIOSTANDARD Status;
3002     Status.eRet = 0;
3003     Status.eStandard = eStandard;
3004 
3005     if(_AUDIO_IOCtrlOpen() == FALSE)
3006     {
3007         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Convert To Basic Audio Standard fail\n", __LINE__);
3008         //return;
3009     }
3010 
3011     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SIF_ConvertToBasicAudioStandard, &Status) != UTOPIA_STATUS_SUCCESS)
3012     {
3013         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Convert To Basic Audio Standard fail\n", __LINE__);
3014         //return;
3015     }
3016 
3017     return Status.eRet;
3018 
3019 #else
3020 
3021     return _MApi_AUDIO_SIF_ConvertToBasicAudioStandard(eStandard);
3022 
3023 #endif
3024 }
3025 
MApi_AUDIO_SIF_SetThreshold(THR_TBL_TYPE * ThrTbl)3026 void MApi_AUDIO_SIF_SetThreshold(THR_TBL_TYPE *ThrTbl)
3027 {
3028 
3029 #ifdef UTOPIA_20
3030 
3031     if(_AUDIO_IOCtrlOpen() == FALSE)
3032     {
3033         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Set Threshold fail\n", __LINE__);
3034         //return;
3035     }
3036 
3037     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SIF_SetThreshold, (THR_TBL_TYPE *)ThrTbl) != UTOPIA_STATUS_SUCCESS)
3038     {
3039         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Set Threshold fail\n", __LINE__);
3040         //return;
3041     }
3042     return;
3043 
3044 #else
3045 
3046     return _MApi_AUDIO_SIF_SetThreshold(ThrTbl);
3047 
3048 #endif
3049 }
3050 
MApi_AUDIO_SIF_SetPrescale(MS_U8 gain_type,MS_S32 db_value)3051 void MApi_AUDIO_SIF_SetPrescale(MS_U8 gain_type, MS_S32 db_value)
3052 {
3053 
3054 #ifdef UTOPIA_20
3055     AUDIO_ST_SIF_SETPRESCALE Status;
3056     Status.u8GainType = gain_type;
3057     Status.s32DbValue = db_value;
3058 
3059     if(_AUDIO_IOCtrlOpen() == FALSE)
3060     {
3061         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Set Prescale fail\n", __LINE__);
3062         return;
3063     }
3064 
3065     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SIF_SetPrescale, &Status) != UTOPIA_STATUS_SUCCESS)
3066     {
3067         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Set Prescale fail\n", __LINE__);
3068         return;
3069     }
3070     return;
3071 
3072 #else
3073 
3074     return _MApi_AUDIO_SIF_SetPrescale(gain_type, db_value);
3075 
3076 #endif
3077 }
3078 
MApi_AUDIO_SIF_IsPALType(AUDIO_SIF_PAL_TYPE pal_type)3079 MS_BOOL MApi_AUDIO_SIF_IsPALType(AUDIO_SIF_PAL_TYPE pal_type)
3080 {
3081 
3082 #ifdef UTOPIA_20
3083     AUDIO_ST_SIF_SIF_ISPALTYPE Status;
3084     Status.bRet = 0;
3085     Status.ePalType = pal_type;
3086 
3087     if(_AUDIO_IOCtrlOpen() == FALSE)
3088     {
3089         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Is PAL Type fail\n", __LINE__);
3090         //return;
3091     }
3092 
3093     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SIF_IsPALType, &Status) != UTOPIA_STATUS_SUCCESS)
3094     {
3095         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Is PAL Type fail\n", __LINE__);
3096         //return;
3097     }
3098 
3099     return Status.bRet;
3100 
3101 #else
3102 
3103     return _MApi_AUDIO_SIF_IsPALType(pal_type);
3104 
3105 #endif
3106 }
3107 
MApi_AUDIO_SIF_SetPALType(AUDIO_SIF_PAL_TYPE pal_type)3108 void MApi_AUDIO_SIF_SetPALType(AUDIO_SIF_PAL_TYPE pal_type)
3109 {
3110 
3111 #ifdef UTOPIA_20
3112 
3113     MS_U32 u32Param = ((MS_U32)pal_type);
3114 
3115     if(_AUDIO_IOCtrlOpen() == FALSE)
3116     {
3117         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Set PAL Type fail\n", __LINE__);
3118         //return;
3119     }
3120 
3121     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SIF_SetPALType, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
3122     {
3123         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Set PAL Type fail\n", __LINE__);
3124         //return;
3125     }
3126     return;
3127 
3128 #else
3129 
3130     return _MApi_AUDIO_SIF_SetPALType(pal_type);
3131 
3132 #endif
3133 }
3134 
MApi_AUDIO_SIF_SendCmd(En_AUD_SIF_CmdType enAudSifCommand,MS_U8 comm_arg1,MS_U8 comm_arg2)3135 void MApi_AUDIO_SIF_SendCmd(En_AUD_SIF_CmdType enAudSifCommand, MS_U8 comm_arg1, MS_U8 comm_arg2)
3136 {
3137 
3138 #ifdef UTOPIA_20
3139     AUDIO_ST_SIF_SENDCMD Status;
3140     Status.eAudSifCommand = enAudSifCommand;
3141     Status.u8CommArg1 = comm_arg1;
3142     Status.u8CommArg2 = comm_arg2;
3143 
3144     if(_AUDIO_IOCtrlOpen() == FALSE)
3145     {
3146         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Send Cmd fail\n", __LINE__);
3147         //return;
3148     }
3149 
3150     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SIF_SendCmd, &Status) != UTOPIA_STATUS_SUCCESS)
3151     {
3152         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Send Cmd fail\n", __LINE__);
3153         //return;
3154     }
3155     return;
3156 
3157 #else
3158 
3159     return _MApi_AUDIO_SIF_SendCmd(enAudSifCommand, comm_arg1, comm_arg2);
3160 
3161 #endif
3162 }
3163 
MApi_AUDIO_SIF_Shift(En_AUD_VIF_Type type)3164 void MApi_AUDIO_SIF_Shift(En_AUD_VIF_Type type)
3165 {
3166 
3167 #ifdef UTOPIA_20
3168 
3169     MS_U32 u32Param = ((MS_U32)type);
3170 
3171     if(_AUDIO_IOCtrlOpen() == FALSE)
3172     {
3173         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Shift fail\n", __LINE__);
3174         return;
3175     }
3176 
3177     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SIF_Shift, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
3178     {
3179         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SIF Shift fail\n", __LINE__);
3180         return;
3181     }
3182     return;
3183 
3184 #else
3185 
3186     return _MApi_AUDIO_SIF_Shift(type);
3187 
3188 #endif
3189 }
3190 
3191 //============================================================
3192 // AUDIO_FM_RADIO RELATIONAL API FUNCTION
3193 //============================================================
3194 #if 1
MApi_AUDIO_FM_RADIO_GetSoundMode(void)3195 MS_U8 MApi_AUDIO_FM_RADIO_GetSoundMode(void)
3196 {
3197 
3198 #ifdef UTOPIA_20
3199     MS_U32 u32param[2] = {0, 0};
3200 
3201     if(_AUDIO_IOCtrlOpen() == FALSE)
3202     {
3203         ULOGE("AUDIO", "[MAPI AUDIO][%06d] FM Radio Get Sound Mode fail\n", __LINE__);
3204         //return;
3205     }
3206 
3207     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_FM_RADIO_GetSoundMode, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
3208     {
3209         ULOGE("AUDIO", "[MAPI AUDIO][%06d] FM Radio Get Sound Mode fail\n", __LINE__);
3210         //return;
3211     }
3212     return ((MS_U8)u32param[1]);
3213 
3214 #else
3215 
3216     return _MApi_AUDIO_FM_RADIO_GetSoundMode();
3217 
3218 #endif
3219 }
3220 
MApi_AUDIO_FM_RADIO_SetSoundMode(MS_U8 u8FMRadioSoundMode)3221 void MApi_AUDIO_FM_RADIO_SetSoundMode(MS_U8 u8FMRadioSoundMode)
3222 {
3223 
3224 #ifdef UTOPIA_20
3225     MS_U32 u32param = ((MS_U32)u8FMRadioSoundMode);
3226 
3227     if(_AUDIO_IOCtrlOpen() == FALSE)
3228     {
3229         ULOGE("AUDIO", "[MAPI AUDIO][%06d] FM Radio Set Sound Mode fail\n", __LINE__);
3230         return;
3231     }
3232 
3233     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_FM_RADIO_SetSoundMode, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
3234     {
3235         ULOGE("AUDIO", "[MAPI AUDIO][%06d] FM Radio Set Sound Mode fail\n", __LINE__);
3236         return;
3237     }
3238     return;
3239 
3240 #else
3241 
3242     return _MApi_AUDIO_FM_RADIO_SetSoundMode(u8FMRadioSoundMode);
3243 
3244 #endif
3245 }
3246 
MApi_AUDIO_FM_RADIO_DeEmphassisOption(MS_BOOL Is_Europe)3247 void MApi_AUDIO_FM_RADIO_DeEmphassisOption(MS_BOOL Is_Europe)
3248 {
3249 
3250 #ifdef UTOPIA_20
3251     MS_U32 u32param = ((MS_U32)Is_Europe);
3252 
3253     if(_AUDIO_IOCtrlOpen() == FALSE)
3254     {
3255         ULOGE("AUDIO", "[MAPI AUDIO][%06d] FM Radio DeEmphassisOption fail\n", __LINE__);
3256         return;
3257     }
3258 
3259     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_FM_RADIO_DeEmphassisOption, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
3260     {
3261         ULOGE("AUDIO", "[MAPI AUDIO][%06d] FM Radio DeEmphassisOption fail\n", __LINE__);
3262         return;
3263     }
3264     return;
3265 
3266 #else
3267 
3268     return _MApi_AUDIO_FM_RADIO_DeEmphassisOption(Is_Europe);
3269 
3270 #endif
3271 }
3272 
MApi_AUDIO_FM_RADIO_GET_DC_AMP(void)3273 MS_S8 MApi_AUDIO_FM_RADIO_GET_DC_AMP(void)
3274 {
3275 
3276 #ifdef UTOPIA_20
3277     MS_S32 s32param[2] = {0, 0};
3278 
3279     if(_AUDIO_IOCtrlOpen() == FALSE)
3280     {
3281         ULOGE("AUDIO", "[MAPI AUDIO][%06d] FM Radio Get DC AMP fail\n", __LINE__);
3282         //return;
3283     }
3284 
3285     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_FM_RADIO_GetDC_Amp, (void*)s32param) != UTOPIA_STATUS_SUCCESS)
3286     {
3287         ULOGE("AUDIO", "[MAPI AUDIO][%06d] FM Radio Get DC AMP fail\n", __LINE__);
3288         //return;
3289     }
3290     return ((MS_S8)s32param[1]);
3291 
3292 #else
3293 
3294     return _MApi_AUDIO_FM_RADIO_GET_DC_AMP();
3295 
3296 #endif
3297 }
3298 
MApi_AUDIO_FM_RADIO_GET_NSR(void)3299 MS_U8 MApi_AUDIO_FM_RADIO_GET_NSR(void)
3300 {
3301 
3302 #ifdef UTOPIA_20
3303     MS_U32 u32param[2] = {0, 0};
3304 
3305     if(_AUDIO_IOCtrlOpen() == FALSE)
3306     {
3307         ULOGE("AUDIO", "[MAPI AUDIO][%06d] FM Radio Get NSR fail\n", __LINE__);
3308         //return;
3309     }
3310 
3311     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_FM_RADIO_Get_NSR, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
3312     {
3313         ULOGE("AUDIO", "[MAPI AUDIO][%06d] FM Radio Get NSR fail\n", __LINE__);
3314         //return;
3315     }
3316     return ((MS_U8)u32param[1]);
3317 
3318 #else
3319 
3320     return _MApi_AUDIO_FM_RADIO_GET_NSR();
3321 
3322 #endif
3323 }
3324 
MApi_AUDIO_FM_RADIO_RESET(void)3325 void MApi_AUDIO_FM_RADIO_RESET(void)
3326 {
3327 
3328 #ifdef UTOPIA_20
3329 
3330     if(_AUDIO_IOCtrlOpen() == FALSE)
3331     {
3332         ULOGE("AUDIO", "[MAPI AUDIO][%06d] FM Radio Reset fail\n", __LINE__);
3333         return;
3334     }
3335 
3336     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_FM_RADIO_Reset, 0) != UTOPIA_STATUS_SUCCESS)
3337     {
3338         ULOGE("AUDIO", "[MAPI AUDIO][%06d] FM Radio Reset fail\n", __LINE__);
3339         return;
3340     }
3341     return;
3342 
3343 #else
3344 
3345     return _MApi_AUDIO_FM_RADIO_RESET();
3346 
3347 #endif
3348 }
3349 #endif
3350 //=============================================================
3351 // AUDIO_SPDIF RELATIONAL API FUNCTION
3352 //=============================================================
MApi_AUDIO_SPDIF_HWEN(MS_BOOL spdif_en)3353 void MApi_AUDIO_SPDIF_HWEN(MS_BOOL spdif_en)
3354 {
3355 
3356 #ifdef UTOPIA_20
3357     AUDIO_ST_SPDIF_OP Status;
3358     Status.eType = SPDIF_HWEN;
3359     Status.spdif_hwen = spdif_en;
3360     Status.mute_en = FALSE;
3361     Status.spdif_mode = SPDIF_OUT_NONE;
3362 
3363     if(_AUDIO_IOCtrlOpen() == FALSE)
3364     {
3365         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SPDIF HWEN fail\n", __LINE__);
3366         return;
3367     }
3368 
3369     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SPDIF_OP, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
3370     {
3371         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SPDIF HWEN fail\n", __LINE__);
3372         return;
3373     }
3374     return;
3375 
3376 #else
3377 
3378     return _MApi_AUDIO_SPDIF_HWEN(spdif_en);
3379 
3380 #endif
3381 }
3382 
MApi_AUDIO_SPDIF_SetMute(MS_BOOL mute_en)3383 void MApi_AUDIO_SPDIF_SetMute(MS_BOOL mute_en)
3384 {
3385 
3386 #ifdef UTOPIA_20
3387     AUDIO_ST_SPDIF_OP Status;
3388     Status.eType = SPDIF_SETMUTE;
3389     Status.spdif_hwen = FALSE;
3390     Status.mute_en = mute_en;
3391     Status.spdif_mode = SPDIF_OUT_NONE;
3392 
3393     if(_AUDIO_IOCtrlOpen() == FALSE)
3394     {
3395         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SPDIF Set Mute fail\n", __LINE__);
3396         return;
3397     }
3398 
3399     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SPDIF_OP, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
3400     {
3401         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SPDIF Set Mute fail\n", __LINE__);
3402         return;
3403     }
3404     return;
3405 
3406 #else
3407 
3408     return _MApi_AUDIO_SPDIF_SetMute(mute_en);
3409 
3410 #endif
3411 }
3412 
MApi_AUDIO_SPDIF_SetMode(MS_U8 spdif_mode)3413 void MApi_AUDIO_SPDIF_SetMode(MS_U8 spdif_mode)
3414 {
3415 
3416 #ifdef UTOPIA_20
3417     AUDIO_ST_SPDIF_OP Status;
3418     Status.eType = SPDIF_SETMODE;
3419     Status.spdif_hwen = FALSE;
3420     Status.mute_en = FALSE;
3421     Status.spdif_mode = spdif_mode;
3422 
3423     if(_AUDIO_IOCtrlOpen() == FALSE)
3424     {
3425         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SPDIF Set Mode fail\n", __LINE__);
3426         return;
3427     }
3428 
3429     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SPDIF_OP, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
3430     {
3431         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SPDIF Set Mode fail\n", __LINE__);
3432         return;
3433     }
3434 
3435     return;
3436 
3437 #else
3438 
3439     return _MApi_AUDIO_SPDIF_SetMode(spdif_mode);
3440 
3441 #endif
3442 }
3443 
MApi_AUDIO_SPDIF_GetMode(void)3444 MS_U8 MApi_AUDIO_SPDIF_GetMode(void)
3445 {
3446 
3447 #ifdef UTOPIA_20
3448     AUDIO_ST_SPDIF_OP Status;
3449     Status.eType = SPDIF_GETMODE;
3450     Status.spdif_hwen = FALSE;
3451     Status.mute_en = FALSE;
3452     Status.spdif_mode = SPDIF_OUT_NONE;
3453 
3454     if(_AUDIO_IOCtrlOpen() == FALSE)
3455     {
3456         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SPDIF Get Mode fail\n", __LINE__);
3457         //return;
3458     }
3459 
3460     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SPDIF_OP, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
3461     {
3462         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SPDIF Get Mode fail\n", __LINE__);
3463         //return;
3464     }
3465     return Status.spdif_mode;
3466 
3467 #else
3468 
3469     return _MApi_AUDIO_SPDIF_GetMode();
3470 
3471 #endif
3472 }
3473 
MApi_AUDIO_SPDIF_SetSCMS(MS_U8 C_bit_en,MS_U8 L_bit_en)3474 void MApi_AUDIO_SPDIF_SetSCMS(MS_U8 C_bit_en, MS_U8 L_bit_en)
3475 {
3476 
3477 #ifdef UTOPIA_20
3478     AUDIO_ST_SPDIF_SCMS Status;
3479     Status.bSetSCMS = TRUE;
3480     Status.C_bit_en = C_bit_en;
3481     Status.L_bit_en = L_bit_en;
3482     Status.Ret_bit = 0;
3483 
3484     if(_AUDIO_IOCtrlOpen() == FALSE)
3485     {
3486         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SPDIF Set SCMS fail\n", __LINE__);
3487         return;
3488     }
3489 
3490     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SPDIF_SCMS, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
3491     {
3492         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SPDIF Set SCMS fail\n", __LINE__);
3493         return;
3494     }
3495     return;
3496 
3497 #else
3498 
3499     return _MApi_AUDIO_SPDIF_SetSCMS(C_bit_en, L_bit_en);
3500 
3501 #endif
3502 }
3503 
MApi_AUDIO_SPDIF_GetSCMS(void)3504 MS_U8 MApi_AUDIO_SPDIF_GetSCMS(void)
3505 {
3506 
3507 #ifdef UTOPIA_20
3508     AUDIO_ST_SPDIF_SCMS Status;
3509     Status.bSetSCMS = FALSE;
3510     Status.C_bit_en = 0;
3511     Status.L_bit_en = 0;
3512     Status.Ret_bit = 0;
3513 
3514     if(_AUDIO_IOCtrlOpen() == FALSE)
3515     {
3516         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SPDIF Get SCMS fail\n", __LINE__);
3517         //return;
3518     }
3519 
3520     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SPDIF_SCMS, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
3521     {
3522         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SPDIF Get SCMS fail\n", __LINE__);
3523         //return;
3524     }
3525     return Status.Ret_bit;
3526 
3527 #else
3528 
3529     return _MApi_AUDIO_SPDIF_GetSCMS();
3530 
3531 #endif
3532 }
3533 
MApi_Audio_SPDIF_Monitor(void)3534 void MApi_Audio_SPDIF_Monitor(void)
3535 {
3536 
3537 #ifdef UTOPIA_20
3538 
3539     if(_AUDIO_IOCtrlOpen() == FALSE)
3540     {
3541         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SPDIF Monitor fail\n", __LINE__);
3542         return;
3543     }
3544 
3545     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SPDIF_Monitor, 0) != UTOPIA_STATUS_SUCCESS)
3546     {
3547         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SPDIF Monitor fail\n", __LINE__);
3548         return;
3549     }
3550     return;
3551 
3552 #else
3553 
3554     return _MApi_Audio_SPDIF_Monitor();
3555 
3556 #endif
3557 }
3558 
MApi_AUDIO_SPDIF_ChannelStatus_CTRL(AUDIO_SPDIF_CS_TYPE cs_mode,AUDIO_SPDIF_CS_TYPE_STATUS status)3559 MS_BOOL MApi_AUDIO_SPDIF_ChannelStatus_CTRL(AUDIO_SPDIF_CS_TYPE cs_mode, AUDIO_SPDIF_CS_TYPE_STATUS status)
3560 {
3561 
3562 #ifdef UTOPIA_20
3563     AUDIO_ST_SPDIF_CHANNELSTATUS_CTRL Status;
3564     Status.bRet = 0;
3565     Status.eCsMode = cs_mode;
3566     Status.eStatus = status;
3567 
3568     if(_AUDIO_IOCtrlOpen() == FALSE)
3569     {
3570         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SPDIF Channel Status CTRL fail\n", __LINE__);
3571         //return;
3572     }
3573 
3574     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SPDIF_ChannelStatus_CTRL, &Status) != UTOPIA_STATUS_SUCCESS)
3575     {
3576         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SPDIF Channel Status CTRL fail\n", __LINE__);
3577         //return;
3578     }
3579 
3580     return Status.bRet;
3581 
3582 #else
3583 
3584     return _MApi_AUDIO_SPDIF_ChannelStatus_CTRL(cs_mode, status);
3585 
3586 #endif
3587 }
3588 
MApi_AUDIO_DigitalOut_SetChannelStatus(DIGITAL_OUTPUT_TYPE ePath,Digital_Out_Channel_Status_t * stChannelStatus)3589 MS_BOOL MApi_AUDIO_DigitalOut_SetChannelStatus(DIGITAL_OUTPUT_TYPE ePath, Digital_Out_Channel_Status_t *stChannelStatus)
3590 {
3591 
3592 #ifdef UTOPIA_20
3593     AUDIO_ST_DIGITALOUT_SETCHANNELSTATUS Status;
3594     Status.bStatus = FALSE;
3595     Status.ePath = ePath;
3596     Status.stChannelStatus = stChannelStatus;
3597 
3598     if(_AUDIO_IOCtrlOpen() == FALSE)
3599     {
3600         ULOGE("AUDIO", "[MAPI AUDIO][%06d] DigitalOut Set Channel Status fail\n", __LINE__);
3601         //return;
3602     }
3603 
3604     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_DigitalOut_SetChannelStatus, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
3605     {
3606         ULOGE("AUDIO", "[MAPI AUDIO][%06d] DigitalOut Set Channel Status fail\n", __LINE__);
3607         //return;
3608     }
3609     return Status.bStatus;
3610 
3611 #else
3612 
3613     return _MApi_AUDIO_DigitalOut_SetChannelStatus(ePath, stChannelStatus);
3614 
3615 #endif
3616 }
3617 
MApi_AUDIO_DigitalOut_SetDeviceCapability(DIGITAL_OUTPUT_TYPE eoutType,AUDIO_FORMAT_CODE ecodecType,Digital_Out_Device_Capability_t * p_codecCapability)3618 MS_BOOL MApi_AUDIO_DigitalOut_SetDeviceCapability(DIGITAL_OUTPUT_TYPE eoutType, AUDIO_FORMAT_CODE ecodecType, Digital_Out_Device_Capability_t *p_codecCapability)
3619 {
3620 
3621 #ifdef UTOPIA_20
3622     AUDIO_ST_DIGITALOUT_SETDEVICECAP Status;
3623     Status.bStatus = FALSE;
3624     Status.eoutType = eoutType;
3625     Status.ecodecType = ecodecType;
3626     Status.p_codecCapability = p_codecCapability;
3627 
3628     if(_AUDIO_IOCtrlOpen() == FALSE)
3629     {
3630         ULOGE("AUDIO", "[MAPI AUDIO][%06d] DigitalOut Set Device Capability fail\n", __LINE__);
3631         //return;
3632     }
3633 
3634     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_DigitalOut_SetDeviceCapability, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
3635     {
3636         ULOGE("AUDIO", "[MAPI AUDIO][%06d] DigitalOut Set DeviceCapability fail\n", __LINE__);
3637         //return;
3638     }
3639     return Status.bStatus;
3640 
3641 #else
3642     return _MApi_AUDIO_DigitalOut_SetDeviceCapability(eoutType, ecodecType, p_codecCapability);
3643 #endif
3644 }
3645 
3646 // unused
3647 /*void MApi_AUDIO_DigitalOut_GetChannelStatus(DIGITAL_OUTPUT_TYPE ePath, Digital_Out_Channel_Status_t *stChannelStatus)
3648 {
3649 
3650 #ifdef UTOPIA_20
3651     if (_AUDIO_IOCtrlOpen() == FALSE)
3652     {
3653         ULOGE("AUDIO", "[MAPI AUDIO][%06d] DigitalOut Get Channel Status fail\n", __LINE__);
3654         //return;
3655     }
3656 
3657     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_DigitalOut_GetChannelStatus, (void*)stChannelStatus) != UTOPIA_STATUS_SUCCESS)
3658     {
3659         ULOGE("AUDIO", "[MAPI AUDIO][%06d] DigitalOut Get Channel Status fail\n", __LINE__);
3660         //return;
3661     }
3662 #else
3663     return _MApi_AUDIO_DigitalOut_GetChannelStatus(ePath, stChannelStatus);
3664 #endif
3665 }*/
3666 
3667 //=============================================================
3668 // AUDIO_HDMI RELATIONAL API FUNCTION
3669 //=============================================================
MApi_AUDIO_HDMI_Tx_SetMute(MS_BOOL mute_en)3670 void MApi_AUDIO_HDMI_Tx_SetMute(MS_BOOL mute_en)
3671 {
3672 
3673 #ifdef UTOPIA_20
3674     MS_U32 u32param = ((MS_U32)mute_en);
3675 
3676     if(_AUDIO_IOCtrlOpen() == FALSE)
3677     {
3678         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI Tx Set Mute fail\n", __LINE__);
3679         return;
3680     }
3681 
3682     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_HDMI_Tx_SetMute, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
3683     {
3684         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI Tx Set MuteL fail\n", __LINE__);
3685         return;
3686     }
3687     return;
3688 
3689 #else
3690 
3691     return _MApi_AUDIO_HDMI_Tx_SetMute(mute_en);
3692 
3693 #endif
3694 }
3695 
MApi_AUDIO_HDMI_Tx_GetStatus(MS_BOOL * onOff,AUDIO_FS_TYPE * hdmi_SmpFreq,HDMI_TX_OUTPUT_TYPE * outType)3696 void MApi_AUDIO_HDMI_Tx_GetStatus(MS_BOOL *onOff, AUDIO_FS_TYPE *hdmi_SmpFreq, HDMI_TX_OUTPUT_TYPE *outType )
3697 {
3698 
3699 #ifdef UTOPIA_20
3700 
3701     AUDIO_HDMI_TX_GETSTATUS Status;
3702 
3703     Status.onOff = FALSE;
3704     Status.hdmi_smpFreq = AUDIO_FS_NONE;
3705     Status.outType = HDMI_OUT_PCM;
3706 
3707     if(_AUDIO_IOCtrlOpen() == FALSE)
3708     {
3709         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI TX Get Status fail\n", __LINE__);
3710         return;
3711     }
3712 
3713     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_HDMI_Tx_GetStatus, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
3714     {
3715         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI TX Get Status fail\n", __LINE__);
3716         return;
3717     }
3718     *onOff = Status.onOff;
3719     *hdmi_SmpFreq = Status.hdmi_smpFreq;
3720     *outType = Status.outType;
3721 
3722     return;
3723 
3724 #else
3725 
3726     return _MApi_AUDIO_HDMI_Tx_GetStatus(onOff, hdmi_SmpFreq, outType);
3727 
3728 #endif
3729 }
3730 
MApi_AUDIO_HDMI_Monitor(void)3731 MS_U8 MApi_AUDIO_HDMI_Monitor(void)
3732 {
3733 
3734 #ifdef UTOPIA_20
3735     MS_U32 u32param[2] = {0, 0};
3736 
3737     if(_AUDIO_IOCtrlOpen() == FALSE)
3738     {
3739         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI Monitor fail\n", __LINE__);
3740         //return;
3741     }
3742 
3743     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_HDMI_Monitor, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
3744     {
3745         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI Monitor fail\n", __LINE__);
3746         //return;
3747     }
3748     return ((MS_U8)u32param[1]);
3749 
3750 #else
3751 
3752     return _MApi_AUDIO_HDMI_Monitor();
3753 
3754 #endif
3755 }
3756 
MApi_AUDIO_HDMI_GetNonpcmFlag(void)3757 MS_BOOL MApi_AUDIO_HDMI_GetNonpcmFlag(void)
3758 {
3759 
3760 #ifdef UTOPIA_20
3761     MS_U32 u32param[2] = {0, 0};
3762 
3763     if(_AUDIO_IOCtrlOpen() == FALSE)
3764     {
3765         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI Get NonPCM Flag fail\n", __LINE__);
3766         //return;
3767     }
3768 
3769     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_HDMI_GetNonpcmFlag, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
3770     {
3771         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI Get NonPCM Flag fail\n", __LINE__);
3772         //return;
3773     }
3774     return ((MS_BOOL)u32param[1]);
3775 
3776 #else
3777 
3778     return _MApi_AUDIO_HDMI_GetNonpcmFlag();
3779 
3780 #endif
3781 }
3782 
MApi_AUDIO_HDMI_SetNonpcm(MS_U8 nonPCM_en)3783 void MApi_AUDIO_HDMI_SetNonpcm(MS_U8 nonPCM_en)     //[Q] should be replace by MApi_AUDIO_HDMI_RX_SetNonpcm
3784 {
3785 
3786 #ifdef UTOPIA_20
3787     MS_U32 u32param = ((MS_U32)nonPCM_en);
3788 
3789     if(_AUDIO_IOCtrlOpen() == FALSE)
3790     {
3791         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI Set NonPCM fail\n", __LINE__);
3792         return;
3793     }
3794 
3795     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_HDMI_SetNonpcm, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
3796     {
3797         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI Set NonPCM fail\n", __LINE__);
3798         return;
3799     }
3800     return;
3801 
3802 #else
3803 
3804     return _MApi_AUDIO_HDMI_SetNonpcm(nonPCM_en);
3805 
3806 #endif
3807 }
3808 
MApi_AUDIO_HDMI_RX_SetNonpcm(MS_U8 nonPCM_en)3809 AUDIO_HDMI_RX_TYPE MApi_AUDIO_HDMI_RX_SetNonpcm(MS_U8 nonPCM_en)
3810 {
3811 
3812 #ifdef UTOPIA_20
3813     AUDIO_ST_HDMI_NONPCM_OP Status;
3814     Status.bSet = TRUE;
3815     Status.nonPCM_en = nonPCM_en;
3816     Status.eRet = HDMI_RX_PCM;
3817 
3818     if(_AUDIO_IOCtrlOpen() == FALSE)
3819     {
3820         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI RX Set Non PCM fail\n", __LINE__);
3821         //return;
3822     }
3823 
3824     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_HDMI_Nonpcm_OP, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
3825     {
3826         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI RX Set Non PCM fail\n", __LINE__);
3827         //return;
3828     }
3829     return Status.eRet;
3830 
3831 #else
3832 
3833     return _MApi_AUDIO_HDMI_RX_SetNonpcm(nonPCM_en);
3834 
3835 #endif
3836 }
3837 
MApi_AUDIO_HDMI_RX_GetNonPCM(void)3838 AUDIO_HDMI_RX_TYPE MApi_AUDIO_HDMI_RX_GetNonPCM(void)
3839 {
3840 
3841 #ifdef UTOPIA_20
3842     AUDIO_ST_HDMI_NONPCM_OP Status;
3843     Status.bSet = FALSE;
3844     Status.nonPCM_en = 0;
3845     Status.eRet = HDMI_RX_PCM;
3846 
3847     if(_AUDIO_IOCtrlOpen() == FALSE)
3848     {
3849         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI RX Get Non PCM fail\n", __LINE__);
3850         //return;
3851     }
3852 
3853     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_HDMI_Nonpcm_OP, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
3854     {
3855         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI RX Get Non PCM fail\n", __LINE__);
3856         //return;
3857     }
3858     return Status.eRet;
3859 
3860 #else
3861 
3862     return _MApi_AUDIO_HDMI_RX_GetNonPCM();
3863 
3864 #endif
3865 }
3866 
MApi_AUDIO_DTV_HDMI_CFG(MS_U8 ctrl)3867 void MApi_AUDIO_DTV_HDMI_CFG(MS_U8 ctrl)
3868 {
3869 
3870 #ifdef UTOPIA_20
3871     MS_U32 u32param = ((MS_U32)ctrl);
3872 
3873     if(_AUDIO_IOCtrlOpen() == FALSE)
3874     {
3875         ULOGE("AUDIO", "[MAPI AUDIO][%06d] DTV HDMI CFG fail\n", __LINE__);
3876         return;
3877     }
3878 
3879     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_DTV_HDMI_CFG, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
3880     {
3881         ULOGE("AUDIO", "[MAPI AUDIO][%06d] DTV HDMI CFG fail\n", __LINE__);
3882         return;
3883     }
3884     return;
3885 
3886 #else
3887 
3888     return _MApi_AUDIO_DTV_HDMI_CFG(ctrl);
3889 
3890 #endif
3891 }
3892 
MApi_AUDIO_HDMI_GetSynthFreq(void)3893 MS_U16 MApi_AUDIO_HDMI_GetSynthFreq(void)
3894 {
3895 
3896 #ifdef UTOPIA_20
3897     MS_U32 u32param[2] = {0, 0};
3898 
3899     if(_AUDIO_IOCtrlOpen() == FALSE)
3900     {
3901         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI Get Synth Freq fail\n", __LINE__);
3902         //return;
3903     }
3904 
3905     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_HDMI_GetSynthFreq, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
3906     {
3907         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI Get Synth Freq fail\n", __LINE__);
3908         //return;
3909     }
3910     return ((MS_U16)u32param[1]);
3911 
3912 #else
3913 
3914     return _MApi_AUDIO_HDMI_GetSynthFreq();
3915 
3916 #endif
3917 }
3918 
MApi_AUDIO_HDMI_SetDownSample(MS_U8 ratio)3919 void MApi_AUDIO_HDMI_SetDownSample(MS_U8 ratio)
3920 {
3921 
3922 #ifdef UTOPIA_20
3923     MS_U32 u32param = ((MS_U32)ratio);
3924 
3925     if(_AUDIO_IOCtrlOpen() == FALSE)
3926     {
3927         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI Set Down Sample fail\n", __LINE__);
3928         return;
3929     }
3930 
3931     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_HDMI_SetDownSample, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
3932     {
3933         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI Set Down Sample fail\n", __LINE__);
3934         return;
3935     }
3936     return;
3937 
3938 #else
3939 
3940     return _MApi_AUDIO_HDMI_SetDownSample(ratio);
3941 
3942 #endif
3943 }
3944 
MApi_AUDIO_HDMI_TX_SetMode(HDMI_TX_OUTPUT_TYPE outType)3945 void MApi_AUDIO_HDMI_TX_SetMode(HDMI_TX_OUTPUT_TYPE outType)
3946 {
3947 
3948 #ifdef UTOPIA_20
3949     MS_U32 u32param = ((MS_U32)outType);
3950 
3951     if(_AUDIO_IOCtrlOpen() == FALSE)
3952     {
3953         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI TX Set Mode fail\n", __LINE__);
3954         return;
3955     }
3956 
3957     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_HDMI_TX_SetMode, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
3958     {
3959         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI TX Set Mode fail\n", __LINE__);
3960         return;
3961     }
3962     return;
3963 
3964 #else
3965 
3966     return _MApi_AUDIO_HDMI_TX_SetMode(outType);
3967 
3968 #endif
3969 }
3970 
MApi_AUDIO_HDMI_RX_GetHdmiInAudioStatus(ST_HDMI_AUDIO_STATUS * p_hdmiAudioSts)3971 MS_BOOL MApi_AUDIO_HDMI_RX_GetHdmiInAudioStatus(ST_HDMI_AUDIO_STATUS *p_hdmiAudioSts)
3972 {
3973 
3974 #ifdef UTOPIA_20
3975 
3976     AUDIO_ST_RX_HDMI_AUDIO_STATUS Status;
3977 
3978     Status.bStatus = FALSE;
3979     Status.pHdmi_status = p_hdmiAudioSts;
3980 
3981     if(_AUDIO_IOCtrlOpen() == FALSE)
3982     {
3983         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI RX Get HDMI Audio Status fail\n", __LINE__);
3984         //return;
3985     }
3986 
3987     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_HDMI_RX_GetHdmiInAudioStatus, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
3988     {
3989         ULOGE("AUDIO", "[MAPI AUDIO][%06d] HDMI RX Get HDMI Audio Status fail\n", __LINE__);
3990         //return;
3991     }
3992     return Status.bStatus;
3993 
3994 #else
3995 
3996     return _MApi_AUDIO_HDMI_RX_GetHdmiInAudioStatus(p_hdmiAudioSts);
3997 
3998 #endif
3999 
4000 }
4001 //=============================================================
4002 // AUDIO_ADVANCE_SOUND RELATIONAL API FUNCTION
4003 //=============================================================
MApi_AUDIO_ADVSOUND_ProcessEnable(ADVSND_TYPE type)4004 MS_BOOL MApi_AUDIO_ADVSOUND_ProcessEnable(ADVSND_TYPE type)
4005 {
4006 
4007 #ifdef UTOPIA_20
4008     AUDIO_ST_ADVSOUND_PROCESSENABLE Status;
4009     Status.bRet = 0;
4010     Status.eType = type;
4011 
4012     if(_AUDIO_IOCtrlOpen() == FALSE)
4013     {
4014         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ADVSOUND Precess Enable fail\n", __LINE__);
4015         //return;
4016     }
4017 
4018     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_ADVSOUND_ProcessEnable, &Status) != UTOPIA_STATUS_SUCCESS)
4019     {
4020         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ADVSOUND Precess Enable fail\n", __LINE__);
4021         //return;
4022     }
4023 
4024     return Status.bRet;
4025 
4026 #else
4027 
4028     return _MApi_AUDIO_ADVSOUND_ProcessEnable(type);
4029 
4030 #endif
4031 }
4032 
MApi_AUDIO_ADVSOUND_SubProcessEnable(ADVFUNC proc,MS_BOOL enable)4033 MS_BOOL MApi_AUDIO_ADVSOUND_SubProcessEnable(ADVFUNC proc, MS_BOOL enable)
4034 {
4035 
4036 #ifdef UTOPIA_20
4037     AUDIO_ST_ADVSOUND_SUBPROCESSENABLE Status;
4038     Status.bRet = 0;
4039     Status.eProc = proc;
4040     Status.bEnable = enable;
4041 
4042     if(_AUDIO_IOCtrlOpen() == FALSE)
4043     {
4044         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ADVSOUND Sub Process Enable fail\n", __LINE__);
4045         //return;
4046     }
4047 
4048     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_ADVSOUND_SubProcessEnable, &Status) != UTOPIA_STATUS_SUCCESS)
4049     {
4050         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ADVSOUND Sub Precess Enable fail\n", __LINE__);
4051         //return;
4052     }
4053 
4054     return Status.bRet;
4055 
4056 #else
4057 
4058     return _MApi_AUDIO_ADVSOUND_SubProcessEnable(proc, enable);
4059 
4060 #endif
4061 }
4062 
MApi_AUDIO_ADVSOUND_SetParam(ADVSND_PARAM param,MS_U16 u16value1,MS_U16 u16value2)4063 MS_BOOL MApi_AUDIO_ADVSOUND_SetParam(ADVSND_PARAM param, MS_U16 u16value1, MS_U16 u16value2)
4064 {
4065 
4066 #ifdef UTOPIA_20
4067     AUDIO_ST_ADVSOUND_SETPARAM Status;
4068     Status.bRet = 0;
4069     Status.eParam = param;
4070     Status.u16Value1 = u16value1;
4071     Status.u16Value2 = u16value2;
4072 
4073     if(_AUDIO_IOCtrlOpen() == FALSE)
4074     {
4075         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ADVSOUND Set Param fail\n", __LINE__);
4076         //return;
4077     }
4078 
4079     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_ADVSOUND_SetParam, &Status) != UTOPIA_STATUS_SUCCESS)
4080     {
4081         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ADVSOUND Set Param fail\n", __LINE__);
4082         //return;
4083     }
4084 
4085     return Status.bRet;
4086 
4087 #else
4088 
4089     return _MApi_AUDIO_ADVSOUND_SetParam(param, u16value1, u16value2);
4090 
4091 #endif
4092 }
4093 
MApi_AUDIO_ADVSND_SetParam(ADVSND_PARAM param,MS_U32 u32value1,MS_U16 u16value2)4094 MS_BOOL MApi_AUDIO_ADVSND_SetParam(ADVSND_PARAM param, MS_U32 u32value1, MS_U16 u16value2)
4095 {
4096 
4097 #ifdef UTOPIA_20
4098     AUDIO_ST_ADVSND_SETPARAM Status;
4099     Status.bRet = 0;
4100     Status.eParam = param;
4101     Status.u32Value1 = u32value1;
4102     Status.u16Value2 = u16value2;
4103 
4104     if(_AUDIO_IOCtrlOpen() == FALSE)
4105     {
4106         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ADVSND Set Param fail\n", __LINE__);
4107         //return;
4108     }
4109 
4110     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_ADVSND_SetParam, &Status) != UTOPIA_STATUS_SUCCESS)
4111     {
4112         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ADVSND Set Param fail\n", __LINE__);
4113         //return;
4114     }
4115 
4116     return Status.bRet;
4117 
4118 #else
4119 
4120     return _MApi_AUDIO_ADVSND_SetParam(param, u32value1, u16value2);
4121 
4122 #endif
4123 }
4124 
4125 /*MS_U32 MApi_AUDIO_ADVSOUND_GetParam(ADVSND_GET_PARAM param)
4126 {
4127 
4128 #ifdef UTOPIA_20
4129     MS_U32 u32param[2] = {0};
4130     u32param[1] = ((MS_U32)param);
4131 
4132     if(_AUDIO_IOCtrlOpen() == FALSE)
4133     {
4134         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ADVSOUND Get Param fail\n", __LINE__);
4135         //return;
4136     }
4137 
4138     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_ADVSOUND_GetParam, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
4139     {
4140         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ADVSOUND Get Param fail\n", __LINE__);
4141         //return;
4142     }
4143     return (MS_U32)u32param[0];
4144 
4145 #else
4146 
4147     return _MApi_AUDIO_ADVSOUND_GetParam(param);
4148 
4149 #endif
4150 }
4151 
4152 MS_BOOL MApi_AUDIO_ADVSOUND_SetASFParam(ADVSND_PARAM param, MS_S16 s16value1, MS_S16 s16value2)
4153 {
4154 
4155 #ifdef UTOPIA_20
4156     AUDIO_ST_ADVSND_SETASFPARAM Status;
4157     Status.bRet = 0;
4158     Status.eParam = param;
4159     Status.s16Value1 = s16value1;
4160     Status.s16Value2 = s16value2;
4161 
4162     if(_AUDIO_IOCtrlOpen() == FALSE)
4163     {
4164         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ADVSOUND Set ASF Param fail\n", __LINE__);
4165         //return;
4166     }
4167 
4168     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_ADVSOUND_SET_ASF_PARAM, &Status) != UTOPIA_STATUS_SUCCESS)
4169     {
4170         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ADVSOUND Set ASF Param fail\n", __LINE__);
4171         //return;
4172     }
4173     return Status.bRet;
4174 #else
4175 
4176     return _MApi_AUDIO_ADVSOUND_SetASFParam(param, s16value1, s16value2);
4177 
4178 #endif
4179 }
4180 
4181 MS_U32 MApi_AUDIO_ADVSOUND_GetASFParam(ADVSND_GET_PARAM param)
4182 {
4183 
4184 #ifdef UTOPIA_20
4185     MS_U32 u32param[2] = {0};
4186     u32param[1] = ((MS_U32)param);
4187 
4188     if(_AUDIO_IOCtrlOpen() == FALSE)
4189     {
4190         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ADVSOUND Get ASF Param fail\n", __LINE__);
4191         //return;
4192     }
4193 
4194     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_ADVSOUND_GET_ASF_PARAM, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
4195     {
4196         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ADVSOUND Get ASF Param fail\n", __LINE__);
4197         //return;
4198     }
4199     return (MS_U32)u32param[0];
4200 
4201 #else
4202 
4203     return _MApi_AUDIO_ADVSOUND_GetASFParam(param);
4204 
4205 #endif
4206 }*/
4207 
MApi_AUDIO_ADVSOUND_GetInfo(AdvSound_GET_Type Type)4208 MS_U32 MApi_AUDIO_ADVSOUND_GetInfo(AdvSound_GET_Type Type)
4209 {
4210 
4211 #ifdef UTOPIA_20
4212     AUDIO_ST_SRS_ADVSOUND_GETINFO Status;
4213     Status.u32Ret = 0;
4214     Status.eType = Type;
4215 
4216     if(_AUDIO_IOCtrlOpen() == FALSE)
4217     {
4218         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ADVSOUND Get Info fail\n", __LINE__);
4219         //return;
4220     }
4221 
4222     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_ADVSOUND_GetInfo, &Status) != UTOPIA_STATUS_SUCCESS)
4223     {
4224         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ADVSOUND Get Info fail\n", __LINE__);
4225         //return;
4226     }
4227 
4228     return Status.u32Ret;
4229 
4230 #else
4231 
4232     return _MApi_AUDIO_ADVSOUND_GetInfo(Type);
4233 
4234 #endif
4235 }
4236 
MApi_DBXTV_SetMode(EN_DBXTV_TotSonMode totsonmode,EN_DBXTV_TotVolMode totvolmode,EN_DBXTV_TotSurMode totsurmode,MS_U32 enable)4237 void MApi_DBXTV_SetMode(EN_DBXTV_TotSonMode totsonmode, EN_DBXTV_TotVolMode totvolmode, EN_DBXTV_TotSurMode totsurmode,MS_U32 enable)
4238 {
4239 
4240 #ifdef UTOPIA_20
4241     AUDIO_ST_DBXTV_SETMODE Status;
4242     Status.eTotSonMode = totsonmode;
4243     Status.eTotVolMode = totvolmode;
4244     Status.eTotSurMode = totsurmode;
4245     Status.u32Enable = enable;
4246 
4247     if(_AUDIO_IOCtrlOpen() == FALSE)
4248     {
4249         ULOGE("AUDIO", "[MAPI AUDIO][%06d] DBXTV Set Mode fail\n", __LINE__);
4250         return;
4251     }
4252 
4253     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_DBXTV_SetMode, &Status) != UTOPIA_STATUS_SUCCESS)
4254     {
4255         ULOGE("AUDIO", "[MAPI AUDIO][%06d] DBXTV Set Mode fail\n", __LINE__);
4256         return;
4257     }
4258     return;
4259 
4260 #else
4261 
4262     return _MApi_DBXTV_SetMode(totsonmode, totvolmode, totsurmode, enable);
4263 
4264 #endif
4265 }
4266 
MApi_AUDIO_SeInit(void)4267 void MApi_AUDIO_SeInit(void)
4268 {
4269 
4270 #ifdef UTOPIA_20
4271 
4272     if(_AUDIO_IOCtrlOpen() == FALSE)
4273     {
4274         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Se Init fail\n", __LINE__);
4275         return;
4276     }
4277 
4278     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SeInit, 0) != UTOPIA_STATUS_SUCCESS)
4279     {
4280         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Se Init fail\n", __LINE__);
4281         return;
4282     }
4283     return;
4284 
4285 #else
4286 
4287     return _MApi_AUDIO_SeInit();
4288 
4289 #endif
4290 }
4291 
MApi_AUDIO_SetAdvSndSys(En_DVB_advsndType u8AdvSurrMod)4292 void MApi_AUDIO_SetAdvSndSys(En_DVB_advsndType u8AdvSurrMod)
4293 {
4294 
4295 #ifdef UTOPIA_20
4296     AUDIO_ST_SETADVSNDSYS Status;
4297     Status.eType = u8AdvSurrMod;
4298 
4299     if (_AUDIO_IOCtrlOpen() == FALSE)
4300     {
4301         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Adv Snd Sys fail\n", __LINE__);
4302         return;
4303     }
4304 
4305     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetAdvSndSys, &Status) != UTOPIA_STATUS_SUCCESS)
4306     {
4307         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Adv Snd Sys fail\n", __LINE__);
4308         return;
4309     }
4310     return;
4311 
4312 #else
4313 
4314     return _MApi_AUDIO_SetAdvSndSys(u8AdvSurrMod);
4315 
4316 #endif
4317 }
4318 
4319 /*void MApi_AUDIO_ADVSND_Set_Sound_Param(AdvSound_SET_Type Type, MS_U32 *pParam) // New api for cover below functions
4320 {
4321 
4322 #ifdef UTOPIA_20
4323     AUDIO_ST_ADV_SOUND_SETPARAM Status;
4324     Status.eType = Type;
4325     Status.pParam = pParam;
4326 
4327     if(_AUDIO_IOCtrlOpen() == FALSE)
4328     {
4329         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set VDS fail\n", __LINE__);
4330         return;
4331     }
4332 
4333     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_ADV_SOUND_SET, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
4334     {
4335         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set VDS fail\n", __LINE__);
4336         return;
4337     }
4338     return;
4339 
4340 #else
4341 
4342     return _MApi_AUDIO_ADVSND_Set_Sound_Param(Type, pParam);
4343 
4344 #endif
4345 
4346 }*/
4347 
MApi_AUDIO_SetVDS(MS_U8 u8enVDS)4348 void MApi_AUDIO_SetVDS(MS_U8 u8enVDS)
4349 {
4350 
4351 #ifdef UTOPIA_20
4352 
4353     MS_U32 u32param = ((MS_U32)u8enVDS);
4354 
4355     if(_AUDIO_IOCtrlOpen() == FALSE)
4356     {
4357         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set VDS fail\n", __LINE__);
4358         return;
4359     }
4360 
4361     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetVDS, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
4362     {
4363         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set VDS fail\n", __LINE__);
4364         return;
4365     }
4366     return;
4367 
4368 #else
4369 
4370     return _MApi_AUDIO_SetVDS(u8enVDS);
4371 
4372 #endif
4373 }
4374 
MApi_AUDIO_SetVSPK(MS_U8 u8enVSPK)4375 void MApi_AUDIO_SetVSPK(MS_U8 u8enVSPK)
4376 {
4377 
4378 #ifdef UTOPIA_20
4379 
4380     MS_U32 u32param = ((MS_U32)u8enVSPK);
4381 
4382     if(_AUDIO_IOCtrlOpen() == FALSE)
4383     {
4384         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set VSPK fail\n", __LINE__);
4385         return;
4386     }
4387 
4388     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetVSPK, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
4389     {
4390         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set VSPK fail\n", __LINE__);
4391         return;
4392     }
4393     return;
4394 
4395 #else
4396 
4397     return _MApi_AUDIO_SetVSPK(u8enVSPK);
4398 
4399 #endif
4400 }
4401 
MApi_AUDIO_SetSRS(MS_U8 u8enSRS)4402 void MApi_AUDIO_SetSRS(MS_U8 u8enSRS)
4403 {
4404 
4405 #ifdef UTOPIA_20
4406 
4407     MS_U32 u32param = ((MS_U32)u8enSRS);
4408 
4409     if(_AUDIO_IOCtrlOpen() == FALSE)
4410     {
4411         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set SRS fail\n", __LINE__);
4412         return;
4413     }
4414 
4415     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetSRS, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
4416     {
4417         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set SRS fail\n", __LINE__);
4418         return;
4419     }
4420     return;
4421 
4422 #else
4423 
4424     return _MApi_AUDIO_SetSRS(u8enSRS);
4425 
4426 #endif
4427 }
4428 
MApi_AUDIO_SetBBE(MS_U8 u8enBBE,MS_U8 u8BBEMode)4429 void MApi_AUDIO_SetBBE(MS_U8 u8enBBE , MS_U8 u8BBEMode)
4430 {
4431 
4432 #ifdef UTOPIA_20
4433     AUDIO_ST_SETBBE Status;
4434     Status.u8EnBBE = u8enBBE;
4435     Status.u8BBEMode = u8BBEMode;
4436 
4437     if(_AUDIO_IOCtrlOpen() == FALSE)
4438     {
4439         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set BBE fail\n", __LINE__);
4440         return;
4441     }
4442 
4443     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetBBE, &Status) != UTOPIA_STATUS_SUCCESS)
4444     {
4445         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set BBE fail\n", __LINE__);
4446         return;
4447     }
4448     return;
4449 
4450 #else
4451 
4452     return _MApi_AUDIO_SetBBE(u8enBBE, u8BBEMode);
4453 
4454 #endif
4455 }
4456 
MApi_AUDIO_VSPK_WMod(MS_U8 u8VSPK_WMode)4457 void MApi_AUDIO_VSPK_WMod(MS_U8 u8VSPK_WMode)
4458 {
4459 
4460 #ifdef UTOPIA_20
4461 
4462     MS_U32 u32param = ((MS_U32)u8VSPK_WMode);
4463 
4464     if(_AUDIO_IOCtrlOpen() == FALSE)
4465     {
4466         ULOGE("AUDIO", "[MAPI AUDIO][%06d] VSPK WMod fail\n", __LINE__);
4467         return;
4468     }
4469 
4470     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_VSPK_WMod, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
4471     {
4472         ULOGE("AUDIO", "[MAPI AUDIO][%06d] VSPK WMod fail\n", __LINE__);
4473         return;
4474     }
4475     return;
4476 
4477 #else
4478 
4479     return _MApi_AUDIO_VSPK_WMod(u8VSPK_WMode);
4480 
4481 #endif
4482 }
4483 
MApi_AUDIO_VSPK_SMod(MS_U8 u8VSPK_SMode)4484 void MApi_AUDIO_VSPK_SMod(MS_U8 u8VSPK_SMode)
4485 {
4486 
4487 #ifdef UTOPIA_20
4488 
4489     MS_U32 u32param = ((MS_U32)u8VSPK_SMode);
4490 
4491     if(_AUDIO_IOCtrlOpen() == FALSE)
4492     {
4493         ULOGE("AUDIO", "[MAPI AUDIO][%06d] VSPK SMod fail\n", __LINE__);
4494         return;
4495     }
4496 
4497     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_VSPK_SMod, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
4498     {
4499         ULOGE("AUDIO", "[MAPI AUDIO][%06d] VSPK SMod fail\n", __LINE__);
4500         return;
4501     }
4502     return;
4503 
4504 #else
4505 
4506     return _MApi_AUDIO_VSPK_SMod(u8VSPK_SMode);
4507 
4508 #endif
4509 }
4510 
MApi_AUDIO_SRS_DC(MS_U8 u8SRSenDC)4511 void MApi_AUDIO_SRS_DC(MS_U8 u8SRSenDC)
4512 {
4513 
4514 #ifdef UTOPIA_20
4515 
4516     MS_U32 u32param = ((MS_U32)u8SRSenDC);
4517 
4518     if(_AUDIO_IOCtrlOpen() == FALSE)
4519     {
4520         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SRS DC fail\n", __LINE__);
4521         return;
4522     }
4523 
4524     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SRS_DC, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
4525     {
4526         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SRS DC fail\n", __LINE__);
4527         return;
4528     }
4529     return;
4530 
4531 #else
4532 
4533     return _MApi_AUDIO_SRS_DC(u8SRSenDC);
4534 
4535 #endif
4536 }
4537 
MApi_AUDIO_SRS_TruBass(MS_U8 u8SRSenTruBass)4538 void MApi_AUDIO_SRS_TruBass(MS_U8 u8SRSenTruBass)
4539 {
4540 
4541 #ifdef UTOPIA_20
4542 
4543     MS_U32 u32param = ((MS_U32)u8SRSenTruBass);
4544 
4545     if(_AUDIO_IOCtrlOpen() == FALSE)
4546     {
4547         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SRS TruBass fail\n", __LINE__);
4548         return;
4549     }
4550 
4551     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SRS_TruBass, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
4552     {
4553         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SRS TruBass fail\n", __LINE__);
4554         return;
4555     }
4556     return;
4557 
4558 #else
4559 
4560     return _MApi_AUDIO_SRS_TruBass(u8SRSenTruBass);
4561 
4562 #endif
4563 }
4564 
MApi_AUDIO_SRS_SetTsxtPara(MS_U8 u8mode,MS_U8 u8value)4565 void  MApi_AUDIO_SRS_SetTsxtPara(MS_U8 u8mode, MS_U8 u8value)
4566 {
4567 
4568 #ifdef UTOPIA_20
4569     AUDIO_ST_SRS_SETTSXTPARA Status;
4570     Status.u8Mode = u8mode;
4571 	Status.u8Value = u8value;
4572 
4573     if(_AUDIO_IOCtrlOpen() == FALSE)
4574     {
4575         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SRS SetTsxtPara fail\n", __LINE__);
4576         return;
4577     }
4578 
4579     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SRSTsxtPara, &Status) != UTOPIA_STATUS_SUCCESS)
4580     {
4581         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SRS SetTsxtPara fail\n", __LINE__);
4582         return;
4583     }
4584     return;
4585 
4586 #else
4587 
4588     return _MApi_AUDIO_SRS_SetTsxtPara(u8mode, u8value);
4589 
4590 #endif
4591 }
4592 
MApi_AUDIO_SetSRSTSHD(MS_U8 u8enTSHD)4593 void MApi_AUDIO_SetSRSTSHD(MS_U8 u8enTSHD)
4594 {
4595 
4596 #ifdef UTOPIA_20
4597 
4598     MS_U32 u32param = ((MS_U32)u8enTSHD);
4599 
4600     if(_AUDIO_IOCtrlOpen() == FALSE)
4601     {
4602         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set SRS TSHD fail\n", __LINE__);
4603         return;
4604     }
4605 
4606     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetSRSTSHD, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
4607     {
4608         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set SRS TSHD fail\n", __LINE__);
4609         return;
4610     }
4611     return;
4612 
4613     #else
4614 
4615     return _MApi_AUDIO_SetSRSTSHD(u8enTSHD);
4616 
4617 #endif
4618 }
4619 
MApi_AUDIO_TSHD_TruBass(MS_U8 u8TSHDenTruBass)4620 void  MApi_AUDIO_TSHD_TruBass(MS_U8 u8TSHDenTruBass)
4621 {
4622 #ifdef UTOPIA_20
4623     MS_U32 u32param = ((MS_U32)u8TSHDenTruBass);
4624 
4625     if(_AUDIO_IOCtrlOpen() == FALSE)
4626     {
4627         ULOGE("AUDIO", "[MAPI AUDIO][%06d] TSHD TreBass fail\n", __LINE__);
4628         return;
4629     }
4630 
4631     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_TSHD_TruBass, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
4632     {
4633         ULOGE("AUDIO", "[MAPI AUDIO][%06d] TSHD TreBass fail\n", __LINE__);
4634         return;
4635     }
4636     return;
4637 
4638 #else
4639     _MApi_AUDIO_TSHD_TruBass(u8TSHDenTruBass);
4640 #endif
4641 
4642 }
4643 
MApi_AUDIO_TSHD_Definition(MS_U8 u8TSHDenDefinition)4644 void  MApi_AUDIO_TSHD_Definition(MS_U8 u8TSHDenDefinition)
4645 {
4646 
4647 #ifdef UTOPIA_20
4648 
4649     MS_U32 u32param = ((MS_U32)u8TSHDenDefinition);
4650 
4651     if(_AUDIO_IOCtrlOpen() == FALSE)
4652     {
4653         ULOGE("AUDIO", "[MAPI AUDIO][%06d] TSHD Definition fail\n", __LINE__);
4654         return;
4655     }
4656 
4657     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_TSHD_Definition, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
4658     {
4659         ULOGE("AUDIO", "[MAPI AUDIO][%06d] TSHD Definition fail\n", __LINE__);
4660         return;
4661     }
4662     return;
4663 
4664 #else
4665 
4666     return _MApi_AUDIO_TSHD_Definition(u8TSHDenDefinition);
4667 
4668 #endif
4669 }
4670 
MApi_AUDIO_TSHD_Clarity(MS_U8 u8TSHDenClarity)4671 void  MApi_AUDIO_TSHD_Clarity(MS_U8 u8TSHDenClarity)
4672 {
4673 
4674 #ifdef UTOPIA_20
4675 
4676     MS_U32 u32param = ((MS_U32)u8TSHDenClarity);
4677 
4678     if(_AUDIO_IOCtrlOpen() == FALSE)
4679     {
4680         ULOGE("AUDIO", "[MAPI AUDIO][%06d] TSHD Clarity fail\n", __LINE__);
4681         return;
4682     }
4683 
4684     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_TSHD_Clarity, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
4685     {
4686         ULOGE("AUDIO", "[MAPI AUDIO][%06d] TSHD Clarity fail\n", __LINE__);
4687         return;
4688     }
4689     return;
4690 
4691 #else
4692 
4693     return _MApi_AUDIO_TSHD_Clarity(u8TSHDenClarity);
4694 
4695 #endif
4696 }
4697 
MApi_AUDIO_SRS_SetTshdPara(MS_U8 u8mode,MS_U8 u8value)4698 void  MApi_AUDIO_SRS_SetTshdPara(MS_U8 u8mode, MS_U8 u8value)
4699 {
4700 
4701 #ifdef UTOPIA_20
4702     AUDIO_ST_SRS_SETTSHDPARA Status;
4703     Status.u8Mode = u8mode;
4704     Status.u8Value = u8value;
4705 
4706     if(_AUDIO_IOCtrlOpen() == FALSE)
4707     {
4708         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SRS SetTshdPara fail\n", __LINE__);
4709         return;
4710     }
4711 
4712     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SRSSetTshdPara, &Status) != UTOPIA_STATUS_SUCCESS)
4713     {
4714         ULOGE("AUDIO", "[MAPI AUDIO][%06d] SRS SetTshdPara fail\n", __LINE__);
4715         return;
4716     }
4717     return;
4718 
4719 #else
4720 
4721     return _MApi_AUDIO_SRS_SetTshdPara(u8mode, u8value);
4722 
4723 #endif
4724 }
4725 
MApi_AUDIO_COPY_Parameter(ADVSND_PARAM type,void * Parameter_ptr,MS_U32 size)4726 void MApi_AUDIO_COPY_Parameter(ADVSND_PARAM type, void* Parameter_ptr, MS_U32 size)
4727 {
4728 
4729 #ifdef UTOPIA_20
4730     AUDIO_ST_COPY_PARAMETER Parameter;
4731     void *pParam = NULL;
4732     MS_U32 type_size, parameter_size, total_size;
4733 
4734     parameter_size = size;
4735     #if defined(UFO_PUBLIC_HEADER_500) || defined(UFO_PUBLIC_HEADER_700)
4736     type_size = strlen(type)+1;
4737     #else
4738     type_size = sizeof(ADVSND_TYPE);
4739     #endif
4740     total_size = size+type_size;
4741 
4742     pParam = malloc(total_size);
4743     if (pParam != NULL)
4744     {
4745         memcpy(pParam, Parameter_ptr, parameter_size);
4746         #if defined(UFO_PUBLIC_HEADER_500) || defined(UFO_PUBLIC_HEADER_700)
4747         memcpy((void *)(((MS_U8 *)pParam)+parameter_size), (void *)type, type_size);
4748         #else
4749         memcpy((void *)(((MS_U8 *)pParam)+parameter_size), (void *)&type, type_size);
4750         #endif
4751 
4752         Parameter.Parameter_ptr = pParam;
4753         Parameter.parameter_size = parameter_size;
4754         Parameter.type_size = type_size;
4755     }
4756     else
4757     {
4758         return;
4759     }
4760 
4761     if(_AUDIO_IOCtrlOpen() == FALSE)
4762     {
4763         ULOGE("AUDIO", "[MAPI AUDIO][%06d] COPY Parameter fail\n", __LINE__);
4764         goto exit;
4765     }
4766 
4767     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Copy_Parameter, (void*)&Parameter) != UTOPIA_STATUS_SUCCESS)
4768     {
4769         ULOGE("AUDIO", "[MAPI AUDIO][%06d] COPY Parameter fail\n", __LINE__);
4770         goto exit;
4771     }
4772 exit:
4773     if (pParam != NULL)
4774     {
4775         free(pParam);
4776     }
4777     return;
4778 
4779 #else
4780 
4781     return _MApi_AUDIO_COPY_Parameter(type, Parameter_ptr, size);
4782 
4783 #endif
4784 }
4785 
4786 //=============================================================
4787 // AUDIO_KTV RELATIONAL API FUNCTION
4788 //=============================================================
MApi_AUDIO_SetKTVInfo(AUDIO_KTV_MODEL modelType,AUDIO_KTV_PARAMTYPE paramType,MS_U32 param1,MS_U32 param2)4789 MS_BOOL MApi_AUDIO_SetKTVInfo(AUDIO_KTV_MODEL modelType, AUDIO_KTV_PARAMTYPE paramType, MS_U32 param1, MS_U32 param2)
4790 {
4791 
4792 #ifdef UTOPIA_20
4793     AUDIO_ST_KTV_OP Status;
4794     Status.eType = KTV_SET_INFO;
4795     Status.modelType = modelType;
4796     Status.paramType = AUD_KTV_ParamType1;
4797     Status.param1 = param1;
4798     Status.param2 = param2;
4799     Status.bRet = FALSE;
4800 
4801     if(_AUDIO_IOCtrlOpen() == FALSE)
4802     {
4803         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set KTV Info fail\n", __LINE__);
4804         //return;
4805     }
4806 
4807     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_KTV_OP, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
4808     {
4809         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set KTV Info fail\n", __LINE__);
4810         //return;
4811     }
4812     return Status.bRet;
4813 
4814 #else
4815 
4816     return _MApi_AUDIO_SetKTVInfo(modelType, paramType, param1, param2);
4817 
4818 #endif
4819 }
4820 
MApi_AUDIO_GetKTVInfo(AUDIO_KTV_MODEL modelType,AUDIO_KTV_INFOTYPE infoType)4821 MS_U32 MApi_AUDIO_GetKTVInfo(AUDIO_KTV_MODEL modelType, AUDIO_KTV_INFOTYPE infoType)
4822 {
4823 
4824 #ifdef UTOPIA_20
4825     AUDIO_ST_KTV_OP Status;
4826     Status.eType = KTV_GET_INFO;
4827     Status.modelType = modelType;
4828     Status.infoType = infoType;
4829     Status.u32Ret = 0;
4830 
4831     if(_AUDIO_IOCtrlOpen() == FALSE)
4832     {
4833         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set KTV Info fail\n", __LINE__);
4834         //return;
4835     }
4836 
4837     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_KTV_OP, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
4838     {
4839         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set KTV Info fail\n", __LINE__);
4840         //return;
4841     }
4842     return Status.u32Ret;
4843 
4844 #else
4845 
4846     return _MApi_AUDIO_GetKTVInfo(modelType, infoType);
4847 
4848 #endif
4849 }
4850 
MApi_AUDIO_SetMixModeVolume(AUDIO_SOURCE_INFO_TYPE eSourceType,AUDIO_MIX_VOL_TYPE VolType,MS_U8 u8Vol1,MS_U8 u8Vol2)4851 void MApi_AUDIO_SetMixModeVolume(AUDIO_SOURCE_INFO_TYPE eSourceType, AUDIO_MIX_VOL_TYPE VolType, MS_U8 u8Vol1, MS_U8 u8Vol2)
4852 {
4853 
4854 #ifdef UTOPIA_20
4855     AUDIO_ST_KTV_OP Status;
4856     Status.eType = KTV_SET_MIX_VOL;
4857     Status.eSourceType = eSourceType;
4858     Status.VolType = VolType;
4859     Status.u8Vol1 = u8Vol1;
4860     Status.u8Vol2 = u8Vol2;
4861 
4862     if(_AUDIO_IOCtrlOpen() == FALSE)
4863     {
4864         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Mix Mode Volume fail\n", __LINE__);
4865         return;
4866     }
4867 
4868     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_KTV_OP, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
4869     {
4870         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Mix Mode Volume fail\n", __LINE__);
4871         return;
4872     }
4873     return;
4874 
4875 #else
4876 
4877     return _MApi_AUDIO_SetMixModeVolume(eSourceType, VolType, u8Vol1, u8Vol2);
4878 
4879 #endif
4880 }
4881 
MApi_AUDIO_SetMixModeMute(AUDIO_SOURCE_INFO_TYPE eSourceType,AUDIO_MIX_VOL_TYPE VolType,MS_BOOL EnMute)4882 void MApi_AUDIO_SetMixModeMute(AUDIO_SOURCE_INFO_TYPE eSourceType, AUDIO_MIX_VOL_TYPE VolType, MS_BOOL EnMute)
4883 {
4884 
4885 #ifdef UTOPIA_20
4886     AUDIO_ST_KTV_OP Status;
4887     Status.eType = KTV_SET_MIX_MUTE;
4888     Status.eSourceType = eSourceType;
4889     Status.VolType = VolType;
4890     Status.EnMute = EnMute;
4891 
4892     if(_AUDIO_IOCtrlOpen() == FALSE)
4893     {
4894         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Mix Mode Mute fail\n", __LINE__);
4895         return;
4896     }
4897 
4898     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_KTV_OP, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
4899     {
4900         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Mix Mode Mute fail\n", __LINE__);
4901         return;
4902     }
4903     return;
4904 
4905 #else
4906 
4907     return _MApi_AUDIO_SetMixModeMute(eSourceType, VolType, EnMute);
4908 
4909 #endif
4910 }
4911 
MApi_AUDIO_PlayMenuSound(void)4912 void MApi_AUDIO_PlayMenuSound(void)
4913 {
4914 
4915 #ifdef UTOPIA_20
4916     if(_AUDIO_IOCtrlOpen() == FALSE)
4917     {
4918         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Play Menu Sound fail\n", __LINE__);
4919         return;
4920     }
4921 
4922     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_PlayMenuSound, 0) != UTOPIA_STATUS_SUCCESS)
4923     {
4924         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Play Menu Sound fail\n", __LINE__);
4925         return;
4926     }
4927     return;
4928 
4929 #else
4930 
4931     return _MApi_AUDIO_PlayMenuSound();
4932 
4933 #endif
4934 }
4935 
4936 //=============================================================
4937 // AUDIO_MM RELATIONAL API FUNCTION
4938 //=============================================================
MApi_AUDIO_SetCommAudioInfo(Audio_COMM_infoType infoType,MS_VIRT param1,MS_VIRT param2)4939 MS_BOOL MApi_AUDIO_SetCommAudioInfo( Audio_COMM_infoType infoType, MS_VIRT param1, MS_VIRT param2 )
4940 {
4941 
4942 #ifdef UTOPIA_20
4943     AUDIO_ST_SET_COMMAUDIOINFO Status;
4944     Status.bRet = 0;
4945     Status.eInfoType = infoType;
4946     Status.Param1 = param1;
4947     Status.Param2 = param2;
4948 
4949     if(_AUDIO_IOCtrlOpen() == FALSE)
4950     {
4951         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Comm Audio Info fail\n", __LINE__);
4952         //return;
4953     }
4954 
4955     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetCommAudioInfo, &Status) != UTOPIA_STATUS_SUCCESS)
4956     {
4957         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Comm Audio Info fail\n", __LINE__);
4958         //return;
4959     }
4960 
4961     return Status.bRet;
4962 
4963 #else
4964 
4965     return _MApi_AUDIO_SetCommAudioInfo(infoType, param1, param2);
4966 
4967 #endif
4968 }
4969 
4970 #if 0
4971 MS_BOOL MApi_ADEC_SetDecodeParam( AUDIO_DEC_ID DecId, Audio_ParamType paramType, MS_U32* Param )
4972 {
4973 #ifdef UTOPIA_20
4974     AUDIO_ST_SETDECODEPARAM Status;
4975     Status.DecID = DecId;
4976     Status.paramType = paramType;
4977     Status.Param = Param;
4978 
4979     if(_AUDIO_IOCtrlOpen() == FALSE)
4980     {
4981         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Decode Param fail\n", __LINE__);
4982         //return;
4983     }
4984 
4985     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetDecodeParam, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
4986     {
4987         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Decode Param fail\n", __LINE__);
4988         //return;
4989     }
4990     return Status.bStatus;
4991 
4992 #else
4993 
4994     return _MApi_ADEC_SetDecodeParam(DecId, paramType, Param);
4995 
4996 #endif
4997 
4998 }
4999 #endif
5000 
MApi_AUDIO_SetMpegInfo(Audio_MPEG_infoType infoType,MS_VIRT param1,MS_VIRT param2)5001 MS_BOOL MApi_AUDIO_SetMpegInfo( Audio_MPEG_infoType infoType, MS_VIRT param1, MS_VIRT param2 )
5002 {
5003 
5004 #ifdef UTOPIA_20
5005     AUDIO_ST_SET_MPEGINFO Status;
5006     Status.bRet = 0;
5007     Status.eInfoType = infoType;
5008     Status.Param1 = param1;
5009     Status.Param2 = param2;
5010 
5011     if(_AUDIO_IOCtrlOpen() == FALSE)
5012     {
5013         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Mpeg Info fail\n", __LINE__);
5014         //return;
5015     }
5016 
5017     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetMpegInfo, &Status) != UTOPIA_STATUS_SUCCESS)
5018     {
5019         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Mpeg Info fail\n", __LINE__);
5020         //return;
5021     }
5022 
5023     return Status.bRet;
5024 
5025 #else
5026 
5027     return _MApi_AUDIO_SetMpegInfo(infoType, param1, param2);
5028 
5029 #endif
5030 }
5031 
MApi_AUDIO_SetAC3Info(Audio_AC3_infoType infoType,MS_VIRT param1,MS_VIRT param2)5032 MS_BOOL MApi_AUDIO_SetAC3Info(Audio_AC3_infoType infoType, MS_VIRT param1, MS_VIRT param2 )
5033 {
5034 
5035 #ifdef UTOPIA_20
5036     AUDIO_ST_SET_AC3INFO Status;
5037     Status.bRet = 0;
5038     Status.eInfoType = infoType;
5039     Status.Param1 = param1;
5040     Status.Param2 = param2;
5041 
5042     if(_AUDIO_IOCtrlOpen() == FALSE)
5043     {
5044         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set AC3 Info fail\n", __LINE__);
5045         //return;
5046     }
5047 
5048     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetAC3Info, &Status) != UTOPIA_STATUS_SUCCESS)
5049     {
5050         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set AC3 Info fail\n", __LINE__);
5051         //return;
5052     }
5053 
5054     return Status.bRet;
5055 
5056 #else
5057 
5058     return _MApi_AUDIO_SetAC3Info(infoType, param1, param2);
5059 
5060 #endif
5061 }
5062 
MApi_AUDIO_SetAC3PInfo(Audio_AC3P_infoType infoType,MS_VIRT param1,MS_VIRT param2)5063 MS_BOOL MApi_AUDIO_SetAC3PInfo(Audio_AC3P_infoType infoType, MS_VIRT param1, MS_VIRT param2 )
5064 {
5065 
5066 #ifdef UTOPIA_20
5067     AUDIO_ST_SET_AC3PINFO Status;
5068     Status.bRet = 0;
5069     Status.eInfoType = infoType;
5070     Status.Param1 = param1;
5071     Status.Param2 = param2;
5072 
5073     if(_AUDIO_IOCtrlOpen() == FALSE)
5074     {
5075         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set AC3P Info fail\n", __LINE__);
5076         //return;
5077     }
5078 
5079     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetAC3PInfo, &Status) != UTOPIA_STATUS_SUCCESS)
5080     {
5081         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set AC3P Info fail\n", __LINE__);
5082         //return;
5083     }
5084 
5085     return Status.bRet;
5086 
5087 #else
5088 
5089     return _MApi_AUDIO_SetAC3PInfo(infoType, param1, param2);
5090 
5091 #endif
5092 }
5093 
MApi_AUDIO_SetAACInfo(Audio_AAC_infoType infoType,MS_VIRT param1,MS_VIRT param2)5094 MS_BOOL MApi_AUDIO_SetAACInfo( Audio_AAC_infoType infoType, MS_VIRT param1, MS_VIRT param2 )
5095 {
5096 
5097 #ifdef UTOPIA_20
5098     AUDIO_ST_SET_AACINFO Status;
5099     Status.bRet = 0;
5100     Status.eInfoType = infoType;
5101     Status.Param1 = param1;
5102     Status.Param2 = param2;
5103 
5104     if(_AUDIO_IOCtrlOpen() == FALSE)
5105     {
5106         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set AAC Info fail\n", __LINE__);
5107         //return;
5108     }
5109 
5110     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetAACInfo, &Status) != UTOPIA_STATUS_SUCCESS)
5111     {
5112         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set AAC Info fail\n", __LINE__);
5113         //return;
5114     }
5115 
5116     return Status.bRet;
5117 
5118 #else
5119 
5120     return _MApi_AUDIO_SetAACInfo(infoType, param1, param2);
5121 
5122 #endif
5123 }
5124 
MApi_AUDIO_SetWmaInfo(Audio_WMA_infoType infoType,MS_VIRT param1,MS_VIRT param2)5125 MS_BOOL MApi_AUDIO_SetWmaInfo(Audio_WMA_infoType infoType, MS_VIRT param1, MS_VIRT param2 )
5126 {
5127 
5128 #ifdef UTOPIA_20
5129     AUDIO_ST_SET_WMAINFO Status;
5130     Status.bRet = 0;
5131     Status.eInfoType = infoType;
5132     Status.Param1 = param1;
5133     Status.Param2 = param2;
5134 
5135     if(_AUDIO_IOCtrlOpen() == FALSE)
5136     {
5137         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set WMA Info fail\n", __LINE__);
5138         //return;
5139     }
5140 
5141     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetWMAInfo, &Status) != UTOPIA_STATUS_SUCCESS)
5142     {
5143         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set WMA Info fail\n", __LINE__);
5144         //return;
5145     }
5146 
5147     return Status.bRet;
5148 
5149 #else
5150 
5151     return _MApi_AUDIO_SetWmaInfo(infoType, param1, param2);
5152 
5153 #endif
5154 }
5155 
MApi_AUDIO_SetDTSCommonCtrl(Audio_DTS_infoType infoType,Audio_DTS_CtrlType ctrl_type)5156 MS_BOOL MApi_AUDIO_SetDTSCommonCtrl( Audio_DTS_infoType infoType, Audio_DTS_CtrlType ctrl_type )
5157 {
5158 
5159 #ifdef UTOPIA_20
5160     AUDIO_ST_SET_DTSCOMMONCTRL Status;
5161     Status.bRet = 0;
5162     Status.eInfoType = infoType;
5163     Status.eCtrlType = ctrl_type;
5164 
5165     if(_AUDIO_IOCtrlOpen() == FALSE)
5166     {
5167         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set DTS Common Ctrl fail\n", __LINE__);
5168         //return;
5169     }
5170 
5171     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetDTSCommonCtrl, &Status) != UTOPIA_STATUS_SUCCESS)
5172     {
5173         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set DTS Common Ctrl fail\n", __LINE__);
5174         //return;
5175     }
5176 
5177     return Status.bRet;
5178 
5179 #else
5180 
5181     return _MApi_AUDIO_SetDTSCommonCtrl(infoType, ctrl_type);
5182 
5183 #endif
5184 }
5185 
MApi_AUDIO_GetCommAudioInfo(Audio_COMM_infoType infoType)5186 MS_U64 MApi_AUDIO_GetCommAudioInfo( Audio_COMM_infoType infoType )
5187 {
5188 
5189 #ifdef UTOPIA_20
5190     AUDIO_ST_GET_COMMAUDIOINFO Status;
5191     Status.u64Ret = 0;
5192     Status.eInfoType = infoType;
5193 
5194     if(_AUDIO_IOCtrlOpen() == FALSE)
5195     {
5196         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Comm Audio Info fail\n", __LINE__);
5197         //return;
5198     }
5199 
5200     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetCommAudioInfo, &Status) != UTOPIA_STATUS_SUCCESS)
5201     {
5202         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Comm Audio Info fail\n", __LINE__);
5203         //return;
5204     }
5205 
5206     return Status.u64Ret;
5207 
5208 #else
5209 
5210     return _MApi_AUDIO_GetCommAudioInfo(infoType);
5211 
5212 #endif
5213 }
5214 
MApi_AUDIO_GetMpegInfo(Audio_MPEG_infoType infoType)5215 MS_U32 MApi_AUDIO_GetMpegInfo( Audio_MPEG_infoType infoType )
5216 {
5217 
5218 #ifdef UTOPIA_20
5219     AUDIO_ST_GET_MPEGINFO Status;
5220     Status.u32Ret = 0;
5221     Status.eInfoType = infoType;
5222 
5223     if(_AUDIO_IOCtrlOpen() == FALSE)
5224     {
5225         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Mpeg Info fail\n", __LINE__);
5226         //return;
5227     }
5228 
5229     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetMpegInfo, &Status) != UTOPIA_STATUS_SUCCESS)
5230     {
5231         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Mpeg Info fail\n", __LINE__);
5232         //return;
5233     }
5234 
5235     return Status.u32Ret;
5236 
5237 #else
5238 
5239     return _MApi_AUDIO_GetMpegInfo(infoType);
5240 
5241 #endif
5242 }
5243 
MApi_AUDIO_GetAC3Info(Audio_AC3_infoType infoType)5244 MS_U32 MApi_AUDIO_GetAC3Info(Audio_AC3_infoType infoType )
5245 {
5246 
5247 #ifdef UTOPIA_20
5248     AUDIO_ST_GET_AC3INFO Status;
5249     Status.u32Ret = 0;
5250     Status.eInfoType = infoType;
5251 
5252     if(_AUDIO_IOCtrlOpen() == FALSE)
5253     {
5254         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get AC3 Info fail\n", __LINE__);
5255         //return;
5256     }
5257 
5258 	if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetAC3Info, &Status) != UTOPIA_STATUS_SUCCESS)
5259     {
5260         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get AC3 Info fail\n", __LINE__);
5261         //return;
5262     }
5263 
5264     return Status.u32Ret;
5265 
5266 #else
5267 
5268     return _MApi_AUDIO_GetAC3Info(infoType);
5269 
5270 #endif
5271 }
5272 
MApi_AUDIO_GetAC3PInfo(Audio_AC3P_infoType infoType)5273 MS_U32 MApi_AUDIO_GetAC3PInfo( Audio_AC3P_infoType infoType )
5274 {
5275 
5276 #ifdef UTOPIA_20
5277     AUDIO_ST_GET_AC3PINFO Status;
5278     Status.u32Ret = 0;
5279     Status.eInfoType = infoType;
5280 
5281     if(_AUDIO_IOCtrlOpen() == FALSE)
5282     {
5283         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get AC3P Info fail\n", __LINE__);
5284         //return;
5285     }
5286 
5287     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetAC3PInfo, &Status) != UTOPIA_STATUS_SUCCESS)
5288     {
5289         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get AC3P Info fail\n", __LINE__);
5290         //return;
5291     }
5292 
5293     return Status.u32Ret;
5294 
5295 #else
5296 
5297     return _MApi_AUDIO_GetAC3PInfo(infoType);
5298 
5299 #endif
5300 }
5301 
MApi_AUDIO_GetAACInfo(Audio_AAC_infoType infoType)5302 MS_U32 MApi_AUDIO_GetAACInfo( Audio_AAC_infoType infoType )
5303 {
5304 
5305 #ifdef UTOPIA_20
5306     AUDIO_ST_GET_AACINFO Status;
5307     Status.u32Ret = 0;
5308     Status.eInfoType = infoType;
5309 
5310 
5311     if(_AUDIO_IOCtrlOpen() == FALSE)
5312     {
5313         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get AAC Info fail\n", __LINE__);
5314         //return;
5315     }
5316 
5317     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetAACInfo, &Status) != UTOPIA_STATUS_SUCCESS)
5318     {
5319         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get AAC Info fail\n", __LINE__);
5320         //return;
5321     }
5322 
5323     return Status.u32Ret;
5324 
5325 #else
5326 
5327     return _MApi_AUDIO_GetAACInfo(infoType);
5328 
5329 #endif
5330 }
5331 
MApi_AUDIO_GetWmaInfo(Audio_WMA_infoType infoType)5332 MS_U32 MApi_AUDIO_GetWmaInfo( Audio_WMA_infoType infoType )
5333 {
5334 
5335 #ifdef UTOPIA_20
5336     AUDIO_ST_GET_WMAINFO Status;
5337     Status.u32Ret = 0;
5338     Status.eInfoType = infoType;
5339 
5340     if(_AUDIO_IOCtrlOpen() == FALSE)
5341     {
5342         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Wma Info fail\n", __LINE__);
5343         //return;
5344     }
5345 
5346     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetWmaInfo, &Status) != UTOPIA_STATUS_SUCCESS)
5347     {
5348         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Wma Info fail\n", __LINE__);
5349         //return;
5350     }
5351 
5352     return Status.u32Ret;
5353 
5354 #else
5355 
5356     return _MApi_AUDIO_GetWmaInfo(infoType);
5357 
5358 #endif
5359 }
5360 
MApi_AUDIO_GetDTSInfo(Audio_DTS_infoType infoType)5361 MS_U32 MApi_AUDIO_GetDTSInfo( Audio_DTS_infoType infoType )
5362 {
5363 
5364 #ifdef UTOPIA_20
5365     AUDIO_ST_GET_DTSINFO Status;
5366     Status.u32Ret = 0;
5367     Status.eInfoType = infoType;
5368 
5369     if(_AUDIO_IOCtrlOpen() == FALSE)
5370     {
5371         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get DTS Info fail\n", __LINE__);
5372         //return;
5373     }
5374 
5375     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetDTSInfo, &Status) != UTOPIA_STATUS_SUCCESS)
5376     {
5377         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get DTS Info fail\n", __LINE__);
5378         //return;
5379     }
5380 
5381     return Status.u32Ret;
5382 
5383 #else
5384 
5385     return _MApi_AUDIO_GetDTSInfo(infoType);
5386 
5387 #endif
5388 }
5389 
MApi_AUDIO_XPCM_Param(XPCM_TYPE audioType,MS_U8 channels,MS_U16 sampleRate,MS_U8 bitsPerSample,MS_U16 blockSize,MS_U16 samplePerBlock)5390 MS_U8 MApi_AUDIO_XPCM_Param(XPCM_TYPE audioType, MS_U8  channels, MS_U16 sampleRate, MS_U8  bitsPerSample, MS_U16 blockSize, MS_U16 samplePerBlock)
5391 {
5392 
5393 #ifdef UTOPIA_20
5394     AUDIO_ST_XPCMPARAM Status;
5395     Status.u8Ret = 0;
5396     Status.eAudioType = audioType;
5397     Status.u8Channels = channels;
5398     Status.u16SampleRate = sampleRate;
5399     Status.u8BitsPerSample = bitsPerSample;
5400     Status.u16BlockSize = blockSize;
5401     Status.u16SamplePerBlock = samplePerBlock;
5402 
5403     if(_AUDIO_IOCtrlOpen() == FALSE)
5404     {
5405         ULOGE("AUDIO", "[MAPI AUDIO][%06d] XPCM Param fail\n", __LINE__);
5406         //return;
5407     }
5408 
5409     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_XPCM_Param, &Status) != UTOPIA_STATUS_SUCCESS)
5410     {
5411         ULOGE("AUDIO", "[MAPI AUDIO][%06d] XPCM Param fail\n", __LINE__);
5412         //return;
5413     }
5414 
5415     return Status.u8Ret;
5416 
5417 #else
5418 
5419     return _MApi_AUDIO_XPCM_Param(audioType, channels, sampleRate, bitsPerSample, blockSize, samplePerBlock);
5420 
5421 #endif
5422 }
5423 
MApi_AUDIO_XPCM2_Param(XPCM_TYPE audioType,MS_U8 channels,MS_U16 sampleRate,MS_U8 bitsPerSample,MS_U16 blockSize,MS_U16 samplePerBlock)5424 void MApi_AUDIO_XPCM2_Param(XPCM_TYPE audioType, MS_U8  channels, MS_U16 sampleRate, MS_U8  bitsPerSample, MS_U16 blockSize, MS_U16 samplePerBlock)
5425 {
5426 
5427 #ifdef UTOPIA_20
5428     AUDIO_ST_SET_XPCMPARAM Status;
5429     Status.eAudioType = audioType;
5430     Status.u8Channels = channels;
5431     Status.u16SampleRate = sampleRate;
5432     Status.u8BitsPerSample = bitsPerSample;
5433     Status.u16BlockSize = blockSize;
5434     Status.u16SamplePerBlock = samplePerBlock;
5435 
5436     if(_AUDIO_IOCtrlOpen() == FALSE)
5437     {
5438         ULOGE("AUDIO", "[MAPI AUDIO][%06d] XPCM2 Param fail\n", __LINE__);
5439         //return;
5440     }
5441 
5442     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_XPCM2_Param, &Status) != UTOPIA_STATUS_SUCCESS)
5443     {
5444         ULOGE("AUDIO", "[MAPI AUDIO][%06d] XPCM2 Param fail\n", __LINE__);
5445         //return;
5446     }
5447     return;
5448 
5449 #else
5450 
5451     return _MApi_AUDIO_XPCM2_Param(audioType, channels, sampleRate, bitsPerSample, blockSize, samplePerBlock);
5452 
5453 #endif
5454 }
5455 
MApi_AUDIO_XPCM2_CheckIntStatus(void)5456 MS_U16 MApi_AUDIO_XPCM2_CheckIntStatus(void)
5457 {
5458 
5459 #ifdef UTOPIA_20
5460     MS_U32 u32param[2] = {0, 0};
5461 
5462     if(_AUDIO_IOCtrlOpen() == FALSE)
5463     {
5464         ULOGE("AUDIO", "[MAPI AUDIO][%06d] XPCM2 Check Int Status fail\n", __LINE__);
5465         //return;
5466     }
5467 
5468     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_XPCM2_CheckIntStatus, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
5469     {
5470         ULOGE("AUDIO", "[MAPI AUDIO][%06d] XPCM2 Check Int Status fail\n", __LINE__);
5471         //return;
5472     }
5473     return (MS_U16)u32param[1];
5474 
5475 #else
5476 
5477     return _MApi_AUDIO_XPCM2_CheckIntStatus();
5478 
5479 #endif
5480 }
5481 
MApi_AUDIO_RA8_Param(MS_U16 mNumCodecs,MS_U16 mSamples,MS_U16 mSampleRate,MS_U16 * Channels,MS_U16 * Regions,MS_U16 * cplStart,MS_U16 * cplQbits,MS_U16 * FrameSize)5482 MS_U8 MApi_AUDIO_RA8_Param(MS_U16 mNumCodecs, MS_U16 mSamples, MS_U16 mSampleRate, MS_U16* Channels, MS_U16* Regions, MS_U16* cplStart, MS_U16* cplQbits, MS_U16* FrameSize)
5483 {
5484 
5485 #ifdef UTOPIA_20
5486     AUDIO_ST_RA8_Param Status;
5487     Status.u8Status = FALSE;
5488     Status.mNumCodecs = mNumCodecs;
5489     Status.mSamples = mSamples;
5490     Status.mSampleRate= mSampleRate;
5491     Status.pChannels = Channels;
5492     Status.pRegions = Regions;
5493     Status.pcplStart = cplStart;
5494     Status.pcplQbits = cplQbits;
5495     Status.pFrameSize = FrameSize;
5496 
5497     if(_AUDIO_IOCtrlOpen() == FALSE)
5498     {
5499         ULOGE("AUDIO", "[MAPI AUDIO][%06d] RA8 Param fail\n", __LINE__);
5500         //return;
5501     }
5502 
5503     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_RA8_Param, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
5504     {
5505         ULOGE("AUDIO", "[MAPI AUDIO][%06d] RA8 Param fail\n", __LINE__);
5506         //return;
5507     }
5508     return Status.u8Status;
5509 
5510 #else
5511 
5512     return _MApi_AUDIO_RA8_Param(mNumCodecs, mSamples, mSampleRate, Channels, Regions, cplStart, cplQbits,  FrameSize);
5513 
5514 #endif
5515 }
5516 
MApi_AUDIO_Init(En_DVB_decSystemType enDecSystem)5517 void MApi_AUDIO_Init(En_DVB_decSystemType enDecSystem)
5518 {
5519 
5520 #ifdef UTOPIA_20
5521     MS_U32 u32param =((MS_U32)enDecSystem);
5522 
5523     if(_AUDIO_IOCtrlOpen() == FALSE)
5524     {
5525         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Init fail\n", __LINE__);
5526         return;
5527     }
5528 
5529     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Init, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
5530     {
5531         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Init fail\n", __LINE__);
5532         return;
5533     }
5534     return;
5535 
5536 #else
5537 
5538     return _MApi_AUDIO_Init(enDecSystem);
5539 
5540 #endif
5541 }
5542 
MApi_AUDIO_StartDecode(void)5543 void MApi_AUDIO_StartDecode(void)
5544 {
5545 
5546 #ifdef UTOPIA_20
5547 
5548     if(_AUDIO_IOCtrlOpen() == FALSE)
5549     {
5550         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Start Decode fail\n", __LINE__);
5551         return;
5552     }
5553 
5554     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_StartDecode, 0) != UTOPIA_STATUS_SUCCESS)
5555     {
5556         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Start Decode fail\n", __LINE__);
5557         return;
5558     }
5559     return;
5560 
5561 #else
5562 
5563     return _MApi_AUDIO_StartDecode();
5564 
5565 #endif
5566 }
5567 
MApi_AUDIO_StartBrowse(void)5568 void MApi_AUDIO_StartBrowse(void)
5569 {
5570 
5571 #ifdef UTOPIA_20
5572 
5573     if(_AUDIO_IOCtrlOpen() == FALSE)
5574     {
5575         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Start Broswe fail\n", __LINE__);
5576         return;
5577     }
5578 
5579     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_StartBroswe, 0) != UTOPIA_STATUS_SUCCESS)
5580     {
5581         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Start Broswe fail\n", __LINE__);
5582         return;
5583     }
5584     return;
5585 
5586 #else
5587 
5588     return _MApi_AUDIO_StartBrowse();
5589 
5590 #endif
5591 }
5592 
MApi_AUDIO_StopDecode(void)5593 void MApi_AUDIO_StopDecode(void)
5594 {
5595 
5596 #ifdef UTOPIA_20
5597 
5598     if(_AUDIO_IOCtrlOpen() == FALSE)
5599     {
5600         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Stop Decode fail\n", __LINE__);
5601         return;
5602     }
5603 
5604     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_StopDecode, 0) != UTOPIA_STATUS_SUCCESS)
5605     {
5606         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Stop Decode fail\n", __LINE__);
5607         return;
5608     }
5609     return;
5610 
5611 #else
5612 
5613     return _MApi_AUDIO_StopDecode();
5614 
5615 #endif
5616 }
5617 
MApi_AUDIO_PauseDecode(void)5618 void MApi_AUDIO_PauseDecode(void)
5619 {
5620 
5621 #ifdef UTOPIA_20
5622 
5623     if(_AUDIO_IOCtrlOpen() == FALSE)
5624     {
5625         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Pause Decode fail\n", __LINE__);
5626         return;
5627     }
5628 
5629     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_PauseDecode, 0) != UTOPIA_STATUS_SUCCESS)
5630     {
5631         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Pause Decode fail\n", __LINE__);
5632         return;
5633     }
5634     return;
5635 
5636 #else
5637 
5638     return _MApi_AUDIO_PauseDecode();
5639 
5640 #endif
5641 }
5642 
MApi_AUDIO_CheckPlayDone(void)5643 MS_U8 MApi_AUDIO_CheckPlayDone(void)
5644 {
5645 
5646 #ifdef UTOPIA_20
5647     MS_U32 u32param[2] = {0, 0};
5648 
5649     if(_AUDIO_IOCtrlOpen() == FALSE)
5650     {
5651         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Check Play Done fail\n", __LINE__);
5652         //return;
5653     }
5654 
5655     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_CheckPlayDone, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
5656     {
5657         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Check Play Done fail\n", __LINE__);
5658         //return;
5659     }
5660     return (MS_U8)u32param[1];
5661 
5662 #else
5663 
5664     return _MApi_AUDIO_CheckPlayDone();
5665 
5666 #endif
5667 }
5668 
MApi_AUDIO_GetResidualBufferSize(void)5669 MS_U16 MApi_AUDIO_GetResidualBufferSize(void)
5670 {
5671 
5672 #ifdef UTOPIA_20
5673     MS_U32 u32param[2] = {0, 0};
5674 
5675     if(_AUDIO_IOCtrlOpen() == FALSE)
5676     {
5677         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Residual Buffer Size fail\n", __LINE__);
5678         //return;
5679     }
5680 
5681     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetResidualBufferSize, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
5682     {
5683         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Residual Buffer Size fail\n", __LINE__);
5684         //return;
5685     }
5686     return (MS_U16)u32param[1];
5687 
5688 #else
5689 
5690     return _MApi_AUDIO_GetResidualBufferSize();
5691 
5692 #endif
5693 }
5694 
MApi_AUDIO_GetPCMBufferSize(MS_U16 u16BitRate)5695 MS_U16 MApi_AUDIO_GetPCMBufferSize(MS_U16 u16BitRate)
5696 {
5697 
5698 #ifdef UTOPIA_20
5699     AUDIO_ST_GET_PCMBUFFERSIZE Status;
5700     Status.u16Ret = 0;
5701 	Status.u16BitRate = u16BitRate;
5702 
5703     if(_AUDIO_IOCtrlOpen() == FALSE)
5704     {
5705         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get PCM Buffer Size fail\n", __LINE__);
5706         //return;
5707     }
5708 
5709     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetPCMBufferSize, &Status) != UTOPIA_STATUS_SUCCESS)
5710     {
5711         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get PCM Buffer Size fail\n", __LINE__);
5712         //return;
5713     }
5714 
5715     return Status.u16Ret;
5716 
5717 #else
5718 
5719     return _MApi_AUDIO_GetPCMBufferSize(u16BitRate);
5720 
5721 #endif
5722 }
5723 
MApi_AUDIO_GetPCMBufferSize2(MS_U16 u16BitRate,MS_U16 u16SampleRate)5724 MS_U16 MApi_AUDIO_GetPCMBufferSize2(MS_U16 u16BitRate,MS_U16 u16SampleRate)
5725 {
5726 
5727 #ifdef UTOPIA_20
5728     AUDIO_ST_GET_PCMBUFFERSIZE2 Status;
5729     Status.u16Ret = 0;
5730 	Status.u16BitRate = u16BitRate;
5731 	Status.u16SampleRate = u16SampleRate;
5732 
5733     if(_AUDIO_IOCtrlOpen() == FALSE)
5734     {
5735         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get PCM Buffer Size2 fail\n", __LINE__);
5736         //return;
5737     }
5738 
5739     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetPCMBufferSize2, &Status) != UTOPIA_STATUS_SUCCESS)
5740     {
5741         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get PCM Buffer Size2 fail\n", __LINE__);
5742         //return;
5743     }
5744 
5745     return Status.u16Ret;
5746 
5747 #else
5748 
5749     return _MApi_AUDIO_GetPCMBufferSize2(u16BitRate, u16SampleRate);
5750 
5751 #endif
5752 }
5753 
MApi_AUDIO_GetCurrentFrameNumber(void)5754 MS_U32 MApi_AUDIO_GetCurrentFrameNumber(void)
5755 {
5756 
5757 #ifdef UTOPIA_20
5758     MS_U32 u32param[2] = {0, 0};
5759 
5760     if(_AUDIO_IOCtrlOpen() == FALSE)
5761     {
5762         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Current Frame Number fail\n", __LINE__);
5763         //return;
5764     }
5765 
5766     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetCurrentFrameNumber, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
5767     {
5768         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Current Frame Number fail\n", __LINE__);
5769         //return;
5770     }
5771     return (MS_U32)u32param[1];
5772 
5773 #else
5774 
5775     return _MApi_AUDIO_GetCurrentFrameNumber();
5776 
5777 #endif
5778 }
5779 
MApi_AUDIO_GetSampleRate(void)5780 MS_U16 MApi_AUDIO_GetSampleRate(void)
5781 {
5782 
5783 #ifdef UTOPIA_20
5784     MS_U32 u32param[2] = {0, 0};
5785 
5786     if(_AUDIO_IOCtrlOpen() == FALSE)
5787     {
5788         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Sample Rate fail\n", __LINE__);
5789         //return;
5790     }
5791 
5792     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetSampleRates, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
5793     {
5794         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Sample Rate fail\n", __LINE__);
5795         //return;
5796     }
5797     return (MS_U16)u32param[1];
5798 
5799 #else
5800 
5801     return _MApi_AUDIO_GetSampleRate();
5802 
5803 #endif
5804 }
5805 
MApi_AUDIO_GetBitRate(void)5806 MS_U32 MApi_AUDIO_GetBitRate(void)
5807 {
5808 
5809 #ifdef UTOPIA_20
5810     MS_U32 u32param[2] = {0, 0};
5811 
5812     if(_AUDIO_IOCtrlOpen() == FALSE)
5813     {
5814         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Bit Rate fail\n", __LINE__);
5815         //return;
5816     }
5817 
5818     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetBitRates, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
5819     {
5820         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Bit Rate fail\n", __LINE__);
5821         //return;
5822     }
5823     return (MS_U32)u32param[1];
5824 
5825 #else
5826 
5827     return _MApi_AUDIO_GetBitRate();
5828 
5829 #endif
5830 }
5831 
MApi_AUDIO_GetLayer(void)5832 Audio_MP3_LAYER MApi_AUDIO_GetLayer(void)
5833 {
5834 
5835 #ifdef UTOPIA_20
5836     MS_U32 u32param[2] = {0, 0};
5837 
5838     if(_AUDIO_IOCtrlOpen() == FALSE)
5839     {
5840         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Layer fail\n", __LINE__);
5841         //return;
5842     }
5843 
5844     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetLayer, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
5845     {
5846         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Layer fail\n", __LINE__);
5847         //return;
5848     }
5849     return (Audio_MP3_LAYER)u32param[1];
5850 
5851 #else
5852 
5853     return _MApi_AUDIO_GetLayer();
5854 
5855 #endif
5856 }
5857 
MApi_AUDIO_CheckInputRequest(MS_PHY * pPHYWrtAddr,MS_U32 * pU32WrtBytes)5858 MS_U8 MApi_AUDIO_CheckInputRequest(MS_PHY *pPHYWrtAddr, MS_U32 *pU32WrtBytes)
5859 {
5860 
5861 #ifdef UTOPIA_20
5862     AUDIO_ST_CHECK_INPUT_REQ Status;
5863     Status.u8Status = FALSE;
5864     Status.pPHYWrtAddr = pPHYWrtAddr;
5865     Status.pU32WrtBytes = pU32WrtBytes;
5866 
5867     if(_AUDIO_IOCtrlOpen() == FALSE)
5868     {
5869         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Check Input Request fail\n", __LINE__);
5870         //return;
5871     }
5872 
5873     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_CheckInputRequest, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
5874     {
5875         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Check Input Request fail\n", __LINE__);
5876         //return;
5877     }
5878 
5879     return Status.u8Status;
5880 
5881 #else
5882 
5883     return _MApi_AUDIO_CheckInputRequest(pPHYWrtAddr, pU32WrtBytes);
5884 
5885 #endif
5886 }
5887 
MApi_AUDIO_SetInput(void)5888 void MApi_AUDIO_SetInput(void)
5889 {
5890 
5891 #ifdef UTOPIA_20
5892 
5893     if(_AUDIO_IOCtrlOpen() == FALSE)
5894     {
5895         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Input fail\n", __LINE__);
5896         return;
5897     }
5898 
5899     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetInput, 0) != UTOPIA_STATUS_SUCCESS)
5900     {
5901         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Input fail\n", __LINE__);
5902         return;
5903     }
5904     return;
5905 
5906 #else
5907 
5908     return _MApi_AUDIO_SetInput();
5909 
5910 #endif
5911 }
5912 
MApi_AUDIO_SetSampleRateIndex(MS_U16 u16Index)5913 void MApi_AUDIO_SetSampleRateIndex(MS_U16 u16Index)
5914 {
5915 
5916 #ifdef UTOPIA_20
5917     MS_U32 u32param = ((MS_U32)u16Index);
5918 
5919     if(_AUDIO_IOCtrlOpen() == FALSE)
5920     {
5921         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Sample Rate Index fail\n", __LINE__);
5922         return;
5923     }
5924 
5925     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetSampleRateIndex, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
5926     {
5927         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Sample Rate Index fail\n", __LINE__);
5928         return;
5929     }
5930     return;
5931 
5932 #else
5933 
5934     return _MApi_AUDIO_SetSampleRateIndex(u16Index);
5935 
5936 #endif
5937 }
5938 
MApi_AUDIO_SetXPCMParam(XPCM_TYPE audioType,MS_U8 channels,MS_U16 sampleRate,MS_U8 bitsPerSample,MS_U16 blockSize,MS_U16 samplePerBlock)5939 void MApi_AUDIO_SetXPCMParam(XPCM_TYPE audioType, MS_U8 channels, MS_U16 sampleRate, MS_U8 bitsPerSample, MS_U16 blockSize, MS_U16 samplePerBlock)
5940 {
5941 #ifdef UTOPIA_20
5942     AUDIO_ST_SET_XPCMPARAM Status;
5943     Status.eAudioType = audioType;
5944     Status.u8Channels = channels;
5945     Status.u16SampleRate = sampleRate;
5946     Status.u8BitsPerSample = bitsPerSample;
5947     Status.u16BlockSize = blockSize;
5948     Status.u16SamplePerBlock = samplePerBlock;
5949 
5950     if(_AUDIO_IOCtrlOpen() == FALSE)
5951     {
5952         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set XPCM Param fail\n", __LINE__);
5953         //return;
5954     }
5955 
5956     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetXPCMParam, &Status) != UTOPIA_STATUS_SUCCESS)
5957     {
5958         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set XPCM Param fail\n", __LINE__);
5959         //return;
5960     }
5961     return;
5962 
5963 #else
5964 
5965     return _MApi_AUDIO_SetXPCMParam(audioType, channels, sampleRate, bitsPerSample, blockSize, samplePerBlock);
5966 
5967 #endif
5968 }
5969 
MApi_AUDIO_FileEndNotification(void)5970 void MApi_AUDIO_FileEndNotification(void)
5971 {
5972 
5973 #ifdef UTOPIA_20
5974 
5975     if(_AUDIO_IOCtrlOpen() == FALSE)
5976     {
5977         ULOGE("AUDIO", "[MAPI AUDIO][%06d] File End Notification fail\n", __LINE__);
5978         return;
5979     }
5980 
5981     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_FileEndNotification, 0) != UTOPIA_STATUS_SUCCESS)
5982     {
5983         ULOGE("AUDIO", "[MAPI AUDIO][%06d] File End Notification fail\n", __LINE__);
5984         return;
5985     }
5986     return;
5987 
5988 #else
5989 
5990     return _MApi_AUDIO_FileEndNotification();
5991 
5992 #endif
5993 }
5994 
MApi_AUDIO_FileEndDataHandle(MS_U32 u32DataLeft)5995 void MApi_AUDIO_FileEndDataHandle(MS_U32 u32DataLeft)
5996 {
5997 
5998 #ifdef UTOPIA_20
5999     MS_U32 u32param = ((MS_U32)u32DataLeft);
6000 
6001     if(_AUDIO_IOCtrlOpen() == FALSE)
6002     {
6003         ULOGE("AUDIO", "[MAPI AUDIO][%06d] File End Data Handle fail\n", __LINE__);
6004         return;
6005     }
6006 
6007     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_FileEndDataHandle, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
6008     {
6009         ULOGE("AUDIO", "[MAPI AUDIO][%06d] File End Data Handle fail\n", __LINE__);
6010         return;
6011     }
6012     return;
6013 
6014 #else
6015 
6016     return _MApi_AUDIO_FileEndDataHandle(u32DataLeft);
6017 
6018 #endif
6019 }
6020 
MApi_AUDIO_GetPlayTick(void)6021 MS_U32 MApi_AUDIO_GetPlayTick(void)
6022 {
6023 
6024 #ifdef UTOPIA_20
6025     MS_U32 u32param[2] = {0};
6026 
6027     if(_AUDIO_IOCtrlOpen() == FALSE)
6028     {
6029         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Play Tick fail\n", __LINE__);
6030         //return;
6031     }
6032 
6033     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetPlayTick, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
6034     {
6035         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Play Tick fail\n", __LINE__);
6036         //return;
6037     }
6038     return u32param[1];
6039 
6040 #else
6041 
6042     return _MApi_AUDIO_GetPlayTick();
6043 
6044 #endif
6045 }
6046 
MApi_AUDIO_GetEsMEMCnt(void)6047 MS_U16 MApi_AUDIO_GetEsMEMCnt(void)
6048 {
6049 
6050 #ifdef UTOPIA_20
6051     MS_U32 u32param[2] = {0};
6052 
6053     if(_AUDIO_IOCtrlOpen() == FALSE)
6054     {
6055         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Es MEM Cnt fail\n", __LINE__);
6056         //return;
6057     }
6058 
6059     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetEsMEMCnt, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
6060     {
6061         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Es MEM Cnt fail\n", __LINE__);
6062         //return;
6063     }
6064     return (MS_U16)u32param[1];
6065 
6066 #else
6067 
6068     return _MApi_AUDIO_GetEsMEMCnt();
6069 
6070 #endif
6071 }
6072 
MApi_AUDIO_SetASFParm(WMA_ASF_PARMTYPE parm_type,MS_U32 value)6073 void MApi_AUDIO_SetASFParm(WMA_ASF_PARMTYPE parm_type, MS_U32 value)
6074 {
6075 
6076 #ifdef UTOPIA_20
6077 	AUDIO_ST_SET_ASFPARM Status;
6078 	Status.eParmType = parm_type;
6079     Status.u32Value = value;
6080 
6081     if(_AUDIO_IOCtrlOpen() == FALSE)
6082     {
6083         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set ASF Parm fail\n", __LINE__);
6084         return;
6085     }
6086 
6087     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetASFParm, &Status) != UTOPIA_STATUS_SUCCESS)
6088     {
6089         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set ASF Parm fail\n", __LINE__);
6090         return;
6091     }
6092     return;
6093 
6094 #else
6095 
6096     return _MApi_AUDIO_SetASFParm(parm_type, value);
6097 
6098 #endif
6099 }
6100 
MApi_AUDIO_MM_SetInput(En_DVB_AudioDecoder AUDDecoderNo,MS_U8 u8IntTag)6101 void MApi_AUDIO_MM_SetInput (En_DVB_AudioDecoder AUDDecoderNo, MS_U8 u8IntTag)
6102 {
6103 
6104 #ifdef UTOPIA_20
6105 	AUDIO_ST_MM_SETINPUT Status;
6106 	Status.eAudDecoderNo = AUDDecoderNo;
6107     Status.u8IntTag = u8IntTag;
6108 
6109     if(_AUDIO_IOCtrlOpen() == FALSE)
6110     {
6111         ULOGE("AUDIO", "[MAPI AUDIO][%06d] MM Set Input fail\n", __LINE__);
6112         return;
6113     }
6114 
6115     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_MM_SetInput, &Status) != UTOPIA_STATUS_SUCCESS)
6116     {
6117         ULOGE("AUDIO", "[MAPI AUDIO][%06d] MM Set Input fail\n", __LINE__);
6118         return;
6119     }
6120     return;
6121 
6122 #else
6123 
6124     return _MApi_AUDIO_MM_SetInput(AUDDecoderNo, u8IntTag);
6125 
6126 #endif
6127 }
6128 
MApi_AUDIO_MM_CheckPlayDone(En_DVB_AudioDecoder AUDDecoderNo)6129 MS_U32 MApi_AUDIO_MM_CheckPlayDone (En_DVB_AudioDecoder AUDDecoderNo)
6130 {
6131 
6132 #ifdef UTOPIA_20
6133 	AUDIO_ST_MM_CHECKPLAYDONE Status;
6134 	Status.u32Ret = 0;
6135 	Status.eAudDecoderNo = AUDDecoderNo;
6136 
6137 
6138     if(_AUDIO_IOCtrlOpen() == FALSE)
6139     {
6140         ULOGE("AUDIO", "[MAPI AUDIO][%06d] MM Check Play Done fail\n", __LINE__);
6141         //return;
6142     }
6143 
6144     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_MM_CheckPlayDone, &Status) != UTOPIA_STATUS_SUCCESS)
6145     {
6146         ULOGE("AUDIO", "[MAPI AUDIO][%06d] MM Check Play Done fail\n", __LINE__);
6147         //return;
6148     }
6149 
6150     return Status.u32Ret;
6151 
6152 #else
6153 
6154     return _MApi_AUDIO_MM_CheckPlayDone(AUDDecoderNo);
6155 
6156 #endif
6157 }
6158 
MApi_AUDIO_MM_CheckInputRequest(En_DVB_AudioDecoder AUDDecoderNo,MS_PHY * pPHYWrtAddr,MS_U32 * pU32WrtBytes)6159 MS_U8 MApi_AUDIO_MM_CheckInputRequest(En_DVB_AudioDecoder AUDDecoderNo, MS_PHY *pPHYWrtAddr, MS_U32 *pU32WrtBytes)
6160 {
6161 
6162 #ifdef UTOPIA_20
6163     AUDIO_ST_MM_CHECK_INPUT_REQ Status;
6164     Status.u8Status = FALSE;
6165     Status.AUDDecoderNo = AUDDecoderNo;
6166     Status.pPHYWrtAddr = pPHYWrtAddr;
6167     Status.pU32WrtBytes = pU32WrtBytes;
6168 
6169     if(_AUDIO_IOCtrlOpen() == FALSE)
6170     {
6171         ULOGE("AUDIO", "[MAPI AUDIO][%06d] MM Check Input Request fail\n", __LINE__);
6172         //return;
6173     }
6174 
6175     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_MM_CheckInputRequest, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
6176     {
6177         ULOGE("AUDIO", "[MAPI AUDIO][%06d] MM Check Input Request fail\n", __LINE__);
6178         //return;
6179     }
6180     return Status.u8Status;
6181 
6182 #else
6183 
6184     return _MApi_AUDIO_MM_CheckInputRequest(AUDDecoderNo, pPHYWrtAddr, pU32WrtBytes);
6185 
6186 #endif
6187 }
6188 
MApi_AUDIO_DmaReader_Init(SAMPLE_RATE sampleRate)6189 void MApi_AUDIO_DmaReader_Init(SAMPLE_RATE sampleRate)
6190 {
6191 
6192 #ifdef UTOPIA_20
6193     MS_U32 u32param = ((MS_U32)sampleRate);
6194 
6195     if(_AUDIO_IOCtrlOpen() == FALSE)
6196     {
6197         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Dma Reader Init fail\n", __LINE__);
6198         return;
6199     }
6200 
6201     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_DmaReader_Init, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
6202     {
6203         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Dma Reader Init fail\n", __LINE__);
6204         return;
6205     }
6206     return;
6207 
6208 #else
6209 
6210     return _MApi_AUDIO_DmaReader_Init(sampleRate);
6211 
6212 #endif
6213 }
6214 
MApi_AUDIO_DmaReader_AllInput_Init(void)6215 void MApi_AUDIO_DmaReader_AllInput_Init(void)
6216 {
6217 
6218 #ifdef UTOPIA_20
6219 
6220     if(_AUDIO_IOCtrlOpen() == FALSE)
6221     {
6222         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Dma Reader All Input Init fail\n", __LINE__);
6223         return;
6224     }
6225 
6226     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_DmaReader_AllInput_Init, 0) != UTOPIA_STATUS_SUCCESS)
6227     {
6228         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Dma Reader All Input Init fail\n", __LINE__);
6229         return;
6230     }
6231     return;
6232 
6233 #else
6234 
6235     return _MApi_AUDIO_DmaReader_AllInput_Init();
6236 
6237 #endif
6238 }
6239 
MApi_AUDIO_DmaReader_WritePCM(void * buffer,MS_U32 bytes)6240 MS_BOOL MApi_AUDIO_DmaReader_WritePCM(void* buffer, MS_U32 bytes)
6241 {
6242 
6243 #ifdef UTOPIA_20
6244     AUDIO_ST_DMAREADER_WRITEPCM Status;
6245     Status.bStatus = FALSE;
6246     Status.pBuffer = buffer;
6247     Status.bytes = bytes;
6248 
6249     if(_AUDIO_IOCtrlOpen() == FALSE)
6250     {
6251         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Dma Reader WritePCM fail\n", __LINE__);
6252         //return;
6253     }
6254 
6255     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_DmaReader_WritePCM, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
6256     {
6257         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Dma Reader WritePCM fail\n", __LINE__);
6258         //return;
6259     }
6260     return Status.bStatus;
6261 
6262 #else
6263 
6264     return _MApi_AUDIO_DmaReader_WritePCM(buffer, bytes);
6265 
6266 #endif
6267 }
6268 
MApi_AUDIO_DmaWriter_Init(void)6269 void MApi_AUDIO_DmaWriter_Init(void)
6270 {
6271 
6272 #ifdef UTOPIA_20
6273 
6274     if(_AUDIO_IOCtrlOpen() == FALSE)
6275     {
6276         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Dma Writer Init fail\n", __LINE__);
6277         return;
6278     }
6279 
6280     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_DmaWrite_Init, 0) != UTOPIA_STATUS_SUCCESS)
6281     {
6282         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Dma Writer Init fail\n", __LINE__);
6283         return;
6284     }
6285     return ;
6286 
6287 #else
6288 
6289     return _MApi_AUDIO_DmaWriter_Init();
6290 
6291 #endif
6292 }
6293 
MApi_AUDIO_USBPCM_Enable(MS_BOOL bEnable)6294 void MApi_AUDIO_USBPCM_Enable(MS_BOOL bEnable)
6295 {
6296 
6297 #ifdef UTOPIA_20
6298     MS_U32 u32param = ((MS_U32)bEnable);
6299 
6300     if(_AUDIO_IOCtrlOpen() == FALSE)
6301     {
6302         ULOGE("AUDIO", "[MAPI AUDIO][%06d] USBPCM Enable fail\n", __LINE__);
6303         return;
6304     }
6305 
6306     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_USBPCM_Enable, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
6307     {
6308         ULOGE("AUDIO", "[MAPI AUDIO][%06d] USBPCM Enable fail\n", __LINE__);
6309         return;
6310     }
6311     return ;
6312 
6313 #else
6314 
6315     return _MApi_AUDIO_USBPCM_Enable(bEnable);
6316 
6317 #endif
6318 }
6319 
MApi_AUDIO_USBPCM_SetFlag(MS_BOOL bEnable)6320 void MApi_AUDIO_USBPCM_SetFlag(MS_BOOL bEnable)
6321 {
6322 
6323 #ifdef UTOPIA_20
6324     MS_U32 u32param = ((MS_U32)bEnable);
6325 
6326     if(_AUDIO_IOCtrlOpen() == FALSE)
6327     {
6328         ULOGE("AUDIO", "[MAPI AUDIO][%06d] USBPCM SetFlag fail\n", __LINE__);
6329         return;
6330     }
6331 
6332     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_USBPCM_SetFlag, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
6333     {
6334         ULOGE("AUDIO", "[MAPI AUDIO][%06d] USBPCM SetFlag fail\n", __LINE__);
6335         return;
6336     }
6337     return ;
6338 
6339 #else
6340 
6341     return _MApi_AUDIO_USBPCM_SetFlag(bEnable);
6342 
6343 #endif
6344 }
6345 
MApi_AUDIO_USBPCM_GetFlag(void)6346 MS_BOOL MApi_AUDIO_USBPCM_GetFlag(void)
6347 {
6348 
6349 #ifdef UTOPIA_20
6350     MS_U32 u32param[2] = {0, 0};
6351 
6352     if(_AUDIO_IOCtrlOpen() == FALSE)
6353     {
6354         ULOGE("AUDIO", "[MAPI AUDIO][%06d] USBPCM GetFlag fail\n", __LINE__);
6355         //return;
6356     }
6357 
6358     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_USBPCM_GetFlag, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
6359     {
6360         ULOGE("AUDIO", "[MAPI AUDIO][%06d] USBPCM GetFlag fail\n", __LINE__);
6361         //return;
6362     }
6363     return (MS_BOOL)u32param[1];
6364 
6365 #else
6366 
6367     return _MApi_AUDIO_USBPCM_GetFlag();
6368 
6369 #endif
6370 }
6371 
MApi_AUDIO_USBPCM_GetMemInfo(AUDIO_UPLOAD_INFO * uploadInfo)6372 void MApi_AUDIO_USBPCM_GetMemInfo(AUDIO_UPLOAD_INFO *uploadInfo)
6373 {
6374 
6375 #ifdef UTOPIA_20
6376 
6377     if(_AUDIO_IOCtrlOpen() == FALSE)
6378     {
6379         ULOGE("AUDIO", "[MAPI AUDIO][%06d] USBPCM Get Mem Info fail\n", __LINE__);
6380         return;
6381     }
6382 
6383     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_USBPCM_GetMemInfo, (void*)uploadInfo) != UTOPIA_STATUS_SUCCESS)
6384     {
6385         ULOGE("AUDIO", "[MAPI AUDIO][%06d] USBPCM Get Mem Info fail\n", __LINE__);
6386         return;
6387     }
6388     return;
6389 
6390 #else
6391 
6392     return _MApi_AUDIO_USBPCM_GetMemInfo(uploadInfo);
6393 
6394 #endif
6395 }
6396 
MApi_AUDIO_PCMCapture_Init(const AUDIO_DEVICE_TYPE eID,const AUDIO_CAPTURE_SOURCE_TYPE eSource)6397 MS_BOOL MApi_AUDIO_PCMCapture_Init(const AUDIO_DEVICE_TYPE eID, const AUDIO_CAPTURE_SOURCE_TYPE eSource)
6398 {
6399 
6400 #ifdef UTOPIA_20
6401     AUDIO_ST_PCMCAPTURE_INIT Status;
6402     Status.bStatus = FALSE;
6403     Status.eID = eID;
6404     Status.eSource = eSource;
6405 
6406     if(_AUDIO_IOCtrlOpen() == FALSE)
6407     {
6408         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Capture Init fail\n", __LINE__);
6409         //return;
6410     }
6411 
6412     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_PCMCapture_Init, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
6413     {
6414         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Capture Init fail\n", __LINE__);
6415         //return;
6416     }
6417     return Status.bStatus;
6418 
6419 #else
6420 
6421     return _MApi_AUDIO_PCMCapture_Init(eID, eSource);
6422 
6423 #endif
6424 }
6425 
MApi_AUDIO_PCMCapture_Start(const AUDIO_DEVICE_TYPE eID)6426 MS_BOOL MApi_AUDIO_PCMCapture_Start(const AUDIO_DEVICE_TYPE eID)
6427 {
6428 
6429 #ifdef UTOPIA_20
6430     AUDIO_ST_PCMCAPTURE_INIT Status;
6431     Status.bStatus = FALSE;
6432     Status.eID = eID;
6433 
6434     if(_AUDIO_IOCtrlOpen() == FALSE)
6435     {
6436         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Capture Start fail\n", __LINE__);
6437         //return;
6438     }
6439 
6440     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_PCMCapture_Start, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
6441     {
6442         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Capture Start fail\n", __LINE__);
6443         //return;
6444     }
6445     return Status.bStatus;
6446 
6447 #else
6448 
6449     return _MApi_AUDIO_PCMCapture_Start(eID);
6450 
6451 #endif
6452 }
6453 
MApi_AUDIO_PCMCapture_Stop(const AUDIO_DEVICE_TYPE eID)6454 MS_BOOL MApi_AUDIO_PCMCapture_Stop(const AUDIO_DEVICE_TYPE eID)
6455 {
6456 
6457 #ifdef UTOPIA_20
6458     AUDIO_ST_PCMCAPTURE_INIT Status;
6459     Status.bStatus = FALSE;
6460     Status.eID = eID;
6461 
6462     if(_AUDIO_IOCtrlOpen() == FALSE)
6463     {
6464         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Capture Stop fail\n", __LINE__);
6465         //return;
6466     }
6467 
6468     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_PCMCapture_Stop, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
6469     {
6470         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Capture Stop fail\n", __LINE__);
6471         //return;
6472     }
6473     return Status.bStatus;
6474 
6475 #else
6476 
6477     return _MApi_AUDIO_PCMCapture_Stop(eID);
6478 
6479 #endif
6480 }
6481 
MApi_AUDIO_PCMCapture_Read(const AUDIO_DEVICE_TYPE eID,void * buffer,const MS_U32 bytes)6482 MS_BOOL MApi_AUDIO_PCMCapture_Read(const AUDIO_DEVICE_TYPE eID, void *buffer, const MS_U32 bytes)
6483 {
6484 
6485 #ifdef UTOPIA_20
6486     AUDIO_ST_PCMCAPTURE_READ Status;
6487     Status.bStatus = FALSE;
6488     Status.eID = eID;
6489     Status.pBuffer = buffer;
6490     Status.bytes = bytes;
6491 
6492     if(_AUDIO_IOCtrlOpen() == FALSE)
6493     {
6494         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Capture Read fail\n", __LINE__);
6495         //return;
6496     }
6497 
6498     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_PCMCapture_Read, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
6499     {
6500         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Capture Read fail\n", __LINE__);
6501         //return;
6502     }
6503     return Status.bStatus;
6504 
6505 #else
6506 
6507     return _MApi_AUDIO_PCMCapture_Read(eID, buffer, bytes);
6508 
6509 #endif
6510 }
6511 
MApi_AUDIO_VoIP_Config(AUDIO_VoIP_CONFIG_TYPE configType,MS_U32 param1,MS_U32 param2)6512 MS_BOOL MApi_AUDIO_VoIP_Config(AUDIO_VoIP_CONFIG_TYPE configType, MS_U32 param1, MS_U32 param2)
6513 {
6514 
6515 #ifdef UTOPIA_20
6516     AUDIO_ST_VOIP_CONFIG Status;
6517     Status.bRet = 0;
6518     Status.eConfigType = configType;
6519     Status.u32Param1 = param1;
6520     Status.u32Param2 = param2;
6521 
6522     if(_AUDIO_IOCtrlOpen() == FALSE)
6523     {
6524         ULOGE("AUDIO", "[MAPI AUDIO][%06d] VoIP Config fail\n", __LINE__);
6525         //return;
6526     }
6527 
6528     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_VoIP_Config, &Status) != UTOPIA_STATUS_SUCCESS)
6529     {
6530         ULOGE("AUDIO", "[MAPI AUDIO][%06d] VoIP Config fail\n", __LINE__);
6531         //return;
6532     }
6533 
6534     return Status.bRet;
6535 
6536 #else
6537 
6538     return _MApi_AUDIO_VoIP_Config(configType, param1, param2);
6539 
6540 #endif
6541 }
6542 
MApi_AUDIO_ALSA_Check(void)6543 MS_BOOL MApi_AUDIO_ALSA_Check(void)
6544 {
6545 
6546 #ifdef UTOPIA_20
6547     MS_U32 u32param[2] = {0, 0};
6548 
6549     if(_AUDIO_IOCtrlOpen() == FALSE)
6550     {
6551         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ALSA Check fail\n", __LINE__);
6552         //return;
6553     }
6554 
6555     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_ALSA_Check, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
6556     {
6557         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ALSA Check fail\n", __LINE__);
6558         //return;
6559     }
6560     return (MS_BOOL)u32param[1];
6561 
6562 #else
6563 
6564     return _MApi_AUDIO_ALSA_Check();
6565 
6566 #endif
6567 }
6568 
MApi_AUDIO_ALSA_Enable(MS_BOOL bEnable)6569 MS_BOOL MApi_AUDIO_ALSA_Enable(MS_BOOL bEnable)
6570 {
6571 
6572 #ifdef UTOPIA_20
6573     AUDIO_ST_ALSA_ENABLE Status;
6574     Status.bRet = 0;
6575     Status.bEnable = bEnable;
6576 
6577     if(_AUDIO_IOCtrlOpen() == FALSE)
6578     {
6579         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ALSA Enable fail\n", __LINE__);
6580         //return;
6581     }
6582 
6583     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_ALSA_Enable, &Status) != UTOPIA_STATUS_SUCCESS)
6584     {
6585         ULOGE("AUDIO", "[MAPI AUDIO][%06d] ALSA Enable fail\n", __LINE__);
6586         //return;
6587     }
6588 
6589     return Status.bRet;
6590 
6591 #else
6592 
6593     return _MApi_AUDIO_ALSA_Enable(bEnable);
6594 
6595 #endif
6596 }
6597 
MApi_AUDIO_UNI_CheckDecodeDone(MS_PHY * pPHYWrtAddr,MS_U32 * pU32WrtBytes)6598 MS_BOOL MApi_AUDIO_UNI_CheckDecodeDone(MS_PHY *pPHYWrtAddr, MS_U32 *pU32WrtBytes)
6599 {
6600 
6601 #ifdef UTOPIA_20
6602     AUDIO_ST_UNI_CHECK_DECODEDONE Status;
6603     Status.bStatus = FALSE;
6604     Status.pPHYWrtAddr = pPHYWrtAddr;
6605     Status.pU32WrtBytes = pU32WrtBytes;
6606 
6607     if(_AUDIO_IOCtrlOpen() == FALSE)
6608     {
6609         ULOGE("AUDIO", "[MAPI AUDIO][%06d] UNI Check Decode Done fail\n", __LINE__);
6610         //return;
6611     }
6612 
6613     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_UNI_CheckDecodeDone, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
6614     {
6615         ULOGE("AUDIO", "[MAPI AUDIO][%06d] UNI Check Decode Done fail\n", __LINE__);
6616         //return;
6617     }
6618 
6619     return Status.bStatus;
6620 
6621 #else
6622 
6623     return _MApi_AUDIO_UNI_CheckDecodeDone(pPHYWrtAddr, pU32WrtBytes);
6624 
6625 #endif
6626 }
6627 
MApi_AUDIO_UNI_SetOutput(MS_U32 PCMOutCnt)6628 void MApi_AUDIO_UNI_SetOutput (MS_U32 PCMOutCnt)
6629 {
6630 
6631 #ifdef UTOPIA_20
6632     MS_U32 u32param = PCMOutCnt;
6633 
6634     if(_AUDIO_IOCtrlOpen() == FALSE)
6635     {
6636         ULOGE("AUDIO", "[MAPI AUDIO][%06d] UNI Set Output fail\n", __LINE__);
6637         return;
6638     }
6639 
6640     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_UNI_SetOutput, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
6641     {
6642         ULOGE("AUDIO", "[MAPI AUDIO][%06d] UNI Set Output fail\n", __LINE__);
6643         return;
6644     }
6645     return;
6646 
6647 #else
6648 
6649     return _MApi_AUDIO_UNI_SetOutput(PCMOutCnt);
6650 
6651 #endif
6652 }
6653 
MApi_AUDIO_UNI_Set_PCMInputWriteAddr(MS_U32 PCMIn_Wptr)6654 void MApi_AUDIO_UNI_Set_PCMInputWriteAddr (MS_U32 PCMIn_Wptr)
6655 {
6656 
6657 #ifdef UTOPIA_20
6658     MS_U32 u32param = PCMIn_Wptr;
6659 
6660     if(_AUDIO_IOCtrlOpen() == FALSE)
6661     {
6662         ULOGE("AUDIO", "[MAPI AUDIO][%06d] UNI Set PCM Input Write Addr fail\n", __LINE__);
6663         return;
6664     }
6665 
6666     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_UNI_Set_PCMInputWriteAddr, (void*)&u32param) != UTOPIA_STATUS_SUCCESS)
6667     {
6668         ULOGE("AUDIO", "[MAPI AUDIO][%06d] UNI Set PCM Input Write Addr fail\n", __LINE__);
6669         return;
6670     }
6671     return;
6672 
6673 #else
6674 
6675     return _MApi_AUDIO_UNI_Set_PCMInputWriteAddr(PCMIn_Wptr);
6676 
6677 #endif
6678 }
6679 
MApi_AUDIO_UNI_Get_OutPCMLevel(void)6680 MS_U32 MApi_AUDIO_UNI_Get_OutPCMLevel (void)
6681 {
6682 
6683 #ifdef UTOPIA_20
6684     MS_U32 u32param[2] = {0, 0};
6685 
6686     if(_AUDIO_IOCtrlOpen() == FALSE)
6687     {
6688         ULOGE("AUDIO", "[MAPI AUDIO][%06d] UNI Get Out PCM Level fail\n", __LINE__);
6689         //return;
6690     }
6691 
6692     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_UNI_Get_OutPCMLevel, (void*)u32param) != UTOPIA_STATUS_SUCCESS)
6693     {
6694         ULOGE("AUDIO", "[MAPI AUDIO][%06d] UNI Get Out PCM Level fail\n", __LINE__);
6695         //return;
6696     }
6697     return (MS_BOOL)u32param[1];
6698 
6699 #else
6700 
6701     return _MApi_AUDIO_UNI_Get_OutPCMLevel();
6702 
6703 #endif
6704 }
6705 
MApi_AUDIO_RingTask(audioRingTask * auRingTask)6706 void MApi_AUDIO_RingTask(audioRingTask* auRingTask)        // this function is used for auto ring address
6707 {
6708 
6709 #ifdef UTOPIA_20
6710 
6711     if(_AUDIO_IOCtrlOpen() == FALSE)
6712     {
6713         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Ring Task fail\n", __LINE__);
6714         return;
6715     }
6716 
6717     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_RingTask, (void*)auRingTask) != UTOPIA_STATUS_SUCCESS)
6718     {
6719         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Ring Task fail\n", __LINE__);
6720         return;
6721     }
6722     return;
6723 
6724 #else
6725 
6726     return _MApi_AUDIO_RingTask(auRingTask);
6727 
6728 #endif
6729 }
6730 
MApi_AUDIO_Ring_DataTransfer(audioRingTask * auRingTask,audioRingTask * auRingTask_1)6731 void MApi_AUDIO_Ring_DataTransfer(audioRingTask* auRingTask, audioRingTask* auRingTask_1)
6732 {
6733 
6734 #ifdef UTOPIA_20
6735     AUDIO_ST_RING_DATA_TRANS st_auRingTask;
6736     st_auRingTask.pauRingTask = auRingTask;
6737     st_auRingTask.pauRingTask_1 = auRingTask_1;
6738 
6739     if(_AUDIO_IOCtrlOpen() == FALSE)
6740     {
6741         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Ring Task Data Transfer fail\n", __LINE__);
6742         return;
6743     }
6744 
6745     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Ring_DataTransfer, (void*)&st_auRingTask) != UTOPIA_STATUS_SUCCESS)
6746     {
6747         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Ring Task Data Transfer fail\n", __LINE__);
6748         return;
6749     }
6750     return;
6751 
6752 #else
6753 
6754     return _MApi_AUDIO_Ring_DataTransfer(auRingTask, auRingTask_1);
6755 
6756 #endif
6757 }
6758 
MApi_AUDIO_MM2_initAesInfo(AUDIO_DEC_ID dec_id)6759 MS_BOOL MApi_AUDIO_MM2_initAesInfo( AUDIO_DEC_ID dec_id )
6760 {
6761 
6762 #ifdef UTOPIA_20
6763     AUDIO_ST_MM2_INITAESINFO Status;
6764     Status.bRet = 0;
6765     Status.eDecId = dec_id;
6766 
6767     if(_AUDIO_IOCtrlOpen() == FALSE)
6768     {
6769         ULOGE("AUDIO", "[MAPI AUDIO][%06d] MM2 Init Aes Info fail\n", __LINE__);
6770         //return;
6771     }
6772 
6773     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_MM2_InitAesInfo, &Status) != UTOPIA_STATUS_SUCCESS)
6774     {
6775         ULOGE("AUDIO", "[MAPI AUDIO][%06d] MM2 Init Aes Info fail\n", __LINE__);
6776         //return;
6777     }
6778 
6779     return Status.bRet;
6780 
6781 #else
6782 
6783     return _MApi_AUDIO_MM2_initAesInfo(dec_id);
6784 
6785 #endif
6786 }
6787 
MApi_AUDIO_MM2_checkAesInfo(AUDIO_DEC_ID dec_id,AES_INFO * aes_info)6788 MS_BOOL MApi_AUDIO_MM2_checkAesInfo( AUDIO_DEC_ID  dec_id, AES_INFO *aes_info )
6789 {
6790 
6791 #ifdef UTOPIA_20
6792     AUDIO_ST_MM2_CHECKAESINFO Status;
6793     Status.dec_id = dec_id;
6794     Status.paes_info = aes_info;
6795 
6796     if(_AUDIO_IOCtrlOpen() == FALSE)
6797     {
6798         ULOGE("AUDIO", "[MAPI AUDIO][%06d] MM2 Check Aes Info fail\n", __LINE__);
6799         //return;
6800     }
6801 
6802     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_MM2_CheckAesInfo, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
6803     {
6804         ULOGE("AUDIO", "[MAPI AUDIO][%06d] MM2 Check Aes Info fail\n", __LINE__);
6805         //return;
6806     }
6807 
6808     return TRUE;
6809 
6810 #else
6811 
6812     return _MApi_AUDIO_MM2_checkAesInfo(dec_id, aes_info);
6813 
6814 #endif
6815 }
6816 
MApi_AUDIO_MM2_inputAesFinished(AUDIO_DEC_ID dec_id,MS_U32 es_size,MS_BOOL ptsExist,MS_U64 pts)6817 MS_BOOL MApi_AUDIO_MM2_inputAesFinished( AUDIO_DEC_ID dec_id, MS_U32 es_size, MS_BOOL ptsExist, MS_U64 pts )
6818 {
6819 
6820 #ifdef UTOPIA_20
6821     AUDIO_ST_MM2_INPUTAES_FINISH Status;
6822     Status.bStatus = FALSE;
6823     Status.dec_id = dec_id;
6824     Status.es_size = es_size;
6825     Status.ptsExist = ptsExist;
6826     Status.pts = pts;
6827 
6828     if(_AUDIO_IOCtrlOpen() == FALSE)
6829     {
6830         ULOGE("AUDIO", "[MAPI AUDIO][%06d] MM2 Input Aes Finished fail\n", __LINE__);
6831         //return;
6832     }
6833 
6834     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_MM2_InputAesFinished, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
6835     {
6836         ULOGE("AUDIO", "[MAPI AUDIO][%06d] MM2 Input Aes Finished fail\n", __LINE__);
6837         //return;
6838     }
6839     return Status.bStatus;
6840 
6841 #else
6842 
6843     return _MApi_AUDIO_MM2_inputAesFinished(dec_id, es_size, ptsExist, pts);
6844 
6845 #endif
6846 }
6847 
MApi_AUDIO_SetAudioParam2(AUDIO_DEC_ID DecId,Audio_ParamType paramType,MS_VIRT Param)6848 MS_BOOL MApi_AUDIO_SetAudioParam2( AUDIO_DEC_ID DecId, Audio_ParamType paramType, MS_VIRT Param )
6849 {
6850 
6851 #ifdef UTOPIA_20
6852     AUDIO_ST_SET_AUDIOPARAM2 Status;
6853     Status.bRet = 0;
6854     Status.eDecId = DecId;
6855     Status.eParamType = paramType;
6856     Status.Param = Param;
6857 
6858     if(_AUDIO_IOCtrlOpen() == FALSE)
6859     {
6860         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Audio Param2 fail\n", __LINE__);
6861         //return;
6862     }
6863 
6864     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_SetAudioParam2, &Status) != UTOPIA_STATUS_SUCCESS)
6865     {
6866         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Set Audio Param2 fail\n", __LINE__);
6867         //return;
6868     }
6869 
6870     return Status.bRet;
6871 
6872 #else
6873 
6874     return _MApi_AUDIO_SetAudioParam2(DecId, paramType, Param );
6875 
6876 #endif
6877 }
6878 
MApi_AUDIO_GetAudioInfo2(AUDIO_DEC_ID DecId,Audio_InfoType infoType,void * pInfo)6879 MS_BOOL MApi_AUDIO_GetAudioInfo2(AUDIO_DEC_ID DecId, Audio_InfoType infoType, void * pInfo )
6880 {
6881 
6882 #ifdef UTOPIA_20
6883     AUDIO_ST_GETAUDIOINFO2 Status;
6884     Status.bStatus = FALSE;
6885     Status.DecId = DecId;
6886     Status.infoType = infoType;
6887     Status.pInfo = pInfo;
6888 
6889     if(_AUDIO_IOCtrlOpen() == FALSE)
6890     {
6891         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Audio Info2 fail\n", __LINE__);
6892         //return;
6893     }
6894 
6895     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetAudioInfo2, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
6896     {
6897         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Audio Info2 fail\n", __LINE__);
6898         //return;
6899     }
6900     return Status.bStatus;
6901 
6902 #else
6903 
6904     return _MApi_AUDIO_GetAudioInfo2(DecId, infoType, pInfo);
6905 
6906 #endif
6907 }
6908 
MApi_AUDIO_GetDDRInfo(AUDIO_DEC_ID DecId,EN_AUDIO_DDRINFO DDRInfo)6909 MS_PHY MApi_AUDIO_GetDDRInfo(AUDIO_DEC_ID DecId, EN_AUDIO_DDRINFO DDRInfo)
6910 {
6911 
6912 #ifdef UTOPIA_20
6913     AUDIO_ST_GET_DDRINFO Status;
6914     Status.Ret = 0;
6915     Status.eDecId = DecId;
6916     Status.eDdrInfo = DDRInfo;
6917 
6918     if(_AUDIO_IOCtrlOpen() == FALSE)
6919     {
6920         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get DDR Info fail\n", __LINE__);
6921         //return;
6922     }
6923 
6924     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetDDRInfo, &Status) != UTOPIA_STATUS_SUCCESS)
6925     {
6926         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get DDR Info fail\n", __LINE__);
6927         //return;
6928     }
6929 
6930     return Status.Ret;
6931 
6932 #else
6933 
6934     return _MApi_AUDIO_GetDDRInfo(DecId, DDRInfo);
6935 
6936 #endif
6937 }
6938 
MApi_AUDIO_GetCaps(AUDIO_DEC_ID DecId,MS_U32 * pCaps)6939 MS_U32 MApi_AUDIO_GetCaps(AUDIO_DEC_ID DecId, MS_U32 *pCaps)
6940 {
6941 
6942 #ifdef UTOPIA_20
6943     AUDIO_ST_GETCAPS Status;
6944     Status.u32Ret = 0;
6945     Status.eDecId= DecId;
6946     Status.pu32Caps= pCaps;
6947 
6948     if(_AUDIO_IOCtrlOpen() == FALSE)
6949     {
6950         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Caps fail\n", __LINE__);
6951         //return;
6952     }
6953 
6954     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_GetCaps, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
6955     {
6956         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Get Caps fail\n", __LINE__);
6957         //return;
6958     }
6959     return Status.u32Ret;
6960 
6961 #else
6962 
6963     return _MApi_AUDIO_GetCaps(DecId, pCaps);
6964 
6965 #endif
6966 }
6967 
MApi_AUDIO_PCM_Open(void * pData)6968 MS_S32 MApi_AUDIO_PCM_Open(void *pData)
6969 {
6970 
6971 #ifdef UTOPIA_20
6972     AUDIO_ST_PCM_OPEN Status;
6973     Status.s32Ret = 0;
6974     Status.pData = pData;
6975 
6976     if(_AUDIO_IOCtrlOpen() == FALSE)
6977     {
6978         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Open fail\n", __LINE__);
6979     }
6980 
6981     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_PcmOpen, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
6982     {
6983         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Open fail\n", __LINE__);
6984     }
6985     return Status.s32Ret;
6986 
6987 #else
6988 
6989     return _MApi_AUDIO_PCM_Open(pData);
6990 
6991 #endif
6992 }
6993 
MApi_AUDIO_PCM_Close(MS_S32 s32DeviceId)6994 MS_S32 MApi_AUDIO_PCM_Close(MS_S32 s32DeviceId)
6995 {
6996 
6997 #ifdef UTOPIA_20
6998     AUDIO_ST_PCM_CLOSE Status;
6999     Status.s32Ret = 0;
7000     Status.s32DeviceId = s32DeviceId;
7001 
7002     if(_AUDIO_IOCtrlOpen() == FALSE)
7003     {
7004         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Close fail\n", __LINE__);
7005     }
7006 
7007     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_PcmClose, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
7008     {
7009         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Close fail\n", __LINE__);
7010     }
7011     return Status.s32Ret;
7012 
7013 #else
7014 
7015     return _MApi_AUDIO_PCM_Close(s32DeviceId);
7016 
7017 #endif
7018 }
7019 
MApi_AUDIO_PCM_Start(MS_S32 s32DeviceId)7020 MS_S32 MApi_AUDIO_PCM_Start(MS_S32 s32DeviceId)
7021 {
7022 
7023 #ifdef UTOPIA_20
7024     AUDIO_ST_PCM_START Status;
7025     Status.s32Ret = 0;
7026     Status.s32DeviceId = s32DeviceId;
7027 
7028     if(_AUDIO_IOCtrlOpen() == FALSE)
7029     {
7030         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Start fail\n", __LINE__);
7031     }
7032 
7033     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_PcmStart, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
7034     {
7035         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Start fail\n", __LINE__);
7036     }
7037     return Status.s32Ret;
7038 
7039 #else
7040 
7041     return _MApi_AUDIO_PCM_Start(s32DeviceId);
7042 
7043 #endif
7044 }
7045 
MApi_AUDIO_PCM_Stop(MS_S32 s32DeviceId)7046 MS_S32 MApi_AUDIO_PCM_Stop(MS_S32 s32DeviceId)
7047 {
7048 
7049 #ifdef UTOPIA_20
7050     AUDIO_ST_PCM_STOP Status;
7051     Status.s32Ret = 0;
7052     Status.s32DeviceId = s32DeviceId;
7053 
7054     if(_AUDIO_IOCtrlOpen() == FALSE)
7055     {
7056         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Stop fail\n", __LINE__);
7057     }
7058 
7059     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_PcmStop, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
7060     {
7061         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Stop fail\n", __LINE__);
7062     }
7063     return Status.s32Ret;
7064 
7065 #else
7066 
7067     return _MApi_AUDIO_PCM_Stop(s32DeviceId);
7068 
7069 #endif
7070 }
7071 
MApi_AUDIO_PCM_Set(MS_S32 s32DeviceId,MS_U32 u32Cmd,const void * pData)7072 MS_S32 MApi_AUDIO_PCM_Set(MS_S32 s32DeviceId, MS_U32 u32Cmd, const void *pData)
7073 {
7074 
7075 #ifdef UTOPIA_20
7076     AUDIO_ST_PCM_SET Status;
7077     Status.s32Ret = 0;
7078     Status.s32DeviceId = s32DeviceId;
7079     Status.u32Cmd = u32Cmd;
7080     Status.pData = pData;
7081 
7082     if(_AUDIO_IOCtrlOpen() == FALSE)
7083     {
7084         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Set fail\n", __LINE__);
7085     }
7086 
7087     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_PcmSet, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
7088     {
7089         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Set fail\n", __LINE__);
7090     }
7091     return Status.s32Ret;
7092 
7093 #else
7094 
7095     return _MApi_AUDIO_PCM_Set(s32DeviceId, u32Cmd, pData);
7096 
7097 #endif
7098 }
7099 
MApi_AUDIO_PCM_Get(MS_S32 s32DeviceId,MS_U32 u32Cmd,void * pData)7100 MS_S32 MApi_AUDIO_PCM_Get(MS_S32 s32DeviceId, MS_U32 u32Cmd, void *pData)
7101 {
7102 
7103 #ifdef UTOPIA_20
7104     AUDIO_ST_PCM_GET Status;
7105     Status.s32Ret = 0;
7106     Status.s32DeviceId = s32DeviceId;
7107     Status.u32Cmd = u32Cmd;
7108     Status.pData = pData;
7109 
7110     if(_AUDIO_IOCtrlOpen() == FALSE)
7111     {
7112         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Get fail\n", __LINE__);
7113     }
7114 
7115     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_PcmGet, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
7116     {
7117         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Get fail\n", __LINE__);
7118     }
7119     return Status.s32Ret;
7120 
7121 #else
7122 
7123     return _MApi_AUDIO_PCM_Get(s32DeviceId, u32Cmd, pData);
7124 
7125 #endif
7126 }
7127 
MApi_AUDIO_PCM_Read(MS_S32 s32DeviceId,void * pBuf,MS_U32 u32Size)7128 MS_U32 MApi_AUDIO_PCM_Read(MS_S32 s32DeviceId, void *pBuf, MS_U32 u32Size)
7129 {
7130 
7131 #ifdef UTOPIA_20
7132     AUDIO_ST_PCM_READ Status;
7133     Status.u32Ret = 0;
7134     Status.s32DeviceId = s32DeviceId;
7135     Status.u32Size = u32Size;
7136     Status.pBuf = pBuf;
7137 
7138     if(_AUDIO_IOCtrlOpen() == FALSE)
7139     {
7140         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Read fail\n", __LINE__);
7141     }
7142 
7143     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_PcmRead, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
7144     {
7145         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Read fail\n", __LINE__);
7146     }
7147     return Status.u32Ret;
7148 
7149 #else
7150 
7151     return _MApi_AUDIO_PCM_Read(s32DeviceId, pBuf, u32Size);
7152 
7153 #endif
7154 }
7155 
MApi_AUDIO_PCM_Write(MS_S32 s32DeviceId,const void * pBuf,MS_U32 u32Size)7156 MS_U32 MApi_AUDIO_PCM_Write(MS_S32 s32DeviceId, const void *pBuf, MS_U32 u32Size)
7157 {
7158 
7159 #ifdef UTOPIA_20
7160     AUDIO_ST_PCM_WRITE Status;
7161     Status.u32Ret = 0;
7162     Status.s32DeviceId = s32DeviceId;
7163     Status.u32Size = u32Size;
7164     Status.pBuf = pBuf;
7165 
7166     if(_AUDIO_IOCtrlOpen() == FALSE)
7167     {
7168         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Write fail\n", __LINE__);
7169     }
7170 
7171     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_PcmWrite, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
7172     {
7173         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Write fail\n", __LINE__);
7174     }
7175     return Status.u32Ret;
7176 
7177 #else
7178 
7179     return _MApi_AUDIO_PCM_Write(s32DeviceId, pBuf, u32Size);
7180 
7181 #endif
7182 }
7183 
MApi_AUDIO_PCM_Flush(MS_S32 s32DeviceId)7184 MS_S32 MApi_AUDIO_PCM_Flush(MS_S32 s32DeviceId)
7185 {
7186 
7187 #ifdef UTOPIA_20
7188     AUDIO_ST_PCM_FLUSH Status;
7189     Status.s32Ret = 0;
7190     Status.s32DeviceId = s32DeviceId;
7191 
7192     if(_AUDIO_IOCtrlOpen() == FALSE)
7193     {
7194         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Flush fail\n", __LINE__);
7195     }
7196 
7197     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_PcmFlush, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
7198     {
7199         ULOGE("AUDIO", "[MAPI AUDIO][%06d] PCM Flush fail\n", __LINE__);
7200     }
7201     return Status.s32Ret;
7202 
7203 #else
7204 
7205     return _MApi_AUDIO_PCM_Flush(s32DeviceId);
7206 
7207 #endif
7208 }
7209 
MApi_AUDIO_ENCODER_Open(const char * pName)7210 MS_S32 MApi_AUDIO_ENCODER_Open(const char *pName)
7211 {
7212 
7213 #ifdef UTOPIA_20
7214     AUDIO_ST_ENCODER_OPEN Status;
7215     Status.s32Ret = 0;
7216     Status.pName = pName;
7217 
7218     if(_AUDIO_IOCtrlOpen() == FALSE)
7219     {
7220         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Encoder Open fail\n", __LINE__);
7221     }
7222 
7223     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_EncoderOpen, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
7224     {
7225         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Encoder Open fail\n", __LINE__);
7226     }
7227     return Status.s32Ret;
7228 
7229 #else
7230 
7231     return _MApi_AUDIO_ENCODER_Open(pName);
7232 
7233 #endif
7234 }
7235 
MApi_AUDIO_ENCODER_Close(MS_S32 s32DeviceId)7236 MS_S32 MApi_AUDIO_ENCODER_Close(MS_S32 s32DeviceId)
7237 {
7238 
7239 #ifdef UTOPIA_20
7240     AUDIO_ST_ENCODER_CLOSE Status;
7241     Status.s32Ret = 0;
7242     Status.s32DeviceId = s32DeviceId;
7243 
7244     if(_AUDIO_IOCtrlOpen() == FALSE)
7245     {
7246         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Encoder Close fail\n", __LINE__);
7247     }
7248 
7249     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_EncoderClose, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
7250     {
7251         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Encoder Close fail\n", __LINE__);
7252     }
7253     return Status.s32Ret;
7254 
7255 #else
7256 
7257     return _MApi_AUDIO_ENCODER_Close(s32DeviceId);
7258 
7259 #endif
7260 }
7261 
MApi_AUDIO_ENCODER_Start(MS_S32 s32DeviceId)7262 MS_S32 MApi_AUDIO_ENCODER_Start(MS_S32 s32DeviceId)
7263 {
7264 
7265 #ifdef UTOPIA_20
7266     AUDIO_ST_ENCODER_START Status;
7267     Status.s32Ret = 0;
7268     Status.s32DeviceId = s32DeviceId;
7269 
7270     if(_AUDIO_IOCtrlOpen() == FALSE)
7271     {
7272         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Encoder Start fail\n", __LINE__);
7273     }
7274 
7275     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_EncoderStart, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
7276     {
7277         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Encoder Start fail\n", __LINE__);
7278     }
7279     return Status.s32Ret;
7280 
7281 #else
7282 
7283     return _MApi_AUDIO_ENCODER_Start(s32DeviceId);
7284 
7285 #endif
7286 }
7287 
MApi_AUDIO_ENCODER_Stop(MS_S32 s32DeviceId)7288 MS_S32 MApi_AUDIO_ENCODER_Stop(MS_S32 s32DeviceId)
7289 {
7290 
7291 #ifdef UTOPIA_20
7292     AUDIO_ST_ENCODER_STOP Status;
7293     Status.s32Ret = 0;
7294     Status.s32DeviceId = s32DeviceId;
7295 
7296     if(_AUDIO_IOCtrlOpen() == FALSE)
7297     {
7298         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Encoder Stop fail\n", __LINE__);
7299     }
7300 
7301     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_EncoderStop, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
7302     {
7303         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Encoder Stop fail\n", __LINE__);
7304     }
7305     return Status.s32Ret;
7306 
7307 #else
7308 
7309     return _MApi_AUDIO_ENCODER_Stop(s32DeviceId);
7310 
7311 #endif
7312 }
7313 
MApi_AUDIO_ENCODER_Ioctl(MS_S32 s32DeviceId,const char * pCmd,void * pData)7314 MS_S32 MApi_AUDIO_ENCODER_Ioctl(MS_S32 s32DeviceId, const char *pCmd, void *pData)
7315 {
7316 
7317 #ifdef UTOPIA_20
7318     AUDIO_ST_ENCODER_IOCTL Status;
7319     Status.s32Ret = 0;
7320     Status.s32DeviceId = s32DeviceId;
7321     Status.pCmd = pCmd;
7322     Status.pData = pData;
7323 
7324     if(_AUDIO_IOCtrlOpen() == FALSE)
7325     {
7326         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Encoder Get fail\n", __LINE__);
7327     }
7328 
7329     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_EncoderIoctl, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
7330     {
7331         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Encoder Get fail\n", __LINE__);
7332     }
7333     return Status.s32Ret;
7334 
7335 #else
7336 
7337     return _MApi_AUDIO_ENCODER_Ioctl(s32DeviceId, pCmd, pData);
7338 
7339 #endif
7340 }
7341 
MApi_AUDIO_ENCODER_Read(MS_S32 s32DeviceId,void * pBuf,MS_U32 u32Size)7342 MS_U32 MApi_AUDIO_ENCODER_Read(MS_S32 s32DeviceId, void *pBuf, MS_U32 u32Size)
7343 {
7344 
7345 #ifdef UTOPIA_20
7346     AUDIO_ST_ENCODER_READ Status;
7347     Status.u32Ret = 0;
7348     Status.s32DeviceId = s32DeviceId;
7349     Status.u32Size = u32Size;
7350     Status.pBuf = pBuf;
7351 
7352     if(_AUDIO_IOCtrlOpen() == FALSE)
7353     {
7354         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Encoder Read fail\n", __LINE__);
7355     }
7356 
7357     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_EncoderRead, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
7358     {
7359         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Encoder Read fail\n", __LINE__);
7360     }
7361     return Status.u32Ret;
7362 
7363 #else
7364 
7365     return _MApi_AUDIO_ENCODER_Read(s32DeviceId, pBuf, u32Size);
7366 
7367 #endif
7368 }
7369 
MApi_AUDIO_ENCODER_Flush(MS_S32 s32DeviceId)7370 MS_S32 MApi_AUDIO_ENCODER_Flush(MS_S32 s32DeviceId)
7371 {
7372 
7373 #ifdef UTOPIA_20
7374     AUDIO_ST_ENCODER_FLUSH Status;
7375     Status.s32Ret = 0;
7376     Status.s32DeviceId = s32DeviceId;
7377 
7378     if(_AUDIO_IOCtrlOpen() == FALSE)
7379     {
7380         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Encoder Flush fail\n", __LINE__);
7381     }
7382 
7383     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_EncoderFlush, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
7384     {
7385         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Encoder Flush fail\n", __LINE__);
7386     }
7387     return Status.s32Ret;
7388 
7389 #else
7390 
7391     return _MApi_AUDIO_ENCODER_Flush(s32DeviceId);
7392 
7393 #endif
7394 }
7395 
7396 #if 0
7397 ////     TEST   Block   ////
7398 #define TEST_GOP1 0
7399 #define TEST_GOP2 0
7400 #define TEST_GOP3 0
7401 #define TEST_GOP4 0
7402 #define TEST_GOP5 0
7403 #define TEST_GOP7 0
7404 #define TEST_GOP8 0
7405 #define TEST_GOP9 0
7406 #define TEST_GOP10 0
7407 #define TEST_GOP11 0
7408 
7409 int VT_Count = 0;
7410 
7411 void MApi_AUDIO_EnableAutoVolume(MS_BOOL EnAVC)
7412 {
7413     //AUDIO_PRINT(AUDIO_DEBUG_LEVEL_DEBUG, "[%s] %d\n", __FUNCTION__, __LINE__);
7414 
7415 #ifdef UTOPIA_20
7416     MS_U32 u32Param[4] = {0,0,0,0};
7417     u32Param[0] = EnAVC;
7418     AUDIO_ST_SOUND_SETPARAM Status;
7419     Status.bStatus = FALSE;
7420     Status.eType = Sound_SET_Type_EnableAutoVolume;
7421     Status.pParam = (MS_U32*)u32Param;
7422 
7423     if(_AUDIO_IOCtrlOpen() == FALSE)
7424     {
7425         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable Auto Volume fail\n", __LINE__);
7426         return;
7427     }
7428 
7429     #if 1
7430     if(VT_Count < 5)
7431     {
7432         if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_Sound_SetParam, (void*)&Status) != UTOPIA_STATUS_SUCCESS)
7433         {
7434             ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable Auto Volume fail\n", __LINE__);
7435             return;
7436         }
7437         VT_Count++;
7438 
7439     }
7440     else
7441     {
7442 
7443         // Test block
7444         VT_Count++;
7445         // Test block end
7446 
7447         #if (TEST_GOP1 == 1)        //audio system
7448         MS_U16 u16Data = 0;
7449         MApi_AUDIO_SetPowerOn(TRUE);
7450         u16Data = MApi_AUDIO_ReadMailBox(0, 5);
7451         MApi_AUDIO_WriteMailBox(0, 5, u16Data);
7452         MApi_AUDIO_FwTriggerDSP(0);
7453         MApi_AUDIO_SetFwStatus(TRUE);
7454         MApi_AUDIO_I2S_SetMode(AUDIO_I2S_SOURCE_CH, 0);
7455         MApi_AUDIO_EnaEarphone_LowPower_Stage();
7456         MApi_AUDIO_EnaEarphone_HighDriving_Stage();
7457         MApi_AUDIO_SendIntrupt(0, 0);
7458         MApi_AUDIO_RebootDsp(DSP_SE);
7459         MApi_AUDIO_ExitAudioSystem();
7460         MApi_AUDIO_SetSystem(MSAPI_AUD_DVB_MPEG);
7461         #endif
7462 
7463         #if (TEST_GOP2 == 1)        //audio sound
7464         MS_U16 u16Data = 0;
7465         MS_U32 u32Data = 0;
7466         u32Data = u16Data = MApi_SND_GetParam1(Sound_GET_PARAM_EQ, 0);
7467         MApi_AUDIO_SOUND_SetParam(Sound_GET_PARAM_EQ, &u32Data);
7468         MApi_AUDIO_SetPreScale(0, 0x6F);
7469         MApi_AUDIO_SourceConnect(E_CONNECT_KTV, TRUE);
7470         MApi_AUDIO_SetDynamicBass(0x0C);
7471         MApi_AUDIO_AbsoluteBass(0);
7472         MApi_AUDIO_AbsoluteTreble(0);
7473         MApi_AUDIO_ConvertVolumeUnit(100);
7474         AUDIO_PEQ_COEF eq_coef;
7475         eq_coef.band = 0;
7476         eq_coef.sfs = 0;
7477         eq_coef.scale = 0;
7478         eq_coef.a0 = 0;
7479         eq_coef.a1 = 0;
7480         eq_coef.a2 = 0;
7481         eq_coef.b1 = 0;
7482         eq_coef.b2 = 0;
7483         eq_coef.type = AUDIO_COEF_PEQ;
7484         eq_coef.enable = FALSE;
7485         eq_coef.precision = AUDIO_SINGLE_PRECISION;
7486         MApi_AUDIO_SetPEQCoef(&eq_coef);
7487         MApi_AUDIO_EnablePEQ(FALSE);
7488         MApi_AUDIO_EnableDcRemove(TRUE);
7489         #endif
7490 
7491         #if (TEST_GOP3 == 1)        //audio DTV
7492         MApi_AUDIO_GetMAD_LOCK();
7493         MApi_AUDIO_ReleaseDecodeSystem(AU_DEC_MAX);
7494         AudioDecStatus_t AudioDecStatus;
7495         MApi_AUDIO_GetDecodeSystem(AU_DEC_ID1, &AudioDecStatus);
7496         MApi_AUDIO_SetDecodeSystem(AU_DEC_ID1, &AudioDecStatus);
7497         MApi_AUDIO_SetDecodeCmd(AU_DEC_ID1, MSAPI_AUD_DVB_DECCMD_PLAY);
7498         MApi_AUDIO_GetDecSysSupportStatus(MSAPI_AUD_DVB_MPEG);
7499         MApi_AUDIO_GetDecStatus();
7500         MApi_AUDIO_GetCommand(DVB_Audio_Decoder1);
7501         #endif
7502 
7503         #if (TEST_GOP4 == 1)        //audio pvr
7504         MApi_AUDIO_SetEncInit(AU_DVB_ENCBR_192K, 2);
7505         MApi_AUDIO_SetEncCommand(AU_DVB_ENCCMD_STOP);
7506         AU_DVB_ENC_FRAME_INFO EncFrameInfo;
7507         MApi_AUDIO_GetEncodeFrameInfo(&EncFrameInfo);
7508         MApi_AUDIO_GetEncodeDoneFlag();
7509         #endif
7510 
7511         #if (TEST_GOP5 == 1)        // audio atv
7512         MApi_AUDIO_SIF_StartAutoStandardDetection();
7513         MApi_AUDIO_SIF_GetResultOfAutoStandardDetection();
7514         #endif
7515 
7516         #if (TEST_GOP7 == 1)        // audio SPDIF
7517         MApi_AUDIO_SPDIF_SetMute(FALSE);
7518         MApi_AUDIO_SPDIF_GetMode();
7519         Digital_Out_Channel_Status_t stChannelStatus;
7520         MApi_AUDIO_DigitalOut_SetChannelStatus(DIGITAL_SPDIF_OUTPUT, &stChannelStatus);
7521         #endif
7522 
7523         #if (TEST_GOP8 == 1)        //audio hdmi
7524         MS_BOOL onOff = FALSE;
7525         AUDIO_FS_TYPE hdmi_smpFreq = 0;
7526         HDMI_TX_OUTPUT_TYPE outType = 1;
7527         MApi_AUDIO_HDMI_Tx_GetStatus(&onOff, &hdmi_smpFreq, &outType);
7528         MApi_AUDIO_HDMI_Monitor();
7529         MApi_AUDIO_HDMI_SetNonpcm(FALSE);
7530         MApi_AUDIO_DTV_HDMI_CFG(1);
7531         MApi_AUDIO_HDMI_GetSynthFreq();
7532         MApi_AUDIO_HDMI_SetDownSample(0);
7533         ST_HDMI_AUDIO_STATUS hdmiAudioSts;
7534         MApi_AUDIO_HDMI_RX_GetHdmiInAudioStatus(&hdmiAudioSts);
7535         #endif
7536 
7537         #if (TEST_GOP9 == 1)        // audio advance
7538         MApi_AUDIO_SeInit();
7539         MApi_AUDIO_ADVSOUND_SetParam(0, 0, 0);
7540         MApi_AUDIO_ADVSND_SetParam(0, 0, 0);
7541         MApi_AUDIO_ADVSOUND_GetInfo(0);
7542         MApi_DBXTV_SetMode(0, 0, 0, 0);
7543         MApi_AUDIO_SetAdvSndSys(MSAPI_AUD_ADVSND_BBE);
7544         MApi_AUDIO_SetVDS(0);
7545         MApi_AUDIO_SetVSPK(0);
7546         MApi_AUDIO_SetSRS(0);
7547         MApi_AUDIO_SetBBE(0, 1);
7548         MApi_AUDIO_VSPK_WMod(1);
7549         MApi_AUDIO_VSPK_SMod(1);
7550         MApi_AUDIO_SRS_DC(1);
7551         MApi_AUDIO_SRS_TruBass(1);
7552         MApi_AUDIO_SRS_SetTsxtPara(0, 0);
7553         MApi_AUDIO_SetSRSTSHD(1);
7554         MApi_AUDIO_TSHD_Definition(0);
7555         MApi_AUDIO_SRS_SetTshdPara(0, 0);
7556         #endif
7557 
7558         #if (TEST_GOP10 == 1)       //audio dtv
7559         MApi_AUDIO_GetKTVInfo (0, 0);
7560         MApi_AUDIO_SetKTVInfo (0, 0, 0, 2);
7561         MApi_AUDIO_SetMixModeVolume(0, 0, 0, 0);
7562         MApi_AUDIO_SetMixModeMute(0, 0, TRUE);
7563         MApi_AUDIO_PlayMenuSound();
7564         #endif
7565 
7566         #if (TEST_GOP11 == 1)      //audio MM
7567         MApi_AUDIO_Init(MSAPI_AUD_DVB_MPEG);
7568         MApi_AUDIO_SetAACInfo(Audio_AAC_error_count, 0, 0);
7569         MApi_AUDIO_GetMpegInfo(Audio_MPEG_infoType_DecStatus);
7570         MApi_AUDIO_GetAC3Info(Audio_AC3_infoType_DecStatus);
7571         MApi_AUDIO_GetAACInfo(Audio_AAC_error_count);
7572         MApi_AUDIO_GetWmaInfo(Audio_WMA_infoType_DecStatus);
7573         MApi_AUDIO_GetDTSInfo(Audio_DTS_infoType_DecStatus);
7574         MApi_AUDIO_XPCM_Param(LPCM, 0, 0, 0, 0, 0);
7575         MApi_AUDIO_XPCM2_CheckIntStatus();
7576         MApi_AUDIO_StartBrowse();
7577         MApi_AUDIO_PauseDecode();
7578         MApi_AUDIO_CheckPlayDone();
7579         MApi_AUDIO_GetResidualBufferSize();
7580         MApi_AUDIO_GetPCMBufferSize(100);
7581         MApi_AUDIO_GetPCMBufferSize2(100,100);
7582         MApi_AUDIO_GetCurrentFrameNumber();
7583         MApi_AUDIO_GetSampleRate();
7584         MApi_AUDIO_GetBitRate();
7585         MApi_AUDIO_GetLayer();
7586         MApi_AUDIO_SetSampleRateIndex(1);
7587         MApi_AUDIO_FileEndNotification();
7588         MApi_AUDIO_GetEsMEMCnt();
7589         MApi_AUDIO_MM_SetInput (0, 0);
7590         MApi_AUDIO_MM_CheckPlayDone (0);
7591         MS_U32 u32WrtAddr = 0x1000;
7592         MS_U32 u32WrtByte = 10;
7593         MApi_AUDIO_MM_CheckInputRequest(0, &u32WrtAddr, &u32WrtByte);
7594         MApi_AUDIO_DmaReader_Init(0);
7595         MApi_AUDIO_DmaReader_AllInput_Init();
7596         MS_U32 buff = 0;
7597         //MApi_AUDIO_DmaReader_WritePCM(&buff, u32WrtByte);     // core dump cause by buffer address
7598         MApi_AUDIO_DmaWriter_Init();
7599         MApi_AUDIO_USBPCM_Enable(FALSE);
7600         MApi_AUDIO_USBPCM_SetFlag(FALSE);
7601         MApi_AUDIO_USBPCM_GetFlag();
7602         AUDIO_UPLOAD_INFO uploadInfo;
7603         MApi_AUDIO_USBPCM_GetMemInfo(&uploadInfo);
7604         MApi_AUDIO_PCMCapture_Init(0, 0);
7605         MApi_AUDIO_PCMCapture_Start(0);
7606         MApi_AUDIO_PCMCapture_Stop(0);
7607         MApi_AUDIO_PCMCapture_Read(0, &buff, u32WrtByte);
7608         MApi_AUDIO_VoIP_Config(0, 0, 0);
7609         MApi_AUDIO_ALSA_Check();
7610         MApi_AUDIO_ALSA_Enable(FALSE);
7611         MApi_AUDIO_UNI_CheckDecodeDone(&u32WrtAddr, &u32WrtByte);
7612         MApi_AUDIO_UNI_SetOutput(0);
7613         MApi_AUDIO_UNI_Set_PCMInputWriteAddr (0);
7614         MApi_AUDIO_UNI_Get_OutPCMLevel();
7615         audioRingTask auRingTask, auRingTask_1;
7616         MApi_AUDIO_RingTask(&auRingTask) ;
7617         MApi_AUDIO_Ring_DataTransfer(&auRingTask, &auRingTask_1);
7618         MApi_AUDIO_SetAudioParam2(0, 0, 0);
7619         MApi_AUDIO_GetAudioInfo2(0, 0, &buff);
7620         MApi_AUDIO_GetDDRInfo(0, 0);
7621         #endif
7622     }
7623     #else
7624     if (UtopiaIoctl(_pInstantAudio, MApi_CMD_AUDIO_EnableAutoVolume, (void*)&u32Param) != UTOPIA_STATUS_SUCCESS)
7625     {
7626         ULOGE("AUDIO", "[MAPI AUDIO][%06d] Enable Auto Volume fail\n", __LINE__);
7627         return;
7628     }
7629     #endif
7630     //AUDIO_PRINT(AUDIO_DEBUG_LEVEL_DEBUG, "[%s] Return 0\n", __FUNCTION__);
7631     return;
7632 
7633 #else   //utopia 1.0
7634     if(VT_Count < 5)
7635     {
7636         VT_Count++;
7637             return _MApi_AUDIO_EnableAutoVolume(EnAVC);
7638     }
7639     else
7640     {
7641 
7642         #if (TEST_GOP1 == 1)        //audio system
7643         MS_U16 u16Data = 0;
7644         MApi_AUDIO_SetPowerOn(TRUE);
7645         u16Data = MApi_AUDIO_ReadMailBox(0, 5);
7646         MApi_AUDIO_WriteMailBox(0, 5, u16Data);
7647         MApi_AUDIO_FwTriggerDSP(0);
7648         MApi_AUDIO_SetFwStatus(TRUE);
7649         MApi_AUDIO_I2S_SetMode(AUDIO_I2S_SOURCE_CH, 0);
7650         MApi_AUDIO_EnaEarphone_LowPower_Stage();
7651         MApi_AUDIO_EnaEarphone_HighDriving_Stage();
7652         MApi_AUDIO_SendIntrupt(0, 0);
7653         MApi_AUDIO_RebootDsp(DSP_SE);
7654         MApi_AUDIO_ExitAudioSystem();
7655         MApi_AUDIO_SetSystem(MSAPI_AUD_DVB_MPEG);
7656         #endif
7657 
7658         #if (TEST_GOP2 == 1)        //audio sound
7659         MS_U16 u16Data = 0;
7660         MS_U32 u32Data = 0;
7661 
7662         u32Data = u16Data = MApi_SND_GetParam1(Sound_GET_PARAM_EQ, 0);
7663         MApi_AUDIO_SOUND_SetParam(Sound_GET_PARAM_EQ, &u32Data);
7664         MApi_AUDIO_SetPreScale(0, 0x6F);
7665         MApi_AUDIO_SourceConnect(E_CONNECT_KTV, TRUE);
7666         MApi_AUDIO_SetDynamicBass(0x0C);
7667         MApi_AUDIO_AbsoluteBass(0);
7668         MApi_AUDIO_AbsoluteTreble(0);
7669         MApi_AUDIO_ConvertVolumeUnit(100);
7670 
7671         AUDIO_PEQ_COEF eq_coef;
7672         eq_coef.band = 0;
7673         eq_coef.sfs = 0;
7674         eq_coef.scale = 0;
7675         eq_coef.a0 = 0;
7676         eq_coef.a1 = 0;
7677         eq_coef.a2 = 0;
7678         eq_coef.b1 = 0;
7679         eq_coef.b2 = 0;
7680         eq_coef.type = AUDIO_COEF_PEQ;
7681         eq_coef.enable = FALSE;
7682         eq_coef.precision = AUDIO_SINGLE_PRECISION;
7683         MApi_AUDIO_SetPEQCoef(&eq_coef);
7684         MApi_AUDIO_EnablePEQ(FALSE);
7685         MApi_AUDIO_EnableDcRemove(TRUE);
7686         #endif
7687 
7688         #if (TEST_GOP3 == 1)        //audio DTV
7689         MApi_AUDIO_GetMAD_LOCK();
7690         MApi_AUDIO_ReleaseDecodeSystem(AU_DEC_MAX);
7691         AudioDecStatus_t AudioDecStatus;
7692         MApi_AUDIO_GetDecodeSystem(AU_DEC_ID1, &AudioDecStatus);
7693         MApi_AUDIO_SetDecodeSystem(AU_DEC_ID1, &AudioDecStatus);
7694         MApi_AUDIO_SetDecodeCmd(AU_DEC_ID1, MSAPI_AUD_DVB_DECCMD_PLAY);
7695         MApi_AUDIO_GetDecSysSupportStatus(MSAPI_AUD_DVB_MPEG);
7696         MApi_AUDIO_GetDecStatus();
7697         MApi_AUDIO_GetCommand(DVB_Audio_Decoder1);
7698         #endif
7699 
7700         #if (TEST_GOP4 == 1)        //audio pvr
7701         MApi_AUDIO_SetEncInit(AU_DVB_ENCBR_192K, 2);
7702         MApi_AUDIO_SetEncCommand(AU_DVB_ENCCMD_STOP);
7703         AU_DVB_ENC_FRAME_INFO EncFrameInfo;
7704         MApi_AUDIO_GetEncodeFrameInfo(&EncFrameInfo);
7705         MApi_AUDIO_GetEncodeDoneFlag();
7706         #endif
7707 
7708         #if (TEST_GOP5 == 1)        // audio atv
7709         MApi_AUDIO_SIF_StartAutoStandardDetection();
7710         MApi_AUDIO_SIF_GetResultOfAutoStandardDetection();
7711         #endif
7712 
7713         #if (TEST_GOP7 == 1)        // audio SPDIF
7714         MApi_AUDIO_SPDIF_SetMute(FALSE);
7715         MApi_AUDIO_SPDIF_GetMode();
7716         Digital_Out_Channel_Status_t stChannelStatus;
7717         MApi_AUDIO_DigitalOut_SetChannelStatus(DIGITAL_SPDIF_OUTPUT, &stChannelStatus);
7718         #endif
7719 
7720         #if (TEST_GOP8 == 1)        //audio hdmi
7721         MS_BOOL onOff = FALSE;
7722         AUDIO_FS_TYPE hdmi_smpFreq = 0;
7723         HDMI_TX_OUTPUT_TYPE outType = 1;
7724         MApi_AUDIO_HDMI_Tx_GetStatus(&onOff, &hdmi_smpFreq, &outType);
7725         MApi_AUDIO_HDMI_Monitor();
7726         MApi_AUDIO_HDMI_SetNonpcm(FALSE);
7727         MApi_AUDIO_DTV_HDMI_CFG(1);
7728         MApi_AUDIO_HDMI_GetSynthFreq();
7729         MApi_AUDIO_HDMI_SetDownSample(0);
7730         ST_HDMI_AUDIO_STATUS hdmiAudioSts;
7731         MApi_AUDIO_HDMI_RX_GetHdmiInAudioStatus(&hdmiAudioSts);
7732         #endif
7733 
7734         #if (TEST_GOP9 == 1)        // audio advance
7735         MApi_AUDIO_SeInit();
7736         MApi_AUDIO_ADVSOUND_SetParam(0, 0, 0);
7737         MApi_AUDIO_ADVSND_SetParam(0, 0, 0);
7738         MApi_AUDIO_ADVSOUND_GetInfo(0);
7739         MApi_DBXTV_SetMode(0, 0, 0, 0);
7740         MApi_AUDIO_SetAdvSndSys(MSAPI_AUD_ADVSND_BBE);
7741         MApi_AUDIO_SetVDS(0);
7742         MApi_AUDIO_SetVSPK(0);
7743         MApi_AUDIO_SetSRS(0);
7744         MApi_AUDIO_SetBBE(0, 1);
7745         MApi_AUDIO_VSPK_WMod(1);
7746         MApi_AUDIO_VSPK_SMod(1);
7747         MApi_AUDIO_SRS_DC(1);
7748         MApi_AUDIO_SRS_TruBass(1);
7749         MApi_AUDIO_SRS_SetTsxtPara(0, 0);
7750         MApi_AUDIO_SetSRSTSHD(1);
7751         MApi_AUDIO_TSHD_Definition(0);
7752         MApi_AUDIO_SRS_SetTshdPara(0, 0);
7753         #endif
7754 
7755         #if (TEST_GOP10 == 1)       //audio dtv
7756         MApi_AUDIO_GetKTVInfo (0, 0);
7757         MApi_AUDIO_SetKTVInfo (0, 0, 0, 2);
7758         MApi_AUDIO_SetMixModeVolume(0, 0, 0, 0);
7759         MApi_AUDIO_SetMixModeMute(0, 0, TRUE);
7760         MApi_AUDIO_PlayMenuSound();
7761         #endif
7762 
7763         #if (TEST_GOP11 == 1)      //audio MM
7764         MApi_AUDIO_Init(MSAPI_AUD_DVB_MPEG);
7765         MApi_AUDIO_SetAACInfo(Audio_AAC_error_count, 0, 0);
7766         MApi_AUDIO_GetMpegInfo(Audio_MPEG_infoType_DecStatus);
7767         MApi_AUDIO_GetAC3Info(Audio_AC3_infoType_DecStatus);
7768         MApi_AUDIO_GetAACInfo(Audio_AAC_error_count);
7769         MApi_AUDIO_GetWmaInfo(Audio_WMA_infoType_DecStatus);
7770         MApi_AUDIO_GetDTSInfo(Audio_DTS_infoType_DecStatus);
7771         MApi_AUDIO_XPCM_Param(LPCM, 0, 0, 0, 0, 0);
7772         MApi_AUDIO_XPCM2_Param(LPCM, 0, 0, 0, 0, 0);
7773         MApi_AUDIO_XPCM2_CheckIntStatus();
7774         MApi_AUDIO_StartBrowse();
7775         MApi_AUDIO_PauseDecode();
7776         MApi_AUDIO_CheckPlayDone();
7777         MApi_AUDIO_GetResidualBufferSize();
7778         MApi_AUDIO_GetPCMBufferSize(100);
7779         MApi_AUDIO_GetPCMBufferSize2(100,100);
7780         MApi_AUDIO_GetCurrentFrameNumber();
7781         MApi_AUDIO_GetSampleRate();
7782         MApi_AUDIO_GetBitRate();
7783         MApi_AUDIO_GetLayer();
7784         MApi_AUDIO_SetSampleRateIndex(1);
7785         MApi_AUDIO_FileEndNotification();
7786         MApi_AUDIO_GetEsMEMCnt();
7787         MApi_AUDIO_MM_SetInput (0, 0);
7788         MApi_AUDIO_MM_CheckPlayDone (0);
7789         MS_U32 u32WrtAddr = 0x1000;
7790         MS_U32 u32WrtByte = 10;
7791         MApi_AUDIO_MM_CheckInputRequest(0, &u32WrtAddr, &u32WrtByte);
7792         MApi_AUDIO_DmaReader_Init(0);
7793         MApi_AUDIO_DmaReader_AllInput_Init();
7794         MS_U32 buff = 0;
7795         //MApi_AUDIO_DmaReader_WritePCM(&buff, u32WrtByte);     // core dump cause by buffer address
7796         MApi_AUDIO_DmaWriter_Init();
7797         MApi_AUDIO_USBPCM_Enable(FALSE);
7798         MApi_AUDIO_USBPCM_SetFlag(FALSE);
7799         MApi_AUDIO_USBPCM_GetFlag();
7800         AUDIO_UPLOAD_INFO uploadInfo;
7801         MApi_AUDIO_USBPCM_GetMemInfo(&uploadInfo);
7802         MApi_AUDIO_PCMCapture_Init(0, 0);
7803         MApi_AUDIO_PCMCapture_Start(0);
7804         MApi_AUDIO_PCMCapture_Stop(0);
7805         MApi_AUDIO_PCMCapture_Read(0, &buff, u32WrtByte);
7806         MApi_AUDIO_VoIP_Config(0, 0, 0);
7807         MApi_AUDIO_ALSA_Check();
7808         MApi_AUDIO_ALSA_Enable(FALSE);
7809         MApi_AUDIO_UNI_CheckDecodeDone(&u32WrtAddr, &u32WrtByte);
7810         MApi_AUDIO_UNI_SetOutput(0);
7811         MApi_AUDIO_UNI_Set_PCMInputWriteAddr (0);
7812         MApi_AUDIO_UNI_Get_OutPCMLevel();
7813         audioRingTask auRingTask, auRingTask_1;
7814         MApi_AUDIO_RingTask(&auRingTask) ;
7815         MApi_AUDIO_Ring_DataTransfer(&auRingTask, &auRingTask_1);
7816         MApi_AUDIO_SetAudioParam2(0, 0, 0);
7817         MApi_AUDIO_GetAudioInfo2(0, 0, &buff);
7818         MApi_AUDIO_GetDDRInfo(0, 0);
7819         #endif
7820     }
7821 #endif
7822 }
7823 #endif
7824