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_customer.c
98 /// @brief Audio 1.0 API wrapper for Audio 2.0
99 /// @author MStar Semiconductor,Inc.
100 ////////////////////////////////////////////////////////////////////////////////////////////////////
101 #ifdef ROLLS_ROYCE
102
103 //-------------------------------------------------------------------------------------------------------------------------------------
104 // [Distinction Area] [kernel space / user space] [#include standard header] declare in this area.
105 //-------------------------------------------------------------------------------------------------------------------------------------
106 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
107 #include <linux/string.h>
108 #include <linux/slab.h>
109 #include <linux/delay.h>
110 #include <linux/kthread.h>
111 #include <linux/module.h> // Needed by all modules
112 #include <linux/kernel.h> // Needed for KERN_INFO
113 #include <linux/fs.h> // Needed by filp
114 #include <asm/uaccess.h> // Needed by segment descriptors
115 #include <linux/proc_fs.h>
116 #include <linux/io.h>
117
118 #else //User Space
119 #include <string.h>
120 #include <sys/types.h>
121 #include <unistd.h>
122 #include <stdlib.h>
123 #include <stdio.h>
124 #include <ctype.h>
125 #include <pthread.h>
126 #endif
127
128 //-------------------------------------------------------------------------------------------------------------------------------------
129 // [Share Area] shared [#include local header] declare in this area.
130 //-------------------------------------------------------------------------------------------------------------------------------------
131 #include "apiAUDIO_v2_customer.h"
132 #include "apiAUDIO_v2_customer_utopia.h"
133 #include "apiAUDIO_v2_customer_config.h"
134 #include "MsTypes.h"
135 #include "MsOS.h"
136 #include "MsCommon.h"
137 #include "apiXC.h"
138 #include "drvXC_HDMI_if.h"
139 #include "apiDMX.h"
140
141 //-------------------------------------------------------------------------------------------------------------------------------------
142 // [Distinction Area] [kernel space / user space] [#include local library] declare in this area.
143 //-------------------------------------------------------------------------------------------------------------------------------------
144 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
145
146 #else //User Space
147 #if (UTPA_SUPPORT_AAC_ENCODE == 1)
148 #include "./aenc/libaac/inc/exp_emz_common.h"
149 #include "./aenc/libaac/inc/exp_emz_memory.h"
150 #include "./aenc/libaac/inc/exp_Mp4AacEnc_API.h"
151 #endif
152 #endif
153
154 //-------------------------------------------------------------------------------------------------------------------------------------
155 // [Share Area] shared [#define] declare in this area.
156 //-------------------------------------------------------------------------------------------------------------------------------------
157 #define AU_VERSION 0x04E2
158 #define AU_NDBG_LOG_TO_FILE_PATH "/tmp/AudioCUSnDBGLog.log"
159 #define AU_NDBG_MENULOG_TO_FILE_PATH "/tmp/AudioCUSnDBGMenuLog.log"
160 #define AU_R2_LOG_TO_FILE_PATH "/tmp/AudioR2Log.log"
161 #define AU_DDR_BIN_PATH "/tmp/AUDIO_DDR.bin"
162 #define AU_ADEC_PCM_DUMP_PATH "/tmp/AdecPcmDump.pcm"
163 #define AU_PCM_CAPTURE_SOURCE_DUMP_PATH "/tmp/PcmCaptureSourceDump.pcm"
164 #define AU_R2_UART_ENABLE_MESSAGE "R2_UART_ENABLE (TV: 0x0 / 0xCCCC, STB: 0x456 / 0x466 / 0x65c / ... : \n"
165 #define AU_HW_DMA_READER1 "HW DMA Reader1"
166 #define AU_UNUSED(x) ((x)=(x))
167
168 //Bifrost parser
169 #define DTS_AUDIO_PARSER_ENABLE 1
170 #define WMA_AUDIO_PARSER_ENABLE 1
171 #define XPCM_AUDIO_PARSER_ENABLE 1
172
173 //HDMI set non-pcm
174 //Main Sub: 0/1
175 //PCM NPCM: 0/1
176 #define AU_HDMI_MAIN_PCM 0x00
177 #define AU_HDMI_MAIN_NPCM 0x01
178 #define AU_HDMI_SUB_PCM 0x10
179 #define AU_HDMI_SUB_NPCM 0x11
180
181 /* MP3 Encode parameter */
182 #define MP3_REQUEST_BYTES (384*2)
183
184 #if (UTPA_SUPPORT_AAC_ENCODE == 1)
185 /* AAC Encode parameter */
186 #define AAC_ENCODED_LENTH (6144)
187 #define AAC_REQUEST_BYTES (4096)
188 #endif
189
190 //AU Demo MM New Mode Get PCM
191 #define AU_DEMO_MM_NEW_MODE_GET_PCM_BUFFER_SIZE 1024000
192 #define AU_DEMO_MM_NEW_MODE_GET_PCM_FILE_PATH "/tmp/Demo_Audio_AdecPcmDump.pcm"
193
194 //AU Demo MM New Mode Get PCM
195 #define AU_MM_MODE_GET_ES_BUFFER_PATH "/tmp/MM_Audio_ESDump.bin"
196
197 //AU debug get string input
198 #define AU_DEBUG_INPUT_STR_LENGTH 255
199 #define SEEK_CUR 1
200 #define SEEK_END 2
201 #define SEEK_SET 0
202
203 #ifdef CONFIG_MBOOT
204 #define fflush(x) //define for mboot compile error
205 #define fwrite(a,b,c,d) //define for mboot compile error
206 #endif
207
208 //MSTAR GEQ Max band
209 #define MSTAR_SE_GEQ_MAX_BAND 5
210
211 //MSTAR PEQ Max band
212 #define MSTAR_SE_PEQ_MAX_BAND 8
213
214 //-------------------------------------------------------------------------------------------------------------------------------------
215 // [Distinction Area] [kernel space / user space] [#define] declare in this area.
216 //-------------------------------------------------------------------------------------------------------------------------------------
217 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
218 #define AU_nDBG(_f,_a...) \
219 { \
220 if(pstAudioCustomerShmData->g_audio_customer_bEnableNonThreadPrintMsg) \
221 { \
222 printf("\033[1;32m" "[A]" "[%ld]" "[%s]" "[%d]" _f "\033[0m", (long int)MsOS_GetSystemTime(), __FUNCTION__, __LINE__, ##_a); \
223 } \
224 }
225
226 #define AU_nPRINT(_f,_a...) \
227 { \
228 printf("\033[1;32m"_f"\033[0m", ##_a); \
229 }
230
231 #define AU_nThreadDBG(_f,_a...) \
232 { \
233 if( (pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg) && (pstAudioCustomerShmData->g_audio_customer_bThreadPrintMsg) ) \
234 { \
235 printf("\033[0;33m" "[A]" "[%ld]" "[%s]" "[%d]" _f "\033[0m", (long int)MsOS_GetSystemTime(), __FUNCTION__, __LINE__, ##_a); \
236 } \
237 }
238
239 #if (UTPA_SUPPORT_AAC_ENCODE == 1)
240 #define E_EMZ_TRUE 1
241 #define E_EMZ_FALSE 0
242 #define E_EMZ_ON 1
243 #define E_EMZ_OFF 0
244
245 /* Common error code definitions */
246 #define E_EMZ_SUCCESS 0
247 #define E_EMZ_FAILURE (-1)
248 #define E_EMZ_OUT_OF_MEMORY (-2)
249 #define E_EMZ_INVALID_ARGS (-3)
250 #define E_EMZ_NOT_SUPPORTED (-4)
251 #define E_EMZ_INVALID_HANDLE (-5)
252 #define E_EMZ_ENC_UNINITIALIZED (-6)
253 #define E_EMZ_ENCODE_COMPLETE (-7)
254
255 /* Individual component error code base definitions */
256 #define E_EMZ_AUDIO_DECODER_ERROR_BASE ((tEmzInt32) -1000)
257 #define E_EMZ_AUDIO_ENCODER_ERROR_BASE ((tEmzInt32) -2000)
258 #define E_EMZ_VIDEO_DECODER_ERROR_BASE ((tEmzInt32) -3000)
259 #define E_EMZ_VIDEO_ENCODER_ERROR_BASE ((tEmzInt32) -4000)
260 #define E_EMZ_IMAGE_DECODER_ERROR_BASE ((tEmzInt32) -5000)
261 #define E_EMZ_IMAGE_ENCODER_ERROR_BASE ((tEmzInt32) -6000)
262 #define E_EMZ_SYSTEM_ERROR_BASE ((tEmzInt32)-10000)
263 #endif
264
265 /* kernel debug proc */
266 #define AU_CUS_KERNEL_DEBUG_PROC_STRING_BUFFER_LENGTH 128
267 #define AU_CUS_KERNEL_DEBUG_PROC_ROOT_NAME "MstarAudioCustomerDebug"
268 #define AU_CUS_KERNEL_DEBUG_PROC_MAX_CHILD 2 //<--Remember add one when add new proc
269 #define AU_CUS_KERNEL_DEBUG_PROC_CHILD_0001_NDBG "0001_nDBG" /* proc child 1 */
270 #define AU_CUS_KERNEL_DEBUG_PROC_CHILD_0002_SHOW_VERSION "0002_ShowVersion" /* proc child 2 */
271
272 #else //User Space
273 #define SYS_SHM_QUERY 0x00000000UL
274 #define SYS_SHM_CREATE 0x00000001UL
275
276 #ifdef CONFIG_MBOOT
277 #define AU_nDBG(_f,_a...) \
278 { \
279 if(pstAudioCustomerShmData->g_audio_customer_bEnableNonThreadPrintMsg) \
280 { \
281 printf("\033[1;32m" "[A]" "[%ld]" "[%s]" "[%d]" _f "\033[0m", (long int)MsOS_GetSystemTime(), __FUNCTION__, __LINE__, ##_a); \
282 } \
283 }
284
285 #define AU_nPRINT(_f,_a...) \
286 { \
287 printf("\033[1;32m"_f"\033[0m", ##_a); \
288 }
289
290 #define AU_nThreadDBG(_f,_a...) \
291 { \
292 if( (pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg) && (pstAudioCustomerShmData->g_audio_customer_bThreadPrintMsg) ) \
293 { \
294 if(__LINE__ != pstAudioCustomerShmData->g_audio_customer_bThreadPrintMsg_Line) \
295 { \
296 printf("\033[0;33m" "[A]" "[%ld]" "[%s]" "[%d]" _f "\033[0m", (long int)MsOS_GetSystemTime(), __FUNCTION__, __LINE__, ##_a); \
297 pstAudioCustomerShmData->g_audio_customer_bThreadPrintMsg_Line = __LINE__; \
298 } \
299 } \
300 }
301 #else
302 #define AU_nDBG(_f,_a...) \
303 { \
304 if(pstAudioCustomerShmData->g_audio_customer_bEnableNonThreadPrintMsg) \
305 { \
306 printf("\033[1;32m" "[A]" "[%ld]" "[%s]" "[%d]" _f "\033[0m", (long int)MsOS_GetSystemTime(), __FUNCTION__, __LINE__, ##_a); \
307 } \
308 if(pAU_nDBG_Log_To_File) \
309 { \
310 fprintf(pAU_nDBG_Log_To_File, "\033[1;32m" "[A]" "[%ld]" "[%s]" "[%d]"_f "\033[0m" , (long int)MsOS_GetSystemTime(), __FUNCTION__, __LINE__, ##_a); \
311 fflush(pAU_nDBG_Log_To_File); \
312 } \
313 }
314
315 #define AU_nPRINT(_f,_a...) \
316 { \
317 printf("\033[1;32m"_f"\033[0m", ##_a); \
318 if(pAU_nDBG_MenuLog_To_File) \
319 { \
320 fprintf(pAU_nDBG_MenuLog_To_File, _f, ##_a); \
321 fflush(pAU_nDBG_MenuLog_To_File); \
322 } \
323 }
324
325 #define AU_nThreadDBG(_f,_a...) \
326 { \
327 if( (pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg) && (pstAudioCustomerShmData->g_audio_customer_bThreadPrintMsg) ) \
328 { \
329 if(__LINE__ != pstAudioCustomerShmData->g_audio_customer_bThreadPrintMsg_Line) \
330 { \
331 printf("\033[0;33m" "[A]" "[%ld]" "[%s]" "[%d]" _f "\033[0m", (long int)MsOS_GetSystemTime(), __FUNCTION__, __LINE__, ##_a); \
332 pstAudioCustomerShmData->g_audio_customer_bThreadPrintMsg_Line = __LINE__; \
333 } \
334 } \
335 if((pAU_nDBG_Log_To_File) && (pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg) && (pstAudioCustomerShmData->g_audio_customer_bThreadPrintMsg)) \
336 { \
337 fprintf(pAU_nDBG_Log_To_File, "\033[0;33m" "[A]" "[%ld]" "[%s]" "[%d]"_f "\033[0m", (long int)MsOS_GetSystemTime(), __FUNCTION__, __LINE__, ##_a); \
338 fflush(pAU_nDBG_Log_To_File); \
339 } \
340 }
341 #endif
342
343 #define NON_SCANF_DEBUG_CMD_PARAMS_MAX 30
344
345 #if(DTS_AUDIO_PARSER_ENABLE)
346 #define DTS_BOOLEAN_CONVERT(n) ((n) ? dtsTrue : dtsFalse)
347
348 /* pre-calculate sizeof for speed */
349 #define dtsInt32SizeBytes (sizeof(dtsInt32))
350 #define dtsUint16SizeBytes (sizeof(dtsUint16))
351 #define dtsUint32SizeBytes (sizeof(dtsUint32))
352 #define dtsUint64SizeBytes (sizeof(dtsUint64))
353
354 #define DTS_WAV_FILE_CHUNK_ID_LENGTH (4)
355 #define DTS_WAV_FILE_CHUNK_LENGTH_LENGTH (4)
356
357 #define DTS_WAV_FILE_FORMAT_CHUNK_ID "fmt " /* Note that the space is important at the end of this */
358 #define DTS_WAV_FILE_DATA_CHUNK_ID "data"
359
360 /* Identifiers for wave file start */
361 #define DTS_WAV_FILE_IDENTIFIER "RIFF"
362 #define DTS_WAV_FILE_ID_LENGTH (4)
363 #define DTS_WAV_FILE_CONTENT "WAVE"
364 #define DTS_WAV_FILE_CONTENT_LENGTH (4)
365
366 /* Format chunk information */
367 #define DTS_WAV_FILE_FORMAT_PCM_CHUNK_PAYLOAD_SIZE (16)
368 #define DTS_WAV_FILE_FORMAT_PCM_ID (0x0001)
369
370 /* RIFF header length */
371 //(4 + (2*4) + (2*4) + 16) = 0x24
372 #define DTS_WAV_FILE_RIFF_HEADER_LENGTH (DTS_WAV_FILE_CONTENT_LENGTH + (2*DTS_WAV_FILE_CHUNK_ID_LENGTH) + (2*DTS_WAV_FILE_CHUNK_LENGTH_LENGTH) + DTS_WAV_FILE_FORMAT_PCM_CHUNK_PAYLOAD_SIZE)
373
374 #define DTS_FILETYPE_WAV 1
375 #define DTS_FILETYPE_DTSHD 2
376 #define DTS_FILETYPE_RAW_PCM 3
377
378 #define DTS_HD_MAX_ASSETS (8)
379 #define DTS_HD_MAX_BUILDVER_BYTES (128)
380
381 /* Macro definitions for HD file contents */
382 #define DTS_HD_CHUNK_ID_LENGTH (8)
383 #define DTS_HD_CHUNK_LENGTH_LENGTH (8)
384
385 #define DTS_HD_CHUNK_HDR "DTSHDHDR"
386 #define DTS_HD_CHUNK_FILEINFO "FILEINFO"
387 #define DTS_HD_CHUNK_CORESSMD "CORESSMD"
388 #define DTS_HD_CHUNK_EXTSS_MD "EXTSS_MD"
389 #define DTS_HD_CHUNK_AUPR_HDR "AUPR-HDR"
390 #define DTS_HD_CHUNK_AUPRINFO "AUPRINFO"
391 #define DTS_HD_CHUNK_NAVI_TBL "NAVI-TBL"
392 #define DTS_HD_CHUNK_BITSHVTB "BITSHVTB"
393 #define DTS_HD_CHUNK_STRMDATA "STRMDATA"
394 #define DTS_HD_CHUNK_TIMECODE "TIMECODE"
395 #define DTS_HD_CHUNK_BUILDVER "BUILDVER"
396
397 /* Minimum lengths required for chunks */
398 #define DTS_HD_DTSHDR_MIN_LENGTH_IN_BYTES (13)
399 #define DTS_HD_CORESSMD_MIN_LENGTH_IN_BYTES (11)
400 #define DTS_HD_EXTSSMD_MIN_LENGTH_IN_BYTES (7)
401 #define DTS_HD_EXTSSMD_MAX_LENGTH_IN_BYTES (8)
402 #define DTS_HD_AUPRHDR_MIN_LENGTH_IN_BYTES (21)
403 #define DTS_HD_AUPRHDR_MAX_LENGTH_IN_BYTES (29)
404 #define DTS_HD_NAVITBL_MIN_LENGTH_IN_BYTES (7)
405 #define DTS_HD_BUILDVER_MAX_LENGTH_IN_BYTES (128)
406 #define DTS_HD_TIMECODE_MIN_LENGTH_IN_BYTES (29)
407 #endif //#if(DTS_AUDIO_PARSER_ENABLE)
408
409 #if(WMA_AUDIO_PARSER_ENABLE)
410 #ifndef _WMAERR_DEFINED
411 #define _WMAERR_DEFINED
412 typedef int WMAERR;
413 #endif /* _WMAERR_DEFINED */
414
415 #define WMA_DBG_PRINT(x) //x
416 #define WMAERR_OK 0
417 #define WMAERR_FAIL 1
418 #define WMAERR_INVALIDARG 2
419 #define WMAERR_BUFFERTOOSMALL 3
420 #define WMAERR_INVALIDHEADER 4
421 #define WMAERR_OUTOFMEMORY 5
422 #define WMAERR_CORRUPTDATA 6
423 #define WMAERR_NOTDONE 7 /* need more data to finish the work */
424 #define WMAERR_INVALIDSTATE 8
425 #define MIN_OBJECT_SIZE 24
426 #define DATA_OBJECT_SIZE 50
427 #define FILEPROPFLAG_BROADCAST 1
428 #define WMAPRO_DECODE_FIFO_SIZE (1024*20)
429 #define WMA_MAX_DATA_REQUESTED 128
430 #define WMA_MAX_METADATA_LEN 512 // Max length (in bytes) of any metadata field - note that metadata is WCHAR, so use even numbers
431 // We will truncate incoming metadata to this length (and skip past the remaining data).
432 // If you want to support max allowable size, set this to 65535 (0xFFFF).
433 #define MAX_BUFSIZE 128
434
435 #define WMA_IsEqualGUID(rguid1, rguid2) (!memcmp((void *)rguid1, (void *)rguid2, sizeof(GUID)))
436
437 #define GetUnalignedWord( pb, w ) \
438 (w) = ((unsigned short) *(pb + 1) << 8) + *pb;
439
440 #define GetUnalignedDword( pb, dw ) \
441 (dw) = ((unsigned int) *(pb + 3) << 24) + \
442 ((unsigned int) *(pb + 2) << 16) + \
443 ((unsigned int) *(pb + 1) << 8) + *pb;
444
445 #define GetUnalignedQword(pb, qw) \
446 GetUnalignedDword(pb, (qw).dwLo); \
447 GetUnalignedDword((pb + 4), (qw).dwHi);
448
449 #define GetUnalignedDouble( pb, d ) (d) = *(UNALIGNED double*)(pb);
450
451 #define GetUnalignedWordEx(pb, w) GetUnalignedWord(pb, w) ; (pb) += sizeof(unsigned short);
452 #define GetUnalignedDwordEx(pb, dw) GetUnalignedDword(pb, dw) ; (pb) += sizeof(unsigned int);
453 #define GetUnalignedQwordEx(pb, qw) GetUnalignedQword(pb, qw) ; (pb) += sizeof(QWORD);
454 #define GetUnalignedDoubleEx(pb, d) GetUnalignedDouble(pb, d) ; (pb) += sizeof(double);
455
456 #define LoadBYTE(b, p) b = *(unsigned char *)(p); (p) += sizeof(unsigned char)
457
458 #define LoadWORD(w, p) GetUnalignedWordEx(p, w)
459 #define LoadDWORD(dw, p) GetUnalignedDwordEx(p, dw)
460 #define LoadQWORD(qw, p) GetUnalignedQwordEx(p, qw)
461
462 #define LoadGUID( g, p ) \
463 { \
464 LoadDWORD( (g).Data1, p ); \
465 LoadWORD( (g).Data2, p ); \
466 LoadWORD( (g).Data3, p ); \
467 LoadBYTE( (g).Data4[0], p ); \
468 LoadBYTE( (g).Data4[1], p ); \
469 LoadBYTE( (g).Data4[2], p ); \
470 LoadBYTE( (g).Data4[3], p ); \
471 LoadBYTE( (g).Data4[4], p ); \
472 LoadBYTE( (g).Data4[5], p ); \
473 LoadBYTE( (g).Data4[6], p ); \
474 LoadBYTE( (g).Data4[7], p ); \
475 }
476
477 #ifndef _WAVEFORMATEX_
478 #define _WAVEFORMATEX_
479
480 typedef struct tWAVEFORMATEX
481 {
482 unsigned short wFormatTag; /* format type */
483 unsigned short nChannels; /* number of channels (i.e. mono, stereo...) */
484 unsigned int nSamplesPerSec; /* sample rate */
485 unsigned int nAvgBytesPerSec; /* for buffer estimation */
486 unsigned short nBlockAlign; /* block size of data */
487 unsigned short wBitsPerSample; /* Number of bits per sample of mono data */
488 unsigned short cbSize; /* The count in bytes of the size of
489 extra information (after cbSize) */
490 } WAVEFORMATEX;
491
492 typedef WAVEFORMATEX *PWAVEFORMATEX;
493 typedef WAVEFORMATEX *NPWAVEFORMATEX;
494 typedef WAVEFORMATEX *LPWAVEFORMATEX;
495 #endif /* _WAVEFORMATEX_ */
496
497 #ifndef WAVE_FORMAT_PCM
498 #define WAVE_FORMAT_PCM 1
499 #endif /* WAVE_FORMAT_PCM */
500
501 #if !defined (WAVE_FORMAT_WMAUDIO_LOSSLESS)
502 #define WAVE_FORMAT_WMAUDIO_LOSSLESS 0x0163
503 #endif
504
505 #ifndef WAVE_FORMAT_EXTENSIBLE
506 #define WAVE_FORMAT_EXTENSIBLE 65534
507 #endif /* WAVE_FORMAT_EXTENSIBLE */
508
509 #if !defined (WAVE_FORMAT_WMAUDIO3)
510 #define WAVE_FORMAT_WMAUDIO3 0x0162
511
512 typedef struct wmaudio3waveformat_tag
513 {
514 WAVEFORMATEX wfx;
515 unsigned short wValidBitsPerSample; // bits of precision
516 unsigned int dwChannelMask; // which channels are present in stream
517 unsigned int dwReserved1;
518 unsigned int dwReserved2;
519 unsigned short wEncodeOptions;
520 unsigned short wReserved3;
521 } WMAUDIO3WAVEFORMAT;
522 #endif
523
524 #if !defined (WAVE_FORMAT_WMAUDIO_LOSSLESS_ES)
525 #define WAVE_FORMAT_WMAUDIO_LOSSLESS_ES 0x0167
526 #endif
527
528 #define WAVE_FORMAT_MSAUDIO1 0x0160
529 #define WAVE_FORMAT_WMAUDIO2 0x0161
530
531 #ifndef _SPEAKER_POSITIONS_
532 #define _SPEAKER_POSITIONS_
533 /* Speaker Positions for dwChannelMask in WAVEFORMATEXTENSIBLE: from ksmedia.h */
534 #define SPEAKER_FRONT_LEFT 0x1
535 #define SPEAKER_FRONT_RIGHT 0x2
536 #define SPEAKER_FRONT_CENTER 0x4
537 #define SPEAKER_LOW_FREQUENCY 0x8
538 #define SPEAKER_BACK_LEFT 0x10
539 #define SPEAKER_BACK_RIGHT 0x20
540 #define SPEAKER_FRONT_LEFT_OF_CENTER 0x40
541 #define SPEAKER_FRONT_RIGHT_OF_CENTER 0x80
542 #define SPEAKER_BACK_CENTER 0x100
543 #define SPEAKER_SIDE_LEFT 0x200
544 #define SPEAKER_SIDE_RIGHT 0x400
545 #define SPEAKER_TOP_CENTER 0x800
546 #define SPEAKER_TOP_FRONT_LEFT 0x1000
547 #define SPEAKER_TOP_FRONT_CENTER 0x2000
548 #define SPEAKER_TOP_FRONT_RIGHT 0x4000
549 #define SPEAKER_TOP_BACK_LEFT 0x8000
550 #define SPEAKER_TOP_BACK_CENTER 0x10000
551 #define SPEAKER_TOP_BACK_RIGHT 0x20000
552 #endif /* _SPEAKER_POSITIONS_ */
553
554 #ifndef _QWORD_DEFINED
555 #define _QWORD_DEFINED
556 typedef struct tQWORD
557 {
558 unsigned int dwLo;
559 unsigned int dwHi;
560 } QWORD;
561 #endif /* _QWORD_DEFINED */
562
563 #ifndef GUID_DEFINED
564 #define GUID_DEFINED
565 typedef struct // size is 16
566 {
567 unsigned int Data1;
568 unsigned short Data2;
569 unsigned short Data3;
570 unsigned char Data4[8];
571 } GUID;
572 #endif //!GUID_DEFINED
573
574 #ifndef _WMAFILECONTDESC_DEFINED
575 #define _WMAFILECONTDESC_DEFINED
576 typedef struct tagWMAFileContDesc
577 {
578 /* *_len: as [in], they specify how large the corresponding
579 * buffers below are.
580 * as [out], they specify how large the returned
581 * buffers actually are.
582 */
583 unsigned short title_len;
584 unsigned short author_len;
585 unsigned short copyright_len;
586 unsigned short description_len; /* rarely used */
587 unsigned short rating_len; /* rarely used */
588
589 /* these are two-byte strings
590 * for ASCII-type character set, to convert these
591 * into a single-byte characters, simply skip
592 * over every other bytes.
593 */
594 unsigned char *pTitle;
595 unsigned char *pAuthor;
596 unsigned char *pCopyright;
597 unsigned char *pDescription;
598 unsigned char *pRating;
599
600 } tWMAFileContDesc;
601 #endif /* _WMAFILECONTDESC_DEFINED */
602
603 #define DESC_NAME_MAX_LENGTH 64
604 typedef struct _MarkerEntry
605 {
606 QWORD m_qOffset;
607 QWORD m_qtime;
608 unsigned short m_wEntryLen;
609 unsigned int m_dwSendTime;
610 unsigned int m_dwFlags;
611 unsigned int m_dwDescLen;
612 unsigned short m_pwDescName[DESC_NAME_MAX_LENGTH];
613 } MarkerEntry;
614
615 #ifndef _ECD_DEFINED_
616 #define _ECD_DEFINED_
617 enum
618 {
619 ECD_STRING = 0,
620 ECD_BINARY = 1,
621 ECD_BOOL = 2,
622 ECD_DWORD = 3,
623 ECD_QWORD = 4,
624 ECD_WORD = 5
625 };
626
627 typedef struct _ECD_DESCRIPTOR
628 {
629 unsigned short cbName;
630 unsigned short *pwszName;
631 unsigned short data_type;
632 unsigned short cbValue;
633 union
634 {
635 unsigned short *pwszString;
636 char *pbBinary;
637 unsigned int *pfBool;
638 unsigned int *pdwDword;
639 unsigned long long *pqwQword;
640 unsigned short *pwWord;
641 } uValue;
642 } ECD_DESCRIPTOR;
643 #endif //_ECD_DEFINED_
644
645 #ifndef _WMAFILESTATUS_DEFINED
646 #define _WMAFILESTATUS_DEFINED
647 typedef enum tagWMAFileStatus
648 {
649 cWMA_NoErr, /* -> always first entry */
650
651 /* remaining entry order is not guaranteed */
652 cWMA_Failed,
653 cWMA_BadArgument,
654 cWMA_BadAsfHeader,
655 cWMA_BadPacketHeader,
656 cWMA_BrokenFrame,
657 cWMA_NoMoreFrames,
658 cWMA_BadSamplingRate,
659 cWMA_BadNumberOfChannels,
660 cWMA_BadVersionNumber,
661 cWMA_BadWeightingMode,
662 cWMA_BadPacketization,
663
664 cWMA_BadDRMType,
665 cWMA_DRMFailed,
666 cWMA_DRMUnsupported,
667
668 cWMA_DemoExpired,
669
670 cWMA_BadState,
671 cWMA_Internal,/* really bad */
672 cWMA_NoMoreDataThisTime
673 } tWMAFileStatus;
674 #endif /* _WMAFILESTATUS_DEFINED */
675
676 #if !defined (COPY_KSDATAFORMAT_SUBTYPE_PCM)
677 #define COPY_KSDATAFORMAT_SUBTYPE_PCM(guid) \
678 (guid)->Data1 = 0x01; \
679 (guid)->Data2 = 0x00; \
680 (guid)->Data3 = 0x10; \
681 (guid)->Data4[0] = 0x80; \
682 (guid)->Data4[1] = 0x00; \
683 (guid)->Data4[2] = 0x00; \
684 (guid)->Data4[3] = 0xaa; \
685 (guid)->Data4[4] = 0x00; \
686 (guid)->Data4[5] = 0x38; \
687 (guid)->Data4[6] = 0x9b; \
688 (guid)->Data4[7] = 0x71;
689 #endif //COPY_KSDATAFORMAT_SUBTYPE_PCM
690 #endif //#if(WMA_AUDIO_PARSER_ENABLE)
691
692 #endif
693
694 //-------------------------------------------------------------------------------------------------------------------------------------
695 // [Share Area] shared [variable / struct / enum] declare in this area.
696 //-------------------------------------------------------------------------------------------------------------------------------------
697 typedef struct
698 {
699 //-------------------------------------------------------------------------------------------------------------------------------------
700 /* Initialize, STR */
701 //-------------------------------------------------------------------------------------------------------------------------------------
702 //Audio init flag
703 MS_BOOL g_audio_customer_Init_Done;
704 MS_BOOL g_audio_customer_STR_bSuspendStart;
705 MS_BOOL g_audio_customer_STR_bResumeFinish;
706 MS_BOOL g_audio_customer_scanf_bSupport;
707 API_AUDIO_CUSTOMER_CHIP_PLATFORM g_audio_customer_Chip_Platform;
708
709 //Dynamic Enable all apiAUDIO_v2_customer debug msg
710 MS_BOOL g_audio_customer_bEnableNonThreadPrintMsg;
711 MS_BOOL g_audio_customer_bEnableThreadPrintMsg;
712 MS_U32 g_audio_customer_bEnableThreadPrintMsg_Interval;
713 MS_BOOL g_audio_customer_bThreadPrintMsg;
714 MS_U32 g_audio_customer_bThreadPrintMsg_Interval;
715 MS_U32 g_audio_customer_bThreadPrintMsg_Line;
716
717 //-------------------------------------------------------------------------------------------------------------------------------------
718 /* Connect & Disconnect */
719 //-------------------------------------------------------------------------------------------------------------------------------------
720 //Parser connect
721 API_AUDIO_CUSTOMER_PARSER_MODE g_audio_customer_PARSER_Mode;
722 API_AUDIO_CUSTOMER_PARSER_INPUT g_audio_customer_PARSER_A_Connect;
723 API_AUDIO_CUSTOMER_PARSER_INPUT g_audio_customer_PARSER_B_Connect;
724 API_AUDIO_CUSTOMER_PARSER_INPUT g_audio_customer_PARSER_C_Connect;
725 API_AUDIO_CUSTOMER_PARSER_INPUT g_audio_customer_PARSER_D_Connect;
726
727 //ADEC connect / ID / Gain / Mute
728 API_AUDIO_CUSTOMER_ADEC_INPUT g_audio_customer_ADEC0_Connect;
729 API_AUDIO_CUSTOMER_ADEC_INPUT g_audio_customer_ADEC1_Connect;
730 API_AUDIO_CUSTOMER_ADEC_INPUT g_audio_customer_ADEC_ATV_Connect;
731 AUDIO_DEC_ID g_audio_customer_ADEC0_DecID;
732 AUDIO_DEC_ID g_audio_customer_ADEC1_DecID;
733 AUDIO_DEC_ID g_audio_customer_ADEC_ATV_DecID;
734 int g_audio_customer_ADEC0_Gain;
735 int g_audio_customer_ADEC1_Gain;
736 MS_BOOL g_audio_customer_ADEC0_bMute;
737 MS_BOOL g_audio_customer_ADEC1_bMute;
738
739 //ADC connect
740 API_AUDIO_CUSTOMER_ADC_IN_PORT g_audio_customer_ADC0_Connect;
741 API_AUDIO_CUSTOMER_ADC_IN_PORT g_audio_customer_ADC1_Connect;
742
743 //PCM Mixer connect / ID / Gain / Mute
744 MS_BOOL g_audio_customer_PCM_Mixer_Connect[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_MAX];
745 int g_audio_customer_PCM_Mixer_ID[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_MAX];
746 int g_audio_customer_PCM_Mixer_Gain[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_MAX];
747 MS_BOOL g_audio_customer_PCM_Mixer_bMute[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_MAX];
748
749 //Channel Sound Connect / inDelay
750 API_AUDIO_CUSTOMER_CH_INPUT g_audio_customer_CH5_Sound_Connect;
751 API_AUDIO_CUSTOMER_CH_INPUT g_audio_customer_CH6_Sound_Connect;
752 API_AUDIO_CUSTOMER_CH_INPUT g_audio_customer_CH7_Sound_Connect;
753 API_AUDIO_CUSTOMER_CH_INPUT g_audio_customer_CH8_Sound_Connect;
754 int g_audio_customer_CH5_Sound_inDelay;
755 int g_audio_customer_CH6_Sound_inDelay;
756 int g_audio_customer_CH7_Sound_inDelay;
757 int g_audio_customer_CH8_Sound_inDelay;
758
759 //FW Mixer Connect / Gain / Mute / Delay
760 MS_BOOL g_audio_customer_FW_Mixer0_Connect[API_AUDIO_CUSTOMER_FWM_INPUT_MAX];
761 MS_BOOL g_audio_customer_FW_Mixer1_Connect[API_AUDIO_CUSTOMER_FWM_INPUT_MAX];
762 MS_BOOL g_audio_customer_FW_Mixer2_Connect[API_AUDIO_CUSTOMER_FWM_INPUT_MAX];
763 MS_U32 g_audio_customer_FW_Mixer0_Channel_Gain[API_AUDIO_CUSTOMER_FWM_INPUT_MAX];
764 MS_U32 g_audio_customer_FW_Mixer1_Channel_Gain[API_AUDIO_CUSTOMER_FWM_INPUT_MAX];
765 MS_U32 g_audio_customer_FW_Mixer2_Channel_Gain[API_AUDIO_CUSTOMER_FWM_INPUT_MAX];
766 MS_BOOL g_audio_customer_FW_Mixer0_Channel_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_MAX];
767 MS_BOOL g_audio_customer_FW_Mixer1_Channel_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_MAX];
768 MS_BOOL g_audio_customer_FW_Mixer2_Channel_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_MAX];
769 int g_audio_customer_FW_Mixer0_Channel_Delay;
770 int g_audio_customer_FW_Mixer1_Channel_Delay;
771 int g_audio_customer_FW_Mixer2_Channel_Delay;
772
773 //FW Mixer During Limit time mute
774 MS_BOOL g_audio_customer_FW_Mixer0_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_MAX];
775 MS_BOOL g_audio_customer_FW_Mixer1_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_MAX];
776 MS_BOOL g_audio_customer_FW_Mixer2_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_MAX];
777
778 //FW Mixer final mute
779 MS_BOOL g_audio_customer_FW_Mixer0_final_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_MAX];
780 MS_BOOL g_audio_customer_FW_Mixer1_final_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_MAX];
781 MS_BOOL g_audio_customer_FW_Mixer2_final_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_MAX];
782
783 //SE delay, SE(PreR2 / SeDSP / PostR2) connect
784 int g_audio_customer_SE_UpperDelay;
785 int g_audio_customer_SE_DriverDelay;
786 API_AUDIO_CUSTOMER_SE_INPUT g_audio_customer_SE_PreR2_Connect;
787 API_AUDIO_CUSTOMER_SE_INPUT g_audio_customer_SE_DspSE_Connect;
788 API_AUDIO_CUSTOMER_SE_INPUT g_audio_customer_SE_PostR2_Connect;
789
790 //SOUND OUT connect / Gain / Mute / SPDIF,HDMI(fg/Mode/PCM,NPCM mute/Delay)
791 API_AUDIO_CUSTOMER_SOUNDOUT_INPUT g_audio_customer_Sound_Out_I2S_Connect;
792 int g_audio_customer_Sound_Out_I2S_Gain;
793 MS_BOOL g_audio_customer_Sound_Out_I2S_bMute;
794 API_AUDIO_CUSTOMER_SOUNDOUT_INPUT g_audio_customer_Sound_Out_Line0_Connect;
795 int g_audio_customer_Sound_Out_Line0_Gain;
796 MS_BOOL g_audio_customer_Sound_Out_Line0_bMute;
797 API_AUDIO_CUSTOMER_SOUNDOUT_INPUT g_audio_customer_Sound_Out_Line1_Connect;
798 int g_audio_customer_Sound_Out_Line1_Gain;
799 MS_BOOL g_audio_customer_Sound_Out_Line1_bMute;
800 API_AUDIO_CUSTOMER_SOUNDOUT_INPUT g_audio_customer_Sound_Out_Line2_Connect;
801 int g_audio_customer_Sound_Out_Line2_Gain;
802 MS_BOOL g_audio_customer_Sound_Out_Line2_bMute;
803 API_AUDIO_CUSTOMER_SOUNDOUT_INPUT g_audio_customer_Sound_Out_Line3_Connect;
804 int g_audio_customer_Sound_Out_Line3_Gain;
805 MS_BOOL g_audio_customer_Sound_Out_Line3_bMute;
806 API_AUDIO_CUSTOMER_SOUNDOUT_INPUT g_audio_customer_Sound_Out_SPDIF_Connect;
807 int g_audio_customer_Sound_Out_SPDIF_Gain;
808 MS_BOOL g_audio_customer_Sound_Out_SPDIF_bMute;
809 int g_audio_customer_Sound_Out_SPDIF_UpperDelay;
810 int g_audio_customer_Sound_Out_SPDIF_DriverDelay;
811 API_AUDIO_CUSTOMER_SOUNDOUT_INPUT g_audio_customer_Sound_Out_ARC_Connect;
812 API_AUDIO_CUSTOMER_SPDIF_TX_MODE g_audio_customer_Sound_Out_ARC_mode;
813 API_AUDIO_CUSTOMER_SOUNDOUT_INPUT g_audio_customer_Sound_Out_HDMI_Connect;
814 int g_audio_customer_Sound_Out_HDMI_Gain;
815 MS_BOOL g_audio_customer_Sound_Out_HDMI_bMute;
816 int g_audio_customer_Sound_Out_HDMI_UpperDelay;
817 int g_audio_customer_Sound_Out_HDMI_DriverDelay;
818
819 //SetSourceInfo / InputSwitch
820 AUDIO_SOURCE_INFO_TYPE g_audio_customer_AU_SetSourceInfo_eSourceType;
821 AUDIO_INPUT_TYPE g_audio_customer_AU_InputSwitch_enSource;
822 AUDIO_SWITCH_GROUP g_audio_customer_AU_InputSwitch_enGroup;
823
824 //sound out During Limit time mute
825 MS_BOOL g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_OUTPUT_MAX];
826
827 //sound out final mute
828 MS_BOOL g_audio_customer_Sound_Out_I2S_final_bMute;
829 MS_BOOL g_audio_customer_Sound_Out_Line0_final_bMute;
830 MS_BOOL g_audio_customer_Sound_Out_Line1_final_bMute;
831 MS_BOOL g_audio_customer_Sound_Out_Line2_final_bMute;
832 MS_BOOL g_audio_customer_Sound_Out_Line3_final_bMute;
833 MS_BOOL g_audio_customer_Sound_Out_SPDIF_final_bMute;
834 MS_BOOL g_audio_customer_Sound_Out_HDMI_final_bMute;
835
836 //PCM Capture connect / bEnable / Gain / Mute / Delay
837 API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT g_audio_customer_PCM_CAPTURE0_Connect;
838 MS_BOOL g_audio_customer_PCM_CAPTURE0_bEnable;
839 int g_audio_customer_PCM_CAPTURE0_Gain;
840 MS_BOOL g_audio_customer_PCM_CAPTURE0_bMute;
841 int g_audio_customer_PCM_CAPTURE0_Delay;
842 API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT g_audio_customer_PCM_CAPTURE1_Connect;
843 MS_BOOL g_audio_customer_PCM_CAPTURE1_bEnable;
844 int g_audio_customer_PCM_CAPTURE1_Gain;
845 MS_BOOL g_audio_customer_PCM_CAPTURE1_bMute;
846 int g_audio_customer_PCM_CAPTURE1_Delay;
847 API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT g_audio_customer_PCM_CAPTURE2_Connect;
848 MS_BOOL g_audio_customer_PCM_CAPTURE2_bEnable;
849 int g_audio_customer_PCM_CAPTURE2_Gain;
850 MS_BOOL g_audio_customer_PCM_CAPTURE2_bMute;
851 int g_audio_customer_PCM_CAPTURE2_Delay;
852
853 //MP3 ENC connect / bEnable
854 API_AUDIO_CUSTOMER_MP3_ENC_INPUT g_audio_customer_MP3_ENC_Connect;
855 MS_BOOL g_audio_customer_MP3_ENC_bEnable;
856
857 //AAC ENC connect / bEnable
858 API_AUDIO_CUSTOMER_AAC_ENC_INPUT g_audio_customer_AAC_ENC_Connect;
859 MS_BOOL g_audio_customer_AAC_ENC_bEnable;
860
861 //AENC Gain
862 MS_U32 g_audio_customer_AENC_Gain;
863
864 //-------------------------------------------------------------------------------------------------------------------------------------
865 /* Start & Stop */
866 //-------------------------------------------------------------------------------------------------------------------------------------
867 API_AUDIO_CUSTOMER_ADEC_INDEX g_audio_customer_MainDecoderOutput;
868
869 //-------------------------------------------------------------------------------------------------------------------------------------
870 /* SPDIF */
871 //-------------------------------------------------------------------------------------------------------------------------------------
872 API_AUDIO_CUSTOMER_SPDIF_TX_MODE g_audio_customer_SPDIF_TX_UpperOutputType;
873 API_AUDIO_CUSTOMER_SPDIF_TX_MODE g_audio_customer_SPDIF_TX_DriverOutputType;
874 API_AUDIO_CUSTOMER_SPDIF_COPYRIGHT g_audio_customer_SPDIF_TX_CopyInfo;
875 MS_U8 g_audio_customer_SPDIF_TX_CategoryCode;
876 MS_BOOL g_audio_customer_SPDIF_TX_LightOnOff;
877 MS_BOOL g_audio_customer_SPDIF_TX_MonitorOnOff;
878 API_AUDIO_CUSTOMER_SPDIF_CS_TYPE g_audio_customer_SPDIF_TX_ChannelStatus_Type;
879 API_AUDIO_CUSTOMER_SPDIF_CS_TYPE_STATUS g_audio_customer_SPDIF_TX_ChannelStatus_Type_Status;
880
881 //-------------------------------------------------------------------------------------------------------------------------------------
882 /* HDMI */
883 //-------------------------------------------------------------------------------------------------------------------------------------
884 API_AUDIO_CUSTOMER_CODEC_TYPE g_audio_customer_HDMI_RX_Current_Codec_Type;
885 API_AUDIO_CUSTOMER_CODEC_TYPE g_audio_customer_HDMI_RX_Previous_Codec_Type;
886 MS_BOOL g_audio_customer_HDMI_RX_AudioReturnChannel;
887 API_AUDIO_CUSTOMER_SPDIF_COPYRIGHT g_audio_customer_HDMI_RX_CopyInfo;
888 MS_BOOL g_audio_customer_HDMI_RX_MonitorOnOff;
889 API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_TYPE g_audio_customer_HDMI_TX_UpperOutputType;
890 API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_TYPE g_audio_customer_HDMI_TX_DriverOutputType;
891 MS_BOOL g_audio_customer_HDMI_TX_MonitorOnOff;
892
893 //-------------------------------------------------------------------------------------------------------------------------------------
894 /* ATV */
895 //-------------------------------------------------------------------------------------------------------------------------------------
896 //ATV_Prescale(A2)
897 int g_audio_customer_ADEC_ATV_Prescale_A2_FM;
898 int g_audio_customer_ADEC_ATV_Prescale_NICAM;
899 int g_audio_customer_ADEC_ATV_Prescale_AM;
900 int g_audio_customer_ADEC_ATV_Prescale_HIDEV;
901 int g_audio_customer_ADEC_ATV_Prescale_FM_M;
902 int g_audio_customer_ADEC_ATV_Prescale_HIDEV_M;
903
904 //ATV_Prescale(BTSC)
905 int g_audio_customer_ADEC_ATV_Prescale_BTSC;
906 int g_audio_customer_ADEC_ATV_Prescale_BTSC_MONO;
907 int g_audio_customer_ADEC_ATV_Prescale_BTSC_STEREO;
908 int g_audio_customer_ADEC_ATV_Prescale_BTSC_SAP;
909
910 //Monitor
911 MS_BOOL g_audio_customer_SIF_MonitorOnOff;
912
913 //-------------------------------------------------------------------------------------------------------------------------------------
914 /* Decoder */
915 //-------------------------------------------------------------------------------------------------------------------------------------
916 //Codec Type (Upper layer)
917 API_AUDIO_CUSTOMER_CODEC_TYPE g_audio_customer_ADEC0_UpperCodec;
918 API_AUDIO_CUSTOMER_CODEC_TYPE g_audio_customer_ADEC1_UpperCodec;
919 API_AUDIO_CUSTOMER_SIF_TYPE g_audio_customer_ADEC_ATV_UpperSifType;
920
921 //Codec Type (Driver layer)
922 En_DVB_decSystemType g_audio_customer_ADEC0_DriverCodec;
923 En_DVB_decSystemType g_audio_customer_ADEC1_DriverCodec;
924 En_DVB_decSystemType g_audio_customer_ADEC_ATV_DriverSifType;
925
926 //Play Cmd (Upper layer)
927 API_AUDIO_CUSTOMER_UPPER_PLAYCMD g_audio_customer_ADEC0_UpperPlay;
928 API_AUDIO_CUSTOMER_UPPER_PLAYCMD g_audio_customer_ADEC1_UpperPlay;
929 API_AUDIO_CUSTOMER_UPPER_PLAYCMD g_audio_customer_ADEC_ATV_UpperPlay;
930
931 //Play Cmd (Driver layer)
932 AU_DVB_DECCMD g_audio_customer_ADEC0_DriverPlay;
933 AU_DVB_DECCMD g_audio_customer_ADEC1_DriverPlay;
934 AU_DVB_DECCMD g_audio_customer_ADEC_ATV_DriverPlay;
935
936 //---Play/pause Cmd Delay---
937 int g_audio_customer_AU_CUS_SetPlayCmdByAdecSource_Delay;
938 int g_audio_customer_AU_CUS_PauseDecoding_Delay;
939
940 //bMM mode (ADEC is used by MM)
941 MS_BOOL g_audio_customer_ADEC0_bMM;
942 MS_BOOL g_audio_customer_ADEC1_bMM;
943
944 //Sync mode
945 MS_BOOL g_audio_customer_ADEC0_SyncMode;
946 MS_BOOL g_audio_customer_ADEC1_SyncMode;
947
948 //DRC mode
949 API_AUDIO_CUSTOMER_DOLBY_DRC_MODE g_audio_customer_ADEC0_AC3P_DolbyDRCMode;
950 API_AUDIO_CUSTOMER_DOLBY_DRC_MODE g_audio_customer_ADEC1_AC3P_DolbyDRCMode;
951
952 //Downmix mode
953 API_AUDIO_CUSTOMER_DOWNMIX_MODE g_audio_customer_ADEC0_AC3P_DownmixMode;
954 API_AUDIO_CUSTOMER_DOWNMIX_MODE g_audio_customer_ADEC1_AC3P_DownmixMode;
955
956 //DualMono mode
957 API_AUDIO_CUSTOMER_DUALMONO_MODE g_audio_customer_ADEC0_DualmonoMode;
958 API_AUDIO_CUSTOMER_DUALMONO_MODE g_audio_customer_ADEC1_DualmonoMode;
959
960 //Trick mode
961 API_AUDIO_CUSTOMER_TRICK_MODE g_audio_customer_ADEC0_TrickMode;
962 API_AUDIO_CUSTOMER_TRICK_MODE g_audio_customer_ADEC1_TrickMode;
963
964 //AD bMain
965 MS_BOOL g_audio_customer_ADEC0_AD_bMain;
966 MS_BOOL g_audio_customer_ADEC1_AD_bMain;
967
968 //AD Gain
969 int g_audio_customer_ADEC0_AD_Gain;
970 int g_audio_customer_ADEC1_AD_Gain;
971
972 //ES Exist
973 MS_BOOL g_audio_customer_ADEC0_bESExist;
974 MS_BOOL g_audio_customer_ADEC1_bESExist;
975
976 //ES Info
977 API_AUDIO_CUSTOMER_HEAAC_ES_INFO g_audio_customer_ADEC0_HEAAC_EsInfo;
978 API_AUDIO_CUSTOMER_MPEG_ES_INFO g_audio_customer_ADEC0_MPEG_EsInfo;
979 API_AUDIO_CUSTOMER_AC3_ES_INFO g_audio_customer_ADEC0_AC3_EsInfo;
980 API_AUDIO_CUSTOMER_HEAAC_ES_INFO g_audio_customer_ADEC1_HEAAC_EsInfo;
981 API_AUDIO_CUSTOMER_MPEG_ES_INFO g_audio_customer_ADEC1_MPEG_EsInfo;
982 API_AUDIO_CUSTOMER_AC3_ES_INFO g_audio_customer_ADEC1_AC3_EsInfo;
983
984 //ADEC PCM output path
985 API_AUDIO_CUSTOMER_ADEC_PCM_PATH g_audio_customer_ADEC0_PCM_OutputPath;
986 API_AUDIO_CUSTOMER_ADEC_PCM_PATH g_audio_customer_ADEC1_PCM_OutputPath;
987
988 //dump adec pcm (MCU path)
989 MS_BOOL g_audio_customer_bEnableAdecPcmDump;
990
991 //ADEC End of stream
992 MS_BOOL g_audio_customer_ADEC0_End_Of_Stream_bRegister;
993 MS_BOOL g_audio_customer_ADEC1_End_Of_Stream_bRegister;
994 MS_U32 g_audio_customer_ADEC_End_Of_Stream_TimeOutCnt;
995
996 //ADEC Underrun
997 MS_BOOL g_audio_customer_ADEC0_Underrun_bRegister;
998 MS_U32 g_audio_customer_ADEC0_Underrun_Threshold_in_ms;
999 MS_U32 g_audio_customer_ADEC0_Underrun_Debounce_Cnt;
1000 MS_BOOL g_audio_customer_ADEC1_Underrun_bRegister;
1001 MS_U32 g_audio_customer_ADEC1_Underrun_Threshold_in_ms;
1002 MS_U32 g_audio_customer_ADEC1_Underrun_Debounce_Cnt;
1003
1004 //Monitor
1005 MS_BOOL g_audio_customer_Auto_Recovery_MonitorOnOff;
1006
1007 //-------------------------------------------------------------------------------------------------------------------------------------
1008 /* Common */
1009 //-------------------------------------------------------------------------------------------------------------------------------------
1010 #if (UTPA_SUPPORT_XPCM_PARAM_CHANNEL_MASK)
1011 MS_U32 g_audio_customer_ADEC_Param_XPCM_ChannelMask_debug_Cmd;
1012 #endif //#if (UTPA_SUPPORT_XPCM_PARAM_CHANNEL_MASK)
1013
1014 //-------------------------------------------------------------------------------------------------------------------------------------
1015 /* Customized patch */
1016 //-------------------------------------------------------------------------------------------------------------------------------------
1017 #if (CUSTOMIZED_PATCH_PARAM_HDMI_RX_BYPASS)
1018 MS_BOOL g_audio_customer_patch_HDMI_RX_ByPass_bEnable;
1019 #endif //#if (CUSTOMIZED_PATCH_PARAM_HDMI_RX_BYPASS)
1020
1021 #if(CUSTOMIZED_PATCH_PARAM_LOW_LATENCY)
1022 MS_BOOL g_audio_customer_patch_Low_Latency_Limiter_bEnable;
1023 MS_U32 g_audio_customer_patch_Low_Latency_Limiter_ES_Threshold;
1024 MS_U32 g_audio_customer_patch_Low_Latency_Limiter_PCM_Threshold;
1025 #endif //#if(CUSTOMIZED_PATCH_PARAM_LOW_LATENCY)
1026
1027 #if(CUSTOMIZED_PATCH_PARAM_MCU_DUMP_R2_LOG)
1028 MS_BOOL g_audio_customer_patch_MCU_Dump_R2_Log_Moitor_bEnable;
1029 MS_U16 g_audio_customer_patch_MCU_Dump_R2_Log_Option;
1030 MS_U16 g_audio_customer_patch_MCU_Dump_R2_Log_Orignal_REG_BANK_R2_LOG_DBG;
1031 #endif //#if(CUSTOMIZED_PATCH_PARAM_MCU_DUMP_R2_LOG)
1032
1033 #if(CUSTOMIZED_PATCH_PARAM_SEDSP_MS12_ENC_WO_MAIN_SND)
1034 MS_BOOL g_audio_customer_patch_HDMI_TX_SEDSP_DDE_WO_MAIN_SND_bEnable;
1035 MS_BOOL g_audio_customer_patch_HDMI_TX_SEDSP_DDPE_WO_MAIN_SND_bEnable;
1036 MS_BOOL g_audio_customer_patch_SPDIF_TX_SEDSP_DDE_WO_MAIN_SND_bEnable;
1037 #endif //#if(CUSTOMIZED_PATCH_PARAM_SEDSP_MS12_ENC_WO_MAIN_SND)
1038
1039 #if(CUSTOMIZED_PATCH_PARAM_SNDR2_MS12_ENC_WO_MAIN_SND)
1040 MS_BOOL g_audio_customer_patch_HDMI_ARC_SEDSP_DDE_WO_MAIN_SND_bEnable;
1041 MS_BOOL g_audio_customer_patch_HDMI_ARC_SNDR2_DDPE_WO_MAIN_SND_bEnable;
1042 #endif //#if(CUSTOMIZED_PATCH_PARAM_SNDR2_MS12_ENC_WO_MAIN_SND)
1043
1044 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_SWITCH_TO_PCM_DEBOUNCE)
1045 MS_U32 g_audio_customer_patch_HDMI_RX_switch_to_pcm_debounce_in_ms;
1046 #endif //#if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_SWITCH_TO_PCM_DEBOUNCE)
1047
1048 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK)
1049 API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO g_audio_customer_HDMI_RX_Monitr_Event_Current_IsHDMI;
1050 API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO g_audio_customer_HDMI_RX_Monitr_Event_Previous_IsHDMI;
1051 API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO g_audio_customer_HDMI_RX_Monitr_Event_Current_IsPCM;
1052 API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO g_audio_customer_HDMI_RX_Monitr_Event_Previous_IsPCM;
1053 API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO g_audio_customer_HDMI_RX_Monitr_Event_Current_CodecType;
1054 API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO g_audio_customer_HDMI_RX_Monitr_Event_Previous_CodecType;
1055 #endif //#if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK)
1056
1057 //-------------------------------------------------------------------------------------------------------------------------------------
1058 /* Customized Internal patch */
1059 //-------------------------------------------------------------------------------------------------------------------------------------
1060 //---MS12 HDMI TX PCM ouput Auto Delay (for sync with NPCM)---
1061 //input: MS12 DD/DDP/DP
1062 int g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_DD_in_Auto_Audio_Delay;
1063 int g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_DDP_in_Auto_Audio_Delay;
1064 int g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_DP_in_Auto_Audio_Delay;
1065 int g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_Final_Auto_Audio_Delay;
1066
1067 //---General Buffer Dump---
1068 MS_BOOL g_audio_customer_internal_patch_General_Buffer_Dump_bEnable;
1069 MS_BOOL g_audio_customer_internal_patch_Dump_MM_ES1_bEnable;
1070 MS_BOOL g_audio_customer_internal_patch_Dump_PCM1_bEnable;
1071 MS_BOOL g_audio_customer_internal_patch_Dump_HDMINPCM_bEnable;
1072 MS_BOOL g_audio_customer_internal_patch_Dump_MS12_METADATA_bEnable;
1073 MS_BOOL g_audio_customer_internal_patch_Dump_HDMI_ES1_bEnable;
1074
1075 //---MS12 SNDR2 PCMR METADATA SELECT---
1076 int g_audio_customer_internal_patch_SndR2_MS12_Pcmr_Metadata_Select;
1077
1078 //---HW SRC Output Gain Compensate---
1079 int g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_I2S_Out;
1080 int g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_0_Out;
1081 int g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_1_Out;
1082 int g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_2_Out;
1083 int g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_3_Out;
1084 int g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_SPDIF_Out;
1085 int g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_HDMI_Out;
1086
1087 //---DDP_71 Auto Bypass check---
1088 API_AUDIO_CUSTOMER_ADEC_INDEX g_audio_customer_internal_patch_DDP_71_Auto_Bypass_adecIndex;
1089 int g_audio_customer_internal_patch_DDP_71_Auto_Bypass_Monitor_bEnable;
1090 int g_audio_customer_internal_patch_DDP_71_Auto_Bypass_Debounce_Cnt;
1091 int g_audio_customer_internal_patch_DDP_71_Auto_Bypass_okFrmCnt;
1092 int g_audio_customer_internal_patch_DDP_71_Auto_Bypass_bDDP_71_Stream;
1093
1094 //---Avoid ADEC Pop Noise---
1095 int g_audio_customer_internal_patch_Avoid_ADEC_Stop_Pop_Noise_mute_limited_time;
1096 int g_audio_customer_internal_patch_Avoid_ADEC_Pause_Pop_Noise_mute_limited_time;
1097
1098 //---ADEC mute delay---
1099 int g_audio_customer_AU_CUS_ADEC_SetMute_Delay;
1100
1101 //-------------------------------------------------------------------------------------------------------------------------------------
1102 /* Clip Play for ES */
1103 //-------------------------------------------------------------------------------------------------------------------------------------
1104
1105 //-------------------------------------------------------------------------------------------------------------------------------------
1106 /* Clip Play for PCM */
1107 //-------------------------------------------------------------------------------------------------------------------------------------
1108
1109 //-------------------------------------------------------------------------------------------------------------------------------------
1110 /* Gain, Mute & Delay */
1111 //-------------------------------------------------------------------------------------------------------------------------------------
1112
1113 //-------------------------------------------------------------------------------------------------------------------------------------
1114 /* AENC */
1115 //-------------------------------------------------------------------------------------------------------------------------------------
1116 //Dynamic dump file for debug
1117 MS_BOOL g_audio_customer_AENC_bDumpEncData;
1118
1119 //AENC Enable
1120 MS_BOOL g_audio_customer_AENC0_bEnable;
1121 MS_BOOL g_audio_customer_AENC1_bEnable;
1122
1123 //AENC Type
1124 API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT g_audio_customer_AENC0_Type;
1125 API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT g_audio_customer_AENC1_Type;
1126
1127 //-------------------------------------------------------------------------------------------------------------------------------------
1128 /* PCM Capture */
1129 //-------------------------------------------------------------------------------------------------------------------------------------
1130 //PCM capture Dump to file for debug
1131 MS_BOOL g_audio_customer_PCM_CAPTURE_Source_Dump_to_file_bEnable;
1132
1133 //PCM capture request data in byte
1134 MS_U32 g_audio_customer_PCM_CAPTURE_Request_data_in_byte;
1135
1136 //-------------------------------------------------------------------------------------------------------------------------------------
1137 /* PCM IO Control */
1138 //-------------------------------------------------------------------------------------------------------------------------------------
1139
1140 //-------------------------------------------------------------------------------------------------------------------------------------
1141 /* MM New Mode */
1142 //-------------------------------------------------------------------------------------------------------------------------------------
1143
1144 //-------------------------------------------------------------------------------------------------------------------------------------
1145 /* Mstar Sound Effect */
1146 //-------------------------------------------------------------------------------------------------------------------------------------
1147 //API_AUDIO_CUSTOMER_MSTAR_SE_Enable
1148 MS_BOOL g_audio_customer_MSTAR_SE_Enable[API_AUDIO_CUSTOMER_MSTAR_SE_MAX];
1149 MS_U32 g_audio_customer_MSTAR_SE_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_MSTAR_SE_MAX];
1150
1151 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_GEQ
1152 MS_S8 g_audio_customer_MSTAR_SE_SET_GEQ[MSTAR_SE_GEQ_MAX_BAND];
1153 MS_U32 g_audio_customer_MSTAR_SE_SET_GEQ_UpperSetCnt[MSTAR_SE_GEQ_MAX_BAND];
1154
1155 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_PEQCoef
1156 API_AUDIO_CUSTOMER_MSTAR_PEQ_COEF g_audio_customer_MSTAR_SE_SET_PEQCoef[MSTAR_SE_PEQ_MAX_BAND];
1157 MS_U32 g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[MSTAR_SE_PEQ_MAX_BAND];
1158
1159 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_HPFCoef
1160 API_AUDIO_CUSTOMER_MSTAR_HPF_COEF g_audio_customer_MSTAR_SE_SET_HPFCoef;
1161 MS_U32 g_audio_customer_MSTAR_SE_SET_HPFCoef_UpperSetCnt;
1162
1163 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_MODE
1164 API_AUDIO_CUSTOMER_MSTAR_AVC_MODE g_audio_customer_MSTAR_SE_SET_AVC_MODE;
1165 MS_U32 g_audio_customer_MSTAR_SE_SET_AVC_MODE_UpperSetCnt;
1166
1167 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_LEVEL
1168 MS_U16 g_audio_customer_MSTAR_SE_SET_AVC_LEVEL;
1169 MS_U32 g_audio_customer_MSTAR_SE_SET_AVC_LEVEL_UpperSetCnt;
1170
1171 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_Begin
1172 MS_U16 g_audio_customer_MSTAR_SE_SET_R_MODE_Begin;
1173 MS_U32 g_audio_customer_MSTAR_SE_SET_R_MODE_Begin_UpperSetCnt;
1174
1175 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_End
1176 MS_U16 g_audio_customer_MSTAR_SE_SET_R_MODE_End;
1177 MS_U32 g_audio_customer_MSTAR_SE_SET_R_MODE_End_UpperSetCnt;
1178
1179 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_Slope
1180 MS_U16 g_audio_customer_MSTAR_SE_SET_R_MODE_Slope;
1181 MS_U32 g_audio_customer_MSTAR_SE_SET_R_MODE_Slope_UpperSetCnt;
1182
1183 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_S_MODE_OFFSET
1184 MS_U16 g_audio_customer_MSTAR_SE_SET_AVC_S_MODE_OFFSET;
1185 MS_U32 g_audio_customer_MSTAR_SE_SET_AVC_S_MODE_OFFSET_UpperSetCnt;
1186
1187 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_AttackTime
1188 MS_U8 g_audio_customer_MSTAR_SE_SET_AVC_AttackTime;
1189 MS_U32 g_audio_customer_MSTAR_SE_SET_AVC_AttackTime_UpperSetCnt;
1190
1191 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_ReleaseTime
1192 MS_U8 g_audio_customer_MSTAR_SE_SET_AVC_ReleaseTime;
1193 MS_U32 g_audio_customer_MSTAR_SE_SET_AVC_ReleaseTime_UpperSetCnt;
1194
1195 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_DRC_LEVEL
1196 MS_U16 g_audio_customer_MSTAR_SE_SET_DRC_LEVEL;
1197 MS_U32 g_audio_customer_MSTAR_SE_SET_DRC_LEVEL_UpperSetCnt;
1198
1199 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_BALANCE
1200 MS_U16 g_audio_customer_MSTAR_SE_SET_BALANCE_L;
1201 MS_U16 g_audio_customer_MSTAR_SE_SET_BALANCE_R;
1202 MS_U32 g_audio_customer_MSTAR_SE_SET_BALANCE_UpperSetCnt;
1203
1204 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_NR_Threshold
1205 MS_U16 g_audio_customer_MSTAR_SE_SET_NR_Threshold;
1206 MS_U32 g_audio_customer_MSTAR_SE_SET_NR_Threshold_UpperSetCnt;
1207
1208 //API_AUDIO_CUSTOMER_MSTAR_SE_GET_NR_Status
1209 MS_S32 g_audio_customer_MSTAR_SE_GET_NR_Threshold;
1210
1211 //-------------------------------------------------------------------------------------------------------------------------------------
1212 /* Advanced Sound Effect */
1213 //-------------------------------------------------------------------------------------------------------------------------------------
1214 //API_AUDIO_CUSTOMER_DTS_SE_Enable
1215 MS_BOOL g_audio_customer_DTS_SE_Enable[API_AUDIO_CUSTOMER_DTS_SE_MAX];
1216 MS_U32 g_audio_customer_DTS_SE_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_MAX];
1217
1218 //API_AUDIO_CUSTOMER_DTS_SE_ProcessUnit_Enable
1219 MS_BOOL g_audio_customer_DTS_SE_ProcessUnit_Enable[API_AUDIO_CUSTOMER_DTS_SE_UNIT_MAX];
1220 MS_U32 g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_UNIT_MAX];
1221
1222 //API_AUDIO_CUSTOMER_DTS_SE_SetParam
1223 MS_U32 g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_MAX];
1224 MS_U32 g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_MAX];
1225
1226 //API_AUDIO_CUSTOMER_Dolby_DAP_Enable
1227 MS_BOOL g_audio_customer_Dolby_DAP_Enable;
1228 MS_U32 g_audio_customer_Dolby_DAP_Enable_UpperSetCnt;
1229
1230 //API_AUDIO_CUSTOMER_Dolby_DAP_ProcessUnit_Enable
1231 MS_BOOL g_audio_customer_Dolby_DAP_ProcessUnit_Enable;
1232 MS_U32 g_audio_customer_Dolby_DAP_ProcessUnit_Enable_UpperSetCnt;
1233
1234 //API_AUDIO_CUSTOMER_Dolby_DAP_SetParam
1235 API_AUDIO_CUSTOMER_DOLBY_DAP_PARAM g_audio_customer_Dolby_DAP_SetParam;
1236 MS_U32 g_audio_customer_Dolby_DAP_SetParam_UpperSetCnt;
1237
1238 //-------------------------------------------------------------------------------------------------------------------------------------
1239 /* Thread monitor Enable */
1240 //-------------------------------------------------------------------------------------------------------------------------------------
1241 MS_BOOL g_audio_customer_AU_CUS_ClipDecoderMonitor_bEnable;
1242 MS_BOOL g_audio_customer_AU_CUS_MP3EncodeMonitor_bEnable;
1243 MS_BOOL g_audio_customer_AU_CUS_MonitorService_bEnable;
1244 MS_BOOL g_audio_customer_AU_CUS_AACEncodeMonitor_bEnable;
1245 MS_BOOL g_audio_customer_AU_CUS_MuteDuringLimitedTime_Monitor_bEnable;
1246 MS_BOOL g_audio_customer_AU_CUS_AdecPcmOutMonitor_bEnable;
1247 MS_BOOL g_audio_customer_AU_CUS_PCMCaptureMonitor_bEnable;
1248 MS_BOOL g_audio_customer_AU_CUS_EndOfStreamMonitor_bEnable;
1249 MS_BOOL g_audio_customer_AU_CUS_ADEC_Underrun_Monitor_bEnable;
1250 MS_BOOL g_audio_customer_AU_CUS_PATCH_Dump_R2_Log_Monitor_bEnable;
1251 MS_BOOL g_audio_customer_AU_CUS_INTERNAL_PATCH_Auto_Audio_Delay_Monitor_bEnable;
1252 MS_BOOL g_audio_customer_AU_CUS_INTERNAL_PATCH_General_Dump_Buffer_Monitor_bEnable;
1253 MS_BOOL g_audio_customer_AU_CUS_INTERNAL_PATCH_DDP_71_Auto_Bypass_Monitor_bEnable;
1254 MS_BOOL g_audio_customer_AU_CUS_INTERNAL_PATCH_R2_Active_Monitor_bEnable;
1255 MS_BOOL g_audio_customer_AU_CUS_Demo_MM_New_Mode_AD_Play_Monitor_bEnable;
1256 MS_BOOL g_audio_customer_AU_CUS_Demo_MM_New_Mode_Play_Monitor_bEnable;
1257 MS_BOOL g_audio_customer_AU_CUS_Demo_PCMIO_Play_Monitor_bEnable;
1258 MS_BOOL g_audio_customer_AU_CUS_AV_Sync_Info_Monitor_bEnable;
1259 MS_BOOL g_audio_customer_AU_CUS_ThreadPrintMsg_Monitor_bEnable;
1260
1261 //-------------------------------------------------------------------------------------------------------------------------------------
1262 /* Thread monitor interval */
1263 //-------------------------------------------------------------------------------------------------------------------------------------
1264 MS_U32 g_audio_customer_AU_ClipDecoderMonitor_Interval; //ms
1265 MS_U32 g_audio_customer_AU_MP3EncodeMonitor_Interval; //ms
1266 MS_U32 g_audio_customer_AU_MonitorService_Interval; //ms
1267 MS_U32 g_audio_customer_AU_AACEncodeMonitor_Interval; //ms
1268 MS_U32 g_audio_customer_AU_MuteDuringLimitedTime_Monitor_Interval; //ms
1269 MS_U32 g_audio_customer_AU_AdecPcmOut_Interval; //ms
1270 MS_U32 g_audio_customer_AU_PCMCapture_Interval; //ms
1271 MS_U32 g_audio_customer_AU_EndOfStreamMonitor_Interval; //ms
1272 MS_U32 g_audio_customer_AU_AdecUnderrun_Interval; //ms
1273 MS_U32 g_audio_customer_patch_Dump_R2_Log_Monitor_Interval; //ms
1274 MS_U32 g_audio_customer_internal_patch_Auto_Audio_Delay_Monitor_Interval; //ms
1275 MS_U32 g_audio_customer_internal_patch_General_Buffer_Dump_Monitor_Interval; //ms
1276 MS_U32 g_audio_customer_internal_patch_DDP_71_Auto_Bypass_Monitor_Interval; //ms
1277 MS_U32 g_audio_customer_internal_patch_R2_Active_Monitor_Interval; //ms
1278
1279 //-------------------------------------------------------------------------------------------------------------------------------------
1280 /* AU Demo PCMIO play */
1281 //-------------------------------------------------------------------------------------------------------------------------------------
1282 API_AUDIO_CUSTOMER_PCMIO_PARAM g_audio_customer_AU_Demo_PCMIO_pcmParam;
1283 API_AUDIO_CUSTOMER_UPPER_PLAYCMD g_audio_customer_AU_Demo_PCMIO_UpperPlay;
1284 MS_U32 g_audio_customer_AU_Demo_PCMIO_repeatNum;
1285 MS_U32 g_audio_customer_AU_Demo_PCMIO_Monitor_Interval;
1286 int g_audio_customer_AU_Demo_PCMIO_input_file_length;
1287
1288 //-------------------------------------------------------------------------------------------------------------------------------------
1289 /* AU Demo MM New Mode */
1290 //-------------------------------------------------------------------------------------------------------------------------------------
1291 MS_U32 g_audio_customer_AU_Demo_MM_New_Mode_Play_StartTime;
1292 MS_U32 g_audio_customer_AU_Demo_MM_New_Mode_AD_Play_StartTime;
1293 MS_U32 g_audio_customer_AU_Demo_MM_New_Mode_Play_Monitor_Interval;
1294
1295 //-------------------------------------------------------------------------------------------------------------------------------------
1296 /* AV Sync Info */
1297 //-------------------------------------------------------------------------------------------------------------------------------------
1298 API_AUDIO_CUSTOMER_ADEC_INDEX g_audio_customer_AU_AV_Sync_Info_adecIndex;
1299 MS_U32 g_audio_customer_AU_AV_Sync_Info_bEnable;
1300 int g_audio_customer_AU_AV_Sync_Info_Monitor_Interval;
1301 MS_U32 g_audio_customer_AU_AV_Sync_Info_PCMlevel;
1302 MS_U32 g_audio_customer_AU_AV_Sync_Info_PCMlevel_in_ms;
1303 MS_U32 g_audio_customer_AU_AV_Sync_Info_Upper_es_size;
1304 MS_BOOL g_audio_customer_AU_AV_Sync_Info_Upper_ptsExist;
1305 MS_U64 g_audio_customer_AU_AV_Sync_Info_Upper_pts;
1306 MS_U64 g_audio_customer_AU_AV_Sync_Info_R2_pts;
1307 MS_U32 g_audio_customer_AU_AV_Sync_Info_DMX_stc;
1308 MS_U32 g_audio_customer_AU_AV_Sync_Info_inputAesFinished_cnt;
1309 MS_BOOL g_audio_customer_AU_AV_Sync_Info_inputAesFinished_ret;
1310 int g_audio_customer_AU_AV_Sync_Info_pts_offset;
1311 API_AUDIO_CUSTOMER_AES_INFO g_audio_customer_AU_AV_Sync_Info_aes_info;
1312
1313 } St_Audio_Customer_Shm_data;
1314
1315 static St_Audio_Customer_Shm_data *pstAudioCustomerShmData = NULL;
1316
1317 //---Audio init finish---
1318 MS_BOOL g_api_audio_InitializeModule_R2_bActive = FALSE;
1319
1320 //---Call back functions---
1321 typedef struct
1322 {
1323 pfnAudioCustomerAdecoderClipDone pFunc_ClipDec;
1324 pfnAudioCustomerAENCDataHandling pFunc_AencMP3;
1325 pfnAudioCustomerAENCDataHandling pFunc_AencAAC;
1326 pfnAudioCustomerPCMSending pFunc_PCMCaptureDone;
1327 pfnAudioCustomerMP3EncodeDone pFunc_MP3Encode;
1328 pfnAudioCustomerAdecDecodeDone pFunc_AdecDecDone;
1329 pfnAudioCustomerAdecEndOfStream pFunc_Adec0_EndOfStream;
1330 pfnAudioCustomerAdecEndOfStream pFunc_Adec1_EndOfStream;
1331 pfnAudioCustomerAdecUnderrun pFunc_Adec0_Underrun;
1332 pfnAudioCustomerAdecUnderrun pFunc_Adec1_Underrun;
1333 pfnAudioCustomerHDMIMonitorEvent pFunc_HDMIMonitorEvent;
1334 } St_Audio_Callback_Func;
1335
1336 St_Audio_Callback_Func madCallBack;
1337
1338 //---buffer info---
1339 typedef struct
1340 {
1341 MS_U32 u32BufStartAddr_P;
1342 MS_U32 u32BufEndAddr_P;
1343 MS_U32 u32BufWptr_P;
1344 MS_U32 u32BufRptr_P;
1345 MS_U32 u32BufStartAddr_V;
1346 MS_U32 u32BufEndAddr_V;
1347 MS_U32 u32BufWptr_V;
1348 MS_U32 u32BufRptr_V;
1349 MS_U32 u32BufSize;
1350 } St_Audio_Buf_Info;
1351
1352 /* Main sound */
1353 St_Audio_Buf_Info ES1BufInfo;
1354 St_Audio_Buf_Info ES3BufInfo;
1355 St_Audio_Buf_Info ExternalBufInfo;
1356
1357 /* Ad sound */
1358 St_Audio_Buf_Info AD_ES2BufInfo;
1359 St_Audio_Buf_Info AD_ExternalBufInfo;
1360
1361 //---Clip play info---
1362 typedef struct
1363 {
1364 void *address;
1365 MS_U32 u32Size;
1366 MS_BOOL bIsStart;
1367 MS_BOOL bIsPause;
1368 MS_U8 u8Sink;
1369 AUDIO_DEC_ID decID;
1370 MS_U32 u32RepeatNum;
1371 } St_Audio_Clip_Decoder_Info;
1372
1373 St_Audio_Clip_Decoder_Info clipDecoderInfo;
1374 St_Audio_Buf_Info *pClipDecESBufInfo = NULL;
1375 St_Audio_Buf_Info *pClipDecExtBufInfo = NULL;
1376
1377 //---get pcm (uni-play)---
1378 typedef struct
1379 {
1380 MS_U32 U32DecodeFrame;
1381 MS_U32 U32WrtAddr;
1382 MS_U32 U32WrtBytes;
1383 } API_AUDIO_MM_PCM_Info;
1384
1385 typedef struct
1386 {
1387 MS_U32 u32BufStartAddr;
1388 MS_U32 u32BufEndAddr;
1389 MS_U32 u32BufWrPtr;
1390 MS_U32 u32BufTotalSize;
1391 MS_U32 u32BufOffset;
1392 } API_AUDIO_MM_PCM_BufControl;
1393
1394 typedef struct
1395 {
1396 API_AUDIO_MM_PCM_Info PcmInfo;
1397 API_AUDIO_MM_PCM_BufControl PcmBuf;
1398 MS_U32 u32LastDecodeFrame;
1399 } API_AUDIO_MM_PCM_HANDLE;
1400
1401 API_AUDIO_MM_PCM_HANDLE stADEC_PCM_HANDLE;
1402 API_AUDIO_MM_PCM_HANDLE* pAdecPcmHandle = &stADEC_PCM_HANDLE;
1403
1404 //---audio demo (MM new mode)---
1405 typedef struct
1406 {
1407 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex;
1408 void *extBufaddr_V;
1409 MS_U32 u32Size;
1410 MS_BOOL bIsStart;
1411 MS_BOOL bIsPause;
1412 MS_U32 u32RepeatNum;
1413 } St_AU_Demo_MM_New_Mode_Decoder_Info;
1414
1415 /* Main sound */
1416 St_AU_Demo_MM_New_Mode_Decoder_Info AU_Demo_MM_New_Mode_DecInfo;
1417 St_Audio_Buf_Info *pAU_Demo_MM_New_Mode_DecESBufInfo = NULL;
1418 St_Audio_Buf_Info *pAU_Demo_MM_New_Mode_DecExtBufInfo = NULL;
1419
1420 /* Ad sound */
1421 St_AU_Demo_MM_New_Mode_Decoder_Info AU_Demo_MM_New_Mode_AD_DecInfo;
1422 St_Audio_Buf_Info *pAU_Demo_MM_New_Mode_AD_DecESBufInfo = NULL;
1423 St_Audio_Buf_Info *pAU_Demo_MM_New_Mode_AD_DecExtBufInfo = NULL;
1424
1425 //---audio chip type---
1426 typedef enum
1427 {
1428 API_AUDIO_CUSTOMER_CHIP_TYPE_INVALID = -1,
1429 API_AUDIO_CUSTOMER_CHIP_TYPE_2R1D,
1430 API_AUDIO_CUSTOMER_CHIP_TYPE_1R1D,
1431 API_AUDIO_CUSTOMER_CHIP_TYPE_2D1R,
1432 API_AUDIO_CUSTOMER_CHIP_TYPE_2D,
1433 API_AUDIO_CUSTOMER_CHIP_TYPE_1D,
1434 } API_AUDIO_CUSTOMER_CHIP_TYPE;
1435
1436 typedef enum
1437 {
1438 API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT_INVALID = -1,
1439 API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT_DEC = 0x0, //decoder
1440 API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT_MCH = 0x1, //multi-channel
1441 API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT_DMX = 0x2, //downmix
1442 }API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT;
1443
1444 //---Customized internal patch---
1445 typedef enum
1446 {
1447 AU_CUS_INTERNAL_PATCH_PARAM_TYPE_INVALID = -1,
1448
1449 //--------------------------------------------------------------------------------------
1450 // (AU_CUS_"INTERNAL_PATCH"_PARAM_XXXXXXXX), PARAM: Set
1451 //--------------------------------------------------------------------------------------
1452 //---ADEC set gain, mute---
1453 AU_CUS_INTERNAL_PATCH_PARAM_ADEC_SET_GAIN,
1454 AU_CUS_INTERNAL_PATCH_PARAM_ADEC_SET_MUTE,
1455
1456 //---MS12 HDMI TX PCM ouput Auto Delay (for sync with NPCM)---
1457 AU_CUS_INTERNAL_PATCH_PARAM_MS12_HDMI_TX_PCM_AUDIO_DELAY,
1458
1459 //---General Buffer Dump---
1460 AU_CUS_INTERNAL_PATCH_PARAM_GENERAL_BUFFER_DUMP_ENABLE,
1461
1462 //---SNDR2_MS12_PCMR_METADATA_SELECT---
1463 AU_CUS_INTERNAL_PATCH_PARAM_SNDR2_MS12_PCMR_METADATA_SELECT,
1464
1465 //---MAX---
1466 AU_CUS_INTERNAL_PATCH_PARAM_MAX = AU_CUS_INTERNAL_PATCH_PARAM_GENERAL_BUFFER_DUMP_ENABLE,
1467 } AU_CUS_INTERNAL_PATCH_PARAM_TYPE;
1468
1469 typedef enum
1470 {
1471 AU_CUS_INTERNAL_PATCH_INFO_TYPE_INVALID = -1,
1472
1473 //--------------------------------------------------------------------------------------
1474 // (AU_CUS_"INTERNAL_PATCH"_INFO_XXXXXXXX), INFO: Get
1475 //--------------------------------------------------------------------------------------
1476 //---RESERVE---
1477 AU_CUS_INTERNAL_PATCH_INFO_RESERVE0,
1478
1479 //---MAX---
1480 AU_CUS_INTERNAL_PATCH_INFO_MAX = AU_CUS_INTERNAL_PATCH_INFO_RESERVE0,
1481 } AU_CUS_INTERNAL_PATCH_INFO_TYPE;
1482
1483 //---Debug cmd---
1484 typedef enum
1485 {
1486 AU_DebugMenu_IDX,
1487 API_AUDIO_CUSTOMER_MAX_COMMNAD_IDX, //maximum commnad index
1488 }EN_COMMNAD_INDEX;
1489
1490 typedef struct
1491 {
1492 char cCommmandName[64];
1493 EN_COMMNAD_INDEX u32CommmandIndex;
1494 } API_AUDIO_CUSTOMER_COMMAND_ST;
1495
1496 const API_AUDIO_CUSTOMER_COMMAND_ST API_AUDIO_CUSTOMER_COMMNAD_INFO[] =
1497 {
1498 {{"AU_DebugMenu"} , AU_DebugMenu_IDX},
1499 };
1500
1501 /* ATV parameter */
1502 AUDIOSTANDARD_TYPE SIF_AudioStandard = E_AUDIOSTANDARD_NOTSTANDARD;
1503 AUDIOSTATUS SIF_AudioStatus = E_STATE_AUDIO_NO_CARRIER;
1504 AUDIOMODE_TYPE SIF_AudioMode = E_AUDIOMODE_INVALID;
1505
1506 /* Encode parameter */
1507 API_AUDIO_CUSTOMER_AENC_INFO AENC_INFO;
1508 static MS_BOOL firstGetEncodeTimeFlag = FALSE;
1509 static MS_U32 encStartTime = 0;
1510
1511 /* MP3 Encode parameter */
1512 MS_U8 *pMP3EncBuffer = NULL;
1513 static MS_U32 retryCounterMP3Encode = 0;
1514
1515 #if (UTPA_SUPPORT_AAC_ENCODE == 1)
1516 /* AAC Encode parameter */
1517 MS_U8 *pAACEncPCMBuffer = NULL;
1518 unsigned char aacEncodedBuffer[AAC_ENCODED_LENTH];
1519 static MS_U32 retryCounterAACEncode = 0;
1520 AUDIO_DEVICE_TYPE AACEncPCMCaptureDevice = E_DEVICE0;
1521 void *aacEncodeHandler = NULL;
1522 #endif
1523
1524 /* PCM Capture parameter */
1525 MS_U8 *pPCMCaptureBuffer = NULL;
1526 MS_U32 retryCounterPCMCapture = 0;
1527
1528 //Mute during limit time (Output)
1529 static MS_U32 MuteLimitedTimeOfSoundOut[API_AUDIO_CUSTOMER_OUTPUT_MAX] = {0,0,0,0,0,0,0,0,0};
1530
1531 //Mute during limit time of FM0 (Input)
1532 static MS_U32 MuteLimitedTimeOfFWM0In[API_AUDIO_CUSTOMER_FWM_INPUT_MAX] = {0,0,0};
1533
1534 //for apiAUDIO.c / apiAUDIO_V2.c nDBG MSG.
1535 MS_U8 g_api_audio_V2_bEnableNonThreadPrintMsg = 0;
1536 MS_U8 g_api_audio_V2_bEnableThreadPrintMsg = 0;
1537 MS_U8 g_api_audio_V2_bEnableReturnPrintMsg = 0;
1538
1539 //Audio Chip type
1540 static API_AUDIO_CUSTOMER_CHIP_TYPE AUDIO_CHIP_TYPE = API_AUDIO_CUSTOMER_CHIP_TYPE_INVALID;
1541
1542 //REG_BANK
1543 static MS_U32 REG_BANK_ADEC1_PLAY = 0;
1544 static MS_U32 REG_BANK_ADEC1_CODEC = 0;
1545 static MS_U32 REG_BANK_ADEC2_PLAY = 0;
1546 static MS_U32 REG_BANK_ADEC2_CODEC = 0;
1547 static MS_U32 REG_BANK_R2_UART = 0;
1548 static MS_U32 REG_BANK_R2_DEC_UART_ENABLE = 0;
1549 static MS_U32 REG_BANK_R2_SND_UART_ENABLE = 0;
1550 static MS_U32 REG_BANK_R2_WFI = 0;
1551 static MS_U32 REG_BANK_R2_WFI_ENABLE = 0;
1552 static MS_U32 REG_BANK_R2_LOG_DBG = 0;
1553 static MS_U32 REG_BANK_R2_SYSTEM_DBG = 0;
1554 static MS_U32 REG_BANK_ADEC_DSP_DBG = 0;
1555 static MS_U32 REG_BANK_ADEC_DSP_RESULT1 = 0;
1556 static MS_U32 REG_BANK_ADEC_DSP_RESULT2 = 0;
1557 static MS_U32 REG_BANK_ASND_DSP_DBG = 0;
1558 static MS_U32 REG_BANK_ASND_DSP_RESULT1 = 0;
1559 static MS_U32 REG_BANK_ASND_DSP_RESULT2 = 0;
1560 static MS_U32 REG_BANK_DEC_R2_VERSION = 0;
1561 static MS_U32 REG_BANK_SND_R2_VERSION = 0;
1562 static MS_U32 REG_BANK_SND_R2_SRS = 0;
1563 static MS_U32 REG_BANK_SNDOUT_INPUT_PATH_SEL1 = 0;
1564 static MS_U32 REG_BANK_SNDOUT_INPUT_PATH_SEL2 = 0;
1565 static MS_U32 REG_BANK_SNDOUT_INPUT_PATH_SEL3 = 0;
1566 static MS_U32 REG_BANK_ADEC_DSP_IDMA = 0;
1567 static MS_U32 REG_BANK_ASND_DSP_IDMA = 0;
1568
1569 //AU Demo MM New mode Get PCM
1570 char AU_Demo_MM_New_Mode_Get_PCM_Buffer[AU_DEMO_MM_NEW_MODE_GET_PCM_BUFFER_SIZE];
1571 char *pAU_Demo_MM_New_Mode_Get_PCM_Buffer = AU_Demo_MM_New_Mode_Get_PCM_Buffer;
1572
1573 //MM dump ES
1574 MS_U8 g_api_audio_V2_bEnableMMESDump = 0;
1575
1576 //AU Demo MM file read in buffer
1577 MS_U8 *AU_Demo_MM_File_read_in_buffer = NULL;
1578 MS_U8 *AU_Demo_MM_File_read_in_buffer2 = NULL;
1579 MS_U8 *AU_Demo_MM_File_read_in_buffer3 = NULL;
1580
1581 //-------------------------------------------------------------------------------------------------------------------------------------
1582 // [Distinction Area] [kernel space / user space] [variable / struct / enum] declare in this area.
1583 //-------------------------------------------------------------------------------------------------------------------------------------
1584 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
1585 //file for nDBG log
1586 struct file *pAU_nDBG_Log_To_File = NULL;
1587 struct file *pAU_nDBG_MenuLog_To_File = NULL;
1588
1589 //Shm Data
1590 static St_Audio_Customer_Shm_data stAudioCustomerShmData;
1591
1592 //mutex
1593 struct mutex AU_Customer_ReadAbsReg_mutex_lock;
1594 struct mutex AU_Customer_WriteAbsReg_mutex_lock;
1595 struct mutex AU_Customer_ReadDM_mutex_lock;
1596 struct mutex AU_Customer_WriteDM_mutex_lock;
1597 struct mutex AU_Customer_ReadPM_mutex_lock;
1598 struct mutex AU_Customer_WritePM_mutex_lock;
1599 struct mutex AU_Customer_ReadAbsXbox_mutex_lock;
1600 struct mutex AU_Customer_WriteAbsXbox_mutex_lock;
1601 struct mutex AU_Customer_MP3Encode_mutex_lock;
1602 #if (UTPA_SUPPORT_AAC_ENCODE == 1)
1603 struct mutex AU_Customer_AACEncode_mutex_lock;
1604 #endif
1605 struct mutex AU_Customer_PCMCapture_mutex_lock;
1606 struct mutex AU_Customer_MM2_initAesInfo_mutex_lock;
1607 struct mutex AU_Customer_MM2_checkAesInfo_mutex_lock;
1608 struct mutex AU_Customer_MM2_inputAesFinished_mutex_lock;
1609 struct mutex AU_Customer_SPDIF_TX_SetOutputType_mutex_lock;
1610
1611 //MP3 Encode (Dump file)
1612 struct file *pAU_MP3EncDumpFile = NULL;
1613
1614 //ADEC PCM dump file
1615 struct file *pAU_AdecPcmDumpFile = NULL;
1616
1617 #if (UTPA_SUPPORT_AAC_ENCODE == 1)
1618 typedef signed char tEmzInt8;
1619 typedef unsigned char tEmzUint8;
1620 typedef short int tEmzInt16;
1621 typedef unsigned short int tEmzUint16;
1622 typedef int tEmzInt32;
1623 typedef unsigned int tEmzUint32;
1624 typedef float tEmzFlt32;
1625 typedef double tEmzFlt64;
1626 typedef unsigned char tEmzBool;
1627 typedef signed int tEmzError;
1628
1629 typedef enum OpFormat
1630 {
1631 FORMAT_RAW = 0,
1632 FORMAT_ADIF = 1,
1633 FORMAT_ADTS = 2
1634 }tOutputFormat;
1635
1636 typedef enum channelMode
1637 {
1638 SINGLE_CHANNEL = 0,
1639 DUAL_MONO = 1,
1640 JOINT_STEREO = 2
1641 }tChannelMode;
1642
1643 typedef struct Mp4AacEncParams tMp4AacEncParams;
1644 struct Mp4AacEncParams
1645 {
1646 tEmzUint32 NumberOfChannels;
1647 tEmzUint32 SamplingFrequency;
1648 tEmzUint32 TurnOnPns;
1649 tEmzUint32 TurnOnTns;
1650 tEmzUint32 VersionInfo;
1651 tOutputFormat OutputFormat;
1652 tEmzUint32 OutputBitRate;
1653 tChannelMode ChannelMode;
1654 tEmzUint32 Flag_VBR;
1655 tEmzUint16 BandWidthSel;
1656 };
1657
1658 //AAC Encode (Dump file)
1659 struct file *pAU_AACEncDumpFile = NULL;
1660 struct file *pAU_AACEncPCMCaptureDumpFile = NULL;
1661 #endif
1662
1663 //PCM Capture dump file
1664 struct file *pAU_PcmCaptureSourceDumpFile = NULL;
1665
1666 //DDR Dump file
1667 struct file *pAU_DDR_BIN_File = NULL;
1668
1669 //AU Demo MM New Mode Get PCM
1670 struct file *pAU_Demo_MM_New_Mode_AdecPcmDump = NULL;
1671
1672 //MM mode ES real time dump file
1673 struct file *pAU_MMESDumpFile = NULL;
1674
1675 //General buffer dump file
1676 struct file *pAU_GeneralBufferDumpFile = NULL;
1677
1678 //General buffer dump file
1679 struct file *pAU_GeneralBufferDumpFile2 = NULL;
1680
1681 //General buffer dump file
1682 struct file *pAU_GeneralBufferDumpFile3 = NULL;
1683
1684 //General buffer dump file
1685 struct file *pAU_GeneralBufferDumpFile4 = NULL;
1686
1687 //R2 Log buffer dump file
1688 struct file *pAU_R2LogBufferDumpFile = NULL;
1689
1690 /* kernel debug proc */
1691 /* Define a Proc structure for debug */
1692 struct AU_CUS_kernel_debug_proc_st
1693 {
1694 struct proc_dir_entry *proc_entry;
1695 struct file_operations proc_fops;
1696 char *proc_name;
1697 umode_t proc_mode;
1698 };
1699 static struct proc_dir_entry *g_proc_root = NULL;
1700
1701 #else //User Space
1702 //file for nDBG log
1703 FILE *pAU_nDBG_Log_To_File = NULL;
1704 FILE *pAU_nDBG_MenuLog_To_File = NULL;
1705
1706 //mutex
1707 static MS_S32 AU_Customer_ReadAbsReg_mutex_lock = -1;
1708 static MS_S32 AU_Customer_WriteAbsReg_mutex_lock = -1;
1709 static MS_S32 AU_Customer_ReadDM_mutex_lock = -1;
1710 static MS_S32 AU_Customer_WriteDM_mutex_lock = -1;
1711 static MS_S32 AU_Customer_ReadPM_mutex_lock = -1;
1712 static MS_S32 AU_Customer_WritePM_mutex_lock = -1;
1713 static MS_S32 AU_Customer_ReadAbsXbox_mutex_lock = -1;
1714 static MS_S32 AU_Customer_WriteAbsXbox_mutex_lock = -1;
1715 static MS_S32 AU_Customer_MP3Encode_mutex_lock = -1;
1716 #if (UTPA_SUPPORT_AAC_ENCODE == 1)
1717 static MS_S32 AU_Customer_AACEncode_mutex_lock = -1;
1718 #endif
1719 static MS_S32 AU_Customer_PCMCapture_mutex_lock = -1;
1720 static MS_S32 AU_Customer_MM2_initAesInfo_mutex_lock = -1;
1721 static MS_S32 AU_Customer_MM2_checkAesInfo_mutex_lock = -1;
1722 static MS_S32 AU_Customer_MM2_inputAesFinished_mutex_lock = -1;
1723 static MS_S32 AU_Customer_SPDIF_TX_SetOutputType_mutex_lock = -1;
1724
1725 //MP3 Encode (Dump file)
1726 FILE *pAU_MP3EncDumpFile = NULL;
1727
1728 //ADEC PCM dump file
1729 FILE *pAU_AdecPcmDumpFile = NULL;
1730
1731 #if (UTPA_SUPPORT_AAC_ENCODE == 1)
1732 //AAC Encode (Dump file)
1733 FILE *pAU_AACEncDumpFile = NULL;
1734 FILE *pAU_AACEncPCMCaptureDumpFile = NULL;
1735 #endif
1736
1737 //PCM Capture dump file
1738 FILE *pAU_PcmCaptureSourceDumpFile = NULL;
1739
1740 //DDR Dump file
1741 FILE *pAU_DDR_BIN_File = NULL;
1742
1743 //AU Demo MM New Mode Get PCM
1744 FILE *pAU_Demo_MM_New_Mode_AdecPcmDump = NULL;
1745
1746 //MM mode ES real time dump file
1747 FILE *pAU_MMESDumpFile = NULL;
1748
1749 //General buffer dump file
1750 FILE *pAU_GeneralBufferDumpFile = NULL;
1751
1752 //General buffer dump file
1753 FILE *pAU_GeneralBufferDumpFile2 = NULL;
1754
1755 //General buffer dump file
1756 FILE *pAU_GeneralBufferDumpFile3 = NULL;
1757
1758 //General buffer dump file
1759 FILE *pAU_GeneralBufferDumpFile4 = NULL;
1760
1761 //R2 Log buffer dump file
1762 FILE *pAU_R2LogBufferDumpFile = NULL;
1763
1764 //debug menu operate by non_scanf
1765 unsigned int non_scanf_params[NON_SCANF_DEBUG_CMD_PARAMS_MAX]; // store the decimal command number
1766 unsigned int non_scanf_paramsHex[NON_SCANF_DEBUG_CMD_PARAMS_MAX]; // store the heximal command number
1767 char non_scanf_paramsStr[AU_DEBUG_INPUT_STR_LENGTH+1]; // store the string
1768 unsigned char non_scanf_paramIdx = 0;
1769 unsigned char non_scanf_paramsCount = 0;
1770
1771 //AU debug get string input
1772 char au_debug_input_string[AU_DEBUG_INPUT_STR_LENGTH+1] = {'\0'};
1773 FILE *pAU_debug_input_file = NULL;
1774 FILE *pAU_debug_input_file2 = NULL;
1775 FILE *pAU_debug_input_file3 = NULL;
1776
1777 #if(DTS_AUDIO_PARSER_ENABLE)
1778 typedef unsigned long long uint64_t;
1779 typedef unsigned char uint8_t;
1780 typedef signed char int8_t;
1781 typedef unsigned short uint16_t;
1782 typedef short int16_t;
1783 typedef unsigned int uint32_t;
1784 typedef int int32_t;
1785 typedef fpos_t fpos_tt;
1786 typedef uint64_t dtsUint64;
1787
1788 /* basic abstract data types */
1789 typedef int32_t bool_t;
1790 typedef uint8_t dtsUint8;
1791 typedef uint8_t Uint8;
1792 typedef int8_t Int8;
1793 typedef int8_t dtsInt8;
1794 typedef int16_t dtsInt16;
1795 typedef int16_t Int16;
1796 typedef uint16_t Uint16;
1797 typedef uint16_t dtsUint16;
1798 typedef uint32_t Uint32;
1799 typedef uint32_t dtsUint32;
1800 typedef uint32_t dtsUint32b;
1801 typedef uint32_t uintptr_t;
1802 typedef int Int32;
1803 typedef int dtsInt32b;
1804 typedef int dtsInt32;
1805
1806 typedef enum
1807 {
1808 dtsTrue = 1,
1809 dtsFalse = 0
1810 } dtsBoolean;
1811
1812 typedef struct dtsHDHdr
1813 {
1814 dtsBoolean valid;
1815 dtsUint32 hdrVersion;
1816 dtsUint64 timeCode;
1817 dtsUint8 TCFrameRate;
1818 struct bitWStreamMetaData
1819 {
1820 dtsBoolean vbr;
1821 dtsBoolean pbrs;
1822 dtsBoolean navi;
1823 dtsBoolean coreSStrm;
1824 dtsBoolean extSStrm;
1825 } bitWStreamMetaData;
1826 dtsUint8 NumAudioPres;
1827 } dtsHDHdr;
1828
1829 typedef struct dtsCoreSSMD
1830 {
1831 dtsBoolean valid;
1832 dtsUint32 maxSampleRateHz;
1833 dtsUint16 bitRateKbps;
1834 dtsUint16 channelMask;
1835 dtsUint32 framePayloadBytes;
1836 } dtsCoreSSMD;
1837
1838 typedef struct dtsExtSSMD
1839 {
1840 dtsBoolean valid;
1841 dtsUint32 avgBitRateKbps;
1842 dtsUint32 peakBitRateKbps;
1843 dtsUint16 pbrSmoothBuffSizeKb;
1844 dtsUint32 framePayloadBytes;
1845 } dtsExtSSMD;
1846
1847 typedef struct dtsAuPrHdr
1848 {
1849 dtsBoolean valid;
1850
1851 struct bitWAupresMetaData
1852 {
1853 dtsBoolean BCCCComp;
1854 dtsBoolean BCCCCompInExtSS;
1855 dtsBoolean LLCComp;
1856 dtsBoolean LBRCComp;
1857 } bitWAupresMetaData;
1858
1859 dtsUint32 maxSampleRate;
1860 dtsUint32 numFrames;
1861 dtsUint16 samplesPerFrameMaxFs;
1862 dtsUint64 numSamplesOrigAudioMaxFs;
1863 dtsUint16 channelMask;
1864 dtsUint16 codecDelayMaxFs;
1865 dtsUint32 BCCoreMaxSampleRate;
1866 dtsUint16 BCCoreBitRate;
1867 dtsUint16 BCCoreChannelMask;
1868 dtsUint8 LSBTrimPercent;
1869 } dtsAuPrHdr;
1870
1871 typedef struct dtsSTRMData
1872 {
1873 dtsBoolean valid;
1874 dtsUint64 streamDataByteSize;
1875 dtsUint64 bytesRead;
1876 fpos_tt currentFilePosition;
1877 fpos_tt positionStartOfData;
1878 } dtsSTRMData;
1879
1880 typedef struct dtsNaviTbl
1881 {
1882 dtsBoolean valid;
1883 dtsUint32 numEntries;
1884 dtsUint16 intervalFrames;
1885 dtsUint8 entrySize;
1886 fpos_tt tblEntryStartPos;
1887 } dtsNaviTbl;
1888
1889 typedef struct dtsBuildVer
1890 {
1891 dtsBoolean valid;
1892 dtsUint8 dataSizeBytes;
1893 dtsUint8 data[DTS_HD_MAX_BUILDVER_BYTES];
1894 } dtsBuildVer;
1895
1896 typedef struct dtsTimecode
1897 {
1898 dtsBoolean valid;
1899 dtsUint32 clock;
1900 dtsUint8 frameRate;
1901 dtsUint64 startSampSinceMidnight;
1902 dtsUint32 startResidual;
1903 dtsUint64 refSampSinceMidnight;
1904 dtsUint32 refResidual;
1905 dtsUint64 endSampSinceMidnight;
1906 } dtsTimecode;
1907
1908 typedef struct
1909 {
1910 dtsHDHdr hdr;
1911 dtsCoreSSMD coreSSMD;
1912 dtsExtSSMD extSSMD;
1913 dtsAuPrHdr auPrHdr[DTS_HD_MAX_ASSETS];
1914 dtsSTRMData data;
1915 dtsNaviTbl navi;
1916 dtsBuildVer bldVer;
1917 dtsTimecode timecode;
1918 dtsBoolean eof;
1919 } dtsHDFileInfo;
1920
1921 typedef enum HDParserState
1922 {
1923 HD_PS_START = 0,
1924 HD_PS_HDR_FOUND,
1925 HD_PS_STREAM_FOUND,
1926 HD_PS_EOF,
1927 HD_PS_ERROR
1928 } HDParserState;
1929
1930 typedef struct
1931 {
1932 dtsUint64 size;
1933 dtsUint64 pos;
1934 } dtsFilePCMInfo;
1935
1936 typedef struct dtsWavFileFormatInfo
1937 {
1938 dtsUint16 wFormatTag;
1939 dtsUint16 wChannels;
1940 dtsUint32 dwSamplesPerSec;
1941 dtsUint32 dwAvgBytesPerSec;
1942 dtsUint16 wBlockAlign;
1943 dtsUint16 wBitsPerSample;
1944 } dtsWavFileFormatInfo;
1945
1946 typedef struct dtsWavFileDataInfo
1947 {
1948 dtsUint64 lengthInBytes;
1949 dtsUint64 bytesRead;
1950 } dtsWavFileDataInfo;
1951
1952 typedef struct dtsWavFileWriteInfo
1953 {
1954 fpos_tt riffChunkLengthLocation;
1955 fpos_tt dataChunkLengthLocation;
1956 fpos_tt nextWritePosition;
1957 } dtsWavFileWriteInfo;
1958
1959 typedef struct dtsWavFileReadInfo
1960 {
1961 fpos_tt nextReadPosition;
1962 } dtsWavFileReadInfo;
1963
1964 typedef struct dtsWavFileInfo
1965 {
1966 dtsWavFileFormatInfo format;
1967 dtsWavFileDataInfo data;
1968 dtsBoolean isWritable;
1969 dtsBoolean isInit;
1970 dtsBoolean eof;
1971 dtsWavFileWriteInfo writeInfo;
1972 dtsWavFileReadInfo readInfo;
1973 } dtsWavFileInfo;
1974
1975 typedef struct dtsWavFileHeader
1976 {
1977 dtsUint32 length;
1978 dtsUint8 id[DTS_WAV_FILE_ID_LENGTH];
1979 dtsUint8 content[DTS_WAV_FILE_CONTENT_LENGTH];
1980 } dtsWavFileHeader;
1981
1982 typedef struct
1983 {
1984 int type;
1985
1986 union
1987 {
1988 dtsWavFileInfo wav;
1989 dtsHDFileInfo dtshd;
1990 dtsFilePCMInfo pcm;
1991 } info;
1992 } DTS_FILEINFO;
1993
1994 DTS_FILEINFO dtsfile_info;
1995 #endif //#if(DTS_AUDIO_PARSER_ENABLE)
1996
1997 #if(WMA_AUDIO_PARSER_ENABLE)
1998 const GUID CLSID_CAsfHeaderObjectV0 = {0x75b22630, 0x668e, 0x11cf, {0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c} };
1999 const GUID CLSID_CAsfPropertiesObjectV2 = {0x8cabdca1, 0xa947, 0x11cf, {0x8e, 0xe4, 0x0 , 0xc0, 0xc , 0x20, 0x53, 0x65} };
2000 const GUID CLSID_CAsfStreamPropertiesObjectV1 = {0xb7dc0791, 0xa9b7, 0x11cf, {0x8e, 0xe6, 0x0 , 0xc0, 0xc , 0x20, 0x53, 0x65} };
2001 const GUID CLSID_CAsfContentDescriptionObjectV0 = {0x75b22633, 0x668e, 0x11cf, {0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c} };
2002 const GUID CLSID_CAsfDataObjectV0 = {0x75b22636, 0x668e, 0x11cf, {0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c} };
2003 const GUID CLSID_AsfXNullErrorMaskingStrategy = {0x20fb5700, 0x5b55, 0x11cf, {0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b} };
2004 const GUID CLSID_AsfXAcmAudioErrorMaskingStrategy = {0xbfc3cd50, 0x618f, 0x11cf, {0x8b, 0xb2, 0x00, 0xaa, 0x00, 0xb4, 0xe2, 0x20} };
2005 const GUID CLSID_AsfXSignatureAudioErrorMaskingStrategy = {0x49f1a440, 0x4ece, 0x11d0, {0xa3, 0xac, 0x0 , 0xa0, 0xc9, 0x3 , 0x48, 0xf6} };
2006 const GUID CLSID_AsfXStreamTypeAcmAudio = {0xf8699e40, 0x5b4d, 0x11cf, {0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b} };
2007 const GUID CLSID_CAsfContentEncryptionObject = {0x2211b3fb, 0xbd23, 0x11d2, {0xb4, 0xb7, 0x0 , 0xa0, 0xc9, 0x55, 0xfc, 0x6e} };
2008 const GUID CLSID_CAsfExtendedContentDescObject = {0xd2d0a440, 0xe307, 0x11d2, {0x97, 0xf0, 0x0 , 0xa0, 0xc9, 0x5e, 0xa8, 0x50} };
2009 const GUID CLSID_CAsfMarkerObjectV0 = {0xf487cd01, 0xa951, 0x11cf, {0x8e, 0xe6, 0x0 , 0xc0, 0xc , 0x20, 0x53, 0x65} };
2010 const GUID CLSID_CAsfLicenseStoreObject = {0x8fa7857b, 0xddc0, 0x11d3, {0xb6, 0xbd, 0x0 , 0xc0, 0x4f, 0x61, 0xd , 0x62} };
2011 const GUID CLSID_CAsfStreamPropertiesObjectV2 = {0x818d0d47, 0x43 , 0x4451, {0x92, 0x37, 0xda, 0xef, 0xbc, 0x48, 0x4f, 0x50} };
2012 const GUID CLSID_CAsfExtendedStreamPropertiesObject = {0x14E6A5CB, 0xC672, 0x4332, {0x83, 0x99, 0xA9, 0x69, 0x52, 0x06, 0x5B, 0x5A} };
2013 const GUID CLSID_AsfXStreamTypeDRMAuxData = {0xd5c82c81, 0x8264, 0x4abd, {0xa7, 0x14, 0xcd, 0x4f, 0x85, 0x54, 0xc7, 0x2e} };
2014 const GUID CLSID_CAsfClockObjectV0 = {0x5fbf03b5, 0xa92e, 0x11cf, {0x8e, 0xe3, 0x0 , 0xc0, 0xc , 0x20, 0x53, 0x65} };
2015 const GUID CLSID_AsfXMetaDataObject = {0xC5F8CBEA, 0x5BAF, 0x4877, {0x84, 0x67, 0xAA, 0x8C, 0x44, 0xFA, 0x4C, 0xCA} };
2016 const GUID CLSID_CAsfPacketClock1 = {0xabd3d211, 0xa9ba, 0x11cf, {0x8e, 0xe6, 0x0 , 0xc0, 0xc , 0x20, 0x53, 0x65} };
2017 const GUID CLSID_CAsfReserved1 = {0xabd3d211, 0xa9ba, 0x11cf, {0x8e, 0xe6, 0x0 , 0xc0, 0xc , 0x20, 0x53, 0x65} };
2018
2019 typedef struct tagWMAExtendedContentDescription
2020 {
2021 unsigned short cDescriptors; // number of descriptors
2022 ECD_DESCRIPTOR *pDescriptors; // pointer to all the descriptors
2023 } tWMAExtendedContentDesc;
2024
2025 typedef struct tagWMA_MetaDataDescRecords
2026 {
2027 unsigned short wLangIdIndex; // Specifies the index of the language ID in the Language List Object
2028 unsigned short wStreamNumber; // Specifies whether the entry applies to a specific media stream or
2029 // whether it applies to the whole file. A value of 0 in this field
2030 // indicates that it applies to the whole file; otherwise, the entry
2031 // applies only to the indicated stream number.
2032 unsigned short wNameLenth; // Specifies the number of valid bytes stored in the Name field.
2033 unsigned short wDataType; // Specifies the type of information being stored. The following values are recognized:
2034 unsigned int dwDataLength; // Specifies the length in bytes of the Data field.
2035 unsigned short *pwName; // Specifies the name that uniquely identifies the attribute being described. Names are case-sensitive.
2036 unsigned char *pData; // Specifies the actual metadata being stored. The Data field should be interpreted according to the value
2037 // stored in the Data Type field. If the Data Type is one of the extended values, this field may not contain
2038 // any data if the file is being streamed over the wire.
2039 } WMA_MetaDataDescRecords;
2040
2041 typedef struct tagWMA_MetaDataEntry
2042 {
2043 unsigned short m_wDescRecordsCount;
2044 WMA_MetaDataDescRecords *pDescRec;
2045 } WMA_MetaDataEntry;
2046
2047 typedef struct tagWMAFileHdrStateInternal
2048 {
2049 unsigned int currPacketOffset; /* not just for packets */
2050 unsigned int nextPacketOffset;
2051
2052 /* ASF header */
2053 unsigned int cbHeader;
2054 unsigned int cbPacketSize;
2055 unsigned int cbAudioSize;
2056 unsigned int cPackets;
2057 unsigned int msDuration;
2058 unsigned int msPreroll;
2059 unsigned int cbFirstPacketOffset;
2060 unsigned int cbLastPacketOffset;
2061 unsigned int dwFilePropertiesFlags;
2062
2063 /* audio prop */
2064 unsigned short nVersion;
2065 unsigned short wFormatTag;
2066 unsigned int nSamplesPerSec;
2067 unsigned int nAvgBytesPerSec;
2068 unsigned int payload_size;
2069 unsigned int nBlockAlign;
2070 unsigned short nChannels;
2071 unsigned int nSamplesPerBlock;
2072 unsigned short nEncodeOpt;
2073 unsigned short nAdvancedEncodeOpt;
2074 unsigned int nAdvancedEncodeOpt2;
2075
2076 // Added in V9
2077 unsigned short wPCMFormatTag;
2078 unsigned short wBitsPerSample; // container size
2079 unsigned short wValidBitsPerSample; // actual valid data depth in the decoded stream
2080 unsigned int dwChannelMask;
2081 GUID SubFormat;
2082 unsigned short wOriginalBitDepth; // actual valid data depth in the original source (informational)
2083
2084 /* DRM */
2085 unsigned char pbSecretData[32];
2086 unsigned int cbSecretData;
2087 unsigned char pbType[16];
2088 unsigned char pbKeyID[32];
2089
2090 /* Content Description */
2091 tWMAFileContDesc *m_pDesc;
2092
2093 /* Extended Content Description */
2094 tWMAExtendedContentDesc *m_pECDesc;
2095
2096 /* Marker */
2097 unsigned int m_dwMarkerNum;
2098 MarkerEntry *m_pMarker;
2099
2100 /* License Store */
2101 unsigned int m_dwLicenseLen;
2102 unsigned char *m_pLicData;
2103
2104 // Members added by Amit
2105 unsigned short wAudioStreamId;
2106 WMA_MetaDataEntry *ptMetaDataEntry;
2107
2108 // Members added by Naveen for MBR support
2109 unsigned short wTargetAudioStreamNumber;
2110 unsigned short cAudioStreams;
2111
2112 int bMstarHeader;
2113 unsigned long long u64CurrHeaderOffset;
2114 unsigned long long u64NextHeaderOffset;
2115 unsigned long long u64CurPayloadOffset;
2116 unsigned long long u64NextPayloadOffset;
2117 } tWMAFileHdrStateInternal;
2118
2119 typedef struct
2120 {
2121 unsigned int u32Size;
2122 unsigned int u32Level;
2123 unsigned int consumed_bytes;
2124 unsigned char *pStartAddr;
2125 unsigned char *pRptr;
2126 unsigned char *pWptr;
2127 unsigned char *pEndAddr;
2128 } Buffer_Control_t;
2129
2130 /* parser state */
2131 typedef enum
2132 {
2133 csWMA_NotValid = 0,
2134 csWMA_HeaderStart,
2135 csWMA_HeaderError,
2136 csWMA_NewAsfPacket,
2137
2138 /* packet parsing states */
2139 csWMA_DecodePayloadStart,
2140 csWMA_DecodePayload,
2141 csWMA_DecodeAudioData,
2142 csWMA_DecodePayloadEnd,
2143 csWMA_DecodeCompressedPayload,
2144
2145 csWMA_End_
2146 } tWMAParseState;
2147
2148 typedef struct tPACKET_PARSE_INFO_EX
2149 {
2150 int fParityPacket;
2151 unsigned int cbParseOffset;
2152
2153 int fEccPresent;
2154 unsigned char bECLen;
2155
2156 unsigned char bPacketLenType;
2157 unsigned int cbPacketLenTypeOffset;
2158
2159 unsigned char bPadLenType;
2160 unsigned char bSequenceLenType;
2161
2162 int fMultiPayloads;
2163 unsigned char bOffsetBytes;
2164 unsigned char bOffsetLenType;
2165 unsigned int cbPacketLenOffset;
2166 unsigned int cbExplicitPacketLength;
2167 unsigned int cbSequenceOffset;
2168 unsigned int dwSequenceNum;
2169
2170 unsigned int cbPadLenOffset;
2171 unsigned int cbPadding;
2172
2173 unsigned int dwSCR;
2174 unsigned short wDuration;
2175
2176 unsigned char bPayLenType;
2177 unsigned char bPayBytes;
2178 unsigned int cbPayLenTypeOffset;
2179 unsigned int cPayloads;
2180 } PACKET_PARSE_INFO_EX;
2181
2182 typedef struct tPAYLOAD_MAP_ENTRY_EX
2183 {
2184 unsigned short cbPacketOffset;
2185 unsigned short cbTotalSize;
2186
2187 unsigned char bStreamId;
2188 unsigned char bObjectId;
2189
2190 unsigned int cbObjectOffset;
2191 unsigned int cbObjectSize;
2192 unsigned int msObjectPres;
2193
2194 unsigned char cbRepData;
2195 unsigned short cbPayloadSize;
2196
2197 //Added by Amit
2198 unsigned short wBytesRead;
2199 unsigned short wTotalDataBytes;
2200 unsigned char bSubPayloadState;
2201 unsigned char bIsCompressedPayload;
2202 unsigned int dwDeltaTime;
2203 } PAYLOAD_MAP_ENTRY_EX;
2204
2205 typedef struct tagWMAFileStateInternal
2206 {
2207 tWMAFileHdrStateInternal hdr_parse;
2208
2209 /* parse_state */
2210 tWMAParseState parse_state;
2211
2212 /* payload parsing */
2213 unsigned long long cbPayloadOffset;
2214 unsigned long long cbPayloadLeft;
2215
2216 int bBlockStart;
2217 unsigned int cbBlockLeft;
2218
2219 /* packet parsing */
2220 PACKET_PARSE_INFO_EX ppex;
2221 PAYLOAD_MAP_ENTRY_EX payload;
2222 unsigned int iPayload;
2223 unsigned short wPayStart;
2224 } tWMAFileStateInternal;
2225
2226 tWMAFileStateInternal sWmaHandle;
2227
2228 typedef enum {MS_OK=0, MS_FAIL=1} MS_RESULT;
2229 typedef enum {BUF_WRITE=0, BUF_READ=1} MS_BUF_ACCESS;
2230
2231 Buffer_Control_t sDecodeFifo_Info;
2232
2233 unsigned char WMAPRO_DecodeFifo[WMAPRO_DECODE_FIFO_SIZE];
2234
2235 FILE *g_wmaInput_fp = NULL;
2236 int bEOF = 0;
2237 unsigned long long u64FileOffset = 0;
2238 unsigned int MaxRequestSize = WMA_MAX_DATA_REQUESTED;
2239 unsigned long long u64offset_expect = 0;
2240
2241 typedef struct tAsfXAcmAudioErrorMaskingData
2242 {
2243 unsigned char span;
2244 unsigned short virtualPacketLen;
2245 unsigned short virtualChunkLen;
2246 unsigned short silenceLen;
2247 unsigned char silence[1];
2248 } AsfXAcmAudioErrorMaskingData;
2249
2250 typedef struct tAsfXSignatureAudioErrorMaskingData
2251 {
2252 unsigned int maxObjectSize;
2253 unsigned short chunkLen;
2254 unsigned short signatureLen;
2255 unsigned char signature[1];
2256 } AsfXSignatureAudioErrorMaskingData;
2257
2258 typedef void * tHWMAFileState;
2259 #endif //#if(WMA_AUDIO_PARSER_ENABLE)
2260
2261 #endif
2262
2263 //-------------------------------------------------------------------------------------------------------------------------------------
2264 // [Pre-Declaration Area] pre-declared [function] declare in this area.
2265 //-------------------------------------------------------------------------------------------------------------------------------------
2266 /* Initialize, STR */
2267
2268 /* Connect & Disconnect */
2269 MS_BOOL AU_CUS_ADEC_Connect(API_AUDIO_CUSTOMER_ADEC_INDEX currentConnect, API_AUDIO_CUSTOMER_ADEC_INPUT inputConnect);
2270 MS_BOOL AU_CUS_ADEC_Disconnect(API_AUDIO_CUSTOMER_ADEC_INDEX currentConnect);
2271 MS_BOOL AU_CUS_ADC_Connect(API_AUDIO_CUSTOMER_ADC_INDEX currentConnect, API_AUDIO_CUSTOMER_ADC_IN_PORT portNum);
2272 MS_BOOL AU_CUS_ADC_Disconnect(API_AUDIO_CUSTOMER_ADC_INDEX currentConnect, API_AUDIO_CUSTOMER_ADC_IN_PORT portNum);
2273 MS_BOOL AU_CUS_CH_Sound_Connect(API_AUDIO_CUSTOMER_CH_SOUND currentConnect, API_AUDIO_CUSTOMER_CH_INPUT inputConnect);
2274 MS_BOOL AU_CUS_CH_Sound_Disconnect(API_AUDIO_CUSTOMER_CH_SOUND currentConnect, API_AUDIO_CUSTOMER_CH_INPUT inputConnect);
2275 MS_BOOL AU_CUS_FW_MIXER_Connect(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect, API_AUDIO_CUSTOMER_FWM_INPUT inputConnect);
2276 MS_BOOL AU_CUS_FW_MIXER_Disconnect(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect, API_AUDIO_CUSTOMER_FWM_INPUT inputConnect);
2277 MS_BOOL AU_CUS_SNDOUT_Connect(API_AUDIO_CUSTOMER_SOUNDOUT_INDEX currentConnect, API_AUDIO_CUSTOMER_SOUNDOUT_INPUT inputConnect);
2278 MS_BOOL AU_CUS_SNDOUT_Disconnect(API_AUDIO_CUSTOMER_SOUNDOUT_INDEX currentConnect, API_AUDIO_CUSTOMER_SOUNDOUT_INPUT inputConnect);
2279 API_AUDIO_CUSTOMER_CH_SOUND AU_CUS_Mapping_ADEC_to_FWM_INPUT(API_AUDIO_CUSTOMER_ADEC_INDEX currentConnect);
2280 void AU_CUS_SetSourceInfo(AUDIO_SOURCE_INFO_TYPE eSourceType);
2281 void AU_CUS_InputSwitch(AUDIO_INPUT_TYPE enSource, AUDIO_SWITCH_GROUP enGroup);
2282
2283 /* Start & Stop */
2284 MS_BOOL AU_CUS_SetCodecType(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_CODEC_TYPE audioType);
2285 MS_BOOL AU_CUS_StartDecoding(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex);
2286 MS_BOOL AU_CUS_StopDecoding(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex);
2287 MS_BOOL AU_CUS_PauseDecoding(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex);
2288
2289 /* SPDIF */
2290 MS_BOOL AU_CUS_SPDIF_TX_SetOutputType(API_AUDIO_CUSTOMER_SPDIF_TX_MODE eSPDIFMode);
2291 void AU_CUS_SPDIF_TX_Monitor(void);
2292
2293 /* HDMI */
2294 MS_BOOL AU_CUS_HDMI_TX_SetOutputType(API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_TYPE eHDMIMode);
2295 void AU_CUS_HDMI_RX_Monitor(void);
2296 void AU_CUS_HDMI_TX_Monitor(void);
2297 MS_BOOL AU_CUS_HDMI_RX_GetAudioMode(void);
2298
2299 /* ATV */
2300 void AU_CUS_CheckATVSoundMode(void);
2301 void AU_CUS_SIF_Monitor(void);
2302
2303 /* Decoder */
2304 MS_BOOL AU_CUS_SetSyncMode(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_BOOL bOnOff);
2305
2306 /* Common Decoder */
2307 MS_S32 AU_CUS_COMMON_DECODER_Open(void * pData);
2308 MS_S32 AU_CUS_COMMON_DECODER_Close(MS_S32 s32DeviceID);
2309 MS_S32 AU_CUS_COMMON_DECODER_Start(MS_S32 s32DeviceID);
2310 MS_S32 AU_CUS_COMMON_DECODER_Stop(MS_S32 s32DeviceID);
2311 MS_S32 AU_CUS_COMMON_DECODER_Set(MS_S32 s32DeviceID, API_AUDIO_CUSTOMER_COMMON_DECODER_COMMAND Cmd, void* pData);
2312 MS_S32 AU_CUS_COMMON_DECODER_Get(MS_S32 s32DeviceID, API_AUDIO_CUSTOMER_COMMON_DECODER_COMMAND Cmd, void* pData);
2313 MS_U32 AU_CUS_COMMON_DECODER_Read(MS_S32 s32DeviceID, void* pBuf, MS_U32 u32Size);
2314 MS_U32 AU_CUS_COMMON_DECODER_Write(MS_S32 s32DeviceID, void* pBuf, MS_U32 u32Size);
2315 MS_S32 AU_CUS_COMMON_DECODER_Flush(MS_S32 s32DeviceID);
2316
2317 /* Common */
2318 MS_BOOL AU_CUS_SetAudioParam(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_PARAM_TYPE paramType, void *pParam);
2319 MS_BOOL AU_CUS_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_INFO_TYPE infoType, void *pInfo);
2320
2321 /* Customized patch */
2322 MS_BOOL AU_CUS_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMIZED_PATCH_PARAM_TYPE paramType, void *pParam);
2323 MS_BOOL AU_CUS_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMIZED_PATCH_INFO_TYPE infoType, void *pInfo);
2324 void AU_CUS_PATCH_SeDSP_MS12_Enc_wo_Main_Snd_disable(void);
2325 void AU_CUS_PATCH_SndR2_MS12_Enc_wo_Main_Snd_disable(void);
2326
2327 /* Customized Internal patch */
2328 MS_BOOL AU_CUS_INTERNAL_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, AU_CUS_INTERNAL_PATCH_PARAM_TYPE paramType, void *pParam);
2329 MS_BOOL AU_CUS_INTERNAL_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, AU_CUS_INTERNAL_PATCH_INFO_TYPE infoType, void *pInfo);
2330 MS_BOOL AU_CUS_ADEC_SetGain(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, int gain);
2331 MS_BOOL AU_CUS_ADEC_SetMute(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_BOOL bOnOff);
2332
2333 /* Clip Play for ES */
2334
2335 /* Clip Play for PCM */
2336
2337 /* Gain, Mute & Delay */
2338 //---Gain---
2339 MS_BOOL AU_CUS_SetFWMixerChannelGain(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect, API_AUDIO_CUSTOMER_FWM_INPUT inputConnect, MS_U32 gain);
2340 MS_BOOL AU_CUS_SetI2SOutGain(MS_U32 gain);
2341 MS_BOOL AU_CUS_SetLineOutGain(API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex, MS_U32 gain);
2342 MS_BOOL AU_CUS_SetSPDIFOutGain(MS_U32 gain);
2343 //---Mute---
2344 MS_BOOL AU_CUS_SetFWMixerChannelMute(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect, API_AUDIO_CUSTOMER_FWM_INPUT inputConnect, MS_BOOL bOnOff);
2345 MS_BOOL AU_CUS_SetI2SOutMute(MS_BOOL bOnOff);
2346 MS_BOOL AU_CUS_SetLineOutMute(API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex, MS_BOOL bOnOff);
2347 MS_BOOL AU_CUS_SetSPDIFOutMute(MS_BOOL bOnOff);
2348 MS_BOOL AU_CUS_SetHDMIOutMute(MS_BOOL bOnOff);
2349 MS_BOOL AU_CUS_MuteDuringLimitedTime_Input(MS_U32 per_50ms, API_AUDIO_CUSTOMER_FWM_INDEX eFWM, API_AUDIO_CUSTOMER_FWM_INPUT eCh);
2350 MS_BOOL AU_CUS_MuteDuringLimitedTime_Output(MS_U32 per_50ms, API_AUDIO_CUSTOMER_OUTPUT_TYPE ePort);
2351 void AU_CUS_SetI2SOutMuteStatus(void);
2352 void AU_CUS_SetLineOutMuteStatus(API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex);
2353 void AU_CUS_SetSPDIFOutMuteStatus(void);
2354 void AU_CUS_SetHDMIOutMuteStatus(void);
2355 void AU_CUS_SetSoundOutMuteStatus(API_AUDIO_CUSTOMER_OUTPUT_TYPE port);
2356 void AU_CUS_Mute_LimitedTime_Input_Avoid_ADEC_Pop_Noise(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_U32 per_50ms);
2357 //---Delay---
2358 MS_BOOL AU_CUS_SetAudioDelay(MS_U32 delay);
2359 MS_BOOL AU_CUS_SetSpdifDelay(MS_U32 delay);
2360 MS_BOOL AU_CUS_SetHdmiDelay(MS_U32 delay);
2361
2362 /* AENC */
2363
2364 /* PCM Capture */
2365
2366 /* PCM IO Control */
2367
2368 /* MM New Mode */
2369 AUDIO_DEC_ID AU_CUS_ConvertDriverMainDecIDtoDriverAdDecID(AUDIO_DEC_ID DecID);
2370
2371 /* Mstar Sound Effect */
2372
2373 /* Advanced Sound Effect */
2374
2375 /* internal used functions */
2376 void AU_CUS_SHOW_ALL_VERSION(void);
2377 void AU_CUS_Delay1MS(int delay1MS);
2378 MS_U8* AU_CUS_MemoryAlloc(MS_U32 allocSize);
2379 void AU_CUS_MemoryFree(void *pMemoryBuffer);
2380 void AU_CUS_ShowAudioBlockDiagram(void);
2381 void AU_CUS_Dump_RegBank(int bank);
2382 void AU_CUS_Dump_Audio_Related_Bank(void);
2383 void AU_CUS_Show_R2_Debug_Option(void);
2384 void AU_CUS_Show_Bifrost_Test_File_Option(void);
2385 void AU_CUS_Show_Codec_Type_Option(void);
2386 MS_BOOL AU_CUS_DebugMenu(void);
2387 static MS_U16 AU_CUS_ReadAbsReg(MS_U32 regaddr);
2388 static void AU_CUS_WriteAbsReg(MS_U32 regaddr, MS_U16 data);
2389 static void AU_CUS_WriteAbsMaskReg(MS_U32 u32RegAddr, MS_U16 u16Mask, MS_U16 u16Val);
2390 static MS_U16 AU_CUS_ReadDM(AUDIO_DEC_ID DecID, MS_U32 regaddr, MS_BOOL bIsIDMA);
2391 static void AU_CUS_WriteDM(AUDIO_DEC_ID DecID, MS_U32 regaddr, MS_U16 data, MS_BOOL bIsIDMA);
2392 static MS_U16 AU_CUS_ReadPM(AUDIO_DEC_ID DecID, MS_U32 regaddr, MS_BOOL bIsIDMA);
2393 static void AU_CUS_WritePM(AUDIO_DEC_ID DecID, MS_U32 regaddr, MS_U32 data, MS_BOOL bIsIDMA);
2394 static MS_U32 AU_CUS_ReadAbsXbox(MS_U32 xboxaddr);
2395 static void AU_CUS_WriteAbsXbox(MS_U32 xboxaddr, MS_U32 data);
2396 static long long AU_CUS_long_div(long long a, int b);
2397
2398 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel space
2399 struct file * AU_CUS_FileOpen(const char * filename, const char *mode);
2400 void AU_CUS_FileClose(struct file *fp);
2401 void AU_CUS_FileWrite(const void *p, size_t size, size_t nmemb, struct file * fp);
2402
2403 #if (UTPA_SUPPORT_AAC_ENCODE == 1)
2404 tEmzInt32 Mpeg4AacEnc_Create(void **aHandle);
2405 tEmzInt32 Mpeg4AacEnc_Reset(void *aHandle, tMp4AacEncParams *aEncPrms);
2406 tEmzInt32 Mpeg4AacEnc_Encode(void *aHandle, tEmzInt16 aSrc[], tEmzInt32 aSrcLen, tEmzUint8 aDst[], tEmzInt32 *aDstLen);
2407 tEmzInt32 Mpeg4AacEnc_Delete(void *aHandle);
2408 #endif
2409
2410 /* kernel debug proc */
2411 /* proc child 1 */
2412 static ssize_t AU_CUS_kernel_debug_proc_read_nDBG(struct file *file, char __user *buffer, size_t count, loff_t *pos);
2413 static ssize_t AU_CUS_kernel_debug_proc_write_nDBG(struct file *file, const char __user *buffer, size_t count, loff_t *pos);
2414
2415 /* proc child 2 */
2416 static ssize_t AU_CUS_kernel_debug_proc_read_ShowVersion(struct file *file, char __user *buffer, size_t count, loff_t *pos);
2417
2418 #else //User space
2419 FILE * AU_CUS_FileOpen(const char * filename, const char *mode);
2420 int AU_CUS_FileClose(FILE * fp);
2421 void AU_CUS_FileWrite(const void *p, size_t size, size_t nmemb, FILE *fp);
2422
2423 #if(DTS_AUDIO_PARSER_ENABLE)
2424 typedef void (*AU_CUS_DTS_Parser_dtsDecodeChunkFunction)(FILE *fp, dtsHDFileInfo *pFileInfo, dtsUint64 chunkLength);
2425
2426 /* Decode functions for HD file chunks */
2427 void AU_CUS_DTS_Parser_dtsDecodeDTSHDHR( FILE *fp, dtsHDFileInfo *pFileInfo, dtsUint64 chunkLength);
2428 void AU_CUS_DTS_Parser_dtsDecodeCORESSMD(FILE *fp, dtsHDFileInfo *pFileInfo, dtsUint64 chunkLength);
2429 void AU_CUS_DTS_Parser_dtsDecodeEXTSSMD( FILE *fp, dtsHDFileInfo *pFileInfo, dtsUint64 chunkLength);
2430 void AU_CUS_DTS_Parser_dtsDecodeAUPRHDR( FILE *fp, dtsHDFileInfo *pFileInfo, dtsUint64 chunkLength);
2431 void AU_CUS_DTS_Parser_dtsDecodeSTRMDATA(FILE *fp, dtsHDFileInfo *pFileInfo, dtsUint64 chunkLength);
2432 void AU_CUS_DTS_Parser_dtsDecodeNAVITBL( FILE *fp, dtsHDFileInfo *pFileInfo, dtsUint64 chunkLength);
2433 void AU_CUS_DTS_Parser_dtsDecodeBUILDVER(FILE *fp, dtsHDFileInfo *pFileInfo, dtsUint64 chunkLength);
2434 void AU_CUS_DTS_Parser_dtsDecodeTIMECODE(FILE *fp, dtsHDFileInfo *pFileInfo, dtsUint64 chunkLength);
2435
2436 struct
2437 {
2438 const char *pChunkdId;
2439 AU_CUS_DTS_Parser_dtsDecodeChunkFunction pChunkDecode;
2440 } dtsHDChunkDecodeMatrix[] =
2441 {
2442 { DTS_HD_CHUNK_HDR , AU_CUS_DTS_Parser_dtsDecodeDTSHDHR },
2443 { DTS_HD_CHUNK_FILEINFO, NULL },
2444 { DTS_HD_CHUNK_CORESSMD, AU_CUS_DTS_Parser_dtsDecodeCORESSMD },
2445 { DTS_HD_CHUNK_EXTSS_MD, AU_CUS_DTS_Parser_dtsDecodeEXTSSMD },
2446 { DTS_HD_CHUNK_AUPR_HDR, AU_CUS_DTS_Parser_dtsDecodeAUPRHDR },
2447 { DTS_HD_CHUNK_AUPRINFO, NULL },
2448 { DTS_HD_CHUNK_NAVI_TBL, AU_CUS_DTS_Parser_dtsDecodeNAVITBL },
2449 { DTS_HD_CHUNK_BITSHVTB, NULL },
2450 { DTS_HD_CHUNK_STRMDATA, AU_CUS_DTS_Parser_dtsDecodeSTRMDATA },
2451 { DTS_HD_CHUNK_TIMECODE, AU_CUS_DTS_Parser_dtsDecodeTIMECODE },
2452 { DTS_HD_CHUNK_BUILDVER, AU_CUS_DTS_Parser_dtsDecodeBUILDVER }
2453 };
2454 #endif //#if(DTS_AUDIO_PARSER_ENABLE)
2455
2456 #endif
2457
2458 //-------------------------------------------------------------------------------------------------------------------------------------
2459 // [Share Area] shared [function] declare / implement in this area.
2460 //-------------------------------------------------------------------------------------------------------------------------------------
AU_CUS_ShmInit_All_variables(void)2461 void AU_CUS_ShmInit_All_variables(void)
2462 {
2463 //-------------------------------------------------------------------------------------------------------------------------------------
2464 /* Initialize, STR */
2465 //-------------------------------------------------------------------------------------------------------------------------------------
2466 //Audio init flag
2467 pstAudioCustomerShmData->g_audio_customer_Init_Done = FALSE;
2468 pstAudioCustomerShmData->g_audio_customer_STR_bSuspendStart = FALSE;
2469 pstAudioCustomerShmData->g_audio_customer_STR_bResumeFinish = TRUE;
2470 pstAudioCustomerShmData->g_audio_customer_scanf_bSupport = TRUE;
2471 pstAudioCustomerShmData->g_audio_customer_Chip_Platform = API_AUDIO_CUSTOMER_CHIP_PLATFORM_INVALID;
2472
2473 //Dynamic Enable all apiAUDIO_v2_customer debug msg
2474 pstAudioCustomerShmData->g_audio_customer_bEnableNonThreadPrintMsg = FALSE;
2475 pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg = FALSE;
2476 pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg_Interval = 500;
2477 pstAudioCustomerShmData->g_audio_customer_bThreadPrintMsg = FALSE;
2478 pstAudioCustomerShmData->g_audio_customer_bThreadPrintMsg_Interval = 1000;
2479 pstAudioCustomerShmData->g_audio_customer_bThreadPrintMsg_Line = 0;
2480
2481 //-------------------------------------------------------------------------------------------------------------------------------------
2482 /* Connect & Disconnect */
2483 //-------------------------------------------------------------------------------------------------------------------------------------
2484 //Parser connect
2485 pstAudioCustomerShmData->g_audio_customer_PARSER_Mode = API_AUDIO_CUSTOMER_PARSER_MODE_INVALID;
2486 pstAudioCustomerShmData->g_audio_customer_PARSER_A_Connect = API_AUDIO_CUSTOMER_PARSER_INPUT_INVALID;
2487 pstAudioCustomerShmData->g_audio_customer_PARSER_B_Connect = API_AUDIO_CUSTOMER_PARSER_INPUT_INVALID;
2488 pstAudioCustomerShmData->g_audio_customer_PARSER_C_Connect = API_AUDIO_CUSTOMER_PARSER_INPUT_INVALID;
2489 pstAudioCustomerShmData->g_audio_customer_PARSER_D_Connect = API_AUDIO_CUSTOMER_PARSER_INPUT_INVALID;
2490
2491 //ADEC connect / ID / Gain / Mute
2492 pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect = API_AUDIO_CUSTOMER_ADEC_INPUT_INVALID;
2493 pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect = API_AUDIO_CUSTOMER_ADEC_INPUT_INVALID;
2494 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Connect = API_AUDIO_CUSTOMER_ADEC_INPUT_INVALID;
2495 pstAudioCustomerShmData->g_audio_customer_ADEC0_DecID = AU_DEC_INVALID;
2496 pstAudioCustomerShmData->g_audio_customer_ADEC1_DecID = AU_DEC_INVALID;
2497 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_DecID = AU_DEC_INVALID;
2498 pstAudioCustomerShmData->g_audio_customer_ADEC0_Gain = 0;
2499 pstAudioCustomerShmData->g_audio_customer_ADEC1_Gain = 0;
2500 pstAudioCustomerShmData->g_audio_customer_ADEC0_bMute = FALSE;
2501 pstAudioCustomerShmData->g_audio_customer_ADEC1_bMute = FALSE;
2502
2503 //ADC connect
2504 pstAudioCustomerShmData->g_audio_customer_ADC0_Connect = API_AUDIO_CUSTOMER_ADC_IN_PORT_INVALID;
2505 pstAudioCustomerShmData->g_audio_customer_ADC1_Connect = API_AUDIO_CUSTOMER_ADC_IN_PORT_INVALID;
2506
2507 //PCM Mixer connect / ID / Gain / Mute
2508 memset(&pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_Connect, FALSE, sizeof(pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_Connect));
2509 memset(&pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_ID, API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_INVALID, sizeof(pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_ID));
2510 memset(&pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_Gain, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_Gain));
2511 memset(&pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_bMute, FALSE, sizeof(pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_bMute));
2512
2513 //Channel Sound Connect
2514 pstAudioCustomerShmData->g_audio_customer_CH5_Sound_Connect = API_AUDIO_CUSTOMER_CH_INPUT_INVALID;
2515 pstAudioCustomerShmData->g_audio_customer_CH6_Sound_Connect = API_AUDIO_CUSTOMER_CH_INPUT_INVALID;
2516 pstAudioCustomerShmData->g_audio_customer_CH7_Sound_Connect = API_AUDIO_CUSTOMER_CH_INPUT_INVALID;
2517 pstAudioCustomerShmData->g_audio_customer_CH8_Sound_Connect = API_AUDIO_CUSTOMER_CH_INPUT_INVALID;
2518 pstAudioCustomerShmData->g_audio_customer_CH5_Sound_inDelay = 0;
2519 pstAudioCustomerShmData->g_audio_customer_CH6_Sound_inDelay = 0;
2520 pstAudioCustomerShmData->g_audio_customer_CH7_Sound_inDelay = 0;
2521 pstAudioCustomerShmData->g_audio_customer_CH8_Sound_inDelay = 0;
2522
2523 //FW Mixer Connect / Gain / Mute / Delay
2524 memset(&pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Connect, FALSE, sizeof(pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Connect));
2525 memset(&pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Connect, FALSE, sizeof(pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Connect));
2526 memset(&pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Connect, FALSE, sizeof(pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Connect));
2527 memset(&pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_Gain, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_Gain));
2528 memset(&pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Channel_Gain, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Channel_Gain));
2529 memset(&pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Channel_Gain, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Channel_Gain));
2530 memset(&pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_bMute, FALSE, sizeof(pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_bMute));
2531 memset(&pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Channel_bMute, FALSE, sizeof(pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Channel_bMute));
2532 memset(&pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Channel_bMute, FALSE, sizeof(pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Channel_bMute));
2533 pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_Delay = 0;
2534 pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Channel_Delay = 0;
2535 pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Channel_Delay = 0;
2536
2537 //FW Mixer During Limit time mute
2538 pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH5] = FALSE;
2539 pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH6] = FALSE;
2540 pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] = FALSE;
2541 pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH5] = FALSE;
2542 pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH6] = FALSE;
2543 pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] = FALSE;
2544 pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH5] = FALSE;
2545 pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH6] = FALSE;
2546 pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] = FALSE;
2547
2548 //FW Mixer final mute
2549 pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_final_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH5] = FALSE;
2550 pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_final_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH6] = FALSE;
2551 pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_final_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] = FALSE;
2552 pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_final_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH5] = FALSE;
2553 pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_final_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH6] = FALSE;
2554 pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_final_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] = FALSE;
2555 pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_final_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH5] = FALSE;
2556 pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_final_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH6] = FALSE;
2557 pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_final_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] = FALSE;
2558
2559 //SE delay, SE(PreR2 / SeDSP / PostR2) connect
2560 pstAudioCustomerShmData->g_audio_customer_SE_UpperDelay = 32; //ms
2561 pstAudioCustomerShmData->g_audio_customer_SE_DriverDelay = 32; //ms
2562 pstAudioCustomerShmData->g_audio_customer_SE_PreR2_Connect = API_AUDIO_CUSTOMER_SE_INPUT_INVALID;
2563 pstAudioCustomerShmData->g_audio_customer_SE_DspSE_Connect = API_AUDIO_CUSTOMER_SE_INPUT_INVALID;
2564 pstAudioCustomerShmData->g_audio_customer_SE_PostR2_Connect = API_AUDIO_CUSTOMER_SE_INPUT_INVALID;
2565
2566 //SOUND OUT connect / Gain / Mute / SPDIF,HDMI(fg/Mode/PCM,NPCM mute/Delay)
2567 pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_Connect = API_AUDIO_CUSTOMER_SOUNDOUT_INPUT_INVALID;
2568 pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_Gain = 0;
2569 pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_bMute = FALSE;
2570 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_Connect = API_AUDIO_CUSTOMER_SOUNDOUT_INPUT_INVALID;
2571 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_Gain = 0;
2572 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_bMute = FALSE;
2573 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_Connect = API_AUDIO_CUSTOMER_SOUNDOUT_INPUT_INVALID;
2574 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_Gain = 0;
2575 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_bMute = FALSE;
2576 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_Connect = API_AUDIO_CUSTOMER_SOUNDOUT_INPUT_INVALID;
2577 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_Gain = 0;
2578 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_bMute = FALSE;
2579 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_Connect = API_AUDIO_CUSTOMER_SOUNDOUT_INPUT_INVALID;
2580 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_Gain = 0;
2581 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_bMute = FALSE;
2582 pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_Connect = API_AUDIO_CUSTOMER_SOUNDOUT_INPUT_INVALID;
2583 pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_Gain = 0;
2584 pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_bMute = FALSE;
2585 pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_UpperDelay = 0;
2586 pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_DriverDelay = 0;
2587 pstAudioCustomerShmData->g_audio_customer_Sound_Out_ARC_Connect = API_AUDIO_CUSTOMER_SOUNDOUT_INPUT_INVALID;
2588 pstAudioCustomerShmData->g_audio_customer_Sound_Out_ARC_mode = API_AUDIO_CUSTOMER_SPDIF_TX_MODE_INVALID;
2589 pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_Connect = API_AUDIO_CUSTOMER_SOUNDOUT_INPUT_INVALID;
2590 pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_Gain = 0;
2591 pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_bMute = FALSE;
2592 pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_UpperDelay = 0;
2593 pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_DriverDelay = 0;
2594
2595 //SetSourceInfo / InputSwitch
2596 pstAudioCustomerShmData->g_audio_customer_AU_SetSourceInfo_eSourceType = E_AUDIO_INFO_KTV_STB_IN;
2597 pstAudioCustomerShmData->g_audio_customer_AU_InputSwitch_enSource = AUDIO_NULL_INPUT;
2598 pstAudioCustomerShmData->g_audio_customer_AU_InputSwitch_enGroup = E_AUDIO_GROUP_INVALID;
2599
2600 //sound out During Limit time mute
2601 pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_LINEOUT0_OUTPUT] = FALSE;
2602 pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_LINEOUT1_OUTPUT] = FALSE;
2603 pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_LINEOUT2_OUTPUT] = FALSE;
2604 pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_LINEOUT3_OUTPUT] = FALSE;
2605 pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_SPDIF_OUTPUT] = FALSE;
2606 pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_I2S_OUTPUT] = FALSE;
2607 pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_HDMI_ARC_OUTPUT] = FALSE;
2608 pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_HDMI_OUTPUT] = FALSE;
2609
2610 //sound out final mute
2611 pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_final_bMute = FALSE;
2612 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_final_bMute = FALSE;
2613 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_final_bMute = FALSE;
2614 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_final_bMute = FALSE;
2615 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_final_bMute = FALSE;
2616 pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_final_bMute = FALSE;
2617 pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_final_bMute = FALSE;
2618
2619 //PCM Capture connect / bEnable / Gain / Mute / Delay
2620 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_Connect = API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_INVALID;
2621 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_bEnable = FALSE;
2622 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_Gain = 0;
2623 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_bMute = FALSE;
2624 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_Delay = 0;
2625 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE1_Connect = API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_INVALID;
2626 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE1_bEnable = FALSE;
2627 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE1_Gain = 0;
2628 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE1_bMute = FALSE;
2629 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE1_Delay = 0;
2630 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE2_Connect = API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_INVALID;
2631 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE2_bEnable = FALSE;
2632 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE2_Gain = 0;
2633 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE2_bMute = FALSE;
2634 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE2_Delay = 0;
2635
2636 //MP3 ENC connect / bEnable
2637 pstAudioCustomerShmData->g_audio_customer_MP3_ENC_Connect = API_AUDIO_CUSTOMER_MP3_ENC_INPUT_INVALID;
2638 pstAudioCustomerShmData->g_audio_customer_MP3_ENC_bEnable = FALSE;
2639
2640 //AAC ENC connect / bEnable
2641 pstAudioCustomerShmData->g_audio_customer_AAC_ENC_Connect = API_AUDIO_CUSTOMER_MP3_ENC_INPUT_INVALID;
2642 pstAudioCustomerShmData->g_audio_customer_AAC_ENC_bEnable = FALSE;
2643
2644 //AENC Gain
2645 pstAudioCustomerShmData->g_audio_customer_AENC_Gain = 0x00;
2646
2647 //-------------------------------------------------------------------------------------------------------------------------------------
2648 /* Start & Stop */
2649 //-------------------------------------------------------------------------------------------------------------------------------------
2650 pstAudioCustomerShmData->g_audio_customer_MainDecoderOutput = API_AUDIO_CUSTOMER_ADEC0;
2651
2652 //-------------------------------------------------------------------------------------------------------------------------------------
2653 /* SPDIF */
2654 //-------------------------------------------------------------------------------------------------------------------------------------
2655 pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_UpperOutputType = API_AUDIO_CUSTOMER_SPDIF_TX_PCM;
2656 pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_DriverOutputType = API_AUDIO_CUSTOMER_SPDIF_TX_PCM;
2657 pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_CopyInfo = API_AUDIO_CUSTOMER_SPDIF_COPYRIGHT_INVALID;
2658 pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_CategoryCode = 0;
2659 pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_LightOnOff = FALSE;
2660 pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_MonitorOnOff = TRUE;
2661 pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_ChannelStatus_Type = API_AUDIO_CUSTOMER_SPDIF_CS_CategoryCode;
2662 pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_ChannelStatus_Type_Status = API_AUDIO_CUSTOMER_SPDIF_CS_Category_General;
2663
2664 //-------------------------------------------------------------------------------------------------------------------------------------
2665 /* HDMI */
2666 //-------------------------------------------------------------------------------------------------------------------------------------
2667 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type = API_AUDIO_CUSTOMER_CODEC_TYPE_INVALID;
2668 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Previous_Codec_Type = API_AUDIO_CUSTOMER_CODEC_TYPE_INVALID;
2669 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_AudioReturnChannel = FALSE;
2670 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_CopyInfo = API_AUDIO_CUSTOMER_SPDIF_COPYRIGHT_INVALID;
2671 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_MonitorOnOff = FALSE;
2672 pstAudioCustomerShmData->g_audio_customer_HDMI_TX_UpperOutputType = API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_PCM;
2673 pstAudioCustomerShmData->g_audio_customer_HDMI_TX_DriverOutputType = API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_PCM;
2674 pstAudioCustomerShmData->g_audio_customer_HDMI_TX_MonitorOnOff = TRUE;
2675
2676 //-------------------------------------------------------------------------------------------------------------------------------------
2677 /* ATV */
2678 //-------------------------------------------------------------------------------------------------------------------------------------
2679 //ATV_Prescale(A2)
2680 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Prescale_A2_FM = 0;
2681 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Prescale_NICAM = 0;
2682 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Prescale_AM = 0;
2683 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Prescale_HIDEV = 0;
2684 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Prescale_FM_M = 0;
2685 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Prescale_HIDEV_M = 0;
2686
2687 //ATV_Prescale(BTSC)
2688 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Prescale_BTSC = 0;
2689 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Prescale_BTSC_MONO = 0;
2690 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Prescale_BTSC_STEREO = 0;
2691 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Prescale_BTSC_SAP = 0;
2692
2693 //Monitor
2694 pstAudioCustomerShmData->g_audio_customer_SIF_MonitorOnOff = FALSE;
2695
2696 //-------------------------------------------------------------------------------------------------------------------------------------
2697 /* Decoder */
2698 //-------------------------------------------------------------------------------------------------------------------------------------
2699 //Codec Type (Upper layer)
2700 pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperCodec = API_AUDIO_CUSTOMER_CODEC_TYPE_INVALID;
2701 pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperCodec = API_AUDIO_CUSTOMER_CODEC_TYPE_INVALID;
2702 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_UpperSifType = API_AUDIO_CUSTOMER_CODEC_TYPE_INVALID;
2703
2704 //Codec Type (Driver layer)
2705 pstAudioCustomerShmData->g_audio_customer_ADEC0_DriverCodec = MSAPI_AUD_DVB_INVALID;
2706 pstAudioCustomerShmData->g_audio_customer_ADEC1_DriverCodec = MSAPI_AUD_DVB_INVALID;
2707 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_DriverSifType = MSAPI_AUD_DVB_INVALID;
2708
2709 //Play Cmd (Upper layer)
2710 pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperPlay = API_AUDIO_CUSTOMER_UPPER_PLAYCMD_INVALID;
2711 pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperPlay = API_AUDIO_CUSTOMER_UPPER_PLAYCMD_INVALID;
2712 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_UpperPlay = API_AUDIO_CUSTOMER_UPPER_PLAYCMD_INVALID;
2713
2714 //Play Cmd (Driver layer)
2715 pstAudioCustomerShmData->g_audio_customer_ADEC0_DriverPlay = AU_DVB_DECCMD_STOP;
2716 pstAudioCustomerShmData->g_audio_customer_ADEC1_DriverPlay = AU_DVB_DECCMD_STOP;
2717 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_DriverPlay = AU_DVB_DECCMD_STOP;
2718
2719 //---Play/pause Cmd Delay---
2720 pstAudioCustomerShmData->g_audio_customer_AU_CUS_SetPlayCmdByAdecSource_Delay = 10;
2721 pstAudioCustomerShmData->g_audio_customer_AU_CUS_PauseDecoding_Delay = 10;
2722
2723 //bMM mode (ADEC is used by MM)
2724 pstAudioCustomerShmData->g_audio_customer_ADEC0_bMM = FALSE;
2725 pstAudioCustomerShmData->g_audio_customer_ADEC1_bMM = FALSE;
2726
2727 //Sync mode
2728 pstAudioCustomerShmData->g_audio_customer_ADEC0_SyncMode = FALSE;
2729 pstAudioCustomerShmData->g_audio_customer_ADEC1_SyncMode = FALSE;
2730
2731 //DRC mode
2732 pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DolbyDRCMode = API_AUDIO_CUSTOMER_DOLBY_DRC_MODE_INVALID;
2733 pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3P_DolbyDRCMode = API_AUDIO_CUSTOMER_DOLBY_DRC_MODE_INVALID;
2734
2735 //Downmix mode
2736 pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DownmixMode = API_AUDIO_CUSTOMER_DOWNMIX_MODE_INVALID;
2737 pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3P_DownmixMode = API_AUDIO_CUSTOMER_DOWNMIX_MODE_INVALID;
2738
2739 //DualMono mode
2740 pstAudioCustomerShmData->g_audio_customer_ADEC0_DualmonoMode = API_AUDIO_CUSTOMER_DUALMONO_MODE_INVALID;
2741 pstAudioCustomerShmData->g_audio_customer_ADEC1_DualmonoMode = API_AUDIO_CUSTOMER_DUALMONO_MODE_INVALID;
2742
2743 //Trick mode
2744 pstAudioCustomerShmData->g_audio_customer_ADEC0_TrickMode = API_AUDIO_CUSTOMER_TRICK_MODE_INVALID;
2745 pstAudioCustomerShmData->g_audio_customer_ADEC1_TrickMode = API_AUDIO_CUSTOMER_TRICK_MODE_INVALID;
2746
2747 //AD bMain
2748 pstAudioCustomerShmData->g_audio_customer_ADEC0_AD_bMain = FALSE;
2749 pstAudioCustomerShmData->g_audio_customer_ADEC1_AD_bMain = FALSE;
2750
2751 //AD Gain
2752 pstAudioCustomerShmData->g_audio_customer_ADEC0_AD_Gain = 0;
2753 pstAudioCustomerShmData->g_audio_customer_ADEC1_AD_Gain = 0;
2754
2755 //ES Exist
2756 pstAudioCustomerShmData->g_audio_customer_ADEC0_bESExist = FALSE;
2757 pstAudioCustomerShmData->g_audio_customer_ADEC1_bESExist = FALSE;
2758
2759 //ES_Info
2760 memset(&pstAudioCustomerShmData->g_audio_customer_ADEC0_HEAAC_EsInfo, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_ADEC0_HEAAC_EsInfo));
2761 memset(&pstAudioCustomerShmData->g_audio_customer_ADEC0_MPEG_EsInfo, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_ADEC0_MPEG_EsInfo));
2762 memset(&pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3_EsInfo, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3_EsInfo));
2763 memset(&pstAudioCustomerShmData->g_audio_customer_ADEC1_HEAAC_EsInfo, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_ADEC1_HEAAC_EsInfo));
2764 memset(&pstAudioCustomerShmData->g_audio_customer_ADEC1_MPEG_EsInfo, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_ADEC1_MPEG_EsInfo));
2765 memset(&pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3_EsInfo, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3_EsInfo));
2766
2767 //ADEC PCM output path
2768 pstAudioCustomerShmData->g_audio_customer_ADEC0_PCM_OutputPath = API_AUDIO_CUSTOMER_ADEC_PCM_PATH_DSP_SRC;
2769 pstAudioCustomerShmData->g_audio_customer_ADEC1_PCM_OutputPath = API_AUDIO_CUSTOMER_ADEC_PCM_PATH_DSP_SRC;
2770
2771 //dump adec pcm (MCU path)
2772 pstAudioCustomerShmData->g_audio_customer_bEnableAdecPcmDump = FALSE;
2773
2774 //ADEC End of stream
2775 pstAudioCustomerShmData->g_audio_customer_ADEC0_End_Of_Stream_bRegister = FALSE;
2776 pstAudioCustomerShmData->g_audio_customer_ADEC1_End_Of_Stream_bRegister = FALSE;
2777 pstAudioCustomerShmData->g_audio_customer_ADEC_End_Of_Stream_TimeOutCnt = 10;
2778
2779 //ADEC Underrun
2780 pstAudioCustomerShmData->g_audio_customer_ADEC0_Underrun_bRegister = FALSE;
2781 pstAudioCustomerShmData->g_audio_customer_ADEC0_Underrun_Threshold_in_ms = 0;
2782 pstAudioCustomerShmData->g_audio_customer_ADEC0_Underrun_Debounce_Cnt = 10;
2783 pstAudioCustomerShmData->g_audio_customer_ADEC1_Underrun_bRegister = FALSE;
2784 pstAudioCustomerShmData->g_audio_customer_ADEC1_Underrun_Threshold_in_ms = 0;
2785 pstAudioCustomerShmData->g_audio_customer_ADEC1_Underrun_Debounce_Cnt = 10;
2786
2787 //Monitor
2788 pstAudioCustomerShmData->g_audio_customer_Auto_Recovery_MonitorOnOff = TRUE;
2789
2790 //-------------------------------------------------------------------------------------------------------------------------------------
2791 /* Common */
2792 //-------------------------------------------------------------------------------------------------------------------------------------
2793 #if (UTPA_SUPPORT_XPCM_PARAM_CHANNEL_MASK)
2794 pstAudioCustomerShmData->g_audio_customer_ADEC_Param_XPCM_ChannelMask_debug_Cmd = 0;
2795 #endif //#if (UTPA_SUPPORT_XPCM_PARAM_CHANNEL_MASK)
2796
2797 //-------------------------------------------------------------------------------------------------------------------------------------
2798 /* Customized patch */
2799 //-------------------------------------------------------------------------------------------------------------------------------------
2800 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_BYPASS)
2801 pstAudioCustomerShmData->g_audio_customer_patch_HDMI_RX_ByPass_bEnable = FALSE;
2802 #endif
2803
2804 #if(CUSTOMIZED_PATCH_PARAM_LOW_LATENCY)
2805 pstAudioCustomerShmData->g_audio_customer_patch_Low_Latency_Limiter_bEnable = FALSE;
2806 pstAudioCustomerShmData->g_audio_customer_patch_Low_Latency_Limiter_ES_Threshold = 0;
2807 pstAudioCustomerShmData->g_audio_customer_patch_Low_Latency_Limiter_PCM_Threshold = 0;
2808 #endif //#if(CUSTOMIZED_PATCH_PARAM_LOW_LATENCY)
2809
2810 #if(CUSTOMIZED_PATCH_PARAM_MCU_DUMP_R2_LOG)
2811 pstAudioCustomerShmData->g_audio_customer_patch_MCU_Dump_R2_Log_Moitor_bEnable = FALSE;
2812 pstAudioCustomerShmData->g_audio_customer_patch_MCU_Dump_R2_Log_Option = 0;
2813 pstAudioCustomerShmData->g_audio_customer_patch_MCU_Dump_R2_Log_Orignal_REG_BANK_R2_LOG_DBG = 0;
2814 #endif //#if(CUSTOMIZED_PATCH_PARAM_MCU_DUMP_R2_LOG)
2815
2816 #if(CUSTOMIZED_PATCH_PARAM_SEDSP_MS12_ENC_WO_MAIN_SND)
2817 pstAudioCustomerShmData->g_audio_customer_patch_HDMI_TX_SEDSP_DDE_WO_MAIN_SND_bEnable = FALSE;
2818 pstAudioCustomerShmData->g_audio_customer_patch_HDMI_TX_SEDSP_DDPE_WO_MAIN_SND_bEnable = FALSE;
2819 pstAudioCustomerShmData->g_audio_customer_patch_SPDIF_TX_SEDSP_DDE_WO_MAIN_SND_bEnable = FALSE;
2820 #endif //#if(CUSTOMIZED_PATCH_PARAM_SEDSP_MS12_ENC_WO_MAIN_SND)
2821
2822 #if(CUSTOMIZED_PATCH_PARAM_SNDR2_MS12_ENC_WO_MAIN_SND)
2823 pstAudioCustomerShmData->g_audio_customer_patch_HDMI_ARC_SEDSP_DDE_WO_MAIN_SND_bEnable = FALSE;
2824 pstAudioCustomerShmData->g_audio_customer_patch_HDMI_ARC_SNDR2_DDPE_WO_MAIN_SND_bEnable = FALSE;
2825 #endif //#if(CUSTOMIZED_PATCH_PARAM_SNDR2_MS12_ENC_WO_MAIN_SND)
2826
2827 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_SWITCH_TO_PCM_DEBOUNCE)
2828 pstAudioCustomerShmData->g_audio_customer_patch_HDMI_RX_switch_to_pcm_debounce_in_ms = 0;
2829 #endif //#if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_SWITCH_TO_PCM_DEBOUNCE)
2830
2831 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK)
2832 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_IsHDMI = API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO_INVALID;
2833 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Previous_IsHDMI = API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO_INVALID;
2834 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_IsPCM = API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO_INVALID;
2835 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Previous_IsPCM = API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO_INVALID;
2836 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_CodecType = API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO_INVALID;
2837 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Previous_CodecType = API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO_INVALID;
2838 #endif //#if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK)
2839
2840 //-------------------------------------------------------------------------------------------------------------------------------------
2841 /* Customized Internal patch */
2842 //-------------------------------------------------------------------------------------------------------------------------------------
2843 //---MS12 HDMI TX PCM ouput Auto Delay (for sync with NPCM)---
2844 //input: MS12 DD/DDP/DP
2845 pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_DD_in_Auto_Audio_Delay = CUSTOMIZED_INTERNAL_PATCH_MS12_HDMI_TX_PCM_DD_IN_AUTO_AUDIO_DELAY;
2846 pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_DDP_in_Auto_Audio_Delay = CUSTOMIZED_INTERNAL_PATCH_MS12_HDMI_TX_PCM_DDP_IN_AUTO_AUDIO_DELAY;
2847 pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_DP_in_Auto_Audio_Delay = CUSTOMIZED_INTERNAL_PATCH_MS12_HDMI_TX_PCM_DP_IN_AUTO_AUDIO_DELAY;
2848 pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_Final_Auto_Audio_Delay = 0;
2849
2850 //---General Buffer Dump---
2851 pstAudioCustomerShmData->g_audio_customer_internal_patch_General_Buffer_Dump_bEnable = FALSE;
2852 pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_MM_ES1_bEnable = FALSE;
2853 pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_PCM1_bEnable = FALSE;
2854 pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_HDMINPCM_bEnable = FALSE;
2855 pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_MS12_METADATA_bEnable = FALSE;
2856 pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_HDMI_ES1_bEnable = FALSE;
2857
2858 //---MS12 SNDR2 PCMR METADATA SELECT---
2859 pstAudioCustomerShmData->g_audio_customer_internal_patch_SndR2_MS12_Pcmr_Metadata_Select = API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT_INVALID;
2860
2861 //---HW SRC Output Gain Compensate---
2862 pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_I2S_Out = CUSTOMIZED_INTERNAL_PATCH_HW_SRC_GAIN_COMPENSATE_I2S_OUT;
2863 pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_0_Out = CUSTOMIZED_INTERNAL_PATCH_HW_SRC_GAIN_COMPENSATE_LINE_0_OUT;
2864 pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_1_Out = CUSTOMIZED_INTERNAL_PATCH_HW_SRC_GAIN_COMPENSATE_LINE_1_OUT;
2865 pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_2_Out = CUSTOMIZED_INTERNAL_PATCH_HW_SRC_GAIN_COMPENSATE_LINE_2_OUT;
2866 pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_3_Out = CUSTOMIZED_INTERNAL_PATCH_HW_SRC_GAIN_COMPENSATE_LINE_3_OUT;
2867 pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_SPDIF_Out = CUSTOMIZED_INTERNAL_PATCH_HW_SRC_GAIN_COMPENSATE_SPDIF_OUT;
2868 pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_HDMI_Out = CUSTOMIZED_INTERNAL_PATCH_HW_SRC_GAIN_COMPENSATE_HDMI_OUT;
2869
2870 //---DDP_71 Auto Bypass check---
2871 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_adecIndex = API_AUDIO_CUSTOMER_ADEC_INDEX_INVALID;
2872 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_Monitor_bEnable = FALSE;
2873 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_Debounce_Cnt = 1000;
2874 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_okFrmCnt = 0;
2875 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_bDDP_71_Stream = FALSE;
2876
2877 //---Avoid ADEC Pop Noise---
2878 pstAudioCustomerShmData->g_audio_customer_internal_patch_Avoid_ADEC_Stop_Pop_Noise_mute_limited_time = 10;
2879 pstAudioCustomerShmData->g_audio_customer_internal_patch_Avoid_ADEC_Pause_Pop_Noise_mute_limited_time = 10;
2880
2881 //---ADEC mute delay---
2882 pstAudioCustomerShmData->g_audio_customer_AU_CUS_ADEC_SetMute_Delay = 10; //ms
2883
2884 //-------------------------------------------------------------------------------------------------------------------------------------
2885 /* Clip Play for ES */
2886 //-------------------------------------------------------------------------------------------------------------------------------------
2887
2888 //-------------------------------------------------------------------------------------------------------------------------------------
2889 /* Clip Play for PCM */
2890 //-------------------------------------------------------------------------------------------------------------------------------------
2891
2892 //-------------------------------------------------------------------------------------------------------------------------------------
2893 /* Gain, Mute & Delay */
2894 //-------------------------------------------------------------------------------------------------------------------------------------
2895
2896 //-------------------------------------------------------------------------------------------------------------------------------------
2897 /* AENC */
2898 //-------------------------------------------------------------------------------------------------------------------------------------
2899 //Dynamic dump file for debug
2900 pstAudioCustomerShmData->g_audio_customer_AENC_bDumpEncData = FALSE;
2901
2902 //AENC Enable
2903 pstAudioCustomerShmData->g_audio_customer_AENC0_bEnable = FALSE;
2904 pstAudioCustomerShmData->g_audio_customer_AENC1_bEnable = FALSE;
2905
2906 //AENC Type
2907 pstAudioCustomerShmData->g_audio_customer_AENC0_Type = API_AUDIO_CUSTOMER_AENC_ENCODE_MP3;
2908 pstAudioCustomerShmData->g_audio_customer_AENC1_Type = API_AUDIO_CUSTOMER_AENC_ENCODE_MP3;
2909
2910 //-------------------------------------------------------------------------------------------------------------------------------------
2911 /* PCM Capture */
2912 //-------------------------------------------------------------------------------------------------------------------------------------
2913 //PCM capture Dump to file for debug
2914 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE_Source_Dump_to_file_bEnable = FALSE;
2915
2916 //PCM capture request data in byte
2917 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE_Request_data_in_byte = 50*48*2*2; /* 50ms in 48KHz, 16bits, stereo PCM */
2918
2919 //-------------------------------------------------------------------------------------------------------------------------------------
2920 /* PCM IO Control */
2921 //-------------------------------------------------------------------------------------------------------------------------------------
2922
2923 //-------------------------------------------------------------------------------------------------------------------------------------
2924 /* MM New Mode */
2925 //-------------------------------------------------------------------------------------------------------------------------------------
2926
2927 //-------------------------------------------------------------------------------------------------------------------------------------
2928 /* Mstar Sound Effect */
2929 //-------------------------------------------------------------------------------------------------------------------------------------
2930 //API_AUDIO_CUSTOMER_MSTAR_SE_Enable
2931 memset(&pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_Enable, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_Enable));
2932 memset(&pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_Enable_UpperSetCnt, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_Enable_UpperSetCnt));
2933
2934 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_GEQ
2935 memset(&pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_GEQ, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_GEQ));
2936 memset(&pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_GEQ_UpperSetCnt, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_GEQ_UpperSetCnt));
2937
2938 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_PEQCoef
2939 memset(&pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef));
2940 memset(&pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt));
2941
2942 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_HPFCoef
2943 memset(&pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_HPFCoef, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_HPFCoef));
2944 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_HPFCoef_UpperSetCnt = 0;
2945
2946 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_MODE
2947 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_MODE = API_AUDIO_CUSTOMER_AVC_LINEAR;
2948 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_MODE_UpperSetCnt = 0;
2949
2950 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_LEVEL
2951 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_LEVEL = 0;
2952 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_LEVEL_UpperSetCnt = 0;
2953
2954 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_Begin
2955 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_R_MODE_Begin = 0;
2956 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_R_MODE_Begin_UpperSetCnt = 0;
2957
2958 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_End
2959 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_R_MODE_End = 0;
2960 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_R_MODE_End_UpperSetCnt = 0;
2961
2962 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_Slope
2963 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_R_MODE_Slope = 0;
2964 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_R_MODE_Slope_UpperSetCnt = 0;
2965
2966 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_S_MODE_OFFSET
2967 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_S_MODE_OFFSET = 0;
2968 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_S_MODE_OFFSET_UpperSetCnt = 0;
2969
2970 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_AttackTime
2971 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_AttackTime = 0;
2972 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_AttackTime_UpperSetCnt = 0;
2973
2974 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_ReleaseTime
2975 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_ReleaseTime = 0;
2976 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_ReleaseTime_UpperSetCnt = 0;
2977
2978 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_DRC_LEVEL
2979 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_DRC_LEVEL = 0;
2980 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_DRC_LEVEL_UpperSetCnt = 0;
2981
2982 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_BALANCE
2983 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_BALANCE_L = 0;
2984 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_BALANCE_R = 0;
2985 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_BALANCE_UpperSetCnt = 0;
2986
2987 //API_AUDIO_CUSTOMER_MSTAR_SE_SET_NR_Threshold
2988 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_NR_Threshold = 0;
2989 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_NR_Threshold_UpperSetCnt = 0;
2990
2991 //API_AUDIO_CUSTOMER_MSTAR_SE_GET_NR_Status
2992 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_GET_NR_Threshold = 0;
2993
2994 //-------------------------------------------------------------------------------------------------------------------------------------
2995 /* Advanced Sound Effect */
2996 //-------------------------------------------------------------------------------------------------------------------------------------
2997 //API_AUDIO_CUSTOMER_DTS_SE_Enable
2998 memset(&pstAudioCustomerShmData->g_audio_customer_DTS_SE_Enable, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_DTS_SE_Enable));
2999 memset(&pstAudioCustomerShmData->g_audio_customer_DTS_SE_Enable_UpperSetCnt, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_DTS_SE_Enable_UpperSetCnt));
3000
3001 //API_AUDIO_CUSTOMER_DTS_SE_ProcessUnit_Enable
3002 memset(&pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable));
3003 memset(&pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt));
3004
3005 //API_AUDIO_CUSTOMER_DTS_SE_SetParam
3006 memset(&pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam));
3007 memset(&pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt));
3008
3009 //API_AUDIO_CUSTOMER_Dolby_DAP_Enable
3010 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_Enable = FALSE;
3011 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_Enable_UpperSetCnt = 0;
3012
3013 //API_AUDIO_CUSTOMER_Dolby_DAP_ProcessUnit_Enable
3014 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_ProcessUnit_Enable = FALSE;
3015 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_ProcessUnit_Enable_UpperSetCnt = 0;
3016
3017 //API_AUDIO_CUSTOMER_Dolby_DAP_SetParam
3018 memset(&pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam));
3019 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam_UpperSetCnt = 0;
3020
3021 //-------------------------------------------------------------------------------------------------------------------------------------
3022 /* Thread monitor Enable */
3023 //-------------------------------------------------------------------------------------------------------------------------------------
3024 pstAudioCustomerShmData->g_audio_customer_AU_CUS_ClipDecoderMonitor_bEnable = TRUE;
3025 pstAudioCustomerShmData->g_audio_customer_AU_CUS_MP3EncodeMonitor_bEnable = TRUE;
3026 pstAudioCustomerShmData->g_audio_customer_AU_CUS_MonitorService_bEnable = TRUE;
3027 pstAudioCustomerShmData->g_audio_customer_AU_CUS_AACEncodeMonitor_bEnable = TRUE;
3028 pstAudioCustomerShmData->g_audio_customer_AU_CUS_MuteDuringLimitedTime_Monitor_bEnable = TRUE;
3029 pstAudioCustomerShmData->g_audio_customer_AU_CUS_AdecPcmOutMonitor_bEnable = TRUE;
3030 pstAudioCustomerShmData->g_audio_customer_AU_CUS_PCMCaptureMonitor_bEnable = TRUE;
3031 pstAudioCustomerShmData->g_audio_customer_AU_CUS_EndOfStreamMonitor_bEnable = TRUE;
3032 pstAudioCustomerShmData->g_audio_customer_AU_CUS_ADEC_Underrun_Monitor_bEnable = TRUE;
3033 pstAudioCustomerShmData->g_audio_customer_AU_CUS_PATCH_Dump_R2_Log_Monitor_bEnable = TRUE;
3034 pstAudioCustomerShmData->g_audio_customer_AU_CUS_INTERNAL_PATCH_Auto_Audio_Delay_Monitor_bEnable = TRUE;
3035 pstAudioCustomerShmData->g_audio_customer_AU_CUS_INTERNAL_PATCH_General_Dump_Buffer_Monitor_bEnable = TRUE;
3036 pstAudioCustomerShmData->g_audio_customer_AU_CUS_INTERNAL_PATCH_DDP_71_Auto_Bypass_Monitor_bEnable = TRUE;
3037 pstAudioCustomerShmData->g_audio_customer_AU_CUS_INTERNAL_PATCH_R2_Active_Monitor_bEnable = TRUE;
3038 pstAudioCustomerShmData->g_audio_customer_AU_CUS_Demo_MM_New_Mode_AD_Play_Monitor_bEnable = TRUE;
3039 pstAudioCustomerShmData->g_audio_customer_AU_CUS_Demo_MM_New_Mode_Play_Monitor_bEnable = TRUE;
3040 pstAudioCustomerShmData->g_audio_customer_AU_CUS_Demo_PCMIO_Play_Monitor_bEnable = TRUE;
3041 pstAudioCustomerShmData->g_audio_customer_AU_CUS_AV_Sync_Info_Monitor_bEnable = TRUE;
3042 pstAudioCustomerShmData->g_audio_customer_AU_CUS_ThreadPrintMsg_Monitor_bEnable = TRUE;
3043
3044 //-------------------------------------------------------------------------------------------------------------------------------------
3045 /* Thread monitor interval */
3046 //-------------------------------------------------------------------------------------------------------------------------------------
3047 pstAudioCustomerShmData->g_audio_customer_AU_ClipDecoderMonitor_Interval = 10; //ms
3048 pstAudioCustomerShmData->g_audio_customer_AU_MP3EncodeMonitor_Interval = 5; //ms
3049 pstAudioCustomerShmData->g_audio_customer_AU_MonitorService_Interval = 30; //ms
3050 pstAudioCustomerShmData->g_audio_customer_AU_AACEncodeMonitor_Interval = 5; //ms
3051 pstAudioCustomerShmData->g_audio_customer_AU_MuteDuringLimitedTime_Monitor_Interval = 50; //ms
3052 pstAudioCustomerShmData->g_audio_customer_AU_AdecPcmOut_Interval = 50; //ms
3053 pstAudioCustomerShmData->g_audio_customer_AU_PCMCapture_Interval = 20; //ms
3054 pstAudioCustomerShmData->g_audio_customer_AU_EndOfStreamMonitor_Interval = 10; //ms
3055 pstAudioCustomerShmData->g_audio_customer_AU_AdecUnderrun_Interval = 10; //ms
3056 pstAudioCustomerShmData->g_audio_customer_patch_Dump_R2_Log_Monitor_Interval = 40; //ms
3057 pstAudioCustomerShmData->g_audio_customer_internal_patch_Auto_Audio_Delay_Monitor_Interval = 20; //ms
3058 pstAudioCustomerShmData->g_audio_customer_internal_patch_General_Buffer_Dump_Monitor_Interval = 20; //ms
3059 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_Monitor_Interval = 10; //ms
3060 pstAudioCustomerShmData->g_audio_customer_internal_patch_R2_Active_Monitor_Interval = 30; //ms
3061
3062 //-------------------------------------------------------------------------------------------------------------------------------------
3063 /* AU Demo PCMIO play */
3064 //-------------------------------------------------------------------------------------------------------------------------------------
3065 memset((void *)&pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_pcmParam, 0x00, sizeof(API_AUDIO_CUSTOMER_PCMIO_PARAM));
3066 pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_UpperPlay = API_AUDIO_CUSTOMER_UPPER_PLAYCMD_INVALID;
3067 pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_repeatNum = 1;
3068 pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_Monitor_Interval = 1000;
3069 pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_input_file_length = 0;
3070
3071 //-------------------------------------------------------------------------------------------------------------------------------------
3072 /* AU Demo MM New Mode */
3073 //-------------------------------------------------------------------------------------------------------------------------------------
3074 pstAudioCustomerShmData->g_audio_customer_AU_Demo_MM_New_Mode_Play_StartTime = 0;
3075 pstAudioCustomerShmData->g_audio_customer_AU_Demo_MM_New_Mode_AD_Play_StartTime = 0;
3076 pstAudioCustomerShmData->g_audio_customer_AU_Demo_MM_New_Mode_Play_Monitor_Interval = 10;
3077
3078 //-------------------------------------------------------------------------------------------------------------------------------------
3079 /* AV Sync Info */
3080 //-------------------------------------------------------------------------------------------------------------------------------------
3081 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_adecIndex = API_AUDIO_CUSTOMER_ADEC_INDEX_INVALID;
3082 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_bEnable = FALSE;
3083 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_Monitor_Interval = 10;
3084 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_PCMlevel = 0;
3085 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_PCMlevel_in_ms = 0;
3086 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_Upper_es_size = 0;
3087 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_Upper_ptsExist = FALSE;
3088 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_Upper_pts = 0;
3089 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_R2_pts = 0;
3090 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_DMX_stc = 0;
3091 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_inputAesFinished_cnt = 0;
3092 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_inputAesFinished_ret = FALSE;
3093 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_pts_offset = 0;
3094 memset(&pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_aes_info, 0, sizeof(pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_aes_info));
3095 }
3096
AU_CUS_SetDspInternalPath(API_AUDIO_CUSTOMER_SOUNDOUT_INDEX currentConnect,API_AUDIO_CUSTOMER_SOUNDOUT_INPUT inputConnect)3097 static MS_BOOL AU_CUS_SetDspInternalPath(API_AUDIO_CUSTOMER_SOUNDOUT_INDEX currentConnect, API_AUDIO_CUSTOMER_SOUNDOUT_INPUT inputConnect)
3098 {
3099 MS_U16 path = 4;
3100 MS_U32 reg = 0;
3101 MS_U16 mask = 0;
3102
3103 switch(inputConnect)
3104 {
3105 case API_AUDIO_CUSTOMER_SOUNDOUT_INPUT_FWM0:
3106 path = 4;
3107 break;
3108
3109 case API_AUDIO_CUSTOMER_SOUNDOUT_INPUT_DLY0:
3110 path = 5;
3111 break;
3112
3113 case API_AUDIO_CUSTOMER_SOUNDOUT_INPUT_AUDIO_DELAY:
3114 path = 5;
3115 break;
3116
3117 case API_AUDIO_CUSTOMER_SOUNDOUT_INPUT_DSPSE:
3118 path = 6;
3119 break;
3120
3121 case API_AUDIO_CUSTOMER_SOUNDOUT_INPUT_CH7:
3122 path = 7;
3123 break;
3124
3125 case API_AUDIO_CUSTOMER_SOUNDOUT_INPUT_NULL:
3126 path = 0;
3127 break;
3128
3129 default:
3130 path = 4;
3131 break;
3132 }
3133
3134 switch(currentConnect)
3135 {
3136 case API_AUDIO_CUSTOMER_SOUNDOUT_I2S:
3137 reg = REG_BANK_SNDOUT_INPUT_PATH_SEL2;
3138 mask = 0x000F;
3139 break;
3140
3141 case API_AUDIO_CUSTOMER_SOUNDOUT_LINEOUT0:
3142 reg = REG_BANK_SNDOUT_INPUT_PATH_SEL1;
3143 mask = 0x000F;
3144 break;
3145
3146 case API_AUDIO_CUSTOMER_SOUNDOUT_LINEOUT1:
3147 reg = REG_BANK_SNDOUT_INPUT_PATH_SEL1;
3148 path = path<<4;
3149 mask = 0x00F0;
3150 break;
3151
3152 case API_AUDIO_CUSTOMER_SOUNDOUT_LINEOUT2:
3153 reg = REG_BANK_SNDOUT_INPUT_PATH_SEL1;
3154 path = path<<8;
3155 mask = 0x0F00;
3156 break;
3157
3158 case API_AUDIO_CUSTOMER_SOUNDOUT_LINEOUT3:
3159 reg = REG_BANK_SNDOUT_INPUT_PATH_SEL1;
3160 path = path<<12;
3161 mask = 0xF000;
3162 break;
3163
3164 case API_AUDIO_CUSTOMER_SOUNDOUT_SPDIF:
3165 reg = REG_BANK_SNDOUT_INPUT_PATH_SEL3;
3166 path = path<<8;
3167 mask = 0x0F00;
3168 break;
3169
3170 case API_AUDIO_CUSTOMER_SOUNDOUT_HDMI_ARC:
3171 reg = REG_BANK_SNDOUT_INPUT_PATH_SEL3;
3172 path = path<<4;
3173 mask = 0x00F0;
3174 break;
3175
3176 case API_AUDIO_CUSTOMER_SOUNDOUT_HDMI_TX:
3177 reg = REG_BANK_SNDOUT_INPUT_PATH_SEL3;
3178 mask = 0x000F;
3179 break;
3180
3181 default:
3182 break;
3183 }
3184
3185 if(reg > 0)
3186 {
3187 AU_CUS_WriteAbsMaskReg(reg, mask, path);
3188 return TRUE;
3189 }
3190 else
3191 {
3192 return FALSE;
3193 }
3194 }
3195
AU_CUS_Initial_Register_Bank_By_ChipType(void)3196 static void AU_CUS_Initial_Register_Bank_By_ChipType(void)
3197 {
3198 #if 0
3199 MS_U32 adecR2reg = 0x1603B2;
3200 MS_U32 asndR2reg = 0x112EB2;
3201 MS_U32 adecDspreg = 0x112DB8;
3202 MS_U32 asndDspreg = 0x112DF8;
3203
3204 if(AU_CUS_ReadAbsReg(adecR2reg) != 0 && AU_CUS_ReadAbsReg(asndR2reg) != 0)
3205 {
3206 //---2R1D---
3207 }
3208 else if(AU_CUS_ReadAbsReg(asndR2reg) != 0 && AU_CUS_ReadAbsReg(asndDspreg) != 0)
3209 {
3210 //---1R1D---
3211 }
3212 else if(AU_CUS_ReadAbsReg(asndR2reg) != 0 && AU_CUS_ReadAbsReg(adecDspreg) != 0 && AU_CUS_ReadAbsReg(asndDspreg) != 0)
3213 {
3214 //---2D1R---
3215 }
3216 else if(AU_CUS_ReadAbsReg(adecDspreg) != 0 && AU_CUS_ReadAbsReg(asndDspreg) != 0)
3217 {
3218 //---2D---
3219 }
3220 else if(AU_CUS_ReadAbsReg(asndDspreg) != 0)
3221 {
3222 //---1D---
3223 }
3224 else
3225 {
3226 //---UNKNOWN (Default is 1D)---
3227 }
3228 return;
3229 #endif
3230
3231 if(UTPA_AUDIO_CHIP_TYPE_2R1D)
3232 {
3233 //---2R1D---
3234 AUDIO_CHIP_TYPE = API_AUDIO_CUSTOMER_CHIP_TYPE_2R1D;
3235 REG_BANK_ADEC1_PLAY = 0x160398;
3236 REG_BANK_ADEC1_CODEC = 0x160398;
3237 REG_BANK_ADEC2_PLAY = 0x16039A;
3238 REG_BANK_ADEC2_CODEC = 0x16039A;
3239 REG_BANK_R2_UART = 0x101EA6;
3240 REG_BANK_R2_DEC_UART_ENABLE = 0x0;
3241 REG_BANK_R2_SND_UART_ENABLE = 0xCCCC;
3242 REG_BANK_R2_WFI = 0x16038A;
3243 REG_BANK_R2_WFI_ENABLE = 0x0800;
3244 REG_BANK_R2_LOG_DBG = MBOX_BYTE_STATUS_SELECT;
3245 REG_BANK_R2_SYSTEM_DBG = 0x16038A;
3246 REG_BANK_ADEC_DSP_DBG = 0x112DDC;
3247 REG_BANK_ADEC_DSP_RESULT1 = 0x112DFC;
3248 REG_BANK_ADEC_DSP_RESULT2 = 0x112DFE;
3249 REG_BANK_ASND_DSP_DBG = 0x112DDC;
3250 REG_BANK_ASND_DSP_RESULT1 = 0x112DFC;
3251 REG_BANK_ASND_DSP_RESULT2 = 0x112DFE;
3252 REG_BANK_DEC_R2_VERSION = 0x1603AA;
3253 REG_BANK_SND_R2_VERSION = 0x112EAA;
3254 REG_BANK_SND_R2_SRS = 0x112E94;
3255 REG_BANK_SNDOUT_INPUT_PATH_SEL1 = 0x112D50;
3256 REG_BANK_SNDOUT_INPUT_PATH_SEL2 = 0x112D52;
3257 REG_BANK_SNDOUT_INPUT_PATH_SEL3 = 0x112D54;
3258 REG_BANK_ADEC_DSP_IDMA = 0x112A80;
3259 REG_BANK_ASND_DSP_IDMA = 0x112A80;
3260 AU_nDBG("[AUDIO].....ChipType......||[2R1D ] ||]\n");
3261 }
3262 else if(UTPA_AUDIO_CHIP_TYPE_1R1D)
3263 {
3264 //---1R1D---
3265 AUDIO_CHIP_TYPE = API_AUDIO_CUSTOMER_CHIP_TYPE_1R1D;
3266 REG_BANK_ADEC1_PLAY = 0x112E98;
3267 REG_BANK_ADEC1_CODEC = 0x112E98;
3268 REG_BANK_ADEC2_PLAY = 0x112E9A;
3269 REG_BANK_ADEC2_CODEC = 0x112E9A;
3270 REG_BANK_R2_UART = 0x101EA6;
3271 REG_BANK_R2_DEC_UART_ENABLE = 0xCCCC;
3272 REG_BANK_R2_SND_UART_ENABLE = 0xCCCC;
3273 REG_BANK_R2_WFI = 0x112E8A;
3274 REG_BANK_R2_WFI_ENABLE = 0x0800;
3275 REG_BANK_R2_LOG_DBG = MBOX_BYTE_STATUS_SELECT;
3276 REG_BANK_R2_SYSTEM_DBG = 0x112E8A;
3277 REG_BANK_ADEC_DSP_DBG = 0x112DDC;
3278 REG_BANK_ADEC_DSP_RESULT1 = 0x112DFC;
3279 REG_BANK_ADEC_DSP_RESULT2 = 0x112DFE;
3280 REG_BANK_ASND_DSP_DBG = 0x112DDC;
3281 REG_BANK_ASND_DSP_RESULT1 = 0x112DFC;
3282 REG_BANK_ASND_DSP_RESULT2 = 0x112DFE;
3283 REG_BANK_DEC_R2_VERSION = 0x112EAA;
3284 REG_BANK_SND_R2_VERSION = 0x112EAA;
3285 REG_BANK_SND_R2_SRS = 0x112E94;
3286 REG_BANK_SNDOUT_INPUT_PATH_SEL1 = 0x112D50;
3287 REG_BANK_SNDOUT_INPUT_PATH_SEL2 = 0x112D52;
3288 REG_BANK_SNDOUT_INPUT_PATH_SEL3 = 0x112D54;
3289 REG_BANK_ADEC_DSP_IDMA = 0x112A80;
3290 REG_BANK_ASND_DSP_IDMA = 0x112A80;
3291 AU_nDBG("[AUDIO].....ChipType......||[1R1D ] ||]\n");
3292 }
3293 else if(UTPA_AUDIO_CHIP_TYPE_2D1R)
3294 {
3295 //---2D1R---
3296 AUDIO_CHIP_TYPE = API_AUDIO_CUSTOMER_CHIP_TYPE_2D1R;
3297 REG_BANK_ADEC1_PLAY = 0x112A2C;
3298 REG_BANK_ADEC1_CODEC = 0x112DBA;
3299 REG_BANK_ADEC2_PLAY = 0x112AAC;
3300 REG_BANK_ADEC2_CODEC = 0x112DFA;
3301 REG_BANK_R2_UART = 0xFFFFFF;
3302 REG_BANK_R2_DEC_UART_ENABLE = 0xFFFFFF;
3303 REG_BANK_R2_SND_UART_ENABLE = 0xFFFFFF;
3304 REG_BANK_R2_WFI = 0xFFFFFF;
3305 REG_BANK_R2_WFI_ENABLE = 0xFFFFFF;
3306 REG_BANK_R2_LOG_DBG = 0xFFFFFF;
3307 REG_BANK_R2_SYSTEM_DBG = 0xFFFFFF;
3308 REG_BANK_ADEC_DSP_DBG = 0x112D9C;
3309 REG_BANK_ADEC_DSP_RESULT1 = 0x112DBC;
3310 REG_BANK_ADEC_DSP_RESULT2 = 0x112DBE;
3311 REG_BANK_ASND_DSP_DBG = 0x112DDC;
3312 REG_BANK_ASND_DSP_RESULT1 = 0x112DFC;
3313 REG_BANK_ASND_DSP_RESULT2 = 0x112DFE;
3314 REG_BANK_DEC_R2_VERSION = 0x112EAA;
3315 REG_BANK_SND_R2_VERSION = 0x112EAA;
3316 REG_BANK_SND_R2_SRS = 0x112E94;
3317 REG_BANK_SNDOUT_INPUT_PATH_SEL1 = 0x112D50;
3318 REG_BANK_SNDOUT_INPUT_PATH_SEL2 = 0x112D52;
3319 REG_BANK_SNDOUT_INPUT_PATH_SEL3 = 0x112D54;
3320 REG_BANK_ADEC_DSP_IDMA = 0x112A00;
3321 REG_BANK_ASND_DSP_IDMA = 0x112A80;
3322 AU_nDBG("[AUDIO].....ChipType......||[2D1R ] ||]\n");
3323 }
3324 else if(UTPA_AUDIO_CHIP_TYPE_2D)
3325 {
3326 //---2D---
3327 AUDIO_CHIP_TYPE = API_AUDIO_CUSTOMER_CHIP_TYPE_2D;
3328 AU_nDBG("[AUDIO].....ChipType......||[2D ] ||]\n");
3329 }
3330 else if(UTPA_AUDIO_CHIP_TYPE_1D)
3331 {
3332 //---1D---
3333 AUDIO_CHIP_TYPE = API_AUDIO_CUSTOMER_CHIP_TYPE_1D;
3334 REG_BANK_ADEC1_PLAY = 0x112AAC;
3335 REG_BANK_ADEC1_CODEC = 0x112DFA;
3336 REG_BANK_ADEC2_PLAY = 0x112AAC;
3337 REG_BANK_ADEC2_CODEC = 0x112DFA;
3338 REG_BANK_ADEC_DSP_DBG = 0x112DDC;
3339 REG_BANK_ADEC_DSP_RESULT1 = 0x112DFC;
3340 REG_BANK_ADEC_DSP_RESULT2 = 0x112DFE;
3341 REG_BANK_ASND_DSP_DBG = 0x112DDC;
3342 REG_BANK_ASND_DSP_RESULT1 = 0x112DFC;
3343 REG_BANK_ASND_DSP_RESULT2 = 0x112DFE;
3344 REG_BANK_SNDOUT_INPUT_PATH_SEL1 = 0x112D50;
3345 REG_BANK_SNDOUT_INPUT_PATH_SEL2 = 0x112D52;
3346 REG_BANK_SNDOUT_INPUT_PATH_SEL3 = 0x112D54;
3347 REG_BANK_ADEC_DSP_IDMA = 0x112A80;
3348 REG_BANK_ASND_DSP_IDMA = 0x112A80;
3349 AU_nDBG("[AUDIO].....ChipType......||[1D ] ||]\n");
3350 }
3351 else
3352 {
3353 //---UNKNOWN (Default is 1D)---
3354 AUDIO_CHIP_TYPE = API_AUDIO_CUSTOMER_CHIP_TYPE_1D;
3355 REG_BANK_ADEC1_PLAY = 0x112AAC;
3356 REG_BANK_ADEC1_CODEC = 0x112DFA;
3357 REG_BANK_ADEC2_PLAY = 0x112AAC;
3358 REG_BANK_ADEC2_CODEC = 0x112DFA;
3359 REG_BANK_ADEC_DSP_DBG = 0x112DDC;
3360 REG_BANK_ADEC_DSP_RESULT1 = 0x112DFC;
3361 REG_BANK_ADEC_DSP_RESULT2 = 0x112DFE;
3362 REG_BANK_ASND_DSP_DBG = 0x112DDC;
3363 REG_BANK_ASND_DSP_RESULT1 = 0x112DFC;
3364 REG_BANK_ASND_DSP_RESULT2 = 0x112DFE;
3365 REG_BANK_SNDOUT_INPUT_PATH_SEL1 = 0x112D50;
3366 REG_BANK_SNDOUT_INPUT_PATH_SEL2 = 0x112D52;
3367 REG_BANK_SNDOUT_INPUT_PATH_SEL3 = 0x112D54;
3368 REG_BANK_ADEC_DSP_IDMA = 0x112A80;
3369 REG_BANK_ASND_DSP_IDMA = 0x112A80;
3370 AU_nDBG("[AUDIO].....ChipType......||[unKnown - default 1D] ||]\n");
3371 }
3372 return;
3373 }
3374
AU_CUS_Dump_RegBank(int bank)3375 void AU_CUS_Dump_RegBank(int bank)
3376 {
3377 int intOffset, i;
3378 intOffset = (int)bank & 0xFFFF00;
3379 for(i = 0; i <= 15; i++)
3380 {
3381 #if 0 //because some customer will re-define printf(), it will cause always "\n" in each function call
3382 for(j = 0; j<= 7; j++)
3383 {
3384 unsigned int temp_reg = intOffset + 16*i + 2*j;
3385 AU_nPRINT("[0x%x]=0x%-4X,", temp_reg, AU_CUS_ReadAbsReg((MS_U32)temp_reg));
3386 }
3387 AU_nPRINT(" @@ \n");
3388 #endif
3389 AU_nPRINT("[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X, @@ \n",
3390 (intOffset + 16*i + 2*0), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*0)),
3391 (intOffset + 16*i + 2*1), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*1)),
3392 (intOffset + 16*i + 2*2), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*2)),
3393 (intOffset + 16*i + 2*3), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*3)),
3394 (intOffset + 16*i + 2*4), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*4)),
3395 (intOffset + 16*i + 2*5), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*5)),
3396 (intOffset + 16*i + 2*6), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*6)),
3397 (intOffset + 16*i + 2*7), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*7)) );
3398 }
3399
3400 return;
3401 }
3402
AU_CUS_ConvertCustomerCaptureInputToDriverInput(API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT captureCustomerSourceType)3403 static AUDIO_CAPTURE_SOURCE_TYPE AU_CUS_ConvertCustomerCaptureInputToDriverInput(API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT captureCustomerSourceType)
3404 {
3405 AUDIO_CAPTURE_SOURCE_TYPE captureDriverSourceType = E_CAPTURE_NULL;
3406
3407 switch(captureCustomerSourceType)
3408 {
3409 case API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_CH5:
3410 {
3411 captureDriverSourceType = E_CAPTURE_CH5;
3412 }
3413 break;
3414
3415 case API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_CH6:
3416 {
3417 captureDriverSourceType = E_CAPTURE_CH6;
3418 }
3419 break;
3420
3421 case API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_CH7:
3422 {
3423 captureDriverSourceType = E_CAPTURE_CH7;
3424 }
3425 break;
3426
3427 case API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_CH8:
3428 {
3429 captureDriverSourceType = E_CAPTURE_CH8;
3430 }
3431 break;
3432
3433 case API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_PCM:
3434 {
3435 captureDriverSourceType = E_CAPTURE_PCM;
3436 }
3437 break;
3438
3439 case API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_PCM_DELAY:
3440 {
3441 captureDriverSourceType = E_CAPTURE_PCM_DELAY;
3442 }
3443 break;
3444
3445 case API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_PCM_SE:
3446 {
3447 captureDriverSourceType = E_CAPTURE_PCM_SE;
3448 }
3449 break;
3450
3451 case API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_MIXER:
3452 {
3453 captureDriverSourceType = E_CAPTURE_MIXER;
3454 }
3455 break;
3456
3457 default:
3458 {
3459 captureDriverSourceType = E_CAPTURE_CH5;
3460 }
3461 break;
3462 }
3463
3464 return captureDriverSourceType;
3465 }
3466
AU_CUS_ConvertCustomerAdecIndexToDriverDecID(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)3467 static AUDIO_DEC_ID AU_CUS_ConvertCustomerAdecIndexToDriverDecID(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
3468 {
3469 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
3470
3471 switch(adecIndex)
3472 {
3473 case API_AUDIO_CUSTOMER_ADEC0:
3474 {
3475 DecID = pstAudioCustomerShmData->g_audio_customer_ADEC0_DecID;
3476
3477 if(DecID == AU_DEC_INVALID)
3478 {
3479 DecID = AU_DEC_ID1;
3480 }
3481 }
3482 break;
3483
3484 case API_AUDIO_CUSTOMER_ADEC1:
3485 {
3486 DecID = pstAudioCustomerShmData->g_audio_customer_ADEC1_DecID;
3487
3488 if(DecID == AU_DEC_INVALID)
3489 {
3490 DecID = AU_DEC_ID3;
3491 }
3492 }
3493 break;
3494
3495 case API_AUDIO_CUSTOMER_ADEC_ATV:
3496 {
3497 DecID = pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_DecID;
3498
3499 if(DecID == AU_DEC_INVALID)
3500 {
3501 DecID = AU_DEC_ID2;
3502 }
3503 }
3504 break;
3505
3506 default:
3507 {
3508 AU_nPRINT("[Error] [%s] [Invalid adecIndex: %d] \n", __FUNCTION__, adecIndex);
3509 DecID = pstAudioCustomerShmData->g_audio_customer_ADEC0_DecID;
3510 }
3511 break;
3512 }
3513 return DecID;
3514 }
3515
AU_CUS_ConvertCustomerCodecTypeToDriverDVBdecSystemType(API_AUDIO_CUSTOMER_CODEC_TYPE audioType)3516 static En_DVB_decSystemType AU_CUS_ConvertCustomerCodecTypeToDriverDVBdecSystemType(API_AUDIO_CUSTOMER_CODEC_TYPE audioType)
3517 {
3518 En_DVB_decSystemType eAudioDSPSystem = MSAPI_AUD_DVB_INVALID;
3519
3520 switch(audioType)
3521 {
3522 case API_AUDIO_CUSTOMER_CODEC_TYPE_UNKNOWN:
3523 {
3524 eAudioDSPSystem = MSAPI_AUD_DVB_INVALID;
3525 }
3526 break;
3527
3528 case API_AUDIO_CUSTOMER_CODEC_TYPE_AC3:
3529 case API_AUDIO_CUSTOMER_CODEC_TYPE_EAC3:
3530 {
3531 eAudioDSPSystem = MSAPI_AUD_DVB_AC3;
3532 }
3533 break;
3534
3535 case API_AUDIO_CUSTOMER_CODEC_TYPE_MPEG:
3536 {
3537 eAudioDSPSystem = MSAPI_AUD_DVB_MPEG;
3538 }
3539 break;
3540
3541 case API_AUDIO_CUSTOMER_CODEC_TYPE_AAC:
3542 case API_AUDIO_CUSTOMER_CODEC_TYPE_HEAAC:
3543 {
3544 eAudioDSPSystem = MSAPI_AUD_DVB_AAC;
3545 }
3546 break;
3547
3548 case API_AUDIO_CUSTOMER_CODEC_TYPE_DRA:
3549 {
3550 eAudioDSPSystem = MSAPI_AUD_DVB_DRA;
3551 }
3552 break;
3553
3554 case API_AUDIO_CUSTOMER_CODEC_TYPE_MP3:
3555 {
3556 eAudioDSPSystem = MSAPI_AUD_DVB_MP3;
3557 }
3558 break;
3559
3560 case API_AUDIO_CUSTOMER_CODEC_TYPE_DTS:
3561 case API_AUDIO_CUSTOMER_CODEC_TYPE_DTS_HD_MA:
3562 case API_AUDIO_CUSTOMER_CODEC_TYPE_DTS_EXPRESS:
3563 case API_AUDIO_CUSTOMER_CODEC_TYPE_DTS_CD:
3564 {
3565 eAudioDSPSystem = MSAPI_AUD_DVB_DTS;
3566 }
3567 break;
3568
3569 case API_AUDIO_CUSTOMER_CODEC_TYPE_WMA:
3570 case API_AUDIO_CUSTOMER_CODEC_TYPE_WMA_PRO:
3571 {
3572 eAudioDSPSystem = MSAPI_AUD_DVB_WMA_PRO;
3573 }
3574 break;
3575
3576 case API_AUDIO_CUSTOMER_CODEC_TYPE_XPCM:
3577 {
3578 eAudioDSPSystem = MSAPI_AUD_DVB_XPCM;
3579 }
3580 break;
3581
3582 case API_AUDIO_CUSTOMER_CODEC_TYPE_RA8LBR:
3583 {
3584 eAudioDSPSystem = MSAPI_AUD_DVB_RA8LBR;
3585 }
3586 break;
3587
3588 case API_AUDIO_CUSTOMER_CODEC_TYPE_FLAC:
3589 {
3590 eAudioDSPSystem = MSAPI_AUD_DVB_FLAC;
3591 }
3592 break;
3593
3594 case API_AUDIO_CUSTOMER_CODEC_TYPE_VORBIS:
3595 {
3596 eAudioDSPSystem = MSAPI_AUD_DVB_VORBIS;
3597 }
3598 break;
3599
3600 case API_AUDIO_CUSTOMER_CODEC_TYPE_AMR_NB:
3601 {
3602 eAudioDSPSystem = MSAPI_AUD_DVB_AMR_NB;
3603 }
3604 break;
3605
3606 case API_AUDIO_CUSTOMER_CODEC_TYPE_AMR_WB:
3607 {
3608 eAudioDSPSystem = MSAPI_AUD_DVB_AMR_WB;
3609 }
3610 break;
3611
3612 case API_AUDIO_CUSTOMER_CODEC_TYPE_DolbyTrueHDBypass:
3613 {
3614 eAudioDSPSystem = MSAPI_AUD_DVB_DolbyTrueHDBypass;
3615 }
3616 break;
3617
3618 case API_AUDIO_CUSTOMER_CODEC_TYPE_SIF:
3619 case API_AUDIO_CUSTOMER_CODEC_TYPE_SIF_A2:
3620 {
3621 eAudioDSPSystem = MSAPI_AUD_ATV_PAL;
3622 }
3623 break;
3624
3625 case API_AUDIO_CUSTOMER_CODEC_TYPE_SIF_BTSC:
3626 {
3627 eAudioDSPSystem = MSAPI_AUD_ATV_BTSC;
3628 }
3629 break;
3630
3631 case API_AUDIO_CUSTOMER_CODEC_TYPE_ESBypass:
3632 {
3633 #if(CUSTOMIZED_PATCH_PARAM_ES_PASSTHROUGH)
3634 {
3635 eAudioDSPSystem = MSAPI_AUD_DVB_ES_Bypass;
3636 }
3637 #endif //#if(CUSTOMIZED_PATCH_PARAM_ES_PASSTHROUGH)
3638 }
3639 break;
3640
3641 default:
3642 {
3643 eAudioDSPSystem = MSAPI_AUD_DVB_INVALID;
3644 }
3645 break;
3646 }
3647
3648 return eAudioDSPSystem;
3649 }
3650
AU_CUS_ConvertCustomerADECInputSourceToDriverSourceInfoType(API_AUDIO_CUSTOMER_ADEC_INPUT enInputSourceType)3651 static AUDIO_SOURCE_INFO_TYPE AU_CUS_ConvertCustomerADECInputSourceToDriverSourceInfoType(API_AUDIO_CUSTOMER_ADEC_INPUT enInputSourceType)
3652 {
3653 AUDIO_SOURCE_INFO_TYPE eAudioSource = E_AUDIO_INFO_SPDIF_IN;
3654 switch(enInputSourceType)
3655 {
3656 case API_AUDIO_CUSTOMER_ADEC_INPUT_DTV:
3657 {
3658 eAudioSource = E_AUDIO_INFO_DTV_IN;
3659 }
3660 break;
3661
3662 case API_AUDIO_CUSTOMER_ADEC_INPUT_HDMI:
3663 {
3664 eAudioSource = E_AUDIO_INFO_HDMI_IN;
3665 }
3666 break;
3667
3668 case API_AUDIO_CUSTOMER_ADEC_INPUT_MM:
3669 {
3670 eAudioSource = E_AUDIO_INFO_MM_IN;
3671 }
3672 break;
3673
3674 case API_AUDIO_CUSTOMER_ADEC_INPUT_CLIP:
3675 {
3676 eAudioSource = E_AUDIO_INFO_GAME_IN;
3677 }
3678 break;
3679
3680 case API_AUDIO_CUSTOMER_ADEC_INPUT_ATV:
3681 {
3682 eAudioSource = E_AUDIO_INFO_ATV_IN;
3683 }
3684 break;
3685
3686 default:
3687 break;
3688 }
3689
3690 return eAudioSource;
3691 }
3692
AU_CUS_ConvertCustomerADECSourceToDriverSourceType(API_AUDIO_CUSTOMER_ADEC_INPUT inputConnect)3693 static AUDIO_INPUT_TYPE AU_CUS_ConvertCustomerADECSourceToDriverSourceType(API_AUDIO_CUSTOMER_ADEC_INPUT inputConnect)
3694 {
3695 AUDIO_SOURCE_INFO_TYPE sourceType = E_AUDIO_INFO_DTV_IN;
3696
3697 switch(inputConnect)
3698 {
3699 case API_AUDIO_CUSTOMER_ADEC_INPUT_DTV:
3700 {
3701 sourceType = E_AUDIO_INFO_DTV_IN;
3702 }
3703 break;
3704
3705 case API_AUDIO_CUSTOMER_ADEC_INPUT_HDMI:
3706 {
3707 sourceType = E_AUDIO_INFO_HDMI_IN;
3708 }
3709 break;
3710
3711 case API_AUDIO_CUSTOMER_ADEC_INPUT_MM:
3712 case API_AUDIO_CUSTOMER_ADEC_INPUT_CLIP:
3713 {
3714 sourceType = E_AUDIO_INFO_MM_IN;
3715 }
3716 break;
3717
3718 case API_AUDIO_CUSTOMER_ADEC_INPUT_ATV:
3719 {
3720 sourceType = E_AUDIO_INFO_ATV_IN;
3721 }
3722 break;
3723
3724 default:
3725 break;
3726 }
3727
3728 return sourceType;
3729 }
3730
AU_CUS_ConvertCustomerChInputToDriverInputType(API_AUDIO_CUSTOMER_CH_INPUT ChInput)3731 static AUDIO_INPUT_TYPE AU_CUS_ConvertCustomerChInputToDriverInputType(API_AUDIO_CUSTOMER_CH_INPUT ChInput)
3732 {
3733 AUDIO_INPUT_TYPE eAudioSource = AUDIO_NULL_INPUT;
3734
3735 switch(ChInput)
3736 {
3737 case API_AUDIO_CUSTOMER_CH_INPUT_ADEC0:
3738 {
3739 switch(pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect)
3740 {
3741 case API_AUDIO_CUSTOMER_ADEC_INPUT_DTV:
3742 case API_AUDIO_CUSTOMER_ADEC_INPUT_MM:
3743 case API_AUDIO_CUSTOMER_ADEC_INPUT_CLIP:
3744 {
3745 eAudioSource = AUDIO_DSP1_DVB_INPUT;
3746 }
3747 break;
3748
3749 case API_AUDIO_CUSTOMER_ADEC_INPUT_HDMI:
3750 {
3751 eAudioSource = AUDIO_DSP1_HDMI_INPUT;
3752 }
3753 break;
3754
3755 default:
3756 {
3757 eAudioSource = AUDIO_NULL_INPUT;
3758 }
3759 break;
3760 }
3761 }
3762 break;
3763
3764 case API_AUDIO_CUSTOMER_CH_INPUT_ADEC1:
3765 {
3766 switch(pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect)
3767 {
3768 case API_AUDIO_CUSTOMER_ADEC_INPUT_DTV:
3769 case API_AUDIO_CUSTOMER_ADEC_INPUT_MM:
3770 case API_AUDIO_CUSTOMER_ADEC_INPUT_CLIP:
3771 {
3772 #if(R2_SUPPORT_R2DMA_READER2 == 1)
3773 {
3774 eAudioSource = AUDIO_DSP3_DVB_INPUT;
3775 }
3776 #elif(R2_SUPPORT_R2_DEC_ISR2_EN == 1)
3777 {
3778 // _____ ___________ _______________
3779 // | | R2 DMA | DSP Dec out |
3780 // |_____|___________|_______________|
3781 // |ADEC0| R2_DMA_1 |R2_DEC_ISR1_EN |
3782 // | | (0x80) | (0x80) |
3783 // |_____|___________|_______________|
3784 // |ADEC1| R2_DMA_2 |R2_DEC_ISR2_EN |
3785 // | | (0x82) | (0x83) |
3786 // | | 1R1D not | |
3787 // |_____|_Support___|_______________|
3788
3789 // note: R2_DEC_ISR2_EN sholud be 1 in Sys_def.h
3790 eAudioSource = AUDIO_DSP4_SIF_INPUT;
3791 }
3792 #else
3793 {
3794 eAudioSource = AUDIO_DSP3_DVB_INPUT;
3795 }
3796 #endif
3797 }
3798 break;
3799
3800 case API_AUDIO_CUSTOMER_ADEC_INPUT_HDMI:
3801 {
3802 eAudioSource = AUDIO_DSP3_HDMI_INPUT;
3803 }
3804 break;
3805
3806 default:
3807 {
3808 eAudioSource = AUDIO_NULL_INPUT;
3809 }
3810 break;
3811 }
3812 }
3813 break;
3814
3815 case API_AUDIO_CUSTOMER_CH_INPUT_ADEC_ATV:
3816 {
3817 eAudioSource = AUDIO_DSP4_SIF_INPUT;
3818 }
3819 break;
3820
3821 case API_AUDIO_CUSTOMER_CH_INPUT_HDMI:
3822 {
3823 eAudioSource = AUDIO_HDMI_INPUT;
3824 }
3825 break;
3826
3827 case API_AUDIO_CUSTOMER_CH_INPUT_ADC0:
3828 {
3829 eAudioSource = pstAudioCustomerShmData->g_audio_customer_ADC0_Connect;
3830 }
3831 break;
3832
3833 case API_AUDIO_CUSTOMER_CH_INPUT_ADC1:
3834 {
3835 eAudioSource = pstAudioCustomerShmData->g_audio_customer_ADC1_Connect;
3836 }
3837 break;
3838
3839 case API_AUDIO_CUSTOMER_CH_INPUT_SCART:
3840 {
3841 eAudioSource = pstAudioCustomerShmData->g_audio_customer_ADC0_Connect;
3842 }
3843 break;
3844
3845 case API_AUDIO_CUSTOMER_CH_INPUT_R2DMA_DSP1:
3846 {
3847 eAudioSource = AUDIO_DSP1_DVB_INPUT;
3848 }
3849 break;
3850
3851 case API_AUDIO_CUSTOMER_CH_INPUT_R2DMA_DSP3:
3852 {
3853 eAudioSource = AUDIO_DSP3_DVB_INPUT;
3854 }
3855 break;
3856
3857 case API_AUDIO_CUSTOMER_CH_INPUT_SWDMA_DSP3:
3858 {
3859 eAudioSource = AUDIO_DSP3_DVB_INPUT;
3860 }
3861 break;
3862
3863 case API_AUDIO_CUSTOMER_CH_INPUT_HWDMA:
3864 {
3865 eAudioSource = AUDIO_DMA_READER_INPUT;
3866 }
3867 break;
3868
3869 case API_AUDIO_CUSTOMER_CH_INPUT_NONE:
3870 {
3871 eAudioSource = AUDIO_NULL_INPUT;
3872 }
3873 break;
3874
3875 default:
3876 {
3877 eAudioSource = AUDIO_NULL_INPUT;
3878 }
3879 break;
3880 }
3881
3882 return eAudioSource;
3883 }
3884
AU_CUS_ConvertCustomerChInputToDriverSourceInfoType(API_AUDIO_CUSTOMER_CH_INPUT chInput)3885 static AUDIO_SOURCE_INFO_TYPE AU_CUS_ConvertCustomerChInputToDriverSourceInfoType(API_AUDIO_CUSTOMER_CH_INPUT chInput)
3886 {
3887 AUDIO_SOURCE_INFO_TYPE eAudioSource = E_AUDIO_INFO_ADC_IN;
3888
3889 switch(chInput)
3890 {
3891 case API_AUDIO_CUSTOMER_CH_INPUT_ADEC0:
3892 {
3893 eAudioSource = AU_CUS_ConvertCustomerADECInputSourceToDriverSourceInfoType(pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect);
3894 }
3895 break;
3896
3897 case API_AUDIO_CUSTOMER_CH_INPUT_ADEC1:
3898 {
3899 eAudioSource = AU_CUS_ConvertCustomerADECInputSourceToDriverSourceInfoType(pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect);
3900 }
3901 break;
3902
3903 case API_AUDIO_CUSTOMER_CH_INPUT_ADEC_ATV:
3904 {
3905 eAudioSource = AU_CUS_ConvertCustomerADECInputSourceToDriverSourceInfoType(pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Connect);
3906 }
3907 break;
3908
3909 case API_AUDIO_CUSTOMER_CH_INPUT_ADC0:
3910 case API_AUDIO_CUSTOMER_CH_INPUT_ADC1:
3911 {
3912 eAudioSource = E_AUDIO_INFO_ADC_IN;
3913 }
3914 break;
3915
3916 case API_AUDIO_CUSTOMER_CH_INPUT_HDMI:
3917 {
3918 eAudioSource = E_AUDIO_INFO_HDMI_IN;
3919 }
3920 break;
3921
3922 default:
3923 break;
3924 }
3925
3926 return eAudioSource;
3927 }
3928
AU_CUS_ConvertCustomerMstarSndTypeToDriverMstarSndType(API_AUDIO_CUSTOMER_MSTAR_SE_TYPE seType)3929 static Sound_ENABLE_Type AU_CUS_ConvertCustomerMstarSndTypeToDriverMstarSndType(API_AUDIO_CUSTOMER_MSTAR_SE_TYPE seType)
3930 {
3931 Sound_ENABLE_Type retType = -1;
3932 switch(seType)
3933 {
3934 case API_AUDIO_CUSTOMER_GEQ:
3935 {
3936 retType = Sound_ENABL_Type_EQ;
3937 }
3938 break;
3939
3940 case API_AUDIO_CUSTOMER_PEQ:
3941 {
3942 retType = Sound_ENABL_Type_PEQ;
3943 }
3944 break;
3945
3946 case API_AUDIO_CUSTOMER_HPF:
3947 {
3948 retType = Sound_ENABL_Type_Hpf;
3949 }
3950 break;
3951
3952 case API_AUDIO_CUSTOMER_DRC:
3953 {
3954 retType = Sound_ENABL_Type_DRC;
3955 }
3956 break;
3957
3958 case API_AUDIO_CUSTOMER_AVC:
3959 {
3960 retType = Sound_ENABL_Type_AutoVolume;
3961 }
3962 break;
3963
3964 case API_AUDIO_CUSTOMER_BALANCE:
3965 {
3966 retType = Sound_ENABL_Type_Balance;
3967 }
3968
3969
3970 default:
3971 break;
3972
3973 }
3974 return retType;
3975 }
3976
AU_CUS_ConvertCustomerDtsSndTypeToDriverDtsSndType(API_AUDIO_CUSTOMER_DTS_SE_TYPE seType)3977 static ADVSND_TYPE AU_CUS_ConvertCustomerDtsSndTypeToDriverDtsSndType(API_AUDIO_CUSTOMER_DTS_SE_TYPE seType)
3978 {
3979 ADVSND_TYPE retType = ADV_NONE;
3980 switch(seType)
3981 {
3982 case API_AUDIO_CUSTOMER_DTS_SE_TSXT:
3983 {
3984 retType = SRS_TSXT;
3985 }
3986 break;
3987
3988 case API_AUDIO_CUSTOMER_DTS_SE_TSHD:
3989 {
3990 retType = SRS_TSHD;
3991 }
3992 break;
3993
3994 case API_AUDIO_CUSTOMER_DTS_SE_THEATERSOUND:
3995 {
3996 retType = SRS_THEATERSOUND;
3997 }
3998 break;
3999
4000 case API_AUDIO_CUSTOMER_DTS_SE_PURESND:
4001 {
4002 retType = SRS_PURESND;
4003 }
4004 break;
4005
4006 case API_AUDIO_CUSTOMER_DTS_SE_STUDIOSOUND_3D:
4007 {
4008 retType = DTS_STUDIOSOUND_3D;
4009 }
4010 break;
4011
4012 default:
4013 break;
4014
4015 }
4016 return retType;
4017 }
4018
AU_CUS_ConvertCustomerDtsSndUnitToDriverDtsSndUnitType(API_AUDIO_CUSTOMER_DTS_SE_UNIT_TYPE seUnit)4019 static ADVFUNC AU_CUS_ConvertCustomerDtsSndUnitToDriverDtsSndUnitType(API_AUDIO_CUSTOMER_DTS_SE_UNIT_TYPE seUnit)
4020 {
4021 ADVFUNC retType = SRS_THEATERSOUND_TOTAL;
4022
4023 switch(seUnit)
4024 {
4025 //---------------------------------------------------------------------------------
4026 // TSHD
4027 //---------------------------------------------------------------------------------
4028 case API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TOTAL:
4029 {
4030 retType = SRS_THEATERSOUND_TOTAL;
4031 }
4032 break;
4033
4034 case API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD:
4035 {
4036 retType = SRS_THEATERSOUND_TSHD;
4037 }
4038 break;
4039
4040 case API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD_DEFINITION:
4041 {
4042 retType = SRS_THEATERSOUND_DEFINITION;
4043 }
4044 break;
4045
4046 case API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD_DC:
4047 {
4048 retType = SRS_THEATERSOUND_DC;
4049 }
4050 break;
4051
4052 case API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD_SURR:
4053 {
4054 retType = SRS_THEATERSOUND_TSHD_SURR;
4055 }
4056 break;
4057
4058 case API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD_TRUBASS:
4059 {
4060 retType = SRS_THEATERSOUND_TRUBASS;
4061 }
4062 break;
4063
4064 case API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD_TRUBASS_LVL_INDPT:
4065 {
4066 retType = SRS_THEATERSOUND_TSHD_LEVEL_INDPT;
4067 }
4068 break;
4069
4070 //---------------------------------------------------------------------------------
4071 // CC3D Controls (CC3D must enable)
4072 //---------------------------------------------------------------------------------
4073 case API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_CC3D:
4074 {
4075 retType = SRS_THEATERSOUND_CC3D_EN;
4076 }
4077 break;
4078
4079 case API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_CC3D_DEPTH_PROCESS:
4080 {
4081 retType = SRS_THEATERSOUND_CC3D_DEPTH_PROCESS_EN;
4082 }
4083 break;
4084
4085 //---------------------------------------------------------------------------------
4086 // TRUVOLUME HD
4087 //---------------------------------------------------------------------------------
4088 case API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TRUVOLUME:
4089 {
4090 retType = SRS_THEATERSOUND_TRUVOLUME;
4091 }
4092 break;
4093
4094 case API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TRUVOLUME_NORMALIZER:
4095 {
4096 retType = SRS_THEATERSOUND_TRUVOLUME_NORMALIZER;
4097 }
4098 break;
4099
4100 //---------------------------------------------------------------------------------
4101 // TRUDIALOG
4102 //---------------------------------------------------------------------------------
4103 case API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TRUDIALOG:
4104 {
4105 retType = SRS_THEATERSOUND_TRUDIALOG;
4106 }
4107 break;
4108
4109 //---------------------------------------------------------------------------------
4110 // TBHDX
4111 //---------------------------------------------------------------------------------
4112 case API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_CC3D_TBHDX:
4113 {
4114 retType = SRS_THEATERSOUND_CC3D_TBHDX_EN;
4115 }
4116 break;
4117
4118 //---------------------------------------------------------------------------------
4119 // GEQ
4120 //---------------------------------------------------------------------------------
4121 case API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_GEQ:
4122 {
4123 retType = SRS_THEATERSOUND_GEQ_EN;
4124 }
4125 break;
4126
4127 //---------------------------------------------------------------------------------
4128 // PURESOUND HRADLIMITER
4129 //---------------------------------------------------------------------------------
4130 case API_AUDIO_CUSTOMER_DTS_SE_UNIT_PURESOUND_HL:
4131 {
4132 retType = SRS_PURESOUND_HL;
4133 }
4134 break;
4135
4136 //---------------------------------------------------------------------------------
4137 // PURESOUND AEQ
4138 //---------------------------------------------------------------------------------
4139 case API_AUDIO_CUSTOMER_DTS_SE_UNIT_PURESOUND_AEQ:
4140 {
4141 retType = SRS_PURESOUND_AEQ;
4142 }
4143 break;
4144
4145 //---------------------------------------------------------------------------------
4146 // PURESOUND HPF
4147 //---------------------------------------------------------------------------------
4148 case API_AUDIO_CUSTOMER_DTS_SE_UNIT_PURESOUND_HPF:
4149 {
4150 retType = SRS_PURESOUND_HPF;
4151 }
4152 break;
4153
4154 default:
4155 break;
4156
4157 }
4158 return retType;
4159 }
4160
AU_CUS_ConvertCustomerDtsSndParamToDriverDtsSndParam(API_AUDIO_CUSTOMER_DTS_SE_PARAM_TYPE seParam,MS_U32 u32value)4161 static ADVSND_PARAM AU_CUS_ConvertCustomerDtsSndParamToDriverDtsSndParam(API_AUDIO_CUSTOMER_DTS_SE_PARAM_TYPE seParam, MS_U32 u32value)
4162 {
4163 ADVSND_PARAM retType = 0;
4164
4165 switch(seParam)
4166 {
4167 //---------------------------------------------------------------------------------
4168 // TSHD
4169 //---------------------------------------------------------------------------------
4170 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_INPUT_GAIN_FXP24:
4171 {
4172 retType = SRS_THEATERSOUND_INPUT_GAIN;
4173 }
4174 break;
4175
4176 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_DEFINITION_CTRL_FXP24:
4177 {
4178 retType = SRS_THEATERSOUND_DEFINITION_CONTROL;
4179 }
4180 break;
4181
4182 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_DC_LEVEL_CTRL_FXP24:
4183 {
4184 retType = SRS_THEATERSOUND_DC_CONTROL;
4185 }
4186 break;
4187
4188 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_SURR_LEVEL_CTRL_FXP24:
4189 {
4190 retType = SRS_THEATERSOUND_SURR_LEVEL_CONTROL;
4191 }
4192 break;
4193
4194 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_CTRL_FXP24:
4195 {
4196 retType = SRS_THEATERSOUND_TRUBASS_CONTROL;
4197 }
4198 break;
4199
4200 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_COMPR_CTRL_FXP24:
4201 {
4202 retType = SRS_THEATERSOUND_TRUBASS_COMPRESSOR_CONTROL;
4203 }
4204 break;
4205
4206 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_PROCESS_MODE:
4207 {
4208 if(u32value < 2)
4209 {
4210 retType = SRS_THEATERSOUND_TRUBASS_PROCESS_MODE;
4211 }
4212 else
4213 {
4214 AU_nPRINT("Error: API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_PROCESS_MODE value is out of range \n");
4215 }
4216 }
4217 break;
4218
4219 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_SPKSIZE:
4220 {
4221 if(u32value < 9)
4222 {
4223 retType = SRS_THEATERSOUND_SPEAKERSIZE;
4224 }
4225 else
4226 {
4227 AU_nPRINT("Error: API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_SPKSIZE value is out of range \n");
4228 }
4229 }
4230 break;
4231
4232 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_CUS_SPKSIZE:
4233 {
4234 if(u32value < 39)
4235 {
4236 retType = SRS_THEATERSOUND_TRUBASS_SPEAKER_AUDIO;
4237 }
4238 else
4239 {
4240 AU_nPRINT("Error: API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_CUS_SPKSIZE value is out of range \n");
4241 }
4242 }
4243 break;
4244
4245 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_CUS_SPKSIZE_ANALYSIS:
4246 {
4247 if(u32value < 39)
4248 {
4249 retType = SRS_THEATERSOUND_TRUBASS_SPEAKER_ANALYSIS;
4250 }
4251 else
4252 {
4253 AU_nPRINT("Error: API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_CUS_SPKSIZE_ANALYSIS value is out of range \n");
4254 }
4255 }
4256 break;
4257
4258 //---------------------------------------------------------------------------------
4259 // Main Controls
4260 //---------------------------------------------------------------------------------
4261 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_MAIN_CTRL_HEADROOM_GAIN_FXP24:
4262 {
4263 retType = SRS_THEATERSOUND_HEADROOM_GAIN;
4264 }
4265 break;
4266
4267 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_MAIN_CTRL_BYPASS_GAIN_FXP24:
4268 {
4269 retType = SRS_THEATERSOUND_BYPASS_GAIN;
4270 }
4271 break;
4272
4273 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_MAIN_CTRL_CC3D_PROCESS_PATH:
4274 {
4275 retType = SRS_THEATERSOUND_CC3D_PROCESS_PATH;
4276 }
4277 break;
4278
4279 //---------------------------------------------------------------------------------
4280 // CC3D Controls
4281 //---------------------------------------------------------------------------------
4282 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_INPUT_GAIN_FXP24:
4283 {
4284 retType = SRS_THEATERSOUND_CC3D_INPUT_GAIN;
4285 }
4286 break;
4287
4288 //---------------------------------------------------------------------------------
4289 // TRUVOLUME HD
4290 //---------------------------------------------------------------------------------
4291 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUVOLUME_MODE:
4292 {
4293 retType = SRS_THEATERSOUND_TRUVOLUME_MODE;
4294 }
4295 break;
4296
4297 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUVOLUME_REF_LEVEL_FXP24:
4298 {
4299 retType = SRS_THEATERSOUND_TRUVOLUME_REF_LEVEL;
4300 }
4301 break;
4302
4303 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUVOLUME_MAX_GAIN_FXP24:
4304 {
4305 retType = SRS_THEATERSOUND_TRUVOLUME_MAX_GAIN;
4306 }
4307 break;
4308
4309 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUVOLUME_NORMALIZE_THRESH_FXP24:
4310 {
4311 retType = SRS_THEATERSOUND_TRUVOLUME_NORMALIZE_THRESH;
4312 }
4313 break;
4314
4315 //---------------------------------------------------------------------------------
4316 // TRUDIALOG
4317 //---------------------------------------------------------------------------------
4318 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUDIALOG_INPUT_GAIN_FXP24:
4319 {
4320 retType = SRS_THEATERSOUND_TRUDIALOG_INPUT_GAIN;
4321 }
4322 break;
4323
4324 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUDIALOG_CLARITY_GAIN_FXP24:
4325 {
4326 retType = SRS_THEATERSOUND_TRUDIALOG_CLARITY_GAIN;
4327 }
4328 break;
4329
4330 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUDIALOG_PROCESS_GAIN_FXP24:
4331 {
4332 retType = SRS_THEATERSOUND_TRUDIALOG_PROCESS_GAIN;
4333 }
4334 break;
4335
4336 //---------------------------------------------------------------------------------
4337 // TBHDX
4338 //---------------------------------------------------------------------------------
4339 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_INPUT_GAIN_FXP24:
4340 {
4341 retType = SRS_THEATERSOUND_CC3D_TBHDX_INPUT_GAIN;
4342 }
4343 break;
4344
4345 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_BASSLEVEL_FXP24:
4346 {
4347 retType = SRS_THEATERSOUND_CC3D_TBHDX_BASSLEVEL;
4348 }
4349 break;
4350
4351 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_SPEAKERSIZE:
4352 {
4353 retType = SRS_THEATERSOUND_CC3D_TBHDX_SPEAKERSIZE;
4354 }
4355 break;
4356
4357 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_HP_ORDER:
4358 {
4359 retType = SRS_THEATERSOUND_CC3D_TBHDX_HP_ORDER;
4360 }
4361 break;
4362
4363 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_DYNAMICS_FXP24:
4364 {
4365 retType = SRS_THEATERSOUND_CC3D_TBHDX_DYNAMICS;
4366 }
4367 break;
4368
4369 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_MODE:
4370 {
4371 retType = SRS_THEATERSOUND_CC3D_TBHDX_MODE;
4372 }
4373 break;
4374
4375 //---------------------------------------------------------------------------------
4376 // CS DECODER
4377 //---------------------------------------------------------------------------------
4378 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CS_INPUT_GAIN_FXP24:
4379 {
4380 retType = SRS_THEATERSOUND_CS_INPUT_GAIN;
4381 }
4382 break;
4383
4384 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CS_PROCESS_MODE:
4385 {
4386 retType = SRS_THEATERSOUND_CS_PROCESS_MODE;
4387 }
4388 break;
4389
4390 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CS_LR_OUTPUT_GAIN_FXP24:
4391 {
4392 retType = SRS_THEATERSOUND_CS_LR_OUTPUT_GAIN;
4393 }
4394 break;
4395
4396 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CS_LsRs_OUTPUT_GAIN_FXP24:
4397 {
4398 retType = SRS_THEATERSOUND_CS_LsRs_OUTPUT_GAIN;
4399 }
4400 break;
4401
4402 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CS_Center_OUTPUT_GAIN_FXP24:
4403 {
4404 retType = SRS_THEATERSOUND_CS_Center_OUTPUT_GAIN;
4405 }
4406 break;
4407
4408 //---------------------------------------------------------------------------------
4409 // GEQ
4410 //---------------------------------------------------------------------------------
4411 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_INPUT_GAIN_FXP24:
4412 {
4413 retType = SRS_THEATERSOUND_GEQ_INPUT_GAIN;
4414 }
4415 break;
4416
4417 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_BAND0_GAIN_FXP24:
4418 {
4419 retType = SRS_THEATERSOUND_GEQ_BAND0_GAIN;
4420 }
4421 break;
4422
4423 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_BAND1_GAIN_FXP24:
4424 {
4425 retType = SRS_THEATERSOUND_GEQ_BAND1_GAIN;
4426 }
4427 break;
4428
4429 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_BAND2_GAIN_FXP24:
4430 {
4431 retType = SRS_THEATERSOUND_GEQ_BAND2_GAIN;
4432 }
4433 break;
4434
4435 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_BAND3_GAIN_FXP24:
4436 {
4437 retType = SRS_THEATERSOUND_GEQ_BAND3_GAIN;
4438 }
4439 break;
4440
4441 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_BAND4_GAIN_FXP24:
4442 {
4443 retType = SRS_THEATERSOUND_GEQ_BAND4_GAIN;
4444 }
4445 break;
4446
4447 //---------------------------------------------------------------------------------
4448 // PURESOUND HRADLIMITER
4449 //---------------------------------------------------------------------------------
4450 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_INPUT_GAIN_FXP24:
4451 {
4452 retType = SRS_PURESOUND_HL_INPUT_GAIN;
4453 }
4454 break;
4455
4456 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_OUTPUT_GAIN_FXP24:
4457 {
4458 retType = SRS_PURESOUND_HL_OUTPUT_GAIN;
4459 }
4460 break;
4461
4462 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_BYPASS_GAIN_FXP24:
4463 {
4464 retType = SRS_PURESOUND_HL_BYPASS_GAIN;
4465 }
4466 break;
4467
4468 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_LIMITERBOOST_FXP24:
4469 {
4470 retType = SRS_PURESOUND_HL_LIMITERBOOST;
4471 }
4472 break;
4473
4474 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_HARDLIMIT_CTRL_FXP24:
4475 {
4476 retType = SRS_PURESOUND_HL_HARDLIMIT;
4477 }
4478 break;
4479
4480 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_DELAY:
4481 {
4482 if( (u32value > 6) && (u32value < 48))
4483 {
4484 retType = SRS_PURESOUND_HL_DELAYLEN;
4485 }
4486 else
4487 {
4488 AU_nPRINT("Error: PURESOUND_HL_DELAY value is out of range \n");
4489 }
4490 }
4491 break;
4492
4493 //---------------------------------------------------------------------------------
4494 // PURESOUND AEQ
4495 //---------------------------------------------------------------------------------
4496 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_AEQ_INPUT_GAIN_FXP24:
4497 {
4498 retType = SRS_PURESOUND_AEQ_INPUT_GAIN;
4499 }
4500 break;
4501
4502 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_AEQ_OUTPUT_GAIN_FXP24:
4503 {
4504 retType = SRS_PURESOUND_AEQ_OUTPUT_GAIN;
4505 }
4506 break;
4507
4508 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_AEQ_BYPASS_GAIN_FXP24:
4509 {
4510 retType = SRS_PURESOUND_AEQ_BYPASS_GAIN;
4511 }
4512 break;
4513
4514 //---------------------------------------------------------------------------------
4515 // PURESOUND HPF
4516 //---------------------------------------------------------------------------------
4517 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HPF_FREQUENCY:
4518 {
4519 if(u32value < 4)
4520 {
4521 retType = SRS_PURESOUND_HPF_FREQUENCY;
4522 }
4523 else
4524 {
4525 AU_nPRINT("Error: API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HPF_FREQUENCY value is out of range \n");
4526 }
4527 }
4528 break;
4529
4530 //---------------------------------------------------------------------------------
4531 // PURESOUND hash only
4532 //---------------------------------------------------------------------------------
4533 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_INPUT_GAIN_FXP24:
4534 {
4535 retType = SRS_PURESOUND_INPUT_GAIN;
4536 }
4537 break;
4538
4539 case API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_OUTPUT_GAIN_FXP24:
4540 {
4541 retType = SRS_PURESOUND_OUTPUT_GAIN;
4542 }
4543 break;
4544
4545 default:
4546 break;
4547 }
4548
4549 return retType;
4550 }
4551
AU_CUS_SetPlayCmdByAdecSource(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)4552 static MS_BOOL AU_CUS_SetPlayCmdByAdecSource(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
4553 {
4554 API_AUDIO_CUSTOMER_ADEC_INPUT adecSrc = API_AUDIO_CUSTOMER_ADEC_INPUT_INVALID;
4555 MMA_AUDIO_CONTROL cmd = MMA_STOP;
4556 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
4557
4558 AU_nDBG("[adecIndex = 0x%x]\n", (unsigned int)adecIndex);
4559
4560 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
4561
4562 switch(adecIndex)
4563 {
4564 case API_AUDIO_CUSTOMER_ADEC0:
4565 {
4566 adecSrc = pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect;
4567 }
4568 break;
4569
4570 case API_AUDIO_CUSTOMER_ADEC1:
4571 {
4572 adecSrc = pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect;
4573 }
4574 break;
4575
4576 case API_AUDIO_CUSTOMER_ADEC_ATV:
4577 {
4578 adecSrc = pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Connect;
4579 }
4580 break;
4581
4582 default:
4583 break;
4584 }
4585
4586 switch(adecSrc)
4587 {
4588 case API_AUDIO_CUSTOMER_ADEC_INPUT_DTV:
4589 case API_AUDIO_CUSTOMER_ADEC_INPUT_HDMI:
4590 {
4591 cmd = MMA_PLAY;
4592 }
4593 break;
4594
4595 case API_AUDIO_CUSTOMER_ADEC_INPUT_MM:
4596 case API_AUDIO_CUSTOMER_ADEC_INPUT_CLIP:
4597 {
4598
4599 if(((adecIndex == API_AUDIO_CUSTOMER_ADEC0) && (pstAudioCustomerShmData->g_audio_customer_ADEC0_PCM_OutputPath == API_AUDIO_CUSTOMER_ADEC_PCM_PATH_MCU))||
4600 ((adecIndex == API_AUDIO_CUSTOMER_ADEC1) && (pstAudioCustomerShmData->g_audio_customer_ADEC1_PCM_OutputPath == API_AUDIO_CUSTOMER_ADEC_PCM_PATH_MCU)))
4601 {
4602 cmd = MMA_PLAY_FRAME_GS;
4603 }
4604 else
4605 {
4606 cmd = MMA_PLAY_FILE;
4607 }
4608 }
4609 break;
4610
4611 default:
4612 break;
4613 }
4614
4615 if( AUDIO_CHIP_TYPE >= API_AUDIO_CUSTOMER_CHIP_TYPE_2D1R && cmd == MMA_PLAY_FILE)
4616 {
4617 MApi_AUDIO_SetCommand(MSAPI_AUD_DVB_DECCMD_PLAYMM_FILE2);
4618 }
4619 else
4620 {
4621 MApi_AUDIO_SetAudioParam2(DecID , Audio_ParamType_playControl, (MS_U32)cmd);
4622 }
4623
4624 #if(CUSTOMIZED_INTERNAL_PATCH_SET_PLAY_CMD_BY_ADEC_SOURCE_DELAY)
4625 {
4626 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_AU_CUS_SetPlayCmdByAdecSource_Delay);
4627 }
4628 #endif
4629
4630 return TRUE;
4631 }
4632
AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM_INDEX fwm_index,API_AUDIO_CUSTOMER_FWM_INPUT fwm_input)4633 static MS_BOOL AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM_INDEX fwm_index, API_AUDIO_CUSTOMER_FWM_INPUT fwm_input)
4634 {
4635 AUDIO_MIX_VOL_TYPE VolType = PCM_VOL;
4636 MS_BOOL bATV_Mute = FALSE;
4637
4638 AU_nDBG("[fwm_index = %d] [input_channel = 0x%x] \n", (unsigned int)fwm_index, (unsigned int)fwm_input);
4639
4640 switch(fwm_index)
4641 {
4642 case API_AUDIO_CUSTOMER_FWM0:
4643 {
4644 switch(fwm_input)
4645 {
4646 case API_AUDIO_CUSTOMER_FWM_INPUT_CH5:
4647 {
4648 VolType = GAME1_VOL;
4649 if(pstAudioCustomerShmData->g_audio_customer_CH5_Sound_Connect == API_AUDIO_CUSTOMER_CH_INPUT_ADEC_ATV)
4650 {
4651 if(pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Connect != API_AUDIO_CUSTOMER_ADEC_INPUT_ATV||
4652 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_UpperPlay != API_AUDIO_CUSTOMER_UPPER_PLAY)
4653 {
4654 bATV_Mute = TRUE;
4655 }
4656 }
4657 }
4658 break;
4659
4660 case API_AUDIO_CUSTOMER_FWM_INPUT_CH6:
4661 {
4662 VolType = GAME2_VOL;
4663 if(pstAudioCustomerShmData->g_audio_customer_CH6_Sound_Connect == API_AUDIO_CUSTOMER_CH_INPUT_ADEC_ATV)
4664 {
4665 if(pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Connect != API_AUDIO_CUSTOMER_ADEC_INPUT_ATV||
4666 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_UpperPlay != API_AUDIO_CUSTOMER_UPPER_PLAY)
4667 {
4668 bATV_Mute = TRUE;
4669 }
4670 }
4671 }
4672 break;
4673
4674 case API_AUDIO_CUSTOMER_FWM_INPUT_CH8:
4675 {
4676 VolType = PCM_VOL;
4677 }
4678 break;
4679
4680 default:
4681 break;
4682 }
4683
4684 pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_final_bMute[fwm_input] =
4685 (!pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Connect[fwm_input]) |
4686 (pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_bMute[fwm_input]) |
4687 (pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_DuringLimitTime_bMute[fwm_input])|
4688 (bATV_Mute);
4689
4690 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_final_bMute[%-4d] = 0x%x] \n",(unsigned int)fwm_input, (unsigned int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_final_bMute[fwm_input] );
4691 AU_nDBG("[!pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Connect[%-4d] = 0x%x] \n",(unsigned int)fwm_input, (unsigned int)(!pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Connect[fwm_input]) );
4692 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_bMute[%-4d] = 0x%x] \n",(unsigned int)fwm_input, (unsigned int)(pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_bMute[fwm_input]) );
4693 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_DuringLimitTime_bMute[%-4d] = 0x%x] \n",(unsigned int)fwm_input, (unsigned int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_DuringLimitTime_bMute[fwm_input]);
4694 AU_nDBG("[bATV_Mute = 0x%x] \n",(unsigned int)bATV_Mute);
4695
4696 MApi_AUDIO_SetMixModeMute(E_AUDIO_INFO_GAME_IN, VolType, pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_final_bMute[fwm_input]);
4697 }
4698 break;
4699
4700 case API_AUDIO_CUSTOMER_FWM1:
4701 {
4702 //not support yet
4703 }
4704 break;
4705
4706 case API_AUDIO_CUSTOMER_FWM2:
4707 {
4708 //not support yet
4709 }
4710 break;
4711
4712 default:
4713 break;
4714 }
4715
4716 //for MS12, can't mute input channel for Dolby content.
4717 switch(fwm_input)
4718 {
4719 case API_AUDIO_CUSTOMER_FWM_INPUT_CH5:
4720 {
4721 switch(pstAudioCustomerShmData->g_audio_customer_CH5_Sound_Connect)
4722 {
4723 case API_AUDIO_CUSTOMER_CH_INPUT_ADEC0:
4724 {
4725 AU_CUS_INTERNAL_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, AU_CUS_INTERNAL_PATCH_PARAM_ADEC_SET_MUTE, &pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_final_bMute[fwm_input]);
4726 }
4727 break;
4728
4729 case API_AUDIO_CUSTOMER_CH_INPUT_ADEC1:
4730 {
4731 AU_CUS_INTERNAL_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC1, AU_CUS_INTERNAL_PATCH_PARAM_ADEC_SET_MUTE, &pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_final_bMute[fwm_input]);
4732 }
4733 break;
4734
4735 default:
4736 break;
4737 }
4738 }
4739 break;
4740
4741 case API_AUDIO_CUSTOMER_FWM_INPUT_CH6:
4742 {
4743 switch(pstAudioCustomerShmData->g_audio_customer_CH6_Sound_Connect)
4744 {
4745 case API_AUDIO_CUSTOMER_CH_INPUT_ADEC0:
4746 {
4747 AU_CUS_INTERNAL_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, AU_CUS_INTERNAL_PATCH_PARAM_ADEC_SET_MUTE, &pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_final_bMute[fwm_input]);
4748 }
4749 break;
4750
4751 case API_AUDIO_CUSTOMER_CH_INPUT_ADEC1:
4752 {
4753 AU_CUS_INTERNAL_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC1, AU_CUS_INTERNAL_PATCH_PARAM_ADEC_SET_MUTE, &pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_final_bMute[fwm_input]);
4754 }
4755 break;
4756
4757 default:
4758 break;
4759 }
4760 }
4761 break;
4762
4763 default:
4764 break;
4765 }
4766
4767 return TRUE;
4768 }
4769
AU_CUS_ESBufInit(AUDIO_DEC_ID DecID)4770 static void AU_CUS_ESBufInit(AUDIO_DEC_ID DecID)
4771 {
4772 St_Audio_Buf_Info *pESBufInfo;
4773
4774 switch(DecID)
4775 {
4776 case AU_DEC_ID1:
4777 {
4778 pESBufInfo = &ES1BufInfo;
4779 }
4780 break;
4781
4782 case AU_DEC_ID3:
4783 {
4784 pESBufInfo = &ES3BufInfo;
4785 }
4786 break;
4787
4788 case AU_DEC_ID2:
4789 default:
4790 {
4791 AU_nPRINT("[Error] [%s] [Invalid DecID: %d] \n", __FUNCTION__, DecID);
4792 pESBufInfo = &ES1BufInfo;
4793 }
4794 break;
4795 }
4796
4797 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_UNI_ES_Base, &(pESBufInfo->u32BufStartAddr_P));
4798 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_UNI_ES_Size, &(pESBufInfo->u32BufSize));
4799 pESBufInfo->u32BufEndAddr_P = pESBufInfo->u32BufStartAddr_P + pESBufInfo->u32BufSize;
4800 pESBufInfo->u32BufWptr_P = pESBufInfo->u32BufStartAddr_P;
4801 pESBufInfo->u32BufRptr_P = pESBufInfo->u32BufStartAddr_P;
4802
4803 pESBufInfo->u32BufStartAddr_V = MsOS_MPool_PA2KSEG1(pESBufInfo->u32BufStartAddr_P);
4804 pESBufInfo->u32BufEndAddr_V = pESBufInfo->u32BufStartAddr_V + pESBufInfo->u32BufSize;
4805 pESBufInfo->u32BufWptr_V = pESBufInfo->u32BufStartAddr_V;
4806 pESBufInfo->u32BufRptr_V = pESBufInfo->u32BufStartAddr_V;
4807 }
4808
AU_CUS_ExternalBufInit(void)4809 static void AU_CUS_ExternalBufInit(void )
4810 {
4811 //Eric.C: need to request one clip memory from system
4812 #if 0
4813 {
4814 if(!(MAdp_MPool_GetBlockVa( E_SYS_MMAP_AUDIO_CLIP_MEM, &(ExternalBufInfo.u32BufStartAddr_V) , &(ExternalBufInfo.u32BufSize) )))
4815 {
4816 AU_nPRINT("[Error] [%s] [Fail to get external buffer] \n", __FUNCTION__);
4817 return;
4818 }
4819 }
4820 #else
4821 {
4822 ExternalBufInfo.u32BufStartAddr_P = 0x8C600000;
4823 ExternalBufInfo.u32BufSize = 0x200000;
4824 }
4825 #endif
4826 ExternalBufInfo.u32BufEndAddr_P = ExternalBufInfo.u32BufStartAddr_P + ExternalBufInfo.u32BufSize;
4827 ExternalBufInfo.u32BufWptr_P = ExternalBufInfo.u32BufStartAddr_P;
4828 ExternalBufInfo.u32BufRptr_P = ExternalBufInfo.u32BufStartAddr_P;
4829
4830 ExternalBufInfo.u32BufStartAddr_V = MsOS_MPool_PA2KSEG1(ExternalBufInfo.u32BufStartAddr_P);
4831 ExternalBufInfo.u32BufEndAddr_V = ExternalBufInfo.u32BufStartAddr_V + ExternalBufInfo.u32BufSize;
4832 ExternalBufInfo.u32BufWptr_V = ExternalBufInfo.u32BufStartAddr_V;
4833 ExternalBufInfo.u32BufRptr_V = ExternalBufInfo.u32BufStartAddr_V;
4834 }
4835
AU_CUS_FeedingES(void * pAddr,MS_U32 u32Size,AUDIO_DEC_ID DecID,St_Audio_Buf_Info * pESBufInfo)4836 void AU_CUS_FeedingES(void* pAddr, MS_U32 u32Size, AUDIO_DEC_ID DecID, St_Audio_Buf_Info *pESBufInfo)
4837 {
4838 //AU_nPRINT("[AUDIO][%s] [%d] [ES_Wptr_V = 0x%X] [ES_Wptr_P = 0x%X]\n", __FUNCTION__, __LINE__, (unsigned int)pESBufInfo->u32BufWptr_V, (unsigned int)pESBufInfo->u32BufWptr_P);
4839 memcpy((void *)(pESBufInfo->u32BufWptr_V), pAddr, u32Size);
4840 pESBufInfo->u32BufWptr_V += u32Size;
4841 pESBufInfo->u32BufWptr_P += u32Size;
4842 MsOS_FlushMemory();
4843 MsOS_Sync();
4844 MApi_AUDIO_MM2_inputAesFinished(DecID, u32Size, FALSE, 0);
4845
4846 if( (pESBufInfo->u32BufWptr_V == pESBufInfo->u32BufEndAddr_V) && (pESBufInfo->u32BufWptr_P == pESBufInfo->u32BufEndAddr_P) )
4847 {
4848 pESBufInfo->u32BufWptr_V = pESBufInfo->u32BufStartAddr_V;
4849 pESBufInfo->u32BufWptr_P = pESBufInfo->u32BufStartAddr_P;
4850 }
4851 }
4852
AU_CUS_ClipDecoderBufInit(AUDIO_DEC_ID DecID)4853 static void AU_CUS_ClipDecoderBufInit(AUDIO_DEC_ID DecID)
4854 {
4855 MApi_AUDIO_MM2_initAesInfo(DecID);
4856
4857 AU_CUS_ESBufInit(DecID);
4858
4859 AU_CUS_ExternalBufInit();
4860
4861 switch(DecID)
4862 {
4863 case AU_DEC_ID1:
4864 {
4865 pClipDecESBufInfo = &ES1BufInfo;
4866 }
4867 break;
4868
4869 case AU_DEC_ID3:
4870 {
4871 pClipDecESBufInfo = &ES3BufInfo;
4872 }
4873 break;
4874
4875 case AU_DEC_ID2:
4876 default:
4877 break;
4878 }
4879
4880 pClipDecExtBufInfo = &ExternalBufInfo;
4881 }
4882
AU_CUS_ClipDecoderPlay(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMER_CLIP_DEC_PARAM clipInfo)4883 static void AU_CUS_ClipDecoderPlay(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_CLIP_DEC_PARAM clipInfo)
4884 {
4885 switch(adecIndex)
4886 {
4887 case API_AUDIO_CUSTOMER_ADEC0:
4888 {
4889 /* Variable setting */
4890 pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperCodec = clipInfo.clipType;
4891 pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperPlay = API_AUDIO_CUSTOMER_UPPER_PLAY;
4892
4893 if(pstAudioCustomerShmData->g_audio_customer_ADEC0_PCM_OutputPath == API_AUDIO_CUSTOMER_ADEC_PCM_PATH_MCU)
4894 {
4895 MApi_AUDIO_SetAudioParam2(pstAudioCustomerShmData->g_audio_customer_ADEC0_DecID, Audio_ParamType_playControl, MMA_PLAY_FRAME_GS);
4896 }
4897 else
4898 {
4899 MApi_AUDIO_SetAudioParam2(pstAudioCustomerShmData->g_audio_customer_ADEC0_DecID, Audio_ParamType_playControl, MMA_FREERUN);
4900 MApi_AUDIO_SetAudioParam2(pstAudioCustomerShmData->g_audio_customer_ADEC0_DecID, Audio_ParamType_playControl, MMA_PLAY_FILE);
4901 }
4902 }
4903 break;
4904
4905 case API_AUDIO_CUSTOMER_ADEC1:
4906 {
4907 /* Variable setting */
4908 pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperCodec = clipInfo.clipType;
4909 pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperPlay = API_AUDIO_CUSTOMER_UPPER_PLAY;
4910
4911 if(pstAudioCustomerShmData->g_audio_customer_ADEC1_PCM_OutputPath == API_AUDIO_CUSTOMER_ADEC_PCM_PATH_MCU)
4912 {
4913 MApi_AUDIO_SetAudioParam2(pstAudioCustomerShmData->g_audio_customer_ADEC1_DecID, Audio_ParamType_playControl, MMA_PLAY_FRAME_GS);
4914 }
4915 else
4916 {
4917 MApi_AUDIO_SetAudioParam2(pstAudioCustomerShmData->g_audio_customer_ADEC1_DecID, Audio_ParamType_playControl, MMA_FREERUN);
4918 MApi_AUDIO_SetAudioParam2(pstAudioCustomerShmData->g_audio_customer_ADEC1_DecID, Audio_ParamType_playControl, MMA_PLAY_FILE);
4919 }
4920 }
4921 break;
4922
4923 default:
4924 break;
4925 }
4926 }
4927
AU_CUS_ClipDecoderMonitor(void)4928 static void AU_CUS_ClipDecoderMonitor(void)
4929 {
4930 while(pstAudioCustomerShmData->g_audio_customer_AU_CUS_ClipDecoderMonitor_bEnable)
4931 {
4932 if( (clipDecoderInfo.bIsStart == TRUE) && (clipDecoderInfo.bIsPause == FALSE) && (clipDecoderInfo.u32RepeatNum > 0) )
4933 {
4934 MS_U32 u32RemainingSize;
4935 u32RemainingSize = pClipDecExtBufInfo->u32BufWptr_V - pClipDecExtBufInfo->u32BufRptr_V;
4936
4937 if(u32RemainingSize > 0)
4938 {
4939 AES_INFO clipDecESInfo = {0,};
4940 MApi_AUDIO_MM2_checkAesInfo(clipDecoderInfo.decID, &clipDecESInfo);
4941 //AU_nPRINT("[AUDIO][%s] [%d] [DecID: %u] [u32RemainingSize = 0x%X] [u32FreeSpace = 0x%X] \n", __FUNCTION__, __LINE__, (unsigned int)clipDecoderInfo.decID, (unsigned int)u32RemainingSize, (unsigned int)clipDecESInfo.aes_freeSpace);
4942
4943 if(u32RemainingSize <= clipDecESInfo.aes_freeSpace)
4944 {
4945 AU_CUS_FeedingES((void*)(pClipDecExtBufInfo->u32BufRptr_V), u32RemainingSize, clipDecoderInfo.decID, pClipDecESBufInfo);
4946 pClipDecExtBufInfo->u32BufRptr_V += u32RemainingSize;
4947 //AU_nPRINT("[AUDIO][%s] [%d] [No remaining ES data] [Remaining repeat time: %u] \n", __FUNCTION__, __LINE__, (unsigned int)clipDecoderInfo.u32RepeatNum);
4948 }
4949 else
4950 {
4951 if(clipDecESInfo.aes_freeSpace > 0)
4952 {
4953 //AU_nPRINT("[AUDIO][%s] [%d] [Feeding data] [u32BufWptr_V = 0x%X] [u32BufRptr_V = 0x%X] \n", __FUNCTION__, __LINE__, (unsigned int)pClipDecExtBufInfo->u32BufWptr_V, (unsigned int)pClipDecExtBufInfo->u32BufRptr_V);
4954 AU_CUS_FeedingES((void*)(pClipDecExtBufInfo->u32BufRptr_V), clipDecESInfo.aes_freeSpace, clipDecoderInfo.decID, pClipDecESBufInfo);
4955 pClipDecExtBufInfo->u32BufRptr_V += clipDecESInfo.aes_freeSpace;
4956 }
4957 }
4958 }
4959 else
4960 {
4961 MS_U32 u32PCMlevel = 0;
4962 static MS_U32 u32TimeOutCnt = 0;
4963 MApi_AUDIO_GetAudioInfo2(clipDecoderInfo.decID, Audio_infoType_pcmBuf_currLevel, &u32PCMlevel);
4964 //AU_nPRINT("[AUDIO][%s] [%d] [Wait PCM buffer(0x%X) empty] [Time-Out count: %u]\n", __FUNCTION__, __LINE__, (unsigned int)u32PCMlevel, (unsigned int)u32TimeOutCnt);
4965
4966 //Wait all PCM data output from PCM buffer until time out
4967 if(u32PCMlevel == 0 && u32TimeOutCnt > 100)
4968 {
4969 u32TimeOutCnt = 0;
4970 clipDecoderInfo.u32RepeatNum --;
4971 if(clipDecoderInfo.u32RepeatNum > 0)
4972 {
4973 // Reset ADEC
4974 MApi_AUDIO_SetAudioParam2(clipDecoderInfo.decID, Audio_ParamType_playControl, MMA_STOP);
4975 // Make sure R2 receives stop command
4976 AU_CUS_Delay1MS(2);
4977
4978 // Init Buffer
4979 AU_CUS_ClipDecoderBufInit(clipDecoderInfo.decID);
4980 memset((void *)(pClipDecESBufInfo->u32BufStartAddr_V), 0, pClipDecESBufInfo->u32BufSize);
4981
4982 pClipDecExtBufInfo->u32BufWptr_V += clipDecoderInfo.u32Size;
4983
4984 //When AP call stop or pause, there is timing issue if AU_CUS_ClipDecoderMonitor already execute here.
4985 //So check here again.
4986 if( (clipDecoderInfo.bIsStart == TRUE) && (clipDecoderInfo.bIsPause == FALSE) )
4987 {
4988 if(pstAudioCustomerShmData->g_audio_customer_ADEC0_PCM_OutputPath == API_AUDIO_CUSTOMER_ADEC_PCM_PATH_MCU)
4989 {
4990 MApi_AUDIO_SetAudioParam2(clipDecoderInfo.decID, Audio_ParamType_playControl, MMA_PLAY_FRAME_GS);
4991 }
4992 else
4993 {
4994 MApi_AUDIO_SetAudioParam2(clipDecoderInfo.decID, Audio_ParamType_playControl, MMA_PLAY_FILE);
4995 }
4996 //AU_nPRINT("[AUDIO][%s] [%d] [Play next clip with DecID(%d)] [Remaining repeat time: %u] \n", __FUNCTION__, __LINE__, (int)clipDecoderInfo.decID, (unsigned int)clipDecoderInfo.u32RepeatNum);
4997 }
4998 else
4999 {
5000 AU_nPRINT("[AUDIO][%s] [%d] [Can't play next clip] [bIsStart: %u] [bIsPause: %u]\n", __FUNCTION__, __LINE__, (unsigned int)clipDecoderInfo.bIsStart, (unsigned int)clipDecoderInfo.bIsPause);
5001 }
5002 }
5003 else
5004 {
5005 MApi_AUDIO_SetAudioParam2(clipDecoderInfo.decID, Audio_ParamType_playControl, MMA_STOP);
5006 clipDecoderInfo.bIsStart = FALSE;
5007 pClipDecExtBufInfo->u32BufRptr_V = pClipDecExtBufInfo->u32BufStartAddr_V;
5008 pClipDecExtBufInfo->u32BufWptr_V = pClipDecExtBufInfo->u32BufStartAddr_V;
5009 if(madCallBack.pFunc_ClipDec != NULL)
5010 {
5011 madCallBack.pFunc_ClipDec(clipDecoderInfo.u8Sink);
5012 }
5013 //AU_nPRINT("[AUDIO][%s] [%d] [Clip decoder finish !!] \n", __FUNCTION__, __LINE__);
5014 }
5015 }
5016 else
5017 {
5018 u32TimeOutCnt ++;
5019 }
5020 }
5021 }
5022
5023 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_AU_ClipDecoderMonitor_Interval);
5024 }
5025 }
5026
5027 /* MP3 Encoder Function */
AU_CUS_MP3EncCallBack(MS_U8 * pCopyBuffer,MS_U16 copyLenth)5028 static void AU_CUS_MP3EncCallBack(MS_U8 *pCopyBuffer, MS_U16 copyLenth)
5029 {
5030 API_AUDIO_CUSTOMER_AENC_DATA mp3EncInfo;
5031
5032 if(pAU_MP3EncDumpFile != NULL)
5033 {
5034 AU_CUS_FileWrite((void*)pCopyBuffer, sizeof(MS_U8) , copyLenth, pAU_MP3EncDumpFile);
5035 }
5036 else
5037 {
5038 AU_nPRINT("[Error] [%s] [please open MP3EncDump.mp3 at first] \n", __FUNCTION__);
5039 }
5040
5041 if(firstGetEncodeTimeFlag == TRUE)
5042 {
5043 mp3EncInfo.pts = 0;
5044 encStartTime = MsOS_GetSystemTime();
5045 firstGetEncodeTimeFlag = FALSE;
5046 }
5047 else
5048 {
5049 mp3EncInfo.pts = (MS_U64)(((MS_U64)MsOS_GetSystemTime() - encStartTime + 90)*90);
5050 }
5051
5052 mp3EncInfo.encFormat = API_AUDIO_CUSTOMER_AENC_ENCODE_MP3;
5053 mp3EncInfo.pData = (MS_U8 *)pCopyBuffer;
5054 mp3EncInfo.dataLen = copyLenth;
5055 mp3EncInfo.pRStart = (MS_U8 *)pCopyBuffer;
5056 mp3EncInfo.pREnd = mp3EncInfo.pRStart + copyLenth;
5057 #if 0
5058 AU_nPRINT("[AUDIO][mp3EncInfo.index = 0x%x] \n", (unsigned int)mp3EncInfo.index);
5059 AU_nPRINT("[AUDIO][mp3EncInfo.pts = %llu] \n", mp3EncInfo.pts);
5060 AU_nPRINT("[AUDIO][mp3EncInfo.pData = 0x%x] \n", mp3EncInfo.pData);
5061 AU_nPRINT("[AUDIO][mp3EncInfo.dataLen = 0x%x] \n", (unsigned int)mp3EncInfo.dataLen);
5062 AU_nPRINT("[AUDIO][mp3EncInfo.pRStart = 0x%x] \n", mp3EncInfo.pRStart);
5063 AU_nPRINT("[AUDIO][mp3EncInfo.pREnd = 0x%x] \n", mp3EncInfo.pREnd);
5064 #endif
5065
5066 if(madCallBack.pFunc_AencMP3 != NULL)
5067 {
5068 madCallBack.pFunc_AencMP3(&mp3EncInfo);
5069 }
5070
5071 }
5072
AU_CUS_MP3EncodeMonitor(void)5073 static void AU_CUS_MP3EncodeMonitor(void)
5074 {
5075 while(pstAudioCustomerShmData->g_audio_customer_AU_CUS_MP3EncodeMonitor_bEnable)
5076 {
5077 if(pstAudioCustomerShmData->g_audio_customer_MP3_ENC_bEnable == TRUE)
5078 {
5079 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
5080 {
5081 mutex_lock(&AU_Customer_MP3Encode_mutex_lock);
5082 }
5083 #else //User Space
5084 {
5085 OS_OBTAIN_MUTEX(AU_Customer_MP3Encode_mutex_lock, MSOS_WAIT_FOREVER);
5086 }
5087 #endif
5088
5089 memset((void *)pMP3EncBuffer, 0x00, MP3_REQUEST_BYTES);
5090 if(MApi_AUDIO_PCMCapture_Read(E_DEVICE2, (void *)pMP3EncBuffer, MP3_REQUEST_BYTES) == TRUE)
5091 {
5092 retryCounterMP3Encode = 0;
5093
5094 if(madCallBack.pFunc_MP3Encode != NULL)
5095 {
5096 madCallBack.pFunc_MP3Encode(pMP3EncBuffer, MP3_REQUEST_BYTES);
5097 }
5098 }
5099 else
5100 {
5101 retryCounterMP3Encode++;
5102 if (retryCounterMP3Encode > 10)
5103 {
5104 AU_nPRINT("Warning: MP3 encode capture retry too much (0x%x) !!!!!\n", (unsigned int)retryCounterMP3Encode);
5105 }
5106 }
5107
5108 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
5109 {
5110 mutex_unlock(&AU_Customer_MP3Encode_mutex_lock);
5111 }
5112 #else //User Space
5113 {
5114 OS_RELEASE_MUTEX(AU_Customer_MP3Encode_mutex_lock);
5115 }
5116 #endif
5117 }
5118
5119 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_AU_MP3EncodeMonitor_Interval);
5120 }
5121 }
5122
AU_CUS_MP3EncodeInit(void * pCallBackFunc,AUDIO_CAPTURE_SOURCE_TYPE sourceType)5123 static MS_BOOL AU_CUS_MP3EncodeInit(void *pCallBackFunc, AUDIO_CAPTURE_SOURCE_TYPE sourceType)
5124 {
5125 madCallBack.pFunc_MP3Encode = pCallBackFunc;
5126
5127 if(pCallBackFunc != NULL)
5128 {
5129 //alloc memory for MP3 encoded buffer
5130 pMP3EncBuffer = AU_CUS_MemoryAlloc(MP3_REQUEST_BYTES);
5131
5132 if(pMP3EncBuffer == NULL)
5133 {
5134 AU_nPRINT("[pMP3EncBuffer cannot malloc]\n");
5135 return FALSE;
5136 }
5137 }
5138 else
5139 {
5140 AU_nPRINT("[pCallBackFunc is NULL] \n");
5141 return FALSE;
5142 }
5143
5144 //Init PCM capture driver
5145 MApi_AUDIO_PCMCapture_Init(E_DEVICE2, sourceType);
5146 MApi_AUDIO_PCMCapture_Start(E_DEVICE2);
5147
5148 return TRUE;
5149 }
5150
5151 /* Initialize, STR */
5152
5153 /* Connect & Disconnect */
AU_CUS_ADEC_Connect(API_AUDIO_CUSTOMER_ADEC_INDEX currentConnect,API_AUDIO_CUSTOMER_ADEC_INPUT inputConnect)5154 MS_BOOL AU_CUS_ADEC_Connect(API_AUDIO_CUSTOMER_ADEC_INDEX currentConnect, API_AUDIO_CUSTOMER_ADEC_INPUT inputConnect)
5155 {
5156 AUDIO_INPUT_TYPE enSource = AUDIO_NULL_INPUT;
5157 AUDIO_SWITCH_GROUP enGroup = E_AUDIO_GROUP_INVALID;
5158 MS_BOOL bNeed_Set_CH_input = FALSE;
5159
5160 AU_nDBG("[currentConnect = 0x%x] [inputConnect = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect);
5161
5162 switch(currentConnect)
5163 {
5164 case API_AUDIO_CUSTOMER_ADEC0:
5165 {
5166 pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect = inputConnect;
5167
5168 if(pstAudioCustomerShmData->g_audio_customer_CH5_Sound_Connect == API_AUDIO_CUSTOMER_CH_INPUT_ADEC0)
5169 {
5170 enSource = AU_CUS_ConvertCustomerChInputToDriverInputType(API_AUDIO_CUSTOMER_CH_INPUT_ADEC0);
5171 enGroup = E_AUDIO_GROUP_MAIN;
5172 bNeed_Set_CH_input = TRUE;
5173 }
5174 if(pstAudioCustomerShmData->g_audio_customer_CH6_Sound_Connect == API_AUDIO_CUSTOMER_CH_INPUT_ADEC0)
5175 {
5176 enSource = AU_CUS_ConvertCustomerChInputToDriverInputType(API_AUDIO_CUSTOMER_CH_INPUT_ADEC0);
5177 enGroup = E_AUDIO_GROUP_SUB;
5178 bNeed_Set_CH_input = TRUE;
5179 }
5180 if(pstAudioCustomerShmData->g_audio_customer_CH7_Sound_Connect == API_AUDIO_CUSTOMER_CH_INPUT_ADEC0)
5181 {
5182 enSource = AU_CUS_ConvertCustomerChInputToDriverInputType(API_AUDIO_CUSTOMER_CH_INPUT_ADEC0);
5183 enGroup = E_AUDIO_GROUP_SCART;
5184 bNeed_Set_CH_input = TRUE;
5185 }
5186 }
5187 break;
5188
5189 case API_AUDIO_CUSTOMER_ADEC1:
5190 {
5191 pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect = inputConnect;
5192
5193 if(pstAudioCustomerShmData->g_audio_customer_CH5_Sound_Connect == API_AUDIO_CUSTOMER_CH_INPUT_ADEC1)
5194 {
5195 enSource = AU_CUS_ConvertCustomerChInputToDriverInputType(API_AUDIO_CUSTOMER_CH_INPUT_ADEC1);
5196 enGroup = E_AUDIO_GROUP_MAIN;
5197 bNeed_Set_CH_input = TRUE;
5198 }
5199 if(pstAudioCustomerShmData->g_audio_customer_CH6_Sound_Connect == API_AUDIO_CUSTOMER_CH_INPUT_ADEC1)
5200 {
5201 enSource = AU_CUS_ConvertCustomerChInputToDriverInputType(API_AUDIO_CUSTOMER_CH_INPUT_ADEC1);
5202 enGroup = E_AUDIO_GROUP_SUB;
5203 bNeed_Set_CH_input = TRUE;
5204 }
5205 if(pstAudioCustomerShmData->g_audio_customer_CH7_Sound_Connect == API_AUDIO_CUSTOMER_CH_INPUT_ADEC1)
5206 {
5207 enSource = AU_CUS_ConvertCustomerChInputToDriverInputType(API_AUDIO_CUSTOMER_CH_INPUT_ADEC1);
5208 enGroup = E_AUDIO_GROUP_SCART;
5209 bNeed_Set_CH_input = TRUE;
5210 }
5211 }
5212 break;
5213
5214 case API_AUDIO_CUSTOMER_ADEC_ATV:
5215 {
5216 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Connect = inputConnect;
5217
5218 if(pstAudioCustomerShmData->g_audio_customer_CH5_Sound_Connect == API_AUDIO_CUSTOMER_CH_INPUT_ADEC_ATV)
5219 {
5220 enSource = AU_CUS_ConvertCustomerChInputToDriverInputType(API_AUDIO_CUSTOMER_CH_INPUT_ADEC_ATV);
5221 enGroup = E_AUDIO_GROUP_MAIN;
5222 bNeed_Set_CH_input = TRUE;
5223 AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5);
5224 }
5225 if(pstAudioCustomerShmData->g_audio_customer_CH6_Sound_Connect == API_AUDIO_CUSTOMER_CH_INPUT_ADEC_ATV)
5226 {
5227 enSource = AU_CUS_ConvertCustomerChInputToDriverInputType(API_AUDIO_CUSTOMER_CH_INPUT_ADEC_ATV);
5228 enGroup = E_AUDIO_GROUP_SUB;
5229 bNeed_Set_CH_input = TRUE;
5230 AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH6);
5231 }
5232 if(pstAudioCustomerShmData->g_audio_customer_CH7_Sound_Connect == API_AUDIO_CUSTOMER_CH_INPUT_ADEC_ATV)
5233 {
5234 enSource = AU_CUS_ConvertCustomerChInputToDriverInputType(API_AUDIO_CUSTOMER_CH_INPUT_ADEC_ATV);
5235 enGroup = E_AUDIO_GROUP_SCART;
5236 bNeed_Set_CH_input = TRUE;
5237 }
5238 }
5239 break;
5240 default:
5241 break;
5242 }
5243
5244 if(pstAudioCustomerShmData->g_audio_customer_MainDecoderOutput == API_AUDIO_CUSTOMER_ADEC0)
5245 {
5246 AU_CUS_SetSourceInfo(AU_CUS_ConvertCustomerADECSourceToDriverSourceType(pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect));
5247 }
5248 else if(pstAudioCustomerShmData->g_audio_customer_MainDecoderOutput == API_AUDIO_CUSTOMER_ADEC1)
5249 {
5250 AU_CUS_SetSourceInfo(AU_CUS_ConvertCustomerADECSourceToDriverSourceType(pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect));
5251 }
5252 else if(pstAudioCustomerShmData->g_audio_customer_MainDecoderOutput == API_AUDIO_CUSTOMER_ADEC_ATV)
5253 {
5254 AU_CUS_SetSourceInfo(AU_CUS_ConvertCustomerADECSourceToDriverSourceType(pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Connect));
5255 }
5256
5257 if(bNeed_Set_CH_input)
5258 {
5259 AU_CUS_InputSwitch(enSource, enGroup);
5260 }
5261
5262 return TRUE;
5263 }
5264
AU_CUS_ADEC_Disconnect(API_AUDIO_CUSTOMER_ADEC_INDEX currentConnect)5265 MS_BOOL AU_CUS_ADEC_Disconnect(API_AUDIO_CUSTOMER_ADEC_INDEX currentConnect)
5266 {
5267 AU_nDBG("[currentConnect = 0x%x] \n", (unsigned int)currentConnect);
5268
5269 switch(currentConnect)
5270 {
5271 case API_AUDIO_CUSTOMER_ADEC0:
5272 {
5273 pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect = API_AUDIO_CUSTOMER_ADEC_INPUT_NONE;
5274 }
5275 break;
5276
5277 case API_AUDIO_CUSTOMER_ADEC1:
5278 {
5279 pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect = API_AUDIO_CUSTOMER_ADEC_INPUT_NONE;
5280 }
5281 break;
5282
5283 case API_AUDIO_CUSTOMER_ADEC_ATV:
5284 {
5285 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Connect = API_AUDIO_CUSTOMER_ADEC_INPUT_NONE;
5286 AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5);
5287 AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH6);
5288 }
5289 break;
5290 default:
5291 break;
5292 }
5293
5294 //let HDMI RX monitor alive when next HDMI Connect.
5295 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type = API_AUDIO_CUSTOMER_CODEC_TYPE_UNKNOWN;
5296 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Previous_Codec_Type = API_AUDIO_CUSTOMER_CODEC_TYPE_UNKNOWN;
5297
5298 return TRUE;
5299 }
5300
AU_CUS_ADC_Connect(API_AUDIO_CUSTOMER_ADC_INDEX currentConnect,API_AUDIO_CUSTOMER_ADC_IN_PORT portNum)5301 MS_BOOL AU_CUS_ADC_Connect(API_AUDIO_CUSTOMER_ADC_INDEX currentConnect, API_AUDIO_CUSTOMER_ADC_IN_PORT portNum)
5302 {
5303 AU_nDBG("[currentConnect = 0x%x][portNum = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)portNum);
5304
5305 switch(currentConnect)
5306 {
5307 case API_AUDIO_CUSTOMER_ADC0:
5308 {
5309 pstAudioCustomerShmData->g_audio_customer_ADC0_Connect = portNum;
5310 }
5311 break;
5312 case API_AUDIO_CUSTOMER_ADC1:
5313 {
5314 pstAudioCustomerShmData->g_audio_customer_ADC1_Connect = portNum;
5315 }
5316 break;
5317 default:
5318 break;
5319 }
5320
5321 return TRUE;
5322 }
5323
AU_CUS_ADC_Disconnect(API_AUDIO_CUSTOMER_ADC_INDEX currentConnect,API_AUDIO_CUSTOMER_ADC_IN_PORT portNum)5324 MS_BOOL AU_CUS_ADC_Disconnect(API_AUDIO_CUSTOMER_ADC_INDEX currentConnect, API_AUDIO_CUSTOMER_ADC_IN_PORT portNum)
5325 {
5326 AU_nDBG("[currentConnect = 0x%x][portNum = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)portNum);
5327
5328 switch(currentConnect)
5329 {
5330 case API_AUDIO_CUSTOMER_ADC0:
5331 {
5332 pstAudioCustomerShmData->g_audio_customer_ADC0_Connect = API_AUDIO_CUSTOMER_ADC_IN_PORT_INVALID;
5333 }
5334 break;
5335 case API_AUDIO_CUSTOMER_ADC1:
5336 {
5337 pstAudioCustomerShmData->g_audio_customer_ADC1_Connect = API_AUDIO_CUSTOMER_ADC_IN_PORT_INVALID;
5338 }
5339 break;
5340 default:
5341 break;
5342 }
5343
5344 return TRUE;
5345 }
5346
AU_CUS_CH_Sound_Connect(API_AUDIO_CUSTOMER_CH_SOUND currentConnect,API_AUDIO_CUSTOMER_CH_INPUT inputConnect)5347 MS_BOOL AU_CUS_CH_Sound_Connect(API_AUDIO_CUSTOMER_CH_SOUND currentConnect, API_AUDIO_CUSTOMER_CH_INPUT inputConnect)
5348 {
5349 AUDIO_INPUT_TYPE enSource = AUDIO_NULL_INPUT;
5350 AUDIO_SWITCH_GROUP enGroup = E_AUDIO_GROUP_INVALID;
5351
5352 AU_nDBG("[currectChannel = 0x%x] [inputConnect = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect);
5353
5354 switch(currentConnect)
5355 {
5356 case API_AUDIO_CUSTOMER_CH5_SOUND:
5357 {
5358 enSource = AU_CUS_ConvertCustomerChInputToDriverInputType(inputConnect);
5359 enGroup = E_AUDIO_GROUP_MAIN;
5360 pstAudioCustomerShmData->g_audio_customer_CH5_Sound_Connect = inputConnect;
5361 AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5);
5362 AU_CUS_SetSourceInfo(AU_CUS_ConvertCustomerChInputToDriverSourceInfoType(pstAudioCustomerShmData->g_audio_customer_CH5_Sound_Connect));
5363
5364 #if(CUSTOMIZED_INTERNAL_PATCH_PARAM_SNDR2_MS12_PCMR_METADATA_SELECT)
5365 {
5366 switch(pstAudioCustomerShmData->g_audio_customer_CH5_Sound_Connect)
5367 {
5368 case API_AUDIO_CUSTOMER_CH_INPUT_ADEC0:
5369 case API_AUDIO_CUSTOMER_CH_INPUT_ADEC1:
5370 {
5371 API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT metadata_Select = API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT_DEC;
5372 AU_CUS_INTERNAL_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, AU_CUS_INTERNAL_PATCH_PARAM_SNDR2_MS12_PCMR_METADATA_SELECT, &metadata_Select);
5373 }
5374 break;
5375
5376 default:
5377 {
5378 API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT metadata_Select = API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT_DMX;
5379 AU_CUS_INTERNAL_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, AU_CUS_INTERNAL_PATCH_PARAM_SNDR2_MS12_PCMR_METADATA_SELECT, &metadata_Select);
5380 }
5381 break;
5382 }
5383 }
5384 #endif
5385 }
5386 break;
5387
5388 case API_AUDIO_CUSTOMER_CH6_SOUND:
5389 {
5390 enSource = AU_CUS_ConvertCustomerChInputToDriverInputType(inputConnect);
5391 enGroup = E_AUDIO_GROUP_SUB;
5392 pstAudioCustomerShmData->g_audio_customer_CH6_Sound_Connect = inputConnect;
5393 AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH6);
5394 }
5395 break;
5396
5397 case API_AUDIO_CUSTOMER_CH7_SOUND:
5398 {
5399 enSource = AU_CUS_ConvertCustomerChInputToDriverInputType(inputConnect);
5400 enGroup = E_AUDIO_GROUP_SCART;
5401 pstAudioCustomerShmData->g_audio_customer_CH7_Sound_Connect = inputConnect;
5402 }
5403 break;
5404 default:
5405 break;
5406 }
5407
5408 AU_CUS_InputSwitch(enSource, enGroup);
5409
5410 //AU_CUS_InputSwitch will change internal path setting, need to reset to customer's setting here.
5411 AU_CUS_SetDspInternalPath(API_AUDIO_CUSTOMER_SOUNDOUT_I2S, pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_Connect);
5412 AU_CUS_SetDspInternalPath(API_AUDIO_CUSTOMER_SOUNDOUT_LINEOUT0, pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_Connect);
5413 AU_CUS_SetDspInternalPath(API_AUDIO_CUSTOMER_SOUNDOUT_LINEOUT1, pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_Connect);
5414 AU_CUS_SetDspInternalPath(API_AUDIO_CUSTOMER_SOUNDOUT_LINEOUT2, pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_Connect);
5415 AU_CUS_SetDspInternalPath(API_AUDIO_CUSTOMER_SOUNDOUT_LINEOUT3, pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_Connect);
5416 AU_CUS_SetDspInternalPath(API_AUDIO_CUSTOMER_SOUNDOUT_SPDIF, pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_Connect);
5417 AU_CUS_SetDspInternalPath(API_AUDIO_CUSTOMER_SOUNDOUT_HDMI_ARC, pstAudioCustomerShmData->g_audio_customer_Sound_Out_ARC_Connect);
5418 AU_CUS_SetDspInternalPath(API_AUDIO_CUSTOMER_SOUNDOUT_HDMI_TX, pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_Connect);
5419
5420 return TRUE;
5421 }
5422
AU_CUS_CH_Sound_Disconnect(API_AUDIO_CUSTOMER_CH_SOUND currentConnect,API_AUDIO_CUSTOMER_CH_INPUT inputConnect)5423 MS_BOOL AU_CUS_CH_Sound_Disconnect(API_AUDIO_CUSTOMER_CH_SOUND currentConnect, API_AUDIO_CUSTOMER_CH_INPUT inputConnect)
5424 {
5425 AUDIO_INPUT_TYPE enSource = AUDIO_NULL_INPUT;
5426 AUDIO_SWITCH_GROUP enGroup = E_AUDIO_GROUP_INVALID;
5427
5428 AU_nDBG("[currectChannel = 0x%x] [inputConnect = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect);
5429
5430 switch(currentConnect)
5431 {
5432 case API_AUDIO_CUSTOMER_CH5_SOUND:
5433 {
5434 pstAudioCustomerShmData->g_audio_customer_CH5_Sound_Connect = API_AUDIO_CUSTOMER_CH_INPUT_NONE;
5435 enGroup = E_AUDIO_GROUP_MAIN;
5436 }
5437 break;
5438
5439 case API_AUDIO_CUSTOMER_CH6_SOUND:
5440 {
5441 pstAudioCustomerShmData->g_audio_customer_CH6_Sound_Connect = API_AUDIO_CUSTOMER_CH_INPUT_NONE;
5442 enGroup = E_AUDIO_GROUP_SUB;
5443 }
5444 break;
5445
5446 case API_AUDIO_CUSTOMER_CH7_SOUND:
5447 {
5448 pstAudioCustomerShmData->g_audio_customer_CH7_Sound_Connect = API_AUDIO_CUSTOMER_CH_INPUT_NONE;
5449 enGroup = E_AUDIO_GROUP_SCART;
5450 }
5451 break;
5452 default:
5453 break;
5454 }
5455
5456 enSource = AUDIO_NULL_INPUT;
5457
5458 AU_CUS_InputSwitch(enSource, enGroup);
5459
5460 //AU_CUS_InputSwitch will change internal path setting, need to reset to customer's setting here.
5461 AU_CUS_SetDspInternalPath(API_AUDIO_CUSTOMER_SOUNDOUT_I2S, pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_Connect);
5462 AU_CUS_SetDspInternalPath(API_AUDIO_CUSTOMER_SOUNDOUT_LINEOUT0, pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_Connect);
5463 AU_CUS_SetDspInternalPath(API_AUDIO_CUSTOMER_SOUNDOUT_LINEOUT1, pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_Connect);
5464 AU_CUS_SetDspInternalPath(API_AUDIO_CUSTOMER_SOUNDOUT_LINEOUT2, pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_Connect);
5465 AU_CUS_SetDspInternalPath(API_AUDIO_CUSTOMER_SOUNDOUT_LINEOUT3, pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_Connect);
5466 AU_CUS_SetDspInternalPath(API_AUDIO_CUSTOMER_SOUNDOUT_SPDIF, pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_Connect);
5467 AU_CUS_SetDspInternalPath(API_AUDIO_CUSTOMER_SOUNDOUT_HDMI_ARC, pstAudioCustomerShmData->g_audio_customer_Sound_Out_ARC_Connect);
5468 AU_CUS_SetDspInternalPath(API_AUDIO_CUSTOMER_SOUNDOUT_HDMI_TX, pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_Connect);
5469
5470 return TRUE;
5471 }
5472
AU_CUS_FW_MIXER_Connect(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect,API_AUDIO_CUSTOMER_FWM_INPUT inputConnect)5473 MS_BOOL AU_CUS_FW_MIXER_Connect(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect, API_AUDIO_CUSTOMER_FWM_INPUT inputConnect)
5474 {
5475 AU_nDBG("[currentConnect = 0x%x] [inputConnect = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect);
5476
5477 switch(currentConnect)
5478 {
5479 case API_AUDIO_CUSTOMER_FWM0:
5480 {
5481 pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Connect[inputConnect] = TRUE;
5482 AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM0, inputConnect);
5483 }
5484 break;
5485
5486 case API_AUDIO_CUSTOMER_FWM1:
5487 {
5488 pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Connect[inputConnect] = TRUE;
5489 AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM1, inputConnect);
5490 }
5491 break;
5492
5493 case API_AUDIO_CUSTOMER_FWM2:
5494 {
5495 pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Connect[inputConnect] = TRUE;
5496 AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM2, inputConnect);
5497 }
5498 break;
5499
5500 default:
5501 break;
5502 }
5503
5504 return TRUE;
5505 }
5506
AU_CUS_FW_MIXER_Disconnect(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect,API_AUDIO_CUSTOMER_FWM_INPUT inputConnect)5507 MS_BOOL AU_CUS_FW_MIXER_Disconnect(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect, API_AUDIO_CUSTOMER_FWM_INPUT inputConnect)
5508 {
5509 AU_nDBG("[currentConnect = 0x%x] [inputConnect = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect);
5510
5511 switch(currentConnect)
5512 {
5513 case API_AUDIO_CUSTOMER_FWM0:
5514 {
5515 pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Connect[inputConnect] = FALSE;
5516 AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM0, inputConnect);
5517 }
5518 break;
5519
5520 case API_AUDIO_CUSTOMER_FWM1:
5521 {
5522 pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Connect[inputConnect] = FALSE;
5523 AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM1, inputConnect);
5524 }
5525 break;
5526
5527 case API_AUDIO_CUSTOMER_FWM2:
5528 {
5529 pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Connect[inputConnect] = FALSE;
5530 AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM2, inputConnect);
5531 }
5532 break;
5533
5534 default:
5535 break;
5536 }
5537
5538 return TRUE;
5539 }
5540
AU_CUS_SNDOUT_Connect(API_AUDIO_CUSTOMER_SOUNDOUT_INDEX currentConnect,API_AUDIO_CUSTOMER_SOUNDOUT_INPUT inputConnect)5541 MS_BOOL AU_CUS_SNDOUT_Connect(API_AUDIO_CUSTOMER_SOUNDOUT_INDEX currentConnect, API_AUDIO_CUSTOMER_SOUNDOUT_INPUT inputConnect)
5542 {
5543 AU_nDBG("[currentConnect = 0x%x] [inputConnect = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect);
5544
5545 API_AUDIO_CUSTOMER_SOUNDOUT_INPUT *pConnet = NULL;
5546
5547 switch(currentConnect)
5548 {
5549 case API_AUDIO_CUSTOMER_SOUNDOUT_I2S:
5550 pConnet = &pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_Connect;
5551 break;
5552
5553 case API_AUDIO_CUSTOMER_SOUNDOUT_LINEOUT0:
5554 pConnet = &pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_Connect;
5555 break;
5556
5557 case API_AUDIO_CUSTOMER_SOUNDOUT_LINEOUT1:
5558 pConnet = &pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_Connect;
5559 break;
5560
5561 case API_AUDIO_CUSTOMER_SOUNDOUT_LINEOUT2:
5562 pConnet = &pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_Connect;
5563 break;
5564
5565 case API_AUDIO_CUSTOMER_SOUNDOUT_LINEOUT3:
5566 pConnet = &pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_Connect;
5567 break;
5568
5569 case API_AUDIO_CUSTOMER_SOUNDOUT_SPDIF:
5570 pConnet = &pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_Connect;
5571 break;
5572
5573 case API_AUDIO_CUSTOMER_SOUNDOUT_HDMI_ARC:
5574 pConnet = &pstAudioCustomerShmData->g_audio_customer_Sound_Out_ARC_Connect;
5575 break;
5576
5577 case API_AUDIO_CUSTOMER_SOUNDOUT_HDMI_TX:
5578 pConnet = &pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_Connect;
5579 break;
5580
5581 default:
5582 break;
5583 }
5584
5585 if(pConnet != NULL)
5586 {
5587 *pConnet = inputConnect;
5588 AU_CUS_SetDspInternalPath(currentConnect, inputConnect);
5589 return TRUE;
5590 }
5591 else
5592 {
5593 return FALSE;
5594 }
5595 }
5596
AU_CUS_SNDOUT_Disconnect(API_AUDIO_CUSTOMER_SOUNDOUT_INDEX currentConnect,API_AUDIO_CUSTOMER_SOUNDOUT_INPUT inputConnect)5597 MS_BOOL AU_CUS_SNDOUT_Disconnect(API_AUDIO_CUSTOMER_SOUNDOUT_INDEX currentConnect, API_AUDIO_CUSTOMER_SOUNDOUT_INPUT inputConnect)
5598 {
5599 AU_nDBG("[currentConnect = 0x%x] [inputConnect = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect);
5600
5601 API_AUDIO_CUSTOMER_SOUNDOUT_INPUT *pConnet = NULL;
5602
5603 switch(currentConnect)
5604 {
5605 case API_AUDIO_CUSTOMER_SOUNDOUT_I2S:
5606 pConnet = &pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_Connect;
5607 break;
5608
5609 case API_AUDIO_CUSTOMER_SOUNDOUT_LINEOUT0:
5610 pConnet = &pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_Connect;
5611 break;
5612
5613 case API_AUDIO_CUSTOMER_SOUNDOUT_LINEOUT1:
5614 pConnet = &pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_Connect;
5615 break;
5616
5617 case API_AUDIO_CUSTOMER_SOUNDOUT_LINEOUT2:
5618 pConnet = &pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_Connect;
5619 break;
5620
5621 case API_AUDIO_CUSTOMER_SOUNDOUT_LINEOUT3:
5622 pConnet = &pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_Connect;
5623 break;
5624
5625 case API_AUDIO_CUSTOMER_SOUNDOUT_SPDIF:
5626 pConnet = &pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_Connect;
5627 break;
5628
5629 case API_AUDIO_CUSTOMER_SOUNDOUT_HDMI_ARC:
5630 pConnet = &pstAudioCustomerShmData->g_audio_customer_Sound_Out_ARC_Connect;
5631 break;
5632
5633 case API_AUDIO_CUSTOMER_SOUNDOUT_HDMI_TX:
5634 pConnet = &pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_Connect;
5635 break;
5636
5637 default:
5638 break;
5639 }
5640
5641 if(pConnet != NULL)
5642 {
5643 *pConnet = API_AUDIO_CUSTOMER_SOUNDOUT_INPUT_NULL;
5644 AU_CUS_SetDspInternalPath(currentConnect, API_AUDIO_CUSTOMER_SOUNDOUT_INPUT_NULL);
5645 return TRUE;
5646 }
5647 else
5648 {
5649 return FALSE;
5650 }
5651 }
5652
AU_CUS_Mapping_ADEC_to_FWM_INPUT(API_AUDIO_CUSTOMER_ADEC_INDEX currentConnect)5653 API_AUDIO_CUSTOMER_CH_SOUND AU_CUS_Mapping_ADEC_to_FWM_INPUT(API_AUDIO_CUSTOMER_ADEC_INDEX currentConnect)
5654 {
5655 API_AUDIO_CUSTOMER_FWM_INPUT Ret = API_AUDIO_CUSTOMER_FWM_INPUT_INVALID;
5656 API_AUDIO_CUSTOMER_CH_INPUT ch_input = API_AUDIO_CUSTOMER_CH_INPUT_INVALID;
5657
5658 AU_nDBG("[currentConnect = 0x%x] \n", (unsigned int)currentConnect);
5659
5660 switch(currentConnect)
5661 {
5662 case API_AUDIO_CUSTOMER_ADEC0:
5663 {
5664 ch_input = API_AUDIO_CUSTOMER_CH_INPUT_ADEC0;
5665 }
5666 break;
5667
5668 case API_AUDIO_CUSTOMER_ADEC1:
5669 {
5670 ch_input = API_AUDIO_CUSTOMER_CH_INPUT_ADEC1;
5671 }
5672 break;
5673
5674 case API_AUDIO_CUSTOMER_ADEC_ATV:
5675 {
5676 ch_input = API_AUDIO_CUSTOMER_CH_INPUT_ADEC_ATV;
5677 }
5678 break;
5679
5680 default:
5681 break;
5682 }
5683
5684 AU_nDBG("[ch_input = 0x%x] \n", (unsigned int)ch_input);
5685
5686 if(pstAudioCustomerShmData->g_audio_customer_CH5_Sound_Connect == ch_input)
5687 {
5688 Ret = API_AUDIO_CUSTOMER_FWM_INPUT_CH5;
5689 }
5690 else if(pstAudioCustomerShmData->g_audio_customer_CH6_Sound_Connect == ch_input)
5691 {
5692 Ret = API_AUDIO_CUSTOMER_FWM_INPUT_CH6;
5693 }
5694 else if(pstAudioCustomerShmData->g_audio_customer_CH7_Sound_Connect == ch_input)
5695 {
5696 Ret = API_AUDIO_CUSTOMER_FWM_INPUT_CH7;
5697 }
5698 else if(pstAudioCustomerShmData->g_audio_customer_CH8_Sound_Connect == ch_input)
5699 {
5700 Ret = API_AUDIO_CUSTOMER_FWM_INPUT_CH8;
5701 }
5702
5703 AU_nDBG("[Ret = 0x%x] \n", (unsigned int)Ret);
5704
5705 return Ret;
5706 }
5707
AU_CUS_SetSourceInfo(AUDIO_SOURCE_INFO_TYPE eSourceType)5708 void AU_CUS_SetSourceInfo(AUDIO_SOURCE_INFO_TYPE eSourceType)
5709 {
5710 AU_nDBG("[eSourceType = 0x%x] \n", (unsigned int)eSourceType);
5711
5712 pstAudioCustomerShmData->g_audio_customer_AU_SetSourceInfo_eSourceType = eSourceType;
5713
5714 MApi_AUDIO_SetSourceInfo(eSourceType);
5715 }
5716
AU_CUS_InputSwitch(AUDIO_INPUT_TYPE enSource,AUDIO_SWITCH_GROUP enGroup)5717 void AU_CUS_InputSwitch(AUDIO_INPUT_TYPE enSource, AUDIO_SWITCH_GROUP enGroup)
5718 {
5719 AU_nDBG("[enSource = 0x%x] [enGroup = 0x%x]\n", (unsigned int)enSource, (unsigned int)enGroup);
5720
5721 pstAudioCustomerShmData->g_audio_customer_AU_InputSwitch_enSource = enSource;
5722 pstAudioCustomerShmData->g_audio_customer_AU_InputSwitch_enGroup = enGroup;
5723
5724 MApi_AUDIO_InputSwitch(enSource, enGroup);
5725 }
5726
5727 /* Start & Stop */
AU_CUS_SetCodecType(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMER_CODEC_TYPE audioType)5728 MS_BOOL AU_CUS_SetCodecType(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_CODEC_TYPE audioType)
5729 {
5730 AudioDecStatus_t stAudioDecStatus_t;
5731
5732 AU_nDBG("[adecIndex = 0x%x] [audioType = 0x%x] \n", (unsigned int)adecIndex, (unsigned int)audioType);
5733
5734 memset(&stAudioDecStatus_t, 0x00, sizeof(AudioDecStatus_t));
5735
5736 switch(adecIndex)
5737 {
5738 case API_AUDIO_CUSTOMER_ADEC0:
5739 {
5740 MApi_AUDIO_ReleaseDecodeSystem(pstAudioCustomerShmData->g_audio_customer_ADEC0_DecID);
5741
5742 stAudioDecStatus_t.bIsAD = FALSE;
5743 stAudioDecStatus_t.eAudFormat = AU_CUS_ConvertCustomerCodecTypeToDriverDVBdecSystemType(audioType);
5744 stAudioDecStatus_t.eSourceType = AU_CUS_ConvertCustomerADECInputSourceToDriverSourceInfoType(pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect);
5745 stAudioDecStatus_t.eGroup = E_CONNECT_MAIN; //define ADEC0 as main, can also work well
5746 stAudioDecStatus_t.eAudio_Force_ID = AUDIO_FORCE_ID1;
5747
5748 pstAudioCustomerShmData->g_audio_customer_ADEC0_DriverCodec = stAudioDecStatus_t.eAudFormat;
5749 pstAudioCustomerShmData->g_audio_customer_ADEC0_DecID = MApi_AUDIO_OpenDecodeSystem(&stAudioDecStatus_t);
5750 MApi_AUDIO_GetDecodeSystem(pstAudioCustomerShmData->g_audio_customer_ADEC0_DecID, &stAudioDecStatus_t);
5751 MApi_AUDIO_SetDecodeSystem(pstAudioCustomerShmData->g_audio_customer_ADEC0_DecID, &stAudioDecStatus_t);
5752 }
5753 break;
5754
5755 case API_AUDIO_CUSTOMER_ADEC1:
5756 {
5757 MApi_AUDIO_ReleaseDecodeSystem(pstAudioCustomerShmData->g_audio_customer_ADEC1_DecID);
5758
5759 stAudioDecStatus_t.bIsAD = FALSE;
5760 stAudioDecStatus_t.eAudFormat = AU_CUS_ConvertCustomerCodecTypeToDriverDVBdecSystemType(audioType);
5761 stAudioDecStatus_t.eSourceType = AU_CUS_ConvertCustomerADECInputSourceToDriverSourceInfoType(pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect);
5762 stAudioDecStatus_t.eGroup = E_CONNECT_MAIN; //define ADEC1 as main, can also work well
5763 stAudioDecStatus_t.eAudio_Force_ID = AUDIO_FORCE_ID3;
5764
5765 pstAudioCustomerShmData->g_audio_customer_ADEC1_DriverCodec = stAudioDecStatus_t.eAudFormat;
5766 pstAudioCustomerShmData->g_audio_customer_ADEC1_DecID = MApi_AUDIO_OpenDecodeSystem(&stAudioDecStatus_t);
5767 MApi_AUDIO_GetDecodeSystem(pstAudioCustomerShmData->g_audio_customer_ADEC1_DecID, &stAudioDecStatus_t);
5768 MApi_AUDIO_SetDecodeSystem(pstAudioCustomerShmData->g_audio_customer_ADEC1_DecID, &stAudioDecStatus_t);
5769 }
5770 break;
5771
5772 case API_AUDIO_CUSTOMER_ADEC_ATV:
5773 {
5774 MApi_AUDIO_ReleaseDecodeSystem(pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_DecID);
5775
5776 stAudioDecStatus_t.bIsAD = FALSE;
5777 stAudioDecStatus_t.eAudFormat = AU_CUS_ConvertCustomerCodecTypeToDriverDVBdecSystemType(audioType);
5778 stAudioDecStatus_t.eSourceType = AU_CUS_ConvertCustomerADECInputSourceToDriverSourceInfoType(pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Connect);
5779 stAudioDecStatus_t.eGroup = E_CONNECT_MAIN; //define ADEC_ATV as main, can also work well
5780 stAudioDecStatus_t.eAudio_Force_ID = AUDIO_FORCE_ID2;
5781
5782 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_DriverSifType = stAudioDecStatus_t.eAudFormat;
5783 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_DecID = MApi_AUDIO_OpenDecodeSystem(&stAudioDecStatus_t);
5784 MApi_AUDIO_GetDecodeSystem(pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_DecID, &stAudioDecStatus_t);
5785 MApi_AUDIO_SetDecodeSystem(pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_DecID, &stAudioDecStatus_t);
5786 }
5787 break;
5788 default:
5789 break;
5790 }
5791
5792 return TRUE;
5793 }
5794
AU_CUS_StartDecoding(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)5795 MS_BOOL AU_CUS_StartDecoding(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
5796 {
5797 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
5798 MS_U8 hdmi_rx_npcm_type = 0;
5799 MS_U8 hdmi_rx_pcm_type = 0;
5800 MS_BOOL check_hdmi_rx = FALSE;
5801 MS_BOOL bDec = FALSE;
5802
5803 AU_nDBG("[adecIndex = 0x%x]\n", (unsigned int)adecIndex);
5804
5805 //for SPDIF/HDMI output, need set to original mode before ES Play
5806 AU_CUS_SPDIF_TX_SetOutputType(pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_UpperOutputType);
5807 AU_CUS_HDMI_TX_SetOutputType(pstAudioCustomerShmData->g_audio_customer_HDMI_TX_UpperOutputType);
5808
5809 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
5810
5811 switch(adecIndex)
5812 {
5813 case API_AUDIO_CUSTOMER_ADEC0:
5814 {
5815 pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperPlay = API_AUDIO_CUSTOMER_UPPER_PLAY;
5816
5817 hdmi_rx_npcm_type = AU_HDMI_MAIN_NPCM;
5818 hdmi_rx_pcm_type = AU_HDMI_MAIN_PCM;
5819 if(pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect == API_AUDIO_CUSTOMER_ADEC_INPUT_HDMI)
5820 {
5821 check_hdmi_rx = TRUE;
5822 }
5823 else
5824 {
5825 check_hdmi_rx = FALSE;
5826 }
5827
5828 if(pstAudioCustomerShmData->g_audio_customer_ADEC0_DriverCodec != MSAPI_AUD_DVB_NONE &&
5829 pstAudioCustomerShmData->g_audio_customer_ADEC0_DriverCodec != MSAPI_AUD_DVB_INVALID)
5830 {
5831 bDec = TRUE;
5832 }
5833 }
5834 break;
5835
5836 case API_AUDIO_CUSTOMER_ADEC1:
5837 {
5838 pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperPlay = API_AUDIO_CUSTOMER_UPPER_PLAY;
5839
5840 hdmi_rx_npcm_type = AU_HDMI_SUB_NPCM;
5841 hdmi_rx_pcm_type = AU_HDMI_SUB_PCM;
5842 if(pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect == API_AUDIO_CUSTOMER_ADEC_INPUT_HDMI)
5843 {
5844 check_hdmi_rx = TRUE;
5845 }
5846 else
5847 {
5848 check_hdmi_rx = FALSE;
5849 }
5850
5851 if(pstAudioCustomerShmData->g_audio_customer_ADEC1_DriverCodec != MSAPI_AUD_DVB_NONE &&
5852 pstAudioCustomerShmData->g_audio_customer_ADEC1_DriverCodec != MSAPI_AUD_DVB_INVALID)
5853 {
5854 bDec = TRUE;
5855 }
5856 }
5857 break;
5858
5859 case API_AUDIO_CUSTOMER_ADEC_ATV:
5860 {
5861 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_UpperPlay = API_AUDIO_CUSTOMER_UPPER_PLAY;
5862
5863 if(pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_DriverSifType == MSAPI_AUD_ATV_BTSC)
5864 {
5865 MApi_AUDIO_SIF_SendCmd(MSAPI_AUD_SIF_CMD_SET_PLAY,0,0);
5866 }
5867 AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5);
5868 AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH6);
5869 return TRUE;
5870 }
5871 break;
5872
5873 default:
5874 {
5875 hdmi_rx_npcm_type = 0;
5876 hdmi_rx_pcm_type = 0;
5877 check_hdmi_rx = FALSE;
5878 }
5879 break;
5880 }
5881
5882 if(check_hdmi_rx) /* Set HDMI_RX for HDMI ES input decode*/
5883 {
5884 if(pstAudioCustomerShmData->g_audio_customer_HDMI_RX_MonitorOnOff == TRUE)
5885 {
5886 if ((pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type == API_AUDIO_CUSTOMER_CODEC_TYPE_AC3) ||
5887 (pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type == API_AUDIO_CUSTOMER_CODEC_TYPE_AAC) ||
5888 (pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type == API_AUDIO_CUSTOMER_CODEC_TYPE_DTS))
5889 {
5890 MApi_AUDIO_HDMI_RX_SetNonpcm(hdmi_rx_npcm_type);
5891 }
5892 else if(pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type == API_AUDIO_CUSTOMER_CODEC_TYPE_PCM)
5893 {
5894 MApi_AUDIO_HDMI_RX_SetNonpcm(hdmi_rx_pcm_type);
5895 }
5896 }
5897 }
5898 else
5899 {
5900 if(bDec)
5901 {
5902 /* Start decode */
5903 AU_CUS_SetPlayCmdByAdecSource(adecIndex);
5904 }
5905 }
5906
5907 AU_nDBG("[hdmi_rx_npcm_type = %-4d]\n", (unsigned int)hdmi_rx_npcm_type);
5908 AU_nDBG("[hdmi_rx_pcm_type = %-4d]\n", (unsigned int)hdmi_rx_pcm_type);
5909 AU_nDBG("[check_hdmi_rx = %-4d]\n", (unsigned int)check_hdmi_rx);
5910 AU_nDBG("[bDec = %-4d]\n", (unsigned int)bDec);
5911
5912 #if(CUSTOMIZED_INTERNAL_PATCH_DDP_71_AUTO_BYPASS_ENABLE)
5913 {
5914 #ifdef CONFIG_MBOOT //mboot
5915 {
5916 //do nothing in mboot.
5917 }
5918 #else
5919 {
5920 if(bDec)
5921 {
5922 if( AUDIO_CHIP_TYPE >= API_AUDIO_CUSTOMER_CHIP_TYPE_2D1R)
5923 {
5924 MApi_AUDIO_SetCommand(MMA_BROWSE);
5925 }
5926 else
5927 {
5928 MApi_AUDIO_SetAudioParam2(DecID , Audio_ParamType_playControl, (MS_U32)MMA_BROWSE);
5929 }
5930 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_adecIndex = adecIndex;
5931 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_Monitor_bEnable = TRUE;
5932 }
5933 }
5934 #endif
5935 }
5936 #endif
5937
5938 return TRUE;
5939 }
5940
AU_CUS_StopDecoding(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)5941 MS_BOOL AU_CUS_StopDecoding(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
5942 {
5943 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
5944
5945 AU_nDBG("[adecIndex = 0x%x] \n", (unsigned int)adecIndex);
5946
5947 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
5948
5949 switch(adecIndex)
5950 {
5951 case API_AUDIO_CUSTOMER_ADEC0:
5952 {
5953 pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperPlay = API_AUDIO_CUSTOMER_UPPER_STOP;
5954
5955 #if(CUSTOMIZED_INTERNAL_PATCH_AVOID_ADEC_STOP_POP_NOISE)
5956 {
5957 AU_nDBG("\n");
5958 AU_CUS_Mute_LimitedTime_Input_Avoid_ADEC_Pop_Noise(adecIndex, pstAudioCustomerShmData->g_audio_customer_internal_patch_Avoid_ADEC_Stop_Pop_Noise_mute_limited_time);
5959 }
5960 #endif
5961
5962 if(pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect == API_AUDIO_CUSTOMER_ADEC_INPUT_MM ||
5963 pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect == API_AUDIO_CUSTOMER_ADEC_INPUT_CLIP)
5964 {
5965 MApi_AUDIO_SetAudioParam2(DecID , Audio_ParamType_playControl, (MS_U32)MMA_STOP);
5966 }
5967 else
5968 {
5969 MApi_AUDIO_SetDecodeCmd(DecID, MSAPI_AUD_DVB_DECCMD_STOP);
5970 }
5971 }
5972 break;
5973
5974 case API_AUDIO_CUSTOMER_ADEC1:
5975 {
5976 pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperPlay = API_AUDIO_CUSTOMER_UPPER_STOP;
5977
5978 #if(CUSTOMIZED_INTERNAL_PATCH_AVOID_ADEC_STOP_POP_NOISE)
5979 {
5980 AU_nDBG("\n");
5981 AU_CUS_Mute_LimitedTime_Input_Avoid_ADEC_Pop_Noise(adecIndex, pstAudioCustomerShmData->g_audio_customer_internal_patch_Avoid_ADEC_Stop_Pop_Noise_mute_limited_time);
5982 }
5983 #endif
5984
5985 if(pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect == API_AUDIO_CUSTOMER_ADEC_INPUT_MM ||
5986 pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect == API_AUDIO_CUSTOMER_ADEC_INPUT_CLIP)
5987 {
5988 MApi_AUDIO_SetAudioParam2(DecID , Audio_ParamType_playControl, (MS_U32)MMA_STOP);
5989 }
5990 else
5991 {
5992 MApi_AUDIO_SetDecodeCmd(DecID, MSAPI_AUD_DVB_DECCMD_STOP);
5993 }
5994 }
5995 break;
5996
5997 case API_AUDIO_CUSTOMER_ADEC_ATV:
5998 {
5999 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_UpperPlay = API_AUDIO_CUSTOMER_UPPER_STOP;
6000 AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5);
6001 AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH6);
6002 if(pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_DriverSifType == MSAPI_AUD_ATV_BTSC)
6003 {
6004 MApi_AUDIO_SIF_SendCmd(MSAPI_AUD_SIF_CMD_SET_STOP,0,0);
6005 }
6006 }
6007 break;
6008
6009 default:
6010 break;
6011 }
6012
6013 #if(R2_SUPPORT_MS12_PCM_RENDER_ALWAYS_ENABLE && CUSTOMIZED_INTERNAL_PATCH_DDP_71_AUTO_BYPASS_ENABLE)
6014 {
6015 if( pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperCodec == API_AUDIO_CUSTOMER_CODEC_TYPE_ESBypass ||
6016 pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperCodec == API_AUDIO_CUSTOMER_CODEC_TYPE_ESBypass )
6017 {
6018 AU_nDBG("\n");
6019 AU_CUS_SPDIF_TX_SetOutputType(API_AUDIO_CUSTOMER_SPDIF_TX_PCM);
6020 AU_CUS_HDMI_TX_SetOutputType(API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_PCM);
6021 }
6022 else
6023 {
6024 #if(CUSTOMIZED_INTERNAL_PATCH_DDP_71_AUTO_BYPASS_STB_HDMI_TX)
6025 {
6026 AU_nDBG("\n");
6027
6028 //Recover previous HDMI output type settings
6029 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_bDDP_71_Stream = FALSE;
6030 AU_CUS_HDMI_TX_SetOutputType(pstAudioCustomerShmData->g_audio_customer_HDMI_TX_UpperOutputType);
6031 }
6032 #endif
6033
6034 #if(CUSTOMIZED_INTERNAL_PATCH_DDP_71_AUTO_BYPASS_TV_HDMI_ARC)
6035 {
6036 AU_nDBG("\n");
6037
6038 //Recover previous SPDIF output type settings
6039 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_bDDP_71_Stream = FALSE;
6040 AU_CUS_SPDIF_TX_SetOutputType(pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_UpperOutputType);
6041 }
6042 #endif
6043 }
6044 }
6045 #else
6046 {
6047 AU_nDBG("\n");
6048
6049 //for SPDIF/HDMI output, need change to PCM after ES Stop decoding
6050 AU_CUS_SPDIF_TX_SetOutputType(API_AUDIO_CUSTOMER_SPDIF_TX_PCM);
6051 AU_CUS_HDMI_TX_SetOutputType(API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_PCM);
6052 }
6053 #endif
6054
6055 return TRUE;
6056 }
6057
AU_CUS_PauseDecoding(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)6058 MS_BOOL AU_CUS_PauseDecoding(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
6059 {
6060 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
6061
6062 AU_nDBG("[adecIndex = 0x%x] \n", (unsigned int)adecIndex);
6063
6064 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
6065
6066 switch(adecIndex)
6067 {
6068 case API_AUDIO_CUSTOMER_ADEC0:
6069 {
6070 pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperPlay = API_AUDIO_CUSTOMER_UPPER_PAUSE;
6071
6072 #if(CUSTOMIZED_INTERNAL_PATCH_AVOID_ADEC_PAUSE_POP_NOISE)
6073 {
6074 AU_nDBG("\n");
6075 AU_CUS_Mute_LimitedTime_Input_Avoid_ADEC_Pop_Noise(adecIndex, pstAudioCustomerShmData->g_audio_customer_internal_patch_Avoid_ADEC_Pause_Pop_Noise_mute_limited_time);
6076 }
6077 #endif
6078
6079 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_playControl, (MS_U32)MMA_PAUSE);
6080 }
6081 break;
6082
6083 case API_AUDIO_CUSTOMER_ADEC1:
6084 {
6085 pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperPlay = API_AUDIO_CUSTOMER_UPPER_PAUSE;
6086
6087 #if(CUSTOMIZED_INTERNAL_PATCH_AVOID_ADEC_PAUSE_POP_NOISE)
6088 {
6089 AU_nDBG("\n");
6090 AU_CUS_Mute_LimitedTime_Input_Avoid_ADEC_Pop_Noise(adecIndex, pstAudioCustomerShmData->g_audio_customer_internal_patch_Avoid_ADEC_Pause_Pop_Noise_mute_limited_time);
6091 }
6092 #endif
6093
6094 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_playControl, (MS_U32)MMA_PAUSE);
6095 }
6096 break;
6097
6098 case API_AUDIO_CUSTOMER_ADEC_ATV:
6099 {
6100 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_UpperPlay = API_AUDIO_CUSTOMER_UPPER_PAUSE;
6101
6102 if(pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_DriverSifType == MSAPI_AUD_ATV_BTSC)
6103 {
6104 MApi_AUDIO_SetCommand(MSAPI_AUD_DVB2_DECCMD_STOP);
6105 }
6106 }
6107 break;
6108
6109 default:
6110 break;
6111 }
6112
6113 #if(CUSTOMIZED_INTERNAL_PATCH_PAUSE_DECODING_DELAY)
6114 {
6115 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_AU_CUS_PauseDecoding_Delay);
6116 }
6117 #endif
6118
6119 return TRUE;
6120 }
6121
6122 /* SPDIF */
AU_CUS_SPDIF_TX_SetOutputType(API_AUDIO_CUSTOMER_SPDIF_TX_MODE eSPDIFMode)6123 MS_BOOL AU_CUS_SPDIF_TX_SetOutputType(API_AUDIO_CUSTOMER_SPDIF_TX_MODE eSPDIFMode)
6124 {
6125 MS_U8 spdif_mode = 0;
6126 Digital_Out_Device_Capability_t Device_Capability;
6127
6128 AU_nDBG("[eSPDIFMode = 0x%x] \n", (unsigned int)eSPDIFMode);
6129
6130 #if(CUSTOMIZED_INTERNAL_PATCH_DDP_71_AUTO_BYPASS_ENABLE && CUSTOMIZED_INTERNAL_PATCH_DDP_71_AUTO_BYPASS_TV_HDMI_ARC)
6131 {
6132 //Need force DDP_71 bypass, and avoid other cmd from upper.
6133 if(pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_bDDP_71_Stream)
6134 {
6135 switch(eSPDIFMode)
6136 {
6137 case API_AUDIO_CUSTOMER_SPDIF_TX_PCM:
6138 case API_AUDIO_CUSTOMER_SPDIF_TX_BYPASS:
6139 {
6140 AU_nDBG("\n");
6141 //do nothing
6142 }
6143 break;
6144
6145 case API_AUDIO_CUSTOMER_SPDIF_TX_AUTO:
6146 case API_AUDIO_CUSTOMER_SPDIF_TX_TRANSCODE:
6147 case API_AUDIO_CUSTOMER_SPDIF_TX_DD:
6148 {
6149 AU_nDBG("\n");
6150 return TRUE;
6151 }
6152 break;
6153
6154 default:
6155 {
6156 AU_nDBG("\n");
6157 //do nothing
6158 }
6159 break;
6160 }
6161 }
6162 }
6163 #endif
6164
6165 pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_DriverOutputType = eSPDIFMode;
6166
6167 switch(eSPDIFMode)
6168 {
6169 case API_AUDIO_CUSTOMER_SPDIF_TX_PCM:
6170 {
6171 spdif_mode = SPDIF_OUT_PCM;
6172 }
6173 break;
6174
6175 case API_AUDIO_CUSTOMER_SPDIF_TX_AUTO:
6176 case API_AUDIO_CUSTOMER_SPDIF_TX_DD:
6177 {
6178 spdif_mode = SPDIF_OUT_AUTO;
6179 }
6180 break;
6181
6182 case API_AUDIO_CUSTOMER_SPDIF_TX_BYPASS:
6183 {
6184 spdif_mode = SPDIF_OUT_BYPASS;
6185 }
6186 break;
6187
6188 case API_AUDIO_CUSTOMER_SPDIF_TX_TRANSCODE:
6189 {
6190 spdif_mode = SPDIF_OUT_TRANSCODE;
6191 }
6192 break;
6193
6194 default:
6195 {
6196 spdif_mode = SPDIF_OUT_PCM;
6197 }
6198 break;
6199 }
6200
6201 memset((void *)&Device_Capability, 0, sizeof(Device_Capability));
6202
6203 if(eSPDIFMode == API_AUDIO_CUSTOMER_SPDIF_TX_DD)
6204 {
6205 Device_Capability.support_codec = 0;
6206 MApi_AUDIO_DigitalOut_SetDeviceCapability(DIGITAL_HDMI_ARC_OUTPUT, CODEC_DDP, &Device_Capability);
6207 }
6208 else
6209 {
6210 Device_Capability.support_codec = 1;
6211 MApi_AUDIO_DigitalOut_SetDeviceCapability(DIGITAL_HDMI_ARC_OUTPUT, CODEC_DDP, &Device_Capability);
6212 }
6213
6214 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
6215 {
6216 mutex_lock(&AU_Customer_SPDIF_TX_SetOutputType_mutex_lock);
6217 }
6218 #else //User Space
6219 {
6220 OS_OBTAIN_MUTEX(AU_Customer_SPDIF_TX_SetOutputType_mutex_lock, MSOS_WAIT_FOREVER);
6221 }
6222 #endif
6223
6224 MApi_AUDIO_SPDIF_SetMode(spdif_mode);
6225
6226 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
6227 {
6228 mutex_unlock(&AU_Customer_SPDIF_TX_SetOutputType_mutex_lock);
6229 }
6230 #else //User Space
6231 {
6232 OS_RELEASE_MUTEX(AU_Customer_SPDIF_TX_SetOutputType_mutex_lock);
6233 }
6234 #endif
6235
6236 return TRUE;
6237 }
6238
AU_CUS_SPDIF_TX_Monitor(void)6239 void AU_CUS_SPDIF_TX_Monitor(void)
6240 {
6241 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
6242 {
6243 mutex_lock(&AU_Customer_SPDIF_TX_SetOutputType_mutex_lock);
6244 }
6245 #else //User Space
6246 {
6247 OS_OBTAIN_MUTEX(AU_Customer_SPDIF_TX_SetOutputType_mutex_lock, MSOS_WAIT_FOREVER);
6248 }
6249 #endif
6250
6251 MApi_Audio_SPDIF_Monitor();
6252
6253 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
6254 {
6255 mutex_unlock(&AU_Customer_SPDIF_TX_SetOutputType_mutex_lock);
6256 }
6257 #else //User Space
6258 {
6259 OS_RELEASE_MUTEX(AU_Customer_SPDIF_TX_SetOutputType_mutex_lock);
6260 }
6261 #endif
6262 }
6263
6264 /* HDMI */
AU_CUS_HDMI_TX_SetOutputType(API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_TYPE eHDMIMode)6265 MS_BOOL AU_CUS_HDMI_TX_SetOutputType(API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_TYPE eHDMIMode)
6266 {
6267 #ifdef CONFIG_API_HDMITX //TV dont have HDMI TX
6268 AU_nDBG("[eHDMIMode = 0x%x] \n", (unsigned int)eHDMIMode);
6269
6270 #if(CUSTOMIZED_INTERNAL_PATCH_DDP_71_AUTO_BYPASS_ENABLE && CUSTOMIZED_INTERNAL_PATCH_DDP_71_AUTO_BYPASS_STB_HDMI_TX)
6271 {
6272 //Need force DDP_71 bypass, and avoid other cmd from upper.
6273 if(pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_bDDP_71_Stream)
6274 {
6275 switch(eHDMIMode)
6276 {
6277 case API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_PCM:
6278 {
6279 AU_nDBG("\n");
6280 //do nothing
6281 }
6282 break;
6283
6284 case API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_NONPCM:
6285 {
6286 AU_nDBG("\n");
6287 return TRUE;
6288 }
6289 break;
6290
6291 case API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_EAC3_BYPASS:
6292 {
6293 AU_nDBG("\n");
6294 //do nothing
6295 }
6296 break;
6297
6298 case API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_EAC3:
6299 {
6300 AU_nDBG("\n");
6301 return TRUE;
6302 }
6303 break;
6304
6305 default:
6306 {
6307 //do nothing
6308 }
6309 break;
6310 }
6311 }
6312 }
6313 #endif
6314
6315 pstAudioCustomerShmData->g_audio_customer_HDMI_TX_DriverOutputType = eHDMIMode;
6316
6317 switch(eHDMIMode)
6318 {
6319 case API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_PCM:
6320 {
6321 AU_nDBG("\n");
6322
6323 #if(UTPA_SUPPORT_M2S_MBOX_DDPE_ENCODE_CTRL && UTPA_SUPPORT_M2S_MBOX_MCU_HDMI_NONPCM_CTRL)
6324 {
6325 AU_nDBG("\n");
6326 AU_CUS_WriteAbsMaskReg(M2S_MBOX_MCU_HDMI_NONPCM_CTRL, 0x0001, 0x0000); //Disable Force MCU Control
6327 }
6328 #endif
6329
6330 //step1: trun off AC3 bypass
6331 MApi_AUDIO_SetAC3PInfo(Audio_AC3P_infoType_hdmiTxBypass_enable, FALSE, 0);
6332 AU_CUS_Delay1MS(10);
6333
6334 //step2: trun on HDMI PCM
6335 MApi_AUDIO_HDMI_TX_SetMode(HDMI_OUT_PCM);
6336 AU_CUS_Delay1MS(10);
6337 }
6338 break;
6339
6340 case API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_NONPCM:
6341 {
6342 AU_nDBG("\n");
6343
6344 #if(UTPA_SUPPORT_M2S_MBOX_DDPE_ENCODE_CTRL && UTPA_SUPPORT_M2S_MBOX_MCU_HDMI_NONPCM_CTRL)
6345 {
6346 if( pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperCodec == API_AUDIO_CUSTOMER_CODEC_TYPE_ESBypass ||
6347 pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperCodec == API_AUDIO_CUSTOMER_CODEC_TYPE_ESBypass )
6348 {
6349 AU_nDBG("\n");
6350 AU_CUS_WriteAbsMaskReg(M2S_MBOX_MCU_HDMI_NONPCM_CTRL, 0x0001, 0x0000); //Disable Force MCU Control
6351 }
6352 else
6353 {
6354 AU_nDBG("\n");
6355 AU_CUS_WriteAbsMaskReg(M2S_MBOX_MCU_HDMI_NONPCM_CTRL, 0x0001, 0x0001); //Enable Force MCU Control
6356 AU_CUS_WriteAbsMaskReg(M2S_MBOX_MCU_HDMI_NONPCM_CTRL, 0x0020, 0x0020); //Enable Force MCU Control, NPCM Owner: SE-DSP
6357 }
6358 }
6359 #endif
6360
6361 //step1: trun off AC3 bypass
6362 MApi_AUDIO_SetAC3PInfo(Audio_AC3P_infoType_hdmiTxBypass_enable, FALSE, 0);
6363 AU_CUS_Delay1MS(10);
6364
6365 //step2: trun on HDMI NPCM
6366 MApi_AUDIO_HDMI_TX_SetMode(HDMI_OUT_NONPCM);
6367 AU_CUS_Delay1MS(10);
6368 }
6369 break;
6370
6371 case API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_EAC3_BYPASS:
6372 {
6373 AU_nDBG("\n");
6374
6375 #if(UTPA_SUPPORT_HDMI_TX_OUT_BYPASS)
6376 {
6377 #if(UTPA_SUPPORT_M2S_MBOX_DDPE_ENCODE_CTRL && UTPA_SUPPORT_M2S_MBOX_MCU_HDMI_NONPCM_CTRL)
6378 {
6379 AU_nDBG("\n");
6380 AU_CUS_WriteAbsMaskReg(M2S_MBOX_MCU_HDMI_NONPCM_CTRL, 0x0001, 0x0000); //Disable Force MCU Control
6381 }
6382 #endif
6383
6384 //step1: trun off AC3 bypass
6385 MApi_AUDIO_SetAC3PInfo(Audio_AC3P_infoType_hdmiTxBypass_enable, FALSE, 0);
6386 AU_CUS_Delay1MS(10);
6387
6388 //step3: trun on HDMI bypass
6389 MApi_AUDIO_HDMI_TX_SetMode(HDMI_OUT_BYPASS);
6390 }
6391 #else //(Same flow as API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_NONPCM)
6392 {
6393 //step1: trun off AC3 bypass
6394 MApi_AUDIO_SetAC3PInfo(Audio_AC3P_infoType_hdmiTxBypass_enable, FALSE, 0);
6395 AU_CUS_Delay1MS(10);
6396
6397 //step2: trun on HDMI NPCM
6398 MApi_AUDIO_HDMI_TX_SetMode(HDMI_OUT_NONPCM);
6399 AU_CUS_Delay1MS(10);
6400 }
6401 #endif
6402 }
6403 break;
6404
6405 case API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_EAC3:
6406 {
6407 AU_nDBG("\n");
6408
6409 #if(UTPA_SUPPORT_M2S_MBOX_DDPE_ENCODE_CTRL && UTPA_SUPPORT_M2S_MBOX_MCU_HDMI_NONPCM_CTRL)
6410 {
6411 AU_nDBG("\n");
6412 AU_CUS_WriteAbsMaskReg(M2S_MBOX_MCU_HDMI_NONPCM_CTRL, 0x0001, 0x0001); //Enable Force MCU Control
6413 AU_CUS_WriteAbsMaskReg(M2S_MBOX_MCU_HDMI_NONPCM_CTRL, 0x0020, 0x0020); //Enable Force MCU Control, NPCM Owner: SE-DSP
6414 }
6415 #endif
6416
6417 //step1: trun on HDMI NPCM
6418 MApi_AUDIO_HDMI_TX_SetMode(HDMI_OUT_NONPCM);
6419 AU_CUS_Delay1MS(10);
6420
6421 //step2: trun on AC3 bypass
6422 MApi_AUDIO_SetAC3PInfo(Audio_AC3P_infoType_hdmiTxBypass_enable, TRUE, 0);
6423 AU_CUS_Delay1MS(10);
6424 }
6425 break;
6426
6427 default:
6428 {
6429 AU_nDBG("\n");
6430
6431 MApi_AUDIO_HDMI_TX_SetMode((HDMI_TX_OUTPUT_TYPE)eHDMIMode);
6432 AU_CUS_Delay1MS(10);
6433 }
6434 break;
6435 }
6436 #endif
6437 return TRUE;
6438 }
6439
AU_CUS_HDMI_RX_GetAudioMode(void)6440 MS_BOOL AU_CUS_HDMI_RX_GetAudioMode(void)
6441 {
6442 AUDIO_HDMI_RX_TYPE hdmi_rx_codec_type = HDMI_RX_PCM;
6443 MS_BOOL bHDMI = FALSE;
6444 MS_BOOL bNonPCM = FALSE;
6445
6446 bHDMI = MDrv_HDMI_IsHDMI_Mode();
6447 bNonPCM = MApi_AUDIO_HDMI_GetNonpcmFlag();
6448
6449 if(bHDMI == TRUE)
6450 {
6451 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK)
6452 {
6453 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_IsHDMI = API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO_HDMI_MODE;
6454 if(pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_IsHDMI != pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Previous_IsHDMI)
6455 {
6456 if(madCallBack.pFunc_HDMIMonitorEvent != NULL)
6457 {
6458 madCallBack.pFunc_HDMIMonitorEvent(API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_IS_HDMI, pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_IsHDMI);
6459 }
6460 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Previous_IsHDMI = pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_IsHDMI;
6461 }
6462 }
6463 #endif
6464
6465 if(bNonPCM == TRUE)
6466 {
6467 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK)
6468 {
6469 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_IsPCM = API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO_NONPCM;
6470 if(pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_IsPCM != pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Previous_IsPCM)
6471 {
6472 if(madCallBack.pFunc_HDMIMonitorEvent != NULL)
6473 {
6474 madCallBack.pFunc_HDMIMonitorEvent(API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_IS_NONPCM, pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_IsPCM);
6475 }
6476 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Previous_IsPCM = pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_IsPCM;
6477 }
6478 }
6479 #endif
6480
6481 hdmi_rx_codec_type = MApi_AUDIO_HDMI_RX_GetNonPCM();
6482 switch (hdmi_rx_codec_type)
6483 {
6484 case HDMI_RX_DD:
6485 {
6486 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type = API_AUDIO_CUSTOMER_CODEC_TYPE_AC3;
6487
6488 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK)
6489 {
6490 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_CodecType = API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO_DD;
6491 }
6492 #endif
6493 }
6494 break;
6495
6496 case HDMI_RX_DDP:
6497 {
6498 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type = API_AUDIO_CUSTOMER_CODEC_TYPE_AC3;
6499
6500 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK)
6501 {
6502 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_CodecType = API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO_DDP;
6503 }
6504 #endif
6505 }
6506 break;
6507
6508 case HDMI_RX_DTS:
6509 {
6510 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type = API_AUDIO_CUSTOMER_CODEC_TYPE_DTS;
6511
6512 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK)
6513 {
6514 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_CodecType = API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO_DTS;
6515 }
6516 #endif
6517 }
6518 break;
6519
6520 case HDMI_RX_DP:
6521 {
6522 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type = API_AUDIO_CUSTOMER_CODEC_TYPE_AAC;
6523
6524 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK)
6525 {
6526 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_CodecType = API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO_DP;
6527 }
6528 #endif
6529 }
6530 break;
6531
6532 case HDMI_RX_PCM:
6533 {
6534 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type = API_AUDIO_CUSTOMER_CODEC_TYPE_PCM;
6535
6536 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK)
6537 {
6538 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_CodecType = API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO_PCM;
6539 }
6540 #endif
6541 }
6542 break;
6543
6544 case HDMI_RX_Other:
6545 default:
6546 {
6547 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type = API_AUDIO_CUSTOMER_CODEC_TYPE_UNKNOWN;
6548
6549 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK)
6550 {
6551 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_CodecType = API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO_OTHER;
6552 }
6553 #endif
6554 }
6555 break;
6556 }
6557
6558 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK)
6559 {
6560 if(pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_CodecType != pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Previous_CodecType)
6561 {
6562 if(madCallBack.pFunc_HDMIMonitorEvent != NULL)
6563 {
6564 madCallBack.pFunc_HDMIMonitorEvent(API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_CODEC_CHANGE, pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_CodecType);
6565 }
6566 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Previous_CodecType = pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_CodecType;
6567 }
6568 }
6569 #endif
6570 }
6571 else
6572 {
6573 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type = API_AUDIO_CUSTOMER_CODEC_TYPE_PCM;
6574
6575 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK)
6576 {
6577 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_IsPCM = API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO_PCM;
6578 if(pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_IsPCM != pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Previous_IsPCM)
6579 {
6580 if(madCallBack.pFunc_HDMIMonitorEvent != NULL)
6581 {
6582 madCallBack.pFunc_HDMIMonitorEvent(API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_IS_NONPCM, pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_IsPCM);
6583 }
6584 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Previous_IsPCM = pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_IsPCM;
6585 }
6586 }
6587 #endif
6588 }
6589 }
6590 else
6591 {
6592 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type = API_AUDIO_CUSTOMER_CODEC_TYPE_DVI;
6593
6594 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK)
6595 {
6596 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_IsHDMI = API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO_DVI_MODE;
6597 if(pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_IsHDMI != pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Previous_IsHDMI)
6598 {
6599 if(madCallBack.pFunc_HDMIMonitorEvent !=NULL)
6600 {
6601 madCallBack.pFunc_HDMIMonitorEvent(API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_IS_HDMI, pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_IsHDMI);
6602 }
6603 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Previous_IsHDMI = pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Monitr_Event_Current_IsHDMI;
6604 }
6605 }
6606 #endif
6607 }
6608
6609 AU_nThreadDBG("[pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type);
6610
6611 return TRUE;
6612 }
6613
AU_CUS_HDMI_RX_Monitor(void)6614 void AU_CUS_HDMI_RX_Monitor(void)
6615 {
6616 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_SWITCH_TO_PCM_DEBOUNCE)
6617 {
6618 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = API_AUDIO_CUSTOMER_ADEC_INDEX_INVALID;
6619 API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT metadata_Select = API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT_INVALID;
6620 MS_U32 tmpTime = 0;
6621 MS_U32 TimeDiff = 0;
6622 MS_U32 debounce_state = 0;
6623
6624 while(1)
6625 {
6626 if(pstAudioCustomerShmData->g_audio_customer_HDMI_RX_MonitorOnOff == TRUE)
6627 {
6628 if( (pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect == API_AUDIO_CUSTOMER_ADEC_INPUT_HDMI) ||
6629 (pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect == API_AUDIO_CUSTOMER_ADEC_INPUT_HDMI) )
6630 {
6631 if(pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect == API_AUDIO_CUSTOMER_ADEC_INPUT_HDMI)
6632 {
6633 adecIndex = API_AUDIO_CUSTOMER_ADEC0;
6634 }
6635 else if(pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect == API_AUDIO_CUSTOMER_ADEC_INPUT_HDMI)
6636 {
6637 adecIndex = API_AUDIO_CUSTOMER_ADEC1;
6638 }
6639
6640 AU_CUS_HDMI_RX_GetAudioMode();
6641 if(pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type != pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Previous_Codec_Type)
6642 {
6643 #if(CUSTOMIZED_INTERNAL_PATCH_PARAM_SNDR2_MS12_PCMR_METADATA_SELECT)
6644 {
6645 if(pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type == API_AUDIO_CUSTOMER_CODEC_TYPE_PCM)
6646 {
6647 if(debounce_state == 0)
6648 {
6649 tmpTime = MsOS_GetSystemTime();
6650 debounce_state = 1;
6651 TimeDiff = 0;
6652 }
6653 else
6654 {
6655 TimeDiff = MsOS_GetSystemTime() - tmpTime;
6656 }
6657
6658 if(TimeDiff >= pstAudioCustomerShmData->g_audio_customer_patch_HDMI_RX_switch_to_pcm_debounce_in_ms)
6659 {
6660 if( API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT_DMX != (API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT)pstAudioCustomerShmData->g_audio_customer_internal_patch_SndR2_MS12_Pcmr_Metadata_Select)
6661 {
6662 metadata_Select = API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT_DMX;
6663 AU_CUS_INTERNAL_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, AU_CUS_INTERNAL_PATCH_PARAM_SNDR2_MS12_PCMR_METADATA_SELECT, &metadata_Select);
6664 }
6665 }
6666 }
6667 else
6668 {
6669 if( API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT_DEC != (API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT)pstAudioCustomerShmData->g_audio_customer_internal_patch_SndR2_MS12_Pcmr_Metadata_Select)
6670 {
6671 metadata_Select = API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT_DEC;
6672 AU_CUS_INTERNAL_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, AU_CUS_INTERNAL_PATCH_PARAM_SNDR2_MS12_PCMR_METADATA_SELECT, &metadata_Select);
6673 }
6674 }
6675 }
6676 #endif
6677
6678 if((pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type != API_AUDIO_CUSTOMER_CODEC_TYPE_PCM) ||
6679 (TimeDiff >= pstAudioCustomerShmData->g_audio_customer_patch_HDMI_RX_switch_to_pcm_debounce_in_ms))
6680 {
6681 /* set codec type */
6682 AU_CUS_SetCodecType(adecIndex, pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type);
6683
6684 /* Start decode */
6685 AU_CUS_StartDecoding(adecIndex);
6686
6687 debounce_state = 0;
6688 TimeDiff = 0;
6689
6690 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Previous_Codec_Type = pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type;
6691 }
6692 }
6693 else
6694 {
6695 debounce_state = 0;
6696 }
6697 }
6698 else
6699 {
6700 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Previous_Codec_Type = API_AUDIO_CUSTOMER_CODEC_TYPE_UNKNOWN;
6701 }
6702
6703 if(debounce_state > 0)
6704 {
6705 if((pstAudioCustomerShmData->g_audio_customer_patch_HDMI_RX_switch_to_pcm_debounce_in_ms - TimeDiff) > pstAudioCustomerShmData->g_audio_customer_AU_MonitorService_Interval)
6706 {
6707 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_AU_MonitorService_Interval);
6708 }
6709 else
6710 {
6711 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_patch_HDMI_RX_switch_to_pcm_debounce_in_ms - TimeDiff);
6712 }
6713 }
6714 else
6715 {
6716 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_AU_MonitorService_Interval);
6717 }
6718 }
6719 else
6720 {
6721 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_AU_MonitorService_Interval);
6722 }
6723 }
6724 }
6725 #else
6726 {
6727 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = API_AUDIO_CUSTOMER_ADEC_INDEX_INVALID;
6728 API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT metadata_Select = API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT_INVALID;
6729 AU_UNUSED(metadata_Select);
6730
6731 if( (pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect == API_AUDIO_CUSTOMER_ADEC_INPUT_HDMI) ||
6732 (pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect == API_AUDIO_CUSTOMER_ADEC_INPUT_HDMI) )
6733 {
6734 if(pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect == API_AUDIO_CUSTOMER_ADEC_INPUT_HDMI)
6735 {
6736 adecIndex = API_AUDIO_CUSTOMER_ADEC0;
6737 }
6738 else if(pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect == API_AUDIO_CUSTOMER_ADEC_INPUT_HDMI)
6739 {
6740 adecIndex = API_AUDIO_CUSTOMER_ADEC1;
6741 }
6742
6743 AU_CUS_HDMI_RX_GetAudioMode();
6744
6745 if(pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type == pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Previous_Codec_Type)
6746 {
6747 #if(CUSTOMIZED_INTERNAL_PATCH_PARAM_SNDR2_MS12_PCMR_METADATA_SELECT)
6748 {
6749 if(pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type == API_AUDIO_CUSTOMER_CODEC_TYPE_PCM)
6750 {
6751 if( API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT_DMX != (API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT)pstAudioCustomerShmData->g_audio_customer_internal_patch_SndR2_MS12_Pcmr_Metadata_Select)
6752 {
6753 metadata_Select = API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT_DMX;
6754 AU_CUS_INTERNAL_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, AU_CUS_INTERNAL_PATCH_PARAM_SNDR2_MS12_PCMR_METADATA_SELECT, &metadata_Select);
6755 }
6756 }
6757 else
6758 {
6759 if( API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT_DEC != (API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT)pstAudioCustomerShmData->g_audio_customer_internal_patch_SndR2_MS12_Pcmr_Metadata_Select)
6760 {
6761 metadata_Select = API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT_DEC;
6762 AU_CUS_INTERNAL_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, AU_CUS_INTERNAL_PATCH_PARAM_SNDR2_MS12_PCMR_METADATA_SELECT, &metadata_Select);
6763 }
6764 }
6765 }
6766 #endif
6767
6768 return;
6769 }
6770
6771 /* set codec type */
6772 AU_CUS_SetCodecType(adecIndex, pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type);
6773
6774 /* Start decode */
6775 AU_CUS_StartDecoding(adecIndex);
6776
6777 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Previous_Codec_Type = pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type;
6778 }
6779 else
6780 {
6781 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Previous_Codec_Type = API_AUDIO_CUSTOMER_CODEC_TYPE_UNKNOWN;
6782 }
6783 }
6784 #endif
6785 }
6786
AU_CUS_HDMI_TX_Monitor(void)6787 void AU_CUS_HDMI_TX_Monitor(void)
6788 {
6789 #ifdef CONFIG_API_HDMITX //TV dont have HDMI TX
6790 if(pstAudioCustomerShmData->g_audio_customer_Chip_Platform == API_AUDIO_CUSTOMER_CHIP_PLATFORM_STB)
6791 {
6792 static AUDIO_FS_TYPE _stCurSampleType = AUDIO_FS_NONE;
6793 static HDMI_TX_OUTPUT_TYPE _stCurHDMIType = HDMI_OUT_PCM;
6794 static HDMITX_HDCP_STATUS _stCurHDMITx_HDCP_Status = E_HDCP_FAIL;
6795
6796 MS_BOOL hdmi_tx_en;
6797 AUDIO_FS_TYPE fs_type;
6798 HDMI_TX_OUTPUT_TYPE outType;
6799 HDMITX_AUDIO_FREQUENCY hreq = HDMITX_AUDIO_FREQ_NO_SIG;
6800 HDMITX_AUDIO_CODING_TYPE htype = HDMITX_AUDIO_PCM;
6801 HDMITX_HDCP_STATUS HDCP_Status = E_HDCP_FAIL;
6802
6803 MApi_AUDIO_HDMI_Tx_GetStatus(&hdmi_tx_en, &fs_type, &outType);
6804 HDCP_Status = MApi_HDMITx_GetHDCPStatus();
6805
6806 if(hdmi_tx_en)
6807 {
6808 if( (_stCurSampleType == fs_type) && (_stCurHDMIType == outType) && (_stCurHDMITx_HDCP_Status == HDCP_Status) )
6809 {
6810 return;
6811 }
6812 else
6813 {
6814 _stCurSampleType = fs_type;
6815 _stCurHDMIType = outType;
6816 _stCurHDMITx_HDCP_Status = HDCP_Status;
6817
6818 AU_nPRINT("[hdmi_tx_en = %-4d] \n", (int)hdmi_tx_en);
6819 AU_nPRINT("[fs_type = %-4d] \n", (int)fs_type);
6820 AU_nPRINT("[outType = %-4d] \n", (int)outType);
6821 AU_nPRINT("[HDCP_Status = %-4d] \n", (int)HDCP_Status);
6822 }
6823
6824 if(outType == HDMI_OUT_NONPCM)
6825 {
6826 htype = HDMITX_AUDIO_NONPCM;
6827 switch(fs_type)
6828 {
6829 case AUDIO_FS_32KHZ:
6830 {
6831 hreq = HDMITX_AUDIO_32K;
6832 }
6833 break;
6834
6835 case AUDIO_FS_44KHZ:
6836 {
6837 hreq = HDMITX_AUDIO_44K;
6838 }
6839 break;
6840
6841 case AUDIO_FS_176KHZ:
6842 {
6843 hreq = HDMITX_AUDIO_176K;
6844 }
6845 break;
6846
6847 case AUDIO_FS_192KHZ:
6848 {
6849 hreq = HDMITX_AUDIO_192K;
6850 }
6851 break;
6852
6853 default:
6854 case AUDIO_FS_48KHZ:
6855 {
6856 hreq = HDMITX_AUDIO_48K;
6857 }
6858 break;
6859 }
6860 }
6861 else
6862 {
6863 htype = HDMITX_AUDIO_PCM;
6864 hreq = HDMITX_AUDIO_48K; //for PCM mode always SRC to 48K
6865 }
6866 AU_nPRINT("[Hdmx Tx:%-4d, %-4d] \n", hreq, htype);
6867
6868 if(HDCP_Status != E_HDCP_FAIL)
6869 {
6870 MApi_HDMITx_SetAudioOnOff(TRUE);
6871 }
6872 else
6873 {
6874 MApi_HDMITx_SetAudioOnOff(FALSE);
6875 }
6876
6877 #if(UTPA_SUPPORT_HDMI_TX_STATUS)
6878 {
6879 MApi_AUDIO_SetCommAudioInfo(Audio_Comm_infoType_HDMITx_Status, (MS_U32)outType, (MS_U32)hreq);
6880 }
6881 #endif
6882
6883 MApi_HDMITx_SetAudioFrequency(hreq);
6884 MApi_HDMITx_SetAudioConfiguration(hreq, HDMITX_AUDIO_CH_2, htype);
6885 MApi_HDMITx_SetAudioSourceFormat(HDMITX_AUDIO_FORMAT_PCM);
6886 }
6887 }
6888 #endif
6889 }
6890
6891 /* ATV */
AU_CUS_CheckATVSoundMode(void)6892 void AU_CUS_CheckATVSoundMode(void)
6893 {
6894 AUDIOMODE_TYPE eDetectedAudioMode;
6895
6896 if( TRUE == MApi_AUDIO_SIF_IsPALType(AU_SIF_PAL_MONO) )
6897 {
6898 eDetectedAudioMode = E_AUDIOMODE_MONO;
6899 }
6900 else
6901 {
6902 eDetectedAudioMode = (AUDIOMODE_TYPE)MApi_AUDIO_SIF_GetSoundMode();
6903 }
6904
6905 if(eDetectedAudioMode == E_AUDIOMODE_INVALID)
6906 {
6907 return;
6908 }
6909
6910 if(SIF_AudioMode == eDetectedAudioMode)
6911 {
6912 MApi_AUDIO_SIF_SetSoundMode(SIF_AudioMode);
6913 return;
6914 }
6915
6916 if(((SIF_AudioMode == E_AUDIOMODE_DUAL_A) || (SIF_AudioMode == E_AUDIOMODE_DUAL_B) || (SIF_AudioMode == E_AUDIOMODE_DUAL_AB))
6917 && ((eDetectedAudioMode == E_AUDIOMODE_DUAL_A) || (eDetectedAudioMode == E_AUDIOMODE_DUAL_B) || (eDetectedAudioMode == E_AUDIOMODE_DUAL_AB)))
6918 {
6919 MApi_AUDIO_SIF_SetSoundMode(SIF_AudioMode);
6920 return;
6921 }
6922
6923 if(((SIF_AudioMode == E_AUDIOMODE_NICAM_DUAL_A) || (SIF_AudioMode == E_AUDIOMODE_NICAM_DUAL_B) || (SIF_AudioMode == E_AUDIOMODE_NICAM_DUAL_AB))
6924 && ((eDetectedAudioMode == E_AUDIOMODE_NICAM_DUAL_A) || (eDetectedAudioMode == E_AUDIOMODE_NICAM_DUAL_B) || (eDetectedAudioMode == E_AUDIOMODE_NICAM_DUAL_AB)))
6925 {
6926 MApi_AUDIO_SIF_SetSoundMode(SIF_AudioMode);
6927 return;
6928 }
6929
6930 if((SIF_AudioMode == E_AUDIOMODE_FORCED_MONO) && (eDetectedAudioMode != E_AUDIOMODE_DUAL_A))
6931 {
6932 MApi_AUDIO_SIF_SetSoundMode(SIF_AudioMode);
6933 return;
6934 }
6935
6936 SIF_AudioMode = eDetectedAudioMode;
6937
6938 MApi_AUDIO_SIF_SetSoundMode(SIF_AudioMode);
6939 }
6940
AU_CUS_SIF_Monitor(void)6941 void AU_CUS_SIF_Monitor(void)
6942 {
6943 AUDIOSTATUS eCurrentAudioStatus;
6944
6945 if(TRUE != MApi_AUDIO_SIF_GetAudioStatus(&eCurrentAudioStatus))
6946 return;
6947
6948 if(SIF_AudioStatus != eCurrentAudioStatus)
6949 {
6950 SIF_AudioStatus = eCurrentAudioStatus;
6951 AU_CUS_Delay1MS(5);
6952 if(TRUE != MApi_AUDIO_SIF_GetAudioStatus(&eCurrentAudioStatus))
6953 return;
6954
6955 //Check twice for speed up detection
6956 if(SIF_AudioStatus != eCurrentAudioStatus)
6957 {
6958 SIF_AudioStatus = eCurrentAudioStatus;
6959 return;
6960 }
6961 }
6962
6963 //need touch.
6964 if(SIF_AudioStandard == E_AUDIOSTANDARD_L)
6965 {
6966 if(((SIF_AudioStatus & (E_STATE_AUDIO_PRIMARY_CARRIER | E_STATE_AUDIO_NICAM)) == (E_STATE_AUDIO_PRIMARY_CARRIER | E_STATE_AUDIO_NICAM))
6967 || ((SIF_AudioStatus & E_STATE_AUDIO_PRIMARY_CARRIER) == E_STATE_AUDIO_PRIMARY_CARRIER))
6968 {
6969 AU_CUS_CheckATVSoundMode();
6970 }
6971 return;
6972 }
6973
6974 if((SIF_AudioStatus & (E_STATE_AUDIO_PRIMARY_CARRIER | E_STATE_AUDIO_NICAM)) == (E_STATE_AUDIO_PRIMARY_CARRIER | E_STATE_AUDIO_NICAM))
6975 {
6976 if(FALSE == MApi_AUDIO_SIF_IsPALType(AU_SIF_PAL_NICAM))
6977 {
6978 switch(SIF_AudioStandard)
6979 {
6980 case E_AUDIOSTANDARD_BG:
6981 case E_AUDIOSTANDARD_BG_A2:
6982 SIF_AudioStandard = E_AUDIOSTANDARD_BG_NICAM;
6983 break;
6984 case E_AUDIOSTANDARD_DK:
6985 case E_AUDIOSTANDARD_DK1_A2:
6986 SIF_AudioStandard = E_AUDIOSTANDARD_DK_NICAM;
6987 break;
6988 default:
6989 break;
6990 }
6991 MApi_AUDIO_SIF_SetStandard(SIF_AudioStandard);
6992 MApi_AUDIO_SIF_SetPALType(AU_SIF_PAL_NICAM);
6993 AU_CUS_Delay1MS(50);
6994 }
6995 }
6996 else if((SIF_AudioStatus &(E_STATE_AUDIO_SECONDARY_CARRIER | E_STATE_AUDIO_PILOT)) ==
6997 (E_STATE_AUDIO_SECONDARY_CARRIER | E_STATE_AUDIO_PILOT))
6998 {
6999 //Reload A2 while Pilot detected. C.P.Chen
7000 if(FALSE == MApi_AUDIO_SIF_IsPALType(AU_SIF_PAL_A2))
7001 {
7002 if((SIF_AudioStatus & E_STATE_AUDIO_DK2) == E_STATE_AUDIO_DK2)
7003 SIF_AudioStandard = E_AUDIOSTANDARD_DK2_A2;
7004 else if((SIF_AudioStatus & E_STATE_AUDIO_DK3) == E_STATE_AUDIO_DK3)
7005 SIF_AudioStandard = E_AUDIOSTANDARD_DK3_A2;
7006
7007 MApi_AUDIO_SIF_SetStandard(SIF_AudioStandard);
7008 MApi_AUDIO_SIF_SetPALType(AU_SIF_PAL_A2);
7009
7010 AU_CUS_Delay1MS(50);
7011 }
7012 }
7013 else //if((SDK_eAudioStatus & E_STATE_AUDIO_PRIMARY_CARRIER) == E_STATE_AUDIO_PRIMARY_CARRIER)
7014 {
7015 switch(SIF_AudioStandard)
7016 {
7017 case E_AUDIOSTANDARD_BG_NICAM:
7018 MApi_AUDIO_SIF_SetStandard(E_AUDIOSTANDARD_BG_A2);
7019 SIF_AudioStandard = E_AUDIOSTANDARD_BG_A2;
7020 break;
7021 case E_AUDIOSTANDARD_DK_NICAM:
7022 case E_AUDIOSTANDARD_DK2_A2:
7023 case E_AUDIOSTANDARD_DK3_A2:
7024 MApi_AUDIO_SIF_SetStandard(E_AUDIOSTANDARD_DK1_A2);
7025 SIF_AudioStandard = E_AUDIOSTANDARD_DK1_A2;
7026 break;
7027 default:
7028 break;
7029 }
7030
7031 if(FALSE == MApi_AUDIO_SIF_IsPALType(AU_SIF_PAL_MONO))
7032 {
7033 MApi_AUDIO_SIF_SetPALType(AU_SIF_PAL_MONO);
7034 }
7035 }
7036
7037 AU_CUS_CheckATVSoundMode();
7038 }
7039
7040 /* Decoder */
AU_CUS_SetSyncMode(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,MS_BOOL bOnOff)7041 MS_BOOL AU_CUS_SetSyncMode(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_BOOL bOnOff)
7042 {
7043 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
7044
7045 AU_nDBG("[adecIndex = 0x%X] [bOnOff = 0x%X] \n", (unsigned int)adecIndex, (unsigned int)bOnOff);
7046
7047 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
7048
7049 //If in PVR case, it should be free run
7050 switch(adecIndex)
7051 {
7052 case API_AUDIO_CUSTOMER_ADEC0:
7053 {
7054 pstAudioCustomerShmData->g_audio_customer_ADEC0_SyncMode = bOnOff;
7055
7056 //PVR Case, set free run
7057 if(pstAudioCustomerShmData->g_audio_customer_ADEC0_TrickMode > API_AUDIO_CUSTOMER_TRICK_NONE)
7058 {
7059 bOnOff = FALSE;
7060 AU_nDBG("[adecIndex = 0x%x] [bOnOff = 0x%x] \n", (unsigned int)adecIndex, (unsigned int)bOnOff);
7061 }
7062 }
7063 break;
7064 case API_AUDIO_CUSTOMER_ADEC1:
7065 {
7066 pstAudioCustomerShmData->g_audio_customer_ADEC1_SyncMode = bOnOff;
7067
7068 //PVR Case, set free run
7069 if(pstAudioCustomerShmData->g_audio_customer_ADEC1_TrickMode > API_AUDIO_CUSTOMER_TRICK_NONE)
7070 {
7071 bOnOff = FALSE;
7072 AU_nDBG("[adecIndex = 0x%x] [bOnOff = 0x%x] \n", (unsigned int)adecIndex, (unsigned int)bOnOff);
7073 }
7074 }
7075 break;
7076
7077 default:
7078 break;
7079 }
7080
7081 if(bOnOff)
7082 {
7083 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_playControl, MMA_AVSYNC);
7084 }
7085 else
7086 {
7087 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_playControl, MMA_FREERUN);
7088 }
7089
7090 return TRUE;
7091 }
7092
7093 /* Common Decoder */
AU_CUS_COMMON_DECODER_Open(void * pData)7094 MS_S32 AU_CUS_COMMON_DECODER_Open(void * pData)
7095 {
7096 AU_nDBG("\n");
7097
7098 #if(UTPA_SUPPORT_COMMON_DECODER_API)
7099 {
7100 return MApi_AUDIO_DECODER_Open(pData);
7101 }
7102 #else
7103 {
7104 return FALSE;
7105 }
7106 #endif //#if(UTPA_SUPPORT_COMMON_DECODER_API)
7107 }
7108
AU_CUS_COMMON_DECODER_Close(MS_S32 s32DeviceID)7109 MS_S32 AU_CUS_COMMON_DECODER_Close(MS_S32 s32DeviceID)
7110 {
7111 AU_nDBG("[s32DeviceID = %ld] \n", (signed long)s32DeviceID);
7112
7113 #if(UTPA_SUPPORT_COMMON_DECODER_API)
7114 {
7115 return MApi_AUDIO_DECODER_Close(s32DeviceID);
7116 }
7117 #else
7118 {
7119 return FALSE;
7120 }
7121 #endif //#if(UTPA_SUPPORT_COMMON_DECODER_API)
7122 }
7123
AU_CUS_COMMON_DECODER_Start(MS_S32 s32DeviceID)7124 MS_S32 AU_CUS_COMMON_DECODER_Start(MS_S32 s32DeviceID)
7125 {
7126 AU_nDBG("[s32DeviceID = %ld] \n", (signed long)s32DeviceID);
7127
7128 #if(UTPA_SUPPORT_COMMON_DECODER_API)
7129 {
7130 return MApi_AUDIO_DECODER_Start(s32DeviceID);
7131 }
7132 #else
7133 {
7134 return FALSE;
7135 }
7136 #endif //#if(UTPA_SUPPORT_COMMON_DECODER_API)
7137 }
7138
AU_CUS_COMMON_DECODER_Stop(MS_S32 s32DeviceID)7139 MS_S32 AU_CUS_COMMON_DECODER_Stop(MS_S32 s32DeviceID)
7140 {
7141 AU_nDBG("[s32DeviceID = %ld] \n", (signed long)s32DeviceID);
7142
7143 #if(UTPA_SUPPORT_COMMON_DECODER_API)
7144 {
7145 return MApi_AUDIO_DECODER_Stop(s32DeviceID);
7146 }
7147 #else
7148 {
7149 return FALSE;
7150 }
7151 #endif //#if(UTPA_SUPPORT_COMMON_DECODER_API)
7152 }
7153
AU_CUS_COMMON_DECODER_Set(MS_S32 s32DeviceID,API_AUDIO_CUSTOMER_COMMON_DECODER_COMMAND Cmd,void * pData)7154 MS_S32 AU_CUS_COMMON_DECODER_Set(MS_S32 s32DeviceID, API_AUDIO_CUSTOMER_COMMON_DECODER_COMMAND Cmd, void* pData)
7155 {
7156 AU_nDBG("[s32DeviceID = %ld] \n", (signed long)s32DeviceID);
7157
7158 #if(UTPA_SUPPORT_COMMON_DECODER_API)
7159 {
7160 AUDIO_DECODER_Command_t cmd_t;
7161 strncpy(cmd_t.CmdName, Cmd.CmdName, strlen((char*)Cmd.CmdName) + 1);
7162 cmd_t.CmdLen = Cmd.CmdLen;
7163
7164 return MApi_AUDIO_DECODER_Set(s32DeviceID, cmd_t, pData);
7165 }
7166 #else
7167 {
7168 return FALSE;
7169 }
7170 #endif //#if(UTPA_SUPPORT_COMMON_DECODER_API)
7171 }
7172
AU_CUS_COMMON_DECODER_Get(MS_S32 s32DeviceID,API_AUDIO_CUSTOMER_COMMON_DECODER_COMMAND Cmd,void * pData)7173 MS_S32 AU_CUS_COMMON_DECODER_Get(MS_S32 s32DeviceID, API_AUDIO_CUSTOMER_COMMON_DECODER_COMMAND Cmd, void* pData)
7174 {
7175 AU_nDBG("[s32DeviceID = %ld] \n", (signed long)s32DeviceID);
7176
7177 #if(UTPA_SUPPORT_COMMON_DECODER_API)
7178 {
7179 AUDIO_DECODER_Command_t cmd_t;
7180 strncpy(cmd_t.CmdName, Cmd.CmdName, strlen((char*)Cmd.CmdName) + 1);
7181 cmd_t.CmdLen = Cmd.CmdLen;
7182
7183 return MApi_AUDIO_DECODER_Get(s32DeviceID, cmd_t, pData);
7184 }
7185 #else
7186 {
7187 return FALSE;
7188 }
7189 #endif //#if(UTPA_SUPPORT_COMMON_DECODER_API)
7190 }
7191
AU_CUS_COMMON_DECODER_Read(MS_S32 s32DeviceID,void * pBuf,MS_U32 u32Size)7192 MS_U32 AU_CUS_COMMON_DECODER_Read(MS_S32 s32DeviceID, void* pBuf, MS_U32 u32Size)
7193 {
7194 AU_nDBG("[s32DeviceID = %ld] [u32Size = 0x%x] \n", (signed long)s32DeviceID, (unsigned int)u32Size);
7195
7196 #if(UTPA_SUPPORT_COMMON_DECODER_API)
7197 {
7198 return MApi_AUDIO_DECODER_Read(s32DeviceID, pBuf, u32Size);
7199 }
7200 #else
7201 {
7202 return FALSE;
7203 }
7204 #endif //#if(UTPA_SUPPORT_COMMON_DECODER_API)
7205 }
7206
AU_CUS_COMMON_DECODER_Write(MS_S32 s32DeviceID,void * pBuf,MS_U32 u32Size)7207 MS_U32 AU_CUS_COMMON_DECODER_Write(MS_S32 s32DeviceID, void* pBuf, MS_U32 u32Size)
7208 {
7209 AU_nDBG("[s32DeviceID = %ld] [u32Size = 0x%x] \n", (signed long)s32DeviceID, (unsigned int)u32Size);
7210
7211 #if(UTPA_SUPPORT_COMMON_DECODER_API)
7212 {
7213 return MApi_AUDIO_DECODER_Write(s32DeviceID, pBuf, u32Size);
7214 }
7215 #else
7216 {
7217 return FALSE;
7218 }
7219 #endif //#if(UTPA_SUPPORT_COMMON_DECODER_API)
7220 }
7221
AU_CUS_COMMON_DECODER_Flush(MS_S32 s32DeviceID)7222 MS_S32 AU_CUS_COMMON_DECODER_Flush(MS_S32 s32DeviceID)
7223 {
7224 AU_nDBG("[s32DeviceID = %ld] \n", (signed long)s32DeviceID);
7225
7226 #if(UTPA_SUPPORT_COMMON_DECODER_API)
7227 {
7228 return MApi_AUDIO_DECODER_Flush(s32DeviceID);
7229 }
7230 #else
7231 {
7232 return FALSE;
7233 }
7234 #endif //#if(UTPA_SUPPORT_COMMON_DECODER_API)
7235 }
7236
7237 /* Common */
AU_CUS_SetAudioParam(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMER_PARAM_TYPE paramType,void * pParam)7238 MS_BOOL AU_CUS_SetAudioParam(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_PARAM_TYPE paramType, void *pParam)
7239 {
7240 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
7241
7242 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
7243
7244 AU_nThreadDBG("[adecIndex = 0x%X] [paramType = 0x%X] \n", (unsigned int)adecIndex, (unsigned int)paramType);
7245
7246 switch(paramType)
7247 {
7248 //--------------------------------------------------------------------------------------
7249 // Decoder (API_AUDIO_CUSTOMER_"ADEC"_PARAM_XXXXXXXX)
7250 //--------------------------------------------------------------------------------------
7251 //---MPEG---
7252 case API_AUDIO_CUSTOMER_ADEC_PARAM_MPEG_SOUND_MODE:
7253 {
7254 }
7255 break;
7256
7257 //---Dolby AC3P---
7258 case API_AUDIO_CUSTOMER_ADEC_PARAM_AC3P_DRC_MODE:
7259 {
7260 switch(adecIndex)
7261 {
7262 case API_AUDIO_CUSTOMER_ADEC0:
7263 {
7264 pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DolbyDRCMode = (*(API_AUDIO_CUSTOMER_DOLBY_DRC_MODE*)pParam);
7265 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DolbyDRCMode = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DolbyDRCMode);
7266 }
7267 break;
7268
7269 case API_AUDIO_CUSTOMER_ADEC1:
7270 {
7271 pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3P_DolbyDRCMode = (*(API_AUDIO_CUSTOMER_DOLBY_DRC_MODE*)pParam);
7272 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3P_DolbyDRCMode = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3P_DolbyDRCMode);
7273 }
7274 break;
7275
7276 default:
7277 {
7278 AU_nDBG("\n");
7279 }
7280 break;
7281 }
7282
7283 if( AUDIO_CHIP_TYPE >= API_AUDIO_CUSTOMER_CHIP_TYPE_2D1R)
7284 {
7285 MApi_AUDIO_SetAC3PInfo(Audio_AC3P_infoType_DrcMode, (MS_VIRT)pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DolbyDRCMode, 0);
7286 }
7287 else
7288 {
7289 MApi_AUDIO_SetAudioParam2(DecID, Audio_R2_SHM_PARAM_DOLBY_DRC_MODE, (*(API_AUDIO_CUSTOMER_DOLBY_DRC_MODE*)pParam));
7290 }
7291 }
7292 break;
7293
7294 case API_AUDIO_CUSTOMER_ADEC_PARAM_AC3P_DOWNMIX_MODE:
7295 {
7296 switch(adecIndex)
7297 {
7298 case API_AUDIO_CUSTOMER_ADEC0:
7299 {
7300 pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DownmixMode = (*(API_AUDIO_CUSTOMER_DOWNMIX_MODE*)pParam);
7301 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DownmixMode = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DownmixMode);
7302 }
7303 break;
7304
7305 case API_AUDIO_CUSTOMER_ADEC1:
7306 {
7307 pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3P_DownmixMode = (*(API_AUDIO_CUSTOMER_DOWNMIX_MODE*)pParam);
7308 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3P_DownmixMode = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3P_DownmixMode);
7309 }
7310 break;
7311
7312 default:
7313 {
7314 AU_nDBG("\n");
7315 }
7316 break;
7317 }
7318
7319 MApi_AUDIO_SetAudioParam2(DecID, Audio_R2_SHM_PARAM_DOLBY_DMX_MODE, (*(API_AUDIO_CUSTOMER_DOWNMIX_MODE*)pParam));
7320 }
7321 break;
7322
7323 case API_AUDIO_CUSTOMER_ADEC_PARAM_AC3P_DOLBY_BULLETIN11:
7324 {
7325 }
7326 break;
7327
7328 case API_AUDIO_CUSTOMER_ADEC_PARAM_AC3P_HDMITX_BYPASS_ENABLE:
7329 {
7330 MApi_AUDIO_SetAC3PInfo(Audio_AC3P_infoType_hdmiTxBypass_enable, *(MS_U32*)pParam, 0);
7331 AU_nDBG("[*(MS_U32*)pParam = %d] \n", (unsigned int)(*(MS_U32*)pParam));
7332 }
7333 break;
7334
7335 case API_AUDIO_CUSTOMER_ADEC_PARAM_AC3P_DRC_HIGHCUT_SCALE:
7336 {
7337 MApi_AUDIO_SetAudioParam2(DecID, Audio_R2_SHM_PARAM_DOLBY_HIGH_CUT, *(MS_U32*)pParam);
7338 AU_nDBG("[*(MS_U32*)pParam = %d] \n", (unsigned int)(*(MS_U32*)pParam));
7339 }
7340 break;
7341
7342 case API_AUDIO_CUSTOMER_ADEC_PARAM_AC3P_DRC_LOWBOOT_SCALE:
7343 {
7344 MApi_AUDIO_SetAudioParam2(DecID, Audio_R2_SHM_PARAM_DOLBY_LOW_BOOST, *(MS_U32*)pParam);
7345 AU_nDBG("[*(MS_U32*)pParam = %d] \n", (unsigned int)(*(MS_U32*)pParam));
7346 }
7347 break;
7348
7349 //---AAC---
7350 case API_AUDIO_CUSTOMER_ADEC_PARAM_AAC_DRC_MODE:
7351 {
7352 }
7353 break;
7354
7355 case API_AUDIO_CUSTOMER_ADEC_PARAM_AAC_DOWNMIX_MODE:
7356 {
7357 }
7358 break;
7359
7360 //---WMA---
7361 case API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_VERSION:
7362 {
7363 MApi_AUDIO_SetASFParm(WMA_PARAMTYPE_VERSION, *(MS_U32*)pParam);
7364 AU_nDBG("[*(MS_U32*)pParam = %d] \n", (unsigned int)(*(MS_U32*)pParam));
7365 }
7366 break;
7367
7368 case API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_CHANNELS:
7369 {
7370 MApi_AUDIO_SetASFParm(WMA_PARAMTYPE_CHANNELS, *(MS_U32*)pParam);
7371 AU_nDBG("[*(MS_U32*)pParam = %d] \n", (unsigned int)(*(MS_U32*)pParam));
7372 }
7373 break;
7374
7375 case API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_SAMPLERATE:
7376 {
7377 MApi_AUDIO_SetASFParm(WMA_PARAMTYPE_SAMPLERATE, *(MS_U32*)pParam);
7378 AU_nDBG("[*(MS_U32*)pParam = %d] \n", (unsigned int)(*(MS_U32*)pParam));
7379 }
7380 break;
7381
7382 case API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_BYTERATE:
7383 {
7384 MApi_AUDIO_SetASFParm(WMA_PARAMTYPE_BYTERATE, *(MS_U32*)pParam);
7385 AU_nDBG("[*(MS_U32*)pParam = %d] \n", (unsigned int)(*(MS_U32*)pParam));
7386 }
7387 break;
7388
7389 case API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_BLOCKALIGN:
7390 {
7391 MApi_AUDIO_SetASFParm(WMA_PARAMTYPE_BLOCKALIGN, *(MS_U32*)pParam);
7392 AU_nDBG("[*(MS_U32*)pParam = %d] \n", (unsigned int)(*(MS_U32*)pParam));
7393 }
7394 break;
7395
7396 case API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_ENCOPT:
7397 {
7398 MApi_AUDIO_SetASFParm(WMA_PARAMTYPE_ENCOPT, *(MS_U32*)pParam);
7399 AU_nDBG("[*(MS_U32*)pParam = %d] \n", (unsigned int)(*(MS_U32*)pParam));
7400 }
7401 break;
7402
7403 case API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_PARSINGBYAPP:
7404 {
7405 MApi_AUDIO_SetASFParm(WMA_PARAMTYPE_PARSINGBYAPP, *(MS_U32*)pParam);
7406 AU_nDBG("[*(MS_U32*)pParam = %d] \n", (unsigned int)(*(MS_U32*)pParam));
7407 }
7408 break;
7409
7410 case API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_BITS_PER_SAMPLE:
7411 {
7412 MApi_AUDIO_SetASFParm(WMA_PARAMTYPE_BITS_PER_SAMPLE, *(MS_U32*)pParam);
7413 AU_nDBG("[*(MS_U32*)pParam = %d] \n", (unsigned int)(*(MS_U32*)pParam));
7414 }
7415 break;
7416
7417 case API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_CHANNELMASK:
7418 {
7419 MApi_AUDIO_SetASFParm(WMA_PARAMTYPE_CHANNELMASK, *(MS_U32*)pParam);
7420 AU_nDBG("[*(MS_U32*)pParam = %d] \n", (unsigned int)(*(MS_U32*)pParam));
7421 }
7422 break;
7423
7424 case API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_DRC_PARAM_EXIST:
7425 {
7426 MApi_AUDIO_SetASFParm(WMA_PARAMTYPE_DRC_PARAM_EXIST, *(MS_U32*)pParam);
7427 AU_nDBG("[*(MS_U32*)pParam = %d] \n", (unsigned int)(*(MS_U32*)pParam));
7428 }
7429 break;
7430
7431 case API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_DRC_RMS_AMP_REF:
7432 {
7433 MApi_AUDIO_SetASFParm(WMA_PARAMTYPE_DRC_RMS_AMP_REF, *(MS_U32*)pParam);
7434 AU_nDBG("[*(MS_U32*)pParam = %d] \n", (unsigned int)(*(MS_U32*)pParam));
7435 }
7436 break;
7437
7438 case API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_DRC_RMS_AMP_TARGET:
7439 {
7440 MApi_AUDIO_SetASFParm(WMA_PARAMTYPE_DRC_RMS_AMP_TARGET, *(MS_U32*)pParam);
7441 AU_nDBG("[*(MS_U32*)pParam = %d] \n", (unsigned int)(*(MS_U32*)pParam));
7442 }
7443 break;
7444
7445 case API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_DRC_PEAK_AMP_REF:
7446 {
7447 MApi_AUDIO_SetASFParm(WMA_PARAMTYPE_DRC_PEAK_AMP_REF, *(MS_U32*)pParam);
7448 AU_nDBG("[*(MS_U32*)pParam = %d] \n", (unsigned int)(*(MS_U32*)pParam));
7449 }
7450 break;
7451
7452 case API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_DRC_PEAK_AMP_TARGET:
7453 {
7454 MApi_AUDIO_SetASFParm(WMA_PARAMTYPE_DRC_PEAK_AMP_TARGET, *(MS_U32*)pParam);
7455 AU_nDBG("[*(MS_U32*)pParam = %d] \n", (unsigned int)(*(MS_U32*)pParam));
7456 }
7457 break;
7458
7459 case API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_MAX_PACKET_SIZE:
7460 {
7461 MApi_AUDIO_SetASFParm(WMA_PARAMTYPE_MAX_PACKET_SIZE, *(MS_U32*)pParam);
7462 AU_nDBG("[*(MS_U32*)pParam = %d] \n", (unsigned int)(*(MS_U32*)pParam));
7463 }
7464 break;
7465
7466 //---XPCM---
7467 case API_AUDIO_CUSTOMER_ADEC_PARAM_XPCM:
7468 {
7469 Audio_XPCM_Param xpcm_param = {0,};
7470 xpcm_param.audioType = (*(API_AUDIO_CUSTOMER_XPCM_PARAM*)pParam).audioType;
7471 xpcm_param.sampleRate = (*(API_AUDIO_CUSTOMER_XPCM_PARAM*)pParam).sampleRate;
7472 xpcm_param.blockSize = (*(API_AUDIO_CUSTOMER_XPCM_PARAM*)pParam).blockSize;
7473 xpcm_param.samplePerBlock = (*(API_AUDIO_CUSTOMER_XPCM_PARAM*)pParam).samplePerBlock;
7474 xpcm_param.channels = (*(API_AUDIO_CUSTOMER_XPCM_PARAM*)pParam).channels;
7475 xpcm_param.bitsPerSample = (*(API_AUDIO_CUSTOMER_XPCM_PARAM*)pParam).bitsPerSample;
7476 #if(UTPA_SUPPORT_XPCM_PARAM_CHANNEL_MASK)
7477 {
7478 AU_nDBG("[xpcm_param.dwchannelMask = %d] \n", (unsigned int)(xpcm_param.dwchannelMask));
7479
7480 if((xpcm_param.dwchannelMask == 0) || (xpcm_param.dwchannelMask >= 0x3F)) //channel mask should between 00 0000(0x0) ~ 11 1111 (0x3F)
7481 {
7482 AU_nDBG("\n");
7483
7484 //upper layer don't set or set wrong channel mask. reset to default (0x3F)
7485 xpcm_param.dwchannelMask = 0x3F;
7486 }
7487 else
7488 {
7489 AU_nDBG("\n");
7490
7491 xpcm_param.dwchannelMask = (*(API_AUDIO_CUSTOMER_XPCM_PARAM*)pParam).dwchannelMask;
7492 }
7493
7494 if(pstAudioCustomerShmData->g_audio_customer_ADEC_Param_XPCM_ChannelMask_debug_Cmd != 0)
7495 {
7496 AU_nDBG("\n");
7497
7498 //debug mode of XPCM channel mask
7499 xpcm_param.dwchannelMask = pstAudioCustomerShmData->g_audio_customer_ADEC_Param_XPCM_ChannelMask_debug_Cmd;
7500 }
7501 }
7502 #endif //#if(UTPA_SUPPORT_XPCM_PARAM_CHANNEL_MASK)
7503
7504 AU_nDBG("[xpcm_param.audioType = %d] \n", (unsigned int)(xpcm_param.audioType));
7505 AU_nDBG("[xpcm_param.sampleRate = %d] \n", (unsigned int)(xpcm_param.sampleRate));
7506 AU_nDBG("[xpcm_param.blockSize = %d] \n", (unsigned int)(xpcm_param.blockSize));
7507 AU_nDBG("[xpcm_param.samplePerBlock = %d] \n", (unsigned int)(xpcm_param.samplePerBlock));
7508 AU_nDBG("[xpcm_param.channels = %d] \n", (unsigned int)(xpcm_param.channels));
7509 AU_nDBG("[xpcm_param.bitsPerSample = %d] \n", (unsigned int)(xpcm_param.bitsPerSample));
7510 #if(UTPA_SUPPORT_XPCM_PARAM_CHANNEL_MASK)
7511 AU_nDBG("[xpcm_param.dwchannelMask = 0x%x] \n", (unsigned int)(xpcm_param.dwchannelMask));
7512 #endif //#if(UTPA_SUPPORT_XPCM_PARAM_CHANNEL_MASK)
7513
7514 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_setXPCMDecParam, (MS_VIRT)(&xpcm_param));
7515 }
7516 break;
7517
7518 //---Underrun threshold---
7519 case API_AUDIO_CUSTOMER_ADEC_PARAM_UNDERRUN_THRESHOLD_IN_MS:
7520 {
7521 switch(adecIndex)
7522 {
7523 case API_AUDIO_CUSTOMER_ADEC0:
7524 {
7525 pstAudioCustomerShmData->g_audio_customer_ADEC0_Underrun_Threshold_in_ms = (*(MS_U32*)pParam);
7526 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC0_Underrun_Threshold_in_ms = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC0_Underrun_Threshold_in_ms);
7527 }
7528 break;
7529
7530 case API_AUDIO_CUSTOMER_ADEC1:
7531 {
7532 pstAudioCustomerShmData->g_audio_customer_ADEC1_Underrun_Threshold_in_ms = (*(MS_U32*)pParam);
7533 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC1_Underrun_Threshold_in_ms = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC1_Underrun_Threshold_in_ms);
7534 }
7535 break;
7536
7537 default:
7538 {
7539 AU_nDBG("\n");
7540 }
7541 break;
7542 }
7543 }
7544 break;
7545
7546 case API_AUDIO_CUSTOMER_ADEC_PARAM_UNDERRUN_DEBOUNCE_CNT:
7547 {
7548 switch(adecIndex)
7549 {
7550 case API_AUDIO_CUSTOMER_ADEC0:
7551 {
7552 pstAudioCustomerShmData->g_audio_customer_ADEC0_Underrun_Debounce_Cnt = (*(MS_U32*)pParam);
7553 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC0_Underrun_Debounce_Cnt = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC0_Underrun_Debounce_Cnt);
7554 }
7555 break;
7556
7557 case API_AUDIO_CUSTOMER_ADEC1:
7558 {
7559 pstAudioCustomerShmData->g_audio_customer_ADEC1_Underrun_Debounce_Cnt = (*(MS_U32*)pParam);
7560 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC1_Underrun_Debounce_Cnt = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC1_Underrun_Debounce_Cnt);
7561 }
7562 break;
7563
7564 default:
7565 {
7566 AU_nDBG("\n");
7567 }
7568 break;
7569 }
7570 }
7571 break;
7572
7573 //--------------------------------------------------------------------------------------
7574 // Common (API_AUDIO_CUSTOMER_"COMMON"_PARAM_XXXXXXXX)
7575 //--------------------------------------------------------------------------------------
7576 case API_AUDIO_CUSTOMER_COMMON_PARAM_DUMP_INFO_Off:
7577 {
7578 MApi_AUDIO_SetCommAudioInfo(Audio_Comm_infoType_Dump_Dsp_Info, (MS_U32)Audio_DumpInfo_Off, (MS_U32)0);
7579 }
7580 break;
7581
7582 case API_AUDIO_CUSTOMER_COMMON_PARAM_DUMP_INFO_AVSYNC:
7583 {
7584 MApi_AUDIO_SetCommAudioInfo(Audio_Comm_infoType_Dump_Dsp_Info, (MS_U32)Audio_DumpInfo_Avsync, (MS_U32)0);
7585 }
7586 break;
7587
7588 case API_AUDIO_CUSTOMER_COMMON_PARAM_DUMP_INFO_ADEC0:
7589 {
7590 MApi_AUDIO_SetCommAudioInfo(Audio_Comm_infoType_Dump_Dsp_Info, (MS_U32)Audio_DumpInfo_Dec1, (MS_U32)0);
7591 }
7592 break;
7593
7594 case API_AUDIO_CUSTOMER_COMMON_PARAM_DUMP_INFO_IO_INFO:
7595 {
7596 MApi_AUDIO_SetCommAudioInfo(Audio_Comm_infoType_Dump_Dsp_Info, (MS_U32)Audio_DumpInfo_IoInfo, (MS_U32)0);
7597 }
7598 break;
7599
7600 case API_AUDIO_CUSTOMER_COMMON_PARAM_DUMP_INFO_MM_FILE_AVSYNC:
7601 {
7602 MApi_AUDIO_SetCommAudioInfo(Audio_Comm_infoType_Dump_Dsp_Info, (MS_U32)Audio_DumpInfo_mmFileAVsync, (MS_U32)0);
7603 }
7604 break;
7605
7606 case API_AUDIO_CUSTOMER_COMMON_PARAM_DUMP_INFO_ALL:
7607 {
7608 MApi_AUDIO_SetCommAudioInfo(Audio_Comm_infoType_Dump_Dsp_Info, (MS_U32)Audio_DumpInfo_All, (MS_U32)0);
7609 }
7610 break;
7611
7612 case API_AUDIO_CUSTOMER_COMMON_PARAM_DUMP_INFO_AUTOTEST:
7613 {
7614 MApi_AUDIO_SetCommAudioInfo(Audio_Comm_infoType_Dump_Dsp_Info, (MS_U32)Audio_DumpInfo_AutoTest, (MS_U32)0);
7615 }
7616 break;
7617
7618 //---Common Cmd---
7619 case API_AUDIO_CUSTOMER_COMMON_PARAM_COMMON_CMD:
7620 {
7621 #if(UTPA_SUPPORT_COMMON_CMD_API)
7622 {
7623 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_CommonCmd, (MS_VIRT)pParam);
7624 }
7625 #endif
7626 }
7627 break;
7628
7629 //---OMX---
7630 case API_AUDIO_CUSTOMER_COMMON_PARAM_OMX_SPDIF_MODE:
7631 {
7632 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_omx_spdif_mode, (MS_VIRT)pParam);
7633 }
7634 break;
7635
7636 case API_AUDIO_CUSTOMER_COMMON_PARAM_OMX_SPDIF_PLAY:
7637 {
7638 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_omx_spdif_play, (MS_VIRT)pParam);
7639 }
7640 break;
7641
7642 default:
7643 {
7644 return FALSE;
7645 }
7646 }
7647 return TRUE;
7648 }
7649
AU_CUS_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMER_INFO_TYPE infoType,void * pInfo)7650 MS_BOOL AU_CUS_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_INFO_TYPE infoType, void *pInfo)
7651 {
7652 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
7653
7654 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
7655
7656 AU_nThreadDBG("[adecIndex = 0x%X] [infoType = 0x%X] \n", (unsigned int)adecIndex, (unsigned int)infoType);
7657
7658 switch(infoType)
7659 {
7660 //--------------------------------------------------------------------------------------
7661 // Decoder (API_AUDIO_CUSTOMER_"ADEC"_INFO_XXXXXXXX)
7662 //--------------------------------------------------------------------------------------
7663 //---MPEG---
7664 case API_AUDIO_CUSTOMER_ADEC_INFO_MPEG_SOUND_MODE:
7665 {
7666 }
7667 break;
7668
7669 //---Dolby AC3P---
7670 case API_AUDIO_CUSTOMER_ADEC_INFO_AC3P_DRC_MODE:
7671 {
7672 }
7673 break;
7674
7675 case API_AUDIO_CUSTOMER_ADEC_INFO_AC3P_DOWNMIX_MODE:
7676 {
7677 }
7678 break;
7679
7680 case API_AUDIO_CUSTOMER_ADEC_INFO_AC3P_IS_ATMOS_STREAM:
7681 {
7682 #if(UTPA_SUPPORT_IS_ATMOS_STREAM)
7683 {
7684 AUDIO_AC3_TYPE Ret = AUDIO_AC3_TYPE_DDP;
7685
7686 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_Decoder_Type, (void *)&Ret);
7687
7688 if(Ret == AUDIO_AC3_TYPE_ATMOS)
7689 {
7690 *(MS_U32*)pInfo = TRUE;
7691 }
7692 else
7693 {
7694 *(MS_U32*)pInfo = FALSE;
7695 }
7696
7697 AU_nThreadDBG("[*(MS_U32*)pInfo = 0x%X] \n", (unsigned int)(*(MS_U32*)pInfo));
7698 }
7699 #endif //#if(UTPA_SUPPORT_IS_ATMOS_STREAM)
7700 }
7701 break;
7702
7703 //---AAC---
7704 case API_AUDIO_CUSTOMER_ADEC_INFO_AAC_DRC_MODE:
7705 {
7706 }
7707 break;
7708
7709 case API_AUDIO_CUSTOMER_ADEC_INFO_AAC_DOWNMIX_MODE:
7710 {
7711 }
7712 break;
7713
7714 case API_AUDIO_CUSTOMER_ADEC_INFO_AAC_TYPE:
7715 {
7716 #if(UTPA_SUPPORT_AAC_TYPE)
7717 {
7718 AUDIO_AAC_TYPE Ret = AUDIO_AAC_TYPE_DOLBY_AAC;
7719
7720 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_Decoder_Type, (void *)&Ret);
7721
7722 switch(Ret)
7723 {
7724 case AUDIO_AAC_TYPE_GENERIC_AAC:
7725 {
7726 *(API_AUDIO_CUSTOMER_AAC_TYPE*)pInfo = API_AUDIO_CUSTOMER_AAC_TYPE_GENERIC_AAC;
7727 }
7728 break;
7729
7730 case AUDIO_AAC_TYPE_GENERIC_HEAACv1:
7731 {
7732 *(API_AUDIO_CUSTOMER_AAC_TYPE*)pInfo = API_AUDIO_CUSTOMER_AAC_TYPE_GENERIC_HEAACv1;
7733 }
7734 break;
7735
7736 case AUDIO_AAC_TYPE_GENERIC_HEAACv2:
7737 {
7738 *(API_AUDIO_CUSTOMER_AAC_TYPE*)pInfo = API_AUDIO_CUSTOMER_AAC_TYPE_GENERIC_HEAACv2;
7739 }
7740 break;
7741
7742 case AUDIO_AAC_TYPE_DOLBY_AAC:
7743 {
7744 *(API_AUDIO_CUSTOMER_AAC_TYPE*)pInfo = API_AUDIO_CUSTOMER_AAC_TYPE_DOLBY_AAC;
7745 }
7746 break;
7747
7748 case AUDIO_AAC_TYPE_DOLBY_HEAACv1:
7749 {
7750 *(API_AUDIO_CUSTOMER_AAC_TYPE*)pInfo = API_AUDIO_CUSTOMER_AAC_TYPE_DOLBY_HEAACv1;
7751 }
7752 break;
7753
7754 case AUDIO_AAC_TYPE_DOLBY_HEAACv2:
7755 {
7756 *(API_AUDIO_CUSTOMER_AAC_TYPE*)pInfo = API_AUDIO_CUSTOMER_AAC_TYPE_DOLBY_HEAACv2;
7757 }
7758 break;
7759
7760 default:
7761 break;
7762 }
7763
7764 AU_nThreadDBG("[*(MS_U32*)pInfo = 0x%X] \n", (unsigned int)(*(MS_U32*)pInfo));
7765 }
7766 #endif //#if(UTPA_SUPPORT_AAC_TYPE)
7767 }
7768 break;
7769
7770 //---Decode Info---
7771 case API_AUDIO_CUSTOMER_ADEC_INFO_SAMPLERATE:
7772 {
7773 int Ret = 0;
7774
7775 Ret = (int)MApi_AUDIO_GetCommAudioInfo(Audio_Comm_infoType_SampleRate);
7776 switch(Ret)
7777 {
7778 case AUDIO_FS_8KHZ: *(int*)pInfo = 8000; break;
7779 case AUDIO_FS_11KHZ: *(int*)pInfo = 11025; break;
7780 case AUDIO_FS_12KHZ: *(int*)pInfo = 12000; break;
7781 case AUDIO_FS_16KHZ: *(int*)pInfo = 16000; break;
7782 case AUDIO_FS_22KHZ: *(int*)pInfo = 22050; break;
7783 case AUDIO_FS_24KHZ: *(int*)pInfo = 24000; break;
7784 case AUDIO_FS_32KHZ: *(int*)pInfo = 32000; break;
7785 case AUDIO_FS_44KHZ: *(int*)pInfo = 44100; break;
7786 case AUDIO_FS_48KHZ: *(int*)pInfo = 48000; break;
7787 case AUDIO_FS_88KHZ: *(int*)pInfo = 88200; break;
7788 case AUDIO_FS_96KHZ: *(int*)pInfo = 96000; break;
7789 case AUDIO_FS_176KHZ: *(int*)pInfo = 128000; break;
7790 case AUDIO_FS_192KHZ: *(int*)pInfo = 192000; break;
7791 default : *(int*)pInfo = 0; break;
7792 }
7793 }
7794 break;
7795
7796 case API_AUDIO_CUSTOMER_ADEC_INFO_ACMODE:
7797 {
7798 int Ret = 0;
7799
7800 if(DecID == AU_DEC_ID3)
7801 {
7802 Ret = (int)MApi_AUDIO_GetCommAudioInfo(Audio_Comm_infoType_ADEC2_acmod);
7803 }
7804 else
7805 {
7806 Ret = (int)MApi_AUDIO_GetCommAudioInfo(Audio_Comm_infoType_ADEC1_acmod);
7807 }
7808
7809 switch(Ret)
7810 {
7811 case AUD_CH_MODE_DUAL_MONO: *(int*)pInfo = API_AUDIO_CUSTOMER_CH_MODE_DUAL_MONO; break;
7812 case AUD_CH_MODE_MONO: *(int*)pInfo = API_AUDIO_CUSTOMER_CH_MODE_MONO; break;
7813 case AUD_CH_MODE_STEREO: *(int*)pInfo = API_AUDIO_CUSTOMER_CH_MODE_STEREO; break;
7814 case AUD_CH_MODE_JOINT_STEREO: *(int*)pInfo = API_AUDIO_CUSTOMER_CH_MODE_JOINT_STEREO; break;
7815 default : *(int*)pInfo = API_AUDIO_CUSTOMER_CH_MODE_UNKNOWN; break;
7816 }
7817 }
7818 break;
7819
7820 case API_AUDIO_CUSTOMER_ADEC_INFO_AVSYNC_STATE:
7821 {
7822 int Ret = 0;
7823
7824 Ret = (int)MApi_AUDIO_GetCommAudioInfo(Audio_Comm_infoType_ADEC1_AudioSyncStatus);
7825 *(int*)pInfo = Ret;
7826 }
7827 break;
7828
7829 //--------------------------------------------------------------------------------------
7830 // Common (API_AUDIO_CUSTOMER_"COMMON"_INFO_XXXXXXXX)
7831 //--------------------------------------------------------------------------------------
7832 //---ES---
7833 case API_AUDIO_CUSTOMER_COMMON_INFO_ES_BUFFER_BASE:
7834 {
7835 MS_U32 Ret = 0;
7836
7837 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_UNI_ES_Base, (void *)&Ret);
7838 *(MS_U32*)pInfo = Ret;
7839
7840 AU_nThreadDBG("[*(MS_U32*)pInfo = 0x%X] \n", (unsigned int)(*(MS_U32*)pInfo));
7841 }
7842 break;
7843
7844 case API_AUDIO_CUSTOMER_COMMON_INFO_ES_BUFFER_SIZE:
7845 {
7846 MS_U32 Ret = 0;
7847
7848 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_UNI_ES_Size, (void *)&Ret);
7849 *(MS_U32*)pInfo = Ret;
7850
7851 AU_nThreadDBG("[*(MS_U32*)pInfo = 0x%X] \n", (unsigned int)(*(MS_U32*)pInfo));
7852 }
7853 break;
7854
7855 //---AD_ES (Audio description)---
7856 case API_AUDIO_CUSTOMER_COMMON_INFO_AD_ES_BUFFER_BASE:
7857 {
7858 MS_U32 Ret = 0;
7859 AUDIO_DEC_ID AD_DecID = AU_DEC_INVALID;
7860
7861 AD_DecID = AU_CUS_ConvertDriverMainDecIDtoDriverAdDecID(DecID);
7862
7863 MApi_AUDIO_GetAudioInfo2(AD_DecID, Audio_infoType_UNI_ES_Base, (void *)&Ret);
7864 *(MS_U32*)pInfo = Ret;
7865
7866 AU_nThreadDBG("[*(MS_U32*)pInfo = 0x%X] \n", (unsigned int)(*(MS_U32*)pInfo));
7867 }
7868 break;
7869
7870 case API_AUDIO_CUSTOMER_COMMON_INFO_AD_ES_BUFFER_SIZE:
7871 {
7872 MS_U32 Ret = 0;
7873 AUDIO_DEC_ID AD_DecID = AU_DEC_INVALID;
7874
7875 AD_DecID = AU_CUS_ConvertDriverMainDecIDtoDriverAdDecID(DecID);
7876
7877 MApi_AUDIO_GetAudioInfo2(AD_DecID, Audio_infoType_UNI_ES_Size, (void *)&Ret);
7878 *(MS_U32*)pInfo = Ret;
7879
7880 AU_nThreadDBG("[*(MS_U32*)pInfo = 0x%X] \n", (unsigned int)(*(MS_U32*)pInfo));
7881 }
7882 break;
7883
7884 //---PCM---
7885 case API_AUDIO_CUSTOMER_COMMON_INFO_PCM_BUFFER_CURRENT_LEVEL:
7886 {
7887 MS_U32 Ret = 0;
7888
7889 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_pcmBuf_currLevel, (void *)&Ret);
7890 *(MS_U32*)pInfo = Ret;
7891
7892 AU_nThreadDBG("[*(MS_U32*)pInfo = 0x%X] \n", (unsigned int)(*(MS_U32*)pInfo));
7893 }
7894 break;
7895
7896 case API_AUDIO_CUSTOMER_COMMON_INFO_PCM_BUFFER_CURRENT_LEVEL_IN_MS:
7897 {
7898 MS_U32 pcmBuf_currLevel = 0;
7899 MS_U32 tmp1 = 0;
7900 MS_U32 tmp2 = 0;
7901 MS_U32 tmp3 = 0;
7902 MS_U32 sampleRate = 0;
7903
7904 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_pcmBuf_currLevel, (void *)&pcmBuf_currLevel);
7905
7906 tmp3 = (MS_U32)MApi_AUDIO_GetCommAudioInfo(Audio_Comm_infoType_SampleRate);
7907 switch(tmp3)
7908 {
7909 case AUDIO_FS_8KHZ: sampleRate = 8000; break;
7910 case AUDIO_FS_11KHZ: sampleRate = 11025; break;
7911 case AUDIO_FS_12KHZ: sampleRate = 12000; break;
7912 case AUDIO_FS_16KHZ: sampleRate = 16000; break;
7913 case AUDIO_FS_22KHZ: sampleRate = 22050; break;
7914 case AUDIO_FS_24KHZ: sampleRate = 24000; break;
7915 case AUDIO_FS_32KHZ: sampleRate = 32000; break;
7916 case AUDIO_FS_44KHZ: sampleRate = 44100; break;
7917 case AUDIO_FS_48KHZ: sampleRate = 48000; break;
7918 case AUDIO_FS_88KHZ: sampleRate = 88200; break;
7919 case AUDIO_FS_96KHZ: sampleRate = 96000; break;
7920 case AUDIO_FS_176KHZ: sampleRate = 128000; break;
7921 case AUDIO_FS_192KHZ: sampleRate = 192000; break;
7922 default : sampleRate = 0; break;
7923 }
7924
7925 // pcm bytes to ms:
7926 // bytes * 1000ms / 2(ch) / 2(16 bits) / Sample rate
7927 tmp1 = (MS_U32)AU_CUS_long_div((MS_U64)(pcmBuf_currLevel * 1000), 2);
7928 tmp2 = (MS_U32)AU_CUS_long_div((MS_U64)(tmp1), 2);
7929 tmp3 = (MS_U32)AU_CUS_long_div((MS_U64)(tmp2), sampleRate);
7930
7931 *(MS_U32*)pInfo = tmp3;
7932 AU_nThreadDBG("[*(MS_U32*)pInfo = 0x%X] \n", (unsigned int)(*(MS_U32*)pInfo));
7933 }
7934 break;
7935
7936 //---PTS---
7937 case API_AUDIO_CUSTOMER_COMMON_INFO_33BIT_PTS:
7938 {
7939 MS_U64 pts = 0;
7940
7941 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_33bit_PTS, (void *)&pts);
7942 *(MS_U64*)pInfo = pts;
7943
7944 AU_nThreadDBG("[*(MS_U32*)pInfo = 0x%X] \n", (unsigned int)(*(MS_U32*)pInfo));
7945
7946 return TRUE;
7947 }
7948 break;
7949
7950 //---OK, ERR Frame Cnt, IS_MAD_LOCK---
7951 case API_AUDIO_CUSTOMER_COMMON_INFO_OK_FRAME_CNT:
7952 {
7953 MS_U32 Ret = 0;
7954
7955 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_okFrmCnt, (void *)&Ret);
7956 *(MS_U32*)pInfo = Ret;
7957 }
7958 break;
7959
7960 case API_AUDIO_CUSTOMER_COMMON_INFO_ERR_FRAME_CNT:
7961 {
7962 MS_U32 Ret = 0;
7963
7964 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_errFrmCnt, (void *)&Ret);
7965 *(MS_U32*)pInfo = Ret;
7966 }
7967 break;
7968
7969 case API_AUDIO_CUSTOMER_COMMON_INFO_IS_MAD_LOCK:
7970 {
7971 MS_BOOL Ret = 0;
7972 Ret = MApi_AUDIO_GetMAD_LOCK();
7973
7974 *(MS_BOOL*)pInfo = Ret;
7975 }
7976 break;
7977
7978 //---Delay---
7979 case API_AUDIO_CUSTOMER_COMMON_INFO_AUDIO_DELAY:
7980 {
7981 MS_U16 Ret = 0;
7982
7983 Ret = MApi_SND_GetParam1(Sound_GET_PARAM_AudioDelay, 0);
7984 *(MS_U16*)pInfo = Ret;
7985 }
7986 break;
7987
7988 case API_AUDIO_CUSTOMER_COMMON_INFO_SEDSP_MS12_DDE_DELAY:
7989 {
7990 *(MS_U16*)pInfo = AUDIO_COMMON_INFO_SEDSP_MS12_DDE_DELAY;
7991 }
7992 break;
7993
7994 case API_AUDIO_CUSTOMER_COMMON_INFO_SNDR2_MS12_DDPE_DELAY:
7995 {
7996 *(MS_U16*)pInfo = AUDIO_COMMON_INFO_SNDR2_MS12_DDPE_DELAY;
7997 }
7998 break;
7999
8000 case API_AUDIO_CUSTOMER_COMMON_INFO_SNDR2_MS12_DAP_DELAY:
8001 {
8002 *(MS_U16*)pInfo = AUDIO_COMMON_INFO_SNDR2_MS12_DAP_DELAY;
8003 }
8004 break;
8005
8006 default:
8007 {
8008 return FALSE;
8009 }
8010
8011 }
8012
8013 return TRUE;
8014 }
8015
8016 /* Customized patch */
AU_CUS_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMIZED_PATCH_PARAM_TYPE paramType,void * pParam)8017 MS_BOOL AU_CUS_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMIZED_PATCH_PARAM_TYPE paramType, void *pParam)
8018 {
8019 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
8020
8021 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
8022 AU_UNUSED(DecID);
8023
8024 AU_nThreadDBG("[adecIndex = 0x%X] [paramType = 0x%X] \n", (unsigned int)adecIndex, (unsigned int)paramType);
8025
8026 switch(paramType)
8027 {
8028 #if(CUSTOMIZED_PATCH_PARAM_ES_PASSTHROUGH)
8029 {
8030 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_ES_PASSTHROUGH_DELAY_SAMPLE:
8031 {
8032 MApi_AUDIO_SetCommAudioInfo(Audio_Comm_infoType_ES_PassThrough_DelaySmp, *(MS_VIRT*)pParam, 0);
8033 }
8034 break;
8035
8036 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_ES_PASSTHROUGH_PCM_SAMPLERATE:
8037 {
8038 MApi_AUDIO_SetCommAudioInfo(Audio_Comm_infoType_ES_PassThrough_PcmSmpRate, *(MS_VIRT*)pParam, 0);
8039 }
8040 break;
8041
8042 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_ES_PASSTHROUGH_HDMI_SAMPLERATE:
8043 {
8044 MApi_AUDIO_SetCommAudioInfo(Audio_Comm_infoType_ES_PassThrough_HdmiSmpRate, *(MS_VIRT*)pParam, 0);
8045 }
8046 break;
8047 }
8048 #endif //#if(CUSTOMIZED_PATCH_PARAM_ES_PASSTHROUGH)
8049
8050 #if(CUSTOMIZED_PATCH_PARAM_PCM_CAPTURE1_RPTR)
8051 {
8052 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_PCM_CAPTURE1_RPTR:
8053 {
8054 AU_CUS_WriteAbsReg(M2S_MBOX_PCM_CAPTURE_DDR_RdPtr, *(MS_U16*)pParam);
8055 }
8056 break;
8057 }
8058 #endif //#if(CUSTOMIZED_PATCH_PARAM_PCM_CAPTURE1_RPTR)
8059
8060 #if(CUSTOMIZED_PATCH_PARAM_PCM_CAPTURE2_RPTR)
8061 {
8062 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_PCM_CAPTURE2_RPTR:
8063 {
8064 AU_CUS_WriteAbsReg(M2S_MBOX_PCM_CAPTURE2_DDR_RdPtr, *(MS_U16*)pParam);
8065 }
8066 break;
8067 }
8068 #endif //#if(CUSTOMIZED_PATCH_PARAM_PCM_CAPTURE2_RPTR)
8069
8070 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_BYPASS)
8071 {
8072 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_HDMI_RX_BYPASS_ENABLE:
8073 {
8074 pstAudioCustomerShmData->g_audio_customer_patch_HDMI_RX_ByPass_bEnable = *(MS_BOOL*)pParam;
8075 if(pstAudioCustomerShmData->g_audio_customer_patch_HDMI_RX_ByPass_bEnable == FALSE)
8076 {
8077 if(pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_DriverOutputType == API_AUDIO_CUSTOMER_SPDIF_TX_PCM)
8078 {
8079 AU_CUS_WriteAbsMaskReg(REG_AUDIO_SPDIF_OUT_CFG, 0x07, 0x00); //Spdif HDMI bypass disable
8080 AU_CUS_WriteAbsMaskReg(REG_AUDIO_SPDIF2_OUT_CFG, 0x07, 0x00); //ARC HDMI bypass disable
8081 }
8082
8083 //recovery current SPDIF TX output type.
8084 AU_CUS_SPDIF_TX_SetOutputType(pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_UpperOutputType);
8085 }
8086 }
8087 break;
8088 }
8089 #endif //#if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_BYPASS)
8090
8091 #if(CUSTOMIZED_PATCH_PARAM_LOW_LATENCY)
8092 {
8093 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_LOW_LATENCY_LIMITER_ENABLE:
8094 {
8095 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_Low_Latency_Limiter_ES_enable, *(MS_BOOL*)pParam);
8096 }
8097 break;
8098
8099 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_LOW_LATENCY_LIMITER_ES_THRESHOLD:
8100 {
8101 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_Low_Latency_Limiter_ES_Threshold, *(MS_U16*)pParam);
8102 }
8103 break;
8104
8105 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_LOW_LATENCY_LIMITER_PCM_THRESHOLD:
8106 {
8107 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_Low_Latency_Limiter_PCM_Threshold, *(MS_U16*)pParam);
8108 }
8109 break;
8110
8111 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_LOW_LATENCY_LIMITER_PCM_SKIP_TARGET:
8112 {
8113 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_Low_Latency_Limiter_PCM_Skip_Target, *(MS_U16*)pParam);
8114 }
8115 break;
8116 }
8117 #endif //#if(CUSTOMIZED_PATCH_PARAM_LOW_LATENCY)
8118
8119 #if(CUSTOMIZED_PATCH_PARAM_DNSE)
8120 {
8121 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_DNSE_ENABLE:
8122 {
8123 MApi_AUDIO_ADVSOUND_ProcessEnable(SEC_SOUND);
8124 }
8125 break;
8126
8127 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_DNSE_AUTO_VOLUME_CTRL:
8128 {
8129 MApi_AUDIO_ADVSND_SetParam(SEC_AUTO_VOLUME_CTRL, *(MS_U32*)pParam, 0);
8130 }
8131 break;
8132
8133 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_DNSE_WIDE_STEREO_CTRL:
8134 {
8135 MApi_AUDIO_ADVSND_SetParam(SEC_WIDE_STEREO_CTRL, *(MS_U32*)pParam, 0);
8136 }
8137 break;
8138
8139 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_DNSE_WALL_FILTER_CTRL:
8140 {
8141 MApi_AUDIO_ADVSND_SetParam(SEC_WALL_FILTER_CTRL, *(MS_U32*)pParam, 0);
8142 }
8143 break;
8144
8145 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_DNSE_HEADROOM_GAIN_CTRL:
8146 {
8147 MApi_AUDIO_ADVSND_SetParam(SEC_HEADROOM_GAIN_CTRL, *(MS_U32*)pParam, 0);
8148 }
8149 break;
8150
8151 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_DNSE_GAIN_ADJUSTMENT_CTRL:
8152 {
8153 MApi_AUDIO_ADVSND_SetParam(SEC_GAIN_ADJUSTMENT_CTRL, *(MS_U32*)pParam, 0);
8154 }
8155 break;
8156
8157 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_DNSE_HARD_LIMITER_CTRL:
8158 {
8159 MApi_AUDIO_ADVSND_SetParam(SEC_HARD_LIMITER_CTRL, *(MS_U32*)pParam, 0);
8160 }
8161 break;
8162
8163 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_DNSE_MODE_IDENTIFICATION_CTRL:
8164 {
8165 MApi_AUDIO_ADVSND_SetParam(SEC_MODE_IDENTIFICATION_CTRL, *(MS_U32*)pParam, 0);
8166 }
8167 break;
8168 }
8169 #endif //#if(CUSTOMIZED_PATCH_PARAM_DNSE)
8170
8171 #if(CUSTOMIZED_PATCH_PARAM_DOLBY_ATMOS_CTRL)
8172 {
8173 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_DOLBY_ATMOS_ENABLE:
8174 {
8175 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_ddp_disable_atmos, 0);
8176 }
8177 break;
8178
8179 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_DOLBY_ATMOS_DISABLE:
8180 {
8181 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_ddp_disable_atmos, 1);
8182 }
8183 break;
8184 }
8185 #endif //#if(CUSTOMIZED_PATCH_PARAM_DOLBY_ATMOS_CTRL)
8186
8187 #if(CUSTOMIZED_PATCH_PARAM_MCU_DUMP_R2_LOG)
8188 {
8189 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_MCU_DUMP_R2_LOG_ENABLE:
8190 {
8191 //R2 WFI, bit11
8192 AU_CUS_WriteAbsMaskReg((MS_U32)REG_BANK_R2_WFI, REG_BANK_R2_WFI_ENABLE, REG_BANK_R2_WFI_ENABLE);
8193
8194 if(pstAudioCustomerShmData->g_audio_customer_patch_MCU_Dump_R2_Log_Moitor_bEnable == FALSE)
8195 {
8196 //Recover
8197 AU_nDBG("Recover Orignal_REG_BANK_R2_LOG_DBG = 0x%-4X,\n", pstAudioCustomerShmData->g_audio_customer_patch_MCU_Dump_R2_Log_Orignal_REG_BANK_R2_LOG_DBG);
8198
8199 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_R2_LOG_DBG, (MS_U16)pstAudioCustomerShmData->g_audio_customer_patch_MCU_Dump_R2_Log_Orignal_REG_BANK_R2_LOG_DBG);
8200 }
8201 }
8202 break;
8203
8204 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_MCU_DUMP_R2_LOG_OPTION:
8205 {
8206 pstAudioCustomerShmData->g_audio_customer_patch_MCU_Dump_R2_Log_Option = *(MS_U16*)pParam;
8207 pstAudioCustomerShmData->g_audio_customer_patch_MCU_Dump_R2_Log_Orignal_REG_BANK_R2_LOG_DBG = AU_CUS_ReadAbsReg((MS_U32)REG_BANK_R2_LOG_DBG);
8208
8209 AU_nDBG("Option = 0x%-4X,\n", pstAudioCustomerShmData->g_audio_customer_patch_MCU_Dump_R2_Log_Option);
8210 AU_nDBG("Orignal_REG_BANK_R2_LOG_DBG = 0x%-4X,\n", pstAudioCustomerShmData->g_audio_customer_patch_MCU_Dump_R2_Log_Orignal_REG_BANK_R2_LOG_DBG);
8211
8212 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_R2_LOG_DBG, (MS_U16)pstAudioCustomerShmData->g_audio_customer_patch_MCU_Dump_R2_Log_Option); // R2 print msg
8213 }
8214 break;
8215 }
8216 #endif //#if(CUSTOMIZED_PATCH_PARAM_MCU_DUMP_R2_LOG)
8217
8218 #if(CUSTOMIZED_PATCH_PARAM_ES_REPEAT_PLAY)
8219 {
8220 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_ES_REPLAY_PLAY_ENABLE:
8221 {
8222 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_Decoder_RepeatPlay, *(MS_BOOL*)pParam);
8223 }
8224 break;
8225 }
8226 #endif //#if(CUSTOMIZED_PATCH_PARAM_ES_REPEAT_PLAY)
8227
8228 #if(CUSTOMIZED_PATCH_PARAM_SEDSP_MS12_ENC_WO_MAIN_SND)
8229 {
8230 /*
8231 1R1D:
8232 [7:5] SPDIF / HDMI owner (MCU inform R2 to decide who is encode owner)
8233 000: DEC-R2
8234 001: SND-R2
8235 010: SE-DSP-DD / SE-DSP-DD
8236 011: SE-DSP-PCM / SE-DSP-DDP
8237
8238 [4:0] raw decoder selct
8239
8240 2R1D:
8241 [7:5] SPDIF / HDMI owner (MCU inform R2 to decide who is encode owner)
8242 000: DEC-R2
8243 001: SND-R2
8244 010: SE-DSP-DD / SE-DSP-DD
8245 011: SE-DSP-DD / SND-R2-DDP
8246
8247 [4:0] raw decoder selct
8248 */
8249
8250 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_HDMI_TX_SEDSP_DDE_WO_MAIN_SND_ENABLE:
8251 {
8252 AU_nDBG("\n");
8253
8254 pstAudioCustomerShmData->g_audio_customer_patch_HDMI_TX_SEDSP_DDE_WO_MAIN_SND_bEnable = TRUE;
8255
8256 AU_CUS_WriteAbsMaskReg(MBOX_BYTE_DEC_SPDIF_SEL, 0x00E0, 0x0040);
8257 }
8258 break;
8259
8260 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_HDMI_TX_SEDSP_DDPE_WO_MAIN_SND_ENABLE:
8261 {
8262 AU_nDBG("\n");
8263
8264 pstAudioCustomerShmData->g_audio_customer_patch_HDMI_TX_SEDSP_DDPE_WO_MAIN_SND_bEnable = TRUE;
8265
8266 AU_CUS_WriteAbsMaskReg(MBOX_BYTE_DEC_SPDIF_SEL, 0x00E0, 0x0060);
8267 }
8268 break;
8269
8270 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_SPDIF_TX_SEDSP_DDE_WO_MAIN_SND_ENABLE:
8271 {
8272 AU_nDBG("\n");
8273
8274 pstAudioCustomerShmData->g_audio_customer_patch_SPDIF_TX_SEDSP_DDE_WO_MAIN_SND_bEnable = TRUE;
8275
8276 AU_CUS_WriteAbsMaskReg(MBOX_BYTE_DEC_SPDIF_SEL, 0x00E0, 0x0040);
8277 }
8278 break;
8279
8280 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_SEDSP_MS12_ENC_WO_MAIN_SND_DISABLE:
8281 {
8282 AU_nDBG("\n");
8283 pstAudioCustomerShmData->g_audio_customer_patch_HDMI_TX_SEDSP_DDE_WO_MAIN_SND_bEnable = FALSE;
8284 pstAudioCustomerShmData->g_audio_customer_patch_HDMI_TX_SEDSP_DDPE_WO_MAIN_SND_bEnable = FALSE;
8285 pstAudioCustomerShmData->g_audio_customer_patch_SPDIF_TX_SEDSP_DDE_WO_MAIN_SND_bEnable = FALSE;
8286 AU_CUS_PATCH_SeDSP_MS12_Enc_wo_Main_Snd_disable();
8287 }
8288 break;
8289 }
8290 #endif //#if(CUSTOMIZED_PATCH_PARAM_SEDSP_MS12_ENC_WO_MAIN_SND)
8291
8292 #if(CUSTOMIZED_PATCH_PARAM_SNDR2_MS12_ENC_WO_MAIN_SND)
8293 {
8294 /*
8295 1R1D:
8296 [7:5] SPDIF / HDMI owner (MCU inform R2 to decide who is encode owner)
8297 000: DEC-R2
8298 001: SND-R2
8299 010: SE-DSP-DD / SE-DSP-DD
8300 011: SE-DSP-PCM / SE-DSP-DDP
8301
8302 [4:0] raw decoder selct
8303
8304 2R1D:
8305 [7:5] SPDIF / HDMI owner (MCU inform R2 to decide who is encode owner)
8306 000: DEC-R2
8307 001: SND-R2
8308 010: SE-DSP-DD / SE-DSP-DD
8309 011: SE-DSP-DD / SND-R2-DDP
8310
8311 [4:0] raw decoder selct
8312 */
8313
8314 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_HDMI_ARC_SEDSP_DDE_WO_MAIN_SND_ENABLE:
8315 {
8316 AU_nDBG("\n");
8317
8318 pstAudioCustomerShmData->g_audio_customer_patch_HDMI_ARC_SEDSP_DDE_WO_MAIN_SND_bEnable = TRUE;
8319
8320 AU_CUS_WriteAbsMaskReg(MBOX_BYTE_DEC_SPDIF_SEL, 0x00E0, 0x0040);
8321 }
8322 break;
8323
8324 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_HDMI_ARC_SNDR2_DDPE_WO_MAIN_SND_ENABLE:
8325 {
8326 AU_nDBG("\n");
8327
8328 pstAudioCustomerShmData->g_audio_customer_patch_HDMI_ARC_SNDR2_DDPE_WO_MAIN_SND_bEnable = TRUE;
8329
8330 AU_CUS_WriteAbsMaskReg(MBOX_BYTE_DEC_SPDIF_SEL, 0x00E0, 0x0060);
8331 }
8332 break;
8333
8334 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_SEDSP_MS12_ENC_WO_MAIN_SND_DISABLE:
8335 {
8336 AU_nDBG("\n");
8337 pstAudioCustomerShmData->g_audio_customer_patch_HDMI_ARC_SEDSP_DDE_WO_MAIN_SND_bEnable = FALSE;
8338 pstAudioCustomerShmData->g_audio_customer_patch_HDMI_ARC_SNDR2_DDPE_WO_MAIN_SND_bEnable = FALSE;
8339 AU_CUS_PATCH_SndR2_MS12_Enc_wo_Main_Snd_disable();
8340 }
8341 break;
8342 }
8343 #endif //#if(CUSTOMIZED_PATCH_PARAM_SNDR2_MS12_ENC_WO_MAIN_SND)
8344
8345 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_SWITCH_TO_PCM_DEBOUNCE)
8346 {
8347 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_HDMI_RX_SWITCH_TO_PCM_DEBOUNCE:
8348 {
8349 AU_nDBG("\n");
8350 pstAudioCustomerShmData->g_audio_customer_patch_HDMI_RX_switch_to_pcm_debounce_in_ms = *(MS_U32*)pParam;
8351 }
8352 break;
8353 }
8354 #endif //#if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_SWITCH_TO_PCM_DEBOUNCE)
8355
8356 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK)
8357 {
8358 case API_AUDIO_CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK_REGISTER:
8359 {
8360 if(pParam)
8361 {
8362 AU_nDBG("\n");
8363 madCallBack.pFunc_HDMIMonitorEvent = (pfnAudioCustomerHDMIMonitorEvent)pParam;
8364 }
8365 else
8366 {
8367 AU_nDBG("\n");
8368 madCallBack.pFunc_HDMIMonitorEvent = NULL;
8369 }
8370 }
8371 break;
8372 }
8373 #endif //#if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK)
8374
8375 default:
8376 {
8377 return FALSE;
8378 }
8379 }
8380 return TRUE;
8381 }
8382
AU_CUS_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMIZED_PATCH_INFO_TYPE infoType,void * pInfo)8383 MS_BOOL AU_CUS_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMIZED_PATCH_INFO_TYPE infoType, void *pInfo)
8384 {
8385 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
8386
8387 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
8388
8389 AU_nThreadDBG("[adecIndex = 0x%X] [infoType = 0x%X] \n", (unsigned int)adecIndex, (unsigned int)infoType);
8390
8391 switch(infoType)
8392 {
8393 #if(CUSTOMIZED_PATCH_INFO_SPDIF_NPCM_WPTR)
8394 {
8395 case API_AUDIO_CUSTOMIZED_PATCH_INFO_SPDIF_NONPCM_WPTR:
8396 {
8397 MS_U32 *pU32data = (MS_U32*) pInfo;
8398 *pU32data = (MS_U32)AU_CUS_ReadDM(AU_DEC_ID1, DSP2DmAddr_nonpcm_capture_wptr, FALSE);
8399 }
8400 break;
8401 }
8402 #endif //#if(CUSTOMIZED_PATCH_INFO_SPDIF_NPCM_WPTR)
8403
8404 #if(CUSTOMIZED_PATCH_INFO_PCM_CAPTURE1_WPTR)
8405 {
8406 case API_AUDIO_CUSTOMIZED_PATCH_INFO_PCM_CAPTURE1_WPTR:
8407 {
8408 MS_U32 *pU32data = (MS_U32*) pInfo;
8409 *pU32data = (MS_U32)AU_CUS_ReadAbsReg(S2M_MBOX_PCM_CAPTURE_DDR_WrPtr);
8410 }
8411 break;
8412 }
8413 #endif //#if(CUSTOMIZED_PATCH_INFO_PCM_CAPTURE1_WPTR)
8414
8415 #if(CUSTOMIZED_PATCH_INFO_PCM_CAPTURE2_WPTR)
8416 {
8417 case API_AUDIO_CUSTOMIZED_PATCH_INFO_PCM_CAPTURE2_WPTR:
8418 {
8419 MS_U32 *pU32data = (MS_U32*) pInfo;
8420 *pU32data = (MS_U32)AU_CUS_ReadAbsReg(S2M_MBOX_PCM_CAPTURE2_DDR_WrPtr);
8421 }
8422 break;
8423 }
8424 #endif //#if(CUSTOMIZED_PATCH_INFO_PCM_CAPTURE2_WPTR)
8425
8426 #if(CUSTOMIZED_PATCH_INFO_MCU_DUMP_R2_LOG)
8427 {
8428 case API_AUDIO_CUSTOMIZED_PATCH_INFO_R2_UART_BUF_BASE:
8429 {
8430 MS_U32 Ret = 0;
8431
8432 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_R2_uart_buf_base, (void *)&Ret);
8433 *(MS_U32*)pInfo = ( Ret + MApi_AUDIO_GetDspMadBaseAddr(2) );
8434 }
8435 break;
8436
8437 case API_AUDIO_CUSTOMIZED_PATCH_INFO_R2_UART_BUF_SIZE:
8438 {
8439 MS_U32 Ret = 0;
8440
8441 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_R2_uart_buf_size, (void *)&Ret);
8442 *(MS_U32*)pInfo = Ret;
8443 }
8444 break;
8445
8446 case API_AUDIO_CUSTOMIZED_PATCH_INFO_R2_UART_BUF_WPTR:
8447 {
8448 MS_U32 Buf_Base = 0;
8449 MS_U32 Buf_Wptr = 0;
8450
8451 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_R2_uart_buf_base, (void *)&Buf_Base);
8452 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_R2_uart_buf_wptr, (void *)&Buf_Wptr);
8453 *(MS_U32*)pInfo = ( Buf_Base + Buf_Wptr + MApi_AUDIO_GetDspMadBaseAddr(2) );
8454 }
8455 break;
8456 }
8457 #endif //#if(CUSTOMIZED_PATCH_INFO_MCU_DUMP_R2_LOG)
8458
8459 #if(CUSTOMIZED_PATCH_INFO_DEC_PCM1_BUFFER)
8460 {
8461 case API_AUDIO_CUSTOMIZED_PATCH_INFO_DEC_PCM1_BUF_BASE:
8462 {
8463 MS_U32 Ret = (MS_U32)OFFSET_PCM1_DRAM_ADDR + MApi_AUDIO_GetDspMadBaseAddr(1) + (MS_U32)ASND_DSP_DDR_SIZE;
8464 *(MS_U32*)pInfo = Ret;
8465 }
8466 break;
8467
8468 case API_AUDIO_CUSTOMIZED_PATCH_INFO_DEC_PCM1_BUF_SIZE:
8469 {
8470 MS_U32 Ret = (MS_U32)PCM1_DRAM_SIZE;
8471 *(MS_U32*)pInfo = Ret;
8472 }
8473 break;
8474
8475 case API_AUDIO_CUSTOMIZED_PATCH_INFO_DEC_PCM1_BUF_WPTR:
8476 {
8477 MS_U32 Ret = (MS_U32)MApi_AUDIO_GetCommAudioInfo(Audio_Comm_infoType_ADEC1_UNI_pcm_wptr);
8478 *(MS_U32*)pInfo = Ret;
8479 }
8480 break;
8481 }
8482 #endif //#if(CUSTOMIZED_PATCH_INFO_DEC_PCM1_BUFFER)
8483
8484 #if(CUSTOMIZED_PATCH_INFO_HDMI_NPCM_BUFFER)
8485 {
8486 case API_AUDIO_CUSTOMIZED_PATCH_INFO_HDMI_NPCM_BUF_BASE:
8487 {
8488 MS_U32 Ret = 0;
8489
8490 #if(UTPA_AUDIO_CHIP_TYPE_1R1D)
8491 {
8492 Ret = (MS_U32)OFFSET_HDMI_NONPCM_DRAM_BASE + MApi_AUDIO_GetDspMadBaseAddr(1);
8493 }
8494 #elif(UTPA_AUDIO_CHIP_TYPE_2R1D)
8495 {
8496 Ret = (MS_U32)OFFSET_HDMI_NONPCM_DRAM_BASE + MApi_AUDIO_GetDspMadBaseAddr(1) + ASND_DSP_DDR_SIZE;
8497 }
8498 #endif
8499
8500 *(MS_U32*)pInfo = Ret;
8501 }
8502 break;
8503
8504 case API_AUDIO_CUSTOMIZED_PATCH_INFO_HDMI_NPCM_BUF_SIZE:
8505 {
8506 MS_U32 Ret = (MS_U32)HDMI_NONPCM_DRAM_SIZE;
8507 *(MS_U32*)pInfo = Ret;
8508 }
8509 break;
8510
8511 case API_AUDIO_CUSTOMIZED_PATCH_INFO_HDMI_NPCM_BUF_RPTR:
8512 {
8513 MS_U32 Ret = 0;
8514
8515 #if(UTPA_AUDIO_CHIP_TYPE_1R1D)
8516 {
8517 Ret = (MS_U32)OFFSET_HDMI_NONPCM_DRAM_BASE + MApi_AUDIO_GetDspMadBaseAddr(1) + (MS_U32)( AU_CUS_ReadAbsReg(S2M_MBOX_HDMI_NPCM_RPTR)<<4 );
8518 }
8519 #elif(UTPA_AUDIO_CHIP_TYPE_2R1D)
8520 {
8521 Ret = (MS_U32)OFFSET_HDMI_NONPCM_DRAM_BASE + MApi_AUDIO_GetDspMadBaseAddr(1) + ASND_DSP_DDR_SIZE + (MS_U32)( AU_CUS_ReadAbsReg(S2M_MBOX_HDMI_NPCM_RPTR)<<4 );
8522 }
8523 #endif
8524
8525 *(MS_U32*)pInfo = Ret;
8526 }
8527 break;
8528
8529 case API_AUDIO_CUSTOMIZED_PATCH_INFO_HDMI_NPCM_BUF_WPTR:
8530 {
8531 MS_U32 Ret = 0;
8532
8533 #if(UTPA_AUDIO_CHIP_TYPE_1R1D)
8534 {
8535 Ret = (MS_U32)OFFSET_HDMI_NONPCM_DRAM_BASE + MApi_AUDIO_GetDspMadBaseAddr(1) + (MS_U32)( AU_CUS_ReadAbsReg(S2M_MBOX_HDMI_NPCM_WPTR)<<4 );
8536 }
8537 #elif(UTPA_AUDIO_CHIP_TYPE_2R1D)
8538 {
8539 Ret = (MS_U32)OFFSET_HDMI_NONPCM_DRAM_BASE + MApi_AUDIO_GetDspMadBaseAddr(1) + ASND_DSP_DDR_SIZE + (MS_U32)( AU_CUS_ReadAbsReg(S2M_MBOX_HDMI_NPCM_WPTR)<<4 );
8540 }
8541 #endif
8542
8543 *(MS_U32*)pInfo = Ret;
8544 }
8545 break;
8546 }
8547 #endif //#if(CUSTOMIZED_PATCH_INFO_HDMI_NPCM_BUFFER)
8548
8549 #if(CUSTOMIZED_PATCH_INFO_MS12_DDPE_METADATA_BUFFER)
8550 {
8551 case API_AUDIO_CUSTOMIZED_PATCH_INFO_MS12_DDPE_METADATA_BUF_BASE:
8552 {
8553 MS_U32 Ret = (MS_U32)OFFSET_DDPENC_METADATA_DRAM_ADDR + MApi_AUDIO_GetDspMadBaseAddr(1) + (MS_U32)ASND_DSP_DDR_SIZE;
8554 *(MS_U32*)pInfo = Ret;
8555 }
8556 break;
8557
8558 case API_AUDIO_CUSTOMIZED_PATCH_INFO_MS12_DDPE_METADATA_BUF_SIZE:
8559 {
8560 MS_U32 Ret = (MS_U32)DDPENC_METADATA_DRAM_SIZE;
8561 *(MS_U32*)pInfo = Ret;
8562 }
8563 break;
8564
8565 case API_AUDIO_CUSTOMIZED_PATCH_INFO_MS12_DDPE_METADATA_BUF_WPTR:
8566 {
8567 MS_U32 Ret = (MS_U32)OFFSET_DDPENC_METADATA_DRAM_ADDR + MApi_AUDIO_GetDspMadBaseAddr(1) + (MS_U32)( AU_CUS_ReadAbsReg(S2M_MBOX_DDPE_METADATA_WPTR)<<4 );
8568 *(MS_U32*)pInfo = Ret;
8569 }
8570 break;
8571 }
8572 #endif //#if(CUSTOMIZED_PATCH_INFO_MS12_DDPE_METADATA_BUFFER)
8573
8574 #if(CUSTOMIZED_PATCH_INFO_DEC_ES1_BUFFER)
8575 {
8576 case API_AUDIO_CUSTOMIZED_PATCH_INFO_DEC_ES1_BUF_BASE:
8577 {
8578 MS_U32 u32ES1BufStartAddr_P = 0;
8579 MApi_AUDIO_GetAudioInfo2(AU_DEC_ID1, Audio_infoType_UNI_ES_Base, &u32ES1BufStartAddr_P);
8580
8581 *(MS_U32*)pInfo = u32ES1BufStartAddr_P;
8582 }
8583 break;
8584
8585 case API_AUDIO_CUSTOMIZED_PATCH_INFO_DEC_ES1_BUF_SIZE:
8586 {
8587 MS_U32 Ret = (MS_U32)ES1_DRAM_SIZE;
8588 *(MS_U32*)pInfo = Ret;
8589 }
8590 break;
8591
8592 case API_AUDIO_CUSTOMIZED_PATCH_INFO_DEC_ES1_BUF_RPTR:
8593 {
8594 AES_INFO currentAESInfo = {0,};
8595 MApi_AUDIO_MM2_checkAesInfo(DecID, ¤tAESInfo);
8596
8597 MS_U32 Ret = MApi_AUDIO_GetDspMadBaseAddr(1) + currentAESInfo.aes_read_addr;
8598 *(MS_U32*)pInfo = Ret;
8599 }
8600 break;
8601
8602 case API_AUDIO_CUSTOMIZED_PATCH_INFO_DEC_ES1_BUF_WPTR:
8603 {
8604 AES_INFO currentAESInfo = {0,};
8605 MApi_AUDIO_MM2_checkAesInfo(DecID, ¤tAESInfo);
8606
8607 MS_U32 Ret = MApi_AUDIO_GetDspMadBaseAddr(1) + currentAESInfo.aes_write_addr;
8608 *(MS_U32*)pInfo = Ret;
8609 }
8610 break;
8611 }
8612 #endif //#if(CUSTOMIZED_PATCH_INFO_DEC_ES1_BUFFER)
8613
8614 default:
8615 {
8616 return FALSE;
8617 }
8618
8619 }
8620 return TRUE;
8621 }
8622
AU_CUS_PATCH_SeDSP_MS12_Enc_wo_Main_Snd_disable(void)8623 void AU_CUS_PATCH_SeDSP_MS12_Enc_wo_Main_Snd_disable(void)
8624 {
8625 #if(CUSTOMIZED_PATCH_PARAM_SEDSP_MS12_ENC_WO_MAIN_SND)
8626 {
8627 AU_nDBG("\n");
8628 AU_CUS_WriteAbsMaskReg(MBOX_BYTE_DEC_SPDIF_SEL, 0x00E0, 0x0000);
8629 }
8630 #endif
8631 }
8632
AU_CUS_PATCH_SndR2_MS12_Enc_wo_Main_Snd_disable(void)8633 void AU_CUS_PATCH_SndR2_MS12_Enc_wo_Main_Snd_disable(void)
8634 {
8635 #if(CUSTOMIZED_PATCH_PARAM_SNDR2_MS12_ENC_WO_MAIN_SND)
8636 {
8637 AU_nDBG("\n");
8638 AU_CUS_WriteAbsMaskReg(MBOX_BYTE_DEC_SPDIF_SEL, 0x00E0, 0x0000);
8639 }
8640 #endif
8641 }
8642
8643 /* Customized Internal patch */
AU_CUS_INTERNAL_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,AU_CUS_INTERNAL_PATCH_PARAM_TYPE paramType,void * pParam)8644 MS_BOOL AU_CUS_INTERNAL_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, AU_CUS_INTERNAL_PATCH_PARAM_TYPE paramType, void *pParam)
8645 {
8646 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
8647
8648 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
8649 AU_UNUSED(DecID);
8650
8651 AU_nThreadDBG("[adecIndex = 0x%X] [paramType = 0x%X] \n", (unsigned int)adecIndex, (unsigned int)paramType);
8652
8653 switch(paramType)
8654 {
8655 case AU_CUS_INTERNAL_PATCH_PARAM_ADEC_SET_GAIN:
8656 {
8657 #if(CUSTOMIZED_INTERNAL_PATCH_PARAM_ADEC_SET_GAIN)
8658 {
8659 AU_nDBG("\n");
8660 /**
8661 * AU_CUS_ADEC_SetGain
8662 * gain Scale : 0.125dB
8663 * gain Range : -114.875dB ~ 0dB
8664 * ex. gain 0 = -114.875dB; gain 919 = 0dB
8665 */
8666 AU_CUS_ADEC_SetGain(adecIndex, *(int*) pParam);
8667 }
8668 #endif //#if(CUSTOMIZED_INTERNAL_PATCH_PARAM_ADEC_SET_GAIN)
8669 }
8670 break;
8671
8672 case AU_CUS_INTERNAL_PATCH_PARAM_ADEC_SET_MUTE:
8673 {
8674 #if(CUSTOMIZED_INTERNAL_PATCH_PARAM_ADEC_SET_MUTE)
8675 {
8676 AU_nDBG("\n");
8677 AU_CUS_ADEC_SetMute(adecIndex, *(MS_BOOL*) pParam);
8678 }
8679 #endif //#if(CUSTOMIZED_INTERNAL_PATCH_PARAM_ADEC_SET_MUTE)
8680 }
8681 break;
8682
8683 case AU_CUS_INTERNAL_PATCH_PARAM_MS12_HDMI_TX_PCM_AUDIO_DELAY:
8684 {
8685 #if(CUSTOMIZED_INTERNAL_PATCH_PARAM_MS12_HDMI_TX_PCM_AUTO_AUDIO_DELAY_ENABLE)
8686 {
8687 AU_nDBG("\n");
8688 AU_CUS_SetAudioDelay(*(MS_U32*) pParam);
8689 }
8690 #endif //#if(CUSTOMIZED_INTERNAL_PATCH_PARAM_MS12_HDMI_TX_PCM_AUTO_AUDIO_DELAY_ENABLE)
8691 }
8692 break;
8693
8694 case AU_CUS_INTERNAL_PATCH_PARAM_GENERAL_BUFFER_DUMP_ENABLE:
8695 {
8696 #if(CUSTOMIZED_INTERNAL_PATCH_PARAM_GENERAL_BUFFER_DUMP)
8697 {
8698 pstAudioCustomerShmData->g_audio_customer_internal_patch_General_Buffer_Dump_bEnable = *(MS_BOOL*) pParam;
8699 }
8700 #endif //#if(CUSTOMIZED_INTERNAL_PATCH_PARAM_GENERAL_BUFFER_DUMP)
8701 }
8702 break;
8703
8704 case AU_CUS_INTERNAL_PATCH_PARAM_SNDR2_MS12_PCMR_METADATA_SELECT:
8705 {
8706 #if(CUSTOMIZED_INTERNAL_PATCH_PARAM_SNDR2_MS12_PCMR_METADATA_SELECT)
8707 {
8708 pstAudioCustomerShmData->g_audio_customer_internal_patch_SndR2_MS12_Pcmr_Metadata_Select = *(API_AUDIO_CUSTOMER_SNDR2_MS12_PCMR_METADATA_SELECT*) pParam;
8709
8710 AU_nDBG("SndR2_MS12_Pcmr_Metadata_Select: %d\n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_SndR2_MS12_Pcmr_Metadata_Select );
8711
8712 // 0x112E92[10:9] = 00: R2 decoder is activated
8713 // 0x112E92[10:9] = 01: Mch
8714 // 0x112E92[10:9] = 10: Dmx
8715 AU_CUS_WriteAbsMaskReg(SNDR2_MS12_MBOX_PCMR_METADATA_SELECT, 0x0600, (pstAudioCustomerShmData->g_audio_customer_internal_patch_SndR2_MS12_Pcmr_Metadata_Select << 9) );
8716 }
8717 #endif //#if(CUSTOMIZED_INTERNAL_PATCH_PARAM_SNDR2_MS12_PCMR_METADATA_SELECT)
8718 }
8719 break;
8720
8721 default:
8722 {
8723 return FALSE;
8724 }
8725 }
8726 return TRUE;
8727 }
8728
AU_CUS_INTERNAL_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,AU_CUS_INTERNAL_PATCH_INFO_TYPE infoType,void * pInfo)8729 MS_BOOL AU_CUS_INTERNAL_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, AU_CUS_INTERNAL_PATCH_INFO_TYPE infoType, void *pInfo)
8730 {
8731 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
8732
8733 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
8734 AU_UNUSED(DecID);
8735
8736 AU_nThreadDBG("[adecIndex = 0x%X] [infoType = 0x%X] \n", (unsigned int)adecIndex, (unsigned int)infoType);
8737
8738 switch(infoType)
8739 {
8740 //---RESERVE---
8741 case AU_CUS_INTERNAL_PATCH_INFO_RESERVE0:
8742 {
8743 }
8744 break;
8745
8746 default:
8747 {
8748 return FALSE;
8749 }
8750
8751 }
8752 return TRUE;
8753 }
8754
AU_CUS_ADEC_SetGain(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,int gain)8755 MS_BOOL AU_CUS_ADEC_SetGain(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, int gain)
8756 {
8757 MS_U32 mainVol, fineVol;
8758
8759 AU_nDBG("[adecIndex = 0x%x] [gain = %d] \n", (unsigned int)adecIndex, (unsigned int)gain);
8760
8761 mainVol = (1015 - (int)gain)/8;
8762 fineVol = (1015 - (int)gain) - mainVol*8;
8763
8764 switch(adecIndex)
8765 {
8766 case API_AUDIO_CUSTOMER_ADEC0:
8767 {
8768 pstAudioCustomerShmData->g_audio_customer_ADEC0_Gain = gain;
8769 MApi_AUDIO_SetAbsoluteVolume(AUDIO_T3_PATH_MIXER_MCH_IN, (MS_U8)mainVol, (MS_U8)fineVol);
8770 }
8771 break;
8772
8773 case API_AUDIO_CUSTOMER_ADEC1:
8774 {
8775 pstAudioCustomerShmData->g_audio_customer_ADEC1_Gain = gain;
8776 MApi_AUDIO_SetAbsoluteVolume(AUDIO_T3_PATH_MIXER_MCH_IN, (MS_U8)mainVol, (MS_U8)fineVol);
8777 }
8778 break;
8779
8780 default:
8781 {
8782 return FALSE;
8783 }
8784 break;
8785 }
8786
8787 return TRUE;
8788 }
8789
AU_CUS_ADEC_SetMute(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,MS_BOOL bOnOff)8790 MS_BOOL AU_CUS_ADEC_SetMute(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_BOOL bOnOff)
8791 {
8792 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
8793
8794 AU_nDBG("[adecIndex = 0x%x] [bOnOff = %d] \n", (unsigned int)adecIndex, (unsigned int)bOnOff);
8795
8796 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
8797
8798 switch(adecIndex)
8799 {
8800 case API_AUDIO_CUSTOMER_ADEC0:
8801 {
8802 pstAudioCustomerShmData->g_audio_customer_ADEC0_bMute = bOnOff;
8803 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_mute, pstAudioCustomerShmData->g_audio_customer_ADEC0_bMute);
8804 }
8805 break;
8806
8807 case API_AUDIO_CUSTOMER_ADEC1:
8808 {
8809 pstAudioCustomerShmData->g_audio_customer_ADEC1_bMute = bOnOff;
8810 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_mute, pstAudioCustomerShmData->g_audio_customer_ADEC1_bMute);
8811 }
8812 break;
8813
8814 default:
8815 {
8816 return FALSE;
8817 }
8818 break;
8819 }
8820
8821 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_AU_CUS_ADEC_SetMute_Delay);
8822
8823 return TRUE;
8824 }
8825
8826 /* Clip Play for ES */
8827
8828 /* Clip Play for PCM */
8829
8830 /* Gain, Mute & Delay */
8831 //---Gain---
AU_CUS_SetFWMixerChannelGain(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect,API_AUDIO_CUSTOMER_FWM_INPUT inputConnect,MS_U32 gain)8832 MS_BOOL AU_CUS_SetFWMixerChannelGain(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect, API_AUDIO_CUSTOMER_FWM_INPUT inputConnect, MS_U32 gain)
8833 {
8834 AUDIO_MIX_VOL_TYPE VolType = PCM_VOL;
8835 int vol1, vol2;
8836
8837 AU_nDBG("[currentConnect = 0x%x] [inputConnect = 0x%x] [gain = %d] \n", (unsigned int)currentConnect, (unsigned int)inputConnect, (unsigned int)gain);
8838
8839 switch(currentConnect)
8840 {
8841 case API_AUDIO_CUSTOMER_FWM0:
8842 {
8843 pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_Gain[inputConnect] = gain;
8844
8845 switch(inputConnect)
8846 {
8847 case API_AUDIO_CUSTOMER_FWM_INPUT_CH5:
8848 {
8849 VolType = GAME1_VOL;
8850 }
8851 break;
8852
8853 case API_AUDIO_CUSTOMER_FWM_INPUT_CH6:
8854 {
8855 VolType = GAME2_VOL;
8856 }
8857 break;
8858
8859 case API_AUDIO_CUSTOMER_FWM_INPUT_CH8:
8860 {
8861 VolType = PCM_VOL;
8862 }
8863 break;
8864
8865 default:
8866 break;
8867 }
8868 }
8869 break;
8870
8871 case API_AUDIO_CUSTOMER_FWM1:
8872 {
8873 pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Channel_Gain[inputConnect] = gain;
8874 return TRUE;
8875 }
8876 break;
8877
8878 case API_AUDIO_CUSTOMER_FWM2:
8879 {
8880 pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Channel_Gain[inputConnect] = gain;
8881 return TRUE;
8882 }
8883 break;
8884
8885 default:
8886 break;
8887 }
8888
8889 vol1 = (1015 - (int)gain)/8;
8890 vol2 = (1015 - (int)gain) - vol1*8;
8891 MApi_AUDIO_SetMixModeVolume(E_AUDIO_INFO_GAME_IN, VolType, vol1, vol2);
8892
8893 //for MS12, CH5/CH6 gain control can't set input gain for Dolby content.
8894 switch(inputConnect)
8895 {
8896 case API_AUDIO_CUSTOMER_FWM_INPUT_CH5:
8897 {
8898 switch(pstAudioCustomerShmData->g_audio_customer_CH5_Sound_Connect)
8899 {
8900 case API_AUDIO_CUSTOMER_CH_INPUT_ADEC0:
8901 {
8902 AU_CUS_INTERNAL_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, AU_CUS_INTERNAL_PATCH_PARAM_ADEC_SET_GAIN, &gain);
8903 }
8904 break;
8905
8906 case API_AUDIO_CUSTOMER_CH_INPUT_ADEC1:
8907 {
8908 AU_CUS_INTERNAL_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC1, AU_CUS_INTERNAL_PATCH_PARAM_ADEC_SET_GAIN, &gain);
8909 }
8910 break;
8911
8912 default:
8913 break;
8914 }
8915 }
8916 break;
8917
8918 case API_AUDIO_CUSTOMER_FWM_INPUT_CH6:
8919 {
8920 switch(pstAudioCustomerShmData->g_audio_customer_CH6_Sound_Connect)
8921 {
8922 case API_AUDIO_CUSTOMER_CH_INPUT_ADEC0:
8923 {
8924 AU_CUS_INTERNAL_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, AU_CUS_INTERNAL_PATCH_PARAM_ADEC_SET_GAIN, &gain);
8925 }
8926 break;
8927
8928 case API_AUDIO_CUSTOMER_CH_INPUT_ADEC1:
8929 {
8930 AU_CUS_INTERNAL_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC1, AU_CUS_INTERNAL_PATCH_PARAM_ADEC_SET_GAIN, &gain);
8931 }
8932 break;
8933
8934 default:
8935 break;
8936 }
8937 }
8938 break;
8939
8940 default:
8941 break;
8942 }
8943
8944 return TRUE;
8945 }
8946
AU_CUS_SetI2SOutGain(MS_U32 gain)8947 MS_BOOL AU_CUS_SetI2SOutGain(MS_U32 gain)
8948 {
8949 int vol1, vol2;
8950
8951 AU_nDBG("[gain = %d] \n", (unsigned int)gain);
8952
8953 pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_Gain = gain;
8954 gain = gain + pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_I2S_Out;
8955
8956 vol1 = (1015 - (int)gain)/8;
8957 vol2 = (1015 - (int)gain) - vol1*8;
8958 MApi_AUDIO_SetAbsoluteVolume(AUDIO_T3_PATH_I2S, vol1, vol2);
8959
8960 return TRUE;
8961 }
8962
AU_CUS_SetLineOutGain(API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex,MS_U32 gain)8963 MS_BOOL AU_CUS_SetLineOutGain(API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex, MS_U32 gain)
8964 {
8965 int vol1, vol2;
8966 AUDIO_PATH_TYPE path = AUDIO_PATH_NULL;
8967
8968 AU_nDBG("[lineIndex = %d] [gain = %d] \n", (unsigned int)lineIndex, (unsigned int)gain);
8969
8970 switch(lineIndex)
8971 {
8972 case API_AUDIO_CUSTOMER_LINE_OUT_0:
8973 {
8974 path = AUDIO_T3_PATH_AUOUT0;
8975 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_Gain = gain;
8976 gain = gain + pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_0_Out;
8977 }
8978 break;
8979
8980 case API_AUDIO_CUSTOMER_LINE_OUT_1:
8981 {
8982 path = AUDIO_T3_PATH_AUOUT1;
8983 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_Gain = gain;
8984 gain = gain + pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_1_Out;
8985 }
8986 break;
8987
8988 case API_AUDIO_CUSTOMER_LINE_OUT_2:
8989 {
8990 path = AUDIO_T3_PATH_AUOUT2;
8991 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_Gain = gain;
8992 gain = gain + pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_2_Out;
8993 }
8994 break;
8995
8996 case API_AUDIO_CUSTOMER_LINE_OUT_3:
8997 {
8998 path = AUDIO_T3_PATH_AUOUT3;
8999 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_Gain = gain;
9000 gain = gain + pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_3_Out;
9001 }
9002 break;
9003
9004 default:
9005 break;
9006 }
9007
9008 vol1 = (1015 - (int)gain)/8;
9009 vol2 = (1015 - (int)gain) - vol1*8;
9010 MApi_AUDIO_SetAbsoluteVolume(path, vol1, vol2);
9011
9012 return TRUE;
9013 }
9014
AU_CUS_SetSPDIFOutGain(MS_U32 gain)9015 MS_BOOL AU_CUS_SetSPDIFOutGain(MS_U32 gain)
9016 {
9017 int vol1, vol2;
9018
9019 AU_nDBG("[gain = %d] \n", (unsigned int)gain);
9020
9021 pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_Gain = gain;
9022 gain = gain + pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_SPDIF_Out;
9023
9024 vol1 = (1015 - (int)gain)/8;
9025 vol2 = (1015 - (int)gain) - vol1*8;
9026 MApi_AUDIO_SetAbsoluteVolume(AUDIO_T3_PATH_SPDIF, vol1, vol2);
9027
9028 return TRUE;
9029 }
9030
9031 //---Mute---
AU_CUS_SetFWMixerChannelMute(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect,API_AUDIO_CUSTOMER_FWM_INPUT inputConnect,MS_BOOL bOnOff)9032 MS_BOOL AU_CUS_SetFWMixerChannelMute(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect, API_AUDIO_CUSTOMER_FWM_INPUT inputConnect, MS_BOOL bOnOff)
9033 {
9034 AU_nDBG("[currentConnect = 0x%x] [inputConnect = 0x%x] [bOnOff = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect, (unsigned int)bOnOff);
9035
9036 switch(currentConnect)
9037 {
9038 case API_AUDIO_CUSTOMER_FWM0:
9039 {
9040 pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_bMute[inputConnect] = bOnOff;
9041 AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM0, inputConnect);
9042 }
9043 break;
9044
9045 case API_AUDIO_CUSTOMER_FWM1:
9046 {
9047 pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Channel_bMute[inputConnect] = bOnOff;
9048 AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM1, inputConnect);
9049 }
9050 break;
9051
9052 case API_AUDIO_CUSTOMER_FWM2:
9053 {
9054 pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Channel_bMute[inputConnect] = bOnOff;
9055 AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM2, inputConnect);
9056 }
9057 break;
9058
9059 default:
9060 break;
9061 }
9062
9063 return TRUE;
9064 }
9065
AU_CUS_SetI2SOutMute(MS_BOOL bOnOff)9066 MS_BOOL AU_CUS_SetI2SOutMute(MS_BOOL bOnOff)
9067 {
9068 AU_nDBG("[bOnOff = 0x%x] \n", (unsigned int)bOnOff);
9069
9070 pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_bMute = bOnOff;
9071
9072 AU_CUS_SetI2SOutMuteStatus();
9073
9074 return TRUE;
9075 }
9076
AU_CUS_SetLineOutMute(API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex,MS_BOOL bOnOff)9077 MS_BOOL AU_CUS_SetLineOutMute(API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex, MS_BOOL bOnOff)
9078 {
9079 AU_nDBG("[lineIndex = %d] [bOnOff = 0x%x] \n", lineIndex, bOnOff);
9080
9081 switch(lineIndex)
9082 {
9083 case API_AUDIO_CUSTOMER_LINE_OUT_0:
9084 {
9085 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_bMute = bOnOff;
9086 AU_CUS_SetLineOutMuteStatus(API_AUDIO_CUSTOMER_LINE_OUT_0);
9087 }
9088 break;
9089
9090 case API_AUDIO_CUSTOMER_LINE_OUT_1:
9091 {
9092 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_bMute = bOnOff;
9093 AU_CUS_SetLineOutMuteStatus(API_AUDIO_CUSTOMER_LINE_OUT_1);
9094 }
9095 break;
9096
9097 case API_AUDIO_CUSTOMER_LINE_OUT_2:
9098 {
9099 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_bMute = bOnOff;
9100 AU_CUS_SetLineOutMuteStatus(API_AUDIO_CUSTOMER_LINE_OUT_2);
9101 }
9102 break;
9103
9104 case API_AUDIO_CUSTOMER_LINE_OUT_3:
9105 {
9106 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_bMute = bOnOff;
9107 AU_CUS_SetLineOutMuteStatus(API_AUDIO_CUSTOMER_LINE_OUT_3);
9108 }
9109 break;
9110
9111 default:
9112 break;
9113 }
9114
9115 return TRUE;
9116 }
9117
AU_CUS_SetSPDIFOutMute(MS_BOOL bOnOff)9118 MS_BOOL AU_CUS_SetSPDIFOutMute(MS_BOOL bOnOff)
9119 {
9120 AU_nDBG("[bOnOff = 0x%x] \n", (unsigned int)bOnOff);
9121
9122 pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_bMute = bOnOff;
9123
9124 AU_CUS_SetSPDIFOutMuteStatus();
9125
9126 return TRUE;
9127 }
9128
AU_CUS_SetHDMIOutMute(MS_BOOL bOnOff)9129 MS_BOOL AU_CUS_SetHDMIOutMute(MS_BOOL bOnOff)
9130 {
9131 AU_nDBG("[bOnOff = 0x%x] \n", (unsigned int)bOnOff);
9132
9133 pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_bMute = bOnOff;
9134
9135 AU_CUS_SetHDMIOutMuteStatus();
9136
9137 return TRUE;
9138 }
9139
AU_CUS_MuteDuringLimitedTime_Input(MS_U32 per_50ms,API_AUDIO_CUSTOMER_FWM_INDEX eFWM,API_AUDIO_CUSTOMER_FWM_INPUT eCh)9140 MS_BOOL AU_CUS_MuteDuringLimitedTime_Input(MS_U32 per_50ms, API_AUDIO_CUSTOMER_FWM_INDEX eFWM, API_AUDIO_CUSTOMER_FWM_INPUT eCh)
9141 {
9142 AU_nDBG("[per_50ms = %d] [eFWM = 0x%x] [eCh = 0x%x]\n", (unsigned int)per_50ms, (unsigned int)eFWM, (unsigned int)eCh);
9143
9144 if(per_50ms > MuteLimitedTimeOfFWM0In[eCh])
9145 {
9146 MuteLimitedTimeOfFWM0In[eCh] = per_50ms;
9147 pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_DuringLimitTime_bMute[eCh] = TRUE;
9148 AU_CUS_DspMixerMuteStatus(eFWM, eCh);
9149 }
9150
9151 return TRUE;
9152 }
9153
AU_CUS_MuteDuringLimitedTime_Output(MS_U32 per_50ms,API_AUDIO_CUSTOMER_OUTPUT_TYPE ePort)9154 MS_BOOL AU_CUS_MuteDuringLimitedTime_Output(MS_U32 per_50ms, API_AUDIO_CUSTOMER_OUTPUT_TYPE ePort)
9155 {
9156 AU_nDBG("[per_50ms = %d] [ePort = 0x%x] \n", (unsigned int)per_50ms, (unsigned int)ePort);
9157
9158 if(per_50ms > MuteLimitedTimeOfSoundOut[ePort])
9159 {
9160 MuteLimitedTimeOfSoundOut[ePort] = per_50ms;
9161 pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[ePort] = TRUE;
9162 }
9163
9164 switch(ePort)
9165 {
9166 case API_AUDIO_CUSTOMER_LINEOUT0_OUTPUT:
9167 case API_AUDIO_CUSTOMER_LINEOUT1_OUTPUT:
9168 case API_AUDIO_CUSTOMER_LINEOUT2_OUTPUT:
9169 case API_AUDIO_CUSTOMER_LINEOUT3_OUTPUT:
9170 {
9171 AU_CUS_SetLineOutMuteStatus(API_AUDIO_CUSTOMER_LINE_OUT_0);
9172 }
9173 break;
9174
9175 case API_AUDIO_CUSTOMER_SPDIF_OUTPUT:
9176 {
9177 AU_CUS_SetSPDIFOutMuteStatus();
9178 }
9179 break;
9180
9181 case API_AUDIO_CUSTOMER_I2S_OUTPUT:
9182 {
9183 AU_CUS_SetI2SOutMuteStatus();
9184 }
9185 break;
9186
9187 case API_AUDIO_CUSTOMER_HDMI_OUTPUT:
9188 {
9189 AU_CUS_SetHDMIOutMuteStatus();
9190 }
9191 break;
9192
9193 default:
9194 break;
9195 }
9196
9197 return TRUE;
9198 }
9199
9200 //---Delay---
AU_CUS_SetChannelDelay(API_AUDIO_CUSTOMER_CH_SOUND ch,MS_U32 delay)9201 MS_BOOL AU_CUS_SetChannelDelay(API_AUDIO_CUSTOMER_CH_SOUND ch, MS_U32 delay)
9202 {
9203 #if(UTPA_SUPPORT_SND_INTERNAL_DELAY)
9204 {
9205 Sound_SET_PARAM_Type Type;
9206
9207 AU_nDBG("[delay = 0x%x] \n", (unsigned int)delay);
9208
9209 switch(ch)
9210 {
9211 case API_AUDIO_CUSTOMER_CH5_SOUND:
9212 {
9213 Type = Sound_SET_PARAM_InternalDelay_Ch5;
9214 }
9215 break;
9216
9217 case API_AUDIO_CUSTOMER_CH6_SOUND:
9218 {
9219 Type = Sound_SET_PARAM_InternalDelay_Ch6;
9220 }
9221 break;
9222
9223 case API_AUDIO_CUSTOMER_CH7_SOUND:
9224 {
9225 Type = Sound_SET_PARAM_InternalDelay_Ch7;
9226 }
9227 break;
9228
9229 case API_AUDIO_CUSTOMER_CH8_SOUND:
9230 {
9231 Type = Sound_SET_PARAM_InternalDelay_Ch8;
9232 }
9233 break;
9234
9235 default:
9236 {
9237 return FALSE;
9238 }
9239 break;
9240 }
9241
9242 MApi_SND_SetParam1(Type, (MS_U16)delay, 0);
9243
9244 #if(UTPA_ASND_DSP_DDR_SIZE_SYNC_WITH_ALSA)
9245 {
9246 MApi_SND_SetParam1(Sound_SET_PARAM_InternalDelay_Ch1, (MS_U16)delay, 0);
9247 }
9248 #endif
9249
9250 return TRUE;
9251 }
9252 #else
9253 {
9254 return TRUE;
9255 }
9256 #endif
9257 }
9258
AU_CUS_SetAudioDelay(MS_U32 delay)9259 MS_BOOL AU_CUS_SetAudioDelay(MS_U32 delay)
9260 {
9261 AU_nThreadDBG("[delay = 0x%x] \n", (unsigned int)delay);
9262
9263 pstAudioCustomerShmData->g_audio_customer_SE_DriverDelay = delay;
9264
9265 #if(CUSTOMIZED_INTERNAL_PATCH_LIMITED_AUDIO_DELAY_ENABLE)
9266 {
9267 if(delay < AUDIO_DELAY_LOWER_BOUND)
9268 {
9269 delay = AUDIO_DELAY_LOWER_BOUND;
9270 AU_nThreadDBG("[delay = 0x%x] \n", (unsigned int)delay);
9271 }
9272 }
9273 #endif
9274
9275 return MApi_SND_SetParam1(Sound_SET_PARAM_AudioDelay, (MS_U16)delay, 0);
9276 }
9277
AU_CUS_SetSpdifDelay(MS_U32 delay)9278 MS_BOOL AU_CUS_SetSpdifDelay(MS_U32 delay)
9279 {
9280 AU_nThreadDBG("[delayTime = 0x%x] \n", (unsigned int)delay);
9281
9282 pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_DriverDelay = delay;
9283
9284 return MApi_AUDIO_SetCommAudioInfo(Audio_Comm_infoType_setSpdifDelay, delay, 0);
9285 }
9286
AU_CUS_SetHdmiDelay(MS_U32 delay)9287 MS_BOOL AU_CUS_SetHdmiDelay(MS_U32 delay)
9288 {
9289 AU_nThreadDBG("[delayTime = 0x%x] \n", (unsigned int)delay);
9290
9291 pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_DriverDelay = delay;
9292
9293 #ifdef CONFIG_API_HDMITX //TV dont have HDMI TX
9294 return MApi_AUDIO_SetCommAudioInfo(Audio_Comm_infoType_setHdmiDelay, delay, 0);
9295 #else
9296 return FALSE;
9297 #endif
9298 }
9299
9300 /* AENC */
9301
9302 /* PCM Capture */
9303
9304 /* PCM IO Control */
9305
9306 /* MM New Mode */
AU_CUS_ConvertDriverMainDecIDtoDriverAdDecID(AUDIO_DEC_ID DecID)9307 AUDIO_DEC_ID AU_CUS_ConvertDriverMainDecIDtoDriverAdDecID(AUDIO_DEC_ID DecID)
9308 {
9309 AUDIO_DEC_ID AD_DecID = AU_DEC_INVALID;
9310
9311 AU_nDBG("[DecID = 0x%x] \n", (unsigned int)DecID);
9312
9313 switch(DecID)
9314 {
9315 case AU_DEC_ID1:
9316 {
9317 AD_DecID = AU_DEC_ID2;
9318 }
9319 break;
9320
9321 default:
9322 break;
9323 }
9324
9325 AU_nDBG("[AD_DecID = 0x%x] \n", (unsigned int)AD_DecID);
9326
9327 return AD_DecID;
9328 }
9329
9330 /* Mstar Sound Effect */
9331
9332 /* Advanced Sound Effect */
9333
AU_CUS_MonitorService(void)9334 static void AU_CUS_MonitorService(void)
9335 {
9336 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
9337 int DDPEnc_bEnable = 0;
9338 static int Current_SRS_Status = -1;
9339 static int Previous_SRS_Status = -1;
9340 static int Current_DAP_Status = -1;
9341 static int Previous_DAP_Status = -1;
9342
9343 AU_UNUSED(DecID);
9344 AU_UNUSED(DDPEnc_bEnable);
9345 AU_UNUSED(Current_SRS_Status);
9346 AU_UNUSED(Previous_SRS_Status);
9347 AU_UNUSED(Current_DAP_Status);
9348 AU_UNUSED(Previous_DAP_Status);
9349
9350 while(pstAudioCustomerShmData->g_audio_customer_AU_CUS_MonitorService_bEnable)
9351 {
9352 if(pstAudioCustomerShmData->g_audio_customer_Init_Done == TRUE)
9353 {
9354 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_BYPASS)
9355 if(pstAudioCustomerShmData->g_audio_customer_patch_HDMI_RX_ByPass_bEnable == TRUE)
9356 {
9357 AU_CUS_WriteAbsMaskReg(REG_AUDIO_SPDIF_OUT_CFG, 0x07, 0x03); //Spdif HDMI bypass
9358 AU_CUS_WriteAbsMaskReg(REG_AUDIO_SPDIF2_OUT_CFG, 0x07, 0x03); //ARC HDMI bypass
9359 }
9360 else
9361 #endif
9362 {
9363 if(pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_MonitorOnOff)
9364 {
9365 AU_CUS_SPDIF_TX_Monitor();
9366
9367 #if(CUSTOMIZED_INTERNAL_PATCH_DDPE_SRS_AUTO_BYPASS_ENABLE)
9368 {
9369 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(pstAudioCustomerShmData->g_audio_customer_MainDecoderOutput);
9370 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_Get_DDPEnc_Status, (void *)&DDPEnc_bEnable);
9371
9372 if(DDPEnc_bEnable)
9373 {
9374 Current_SRS_Status = 0;
9375 if(Current_SRS_Status != Previous_SRS_Status)
9376 {
9377 AU_CUS_WriteAbsMaskReg((MS_U32)REG_BANK_SND_R2_SRS, 0x02, 0x02);
9378 Previous_SRS_Status = Current_SRS_Status;
9379 }
9380 }
9381 else
9382 {
9383 Current_SRS_Status = 1;
9384 if(Current_SRS_Status != Previous_SRS_Status)
9385 {
9386 AU_CUS_WriteAbsMaskReg((MS_U32)REG_BANK_SND_R2_SRS, 0x02, 0x00);
9387 Previous_SRS_Status = Current_SRS_Status;
9388 }
9389 }
9390 }
9391 #endif
9392
9393 #if(CUSTOMIZED_INTERNAL_PATCH_DDPE_DAP_AUTO_BYPASS_ENABLE)
9394 {
9395 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(pstAudioCustomerShmData->g_audio_customer_MainDecoderOutput);
9396 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_Get_DDPEnc_Status, (void *)&DDPEnc_bEnable);
9397
9398 if(DDPEnc_bEnable)
9399 {
9400 #if(UTPA_SUPPORT_DOLBY_DAP)
9401 {
9402 Current_DAP_Status = 0;
9403 if(Current_DAP_Status != Previous_DAP_Status)
9404 {
9405 MApi_AUDIO_ADVSOUND_SubProcessEnable(DOLBY_DAP_EN, FALSE);
9406 Previous_DAP_Status = Current_DAP_Status;
9407 }
9408 }
9409 #endif
9410 }
9411 else
9412 {
9413 #if(UTPA_SUPPORT_DOLBY_DAP)
9414 {
9415 Current_DAP_Status = 1;
9416 if(Current_DAP_Status != Previous_DAP_Status)
9417 {
9418 MApi_AUDIO_ADVSOUND_SubProcessEnable(DOLBY_DAP_EN, pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_ProcessUnit_Enable);
9419 Previous_DAP_Status = Current_DAP_Status;
9420 }
9421 }
9422 #endif
9423 }
9424 }
9425 #endif
9426 }
9427
9428 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_SWITCH_TO_PCM_DEBOUNCE)
9429 {
9430 //do nothing
9431 }
9432 #else
9433 {
9434 if(pstAudioCustomerShmData->g_audio_customer_HDMI_RX_MonitorOnOff)
9435 {
9436 AU_CUS_HDMI_RX_Monitor();
9437 }
9438 }
9439 #endif
9440 }
9441
9442 if(pstAudioCustomerShmData->g_audio_customer_HDMI_TX_MonitorOnOff)
9443 {
9444 AU_CUS_HDMI_TX_Monitor();
9445 }
9446
9447 if(pstAudioCustomerShmData->g_audio_customer_SIF_MonitorOnOff)
9448 {
9449 if(pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_UpperPlay == API_AUDIO_CUSTOMER_UPPER_PLAY)
9450 {
9451 AU_CUS_SIF_Monitor();
9452 }
9453 }
9454
9455 if(pstAudioCustomerShmData->g_audio_customer_Auto_Recovery_MonitorOnOff)
9456 {
9457 MApi_Audio_Monitor();
9458 }
9459 }
9460
9461 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_AU_MonitorService_Interval);
9462 }
9463 }
9464
9465 #if (UTPA_SUPPORT_AAC_ENCODE == 1)
9466 /* AAC Encode Function */
AU_CUS_AACEncOutput(MS_U8 * pPcmBuffer,MS_U16 pcmLenth)9467 static void AU_CUS_AACEncOutput(MS_U8 *pPcmBuffer, MS_U16 pcmLenth)
9468 {
9469 MS_S32 retAACEnc = -1;
9470 API_AUDIO_CUSTOMER_AENC_DATA aacEncInfo;
9471 tEmzInt32 aacEncodedLenth = AAC_ENCODED_LENTH;
9472 MS_U32 aacEnocdeTime = 0;
9473
9474 aacEnocdeTime = MsOS_GetSystemTime();
9475
9476 /* encode */
9477 retAACEnc = (MS_S32)Mpeg4AacEnc_Encode(aacEncodeHandler, (tEmzInt16 *)pPcmBuffer, pcmLenth, aacEncodedBuffer, &aacEncodedLenth);
9478
9479 if (retAACEnc < 0)
9480 {
9481 AU_nPRINT("[Error] [retAACEnc(0x%X), pcmLenth(0x%X), aacEncodedLenth(0x%X), time(0x%X)] \n", (int)retAACEnc, (unsigned int)pcmLenth, (unsigned int)aacEncodedLenth, (unsigned int)aacEnocdeTime);
9482 return;
9483 }
9484
9485 /* output AAC to debug file */
9486 if(pAU_AACEncDumpFile != NULL)
9487 {
9488 AU_CUS_FileWrite((void*)aacEncodedBuffer, sizeof(MS_U8), aacEncodedLenth, pAU_AACEncDumpFile);
9489 }
9490
9491 /* update PTS */
9492 if(firstGetEncodeTimeFlag == TRUE)
9493 {
9494 aacEncInfo.pts = 0;
9495 encStartTime = aacEnocdeTime;
9496 firstGetEncodeTimeFlag = FALSE;
9497 }
9498 else
9499 {
9500 #if 0//need to refine
9501 if(g_bVencEnable == TRUE) //APVR case, else is Music Catch case(no VENC)
9502 {
9503 encStartTime = g_u32AVPtsBase;
9504 }
9505 aacEncInfo.pts = 1 + g_u32StartPTS + (AACEnocdeTime - u32EncStartTime)*90;
9506 #endif
9507 aacEncInfo.pts = (aacEnocdeTime - encStartTime)*90;
9508 }
9509
9510 aacEncInfo.encFormat = API_AUDIO_CUSTOMER_AENC_ENCODE_AAC;
9511 aacEncInfo.pData = (MS_U8 *)aacEncodedBuffer;
9512 aacEncInfo.dataLen = aacEncodedLenth;
9513 aacEncInfo.pRStart = (MS_U8 *)aacEncodedBuffer;
9514 aacEncInfo.pREnd = aacEncInfo.pRStart + aacEncodedLenth;
9515
9516 #if 0
9517 AU_nPRINT("[AUDIO][aacEncInfo.pts = %llu] \n", aacEncInfo.pts);
9518 AU_nPRINT("[AUDIO][aacEncInfo.index = 0x%x] \n", (unsigned int)aacEncInfo.index);
9519 AU_nPRINT("[AUDIO][aacEncInfo.pData = 0x%x] \n", aacEncInfo.pData);
9520 AU_nPRINT("[AUDIO][aacEncInfo.dataLen = 0x%x] \n", (unsigned int)aacEncInfo.dataLen);
9521 AU_nPRINT("[AUDIO][aacEncInfo.pRStart = 0x%x] \n", aacEncInfo.pRStart);
9522 AU_nPRINT("[AUDIO][aacEncInfo.pREnd = 0x%x] \n", aacEncInfo.pREnd);
9523 #endif
9524
9525 if(madCallBack.pFunc_AencAAC != NULL)
9526 {
9527 madCallBack.pFunc_AencAAC(&aacEncInfo);
9528 }
9529 }
9530
AU_CUS_AACEncodeMonitor(void)9531 static void AU_CUS_AACEncodeMonitor(void)
9532 {
9533 while(pstAudioCustomerShmData->g_audio_customer_AU_CUS_AACEncodeMonitor_bEnable)
9534 {
9535 if(pstAudioCustomerShmData->g_audio_customer_AAC_ENC_bEnable == TRUE)
9536 {
9537 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
9538 {
9539 mutex_lock(&AU_Customer_AACEncode_mutex_lock);
9540 }
9541 #else //User Space
9542 {
9543 OS_OBTAIN_MUTEX(AU_Customer_AACEncode_mutex_lock, MSOS_WAIT_FOREVER);
9544 }
9545 #endif
9546
9547 memset((void *)pAACEncPCMBuffer, 0x00, AAC_REQUEST_BYTES);
9548 if(MApi_AUDIO_PCMCapture_Read(AACEncPCMCaptureDevice, (void *)pAACEncPCMBuffer, AAC_REQUEST_BYTES) == TRUE)
9549 {
9550 //AU_nPRINT("[A][%s] [%s] [%d] [Time(%d)] [] \n", __FILE__, __FUNCTION__, __LINE__, (int)MsOS_GetSystemTime());
9551
9552 if(pAU_AACEncPCMCaptureDumpFile != NULL)
9553 {
9554 AU_CUS_FileWrite((void*)pAACEncPCMBuffer, sizeof(MS_U8), AAC_REQUEST_BYTES, pAU_AACEncPCMCaptureDumpFile);
9555 }
9556 else
9557 {
9558 AU_nPRINT("[A] [Error] [%s] [please open AACEncPCMDump.pcm at first] \n", __FUNCTION__);
9559 }
9560
9561 retryCounterAACEncode = 0;
9562
9563 AU_CUS_AACEncOutput(pAACEncPCMBuffer, AAC_REQUEST_BYTES);
9564 }
9565 else
9566 {
9567 retryCounterAACEncode++;
9568 if (retryCounterAACEncode > 10)
9569 {
9570 AU_nPRINT("[A] [Error] [%s] [Too many retry count(%u) for AAC encode] \n", __FUNCTION__, (unsigned int)retryCounterAACEncode);
9571 }
9572 }
9573
9574 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
9575 {
9576 mutex_unlock(&AU_Customer_AACEncode_mutex_lock);
9577 }
9578 #else //User Space
9579 {
9580 OS_RELEASE_MUTEX(AU_Customer_AACEncode_mutex_lock);
9581 }
9582 #endif
9583 }
9584
9585 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_AU_AACEncodeMonitor_Interval);
9586 }
9587 }
9588
AU_CUS_AACEncodeInit(AUDIO_CAPTURE_SOURCE_TYPE sourceType)9589 static MS_BOOL AU_CUS_AACEncodeInit(AUDIO_CAPTURE_SOURCE_TYPE sourceType)
9590 {
9591 //alloc memory for AAC encoded buffer
9592 pAACEncPCMBuffer = AU_CUS_MemoryAlloc(AAC_REQUEST_BYTES);
9593
9594 if(pAACEncPCMBuffer == NULL)
9595 {
9596 AU_nPRINT("[pAACEncPCMBuffer cannot malloc] \n");
9597 return FALSE;
9598 }
9599
9600 MApi_AUDIO_PCMCapture_Init(AACEncPCMCaptureDevice, sourceType);
9601 MApi_AUDIO_PCMCapture_Start(AACEncPCMCaptureDevice);
9602
9603 return TRUE;
9604 }
9605 #endif
9606
AU_CUS_SetI2SOutMuteStatus(void)9607 void AU_CUS_SetI2SOutMuteStatus(void)
9608 {
9609 pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_final_bMute = pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_bMute |
9610 pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_I2S_OUTPUT];
9611
9612 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_final_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_final_bMute);
9613 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_bMute);
9614 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_DuringLimitTime_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_I2S_OUTPUT]);
9615
9616 MApi_AUDIO_SetMute(AUDIO_T3_PATH_I2S, pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_final_bMute);
9617 }
9618
AU_CUS_SetLineOutMuteStatus(API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex)9619 void AU_CUS_SetLineOutMuteStatus(API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex)
9620 {
9621 switch(lineIndex)
9622 {
9623 case API_AUDIO_CUSTOMER_LINE_OUT_0:
9624 {
9625 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_final_bMute = pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_bMute |
9626 pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_LINEOUT0_OUTPUT];
9627
9628 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_final_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_final_bMute);
9629 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_bMute);
9630 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_DuringLimitTime_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_LINEOUT0_OUTPUT]);
9631
9632 MApi_AUDIO_SetMute(AUDIO_T3_PATH_AUOUT0, pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_final_bMute);
9633 }
9634 break;
9635
9636 case API_AUDIO_CUSTOMER_LINE_OUT_1:
9637 {
9638 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_final_bMute = pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_bMute |
9639 pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_LINEOUT1_OUTPUT];
9640
9641 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_final_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_final_bMute);
9642 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_bMute);
9643 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_DuringLimitTime_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_LINEOUT1_OUTPUT]);
9644
9645 MApi_AUDIO_SetMute(AUDIO_T3_PATH_AUOUT1, pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_final_bMute);
9646 }
9647 break;
9648
9649 case API_AUDIO_CUSTOMER_LINE_OUT_2:
9650 {
9651 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_final_bMute = pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_bMute |
9652 pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_LINEOUT2_OUTPUT];
9653
9654 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_final_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_final_bMute);
9655 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_bMute);
9656 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_DuringLimitTime_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_LINEOUT2_OUTPUT]);
9657
9658 MApi_AUDIO_SetMute(AUDIO_T3_PATH_AUOUT2, pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_final_bMute);
9659 }
9660 break;
9661
9662 case API_AUDIO_CUSTOMER_LINE_OUT_3:
9663 {
9664 pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_final_bMute = pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_bMute |
9665 pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_LINEOUT3_OUTPUT];
9666
9667 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_final_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_final_bMute);
9668 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_bMute);
9669 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_DuringLimitTime_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_LINEOUT3_OUTPUT]);
9670
9671 MApi_AUDIO_SetMute(AUDIO_T3_PATH_AUOUT3, pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_final_bMute);
9672 }
9673 break;
9674
9675 default:
9676 break;
9677 }
9678 }
9679
AU_CUS_SetSPDIFOutMuteStatus(void)9680 void AU_CUS_SetSPDIFOutMuteStatus(void)
9681 {
9682 pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_final_bMute = pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_bMute |
9683 pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_SPDIF_OUTPUT];
9684
9685 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_final_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_final_bMute);
9686 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_bMute);
9687 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_DuringLimitTime_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_SPDIF_OUTPUT]);
9688
9689 // note:
9690 // this API will not update UTPA shm g_AudioVars2->g_SPDIF_MuteStatus
9691 // it will cause SPDIF un-mute after SPDIF setmode.
9692 // MApi_AUDIO_SetMute(AUDIO_T3_PATH_SPDIF, pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_final_bMute);
9693 MApi_AUDIO_SPDIF_SetMute(pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_final_bMute);
9694 }
9695
AU_CUS_SetHDMIOutMuteStatus(void)9696 void AU_CUS_SetHDMIOutMuteStatus(void)
9697 {
9698
9699 pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_final_bMute = pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_bMute |
9700 pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_HDMI_OUTPUT];
9701
9702 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_final_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_final_bMute);
9703 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_bMute);
9704 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_DuringLimitTime_bMute = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[API_AUDIO_CUSTOMER_HDMI_OUTPUT]);
9705
9706 MApi_AUDIO_SetMute(AUDIO_T3_PATH_HDMI, pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_final_bMute);
9707 }
9708
AU_CUS_SetSoundOutMuteStatus(API_AUDIO_CUSTOMER_OUTPUT_TYPE port)9709 void AU_CUS_SetSoundOutMuteStatus(API_AUDIO_CUSTOMER_OUTPUT_TYPE port)
9710 {
9711 AU_nDBG("[port = 0x%x] \n", (unsigned int)port);
9712
9713 switch(port)
9714 {
9715 case API_AUDIO_CUSTOMER_LINEOUT0_OUTPUT:
9716 case API_AUDIO_CUSTOMER_LINEOUT1_OUTPUT:
9717 case API_AUDIO_CUSTOMER_LINEOUT2_OUTPUT:
9718 case API_AUDIO_CUSTOMER_LINEOUT3_OUTPUT:
9719 AU_CUS_SetLineOutMuteStatus(port);
9720 break;
9721
9722 case API_AUDIO_CUSTOMER_SPDIF_OUTPUT:
9723 AU_CUS_SetSPDIFOutMuteStatus();
9724 break;
9725
9726 case API_AUDIO_CUSTOMER_I2S_OUTPUT:
9727 AU_CUS_SetI2SOutMuteStatus();
9728 break;
9729 case API_AUDIO_CUSTOMER_HDMI_OUTPUT:
9730 AU_CUS_SetHDMIOutMuteStatus();
9731 break;
9732
9733 default:
9734 break;
9735 }
9736 }
9737
AU_CUS_Mute_LimitedTime_Input_Avoid_ADEC_Pop_Noise(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,MS_U32 per_50ms)9738 void AU_CUS_Mute_LimitedTime_Input_Avoid_ADEC_Pop_Noise(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_U32 per_50ms)
9739 {
9740 API_AUDIO_CUSTOMER_FWM_INPUT fwm_input = API_AUDIO_CUSTOMER_FWM_INPUT_INVALID;
9741
9742 AU_nDBG("[adecIndex = 0x%x][per_50ms = %d] \n", (unsigned int)adecIndex, (unsigned int)per_50ms);
9743
9744 fwm_input = AU_CUS_Mapping_ADEC_to_FWM_INPUT(adecIndex);
9745 AU_nDBG("[fwm_input = %d] \n", (unsigned int)fwm_input);
9746
9747 if(fwm_input > API_AUDIO_CUSTOMER_FWM_INPUT_INVALID)
9748 {
9749 if(pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Connect[fwm_input] == TRUE)
9750 {
9751 AU_nDBG("\n");
9752 AU_CUS_MuteDuringLimitedTime_Input(per_50ms, API_AUDIO_CUSTOMER_FWM0, fwm_input);
9753 }
9754
9755 if(pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Connect[fwm_input] == TRUE)
9756 {
9757 AU_nDBG("\n");
9758 AU_CUS_MuteDuringLimitedTime_Input(per_50ms, API_AUDIO_CUSTOMER_FWM1, fwm_input);
9759 }
9760
9761 if(pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Connect[fwm_input] == TRUE)
9762 {
9763 AU_nDBG("\n");
9764 AU_CUS_MuteDuringLimitedTime_Input(per_50ms, API_AUDIO_CUSTOMER_FWM2, fwm_input);
9765 }
9766 }
9767
9768 return;
9769 }
9770
AU_CUS_MuteDuringLimitedTime_Monitor(void)9771 void AU_CUS_MuteDuringLimitedTime_Monitor(void)
9772 {
9773 int port = 0;
9774 while(pstAudioCustomerShmData->g_audio_customer_AU_CUS_MuteDuringLimitedTime_Monitor_bEnable)
9775 {
9776 //------------------------------------------------------
9777 // Output Mute
9778 //------------------------------------------------------
9779 for(port = API_AUDIO_CUSTOMER_LINEOUT0_OUTPUT; port < API_AUDIO_CUSTOMER_OUTPUT_MAX; port++)
9780 {
9781 if(MuteLimitedTimeOfSoundOut[port] > 0)
9782 {
9783 MuteLimitedTimeOfSoundOut[port]--;
9784 if (MuteLimitedTimeOfSoundOut[port] == 0)
9785 {
9786 pstAudioCustomerShmData->g_audio_customer_Sound_Out_DuringLimitTime_bMute[port] = FALSE;
9787 AU_CUS_SetSoundOutMuteStatus(port);
9788 }
9789 }
9790 }
9791
9792 //------------------------------------------------------
9793 // Input Mute of FM Mixer0
9794 //------------------------------------------------------
9795 for(port = API_AUDIO_CUSTOMER_FWM_INPUT_CH5; port < API_AUDIO_CUSTOMER_FWM_INPUT_MAX; port++)
9796 {
9797 if(MuteLimitedTimeOfFWM0In[port] > 0)
9798 {
9799 MuteLimitedTimeOfFWM0In[port]--;
9800 if (MuteLimitedTimeOfFWM0In[port] == 0)
9801 {
9802 pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_DuringLimitTime_bMute[port] = FALSE;
9803 AU_CUS_DspMixerMuteStatus(API_AUDIO_CUSTOMER_FWM0, port);
9804 }
9805 }
9806 }
9807
9808 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_AU_MuteDuringLimitedTime_Monitor_Interval);
9809 }
9810 }
9811
AU_CUS_AdecPcmOutMonitor(void)9812 static void AU_CUS_AdecPcmOutMonitor(void)
9813 {
9814 int cnt = 0;
9815
9816 while(pstAudioCustomerShmData->g_audio_customer_AU_CUS_AdecPcmOutMonitor_bEnable)
9817 {
9818 if( pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperPlay == API_AUDIO_CUSTOMER_UPPER_PLAY && pstAudioCustomerShmData->g_audio_customer_ADEC0_PCM_OutputPath == API_AUDIO_CUSTOMER_ADEC_PCM_PATH_MCU)
9819 {
9820 if(API_AUDIO_CUSTOMER_AdecPcmReady(API_AUDIO_CUSTOMER_ADEC0))
9821 {
9822 if( madCallBack.pFunc_AdecDecDone !=NULL)
9823 {
9824 madCallBack.pFunc_AdecDecDone(API_AUDIO_CUSTOMER_ADEC0, pAdecPcmHandle->PcmInfo.U32WrtBytes);
9825 }
9826 else
9827 {
9828 AU_nPRINT("Warning: [ADEC0 PCM] call back fucntion is null !!!!\n");
9829 }
9830 cnt = 0;
9831 }
9832 else
9833 {
9834 cnt++;
9835 if(cnt > 3000)
9836 {
9837 AU_nPRINT("Warning: [ADEC0 PCM] waiting for PCM is time out !!!!\n");
9838 cnt = 0;
9839 }
9840
9841 }
9842
9843 }
9844 else if( pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperPlay == API_AUDIO_CUSTOMER_UPPER_PLAY && pstAudioCustomerShmData->g_audio_customer_ADEC1_PCM_OutputPath == API_AUDIO_CUSTOMER_ADEC_PCM_PATH_MCU)
9845 {
9846 if(API_AUDIO_CUSTOMER_AdecPcmReady(API_AUDIO_CUSTOMER_ADEC1))
9847 {
9848 if( madCallBack.pFunc_AdecDecDone !=NULL)
9849 {
9850 madCallBack.pFunc_AdecDecDone(API_AUDIO_CUSTOMER_ADEC1, pAdecPcmHandle->PcmInfo.U32WrtBytes);
9851 }
9852 else
9853 {
9854 AU_nPRINT("Warning: [ADEC1 PCM] call back fucntion is null !!!!\n");
9855 }
9856 cnt = 0;
9857 }
9858 else
9859 {
9860 cnt++;
9861 if(cnt > 3000)
9862 {
9863 AU_nPRINT("Warning: [ADEC1 PCM] waiting for PCM is time out !!!!\n");
9864 cnt = 0;
9865 }
9866 }
9867
9868 }
9869
9870 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_AU_AdecPcmOut_Interval);
9871 }
9872 }
9873
AU_CUS_AdecPcmInit(AUDIO_DEC_ID decID,MS_BOOL bIsMultiCh)9874 MS_BOOL AU_CUS_AdecPcmInit(AUDIO_DEC_ID decID, MS_BOOL bIsMultiCh)
9875 {
9876 MS_U32 Base = 0;
9877 MS_U32 Size = 0;
9878 MS_U32 MadBase = 0;
9879
9880 if (bIsMultiCh)
9881 {
9882 MApi_AUDIO_SetCommAudioInfo(Audio_Comm_infoType_Multi_Channel, 1, 0);
9883 }
9884 else
9885 {
9886 MApi_AUDIO_SetCommAudioInfo(Audio_Comm_infoType_Multi_Channel, 0, 0);
9887 }
9888
9889 MApi_AUDIO_GetAudioInfo2(decID, Audio_infoType_MadBaseAddr, (void *) &MadBase);
9890 MApi_AUDIO_GetAudioInfo2(decID, Audio_infoType_UNI_PCM_Base, (void *) &Base );
9891 MApi_AUDIO_GetAudioInfo2(decID, Audio_infoType_UNI_PCM_Size, (void *) &Size );
9892
9893 /* PCM Control Init */
9894 pAdecPcmHandle->PcmBuf.u32BufStartAddr = Base;
9895 pAdecPcmHandle->PcmBuf.u32BufTotalSize = Size;
9896 pAdecPcmHandle->PcmBuf.u32BufWrPtr = pAdecPcmHandle->PcmBuf.u32BufStartAddr;
9897 pAdecPcmHandle->PcmBuf.u32BufEndAddr = pAdecPcmHandle->PcmBuf.u32BufStartAddr + pAdecPcmHandle->PcmBuf.u32BufTotalSize;
9898 pAdecPcmHandle->PcmBuf.u32BufOffset = Base - MadBase;
9899
9900 pAdecPcmHandle->u32LastDecodeFrame = 0;
9901
9902 // open pcm dump
9903 if(pstAudioCustomerShmData->g_audio_customer_bEnableAdecPcmDump == TRUE)
9904 {
9905 pAU_AdecPcmDumpFile = AU_CUS_FileOpen(AU_ADEC_PCM_DUMP_PATH, "wb");
9906 }
9907
9908 return TRUE;
9909 }
9910
AU_CUS_PCMCaptureMonitor(void)9911 static void AU_CUS_PCMCaptureMonitor(void)
9912 {
9913 while(pstAudioCustomerShmData->g_audio_customer_AU_CUS_PCMCaptureMonitor_bEnable)
9914 {
9915 AUDIO_DEVICE_TYPE deviceType = E_DEVICE0;
9916 MS_BOOL pcmCaptureFlag = FALSE;
9917 if(pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_bEnable == TRUE)
9918 {
9919 deviceType = E_DEVICE0;
9920 pcmCaptureFlag = TRUE;
9921 }
9922 else if(pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE1_bEnable == TRUE)
9923 {
9924 deviceType = E_DEVICE1;
9925 pcmCaptureFlag = TRUE;
9926 }
9927 else if(pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE2_bEnable == TRUE)
9928 {
9929 deviceType = E_DEVICE2;
9930 pcmCaptureFlag = TRUE;
9931 }
9932
9933 if(pcmCaptureFlag == TRUE)
9934 {
9935 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
9936 {
9937 mutex_lock(&AU_Customer_PCMCapture_mutex_lock);
9938 }
9939 #else //User Space
9940 {
9941 OS_OBTAIN_MUTEX(AU_Customer_PCMCapture_mutex_lock, MSOS_WAIT_FOREVER);
9942 }
9943 #endif
9944
9945 memset((void *)pPCMCaptureBuffer, 0x00, pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE_Request_data_in_byte);
9946
9947 if(MApi_AUDIO_PCMCapture_Read(deviceType, (void *)pPCMCaptureBuffer, pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE_Request_data_in_byte) == TRUE)
9948 {
9949 if(pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE_Source_Dump_to_file_bEnable)
9950 {
9951 AU_CUS_FileWrite((void*)pPCMCaptureBuffer, sizeof(MS_U8), pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE_Request_data_in_byte, pAU_PcmCaptureSourceDumpFile);
9952 }
9953
9954 retryCounterPCMCapture = 0;
9955
9956 if(madCallBack.pFunc_PCMCaptureDone != NULL)
9957 {
9958 madCallBack.pFunc_PCMCaptureDone(pPCMCaptureBuffer, pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE_Request_data_in_byte);
9959 }
9960 }
9961 else
9962 {
9963 retryCounterPCMCapture++;
9964 if (retryCounterPCMCapture > 10)
9965 {
9966 AU_nPRINT("Warning: PCM capture retry too much (0x%x) !!!!!\n", (unsigned int)retryCounterPCMCapture);
9967 }
9968 }
9969
9970 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
9971 {
9972 mutex_unlock(&AU_Customer_PCMCapture_mutex_lock);
9973 }
9974 #else //User Space
9975 {
9976 OS_RELEASE_MUTEX(AU_Customer_PCMCapture_mutex_lock);
9977 }
9978 #endif
9979 }
9980
9981 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_AU_PCMCapture_Interval);
9982 }
9983 }
9984
AU_CUS_PCMCaptureInit(AUDIO_DEVICE_TYPE deviceType,AUDIO_CAPTURE_SOURCE_TYPE sourceType)9985 static MS_BOOL AU_CUS_PCMCaptureInit(AUDIO_DEVICE_TYPE deviceType, AUDIO_CAPTURE_SOURCE_TYPE sourceType)
9986 {
9987 //alloc memory for pcm capture buffer
9988 pPCMCaptureBuffer = AU_CUS_MemoryAlloc(pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE_Request_data_in_byte);
9989
9990 if(pPCMCaptureBuffer == NULL)
9991 {
9992 AU_nPRINT("[pPCMCaptureBuffer cannot malloc] \n");
9993 return FALSE;
9994 }
9995
9996 MApi_AUDIO_PCMCapture_Init(deviceType, sourceType);
9997 MApi_AUDIO_PCMCapture_Start(deviceType);
9998
9999 return TRUE;
10000 }
10001
AU_CUS_EndOfStreamMonitor(void)10002 static void AU_CUS_EndOfStreamMonitor(void)
10003 {
10004 while(pstAudioCustomerShmData->g_audio_customer_AU_CUS_EndOfStreamMonitor_bEnable)
10005 {
10006 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
10007
10008 if( (pstAudioCustomerShmData->g_audio_customer_ADEC0_End_Of_Stream_bRegister) && (pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperPlay == API_AUDIO_CUSTOMER_UPPER_PLAY) )
10009 {
10010 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(API_AUDIO_CUSTOMER_ADEC0);
10011
10012 MS_U32 u32Adec0PCMlevel = 0;
10013 static MS_U32 u32Adec0TimeOutCnt = 0;
10014 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_pcmBuf_currLevel, &u32Adec0PCMlevel);
10015 //AU_nPRINT("[AUDIO] [%s] [%d] [DecID = %d][Wait PCM buffer(0x%X) empty] [Time-Out count: %u]\n", __FUNCTION__, __LINE__, DecID, (unsigned int)u32Adec0PCMlevel, (unsigned int)u32Adec0TimeOutCnt);
10016
10017 //Wait all PCM data output from PCM buffer until time out
10018 if( (u32Adec0PCMlevel == 0) && (u32Adec0TimeOutCnt > pstAudioCustomerShmData->g_audio_customer_ADEC_End_Of_Stream_TimeOutCnt) )
10019 {
10020 u32Adec0TimeOutCnt = 0;
10021
10022 if(madCallBack.pFunc_Adec0_EndOfStream != NULL)
10023 {
10024 //AU_nPRINT("[AUDIO] [%s] [%d] [End of Stream finish !!] \n", __FUNCTION__, __LINE__);
10025 madCallBack.pFunc_Adec0_EndOfStream(API_AUDIO_CUSTOMER_ADEC0);
10026 }
10027 }
10028 else
10029 {
10030 //The timeout count should only be incremented if
10031 //there is no audio, otherwise reset the timeout
10032 if (u32Adec0PCMlevel == 0)
10033 {
10034 u32Adec0TimeOutCnt ++;
10035 }
10036 else
10037 {
10038 u32Adec0TimeOutCnt = 0;
10039 }
10040 }
10041 }
10042
10043 if( (pstAudioCustomerShmData->g_audio_customer_ADEC1_End_Of_Stream_bRegister) && (pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperPlay == API_AUDIO_CUSTOMER_UPPER_PLAY) )
10044 {
10045 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(API_AUDIO_CUSTOMER_ADEC1);
10046
10047 MS_U32 u32Adec1PCMlevel = 0;
10048 static MS_U32 u32Adec1TimeOutCnt = 0;
10049 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_pcmBuf_currLevel, &u32Adec1PCMlevel);
10050 //AU_nPRINT("[AUDIO] [%s] [%d] [DecID = %d][Wait PCM buffer(0x%X) empty] [Time-Out count: %u]\n", __FUNCTION__, __LINE__, DecID, (unsigned int)u32Adec1PCMlevel, (unsigned int)u32Adec1TimeOutCnt);
10051
10052 //Wait all PCM data output from PCM buffer until time out
10053 if( (u32Adec1PCMlevel == 0) && (u32Adec1TimeOutCnt > pstAudioCustomerShmData->g_audio_customer_ADEC_End_Of_Stream_TimeOutCnt) )
10054 {
10055 u32Adec1TimeOutCnt = 0;
10056
10057 if(madCallBack.pFunc_Adec1_EndOfStream != NULL)
10058 {
10059 //AU_nPRINT("[AUDIO] [%s] [%d] [End of Stream finish !!] \n", __FUNCTION__, __LINE__);
10060 madCallBack.pFunc_Adec1_EndOfStream(API_AUDIO_CUSTOMER_ADEC1);
10061 }
10062 }
10063 else
10064 {
10065 //The timeout count should only be incremented if
10066 //there is no audio, otherwise reset the timeout
10067 if (u32Adec1PCMlevel == 0)
10068 {
10069 u32Adec1TimeOutCnt ++;
10070 }
10071 else
10072 {
10073 u32Adec1TimeOutCnt = 0;
10074 }
10075 }
10076 }
10077
10078 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_AU_EndOfStreamMonitor_Interval);
10079 }
10080 }
10081
10082 //----------------------------------------------------------
10083 // AU_Demo (PCM capture call back function)
10084 //----------------------------------------------------------
AU_CUS_Demo_PCM_Capture_CallBackFun(MS_U8 * pBuf,MS_U16 length)10085 static MS_BOOL AU_CUS_Demo_PCM_Capture_CallBackFun(MS_U8 *pBuf, MS_U16 length)
10086 {
10087 //Just for Demo
10088
10089 return TRUE;
10090 }
10091
10092 //----------------------------------------------------------
10093 // AU_Demo (PCM I/O function)
10094 //----------------------------------------------------------
AU_CUS_Demo_PCMIO_Play_Monitor(void)10095 static void AU_CUS_Demo_PCMIO_Play_Monitor(void)
10096 {
10097 int i = 0;
10098
10099 while(pstAudioCustomerShmData->g_audio_customer_AU_CUS_Demo_PCMIO_Play_Monitor_bEnable)
10100 {
10101 if (pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_UpperPlay == API_AUDIO_CUSTOMER_UPPER_PLAY)
10102 {
10103 for(i = 0; ( (i<pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_repeatNum) && (pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_UpperPlay == API_AUDIO_CUSTOMER_UPPER_PLAY) ); i++)
10104 {
10105 MS_S32 s32DeviceId = 0;
10106 char *u8WtAdr = (char *)AU_Demo_MM_File_read_in_buffer2;
10107 MS_U32 u32EndAdr = (MS_U32)u8WtAdr + pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_input_file_length;
10108 MS_U32 u32size = 0;
10109 MS_U32 u32level = 0;
10110 MS_U32 u32availSize = 0;
10111
10112 AU_nPRINT("Start to play PCM wirte demo, Remaining time: %d \n", (unsigned int)(pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_repeatNum - (i+1)) );
10113
10114 s32DeviceId = API_AUDIO_CUSTOMER_PCM_Open(&pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_pcmParam);
10115 if(s32DeviceId >= 0)
10116 {
10117 API_AUDIO_CUSTOMER_PCM_Start(s32DeviceId);
10118 do
10119 {
10120 API_AUDIO_CUSTOMER_PCM_Get(s32DeviceId, API_AUDIO_CUSTOMER_PCM_CMD_BUFFERSIZE, &u32size);
10121
10122 API_AUDIO_CUSTOMER_PCM_Get(s32DeviceId, API_AUDIO_CUSTOMER_PCM_CMD_BUFFERLEVEL, &u32level);
10123
10124 if(u32size > u32level)
10125 {
10126 u32availSize = u32size - u32level;
10127 }
10128
10129 if(pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_UpperPlay == API_AUDIO_CUSTOMER_UPPER_PLAY)
10130 {
10131 u32size = API_AUDIO_CUSTOMER_PCM_Write(s32DeviceId, u8WtAdr, u32availSize);
10132 }
10133
10134 u8WtAdr = u8WtAdr + u32size;
10135
10136 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_pcmParam.u32BufferDuration/4);
10137
10138 } while( ((MS_U32)(u8WtAdr + u32size) < u32EndAdr) && (pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_UpperPlay == API_AUDIO_CUSTOMER_UPPER_PLAY) );
10139
10140 API_AUDIO_CUSTOMER_PCM_Stop(s32DeviceId);
10141 API_AUDIO_CUSTOMER_PCM_Flush(s32DeviceId);
10142 API_AUDIO_CUSTOMER_PCM_Close(s32DeviceId);
10143 AU_nPRINT("Play PCM wirte demo Finished!! \n");
10144 }
10145 }
10146 }
10147
10148 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_Monitor_Interval);
10149 }
10150 }
10151
10152 //----------------------------------------------------------
10153 // AU_Demo (MM New Mode) (PCM Path: DSP_SRC)
10154 //----------------------------------------------------------
AU_CUS_Demo_MM_New_Mode_ESBufInit(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)10155 static void AU_CUS_Demo_MM_New_Mode_ESBufInit(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
10156 {
10157 St_Audio_Buf_Info *pESBufInfo;
10158
10159 switch(adecIndex)
10160 {
10161 case API_AUDIO_CUSTOMER_ADEC0:
10162 {
10163 pESBufInfo = &ES1BufInfo;
10164 }
10165 break;
10166
10167 case API_AUDIO_CUSTOMER_ADEC1:
10168 {
10169 pESBufInfo = &ES3BufInfo;
10170 }
10171 break;
10172
10173 case API_AUDIO_CUSTOMER_ADEC_ATV:
10174 default:
10175 {
10176 AU_nPRINT("[Error] [%s] [Invalid adecIndex: %d] \n", __FUNCTION__, adecIndex);
10177 pESBufInfo = &ES1BufInfo;
10178 }
10179 break;
10180 }
10181
10182 API_AUDIO_CUSTOMER_GetAudioInfo(adecIndex, API_AUDIO_CUSTOMER_COMMON_INFO_ES_BUFFER_BASE, &(pESBufInfo->u32BufStartAddr_P));
10183 API_AUDIO_CUSTOMER_GetAudioInfo(adecIndex, API_AUDIO_CUSTOMER_COMMON_INFO_ES_BUFFER_SIZE, &(pESBufInfo->u32BufSize));
10184
10185 pESBufInfo->u32BufEndAddr_P = pESBufInfo->u32BufStartAddr_P + pESBufInfo->u32BufSize;
10186 pESBufInfo->u32BufWptr_P = pESBufInfo->u32BufStartAddr_P;
10187 pESBufInfo->u32BufRptr_P = pESBufInfo->u32BufStartAddr_P;
10188
10189 pESBufInfo->u32BufStartAddr_V = MsOS_MPool_PA2KSEG1(pESBufInfo->u32BufStartAddr_P);
10190 pESBufInfo->u32BufEndAddr_V = pESBufInfo->u32BufStartAddr_V + pESBufInfo->u32BufSize;
10191 pESBufInfo->u32BufWptr_V = pESBufInfo->u32BufStartAddr_V;
10192 pESBufInfo->u32BufRptr_V = pESBufInfo->u32BufStartAddr_V;
10193 }
10194
AU_CUS_Demo_MM_New_Mode_ExternalBufInit(void)10195 static void AU_CUS_Demo_MM_New_Mode_ExternalBufInit(void)
10196 {
10197 ExternalBufInfo.u32BufStartAddr_V = (MS_U32)AU_Demo_MM_New_Mode_DecInfo.extBufaddr_V;
10198 ExternalBufInfo.u32BufEndAddr_V = ExternalBufInfo.u32BufStartAddr_V + AU_Demo_MM_New_Mode_DecInfo.u32Size;
10199 ExternalBufInfo.u32BufWptr_V = ExternalBufInfo.u32BufStartAddr_V;
10200 ExternalBufInfo.u32BufRptr_V = ExternalBufInfo.u32BufStartAddr_V;
10201 ExternalBufInfo.u32BufSize = AU_Demo_MM_New_Mode_DecInfo.u32Size;
10202
10203 AU_nDBG("[AUDIO][%s] [%d] [ExternalBufInfo.u32BufStartAddr_V = 0x%X] \n", __FUNCTION__, __LINE__, (unsigned int)ExternalBufInfo.u32BufStartAddr_V);
10204 AU_nDBG("[AUDIO][%s] [%d] [ExternalBufInfo.u32BufEndAddr_V = 0x%X] \n", __FUNCTION__, __LINE__, (unsigned int)ExternalBufInfo.u32BufEndAddr_V);
10205 AU_nDBG("[AUDIO][%s] [%d] [ExternalBufInfo.u32BufWptr_V = 0x%X] \n", __FUNCTION__, __LINE__, (unsigned int)ExternalBufInfo.u32BufWptr_V);
10206 AU_nDBG("[AUDIO][%s] [%d] [ExternalBufInfo.u32BufRptr_V = 0x%X] \n", __FUNCTION__, __LINE__, (unsigned int)ExternalBufInfo.u32BufRptr_V);
10207 AU_nDBG("[AUDIO][%s] [%d] [ExternalBufInfo.u32BufSize = 0x%X] \n", __FUNCTION__, __LINE__, (unsigned int)ExternalBufInfo.u32BufSize);
10208 }
10209
AU_CUS_Demo_MM_New_Mode_FeedingES(void * ExtBufRptr_V,MS_U32 u32Size,API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,St_Audio_Buf_Info * pESBufInfo)10210 void AU_CUS_Demo_MM_New_Mode_FeedingES(void* ExtBufRptr_V, MS_U32 u32Size, API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, St_Audio_Buf_Info *pESBufInfo)
10211 {
10212 //TRUE: Set PTS; FALSE: Not set PTS (MM New mode support this feature)
10213 MS_BOOL bSetPTS = TRUE;
10214 MS_U64 u64PTS = 0;
10215
10216 //set start time
10217 if( ((MS_U32)ExtBufRptr_V) == (pAU_Demo_MM_New_Mode_DecExtBufInfo->u32BufStartAddr_V) )
10218 {
10219 pstAudioCustomerShmData->g_audio_customer_AU_Demo_MM_New_Mode_Play_StartTime = MsOS_GetSystemTime();
10220 //AU_nPRINT("[AUDIO][%s] [%d] [set start time = %d] \n", __FUNCTION__, __LINE__, (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_Demo_MM_New_Mode_Play_StartTime);
10221 }
10222
10223 //AU_nPRINT("[AUDIO][%s] [%d] [ES_Wptr_V = 0x%X] [ES_Wptr_P = 0x%X]\n", __FUNCTION__, __LINE__, (unsigned int)pESBufInfo->u32BufWptr_V, (unsigned int)pESBufInfo->u32BufWptr_P);
10224 memcpy((void *)(pESBufInfo->u32BufWptr_V), ExtBufRptr_V, u32Size);
10225 pESBufInfo->u32BufWptr_V += u32Size;
10226 pESBufInfo->u32BufWptr_P += u32Size;
10227 MsOS_FlushMemory();
10228 MsOS_Sync();
10229
10230 //example of setting system time difference (ticks) as PTS
10231 u64PTS = (MS_U64)((MS_U64)(MsOS_GetSystemTime()+pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_pts_offset) * 90);
10232
10233 API_AUDIO_CUSTOMER_MM2_inputAesFinished(adecIndex, u32Size, bSetPTS, u64PTS);
10234
10235 if( (pESBufInfo->u32BufWptr_V == pESBufInfo->u32BufEndAddr_V) && (pESBufInfo->u32BufWptr_P == pESBufInfo->u32BufEndAddr_P) )
10236 {
10237 pESBufInfo->u32BufWptr_V = pESBufInfo->u32BufStartAddr_V;
10238 pESBufInfo->u32BufWptr_P = pESBufInfo->u32BufStartAddr_P;
10239 }
10240 }
10241
AU_CUS_Demo_MM_New_Mode_AllBufInit(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)10242 static void AU_CUS_Demo_MM_New_Mode_AllBufInit(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
10243 {
10244 API_AUDIO_CUSTOMER_MM2_initAesInfo(adecIndex);
10245
10246 AU_CUS_Demo_MM_New_Mode_ESBufInit(adecIndex);
10247
10248 AU_CUS_Demo_MM_New_Mode_ExternalBufInit();
10249
10250 switch(adecIndex)
10251 {
10252 case API_AUDIO_CUSTOMER_ADEC0:
10253 {
10254 pAU_Demo_MM_New_Mode_DecESBufInfo = &ES1BufInfo;
10255 }
10256 break;
10257
10258 case API_AUDIO_CUSTOMER_ADEC1:
10259 {
10260 pAU_Demo_MM_New_Mode_DecESBufInfo = &ES3BufInfo;
10261 }
10262 break;
10263
10264 case API_AUDIO_CUSTOMER_ADEC_ATV:
10265 default:
10266 break;
10267 }
10268
10269 pAU_Demo_MM_New_Mode_DecExtBufInfo = &ExternalBufInfo;
10270 }
10271
AU_CUS_Demo_MM_New_Mode_Play_Monitor(void)10272 static void AU_CUS_Demo_MM_New_Mode_Play_Monitor(void)
10273 {
10274 while(pstAudioCustomerShmData->g_audio_customer_AU_CUS_Demo_MM_New_Mode_Play_Monitor_bEnable)
10275 {
10276 if( (AU_Demo_MM_New_Mode_DecInfo.bIsStart == TRUE) && (AU_Demo_MM_New_Mode_DecInfo.bIsPause == FALSE) && (AU_Demo_MM_New_Mode_DecInfo.u32RepeatNum > 0) )
10277 {
10278 int u32RemainingSize;
10279 u32RemainingSize = pAU_Demo_MM_New_Mode_DecExtBufInfo->u32BufWptr_V - pAU_Demo_MM_New_Mode_DecExtBufInfo->u32BufRptr_V;
10280
10281 if(u32RemainingSize > 0)
10282 {
10283 API_AUDIO_CUSTOMER_AES_INFO currentAESInfo;
10284 API_AUDIO_CUSTOMER_MM2_checkAesInfo(AU_Demo_MM_New_Mode_DecInfo.adecIndex, ¤tAESInfo);
10285 //AU_nPRINT("[AUDIO][%s] [%d] [adecIndex: %u] [u32RemainingSize = 0x%X] [u32FreeSpace = 0x%X] \n", __FUNCTION__, __LINE__, (unsigned int)AU_Demo_MM_New_Mode_DecInfo.adecIndex, (unsigned int)u32RemainingSize, (unsigned int)currentAESInfo.aes_freeSpace);
10286
10287 if(u32RemainingSize <= currentAESInfo.aes_freeSpace)
10288 {
10289 AU_CUS_Demo_MM_New_Mode_FeedingES((void*)(pAU_Demo_MM_New_Mode_DecExtBufInfo->u32BufRptr_V), u32RemainingSize, AU_Demo_MM_New_Mode_DecInfo.adecIndex, pAU_Demo_MM_New_Mode_DecESBufInfo);
10290 pAU_Demo_MM_New_Mode_DecExtBufInfo->u32BufRptr_V += u32RemainingSize;
10291 //AU_nPRINT("[AUDIO][%s] [%d] [No remaining ES data] [Remaining repeat time: %u] \n", __FUNCTION__, __LINE__, (unsigned int)AU_Demo_MM_New_Mode_DecInfo.u32RepeatNum);
10292 }
10293 else
10294 {
10295 if(currentAESInfo.aes_freeSpace > 0)
10296 {
10297 //AU_nPRINT("[AUDIO][%s] [%d] [Feeding data] [u32BufWptr_V = 0x%X] [u32BufRptr_V = 0x%X] \n", __FUNCTION__, __LINE__, (unsigned int)pAU_Demo_MM_New_Mode_DecExtBufInfo->u32BufWptr_V, (unsigned int)pAU_Demo_MM_New_Mode_DecExtBufInfo->u32BufRptr_V);
10298 AU_CUS_Demo_MM_New_Mode_FeedingES((void*)(pAU_Demo_MM_New_Mode_DecExtBufInfo->u32BufRptr_V), currentAESInfo.aes_freeSpace, AU_Demo_MM_New_Mode_DecInfo.adecIndex, pAU_Demo_MM_New_Mode_DecESBufInfo);
10299 pAU_Demo_MM_New_Mode_DecExtBufInfo->u32BufRptr_V += currentAESInfo.aes_freeSpace;
10300 }
10301 }
10302 }
10303 else
10304 {
10305 MS_U32 u32PCMlevel = 0;
10306 static MS_U32 u32TimeOutCnt = 0;
10307
10308 API_AUDIO_CUSTOMER_GetAudioInfo(AU_Demo_MM_New_Mode_DecInfo.adecIndex, API_AUDIO_CUSTOMER_COMMON_INFO_PCM_BUFFER_CURRENT_LEVEL, &u32PCMlevel);
10309 //AU_nPRINT("[AUDIO][%s] [%d] [Wait PCM buffer(0x%X) empty] [Time-Out count: %u]\n", __FUNCTION__, __LINE__, (unsigned int)u32PCMlevel, (unsigned int)u32TimeOutCnt);
10310
10311 //Wait all PCM data output from PCM buffer until time out
10312 if(u32PCMlevel == 0 && u32TimeOutCnt > 100)
10313 {
10314 u32TimeOutCnt = 0;
10315 AU_Demo_MM_New_Mode_DecInfo.u32RepeatNum --;
10316 if(AU_Demo_MM_New_Mode_DecInfo.u32RepeatNum > 0)
10317 {
10318 // Reset ADEC
10319 API_AUDIO_CUSTOMER_StopDecoding(AU_Demo_MM_New_Mode_DecInfo.adecIndex);
10320
10321 // Init Buffer
10322 AU_CUS_Demo_MM_New_Mode_AllBufInit(AU_Demo_MM_New_Mode_DecInfo.adecIndex);
10323 memset((void *)(pAU_Demo_MM_New_Mode_DecESBufInfo->u32BufStartAddr_V), 0, pAU_Demo_MM_New_Mode_DecESBufInfo->u32BufSize);
10324
10325 pAU_Demo_MM_New_Mode_DecExtBufInfo->u32BufWptr_V += AU_Demo_MM_New_Mode_DecInfo.u32Size;
10326
10327 //When AP call stop or pause, there is timing issue if AU_CUS_Demo_MM_New_Mode_Play_Monitor already execute here.
10328 //So check here again.
10329 if( (AU_Demo_MM_New_Mode_DecInfo.bIsStart == TRUE) && (AU_Demo_MM_New_Mode_DecInfo.bIsPause == FALSE) )
10330 {
10331 API_AUDIO_CUSTOMER_StartDecoding(AU_Demo_MM_New_Mode_DecInfo.adecIndex);
10332 //AU_nPRINT("[AUDIO][%s] [%d] [Play next clip with adecIndex(%d)] [Remaining repeat time: %u] \n", __FUNCTION__, __LINE__, (int)AU_Demo_MM_New_Mode_DecInfo.adecIndex, (unsigned int)AU_Demo_MM_New_Mode_DecInfo.u32RepeatNum);
10333 }
10334 else
10335 {
10336 AU_nPRINT("[AUDIO][%s] [%d] [Can't play next clip] [bIsStart: %u] [bIsPause: %u]\n", __FUNCTION__, __LINE__, (unsigned int)AU_Demo_MM_New_Mode_DecInfo.bIsStart, (unsigned int)AU_Demo_MM_New_Mode_DecInfo.bIsPause);
10337 }
10338 }
10339 else
10340 {
10341 switch(AU_Demo_MM_New_Mode_DecInfo.adecIndex)
10342 {
10343 case API_AUDIO_CUSTOMER_ADEC0:
10344 {
10345 if(pstAudioCustomerShmData->g_audio_customer_ADEC0_End_Of_Stream_bRegister)
10346 {
10347 //if register EOS, then do stop decoding in call back function
10348 }
10349 else
10350 {
10351 API_AUDIO_CUSTOMER_StopDecoding(AU_Demo_MM_New_Mode_DecInfo.adecIndex);
10352 }
10353 }
10354 break;
10355
10356 case API_AUDIO_CUSTOMER_ADEC1:
10357 {
10358 if(pstAudioCustomerShmData->g_audio_customer_ADEC1_End_Of_Stream_bRegister)
10359 {
10360 //if register EOS, then do stop decoding in call back function
10361 }
10362 else
10363 {
10364 API_AUDIO_CUSTOMER_StopDecoding(AU_Demo_MM_New_Mode_DecInfo.adecIndex);
10365 }
10366 }
10367 break;
10368
10369 default:
10370 {
10371 API_AUDIO_CUSTOMER_StopDecoding(AU_Demo_MM_New_Mode_DecInfo.adecIndex);
10372 }
10373 break;
10374 }
10375
10376 AU_Demo_MM_New_Mode_DecInfo.bIsStart = FALSE;
10377 pAU_Demo_MM_New_Mode_DecExtBufInfo->u32BufRptr_V = pAU_Demo_MM_New_Mode_DecExtBufInfo->u32BufStartAddr_V;
10378 pAU_Demo_MM_New_Mode_DecExtBufInfo->u32BufWptr_V = pAU_Demo_MM_New_Mode_DecExtBufInfo->u32BufStartAddr_V;
10379
10380 AU_nPRINT("[AUDIO][%s] [%d] [Play Clip decoder finish !!] \n", __FUNCTION__, __LINE__);
10381 }
10382 }
10383 else
10384 {
10385 u32TimeOutCnt ++;
10386 }
10387 }
10388 }
10389
10390 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_AU_Demo_MM_New_Mode_Play_Monitor_Interval);
10391 }
10392 }
10393
10394 //----------------------------------------------------------
10395 // AU_Demo (MM AD New Mode) (PCM Path: DSP_SRC)
10396 //----------------------------------------------------------
AU_CUS_Demo_MM_New_Mode_AD_ESBufInit(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)10397 static void AU_CUS_Demo_MM_New_Mode_AD_ESBufInit(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
10398 {
10399 St_Audio_Buf_Info *pESBufInfo;
10400
10401 switch(adecIndex)
10402 {
10403 case API_AUDIO_CUSTOMER_ADEC0:
10404 {
10405 pESBufInfo = &AD_ES2BufInfo;
10406 }
10407 break;
10408
10409 default:
10410 {
10411 AU_nPRINT("[Error] [%s] [Invalid adecIndex: %d] \n", __FUNCTION__, adecIndex);
10412 pESBufInfo = &AD_ES2BufInfo;
10413 }
10414 break;
10415 }
10416
10417 API_AUDIO_CUSTOMER_GetAudioInfo(adecIndex, API_AUDIO_CUSTOMER_COMMON_INFO_AD_ES_BUFFER_BASE, &(pESBufInfo->u32BufStartAddr_P));
10418 API_AUDIO_CUSTOMER_GetAudioInfo(adecIndex, API_AUDIO_CUSTOMER_COMMON_INFO_AD_ES_BUFFER_SIZE, &(pESBufInfo->u32BufSize));
10419
10420 pESBufInfo->u32BufEndAddr_P = pESBufInfo->u32BufStartAddr_P + pESBufInfo->u32BufSize;
10421 pESBufInfo->u32BufWptr_P = pESBufInfo->u32BufStartAddr_P;
10422 pESBufInfo->u32BufRptr_P = pESBufInfo->u32BufStartAddr_P;
10423
10424 pESBufInfo->u32BufStartAddr_V = MsOS_MPool_PA2KSEG1(pESBufInfo->u32BufStartAddr_P);
10425 pESBufInfo->u32BufEndAddr_V = pESBufInfo->u32BufStartAddr_V + pESBufInfo->u32BufSize;
10426 pESBufInfo->u32BufWptr_V = pESBufInfo->u32BufStartAddr_V;
10427 pESBufInfo->u32BufRptr_V = pESBufInfo->u32BufStartAddr_V;
10428 }
10429
AU_CUS_Demo_MM_New_Mode_AD_ExternalBufInit(void)10430 static void AU_CUS_Demo_MM_New_Mode_AD_ExternalBufInit(void)
10431 {
10432 AD_ExternalBufInfo.u32BufStartAddr_V = (MS_U32)AU_Demo_MM_New_Mode_AD_DecInfo.extBufaddr_V;
10433 AD_ExternalBufInfo.u32BufEndAddr_V = AD_ExternalBufInfo.u32BufStartAddr_V + AU_Demo_MM_New_Mode_AD_DecInfo.u32Size;
10434 AD_ExternalBufInfo.u32BufWptr_V = AD_ExternalBufInfo.u32BufStartAddr_V;
10435 AD_ExternalBufInfo.u32BufRptr_V = AD_ExternalBufInfo.u32BufStartAddr_V;
10436 AD_ExternalBufInfo.u32BufSize = AU_Demo_MM_New_Mode_AD_DecInfo.u32Size;
10437
10438 AU_nDBG("[AUDIO][%s] [%d] [AD_ExternalBufInfo.u32BufStartAddr_V = 0x%X] \n", __FUNCTION__, __LINE__, (unsigned int)AD_ExternalBufInfo.u32BufStartAddr_V);
10439 AU_nDBG("[AUDIO][%s] [%d] [AD_ExternalBufInfo.u32BufEndAddr_V = 0x%X] \n", __FUNCTION__, __LINE__, (unsigned int)AD_ExternalBufInfo.u32BufEndAddr_V);
10440 AU_nDBG("[AUDIO][%s] [%d] [AD_ExternalBufInfo.u32BufWptr_V = 0x%X] \n", __FUNCTION__, __LINE__, (unsigned int)AD_ExternalBufInfo.u32BufWptr_V);
10441 AU_nDBG("[AUDIO][%s] [%d] [AD_ExternalBufInfo.u32BufRptr_V = 0x%X] \n", __FUNCTION__, __LINE__, (unsigned int)AD_ExternalBufInfo.u32BufRptr_V);
10442 AU_nDBG("[AUDIO][%s] [%d] [AD_ExternalBufInfo.u32BufSize = 0x%X] \n", __FUNCTION__, __LINE__, (unsigned int)AD_ExternalBufInfo.u32BufSize);
10443 }
10444
AU_CUS_Demo_MM_New_Mode_AD_FeedingES(void * ExtBufRptr_V,MS_U32 u32Size,API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,St_Audio_Buf_Info * pESBufInfo)10445 void AU_CUS_Demo_MM_New_Mode_AD_FeedingES(void* ExtBufRptr_V, MS_U32 u32Size, API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, St_Audio_Buf_Info *pESBufInfo)
10446 {
10447 //TRUE: Set PTS; FALSE: Not set PTS (MM New mode support this feature)
10448 MS_BOOL bSetPTS = TRUE;
10449 MS_U64 u64PTS = 0;
10450
10451 //set start time
10452 if( ((MS_U32)ExtBufRptr_V) == (pAU_Demo_MM_New_Mode_AD_DecExtBufInfo->u32BufStartAddr_V) )
10453 {
10454 pstAudioCustomerShmData->g_audio_customer_AU_Demo_MM_New_Mode_AD_Play_StartTime = MsOS_GetSystemTime();
10455 //AU_nPRINT("[AUDIO][%s] [%d] [set start time = %d] \n", __FUNCTION__, __LINE__, (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_Demo_MM_New_Mode_AD_Play_StartTime);
10456 }
10457
10458 //AU_nPRINT("[AUDIO][%s] [%d] [ES_Wptr_V = 0x%X] [ES_Wptr_P = 0x%X]\n", __FUNCTION__, __LINE__, (unsigned int)pESBufInfo->u32BufWptr_V, (unsigned int)pESBufInfo->u32BufWptr_P);
10459 memcpy((void *)(pESBufInfo->u32BufWptr_V), ExtBufRptr_V, u32Size);
10460 pESBufInfo->u32BufWptr_V += u32Size;
10461 pESBufInfo->u32BufWptr_P += u32Size;
10462 MsOS_FlushMemory();
10463 MsOS_Sync();
10464
10465 //example of setting system time difference (ticks) as PTS
10466 u64PTS = (MS_U64)((MS_U64)(MsOS_GetSystemTime()+pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_pts_offset) * 90);
10467
10468 API_AUDIO_CUSTOMER_MM2_AD_inputAesFinished(adecIndex, u32Size, bSetPTS, u64PTS);
10469
10470 if( (pESBufInfo->u32BufWptr_V == pESBufInfo->u32BufEndAddr_V) && (pESBufInfo->u32BufWptr_P == pESBufInfo->u32BufEndAddr_P) )
10471 {
10472 pESBufInfo->u32BufWptr_V = pESBufInfo->u32BufStartAddr_V;
10473 pESBufInfo->u32BufWptr_P = pESBufInfo->u32BufStartAddr_P;
10474 }
10475 }
10476
AU_CUS_Demo_MM_New_Mode_AD_AllBufInit(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)10477 static void AU_CUS_Demo_MM_New_Mode_AD_AllBufInit(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
10478 {
10479 API_AUDIO_CUSTOMER_MM2_AD_initAesInfo(adecIndex);
10480
10481 AU_CUS_Demo_MM_New_Mode_AD_ESBufInit(adecIndex);
10482
10483 AU_CUS_Demo_MM_New_Mode_AD_ExternalBufInit();
10484
10485 switch(adecIndex)
10486 {
10487 case API_AUDIO_CUSTOMER_ADEC0:
10488 {
10489 pAU_Demo_MM_New_Mode_AD_DecESBufInfo = &AD_ES2BufInfo;
10490 }
10491 break;
10492
10493 case API_AUDIO_CUSTOMER_ADEC1:
10494 case API_AUDIO_CUSTOMER_ADEC_ATV:
10495 default:
10496 break;
10497 }
10498
10499 pAU_Demo_MM_New_Mode_AD_DecExtBufInfo = &AD_ExternalBufInfo;
10500 }
10501
AU_CUS_Demo_MM_New_Mode_AD_Play_Monitor(void)10502 static void AU_CUS_Demo_MM_New_Mode_AD_Play_Monitor(void)
10503 {
10504 while(pstAudioCustomerShmData->g_audio_customer_AU_CUS_Demo_MM_New_Mode_AD_Play_Monitor_bEnable)
10505 {
10506 if( (AU_Demo_MM_New_Mode_AD_DecInfo.bIsStart == TRUE) && (AU_Demo_MM_New_Mode_AD_DecInfo.bIsPause == FALSE) && (AU_Demo_MM_New_Mode_AD_DecInfo.u32RepeatNum > 0) )
10507 {
10508 int u32RemainingSize;
10509 u32RemainingSize = pAU_Demo_MM_New_Mode_AD_DecExtBufInfo->u32BufWptr_V - pAU_Demo_MM_New_Mode_AD_DecExtBufInfo->u32BufRptr_V;
10510
10511 if(u32RemainingSize > 0)
10512 {
10513 API_AUDIO_CUSTOMER_AES_INFO currentAESInfo = {0,};
10514 API_AUDIO_CUSTOMER_MM2_AD_checkAesInfo(AU_Demo_MM_New_Mode_AD_DecInfo.adecIndex, ¤tAESInfo);
10515 //AU_nPRINT("[AUDIO][%s] [%d] [adecIndex: %u] [u32RemainingSize = 0x%X] [u32FreeSpace = 0x%X] \n", __FUNCTION__, __LINE__, (unsigned int)AU_Demo_MM_New_Mode_AD_DecInfo.adecIndex, (unsigned int)u32RemainingSize, (unsigned int)currentAESInfo.aes_freeSpace);
10516
10517 if(u32RemainingSize <= currentAESInfo.aes_freeSpace)
10518 {
10519 AU_CUS_Demo_MM_New_Mode_AD_FeedingES((void*)(pAU_Demo_MM_New_Mode_AD_DecExtBufInfo->u32BufRptr_V), u32RemainingSize, AU_Demo_MM_New_Mode_AD_DecInfo.adecIndex, pAU_Demo_MM_New_Mode_AD_DecESBufInfo);
10520 pAU_Demo_MM_New_Mode_AD_DecExtBufInfo->u32BufRptr_V += u32RemainingSize;
10521 //AU_nPRINT("[AUDIO][%s] [%d] [No remaining ES data] [Remaining repeat time: %u] \n", __FUNCTION__, __LINE__, (unsigned int)AU_Demo_MM_New_Mode_AD_DecInfo.u32RepeatNum);
10522 }
10523 else
10524 {
10525 if(currentAESInfo.aes_freeSpace > 0)
10526 {
10527 //AU_nPRINT("[AUDIO][%s] [%d] [Feeding data] [u32BufWptr_V = 0x%X] [u32BufRptr_V = 0x%X] \n", __FUNCTION__, __LINE__, (unsigned int)pAU_Demo_MM_New_Mode_AD_DecExtBufInfo->u32BufWptr_V, (unsigned int)pAU_Demo_MM_New_Mode_AD_DecExtBufInfo->u32BufRptr_V);
10528 AU_CUS_Demo_MM_New_Mode_AD_FeedingES((void*)(pAU_Demo_MM_New_Mode_AD_DecExtBufInfo->u32BufRptr_V), currentAESInfo.aes_freeSpace, AU_Demo_MM_New_Mode_AD_DecInfo.adecIndex, pAU_Demo_MM_New_Mode_AD_DecESBufInfo);
10529 pAU_Demo_MM_New_Mode_AD_DecExtBufInfo->u32BufRptr_V += currentAESInfo.aes_freeSpace;
10530 }
10531 }
10532 }
10533 else
10534 {
10535 static MS_U32 u32TimeOutCnt = 0;
10536
10537 //AU_nPRINT("[AUDIO][%s] [%d] [Time-Out count: %u]\n", __FUNCTION__, __LINE__, (unsigned int)u32TimeOutCnt);
10538
10539 //Wait all PCM data output from PCM buffer until time out
10540 if(u32TimeOutCnt > 100)
10541 {
10542 u32TimeOutCnt = 0;
10543 AU_Demo_MM_New_Mode_AD_DecInfo.u32RepeatNum --;
10544 if(AU_Demo_MM_New_Mode_AD_DecInfo.u32RepeatNum > 0)
10545 {
10546 // Init Buffer
10547 AU_CUS_Demo_MM_New_Mode_AD_AllBufInit(AU_Demo_MM_New_Mode_AD_DecInfo.adecIndex);
10548 memset((void *)(pAU_Demo_MM_New_Mode_AD_DecESBufInfo->u32BufStartAddr_V), 0, pAU_Demo_MM_New_Mode_AD_DecESBufInfo->u32BufSize);
10549
10550 pAU_Demo_MM_New_Mode_AD_DecExtBufInfo->u32BufWptr_V += AU_Demo_MM_New_Mode_AD_DecInfo.u32Size;
10551 }
10552 else
10553 {
10554 AU_Demo_MM_New_Mode_AD_DecInfo.bIsStart = FALSE;
10555 pAU_Demo_MM_New_Mode_AD_DecExtBufInfo->u32BufRptr_V = pAU_Demo_MM_New_Mode_AD_DecExtBufInfo->u32BufStartAddr_V;
10556 pAU_Demo_MM_New_Mode_AD_DecExtBufInfo->u32BufWptr_V = pAU_Demo_MM_New_Mode_AD_DecExtBufInfo->u32BufStartAddr_V;
10557
10558 AU_nPRINT("[AUDIO][%s] [%d] [Play AD finish !!] \n", __FUNCTION__, __LINE__);
10559 }
10560 }
10561 else
10562 {
10563 u32TimeOutCnt ++;
10564 }
10565 }
10566 }
10567
10568 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_AU_Demo_MM_New_Mode_Play_Monitor_Interval);
10569 }
10570 }
10571
AU_CUS_long_div(long long a,int b)10572 static long long AU_CUS_long_div(long long a, int b)
10573 {
10574 long long r = 0;
10575
10576 while (a >= b)
10577 {
10578 a -= b;
10579 r++;
10580 }
10581 return r;
10582 }
10583
AU_CUS_AV_Sync_Info_Monitor(void)10584 static void AU_CUS_AV_Sync_Info_Monitor(void)
10585 {
10586 while(pstAudioCustomerShmData->g_audio_customer_AU_CUS_AV_Sync_Info_Monitor_bEnable)
10587 {
10588 if(pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_bEnable)
10589 {
10590 VDEC_StreamId _stStreamId = {0,};
10591 VDEC_StreamId _stRealStrmId = {0,};
10592 VDEC_EX_User_Cmd cmd_id = E_VDEC_EX_USER_CMD_GET_MAIN_STREAM_ID;
10593 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
10594 MS_U32 VPTS = 0;
10595 MS_U32 u32Stc32 = 0;
10596 MS_U32 u32Stc = 0;
10597 MS_U32 u32PCMlevel = 0;
10598 MS_U32 u32PCMlevelinMs = 0;
10599 AUDIO_DEC_ID CurrentDecID = AU_DEC_INVALID;
10600 API_AUDIO_CUSTOMER_UPPER_PLAYCMD CurrentUpperPlay = API_AUDIO_CUSTOMER_UPPER_STOP;
10601 API_AUDIO_CUSTOMER_AES_INFO aes_info;
10602 static MS_U32 current_inputAesFinished_cnt = 0;
10603 static MS_U32 previous_inputAesFinished_cnt = 0;
10604 static MS_U32 current_DMX_stc_ms = 0;
10605 static MS_U32 previous_DMX_stc_ms = 0;
10606 static long long current_Upper_pts_ms = 0;
10607 static long long previous_Upper_pts_ms = 0;
10608 static long long current_R2_pts_ms = 0;
10609 static long long previous_R2_pts_ms = 0;
10610
10611 AU_UNUSED(DecID);
10612
10613 switch(pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_adecIndex)
10614 {
10615 case API_AUDIO_CUSTOMER_ADEC0:
10616 {
10617 CurrentUpperPlay = pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperPlay;
10618 CurrentDecID = pstAudioCustomerShmData->g_audio_customer_ADEC0_DecID;
10619 }
10620 break;
10621
10622 case API_AUDIO_CUSTOMER_ADEC1:
10623 {
10624 CurrentUpperPlay = pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperPlay;
10625 CurrentDecID = pstAudioCustomerShmData->g_audio_customer_ADEC1_DecID;
10626 }
10627 break;
10628
10629 default:
10630 {
10631 CurrentUpperPlay = pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperPlay;
10632 CurrentDecID = pstAudioCustomerShmData->g_audio_customer_ADEC0_DecID;
10633 }
10634 break;
10635 }
10636
10637 //Get DMX STC
10638 if(CurrentUpperPlay == API_AUDIO_CUSTOMER_UPPER_PLAY)
10639 {
10640 MApi_DMX_Stc_Get(&u32Stc32, &u32Stc);
10641 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_DMX_stc = (MS_U32)AU_CUS_long_div((MS_U64)(((u32Stc32&0x1)<<31) + (u32Stc>>1)), 45);
10642 }
10643
10644 if( (CurrentDecID != AU_DEC_INVALID) && (pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_adecIndex != API_AUDIO_CUSTOMER_ADEC_INDEX_INVALID) )
10645 {
10646 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_adecIndex);
10647
10648 //Get pcm level
10649 AU_CUS_GetAudioInfo(AU_Demo_MM_New_Mode_DecInfo.adecIndex, API_AUDIO_CUSTOMER_COMMON_INFO_PCM_BUFFER_CURRENT_LEVEL, &u32PCMlevel);
10650
10651 //Get pcm level in ms:
10652 AU_CUS_GetAudioInfo(AU_Demo_MM_New_Mode_DecInfo.adecIndex, API_AUDIO_CUSTOMER_COMMON_INFO_PCM_BUFFER_CURRENT_LEVEL_IN_MS, &u32PCMlevelinMs);
10653
10654 //Get R2 PTS
10655 AU_CUS_GetAudioInfo(pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_adecIndex, API_AUDIO_CUSTOMER_COMMON_INFO_33BIT_PTS, &pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_R2_pts);
10656 }
10657 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_PCMlevel = u32PCMlevel;
10658 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_PCMlevel_in_ms = u32PCMlevelinMs;
10659
10660 //Get VPTS
10661 if(MApi_VDEC_EX_GetControl(&_stStreamId, cmd_id, (MS_U32 *)&_stRealStrmId) == E_VDEC_EX_OK)
10662 {
10663 VPTS = MApi_VDEC_EX_GetPTS(&_stRealStrmId);
10664 }
10665
10666 //Check if stop, refresh aes info
10667 if( (CurrentUpperPlay == API_AUDIO_CUSTOMER_UPPER_STOP) && (CurrentDecID != AU_DEC_INVALID) && (pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_adecIndex != API_AUDIO_CUSTOMER_ADEC_INDEX_INVALID) )
10668 {
10669 memset((void *)(&aes_info), 0, sizeof(aes_info));
10670 API_AUDIO_CUSTOMER_MM2_checkAesInfo(pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_adecIndex, &aes_info);
10671 }
10672 current_inputAesFinished_cnt = pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_inputAesFinished_cnt;
10673 current_DMX_stc_ms = (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_DMX_stc;
10674 current_Upper_pts_ms = AU_CUS_long_div(pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_Upper_pts, 90);
10675 current_R2_pts_ms = AU_CUS_long_div(pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_R2_pts, 90);
10676 #if 0
10677 AU_nPRINT("|%-7ld|(c-p)AesFinished_cnt:%-2d,ret:%-1d|play=%-2d|aes_freeSpace:%-6d|es_size:%-4d|PCMLevel:%-6d,ms:%-4d|\n",
10678 (long int)MsOS_GetSystemTime(),
10679 (unsigned int)current_inputAesFinished_cnt-previous_inputAesFinished_cnt,
10680 (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_inputAesFinished_ret,
10681 (unsigned int)CurrentUpperPlay,
10682 (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_aes_info.aes_freeSpace,
10683 (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_Upper_es_size,
10684 (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_PCMlevel,
10685 (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_PCMlevel_in_ms);
10686 #endif
10687
10688 AU_nPRINT("|STC:%-7d|VPTS:%-7d|(c-p)fin_cnt:%-2d|ptsExist=%d|APTS(Up):%-7lld|APTS(R2):%-7lld|APTS(Up-R2):%-7lld|(c-p)STC=%-4d|(c-p)Up_pts=%-5d|(c-p)R2_pts=%-4d|STC-UpPTS=%-6d|STC-R2_PTS(R2)=%-4d|STC-VPTS=%-4d|\n",
10689 (unsigned int)current_DMX_stc_ms,
10690 (unsigned int)VPTS,
10691 (unsigned int)(current_inputAesFinished_cnt-previous_inputAesFinished_cnt),
10692 (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_Upper_ptsExist,
10693 current_Upper_pts_ms,
10694 current_R2_pts_ms,
10695 current_Upper_pts_ms-current_R2_pts_ms,
10696 (int)(current_DMX_stc_ms-previous_DMX_stc_ms),
10697 (int)(current_Upper_pts_ms-previous_Upper_pts_ms),
10698 (int)(current_R2_pts_ms-previous_R2_pts_ms),
10699 (int)(current_DMX_stc_ms-current_Upper_pts_ms),
10700 (int)(current_DMX_stc_ms-current_R2_pts_ms),
10701 (int)(current_DMX_stc_ms-VPTS) );
10702
10703 previous_inputAesFinished_cnt = current_inputAesFinished_cnt;
10704 previous_DMX_stc_ms = current_DMX_stc_ms;
10705 previous_Upper_pts_ms = current_Upper_pts_ms;
10706 previous_R2_pts_ms = current_R2_pts_ms;
10707 }
10708
10709 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_Monitor_Interval);
10710 }
10711 }
10712
AU_CUS_ADEC_Underrun_Monitor(void)10713 static void AU_CUS_ADEC_Underrun_Monitor(void)
10714 {
10715 while(pstAudioCustomerShmData->g_audio_customer_AU_CUS_ADEC_Underrun_Monitor_bEnable)
10716 {
10717 if( (pstAudioCustomerShmData->g_audio_customer_ADEC0_Underrun_bRegister == TRUE) && (pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperPlay == API_AUDIO_CUSTOMER_UPPER_PLAY) )
10718 {
10719 static MS_U32 u32Adec0DebounceCnt = 0;
10720 MS_U32 u32PCMlevelinMs = 0;
10721 AU_CUS_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_COMMON_INFO_PCM_BUFFER_CURRENT_LEVEL_IN_MS, &u32PCMlevelinMs);
10722
10723 if(u32PCMlevelinMs < pstAudioCustomerShmData->g_audio_customer_ADEC0_Underrun_Threshold_in_ms)
10724 {
10725 u32Adec0DebounceCnt++;
10726 if((madCallBack.pFunc_Adec0_Underrun != NULL) && (u32Adec0DebounceCnt > pstAudioCustomerShmData->g_audio_customer_ADEC0_Underrun_Debounce_Cnt) )
10727 {
10728 madCallBack.pFunc_Adec0_Underrun(API_AUDIO_CUSTOMER_ADEC0);
10729 }
10730 }
10731 else
10732 {
10733 u32Adec0DebounceCnt = 0;
10734 }
10735 }
10736
10737 if( (pstAudioCustomerShmData->g_audio_customer_ADEC1_Underrun_bRegister == TRUE) && (pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperPlay == API_AUDIO_CUSTOMER_UPPER_PLAY) )
10738 {
10739 static MS_U32 u32Adec1DebounceCnt = 0;
10740 MS_U32 u32PCMlevelinMs = 0;
10741 AU_CUS_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC1, API_AUDIO_CUSTOMER_COMMON_INFO_PCM_BUFFER_CURRENT_LEVEL_IN_MS, &u32PCMlevelinMs);
10742
10743 if(u32PCMlevelinMs < pstAudioCustomerShmData->g_audio_customer_ADEC1_Underrun_Threshold_in_ms)
10744 {
10745 u32Adec1DebounceCnt++;
10746 if((madCallBack.pFunc_Adec1_Underrun != NULL) && (u32Adec1DebounceCnt > pstAudioCustomerShmData->g_audio_customer_ADEC1_Underrun_Debounce_Cnt) )
10747 {
10748 madCallBack.pFunc_Adec1_Underrun(API_AUDIO_CUSTOMER_ADEC1);
10749 }
10750 }
10751 else
10752 {
10753 u32Adec1DebounceCnt = 0;
10754 }
10755 }
10756
10757 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_AU_AdecUnderrun_Interval);
10758 }
10759 }
10760
AU_CUS_INTERNAL_PATCH_Auto_Audio_Delay_Monitor(void)10761 static void AU_CUS_INTERNAL_PATCH_Auto_Audio_Delay_Monitor(void)
10762 {
10763 while(pstAudioCustomerShmData->g_audio_customer_AU_CUS_INTERNAL_PATCH_Auto_Audio_Delay_Monitor_bEnable)
10764 {
10765 if(CUSTOMIZED_INTERNAL_PATCH_PARAM_MS12_HDMI_TX_PCM_AUTO_AUDIO_DELAY_ENABLE)
10766 {
10767 static API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = API_AUDIO_CUSTOMER_ADEC_INDEX_INVALID;
10768 static API_AUDIO_CUSTOMER_CODEC_TYPE current_audioType = API_AUDIO_CUSTOMER_CODEC_TYPE_INVALID;
10769 static API_AUDIO_CUSTOMER_CODEC_TYPE previous_audioType = API_AUDIO_CUSTOMER_CODEC_TYPE_INVALID;
10770 static API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_TYPE current_hdmi_tx_output_type = API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_INVALID;
10771 static API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_TYPE previous_hdmi_tx_output_type = API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_INVALID;
10772
10773 adecIndex = pstAudioCustomerShmData->g_audio_customer_MainDecoderOutput;
10774
10775 switch(adecIndex)
10776 {
10777 case API_AUDIO_CUSTOMER_ADEC0:
10778 {
10779 current_audioType = pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperCodec;
10780 }
10781 break;
10782
10783 case API_AUDIO_CUSTOMER_ADEC1:
10784 {
10785 current_audioType = pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperCodec;
10786 }
10787 break;
10788
10789 default:
10790 break;
10791 }
10792
10793 current_hdmi_tx_output_type = pstAudioCustomerShmData->g_audio_customer_HDMI_TX_UpperOutputType;
10794
10795 //case1: code type change, reset delay.
10796 if(current_audioType != previous_audioType)
10797 {
10798 switch(current_audioType)
10799 {
10800 case API_AUDIO_CUSTOMER_CODEC_TYPE_AC3:
10801 {
10802 if(current_hdmi_tx_output_type == API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_PCM)
10803 {
10804 pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_Final_Auto_Audio_Delay = pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_DD_in_Auto_Audio_Delay;
10805 }
10806 else
10807 {
10808 pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_Final_Auto_Audio_Delay = pstAudioCustomerShmData->g_audio_customer_SE_UpperDelay;
10809 }
10810 }
10811 break;
10812
10813 case API_AUDIO_CUSTOMER_CODEC_TYPE_EAC3:
10814 {
10815 if(current_hdmi_tx_output_type == API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_PCM)
10816 {
10817 pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_Final_Auto_Audio_Delay = pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_DDP_in_Auto_Audio_Delay;
10818 }
10819 else
10820 {
10821 pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_Final_Auto_Audio_Delay = pstAudioCustomerShmData->g_audio_customer_SE_UpperDelay;
10822 }
10823 }
10824 break;
10825
10826 case API_AUDIO_CUSTOMER_CODEC_TYPE_AAC:
10827 {
10828 if(current_hdmi_tx_output_type == API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_PCM)
10829 {
10830 pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_Final_Auto_Audio_Delay = pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_DP_in_Auto_Audio_Delay;
10831 }
10832 else
10833 {
10834 pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_Final_Auto_Audio_Delay = pstAudioCustomerShmData->g_audio_customer_SE_UpperDelay;
10835 }
10836 }
10837 break;
10838
10839 default:
10840 {
10841 pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_Final_Auto_Audio_Delay = pstAudioCustomerShmData->g_audio_customer_SE_UpperDelay;
10842 }
10843 break;
10844 }
10845 }
10846
10847 //case2: hdmi tx type change, reset delay.
10848 if(current_hdmi_tx_output_type != previous_hdmi_tx_output_type)
10849 {
10850 if(current_hdmi_tx_output_type == API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_PCM)
10851 {
10852 switch(current_audioType)
10853 {
10854 case API_AUDIO_CUSTOMER_CODEC_TYPE_AC3:
10855 {
10856 pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_Final_Auto_Audio_Delay = pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_DD_in_Auto_Audio_Delay;
10857 }
10858 break;
10859
10860 case API_AUDIO_CUSTOMER_CODEC_TYPE_EAC3:
10861 {
10862 pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_Final_Auto_Audio_Delay = pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_DDP_in_Auto_Audio_Delay;
10863 }
10864 break;
10865
10866 case API_AUDIO_CUSTOMER_CODEC_TYPE_AAC:
10867 {
10868 pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_Final_Auto_Audio_Delay = pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_DP_in_Auto_Audio_Delay;
10869 }
10870 break;
10871
10872 default:
10873 {
10874 pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_Final_Auto_Audio_Delay = pstAudioCustomerShmData->g_audio_customer_SE_UpperDelay;
10875 }
10876 break;
10877 }
10878 }
10879 else
10880 {
10881 pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_Final_Auto_Audio_Delay = pstAudioCustomerShmData->g_audio_customer_SE_UpperDelay;
10882 }
10883 }
10884
10885 //check pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_Final_Auto_Audio_Delay is same as pstAudioCustomerShmData->g_audio_customer_SE_DriverDelay
10886 if(pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_Final_Auto_Audio_Delay != pstAudioCustomerShmData->g_audio_customer_SE_DriverDelay)
10887 {
10888 AU_CUS_INTERNAL_PATCH_SetAudioParam(adecIndex, AU_CUS_INTERNAL_PATCH_PARAM_MS12_HDMI_TX_PCM_AUDIO_DELAY, &pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_Final_Auto_Audio_Delay);
10889 }
10890
10891 //set previous to current
10892 previous_audioType = current_audioType;
10893 previous_hdmi_tx_output_type = current_hdmi_tx_output_type;
10894 }
10895
10896 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_internal_patch_Auto_Audio_Delay_Monitor_Interval);
10897 }
10898 }
10899
AU_CUS_INTERNAL_PATCH_General_Dump_Buffer_Monitor(void)10900 static void AU_CUS_INTERNAL_PATCH_General_Dump_Buffer_Monitor(void)
10901 {
10902 #if(CUSTOMIZED_INTERNAL_PATCH_PARAM_GENERAL_BUFFER_DUMP)
10903 {
10904 //==================================================================================================================================
10905 // [Debug] Dump DEC PCM1 buffer
10906 //==================================================================================================================================
10907 static MS_U32 Base_Addr_Physical = 0;
10908 static MS_U32 Bffer_Length = 0;
10909 static MS_U32 End_Addr_Physical = 0;
10910 static MS_U32 Current_Wptr_Physical = 0;
10911 static MS_U32 Previous_Wptr_Physical = 0;
10912 static MS_U32 copy_size = 0;
10913
10914 //==================================================================================================================================
10915 // [Debug] Dump HDMI NonPCM buffer
10916 //==================================================================================================================================
10917 static MS_U32 Base_Addr_Physical2 = 0;
10918 static MS_U32 Bffer_Length2 = 0;
10919 static MS_U32 End_Addr_Physical2 = 0;
10920 static MS_U32 Current_Wptr_Physical2 = 0;
10921 static MS_U32 Previous_Wptr_Physical2 = 0;
10922 static MS_U32 copy_size2 = 0;
10923
10924 //==================================================================================================================================
10925 // [Debug] Dump MS12 Meta data buffer
10926 //==================================================================================================================================
10927 static MS_U32 Base_Addr_Physical3 = 0;
10928 static MS_U32 Bffer_Length3 = 0;
10929 static MS_U32 End_Addr_Physical3 = 0;
10930 static MS_U32 Current_Wptr_Physical3 = 0;
10931 static MS_U32 Previous_Wptr_Physical3 = 0;
10932 static MS_U32 copy_size3 = 0;
10933
10934 //==================================================================================================================================
10935 // [Debug] Dump DEC ES1 buffer (For HDMI RX NPCM, using Rdptr to dump ES1)
10936 //==================================================================================================================================
10937 static MS_U32 Base_Addr_Physical4 = 0;
10938 static MS_U32 Bffer_Length4 = 0;
10939 static MS_U32 End_Addr_Physical4 = 0;
10940 static MS_U32 Current_Wptr_Physical4 = 0;
10941 static MS_U32 Previous_Wptr_Physical4 = 0;
10942 static MS_U32 copy_size4 = 0;
10943
10944 //==================================================================================================================================
10945
10946 while(pstAudioCustomerShmData->g_audio_customer_AU_CUS_INTERNAL_PATCH_General_Dump_Buffer_Monitor_bEnable)
10947 {
10948 if(pstAudioCustomerShmData->g_audio_customer_internal_patch_General_Buffer_Dump_bEnable)
10949 {
10950 //==================================================================================================================================
10951 // [Debug] Dump DEC PCM1 buffer
10952 //==================================================================================================================================
10953 if(pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_PCM1_bEnable)
10954 {
10955 API_AUDIO_CUSTOMIZED_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_INFO_DEC_PCM1_BUF_BASE, &Base_Addr_Physical);
10956 API_AUDIO_CUSTOMIZED_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_INFO_DEC_PCM1_BUF_SIZE, &Bffer_Length);
10957 End_Addr_Physical = Base_Addr_Physical + Bffer_Length;
10958 API_AUDIO_CUSTOMIZED_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_INFO_DEC_PCM1_BUF_WPTR, &Current_Wptr_Physical);
10959
10960 #if 0
10961 AU_nPRINT("|Base:0x%-9x|buffLength:0x%-6x|End:0x%-9x|CurrWptr:0x%-9x|PrevWptr:0x%-9x|\n",
10962 (unsigned int)Base_Addr_Physical,
10963 (unsigned int)Bffer_Length,
10964 (unsigned int)End_Addr_Physical,
10965 (unsigned int)Current_Wptr_Physical,
10966 (unsigned int)Previous_Wptr_Physical);
10967 #endif
10968
10969 if(Current_Wptr_Physical > Previous_Wptr_Physical)
10970 {
10971 if(Current_Wptr_Physical - Previous_Wptr_Physical <= Bffer_Length)
10972 {
10973 // case1:
10974 // Prev-> ----------- base Addr
10975 // |///////////|
10976 // |///////////|
10977 // |___________|
10978 // Curr->| |
10979 // | |
10980 // | |
10981 // | |
10982 // | |
10983 // | |
10984 // |___________|end Addr
10985
10986 copy_size = Current_Wptr_Physical - Previous_Wptr_Physical;
10987
10988 if(pAU_GeneralBufferDumpFile != NULL)
10989 {
10990 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(Previous_Wptr_Physical), sizeof(char), copy_size, pAU_GeneralBufferDumpFile);
10991 }
10992 }
10993 }
10994 else if(Current_Wptr_Physical < Previous_Wptr_Physical)
10995 {
10996 if(Current_Wptr_Physical == Base_Addr_Physical)
10997 {
10998
10999 // case2:
11000 // Curr-> ----------- base Addr
11001 // | |
11002 // | |
11003 // | |
11004 // | |
11005 // | |
11006 // | |
11007 // Prev->|___________|
11008 // |///////////|
11009 // |///////////|
11010 // |___________|end Addr
11011
11012 copy_size = End_Addr_Physical - Previous_Wptr_Physical;
11013
11014 if(pAU_GeneralBufferDumpFile != NULL)
11015 {
11016 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(Previous_Wptr_Physical), sizeof(char), copy_size, pAU_GeneralBufferDumpFile);
11017 }
11018 }
11019 else if(Current_Wptr_Physical > Base_Addr_Physical)
11020 {
11021 // case3:
11022 // ----------- base Addr
11023 // |///////////|
11024 // Curr->|___________|
11025 // | |
11026 // | |
11027 // | |
11028 // | |
11029 // | |
11030 // Prev->|___________|
11031 // |///////////|
11032 // |___________|end Addr
11033
11034 copy_size = End_Addr_Physical - Previous_Wptr_Physical;
11035
11036 if(pAU_GeneralBufferDumpFile != NULL)
11037 {
11038 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(Previous_Wptr_Physical), sizeof(char), copy_size, pAU_GeneralBufferDumpFile);
11039 }
11040
11041 copy_size = Current_Wptr_Physical - Base_Addr_Physical;
11042
11043 if(pAU_GeneralBufferDumpFile != NULL)
11044 {
11045 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(Base_Addr_Physical), sizeof(char), copy_size, pAU_GeneralBufferDumpFile);
11046 }
11047 }
11048 }
11049 Previous_Wptr_Physical = Current_Wptr_Physical;
11050 }
11051
11052 //==================================================================================================================================
11053 // [Debug] Dump HDMI NonPCM buffer
11054 //==================================================================================================================================
11055 if(pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_HDMINPCM_bEnable)
11056 {
11057 API_AUDIO_CUSTOMIZED_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_INFO_HDMI_NPCM_BUF_BASE, &Base_Addr_Physical2);
11058 API_AUDIO_CUSTOMIZED_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_INFO_HDMI_NPCM_BUF_SIZE, &Bffer_Length2);
11059 End_Addr_Physical2 = Base_Addr_Physical2 + Bffer_Length2;
11060 API_AUDIO_CUSTOMIZED_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_INFO_HDMI_NPCM_BUF_WPTR, &Current_Wptr_Physical2);
11061
11062 #if 0
11063 AU_nPRINT("|Base:0x%-9x|buffLength:0x%-6x|End:0x%-9x|CurrWptr:0x%-9x|PrevWptr:0x%-9x|\n",
11064 (unsigned int)Base_Addr_Physical2,
11065 (unsigned int)Bffer_Length2,
11066 (unsigned int)End_Addr_Physical2,
11067 (unsigned int)Current_Wptr_Physical2,
11068 (unsigned int)Previous_Wptr_Physical2);
11069 #endif
11070
11071 if(Current_Wptr_Physical2 > Previous_Wptr_Physical2)
11072 {
11073 if(Current_Wptr_Physical2 - Previous_Wptr_Physical2 <= Bffer_Length2)
11074 {
11075 copy_size2 = Current_Wptr_Physical2 - Previous_Wptr_Physical2;
11076
11077 if(pAU_GeneralBufferDumpFile2 != NULL)
11078 {
11079 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(Previous_Wptr_Physical2), sizeof(char), copy_size2, pAU_GeneralBufferDumpFile2);
11080 }
11081 }
11082 }
11083 else if(Current_Wptr_Physical2 < Previous_Wptr_Physical2)
11084 {
11085 if(Current_Wptr_Physical2 == Base_Addr_Physical2)
11086 {
11087 copy_size2 = End_Addr_Physical2 - Previous_Wptr_Physical2;
11088
11089 if(pAU_GeneralBufferDumpFile2 != NULL)
11090 {
11091 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(Previous_Wptr_Physical2), sizeof(char), copy_size2, pAU_GeneralBufferDumpFile2);
11092 }
11093 }
11094 else if(Current_Wptr_Physical2 > Base_Addr_Physical2)
11095 {
11096 copy_size2 = End_Addr_Physical2 - Previous_Wptr_Physical2;
11097
11098 if(pAU_GeneralBufferDumpFile2 != NULL)
11099 {
11100 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(Previous_Wptr_Physical2), sizeof(char), copy_size2, pAU_GeneralBufferDumpFile2);
11101 }
11102
11103 copy_size2 = Current_Wptr_Physical2 - Base_Addr_Physical2;
11104
11105 if(pAU_GeneralBufferDumpFile2 != NULL)
11106 {
11107 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(Base_Addr_Physical2), sizeof(char), copy_size2, pAU_GeneralBufferDumpFile2);
11108 }
11109 }
11110 }
11111 Previous_Wptr_Physical2 = Current_Wptr_Physical2;
11112 }
11113
11114 //==================================================================================================================================
11115 // [Debug] Dump MS12 Meta data buffer
11116 //==================================================================================================================================
11117 if(pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_MS12_METADATA_bEnable)
11118 {
11119 API_AUDIO_CUSTOMIZED_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_INFO_MS12_DDPE_METADATA_BUF_BASE, &Base_Addr_Physical3);
11120 API_AUDIO_CUSTOMIZED_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_INFO_MS12_DDPE_METADATA_BUF_SIZE, &Bffer_Length3);
11121 End_Addr_Physical3 = Base_Addr_Physical3 + Bffer_Length3;
11122 API_AUDIO_CUSTOMIZED_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_INFO_MS12_DDPE_METADATA_BUF_WPTR, &Current_Wptr_Physical3);
11123
11124 #if 0
11125 AU_nPRINT("|Base:0x%-9x|buffLength:0x%-6x|End:0x%-9x|CurrWptr:0x%-9x|PrevWptr:0x%-9x|\n",
11126 (unsigned int)Base_Addr_Physical3,
11127 (unsigned int)Bffer_Length3,
11128 (unsigned int)End_Addr_Physical3,
11129 (unsigned int)Current_Wptr_Physical3,
11130 (unsigned int)Previous_Wptr_Physical3);
11131 #endif
11132
11133 if(Current_Wptr_Physical3 > Previous_Wptr_Physical3)
11134 {
11135 if(Current_Wptr_Physical3 - Previous_Wptr_Physical3 <= Bffer_Length3)
11136 {
11137 copy_size3 = Current_Wptr_Physical3 - Previous_Wptr_Physical3;
11138 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(Previous_Wptr_Physical3), sizeof(char), copy_size3, pAU_GeneralBufferDumpFile3);
11139 }
11140 }
11141 else if(Current_Wptr_Physical3 < Previous_Wptr_Physical3)
11142 {
11143 if(Current_Wptr_Physical3 == Base_Addr_Physical3)
11144 {
11145 copy_size3 = End_Addr_Physical3 - Previous_Wptr_Physical3;
11146 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(Previous_Wptr_Physical3), sizeof(char), copy_size3, pAU_GeneralBufferDumpFile3);
11147 }
11148 else if(Current_Wptr_Physical3 > Base_Addr_Physical3)
11149 {
11150 copy_size3 = End_Addr_Physical3 - Previous_Wptr_Physical3;
11151 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(Previous_Wptr_Physical3), sizeof(char), copy_size3, pAU_GeneralBufferDumpFile3);
11152
11153 copy_size3 = Current_Wptr_Physical3 - Base_Addr_Physical3;
11154 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(Base_Addr_Physical3), sizeof(char), copy_size3, pAU_GeneralBufferDumpFile3);
11155 }
11156 }
11157 Previous_Wptr_Physical3 = Current_Wptr_Physical3;
11158 }
11159
11160 //==================================================================================================================================
11161 // [Debug] Dump DEC ES1 buffer (For HDMI RX NPCM, using Rdptr to dump ES1)
11162 //==================================================================================================================================
11163 if(pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_HDMI_ES1_bEnable)
11164 {
11165 API_AUDIO_CUSTOMIZED_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_INFO_DEC_ES1_BUF_BASE, &Base_Addr_Physical4);
11166 API_AUDIO_CUSTOMIZED_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_INFO_DEC_ES1_BUF_SIZE, &Bffer_Length4);
11167 End_Addr_Physical4 = Base_Addr_Physical4 + Bffer_Length4;
11168 API_AUDIO_CUSTOMIZED_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_INFO_DEC_ES1_BUF_RPTR, &Current_Wptr_Physical4);
11169
11170 #if 0
11171 AU_nPRINT("|Base:0x%-9x|buffLength:0x%-6x|End:0x%-9x|CurrWptr:0x%-9x|PrevWptr:0x%-9x|\n",
11172 (unsigned int)Base_Addr_Physical4,
11173 (unsigned int)Bffer_Length4,
11174 (unsigned int)End_Addr_Physical4,
11175 (unsigned int)Current_Wptr_Physical4,
11176 (unsigned int)Previous_Wptr_Physical4);
11177 #endif
11178
11179 if(Current_Wptr_Physical4 > Previous_Wptr_Physical4)
11180 {
11181 if(Current_Wptr_Physical4 - Previous_Wptr_Physical4 <= Bffer_Length4)
11182 {
11183 copy_size4 = Current_Wptr_Physical4 - Previous_Wptr_Physical4;
11184 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(Previous_Wptr_Physical4), sizeof(char), copy_size4, pAU_GeneralBufferDumpFile4);
11185 }
11186 }
11187 else if(Current_Wptr_Physical4 < Previous_Wptr_Physical4)
11188 {
11189 if(Current_Wptr_Physical4 == Base_Addr_Physical4)
11190 {
11191 copy_size4 = End_Addr_Physical4 - Previous_Wptr_Physical4;
11192 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(Previous_Wptr_Physical4), sizeof(char), copy_size4, pAU_GeneralBufferDumpFile4);
11193 }
11194 else if(Current_Wptr_Physical4 > Base_Addr_Physical4)
11195 {
11196 copy_size4 = End_Addr_Physical4 - Previous_Wptr_Physical4;
11197 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(Previous_Wptr_Physical4), sizeof(char), copy_size4, pAU_GeneralBufferDumpFile4);
11198
11199 copy_size4 = Current_Wptr_Physical4 - Base_Addr_Physical4;
11200 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(Base_Addr_Physical4), sizeof(char), copy_size4, pAU_GeneralBufferDumpFile4);
11201 }
11202 }
11203 Previous_Wptr_Physical4 = Current_Wptr_Physical4;
11204 }
11205
11206 }
11207
11208 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_internal_patch_General_Buffer_Dump_Monitor_Interval);
11209 }
11210 }
11211 #endif
11212 }
11213
AU_CUS_INTERNAL_PATCH_DDP_71_Auto_Bypass_Monitor(void)11214 static void AU_CUS_INTERNAL_PATCH_DDP_71_Auto_Bypass_Monitor(void)
11215 {
11216 #if(CUSTOMIZED_INTERNAL_PATCH_DDP_71_AUTO_BYPASS_ENABLE)
11217 {
11218 while(pstAudioCustomerShmData->g_audio_customer_AU_CUS_INTERNAL_PATCH_DDP_71_Auto_Bypass_Monitor_bEnable)
11219 {
11220 if(pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_Monitor_bEnable)
11221 {
11222 MS_U32 bDDP_71_Stream = 0;
11223 int okFrmCnt = 0;
11224 int chkCnt = 0;
11225 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
11226 AU_UNUSED(DecID);
11227
11228 switch(pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_adecIndex)
11229 {
11230 case API_AUDIO_CUSTOMER_ADEC0:
11231 {
11232 if(pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect == API_AUDIO_CUSTOMER_ADEC_INPUT_HDMI)
11233 {
11234 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_Debounce_Cnt = 100000;
11235 }
11236 else
11237 {
11238 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_Debounce_Cnt = 1000;
11239 }
11240 }
11241 break;
11242
11243 case API_AUDIO_CUSTOMER_ADEC1:
11244 {
11245 if(pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect == API_AUDIO_CUSTOMER_ADEC_INPUT_HDMI)
11246 {
11247 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_Debounce_Cnt = 100000;
11248 }
11249 else
11250 {
11251 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_Debounce_Cnt = 1000;
11252 }
11253 }
11254 break;
11255
11256 default:
11257 {
11258 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_Debounce_Cnt = 1000;
11259 }
11260 break;
11261 }
11262
11263
11264 for(chkCnt = 0; chkCnt < pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_Debounce_Cnt; chkCnt++)
11265 {
11266 AU_CUS_GetAudioInfo(pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_adecIndex, API_AUDIO_CUSTOMER_COMMON_INFO_OK_FRAME_CNT, &okFrmCnt);
11267 if(okFrmCnt >= 10)
11268 {
11269 break;
11270 }
11271 }
11272
11273 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_okFrmCnt = okFrmCnt;
11274
11275 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_Debounce_Cnt = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_Debounce_Cnt);
11276 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_okFrmCnt = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_okFrmCnt);
11277
11278 #if(CUSTOMIZED_INTERNAL_PATCH_DDP_71_AUTO_BYPASS_STB_HDMI_TX)
11279 {
11280 bDDP_71_Stream = MApi_AUDIO_GetAC3PInfo(Audio_AC3P_infoType_DDP_71_Stream);
11281 if(bDDP_71_Stream)
11282 {
11283 if(pstAudioCustomerShmData->g_audio_customer_HDMI_TX_UpperOutputType != API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_PCM)
11284 {
11285 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_bDDP_71_Stream = TRUE;
11286 AU_CUS_HDMI_TX_SetOutputType(API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_EAC3_BYPASS);
11287 AU_CUS_PATCH_SeDSP_MS12_Enc_wo_Main_Snd_disable();
11288 }
11289 }
11290 else
11291 {
11292 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_bDDP_71_Stream = FALSE;
11293 AU_CUS_HDMI_TX_SetOutputType(pstAudioCustomerShmData->g_audio_customer_HDMI_TX_UpperOutputType);
11294 }
11295 }
11296 #endif
11297
11298 #if(CUSTOMIZED_INTERNAL_PATCH_DDP_71_AUTO_BYPASS_TV_HDMI_ARC)
11299 {
11300 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_adecIndex);
11301 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_Is_DDP_8ch_Stream, &bDDP_71_Stream);
11302
11303 AU_nDBG("[bDDP_71_Stream = %d] \n", (unsigned int)bDDP_71_Stream);
11304 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_UpperOutputType = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_UpperOutputType);
11305
11306 if(bDDP_71_Stream)
11307 {
11308 if(pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_UpperOutputType != API_AUDIO_CUSTOMER_SPDIF_TX_PCM)
11309 {
11310 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_bDDP_71_Stream = TRUE;
11311 AU_CUS_SPDIF_TX_SetOutputType(API_AUDIO_CUSTOMER_SPDIF_TX_BYPASS);
11312 AU_CUS_PATCH_SndR2_MS12_Enc_wo_Main_Snd_disable();
11313 }
11314 }
11315 else
11316 {
11317 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_bDDP_71_Stream = FALSE;
11318 AU_CUS_SPDIF_TX_SetOutputType(pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_UpperOutputType);
11319 }
11320 }
11321 #endif
11322
11323 pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_Monitor_bEnable = FALSE;
11324
11325 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperPlay = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperPlay);
11326 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperPlay = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperPlay);
11327
11328 /* Make sure current cmd is still UPPER_PLAY */
11329 if( (pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_adecIndex == API_AUDIO_CUSTOMER_ADEC0 && pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperPlay == API_AUDIO_CUSTOMER_UPPER_PLAY) ||
11330 (pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_adecIndex == API_AUDIO_CUSTOMER_ADEC1 && pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperPlay == API_AUDIO_CUSTOMER_UPPER_PLAY) )
11331 {
11332 /* Start decode */
11333 AU_CUS_SetPlayCmdByAdecSource(pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_adecIndex);
11334 }
11335
11336 /* Recover sync mode */
11337 switch(pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_adecIndex)
11338 {
11339 case API_AUDIO_CUSTOMER_ADEC0:
11340 {
11341 AU_CUS_SetSyncMode(API_AUDIO_CUSTOMER_ADEC0, pstAudioCustomerShmData->g_audio_customer_ADEC0_SyncMode);
11342 }
11343 break;
11344
11345 case API_AUDIO_CUSTOMER_ADEC1:
11346 {
11347 AU_CUS_SetSyncMode(API_AUDIO_CUSTOMER_ADEC1, pstAudioCustomerShmData->g_audio_customer_ADEC1_SyncMode);
11348 }
11349 break;
11350
11351 default:
11352 break;
11353 }
11354 }
11355
11356 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_Monitor_Interval);
11357 }
11358 }
11359 #endif
11360 }
11361
AU_CUS_PATCH_Dump_R2_Log_Monitor(void)11362 static void AU_CUS_PATCH_Dump_R2_Log_Monitor(void)
11363 {
11364 #if(CUSTOMIZED_PATCH_PARAM_MCU_DUMP_R2_LOG)
11365 {
11366 static MS_U32 Base_Addr_Physical = 0;
11367 static MS_U32 Bffer_Length = 0;
11368 static MS_U32 End_Addr_Physical = 0;
11369 static MS_U32 Current_Wptr_Physical = 0;
11370 static MS_U32 Previous_Wptr_Physical = 0;
11371
11372 while(pstAudioCustomerShmData->g_audio_customer_AU_CUS_PATCH_Dump_R2_Log_Monitor_bEnable)
11373 {
11374 if(pstAudioCustomerShmData->g_audio_customer_patch_MCU_Dump_R2_Log_Moitor_bEnable)
11375 {
11376 API_AUDIO_CUSTOMIZED_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_INFO_R2_UART_BUF_BASE, &Base_Addr_Physical);
11377 API_AUDIO_CUSTOMIZED_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_INFO_R2_UART_BUF_SIZE, &Bffer_Length);
11378 End_Addr_Physical = Base_Addr_Physical + Bffer_Length;
11379 API_AUDIO_CUSTOMIZED_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_INFO_R2_UART_BUF_WPTR, &Current_Wptr_Physical);
11380
11381 #if 0
11382 AU_nPRINT("|Base:0x%-9x|buffLength:0x%-6x|End:0x%-9x|CurrWptr:0x%-9x|PrevWptr:0x%-9x|c-p=%-9d\n",
11383 (unsigned int)Base_Addr_Physical,
11384 (unsigned int)Bffer_Length,
11385 (unsigned int)End_Addr_Physical,
11386 (unsigned int)Current_Wptr_Physical,
11387 (unsigned int)Previous_Wptr_Physical,
11388 (int)((int)Current_Wptr_Physical-(int)Previous_Wptr_Physical) );
11389 #endif
11390
11391 int copy_size1, copy_size2, copy_length;
11392
11393 if (!Previous_Wptr_Physical)
11394 {
11395 Previous_Wptr_Physical = Base_Addr_Physical;
11396 }
11397
11398 copy_length = Current_Wptr_Physical - Previous_Wptr_Physical;
11399 if (copy_length < 0)
11400 {
11401 copy_length += Bffer_Length;
11402 }
11403
11404 if (copy_length >= (End_Addr_Physical - Previous_Wptr_Physical))
11405 {
11406 copy_size1 = End_Addr_Physical - Previous_Wptr_Physical;
11407 copy_size2 = copy_length - copy_size1;
11408
11409 if(pAU_R2LogBufferDumpFile != NULL)
11410 {
11411 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(Previous_Wptr_Physical), sizeof(char), copy_size1, pAU_R2LogBufferDumpFile);
11412 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(Base_Addr_Physical), sizeof(char), copy_size2, pAU_R2LogBufferDumpFile);
11413 }
11414 }
11415 else
11416 {
11417 if(pAU_R2LogBufferDumpFile != NULL)
11418 {
11419 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(Previous_Wptr_Physical), sizeof(char), copy_length, pAU_R2LogBufferDumpFile);
11420 }
11421 }
11422
11423 Previous_Wptr_Physical = Current_Wptr_Physical;
11424 }
11425
11426 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_patch_Dump_R2_Log_Monitor_Interval);
11427 }
11428 }
11429 #endif
11430 }
11431
AU_CUS_ThreadPrintMsg_Monitor(void)11432 static void AU_CUS_ThreadPrintMsg_Monitor(void)
11433 {
11434 while(pstAudioCustomerShmData->g_audio_customer_AU_CUS_ThreadPrintMsg_Monitor_bEnable)
11435 {
11436 if(pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg)
11437 {
11438 pstAudioCustomerShmData->g_audio_customer_bThreadPrintMsg = TRUE;
11439
11440 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_bThreadPrintMsg_Interval);
11441
11442 pstAudioCustomerShmData->g_audio_customer_bThreadPrintMsg = FALSE;
11443 pstAudioCustomerShmData->g_audio_customer_bThreadPrintMsg_Line = 0;
11444
11445 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_bThreadPrintMsg_Interval);
11446 }
11447
11448 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg_Interval);
11449 }
11450 }
11451
AU_CUS_INTERNAL_PATCH_R2_Active_Monitor(void)11452 static void AU_CUS_INTERNAL_PATCH_R2_Active_Monitor(void)
11453 {
11454 #if(CUSTOMIZED_INTERNAL_PATCH_R2_ACTIVE_MONITOR_ENABLE)
11455 {
11456 MS_U32 u32R2_ACK1_Response = 0;
11457
11458 while(pstAudioCustomerShmData->g_audio_customer_AU_CUS_INTERNAL_PATCH_R2_Active_Monitor_bEnable)
11459 {
11460 if( (g_api_audio_InitializeModule_R2_bActive == FALSE) && (pstAudioCustomerShmData->g_audio_customer_Init_Done == TRUE) )
11461 {
11462 u32R2_ACK1_Response = (MS_U32)AU_CUS_ReadAbsReg(REG_DECR2_ACK1);
11463 //AU_nPRINT("[u32R2_ACK1_Response = 0x%x] \n", (unsigned int)u32R2_ACK1_Response);
11464
11465 if(u32R2_ACK1_Response == REG_DECR2_ACK1_RESPONSE)
11466 {
11467 g_api_audio_InitializeModule_R2_bActive = TRUE;
11468 break;
11469 }
11470 else
11471 {
11472 g_api_audio_InitializeModule_R2_bActive = FALSE;
11473 }
11474 }
11475
11476 AU_CUS_Delay1MS(pstAudioCustomerShmData->g_audio_customer_internal_patch_R2_Active_Monitor_Interval);
11477 }
11478 }
11479 #endif
11480 }
11481
11482 //AU Demo MM New Mode Enter point
AU_CUS_Demo_MM_New_Mode_Play(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMER_CLIP_DEC_PARAM clipInfo,MS_U32 bufSize,void * pExternalBuf)11483 MS_BOOL AU_CUS_Demo_MM_New_Mode_Play(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_CLIP_DEC_PARAM clipInfo, MS_U32 bufSize, void *pExternalBuf)
11484 {
11485 AU_nDBG("[adecIndex = 0x%x] \n", (unsigned int)adecIndex);
11486 AU_nDBG("[clipInfo.clipType = 0x%x] \n", (unsigned int)clipInfo.clipType);
11487 AU_nDBG("[clipInfo.repeatNumber = 0x%x] \n", (unsigned int)clipInfo.repeatNumber);
11488 AU_nDBG("[bufSize = 0x%x] \n", (unsigned int)bufSize);
11489
11490 //update DecInfo for AU_CUS_Demo_MM_New_Mode_Play_Monitor
11491 AU_Demo_MM_New_Mode_DecInfo.adecIndex = adecIndex;
11492 AU_Demo_MM_New_Mode_DecInfo.extBufaddr_V = pExternalBuf;
11493 AU_Demo_MM_New_Mode_DecInfo.u32Size = bufSize;
11494 AU_Demo_MM_New_Mode_DecInfo.u32RepeatNum = clipInfo.repeatNumber;
11495 AU_Demo_MM_New_Mode_DecInfo.bIsPause = FALSE;
11496 AU_Demo_MM_New_Mode_DecInfo.bIsStart = FALSE;
11497
11498 // Step2: Buffer init
11499 AU_CUS_Demo_MM_New_Mode_AllBufInit(adecIndex);
11500
11501 // step3: control Wptr of External buffer.
11502 pAU_Demo_MM_New_Mode_DecExtBufInfo->u32BufWptr_V += AU_Demo_MM_New_Mode_DecInfo.u32Size;
11503
11504 // Step4: Start decoding
11505 API_AUDIO_CUSTOMER_StartDecoding(adecIndex);
11506
11507 // Step5: Start play monitor thread
11508 AU_Demo_MM_New_Mode_DecInfo.bIsStart = TRUE;
11509
11510 return TRUE;
11511 }
11512
AU_CUS_Demo_MM_New_Mode_Stop(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)11513 MS_BOOL AU_CUS_Demo_MM_New_Mode_Stop(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
11514 {
11515 AU_nDBG("[adecIndex = 0x%x] \n", (unsigned int)adecIndex);
11516
11517 AU_Demo_MM_New_Mode_DecInfo.bIsStart = FALSE;
11518
11519 API_AUDIO_CUSTOMER_StopDecoding(adecIndex);
11520
11521 return TRUE;
11522 }
11523
AU_CUS_Demo_MM_New_Mode_Pause(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)11524 MS_BOOL AU_CUS_Demo_MM_New_Mode_Pause(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
11525 {
11526 AU_nDBG("[adecIndex = 0x%x] \n", (unsigned int)adecIndex);
11527
11528 AU_Demo_MM_New_Mode_DecInfo.bIsPause = TRUE;
11529
11530 API_AUDIO_CUSTOMER_PauseDecoding(adecIndex);
11531
11532 return TRUE;
11533 }
11534
AU_CUS_Demo_MM_New_Mode_Resume(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)11535 MS_BOOL AU_CUS_Demo_MM_New_Mode_Resume(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
11536 {
11537 AU_nDBG("[adecIndex = 0x%x] \n", (unsigned int)adecIndex);
11538
11539 AU_Demo_MM_New_Mode_DecInfo.bIsPause = FALSE;
11540
11541 API_AUDIO_CUSTOMER_StartDecoding(adecIndex);
11542
11543 return TRUE;
11544 }
11545
11546 //AU Demo MM New Mode (AD) Enter point
AU_CUS_Demo_MM_New_Mode_AD_Play(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMER_CLIP_DEC_PARAM clipInfo,MS_U32 bufSize,void * pExternalBuf)11547 MS_BOOL AU_CUS_Demo_MM_New_Mode_AD_Play(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_CLIP_DEC_PARAM clipInfo, MS_U32 bufSize, void *pExternalBuf)
11548 {
11549 AU_nDBG("[adecIndex = 0x%x] \n", (unsigned int)adecIndex);
11550 AU_nDBG("[clipInfo.clipType = 0x%x] \n", (unsigned int)clipInfo.clipType);
11551 AU_nDBG("[clipInfo.repeatNumber = 0x%x] \n", (unsigned int)clipInfo.repeatNumber);
11552 AU_nDBG("[bufSize = 0x%x] \n", (unsigned int)bufSize);
11553
11554 //update DecInfo for AU_CUS_Demo_MM_New_Mode_Play_Monitor
11555 AU_Demo_MM_New_Mode_AD_DecInfo.adecIndex = adecIndex;
11556 AU_Demo_MM_New_Mode_AD_DecInfo.extBufaddr_V = pExternalBuf;
11557 AU_Demo_MM_New_Mode_AD_DecInfo.u32Size = bufSize;
11558 AU_Demo_MM_New_Mode_AD_DecInfo.u32RepeatNum = clipInfo.repeatNumber;
11559 AU_Demo_MM_New_Mode_AD_DecInfo.bIsPause = FALSE;
11560 AU_Demo_MM_New_Mode_AD_DecInfo.bIsStart = FALSE;
11561
11562 // Step2: Buffer init
11563 AU_CUS_Demo_MM_New_Mode_AD_AllBufInit(adecIndex);
11564
11565 // step3: control Wptr of AD External buffer.
11566 pAU_Demo_MM_New_Mode_AD_DecExtBufInfo->u32BufWptr_V += AU_Demo_MM_New_Mode_AD_DecInfo.u32Size;
11567
11568 // Step4: Start play AD monitor thread
11569 AU_Demo_MM_New_Mode_AD_DecInfo.bIsStart = TRUE;
11570
11571 return TRUE;
11572 }
11573
AU_CUS_Demo_MM_New_Mode_AD_Stop(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)11574 MS_BOOL AU_CUS_Demo_MM_New_Mode_AD_Stop(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
11575 {
11576 AU_nDBG("[adecIndex = 0x%x] \n", (unsigned int)adecIndex);
11577
11578 AU_Demo_MM_New_Mode_AD_DecInfo.bIsStart = FALSE;
11579
11580 API_AUDIO_CUSTOMER_StopDecoding(adecIndex);
11581
11582 return TRUE;
11583 }
11584
AU_CUS_Demo_MM_New_Mode_AD_Pause(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)11585 MS_BOOL AU_CUS_Demo_MM_New_Mode_AD_Pause(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
11586 {
11587 AU_nDBG("[adecIndex = 0x%x] \n", (unsigned int)adecIndex);
11588
11589 AU_Demo_MM_New_Mode_AD_DecInfo.bIsPause = TRUE;
11590
11591 API_AUDIO_CUSTOMER_PauseDecoding(adecIndex);
11592
11593 return TRUE;
11594 }
11595
AU_CUS_Demo_MM_New_Mode_AD_Resume(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)11596 MS_BOOL AU_CUS_Demo_MM_New_Mode_AD_Resume(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
11597 {
11598 AU_nDBG("[adecIndex = 0x%x] \n", (unsigned int)adecIndex);
11599
11600 AU_Demo_MM_New_Mode_AD_DecInfo.bIsPause = FALSE;
11601
11602 API_AUDIO_CUSTOMER_StartDecoding(adecIndex);
11603
11604 return TRUE;
11605 }
11606
11607 // AU_Demo (MM New Mode) (PCM Path: MCU)
AU_CUS_Demo_MM_New_Mode_AdecPcmCallBackFun(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,MS_U32 copySize)11608 static MS_BOOL AU_CUS_Demo_MM_New_Mode_AdecPcmCallBackFun(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_U32 copySize)
11609 {
11610 if(AU_DEMO_MM_NEW_MODE_GET_PCM_BUFFER_SIZE < copySize)
11611 {
11612 AU_nPRINT("warning: buffer size is not enough, copySize = %d \n", (unsigned int)copySize);
11613 }
11614
11615 API_AUDIO_CUSTOMER_AdecPcmGet(adecIndex, pAU_Demo_MM_New_Mode_Get_PCM_Buffer, copySize);
11616
11617 if(pAU_Demo_MM_New_Mode_AdecPcmDump != NULL)
11618 {
11619 AU_CUS_FileWrite(pAU_Demo_MM_New_Mode_Get_PCM_Buffer, sizeof(char), copySize, pAU_Demo_MM_New_Mode_AdecPcmDump);
11620 }
11621 return TRUE;
11622 }
11623
11624 // AU_Demo (MM New Mode) (End of Stream)
AU_CUS_Demo_MM_New_Mode_EndOfStreamCallBackFun(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)11625 static MS_BOOL AU_CUS_Demo_MM_New_Mode_EndOfStreamCallBackFun(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
11626 {
11627 AU_nPRINT("[adecIndex = 0x%x] End of Stream !! \n", (unsigned int)adecIndex);
11628
11629 API_AUDIO_CUSTOMER_StopDecoding(adecIndex);
11630
11631 return TRUE;
11632 }
11633
11634 // AU_Demo (MM New Mode) (ADEC Underrun)
AU_CUS_Demo_MM_New_Mode_AdecUnderrunCallBackFun(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)11635 static MS_BOOL AU_CUS_Demo_MM_New_Mode_AdecUnderrunCallBackFun(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
11636 {
11637 AU_nPRINT("[adecIndex = 0x%x] Underrun !! \n", (unsigned int)adecIndex);
11638
11639 return TRUE;
11640 }
11641
11642 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK)
11643 // AU_Demo (HDMI RX Monitor Event)
AU_CUS_Demo_HDMI_Monitor_Event_CallBackFun(API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT eventType,API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO info)11644 static MS_BOOL AU_CUS_Demo_HDMI_Monitor_Event_CallBackFun(API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT eventType, API_AUDIO_CUSTOMER_HDMI_MONITOR_EVENT_INFO info)
11645 {
11646 AU_nPRINT("[eventType = 0x%x] [info = 0x%x] !! \n", (unsigned int)eventType, (unsigned int)info);
11647
11648 return TRUE;
11649 }
11650 #endif
11651
11652 //-------------------------------------------------------------------------------------------------------------------------------------
11653 // [Distinction Area] [kernel space / user space] [function] declare / implement in this area.
11654 //-------------------------------------------------------------------------------------------------------------------------------------
11655 //0x9993
AU_CUS_Where_Am_I(void)11656 void AU_CUS_Where_Am_I(void)
11657 {
11658 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
11659 {
11660 AU_nPRINT("[AUDIO][%s] [%d] [Hello Kernel Space] \n", __FUNCTION__, __LINE__);
11661 }
11662 #else //User Space
11663 {
11664 AU_nPRINT("[AUDIO][%s] [%d] [Hello User Space] \n", __FUNCTION__, __LINE__);
11665 }
11666 #endif
11667
11668 #ifdef AUDIO_UTOPIA_20 //Utopia 2.0
11669 {
11670 AU_nPRINT("[AUDIO][%s] [%d] [Hello Utopia 2.0] \n", __FUNCTION__, __LINE__);
11671 }
11672 #else //Utopia 1.0
11673 {
11674 AU_nPRINT("[AUDIO][%s] [%d] [Hello Utopia 1.0] \n", __FUNCTION__, __LINE__);
11675 }
11676 #endif
11677
11678 #ifdef CONFIG_MBOOT //mboot
11679 {
11680 AU_nPRINT("[AUDIO][%s] [%d] [Hello mboot] \n", __FUNCTION__, __LINE__);
11681 }
11682 #else //application
11683 {
11684 AU_nPRINT("[AUDIO][%s] [%d] [Hello Application] \n", __FUNCTION__, __LINE__);
11685 }
11686 #endif
11687 }
11688
AU_CUS_strcmp(const char * str1,const char * str2,size_t n)11689 int AU_CUS_strcmp(const char * str1, const char * str2, size_t n)
11690 {
11691 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
11692 {
11693 #if(LINUX_KERNEL_VERSION_4_4_3)
11694 {
11695 return strncasecmp(str1, str2, n);
11696 }
11697 #else
11698 {
11699 return strnicmp(str1, str2, n);
11700 }
11701 #endif
11702 }
11703 #else //User Space
11704 {
11705 return strcmp(str1, str2);
11706 }
11707 #endif
11708 }
11709
AU_CUS_Delay1MS(int delay1MS)11710 void AU_CUS_Delay1MS(int delay1MS)
11711 {
11712 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
11713 {
11714 msleep(delay1MS);
11715 }
11716 #else //User Space
11717 {
11718 MsOS_DelayTask(delay1MS);
11719 }
11720 #endif
11721 }
11722
AU_CUS_ShmInit(void)11723 static MS_BOOL AU_CUS_ShmInit(void)
11724 {
11725 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
11726 {
11727 if(pstAudioCustomerShmData) return TRUE;
11728
11729 if(pstAudioCustomerShmData == NULL)
11730 {
11731 pstAudioCustomerShmData = &stAudioCustomerShmData;
11732 AU_CUS_ShmInit_All_variables();
11733 }
11734 return TRUE;
11735 }
11736 #else //User Space
11737 {
11738 MS_U32 u32ShmId;
11739 MS_U32 u32Addr;
11740 MS_U32 u32BufSize;
11741 char SHM_ID[] = "Audio_Customer driver";
11742 MS_BOOL bFirstRun = FALSE;
11743
11744 if(pstAudioCustomerShmData) return TRUE;
11745
11746 MsOS_SHM_Init();
11747
11748 if(FALSE == MsOS_SHM_GetId((MS_U8 *)SHM_ID, sizeof(St_Audio_Customer_Shm_data), &u32ShmId, &u32Addr, &u32BufSize, SYS_SHM_QUERY))
11749 {
11750 if(FALSE == MsOS_SHM_GetId((MS_U8 *)SHM_ID, sizeof(St_Audio_Customer_Shm_data), &u32ShmId, &u32Addr, &u32BufSize, SYS_SHM_CREATE))
11751 {
11752 return FALSE;
11753 }
11754 memset((MS_U8 *)u32Addr, 0, sizeof(St_Audio_Customer_Shm_data));
11755 bFirstRun = TRUE;
11756 }
11757
11758 pstAudioCustomerShmData = (St_Audio_Customer_Shm_data *)u32Addr;
11759
11760 if(pstAudioCustomerShmData == NULL)
11761 {
11762 return FALSE;
11763 }
11764
11765 // first time to access, so init the data
11766 if(bFirstRun == TRUE)
11767 {
11768 AU_CUS_ShmInit_All_variables();
11769 }
11770 return TRUE;
11771 }
11772 #endif
11773 }
11774
AU_CUS_Mutex_Init(void)11775 void AU_CUS_Mutex_Init(void)
11776 {
11777 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
11778 {
11779 mutex_init(&AU_Customer_ReadAbsReg_mutex_lock);
11780 mutex_init(&AU_Customer_WriteAbsReg_mutex_lock);
11781 mutex_init(&AU_Customer_ReadDM_mutex_lock);
11782 mutex_init(&AU_Customer_WriteDM_mutex_lock);
11783 mutex_init(&AU_Customer_ReadPM_mutex_lock);
11784 mutex_init(&AU_Customer_WritePM_mutex_lock);
11785 mutex_init(&AU_Customer_ReadAbsXbox_mutex_lock);
11786 mutex_init(&AU_Customer_WriteAbsXbox_mutex_lock);
11787 mutex_init(&AU_Customer_MM2_initAesInfo_mutex_lock);
11788 mutex_init(&AU_Customer_MM2_checkAesInfo_mutex_lock);
11789 mutex_init(&AU_Customer_MM2_inputAesFinished_mutex_lock);
11790 mutex_init(&AU_Customer_SPDIF_TX_SetOutputType_mutex_lock);
11791 }
11792 #else //User Space
11793 {
11794 if(AU_Customer_ReadAbsReg_mutex_lock == -1)
11795 {
11796 AU_Customer_ReadAbsReg_mutex_lock = OS_CREATE_MUTEX(AU_Customer_ReadAbsReg);
11797 if (AU_Customer_ReadAbsReg_mutex_lock == -1)
11798 {
11799 AU_nPRINT("[%d]Error! Create Mutex failed!\n", __LINE__);
11800 }
11801 }
11802
11803 if(AU_Customer_WriteAbsReg_mutex_lock == -1)
11804 {
11805 AU_Customer_WriteAbsReg_mutex_lock = OS_CREATE_MUTEX(AU_Customer_WriteAbsReg);
11806 if (AU_Customer_WriteAbsReg_mutex_lock == -1)
11807 {
11808 AU_nPRINT("[%d]Error! Create Mutex failed!\n", __LINE__);
11809 }
11810 }
11811
11812 if(AU_Customer_ReadDM_mutex_lock == -1)
11813 {
11814 AU_Customer_ReadDM_mutex_lock = OS_CREATE_MUTEX(AU_Customer_ReadDM);
11815 if (AU_Customer_ReadDM_mutex_lock == -1)
11816 {
11817 AU_nPRINT("[%d]Error! Create Mutex failed!\n", __LINE__);
11818 }
11819 }
11820
11821 if(AU_Customer_WriteDM_mutex_lock == -1)
11822 {
11823 AU_Customer_WriteDM_mutex_lock = OS_CREATE_MUTEX(AU_Customer_WriteDM);
11824 if (AU_Customer_WriteDM_mutex_lock == -1)
11825 {
11826 AU_nPRINT("[%d]Error! Create Mutex failed!\n", __LINE__);
11827 }
11828 }
11829
11830 if(AU_Customer_ReadPM_mutex_lock == -1)
11831 {
11832 AU_Customer_ReadPM_mutex_lock = OS_CREATE_MUTEX(AU_Customer_ReadPM);
11833 if (AU_Customer_ReadPM_mutex_lock == -1)
11834 {
11835 AU_nPRINT("[%d]Error! Create Mutex failed!\n", __LINE__);
11836 }
11837 }
11838
11839 if(AU_Customer_WritePM_mutex_lock == -1)
11840 {
11841 AU_Customer_WritePM_mutex_lock = OS_CREATE_MUTEX(AU_Customer_WritePM);
11842 if (AU_Customer_WritePM_mutex_lock == -1)
11843 {
11844 AU_nPRINT("[%d]Error! Create Mutex failed!\n", __LINE__);
11845 }
11846 }
11847
11848 if(AU_Customer_ReadAbsXbox_mutex_lock == -1)
11849 {
11850 AU_Customer_ReadAbsXbox_mutex_lock = OS_CREATE_MUTEX(AU_Customer_ReadAbsXbox);
11851 if (AU_Customer_ReadAbsXbox_mutex_lock == -1)
11852 {
11853 AU_nPRINT("[%d]Error! Create Mutex failed!\n", __LINE__);
11854 }
11855 }
11856
11857 if(AU_Customer_WriteAbsXbox_mutex_lock == -1)
11858 {
11859 AU_Customer_WriteAbsXbox_mutex_lock = OS_CREATE_MUTEX(AU_Customer_WriteAbsXbox);
11860 if (AU_Customer_WriteAbsXbox_mutex_lock == -1)
11861 {
11862 AU_nPRINT("[%d]Error! Create Mutex failed!\n", __LINE__);
11863 }
11864 }
11865
11866 if(AU_Customer_MM2_initAesInfo_mutex_lock == -1)
11867 {
11868 AU_Customer_MM2_initAesInfo_mutex_lock = OS_CREATE_MUTEX(AU_Customer_MM2_initAesInfo);
11869 if (AU_Customer_MM2_initAesInfo_mutex_lock == -1)
11870 {
11871 AU_nPRINT("[%d]Error! Create Mutex failed!\n", __LINE__);
11872 }
11873 }
11874
11875 if(AU_Customer_MM2_checkAesInfo_mutex_lock == -1)
11876 {
11877 AU_Customer_MM2_checkAesInfo_mutex_lock = OS_CREATE_MUTEX(AU_Customer_MM2_checkAesInfo);
11878 if (AU_Customer_MM2_checkAesInfo_mutex_lock == -1)
11879 {
11880 AU_nPRINT("[%d]Error! Create Mutex failed!\n", __LINE__);
11881 }
11882 }
11883
11884 if(AU_Customer_MM2_inputAesFinished_mutex_lock == -1)
11885 {
11886 AU_Customer_MM2_inputAesFinished_mutex_lock = OS_CREATE_MUTEX(AU_Customer_MM2_inputAesFinished);
11887 if (AU_Customer_MM2_inputAesFinished_mutex_lock == -1)
11888 {
11889 AU_nPRINT("[%d]Error! Create Mutex failed!\n", __LINE__);
11890 }
11891 }
11892
11893 if(AU_Customer_SPDIF_TX_SetOutputType_mutex_lock == -1)
11894 {
11895 AU_Customer_SPDIF_TX_SetOutputType_mutex_lock = OS_CREATE_MUTEX(AU_Customer_SPDIF_TX_SetOutputType);
11896 if (AU_Customer_SPDIF_TX_SetOutputType_mutex_lock == -1)
11897 {
11898 AU_nPRINT("[%d]Error! Create Mutex failed!\n", __LINE__);
11899 }
11900 }
11901 }
11902 #endif
11903 }
11904
AU_CUS_ReadAbsReg(MS_U32 regaddr)11905 static MS_U16 AU_CUS_ReadAbsReg(MS_U32 regaddr)
11906 {
11907 MS_U32 pInfo = 0;
11908
11909 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
11910 {
11911 mutex_lock(&AU_Customer_ReadAbsReg_mutex_lock);
11912 }
11913 #else //User Space
11914 {
11915 OS_OBTAIN_MUTEX(AU_Customer_ReadAbsReg_mutex_lock, MSOS_WAIT_FOREVER);
11916 }
11917 #endif
11918
11919 MApi_AUDIO_SetAudioParam2(AU_DEC_ID1, Audio_ParamType_Abs_ReadReg_Target, regaddr);
11920 MApi_AUDIO_GetAudioInfo2(AU_DEC_ID1, Audio_infoType_Abs_ReadReg, (void *)&pInfo);
11921
11922 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
11923 {
11924 mutex_unlock(&AU_Customer_ReadAbsReg_mutex_lock);
11925 }
11926 #else //User Space
11927 {
11928 OS_RELEASE_MUTEX(AU_Customer_ReadAbsReg_mutex_lock);
11929 }
11930 #endif
11931
11932 return (MS_U16)pInfo;
11933 }
11934
AU_CUS_WriteAbsReg(MS_U32 regaddr,MS_U16 data)11935 static void AU_CUS_WriteAbsReg(MS_U32 regaddr, MS_U16 data)
11936 {
11937 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
11938 {
11939 mutex_lock(&AU_Customer_WriteAbsReg_mutex_lock);
11940 }
11941 #else //User Space
11942 {
11943 OS_OBTAIN_MUTEX(AU_Customer_WriteAbsReg_mutex_lock, MSOS_WAIT_FOREVER);
11944 }
11945 #endif
11946
11947 MApi_AUDIO_SetAudioParam2(AU_DEC_ID1, Audio_ParamType_Abs_WriteReg_Target, regaddr);
11948 MApi_AUDIO_SetAudioParam2(AU_DEC_ID1, Audio_ParamType_Abs_WriteReg_Value, (MS_U32)data);
11949
11950 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
11951 {
11952 mutex_unlock(&AU_Customer_WriteAbsReg_mutex_lock);
11953 }
11954 #else //User Space
11955 {
11956 OS_RELEASE_MUTEX(AU_Customer_WriteAbsReg_mutex_lock);
11957 }
11958 #endif
11959 }
11960
AU_CUS_WriteAbsMaskReg(MS_U32 u32RegAddr,MS_U16 u16Mask,MS_U16 u16Val)11961 static void AU_CUS_WriteAbsMaskReg(MS_U32 u32RegAddr, MS_U16 u16Mask, MS_U16 u16Val)
11962 {
11963 MS_U16 u16RegVal;
11964
11965 u16RegVal = AU_CUS_ReadAbsReg(u32RegAddr);
11966 u16RegVal = ((u16RegVal & (~(u16Mask))) | (u16Val & u16Mask));
11967 AU_CUS_WriteAbsReg(u32RegAddr, u16RegVal);
11968 }
11969
AU_CUS_ReadDM(AUDIO_DEC_ID DecID,MS_U32 regaddr,MS_BOOL bIsIDMA)11970 static MS_U16 AU_CUS_ReadDM(AUDIO_DEC_ID DecID, MS_U32 regaddr, MS_BOOL bIsIDMA)
11971 {
11972 MS_U32 pInfo = 0;
11973 MS_U16 tmpReg = 0;
11974
11975 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
11976 {
11977 mutex_lock(&AU_Customer_ReadDM_mutex_lock);
11978 }
11979 #else //User Space
11980 {
11981 OS_OBTAIN_MUTEX(AU_Customer_ReadDM_mutex_lock, MSOS_WAIT_FOREVER);
11982 }
11983 #endif
11984
11985 if(bIsIDMA)
11986 {
11987 tmpReg = AU_CUS_ReadAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA);
11988 AU_CUS_WriteAbsMaskReg((MS_U32)REG_BANK_ASND_DSP_IDMA, 0x80, 0);
11989 AU_CUS_Delay1MS(5);
11990 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA + 8, ((MS_U16)regaddr | 0x08000));
11991 AU_CUS_Delay1MS(5);
11992 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA, 0x0B);
11993 AU_CUS_Delay1MS(5);
11994 pInfo = (MS_U32)AU_CUS_ReadAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA + 12);
11995 pInfo = (pInfo << 8) + (MS_U32)(AU_CUS_ReadAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA + 14) & 0xFF);
11996
11997 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA, tmpReg);
11998 }
11999 else
12000 {
12001 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_ReadDM_Target, regaddr);
12002 MApi_AUDIO_GetAudioInfo2( DecID, Audio_infoType_ReadDM_Value, (void *)&pInfo);
12003 }
12004
12005 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12006 {
12007 mutex_unlock(&AU_Customer_ReadDM_mutex_lock);
12008 }
12009 #else //User Space
12010 {
12011 OS_RELEASE_MUTEX(AU_Customer_ReadDM_mutex_lock);
12012 }
12013 #endif
12014
12015 return (MS_U16)pInfo;
12016 }
12017
AU_CUS_WriteDM(AUDIO_DEC_ID DecID,MS_U32 regaddr,MS_U16 data,MS_BOOL bIsIDMA)12018 static void AU_CUS_WriteDM(AUDIO_DEC_ID DecID, MS_U32 regaddr, MS_U16 data, MS_BOOL bIsIDMA)
12019 {
12020 MS_U16 tmpReg = 0;
12021
12022 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12023 {
12024 mutex_lock(&AU_Customer_WriteDM_mutex_lock);
12025 }
12026 #else //User Space
12027 {
12028 OS_OBTAIN_MUTEX(AU_Customer_WriteDM_mutex_lock, MSOS_WAIT_FOREVER);
12029 }
12030 #endif
12031
12032 if(bIsIDMA)
12033 {
12034 tmpReg = AU_CUS_ReadAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA);
12035 AU_CUS_WriteAbsMaskReg((MS_U32)REG_BANK_ASND_DSP_IDMA, 0x80, 0);
12036 AU_CUS_Delay1MS(5);
12037 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA + 4, ((MS_U16)regaddr | 0x08000));
12038 AU_CUS_Delay1MS(5);
12039 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA + 2, (MS_U16)((data & 0xFFFF00)>>8));
12040 AU_CUS_Delay1MS(5);
12041 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA + 2, (MS_U16)(data & 0x0FF));
12042 AU_CUS_Delay1MS(5);
12043 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA, tmpReg);
12044 }
12045 else
12046 {
12047 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_WriteDM_Target, regaddr);
12048 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_WriteDM_Value, (MS_U32)data);
12049 }
12050
12051 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12052 {
12053 mutex_unlock(&AU_Customer_WriteDM_mutex_lock);
12054 }
12055 #else //User Space
12056 {
12057 OS_RELEASE_MUTEX(AU_Customer_WriteDM_mutex_lock);
12058 }
12059 #endif
12060 }
12061
AU_CUS_ReadPM(AUDIO_DEC_ID DecID,MS_U32 regaddr,MS_BOOL bIsIDMA)12062 static MS_U16 AU_CUS_ReadPM(AUDIO_DEC_ID DecID, MS_U32 regaddr, MS_BOOL bIsIDMA)
12063 {
12064 MS_U32 pInfo = 0;
12065 MS_U16 tmpReg = 0;
12066
12067 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12068 {
12069 mutex_lock(&AU_Customer_ReadPM_mutex_lock);
12070 }
12071 #else //User Space
12072 {
12073 OS_OBTAIN_MUTEX(AU_Customer_ReadPM_mutex_lock, MSOS_WAIT_FOREVER);
12074 }
12075 #endif
12076
12077 if(bIsIDMA)
12078 {
12079 tmpReg = AU_CUS_ReadAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA);
12080 AU_CUS_WriteAbsMaskReg((MS_U32)REG_BANK_ASND_DSP_IDMA, 0x80, 0);
12081 AU_CUS_Delay1MS(5);
12082 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA + 8, (MS_U16)regaddr);
12083 AU_CUS_Delay1MS(5);
12084 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA, 0x0B);
12085 AU_CUS_Delay1MS(5);
12086 pInfo = (MS_U32)AU_CUS_ReadAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA + 12);
12087 pInfo = (pInfo << 8) + (MS_U32)(AU_CUS_ReadAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA + 14) & 0xFF);
12088
12089 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA, tmpReg);
12090 }
12091 else
12092 {
12093 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_ReadPM_Target, regaddr);
12094 MApi_AUDIO_GetAudioInfo2( DecID, Audio_infoType_ReadPM_Value, (void *)&pInfo);
12095 }
12096
12097 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12098 {
12099 mutex_unlock(&AU_Customer_ReadPM_mutex_lock);
12100 }
12101 #else //User Space
12102 {
12103 OS_RELEASE_MUTEX(AU_Customer_ReadPM_mutex_lock);
12104 }
12105 #endif
12106
12107 return (MS_U16)pInfo;
12108 }
12109
AU_CUS_WritePM(AUDIO_DEC_ID DecID,MS_U32 regaddr,MS_U32 data,MS_BOOL bIsIDMA)12110 static void AU_CUS_WritePM(AUDIO_DEC_ID DecID, MS_U32 regaddr, MS_U32 data, MS_BOOL bIsIDMA)
12111 {
12112 MS_U16 tmpReg = 0;
12113
12114 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12115 {
12116 mutex_lock(&AU_Customer_WritePM_mutex_lock);
12117 }
12118 #else //User Space
12119 {
12120 OS_OBTAIN_MUTEX(AU_Customer_WritePM_mutex_lock, MSOS_WAIT_FOREVER);
12121 }
12122 #endif
12123
12124 if(bIsIDMA)
12125 {
12126 tmpReg = AU_CUS_ReadAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA);
12127 AU_CUS_WriteAbsMaskReg((MS_U32)REG_BANK_ASND_DSP_IDMA, 0x80, 0);
12128 AU_CUS_Delay1MS(5);
12129 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA + 4, (MS_U16)regaddr);
12130 AU_CUS_Delay1MS(5);
12131 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA + 2, (MS_U16)((data & 0xFFFF00)>>8));
12132 AU_CUS_Delay1MS(5);
12133 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA + 2, (MS_U16)(data & 0x0FF));
12134 AU_CUS_Delay1MS(5);
12135 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ASND_DSP_IDMA, tmpReg);
12136 }
12137 else
12138 {
12139 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_WritePM_Target, regaddr);
12140 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_WritePM_Value, (MS_U32)data);
12141 }
12142
12143 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12144 {
12145 mutex_unlock(&AU_Customer_WritePM_mutex_lock);
12146 }
12147 #else //User Space
12148 {
12149 OS_RELEASE_MUTEX(AU_Customer_WritePM_mutex_lock);
12150 }
12151 #endif
12152 }
12153
AU_CUS_ReadAbsXbox(MS_U32 xboxaddr)12154 static MS_U32 AU_CUS_ReadAbsXbox(MS_U32 xboxaddr)
12155 {
12156 MS_U32 pInfo = 0;
12157
12158 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12159 {
12160 mutex_lock(&AU_Customer_ReadAbsXbox_mutex_lock);
12161 }
12162 #else //User Space
12163 {
12164 OS_OBTAIN_MUTEX(AU_Customer_ReadAbsXbox_mutex_lock, MSOS_WAIT_FOREVER);
12165 }
12166 #endif
12167
12168 MApi_AUDIO_SetAudioParam2(AU_DEC_ID1, Audio_ParamType_Abs_ReadXbox_Target, xboxaddr);
12169 MApi_AUDIO_GetAudioInfo2(AU_DEC_ID1, Audio_infoType_Abs_ReadXbox, (void *)&pInfo);
12170
12171 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12172 {
12173 mutex_unlock(&AU_Customer_ReadAbsXbox_mutex_lock);
12174 }
12175 #else //User Space
12176 {
12177 OS_RELEASE_MUTEX(AU_Customer_ReadAbsXbox_mutex_lock);
12178 }
12179 #endif
12180
12181 return (MS_U32)pInfo;
12182 }
12183
AU_CUS_WriteAbsXbox(MS_U32 xboxaddr,MS_U32 data)12184 static void AU_CUS_WriteAbsXbox(MS_U32 xboxaddr, MS_U32 data)
12185 {
12186 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12187 {
12188 mutex_lock(&AU_Customer_WriteAbsXbox_mutex_lock);
12189 }
12190 #else //User Space
12191 {
12192 OS_OBTAIN_MUTEX(AU_Customer_WriteAbsXbox_mutex_lock, MSOS_WAIT_FOREVER);
12193 }
12194 #endif
12195
12196 MApi_AUDIO_SetAudioParam2(AU_DEC_ID1, Audio_ParamType_Abs_WriteXbox_Target, xboxaddr);
12197 MApi_AUDIO_SetAudioParam2(AU_DEC_ID1, Audio_ParamType_Abs_WriteXbox_Value, (MS_U32)data);
12198
12199 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12200 {
12201 mutex_unlock(&AU_Customer_WriteAbsXbox_mutex_lock);
12202 }
12203 #else //User Space
12204 {
12205 OS_RELEASE_MUTEX(AU_Customer_WriteAbsXbox_mutex_lock);
12206 }
12207 #endif
12208 }
12209
AU_CUS_CreateThread(void)12210 static void AU_CUS_CreateThread(void)
12211 {
12212 #ifdef CONFIG_MBOOT //mboot
12213 {
12214 }
12215 #else //application
12216 {
12217 //================================================================================================
12218 // Clip Decoder Monitor
12219 //================================================================================================
12220 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12221 {
12222 struct task_struct *pClipDecoderThread = NULL;
12223
12224 pClipDecoderThread = kthread_create((void*)AU_CUS_ClipDecoderMonitor, NULL, "MStar Clip Decoder Monitor");
12225 if (pClipDecoderThread == NULL)
12226 {
12227 AU_nPRINT("[Error] [%s] [Can't create clip decoder monitor thread] \n", __FUNCTION__);
12228 }
12229 else
12230 {
12231 AU_nDBG("Clip decoder monitor thread created successfully \n");
12232 wake_up_process(pClipDecoderThread);
12233 }
12234 }
12235 #else //User Space
12236 {
12237 pthread_t thread_info0;
12238 pthread_attr_t attr0;
12239 struct sched_param sched0;
12240 int s32Result0;
12241
12242 pthread_attr_init(&attr0);
12243 pthread_attr_setdetachstate(&attr0, PTHREAD_CREATE_JOINABLE);
12244 pthread_attr_setinheritsched(&attr0, PTHREAD_EXPLICIT_SCHED);
12245 pthread_attr_setschedpolicy(&attr0, SCHED_RR);
12246 pthread_attr_getschedparam(&attr0, &sched0);
12247 sched0.sched_priority = 85;
12248 pthread_attr_setschedparam(&attr0, &sched0);
12249
12250 s32Result0 = pthread_create(&thread_info0, &attr0, (void*)AU_CUS_ClipDecoderMonitor, (void *) NULL);
12251 if (s32Result0 != 0)
12252 {
12253 AU_nPRINT("[Error] [%s] [Can't create clip decoder monitor thread] \n", __FUNCTION__);
12254 }
12255 else
12256 {
12257 AU_nDBG("Clip decoder monitor thread created successfully \n");
12258 }
12259 }
12260 #endif
12261
12262 //================================================================================================
12263 // MP3 Encode Monitor
12264 //================================================================================================
12265 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12266 {
12267 struct task_struct *pMP3EncodeThread = NULL;
12268
12269 pMP3EncodeThread = kthread_create((void*)AU_CUS_MP3EncodeMonitor, NULL, "MStar MP3 encode Monitor");
12270 if (pMP3EncodeThread == NULL)
12271 {
12272 AU_nPRINT("[Error] [%s] [Can't create mp3 encode monitor thread] \n", __FUNCTION__);
12273 }
12274 else
12275 {
12276 AU_nDBG("mp3 encode monitor thread created successfully \n");
12277 wake_up_process(pMP3EncodeThread);
12278 }
12279 }
12280 #else //User Space
12281 {
12282 pthread_t thread_info1;
12283 pthread_attr_t attr1;
12284 struct sched_param sched1;
12285 int s32Result1;
12286
12287 pthread_attr_init(&attr1);
12288 pthread_attr_setdetachstate(&attr1, PTHREAD_CREATE_JOINABLE);
12289 pthread_attr_setinheritsched(&attr1, PTHREAD_EXPLICIT_SCHED);
12290 pthread_attr_setschedpolicy(&attr1, SCHED_RR);
12291 pthread_attr_getschedparam(&attr1, &sched1);
12292 sched1.sched_priority = 85;
12293 pthread_attr_setschedparam(&attr1, &sched1);
12294
12295 s32Result1 = pthread_create(&thread_info1, &attr1, (void*)AU_CUS_MP3EncodeMonitor, (void *) NULL);
12296 if (s32Result1 != 0)
12297 {
12298 AU_nPRINT("[Error] [%s] [Can't create mp3 encode monitor thread] \n", __FUNCTION__);
12299 }
12300 else
12301 {
12302 AU_nDBG("mp3 encode monitor thread created successfully \n");
12303 }
12304 }
12305 #endif
12306
12307 //================================================================================================
12308 // Audio monitor Service for:
12309 // 1. HDMI Tx (STB_ENABLE only)
12310 // 2. SPDIF
12311 // 3. Audio Auto-Recovery
12312 //================================================================================================
12313 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12314 {
12315 struct task_struct *pMonitorServiceThread = NULL;
12316
12317 pMonitorServiceThread = kthread_create((void*)AU_CUS_MonitorService, NULL, "AU_CUS_MonitorService");
12318 if (pMonitorServiceThread == NULL)
12319 {
12320 AU_nPRINT("[Error] [%s] [Can't create AU_CUS_MonitorService thread] \n", __FUNCTION__);
12321 }
12322 else
12323 {
12324 AU_nDBG("AU_CUS_MonitorService thread created successfully \n");
12325 wake_up_process(pMonitorServiceThread);
12326 }
12327 }
12328 #else //User Space
12329 {
12330 pthread_t thread_info2;
12331 pthread_attr_t attr2;
12332 struct sched_param sched2;
12333 int s32Result2;
12334
12335 pthread_attr_init(&attr2);
12336 pthread_attr_setdetachstate(&attr2, PTHREAD_CREATE_JOINABLE);
12337 pthread_attr_setinheritsched(&attr2, PTHREAD_EXPLICIT_SCHED);
12338 pthread_attr_setschedpolicy(&attr2, SCHED_RR);
12339 pthread_attr_getschedparam(&attr2, &sched2);
12340 sched2.sched_priority = 85;
12341 pthread_attr_setschedparam(&attr2, &sched2);
12342
12343 s32Result2 = pthread_create(&thread_info2, &attr2, (void*)AU_CUS_MonitorService, (void *) NULL);
12344 if (s32Result2 != 0)
12345 {
12346 AU_nPRINT("[Error] [%s] [Can't create AU_CUS_MonitorService thread] \n", __FUNCTION__);
12347 }
12348 else
12349 {
12350 AU_nDBG("AU_CUS_MonitorService thread created successfully \n");
12351 }
12352 }
12353 #endif
12354
12355 #if (UTPA_SUPPORT_AAC_ENCODE == 1)
12356 //================================================================================================
12357 // AAC Encode Monitor
12358 //================================================================================================
12359 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12360 {
12361 struct task_struct *pAACEncodeThread = NULL;
12362
12363 pAACEncodeThread = kthread_create((void*)AU_CUS_AACEncodeMonitor, NULL, "MStar AAC encode Monitor");
12364 if (pAACEncodeThread == NULL)
12365 {
12366 AU_nPRINT("[Error] [%s] [Can't create aac encode monitor thread] \n", __FUNCTION__);
12367 }
12368 else
12369 {
12370 AU_nDBG("aac encode monitor thread created successfully \n");
12371 wake_up_process(pAACEncodeThread);
12372 }
12373 }
12374 #else //User Space
12375 {
12376 pthread_t thread_info3;
12377 pthread_attr_t attr3;
12378 struct sched_param sched3;
12379 int s32Result3;
12380
12381 pthread_attr_init(&attr3);
12382 pthread_attr_setdetachstate(&attr3, PTHREAD_CREATE_JOINABLE);
12383 pthread_attr_setinheritsched(&attr3, PTHREAD_EXPLICIT_SCHED);
12384 pthread_attr_setschedpolicy(&attr3, SCHED_RR);
12385 pthread_attr_getschedparam(&attr3, &sched3);
12386 sched3.sched_priority = 85;
12387 pthread_attr_setschedparam(&attr3, &sched3);
12388
12389 s32Result3 = pthread_create(&thread_info3, &attr3, (void*)AU_CUS_AACEncodeMonitor, (void *) NULL);
12390 if (s32Result3 != 0)
12391 {
12392 AU_nPRINT("[Error] [%s] [Can't create aac encode monitor thread] \n", __FUNCTION__);
12393 }
12394 else
12395 {
12396 AU_nDBG("aac encode monitor thread created successfully \n");
12397 }
12398 }
12399 #endif
12400 #endif
12401
12402 //================================================================================================
12403 // Limit Time Mute Monitor
12404 //================================================================================================
12405 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12406 {
12407 struct task_struct *pMuteDuringLimitedTimeThread = NULL;
12408
12409 pMuteDuringLimitedTimeThread = kthread_create((void*)AU_CUS_MuteDuringLimitedTime_Monitor, NULL, "MuteDuringLimitedTimeThread Monitor");
12410 if (pMuteDuringLimitedTimeThread == NULL)
12411 {
12412 AU_nPRINT("[Error] [%s] [Can't create MuteDuringLimitedTimeThread] \n", __FUNCTION__);
12413 }
12414 else
12415 {
12416 AU_nDBG("MuteDuringLimitedTimeThread created successfully \n");
12417 wake_up_process(pMuteDuringLimitedTimeThread);
12418 }
12419 }
12420 #else //User Space
12421 {
12422 pthread_t thread_info4;
12423 pthread_attr_t attr4;
12424 struct sched_param sched4;
12425 int s32Result4;
12426
12427 pthread_attr_init(&attr4);
12428 pthread_attr_setdetachstate(&attr4, PTHREAD_CREATE_JOINABLE);
12429 pthread_attr_setinheritsched(&attr4, PTHREAD_EXPLICIT_SCHED);
12430 pthread_attr_setschedpolicy(&attr4, SCHED_RR);
12431 pthread_attr_getschedparam(&attr4, &sched4);
12432 sched4.sched_priority = 85;
12433 pthread_attr_setschedparam(&attr4, &sched4);
12434
12435 s32Result4 = pthread_create(&thread_info4, &attr4, (void*)AU_CUS_MuteDuringLimitedTime_Monitor, (void *) NULL);
12436 if (s32Result4 != 0)
12437 {
12438 AU_nPRINT("[Error] [%s] [Can't MuteDuringLimitedTimeThread] \n", __FUNCTION__);
12439 }
12440 else
12441 {
12442 AU_nDBG("MuteDuringLimitedTimeThread successfully \n");
12443 }
12444 }
12445 #endif
12446
12447 //================================================================================================
12448 // ADEC PCM OUT MONITOR
12449 //================================================================================================
12450 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12451 {
12452 struct task_struct *pAU_AdecPcmOutMonitorThread = NULL;
12453
12454 pAU_AdecPcmOutMonitorThread = kthread_create((void*)AU_CUS_AdecPcmOutMonitor, NULL, "AU_CUS_AdecPcmOutMonitor");
12455 if (pAU_AdecPcmOutMonitorThread == NULL)
12456 {
12457 AU_nPRINT("[Error] [%s] [Can't create AU_CUS_AdecPcmOutMonitor thread] \n", __FUNCTION__);
12458 }
12459 else
12460 {
12461 AU_nDBG("AU_CUS_AdecPcmOutMonitor thread created successfully \n");
12462 wake_up_process(pAU_AdecPcmOutMonitorThread);
12463 }
12464 }
12465 #else //User Space
12466 {
12467 pthread_t thread_info5;
12468 pthread_attr_t attr5;
12469 struct sched_param sched5;
12470 int s32Result5;
12471
12472 pthread_attr_init(&attr5);
12473 pthread_attr_setdetachstate(&attr5, PTHREAD_CREATE_JOINABLE);
12474 pthread_attr_setinheritsched(&attr5, PTHREAD_EXPLICIT_SCHED);
12475 pthread_attr_setschedpolicy(&attr5, SCHED_RR);
12476 pthread_attr_getschedparam(&attr5, &sched5);
12477 sched5.sched_priority = 85;
12478 pthread_attr_setschedparam(&attr5, &sched5);
12479
12480 s32Result5 = pthread_create(&thread_info5, &attr5, (void*)AU_CUS_AdecPcmOutMonitor, (void *) NULL);
12481 if (s32Result5 != 0)
12482 {
12483 AU_nPRINT("[Error] [%s] [Can't create AU_CUS_AdecPcmOutMonitor thread] \n", __FUNCTION__);
12484 }
12485 else
12486 {
12487 AU_nDBG("AU_CUS_AdecPcmOutMonitor thread created successfully \n");
12488 }
12489 }
12490 #endif
12491
12492 //================================================================================================
12493 // PCM Capture Monitor
12494 //================================================================================================
12495 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12496 {
12497 struct task_struct *pPCMCaptureThread = NULL;
12498
12499 pPCMCaptureThread = kthread_create((void*)AU_CUS_PCMCaptureMonitor, NULL, "MStar PCM Capture Monitor");
12500 if (pPCMCaptureThread == NULL)
12501 {
12502 AU_nPRINT("[Error] [%s] [Can't create pcm capture monitor thread] \n", __FUNCTION__);
12503 }
12504 else
12505 {
12506 AU_nDBG("pcm capture monitor thread created successfully \n");
12507 wake_up_process(pPCMCaptureThread);
12508 }
12509 }
12510 #else //User Space
12511 {
12512 pthread_t thread_info6;
12513 pthread_attr_t attr6;
12514 struct sched_param sched6;
12515 int s32Result6;
12516
12517 pthread_attr_init(&attr6);
12518 pthread_attr_setdetachstate(&attr6, PTHREAD_CREATE_JOINABLE);
12519 pthread_attr_setinheritsched(&attr6, PTHREAD_EXPLICIT_SCHED);
12520 pthread_attr_setschedpolicy(&attr6, SCHED_RR);
12521 pthread_attr_getschedparam(&attr6, &sched6);
12522 sched6.sched_priority = 85;
12523 pthread_attr_setschedparam(&attr6, &sched6);
12524
12525 s32Result6 = pthread_create(&thread_info6, &attr6, (void*)AU_CUS_PCMCaptureMonitor, (void *) NULL);
12526 if (s32Result6 != 0)
12527 {
12528 AU_nPRINT("[Error] [%s] [Can't create pcm capture monitor thread] \n", __FUNCTION__);
12529 }
12530 else
12531 {
12532 AU_nDBG("pcm capture monitor thread created successfully \n");
12533 }
12534 }
12535 #endif
12536
12537 //================================================================================================
12538 // AU End of Stream Monitor
12539 //================================================================================================
12540 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12541 {
12542 struct task_struct *pAU_End_Of_Stream_Thread = NULL;
12543
12544 pAU_End_Of_Stream_Thread = kthread_create((void*)AU_CUS_EndOfStreamMonitor, NULL, "MStar AU End of Stream Monitor");
12545 if (pAU_End_Of_Stream_Thread == NULL)
12546 {
12547 AU_nPRINT("[Error] [%s] [Can't Create AU End of Stream monitor thread] \n", __FUNCTION__);
12548 }
12549 else
12550 {
12551 AU_nDBG("AU End of Stream monitor thread created successfully \n");
12552 wake_up_process(pAU_End_Of_Stream_Thread);
12553 }
12554 }
12555 #else //User Space
12556 {
12557 pthread_t thread_info7;
12558 pthread_attr_t attr7;
12559 struct sched_param sched7;
12560 int s32Result7;
12561
12562 pthread_attr_init(&attr7);
12563 pthread_attr_setdetachstate(&attr7, PTHREAD_CREATE_JOINABLE);
12564 pthread_attr_setinheritsched(&attr7, PTHREAD_EXPLICIT_SCHED);
12565 pthread_attr_setschedpolicy(&attr7, SCHED_RR);
12566 pthread_attr_getschedparam(&attr7, &sched7);
12567 sched7.sched_priority = 85;
12568 pthread_attr_setschedparam(&attr7, &sched7);
12569
12570 s32Result7 = pthread_create(&thread_info7, &attr7, (void*)AU_CUS_EndOfStreamMonitor, (void *) NULL);
12571 if (s32Result7 != 0)
12572 {
12573 AU_nPRINT("[Error] [%s] [Can't Create AU End of Stream monitor thread] \n", __FUNCTION__);
12574 }
12575 else
12576 {
12577 AU_nDBG("AU Demo MM New Mode Play monitor thread created successfully \n");
12578 }
12579 }
12580 #endif
12581
12582 //================================================================================================
12583 // AU Demo PCMIO Play Monitor
12584 //================================================================================================
12585 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12586 {
12587 struct task_struct *pAU_Demo_PCMIO_PlayThread = NULL;
12588
12589 pAU_Demo_PCMIO_PlayThread = kthread_create((void*)AU_CUS_Demo_PCMIO_Play_Monitor, NULL, "MStar AU Demo PCMIO Play Monitor");
12590 if (pAU_Demo_PCMIO_PlayThread == NULL)
12591 {
12592 AU_nPRINT("[Error] [%s] [Can't AU Demo PCMIO Play thread] \n", __FUNCTION__);
12593 }
12594 else
12595 {
12596 AU_nDBG("AU Demo PCMIO Play monitor thread created successfully \n");
12597 wake_up_process(pAU_Demo_PCMIO_PlayThread);
12598 }
12599 }
12600 #else //User Space
12601 {
12602 pthread_t thread_info8;
12603 pthread_attr_t attr8;
12604 struct sched_param sched8;
12605 int s32Result8;
12606
12607 pthread_attr_init(&attr8);
12608 pthread_attr_setdetachstate(&attr8, PTHREAD_CREATE_JOINABLE);
12609 pthread_attr_setinheritsched(&attr8, PTHREAD_EXPLICIT_SCHED);
12610 pthread_attr_setschedpolicy(&attr8, SCHED_RR);
12611 pthread_attr_getschedparam(&attr8, &sched8);
12612 sched8.sched_priority = 85;
12613 pthread_attr_setschedparam(&attr8, &sched8);
12614
12615 s32Result8 = pthread_create(&thread_info8, &attr8, (void*)AU_CUS_Demo_PCMIO_Play_Monitor, (void *) NULL);
12616 if (s32Result8 != 0)
12617 {
12618 AU_nPRINT("[Error] [%s] [Can't AU Demo PCMIO Play thread] \n", __FUNCTION__);
12619 }
12620 else
12621 {
12622 AU_nDBG("AU Demo PCMIO Play monitor thread created successfully \n");
12623 }
12624 }
12625 #endif
12626
12627 //================================================================================================
12628 // AU Demo MM New Mode Play Monitor
12629 //================================================================================================
12630 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12631 {
12632 struct task_struct *pAU_Demo_MM_New_ModeThread = NULL;
12633
12634 pAU_Demo_MM_New_ModeThread = kthread_create((void*)AU_CUS_Demo_MM_New_Mode_Play_Monitor, NULL, "MStar AU Demo MM New Mode Play Monitor");
12635 if (pAU_Demo_MM_New_ModeThread == NULL)
12636 {
12637 AU_nPRINT("[Error] [%s] [Can't AU Demo MM New Mode Play thread] \n", __FUNCTION__);
12638 }
12639 else
12640 {
12641 AU_nDBG("AU Demo MM New Mode Play monitor thread created successfully \n");
12642 wake_up_process(pAU_Demo_MM_New_ModeThread);
12643 }
12644 }
12645 #else //User Space
12646 {
12647 pthread_t thread_info9;
12648 pthread_attr_t attr9;
12649 struct sched_param sched9;
12650 int s32Result9;
12651
12652 pthread_attr_init(&attr9);
12653 pthread_attr_setdetachstate(&attr9, PTHREAD_CREATE_JOINABLE);
12654 pthread_attr_setinheritsched(&attr9, PTHREAD_EXPLICIT_SCHED);
12655 pthread_attr_setschedpolicy(&attr9, SCHED_RR);
12656 pthread_attr_getschedparam(&attr9, &sched9);
12657 sched9.sched_priority = 85;
12658 pthread_attr_setschedparam(&attr9, &sched9);
12659
12660 s32Result9 = pthread_create(&thread_info9, &attr9, (void*)AU_CUS_Demo_MM_New_Mode_Play_Monitor, (void *) NULL);
12661 if (s32Result9 != 0)
12662 {
12663 AU_nPRINT("[Error] [%s] [Can't AU Demo MM New Mode Play thread] \n", __FUNCTION__);
12664 }
12665 else
12666 {
12667 AU_nDBG("AU Demo MM New Mode Play monitor thread created successfully \n");
12668 }
12669 }
12670 #endif
12671
12672 //================================================================================================
12673 // AU AV Sync Info Monitor
12674 //================================================================================================
12675 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12676 {
12677 struct task_struct *pAU_AV_Sync_Info_Thread = NULL;
12678
12679 pAU_AV_Sync_Info_Thread = kthread_create((void*)AU_CUS_AV_Sync_Info_Monitor, NULL, "MStar AU_CUS_AV_Sync_Info_Monitor");
12680 if (pAU_AV_Sync_Info_Thread == NULL)
12681 {
12682 AU_nPRINT("[Error] [%s] [Can't AU_CUS_AV_Sync_Info_Monitor thread] \n", __FUNCTION__);
12683 }
12684 else
12685 {
12686 AU_nDBG("AU_CUS_AV_Sync_Info_Monitor thread created successfully \n");
12687 wake_up_process(pAU_AV_Sync_Info_Thread);
12688 }
12689 }
12690 #else //User Space
12691 {
12692 pthread_t thread_info10;
12693 pthread_attr_t attr10;
12694 struct sched_param sched10;
12695 int s32Result10;
12696
12697 pthread_attr_init(&attr10);
12698 pthread_attr_setdetachstate(&attr10, PTHREAD_CREATE_JOINABLE);
12699 pthread_attr_setinheritsched(&attr10, PTHREAD_EXPLICIT_SCHED);
12700 pthread_attr_setschedpolicy(&attr10, SCHED_RR);
12701 pthread_attr_getschedparam(&attr10, &sched10);
12702 sched10.sched_priority = 85;
12703 pthread_attr_setschedparam(&attr10, &sched10);
12704
12705 s32Result10 = pthread_create(&thread_info10, &attr10, (void*)AU_CUS_AV_Sync_Info_Monitor, (void *) NULL);
12706 if (s32Result10 != 0)
12707 {
12708 AU_nPRINT("[Error] [%s] [Can't AU_CUS_AV_Sync_Info_Monitor thread] \n", __FUNCTION__);
12709 }
12710 else
12711 {
12712 AU_nDBG("AU_CUS_AV_Sync_Info_Monitor successfully \n");
12713 }
12714 }
12715 #endif
12716
12717 //================================================================================================
12718 // ADEC Underrun Monitor
12719 //================================================================================================
12720 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12721 {
12722 struct task_struct *pAU_ADEC_Underrun_Thread = NULL;
12723
12724 pAU_ADEC_Underrun_Thread = kthread_create((void*)AU_CUS_ADEC_Underrun_Monitor, NULL, "MStar AU_CUS_ADEC_Underrun_Monitor");
12725 if (pAU_ADEC_Underrun_Thread == NULL)
12726 {
12727 AU_nPRINT("[Error] [%s] [Can't AU_CUS_ADEC_Underrun_Monitor thread] \n", __FUNCTION__);
12728 }
12729 else
12730 {
12731 AU_nDBG("AU_CUS_ADEC_Underrun_Monitorthread created successfully \n");
12732 wake_up_process(pAU_ADEC_Underrun_Thread);
12733 }
12734 }
12735 #else //User Space
12736 {
12737 pthread_t thread_info11;
12738 pthread_attr_t attr11;
12739 struct sched_param sched11;
12740 int s32Result11;
12741
12742 pthread_attr_init(&attr11);
12743 pthread_attr_setdetachstate(&attr11, PTHREAD_CREATE_JOINABLE);
12744 pthread_attr_setinheritsched(&attr11, PTHREAD_EXPLICIT_SCHED);
12745 pthread_attr_setschedpolicy(&attr11, SCHED_RR);
12746 pthread_attr_getschedparam(&attr11, &sched11);
12747 sched11.sched_priority = 85;
12748 pthread_attr_setschedparam(&attr11, &sched11);
12749
12750 s32Result11 = pthread_create(&thread_info11, &attr11, (void*)AU_CUS_ADEC_Underrun_Monitor, (void *) NULL);
12751 if (s32Result11 != 0)
12752 {
12753 AU_nPRINT("[Error] [%s] [Can't AU_CUS_ADEC_Underrun_Monitor thread] \n", __FUNCTION__);
12754 }
12755 else
12756 {
12757 AU_nDBG("AU_CUS_ADEC_Underrun_Monitor successfully \n");
12758 }
12759 }
12760 #endif
12761
12762 //================================================================================================
12763 // Customized internal patch: Auto_Audio_Delay_Monitor
12764 //================================================================================================
12765 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12766 {
12767 struct task_struct *pAU_CUS_INTERNAL_PATCH_Auto_Audio_Delay_Thread = NULL;
12768
12769 pAU_CUS_INTERNAL_PATCH_Auto_Audio_Delay_Thread = kthread_create((void*)AU_CUS_INTERNAL_PATCH_Auto_Audio_Delay_Monitor, NULL, "MStar AU_CUS_INTERNAL_PATCH_Auto_Audio_Delay_Monitor");
12770 if (pAU_CUS_INTERNAL_PATCH_Auto_Audio_Delay_Thread == NULL)
12771 {
12772 AU_nPRINT("[Error] [%s] [Can't AU_CUS_INTERNAL_PATCH_Auto_Audio_Delay_Monitor thread] \n", __FUNCTION__);
12773 }
12774 else
12775 {
12776 AU_nDBG("AU_CUS_INTERNAL_PATCH_Auto_Audio_Delay_Monitor thread created successfully \n");
12777 wake_up_process(pAU_CUS_INTERNAL_PATCH_Auto_Audio_Delay_Thread);
12778 }
12779 }
12780 #else //User Space
12781 {
12782 pthread_t thread_info12;
12783 pthread_attr_t attr12;
12784 struct sched_param sched12;
12785 int s32Result12;
12786
12787 pthread_attr_init(&attr12);
12788 pthread_attr_setdetachstate(&attr12, PTHREAD_CREATE_JOINABLE);
12789 pthread_attr_setinheritsched(&attr12, PTHREAD_EXPLICIT_SCHED);
12790 pthread_attr_setschedpolicy(&attr12, SCHED_RR);
12791 pthread_attr_getschedparam(&attr12, &sched12);
12792 sched12.sched_priority = 85;
12793 pthread_attr_setschedparam(&attr12, &sched12);
12794
12795 s32Result12 = pthread_create(&thread_info12, &attr12, (void*)AU_CUS_INTERNAL_PATCH_Auto_Audio_Delay_Monitor, (void *) NULL);
12796 if (s32Result12 != 0)
12797 {
12798 AU_nPRINT("[Error] [%s] [Can't AU_CUS_INTERNAL_PATCH_Auto_Audio_Delay_Monitor thread] \n", __FUNCTION__);
12799 }
12800 else
12801 {
12802 AU_nDBG("AU_CUS_INTERNAL_PATCH_Auto_Audio_Delay_Monitor successfully \n");
12803 }
12804 }
12805 #endif
12806
12807 //================================================================================================
12808 // Customized internal patch: AU_CUS_INTERNAL_PATCH_General_Dump_Buffer_Monitor
12809 //================================================================================================
12810 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12811 {
12812 struct task_struct *pAU_CUS_INTERNAL_PATCH_General_Dump_Buffer_Thread = NULL;
12813
12814 pAU_CUS_INTERNAL_PATCH_General_Dump_Buffer_Thread = kthread_create((void*)AU_CUS_INTERNAL_PATCH_General_Dump_Buffer_Monitor, NULL, "MStar AU_CUS_INTERNAL_PATCH_General_Dump_Buffer_Monitor");
12815 if (pAU_CUS_INTERNAL_PATCH_General_Dump_Buffer_Thread == NULL)
12816 {
12817 AU_nPRINT("[Error] [%s] [Can't AU_CUS_INTERNAL_PATCH_General_Dump_Buffer_Monitor thread] \n", __FUNCTION__);
12818 }
12819 else
12820 {
12821 AU_nDBG("AU_CUS_INTERNAL_PATCH_General_Dump_Buffer_Monitor thread created successfully \n");
12822 wake_up_process(pAU_CUS_INTERNAL_PATCH_General_Dump_Buffer_Thread);
12823 }
12824 }
12825 #else //User Space
12826 {
12827 pthread_t thread_info13;
12828 pthread_attr_t attr13;
12829 struct sched_param sched13;
12830 int s32Result13;
12831
12832 pthread_attr_init(&attr13);
12833 pthread_attr_setdetachstate(&attr13, PTHREAD_CREATE_JOINABLE);
12834 pthread_attr_setinheritsched(&attr13, PTHREAD_EXPLICIT_SCHED);
12835 pthread_attr_setschedpolicy(&attr13, SCHED_RR);
12836 pthread_attr_getschedparam(&attr13, &sched13);
12837 sched13.sched_priority = 85;
12838 pthread_attr_setschedparam(&attr13, &sched13);
12839
12840 s32Result13 = pthread_create(&thread_info13, &attr13, (void*)AU_CUS_INTERNAL_PATCH_General_Dump_Buffer_Monitor, (void *) NULL);
12841 if (s32Result13 != 0)
12842 {
12843 AU_nPRINT("[Error] [%s] [Can't AU_CUS_INTERNAL_PATCH_General_Dump_Buffer_Monitor thread] \n", __FUNCTION__);
12844 }
12845 else
12846 {
12847 AU_nDBG("AU_CUS_INTERNAL_PATCH_General_Dump_Buffer_Monitor successfully \n");
12848 }
12849 }
12850 #endif
12851
12852 //================================================================================================
12853 // Customized internal patch: AU_CUS_INTERNAL_PATCH_DDP_71_Auto_Bypass_Monitor
12854 //================================================================================================
12855 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12856 {
12857 struct task_struct *pAU_CUS_INTERNAL_PATCH_DDP_71_Auto_Bypass_Thread = NULL;
12858
12859 pAU_CUS_INTERNAL_PATCH_DDP_71_Auto_Bypass_Thread = kthread_create((void*)AU_CUS_INTERNAL_PATCH_DDP_71_Auto_Bypass_Monitor, NULL, "MStar AU_CUS_INTERNAL_PATCH_DDP_71_Auto_Bypass_Monitor");
12860 if (pAU_CUS_INTERNAL_PATCH_DDP_71_Auto_Bypass_Thread == NULL)
12861 {
12862 AU_nPRINT("[Error] [%s] [Can't AU_CUS_INTERNAL_PATCH_DDP_71_Auto_Bypass_Monitor thread] \n", __FUNCTION__);
12863 }
12864 else
12865 {
12866 AU_nDBG("AU_CUS_INTERNAL_PATCH_DDP_71_Auto_Bypass_Monitor thread created successfully \n");
12867 wake_up_process(pAU_CUS_INTERNAL_PATCH_DDP_71_Auto_Bypass_Thread);
12868 }
12869 }
12870 #else //User Space
12871 {
12872 pthread_t thread_info14;
12873 pthread_attr_t attr14;
12874 struct sched_param sched14;
12875 int s32Result14;
12876
12877 pthread_attr_init(&attr14);
12878 pthread_attr_setdetachstate(&attr14, PTHREAD_CREATE_JOINABLE);
12879 pthread_attr_setinheritsched(&attr14, PTHREAD_EXPLICIT_SCHED);
12880 pthread_attr_setschedpolicy(&attr14, SCHED_RR);
12881 pthread_attr_getschedparam(&attr14, &sched14);
12882 sched14.sched_priority = 85;
12883 pthread_attr_setschedparam(&attr14, &sched14);
12884
12885 s32Result14 = pthread_create(&thread_info14, &attr14, (void*)AU_CUS_INTERNAL_PATCH_DDP_71_Auto_Bypass_Monitor, (void *) NULL);
12886 if (s32Result14 != 0)
12887 {
12888 AU_nPRINT("[Error] [%s] [Can't AU_CUS_INTERNAL_PATCH_DDP_71_Auto_Bypass_Monitor thread] \n", __FUNCTION__);
12889 }
12890 else
12891 {
12892 AU_nDBG("AU_CUS_INTERNAL_PATCH_DDP_71_Auto_Bypass_Monitor successfully \n");
12893 }
12894 }
12895 #endif
12896
12897 //================================================================================================
12898 // Customized patch: AU_CUS_PATCH_Dump_R2_Log_Monitor
12899 //================================================================================================
12900 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12901 {
12902 struct task_struct *pAU_CUS_PATCH_Dump_R2_Log_Thread = NULL;
12903
12904 pAU_CUS_PATCH_Dump_R2_Log_Thread = kthread_create((void*)AU_CUS_PATCH_Dump_R2_Log_Monitor, NULL, "MStar AU_CUS_PATCH_Dump_R2_Log_Monitor");
12905 if (pAU_CUS_PATCH_Dump_R2_Log_Thread == NULL)
12906 {
12907 AU_nPRINT("[Error] [%s] [Can't AU_CUS_PATCH_Dump_R2_Log_Monitor thread] \n", __FUNCTION__);
12908 }
12909 else
12910 {
12911 AU_nDBG("AU_CUS_PATCH_Dump_R2_Log_Monitor thread created successfully \n");
12912 wake_up_process(pAU_CUS_PATCH_Dump_R2_Log_Thread);
12913 }
12914 }
12915 #else //User Space
12916 {
12917 pthread_t thread_info15;
12918 pthread_attr_t attr15;
12919 struct sched_param sched15;
12920 int s32Result15;
12921
12922 pthread_attr_init(&attr15);
12923 pthread_attr_setdetachstate(&attr15, PTHREAD_CREATE_JOINABLE);
12924 pthread_attr_setinheritsched(&attr15, PTHREAD_EXPLICIT_SCHED);
12925 pthread_attr_setschedpolicy(&attr15, SCHED_RR);
12926 pthread_attr_getschedparam(&attr15, &sched15);
12927 sched15.sched_priority = 85;
12928 pthread_attr_setschedparam(&attr15, &sched15);
12929
12930 s32Result15 = pthread_create(&thread_info15, &attr15, (void*)AU_CUS_PATCH_Dump_R2_Log_Monitor, (void *) NULL);
12931 if (s32Result15 != 0)
12932 {
12933 AU_nPRINT("[Error] [%s] [Can't AU_CUS_PATCH_Dump_R2_Log_Monitor thread] \n", __FUNCTION__);
12934 }
12935 else
12936 {
12937 AU_nDBG("AU_CUS_PATCH_Dump_R2_Log_Monitor successfully \n");
12938 }
12939 }
12940 #endif
12941
12942 //================================================================================================
12943 // AU Demo MM AD New Mode Play Monitor
12944 //================================================================================================
12945 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12946 {
12947 struct task_struct *pAU_Demo_MM_New_Mode_AD_Thread = NULL;
12948
12949 pAU_Demo_MM_New_Mode_AD_Thread = kthread_create((void*)AU_CUS_Demo_MM_New_Mode_AD_Play_Monitor, NULL, "MStar AU Demo MM New Mode AD Play Monitor");
12950 if (pAU_Demo_MM_New_Mode_AD_Thread == NULL)
12951 {
12952 AU_nPRINT("[Error] [%s] [Can't AU Demo MM New Mode AD Play thread] \n", __FUNCTION__);
12953 }
12954 else
12955 {
12956 AU_nDBG("AU Demo MM New Mode AD Play monitor thread created successfully \n");
12957 wake_up_process(pAU_Demo_MM_New_Mode_AD_Thread);
12958 }
12959 }
12960 #else //User Space
12961 {
12962 pthread_t thread_info16;
12963 pthread_attr_t attr16;
12964 struct sched_param sched16;
12965 int s32Result16;
12966
12967 pthread_attr_init(&attr16);
12968 pthread_attr_setdetachstate(&attr16, PTHREAD_CREATE_JOINABLE);
12969 pthread_attr_setinheritsched(&attr16, PTHREAD_EXPLICIT_SCHED);
12970 pthread_attr_setschedpolicy(&attr16, SCHED_RR);
12971 pthread_attr_getschedparam(&attr16, &sched16);
12972 sched16.sched_priority = 85;
12973 pthread_attr_setschedparam(&attr16, &sched16);
12974
12975 s32Result16 = pthread_create(&thread_info16, &attr16, (void*)AU_CUS_Demo_MM_New_Mode_AD_Play_Monitor, (void *) NULL);
12976 if (s32Result16 != 0)
12977 {
12978 AU_nPRINT("[Error] [%s] [Can't AU Demo MM New Mode AD Play thread] \n", __FUNCTION__);
12979 }
12980 else
12981 {
12982 AU_nDBG("AU Demo MM New Mode AD Play monitor thread created successfully \n");
12983 }
12984 }
12985 #endif
12986
12987 //================================================================================================
12988 // AU_CUS_ThreadPrintMsg_Monitor
12989 //================================================================================================
12990 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
12991 {
12992 struct task_struct *pAU_CUS_ThreadPrintMsg_Thread = NULL;
12993
12994 pAU_CUS_ThreadPrintMsg_Thread = kthread_create((void*)AU_CUS_ThreadPrintMsg_Monitor, NULL, "MStar AU_CUS_ThreadPrintMsg_Monitor");
12995 if (pAU_CUS_ThreadPrintMsg_Thread == NULL)
12996 {
12997 AU_nPRINT("[Error] [%s] [Can't create AU_CUS_ThreadPrintMsg_Monitor thread] \n", __FUNCTION__);
12998 }
12999 else
13000 {
13001 AU_nDBG("AU_CUS_ThreadPrintMsg_Monitor created successfully \n");
13002 wake_up_process(pAU_CUS_ThreadPrintMsg_Thread);
13003 }
13004 }
13005 #else //User Space
13006 {
13007 pthread_t thread_info17;
13008 pthread_attr_t attr17;
13009 struct sched_param sched17;
13010 int s32Result17;
13011
13012 pthread_attr_init(&attr17);
13013 pthread_attr_setdetachstate(&attr17, PTHREAD_CREATE_JOINABLE);
13014 pthread_attr_setinheritsched(&attr17, PTHREAD_EXPLICIT_SCHED);
13015 pthread_attr_setschedpolicy(&attr17, SCHED_RR);
13016 pthread_attr_getschedparam(&attr17, &sched17);
13017 sched17.sched_priority = 85;
13018 pthread_attr_setschedparam(&attr17, &sched17);
13019
13020 s32Result17 = pthread_create(&thread_info17, &attr17, (void*)AU_CUS_ThreadPrintMsg_Monitor, (void *) NULL);
13021 if (s32Result17 != 0)
13022 {
13023 AU_nPRINT("[Error] [%s] [Can't AU_CUS_ThreadPrintMsg_Monitor thread] \n", __FUNCTION__);
13024 }
13025 else
13026 {
13027 AU_nDBG("AU_CUS_ThreadPrintMsg_Monitor thread created successfully \n");
13028 }
13029 }
13030 #endif
13031
13032 //================================================================================================
13033 // AU_CUS_INTERNAL_PATCH_R2_Active_Monitor
13034 //================================================================================================
13035 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
13036 {
13037 struct task_struct *pAU_CUS_INTERNAL_PATCH_R2_Active_Thread = NULL;
13038
13039 pAU_CUS_INTERNAL_PATCH_R2_Active_Thread = kthread_create((void*)AU_CUS_INTERNAL_PATCH_R2_Active_Monitor, NULL, "MStar AU_CUS_INTERNAL_PATCH_R2_Active_Monitor");
13040 if (pAU_CUS_INTERNAL_PATCH_R2_Active_Thread == NULL)
13041 {
13042 AU_nPRINT("[Error] [%s] [Can't create AU_CUS_INTERNAL_PATCH_R2_Active_Monitor thread] \n", __FUNCTION__);
13043 }
13044 else
13045 {
13046 AU_nDBG("AU_CUS_INTERNAL_PATCH_R2_Active_Monitor created successfully \n");
13047 wake_up_process(pAU_CUS_INTERNAL_PATCH_R2_Active_Thread);
13048 }
13049 }
13050 #else //User Space
13051 {
13052 pthread_t thread_info18;
13053 pthread_attr_t attr18;
13054 struct sched_param sched18;
13055 int s32Result18;
13056
13057 pthread_attr_init(&attr18);
13058 pthread_attr_setdetachstate(&attr18, PTHREAD_CREATE_JOINABLE);
13059 pthread_attr_setinheritsched(&attr18, PTHREAD_EXPLICIT_SCHED);
13060 pthread_attr_setschedpolicy(&attr18, SCHED_RR);
13061 pthread_attr_getschedparam(&attr18, &sched18);
13062 sched18.sched_priority = 85;
13063 pthread_attr_setschedparam(&attr18, &sched18);
13064
13065 s32Result18 = pthread_create(&thread_info18, &attr18, (void*)AU_CUS_INTERNAL_PATCH_R2_Active_Monitor, (void *) NULL);
13066 if (s32Result18 != 0)
13067 {
13068 AU_nPRINT("[Error] [%s] [Can't AU_CUS_INTERNAL_PATCH_R2_Active_Monitor thread] \n", __FUNCTION__);
13069 }
13070 else
13071 {
13072 AU_nDBG("AU_CUS_INTERNAL_PATCH_R2_Active_Monitor thread created successfully \n");
13073 }
13074 }
13075 #endif
13076
13077 //================================================================================================
13078 // AU_CUS_HDMI_RX_Monitor
13079 //================================================================================================
13080 #if (CUSTOMIZED_PATCH_PARAM_HDMI_RX_SWITCH_TO_PCM_DEBOUNCE)
13081 {
13082 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
13083 {
13084 struct task_struct *pAU_CUS_INTERNAL_PATCH_HDMI_RX_Monitor_Thread = NULL;
13085
13086 pAU_CUS_INTERNAL_PATCH_HDMI_RX_Monitor_Thread = kthread_create((void*)AU_CUS_HDMI_RX_Monitor, NULL, "MStar AU_CUS_HDMI_RX_Monitor");
13087 if (pAU_CUS_INTERNAL_PATCH_HDMI_RX_Monitor_Thread == NULL)
13088 {
13089 AU_nPRINT("[Error] [%s] [Can't create AU_CUS_HDMI_RX_Monitor thread] \n", __FUNCTION__);
13090 }
13091 else
13092 {
13093 AU_nDBG("AU_CUS_HDMI_RX_Monitor created successfully \n");
13094 wake_up_process(pAU_CUS_INTERNAL_PATCH_HDMI_RX_Monitor_Thread);
13095 }
13096 }
13097 #else //User Space
13098 {
13099 pthread_t thread_info19;
13100 pthread_attr_t attr19;
13101 struct sched_param sched19;
13102 int s32Result19;
13103
13104 pthread_attr_init(&attr19);
13105 pthread_attr_setdetachstate(&attr19, PTHREAD_CREATE_JOINABLE);
13106 pthread_attr_setinheritsched(&attr19, PTHREAD_EXPLICIT_SCHED);
13107 pthread_attr_setschedpolicy(&attr19, SCHED_RR);
13108 pthread_attr_getschedparam(&attr19, &sched19);
13109 sched19.sched_priority = 85;
13110 pthread_attr_setschedparam(&attr19, &sched19);
13111
13112 s32Result19 = pthread_create(&thread_info19, &attr19, (void*)AU_CUS_HDMI_RX_Monitor, (void *) NULL);
13113 if (s32Result19 != 0)
13114 {
13115 AU_nPRINT("[Error] [%s] [Can't AU_CUS_HDMI_RX_Monitor thread] \n", __FUNCTION__);
13116 }
13117 else
13118 {
13119 AU_nDBG("AU_CUS_HDMI_RX_Monitor thread created successfully \n");
13120 }
13121 }
13122 #endif
13123 }
13124 #endif
13125 }
13126 #endif
13127
13128 }
13129
AU_CUS_CreateDebugMenuThread(void)13130 static void AU_CUS_CreateDebugMenuThread(void)
13131 {
13132 #ifdef CONFIG_MBOOT //mboot
13133 {
13134 }
13135 #else //application
13136 {
13137 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
13138 {
13139 struct task_struct *pAU_DebugMenuThread = NULL;
13140
13141 pAU_DebugMenuThread = kthread_create((void*)AU_CUS_DebugMenu, NULL, "MStar AU_CUS_DebugMenu");
13142 if (pAU_DebugMenuThread == NULL)
13143 {
13144 AU_nPRINT("[Error] [%s] [Can't create AU_CUS_DebugMenu thread] \n", __FUNCTION__);
13145 }
13146 else
13147 {
13148 AU_nDBG("AU_CUS_DebugMenu thread created successfully \n");
13149 wake_up_process(pAU_DebugMenuThread);
13150 }
13151 }
13152 #else //User Space
13153 {
13154 pthread_t thread_info99;
13155 pthread_attr_t attr99;
13156 struct sched_param sched99;
13157 int s32Result99;
13158
13159 pthread_attr_init(&attr99);
13160 pthread_attr_setdetachstate(&attr99, PTHREAD_CREATE_JOINABLE);
13161 pthread_attr_setinheritsched(&attr99, PTHREAD_EXPLICIT_SCHED);
13162 pthread_attr_setschedpolicy(&attr99, SCHED_RR);
13163 pthread_attr_getschedparam(&attr99, &sched99);
13164 sched99.sched_priority = 85;
13165 pthread_attr_setschedparam(&attr99, &sched99);
13166
13167 s32Result99 = pthread_create(&thread_info99, &attr99, (void*)AU_CUS_DebugMenu, (void *) NULL);
13168 if (s32Result99 != 0)
13169 {
13170 AU_nPRINT("[Error] [%s] [Can't create AU_CUS_DebugMenu thread] \n", __FUNCTION__);
13171 }
13172 else
13173 {
13174 AU_nDBG("AU_CUS_DebugMenu thread created successfully \n");
13175 }
13176 }
13177 #endif
13178 }
13179 #endif
13180 }
13181
AU_CUS_MemoryAlloc(MS_U32 allocSize)13182 MS_U8* AU_CUS_MemoryAlloc(MS_U32 allocSize)
13183 {
13184 MS_U8 *allocBuffer = NULL;
13185
13186 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
13187 allocBuffer = kzalloc(sizeof(MS_U8) * allocSize, GFP_KERNEL);
13188 #else //User Space
13189 allocBuffer = malloc(sizeof(MS_U8) * allocSize);
13190 #endif
13191
13192 if (allocBuffer == NULL)
13193 {
13194 AU_nPRINT("%s: Error! fail to allocate 0x%x bytes memory !\n", __FUNCTION__, (unsigned int)(sizeof(MS_U8) * allocSize));
13195 return allocBuffer;
13196 }
13197
13198 memset(allocBuffer, 0x00, sizeof(MS_U8) * allocSize);
13199
13200 return allocBuffer;
13201 }
13202
AU_CUS_MemoryFree(void * pMemoryBuffer)13203 void AU_CUS_MemoryFree(void *pMemoryBuffer)
13204 {
13205 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel space
13206 kfree(pMemoryBuffer);
13207 #else //user space
13208 free(pMemoryBuffer);
13209 #endif
13210 }
13211
13212 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel space
AU_CUS_FileOpen(const char * filename,const char * mode)13213 struct file * AU_CUS_FileOpen(const char * filename, const char *mode)
13214 {
13215 return filp_open(filename, O_RDWR|O_CREAT|O_APPEND, S_IRWXU | S_IRWXG | S_IRWXO);
13216 }
13217
AU_CUS_FileClose(struct file * fp)13218 void AU_CUS_FileClose(struct file *fp)
13219 {
13220 filp_close(fp, NULL);
13221 }
13222
AU_CUS_FileWrite(const void * p,size_t size,size_t nmemb,struct file * fp)13223 void AU_CUS_FileWrite(const void *p, size_t size, size_t nmemb, struct file * fp)
13224 {
13225 mm_segment_t fs;
13226 /* get current->addr_limit. It should be 0-3G */
13227 fs = get_fs();
13228 /* set current->addr_limit to 4G */
13229 set_fs(get_ds());
13230
13231 if (fp->f_op && fp->f_op->write)
13232 fp->f_op->write(fp, p, nmemb, &fp->f_pos);
13233
13234 if (fp->f_op && fp->f_op->flush)
13235 fp->f_op->flush(fp, NULL);
13236
13237 /* restore the addr_limit */
13238 set_fs(fs);
13239 }
13240
13241 #if (UTPA_SUPPORT_AAC_ENCODE == 1)
Mpeg4AacEnc_Create(void ** aHandle)13242 tEmzInt32 Mpeg4AacEnc_Create(void **aHandle)
13243 {
13244 return 0;
13245 }
Mpeg4AacEnc_Reset(void * aHandle,tMp4AacEncParams * aEncPrms)13246 tEmzInt32 Mpeg4AacEnc_Reset(void *aHandle, tMp4AacEncParams *aEncPrms)
13247 {
13248 return 0;
13249 }
Mpeg4AacEnc_Encode(void * aHandle,tEmzInt16 aSrc[],tEmzInt32 aSrcLen,tEmzUint8 aDst[],tEmzInt32 * aDstLen)13250 tEmzInt32 Mpeg4AacEnc_Encode(void *aHandle, tEmzInt16 aSrc[], tEmzInt32 aSrcLen, tEmzUint8 aDst[], tEmzInt32 *aDstLen)
13251 {
13252 return 0;
13253 }
Mpeg4AacEnc_Delete(void * aHandle)13254 tEmzInt32 Mpeg4AacEnc_Delete(void *aHandle)
13255 {
13256 return 0;
13257 }
13258 #endif
13259
13260 #else //User space
AU_CUS_FileOpen(const char * filename,const char * mode)13261 FILE * AU_CUS_FileOpen(const char * filename, const char *mode)
13262 {
13263 #ifdef CONFIG_MBOOT
13264 return NULL;
13265 #else
13266 return fopen(filename, mode);
13267 #endif
13268 }
13269
AU_CUS_FileClose(FILE * fp)13270 int AU_CUS_FileClose(FILE * fp)
13271 {
13272 #ifdef CONFIG_MBOOT
13273 return NULL;
13274 #else
13275 return fclose(fp);
13276 #endif
13277 }
13278
AU_CUS_FileWrite(const void * p,size_t size,size_t nmemb,FILE * fp)13279 void AU_CUS_FileWrite(const void *p, size_t size, size_t nmemb, FILE *fp)
13280 {
13281 #ifdef CONFIG_MBOOT
13282 return;
13283 #else
13284 fwrite(p, size, nmemb, fp);
13285 fflush(fp);
13286 #endif
13287 }
13288 #endif
13289
13290 /* Debug Related functions */
13291 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
AU_CUS_DebugMenu(void)13292 MS_BOOL AU_CUS_DebugMenu(void)
13293 {
13294 //Kernel Space dont support IO. need to use proc
13295 return TRUE;
13296 }
13297
13298 /* kernel debug proc */
13299 static struct AU_CUS_kernel_debug_proc_st au_cus_kernel_debug_proc_child[AU_CUS_KERNEL_DEBUG_PROC_MAX_CHILD] =
13300 {
13301 {
13302 /* proc child 1 */
13303 .proc_entry = NULL,
13304 .proc_fops =
13305 {
13306 .owner = THIS_MODULE,
13307 .read = AU_CUS_kernel_debug_proc_read_nDBG,
13308 .write = AU_CUS_kernel_debug_proc_write_nDBG,
13309 },
13310 .proc_name = AU_CUS_KERNEL_DEBUG_PROC_CHILD_0001_NDBG,
13311 .proc_mode = 0x0666,
13312 },
13313 {
13314 /* proc child 2 */
13315 .proc_entry = NULL,
13316 .proc_fops =
13317 {
13318 .owner = THIS_MODULE,
13319 .read = AU_CUS_kernel_debug_proc_read_ShowVersion,
13320 },
13321 .proc_name = AU_CUS_KERNEL_DEBUG_PROC_CHILD_0002_SHOW_VERSION,
13322 .proc_mode = 0x0666,
13323 },
13324 };
13325
13326 //-----------------------------------------------------------------------------
13327 // Proc Operations (Init / Exit)
13328 //-----------------------------------------------------------------------------
AU_CUS_KERNEL_DEBUG_PROC_init(void)13329 static int AU_CUS_KERNEL_DEBUG_PROC_init(void)
13330 {
13331 struct AU_CUS_kernel_debug_proc_st *proc_child = NULL;
13332 int loop = 0;
13333 int ret = 0;
13334
13335 g_proc_root = proc_mkdir(AU_CUS_KERNEL_DEBUG_PROC_ROOT_NAME, NULL);
13336 if (g_proc_root == NULL)
13337 {
13338 AU_nDBG(KERN_ERR "Error! fail to create root directory of proc filesystem (%s)!\n", AU_CUS_KERNEL_DEBUG_PROC_ROOT_NAME);
13339 ret = -EACCES;
13340 }
13341 else
13342 {
13343 for (loop = 0; loop < AU_CUS_KERNEL_DEBUG_PROC_MAX_CHILD; loop++)
13344 {
13345 proc_child = &au_cus_kernel_debug_proc_child[loop];
13346
13347 proc_child->proc_entry = proc_create_data(proc_child->proc_name, proc_child->proc_mode, g_proc_root, &proc_child->proc_fops, NULL);
13348 if (proc_child->proc_entry == NULL)
13349 {
13350 AU_nDBG(KERN_ERR "Error! fail to create child directory of proc filesystem (%s)!\n", proc_child->proc_name);
13351 ret = -EACCES;
13352 break;
13353 }
13354 }
13355 }
13356 AU_nDBG("\033[1;32m *****MstarAudioCustomerDebug proc insert SUCESS!! \033[0m \n");
13357
13358 return ret;
13359 }
13360
AU_CUS_KERNEL_DEBUG_PROC_exit(void)13361 static inline void AU_CUS_KERNEL_DEBUG_PROC_exit(void)
13362 {
13363 struct AU_CUS_kernel_debug_proc_st *proc_child = NULL;
13364 int loop = 0;
13365
13366 for (loop = 0; loop < AU_CUS_KERNEL_DEBUG_PROC_MAX_CHILD; loop++)
13367 {
13368 proc_child = &au_cus_kernel_debug_proc_child[loop];
13369
13370 if (proc_child->proc_entry != NULL)
13371 {
13372 remove_proc_entry(proc_child->proc_name, g_proc_root);
13373 }
13374 }
13375
13376 remove_proc_entry(AU_CUS_KERNEL_DEBUG_PROC_ROOT_NAME, NULL);
13377
13378 return;
13379 }
13380
13381 /*
13382
13383 note:
13384 cat xxx // proc read
13385 echo ooo on > xxx // proc write
13386 echo ooo off > xxx // proc write
13387
13388 ===============================================================================
13389 * * * How to use kernel debug proc * * *
13390 ===============================================================================
13391 #------------------------------------------
13392 #Child 1: "0001_nDBG"
13393 #------------------------------------------
13394 cd /proc/MstarAudioCustomerDebug/
13395 cat 0001_nDBG
13396 echo EnableNonThreadPrint > 0001_nDBG
13397 echo EnableThreadPrint > 0001_nDBG
13398 echo DisableNonThreadPrint > 0001_nDBG
13399 echo DisableThreadPrint > 0001_nDBG
13400 echo DisableAllThreadMonitor > 0001_nDBG
13401
13402 #------------------------------------------
13403 #Child 2: "0002_Version"
13404 #------------------------------------------
13405 cd /proc/MstarAudioCustomerDebug/
13406 cat 0002_ShowVersion
13407
13408 */
13409
13410 //-----------------------------------------------------------------------------
13411 // Proc Operations (Child 1, "001_AudioLog")
13412 //-----------------------------------------------------------------------------
AU_CUS_kernel_debug_proc_read_nDBG(struct file * file,char __user * buffer,size_t count,loff_t * pos)13413 static ssize_t AU_CUS_kernel_debug_proc_read_nDBG(struct file *file, char __user *buffer, size_t count, loff_t *pos)
13414 {
13415 AU_nPRINT("Proc_Read_Test\n");
13416
13417 return 0;
13418 }
13419
AU_CUS_kernel_debug_proc_write_nDBG(struct file * file,const char __user * buffer,size_t count,loff_t * pos)13420 static ssize_t AU_CUS_kernel_debug_proc_write_nDBG(struct file *file, const char __user *buffer, size_t count, loff_t *pos)
13421 {
13422 char value_str[AU_CUS_KERNEL_DEBUG_PROC_STRING_BUFFER_LENGTH] = {'\0'};
13423 char action[AU_CUS_KERNEL_DEBUG_PROC_STRING_BUFFER_LENGTH];
13424
13425 if (copy_from_user(value_str, buffer, count))
13426 {
13427 return -EFAULT;
13428 }
13429
13430 value_str[count] = '\0';
13431 sscanf(value_str, "%s\n", action);
13432
13433 AU_nPRINT("*********%s\n", action);
13434
13435 if (!strcmp("EnableNonThreadPrint",action))
13436 {
13437 AU_nPRINT("EnableNonThreadPrint \n");
13438 pstAudioCustomerShmData->g_audio_customer_bEnableNonThreadPrintMsg = TRUE;
13439 }
13440
13441 if (!strcmp("EnableThreadPrint",action))
13442 {
13443 AU_nPRINT("EnableThreadPrint \n");
13444 pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg = TRUE;
13445 }
13446
13447 if (!strcmp("DisableNonThreadPrint",action))
13448 {
13449 AU_nPRINT("DisableNonThreadPrint \n");
13450 pstAudioCustomerShmData->g_audio_customer_bEnableNonThreadPrintMsg = FALSE;
13451 }
13452
13453 if (!strcmp("DisableThreadPrint",action))
13454 {
13455 AU_nPRINT("DisableThreadPrint \n");
13456 pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg = FALSE;
13457 }
13458
13459 if (!strcmp("DisableAllThreadMonitor",action))
13460 {
13461 AU_nPRINT("DisableAllThreadMonitor \n");
13462 pstAudioCustomerShmData->g_audio_customer_AU_CUS_ClipDecoderMonitor_bEnable = FALSE;
13463 pstAudioCustomerShmData->g_audio_customer_AU_CUS_MP3EncodeMonitor_bEnable = FALSE;
13464 pstAudioCustomerShmData->g_audio_customer_AU_CUS_MonitorService_bEnable = FALSE;
13465 pstAudioCustomerShmData->g_audio_customer_AU_CUS_AACEncodeMonitor_bEnable = FALSE;
13466 pstAudioCustomerShmData->g_audio_customer_AU_CUS_MuteDuringLimitedTime_Monitor_bEnable = FALSE;
13467 pstAudioCustomerShmData->g_audio_customer_AU_CUS_AdecPcmOutMonitor_bEnable = FALSE;
13468 pstAudioCustomerShmData->g_audio_customer_AU_CUS_PCMCaptureMonitor_bEnable = FALSE;
13469 pstAudioCustomerShmData->g_audio_customer_AU_CUS_EndOfStreamMonitor_bEnable = FALSE;
13470 pstAudioCustomerShmData->g_audio_customer_AU_CUS_ADEC_Underrun_Monitor_bEnable = FALSE;
13471 pstAudioCustomerShmData->g_audio_customer_AU_CUS_PATCH_Dump_R2_Log_Monitor_bEnable = FALSE;
13472 pstAudioCustomerShmData->g_audio_customer_AU_CUS_INTERNAL_PATCH_Auto_Audio_Delay_Monitor_bEnable = FALSE;
13473 pstAudioCustomerShmData->g_audio_customer_AU_CUS_INTERNAL_PATCH_General_Dump_Buffer_Monitor_bEnable = FALSE;
13474 pstAudioCustomerShmData->g_audio_customer_AU_CUS_INTERNAL_PATCH_DDP_71_Auto_Bypass_Monitor_bEnable = FALSE;
13475 pstAudioCustomerShmData->g_audio_customer_AU_CUS_INTERNAL_PATCH_R2_Active_Monitor_bEnable = FALSE;
13476 pstAudioCustomerShmData->g_audio_customer_AU_CUS_Demo_MM_New_Mode_AD_Play_Monitor_bEnable = FALSE;
13477 pstAudioCustomerShmData->g_audio_customer_AU_CUS_Demo_MM_New_Mode_Play_Monitor_bEnable = FALSE;
13478 pstAudioCustomerShmData->g_audio_customer_AU_CUS_Demo_PCMIO_Play_Monitor_bEnable = FALSE;
13479 pstAudioCustomerShmData->g_audio_customer_AU_CUS_AV_Sync_Info_Monitor_bEnable = FALSE;
13480 pstAudioCustomerShmData->g_audio_customer_AU_CUS_ThreadPrintMsg_Monitor_bEnable = FALSE;
13481 }
13482
13483 return count;
13484 }
13485
13486 //-----------------------------------------------------------------------------
13487 // Proc Operations (Child 2, "0002_ShowVersion")
13488 //-----------------------------------------------------------------------------
AU_CUS_kernel_debug_proc_read_ShowVersion(struct file * file,char __user * buffer,size_t count,loff_t * pos)13489 static ssize_t AU_CUS_kernel_debug_proc_read_ShowVersion(struct file *file, char __user *buffer, size_t count, loff_t *pos)
13490 {
13491 AU_CUS_SHOW_ALL_VERSION();
13492
13493 return 0;
13494 }
13495
13496 #else //User Space
AU_CUS_fgets(char * buf,int num,FILE * fp)13497 char* AU_CUS_fgets(char* buf, int num, FILE* fp)
13498 {
13499 char* c_eof = 0;
13500
13501 if(!fgets(buf, num, fp))
13502 {
13503 return NULL;
13504 }
13505 while(buf[0]== '\n')
13506 {
13507 if(!fgets(buf, num, fp))
13508 {
13509 return NULL;
13510 }
13511 if((c_eof = strrchr(buf, '\n')))
13512 {
13513 *c_eof = '\0';
13514 }
13515 else
13516 {
13517 int ch;
13518 while(((ch = fgetc(fp)) != EOF) && (ch != '\n'));
13519 }
13520
13521 }
13522 return buf;
13523 }
13524
AU_CUS_Debug_GetHex(const char * szComment)13525 unsigned int AU_CUS_Debug_GetHex(const char *szComment)
13526 {
13527 if(pstAudioCustomerShmData->g_audio_customer_scanf_bSupport == TRUE)
13528 {
13529 char cmd[256];
13530 memset(cmd, 0, 256);
13531
13532 AU_nPRINT("%s", szComment);
13533 fflush(stdout);
13534
13535 do
13536 {
13537 AU_CUS_fgets(cmd, sizeof(cmd), stdin);
13538 }while( !isxdigit((int)(*cmd)) && (fprintf(stderr, "please enter a hex integer\n") || 1 ));
13539
13540 cmd[255] = 0x0;
13541
13542 return (strtoul( cmd, (char**) NULL, 16 ));
13543 }
13544 else if(pstAudioCustomerShmData->g_audio_customer_scanf_bSupport == FALSE) //NON_SCANF version: Allow debug menu to work without scanf
13545 {
13546 unsigned int ret = 0xFFFF;
13547
13548 if(szComment)
13549 {
13550 AU_nPRINT("%s", szComment);
13551 fflush(stdout);
13552 }
13553
13554 while(non_scanf_paramsCount == 0)
13555 {
13556 // No more non_scanf_params, block until more non_scanf_params become avail.
13557 sleep(2);
13558 }
13559 if((non_scanf_paramsCount>0) && (non_scanf_paramIdx < NON_SCANF_DEBUG_CMD_PARAMS_MAX))
13560 {
13561 non_scanf_paramsCount--;
13562 ret= non_scanf_paramsHex[non_scanf_paramIdx++];
13563 }
13564
13565 return ret;
13566 }
13567
13568 return TRUE;
13569 }
13570
AU_CUS_Debug_GetDec(void)13571 int AU_CUS_Debug_GetDec(void)
13572 {
13573 if(pstAudioCustomerShmData->g_audio_customer_scanf_bSupport == TRUE)
13574 {
13575 int dValue;
13576
13577 if(scanf("%d", &dValue)==FALSE)
13578 {
13579 dValue=9284;
13580 }
13581
13582 return dValue;
13583 }
13584 else if(pstAudioCustomerShmData->g_audio_customer_scanf_bSupport == FALSE) //NON_SCANF version: Allow debug menu to work without scanf
13585 {
13586 unsigned int ret = 0xFFFF;
13587 while(non_scanf_paramsCount == 0)
13588 {
13589 // No more non_scanf_params, block until more non_scanf_params become avail.
13590 sleep(2);
13591 }
13592 if((non_scanf_paramsCount>0) && (non_scanf_paramIdx < NON_SCANF_DEBUG_CMD_PARAMS_MAX))
13593 {
13594 non_scanf_paramsCount--;
13595 ret = non_scanf_params[non_scanf_paramIdx++];
13596 }
13597 return ret;
13598 }
13599
13600 return TRUE;
13601 }
13602
AU_CUS_Debug_GetString(void)13603 char* AU_CUS_Debug_GetString(void)
13604 {
13605 if(pstAudioCustomerShmData->g_audio_customer_scanf_bSupport == TRUE)
13606 {
13607 if(scanf("%s", au_debug_input_string)==FALSE)
13608 {
13609 memset(au_debug_input_string, 'F', AU_DEBUG_INPUT_STR_LENGTH+1);
13610 }
13611 }
13612 else if(pstAudioCustomerShmData->g_audio_customer_scanf_bSupport == FALSE) //NON_SCANF version: Allow debug menu to work without scanf
13613 {
13614 while(non_scanf_paramsCount == 0)
13615 {
13616 // No more non_scanf_params, block until more non_scanf_params become avail.
13617 sleep(2);
13618 }
13619 non_scanf_paramsCount--;
13620 strcpy(au_debug_input_string, non_scanf_paramsStr);
13621 }
13622
13623 return au_debug_input_string;
13624 }
13625
13626 #if(DTS_AUDIO_PARSER_ENABLE)
AU_CUS_DTS_Parser_dtsHDEndianConvert64(dtsUint64 number)13627 dtsUint64 AU_CUS_DTS_Parser_dtsHDEndianConvert64(dtsUint64 number)
13628 {
13629 dtsUint64 rc;
13630
13631 rc = (number >> 56) & 0xff;
13632 rc |= (((number >> 48) & 0xff) << 8 );
13633 rc |= (((number >> 40) & 0xff) << 16);
13634 rc |= (((number >> 32) & 0xff) << 24);
13635 rc |= (((number >> 24) & 0xff) << 32);
13636 rc |= (((number >> 16) & 0xff) << 40);
13637 rc |= (((number >> 8 ) & 0xff) << 48);
13638 rc |= (((number >> 0 ) & 0xff) << 56);
13639
13640 return rc;
13641 }
13642
AU_CUS_DTS_Parser_dtsHDEndianConvert32(dtsUint32 number)13643 dtsUint32 AU_CUS_DTS_Parser_dtsHDEndianConvert32(dtsUint32 number)
13644 {
13645 dtsUint32 rc;
13646
13647 rc = (number >> 24) & 0xff;
13648 rc |= (((number >> 16) & 0xff) << 8 );
13649 rc |= (((number >> 8 ) & 0xff) << 16);
13650 rc |= (((number >> 0 ) & 0xff) << 24);
13651
13652 return rc;
13653 }
13654
AU_CUS_DTS_Parser_dtsHDEndianConvert16(dtsUint16 number)13655 dtsUint16 AU_CUS_DTS_Parser_dtsHDEndianConvert16(dtsUint16 number)
13656 {
13657 dtsUint16 rc;
13658
13659 rc = (number >> 8) & 0xff;
13660 rc |= ((number & 0xff) << 8);
13661
13662 return rc;
13663 }
13664
AU_CUS_DTS_Parser_dtsHDDecodeChunk(FILE * fp,dtsUint8 * chunkId,dtsUint64 chunkLength,dtsHDFileInfo * pFileInfo)13665 void AU_CUS_DTS_Parser_dtsHDDecodeChunk(FILE *fp, dtsUint8 *chunkId, dtsUint64 chunkLength, dtsHDFileInfo *pFileInfo)
13666 {
13667 dtsUint32 i;
13668 fpos_tt currentFilePosition;
13669
13670 fgetpos(fp, ¤tFilePosition);
13671
13672 for(i = 0; i < sizeof(dtsHDChunkDecodeMatrix) / sizeof(dtsHDChunkDecodeMatrix[0]); i++)
13673 {
13674 if(0 == memcmp(dtsHDChunkDecodeMatrix[i].pChunkdId, chunkId, DTS_HD_CHUNK_ID_LENGTH))
13675 {
13676 if(NULL != dtsHDChunkDecodeMatrix[i].pChunkDecode)
13677 {
13678 dtsHDChunkDecodeMatrix[i].pChunkDecode(fp, pFileInfo, chunkLength);
13679 }
13680 break;
13681 }
13682 }
13683
13684 fsetpos(fp, ¤tFilePosition);
13685
13686 return;
13687 }
13688
AU_CUS_DTS_Parser_dtsDecodeDTSHDHR(FILE * fp,dtsHDFileInfo * pFileInfo,dtsUint64 chunkLength)13689 void AU_CUS_DTS_Parser_dtsDecodeDTSHDHR(FILE *fp, dtsHDFileInfo *pFileInfo, dtsUint64 chunkLength)
13690 {
13691 dtsUint8 headerChunk[DTS_HD_DTSHDR_MIN_LENGTH_IN_BYTES];
13692 dtsUint8 *pTimeCode;
13693 dtsUint16 metaData;
13694
13695 if(DTS_HD_DTSHDR_MIN_LENGTH_IN_BYTES <= chunkLength)
13696 {
13697 /* Read the chunk data before parsing */
13698 if(DTS_HD_DTSHDR_MIN_LENGTH_IN_BYTES == fread(headerChunk, 1, DTS_HD_DTSHDR_MIN_LENGTH_IN_BYTES, fp))
13699 {
13700 pFileInfo->hdr.valid = dtsTrue;
13701
13702 /* Read the header version */
13703 memcpy(&pFileInfo->hdr.hdrVersion, headerChunk, 4);
13704 pFileInfo->hdr.hdrVersion = AU_CUS_DTS_Parser_dtsHDEndianConvert32(pFileInfo->hdr.hdrVersion);
13705
13706 /* Read the time code */
13707 pFileInfo->hdr.timeCode = 0;
13708 pTimeCode = (dtsUint8 *)&pFileInfo->hdr.timeCode;
13709 memcpy(&pTimeCode[3], &headerChunk[4], 5);
13710
13711 pFileInfo->hdr.timeCode = AU_CUS_DTS_Parser_dtsHDEndianConvert64(pFileInfo->hdr.timeCode);
13712
13713 /* Read the Frame Rate */
13714 pFileInfo->hdr.TCFrameRate = headerChunk[9];
13715
13716 /* Read the meta data */
13717 memcpy(&metaData, &headerChunk[10], 2);
13718 metaData = AU_CUS_DTS_Parser_dtsHDEndianConvert16(metaData);
13719
13720 pFileInfo->hdr.bitWStreamMetaData.vbr = DTS_BOOLEAN_CONVERT(metaData & 0x01);
13721 pFileInfo->hdr.bitWStreamMetaData.pbrs = DTS_BOOLEAN_CONVERT(metaData & 0x02);
13722 pFileInfo->hdr.bitWStreamMetaData.navi = DTS_BOOLEAN_CONVERT(metaData & 0x04);
13723 pFileInfo->hdr.bitWStreamMetaData.coreSStrm = DTS_BOOLEAN_CONVERT(metaData & 0x08);
13724 pFileInfo->hdr.bitWStreamMetaData.extSStrm = DTS_BOOLEAN_CONVERT(metaData & 0x10);
13725
13726 /* Read the number of audio presentations */
13727 pFileInfo->hdr.NumAudioPres = headerChunk[12];
13728 }
13729 }
13730
13731 return;
13732 }
13733
AU_CUS_DTS_Parser_dtsDecodeCORESSMD(FILE * fp,dtsHDFileInfo * pFileInfo,dtsUint64 chunkLength)13734 void AU_CUS_DTS_Parser_dtsDecodeCORESSMD(FILE *fp, dtsHDFileInfo *pFileInfo, dtsUint64 chunkLength)
13735 {
13736 dtsUint8 coreChunk[DTS_HD_CORESSMD_MIN_LENGTH_IN_BYTES];
13737 dtsUint8 *srPtr;
13738
13739 if(DTS_HD_CORESSMD_MIN_LENGTH_IN_BYTES <= chunkLength)
13740 {
13741 /* Read the chunk data before parsing */
13742 if(DTS_HD_CORESSMD_MIN_LENGTH_IN_BYTES == fread(coreChunk, 1, DTS_HD_CORESSMD_MIN_LENGTH_IN_BYTES, fp))
13743 {
13744 pFileInfo->coreSSMD.valid = dtsTrue;
13745
13746 /* Read the max sample rate */
13747 pFileInfo->coreSSMD.maxSampleRateHz = 0;
13748 srPtr = (dtsUint8 *)&pFileInfo->coreSSMD.maxSampleRateHz;
13749 memcpy(&srPtr[1], coreChunk, 3);
13750 pFileInfo->coreSSMD.maxSampleRateHz = AU_CUS_DTS_Parser_dtsHDEndianConvert32(pFileInfo->coreSSMD.maxSampleRateHz);
13751
13752 /* Read the bit rate */
13753 memcpy(&pFileInfo->coreSSMD.bitRateKbps, &coreChunk[3], 2);
13754 pFileInfo->coreSSMD.bitRateKbps = AU_CUS_DTS_Parser_dtsHDEndianConvert16(pFileInfo->coreSSMD.bitRateKbps);
13755
13756 /* Read the channel mask */
13757 memcpy(&pFileInfo->coreSSMD.channelMask, &coreChunk[5], 2);
13758 pFileInfo->coreSSMD.channelMask = AU_CUS_DTS_Parser_dtsHDEndianConvert16(pFileInfo->coreSSMD.channelMask);
13759
13760 /* Read the frame payload */
13761 memcpy(&pFileInfo->coreSSMD.framePayloadBytes, &coreChunk[7], 4);
13762 pFileInfo->coreSSMD.framePayloadBytes = AU_CUS_DTS_Parser_dtsHDEndianConvert32(pFileInfo->coreSSMD.framePayloadBytes);
13763
13764 }
13765 }
13766
13767 return;
13768 }
13769
AU_CUS_DTS_Parser_dtsDecodeEXTSSMD(FILE * fp,dtsHDFileInfo * pFileInfo,dtsUint64 chunkLength)13770 void AU_CUS_DTS_Parser_dtsDecodeEXTSSMD(FILE *fp, dtsHDFileInfo *pFileInfo, dtsUint64 chunkLength)
13771 {
13772 dtsUint8 extChunk[DTS_HD_EXTSSMD_MAX_LENGTH_IN_BYTES];
13773 dtsUint8 length;
13774 dtsUint8 *brPtr;
13775
13776 if(DTS_HD_EXTSSMD_MIN_LENGTH_IN_BYTES <= chunkLength)
13777 {
13778 /* This chunk's length is dependent on the hdr */
13779 if(dtsTrue == pFileInfo->hdr.bitWStreamMetaData.vbr)
13780 {
13781 length = DTS_HD_EXTSSMD_MAX_LENGTH_IN_BYTES;
13782 }
13783 else
13784 {
13785 length = DTS_HD_EXTSSMD_MIN_LENGTH_IN_BYTES;
13786 }
13787
13788 /* Read the chunk data before parsing */
13789 if(length == fread(extChunk, 1, length, fp))
13790 {
13791 pFileInfo->extSSMD.valid = dtsTrue;
13792
13793 /* Read the avg bit rate */
13794 pFileInfo->extSSMD.avgBitRateKbps = 0;
13795 brPtr = (dtsUint8 *)&pFileInfo->extSSMD.avgBitRateKbps;
13796 memcpy(&brPtr[1], extChunk, 3);
13797 pFileInfo->extSSMD.avgBitRateKbps = AU_CUS_DTS_Parser_dtsHDEndianConvert32(pFileInfo->extSSMD.avgBitRateKbps);
13798
13799
13800 if(dtsTrue == pFileInfo->hdr.bitWStreamMetaData.vbr)
13801 {
13802 /* Read the peak bit rate */
13803 pFileInfo->extSSMD.peakBitRateKbps = 0;
13804 brPtr = (dtsUint8 *)&pFileInfo->extSSMD.peakBitRateKbps;
13805 memcpy(&brPtr[1], &extChunk[3], 3);
13806 pFileInfo->extSSMD.peakBitRateKbps = AU_CUS_DTS_Parser_dtsHDEndianConvert32(pFileInfo->extSSMD.peakBitRateKbps);
13807
13808
13809 /* Read the pbr smoothing buffer size */
13810 memcpy(&pFileInfo->extSSMD.pbrSmoothBuffSizeKb, &extChunk[6], 2);
13811 pFileInfo->extSSMD.pbrSmoothBuffSizeKb = AU_CUS_DTS_Parser_dtsHDEndianConvert16(pFileInfo->extSSMD.pbrSmoothBuffSizeKb);
13812
13813
13814 pFileInfo->extSSMD.framePayloadBytes = 0;
13815 }
13816 else
13817 {
13818 /* Read the frame payload */
13819 memcpy(&pFileInfo->extSSMD.framePayloadBytes, &extChunk[3], 4);
13820 pFileInfo->extSSMD.framePayloadBytes = AU_CUS_DTS_Parser_dtsHDEndianConvert32(pFileInfo->extSSMD.framePayloadBytes);
13821
13822
13823 pFileInfo->extSSMD.peakBitRateKbps = 0;
13824 pFileInfo->extSSMD.pbrSmoothBuffSizeKb = 0;
13825 }
13826 }
13827 }
13828
13829 return;
13830 }
13831
AU_CUS_DTS_Parser_dtsDecodeAUPRHDR(FILE * fp,dtsHDFileInfo * pFileInfo,dtsUint64 chunkLength)13832 void AU_CUS_DTS_Parser_dtsDecodeAUPRHDR(FILE *fp, dtsHDFileInfo *pFileInfo, dtsUint64 chunkLength)
13833 {
13834 dtsUint8 auprChunk[DTS_HD_AUPRHDR_MAX_LENGTH_IN_BYTES];
13835 dtsUint8 *srPtr, idx;
13836 dtsUint16 metaData;
13837
13838 if(DTS_HD_AUPRHDR_MIN_LENGTH_IN_BYTES <= chunkLength)
13839 {
13840 /* This chunk's length is dependent on it's metadata, read it in two bits */
13841 if(DTS_HD_AUPRHDR_MIN_LENGTH_IN_BYTES == fread(auprChunk, 1, DTS_HD_AUPRHDR_MIN_LENGTH_IN_BYTES, fp))
13842 {
13843 /* Read the index */
13844 idx = auprChunk[0];
13845
13846 if(idx < DTS_HD_MAX_ASSETS)
13847 {
13848 pFileInfo->auPrHdr[idx].valid = dtsTrue;
13849
13850 /* Read the meta data */
13851 memcpy(&metaData, &auprChunk[1], 2);
13852 metaData = AU_CUS_DTS_Parser_dtsHDEndianConvert16(metaData);
13853
13854 pFileInfo->auPrHdr[idx].bitWAupresMetaData.BCCCComp = DTS_BOOLEAN_CONVERT(metaData & 0x01);
13855 pFileInfo->auPrHdr[idx].bitWAupresMetaData.BCCCCompInExtSS = DTS_BOOLEAN_CONVERT(metaData & 0x02);
13856 pFileInfo->auPrHdr[idx].bitWAupresMetaData.LLCComp = DTS_BOOLEAN_CONVERT(metaData & 0x04);
13857 pFileInfo->auPrHdr[idx].bitWAupresMetaData.LBRCComp = DTS_BOOLEAN_CONVERT(metaData & 0x08);
13858
13859 /* Read the sample rate */
13860 pFileInfo->auPrHdr[idx].maxSampleRate = 0;
13861 srPtr = (dtsUint8 *)&pFileInfo->auPrHdr[idx].maxSampleRate;
13862 memcpy(&srPtr[1], &auprChunk[3], 3);
13863 pFileInfo->auPrHdr[idx].maxSampleRate = AU_CUS_DTS_Parser_dtsHDEndianConvert32(pFileInfo->auPrHdr[idx].maxSampleRate);
13864
13865 /* Read the number of frames */
13866 memcpy(&pFileInfo->auPrHdr[idx].numFrames, &auprChunk[6], 4);
13867 pFileInfo->auPrHdr[idx].numFrames = AU_CUS_DTS_Parser_dtsHDEndianConvert32(pFileInfo->auPrHdr[idx].numFrames);
13868
13869 /* Read the samples per frame at max fs */
13870 memcpy(&pFileInfo->auPrHdr[idx].samplesPerFrameMaxFs, &auprChunk[10], 2);
13871 pFileInfo->auPrHdr[idx].samplesPerFrameMaxFs = AU_CUS_DTS_Parser_dtsHDEndianConvert16(pFileInfo->auPrHdr[idx].samplesPerFrameMaxFs);
13872
13873 /* Read the original samples at max fs */
13874 pFileInfo->auPrHdr[idx].numSamplesOrigAudioMaxFs = 0;
13875 srPtr = (dtsUint8 *)&pFileInfo->auPrHdr[idx].numSamplesOrigAudioMaxFs;
13876 memcpy(&srPtr[3], &auprChunk[12], 5);
13877 pFileInfo->auPrHdr[idx].numSamplesOrigAudioMaxFs = AU_CUS_DTS_Parser_dtsHDEndianConvert64(pFileInfo->auPrHdr[idx].numSamplesOrigAudioMaxFs);
13878
13879 /* Read the channel mask */
13880 memcpy(&pFileInfo->auPrHdr[idx].channelMask, &auprChunk[17], 2);
13881 pFileInfo->auPrHdr[idx].channelMask = AU_CUS_DTS_Parser_dtsHDEndianConvert16(pFileInfo->auPrHdr[idx].channelMask);
13882
13883 /* Read the delay */
13884 memcpy(&pFileInfo->auPrHdr[idx].codecDelayMaxFs, &auprChunk[19], 2);
13885 pFileInfo->auPrHdr[idx].codecDelayMaxFs = AU_CUS_DTS_Parser_dtsHDEndianConvert16(pFileInfo->auPrHdr[idx].codecDelayMaxFs);
13886
13887 if((dtsTrue == pFileInfo->auPrHdr[idx].bitWAupresMetaData.BCCCComp) && (dtsTrue == pFileInfo->auPrHdr[idx].bitWAupresMetaData.BCCCCompInExtSS))
13888 {
13889 /* Read another 7 bytes */
13890 if(7 != fread(&auprChunk[DTS_HD_AUPRHDR_MIN_LENGTH_IN_BYTES], 1, 7, fp))
13891 {
13892 pFileInfo->auPrHdr[idx].valid = dtsFalse;
13893 }
13894 else
13895 {
13896 /* Read the core max sample rate */
13897 pFileInfo->auPrHdr[idx].BCCoreMaxSampleRate = 0;
13898 srPtr = (dtsUint8 *)&pFileInfo->auPrHdr[idx].BCCoreMaxSampleRate;
13899 memcpy(&srPtr[1], &auprChunk[DTS_HD_AUPRHDR_MIN_LENGTH_IN_BYTES], 3);
13900 pFileInfo->auPrHdr[idx].BCCoreMaxSampleRate = AU_CUS_DTS_Parser_dtsHDEndianConvert32(pFileInfo->auPrHdr[idx].BCCoreMaxSampleRate);
13901
13902 /* Read the core bit rate */
13903 memcpy(&pFileInfo->auPrHdr[idx].BCCoreBitRate, &auprChunk[DTS_HD_AUPRHDR_MIN_LENGTH_IN_BYTES + 3], 2);
13904 pFileInfo->auPrHdr[idx].BCCoreBitRate = AU_CUS_DTS_Parser_dtsHDEndianConvert16(pFileInfo->auPrHdr[idx].BCCoreBitRate);
13905
13906 /* Read the core channel mask */
13907 memcpy(&pFileInfo->auPrHdr[idx].BCCoreChannelMask, &auprChunk[DTS_HD_AUPRHDR_MIN_LENGTH_IN_BYTES + 5], 2);
13908 pFileInfo->auPrHdr[idx].BCCoreChannelMask = AU_CUS_DTS_Parser_dtsHDEndianConvert16(pFileInfo->auPrHdr[idx].BCCoreChannelMask);
13909 }
13910 }
13911 else
13912 {
13913 pFileInfo->auPrHdr[idx].BCCoreMaxSampleRate = 0;
13914 pFileInfo->auPrHdr[idx].BCCoreBitRate = 0;
13915 pFileInfo->auPrHdr[idx].BCCoreChannelMask = 0;
13916 }
13917
13918 if(dtsTrue == pFileInfo->auPrHdr[idx].bitWAupresMetaData.LLCComp)
13919 {
13920 /* Read another 1 byte */
13921 if(1 != fread(&auprChunk[DTS_HD_AUPRHDR_MIN_LENGTH_IN_BYTES + 7], 1, 1, fp))
13922 {
13923 pFileInfo->auPrHdr[idx].valid = dtsFalse;
13924 }
13925 else
13926 {
13927 /* Read the core bit rate */
13928 pFileInfo->auPrHdr[idx].LSBTrimPercent = auprChunk[DTS_HD_AUPRHDR_MIN_LENGTH_IN_BYTES + 7];
13929 }
13930 }
13931 else
13932 {
13933 pFileInfo->auPrHdr[idx].LSBTrimPercent = 0;
13934 }
13935 }
13936 }
13937 }
13938
13939 return;
13940 }
13941
AU_CUS_DTS_Parser_dtsDecodeSTRMDATA(FILE * fp,dtsHDFileInfo * pFileInfo,dtsUint64 chunkLength)13942 void AU_CUS_DTS_Parser_dtsDecodeSTRMDATA(FILE *fp, dtsHDFileInfo *pFileInfo, dtsUint64 chunkLength)
13943 {
13944 /* Initialise the structure */
13945 pFileInfo->data.bytesRead = 0;
13946 pFileInfo->data.streamDataByteSize = chunkLength;
13947 pFileInfo->eof = dtsFalse;
13948
13949 /* Record the current position in the file */
13950 fgetpos(fp, &pFileInfo->data.currentFilePosition);
13951
13952 pFileInfo->data.valid = dtsTrue;
13953 memcpy(&pFileInfo->data.positionStartOfData, &pFileInfo->data.currentFilePosition, sizeof(fpos_tt));
13954
13955 return;
13956 }
13957
AU_CUS_DTS_Parser_dtsDecodeNAVITBL(FILE * fp,dtsHDFileInfo * pFileInfo,dtsUint64 chunkLength)13958 void AU_CUS_DTS_Parser_dtsDecodeNAVITBL(FILE *fp, dtsHDFileInfo *pFileInfo, dtsUint64 chunkLength)
13959 {
13960 dtsUint8 naviChunk[DTS_HD_NAVITBL_MIN_LENGTH_IN_BYTES];
13961
13962 if(DTS_HD_NAVITBL_MIN_LENGTH_IN_BYTES <= chunkLength)
13963 {
13964 /* Read the first 3 fields */
13965 if(DTS_HD_NAVITBL_MIN_LENGTH_IN_BYTES == fread(naviChunk, 1, DTS_HD_NAVITBL_MIN_LENGTH_IN_BYTES, fp))
13966 {
13967 pFileInfo->navi.valid = dtsTrue;
13968
13969 /* Read the number of entries */
13970 memcpy(&pFileInfo->navi.numEntries, naviChunk, 4);
13971 pFileInfo->navi.numEntries = AU_CUS_DTS_Parser_dtsHDEndianConvert32(pFileInfo->navi.numEntries);
13972
13973
13974 /* Read the interval in frames */
13975 memcpy(&pFileInfo->navi.intervalFrames, &naviChunk[4], 2);
13976 pFileInfo->navi.intervalFrames = AU_CUS_DTS_Parser_dtsHDEndianConvert16(pFileInfo->navi.intervalFrames);
13977
13978
13979 /* Read the entry size */
13980 pFileInfo->navi.entrySize = naviChunk[6];
13981
13982 /* Record the start of the table postion */
13983 fgetpos(fp, &pFileInfo->navi.tblEntryStartPos);
13984
13985 }
13986 }
13987
13988 return;
13989 }
13990
AU_CUS_DTS_Parser_dtsDecodeBUILDVER(FILE * fp,dtsHDFileInfo * pFileInfo,dtsUint64 chunkLength)13991 void AU_CUS_DTS_Parser_dtsDecodeBUILDVER(FILE *fp, dtsHDFileInfo *pFileInfo, dtsUint64 chunkLength)
13992 {
13993 dtsUint8 bldVerChunk[DTS_HD_BUILDVER_MAX_LENGTH_IN_BYTES];
13994 unsigned int toRead;
13995
13996 if(DTS_HD_BUILDVER_MAX_LENGTH_IN_BYTES < chunkLength)
13997 {
13998 toRead = DTS_HD_BUILDVER_MAX_LENGTH_IN_BYTES;
13999 }
14000 else
14001 {
14002 toRead = (unsigned int)chunkLength;
14003 }
14004
14005 /* Read the data */
14006 if(toRead == fread(bldVerChunk, 1, toRead, fp))
14007 {
14008 pFileInfo->bldVer.valid = dtsTrue;
14009 memcpy(&pFileInfo->bldVer.data, bldVerChunk, toRead);
14010 }
14011
14012 return;
14013 }
14014
AU_CUS_DTS_Parser_dtsDecodeTIMECODE(FILE * fp,dtsHDFileInfo * pFileInfo,dtsUint64 chunkLength)14015 void AU_CUS_DTS_Parser_dtsDecodeTIMECODE(FILE *fp, dtsHDFileInfo *pFileInfo, dtsUint64 chunkLength)
14016 {
14017 dtsUint8 timeChunk[DTS_HD_TIMECODE_MIN_LENGTH_IN_BYTES];
14018
14019 if(DTS_HD_TIMECODE_MIN_LENGTH_IN_BYTES <= chunkLength)
14020 {
14021 if(DTS_HD_TIMECODE_MIN_LENGTH_IN_BYTES == fread(timeChunk, 1, DTS_HD_TIMECODE_MIN_LENGTH_IN_BYTES, fp))
14022 {
14023 pFileInfo->timecode.valid = dtsTrue;
14024
14025 /* Read the clock */
14026 memcpy(&pFileInfo->timecode.clock, timeChunk, 4);
14027 pFileInfo->timecode.clock = AU_CUS_DTS_Parser_dtsHDEndianConvert32(pFileInfo->timecode.clock);
14028
14029 /* Read the frame rate */
14030 pFileInfo->timecode.frameRate = timeChunk[4];
14031
14032 /* Read the start samples since midnight */
14033 memcpy(&pFileInfo->timecode.startSampSinceMidnight, &timeChunk[5], 8);
14034 pFileInfo->timecode.startSampSinceMidnight = AU_CUS_DTS_Parser_dtsHDEndianConvert64(pFileInfo->timecode.startSampSinceMidnight);
14035
14036 /* calculate the end samples since midnight */
14037 pFileInfo->timecode.endSampSinceMidnight = pFileInfo->timecode.startSampSinceMidnight + pFileInfo->auPrHdr[0].numSamplesOrigAudioMaxFs;
14038
14039 /* Read the start residual */ //not used
14040 memcpy(&pFileInfo->timecode.startResidual, &timeChunk[13], 4);
14041 pFileInfo->timecode.startResidual = AU_CUS_DTS_Parser_dtsHDEndianConvert32(pFileInfo->timecode.startResidual);
14042
14043 /* Read the reference samples since midnight */ //not used
14044 memcpy(&pFileInfo->timecode.refSampSinceMidnight, &timeChunk[17], 8);
14045 pFileInfo->timecode.refSampSinceMidnight = AU_CUS_DTS_Parser_dtsHDEndianConvert64(pFileInfo->timecode.refSampSinceMidnight);
14046
14047 /* Read the reference residual */ //not used
14048 memcpy(&pFileInfo->timecode.refResidual, &timeChunk[25], 4);
14049 pFileInfo->timecode.refResidual = AU_CUS_DTS_Parser_dtsHDEndianConvert32(pFileInfo->timecode.refResidual);
14050 }
14051 }
14052
14053 return;
14054 }
14055
AU_CUS_DTS_Parser_dtsIsHDFile(FILE * fp,dtsBoolean * isHDFile)14056 dtsBoolean AU_CUS_DTS_Parser_dtsIsHDFile(FILE *fp, dtsBoolean *isHDFile)
14057 {
14058 dtsUint8 chunkId[DTS_HD_CHUNK_ID_LENGTH];
14059
14060 /* Assume that the file is not an HD file */
14061 *isHDFile = dtsFalse;
14062
14063 /* Make sure this is the start of the file */
14064 fseek(fp, 0, SEEK_SET);
14065
14066 /* Read the chunkId from the file */
14067 if(DTS_HD_CHUNK_ID_LENGTH != fread(chunkId, 1, DTS_HD_CHUNK_ID_LENGTH, fp))
14068 return dtsFalse;
14069
14070 /* Check to see if it says the correct thing */
14071 if(0 == memcmp(chunkId, DTS_HD_CHUNK_HDR, DTS_HD_CHUNK_ID_LENGTH))
14072 {
14073 *isHDFile = dtsTrue;
14074 }
14075
14076 return dtsTrue;
14077 }
14078
AU_CUS_DTS_Parser_decodeChunkAndAdvance(FILE * fp,dtsUint8 * chunkId,dtsHDFileInfo * pFileInfo)14079 dtsBoolean AU_CUS_DTS_Parser_decodeChunkAndAdvance(FILE *fp, dtsUint8 *chunkId, dtsHDFileInfo *pFileInfo)
14080 {
14081 dtsBoolean okToContinue = dtsTrue;
14082 dtsUint64 chunkSize;
14083
14084 if(DTS_HD_CHUNK_LENGTH_LENGTH != fread(&chunkSize, 1, DTS_HD_CHUNK_LENGTH_LENGTH, fp))
14085 return dtsFalse;
14086
14087 chunkSize = AU_CUS_DTS_Parser_dtsHDEndianConvert64(chunkSize);
14088 AU_CUS_DTS_Parser_dtsHDDecodeChunk(fp, chunkId, chunkSize, pFileInfo);
14089
14090 if(0 != fseek(fp, chunkSize, SEEK_CUR)) //seek to next chunk
14091 return dtsFalse;
14092
14093 return okToContinue;
14094 }
14095
AU_CUS_DTS_Parser_dtsHDChunksInit(dtsHDFileInfo * pFileInfo)14096 void AU_CUS_DTS_Parser_dtsHDChunksInit(dtsHDFileInfo *pFileInfo)
14097 {
14098 dtsUint8 i;
14099
14100 for(i = 0; i < DTS_HD_MAX_ASSETS; i++)
14101 {
14102 pFileInfo->auPrHdr[i].valid = dtsFalse;
14103 }
14104
14105 pFileInfo->hdr.valid = dtsFalse;
14106 pFileInfo->coreSSMD.valid = dtsFalse;
14107 pFileInfo->extSSMD.valid = dtsFalse;
14108 pFileInfo->data.valid = dtsFalse;
14109 pFileInfo->navi.valid = dtsFalse;
14110 pFileInfo->bldVer.valid = dtsFalse;
14111 pFileInfo->timecode.valid = dtsFalse;
14112 }
14113
AU_CUS_DTS_Parser_dtsHDFileInitRead(FILE * fp,dtsHDFileInfo * pFileInfo)14114 dtsBoolean AU_CUS_DTS_Parser_dtsHDFileInitRead(FILE *fp, dtsHDFileInfo *pFileInfo)
14115 {
14116 dtsUint8 chunkId[DTS_HD_CHUNK_ID_LENGTH + 1];
14117 unsigned int amountRead;
14118 HDParserState decodeState = HD_PS_START;
14119
14120 /* Set all chunks to invalid */
14121 AU_CUS_DTS_Parser_dtsHDChunksInit(pFileInfo);
14122
14123 /* Move to the start of the file */
14124 fseek(fp, 0, SEEK_SET);
14125
14126 while(decodeState != HD_PS_EOF)
14127 {
14128 /* Re-initialise the chunk id */
14129 memset(chunkId, 0, sizeof(chunkId));
14130
14131 /* Read the next chunk */
14132 amountRead = fread(chunkId, 1, DTS_HD_CHUNK_ID_LENGTH, fp);
14133
14134 /* enter HD file parser state machine */
14135 switch(decodeState)
14136 {
14137 case HD_PS_START: /* Check for HD header chunk */
14138 {
14139 //chunkId = "DTSHDHDR"
14140 if((DTS_HD_CHUNK_ID_LENGTH == amountRead) && (0 == memcmp(chunkId, DTS_HD_CHUNK_HDR, DTS_HD_CHUNK_ID_LENGTH)))
14141 {
14142 decodeState = HD_PS_HDR_FOUND;
14143 AU_CUS_DTS_Parser_decodeChunkAndAdvance(fp, chunkId, pFileInfo);
14144 }
14145 else
14146 {
14147 return dtsFalse;
14148 }
14149 }
14150 break;
14151
14152 case HD_PS_HDR_FOUND:
14153 {
14154 if(DTS_HD_CHUNK_ID_LENGTH == amountRead)
14155 {
14156 if(0 == memcmp(chunkId, DTS_HD_CHUNK_STRMDATA, DTS_HD_CHUNK_ID_LENGTH)) //chunkId = "STRMDATA"
14157 {
14158 decodeState = HD_PS_STREAM_FOUND;
14159 }
14160 AU_CUS_DTS_Parser_decodeChunkAndAdvance(fp, chunkId, pFileInfo);
14161 }
14162 else
14163 {
14164 return dtsFalse;
14165 }
14166 }
14167 break;
14168
14169 case HD_PS_STREAM_FOUND:
14170 if(amountRead == 0)
14171 {
14172 fsetpos(fp, &pFileInfo->data.currentFilePosition);
14173 decodeState = HD_PS_EOF;
14174 }
14175 else if(amountRead == DTS_HD_CHUNK_ID_LENGTH)
14176 AU_CUS_DTS_Parser_decodeChunkAndAdvance(fp, chunkId, pFileInfo);
14177 else
14178 return dtsFalse;
14179 break;
14180
14181 default:
14182 break;
14183 }
14184 }
14185
14186 return dtsTrue;
14187 }
14188
AU_CUS_DTS_Parser_dtsHDFileRead(FILE * fp,dtsUint8 * pBytes,dtsUint32 numberOfBytesToRead,dtsHDFileInfo * pFileInfo)14189 dtsBoolean AU_CUS_DTS_Parser_dtsHDFileRead(FILE *fp, dtsUint8 *pBytes, dtsUint32 numberOfBytesToRead, dtsHDFileInfo *pFileInfo)
14190 {
14191 dtsBoolean okToContinue = dtsTrue;
14192 fpos_tt oldPosition;
14193
14194 /* Check to see that there are enough bytes left in the chunk to read */
14195 if(pFileInfo->data.bytesRead + numberOfBytesToRead > pFileInfo->data.streamDataByteSize)
14196 {
14197 pFileInfo->eof = dtsTrue;
14198 return dtsFalse;
14199 }
14200
14201 if(0 != fgetpos(fp, &oldPosition))
14202 return dtsFalse;
14203
14204 if(0 != fsetpos(fp, &pFileInfo->data.currentFilePosition))
14205 return dtsFalse;
14206
14207 fread(pBytes, 1, numberOfBytesToRead, fp);
14208
14209 pFileInfo->data.bytesRead += numberOfBytesToRead;
14210
14211 if(0 != fgetpos(fp, &pFileInfo->data.currentFilePosition))
14212 return dtsFalse;
14213
14214 if(0 != fsetpos(fp, &oldPosition))
14215 return dtsFalse;
14216
14217 return okToContinue;
14218 }
14219
AU_CUS_DTS_Parser_dtsReadWavFileHeader(FILE * fp,dtsWavFileHeader * header)14220 static dtsBoolean AU_CUS_DTS_Parser_dtsReadWavFileHeader(FILE *fp, dtsWavFileHeader *header)
14221 {
14222 dtsBoolean okToContinue = dtsTrue;
14223
14224 if(0 != fseek(fp, 0, SEEK_SET))
14225 return dtsFalse;
14226
14227 /* Read the file id */
14228 if(DTS_WAV_FILE_ID_LENGTH != fread(header->id, 1, DTS_WAV_FILE_ID_LENGTH, fp))
14229 return dtsFalse;
14230
14231 /* Read the length of the file */
14232 if(4 != fread(&header->length, 1, 4, fp))
14233 return dtsFalse;
14234
14235 /* Read the content of the wav file */
14236 if(DTS_WAV_FILE_CONTENT_LENGTH != fread(header->content, 1, DTS_WAV_FILE_CONTENT_LENGTH, fp))
14237 return dtsFalse;
14238
14239 return okToContinue;
14240 }
14241
AU_CUS_DTS_Parser_dtsWavFileHeaderIsValid(dtsWavFileHeader * header)14242 static dtsBoolean AU_CUS_DTS_Parser_dtsWavFileHeaderIsValid(dtsWavFileHeader *header)
14243 {
14244 dtsBoolean headerIsValid = dtsFalse;
14245
14246 if(0 == memcmp(header->id, DTS_WAV_FILE_IDENTIFIER, DTS_WAV_FILE_ID_LENGTH))
14247 {
14248 if(0 == memcmp(header->content, DTS_WAV_FILE_CONTENT, DTS_WAV_FILE_CONTENT_LENGTH))
14249 {
14250 headerIsValid = dtsTrue;
14251 }
14252 }
14253
14254 return headerIsValid;
14255 }
14256
AU_CUS_DTS_Parser_dtsWavFileLocateChunk(FILE * fp,const char * chunkId)14257 static dtsBoolean AU_CUS_DTS_Parser_dtsWavFileLocateChunk(FILE *fp, const char *chunkId)
14258 {
14259 dtsBoolean okToContinue = dtsTrue;
14260 dtsUint8 fileChunkId[DTS_WAV_FILE_CHUNK_ID_LENGTH];
14261 dtsBoolean chunkFound;
14262 dtsUint32 chunkLength;
14263
14264 /* Indicate that the chunk has not been found */
14265 chunkFound = dtsFalse;
14266 while((dtsFalse == chunkFound) && (dtsTrue == okToContinue))
14267 {
14268 if(DTS_WAV_FILE_CHUNK_ID_LENGTH != fread(fileChunkId, 1, DTS_WAV_FILE_CHUNK_ID_LENGTH, fp))
14269 {
14270 okToContinue = dtsFalse;
14271 }
14272 else
14273 {
14274 if(0 == memcmp(fileChunkId, chunkId, DTS_WAV_FILE_CHUNK_ID_LENGTH))
14275 {
14276 chunkFound = dtsTrue;
14277 }
14278 else
14279 {
14280 /* Read the length of the chunk */
14281 if(DTS_WAV_FILE_CHUNK_LENGTH_LENGTH != fread(&chunkLength, 1, 4, fp))
14282 {
14283 okToContinue = dtsFalse;
14284 }
14285 else
14286 {
14287 /* Move to the next position */
14288 if(0 != fseek(fp, chunkLength, SEEK_CUR))
14289 {
14290 okToContinue = dtsFalse;
14291 }
14292 }
14293 }
14294 }
14295
14296 } /* End of while statememt */
14297
14298 if(dtsTrue == okToContinue)
14299 {
14300 okToContinue = chunkFound;
14301 }
14302
14303 return okToContinue;
14304 }
14305
AU_CUS_DTS_Parser_dtsIsWavFile(FILE * fp,dtsBoolean * isWavFile)14306 dtsBoolean AU_CUS_DTS_Parser_dtsIsWavFile(FILE *fp, dtsBoolean *isWavFile)
14307 {
14308 dtsBoolean okToContinue = dtsFalse;
14309 dtsWavFileHeader header;
14310
14311 /* Assume that it is not a wav file */
14312 *isWavFile = dtsFalse;
14313
14314 /* Read the header */
14315 okToContinue = AU_CUS_DTS_Parser_dtsReadWavFileHeader(fp, &header);
14316
14317 /* Check to see if it is valid */
14318 if(dtsTrue == okToContinue)
14319 {
14320 *isWavFile = AU_CUS_DTS_Parser_dtsWavFileHeaderIsValid(&header);
14321 }
14322
14323 return okToContinue;
14324 }
14325
AU_CUS_DTS_Parser_dtsWavFileInitRead(FILE * fp,dtsWavFileInfo * pFileInfo)14326 dtsBoolean AU_CUS_DTS_Parser_dtsWavFileInitRead(FILE *fp, dtsWavFileInfo *pFileInfo)
14327 {
14328 dtsBoolean okToContinue = dtsFalse;
14329 dtsWavFileHeader header;
14330 dtsUint32 chunkLength = 0;
14331 dtsUint8 formatBuffer[DTS_WAV_FILE_FORMAT_PCM_CHUNK_PAYLOAD_SIZE];
14332 dtsUint32 formatBufferIndex;
14333
14334 /* Only interested in reading */
14335 pFileInfo->isWritable = dtsFalse;
14336
14337 /* Read the header */
14338 okToContinue = AU_CUS_DTS_Parser_dtsReadWavFileHeader(fp, &header);
14339 if(dtsTrue == okToContinue)
14340 {
14341 /* Check that it is a valid wav file */
14342 okToContinue = AU_CUS_DTS_Parser_dtsWavFileHeaderIsValid(&header);
14343 }
14344
14345 /* Find the format chunk */
14346 if(dtsTrue == okToContinue)
14347 {
14348 if(dtsTrue == AU_CUS_DTS_Parser_dtsWavFileLocateChunk(fp, DTS_WAV_FILE_FORMAT_CHUNK_ID))
14349 {
14350 /* Read the length of the chunk */
14351 if(dtsUint32SizeBytes != fread(&chunkLength, 1, 4, fp))
14352 {
14353 okToContinue = dtsFalse;
14354 }
14355 }
14356 else
14357 {
14358 okToContinue = dtsFalse;
14359 }
14360 }
14361
14362 /* Verify the length and read the rest of the format */
14363 if(dtsTrue == okToContinue)
14364 {
14365 if(chunkLength != DTS_WAV_FILE_FORMAT_PCM_CHUNK_PAYLOAD_SIZE)
14366 {
14367 okToContinue = dtsFalse;
14368 }
14369 else
14370 {
14371 if(DTS_WAV_FILE_FORMAT_PCM_CHUNK_PAYLOAD_SIZE != fread(formatBuffer, 1, DTS_WAV_FILE_FORMAT_PCM_CHUNK_PAYLOAD_SIZE, fp))
14372 {
14373 okToContinue = dtsFalse;
14374 }
14375 else
14376 {
14377 /* Read each of the fields from the chunk data */
14378 formatBufferIndex = 0;
14379 memcpy(&pFileInfo->format.wFormatTag, &formatBuffer[formatBufferIndex], sizeof(pFileInfo->format.wFormatTag));
14380 pFileInfo->format.wFormatTag = (pFileInfo->format.wFormatTag);
14381 formatBufferIndex += sizeof(pFileInfo->format.wFormatTag);
14382 memcpy(&pFileInfo->format.wChannels, &formatBuffer[formatBufferIndex], sizeof(pFileInfo->format.wChannels));
14383 pFileInfo->format.wChannels = (pFileInfo->format.wChannels);
14384 formatBufferIndex += sizeof(pFileInfo->format.wChannels);
14385 memcpy(&pFileInfo->format.dwSamplesPerSec, &formatBuffer[formatBufferIndex], sizeof(pFileInfo->format.dwSamplesPerSec));
14386 pFileInfo->format.dwSamplesPerSec = (pFileInfo->format.dwSamplesPerSec);
14387 formatBufferIndex += sizeof(pFileInfo->format.dwSamplesPerSec);
14388 memcpy(&pFileInfo->format.dwAvgBytesPerSec, &formatBuffer[formatBufferIndex], sizeof(pFileInfo->format.dwAvgBytesPerSec));
14389 pFileInfo->format.dwAvgBytesPerSec = (pFileInfo->format.dwAvgBytesPerSec);
14390 formatBufferIndex += sizeof(pFileInfo->format.dwAvgBytesPerSec);
14391 memcpy(&pFileInfo->format.wBlockAlign, &formatBuffer[formatBufferIndex], sizeof(pFileInfo->format.wBlockAlign));
14392 pFileInfo->format.wBlockAlign = (pFileInfo->format.wBlockAlign);
14393 formatBufferIndex += sizeof(pFileInfo->format.wBlockAlign);
14394 memcpy(&pFileInfo->format.wBitsPerSample, &formatBuffer[formatBufferIndex], sizeof(pFileInfo->format.wBitsPerSample));
14395 pFileInfo->format.wBitsPerSample = (pFileInfo->format.wBitsPerSample);
14396
14397 /* Check that the format tag says PCM */
14398 if(DTS_WAV_FILE_FORMAT_PCM_ID != pFileInfo->format.wFormatTag)
14399 {
14400 okToContinue = dtsFalse;
14401 }
14402 }
14403 }
14404 }
14405
14406 /* Read the header from the data chunk ... always occurs sometime after a format chunk */
14407 if(dtsTrue == okToContinue)
14408 {
14409 if(dtsTrue == AU_CUS_DTS_Parser_dtsWavFileLocateChunk(fp, DTS_WAV_FILE_DATA_CHUNK_ID))
14410 {
14411 /* Read the length of the chunk */
14412 if(dtsUint32SizeBytes !=fread(&chunkLength, 1, 4, fp))
14413 {
14414 okToContinue = dtsFalse;
14415 }
14416 else
14417 {
14418 /* Store the length */
14419 pFileInfo->data.lengthInBytes = chunkLength;
14420
14421 /* Initialise the number of bytes read from the chunk */
14422 pFileInfo->data.bytesRead = 0;
14423
14424 /* This is not the end of the file */
14425 pFileInfo->eof = dtsFalse;
14426
14427 /* Read the current position in the file */
14428 fgetpos(fp, &pFileInfo->readInfo.nextReadPosition);
14429 }
14430 }
14431 else
14432 {
14433 okToContinue = dtsFalse;
14434 }
14435 }
14436
14437 pFileInfo->isInit = okToContinue;
14438
14439 return okToContinue;
14440 }
14441
AU_CUS_DTS_Parser_ParseInputFile(const char * pFileName)14442 dtsBoolean AU_CUS_DTS_Parser_ParseInputFile(const char *pFileName)
14443 {
14444 dtsBoolean okToContinue = dtsTrue;
14445 dtsBoolean isFileType = dtsFalse;
14446 uint32_t totalbytes; /* number of bytes in input file */
14447 FILE *p_infile;
14448
14449 p_infile = fopen(pFileName, "rb");
14450
14451 if (p_infile == NULL)
14452 {
14453 printf("input open file FAIL %s\n", pFileName);
14454 return dtsFalse;
14455 }
14456 fseek(p_infile, 0, SEEK_END);
14457 totalbytes = ftell(p_infile);
14458 fseek(p_infile, 0, SEEK_SET);
14459
14460 if (totalbytes == 0)
14461 return (dtsFalse);
14462
14463 //---found DTS WAV file---
14464 if(AU_CUS_DTS_Parser_dtsIsWavFile(p_infile, &isFileType) != dtsTrue)
14465 return dtsFalse;
14466
14467 if(isFileType == dtsTrue)
14468 {
14469 /* Initialise the wav file */
14470 dtsfile_info.type = DTS_FILETYPE_WAV;
14471 okToContinue = AU_CUS_DTS_Parser_dtsWavFileInitRead(p_infile, &dtsfile_info.info.wav);
14472 return okToContinue;
14473 }
14474
14475 //---found DTS HD file---
14476 if(AU_CUS_DTS_Parser_dtsIsHDFile(p_infile, &isFileType) != dtsTrue)
14477 return dtsFalse;
14478
14479 if(dtsTrue == isFileType)
14480 {
14481 dtsfile_info.type = DTS_FILETYPE_DTSHD;
14482
14483 //parse each chunk in the file, until to file-ending.
14484 okToContinue = AU_CUS_DTS_Parser_dtsHDFileInitRead(p_infile, &dtsfile_info.info.dtshd);
14485 }
14486 else
14487 {
14488 //---found PCM file---
14489 dtsfile_info.type = DTS_FILETYPE_RAW_PCM;
14490 if (-1 == fseek(p_infile, 0, SEEK_END))
14491 return dtsFalse;
14492
14493 dtsfile_info.info.pcm.size = (dtsUint32)ftell(p_infile);
14494 rewind(p_infile);
14495 }
14496 #if 0
14497 *inputFile = p_infile;
14498 #endif
14499 pAU_debug_input_file = p_infile;
14500
14501 return okToContinue;
14502 }
14503 #endif //#if(DTS_AUDIO_PARSER_ENABLE)
14504
14505 #if(WMA_AUDIO_PARSER_ENABLE)
AU_CUS_WMA_Parser_Buf_Update(int bRead,unsigned int u32Size,Buffer_Control_t * pBuf)14506 int AU_CUS_WMA_Parser_Buf_Update(int bRead, unsigned int u32Size, Buffer_Control_t* pBuf)
14507 {
14508 int iRV = 0;
14509 if(bRead == 1)
14510 {
14511 unsigned char* pRPtr = pBuf->pRptr + u32Size;
14512
14513 if(pRPtr > pBuf->pEndAddr)
14514 {
14515 WMA_DBG_PRINT(printf("=== rptr(0x%x), endptr(0x%x) === \n", (unsigned int)pRPtr, (unsigned int)pBuf->pEndAddr));
14516 iRV = -1;
14517 }
14518 else
14519 {
14520 pBuf->consumed_bytes += u32Size;
14521 pBuf->pRptr += u32Size;
14522 pBuf->u32Level -= u32Size;
14523
14524 // all data finish, reset pointer
14525 if(pBuf->u32Level == 0)
14526 {
14527 pBuf->pRptr = pBuf->pStartAddr;
14528 pBuf->pWptr = pBuf->pStartAddr;
14529 }
14530 }
14531 }
14532 else
14533 {
14534 unsigned char* pWPtr = pBuf->pWptr + u32Size;
14535
14536 if(pWPtr > pBuf->pEndAddr)
14537 {
14538 iRV = -1;
14539 }
14540 else
14541 {
14542 pBuf->pWptr += u32Size;
14543 pBuf->u32Level += u32Size;
14544 }
14545 }
14546
14547 return iRV;
14548 }
14549
AU_CUS_WMA_Parser_DecodeFifoFeed(void)14550 int AU_CUS_WMA_Parser_DecodeFifoFeed(void)
14551 {
14552 Buffer_Control_t* pDecodeBuf = &sDecodeFifo_Info;
14553 unsigned int u32SizeGet = 0;
14554 unsigned int u32RequestSize = pDecodeBuf->u32Size - pDecodeBuf->u32Level; // remain buffer space
14555 int iRV = 0;
14556
14557 if (u32RequestSize <= 0)
14558 {
14559 WMA_DBG_PRINT(printf("=== no enough ES in framework, fail to fill decode fifo, request_Size(0x%x) \n", u32RequestSize));
14560 iRV = -1;
14561 return iRV;
14562 }
14563
14564 if (0 != fseek (g_wmaInput_fp, (unsigned int)u64FileOffset, SEEK_SET))
14565 {
14566 return iRV;
14567 }
14568
14569 if (pDecodeBuf->u32Level != 0)
14570 {
14571 memmove(pDecodeBuf->pStartAddr, pDecodeBuf->pRptr, (size_t)pDecodeBuf->u32Level);
14572 pDecodeBuf->pWptr = pDecodeBuf->pStartAddr + pDecodeBuf->u32Level;
14573 pDecodeBuf->pRptr = pDecodeBuf->pStartAddr;
14574 }
14575
14576 u32SizeGet = fread(pDecodeBuf->pWptr , 1, (size_t)u32RequestSize, g_wmaInput_fp);
14577
14578 if (u32SizeGet == 0)
14579 {
14580 return iRV;
14581 }
14582
14583 if (u32SizeGet < u32RequestSize)
14584 {
14585 printf("\n !!! EOF !!! , request size(0x%x), get size(0x%x)\n", (unsigned int)u32RequestSize, (unsigned int)u32SizeGet);
14586 bEOF = 1;
14587 }
14588
14589 AU_CUS_WMA_Parser_Buf_Update(BUF_WRITE, u32SizeGet, pDecodeBuf);
14590
14591 WMA_DBG_PRINT(printf("=== SizeRequest: (%d), SizeGet: (%d), Offset (%d), === \n", (int)u32RequestSize, (int)u32SizeGet, (int)u64FileOffset));
14592
14593 u64FileOffset += u32SizeGet;
14594
14595 return iRV;
14596 }
14597
14598 // When previous and current file offset mismatch , need to skip bytes, either backward or forward
AU_CUS_WMA_Parser_WMAEsSkip(int bJumpForward,unsigned int u32SkipSize,Buffer_Control_t * pBuf)14599 unsigned int AU_CUS_WMA_Parser_WMAEsSkip(int bJumpForward, unsigned int u32SkipSize, Buffer_Control_t* pBuf)
14600 {
14601 int iRV = 0;
14602
14603 if(bJumpForward == 1)
14604 {
14605 // jump to the future --> flush ES bytes, read pointer increase
14606 pBuf->u32Level -= u32SkipSize;
14607 pBuf->pRptr += u32SkipSize;
14608 }
14609 else
14610 {
14611 // jump to the past, --> reduce read pointer
14612 pBuf->u32Level += u32SkipSize;
14613 pBuf->pRptr -= u32SkipSize;
14614 }
14615
14616 return iRV;
14617 }
14618
AU_CUS_WMA_Parser_WMAGetData(unsigned long long offset,unsigned int num_bytes,char ** ppData)14619 unsigned int AU_CUS_WMA_Parser_WMAGetData(unsigned long long offset, unsigned int num_bytes, char **ppData)
14620 {
14621 Buffer_Control_t* pBuf = &sDecodeFifo_Info;
14622 unsigned int u32BytesSkip = 0;
14623 int bJumpForward = 1;
14624 unsigned int u32SizeGet = num_bytes;
14625 unsigned long long *pExpectOffset = &u64offset_expect;
14626
14627 AU_CUS_WMA_Parser_DecodeFifoFeed();
14628 WMA_DBG_PRINT(printf("=== AU_CUS_WMA_Parser_WMAGetData, offset(0x%x), size(%d), expect_offset(0x%x), level(%d) === \n", (unsigned int)offset, (int)num_bytes, (unsigned int)*pExpectOffset, (int)pBuf->u32Level));
14629
14630 if (pBuf->u32Level < MaxRequestSize)
14631 {
14632 WMA_DBG_PRINT(printf("=== not enough ES data for feeding, wait state === \n"));
14633 return 0;
14634 }
14635
14636 // if expected offset doesn't equal real offset, means skip bytes happens, handle carefully
14637 if(offset > *pExpectOffset)
14638 {
14639 u32BytesSkip = offset - *pExpectOffset;
14640
14641 if(u32BytesSkip <= pBuf->u32Level)
14642 {
14643 AU_CUS_WMA_Parser_WMAEsSkip(bJumpForward, u32BytesSkip, pBuf);
14644
14645 u32BytesSkip = 0;
14646 }
14647 else
14648 {
14649 while(u32BytesSkip)
14650 {
14651 WMA_DBG_PRINT(printf("=== Remain skip bytes (%d) === \n ", (int)u32BytesSkip));
14652 if(u32BytesSkip > pBuf->u32Level)
14653 {
14654 u32BytesSkip -= pBuf->u32Level;
14655
14656 AU_CUS_WMA_Parser_WMAEsSkip(bJumpForward, pBuf->u32Level, pBuf);
14657
14658 pBuf->pRptr = pBuf->pStartAddr;
14659 pBuf->pWptr = pBuf->pStartAddr;
14660 }
14661 else
14662 {
14663 AU_CUS_WMA_Parser_WMAEsSkip(bJumpForward, u32BytesSkip, pBuf);
14664
14665 u32BytesSkip = 0;
14666 }
14667
14668 u32BytesSkip = u32BytesSkip;
14669
14670 // if feeding fail, no new data in ES buffer
14671 if (AU_CUS_WMA_Parser_DecodeFifoFeed() != 0)
14672 {
14673 WMA_DBG_PRINT(puts("=== AU_CUS_WMA_Parser_DecodeFifoFeed fail === \n"));
14674 break;
14675 }
14676 }
14677
14678 }
14679 }
14680 else if (offset < *pExpectOffset)
14681 {
14682 u32BytesSkip = *pExpectOffset - offset;
14683 bJumpForward = 0;
14684
14685 AU_CUS_WMA_Parser_WMAEsSkip(bJumpForward, u32BytesSkip, pBuf);
14686 }
14687
14688 if (pBuf->u32Level < num_bytes)
14689 {
14690 u32SizeGet = pBuf->u32Level;
14691 }
14692
14693 *ppData = (char*)pBuf->pRptr;
14694
14695 // prepare for next round check
14696 *pExpectOffset = offset + u32SizeGet;
14697
14698 // update level, read pointer
14699 AU_CUS_WMA_Parser_Buf_Update(BUF_READ, u32SizeGet, pBuf);
14700
14701 return u32SizeGet;
14702 }
14703
AU_CUS_WMA_Parser_LoadHeaderObject(tWMAFileHdrStateInternal * pInt)14704 WMAERR AU_CUS_WMA_Parser_LoadHeaderObject(tWMAFileHdrStateInternal *pInt)
14705 {
14706 GUID objectId;
14707 QWORD qwSize;
14708 unsigned int cHeaders =0;
14709 unsigned char align =0;
14710 unsigned char arch =0;
14711
14712 unsigned char *pData = NULL;
14713 unsigned int cbActual =0;
14714 unsigned int cbWanted =0;
14715
14716 if(pInt == NULL)
14717 {
14718 return WMAERR_INVALIDARG;
14719 }
14720
14721 cbWanted = MIN_OBJECT_SIZE + sizeof(unsigned int) + 2*sizeof(unsigned char);
14722 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset, cbWanted, (char**)&pData);
14723
14724 if(cbActual != cbWanted)
14725 {
14726 return WMAERR_BUFFERTOOSMALL;
14727 }
14728
14729 pInt->currPacketOffset += cbActual;
14730
14731 LoadGUID(objectId, pData);
14732 LoadQWORD(qwSize, pData);
14733 LoadDWORD(cHeaders, pData);
14734 cHeaders = cHeaders;
14735 LoadBYTE(align, pData);
14736 LoadBYTE(arch, pData);
14737
14738 if(!WMA_IsEqualGUID(&CLSID_CAsfHeaderObjectV0, &objectId)
14739 || align != 1
14740 || arch != 2)
14741 {
14742 return WMAERR_INVALIDHEADER;
14743 }
14744
14745 /* use all */
14746 pInt->cbHeader = qwSize.dwLo;
14747
14748 return WMAERR_OK;
14749 }
14750
AU_CUS_WMA_Parser_HnsQWORDtoMsDWORD(QWORD qw)14751 static unsigned int AU_CUS_WMA_Parser_HnsQWORDtoMsDWORD (QWORD qw)
14752 {
14753 unsigned int msLo, msHi;
14754
14755 msLo = qw.dwLo/10000;
14756 msHi = (unsigned int)((float)qw.dwHi*429496.7296);
14757
14758 return msLo + msHi;
14759 }
14760
AU_CUS_WMA_Parser_LoadPropertiesObject(tWMAFileHdrStateInternal * pInt,unsigned int cbSize)14761 WMAERR AU_CUS_WMA_Parser_LoadPropertiesObject(tWMAFileHdrStateInternal *pInt, unsigned int cbSize)
14762 {
14763 GUID mmsId;
14764 QWORD qwTotalSize;
14765 QWORD qwCreateTime;
14766 QWORD qwPackets;
14767 QWORD qwPlayDuration;
14768 QWORD qwSendDuration;
14769 QWORD qwPreroll;
14770 unsigned int dwFlags = 0;
14771 unsigned int dwMinPacketSize = 0;
14772 unsigned int dwMaxPacketSize = 0;
14773 unsigned int dwMaxBitrate = 0;
14774
14775 unsigned char *pData = NULL;
14776 unsigned int cbActual = 0;
14777 unsigned int cbWanted = 0;
14778
14779 if(pInt == NULL)
14780 {
14781 return WMAERR_INVALIDARG;
14782 }
14783 cbSize -= MIN_OBJECT_SIZE;
14784
14785 cbWanted = sizeof(GUID) + 6*sizeof(QWORD) + 4*sizeof(unsigned int);
14786 if(cbWanted > cbSize)
14787 {
14788 return WMAERR_BUFFERTOOSMALL;
14789 }
14790
14791 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset, cbWanted, (char**)&pData);
14792 if(cbActual != cbWanted)
14793 {
14794 return WMAERR_BUFFERTOOSMALL;
14795 }
14796
14797 LoadGUID(mmsId, pData);
14798 mmsId = mmsId;
14799 LoadQWORD(qwTotalSize, pData);
14800 qwTotalSize = qwTotalSize;
14801 LoadQWORD(qwCreateTime, pData);
14802 qwCreateTime = qwCreateTime;
14803 LoadQWORD(qwPackets, pData);
14804 LoadQWORD(qwPlayDuration, pData);
14805 qwPlayDuration = qwPlayDuration;
14806 LoadQWORD(qwSendDuration, pData);
14807 LoadQWORD(qwPreroll, pData);
14808 LoadDWORD(dwFlags, pData);
14809 LoadDWORD(dwMinPacketSize, pData);
14810 LoadDWORD(dwMaxPacketSize, pData);
14811 LoadDWORD(dwMaxBitrate, pData);
14812 dwMaxBitrate = dwMaxBitrate;
14813
14814 if( (dwMinPacketSize != dwMaxPacketSize) || (qwPackets.dwLo == 0 && qwPackets.dwHi == 0) )
14815 {
14816 return WMAERR_FAIL;
14817 }
14818
14819 pInt->cbPacketSize = dwMaxPacketSize;
14820 pInt->cPackets = qwPackets.dwLo;
14821 pInt->msDuration = AU_CUS_WMA_Parser_HnsQWORDtoMsDWORD(qwSendDuration);
14822 pInt->msPreroll = qwPreroll.dwLo;
14823 pInt->dwFilePropertiesFlags = dwFlags;
14824
14825 /* use all */
14826 pInt->currPacketOffset += cbSize;
14827
14828 return WMAERR_OK;
14829 }
14830
AU_CUS_WMA_Parser_auMalloc(const size_t iSize)14831 void *AU_CUS_WMA_Parser_auMalloc(const size_t iSize)
14832 {
14833 return malloc(iSize);
14834 }
14835
AU_CUS_WMA_Parser_auFree(void * pFree)14836 void AU_CUS_WMA_Parser_auFree(void *pFree)
14837 {
14838 free(pFree);
14839 }
14840
AU_CUS_WMA_Parser_LoadLicenseStoreObject(tWMAFileHdrStateInternal * pInt,unsigned int cbSize)14841 WMAERR AU_CUS_WMA_Parser_LoadLicenseStoreObject(tWMAFileHdrStateInternal *pInt, unsigned int cbSize)
14842 {
14843 unsigned char *pData = NULL;
14844 unsigned int cbActual = 0;
14845 unsigned int cbWanted = 0;
14846 unsigned int cbOffset = 0;
14847 unsigned int cbWanted1 = 0;
14848 unsigned int m_dwFlag = 0;
14849 unsigned int cbObjectOffset = 0;
14850
14851 if(pInt == NULL)
14852 {
14853 return WMAERR_INVALIDARG;
14854 }
14855
14856 cbSize -= MIN_OBJECT_SIZE;
14857
14858 cbWanted = 8;
14859 if(cbObjectOffset + cbWanted > cbSize)
14860 {
14861 return WMAERR_BUFFERTOOSMALL;
14862 }
14863 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset + cbObjectOffset, cbWanted, (char**)&pData);
14864 if(cbActual != cbWanted)
14865 {
14866 return WMAERR_BUFFERTOOSMALL;
14867 }
14868
14869 cbObjectOffset += cbActual;
14870
14871 LoadDWORD(m_dwFlag, pData);
14872 m_dwFlag = m_dwFlag;
14873 LoadDWORD(pInt->m_dwLicenseLen, pData);
14874
14875 cbWanted = pInt->m_dwLicenseLen;
14876 if(cbObjectOffset + cbWanted > cbSize)
14877 {
14878 return WMAERR_NOTDONE;
14879 }
14880
14881 pInt->m_pLicData = AU_CUS_WMA_Parser_auMalloc(cbWanted);
14882 if (NULL == pInt->m_pLicData)
14883 {
14884 return WMAERR_OUTOFMEMORY;
14885 }
14886
14887 if(cbWanted > MAX_BUFSIZE)
14888 {
14889 cbOffset=0;
14890 do
14891 {
14892 cbWanted1 = cbWanted > MAX_BUFSIZE ? MAX_BUFSIZE : cbWanted;
14893 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset + cbObjectOffset, cbWanted1, (char**)&pData);
14894 if(cbActual != cbWanted1)
14895 {
14896 return WMAERR_BUFFERTOOSMALL;
14897 }
14898
14899 cbObjectOffset += cbActual;
14900 cbWanted -= cbActual;
14901 if(cbOffset+cbActual <= (unsigned int)pInt->m_dwLicenseLen)
14902 {
14903 memcpy(pInt->m_pLicData+cbOffset, pData, cbActual);
14904 }
14905 else
14906 {
14907 return WMAERR_BUFFERTOOSMALL;
14908 }
14909
14910 cbOffset +=cbActual;
14911 }
14912 while(cbWanted >0);
14913 }
14914 else
14915 {
14916 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset + cbObjectOffset, cbWanted, (char**)&pData);
14917 if(cbActual != cbWanted)
14918 {
14919 return WMAERR_BUFFERTOOSMALL;
14920 }
14921
14922 cbObjectOffset += cbActual;
14923 memcpy(pInt->m_pLicData, pData, cbActual);
14924 }
14925
14926 /* use all */
14927 pInt->currPacketOffset += cbSize;
14928
14929 return WMAERR_OK;
14930 }
14931
AU_CUS_WMA_Parser_AllocateAndLoadMetadataStr(tHWMAFileState * pInt,unsigned long long * piCurrFileOffset,const unsigned long long iMaxFileOffset,unsigned short * pcbTotalBytesWanted,unsigned char ** ppBuffer)14932 WMAERR AU_CUS_WMA_Parser_AllocateAndLoadMetadataStr(tHWMAFileState *pInt, unsigned long long *piCurrFileOffset,
14933 const unsigned long long iMaxFileOffset, unsigned short *pcbTotalBytesWanted, unsigned char **ppBuffer)
14934 {
14935 unsigned char *pData = NULL;
14936 WMAERR wmaerr = WMAERR_OK;
14937 unsigned int cbBytesToRead = 0;
14938 unsigned int cbBytesRead = 0;
14939 unsigned char *pBuffer = NULL;
14940
14941 // WMAFileCBGetData uses MAX_BUFSIZE, but this function uses WMA_MAX_DATA_REQUESTED.
14942 // I don't know why we need two constants here, but just make sure our assumptions hold.
14943
14944 // Check if reading the requested number of bytes would push us past end of object
14945 if (*piCurrFileOffset + *pcbTotalBytesWanted > iMaxFileOffset)
14946 {
14947 wmaerr = (WMAERR_CORRUPTDATA);
14948
14949 // Return directly, to avoid advancing *piCurrFileOffset into hyperspace
14950 return wmaerr;
14951 }
14952
14953 // Limit us to a reasonable size, esp for embedded devices. No 64kB artist names!
14954 cbBytesToRead = *pcbTotalBytesWanted;
14955 if (cbBytesToRead > WMA_MAX_METADATA_LEN)
14956 {
14957 cbBytesToRead = WMA_MAX_METADATA_LEN;
14958 }
14959
14960 pBuffer = AU_CUS_WMA_Parser_auMalloc(cbBytesToRead + sizeof(unsigned short)); // +1 for null-term
14961 if (NULL == pBuffer)
14962 {
14963 wmaerr = (WMAERR_OUTOFMEMORY);
14964 goto exit;
14965 }
14966
14967 memset(pBuffer, 0, cbBytesToRead + sizeof(unsigned short)); // +1 for null-term
14968
14969 for (cbBytesRead = 0; cbBytesRead < cbBytesToRead; )
14970 {
14971 unsigned int cbWanted;
14972 unsigned int cbActual;
14973
14974 cbWanted = MIN(WMA_MAX_DATA_REQUESTED, (cbBytesToRead - cbBytesRead));
14975 cbActual = AU_CUS_WMA_Parser_WMAGetData(*piCurrFileOffset + cbBytesRead, cbWanted, (char**)&pData);
14976 if (cbActual != cbWanted)
14977 {
14978 wmaerr = (WMAERR_BUFFERTOOSMALL);
14979 goto exit;
14980 }
14981
14982 memcpy(&pBuffer[cbBytesRead], pData, cbActual);
14983 cbBytesRead += cbActual;
14984 }
14985
14986 if (cbBytesRead != cbBytesToRead)
14987 {
14988 wmaerr = (WMAERR_BUFFERTOOSMALL);
14989 goto exit;
14990 }
14991
14992 exit:
14993 // Deal with errors in a "transactional" fashion: either succeed completely,
14994 // or fail completely. In other words, clean up if we encountered any errors.
14995 if (WMAERR_OK != wmaerr)
14996 {
14997 cbBytesRead = 0;
14998 if (pBuffer)
14999 {
15000 AU_CUS_WMA_Parser_auFree(pBuffer);
15001 pBuffer = NULL;
15002 }
15003 }
15004
15005 // Return our results
15006 *piCurrFileOffset += *pcbTotalBytesWanted; // Increment by requested amt even if we truncated
15007 *pcbTotalBytesWanted = (unsigned short)cbBytesRead; // Report actual number of bytes read
15008 *ppBuffer = pBuffer;
15009
15010 return wmaerr;
15011 }
15012
AU_CUS_WMA_Parser_LoadVirtualMetaDataObject(tWMAFileHdrStateInternal * pInt,unsigned int cbSize,unsigned int Offset)15013 WMAERR AU_CUS_WMA_Parser_LoadVirtualMetaDataObject(tWMAFileHdrStateInternal *pInt, unsigned int cbSize, unsigned int Offset)
15014 {
15015 unsigned char *pData = NULL;
15016 unsigned int cbActual = 0;
15017 unsigned int cbWanted = 0;
15018 unsigned long long iCurrFileOffset;
15019 unsigned long long iMaxFileOffset;
15020 WMAERR wmaerr = WMAERR_OK;
15021 unsigned short DescRecCount = 0;
15022 unsigned short i = 0;
15023
15024 WMA_MetaDataDescRecords *tDesc = NULL;
15025
15026 iCurrFileOffset = pInt->currPacketOffset + Offset + MIN_OBJECT_SIZE;
15027 iMaxFileOffset = iCurrFileOffset + cbSize - MIN_OBJECT_SIZE;
15028
15029 if (pInt->ptMetaDataEntry)
15030 {
15031 goto exit;
15032 }
15033
15034 // Load Description Records Count
15035 cbWanted = 2;
15036 if (iCurrFileOffset + cbWanted > iMaxFileOffset)
15037 {
15038 wmaerr = (WMAERR_CORRUPTDATA);
15039 goto exit;
15040 }
15041
15042 cbActual = AU_CUS_WMA_Parser_WMAGetData(iCurrFileOffset, cbWanted, (char**)&pData);
15043 if (cbActual != cbWanted)
15044 {
15045 wmaerr = (WMAERR_BUFFERTOOSMALL);
15046 goto exit;
15047 }
15048
15049 iCurrFileOffset += cbActual;
15050 LoadWORD(DescRecCount , pData);
15051
15052 if (0 == DescRecCount)
15053 {
15054 goto exit;
15055 }
15056
15057 // Allocate a description records structure, and an array to hold all description records
15058 pInt->ptMetaDataEntry = AU_CUS_WMA_Parser_auMalloc(sizeof(WMA_MetaDataEntry));
15059 if (NULL == pInt->ptMetaDataEntry)
15060 {
15061 wmaerr = (WMAERR_OUTOFMEMORY);
15062 goto exit;
15063 }
15064
15065 pInt->ptMetaDataEntry->m_wDescRecordsCount = DescRecCount;
15066
15067 pInt->ptMetaDataEntry->pDescRec = AU_CUS_WMA_Parser_auMalloc(DescRecCount * sizeof(WMA_MetaDataDescRecords));
15068 if (NULL == pInt->ptMetaDataEntry->pDescRec)
15069 {
15070 wmaerr = (WMAERR_OUTOFMEMORY);
15071 goto exit;
15072 }
15073 memset(pInt->ptMetaDataEntry->pDescRec, 0, DescRecCount * sizeof(WMA_MetaDataDescRecords));
15074 tDesc = pInt->ptMetaDataEntry->pDescRec;
15075
15076 // Read in all description records
15077 for (i = 0; i < DescRecCount; i++)
15078 {
15079 // Load in the fixed portion of the description record
15080 cbWanted = 12;
15081 if (iCurrFileOffset + cbWanted > iMaxFileOffset)
15082 {
15083 wmaerr = (WMAERR_CORRUPTDATA);
15084 goto exit;
15085 }
15086 cbActual = AU_CUS_WMA_Parser_WMAGetData(iCurrFileOffset, cbWanted, (char**)&pData);
15087 if (cbActual != cbWanted)
15088 {
15089 wmaerr = (WMAERR_BUFFERTOOSMALL);
15090 goto exit;
15091 }
15092 iCurrFileOffset += cbActual;
15093
15094 LoadWORD ( tDesc[i].wLangIdIndex , pData );
15095 LoadWORD ( tDesc[i].wStreamNumber, pData );
15096 LoadWORD ( tDesc[i].wNameLenth , pData );
15097 LoadWORD ( tDesc[i].wDataType , pData );
15098 LoadDWORD( tDesc[i].dwDataLength , pData );
15099
15100 // verify data length with respect to data type.
15101
15102
15103 // Read in the name. Truncate if necessary.
15104 wmaerr = AU_CUS_WMA_Parser_AllocateAndLoadMetadataStr((tHWMAFileState *)pInt, &iCurrFileOffset, iMaxFileOffset, &tDesc[i].wNameLenth, (unsigned char **)&tDesc[i].pwName);
15105 if (WMAERR_OK != wmaerr)
15106 {
15107 goto exit;
15108 }
15109
15110 // Read in the value.
15111 if (ECD_STRING == tDesc[i].wDataType)
15112 {
15113 unsigned short wDataLength = 0;
15114 unsigned int dwAdditionalSkip = 0;
15115
15116 if (tDesc[i].dwDataLength > 0x0000FFFF)
15117 {
15118 // Truncate to 16-bit size, and remember to add the remainder to file offset
15119 dwAdditionalSkip = tDesc[i].dwDataLength - 0x0000FFFF;
15120 tDesc[i].dwDataLength = 0x0000FFFF;
15121 }
15122
15123 // We will truncate this string if necessary
15124 wDataLength = (unsigned short)tDesc[i].dwDataLength;
15125 wmaerr = AU_CUS_WMA_Parser_AllocateAndLoadMetadataStr((tHWMAFileState *)pInt, &iCurrFileOffset, iMaxFileOffset, &wDataLength, &tDesc[i].pData);
15126 tDesc[i].dwDataLength = wDataLength;
15127 if (WMAERR_OK != wmaerr)
15128 {
15129 goto exit;
15130 }
15131
15132 iCurrFileOffset += dwAdditionalSkip;
15133 }
15134 else
15135 {
15136 unsigned int cbBytesRead;
15137 const unsigned int cbBytesToRead = tDesc[i].dwDataLength;
15138
15139 // Do not truncate
15140 // Check if reading this object takes us past end of object
15141 if (iCurrFileOffset + tDesc[i].dwDataLength > iMaxFileOffset)
15142 {
15143 wmaerr = (WMAERR_CORRUPTDATA);
15144 goto exit;
15145 }
15146
15147 tDesc[i].pData = AU_CUS_WMA_Parser_auMalloc(tDesc[i].dwDataLength);
15148 if (NULL == tDesc[i].pData)
15149 {
15150 wmaerr = (WMAERR_OUTOFMEMORY);
15151 goto exit;
15152 }
15153
15154 for (cbBytesRead = 0; cbBytesRead < cbBytesToRead; )
15155 {
15156 cbWanted = MIN(MAX_BUFSIZE, (cbBytesToRead - cbBytesRead));
15157 cbActual = AU_CUS_WMA_Parser_WMAGetData(iCurrFileOffset + cbBytesRead, cbWanted, (char**)&pData);
15158 if (cbActual != cbWanted)
15159 {
15160 wmaerr = (WMAERR_BUFFERTOOSMALL);
15161 goto exit;
15162 }
15163
15164 memcpy(&tDesc[i].pData[cbBytesRead], pData, cbActual);
15165 cbBytesRead += cbActual;
15166 }
15167
15168 if (cbBytesRead != cbBytesToRead)
15169 {
15170 wmaerr = (WMAERR_BUFFERTOOSMALL);
15171 goto exit;
15172 }
15173
15174 iCurrFileOffset += cbBytesRead;
15175
15176 } // else (NOT ECD_STRING)
15177 }
15178
15179 exit:
15180 // Deal with errors in a "transactional" fashion: either succeed completely,
15181 // or fail completely. In other words, clean up if we encountered any errors.
15182 if (WMAERR_OK != wmaerr)
15183 {
15184 if (pInt->ptMetaDataEntry)
15185 {
15186 if (pInt->ptMetaDataEntry->pDescRec)
15187 {
15188 tDesc = pInt->ptMetaDataEntry->pDescRec;
15189 for (i = 0; i < pInt->ptMetaDataEntry->m_wDescRecordsCount; i++)
15190 {
15191 // it's OK to pass NULL pointers to free
15192 AU_CUS_WMA_Parser_auFree(tDesc[i].pwName);
15193 AU_CUS_WMA_Parser_auFree(tDesc[i].pData);
15194 }
15195 AU_CUS_WMA_Parser_auFree(pInt->ptMetaDataEntry->pDescRec);
15196 }
15197
15198 AU_CUS_WMA_Parser_auFree(pInt->ptMetaDataEntry);
15199 pInt->ptMetaDataEntry = NULL;
15200 }
15201 }
15202
15203 // Note: This function is not responsible for advancing pInt->currPacketOffset
15204
15205 return wmaerr;
15206 }
15207
AU_CUS_WMA_Parser_LoadVirtualObjectHeader(tWMAFileHdrStateInternal * pInt,GUID * pObjectId,QWORD * pqwSize,unsigned int Offset)15208 WMAERR AU_CUS_WMA_Parser_LoadVirtualObjectHeader(tWMAFileHdrStateInternal *pInt, GUID *pObjectId, QWORD *pqwSize, unsigned int Offset)
15209 {
15210 unsigned char *pData = NULL;
15211 unsigned int cbActual =0;
15212 unsigned int cbWanted =0;
15213
15214 cbWanted = MIN_OBJECT_SIZE;
15215 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset + Offset, cbWanted, (char**)&pData);
15216 if(cbActual != cbWanted)
15217 {
15218 return WMAERR_BUFFERTOOSMALL;
15219 }
15220
15221 LoadGUID((*pObjectId), pData);
15222 LoadQWORD((*pqwSize), pData);
15223
15224 if (pqwSize->dwLo < MIN_OBJECT_SIZE)
15225 {
15226 return WMAERR_INVALIDHEADER;
15227 }
15228
15229 return WMAERR_OK;
15230 }
15231
AU_CUS_WMA_Parser_LoadAudioObject(tWMAFileHdrStateInternal * pInt,unsigned int cbSize)15232 WMAERR AU_CUS_WMA_Parser_LoadAudioObject(tWMAFileHdrStateInternal *pInt, unsigned int cbSize)
15233 {
15234 GUID streamType;
15235 GUID ecStrategy;
15236 QWORD qwOffset;
15237 unsigned int cbTypeSpecific = 0;
15238 unsigned int cbErrConcealment = 0;
15239 unsigned short wStreamNum = 0;
15240 unsigned int dwJunk = 0;
15241 unsigned int nBlocksPerObject = 0;
15242 AsfXAcmAudioErrorMaskingData *pScramblingData=NULL;
15243 // WAVEFORMATEX *pFmt;
15244
15245 unsigned char *pData = NULL;
15246 unsigned int cbActual = 0;
15247 unsigned int cbWanted = 0;
15248
15249 unsigned short tw = 0;
15250 unsigned int tdw = 0;
15251 const unsigned char *tp = NULL;
15252 unsigned int cbObjectOffset = 0;
15253
15254 if(pInt == NULL)
15255 {
15256 return WMAERR_INVALIDARG;
15257 }
15258
15259 cbSize -= MIN_OBJECT_SIZE;
15260
15261 cbWanted = 2*sizeof(GUID) + sizeof(QWORD) + 3*sizeof(unsigned int) + sizeof(unsigned short);
15262 if(cbObjectOffset + cbWanted > cbSize)
15263 {
15264 return WMAERR_BUFFERTOOSMALL;
15265 }
15266
15267 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset + cbObjectOffset, cbWanted, (char**)&pData);
15268 if(cbActual != cbWanted)
15269 {
15270 return WMAERR_BUFFERTOOSMALL;
15271 }
15272 cbObjectOffset += cbActual;
15273
15274 LoadGUID(streamType, pData);
15275 LoadGUID(ecStrategy, pData);
15276 LoadQWORD(qwOffset, pData);
15277 qwOffset = qwOffset;
15278 LoadDWORD(cbTypeSpecific, pData);
15279 LoadDWORD(cbErrConcealment, pData);
15280 LoadWORD(wStreamNum, pData);
15281 LoadDWORD(dwJunk, pData);
15282 dwJunk = dwJunk;
15283
15284 wStreamNum &= 0x7F;
15285
15286 if( !WMA_IsEqualGUID( &CLSID_AsfXStreamTypeAcmAudio, &streamType ) )
15287 {
15288 /* Skip over the rest */
15289 pInt->currPacketOffset += cbSize;
15290 return WMAERR_OK;
15291 }
15292 pInt->cAudioStreams++;
15293
15294 if (pInt->cAudioStreams != pInt->wTargetAudioStreamNumber)
15295 {
15296 // We dont want to decode this stream
15297 /* Skip over the rest */
15298 pInt->currPacketOffset += cbSize;
15299 return WMAERR_OK;
15300 }
15301
15302 /* Type specific */
15303 pInt->wAudioStreamId = wStreamNum; //Amit
15304
15305 if(cbTypeSpecific > 0)
15306 {
15307 cbWanted = cbTypeSpecific;
15308 if(cbObjectOffset + cbWanted > cbSize)
15309 {
15310 return WMAERR_BUFFERTOOSMALL;
15311 }
15312 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset + cbObjectOffset, cbWanted, (char**)&pData);
15313 if(cbActual != cbWanted)
15314 {
15315 return WMAERR_BUFFERTOOSMALL;
15316 }
15317 cbObjectOffset += cbActual;
15318
15319 tp = pData;
15320 LoadWORD (tw ,tp);
15321 pInt->wFormatTag = tw;
15322
15323 switch(tw)
15324 {
15325 case WAVE_FORMAT_WMAUDIO3: // fall into
15326 case WAVE_FORMAT_WMAUDIO_LOSSLESS:
15327 {
15328 if(cbTypeSpecific < 36)
15329 {
15330 return WMAERR_FAIL;
15331 }
15332 pInt->nVersion = 3;
15333 tp = pData + 4;
15334 LoadDWORD(tdw,tp);
15335 pInt->nSamplesPerSec = tdw;
15336 tp = pData + 8;
15337 LoadDWORD(tdw,tp);
15338 pInt->nAvgBytesPerSec = tdw;
15339 tp = pData + 12;
15340 LoadWORD (tw ,tp);
15341 pInt->nBlockAlign = tw;
15342 tp = pData + 2;
15343 LoadWORD (tw ,tp);
15344 pInt->nChannels = tw;
15345
15346 // New information in V9
15347 pInt->wPCMFormatTag = WAVE_FORMAT_EXTENSIBLE;
15348 tp = pData + 14;
15349 LoadWORD (tw, tp);
15350 pInt->wValidBitsPerSample = tw; // Container size
15351
15352 // Round up the container size
15353 pInt->wBitsPerSample = 8 * ((pInt->wValidBitsPerSample + 7)/8);
15354
15355 // Digest additional information
15356 tp = pData + 16;
15357 LoadWORD (tw, tp);
15358
15359 // Has V3 specific info
15360 // pData+18 would be reserved.
15361 tp = pData + 20;
15362 LoadDWORD (tdw, tp);
15363 pInt->dwChannelMask = tdw;
15364
15365 // pData+24, pData+28 are reseved DWORD
15366 tp = pData + 28;
15367 LoadDWORD (tdw, tp);
15368 pInt->nAdvancedEncodeOpt2 = tdw;
15369 tp = pData + 32;
15370 LoadWORD (tw, tp);
15371 pInt->nEncodeOpt = tw;
15372 tp = pData + 34;
15373 LoadWORD (tw, tp);
15374 pInt->nAdvancedEncodeOpt = tw;
15375
15376 // set the GUID for file write: Should be done elsewhere
15377 // GUID information:
15378 COPY_KSDATAFORMAT_SUBTYPE_PCM(&(pInt->SubFormat));
15379 }
15380 break;
15381
15382 case WAVE_FORMAT_WMAUDIO2:
15383 {
15384 if(cbTypeSpecific < 28 /*sizeof(WMAUDIO2WAVEFORMAT)*/)
15385 {
15386 return WMAERR_FAIL;
15387 }
15388
15389 pInt->nVersion = 2;
15390 tp = pData + 4;
15391 LoadDWORD(tdw,tp);
15392 pInt->nSamplesPerSec = tdw;
15393 tp = pData + 8;
15394 LoadDWORD(tdw,tp);
15395 pInt->nAvgBytesPerSec = tdw;
15396 tp = pData + 12;
15397 LoadWORD (tw ,tp);
15398 pInt->nBlockAlign = tw;
15399 tp = pData + 2;
15400 LoadWORD (tw ,tp);
15401 pInt->nChannels = tw;
15402
15403 // New information in V9
15404 pInt->wPCMFormatTag = WAVE_FORMAT_PCM;
15405 tp = pData + 14;
15406 LoadWORD (tw, tp);
15407 pInt->wBitsPerSample = tw;
15408 pInt->wOriginalBitDepth = pInt->wValidBitsPerSample = pInt->wBitsPerSample;
15409
15410 tp = pData + 18;
15411 LoadDWORD(tdw,tp);
15412 pInt->nSamplesPerBlock = tdw;
15413 tp = pData + 22;
15414 LoadWORD (tw ,tp);
15415 pInt->nEncodeOpt = tw;
15416
15417 switch (pInt->nChannels)
15418 {
15419 case 1:
15420 {
15421 pInt->dwChannelMask = SPEAKER_FRONT_CENTER;
15422 }
15423 break;
15424
15425 case 2:
15426 {
15427 pInt->dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
15428 }
15429 break;
15430
15431 case 6:
15432 {
15433 // Only to support pseudo V3 streams
15434 pInt->dwChannelMask = (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT |
15435 SPEAKER_FRONT_CENTER | SPEAKER_BACK_LEFT |
15436 SPEAKER_BACK_RIGHT | SPEAKER_LOW_FREQUENCY);
15437 }
15438 break;
15439
15440 default:
15441 {
15442 // "Can not deal with % channels in this format\n"
15443 return WMAERR_FAIL;
15444 }
15445 }
15446 }
15447 break;
15448
15449 case WAVE_FORMAT_MSAUDIO1:
15450 {
15451 if(cbTypeSpecific < 22 /*sizeof(MSAUDIO1WAVEFORMAT)*/)
15452 {
15453 return WMAERR_FAIL;
15454 }
15455
15456 pInt->nVersion = 1;
15457 tp = pData + 4;
15458 LoadDWORD(tdw,tp);
15459 pInt->nSamplesPerSec = tdw;
15460 tp = pData + 8;
15461 LoadDWORD(tdw,tp);
15462 pInt->nAvgBytesPerSec = tdw;
15463 tp = pData + 12;
15464 LoadWORD (tw ,tp);
15465 pInt->nBlockAlign = tw;
15466 tp = pData + 2;
15467 LoadWORD (tw ,tp);
15468 pInt->nChannels = tw;
15469 tp = pData + 20;
15470 LoadWORD (tw,tp);
15471 pInt->nEncodeOpt = tw;
15472 tp = pData + 18;
15473 LoadWORD (tw,tp);
15474 pInt->nSamplesPerBlock = tw;
15475
15476 // New information in V9
15477 pInt->wPCMFormatTag = WAVE_FORMAT_PCM;
15478 tp = pData + 14;
15479 LoadWORD (tw, tp);
15480 pInt->wBitsPerSample = tw;
15481 pInt->wOriginalBitDepth = pInt->wValidBitsPerSample = pInt->wBitsPerSample;
15482
15483 switch (pInt->nChannels)
15484 {
15485 case 1:
15486 {
15487 pInt->dwChannelMask = SPEAKER_FRONT_CENTER;
15488 }
15489 break;
15490
15491 case 2:
15492 {
15493 pInt->dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
15494 }
15495 break;
15496
15497 default:
15498 {
15499 // "Can not deal with % channels in this format\n"
15500 return WMAERR_FAIL;
15501 }
15502 }
15503 }
15504 break;
15505
15506 default:
15507 {
15508 // unknown...
15509 return WMAERR_FAIL;
15510 }
15511 }
15512 }
15513
15514 /* Error concealment - this can get as big as 400!!! */
15515 if(cbErrConcealment > 0)
15516 {
15517 if(WMA_IsEqualGUID(&CLSID_AsfXSignatureAudioErrorMaskingStrategy, &ecStrategy))
15518 {
15519 cbWanted = 9; //sizeof(AsfXSignatureAudioErrorMaskingData); Amit it is giving 12 bytes while actual is 9 09/10/2001
15520 }
15521 else if(WMA_IsEqualGUID(&CLSID_AsfXAcmAudioErrorMaskingStrategy, &ecStrategy))
15522 {
15523
15524 cbWanted = 8; //cbWanted = sizeof(AsfXAcmAudioErrorMaskingData);
15525 }
15526 else
15527 {
15528 return WMAERR_FAIL;
15529 }
15530
15531 if(cbObjectOffset + cbWanted > cbSize)
15532 {
15533 return WMAERR_BUFFERTOOSMALL;
15534 }
15535
15536 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset + cbObjectOffset, cbWanted, (char**)&pData);
15537 if(cbActual != cbWanted)
15538 {
15539 return WMAERR_BUFFERTOOSMALL;
15540 }
15541
15542 cbObjectOffset += cbErrConcealment; // Skip over the rest - cbActual;
15543
15544 if(WMA_IsEqualGUID(&CLSID_AsfXSignatureAudioErrorMaskingStrategy, &ecStrategy))
15545 {
15546 pInt->cbAudioSize = ((AsfXSignatureAudioErrorMaskingData *)pData)->maxObjectSize;
15547 }
15548 else if(WMA_IsEqualGUID(&CLSID_AsfXAcmAudioErrorMaskingStrategy, &ecStrategy))
15549 {
15550 pScramblingData = (AsfXAcmAudioErrorMaskingData *)pData;
15551
15552 pInt->cbAudioSize = (unsigned int)(((unsigned short)(*(pData+1))) * ((unsigned short)(*pData)));
15553 if (pScramblingData->span >1)
15554 {
15555 return WMAERR_FAIL;
15556 }
15557 }
15558 else
15559 {
15560 return WMAERR_FAIL;
15561 }
15562 }
15563
15564 if (pInt->nBlockAlign > 0)
15565 {
15566 nBlocksPerObject = pInt->cbAudioSize/pInt->nBlockAlign;
15567 }
15568
15569 pInt->cbAudioSize = nBlocksPerObject*pInt->nSamplesPerBlock*pInt->nChannels*2;
15570
15571 /* use all */
15572 pInt->currPacketOffset += cbSize;
15573
15574 return WMAERR_OK;
15575 }
15576
AU_CUS_WMA_Parser_LoadVirtualExtendedStreamPropertiesObject(tWMAFileHdrStateInternal * pInt,unsigned int cbSize,unsigned int Offset)15577 WMAERR AU_CUS_WMA_Parser_LoadVirtualExtendedStreamPropertiesObject(tWMAFileHdrStateInternal *pInt, unsigned int cbSize, unsigned int Offset)
15578 {
15579 unsigned int cbObjectOffset = 0;
15580
15581 unsigned char *pData = NULL;
15582 unsigned int cbActual =0;
15583 unsigned int cbWanted =0;
15584 unsigned short wStreamNameCount = 0;
15585 unsigned short wPayloadSystemExtensionCount = 0;
15586 WMAERR rc = WMAERR_OK;
15587
15588 if(pInt == NULL)
15589 {
15590 return WMAERR_INVALIDARG;
15591 }
15592
15593 cbSize -= MIN_OBJECT_SIZE;
15594 Offset+=MIN_OBJECT_SIZE; // Step over GUID + length field of current object
15595
15596 // Get to stream name count
15597 cbObjectOffset = 60;
15598 cbWanted = 4;
15599 if(cbObjectOffset + cbWanted > cbSize)
15600 {
15601 return WMAERR_BUFFERTOOSMALL;
15602 }
15603
15604 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset + Offset + cbObjectOffset, cbWanted, (char**)&pData);
15605 if((cbActual != cbWanted)||(NULL == pData))
15606 {
15607 return WMAERR_BUFFERTOOSMALL;
15608 }
15609
15610 cbObjectOffset += cbActual;
15611
15612 LoadWORD (wStreamNameCount , pData);
15613 LoadWORD (wPayloadSystemExtensionCount , pData);
15614
15615 // Read past the stream names
15616 if (0 != wStreamNameCount)
15617 {
15618 int i;
15619 int cStreamNames = (int) wStreamNameCount;
15620 unsigned short wStreamNameLength = 0;
15621
15622 for (i = 0; i < cStreamNames; i++)
15623 {
15624 cbWanted = 2;
15625 // Dont care for language
15626 cbObjectOffset += 2;
15627 if(cbObjectOffset + cbWanted > cbSize)
15628 {
15629 return WMAERR_BUFFERTOOSMALL;
15630 }
15631
15632 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset + Offset + cbObjectOffset, cbWanted, (char**)&pData);
15633
15634 if((cbActual != cbWanted)||(NULL == pData))
15635 {
15636 return WMAERR_BUFFERTOOSMALL;
15637 }
15638
15639 cbObjectOffset += cbActual;
15640 LoadWORD (wStreamNameLength , pData);
15641 cbObjectOffset += wStreamNameLength;
15642 }
15643 }
15644
15645 // Read past the payload extension systems
15646 if (0 != wPayloadSystemExtensionCount)
15647 {
15648 int i;
15649 int cPayloadSystemExtensionCount = (int) wPayloadSystemExtensionCount;
15650 unsigned int wPayloadSystemLength = 0;
15651
15652 for (i = 0; i < cPayloadSystemExtensionCount; i++)
15653 {
15654 cbWanted = 4;
15655 // Dont care for GUID etc
15656 cbObjectOffset += 18;
15657 if(cbObjectOffset + cbWanted > cbSize)
15658 {
15659 return WMAERR_BUFFERTOOSMALL;
15660 }
15661
15662 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset + Offset + cbObjectOffset, cbWanted, (char**)&pData);
15663
15664 if((cbActual != cbWanted)||(NULL == pData))
15665 {
15666 return WMAERR_BUFFERTOOSMALL;
15667 }
15668
15669 cbObjectOffset += cbActual;
15670 LoadDWORD(wPayloadSystemLength, pData);
15671 cbObjectOffset += wPayloadSystemLength;
15672 }
15673 }
15674
15675 // Check for existence of Stream Properties at the end of extended stream properties.
15676 if ((cbObjectOffset + MIN_OBJECT_SIZE) < cbSize)
15677 {
15678 GUID sobjId;
15679 QWORD sqwSize;
15680
15681 rc= AU_CUS_WMA_Parser_LoadVirtualObjectHeader(pInt, &sobjId, &sqwSize, Offset + cbObjectOffset);
15682 if(rc != WMAERR_OK)
15683 return rc;
15684
15685 cbObjectOffset += MIN_OBJECT_SIZE;
15686
15687 if ( WMA_IsEqualGUID( &CLSID_CAsfStreamPropertiesObjectV1, &sobjId )
15688 || WMA_IsEqualGUID( &CLSID_CAsfStreamPropertiesObjectV2, &sobjId ))
15689 {
15690 // Try reading audio property here. Since AU_CUS_WMA_Parser_LoadAudioObject is not virtual, do
15691 // some work-around here.
15692 unsigned long long dwSafeCurrPacketOffset = pInt->currPacketOffset;
15693 pInt->currPacketOffset += Offset + cbObjectOffset;
15694
15695 if (pInt->currPacketOffset + (sqwSize.dwLo - MIN_OBJECT_SIZE) > pInt->cbFirstPacketOffset)
15696 {
15697 return WMAERR_FAIL;
15698 }
15699
15700 rc = AU_CUS_WMA_Parser_LoadAudioObject(pInt, sqwSize.dwLo);
15701 if(rc != WMAERR_OK)
15702 {
15703 return rc;
15704 }
15705
15706 // restore
15707 pInt->currPacketOffset = dwSafeCurrPacketOffset;
15708 }
15709 }
15710
15711 return rc;
15712 }
15713
AU_CUS_WMA_Parser_LoadClockObject(tWMAFileHdrStateInternal * pInt,unsigned int cbSize)15714 WMAERR AU_CUS_WMA_Parser_LoadClockObject(tWMAFileHdrStateInternal *pInt, unsigned int cbSize)
15715 {
15716 unsigned int cbObjectOffset = 0;
15717 GUID PacketClockType;
15718 unsigned short PacketClockSize;
15719 unsigned int dwHeaderExtDataSize = 0;
15720 unsigned char *pData = NULL;
15721 unsigned int cbActual = 0;
15722 unsigned int cbWanted = 0;
15723 WMAERR rc = WMAERR_OK;
15724 unsigned short wMetaDataObject = 0;
15725 unsigned short wExtendedStreamPropertiesObject = 0;
15726
15727 if(pInt == NULL)
15728 {
15729 return WMAERR_INVALIDARG;
15730 }
15731
15732 cbSize -= MIN_OBJECT_SIZE;
15733
15734 cbWanted = 18;
15735 if(cbObjectOffset + cbWanted > cbSize)
15736 {
15737 return WMAERR_BUFFERTOOSMALL;
15738 }
15739
15740 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset + cbObjectOffset, cbWanted, (char**)&pData);
15741 if((cbActual != cbWanted)||(NULL == pData))
15742 {
15743 return WMAERR_BUFFERTOOSMALL;
15744 }
15745
15746 cbObjectOffset += cbActual;
15747
15748 LoadGUID (PacketClockType, pData);
15749
15750 if (WMA_IsEqualGUID( &CLSID_CAsfPacketClock1, &PacketClockType ) ==0)
15751 {
15752 pInt->currPacketOffset += cbSize;
15753 return WMAERR_BUFFERTOOSMALL;
15754 }
15755
15756 LoadWORD (PacketClockSize, pData);
15757
15758 if (PacketClockSize != 6)
15759 {
15760 pInt->currPacketOffset += cbSize;
15761 return WMAERR_BUFFERTOOSMALL;
15762 }
15763
15764 cbWanted = 4;
15765 if(cbObjectOffset + cbWanted > cbSize)
15766 {
15767 return WMAERR_BUFFERTOOSMALL;
15768 }
15769
15770 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset + cbObjectOffset, cbWanted, (char**)&pData);
15771
15772 if((cbActual != cbWanted)||(NULL == pData))
15773 {
15774 return WMAERR_BUFFERTOOSMALL;
15775 }
15776
15777 cbObjectOffset += cbActual;
15778
15779 LoadDWORD (dwHeaderExtDataSize, pData);
15780
15781 if (dwHeaderExtDataSize >= MIN_OBJECT_SIZE )
15782 {
15783 // There are more objects. parse them.
15784 GUID sobjId;
15785 QWORD sqwSize;
15786 while(cbObjectOffset < cbSize)
15787 {
15788 rc= AU_CUS_WMA_Parser_LoadVirtualObjectHeader(pInt, &sobjId, &sqwSize, cbObjectOffset);
15789 if(rc != WMAERR_OK)
15790 {
15791 return rc;
15792 }
15793
15794 if( WMA_IsEqualGUID( &CLSID_AsfXMetaDataObject, &sobjId ) )
15795 {
15796 wMetaDataObject++;
15797 if ((cbObjectOffset + sqwSize.dwLo > cbSize)||(wMetaDataObject >1))
15798 {
15799 rc = WMAERR_BUFFERTOOSMALL;
15800 goto sabort;
15801 }
15802 rc = AU_CUS_WMA_Parser_LoadVirtualMetaDataObject(pInt, sqwSize.dwLo, cbObjectOffset );
15803 cbObjectOffset += sqwSize.dwLo;
15804 if (WMAERR_OK != rc)
15805 {
15806 // Note the error, but ignore it and try to continue. It's just metadata.
15807 rc = WMAERR_OK;
15808 }
15809 }
15810 else if (WMA_IsEqualGUID( &CLSID_CAsfExtendedStreamPropertiesObject, &sobjId ))
15811 {
15812 wExtendedStreamPropertiesObject++;
15813 if (cbObjectOffset + (sqwSize.dwLo - MIN_OBJECT_SIZE) > pInt->cbFirstPacketOffset)
15814 {
15815 return WMAERR_FAIL;
15816 }
15817
15818 rc = AU_CUS_WMA_Parser_LoadVirtualExtendedStreamPropertiesObject(pInt, sqwSize.dwLo,cbObjectOffset);
15819
15820 cbObjectOffset += sqwSize.dwLo;
15821 if(rc != WMAERR_OK)
15822 {
15823 return rc;
15824 }
15825 }
15826 else
15827 {
15828 /* skip over this object */
15829 cbObjectOffset += sqwSize.dwLo;
15830 }
15831 }
15832 }
15833
15834 sabort:
15835 pInt->currPacketOffset += cbSize;
15836 return rc;
15837 }
15838
AU_CUS_WMA_Parser_LoadExtendedContentDescObject(tWMAFileHdrStateInternal * pInt,unsigned int cbSize)15839 WMAERR AU_CUS_WMA_Parser_LoadExtendedContentDescObject(tWMAFileHdrStateInternal *pInt, unsigned int cbSize)
15840 {
15841 unsigned char *pData = NULL;
15842 unsigned int cbActual = 0;
15843 unsigned int cbWanted = 0;
15844 tWMAExtendedContentDesc *pECDesc = NULL;
15845 unsigned short cDescriptors = 0;
15846 unsigned long long iCurrFileOffset = 0;
15847 unsigned long long iMaxFileOffset = 0;
15848 WMAERR wmaerr = WMAERR_OK;
15849 unsigned int i = 0;
15850
15851 iCurrFileOffset = pInt->currPacketOffset;
15852 iMaxFileOffset = iCurrFileOffset + cbSize - MIN_OBJECT_SIZE;
15853
15854 if (pInt->m_pECDesc)
15855 {
15856 goto exit;
15857 }
15858
15859 pInt->m_pECDesc = AU_CUS_WMA_Parser_auMalloc(sizeof(tWMAExtendedContentDesc));
15860 if( pInt->m_pECDesc == NULL)
15861 {
15862 wmaerr = (WMAERR_OUTOFMEMORY);
15863 goto exit;
15864 }
15865 pECDesc = pInt->m_pECDesc;
15866 memset(pECDesc, 0, sizeof(tWMAExtendedContentDesc));
15867
15868 // Get descriptor count
15869 cbWanted = sizeof(unsigned short);
15870 if (iCurrFileOffset + cbWanted > iMaxFileOffset)
15871 {
15872 wmaerr = (WMAERR_CORRUPTDATA);
15873 goto exit;
15874 }
15875
15876 cbActual = AU_CUS_WMA_Parser_WMAGetData(iCurrFileOffset, cbWanted, (char**)&pData);
15877 if(cbActual != cbWanted)
15878 {
15879 wmaerr = (WMAERR_BUFFERTOOSMALL);
15880 goto exit;
15881 }
15882 iCurrFileOffset += cbActual;
15883 LoadWORD(cDescriptors, pData);
15884 pECDesc->cDescriptors = cDescriptors;
15885
15886 // Allocate array to hold pointers to each descriptor record
15887 pECDesc->pDescriptors = (ECD_DESCRIPTOR *)AU_CUS_WMA_Parser_auMalloc(cDescriptors * sizeof(ECD_DESCRIPTOR));
15888 if(pECDesc->pDescriptors == NULL)
15889 {
15890 wmaerr = (WMAERR_OUTOFMEMORY);
15891 goto exit;
15892 }
15893
15894 memset(pECDesc->pDescriptors, 0, cDescriptors * sizeof(ECD_DESCRIPTOR));
15895
15896 // Read in each descriptor record
15897 for (i = 0; i < cDescriptors; i++)
15898 {
15899 // Load in descriptor name length
15900 cbWanted = sizeof(unsigned short);
15901 if (iCurrFileOffset + cbWanted > iMaxFileOffset)
15902 {
15903 wmaerr = (WMAERR_CORRUPTDATA);
15904 goto exit;
15905 }
15906 cbActual = AU_CUS_WMA_Parser_WMAGetData(iCurrFileOffset, cbWanted, (char**)&pData);
15907 if(cbActual != cbWanted)
15908 {
15909 wmaerr = (WMAERR_BUFFERTOOSMALL);
15910 goto exit;
15911 }
15912 iCurrFileOffset += cbActual;
15913 LoadWORD(pECDesc->pDescriptors[i].cbName, pData);
15914
15915 // Load in descriptor name
15916 wmaerr = AU_CUS_WMA_Parser_AllocateAndLoadMetadataStr((tHWMAFileState *)pInt, &iCurrFileOffset,
15917 iMaxFileOffset, &pECDesc->pDescriptors[i].cbName,
15918 (unsigned char **)&pECDesc->pDescriptors[i].pwszName);
15919 if (WMAERR_OK != wmaerr)
15920 {
15921 goto exit;
15922 }
15923
15924 // Load in descriptor value type, and descriptor value length
15925 cbWanted = 2 * sizeof(unsigned short);
15926 if (iCurrFileOffset + cbWanted > iMaxFileOffset)
15927 {
15928 wmaerr = (WMAERR_CORRUPTDATA);
15929 goto exit;
15930 }
15931 cbActual = AU_CUS_WMA_Parser_WMAGetData(iCurrFileOffset, cbWanted, (char**)&pData);
15932 if(cbActual != cbWanted)
15933 {
15934 wmaerr = (WMAERR_BUFFERTOOSMALL);
15935 goto exit;
15936 }
15937 iCurrFileOffset += cbActual;
15938 LoadWORD(pECDesc->pDescriptors[i].data_type, pData);
15939 LoadWORD(pECDesc->pDescriptors[i].cbValue, pData);
15940
15941 // Load in descriptor value
15942 if (ECD_STRING == pECDesc->pDescriptors[i].data_type)
15943 {
15944 // We will truncate this string if necessary
15945 wmaerr = AU_CUS_WMA_Parser_AllocateAndLoadMetadataStr((tHWMAFileState *)pInt, &iCurrFileOffset, iMaxFileOffset, &pECDesc->pDescriptors[i].cbValue, (unsigned char**)&pECDesc->pDescriptors[i].uValue.pbBinary);
15946 if (WMAERR_OK != wmaerr)
15947 {
15948 goto exit;
15949 }
15950 }
15951 else //(NOT ECD_STRING)
15952 {
15953 unsigned int cbBytesRead;
15954 const unsigned int cbBytesToRead = pECDesc->pDescriptors[i].cbValue;
15955
15956 // Do not truncate
15957 // Check if reading this object takes us past end of object
15958 if (iCurrFileOffset + pECDesc->pDescriptors[i].cbValue > iMaxFileOffset)
15959 {
15960 wmaerr = (WMAERR_CORRUPTDATA);
15961 goto exit;
15962 }
15963
15964 pECDesc->pDescriptors[i].uValue.pbBinary = AU_CUS_WMA_Parser_auMalloc(pECDesc->pDescriptors[i].cbValue);
15965 if (NULL == pECDesc->pDescriptors[i].uValue.pbBinary)
15966 {
15967 wmaerr = (WMAERR_OUTOFMEMORY);
15968 goto exit;
15969 }
15970
15971 for (cbBytesRead = 0; cbBytesRead < cbBytesToRead; )
15972 {
15973 cbWanted = MIN(MAX_BUFSIZE, (cbBytesToRead - cbBytesRead));
15974 cbActual = AU_CUS_WMA_Parser_WMAGetData(iCurrFileOffset + cbBytesRead, cbWanted, (char**)&pData);
15975 if (cbActual != cbWanted)
15976 {
15977 wmaerr = (WMAERR_BUFFERTOOSMALL);
15978 goto exit;
15979 }
15980
15981 memcpy(&pECDesc->pDescriptors[i].uValue.pbBinary[cbBytesRead],
15982 pData, cbActual);
15983 cbBytesRead += cbActual;
15984 }
15985
15986 if (cbBytesRead != cbBytesToRead)
15987 {
15988 wmaerr = (WMAERR_BUFFERTOOSMALL);
15989 goto exit;
15990 }
15991
15992 iCurrFileOffset += cbBytesRead;
15993 }
15994 }
15995
15996 exit:
15997 // Deal with errors in a "transactional" fashion: either succeed completely,
15998 // or fail completely. In other words, clean up if we encountered any errors.
15999 if (WMAERR_OK != wmaerr)
16000 {
16001 if (pInt->m_pECDesc)
16002 {
16003 pECDesc = pInt->m_pECDesc;
16004 if (pECDesc->pDescriptors)
16005 {
16006 for (i = 0; i < pECDesc->cDescriptors; i++)
16007 {
16008 // It's OK to pass NULL pointers to free
16009 AU_CUS_WMA_Parser_auFree(pECDesc->pDescriptors[i].uValue.pbBinary);
16010 }
16011
16012 AU_CUS_WMA_Parser_auFree(pECDesc->pDescriptors);
16013 pECDesc->pDescriptors = NULL;
16014 }
16015
16016 AU_CUS_WMA_Parser_auFree(pInt->m_pECDesc);
16017 pInt->m_pECDesc = NULL;
16018 }
16019 }
16020
16021 // Skip to end of object
16022 pInt->currPacketOffset = iMaxFileOffset;
16023
16024 return wmaerr;
16025 }
16026
AU_CUS_WMA_Parser_LoadContentDescriptionObject(tWMAFileHdrStateInternal * pInt,unsigned int cbSize)16027 WMAERR AU_CUS_WMA_Parser_LoadContentDescriptionObject(tWMAFileHdrStateInternal *pInt, unsigned int cbSize)
16028 {
16029 unsigned char *pData = NULL;
16030 unsigned long long iCurrFileOffset = 0;
16031 unsigned long long iMaxFileOffset = 0;
16032 tWMAFileContDesc *pDesc = NULL;
16033 WMAERR wmaerr = WMAERR_OK;
16034 unsigned int cbActual = 0;
16035 unsigned int cbWanted = 0;
16036
16037 iCurrFileOffset = pInt->currPacketOffset;
16038 iMaxFileOffset = iCurrFileOffset + cbSize - MIN_OBJECT_SIZE;
16039
16040 if (NULL != pInt->m_pDesc)
16041 {
16042 goto exit;
16043 }
16044
16045 pInt->m_pDesc = AU_CUS_WMA_Parser_auMalloc(sizeof(tWMAFileContDesc));
16046 if (NULL == pInt->m_pDesc)
16047 {
16048 wmaerr = (WMAERR_OUTOFMEMORY);
16049 goto exit;
16050 }
16051
16052 pDesc = pInt->m_pDesc;
16053 memset(pDesc, 0, sizeof(tWMAFileContDesc));
16054
16055 // Ugly. The programmer of this function assumed that tWMAFileHdrStateInternal *pInt
16056 // can be cast to (tHWMAFileState *), which is only true because
16057 // tWMAFileHdrStateInternal hdr_parse is first member in tWMAFileStateInternal.
16058 // Codify this assumption. Even here I am limited: if there are more than one
16059 // tWMAFileHdrStateInternal structures in tWMAFileStateInternal, we're lost.
16060
16061 // Check if reading this next field pushes us past end of object
16062 cbWanted = 5*sizeof(unsigned short);
16063 if (iCurrFileOffset + cbWanted > iMaxFileOffset)
16064 {
16065 wmaerr = (WMAERR_CORRUPTDATA);
16066 goto exit;
16067 }
16068
16069 cbActual = AU_CUS_WMA_Parser_WMAGetData(iCurrFileOffset, cbWanted, (char**)&pData);
16070 if(cbActual != cbWanted)
16071 {
16072 wmaerr = (WMAERR_BUFFERTOOSMALL);
16073 goto exit;
16074 }
16075 iCurrFileOffset += cbActual;
16076
16077 LoadWORD(pDesc->title_len, pData);
16078 LoadWORD(pDesc->author_len, pData);
16079 LoadWORD(pDesc->copyright_len, pData);
16080 LoadWORD(pDesc->description_len, pData);
16081 LoadWORD(pDesc->rating_len, pData);
16082
16083 wmaerr = AU_CUS_WMA_Parser_AllocateAndLoadMetadataStr((tHWMAFileState *)pInt, &iCurrFileOffset, iMaxFileOffset, &pDesc->title_len, &pDesc->pTitle);
16084 if (WMAERR_OK != wmaerr)
16085 {
16086 goto exit;
16087 }
16088
16089 wmaerr = AU_CUS_WMA_Parser_AllocateAndLoadMetadataStr((tHWMAFileState *)pInt, &iCurrFileOffset, iMaxFileOffset, &pDesc->author_len, &pDesc->pAuthor);
16090 if (WMAERR_OK != wmaerr)
16091 {
16092 goto exit;
16093 }
16094
16095
16096 wmaerr = AU_CUS_WMA_Parser_AllocateAndLoadMetadataStr((tHWMAFileState *)pInt, &iCurrFileOffset, iMaxFileOffset, &pDesc->copyright_len, &pDesc->pCopyright);
16097 if (WMAERR_OK != wmaerr)
16098 {
16099 goto exit;
16100 }
16101
16102 wmaerr = AU_CUS_WMA_Parser_AllocateAndLoadMetadataStr((tHWMAFileState *)pInt, &iCurrFileOffset, iMaxFileOffset, &pDesc->description_len, &pDesc->pDescription);
16103 if (WMAERR_OK != wmaerr)
16104 {
16105 goto exit;
16106 }
16107
16108
16109 wmaerr = AU_CUS_WMA_Parser_AllocateAndLoadMetadataStr((tHWMAFileState *)pInt, &iCurrFileOffset, iMaxFileOffset, &pDesc->rating_len, &pDesc->pRating);
16110 if (WMAERR_OK != wmaerr)
16111 {
16112 goto exit;
16113 }
16114
16115 // Confirm that we have consumed the entire object EXACTLY
16116
16117 exit:
16118 // Deal with errors in a "transactional" fashion: either succeed completely,
16119 // or fail completely. In other words, clean up if we encountered any errors.
16120 if (WMAERR_OK != wmaerr)
16121 {
16122 if (pInt->m_pDesc)
16123 {
16124 pDesc = pInt->m_pDesc;
16125
16126 // it's OK to pass NULL pointers to free
16127 AU_CUS_WMA_Parser_auFree(pDesc->pTitle);
16128 AU_CUS_WMA_Parser_auFree(pDesc->pAuthor);
16129 AU_CUS_WMA_Parser_auFree(pDesc->pCopyright);
16130 AU_CUS_WMA_Parser_auFree(pDesc->pDescription);
16131 AU_CUS_WMA_Parser_auFree(pDesc->pRating);
16132
16133 AU_CUS_WMA_Parser_auFree(pInt->m_pDesc);
16134 pInt->m_pDesc = NULL;
16135 }
16136 }
16137
16138 // Advance to end of object
16139 pInt->currPacketOffset = iMaxFileOffset;
16140
16141 return wmaerr;
16142 }
16143
AU_CUS_WMA_LoadObjectHeader(tWMAFileHdrStateInternal * pInt,GUID * pObjectId,QWORD * pqwSize)16144 WMAERR AU_CUS_WMA_LoadObjectHeader(tWMAFileHdrStateInternal *pInt, GUID *pObjectId, QWORD *pqwSize)
16145 {
16146 unsigned char *pData = NULL;
16147 unsigned int cbActual = 0;
16148 unsigned int cbWanted = 0;
16149
16150 if(pInt == NULL)
16151 {
16152 return WMAERR_INVALIDARG;
16153 }
16154
16155 cbWanted = MIN_OBJECT_SIZE;
16156 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset, cbWanted, (char**)&pData);
16157 if(cbActual != cbWanted)
16158 {
16159 return WMAERR_BUFFERTOOSMALL;
16160 }
16161
16162 pInt->currPacketOffset += cbActual;
16163
16164 LoadGUID(*pObjectId, pData);
16165 LoadQWORD(*pqwSize, pData);
16166
16167 if (pqwSize->dwLo < MIN_OBJECT_SIZE)
16168 {
16169 return WMAERR_INVALIDHEADER;
16170 }
16171
16172 return WMAERR_OK;
16173 }
16174
AU_CUS_WMA_Parser_LoadEncryptionObject(tWMAFileHdrStateInternal * pInt,unsigned int cbSize)16175 WMAERR AU_CUS_WMA_Parser_LoadEncryptionObject(tWMAFileHdrStateInternal *pInt, unsigned int cbSize)
16176 {
16177 unsigned int cbBlock = 0;
16178 unsigned char *pData = NULL;
16179 unsigned int cbActual = 0;
16180 unsigned int cbWanted = 0;
16181 unsigned int cbObjectOffset = 0;
16182
16183 if(pInt == NULL)
16184 {
16185 return WMAERR_INVALIDARG;
16186 }
16187
16188 cbSize -= MIN_OBJECT_SIZE;
16189
16190 pInt->cbSecretData = 0;
16191
16192 /* SecretData */
16193
16194 cbWanted = sizeof(unsigned int);
16195 if(cbObjectOffset + cbWanted > cbSize)
16196 {
16197 return WMAERR_BUFFERTOOSMALL;
16198 }
16199
16200 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset + cbObjectOffset, cbWanted, (char**)&pData);
16201 if(cbActual != cbWanted)
16202 {
16203 return WMAERR_BUFFERTOOSMALL;
16204 }
16205
16206 cbObjectOffset += cbActual;
16207
16208 LoadDWORD(pInt->cbSecretData, pData);
16209
16210 if (pInt->cbSecretData > 32)
16211 {
16212 return WMAERR_BUFFERTOOSMALL;
16213 }
16214
16215 if(pInt->cbSecretData)
16216 {
16217 cbWanted = pInt->cbSecretData;
16218 if(cbObjectOffset + cbWanted > cbSize)
16219 {
16220 return WMAERR_BUFFERTOOSMALL;
16221 }
16222 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset + cbObjectOffset, cbWanted, (char**)&pData);
16223 if(cbActual != cbWanted)
16224 {
16225 return WMAERR_BUFFERTOOSMALL;
16226 }
16227
16228 cbObjectOffset += cbActual;
16229
16230 if (cbActual <= 32)
16231 {
16232 memcpy(pInt->pbSecretData, pData, (size_t)cbActual);
16233 }
16234 else
16235 {
16236 return WMAERR_BUFFERTOOSMALL;
16237 }
16238 }
16239
16240 /* Type string */
16241
16242 cbWanted = sizeof(unsigned int);
16243 if(cbObjectOffset + cbWanted > cbSize)
16244 {
16245 return WMAERR_BUFFERTOOSMALL;
16246 }
16247 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset + cbObjectOffset, cbWanted, (char**)&pData);
16248 if(cbActual != cbWanted)
16249 {
16250 return WMAERR_BUFFERTOOSMALL;
16251 }
16252
16253 cbObjectOffset += cbActual;
16254
16255 LoadDWORD(cbBlock, pData);
16256
16257 if(cbBlock)
16258 {
16259 cbWanted = cbBlock;
16260 if(cbObjectOffset + cbWanted > cbSize)
16261 {
16262 return WMAERR_BUFFERTOOSMALL;
16263 }
16264 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset + cbObjectOffset, cbWanted, (char**)&pData);
16265 if(cbActual != cbWanted)
16266 {
16267 return WMAERR_BUFFERTOOSMALL;
16268 }
16269
16270 cbObjectOffset += cbActual;
16271
16272 if (cbActual <= 16)
16273 {
16274 memcpy(pInt->pbType, pData, (size_t)cbActual);
16275 }
16276 else
16277 {
16278 return WMAERR_BUFFERTOOSMALL;
16279 }
16280 }
16281
16282 /* Key ID */
16283
16284 cbWanted = sizeof(unsigned int);
16285 if(cbObjectOffset + cbWanted > cbSize)
16286 {
16287 return WMAERR_BUFFERTOOSMALL;
16288 }
16289 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset + cbObjectOffset, cbWanted, (char**)&pData);
16290 if(cbActual != cbWanted)
16291 {
16292 return WMAERR_BUFFERTOOSMALL;
16293 }
16294
16295 cbObjectOffset += cbActual;
16296
16297 LoadDWORD(cbBlock, pData);
16298
16299 if(cbBlock)
16300 {
16301 cbWanted = cbBlock;
16302 if(cbObjectOffset + cbWanted > cbSize)
16303 {
16304 return WMAERR_BUFFERTOOSMALL;
16305 }
16306
16307 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset + cbObjectOffset, cbWanted, (char**)&pData);
16308 if(cbActual != cbWanted)
16309 {
16310 return WMAERR_BUFFERTOOSMALL;
16311 }
16312
16313 cbObjectOffset += cbActual;
16314 if (cbActual <= 32)
16315 {
16316 memcpy(pInt->pbKeyID, pData, (size_t)cbActual);
16317 }
16318 else
16319 {
16320 return WMAERR_BUFFERTOOSMALL;
16321 }
16322 }
16323
16324 /* License URL */
16325
16326 cbWanted = sizeof(unsigned int);
16327 if(cbObjectOffset + cbWanted > cbSize)
16328 {
16329 return WMAERR_BUFFERTOOSMALL;
16330 }
16331 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset + cbObjectOffset, cbWanted, (char**)&pData);
16332 if(cbActual != cbWanted)
16333 {
16334 return WMAERR_BUFFERTOOSMALL;
16335 }
16336
16337 cbObjectOffset += cbActual;
16338
16339 LoadDWORD(cbBlock, pData);
16340
16341 if(cbBlock)
16342 {
16343 cbWanted = cbBlock;
16344 if(cbObjectOffset + cbWanted > cbSize)
16345 {
16346 return WMAERR_BUFFERTOOSMALL;
16347 }
16348 while (cbWanted>0)
16349 {
16350 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->currPacketOffset + cbObjectOffset, cbWanted, (char**)&pData);
16351
16352 cbObjectOffset += cbActual;
16353 cbWanted -= cbActual;
16354
16355 }
16356
16357 /* ignore */
16358 }
16359
16360 /* use all */
16361 pInt->currPacketOffset += cbSize;
16362
16363 return WMAERR_OK;
16364 }
16365
AU_CUS_WMA_Parser_ParseAsfHeader(tWMAFileHdrStateInternal * pInt)16366 WMAERR AU_CUS_WMA_Parser_ParseAsfHeader(tWMAFileHdrStateInternal *pInt)
16367 {
16368 WMAERR wmarc = 0;
16369 GUID objId;
16370 QWORD qwSize;
16371 unsigned short wHeaderObject = 0;
16372 unsigned short wPropertiesObject = 0;
16373 unsigned short wStreamPropertiesObject = 0;
16374 unsigned short wContentDescriptionObject = 0;
16375 unsigned short wExtendedContentDescObject = 0;
16376 unsigned short wLicenceStoreObject = 0;
16377
16378 if(pInt == NULL)
16379 {
16380 return WMAERR_INVALIDARG;
16381 }
16382
16383 /* initialize the some state */
16384
16385 pInt->currPacketOffset = 0;
16386
16387 /* ASF Header Object */
16388
16389 wmarc = AU_CUS_WMA_Parser_LoadHeaderObject(pInt);
16390 if(wmarc != WMAERR_OK)
16391 {
16392 return wmarc;
16393 }
16394 wHeaderObject++;
16395 pInt->cbFirstPacketOffset = pInt->cbHeader += DATA_OBJECT_SIZE;
16396
16397 /* Scan Header Objects */
16398
16399 while(pInt->currPacketOffset < pInt->cbFirstPacketOffset- DATA_OBJECT_SIZE)
16400 {
16401 wmarc = AU_CUS_WMA_LoadObjectHeader(pInt, &objId, &qwSize);
16402
16403 if(wmarc != WMAERR_OK)
16404 {
16405 return wmarc;
16406 }
16407
16408 if(WMA_IsEqualGUID(&CLSID_CAsfPropertiesObjectV2, &objId))
16409 {
16410 wPropertiesObject++;
16411 if (pInt->currPacketOffset + (qwSize.dwLo - MIN_OBJECT_SIZE) > pInt->cbFirstPacketOffset)
16412 {
16413 return WMAERR_FAIL;
16414 }
16415
16416 wmarc = AU_CUS_WMA_Parser_LoadPropertiesObject(pInt, qwSize.dwLo);
16417 if(wmarc != WMAERR_OK)
16418 {
16419 return wmarc;
16420 }
16421 }
16422 else if( WMA_IsEqualGUID( &CLSID_CAsfStreamPropertiesObjectV1, &objId ) || WMA_IsEqualGUID( &CLSID_CAsfStreamPropertiesObjectV2, &objId ) )
16423 {
16424 wStreamPropertiesObject++;
16425 if (pInt->currPacketOffset + (qwSize.dwLo - MIN_OBJECT_SIZE) > pInt->cbFirstPacketOffset)
16426 {
16427 return WMAERR_FAIL;
16428 }
16429
16430 wmarc = AU_CUS_WMA_Parser_LoadAudioObject(pInt, qwSize.dwLo);
16431 if(wmarc != WMAERR_OK)
16432 {
16433 return wmarc;
16434 }
16435 }
16436 else if(WMA_IsEqualGUID(&CLSID_CAsfContentEncryptionObject, &objId))
16437 {
16438 if (pInt->currPacketOffset + (qwSize.dwLo - MIN_OBJECT_SIZE) > pInt->cbFirstPacketOffset)
16439 {
16440 return WMAERR_FAIL;
16441 }
16442
16443 wmarc = AU_CUS_WMA_Parser_LoadEncryptionObject(pInt, qwSize.dwLo);
16444 if(wmarc != WMAERR_OK)
16445 {
16446 return wmarc;
16447 }
16448 }
16449 else if(WMA_IsEqualGUID(&CLSID_CAsfContentDescriptionObjectV0, &objId))
16450 {
16451 wContentDescriptionObject++;
16452 if (pInt->currPacketOffset + (qwSize.dwLo - MIN_OBJECT_SIZE) > pInt->cbFirstPacketOffset)
16453 {
16454 return WMAERR_FAIL;
16455 }
16456
16457 wmarc = AU_CUS_WMA_Parser_LoadContentDescriptionObject(pInt, qwSize.dwLo);
16458 if (WMAERR_OK != wmarc)
16459 {
16460 // Note the error, but ignore it and try to continue. It's just metadata.
16461 wmarc = WMAERR_OK;
16462 }
16463 }
16464 else if(WMA_IsEqualGUID(&CLSID_CAsfExtendedContentDescObject, &objId))
16465 {
16466 wExtendedContentDescObject++;
16467 if (pInt->currPacketOffset + (qwSize.dwLo - MIN_OBJECT_SIZE) > pInt->cbFirstPacketOffset)
16468 {
16469 return WMAERR_FAIL;
16470 }
16471
16472 wmarc = AU_CUS_WMA_Parser_LoadExtendedContentDescObject(pInt, qwSize.dwLo);
16473 if (WMAERR_OK != wmarc)
16474 {
16475 // Note the error, but ignore it and try to continue. It's just metadata.
16476 wmarc = WMAERR_OK;
16477 }
16478 }
16479 else if(WMA_IsEqualGUID(&CLSID_CAsfLicenseStoreObject, &objId))
16480 {
16481 wLicenceStoreObject++;
16482 if (pInt->currPacketOffset + (qwSize.dwLo - MIN_OBJECT_SIZE) > pInt->cbFirstPacketOffset)
16483 {
16484 return WMAERR_FAIL;
16485 }
16486
16487 wmarc = AU_CUS_WMA_Parser_LoadLicenseStoreObject(pInt, qwSize.dwLo);
16488 if(wmarc != WMAERR_OK)
16489 {
16490 return wmarc;
16491 }
16492 }
16493 else if(WMA_IsEqualGUID(&CLSID_CAsfClockObjectV0, &objId))
16494 {
16495 if (pInt->currPacketOffset + (qwSize.dwLo - MIN_OBJECT_SIZE) > pInt->cbFirstPacketOffset)
16496 {
16497 return WMAERR_FAIL;
16498 }
16499
16500 wmarc = AU_CUS_WMA_Parser_LoadClockObject(pInt, qwSize.dwLo);
16501 if(wmarc != WMAERR_OK)
16502 {
16503 return wmarc;
16504 }
16505 }
16506 else
16507 {
16508 /* skip over this object */
16509 pInt->currPacketOffset += qwSize.dwLo - MIN_OBJECT_SIZE;
16510 }
16511 }
16512
16513 if ((wHeaderObject !=1)||(wPropertiesObject !=1)||(wStreamPropertiesObject <1))
16514 {
16515 return WMAERR_FAIL;
16516 }
16517
16518 if(pInt->currPacketOffset != (pInt->cbFirstPacketOffset - DATA_OBJECT_SIZE))
16519 {
16520 return WMAERR_FAIL;
16521 }
16522
16523 return WMAERR_OK;
16524 }
16525
AU_CUS_WMA_Parser_ParsePacketHeader(tWMAFileStateInternal * pInt)16526 WMAERR AU_CUS_WMA_Parser_ParsePacketHeader(tWMAFileStateInternal *pInt)
16527 {
16528 unsigned char b = 0;
16529 PACKET_PARSE_INFO_EX *pParseInfoEx = NULL;
16530 unsigned char *pData = NULL;
16531 unsigned int cbActual = 0;
16532 unsigned int cbWanted = 0;
16533 unsigned int cbLocalOffset = 0;
16534
16535 if(pInt == NULL)
16536 {
16537 return WMAERR_INVALIDARG;
16538 }
16539
16540 pParseInfoEx = &pInt->ppex;
16541
16542 //cbWanted = 24; /* at most */
16543 cbWanted = 1; /* at least */
16544
16545 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->hdr_parse.currPacketOffset, cbWanted, (char**)&pData);
16546
16547 if(cbActual != cbWanted)
16548 {
16549 return WMAERR_BUFFERTOOSMALL;
16550 }
16551
16552 /* ParsePacket begins */
16553 pParseInfoEx->fParityPacket = FALSE;
16554 pParseInfoEx->cbParseOffset = 0;
16555
16556 b = pData[cbLocalOffset];
16557
16558 pParseInfoEx->fEccPresent = (int)( (b&0x80) == 0x80 );
16559 pParseInfoEx->bECLen = 0;
16560
16561 if(pParseInfoEx->fEccPresent)
16562 {
16563 if(b&0x10)
16564 {
16565 pParseInfoEx->fParityPacket = TRUE;
16566 return WMAERR_OK;
16567 }
16568
16569 if(b&0x60)
16570 {
16571 return WMAERR_FAIL;
16572 }
16573
16574 pParseInfoEx->bECLen = (b&0x0f);
16575 if(pParseInfoEx->bECLen != 2)
16576 {
16577 return WMAERR_FAIL;
16578 }
16579
16580 pParseInfoEx->cbParseOffset = (unsigned int)(1 + pParseInfoEx->bECLen);
16581
16582 cbWanted = 1; /* at least */
16583 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset, cbWanted, (char**)&pData);
16584
16585 if(cbActual != cbWanted)
16586 {
16587 return WMAERR_BUFFERTOOSMALL;
16588
16589 }
16590
16591 b = pData[cbLocalOffset];
16592 }
16593
16594 pParseInfoEx->cbPacketLenTypeOffset = pParseInfoEx->cbParseOffset;
16595
16596 pParseInfoEx->bPacketLenType = (b&0x60)>>5;
16597 pParseInfoEx->bPadLenType = (b&0x18)>>3;
16598 pParseInfoEx->bSequenceLenType = (b&0x06)>>1;
16599 pParseInfoEx->fMultiPayloads = (int)(b&0x01);
16600 pParseInfoEx->cbParseOffset++;
16601
16602 cbWanted = 1; /* at least */
16603 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset, cbWanted, (char**)&pData);
16604
16605 if(cbActual != cbWanted)
16606 {
16607 return WMAERR_BUFFERTOOSMALL;
16608 }
16609
16610 b = pData[cbLocalOffset];
16611
16612 pParseInfoEx->bOffsetBytes = 4;
16613 pParseInfoEx->bOffsetLenType = 3;
16614
16615 if(b != 0x5d)
16616 {
16617 if((b&0xc0) != 0x40)
16618 {
16619 return WMAERR_FAIL;
16620 }
16621
16622 if((b&0x30) != 0x10)
16623 {
16624 return WMAERR_FAIL;
16625 }
16626
16627 pParseInfoEx->bOffsetLenType = (b&0x0c)>>2;
16628 if(pParseInfoEx->bOffsetLenType == 0)
16629 {
16630 return WMAERR_FAIL;
16631 }
16632 else if(pParseInfoEx->bOffsetLenType < 3)
16633 {
16634 pParseInfoEx->bOffsetBytes = pParseInfoEx->bOffsetLenType;
16635 }
16636
16637 if((b&0x03) != 0x01)
16638 {
16639 return WMAERR_FAIL;
16640 }
16641 }
16642
16643 pParseInfoEx->cbParseOffset++;
16644 pParseInfoEx->cbPacketLenOffset = pParseInfoEx->cbParseOffset;
16645 switch(pParseInfoEx->bPacketLenType)
16646 {
16647 case 0x01:
16648 {
16649 cbWanted =1;
16650 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset, cbWanted, (char**)&pData);
16651 if(cbActual != cbWanted)
16652 {
16653 return WMAERR_BUFFERTOOSMALL;
16654 }
16655
16656 pParseInfoEx->cbExplicitPacketLength = (unsigned int)(*pData);
16657 pParseInfoEx->cbParseOffset++;
16658 }
16659 break;
16660
16661 case 0x02:
16662 {
16663 unsigned short w=0;
16664 cbWanted =2;
16665 cbActual = AU_CUS_WMA_Parser_WMAGetData( pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset, cbWanted, (char**)&pData);
16666 if(cbActual != cbWanted)
16667 {
16668 return WMAERR_BUFFERTOOSMALL;
16669 }
16670
16671 GetUnalignedWord(pData, w);
16672 pParseInfoEx->cbExplicitPacketLength = (unsigned int)(w);
16673 pParseInfoEx->cbParseOffset+=2;
16674 }
16675 break;
16676
16677 case 0x03:
16678 {
16679 unsigned int dw=0;
16680 cbWanted =4;
16681 cbActual = AU_CUS_WMA_Parser_WMAGetData( pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset, cbWanted, (char**)&pData);
16682 if(cbActual != cbWanted)
16683 {
16684 return WMAERR_BUFFERTOOSMALL;
16685 }
16686 GetUnalignedDword(pData, dw);
16687 pParseInfoEx->cbExplicitPacketLength = dw;
16688 pParseInfoEx->cbParseOffset+=4;
16689
16690 }
16691 break;
16692
16693 default:
16694 {
16695 cbWanted =0;
16696 pParseInfoEx->cbExplicitPacketLength = 0;
16697 }
16698 break;
16699 }
16700
16701 pParseInfoEx->cbSequenceOffset = pParseInfoEx->cbParseOffset;
16702 switch(pParseInfoEx->bSequenceLenType)
16703 {
16704 case 0x01:
16705 {
16706 cbWanted =1;
16707 cbActual = AU_CUS_WMA_Parser_WMAGetData( pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset, cbWanted, (char**)&pData);
16708 if(cbActual != cbWanted)
16709 {
16710 return WMAERR_BUFFERTOOSMALL;
16711 }
16712 pParseInfoEx->dwSequenceNum = (unsigned int)(*pData);
16713 pParseInfoEx->cbParseOffset++;
16714 }
16715 break;
16716
16717 case 0x02:
16718 {
16719 unsigned short w = 0;
16720 cbWanted =2;
16721 cbActual = AU_CUS_WMA_Parser_WMAGetData( pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset, cbWanted, (char**)&pData);
16722 if(cbActual != cbWanted)
16723 {
16724 return WMAERR_BUFFERTOOSMALL;
16725 }
16726 GetUnalignedWord(pData, w);
16727 pParseInfoEx->dwSequenceNum = (unsigned int)(w);
16728 pParseInfoEx->cbParseOffset += 2;
16729 }
16730 break;
16731
16732 case 0x03:
16733 {
16734 unsigned int dw = 0;
16735 cbWanted =4;
16736 cbActual = AU_CUS_WMA_Parser_WMAGetData( pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset, cbWanted, (char**)&pData);
16737 if(cbActual != cbWanted)
16738 {
16739 return WMAERR_BUFFERTOOSMALL;
16740 }
16741 GetUnalignedDword(pData, dw);
16742 pParseInfoEx->dwSequenceNum = dw;
16743 pParseInfoEx->cbParseOffset += 4;
16744 }
16745 break;
16746
16747 default:
16748 {
16749 cbWanted =0;
16750 pParseInfoEx->dwSequenceNum = 0;
16751 }
16752 break;
16753 }
16754
16755 pParseInfoEx->cbPadLenOffset = pParseInfoEx->cbParseOffset;
16756 switch(pParseInfoEx->bPadLenType)
16757 {
16758 case 0x01:
16759 {
16760 cbWanted =1;
16761 cbActual = AU_CUS_WMA_Parser_WMAGetData( pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset, cbWanted, (char**)&pData);
16762 if(cbActual != cbWanted)
16763 {
16764 return WMAERR_BUFFERTOOSMALL;
16765 }
16766 pParseInfoEx->cbPadding = (unsigned int)(*pData);
16767 pParseInfoEx->cbParseOffset++;
16768 }
16769 break;
16770
16771 case 0x02:
16772 {
16773 unsigned short w=0;
16774 cbWanted =2;
16775 cbActual = AU_CUS_WMA_Parser_WMAGetData( pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset,cbWanted, (char**)&pData);
16776 if(cbActual != cbWanted)
16777 {
16778 return WMAERR_BUFFERTOOSMALL;
16779 }
16780 GetUnalignedWord(pData, w);
16781 pParseInfoEx->cbPadding = (unsigned int)(w);
16782 pParseInfoEx->cbParseOffset += 2;
16783 }
16784 break;
16785
16786 case 0x03:
16787 {
16788 unsigned int dw=0;
16789 cbWanted =4;
16790 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset, cbWanted, (char**)&pData);
16791 if(cbActual != cbWanted)
16792 {
16793 return WMAERR_BUFFERTOOSMALL;
16794 }
16795 GetUnalignedDword(pData, dw);
16796 pParseInfoEx->cbPadding = dw;
16797 pParseInfoEx->cbParseOffset += 4;
16798 }
16799 break;
16800
16801 default:
16802 {
16803 cbWanted =0;
16804 pParseInfoEx->cbPadding = 0;
16805 }
16806 break;
16807 }
16808
16809 // Now read 6 bytes
16810 cbWanted =6;
16811 cbActual = AU_CUS_WMA_Parser_WMAGetData( pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset, cbWanted, (char**)&pData);
16812 if(cbActual != cbWanted)
16813 {
16814 return WMAERR_BUFFERTOOSMALL;
16815 }
16816
16817 GetUnalignedDword(&pData[cbLocalOffset], pParseInfoEx->dwSCR);
16818 pParseInfoEx->cbParseOffset += 4;
16819 GetUnalignedWord(&pData[cbLocalOffset+4], pParseInfoEx->wDuration);
16820 pParseInfoEx->cbParseOffset += 2;
16821
16822 /* ParsePacketEx begins */
16823
16824 pParseInfoEx->cbPayLenTypeOffset = 0;
16825 pParseInfoEx->bPayLenType = 0;
16826 pParseInfoEx->bPayBytes = 0;
16827 pParseInfoEx->cPayloads = 1;
16828
16829 if(pParseInfoEx->fMultiPayloads)
16830 {
16831 cbWanted =1;
16832 cbActual = AU_CUS_WMA_Parser_WMAGetData( pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset, cbWanted, (char**)&pData);
16833 if(cbActual != cbWanted)
16834 {
16835 return WMAERR_BUFFERTOOSMALL;
16836 }
16837
16838 b = pData[cbLocalOffset];
16839
16840 pParseInfoEx->cbPayLenTypeOffset = pParseInfoEx->cbParseOffset;
16841
16842 pParseInfoEx->bPayLenType = (b&0xc0)>>6;
16843 if(pParseInfoEx->bPayLenType != 2 && pParseInfoEx->bPayLenType != 1)
16844 {
16845 return WMAERR_FAIL;
16846 }
16847
16848 pParseInfoEx->bPayBytes = pParseInfoEx->bPayLenType;
16849
16850 pParseInfoEx->cPayloads = (unsigned int)(b&0x3f);
16851 if(pParseInfoEx->cPayloads == 0)
16852 {
16853 return WMAERR_FAIL;
16854 }
16855
16856 pParseInfoEx->cbParseOffset++;
16857 }
16858
16859 return WMAERR_OK;
16860 }
16861
AU_CUS_WMA_Parser_ParsePayloadHeader(tWMAFileStateInternal * pInt)16862 WMAERR AU_CUS_WMA_Parser_ParsePayloadHeader(tWMAFileStateInternal *pInt)
16863 {
16864 unsigned int cbParseOffset = 0;
16865 unsigned int cbRepDataOffset = 0;
16866 unsigned int dwPayloadSize = 0;
16867 PACKET_PARSE_INFO_EX *pParseInfoEx = NULL;
16868 PAYLOAD_MAP_ENTRY_EX *pPayload = NULL;
16869 unsigned int cbLocalOffset = 0;
16870
16871 unsigned char *pData = NULL;
16872 unsigned int cbActual = 0;
16873 unsigned int cbWanted = 0;
16874 unsigned short wTotalDataBytes = 0;
16875
16876 if(pInt == NULL)
16877 {
16878 return WMAERR_INVALIDARG;
16879 }
16880
16881 pParseInfoEx = &pInt->ppex;
16882 pPayload = &pInt->payload;
16883
16884 cbWanted = 2; /* at least */
16885 cbActual = AU_CUS_WMA_Parser_WMAGetData( pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset, cbWanted, (char**)&pData);
16886 if(cbActual != cbWanted)
16887 {
16888 return WMAERR_BUFFERTOOSMALL;
16889 }
16890
16891 cbParseOffset = 0;
16892
16893 /* Loop in ParsePacketAndPayloads */
16894
16895 pPayload->cbPacketOffset = (unsigned short)pParseInfoEx->cbParseOffset;
16896 pPayload->bStreamId = (pData[cbParseOffset])&0x7f; // Amit to get correct Streamid
16897 pPayload->bObjectId = pData[cbParseOffset + 1];
16898
16899 switch(pParseInfoEx->bOffsetLenType)
16900 {
16901 case 0x01:
16902 {
16903 cbWanted =1;
16904 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset +2, cbWanted, (char**)&pData);
16905 if(cbActual != cbWanted)
16906 {
16907 return WMAERR_BUFFERTOOSMALL;
16908 }
16909
16910 pPayload->cbObjectOffset = (unsigned int)(*pData);
16911 }
16912 break;
16913
16914 case 0x02:
16915 {
16916 unsigned short w=0;
16917 cbWanted =2;
16918 cbActual = AU_CUS_WMA_Parser_WMAGetData( pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset+2, cbWanted, (char**)&pData);
16919 if(cbActual != cbWanted)
16920 {
16921 return WMAERR_BUFFERTOOSMALL;
16922 }
16923 GetUnalignedWord(pData, w);
16924 pPayload->cbObjectOffset = (unsigned int)(w);
16925 }
16926 break;
16927
16928 case 0x03:
16929 {
16930 unsigned int dw=0;
16931 cbWanted =4;
16932 cbActual = AU_CUS_WMA_Parser_WMAGetData( pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset +2, cbWanted, (char**)&pData);
16933 if(cbActual != cbWanted)
16934 {
16935 return WMAERR_BUFFERTOOSMALL;
16936 }
16937 GetUnalignedDword(pData, dw);
16938 pPayload->cbObjectOffset = dw;
16939 }
16940 break;
16941
16942 default:
16943 {
16944 cbWanted =0;
16945 }
16946 break;
16947 }
16948
16949 cbRepDataOffset = cbParseOffset + 2 + pParseInfoEx->bOffsetBytes;
16950
16951 cbWanted = 1;
16952 cbActual = AU_CUS_WMA_Parser_WMAGetData( pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset + cbRepDataOffset, cbWanted, (char**)&pData);
16953
16954 if(cbActual != cbWanted)
16955 {
16956 return WMAERR_BUFFERTOOSMALL;
16957 }
16958 pPayload->cbRepData = pData[cbLocalOffset];
16959
16960 pPayload->msObjectPres = 0xffffffff;
16961
16962 if(pPayload->cbRepData == 1)
16963 {
16964 pPayload->msObjectPres = pPayload->cbObjectOffset;
16965 pPayload->cbObjectOffset = 0;
16966 pPayload->cbObjectSize = 0;
16967 pPayload->bIsCompressedPayload = 1;
16968
16969 cbWanted =1;
16970 cbActual = AU_CUS_WMA_Parser_WMAGetData( pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset + cbRepDataOffset +1, cbWanted, (char**)&pData);
16971 if(cbActual != cbWanted)
16972 {
16973 return WMAERR_BUFFERTOOSMALL;
16974 }
16975 pPayload->dwDeltaTime = pData[0];
16976
16977 if( pParseInfoEx->fMultiPayloads)
16978 {
16979 cbWanted =2;
16980 cbActual = AU_CUS_WMA_Parser_WMAGetData(pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset + cbRepDataOffset +2, cbWanted, (char**)&pData);
16981
16982 if(cbActual != cbWanted)
16983 {
16984 return WMAERR_BUFFERTOOSMALL;
16985 }
16986
16987 GetUnalignedWord( &pData[cbLocalOffset],wTotalDataBytes );
16988 }
16989 else
16990 {
16991 wTotalDataBytes = 0;
16992 }
16993 }
16994 else if(pPayload->cbRepData >= 8)
16995 {
16996 cbWanted =8;
16997 cbActual = AU_CUS_WMA_Parser_WMAGetData( pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset + cbRepDataOffset +1, cbWanted, (char**)&pData);
16998 if(cbActual != cbWanted)
16999 {
17000 return WMAERR_BUFFERTOOSMALL;
17001 }
17002 GetUnalignedDword(&pData[cbLocalOffset], pPayload->cbObjectSize);
17003 GetUnalignedDword(&pData[cbLocalOffset+ 4], pPayload->msObjectPres);
17004
17005 pPayload->bIsCompressedPayload =0;
17006 }
17007
17008 pPayload->cbTotalSize = 1 + 1 + pParseInfoEx->bOffsetBytes + 1 + pPayload->cbRepData;
17009
17010 if(pParseInfoEx->fMultiPayloads)
17011 {
17012 switch(pParseInfoEx->bPayLenType)
17013 {
17014 case 0x01:
17015 {
17016 cbWanted =1;
17017 cbActual = AU_CUS_WMA_Parser_WMAGetData( pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset +pPayload->cbTotalSize, cbWanted, (char**)&pData);
17018 if(cbActual != cbWanted)
17019 {
17020 return WMAERR_BUFFERTOOSMALL;
17021 }
17022 dwPayloadSize = (unsigned int)(*pData);
17023 }
17024 break;
17025
17026 case 0x02:
17027 {
17028 unsigned short w = 0;
17029 cbWanted = 2;
17030 cbActual = AU_CUS_WMA_Parser_WMAGetData( pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset+pPayload->cbTotalSize, cbWanted, (char**)&pData);
17031 if(cbActual != cbWanted)
17032 {
17033 return WMAERR_BUFFERTOOSMALL;
17034 }
17035 GetUnalignedWord(pData, w);
17036 dwPayloadSize = (unsigned int)(w);
17037 }
17038 break;
17039
17040 case 0x03:
17041 {
17042 unsigned int dw = 0;
17043 cbWanted = 4;
17044 cbActual = AU_CUS_WMA_Parser_WMAGetData( pInt->hdr_parse.currPacketOffset + pParseInfoEx->cbParseOffset + pPayload->cbTotalSize, cbWanted, (char**)&pData);
17045 if(cbActual != cbWanted)
17046 {
17047 return WMAERR_BUFFERTOOSMALL;
17048 }
17049 GetUnalignedDword(pData, dw);
17050 dwPayloadSize = dw;
17051 }
17052 break;
17053
17054 default:
17055 {
17056 cbWanted = 0;
17057 dwPayloadSize = 0;
17058 }
17059 break;
17060 }
17061 }
17062 else if(pParseInfoEx->cbExplicitPacketLength > 0)
17063 {
17064 dwPayloadSize = pParseInfoEx->cbExplicitPacketLength
17065 - pParseInfoEx->cbParseOffset
17066 - pPayload->cbTotalSize
17067 - pParseInfoEx->cbPadding;
17068 }
17069 else
17070 {
17071 dwPayloadSize = pInt->hdr_parse.cbPacketSize - pParseInfoEx->cbParseOffset - pPayload->cbTotalSize - pParseInfoEx->cbPadding;
17072 }
17073
17074 if (0 == wTotalDataBytes)
17075 {
17076 wTotalDataBytes = (unsigned short) dwPayloadSize;
17077 }
17078
17079 pPayload->cbPayloadSize = (unsigned short)dwPayloadSize;
17080
17081 pPayload->cbTotalSize += pParseInfoEx->bPayBytes + (unsigned short)pPayload->cbPayloadSize;
17082
17083 pPayload->wTotalDataBytes = wTotalDataBytes; // Amit
17084
17085 pParseInfoEx->cbParseOffset += pPayload->cbTotalSize;
17086
17087 if(pParseInfoEx->cbParseOffset > pInt->hdr_parse.cbPacketSize || (pParseInfoEx->cbParseOffset == pInt->hdr_parse.cbPacketSize && pInt->iPayload < pParseInfoEx->cPayloads - 1))
17088 {
17089 return WMAERR_CORRUPTDATA;
17090 }
17091
17092 return WMAERR_OK;
17093 }
17094
AU_CUS_WMA_Parser_UpdateNewPayload(tWMAFileStateInternal * pInt)17095 tWMAFileStatus AU_CUS_WMA_Parser_UpdateNewPayload (tWMAFileStateInternal *pInt)
17096 {
17097 /* internal call, so pInt should be okay */
17098
17099 /* HongCho: separated out these parts from the parsing loop, because
17100 * other parts (when a new payload is about to be retrieved)
17101 * need to update the offsets and other states.
17102 *
17103 * used in WMAFileDecodeData() and WMARawDecCBGetData ().
17104 */
17105 int pkt_idx = 0;
17106 WMAERR wmarc;
17107
17108 do
17109 {
17110 switch (pInt->parse_state)
17111 {
17112 case csWMA_NewAsfPacket:
17113 {
17114 if(pInt->hdr_parse.bMstarHeader == 0) // need to parse packet header or payload header only if not Mstar header mode
17115 {
17116 if (pInt->hdr_parse.nextPacketOffset > pInt->hdr_parse.cbLastPacketOffset)
17117 {
17118 return cWMA_NoMoreFrames;
17119 }
17120 pInt->hdr_parse.currPacketOffset = pInt->hdr_parse.nextPacketOffset;
17121 pInt->hdr_parse.nextPacketOffset += pInt->hdr_parse.cbPacketSize;
17122
17123 wmarc = AU_CUS_WMA_Parser_ParsePacketHeader (pInt);
17124 pkt_idx++;
17125
17126 if (wmarc == WMAERR_BUFFERTOOSMALL)
17127 {
17128 pInt->hdr_parse.nextPacketOffset = pInt->hdr_parse.currPacketOffset;
17129 // pInt->hdr_parse.currPacketOffset -= pInt->hdr_parse.cbPacketSize;
17130 return cWMA_NoMoreDataThisTime;
17131 }
17132
17133 if(wmarc != WMAERR_OK)
17134 {
17135 return cWMA_BadPacketHeader;
17136 }
17137
17138 if (pInt->ppex.fEccPresent && pInt->ppex.fParityPacket)
17139 {
17140 /* HongCho: for some reason, ARM's code thinks a parity packet is
17141 * only at the end... Here, I am not assuming that.
17142 */
17143 break;
17144 }
17145 pInt->iPayload = 0; // indicate number of payload processed in this packet
17146 pInt->parse_state = csWMA_DecodePayloadStart;
17147 }
17148 else
17149 {
17150 pInt->iPayload = 0; // indicate number of payload processed in this packet
17151 pInt->parse_state = csWMA_DecodePayloadStart;
17152 pInt->ppex.cPayloads = 1;
17153 }
17154 }
17155 break;
17156
17157 case csWMA_DecodePayloadStart:
17158 {
17159 if(pInt->hdr_parse.bMstarHeader == 0)
17160 {
17161 if (pInt->iPayload >= pInt->ppex.cPayloads) // ppex.cPayloads: information in packet header to indicate total number of payloads in this packet
17162 {
17163 // decode enough number of payloads in this packet --> start next packet
17164 pInt->parse_state = csWMA_NewAsfPacket;
17165 break;
17166 }
17167
17168 wmarc = AU_CUS_WMA_Parser_ParsePayloadHeader(pInt);
17169 if(wmarc != WMAERR_OK)
17170 {
17171 pInt->parse_state = csWMA_DecodePayloadEnd;
17172 break;
17173 }
17174 pInt->wPayStart = pInt->payload.cbPacketOffset + pInt->payload.cbTotalSize - pInt->payload.cbPayloadSize;
17175
17176 if( pInt->payload.cbRepData != 1 )
17177 {
17178 pInt->parse_state = csWMA_DecodePayload;
17179 pInt->payload.bIsCompressedPayload =0; // Amit to take care of compressed payloads.
17180 break;
17181 }
17182 else if(pInt->payload.cbRepData == 1) // Amit to take care of compressed payloads.
17183 {
17184 pInt->parse_state = csWMA_DecodeCompressedPayload;
17185 pInt->payload.bIsCompressedPayload =1;
17186 break;
17187 }
17188 /* a payload has to be a multiple of audio "packets" */
17189
17190 if(pInt->payload.cbPayloadSize%pInt->hdr_parse.nBlockAlign != 0)
17191 {
17192 return cWMA_BrokenFrame;
17193 }
17194 pInt->parse_state = csWMA_DecodePayloadEnd;
17195 }
17196 else
17197 {
17198 pInt->payload.cbRepData = 0;
17199
17200 if( pInt->payload.cbRepData != 1 )
17201 {
17202 pInt->parse_state = csWMA_DecodePayload;
17203 pInt->payload.bIsCompressedPayload =0; // Amit to take care of compressed payloads.
17204 break;
17205 }
17206 else if(pInt->payload.cbRepData == 1) // Amit to take care of compressed payloads.
17207 {
17208 pInt->parse_state = csWMA_DecodeCompressedPayload;
17209 pInt->payload.bIsCompressedPayload =1;
17210 break;
17211 }
17212 }
17213 }
17214 break;
17215
17216 case csWMA_DecodePayload:
17217 {
17218 if(pInt->hdr_parse.bMstarHeader == 0) // need to parse packet header or payload header only if not Mstar header mode
17219 {
17220 if (pInt->payload.bStreamId != pInt->hdr_parse.wAudioStreamId) // Added by Amit to skip Video Payload
17221 {
17222 pInt->parse_state = csWMA_DecodePayloadEnd;
17223 break;
17224 }
17225
17226 // pInt->wPayStart = pInt->payload.cbPacketOffset + pInt->payload.cbTotalSize - pInt->payload.cbPayloadSize;
17227 pInt->cbPayloadOffset = pInt->hdr_parse.currPacketOffset + pInt->wPayStart;
17228 pInt->bBlockStart = TRUE;
17229 pInt->cbBlockLeft = pInt->hdr_parse.nBlockAlign;
17230 pInt->cbPayloadLeft = pInt->payload.cbPayloadSize - pInt->cbBlockLeft;
17231
17232 /* new payload, so take care of DRM */
17233
17234 pInt->parse_state = csWMA_DecodeAudioData;
17235 }
17236 else // mstar header
17237 {
17238 // !!!! note: need to check this offset
17239 pInt->cbPayloadOffset = pInt->hdr_parse.u64CurPayloadOffset;
17240 pInt->bBlockStart = TRUE;
17241 pInt->cbBlockLeft = pInt->hdr_parse.nBlockAlign;
17242 pInt->payload.cbPayloadSize = pInt->hdr_parse.payload_size;
17243 pInt->cbPayloadLeft = pInt->payload.cbPayloadSize - pInt->cbBlockLeft;
17244
17245 pInt->parse_state = csWMA_DecodeAudioData;
17246 }
17247 return cWMA_NoErr;
17248 }
17249 break;
17250
17251 case csWMA_DecodePayloadEnd:
17252 {
17253 pInt->iPayload++;
17254 pInt->parse_state = csWMA_DecodePayloadStart;
17255 }
17256 break;
17257
17258 case csWMA_DecodeCompressedPayload: // Added by Amit to take care of compressed payloads
17259 {
17260 if (pInt->payload.bStreamId != pInt->hdr_parse.wAudioStreamId) // Added by Amit to skip Video Payload
17261 {
17262 pInt->parse_state = csWMA_DecodePayloadEnd;
17263 break;
17264 }
17265
17266 // pInt->cbPayloadOffset = pInt->hdr_parse.currPacketOffset + pInt->wPayStart; // update in main, after parsing Mstar header
17267 pInt->bBlockStart = TRUE;
17268 // pInt->cbBlockLeft = pInt->hdr_parse.nBlockAlign; // update in main, after parsing Mstar header
17269 pInt->payload.wBytesRead = 0;
17270 pInt->payload.bSubPayloadState = 1;
17271 pInt->parse_state = csWMA_DecodeAudioData;
17272
17273 return cWMA_NoErr;
17274 }
17275 break;
17276
17277 default:
17278 {
17279 return cWMA_Internal;
17280 }
17281 break;
17282 }
17283 }
17284 while(1);
17285
17286 return cWMA_NoErr;
17287 }
17288
AU_CUS_WMA_Parser_ParseInputFile(const char * pFileName,int input_file_length)17289 int AU_CUS_WMA_Parser_ParseInputFile(const char *pFileName, int input_file_length)
17290 {
17291 int ret_file_length = 0;
17292 WMAERR wmarc = 0;
17293 FILE *g_intermediateFile = NULL;
17294 tWMAFileStateInternal *pWmaFileStateInternal;
17295 MS_U32 *pU32Tmp;
17296 MS_U8 u8ASFPayloadHeader[16];
17297
17298 g_wmaInput_fp = pAU_debug_input_file;
17299 sDecodeFifo_Info.u32Level = 0;
17300 sDecodeFifo_Info.pStartAddr = WMAPRO_DecodeFifo;
17301 sDecodeFifo_Info.u32Size = WMAPRO_DECODE_FIFO_SIZE;
17302 sDecodeFifo_Info.pWptr = sDecodeFifo_Info.pStartAddr;
17303 sDecodeFifo_Info.pRptr = sDecodeFifo_Info.pStartAddr;
17304 sDecodeFifo_Info.consumed_bytes = 0;
17305 sDecodeFifo_Info.pEndAddr = sDecodeFifo_Info.pStartAddr + sDecodeFifo_Info.u32Size;
17306 memset(sDecodeFifo_Info.pStartAddr, 0, sDecodeFifo_Info.u32Size);
17307
17308 u64FileOffset = 0;
17309 u64offset_expect = 0;
17310
17311 memset(&sWmaHandle, 0, sizeof(tWMAFileStateInternal));
17312 sWmaHandle.hdr_parse.wTargetAudioStreamNumber = 1;
17313 wmarc = AU_CUS_WMA_Parser_ParseAsfHeader(&(sWmaHandle.hdr_parse));
17314 if (wmarc != WMAERR_OK)
17315 {
17316 printf("AU_CUS_WMA_Parser_ParseAsfHeader error\n");
17317 return FALSE;
17318 }
17319 printf("wma_hdr_parse.cbPacketSize : %x\n", (sWmaHandle.hdr_parse).cbPacketSize);
17320 printf("wma_hdr_parse.nBlockAlign : %x\n", (sWmaHandle.hdr_parse).nBlockAlign);
17321 printf("nVersion : %d\n", (sWmaHandle.hdr_parse).nVersion);
17322 printf("nSamplesPerSec : %d\n", (sWmaHandle.hdr_parse).nSamplesPerSec);
17323 printf("nAvgBytesPerSec : %d\n", (sWmaHandle.hdr_parse).nAvgBytesPerSec);
17324 printf("nBlockAlign : %d\n", (sWmaHandle.hdr_parse).nBlockAlign);
17325 printf("nChannels : %d\n", (sWmaHandle.hdr_parse).nChannels);
17326 printf("wBitsPerSample : %d\n", (sWmaHandle.hdr_parse).wBitsPerSample);
17327 printf("dwChannelMask : %d\n", (sWmaHandle.hdr_parse).dwChannelMask);
17328 printf("nEncodeOpt : %d\n", (sWmaHandle.hdr_parse).nEncodeOpt);
17329
17330 pWmaFileStateInternal = &sWmaHandle;
17331 u8ASFPayloadHeader[0] = 0x02;
17332 u8ASFPayloadHeader[1] = 0x80;
17333 u8ASFPayloadHeader[2] = 0xFD;
17334 u8ASFPayloadHeader[3] = 0x7F;
17335 pU32Tmp = (MS_U32 *)(&(u8ASFPayloadHeader[4]));
17336 *pU32Tmp = pWmaFileStateInternal->hdr_parse.nBlockAlign;
17337 memset(&u8ASFPayloadHeader[8], 0, 8);
17338
17339 pWmaFileStateInternal->hdr_parse.cbLastPacketOffset = pWmaFileStateInternal->hdr_parse.cbFirstPacketOffset;
17340 if (pWmaFileStateInternal->hdr_parse.cPackets > 0)
17341 {
17342 pWmaFileStateInternal->hdr_parse.cbLastPacketOffset += ((unsigned long long)pWmaFileStateInternal->hdr_parse.cPackets - 1)*pWmaFileStateInternal->hdr_parse.cbPacketSize;
17343 }
17344
17345 // If broadcast flag is set, packet count is invalid. Override cbLastPacketOffset
17346 if (FILEPROPFLAG_BROADCAST & pWmaFileStateInternal->hdr_parse.dwFilePropertiesFlags)
17347 {
17348 // Set last packet offset to MAX - 1 packet. This prevents us from wrapping around.
17349 pWmaFileStateInternal->hdr_parse.cbLastPacketOffset = -1; // By -1 we mean MAX UNSIGNED VALUE
17350 pWmaFileStateInternal->hdr_parse.cbLastPacketOffset -= pWmaFileStateInternal->hdr_parse.cbPacketSize;
17351 }
17352
17353 pWmaFileStateInternal->hdr_parse.currPacketOffset = pWmaFileStateInternal->hdr_parse.cbHeader;
17354 pWmaFileStateInternal->hdr_parse.nextPacketOffset = pWmaFileStateInternal->hdr_parse.cbHeader;
17355
17356 pWmaFileStateInternal->parse_state = csWMA_NewAsfPacket;
17357
17358 char intermediateFileName[AU_DEBUG_INPUT_STR_LENGTH+1] = {'\0'};
17359
17360 // open intermediate es dump file.
17361 strcpy( intermediateFileName, pFileName);
17362 intermediateFileName[strlen(intermediateFileName)-4] = NULL;
17363 strcat( intermediateFileName, ".es");
17364
17365 g_intermediateFile = fopen(intermediateFileName, "wb");
17366 if (g_intermediateFile == NULL)
17367 {
17368 printf("Open wma intermediate es dump file for writing FAIL %s\n", intermediateFileName);
17369 fclose(pAU_debug_input_file);
17370 return FALSE;
17371 }
17372
17373 printf("original File Path (%s) \n", pFileName);
17374 printf("intermediateFileName (%s) \n", intermediateFileName);
17375
17376 while (1)
17377 {
17378 unsigned char *pData = NULL;
17379 tWMAFileStatus rc1 = cWMA_NoErr;
17380
17381 WMA_DBG_PRINT(printf("FIFO original level (0x%x) \n", (unsigned int)sDecodeFifo_Info.u32Level));
17382 AU_CUS_WMA_Parser_DecodeFifoFeed();
17383 WMA_DBG_PRINT(printf("FIFO new level (0x%x) \n", (unsigned int)sDecodeFifo_Info.u32Level));
17384 if (sDecodeFifo_Info.u32Level < MaxRequestSize)
17385 {
17386 WMA_DBG_PRINT(printf("=== decode FIFO empty === \n"));
17387 goto wma_es_data_dump_to_intermediate_file_finish;
17388 }
17389 rc1 = AU_CUS_WMA_Parser_UpdateNewPayload(pWmaFileStateInternal);
17390 if (rc1 == cWMA_NoMoreDataThisTime)
17391 {
17392 WMA_DBG_PRINT(printf("AU_CUS_WMA_Parser_UpdateNewPayload return cWMA_NoMoreDataThisTime \n"));
17393 goto wma_es_data_dump_to_intermediate_file_finish;
17394 }
17395 WMA_DBG_PRINT(printf("currPacketOffset: %x\n", pWmaFileStateInternal->hdr_parse.currPacketOffset));
17396 WMA_DBG_PRINT(printf("wPayStart : %x\n", pWmaFileStateInternal->wPayStart));
17397
17398 AU_CUS_WMA_Parser_WMAGetData(pWmaFileStateInternal->hdr_parse.currPacketOffset+pWmaFileStateInternal->wPayStart, pWmaFileStateInternal->hdr_parse.nBlockAlign, (char**)&pData);
17399
17400 AU_CUS_FileWrite(u8ASFPayloadHeader, 1, 16, g_intermediateFile);
17401 AU_CUS_FileWrite(pData, 1, pWmaFileStateInternal->hdr_parse.nBlockAlign, g_intermediateFile);
17402 fflush(g_intermediateFile);
17403
17404 WMA_DBG_PRINT(printf("pWmaFileStateInternal->hdr_parse.currPacketOffset+pWmaFileStateInternal->wPayStart+pWmaFileStateInternal->hdr_parse.nBlockAlign: %x \n", pWmaFileStateInternal->hdr_parse.currPacketOffset+pWmaFileStateInternal->wPayStart+pWmaFileStateInternal->hdr_parse.nBlockAlign));
17405 if ((pWmaFileStateInternal->hdr_parse.currPacketOffset+pWmaFileStateInternal->wPayStart+pWmaFileStateInternal->hdr_parse.nBlockAlign) >= input_file_length)
17406 {
17407 goto wma_es_data_dump_to_intermediate_file_finish;
17408 }
17409 pWmaFileStateInternal->hdr_parse.currPacketOffset += (pWmaFileStateInternal->wPayStart+pWmaFileStateInternal->hdr_parse.nBlockAlign);
17410 pWmaFileStateInternal->parse_state = csWMA_DecodePayloadEnd;
17411 }
17412
17413 wma_es_data_dump_to_intermediate_file_finish:
17414 fflush(g_intermediateFile);
17415 fclose(g_intermediateFile);
17416 fclose(pAU_debug_input_file);
17417 pAU_debug_input_file = NULL;
17418 pAU_debug_input_file = fopen(intermediateFileName, "rb");
17419 if (pAU_debug_input_file == NULL)
17420 {
17421 printf("Open wma intermediate es dump file for reading FAIL %s\n", intermediateFileName);
17422 return FALSE;
17423 }
17424
17425 if (fseek(pAU_debug_input_file, 0, SEEK_END))
17426 {
17427 //File seek error.
17428 return FALSE;
17429 }
17430
17431 ret_file_length = ftell(pAU_debug_input_file); //move ptr to begin of file: rewind(fp);
17432 printf("Wma intermediate es dump file length %d\n", ret_file_length);
17433 rewind(pAU_debug_input_file);
17434
17435 MS_U32 Param = 0;
17436 void *pParam = &Param;
17437
17438 Param = 1;
17439 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_PARSINGBYAPP , pParam);
17440
17441 Param = (sWmaHandle.hdr_parse).nSamplesPerSec;
17442 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_SAMPLERATE , pParam);
17443
17444 Param = (sWmaHandle.hdr_parse).nVersion;
17445 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_VERSION , pParam);
17446
17447 Param = (sWmaHandle.hdr_parse).nChannels;
17448 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_CHANNELS , pParam);
17449
17450 Param = (sWmaHandle.hdr_parse).nAvgBytesPerSec;
17451 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_BYTERATE , pParam);
17452
17453 Param = (sWmaHandle.hdr_parse).nEncodeOpt;
17454 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_ENCOPT , pParam);
17455
17456 Param = (sWmaHandle.hdr_parse).wBitsPerSample;
17457 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_BITS_PER_SAMPLE, pParam);
17458
17459 Param = (sWmaHandle.hdr_parse).dwChannelMask;
17460 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_CHANNELMASK , pParam);
17461
17462 Param = (sWmaHandle.hdr_parse).nBlockAlign;
17463 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_ADEC_PARAM_WMA_BLOCKALIGN , pParam);
17464
17465 return ret_file_length;
17466 }
17467 #endif //#if(WMA_AUDIO_PARSER_ENABLE)
17468
17469 #if(XPCM_AUDIO_PARSER_ENABLE)
AU_CUS_XPCM_Parser_ParseInputFile(void)17470 void AU_CUS_XPCM_Parser_ParseInputFile(void)
17471 {
17472 int tmp_readin_buf[50];
17473 int total_dec_size = 0;
17474
17475 MS_U32 WrtBytes = 0;
17476
17477 API_AUDIO_CUSTOMER_XPCM_PARAM xpcm_param;
17478 unsigned char *p_fmt_chunk;
17479 MS_U16 audioType;
17480 int sizeformatex, factchunksize;
17481
17482 AU_UNUSED(WrtBytes);
17483
17484 memset(&xpcm_param, 0, sizeof(xpcm_param));
17485
17486 WrtBytes = fread(tmp_readin_buf, 1, 12, pAU_debug_input_file); // get 12 bytes RIFF chunk -> 4 bytes: "RIFF"+ 4 bytes for RIFF chunk size + 4 bytes: "WAVE".
17487 WrtBytes = fread(tmp_readin_buf, 1, 4, pAU_debug_input_file); // get 4 bytes for fmt chunk identifier: "fmt ".
17488 WrtBytes = fread(&sizeformatex, 1, 4, pAU_debug_input_file); // get 4 bytes for fmt chunk size: formatex.
17489 printf("sizeformatex: %d\n", sizeformatex);
17490 WrtBytes = fread(tmp_readin_buf, 1, sizeformatex, pAU_debug_input_file); // get sizeformatex bytes.
17491
17492 p_fmt_chunk = (unsigned char *)tmp_readin_buf;
17493 memcpy(&audioType, p_fmt_chunk, 2);
17494
17495 switch(audioType)
17496 {
17497 case API_AUDIO_CUSTOMER_XPCM_LPCM:
17498 {
17499 printf("IMA_ADPCM.\n");
17500 xpcm_param.audioType = API_AUDIO_CUSTOMER_XPCM_LPCM;
17501 }
17502 break;
17503
17504 case API_AUDIO_CUSTOMER_XPCM_MS_ADPCM:
17505 {
17506 printf("LPCM.\n");
17507 xpcm_param.audioType = API_AUDIO_CUSTOMER_XPCM_MS_ADPCM;
17508 }
17509 break;
17510
17511 case API_AUDIO_CUSTOMER_XPCM_G711_A_LAW:
17512 {
17513 printf("MS_ADPCM.\n");
17514 xpcm_param.audioType = API_AUDIO_CUSTOMER_XPCM_G711_A_LAW;
17515 }
17516 break;
17517
17518 case API_AUDIO_CUSTOMER_XPCM_G711_u_LAW:
17519 {
17520 printf("G711_A_LAW.\n");
17521 xpcm_param.audioType = API_AUDIO_CUSTOMER_XPCM_G711_u_LAW;
17522 }
17523 break;
17524
17525 case API_AUDIO_CUSTOMER_XPCM_DVD_LPCM:
17526 {
17527 printf("G711_u_LAW.\n");
17528 xpcm_param.audioType = API_AUDIO_CUSTOMER_XPCM_DVD_LPCM;
17529 }
17530 break;
17531
17532 case API_AUDIO_CUSTOMER_XPCM_PRIVATE1_LPCM:
17533 {
17534 printf("MS_ADPCM.\n");
17535 xpcm_param.audioType = API_AUDIO_CUSTOMER_XPCM_PRIVATE1_LPCM;
17536 }
17537 break;
17538
17539 case API_AUDIO_CUSTOMER_XPCM_IMA_ADPCM:
17540 {
17541 printf("G711_A_LAW.\n");
17542 xpcm_param.audioType = API_AUDIO_CUSTOMER_XPCM_IMA_ADPCM;
17543 }
17544 break;
17545
17546 case API_AUDIO_CUSTOMER_XPCM_IMA_ADPCM_APPLE:
17547 {
17548 printf("G711_u_LAW.\n");
17549 xpcm_param.audioType = API_AUDIO_CUSTOMER_XPCM_IMA_ADPCM_APPLE;
17550 }
17551 break;
17552
17553 default:
17554 break;
17555 }
17556
17557 //set channel num
17558 memcpy(&xpcm_param.channels, p_fmt_chunk + 2, 2);
17559 xpcm_param.channels = xpcm_param.channels - 1;
17560
17561 //set sampling rate
17562 memcpy(&xpcm_param.sampleRate, p_fmt_chunk + 4, 4);
17563
17564 //set bit per sample
17565 memcpy(&xpcm_param.bitsPerSample, p_fmt_chunk + 14, 2);
17566
17567 //set block size
17568 memcpy(&xpcm_param.blockSize, p_fmt_chunk + 12, 2);
17569
17570 WrtBytes = fread(tmp_readin_buf, 1, 4, pAU_debug_input_file); // get 4 bytes for next chunk's identifier.
17571 if (0 == memcmp(tmp_readin_buf , "fact", 4)) // if get fact chunk identifier "fact".
17572 {
17573 WrtBytes = fread(&factchunksize, 1, 4, pAU_debug_input_file);
17574 printf("factchunksize : %d\n", factchunksize);
17575 WrtBytes = fread(&total_dec_size, 1, 4, pAU_debug_input_file);
17576 WrtBytes = fread(tmp_readin_buf, 1, 4, pAU_debug_input_file); // get 4 bytes for next chunk's identifier: expect "data"
17577 }
17578 WrtBytes = fread(&total_dec_size, 1, 4, pAU_debug_input_file);
17579 printf("total_dec_size : %d\n", total_dec_size);
17580
17581 // calculate samplePerBlock which is necessary for MS ADPCM.
17582 xpcm_param.samplePerBlock = (((xpcm_param.blockSize - (7 * (xpcm_param.channels+1))) * 8) / (xpcm_param.bitsPerSample * (xpcm_param.channels+1))) + 2;
17583 printf("audio type : %d \n", xpcm_param.audioType);
17584 printf("channels : %d \n", xpcm_param.channels);
17585 printf("sampling rate : %d \n", (int)xpcm_param.sampleRate);
17586 printf("bitsPerSample : %d \n", xpcm_param.bitsPerSample);
17587 printf("blockSize : %d \n", xpcm_param.blockSize);
17588 printf("samplePerBlock : %d \n", xpcm_param.samplePerBlock);
17589
17590 API_AUDIO_CUSTOMER_XPCM_PARAM Param;
17591 memset(&Param, 0, sizeof(Param));
17592
17593 void *pParam = &Param;
17594 Param.audioType = xpcm_param.audioType;
17595 Param.sampleRate = xpcm_param.sampleRate;
17596 Param.blockSize = xpcm_param.blockSize;
17597 Param.samplePerBlock = xpcm_param.samplePerBlock;
17598 Param.channels = xpcm_param.channels;
17599 Param.bitsPerSample = xpcm_param.bitsPerSample;
17600 #if(UTPA_SUPPORT_XPCM_PARAM_CHANNEL_MASK)
17601 Param.dwchannelMask = xpcm_param.dwchannelMask;
17602 #endif //#if(UTPA_SUPPORT_XPCM_PARAM_CHANNEL_MASK)
17603
17604 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_ADEC_PARAM_XPCM, pParam);
17605 }
17606 #endif //#if(XPCM_AUDIO_PARSER_ENABLE)
17607
AU_CUS_AQ_Tuning_MSTAR_SE_Enable(void)17608 void AU_CUS_AQ_Tuning_MSTAR_SE_Enable(void)
17609 {
17610 int arg2, arg3;
17611
17612 AU_nPRINT("MSTAR_SE_TYPE:\n");
17613 AU_nPRINT("API_AUDIO_CUSTOMER_GEQ = 0 \n");
17614 AU_nPRINT("API_AUDIO_CUSTOMER_PEQ = 1 \n");
17615 AU_nPRINT("API_AUDIO_CUSTOMER_HPF = 2 \n");
17616 AU_nPRINT("API_AUDIO_CUSTOMER_DRC = 3 \n");
17617 AU_nPRINT("API_AUDIO_CUSTOMER_AVC = 4 \n");
17618 AU_nPRINT("API_AUDIO_CUSTOMER_BALANCE = 5 \n");
17619
17620 arg2 = AU_CUS_Debug_GetDec();
17621
17622 AU_nPRINT("Enable =1\n");
17623 AU_nPRINT("Disable =0\n");
17624 arg3 = AU_CUS_Debug_GetDec();
17625
17626 API_AUDIO_CUSTOMER_MSTAR_SE_TYPE seType = (API_AUDIO_CUSTOMER_MSTAR_SE_TYPE)arg2;
17627 MS_BOOL bOnOff = (MS_BOOL)arg3;
17628 API_AUDIO_CUSTOMER_MSTAR_SE_Enable(seType, bOnOff);
17629 }
17630
AU_CUS_AQ_Tuning_MSTAR_SE_SET_GEQ(void)17631 void AU_CUS_AQ_Tuning_MSTAR_SE_SET_GEQ(void)
17632 {
17633 int arg2, arg3;
17634
17635 AU_nPRINT("MStar GEQ: \n");
17636 AU_nPRINT("select GEQ band = 0~4 \n");
17637 arg2 = AU_CUS_Debug_GetDec();
17638
17639 AU_nPRINT("set GEQ band level = -48 ~ 48(-12dB ~ 12dB, step 0.25dB) \n");
17640 arg3 = AU_CUS_Debug_GetDec();
17641
17642 MS_U8 u8band = (MS_U8)arg2;
17643 MS_S8 s8level = (MS_U8)arg3;
17644 API_AUDIO_CUSTOMER_MSTAR_SE_SET_GEQ(u8band, s8level);
17645 }
17646
AU_CUS_AQ_Tuning_MSTAR_SE_SET_PEQCoef(void)17647 void AU_CUS_AQ_Tuning_MSTAR_SE_SET_PEQCoef(void)
17648 {
17649 int arg2;
17650 API_AUDIO_CUSTOMER_MSTAR_PEQ_COEF peq_coef;
17651
17652 AU_nPRINT("MStar PEQ: \n");
17653 AU_nPRINT("select PEQ band = 0~7 \n");
17654 arg2 = AU_CUS_Debug_GetDec();
17655 peq_coef.band = (MS_U8)arg2;
17656
17657 AU_nPRINT("1:enable/0:disable peq band\n");
17658 arg2 = AU_CUS_Debug_GetDec();
17659 peq_coef.enable = (MS_BOOL)arg2;
17660
17661 AU_nPRINT("set peq coefficent a0: \n");
17662 arg2 = AU_CUS_Debug_GetHex("");
17663 peq_coef.a0 = (MS_U32)arg2;
17664
17665 AU_nPRINT("set peq coefficent a1: \n");
17666 arg2 = AU_CUS_Debug_GetHex("");
17667 peq_coef.a1 = (MS_U32)arg2;
17668
17669 AU_nPRINT("set peq coefficent a2: \n");
17670 arg2 = AU_CUS_Debug_GetHex("");
17671 peq_coef.a2 = (MS_U32)arg2;
17672
17673 AU_nPRINT("set peq coefficent b1: \n");
17674 arg2 = AU_CUS_Debug_GetHex("");
17675 peq_coef.b1 = (MS_U32)arg2;
17676
17677 AU_nPRINT("set peq coefficent b2: \n");
17678 arg2 = AU_CUS_Debug_GetHex("");
17679 peq_coef.b2 = (MS_U32)arg2;
17680
17681 API_AUDIO_CUSTOMER_MSTAR_SE_SET_PEQCoef(&peq_coef);
17682 }
17683
AU_CUS_AQ_Tuning_MSTAR_SE_SET_HPFCoef(void)17684 void AU_CUS_AQ_Tuning_MSTAR_SE_SET_HPFCoef(void)
17685 {
17686 int arg2;
17687 API_AUDIO_CUSTOMER_MSTAR_HPF_COEF hpf_coef;
17688
17689 AU_nPRINT("MStar HPF: \n");
17690 AU_nPRINT("set hpf coefficent a0: \n");
17691 arg2 = AU_CUS_Debug_GetHex("");
17692 hpf_coef.a0 = (MS_U32)arg2;
17693
17694 AU_nPRINT("set hpf coefficent a1: \n");
17695 arg2 = AU_CUS_Debug_GetHex("");
17696 hpf_coef.a1 = (MS_U32)arg2;
17697
17698 AU_nPRINT("set hpf coefficent a2: \n");
17699 arg2 = AU_CUS_Debug_GetHex("");
17700 hpf_coef.a2 = (MS_U32)arg2;
17701
17702 AU_nPRINT("set hpfcoefficent b1: \n");
17703 arg2 = AU_CUS_Debug_GetHex("");
17704 hpf_coef.b1 = (MS_U32)arg2;
17705
17706 AU_nPRINT("set hpf coefficent b2: \n");
17707 arg2 = AU_CUS_Debug_GetHex("");
17708 hpf_coef.b2 = (MS_U32)arg2;
17709
17710 API_AUDIO_CUSTOMER_MSTAR_SE_SET_HPFCoef(&hpf_coef);
17711 }
17712
AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_MODE(void)17713 void AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_MODE(void)
17714 {
17715 int arg2;
17716
17717 AU_nPRINT("MStar AVC_MODE: \n");
17718 AU_nPRINT("AVC_LINEAR = 0 \n");
17719 AU_nPRINT("AVC_SHIFT = 1 \n");
17720 AU_nPRINT("AVC_NORMAL = 2 \n");
17721 AU_nPRINT("AVC_R = 3 \n");
17722 arg2 = AU_CUS_Debug_GetDec();
17723
17724 API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_MODE((API_AUDIO_CUSTOMER_MSTAR_AVC_MODE)arg2);
17725 }
17726
AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_LEVEL(void)17727 void AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_LEVEL(void)
17728 {
17729 int arg2;
17730
17731 AU_nPRINT("MStar AVC_LEVEL: \n");
17732 AU_nPRINT("0x00-- +0 dBFS \n");
17733 AU_nPRINT("0x01-- -0.5 dBFS \n");
17734 AU_nPRINT("0x20-- -16 dBFS \n");
17735 AU_nPRINT("0x50-- -40 dBFS \n");
17736 arg2 = AU_CUS_Debug_GetDec();
17737
17738 API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_LEVEL((MS_U16)arg2);
17739 }
17740
AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_S_MODE_OFFSET(void)17741 void AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_S_MODE_OFFSET(void)
17742 {
17743 int arg2;
17744
17745 AU_nPRINT("MStar AVC_S_MODE_OFFSET: \n");
17746 AU_nPRINT("range: +0 ~ +12 dB \n");
17747 arg2 = AU_CUS_Debug_GetDec();
17748
17749 API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_S_MODE_OFFSET((MS_U16)arg2);
17750 }
17751
AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_R_MODE_Begin(void)17752 void AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_R_MODE_Begin(void)
17753 {
17754 int arg2;
17755
17756 AU_nPRINT("MStar AVC_R_MODE_Begin: \n");
17757 arg2 = AU_CUS_Debug_GetDec();
17758
17759 API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_Begin((MS_U16)arg2);
17760 }
17761
AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_R_MODE_End(void)17762 void AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_R_MODE_End(void)
17763 {
17764 int arg2;
17765
17766 AU_nPRINT("MStar AVC_R_MODE_End: \n");
17767 arg2 = AU_CUS_Debug_GetDec();
17768
17769 API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_End((MS_U16)arg2);
17770 }
17771
AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_R_MODE_Slope(void)17772 void AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_R_MODE_Slope(void)
17773 {
17774 int arg2;
17775
17776 AU_nPRINT("MStar AVC_R_MODE_Slope: \n");
17777 arg2 = AU_CUS_Debug_GetDec();
17778
17779 API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_Slope((MS_U16)arg2);
17780 }
17781
AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_AttackTime(void)17782 void AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_AttackTime(void)
17783 {
17784 int arg2;
17785
17786 AU_nPRINT("MStar AVC_AttackTime: \n");
17787 AU_nPRINT("AvcAT = 0 --> 20 ms \n");
17788 AU_nPRINT("AvcAT = 1 --> 100 ms \n");
17789 AU_nPRINT("AvcAT = 2 --> 200 ms \n");
17790 AU_nPRINT("AvcAT = 3 --> 1 sec \n");
17791 arg2 = AU_CUS_Debug_GetDec();
17792
17793 API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_AttackTime((MS_U8)arg2);
17794 }
17795
AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_ReleaseTime(void)17796 void AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_ReleaseTime(void)
17797 {
17798 int arg2;
17799
17800 AU_nPRINT("MStar AVC_ReleaseTime: \n");
17801 AU_nPRINT("AvcRT = 0 --> 1 sec \n");
17802 AU_nPRINT("AvcRT = 1 --> 2 sec \n");
17803 AU_nPRINT("AvcRT = 2 --> 100 ms \n");
17804 AU_nPRINT("AvcRT = 3 --> 200 ms \n");
17805 arg2 = AU_CUS_Debug_GetDec();
17806
17807 API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_ReleaseTime((MS_U8)arg2);
17808 }
17809
AU_CUS_AQ_Tuning_MSTAR_SE_SET_DRC_LEVEL(void)17810 void AU_CUS_AQ_Tuning_MSTAR_SE_SET_DRC_LEVEL(void)
17811 {
17812 int arg2;
17813
17814 AU_nPRINT("MStar DRC level:\n");
17815
17816 AU_nPRINT("set DRC level = -48~48(-12dB~12dB, step 0.25dB) \n");
17817 arg2 = AU_CUS_Debug_GetDec();
17818
17819 MS_S8 s8level = (MS_U8)arg2;
17820 API_AUDIO_CUSTOMER_MSTAR_SE_SET_DRC_LEVEL(s8level);
17821 }
17822
AU_CUS_AQ_Tuning_MSTAR_SE_SET_BALANCE(void)17823 void AU_CUS_AQ_Tuning_MSTAR_SE_SET_BALANCE(void)
17824 {
17825 int arg2, arg3;
17826
17827 AU_nPRINT("Lbalance:\n");
17828 arg2 = (MS_U16)AU_CUS_Debug_GetDec();
17829
17830 AU_nPRINT("Rbalance:\n");
17831 arg3 = (MS_U16)AU_CUS_Debug_GetDec();
17832
17833 MS_U16 Lbalance = (MS_U16)arg2;
17834 MS_U16 Rbalance = (MS_U16)arg3;
17835
17836 API_AUDIO_CUSTOMER_MSTAR_SE_SET_BALANCE(Lbalance, Rbalance);
17837 }
17838
AU_CUS_AQ_Tuning_MSTAR_SE_SET_NR_Threshold(void)17839 void AU_CUS_AQ_Tuning_MSTAR_SE_SET_NR_Threshold(void)
17840 {
17841 int arg2;
17842
17843 AU_nPRINT("u16level:\n");
17844 arg2 = AU_CUS_Debug_GetHex("");
17845
17846 MS_U16 u16level = (MS_U16)arg2;
17847
17848 API_AUDIO_CUSTOMER_MSTAR_SE_SET_NR_Threshold(u16level);
17849 }
17850
AU_CUS_AQ_Dump_Data_MSTAR_SE_Upper(void)17851 void AU_CUS_AQ_Dump_Data_MSTAR_SE_Upper(void)
17852 {
17853 AU_nPRINT(" ________________________________________________________________ \n");
17854 AU_nPRINT("| MSTAR_SE_Enable | \n");
17855 AU_nPRINT("|________________________________________________________________| \n");
17856 AU_nPRINT("|MStar_SE_Enable[GEQ] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_Enable[API_AUDIO_CUSTOMER_GEQ] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_GEQ] );
17857 AU_nPRINT("|MStar_SE_Enable[PEQ] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_Enable[API_AUDIO_CUSTOMER_PEQ] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_PEQ] );
17858 AU_nPRINT("|MStar_SE_Enable[HPF] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_Enable[API_AUDIO_CUSTOMER_HPF] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_HPF] );
17859 AU_nPRINT("|MStar_SE_Enable[DRC] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_Enable[API_AUDIO_CUSTOMER_DRC] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DRC] );
17860 AU_nPRINT("|MStar_SE_Enable[AVC] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_Enable[API_AUDIO_CUSTOMER_AVC] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_AVC] );
17861 AU_nPRINT("|MStar_SE_Enable[BALANCE] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_Enable[API_AUDIO_CUSTOMER_BALANCE] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_BALANCE] );
17862 AU_nPRINT("|________________________________________________________________| \n");
17863 AU_nPRINT(" ________________________________________________________________ \n");
17864 AU_nPRINT("| MSTAR_SE_SET_GEQ | \n");
17865 AU_nPRINT("|________________________________________________________________| \n");
17866 AU_nPRINT("|MSTAR_SE_SET_GEQ[0] | = 0x%-8X| UpperSetCnt: %d \n", (int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_GEQ[0] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_GEQ_UpperSetCnt[0] );
17867 AU_nPRINT("|MSTAR_SE_SET_GEQ[1] | = 0x%-8X| UpperSetCnt: %d \n", (int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_GEQ[1] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_GEQ_UpperSetCnt[1] );
17868 AU_nPRINT("|MSTAR_SE_SET_GEQ[2] | = 0x%-8X| UpperSetCnt: %d \n", (int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_GEQ[2] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_GEQ_UpperSetCnt[2] );
17869 AU_nPRINT("|MSTAR_SE_SET_GEQ[3] | = 0x%-8X| UpperSetCnt: %d \n", (int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_GEQ[3] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_GEQ_UpperSetCnt[3] );
17870 AU_nPRINT("|MSTAR_SE_SET_GEQ[4] | = 0x%-8X| UpperSetCnt: %d \n", (int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_GEQ[4] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_GEQ_UpperSetCnt[4] );
17871 AU_nPRINT("|________________________________________________________________| \n");
17872 AU_nPRINT(" ________________________________________________________________ \n");
17873 AU_nPRINT("| MSTAR_SE_SET_PEQCoef | \n");
17874 AU_nPRINT("|________________________________________________________________| \n");
17875 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[0].band | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[0].band , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[0] );
17876 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[0].a0 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[0].a0 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[0] );
17877 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[0].a1 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[0].a1 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[0] );
17878 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[0].a2 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[0].a2 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[0] );
17879 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[0].b1 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[0].b1 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[0] );
17880 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[0].b2 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[0].b2 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[0] );
17881 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[0].enable | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[0].enable , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[0] );
17882 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[0].scale | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[0].scale , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[0] );
17883 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[1].band | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[1].band , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[1] );
17884 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[1].a0 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[1].a0 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[1] );
17885 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[1].a1 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[1].a1 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[1] );
17886 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[1].a2 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[1].a2 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[1] );
17887 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[1].b1 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[1].b1 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[1] );
17888 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[1].b2 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[1].b2 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[1] );
17889 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[1].enable | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[1].enable , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[1] );
17890 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[1].scale | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[1].scale , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[1] );
17891 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[2].band | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[2].band , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[2] );
17892 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[2].a0 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[2].a0 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[2] );
17893 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[2].a1 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[2].a1 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[2] );
17894 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[2].a2 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[2].a2 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[2] );
17895 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[2].b1 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[2].b1 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[2] );
17896 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[2].b2 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[2].b2 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[2] );
17897 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[2].enable | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[2].enable , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[2] );
17898 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[2].scale | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[2].scale , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[2] );
17899 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[3].band | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[3].band , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[3] );
17900 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[3].a0 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[3].a0 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[3] );
17901 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[3].a1 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[3].a1 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[3] );
17902 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[3].a2 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[3].a2 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[3] );
17903 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[3].b1 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[3].b1 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[3] );
17904 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[3].b2 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[3].b2 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[3] );
17905 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[3].enable | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[3].enable , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[3] );
17906 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[3].scale | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[3].scale , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[3] );
17907 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[4].band | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[4].band , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[4] );
17908 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[4].a0 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[4].a0 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[4] );
17909 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[4].a1 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[4].a1 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[4] );
17910 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[4].a2 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[4].a2 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[4] );
17911 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[4].b1 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[4].b1 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[4] );
17912 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[4].b2 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[4].b2 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[4] );
17913 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[4].enable | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[4].enable , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[4] );
17914 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[4].scale | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[4].scale , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[4] );
17915 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[5].band | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[5].band , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[5] );
17916 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[5].a0 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[5].a0 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[5] );
17917 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[5].a1 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[5].a1 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[5] );
17918 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[5].a2 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[5].a2 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[5] );
17919 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[5].b1 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[5].b1 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[5] );
17920 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[5].b2 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[5].b2 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[5] );
17921 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[5].enable | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[5].enable , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[5] );
17922 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[5].scale | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[5].scale , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[5] );
17923 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[6].band | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[6].band , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[6] );
17924 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[6].a0 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[6].a0 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[6] );
17925 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[6].a1 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[6].a1 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[6] );
17926 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[6].a2 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[6].a2 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[6] );
17927 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[6].b1 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[6].b1 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[6] );
17928 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[6].b2 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[6].b2 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[6] );
17929 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[6].enable | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[6].enable , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[6] );
17930 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[6].scale | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[6].scale , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[6] );
17931 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[7].band | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[7].band , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[7] );
17932 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[7].a0 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[7].a0 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[7] );
17933 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[7].a1 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[7].a1 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[7] );
17934 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[7].a2 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[7].a2 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[7] );
17935 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[7].b1 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[7].b1 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[7] );
17936 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[7].b2 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[7].b2 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[7] );
17937 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[7].enable | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[7].enable , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[7] );
17938 AU_nPRINT("|MSTAR_SE_SET_PEQCoef[7].scale | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[7].scale , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[7] );
17939 AU_nPRINT("|________________________________________________________________| \n");
17940 AU_nPRINT(" ________________________________________________________________ \n");
17941 AU_nPRINT("| MSTAR_SE_SET_HPFCoef | \n");
17942 AU_nPRINT("|________________________________________________________________| \n");
17943 AU_nPRINT("|MSTAR_SE_SET_HPFCoef.a0 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_HPFCoef.a0 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_HPFCoef_UpperSetCnt );
17944 AU_nPRINT("|MSTAR_SE_SET_HPFCoef.a1 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_HPFCoef.a1 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_HPFCoef_UpperSetCnt );
17945 AU_nPRINT("|MSTAR_SE_SET_HPFCoef.a2 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_HPFCoef.a2 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_HPFCoef_UpperSetCnt );
17946 AU_nPRINT("|MSTAR_SE_SET_HPFCoef.b1 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_HPFCoef.b1 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_HPFCoef_UpperSetCnt );
17947 AU_nPRINT("|MSTAR_SE_SET_HPFCoef.b2 | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_HPFCoef.b2 , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_HPFCoef_UpperSetCnt );
17948 AU_nPRINT("|________________________________________________________________| \n");
17949 AU_nPRINT(" ________________________________________________________________ \n");
17950 AU_nPRINT("| MSTAR_SE_SET_AVC_MODE | \n");
17951 AU_nPRINT("|________________________________________________________________| \n");
17952 AU_nPRINT("|MSTAR_SE_SET_AVC_MODE | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_MODE , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_MODE_UpperSetCnt );
17953 AU_nPRINT("|________________________________________________________________| \n");
17954 AU_nPRINT(" ________________________________________________________________ \n");
17955 AU_nPRINT("| MSTAR_SE_SET_AVC_LEVEL | \n");
17956 AU_nPRINT("|________________________________________________________________| \n");
17957 AU_nPRINT("|MSTAR_SE_SET_AVC_LEVEL | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_LEVEL , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_LEVEL_UpperSetCnt );
17958 AU_nPRINT("|________________________________________________________________| \n");
17959 AU_nPRINT("| MSTAR_SE_SET_AVC_R_Mode | \n");
17960 AU_nPRINT("|________________________________________________________________| \n");
17961 AU_nPRINT("|MSTAR_SE_SET_AVC_R_Mode_Begin | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_R_MODE_Begin , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_R_MODE_Begin_UpperSetCnt );
17962 AU_nPRINT("|MSTAR_SE_SET_AVC_R_Mode_End | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_R_MODE_End , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_R_MODE_End_UpperSetCnt );
17963 AU_nPRINT("|MSTAR_SE_SET_AVC_R_Mode_Slope | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_R_MODE_Slope , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_R_MODE_Slope_UpperSetCnt );
17964 AU_nPRINT(" ________________________________________________________________ \n");
17965 AU_nPRINT("| MSTAR_SE_SET_AVC_S_MODE_OFFSET | \n");
17966 AU_nPRINT("|________________________________________________________________| \n");
17967 AU_nPRINT("|MSTAR_SE_SET_AVC_S_MODE_OFFSET | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_S_MODE_OFFSET , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_S_MODE_OFFSET_UpperSetCnt );
17968 AU_nPRINT("|________________________________________________________________| \n");
17969 AU_nPRINT(" ________________________________________________________________ \n");
17970 AU_nPRINT("| MSTAR_SE_SET_AVC_AttackTime | \n");
17971 AU_nPRINT("|________________________________________________________________| \n");
17972 AU_nPRINT("|MSTAR_SE_SET_AVC_AttackTime | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_AttackTime , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_AttackTime_UpperSetCnt );
17973 AU_nPRINT("|________________________________________________________________| \n");
17974 AU_nPRINT(" ________________________________________________________________ \n");
17975 AU_nPRINT("| MSTAR_SE_SET_AVC_ReleaseTime | \n");
17976 AU_nPRINT("|________________________________________________________________| \n");
17977 AU_nPRINT("|MSTAR_SE_SET_AVC_ReleaseTime | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_ReleaseTime , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_ReleaseTime_UpperSetCnt );
17978 AU_nPRINT("|________________________________________________________________| \n");
17979 AU_nPRINT(" ________________________________________________________________ \n");
17980 AU_nPRINT("| MSTAR_SE_SET_DRC_LEVEL | \n");
17981 AU_nPRINT("|________________________________________________________________| \n");
17982 AU_nPRINT("|MSTAR_SE_SET_DRC_LEVEL | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_DRC_LEVEL , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_DRC_LEVEL_UpperSetCnt );
17983 AU_nPRINT("|________________________________________________________________| \n");
17984 AU_nPRINT(" ________________________________________________________________ \n");
17985 AU_nPRINT("| MSTAR_SE_SET_BALANCE | \n");
17986 AU_nPRINT("|________________________________________________________________| \n");
17987 AU_nPRINT("|MSTAR_SE_SET_BALANCE_L | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_BALANCE_L , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_BALANCE_UpperSetCnt );
17988 AU_nPRINT("|MSTAR_SE_SET_BALANCE_R | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_BALANCE_R , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_BALANCE_UpperSetCnt );
17989 AU_nPRINT("|________________________________________________________________| \n");
17990 AU_nPRINT(" ________________________________________________________________ \n");
17991 AU_nPRINT("| MSTAR_SE_NR | \n");
17992 AU_nPRINT("|________________________________________________________________| \n");
17993 AU_nPRINT("|MSTAR_SE_SET_NR_Threshold | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_NR_Threshold , (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_NR_Threshold_UpperSetCnt );
17994 AU_nPRINT("|MSTAR_SE_GET_NR_Status | = 0x%-8X \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_GET_NR_Threshold );
17995 AU_nPRINT("|________________________________________________________________| \n");
17996 }
17997
AU_CUS_AQ_Tuning_DTS_SE_Enable(void)17998 void AU_CUS_AQ_Tuning_DTS_SE_Enable(void)
17999 {
18000 unsigned int arg2;
18001
18002 AU_nPRINT("DTS_SE_TYPE:\n");
18003 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_TSXT = 0 \n");
18004 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_TSHD = 1 \n");
18005 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_THEATERSOUND = 2 \n");
18006 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PURESND = 3 \n");
18007 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_STUDIOSOUND_3D = 4 \n");
18008
18009 AU_nPRINT("Enter Option: \n");
18010 arg2 = AU_CUS_Debug_GetDec();
18011
18012 API_AUDIO_CUSTOMER_DTS_SE_TYPE seType = (API_AUDIO_CUSTOMER_DTS_SE_TYPE)arg2;
18013 API_AUDIO_CUSTOMER_DTS_SE_Enable(seType);
18014 }
18015
AU_CUS_AQ_Tuning_DTS_SE_ProcessUnit_Enable(void)18016 void AU_CUS_AQ_Tuning_DTS_SE_ProcessUnit_Enable(void)
18017 {
18018 unsigned int arg2, arg3;
18019
18020 AU_nPRINT("DTS_SE_UNIT_TYPE:\n");
18021 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TOTAL = 0 \n");
18022 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD = 1 \n");
18023 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD_DEFINITION = 2 \n");
18024 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD_DC = 3 \n");
18025 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD_SURR = 4 \n");
18026 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD_TRUBASS = 5 \n");
18027 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD_TRUBASS_LVL_INDPT = 6 \n");
18028 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_CC3D = 7 \n");
18029 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_CC3D_DEPTH_PROCESS = 8 \n");
18030 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TRUVOLUME = 9 \n");
18031 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TRUVOLUME_NORMALIZER = 10 \n");
18032 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TRUDIALOG = 11 \n");
18033 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_CC3D_TBHDX = 12 \n");
18034 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_GEQ = 13 \n");
18035 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_UNIT_PURESOUND_HL = 14 \n");
18036 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_UNIT_PURESOUND_AEQ = 15 \n");
18037 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_UNIT_PURESOUND_HPF = 16 \n");
18038
18039 AU_nPRINT("Enter Option: \n");
18040 arg2 = AU_CUS_Debug_GetDec();
18041
18042 AU_nPRINT("1: Enable, 0: Disable:\n");
18043 arg3 = AU_CUS_Debug_GetDec();
18044
18045 API_AUDIO_CUSTOMER_DTS_SE_UNIT_TYPE seUnit = (API_AUDIO_CUSTOMER_DTS_SE_UNIT_TYPE)arg2;
18046 MS_BOOL bEn = (MS_BOOL)arg3;
18047 API_AUDIO_CUSTOMER_DTS_SE_ProcessUnit_Enable(seUnit, bEn);
18048 }
18049
AU_CUS_AQ_Tuning_DTS_SE_SetParam(void)18050 void AU_CUS_AQ_Tuning_DTS_SE_SetParam(void)
18051 {
18052 unsigned int arg2, arg3;
18053
18054 AU_nPRINT("DTS_SE_PARAM_TYPE:\n");
18055 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_INPUT_GAIN_FXP24 = 0 \n");
18056 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_DEFINITION_CTRL_FXP24 = 1 \n");
18057 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_DC_LEVEL_CTRL_FXP24 = 2 \n");
18058 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_SURR_LEVEL_CTRL_FXP24 = 3 \n");
18059 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_CTRL_FXP24 = 4 \n");
18060 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_COMPR_CTRL_FXP24 = 5 \n");
18061 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_PROCESS_MODE = 6 \n");
18062 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_SPKSIZE = 7 \n");
18063 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_CUS_SPKSIZE = 8 \n");
18064 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_CUS_SPKSIZE_ANALYSIS = 9 \n");
18065 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_MAIN_CTRL_HEADROOM_GAIN_FXP24 = 10 \n");
18066 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_MAIN_CTRL_BYPASS_GAIN_FXP24 = 11 \n");
18067 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_MAIN_CTRL_CC3D_PROCESS_PATH = 12 \n");
18068 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_INPUT_GAIN_FXP24 = 13 \n");
18069 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUVOLUME_MODE = 14 \n");
18070 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUVOLUME_REF_LEVEL_FXP24 = 15 \n");
18071 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUVOLUME_MAX_GAIN_FXP24 = 16 \n");
18072 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUVOLUME_NORMALIZE_THRESH_FXP24 = 17 \n");
18073 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUDIALOG_INPUT_GAIN_FXP24 = 18 \n");
18074 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUDIALOG_CLARITY_GAIN_FXP24 = 19 \n");
18075 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUDIALOG_PROCESS_GAIN_FXP24 = 20 \n");
18076 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_INPUT_GAIN_FXP24 = 21 \n");
18077 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_BASSLEVEL_FXP24 = 22 \n");
18078 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_SPEAKERSIZE = 23 \n");
18079 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_HP_ORDER = 24 \n");
18080 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_DYNAMICS_FXP24 = 25 \n");
18081 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_MODE = 26 \n");
18082 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CS_INPUT_GAIN_FXP24 = 27 \n");
18083 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CS_PROCESS_MODE = 28 \n");
18084 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CS_LR_OUTPUT_GAIN_FXP24 = 29 \n");
18085 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CS_LsRs_OUTPUT_GAIN_FXP24 = 30 \n");
18086 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CS_Center_OUTPUT_GAIN_FXP24 = 31 \n");
18087 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_INPUT_GAIN_FXP24 = 32 \n");
18088 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_BAND0_GAIN_FXP24 = 33 \n");
18089 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_BAND1_GAIN_FXP24 = 34 \n");
18090 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_BAND2_GAIN_FXP24 = 35 \n");
18091 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_BAND3_GAIN_FXP24 = 36 \n");
18092 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_BAND4_GAIN_FXP24 = 37 \n");
18093 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_INPUT_GAIN_FXP24 = 38 \n");
18094 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_OUTPUT_GAIN_FXP24 = 39 \n");
18095 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_BYPASS_GAIN_FXP24 = 40 \n");
18096 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_LIMITERBOOST_FXP24 = 41 \n");
18097 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_HARDLIMIT_CTRL_FXP24 = 42 \n");
18098 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_DELAY = 43 \n");
18099 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_AEQ_INPUT_GAIN_FXP24 = 44 \n");
18100 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_AEQ_OUTPUT_GAIN_FXP24 = 45 \n");
18101 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_AEQ_BYPASS_GAIN_FXP24 = 46 \n");
18102 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HPF_FREQUENCY = 47 \n");
18103 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_INPUT_GAIN_FXP24 = 48 \n");
18104 AU_nPRINT("API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_OUTPUT_GAIN_FXP24 = 49 \n");
18105
18106 AU_nPRINT("Enter Option: \n");
18107 arg2 = AU_CUS_Debug_GetDec();
18108
18109 AU_nPRINT("if upper layer need to set 0.5: u32value should be 0.5*8388607 = 0x3FFFFF \n");
18110 AU_nPRINT("if upper layer need to set 2.0: u32value should be 2.0*8388607 = 0xFFFFFE \n");
18111 AU_nPRINT("Enter Param (u32value): \n");
18112 arg3 = AU_CUS_Debug_GetHex("");
18113
18114 API_AUDIO_CUSTOMER_DTS_SE_PARAM_TYPE param = (API_AUDIO_CUSTOMER_DTS_SE_PARAM_TYPE)arg2;
18115 MS_U32 u32value = (MS_U32)arg3;
18116
18117 API_AUDIO_CUSTOMER_DTS_SE_SetParam(param, u32value);
18118 }
18119
AU_CUS_AQ_Tuning_Dolby_DAP_Enable(void)18120 void AU_CUS_AQ_Tuning_Dolby_DAP_Enable(void)
18121 {
18122 unsigned int arg2;
18123
18124 AU_nPRINT("bOnOff:\n");
18125 arg2 = AU_CUS_Debug_GetDec();
18126
18127 MS_BOOL bOnOff = (MS_BOOL)arg2;
18128 API_AUDIO_CUSTOMER_Dolby_DAP_Enable(bOnOff);
18129 }
18130
AU_CUS_AQ_Tuning_Dolby_DAP_ProcessUnit_Enable(void)18131 void AU_CUS_AQ_Tuning_Dolby_DAP_ProcessUnit_Enable(void)
18132 {
18133 unsigned int arg2;
18134
18135 AU_nPRINT("bOnOff:\n");
18136 arg2 = AU_CUS_Debug_GetDec();
18137
18138 MS_BOOL bOnOff = (MS_BOOL)arg2;
18139 API_AUDIO_CUSTOMER_Dolby_DAP_ProcessUnit_Enable(bOnOff);
18140 }
18141
AU_CUS_AQ_Tuning_Dolby_DAP_SetParam(void)18142 void AU_CUS_AQ_Tuning_Dolby_DAP_SetParam(void)
18143 {
18144 //Demo of Dolby DAP Default params
18145 API_AUDIO_CUSTOMER_DOLBY_DAP_PARAM DolbyDap_default_params =
18146 {
18147 0, // int pregain; -> dap_cpdp_pregain_set
18148 0, // int postgain; -> dap_cpdp_postgain_set
18149 0, // int systemgain; -> dap_cpdp_system_gain_set
18150 1, // int surround_decoder_enable; -> dap_cpdp_surround_decoder_enable_set
18151 1, // int virtualizer_enable; -> dap_cpdp_output_mode_set(DAP_CPDP_OUTPUT_2_SPEAKER)
18152 0, // headphone_reverb; -> dap_cpdp_virtualizer_headphone_reverb_gain_set
18153 5, // int speaker_angle; -> dap_cpdp_virtualizer_speaker_angle_set
18154 200, // int speaker_start; -> dap_cpdp_virtualizer_speaker_start_freq_set
18155 96, // int surround_boost; -> dap_cpdp_surround_boost_set
18156 0, // int mi_ieq_enable; -> dap_cpdp_mi2ieq_steering_enable_set
18157 0, // int mi_dv_enable; -> dap_cpdp_mi2dv_leveler_steering_enable_set
18158 0, // int mi_de_enable; -> dap_cpdp_mi2dialog_enhancer_steering_enable_set
18159 0, // int mi_surround_enable; -> dap_cpdp_mi2surround_compressor_steering_enable_set
18160 0, // int calibration_boost; -> dap_cpdp_calibration_boost_set
18161 7, // int leveler_amount; -> dap_cpdp_volume_leveler_amount_set
18162 -496, // int leveler_input; -> dap_cpdp_volume_leveler_in_target_set
18163 -496, // int leveler_output; -> dap_cpdp_volume_leveler_out_target_set
18164 0, // int leveler_enable; -> dap_cpdp_volume_leveler_enable_set
18165 0, // int modeler_enable; -> dap_cpdp_volume_modeler_enable_set
18166 0, // int modeler_calibration; -> dap_cpdp_volume_modeler_calibration_set
18167 0, // int ieq_enable; -> dap_cpdp_ieq_enable_set
18168 10, // int ieq_amount; -> dap_cpdp_ieq_amount_set
18169 20, // int ieq_nb_bands; -> dap_cpdp_ieq_bands_set
18170 { // int a_ieq_band_center[DAP_IEQ_MAX_BANDS];
18171 65, 136, 223, 332, 467, 634, 841, 1098, 1416, 1812,
18172 2302, 2909, 3663, 4598, 5756, 7194, 8976, 11186, 13927, 17326
18173 },
18174 { // int a_ieq_band_target[DAP_IEQ_MAX_BANDS];
18175 117, 133, 188, 176, 141, 149, 175, 185, 185, 200,
18176 236, 242, 228, 213, 182, 132, 110, 68, -27, -240
18177 },
18178 1, // int de_enable; -> dap_cpdp_de_enable_set
18179 9, // int de_amount; -> dap_cpdp_de_amount_set
18180 0, // int de_ducking; -> dap_cpdp_de_ducking_set
18181 0, // int volmax_boost; -> dap_cpdp_volmax_boost_set
18182 0, // int geq_enable; -> dap_cpdp_graphic_equalizer_enable_set
18183 0, // int geq_nb_bands; -> dap_cpdp_graphic_equalizer_bands_set
18184 { // int a_geq_band_center[DAP_GEQ_MAX_BANDS];
18185 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
18186 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
18187 },
18188 { // int a_geq_band_target[DAP_GEQ_MAX_BANDS];
18189 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
18190 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
18191 },
18192 1, // int optimizer_enable; -> dap_cpdp_audio_optimizer_enable_set
18193 20, // int ao_bands; -> dap_cpdp_audio_optimizer_bands_set
18194 { // int ao_band_center_freq[DAP_OPT_MAX_BANDS];
18195 47, 141, 234, 328, 469, 656, 844, 1031, 1313, 1688,
18196 2250, 3000, 3750, 4688, 5813, 7125, 9000, 11250, 13875, 19688
18197 },
18198 { // int ao_band_gains[DAP_MAX_CHANNELS][DAP_OPT_MAX_BANDS];
18199 {
18200 0, 48, 159, 55, 53, 41, 2, 26, 25, 60,
18201 68, 51, 69, -21, 54, 99, 176, 192, 192, 185
18202 },
18203 {
18204 0, 48, 159, 55, 53, 41, 2, 26, 25, 60,
18205 68, 51, 69, -21, 54, 99, 176, 165, 187, 192
18206 },
18207 {
18208 0, 48, 159, 55, 53, 41, 2, 26, 25, 60,
18209 68, 51, 69, -21, 54, 99, 176, 192, 192, 185
18210 },
18211 {
18212 0, 48, 159, 55, 53, 41, 2, 26, 25, 60,
18213 68, 51, 69, -21, 54, 99, 176, 192, 192, 185
18214 },
18215 {
18216 0, 48, 159, 55, 53, 41, 2, 26, 25, 60,
18217 68, 51, 69, -21, 54, 99, 176, 192, 192, 185
18218 },
18219 {
18220 0, 48, 159, 55, 53, 41, 2, 26, 25, 60,
18221 68, 51, 69, -21, 54, 99, 176, 192, 192, 185
18222 },
18223 },
18224 1, // int bass_enable; -> dap_cpdp_bass_enhancer_enable_set
18225 177, // int bass_boost; -> dap_cpdp_bass_enhancer_boost_set
18226 140, // int bass_cutoff; -> dap_cpdp_bass_enhancer_cutoff_frequency_set
18227 9, // int bass_width; -> dap_cpdp_bass_enhancer_width_set
18228 20, // int ar_bands; -> dap_cpdp_regulator_tuning_set
18229 { // int ar_band_center_freq[DAP_REG_MAX_BANDS];
18230 47, 141, 234, 328, 469, 656, 844, 1031, 1313, 1688,
18231 2250, 3000, 3750, 4688, 5813, 7125, 9000, 11250, 13875, 19688
18232 },
18233 { // int ar_low_thresholds[DAP_REG_MAX_BANDS];
18234 -496, -192, -448, -384, -192, -192, -192, -192, -192, -192,
18235 -192, -192, -192, -192, -192, -192, -192, -192, -192, -192
18236 },
18237 { // int ar_high_thresholds[DAP_REG_MAX_BANDS];
18238 -304, 0, -256, -192, 0, 0, 0, 0, 0, 0,
18239 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
18240 },
18241 { // int ar_isolated_bands[DAP_REG_MAX_BANDS];
18242 1, 0, 1, 1, 0, 0, 0, 0, 0, 0,
18243 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
18244 },
18245 0, // int regulator_overdrive; -> dap_cpdp_regulator_overdrive_set
18246 12, // int regulator_timbre; -> dap_cpdp_regulator_timbre_preservation_set
18247 96, // int regulator_distortion; -> dap_cpdp_regulator_relaxation_amount_set
18248 1, // int regulator_mode; -> dap_cpdp_regulator_speaker_distortion_enable_set
18249 1, // int regulator_enable; -> dap_cpdp_regulator_enable_set
18250 3, // int virtual_bass_mode;
18251 55, // int virtual_bass_low_src_freq;
18252 110, // int virtual_bass_high_src_freq;
18253 0, // int virtual_bass_overall_gain;
18254 -2, // int virtual_bass_slope_gain;
18255 { // int virtual_bass_subgain[3];
18256 -80, -240, -400
18257 },
18258 110, //int virtual_bass_mix_low_freq;
18259 281, //int virtual_bass_mix_high_freq;
18260 };
18261
18262 API_AUDIO_CUSTOMER_Dolby_DAP_SetParam(DolbyDap_default_params);
18263 }
18264
AU_CUS_AQ_Dump_Data_DTS_SE_Upper(void)18265 void AU_CUS_AQ_Dump_Data_DTS_SE_Upper(void)
18266 {
18267 AU_nPRINT("======================================================================================================================================= \n");
18268 AU_nPRINT("** [01] DTS_SE_Enable ** \n");
18269 AU_nPRINT("======================================================================================================================================= \n");
18270 AU_nPRINT(" ________________________________________________________________ \n");
18271 AU_nPRINT("| DTS_SE_Enable | \n");
18272 AU_nPRINT("|________________________________________________________________| \n");
18273 AU_nPRINT("|DTS_SE_Enable[API_AUDIO_CUSTOMER_DTS_SE_TSXT] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_Enable[API_AUDIO_CUSTOMER_DTS_SE_TSXT] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_TSXT] );
18274 AU_nPRINT("|DTS_SE_Enable[API_AUDIO_CUSTOMER_DTS_SE_TSHD] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_Enable[API_AUDIO_CUSTOMER_DTS_SE_TSHD] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_TSHD] );
18275 AU_nPRINT("|DTS_SE_Enable[API_AUDIO_CUSTOMER_DTS_SE_THEATERSOUND] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_Enable[API_AUDIO_CUSTOMER_DTS_SE_THEATERSOUND] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_THEATERSOUND] );
18276 AU_nPRINT("|DTS_SE_Enable[API_AUDIO_CUSTOMER_DTS_SE_PURESND] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_Enable[API_AUDIO_CUSTOMER_DTS_SE_PURESND] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PURESND] );
18277 AU_nPRINT("|DTS_SE_Enable[API_AUDIO_CUSTOMER_DTS_SE_STUDIOSOUND_3D] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_Enable[API_AUDIO_CUSTOMER_DTS_SE_STUDIOSOUND_3D] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_STUDIOSOUND_3D] );
18278 AU_nPRINT("| | \n");
18279 AU_nPRINT("|________________________________________________________________| \n");
18280 AU_nPRINT("======================================================================================================================================= \n");
18281 AU_nPRINT("** [02] DTS_SE_ProcessUnit_Enable ** \n");
18282 AU_nPRINT("======================================================================================================================================= \n");
18283 AU_nPRINT(" ________________________________________________________________ \n");
18284 AU_nPRINT("| TSHD | \n");
18285 AU_nPRINT("|________________________________________________________________| \n");
18286 AU_nPRINT("|DTS_SE_ProcessUnit_Enable[THEATERSOUND_TOTAL] | = 0x%-8X| UpperSetCnt:%d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TOTAL] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TOTAL] );
18287 AU_nPRINT("|DTS_SE_ProcessUnit_Enable[THEATERSOUND_TSHD] | = 0x%-8X| UpperSetCnt:%d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD] );
18288 AU_nPRINT("|DTS_SE_ProcessUnit_Enable[THEATERSOUND_TSHD_DEFINITION] | = 0x%-8X| UpperSetCnt:%d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD_DEFINITION] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD_DEFINITION] );
18289 AU_nPRINT("|DTS_SE_ProcessUnit_Enable[THEATERSOUND_TSHD_DC] | = 0x%-8X| UpperSetCnt:%d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD_DC] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD_DC] );
18290 AU_nPRINT("|DTS_SE_ProcessUnit_Enable[THEATERSOUND_TSHD_SURR] | = 0x%-8X| UpperSetCnt:%d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD_SURR] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD_SURR] );
18291 AU_nPRINT("|DTS_SE_ProcessUnit_Enable[THEATERSOUND_TSHD_TRUBASS] | = 0x%-8X| UpperSetCnt:%d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD_TRUBASS] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD_TRUBASS] );
18292 AU_nPRINT("|DTS_SE_ProcessUnit_Enable[THEATERSOUND_TSHD_TRUBASS_LVL_INDPT] | = 0x%-8X| UpperSetCnt:%d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD_TRUBASS_LVL_INDPT] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TSHD_TRUBASS_LVL_INDPT] );
18293 AU_nPRINT("| | \n");
18294 AU_nPRINT("|________________________________________________________________| \n");
18295 AU_nPRINT(" ________________________________________________________________ \n");
18296 AU_nPRINT("| CC3D Controls (CC3D must enable) | \n");
18297 AU_nPRINT("|________________________________________________________________| \n");
18298 AU_nPRINT("|DTS_SE_ProcessUnit_Enable[THEATERSOUND_CC3D] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_CC3D] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_CC3D] );
18299 AU_nPRINT("|DTS_SE_ProcessUnit_Enable[THEATERSOUND_CC3D_DEPTH_PROCESS] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_CC3D_DEPTH_PROCESS] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_CC3D_DEPTH_PROCESS] );
18300 AU_nPRINT("| | \n");
18301 AU_nPRINT("|________________________________________________________________| \n");
18302 AU_nPRINT(" ________________________________________________________________ \n");
18303 AU_nPRINT("| TRUVOLUME HD | \n");
18304 AU_nPRINT("|________________________________________________________________| \n");
18305 AU_nPRINT("|DTS_SE_ProcessUnit_Enable[THEATERSOUND_TRUVOLUME] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TRUVOLUME] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TRUVOLUME] );
18306 AU_nPRINT("|DTS_SE_ProcessUnit_Enable[THEATERSOUND_TRUVOLUME_NORMALIZER] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TRUVOLUME_NORMALIZER] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TRUVOLUME_NORMALIZER] );
18307 AU_nPRINT("| | \n");
18308 AU_nPRINT("|________________________________________________________________| \n");
18309 AU_nPRINT(" ________________________________________________________________ \n");
18310 AU_nPRINT("| TRUDIALOG | \n");
18311 AU_nPRINT("|________________________________________________________________| \n");
18312 AU_nPRINT("|DTS_SE_ProcessUnit_Enable[THEATERSOUND_TRUDIALOG] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TRUDIALOG] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_TRUDIALOG] );
18313 AU_nPRINT("| | \n");
18314 AU_nPRINT("|________________________________________________________________| \n");
18315 AU_nPRINT(" ________________________________________________________________ \n");
18316 AU_nPRINT("| TBHDX | \n");
18317 AU_nPRINT("|________________________________________________________________| \n");
18318 AU_nPRINT("|DTS_SE_ProcessUnit_Enable[THEATERSOUND_CC3D_TBHDX] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_CC3D_TBHDX] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_CC3D_TBHDX] );
18319 AU_nPRINT("| | \n");
18320 AU_nPRINT("|________________________________________________________________| \n");
18321 AU_nPRINT(" ________________________________________________________________ \n");
18322 AU_nPRINT("| GEQ | \n");
18323 AU_nPRINT("|________________________________________________________________| \n");
18324 AU_nPRINT("|DTS_SE_ProcessUnit_Enable[THEATERSOUND_GEQ] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_GEQ] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_UNIT_THEATERSOUND_GEQ] );
18325 AU_nPRINT("| | \n");
18326 AU_nPRINT("|________________________________________________________________| \n");
18327 AU_nPRINT(" ________________________________________________________________ \n");
18328 AU_nPRINT("| PURESOUND HRADLIMITER | \n");
18329 AU_nPRINT("|________________________________________________________________| \n");
18330 AU_nPRINT("|DTS_SE_ProcessUnit_Enable[PURESOUND_HL] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable[API_AUDIO_CUSTOMER_DTS_SE_UNIT_PURESOUND_HL] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_UNIT_PURESOUND_HL] );
18331 AU_nPRINT("| | \n");
18332 AU_nPRINT("|________________________________________________________________| \n");
18333 AU_nPRINT(" ________________________________________________________________ \n");
18334 AU_nPRINT("| PURESOUND AEQ | \n");
18335 AU_nPRINT("|________________________________________________________________| \n");
18336 AU_nPRINT("|DTS_SE_ProcessUnit_Enable[PURESOUND_AEQ] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable[API_AUDIO_CUSTOMER_DTS_SE_UNIT_PURESOUND_AEQ] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_UNIT_PURESOUND_AEQ] );
18337 AU_nPRINT("| | \n");
18338 AU_nPRINT("|________________________________________________________________| \n");
18339 AU_nPRINT(" ________________________________________________________________ \n");
18340 AU_nPRINT("| PURESOUND HPF | \n");
18341 AU_nPRINT("|________________________________________________________________| \n");
18342 AU_nPRINT("|DTS_SE_ProcessUnit_Enable[PURESOUND_HPF] | = 0x-8%X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable[API_AUDIO_CUSTOMER_DTS_SE_UNIT_PURESOUND_HPF] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_UNIT_PURESOUND_HPF] );
18343 AU_nPRINT("| | \n");
18344 AU_nPRINT("|________________________________________________________________| \n");
18345 AU_nPRINT(" \n");
18346 AU_nPRINT("======================================================================================================================================= \n");
18347 AU_nPRINT("** [03] DTS_SE_SetParam ** \n");
18348 AU_nPRINT("======================================================================================================================================= \n");
18349 AU_nPRINT(" ________________________________________________________________ \n");
18350 AU_nPRINT("| TSHD | \n");
18351 AU_nPRINT("|________________________________________________________________| \n");
18352 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_TSHD_INPUT_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_INPUT_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_INPUT_GAIN_FXP24] );
18353 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_TSHD_DEFINITION_CTRL_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_DEFINITION_CTRL_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_DEFINITION_CTRL_FXP24] );
18354 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_TSHD_DC_LEVEL_CTRL_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_DC_LEVEL_CTRL_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_DC_LEVEL_CTRL_FXP24] );
18355 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_TSHD_SURR_LEVEL_CTRL_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_SURR_LEVEL_CTRL_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_SURR_LEVEL_CTRL_FXP24] );
18356 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_TSHD_TRUBASS_CTRL_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_CTRL_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_CTRL_FXP24] );
18357 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_TSHD_TRUBASS_COMPR_CTRL_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_COMPR_CTRL_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_COMPR_CTRL_FXP24] );
18358 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_TSHD_TRUBASS_PROCESS_MODE] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_PROCESS_MODE] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_PROCESS_MODE] );
18359 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_TSHD_TRUBASS_SPKSIZE] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_SPKSIZE] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_SPKSIZE] );
18360 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_TSHD_TRUBASS_CUS_SPKSIZE] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_CUS_SPKSIZE] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_CUS_SPKSIZE] );
18361 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_TSHD_TRUBASS_CUS_SPKSIZE_ANALYSIS] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_CUS_SPKSIZE_ANALYSIS] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TSHD_TRUBASS_CUS_SPKSIZE_ANALYSIS] );
18362 AU_nPRINT("| | \n");
18363 AU_nPRINT("|________________________________________________________________| \n");
18364 AU_nPRINT(" ________________________________________________________________ \n");
18365 AU_nPRINT("| Main Controls | \n");
18366 AU_nPRINT("|________________________________________________________________| \n");
18367 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_MAIN_CTRL_HEADROOM_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_MAIN_CTRL_HEADROOM_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_MAIN_CTRL_HEADROOM_GAIN_FXP24] );
18368 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_MAIN_CTRL_BYPASS_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_MAIN_CTRL_BYPASS_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_MAIN_CTRL_BYPASS_GAIN_FXP24] );
18369 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_MAIN_CTRL_CC3D_PROCESS_PATH] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_MAIN_CTRL_CC3D_PROCESS_PATH] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_MAIN_CTRL_CC3D_PROCESS_PATH] );
18370 AU_nPRINT("| | \n");
18371 AU_nPRINT("|________________________________________________________________| \n");
18372 AU_nPRINT(" ________________________________________________________________ \n");
18373 AU_nPRINT("| CC3D Controls | \n");
18374 AU_nPRINT("|________________________________________________________________| \n");
18375 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_CC3D_INPUT_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_INPUT_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_INPUT_GAIN_FXP24] );
18376 AU_nPRINT("| | \n");
18377 AU_nPRINT("|________________________________________________________________| \n");
18378 AU_nPRINT(" ________________________________________________________________ \n");
18379 AU_nPRINT("| TRUVOLUME HD | \n");
18380 AU_nPRINT("|________________________________________________________________| \n");
18381 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_TRUVOLUME_MODE] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUVOLUME_MODE] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUVOLUME_MODE] );
18382 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_TRUVOLUME_REF_LEVEL_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUVOLUME_REF_LEVEL_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUVOLUME_REF_LEVEL_FXP24] );
18383 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_TRUVOLUME_MAX_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUVOLUME_MAX_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUVOLUME_MAX_GAIN_FXP24] );
18384 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_TRUVOLUME_NORMALIZE_THRESH_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUVOLUME_NORMALIZE_THRESH_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUVOLUME_NORMALIZE_THRESH_FXP24] );
18385 AU_nPRINT("| | \n");
18386 AU_nPRINT("|________________________________________________________________| \n");
18387 AU_nPRINT(" ________________________________________________________________ \n");
18388 AU_nPRINT("| TRUDIALOG | \n");
18389 AU_nPRINT("|________________________________________________________________| \n");
18390 AU_nPRINT("|DTS_SE_SetParam[TRUDIALOG_INPUT_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUDIALOG_INPUT_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUDIALOG_INPUT_GAIN_FXP24] );
18391 AU_nPRINT("|DTS_SE_SetParam[TRUDIALOG_CLARITY_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUDIALOG_CLARITY_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUDIALOG_CLARITY_GAIN_FXP24] );
18392 AU_nPRINT("|DTS_SE_SetParam[TRUDIALOG_PROCESS_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUDIALOG_PROCESS_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_TRUDIALOG_PROCESS_GAIN_FXP24] );
18393 AU_nPRINT("| | \n");
18394 AU_nPRINT("|________________________________________________________________| \n");
18395 AU_nPRINT(" ________________________________________________________________ \n");
18396 AU_nPRINT("| TBHDX | \n");
18397 AU_nPRINT("|________________________________________________________________| \n");
18398 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_CC3D_TBHDX_INPUT_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_INPUT_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_INPUT_GAIN_FXP24] );
18399 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_CC3D_TBHDX_BASSLEVEL_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_BASSLEVEL_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_BASSLEVEL_FXP24] );
18400 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_CC3D_TBHDX_SPEAKERSIZE] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_SPEAKERSIZE] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_SPEAKERSIZE] );
18401 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_CC3D_TBHDX_HP_ORDER] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_HP_ORDER] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_HP_ORDER] );
18402 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_CC3D_TBHDX_DYNAMICS_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_DYNAMICS_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_DYNAMICS_FXP24] );
18403 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_CC3D_TBHDX_MODE] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_MODE] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CC3D_TBHDX_MODE] );
18404 AU_nPRINT("| | \n");
18405 AU_nPRINT("|________________________________________________________________| \n");
18406 AU_nPRINT(" ________________________________________________________________ \n");
18407 AU_nPRINT("| CS DECODER | \n");
18408 AU_nPRINT("|________________________________________________________________| \n");
18409 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_CS_INPUT_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CS_INPUT_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CS_INPUT_GAIN_FXP24] );
18410 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_CS_PROCESS_MODE] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CS_PROCESS_MODE] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CS_PROCESS_MODE] );
18411 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_CS_LR_OUTPUT_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CS_LR_OUTPUT_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CS_LR_OUTPUT_GAIN_FXP24] );
18412 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_CS_LsRs_OUTPUT_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CS_LsRs_OUTPUT_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CS_LsRs_OUTPUT_GAIN_FXP24] );
18413 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_CS_Center_OUTPUT_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CS_Center_OUTPUT_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_CS_Center_OUTPUT_GAIN_FXP24] );
18414 AU_nPRINT("| | \n");
18415 AU_nPRINT("|________________________________________________________________| \n");
18416 AU_nPRINT(" ________________________________________________________________ \n");
18417 AU_nPRINT("| GEQ | \n");
18418 AU_nPRINT("|________________________________________________________________| \n");
18419 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_GEQ_INPUT_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_INPUT_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_INPUT_GAIN_FXP24] );
18420 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_GEQ_BAND0_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_BAND0_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_BAND0_GAIN_FXP24] );
18421 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_GEQ_BAND1_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_BAND1_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_BAND1_GAIN_FXP24] );
18422 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_GEQ_BAND2_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_BAND2_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_BAND2_GAIN_FXP24] );
18423 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_GEQ_BAND3_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_BAND3_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_BAND3_GAIN_FXP24] );
18424 AU_nPRINT("|DTS_SE_SetParam[THEATERSOUND_GEQ_BAND4_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_BAND4_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_THEATERSOUND_GEQ_BAND4_GAIN_FXP24] );
18425 AU_nPRINT("| | \n");
18426 AU_nPRINT("|________________________________________________________________| \n");
18427 AU_nPRINT(" ________________________________________________________________ \n");
18428 AU_nPRINT("| PURESOUND HRADLIMITER | \n");
18429 AU_nPRINT("|________________________________________________________________| \n");
18430 AU_nPRINT("|DTS_SE_SetParam[PURESOUND_HL_INPUT_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_INPUT_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_INPUT_GAIN_FXP24] );
18431 AU_nPRINT("|DTS_SE_SetParam[PURESOUND_HL_OUTPUT_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_OUTPUT_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_OUTPUT_GAIN_FXP24] );
18432 AU_nPRINT("|DTS_SE_SetParam[PURESOUND_HL_BYPASS_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_BYPASS_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_BYPASS_GAIN_FXP24] );
18433 AU_nPRINT("|DTS_SE_SetParam[PURESOUND_HL_LIMITERBOOST_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_LIMITERBOOST_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_LIMITERBOOST_FXP24] );
18434 AU_nPRINT("|DTS_SE_SetParam[PURESOUND_HL_HARDLIMIT_CTRL_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_HARDLIMIT_CTRL_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_HARDLIMIT_CTRL_FXP24] );
18435 AU_nPRINT("|DTS_SE_SetParam[PURESOUND_HL_DELAY] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_DELAY] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HL_DELAY] );
18436 AU_nPRINT("| | \n");
18437 AU_nPRINT("|________________________________________________________________| \n");
18438 AU_nPRINT(" ________________________________________________________________ \n");
18439 AU_nPRINT("| PURESOUND AEQ | \n");
18440 AU_nPRINT("|________________________________________________________________| \n");
18441 AU_nPRINT("|DTS_SE_SetParam[PURESOUND_AEQ_INPUT_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_AEQ_INPUT_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_AEQ_INPUT_GAIN_FXP24] );
18442 AU_nPRINT("|DTS_SE_SetParam[PURESOUND_AEQ_OUTPUT_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_AEQ_OUTPUT_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_AEQ_OUTPUT_GAIN_FXP24] );
18443 AU_nPRINT("|DTS_SE_SetParam[PURESOUND_AEQ_BYPASS_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_AEQ_BYPASS_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_AEQ_BYPASS_GAIN_FXP24] );
18444 AU_nPRINT("| | \n");
18445 AU_nPRINT("|________________________________________________________________| \n");
18446 AU_nPRINT(" ________________________________________________________________ \n");
18447 AU_nPRINT("| PURESOUND HPF | \n");
18448 AU_nPRINT("|________________________________________________________________| \n");
18449 AU_nPRINT("|DTS_SE_SetParam[PURESOUND_HPF_FREQUENCY] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HPF_FREQUENCY] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_HPF_FREQUENCY] );
18450 AU_nPRINT("| | \n");
18451 AU_nPRINT("|________________________________________________________________| \n");
18452 AU_nPRINT(" ________________________________________________________________ \n");
18453 AU_nPRINT("| PURESOUND hash only | \n");
18454 AU_nPRINT("|________________________________________________________________| \n");
18455 AU_nPRINT("|DTS_SE_SetParam[PURESOUND_INPUT_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_INPUT_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_INPUT_GAIN_FXP24] );
18456 AU_nPRINT("|DTS_SE_SetParam[PURESOUND_OUTPUT_GAIN_FXP24] | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_OUTPUT_GAIN_FXP24] , (unsigned int)pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[API_AUDIO_CUSTOMER_DTS_SE_PARAM_PURESOUND_OUTPUT_GAIN_FXP24] );
18457 AU_nPRINT("| | \n");
18458 AU_nPRINT("|________________________________________________________________| \n");
18459 AU_nPRINT("======================================================================================================================================= \n");
18460 }
18461
AU_CUS_AQ_Dump_Data_DTS_SE_R2(int sleepTime)18462 void AU_CUS_AQ_Dump_Data_DTS_SE_R2(int sleepTime)
18463 {
18464 MS_U16 orignal_REG_BANK_R2_LOG_DBG;
18465 MS_U16 orignal_REG_BANK_R2_UART;
18466
18467 orignal_REG_BANK_R2_LOG_DBG = AU_CUS_ReadAbsReg((MS_U32)REG_BANK_R2_LOG_DBG);
18468 orignal_REG_BANK_R2_UART = AU_CUS_ReadAbsReg((MS_U32)REG_BANK_R2_UART);
18469
18470 AU_nPRINT("orignal_REG_BANK_R2_LOG_DBG = 0x%-4X,\n", orignal_REG_BANK_R2_LOG_DBG);
18471 AU_nPRINT("orignal_REG_BANK_R2_UART = 0x%-4X,\n", orignal_REG_BANK_R2_UART);
18472
18473 //Set R2
18474 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_R2_UART, (MS_U16)REG_BANK_R2_SND_UART_ENABLE);
18475 AU_CUS_WriteAbsMaskReg((MS_U32)REG_BANK_SND_R2_SRS, 0x80, 0x80); // SRS print msg
18476 sleep(sleepTime);
18477
18478 //Recover
18479 AU_CUS_WriteAbsMaskReg((MS_U32)REG_BANK_SND_R2_SRS, 0x80, 0x00); // SRS print msg
18480 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_R2_UART, (MS_U16)orignal_REG_BANK_R2_UART);
18481 }
18482
AU_CUS_AQ_Dump_Data_DAP_Upper(void)18483 void AU_CUS_AQ_Dump_Data_DAP_Upper(void)
18484 {
18485 AU_nPRINT("======================================================================================================================================= \n");
18486 AU_nPRINT("** [01] Dolby_DAP_Enable ** \n");
18487 AU_nPRINT("======================================================================================================================================= \n");
18488 AU_nPRINT(" ________________________________________________________________ \n");
18489 AU_nPRINT("| Dolby_DAP_Enable | \n");
18490 AU_nPRINT("|________________________________________________________________| \n");
18491 AU_nPRINT("|g_audio_customer_Dolby_DAP_Enable | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_Enable, (unsigned int)pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_Enable_UpperSetCnt );
18492 AU_nPRINT("| | \n");
18493 AU_nPRINT("|________________________________________________________________| \n");
18494 AU_nPRINT("======================================================================================================================================= \n");
18495 AU_nPRINT("** [02] Dolby_DAP_ProcessUnit_Enable ** \n");
18496 AU_nPRINT("======================================================================================================================================= \n");
18497 AU_nPRINT(" ________________________________________________________________ \n");
18498 AU_nPRINT("| Dolby_DAP_ProcessUnit_Enable | \n");
18499 AU_nPRINT("|________________________________________________________________| \n");
18500 AU_nPRINT("|g_audio_customer_Dolby_DAP_ProcessUnit_Enable | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_ProcessUnit_Enable, (unsigned int)pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_ProcessUnit_Enable_UpperSetCnt );
18501 AU_nPRINT("| | \n");
18502 AU_nPRINT("|________________________________________________________________| \n");
18503 AU_nPRINT("======================================================================================================================================= \n");
18504 AU_nPRINT("** [03] Dolby_DAP_SetParam ** \n");
18505 AU_nPRINT("======================================================================================================================================= \n");
18506 AU_nPRINT(" ________________________________________________________________ \n");
18507 AU_nPRINT("| Dolby_DAP_SetParam | \n");
18508 AU_nPRINT("|________________________________________________________________| \n");
18509 AU_nPRINT("|g_audio_customer_Dolby_DAP_ProcessUnit_Enable | = 0x%-8X| UpperSetCnt: %d \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_ProcessUnit_Enable, (unsigned int)pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam_UpperSetCnt );
18510 AU_nPRINT("| | \n");
18511 AU_nPRINT("|________________________________________________________________| \n");
18512 AU_nPRINT(" %-8d, pregain \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.pregain );
18513 AU_nPRINT(" %-8d, postgain \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.postgain );
18514 AU_nPRINT(" %-8d, systemgain \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.systemgain );
18515 AU_nPRINT(" %-8d, surround_decoder_enable \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.surround_decoder_enable );
18516 AU_nPRINT(" %-8d, virtualizer_enable \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.virtualizer_enable );
18517 AU_nPRINT(" %-8d, headphone_reverb \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.headphone_reverb );
18518 AU_nPRINT(" %-8d, speaker_angle \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.speaker_angle );
18519 AU_nPRINT(" %-8d, speaker_start \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.speaker_start );
18520 AU_nPRINT(" %-8d, surround_boost \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.surround_boost );
18521 AU_nPRINT(" %-8d, mi_ieq_enable \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.mi_ieq_enable );
18522 AU_nPRINT(" %-8d, mi_dv_enable \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.mi_dv_enable );
18523 AU_nPRINT(" %-8d, mi_de_enable \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.mi_de_enable );
18524 AU_nPRINT(" %-8d, mi_surround_enable \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.mi_surround_enable );
18525 AU_nPRINT(" %-8d, calibration_boost \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.calibration_boost );
18526 AU_nPRINT(" %-8d, leveler_amount \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.leveler_amount );
18527 AU_nPRINT(" %-8d, leveler_input \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.leveler_input );
18528 AU_nPRINT(" %-8d, leveler_output \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.leveler_output );
18529 AU_nPRINT(" %-8d, leveler_enable \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.leveler_enable );
18530 AU_nPRINT(" %-8d, modeler_enable \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.modeler_enable );
18531 AU_nPRINT(" %-8d, modeler_calibration \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.modeler_calibration );
18532 AU_nPRINT(" %-8d, ieq_enable \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.ieq_enable );
18533 AU_nPRINT(" %-8d, ieq_amount \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.ieq_amount );
18534 AU_nPRINT(" %-8d, ieq_nb_bands \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.ieq_nb_bands );
18535 AU_nPRINT(" { a_ieq_band_center[DOLBY_DAP_IEQ_MAX_BANDS] \n");
18536 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[0], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[1], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[2], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[3], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[4], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[5], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[6], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[7], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[8], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[9]);
18537 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[10], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[11], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[12], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[13], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[14], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[15], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[16], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[17], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[18], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[19]);
18538 AU_nPRINT(" } \n");
18539 AU_nPRINT(" { a_ieq_band_target[DOLBY_DAP_IEQ_MAX_BANDS] \n");
18540 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[0], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[1], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[2], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[3], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[4], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[5], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[6], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[7], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[8], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[9]);
18541 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[10], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[11], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[12], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[13], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[14], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[15], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[16], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[17], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[18], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[19]);
18542 AU_nPRINT(" } \n");
18543 AU_nPRINT(" %-8d, de_enable \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.de_enable );
18544 AU_nPRINT(" %-8d, de_amount \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.de_amount );
18545 AU_nPRINT(" %-8d, de_ducking \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.de_ducking );
18546 AU_nPRINT(" %-8d, volmax_boost \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.volmax_boost );
18547 AU_nPRINT(" %-8d, geq_enable \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.geq_enable );
18548 AU_nPRINT(" %-8d, geq_nb_bands \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.geq_nb_bands );
18549 AU_nPRINT(" { a_geq_band_center[DOLBY_DAP_GEQ_MAX_BANDS] \n");
18550 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[0], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[1], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[2], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[3], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[4], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[5], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[6], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[7], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[8], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[9]);
18551 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[10], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[11], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[12], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[13], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[14], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[15], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[16], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[17], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[18], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[19]);
18552 AU_nPRINT(" } \n");
18553 AU_nPRINT(" { a_geq_band_target[DOLBY_DAP_GEQ_MAX_BANDS] \n");
18554 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[0], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[1], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[2], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[3], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[4], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[5], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[6], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[7], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[8], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[9]);
18555 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[10], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[11], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[12], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[13], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[14], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[15], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[16], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[17], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[18], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[19]);
18556 AU_nPRINT(" } \n");
18557 AU_nPRINT(" %-8d, optimizer_enable \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.optimizer_enable );
18558 AU_nPRINT(" %-8d, optimizer_nb_bands \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.optimizer_nb_bands );
18559 AU_nPRINT(" { a_opt_band_center_freq[DOLBY_DAP_OPT_MAX_BANDS] \n");
18560 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[0], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[1], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[2], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[3], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[4], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[5], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[6], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[7], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[8], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[9]);
18561 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[10], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[11], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[12], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[13], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[14], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[15], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[16], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[17], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[18], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[19]);
18562 AU_nPRINT(" } \n");
18563 AU_nPRINT(" { a_opt_band_gain[DOLBY_DAP_MAX_CHANNELS][DOLBY_DAP_OPT_MAX_BANDS] \n");
18564 AU_nPRINT(" { \n");
18565 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[0][0], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[0][1], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[0][2], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[0][3], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[0][4], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[0][5], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[0][6], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[0][7], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[0][8], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[0][9]);
18566 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[0][10], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[0][11], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[0][12], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[0][13], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[0][14], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[0][15], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[0][16], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[0][17], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[0][18], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[0][19]);
18567 AU_nPRINT(" }, \n");
18568 AU_nPRINT(" { \n");
18569 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[1][0], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[1][1], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[1][2], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[1][3], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[1][4], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[1][5], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[1][6], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[1][7], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[1][8], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[1][9]);
18570 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[1][10], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[1][11], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[1][12], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[1][13], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[1][14], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[1][15], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[1][16], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[1][17], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[1][18], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[1][19]);
18571 AU_nPRINT(" }, \n");
18572 AU_nPRINT(" { \n");
18573 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[2][0], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[2][1], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[2][2], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[2][3], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[2][4], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[2][5], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[2][6], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[2][7], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[2][8], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[2][9]);
18574 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[2][10], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[2][11], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[2][12], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[2][13], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[2][14], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[2][15], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[2][16], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[2][17], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[2][18], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[2][19]);
18575 AU_nPRINT(" }, \n");
18576 AU_nPRINT(" { \n");
18577 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[3][0], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[3][1], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[3][2], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[3][3], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[3][4], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[3][5], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[3][6], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[3][7], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[3][8], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[3][9]);
18578 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[3][10], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[3][11], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[3][12], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[3][13], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[3][14], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[3][15], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[3][16], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[3][17], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[3][18], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[3][19]);
18579 AU_nPRINT(" }, \n");
18580 AU_nPRINT(" { \n");
18581 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[4][0], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[4][1], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[4][2], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[4][3], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[4][4], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[4][5], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[4][6], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[4][7], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[4][8], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[4][9]);
18582 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[4][10], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[4][11], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[4][12], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[4][13], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[4][14], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[4][15], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[4][16], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[4][17], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[4][18], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[4][19]);
18583 AU_nPRINT(" }, \n");
18584 AU_nPRINT(" { \n");
18585 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[5][0], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[5][1], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[5][2], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[5][3], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[5][4], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[5][5], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[5][6], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[5][7], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[5][8], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[5][9]);
18586 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[5][10], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[5][11], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[5][12], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[5][13], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[5][14], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[5][15], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[5][16], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[5][17], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[5][18], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[5][19]);
18587 AU_nPRINT(" }, \n");
18588 AU_nPRINT(" } \n");
18589 AU_nPRINT(" %-8d, bass_enable \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.bass_enable );
18590 AU_nPRINT(" %-8d, bass_boost \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.bass_boost );
18591 AU_nPRINT(" %-8d, bass_cutoff \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.bass_cutoff );
18592 AU_nPRINT(" %-8d, bass_width \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.bass_width );
18593 AU_nPRINT(" %-8d, reg_nb_bands \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.reg_nb_bands );
18594 AU_nPRINT(" { a_reg_band_center[DOLBY_DAP_REG_MAX_BANDS] \n");
18595 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[0], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[1], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[2], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[3], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[4], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[5], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[6], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[7], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[8], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[9]);
18596 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[10], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[11], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[12], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[13], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[14], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[15], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[16], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[17], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[18], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[19]);
18597 AU_nPRINT(" } \n");
18598 AU_nPRINT(" { a_reg_low_thresholds[DOLBY_DAP_REG_MAX_BANDS] \n");
18599 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[0], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[1], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[2], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[3], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[4], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[5], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[6], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[7], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[8], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[9]);
18600 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[10], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[11], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[12], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[13], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[14], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[15], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[16], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[17], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[18], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[19]);
18601 AU_nPRINT(" } \n");
18602 AU_nPRINT(" { a_reg_high_thresholds[DOLBY_DAP_REG_MAX_BANDS] \n");
18603 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[0], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[1], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[2], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[3], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[4], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[5], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[6], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[7], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[8], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[9]);
18604 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[10], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[11], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[12], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[13], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[14], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[15], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[16], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[17], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[18], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[19]);
18605 AU_nPRINT(" } \n");
18606 AU_nPRINT(" { a_reg_isolated_bands[DOLBY_DAP_REG_MAX_BANDS] \n");
18607 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[0], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[1], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[2], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[3], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[4], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[5], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[6], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[7], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[8], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[9]);
18608 AU_nPRINT(" %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[10], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[11], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[12], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[13], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[14], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[15], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[16], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[17], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[18], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[19]);
18609 AU_nPRINT(" } \n");
18610 AU_nPRINT(" %-8d, regulator_overdrive \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.regulator_overdrive );
18611 AU_nPRINT(" %-8d, regulator_timbre \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.regulator_timbre );
18612 AU_nPRINT(" %-8d, regulator_distortion \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.regulator_distortion );
18613 AU_nPRINT(" %-8d, regulator_mode \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.regulator_mode );
18614 AU_nPRINT(" %-8d, regulator_enable \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.regulator_enable );
18615 AU_nPRINT(" %-8d, virtual_bass_mode \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.virtual_bass_mode );
18616 AU_nPRINT(" %-8d, virtual_bass_low_src_freq \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.virtual_bass_low_src_freq );
18617 AU_nPRINT(" %-8d, virtual_bass_high_src_freq \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.virtual_bass_high_src_freq );
18618 AU_nPRINT(" %-8d, virtual_bass_overall_gain \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.virtual_bass_overall_gain );
18619 AU_nPRINT(" %-8d, virtual_bass_slope_gain \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.virtual_bass_slope_gain );
18620 AU_nPRINT(" { virtual_bass_subgain[3] \n");
18621 AU_nPRINT(" %-8d, %-8d, %-8d, \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.virtual_bass_subgain[0], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.virtual_bass_subgain[1], pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.virtual_bass_subgain[2] );
18622 AU_nPRINT(" } \n");
18623 AU_nPRINT(" %-8d, virtual_bass_mix_low_freq \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.virtual_bass_mix_low_freq );
18624 AU_nPRINT(" %-8d, virtual_bass_mix_high_freq \n", pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.virtual_bass_mix_high_freq );
18625 AU_nPRINT(" \n");
18626 }
18627
AU_CUS_AQ_Dump_All_Related_Param(void)18628 void AU_CUS_AQ_Dump_All_Related_Param(void)
18629 {
18630 AU_nPRINT("\n\n\n\n\n");
18631 AU_CUS_Dump_RegBank(0x112C00); AU_nPRINT("\n");
18632 AU_CUS_Dump_RegBank(0x112D00); AU_nPRINT("\n");
18633 AU_CUS_Dump_RegBank(0x112E00); AU_nPRINT("\n");
18634 AU_CUS_Dump_RegBank(0x160300); AU_nPRINT("\n");
18635 AU_nPRINT("\n\n\n\n\n");
18636
18637 AU_CUS_AQ_Dump_Data_MSTAR_SE_Upper();
18638 AU_CUS_AQ_Dump_Data_DTS_SE_Upper();
18639 AU_CUS_Delay1MS(1000);
18640
18641 AU_nPRINT("\n\n\n\n\n");
18642 AU_CUS_AQ_Dump_Data_DTS_SE_R2(4);
18643 AU_nPRINT("\n\n\n\n\n");
18644 }
18645
18646 //0x9990
AU_CUS_Show_HashKey_Support(void)18647 void AU_CUS_Show_HashKey_Support(void)
18648 {
18649 //use ADEC0 to show hash key support
18650
18651 if(pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect != API_AUDIO_CUSTOMER_ADEC_INPUT_INVALID)
18652 {
18653 API_AUDIO_CUSTOMER_ADEC_Connect(API_AUDIO_CUSTOMER_ADEC0, pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect);
18654 }
18655 else
18656 {
18657 API_AUDIO_CUSTOMER_ADEC_Connect(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_ADEC_INPUT_MM);
18658 }
18659
18660 if(pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperCodec != API_AUDIO_CUSTOMER_CODEC_TYPE_INVALID)
18661 {
18662 API_AUDIO_CUSTOMER_SetCodecType(API_AUDIO_CUSTOMER_ADEC0, pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperCodec);
18663 }
18664 else
18665 {
18666 API_AUDIO_CUSTOMER_SetCodecType(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_CODEC_TYPE_MPEG);
18667 }
18668 }
18669
18670 //0x9991
AU_CUS_AQ_Tuning_and_Dump_Data(void)18671 void AU_CUS_AQ_Tuning_and_Dump_Data(void)
18672 {
18673 int selNum = 0;
18674
18675 while(selNum != 0x9999)
18676 {
18677 AU_nPRINT("============================================================ \n");
18678 AU_nPRINT("** (MStar Sound Effect) AQ Tuning ** \n");
18679 AU_nPRINT("============================================================ \n");
18680 AU_nPRINT("(0x0000) AU_CUS_AQ_Tuning_MSTAR_SE_Enable(void) \n");
18681 AU_nPRINT("(0x0001) AU_CUS_AQ_Tuning_MSTAR_SE_SET_GEQ(void) \n");
18682 AU_nPRINT("(0x0002) AU_CUS_AQ_Tuning_MSTAR_SE_SET_PEQCoef(void) \n");
18683 AU_nPRINT("(0x0003) AU_CUS_AQ_Tuning_MSTAR_SE_SET_HPFCoef(void) \n");
18684 AU_nPRINT("(0x0004) AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_MODE(void) \n");
18685 AU_nPRINT("(0x0005) AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_LEVEL(void) \n");
18686 AU_nPRINT("(0x0006) AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_R_MODE_Begin(void) \n");
18687 AU_nPRINT("(0x0007) AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_R_MODE_End(void) \n");
18688 AU_nPRINT("(0x0008) AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_R_MODE_Slope(void) \n");
18689 AU_nPRINT("(0x0009) AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_S_MODE_OFFSET(void) \n");
18690 AU_nPRINT("(0x000A) AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_AttackTime(void) \n");
18691 AU_nPRINT("(0x000B) AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_ReleaseTime(void) \n");
18692 AU_nPRINT("(0x000C) AU_CUS_AQ_Tuning_MSTAR_SE_SET_DRC_LEVEL(void) \n");
18693 AU_nPRINT("(0x000D) AU_CUS_AQ_Tuning_MSTAR_SE_SET_BALANCE(void) \n");
18694 AU_nPRINT("(0x000E) AU_CUS_AQ_Tuning_MSTAR_SE_SET_NR_Threshold(void) \n");
18695 AU_nPRINT(" \n");
18696 AU_nPRINT("============================================================ \n");
18697 AU_nPRINT("** (MStar Sound Effect) AQ Dump ** \n");
18698 AU_nPRINT("============================================================ \n");
18699 AU_nPRINT("(0x0100) AU_CUS_AQ_Dump_Data_MSTAR_SE_Upper(void) \n");
18700 AU_nPRINT(" \n");
18701 AU_nPRINT("============================================================ \n");
18702 AU_nPRINT("** (Advanced Sound Effect) AQ Tuning ** \n");
18703 AU_nPRINT("============================================================ \n");
18704 AU_nPRINT("(0x0200) AU_CUS_AQ_Tuning_DTS_SE_Enable(void) \n");
18705 AU_nPRINT("(0x0201) AU_CUS_AQ_Tuning_DTS_SE_ProcessUnit_Enable(void) \n");
18706 AU_nPRINT("(0x0202) AU_CUS_AQ_Tuning_DTS_SE_SetParam(void) \n");
18707 AU_nPRINT("(0x0203) AU_CUS_AQ_Tuning_Dolby_DAP_Enable(void) \n");
18708 AU_nPRINT("(0x0204) AU_CUS_AQ_Tuning_Dolby_DAP_ProcessUnit_Enable(void) \n");
18709 AU_nPRINT("(0x0205) AU_CUS_AQ_Tuning_Dolby_DAP_SetParam(void) \n");
18710 AU_nPRINT(" \n");
18711 AU_nPRINT("============================================================ \n");
18712 AU_nPRINT("** (Advanced Sound Effect) AQ Dump ** \n");
18713 AU_nPRINT("============================================================ \n");
18714 AU_nPRINT("(0x0300) AU_CUS_AQ_Dump_Data_DTS_SE_Upper(void) \n");
18715 AU_nPRINT("(0x0301) AU_CUS_AQ_Dump_Data_DTS_SE_R2(int sleepTime) \n");
18716 AU_nPRINT("(0x0302) AU_CUS_AQ_Dump_Data_DAP_Upper(void) \n");
18717 AU_nPRINT(" \n");
18718 AU_nPRINT("============================================================ \n");
18719 AU_nPRINT("** Dump ALL ** \n");
18720 AU_nPRINT("============================================================ \n");
18721 AU_nPRINT("(0x0400) AU_CUS_AQ_Dump_All_Related_Param(void) \n");
18722 AU_nPRINT("(9999) Exit \n");
18723
18724 selNum = AU_CUS_Debug_GetHex("");
18725
18726 switch(selNum)
18727 {
18728 case 0x0000:
18729 {
18730 AU_CUS_AQ_Tuning_MSTAR_SE_Enable();
18731 }
18732 break;
18733
18734 case 0x0001:
18735 {
18736 AU_CUS_AQ_Tuning_MSTAR_SE_SET_GEQ();
18737 }
18738 break;
18739
18740 case 0x0002:
18741 {
18742 AU_CUS_AQ_Tuning_MSTAR_SE_SET_PEQCoef();
18743 }
18744 break;
18745
18746 case 0x0003:
18747 {
18748 AU_CUS_AQ_Tuning_MSTAR_SE_SET_HPFCoef();
18749 }
18750 break;
18751
18752 case 0x0004:
18753 {
18754 AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_MODE();
18755 }
18756 break;
18757
18758 case 0x0005:
18759 {
18760 AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_LEVEL();
18761 }
18762 break;
18763
18764 case 0x0006:
18765 {
18766 AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_R_MODE_Begin();
18767 }
18768 break;
18769
18770 case 0x0007:
18771 {
18772 AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_R_MODE_End();
18773 }
18774 break;
18775
18776 case 0x0008:
18777 {
18778 AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_R_MODE_Slope();
18779 }
18780 break;
18781
18782 case 0x0009:
18783 {
18784 AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_S_MODE_OFFSET();
18785 }
18786 break;
18787
18788 case 0x000A:
18789 {
18790 AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_AttackTime();
18791 }
18792 break;
18793
18794 case 0x000B:
18795 {
18796 AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_ReleaseTime();
18797 }
18798 break;
18799
18800 case 0x000C:
18801 {
18802 AU_CUS_AQ_Tuning_MSTAR_SE_SET_DRC_LEVEL();
18803 }
18804 break;
18805
18806 case 0x000D:
18807 {
18808 AU_CUS_AQ_Tuning_MSTAR_SE_SET_BALANCE();
18809 }
18810 break;
18811
18812 case 0x000E:
18813 {
18814 AU_CUS_AQ_Tuning_MSTAR_SE_SET_NR_Threshold();
18815 }
18816 break;
18817
18818 case 0x0100:
18819 {
18820 AU_CUS_AQ_Dump_Data_MSTAR_SE_Upper();
18821 }
18822 break;
18823
18824 case 0x0200:
18825 {
18826 AU_CUS_AQ_Tuning_DTS_SE_Enable();
18827 }
18828 break;
18829
18830 case 0x0201:
18831 {
18832 AU_CUS_AQ_Tuning_DTS_SE_ProcessUnit_Enable();
18833 }
18834 break;
18835
18836 case 0x0202:
18837 {
18838 AU_CUS_AQ_Tuning_DTS_SE_SetParam();
18839 }
18840 break;
18841
18842 case 0x0203:
18843 {
18844 AU_CUS_AQ_Tuning_Dolby_DAP_Enable();
18845 }
18846 break;
18847
18848 case 0x0204:
18849 {
18850 AU_CUS_AQ_Tuning_Dolby_DAP_ProcessUnit_Enable();
18851 }
18852 break;
18853
18854 case 0x0205:
18855 {
18856 AU_CUS_AQ_Tuning_Dolby_DAP_SetParam();
18857 }
18858 break;
18859
18860 case 0x0300:
18861 {
18862 AU_CUS_AQ_Dump_Data_DTS_SE_Upper();
18863 }
18864 break;
18865
18866 case 0x0301:
18867 {
18868 int sleepTime;
18869 sleepTime = AU_CUS_Debug_GetHex("======= Sleep time: ============ \n");
18870 AU_CUS_AQ_Dump_Data_DTS_SE_R2(sleepTime);
18871 }
18872 break;
18873
18874 case 0x0302:
18875 {
18876 AU_CUS_AQ_Dump_Data_DAP_Upper();
18877 }
18878 break;
18879
18880 case 0x0400:
18881 {
18882 AU_CUS_AQ_Dump_All_Related_Param();
18883 }
18884 break;
18885
18886 case 0x9999:
18887 {
18888 //Exit
18889 }
18890 break;
18891
18892 default:
18893 break;
18894 }
18895 }
18896
18897 return;
18898 }
18899
18900 //0x9992
AU_CUS_MCU_DUMP_R2_LOG(void)18901 void AU_CUS_MCU_DUMP_R2_LOG(void)
18902 {
18903 int selNum = 0;
18904 int r2_log_option = 0;
18905 int interval = 0;
18906
18907 while(selNum != 0x9999)
18908 {
18909 AU_nPRINT("============================================= \n");
18910 AU_nPRINT("** Dump R2 Log ** \n");
18911 AU_nPRINT("============================================= \n");
18912 AU_nPRINT("(Show) r2_log_option(0x%x) \n", r2_log_option);
18913 AU_nPRINT("(0x01) Start \n");
18914 AU_nPRINT("(0x02) Stop \n");
18915 AU_nPRINT("(0x03) g_audio_customer_patch_Dump_R2_Log_Monitor_Interval(%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_patch_Dump_R2_Log_Monitor_Interval);
18916 AU_nPRINT("(9999) Exit \n");
18917 selNum = AU_CUS_Debug_GetHex("");
18918
18919 switch(selNum)
18920 {
18921 case 0x01:
18922 {
18923 AU_CUS_Show_R2_Debug_Option();
18924 AU_nPRINT("Please input R2 Debug Option: \n");
18925 r2_log_option = AU_CUS_Debug_GetHex("");
18926
18927 //Step1: set R2 Dbg option
18928 API_AUDIO_CUSTOMIZED_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_PARAM_MCU_DUMP_R2_LOG_OPTION, &r2_log_option);
18929
18930 //Step2: Open a debug file (just for demo)
18931 pAU_R2LogBufferDumpFile = AU_CUS_FileOpen(AU_R2_LOG_TO_FILE_PATH, "wb");
18932 if (pAU_R2LogBufferDumpFile == NULL)
18933 {
18934 AU_nPRINT("Open file FAIL!!\n");
18935 break;
18936 }
18937
18938 //Step3: Enable R2 logging to file (just for demo)
18939 #if(CUSTOMIZED_PATCH_PARAM_MCU_DUMP_R2_LOG)
18940 {
18941 pstAudioCustomerShmData->g_audio_customer_patch_MCU_Dump_R2_Log_Moitor_bEnable = TRUE;
18942 }
18943 #endif
18944
18945 //Step4: Set WFI for R2 log.
18946 MS_BOOL enable = TRUE;
18947 API_AUDIO_CUSTOMIZED_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_PARAM_MCU_DUMP_R2_LOG_ENABLE, &enable);
18948 }
18949 break;
18950
18951 case 0x02:
18952 {
18953 #if(CUSTOMIZED_PATCH_PARAM_MCU_DUMP_R2_LOG)
18954 {
18955 pstAudioCustomerShmData->g_audio_customer_patch_MCU_Dump_R2_Log_Moitor_bEnable = FALSE;
18956 }
18957 #endif
18958
18959 MS_BOOL enable = FALSE;
18960 AU_CUS_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_PARAM_MCU_DUMP_R2_LOG_ENABLE, &enable);
18961
18962 if(pAU_R2LogBufferDumpFile != NULL)
18963 {
18964 AU_CUS_FileClose(pAU_R2LogBufferDumpFile);
18965 pAU_R2LogBufferDumpFile = NULL;
18966 }
18967 }
18968 break;
18969
18970 case 0x03:
18971 {
18972 AU_nPRINT("interval: \n");
18973 interval = AU_CUS_Debug_GetDec();
18974 pstAudioCustomerShmData->g_audio_customer_patch_Dump_R2_Log_Monitor_Interval = interval;
18975 }
18976 break;
18977
18978 case 0x9999:
18979 {
18980 //Exit
18981 }
18982 break;
18983
18984 default:
18985 break;
18986 }
18987 }
18988
18989 return;
18990 }
18991
18992 //0x9994
AU_CUS_DDR_Dump_Debug(void)18993 void AU_CUS_DDR_Dump_Debug(void)
18994 {
18995 MS_U32 Addr_V = 0;
18996 MS_U32 Address = 0;
18997 MS_U32 Size = 0;
18998 MS_U16 tmpReg1 = 0;
18999 MS_U16 tmpReg2 = 0;
19000
19001 MS_U32 u32_DEC_Addr = 0;
19002 MS_U32 u32_SE_Addr = 0;
19003 MS_U32 u32_R2_Addr = 0;
19004 MS_U32 u32ES1BufStartAddr_P = 0;
19005 MS_U32 u32ES1BufTotalSize = 0;
19006 MS_U32 u32ES3BufStartAddr_P = 0;
19007 MS_U32 u32ES3BufTotalSize = 0;
19008
19009 pAU_DDR_BIN_File = AU_CUS_FileOpen(AU_DDR_BIN_PATH, "wb");
19010
19011 tmpReg1 = AU_CUS_ReadAbsReg((MS_U32)REG_BANK_ADEC1_PLAY);
19012 tmpReg2 = AU_CUS_ReadAbsReg((MS_U32)REG_BANK_ADEC2_PLAY);
19013 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ADEC1_PLAY, 0);
19014 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ADEC2_PLAY, 0);
19015
19016 u32_DEC_Addr = MApi_AUDIO_GetDspMadBaseAddr(0);
19017 u32_SE_Addr = MApi_AUDIO_GetDspMadBaseAddr(1);
19018 u32_R2_Addr = MApi_AUDIO_GetDspMadBaseAddr(2);
19019
19020 MApi_AUDIO_GetAudioInfo2(AU_DEC_ID1, Audio_infoType_UNI_ES_Base, &u32ES1BufStartAddr_P);
19021 MApi_AUDIO_GetAudioInfo2(AU_DEC_ID1, Audio_infoType_UNI_ES_Size, &u32ES1BufTotalSize);
19022 MApi_AUDIO_GetAudioInfo2(AU_DEC_ID3, Audio_infoType_UNI_ES_Base, &u32ES3BufStartAddr_P);
19023 MApi_AUDIO_GetAudioInfo2(AU_DEC_ID3, Audio_infoType_UNI_ES_Size, &u32ES3BufTotalSize);
19024
19025 AU_nPRINT("\n\n\n");
19026 AU_nPRINT("---------------------------------------------- \n");
19027 AU_nPRINT("----------- DDR DUMP debug ------------------ \n");
19028 AU_nPRINT("---------------------------------------------- \n");
19029 AU_nPRINT("AUDIO R2 DDR base address [0x%X] \n", (unsigned int)u32_R2_Addr);
19030 AU_nPRINT("AUDIO DEC DDR base address [0x%X] \n", (unsigned int)u32_DEC_Addr);
19031 AU_nPRINT("AUDIO SE DDR base address [0x%X] \n", (unsigned int)u32_SE_Addr);
19032 AU_nPRINT("AUDIO ES1 DDR base address / size => [0x%X] / [0x%X] \n", (unsigned int)u32ES1BufStartAddr_P, (unsigned int)u32ES1BufTotalSize);
19033 AU_nPRINT("AUDIO ES3 DDR base address / size => [0x%X] / [0x%X] \n", (unsigned int)u32ES3BufStartAddr_P, (unsigned int)u32ES3BufTotalSize);
19034 AU_nPRINT("\n\n\n");
19035 AU_nPRINT("======= Read DDR address ex:R2 address is 0x%X -> Enter 0x%X ============ \n", (unsigned int)u32_R2_Addr, (unsigned int)u32_R2_Addr);
19036 Address = (MS_U32)AU_CUS_Debug_GetHex("");
19037
19038 Addr_V = MsOS_MPool_PA2KSEG1(Address);
19039
19040 AU_nPRINT("======= Read DDR Size ex:R2 size is 0x20000 -> Enter 0x20000 ============ \n");
19041 Size = (MS_U32)AU_CUS_Debug_GetHex("");
19042
19043 AU_CUS_FileWrite((void*)Addr_V, 1, Size, pAU_DDR_BIN_File);
19044 fflush(pAU_DDR_BIN_File);
19045 if (pAU_DDR_BIN_File != NULL)
19046 {
19047 fclose(pAU_DDR_BIN_File);
19048 pAU_DDR_BIN_File = NULL;
19049 }
19050 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ADEC1_PLAY, tmpReg1);
19051 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ADEC2_PLAY, tmpReg2);
19052
19053 AU_nPRINT("\n\n\n");
19054 AU_nPRINT("======= Read DDR address 0x%X with size 0x%X Done ============ \n", (unsigned int)Address, (unsigned int)Size);
19055 AU_nPRINT("\n\n\n");
19056 }
19057
19058 //0x9995
AU_CUS_Dump_Audio_Related_Bank(void)19059 void AU_CUS_Dump_Audio_Related_Bank(void)
19060 {
19061 AU_nPRINT("\n\n\n\n");
19062
19063 //---[HDMI Tx (2.0)] Curry---
19064 AU_CUS_Dump_RegBank(0x172A00); AU_nPRINT("\n");
19065 AU_CUS_Dump_RegBank(0x172B00); AU_nPRINT("\n");
19066 AU_CUS_Dump_RegBank(0x172C00); AU_nPRINT("\n");
19067 AU_CUS_Dump_RegBank(0x172D00); AU_nPRINT("\n");
19068 AU_CUS_Dump_RegBank(0x172E00); AU_nPRINT("\n");
19069 AU_CUS_Dump_RegBank(0x173000); AU_nPRINT("\n");
19070
19071 //---[HDMI Tx (1.4)] Kiwi---
19072 AU_CUS_Dump_RegBank(0x113000); AU_nPRINT("\n");
19073 AU_CUS_Dump_RegBank(0x113100); AU_nPRINT("\n");
19074 AU_CUS_Dump_RegBank(0x113200); AU_nPRINT("\n");
19075 AU_CUS_Dump_RegBank(0x113300); AU_nPRINT("\n");
19076
19077 //---[HDMI Rx (2.0)] Macan---
19078 AU_CUS_Dump_RegBank(0x173000); AU_nPRINT("\n");
19079 AU_CUS_Dump_RegBank(0x173900); AU_nPRINT("\n");
19080
19081 //---[Audio]---
19082 AU_CUS_Dump_RegBank(0x112A00); AU_nPRINT("\n");
19083 AU_CUS_Dump_RegBank(0x112B00); AU_nPRINT("\n");
19084 AU_CUS_Dump_RegBank(0x112C00); AU_nPRINT("\n");
19085 AU_CUS_Dump_RegBank(0x112D00); AU_nPRINT("\n");
19086 AU_CUS_Dump_RegBank(0x112E00); AU_nPRINT("\n");
19087 AU_CUS_Dump_RegBank(0x113000); AU_nPRINT("\n");
19088 AU_CUS_Dump_RegBank(0x160300); AU_nPRINT("\n");
19089
19090 AU_nPRINT("\n\n\n\n");
19091
19092 return;
19093 }
19094
AU_CUS_DumpSIFInfo(void)19095 void AU_CUS_DumpSIFInfo(void)
19096 {
19097 AU_nPRINT("====================================================================================================================================\n");
19098 AU_nPRINT("112DC0h SIF_STD_SEL 15:0 Default : 0x00 Access : R/W \n");
19099 AU_nPRINT(" RESERVED 15:8 Reserved \n");
19100 AU_nPRINT(" STD_SEL_SET 7:4 For SIF Pal-sum DSP code \n");
19101 AU_nPRINT(" PAL Sound Standard Mode selection \n");
19102 AU_nPRINT(" 1110 = Standard detection command \n");
19103 AU_nPRINT(" 0000 = FM mono mode \n");
19104 AU_nPRINT(" 0001 = Hi-dev mode \n");
19105 AU_nPRINT(" 0010 = A2 mode \n");
19106 AU_nPRINT(" 0100 = NICAM mode \n");
19107 AU_nPRINT(" STD_SEL 3:0 SIF audio standard selection \n");
19108 AU_nPRINT(" 0000 = Standard not found \n");
19109 AU_nPRINT(" 0001 = AU_SYS_M_BTSC \n");
19110 AU_nPRINT(" For BTSC, bit[1]: M/N system identification control bit \n");
19111 AU_nPRINT(" 0 = NTSC_M or PAL_M; \n");
19112 AU_nPRINT(" 1 = PAL_N \n");
19113 AU_nPRINT(" 0010 = AU_SYS_M_EIAJ \n");
19114 AU_nPRINT(" 0011 = AU_SYS_M_A2 \n");
19115 AU_nPRINT(" 0100 = AU_SYS_BG_A2 \n");
19116 AU_nPRINT(" 0101 = AU_SYS_DK1_A2 \n");
19117 AU_nPRINT(" 0110 = AU_SYS_DK2_A2 \n");
19118 AU_nPRINT(" 0111 = AU_SYS_DK3_A2 \n");
19119 AU_nPRINT(" 1000 = AU_SYS_BG_NICAM \n");
19120 AU_nPRINT(" 1001 = AU_SYS_DK_NICAM \n");
19121 AU_nPRINT(" 1010 = AU_SYS_I_NICAM \n");
19122 AU_nPRINT(" 1011 = AU_SYS_L_NICAM \n");
19123 AU_nPRINT("====================================================================================================================================\n");
19124 AU_nPRINT("112DC2h SIF_PFIR_AGC 15:0 Default : 0x00 Access : R/W \n");
19125 AU_nPRINT(" RESERVED 15:10 Reserved \n");
19126 AU_nPRINT(" SIF_AGC_RESET \n");
19127 AU_nPRINT(" (Non VIF mode) 9 1: SIF AGC reset \n");
19128 AU_nPRINT(" SIF_AGC_ENABLE \n");
19129 AU_nPRINT(" (Non VIF mode) 8 0: SIF AGC Disable \n");
19130 AU_nPRINT(" 1: SIF AGC Enable \n");
19131 AU_nPRINT(" SIF_CARRIER_DEBOUNCE 7 SIF Carrier Status De-bounce \n");
19132 AU_nPRINT(" 0: Check carrier 0x10 times. If carrier changes > 0x08 times, carrier status changes. \n");
19133 AU_nPRINT(" 1: Check carrier 0x200 times. If carrier changes > 0x190 times, carrier status changes. \n");
19134 AU_nPRINT(" HI-DEV_SEL 5:4 HIDEV CH1 PFIR Bandwidth Selection \n");
19135 AU_nPRINT(" 01= mode 1 (narrow bandwidth, 130k~260k) \n");
19136 AU_nPRINT(" 02= mode 2 (middle bandwidth, 165k~295K) \n");
19137 AU_nPRINT(" 03= mode 3 (huge bandwidth, 200k~330k) \n");
19138 AU_nPRINT(" Others = mode 2 \n");
19139 AU_nPRINT(" A2_CH2_PFIR 1:0 A2 CH2 PFIR Bandwidth Selection \n");
19140 AU_nPRINT(" 01= mode 1 (narrow bandwidth, 80k~130k) \n");
19141 AU_nPRINT(" 02= mode 2 (middle bandwidth, 100k~150K) \n");
19142 AU_nPRINT(" 03= mode 3 (huge bandwidth, 130k~180k) \n");
19143 AU_nPRINT(" Others = mode 2 \n");
19144 AU_nPRINT("====================================================================================================================================\n");
19145 AU_nPRINT("112DC4h SIF_BTSC_A2_SEL 15:0 Default : 0x00 Access : R/W \n");
19146 AU_nPRINT(" RESERVED 15:8 Reserved \n");
19147 AU_nPRINT(" SIF_SOUND_MOD1[7:0] 7:0 SIF BTSC/A2 demodulator automatic/manual sound mode output select. \n");
19148 AU_nPRINT(" 0xxxxxxx = manual sound select \n");
19149 AU_nPRINT(" 00000000 = BTSC Mono \n");
19150 AU_nPRINT(" 00000001 = BTSC Stereo \n");
19151 AU_nPRINT(" 00000010 = BTSC SAP \n");
19152 AU_nPRINT(" 00000000 = A2 Mono \n");
19153 AU_nPRINT(" 00000001 = A2 Stereo \n");
19154 AU_nPRINT(" 00000010 = A2 Dual B \n");
19155 AU_nPRINT(" 00000011 = A2 Dual A+B \n");
19156 AU_nPRINT(" 1xxxxxxx = auto sound select \n");
19157 AU_nPRINT(" 10000000 = BTSC Mono <-> Mute \n");
19158 AU_nPRINT(" 10000001 = BTSC Stereo <-> Mono <-> Mute \n");
19159 AU_nPRINT(" 10000010 = BTSC SAP<-> Mono <-> Mute \n");
19160 AU_nPRINT(" 10000000 = A2 Mono <-> Mute \n");
19161 AU_nPRINT(" 10000001 = A2 Stereo <->Mono <-> Mute \n");
19162 AU_nPRINT(" 10000010 = A2 Dual B <->Mono <-> Mute \n");
19163 AU_nPRINT("====================================================================================================================================\n");
19164 AU_nPRINT("112DC6h SIF_NICAM_SEL 15:0 Default : 0x00 Access : R/W \n");
19165 AU_nPRINT(" RESERVED 15:8 Reserved \n");
19166 AU_nPRINT(" SIF_SOUND_MOD2[7:0] 7:0 SIF NICAM demodulator automatic sound mode output select. \n");
19167 AU_nPRINT(" 00000000 = NICAM Auto Mode \n");
19168 AU_nPRINT(" Nicam Sound (auto) <-> FM/AM Mono <-> Mute \n");
19169 AU_nPRINT(" 0x01 = FM/AM Mono \n");
19170 AU_nPRINT(" 0x02 = Stereo L / R <-> FM/AM Mono \n");
19171 AU_nPRINT(" 0x03 = Stereo L / L <-> FM/AM Mono \n");
19172 AU_nPRINT(" 0x04 = Stereo R / R <-> FM/AM Mono \n");
19173 AU_nPRINT(" 0x05 = Dual A/ B <-> FM/AM Mono \n");
19174 AU_nPRINT(" 0x06 = Dual A / A <-> FM/AM Mono \n");
19175 AU_nPRINT(" 0x07 = Dual B / B <-> FM/AM Mono \n");
19176 AU_nPRINT(" 0x08 = Nicam Mono <-> FM/AM Mono \n");
19177 AU_nPRINT(" 0x80 = Force NICAM SOUND \n");
19178 AU_nPRINT(" 0x82 = Force Stereo L / R \n");
19179 AU_nPRINT(" 0x83 = Force Stereo L / L \n");
19180 AU_nPRINT(" 0x84 = Force Stereo R / R \n");
19181 AU_nPRINT(" 0x85 = Force Dual A/ B \n");
19182 AU_nPRINT(" 0x86 = Force Dual A / A \n");
19183 AU_nPRINT(" 0x87 = Force Dual B / B \n");
19184 AU_nPRINT(" 0x88 = Force Nicam Mono \n");
19185 AU_nPRINT("====================================================================================================================================\n");
19186 AU_nPRINT("112DE0h SIF_PAL_DEC_RESULT 15:0 Default : 0x00 Access : R \n");
19187 AU_nPRINT(" RESERVED 15:8 Reserved \n");
19188 AU_nPRINT(" BUSY 7 Audio SIF Standard Detection Flag \n");
19189 AU_nPRINT(" 0 = standard detection finished \n");
19190 AU_nPRINT(" 1 = standard detection not finished \n");
19191 AU_nPRINT(" SIF_STD_CODE 6:0 SIF Standard Detect Result \n");
19192 AU_nPRINT(" \n");
19193 AU_nPRINT(" 00h = standard not found \n");
19194 AU_nPRINT(" 03h = AU_SYS_M \n");
19195 AU_nPRINT(" 04h = AU_SYS_BG_A2 \n");
19196 AU_nPRINT(" 05h = AU_SYS_DK1_A2 \n");
19197 AU_nPRINT(" 06h = AU_SYS_DK2_A2 \n");
19198 AU_nPRINT(" 07h = AU_SYS_DK3_A2 \n");
19199 AU_nPRINT(" 08h = AU_SYS_BG_NICAM \n");
19200 AU_nPRINT(" 09h = AU_SYS_DK_NICAM \n");
19201 AU_nPRINT(" 0ah = AU_SYS_I_NICAM \n");
19202 AU_nPRINT(" 0bh = AU_SYS_L_NICAM \n");
19203 AU_nPRINT("====================================================================================================================================\n");
19204 AU_nPRINT("112DE4h SIF_BTSC_A2_CARRIER 15:0 Default : 0x00 Access : R \n");
19205 AU_nPRINT(" RESERVED 15:8 Reserved \n");
19206 AU_nPRINT(" DK3_STATUS 7 If enable DK123_AUTO_CTRL (0x2DCA[7]=1) \n");
19207 AU_nPRINT(" 0: Sound Standard is not DK3 \n");
19208 AU_nPRINT(" 1: Sound Standard is DK3 \n");
19209 AU_nPRINT(" DK2_STATUS 6 If enable DK123_AUTO_CTRL (0x2DCA[7]=1) \n");
19210 AU_nPRINT(" 0: Sound Standard is not DK2 \n");
19211 AU_nPRINT(" 1: Sound Standard is DK2 \n");
19212 AU_nPRINT(" SOUND_MOD_STATUS1 5:0 Sound Mod Status1: \n");
19213 AU_nPRINT(" Bit 0 = BTSC/A2 Mono exist \n");
19214 AU_nPRINT(" Bit 1 = BTSC/A2 Stereo exist \n");
19215 AU_nPRINT(" Bit 2 = BTSC/A2 Sap/Dual exist \n");
19216 AU_nPRINT(" Bit 3 = A2 Pilot exist \n");
19217 AU_nPRINT(" Bit 4 = A2 Carrier 1 exis \n");
19218 AU_nPRINT(" Bit 5 = A2 Carrier 2 exist \n");
19219 AU_nPRINT("====================================================================================================================================\n");
19220 AU_nPRINT("112DE6h SIF_NICAM_STATUS 15:0 Default : 0x00 Access : R \n");
19221 AU_nPRINT(" RESERVED 15:8 Reserved \n");
19222 AU_nPRINT(" SOUND_MOD_STATUS2 7:0 SIF NICAM demodulator automatic sound mode output select \n");
19223 AU_nPRINT(" Low 4 bits: NICAM state info \n");
19224 AU_nPRINT(" Bit[3:0] : NICAM Standard MOD Info \n");
19225 AU_nPRINT(" Bit[3:0] = 0x0 = NICAM FRAME_SEARCH State \n");
19226 AU_nPRINT(" Bit[3:0] = 0x1 = NICAM FRAME_PRESYNC0 State \n");
19227 AU_nPRINT(" Bit[3:0] = 0x2 = NICAM FRAME_PRESYNC1 State \n");
19228 AU_nPRINT(" Bit[3:0] = 0x3 = NICAM FRAME_PRESYNC2 State \n");
19229 AU_nPRINT(" Bit[3:0] = 0x4 = NICAM FRAME_PRESYNC3 State \n");
19230 AU_nPRINT(" Bit[3:0] = 0x5 = NICAM LOCK State \n");
19231 AU_nPRINT(" \n");
19232 AU_nPRINT(" Bit[6:4]: sound mode info \n");
19233 AU_nPRINT(" \n");
19234 AU_nPRINT(" Bit[6:4] = 0x1 = NICAM Mono \n");
19235 AU_nPRINT(" Bit[6:4] = 0x2 = NICAM Stereo \n");
19236 AU_nPRINT(" Bit[6:4] = 0x3 = NICAM Dual \n");
19237 AU_nPRINT(" Bit[6:4] = 0x4 = NICAM Data \n");
19238 AU_nPRINT(" Bit[7]: Reserved. \n");
19239 AU_nPRINT("====================================================================================================================================\n");
19240 AU_nPRINT(" ___________________________________________________ \n");
19241 AU_nPRINT("| | |112D_C0|112D_E4|112D_E6| \n");
19242 AU_nPRINT("| PAL_Type | Standard | | | | \n");
19243 AU_nPRINT("|_______________|___________|_______|_______|_______| \n");
19244 AU_nPRINT("| Mono | BG |04 |10 | | \n");
19245 AU_nPRINT("| A2 Stereo | BG |24 |3B | | \n");
19246 AU_nPRINT("| A2 Dual | BG |24 |3D | | \n");
19247 AU_nPRINT("| Hi Dev | BG |14 |10 | | \n");
19248 AU_nPRINT("| Nicam Stereo | BG |48 | |25 | \n");
19249 AU_nPRINT("| Nicam Dual | BG |48 | |35 | \n");
19250 AU_nPRINT("|_______________|___________|_______|_______|_______| \n");
19251 AU_nPRINT("| Mono | DK1 |05 |10 | | \n");
19252 AU_nPRINT("| A2 Stereo | DK1 |25 |3B | | \n");
19253 AU_nPRINT("| A2 Dual | DK1 |25 |3D | | \n");
19254 AU_nPRINT("| Hi Dev | DK1 |15 |10 | | \n");
19255 AU_nPRINT("|_______________|___________|_______|_______|_______| \n");
19256 AU_nPRINT("| | (China) | | | | \n");
19257 AU_nPRINT("| A2 Stereo | DK2 |26 |7B | | \n");
19258 AU_nPRINT("| A2 Dual | DK2 |26 |7D | | \n");
19259 AU_nPRINT("| Nicam Stereo | DK1 |49 | |25 | \n");
19260 AU_nPRINT("| Nicam Dual | DK1 |49 | |35 | \n");
19261 AU_nPRINT("|_______________|___________|_______|_______|_______| \n");
19262 AU_nPRINT("| | (Factory) | | | | \n");
19263 AU_nPRINT("| A2 Stereo: | DK3 |27 |BB | | \n");
19264 AU_nPRINT("| A2 Dual | DK3 |27 |BD | | \n");
19265 AU_nPRINT("|_______________|___________|_______|_______|_______| \n");
19266 AU_nPRINT("| Mono | I |0A |10 | | \n");
19267 AU_nPRINT("| Nicam stereo | I |4A | |25 | \n");
19268 AU_nPRINT("| Nicam Dual | I |4A | |35 | \n");
19269 AU_nPRINT("|_______________|___________|_______|_______|_______| \n");
19270 AU_nPRINT("| Mono | L |0B |10 | | \n");
19271 AU_nPRINT("| Nicam stereo | L |4B | |25 | \n");
19272 AU_nPRINT("| Nicam Dual | L |4B | |35 | \n");
19273 AU_nPRINT("|_______________|___________|_______|_______|_______| \n");
19274 AU_nPRINT("| Mono | M |03 |10 | | \n");
19275 AU_nPRINT("| A2 Stereo | M |23 |3B | | \n");
19276 AU_nPRINT("| Hidev | M |13 |10 | | \n");
19277 AU_nPRINT("|_______________|___________|_______|_______|_______| \n");
19278 AU_nPRINT("====================================================================================================================================\n");
19279 }
19280
19281 //0x9997
AU_CUS_SIF_Debug(void)19282 void AU_CUS_SIF_Debug(void)
19283 {
19284 int selNum = 0;
19285 int i = 0;
19286 int nUnused = 0;
19287 nUnused = nUnused;
19288
19289 while(1)
19290 {
19291 AU_nPRINT("\n\n\n");
19292 AU_nPRINT("---------------------------------------------- \n");
19293 AU_nPRINT("----------- SIF debug ------------------ \n");
19294 AU_nPRINT("---------------------------------------------- \n");
19295 AU_nPRINT("(01) Read AMP & NSR & nicam phase error rate \n");
19296 AU_nPRINT("(02) MApi_AUDIO_TriggerSifPLL() \n");
19297 AU_nPRINT("(03) AU_CUS_DumpSIFInfo() \n");
19298 AU_nPRINT("---------------------------------------------- \n");
19299 AU_nPRINT("(9999) Exit \n");
19300 AU_nPRINT("---------------------------------------------- \n");
19301 AU_nPRINT("Please input the item number: \n");
19302
19303 selNum = AU_CUS_Debug_GetDec();
19304 switch(selNum)
19305 {
19306 case 9999:
19307 return;
19308
19309 case 01:
19310 {
19311 selNum = AU_CUS_Debug_GetHex("======= Endless loop? N(0) Y(1) ============ \n");
19312
19313 if(selNum == 0)
19314 {
19315 int readingTimes;
19316 readingTimes = AU_CUS_Debug_GetHex("======= Reding Times? ============ \n");
19317
19318 #if 0
19319 PAL: 30: AMP
19320 3C: NSR
19321 NICAM: 41: nicam phase error rate
19322 #endif
19323
19324 for (i = 0; i < readingTimes; i++)
19325 {
19326 AU_nPRINT("------------------------------------------------------\n");
19327
19328 //PAL AMP
19329 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ASND_DSP_DBG, (MS_U16)0x3000);
19330 usleep(2 * 1000);
19331 AU_nPRINT(" [PAL AMP] [112DFC]=0x%-4X,[112DFE]=0x%-4X\n", AU_CUS_ReadAbsReg(REG_BANK_ASND_DSP_RESULT1), AU_CUS_ReadAbsReg(REG_BANK_ASND_DSP_RESULT2));
19332
19333 //PAL NSR
19334 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ASND_DSP_DBG, (MS_U16)0x3C00);
19335 usleep(2 * 1000);
19336 AU_nPRINT(" [PAL NSR] [112DFC]=0x%-4X,[112DFE]=0x%-4X\n", AU_CUS_ReadAbsReg(REG_BANK_ASND_DSP_RESULT1), AU_CUS_ReadAbsReg(REG_BANK_ASND_DSP_RESULT2));
19337
19338 //NICAM Phase error rate
19339 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ASND_DSP_DBG, (MS_U16)0x4100);
19340 usleep(2 * 1000);
19341 AU_nPRINT("[NICAM Phase Err Rate] [112DFC]=0x%-4X,[112DFE]=0x%-4X\n", AU_CUS_ReadAbsReg(REG_BANK_ASND_DSP_RESULT1), AU_CUS_ReadAbsReg(REG_BANK_ASND_DSP_RESULT2));
19342 }
19343
19344 }
19345 else if(selNum == 1)
19346 {
19347 #if 0
19348 PAL: 30: AMP
19349 3C: NSR
19350 NICAM: 41: nicam phase error rate
19351 #endif
19352
19353 while(1)
19354 {
19355 AU_nPRINT("------------------------------------------------------\n");
19356
19357 //PAL AMP
19358 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ASND_DSP_DBG, (MS_U16)0x3000);
19359 usleep(2 * 1000);
19360 AU_nPRINT(" [PAL AMP] [112DFC]=0x%-4X,[112DFE]=0x%-4X\n", AU_CUS_ReadAbsReg(REG_BANK_ASND_DSP_RESULT1), AU_CUS_ReadAbsReg(REG_BANK_ASND_DSP_RESULT2));
19361
19362 //PAL NSR
19363 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ASND_DSP_DBG, (MS_U16)0x3C00);
19364 usleep(2 * 1000);
19365 AU_nPRINT(" [PAL NSR] [112DFC]=0x%-4X,[112DFE]=0x%-4X\n", AU_CUS_ReadAbsReg(REG_BANK_ASND_DSP_RESULT1), AU_CUS_ReadAbsReg(REG_BANK_ASND_DSP_RESULT2));
19366
19367 //NICAM Phase error rate
19368 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_ASND_DSP_DBG, (MS_U16)0x4100);
19369 usleep(2 * 1000);
19370 AU_nPRINT("[NICAM Phase Err Rate] [112DFC]=0x%-4X,[112DFE]=0x%-4X\n", AU_CUS_ReadAbsReg(REG_BANK_ASND_DSP_RESULT1), AU_CUS_ReadAbsReg(REG_BANK_ASND_DSP_RESULT2));
19371 }
19372 }
19373 }
19374 break;
19375
19376 case 02:
19377 {
19378 MApi_AUDIO_TriggerSifPLL();
19379 }
19380 break;
19381
19382 case 03:
19383 {
19384 AU_CUS_DumpSIFInfo();
19385 }
19386 break;
19387
19388 default:
19389 break;
19390 }
19391 }
19392 }
19393
AU_CUS_Show_R2_Debug_Option(void)19394 void AU_CUS_Show_R2_Debug_Option(void)
19395 {
19396 AU_nPRINT("------------------------------------------------------------------ \n");
19397 AU_nPRINT("----------- R2 Debug -------------------------------------- \n");
19398 AU_nPRINT("------------------------------------------------------------------ \n");
19399 AU_nPRINT("case 0x10: print_es_info(R2_ES_ID1); break; \n");
19400 AU_nPRINT("case 0x11: print_es_info(R2_ES_ID2); break; \n");
19401 AU_nPRINT("case 0x12: print_pcm_info(R2_ADEC_ID1); break; \n");
19402 AU_nPRINT("case 0x13: print_pcm_info(R2_ADEC_ID2); break; \n");
19403 AU_nPRINT("case 0x14: print_dec_info(R2_ADEC_ID1); break; \n");
19404 AU_nPRINT("case 0x15: print_dec_info(R2_ADEC_ID2); break; \n");
19405 AU_nPRINT("case 0x16: print_avSync_info(R2_ADEC_ID1); break; \n");
19406 AU_nPRINT("case 0x17: print_avSync_info(R2_ADEC_ID2); break; \n");
19407 AU_nPRINT("case 0x18: printf_PTS_table(R2_ADEC_ID1); break; \n");
19408 AU_nPRINT("case 0x19: printf_PTS_table(R2_ADEC_ID2); break; \n");
19409 AU_nPRINT("case 0x1a: enable_dec_dbgMsg( R2_ADEC_ID1, MS_TRUE ); break; \n");
19410 AU_nPRINT("case 0x1b: enable_dec_dbgMsg( R2_ADEC_ID1, MS_FALSE ); break; \n");
19411 AU_nPRINT("case 0x1c: enable_dec_dbgMsg( R2_ADEC_ID2, MS_TRUE ); break; \n");
19412 AU_nPRINT("case 0x1d: enable_dec_dbgMsg( R2_ADEC_ID2, MS_FALSE ); break; \n");
19413 AU_nPRINT("case 0x1e: print_decoder_instance(R2_ADEC_ID1); break; \n");
19414 AU_nPRINT("case 0x1f: print_decoder_instance(R2_ADEC_ID2); break; \n");
19415 AU_nPRINT("case 0x20: printf_spdif_info(); break; \n");
19416 AU_nPRINT("case 0x21: printf_dmaReader_config(); break; \n");
19417 AU_nPRINT("case 0x22: printf_DPGA_config(); break; \n");
19418 AU_nPRINT("case 0x23: printf_security(); break; \n");
19419 AU_nPRINT("case 0x24: print_omx_info(R2_ADEC_ID1); break; \n");
19420 AU_nPRINT("case 0x25: print_omx_info(R2_ADEC_ID2); break; \n");
19421 AU_nPRINT("case 0x26: print_es_info(R2_ES_ID3); break; \n");
19422 AU_nPRINT("case 0x27: print_es_info(R2_ES_ID4); break; \n");
19423 AU_nPRINT("case 0x28: print_decoder_shmParam(R2_ADEC_ID1); break; \n");
19424 AU_nPRINT("case 0x29: print_decoder_shmParam(R2_ADEC_ID2); break; \n");
19425 AU_nPRINT("case 0x30: print_newMM_info(R2_ADEC_ID1); break; \n");
19426 AU_nPRINT("case 0x31: print_newMM_info(R2_ADEC_ID2); break; \n");
19427 AU_nPRINT("case 0x32: printf_hdmi_info(); break; \n");
19428 AU_nPRINT("case 0x33: printf_wrap_info(R2_ADEC_ID1); break; \n");
19429 AU_nPRINT("case 0x34: printf_wrap_info(R2_ADEC_ID2); break; \n");
19430 AU_nPRINT("case 0x36: printf_AD_avsyncInfo(R2_ADEC_ID1); break; \n");
19431 AU_nPRINT("case 0x37: printf_AD_avsyncInfo(R2_ADEC_ID2); break; \n");
19432 AU_nPRINT("case 0x38: printf_dual_avsyncInfo(R2_ADEC_ID1); break; \n");
19433 AU_nPRINT("case 0x39: printf_dual_avsyncInfo(R2_ADEC_ID2); break; \n");
19434 AU_nPRINT("case 0x3A: printf_pan_fade_Info(R2_ADEC_ID1); break; \n");
19435 AU_nPRINT("case 0x3B: printf_pan_fade_Info(R2_ADEC_ID2); break; \n");
19436 AU_nPRINT("case 0x3C: print_ES_shmInfo(R2_ADEC_ID1); break; \n");
19437 AU_nPRINT("case 0x3D: print_ES_shmInfo(R2_ADEC_ID2); break; \n");
19438 AU_nPRINT("case 0x3E: printf_GST_PTR_NonPCM_Sync_Info(); break; \n");
19439 AU_nPRINT("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
19440 AU_nPRINT(" define MBOX_WORD_R2_SYSTEM_DBG MBOX_M2D_038A break; \n");
19441 AU_nPRINT("case 0x8A00: [ 0] decoder decode frame status break; \n");
19442 AU_nPRINT("case 0x8A01: [ 1] decoder output pcm status break; \n");
19443 AU_nPRINT("case 0x8A03: [ 3] reset measured max AD no signal counter break; \n");
19444 AU_nPRINT("case 0x8A04: [ 4] omx decode done print break; \n");
19445 AU_nPRINT("case 0x8A08: [ 8] decoder print info break; \n");
19446 AU_nPRINT("case 0x8A09: [ 9] measure decoder mips break; \n");
19447 AU_nPRINT("case 0x8A10: [10] measure miu latency break; \n");
19448 AU_nPRINT("case 0x8A12: [12] disable skip frm when doing AV sync break; \n");
19449 AU_nPRINT("case 0x8A13: [13] disable wait STC when doing AV sync break; \n");
19450 AU_nPRINT("case 0x8A14: [14] disable calculate increase cPTS in timer break; \n");
19451 AU_nPRINT("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
19452
19453 return;
19454 }
19455
19456 //0x9998
AU_CUS_RegDebug(void)19457 void AU_CUS_RegDebug(void)
19458 {
19459 int selNum = 0;
19460
19461 while(1)
19462 {
19463 AU_nPRINT("\n\n\n");
19464 AU_CUS_Show_R2_Debug_Option();
19465 AU_nPRINT("------------------------------------------------------------------ \n");
19466 AU_nPRINT("----------- Register debug -------------------------------------- \n");
19467 AU_nPRINT("------------------------------------------------------------------ \n");
19468 AU_nPRINT("(0x0100) Continuous Read Reg / ASND_DSP DM / ASND_DSP PM / Xbox \n");
19469 AU_nPRINT("(0x0101) Read Register Bank \n");
19470 AU_nPRINT("(0x0102) Read Register \n");
19471 AU_nPRINT("(0x0103) Write Mask Register \n");
19472 AU_nPRINT("(0x0104) Read ASND_DSP DM (ex: 0x40A5) \n");
19473 AU_nPRINT("(0x0105) Write ASND_DSP DM \n");
19474 AU_nPRINT("(0x0106) Read ASND_DSP PM (ex: 0x1901) \n");
19475 AU_nPRINT("(0x0107) Write ASND_DSP PM \n");
19476 AU_nPRINT("(0x0108) Read Xbox \n");
19477 AU_nPRINT("(0x0109) Write Xbox \n");
19478 AU_nPRINT("--------------------------------------- \n");
19479 AU_nPRINT("(0x9999) Exit \n");
19480 AU_nPRINT("--------------------------------------- \n");
19481 AU_nPRINT("Please input the item number: \n");
19482
19483 selNum = AU_CUS_Debug_GetHex("");
19484
19485 switch(selNum)
19486 {
19487 case 0x9999:
19488 return;
19489
19490 case 0x10:
19491 case 0x11:
19492 case 0x12:
19493 case 0x13:
19494 case 0x14:
19495 case 0x15:
19496 case 0x16:
19497 case 0x17:
19498 case 0x18:
19499 case 0x19:
19500 case 0x1a:
19501 case 0x1b:
19502 case 0x1c:
19503 case 0x1d:
19504 case 0x1e:
19505 case 0x1f:
19506 case 0x20:
19507 case 0x21:
19508 case 0x22:
19509 case 0x23:
19510 case 0x24:
19511 case 0x25:
19512 case 0x26:
19513 case 0x27:
19514 case 0x28:
19515 case 0x29:
19516 case 0x30:
19517 case 0x31:
19518 case 0x32:
19519 case 0x33:
19520 case 0x34:
19521 case 0x36:
19522 case 0x37:
19523 case 0x38:
19524 case 0x39:
19525 case 0x3A:
19526 case 0x3B:
19527 case 0x3C:
19528 case 0x3D:
19529 case 0x3E:
19530 default:
19531 {
19532 MS_U16 orignal_REG_BANK_R2_LOG_DBG;
19533 MS_U16 orignal_REG_BANK_R2_UART;
19534
19535 orignal_REG_BANK_R2_LOG_DBG = AU_CUS_ReadAbsReg((MS_U32)REG_BANK_R2_LOG_DBG);
19536 orignal_REG_BANK_R2_UART = AU_CUS_ReadAbsReg((MS_U32)REG_BANK_R2_UART);
19537
19538 AU_nPRINT("orignal_REG_BANK_R2_LOG_DBG = 0x%-4X,\n", orignal_REG_BANK_R2_LOG_DBG);
19539 AU_nPRINT("orignal_REG_BANK_R2_UART = 0x%-4X,\n", orignal_REG_BANK_R2_UART);
19540
19541 REG_BANK_R2_DEC_UART_ENABLE = AU_CUS_Debug_GetHex(AU_R2_UART_ENABLE_MESSAGE);
19542
19543 int sleepTime;
19544 sleepTime = AU_CUS_Debug_GetHex("======= Sleep time: ============ \n");
19545
19546 //R2 WFI, bit11
19547 AU_CUS_WriteAbsMaskReg((MS_U32)REG_BANK_R2_WFI, REG_BANK_R2_WFI_ENABLE, REG_BANK_R2_WFI_ENABLE);
19548
19549 //Set R2
19550 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_R2_UART, (MS_U16)REG_BANK_R2_DEC_UART_ENABLE);
19551 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_R2_LOG_DBG, (MS_U16)selNum); // R2 print msg
19552 sleep(sleepTime);
19553
19554 //Recover
19555 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_R2_LOG_DBG, (MS_U16)orignal_REG_BANK_R2_LOG_DBG);
19556 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_R2_UART, (MS_U16)orignal_REG_BANK_R2_UART);
19557
19558 }
19559 break;
19560
19561 case 0x8A00:
19562 case 0x8A01:
19563 case 0x8A03:
19564 case 0x8A04:
19565 case 0x8A08:
19566 case 0x8A09:
19567 case 0x8A10:
19568 case 0x8A12:
19569 case 0x8A13:
19570 case 0x8A14:
19571 {
19572 switch(selNum)
19573 {
19574 default:
19575 case 0x8A00: selNum = 0x0001; break;
19576 case 0x8A01: selNum = 0x0002; break;
19577 case 0x8A03: selNum = 0x0008; break;
19578 case 0x8A04: selNum = 0x0010; break;
19579 case 0x8A08: selNum = 0x0100; break;
19580 case 0x8A09: selNum = 0x0200; break;
19581 case 0x8A10: selNum = 0x0400; break;
19582 case 0x8A12: selNum = 0x1000; break;
19583 case 0x8A13: selNum = 0x2000; break;
19584 case 0x8A14: selNum = 0x4000; break;
19585 }
19586
19587 MS_U16 orignal_REG_BANK_R2_SYSTEM_DBG;
19588 MS_U16 orignal_REG_BANK_R2_UART;
19589
19590 orignal_REG_BANK_R2_SYSTEM_DBG = AU_CUS_ReadAbsReg((MS_U32)REG_BANK_R2_SYSTEM_DBG);
19591 orignal_REG_BANK_R2_UART = AU_CUS_ReadAbsReg((MS_U32)REG_BANK_R2_UART);
19592
19593 AU_nPRINT("orignal_REG_BANK_R2_SYSTEM_DBG = 0x%-4X,\n", orignal_REG_BANK_R2_SYSTEM_DBG);
19594 AU_nPRINT("orignal_REG_BANK_R2_UART = 0x%-4X,\n", orignal_REG_BANK_R2_UART);
19595
19596 REG_BANK_R2_DEC_UART_ENABLE = AU_CUS_Debug_GetHex(AU_R2_UART_ENABLE_MESSAGE);
19597
19598 int sleepTime;
19599 sleepTime = AU_CUS_Debug_GetHex("======= Sleep time: ============ \n");
19600
19601 //R2 WFI, bit11
19602 AU_CUS_WriteAbsMaskReg((MS_U32)REG_BANK_R2_WFI, REG_BANK_R2_WFI_ENABLE, REG_BANK_R2_WFI_ENABLE);
19603
19604 //Set R2
19605 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_R2_UART, (MS_U16)REG_BANK_R2_DEC_UART_ENABLE);
19606 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_R2_SYSTEM_DBG, (MS_U16)selNum); // R2 print msg
19607 sleep(sleepTime);
19608
19609 //Recover
19610 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_R2_SYSTEM_DBG, (MS_U16)orignal_REG_BANK_R2_SYSTEM_DBG);
19611 AU_CUS_WriteAbsReg((MS_U32)REG_BANK_R2_UART, (MS_U16)orignal_REG_BANK_R2_UART);
19612
19613 }
19614 break;
19615
19616 // Continuous Read
19617 case 0x0100:
19618 {
19619 long int startTime = 0;
19620 long int currentTime = 0;
19621 long int readingTimeMS = 0;
19622 int readingTimeSecond = 0;
19623 int numberOfItems = 0;
19624 int readType = 0;
19625 int i = 0;
19626 MS_U32 *readingItems = NULL;
19627 MS_BOOL isIDMA = FALSE;
19628
19629 AU_nPRINT("============================================= \n");
19630 AU_nPRINT("** Continuous Read ** \n");
19631 AU_nPRINT("============================================= \n");
19632 AU_nPRINT("(01) Reg \n");
19633 AU_nPRINT("(02) ASND_DSP DM \n");
19634 AU_nPRINT("(03) ASND_DSP PM \n");
19635 AU_nPRINT("(04) Xbox \n");
19636
19637 readType = AU_CUS_Debug_GetDec();
19638 AU_nPRINT("readType = %d \n", readType);
19639
19640 AU_nPRINT("======= Number of Items to read: ======= \n");
19641 numberOfItems = AU_CUS_Debug_GetDec();
19642
19643 AU_nPRINT("numberOfItems = %d \n", numberOfItems);
19644
19645 readingItems = (MS_U32 *)AU_CUS_MemoryAlloc(numberOfItems * sizeof(MS_U32));
19646
19647 for(i = 0; i < numberOfItems; i++)
19648 {
19649 AU_nPRINT("======= Enter Item[%d] (must starts by \"0x\"): ======= \n", i);
19650 readingItems[i] = AU_CUS_Debug_GetHex("");
19651 }
19652
19653 for(i = 0; i < numberOfItems; i++)
19654 {
19655 AU_nPRINT("Item[%d] = [0x%X] \n", i, (unsigned int)readingItems[i]);
19656 }
19657
19658 AU_nPRINT("======= Enter Reading Time (sec): ======= \n");
19659 readingTimeSecond = AU_CUS_Debug_GetDec();
19660
19661 AU_nPRINT("readingTimeSecond = %d \n", readingTimeSecond);
19662
19663 readingTimeMS = (long int)(readingTimeSecond * 1000);
19664
19665 startTime = MsOS_GetSystemTime();
19666 currentTime = startTime;
19667
19668 AU_nPRINT("======= read by IDMA? (0:FALSE 1: TRUE) ======= \n");
19669 selNum = AU_CUS_Debug_GetDec();
19670 isIDMA = (MS_BOOL)selNum;
19671
19672 while( ((currentTime - startTime) <= (readingTimeMS)) && (readType <= 4 ) && (readType >= 1 ) )
19673 {
19674 currentTime = MsOS_GetSystemTime();
19675
19676 for(i = 0; i < numberOfItems; i++)
19677 {
19678 switch(readType)
19679 {
19680 case 1: //Read Reg
19681 {
19682 AU_nPRINT("Reg[0x%X]=0x%-4X,\n", (unsigned int)readingItems[i], (unsigned int)AU_CUS_ReadAbsReg((MS_U32)readingItems[i]));
19683 }
19684 break;
19685
19686 case 2: //Read ASND_DSP DM
19687 {
19688 AU_nPRINT("[ASND_DSP DM][0x%X]=0x%-4X,\n", (unsigned int)readingItems[i], (unsigned int)AU_CUS_ReadDM(AU_DEC_ID3, (MS_U32)readingItems[i], isIDMA));
19689 }
19690 break;
19691
19692 case 3: //Read ASND_DSP PM
19693 {
19694 AU_nPRINT("[ASND_DSP PM][0x%X]=0x%-4X,\n", (unsigned int)readingItems[i], (unsigned int)AU_CUS_ReadPM(AU_DEC_ID3, (MS_U32) readingItems[i], isIDMA));
19695 }
19696 break;
19697
19698 case 4: //Read Xbox
19699 {
19700 AU_nPRINT("[Xbox][0x%X]=0x%-4X,\n", (unsigned int)readingItems[i], (unsigned int)AU_CUS_ReadAbsXbox((MS_U32)readingItems[i]));
19701 }
19702 break;
19703
19704 default:
19705 break;
19706
19707 }
19708 }
19709
19710 AU_nPRINT("---------------------------------------------\n");
19711 usleep(1 * 1000);
19712 }
19713 AU_nPRINT("======= End of Continuous read ======= \n");
19714
19715 }
19716 break;
19717
19718 case 0x0101:
19719 {
19720 int intOffset;
19721 selNum = AU_CUS_Debug_GetHex("======= Read abs bank ex:0x112A bank -> Enter 112A00 ============ \n");
19722 intOffset = (int)selNum & 0xFFFF00;
19723
19724 AU_nPRINT("\n\n\n\n");
19725 AU_CUS_Dump_RegBank(intOffset);
19726 AU_nPRINT("\n\n\n\n");
19727
19728 }
19729 break;
19730
19731 case 0x0102:
19732 {
19733 int intOffset;
19734
19735 selNum = AU_CUS_Debug_GetHex("======= Read abs register ex:0x112AAC -> Enter 112AAC ============ \n");
19736 intOffset = (int)selNum;
19737 AU_nPRINT("[0x%X]=0x%-4X,\n", intOffset, AU_CUS_ReadAbsReg((MS_U32)intOffset));
19738
19739 }
19740 break;
19741
19742 case 0x0103:
19743 {
19744 int intOffset;
19745 int Mask;
19746 selNum = AU_CUS_Debug_GetHex("======= Write abs register ex:0x112AAC -> Enter 0x112AAC ============ \n");
19747 intOffset = (int)selNum;
19748
19749 Mask = AU_CUS_Debug_GetHex("======= Write MASK value: ============ \n");
19750 selNum = AU_CUS_Debug_GetHex("======= please enter value (0x0 ~ 0xFFFF) ============ \n");
19751 AU_nPRINT("======= Original [0x%X]=0x%-4X, \n", intOffset, AU_CUS_ReadAbsReg((MS_U32)intOffset));
19752 AU_CUS_WriteAbsMaskReg((MS_U32)intOffset, (MS_U16)Mask, (MS_U16)selNum);
19753 AU_nPRINT("======= New [0x%x]=0x%-4X, \n", intOffset, AU_CUS_ReadAbsReg((MS_U32)intOffset));
19754
19755 }
19756 break;
19757
19758 //Read ASND_DSP DM
19759 case 0x0104:
19760 {
19761 int intOffset;
19762 MS_BOOL isIDMA = FALSE;
19763
19764 selNum = AU_CUS_Debug_GetHex("======= Read ASND_DSP DM (must starts by \"0x\") ======= \n");
19765 intOffset = (int)selNum;
19766 AU_nPRINT("======= read by IDMA? (0:FALSE 1: TRUE) ======= \n");
19767 selNum = AU_CUS_Debug_GetDec();
19768 isIDMA = (MS_BOOL)selNum;
19769 AU_nPRINT("[ASND_DSP DM][0x%X]=0x%-4X,\n", intOffset, AU_CUS_ReadDM(AU_DEC_ID3, (MS_U32)intOffset, isIDMA));
19770 }
19771 break;
19772
19773 //Write ASND_DSP DM
19774 case 0x0105:
19775 {
19776 int intOffset, value;
19777 MS_BOOL isIDMA = FALSE;
19778
19779 selNum = AU_CUS_Debug_GetHex("======= Write ASND_DSP DM ADDR (must starts by \"0x\") ======= \n");
19780 intOffset = (int)selNum;
19781 selNum = AU_CUS_Debug_GetHex("======= Write ASND_DSP DM Value (must starts by \"0x\") ======= \n");
19782 value = (int)selNum;
19783 AU_nPRINT("======= write by IDMA? (0:FALSE 1: TRUE) ======= \n");
19784 selNum = AU_CUS_Debug_GetDec();
19785 isIDMA = (MS_BOOL)selNum;
19786 AU_CUS_WriteDM(AU_DEC_ID3, intOffset, value, isIDMA);
19787 AU_nPRINT("\n");
19788 }
19789 break;
19790
19791 //Read ASND_DSP PM
19792 case 0x0106:
19793 {
19794 int intOffset;
19795 MS_BOOL isIDMA = FALSE;
19796
19797 selNum = AU_CUS_Debug_GetHex("======= Read ASND_DSP PM (must starts by \"0x\") ======= \n");
19798 intOffset = (int)selNum;
19799 AU_nPRINT("======= read by IDMA? (0:FALSE 1: TRUE) ======= \n");
19800 selNum = AU_CUS_Debug_GetDec();
19801 isIDMA = (MS_BOOL)selNum;
19802 AU_nPRINT("[ASND_DSP PM][0x%X]=0x%-4X,\n", intOffset, AU_CUS_ReadPM(AU_DEC_ID3, (MS_U32)intOffset, isIDMA));
19803 }
19804 break;
19805
19806 //Write ASND_DSP PM
19807 case 0x0107:
19808 {
19809 int intOffset, value;
19810 MS_BOOL isIDMA = FALSE;
19811
19812 selNum = AU_CUS_Debug_GetHex("======= Write ASND_DSP PM ADDR (must starts by \"0x\") ======= \n");
19813 intOffset = (int)selNum;
19814 selNum = AU_CUS_Debug_GetHex("======= Write ASND_DSP PM Value (must starts by \"0x\") ======= \n");
19815 value = (int)selNum;
19816 AU_nPRINT("======= write by IDMA? (0:FALSE 1: TRUE) ======= \n");
19817 selNum = AU_CUS_Debug_GetDec();
19818 isIDMA = (MS_BOOL)selNum;
19819 AU_CUS_WritePM(AU_DEC_ID3, intOffset, value, isIDMA);
19820 AU_nPRINT("\n");
19821 }
19822 break;
19823
19824 //Read Xbox
19825 case 0x0108:
19826 {
19827 int intOffset;
19828
19829 selNum = AU_CUS_Debug_GetHex("======= Read abs Xbox ex:0xB932 -> Enter 0xB932 ============ \n");
19830 intOffset = (int)selNum;
19831 AU_nPRINT("[Xbox][0x%X]=0x%-4X,\n", intOffset, (unsigned int)AU_CUS_ReadAbsXbox((MS_U32)intOffset));
19832
19833 }
19834 break;
19835
19836 //Write Xbox
19837 case 0x0109:
19838 {
19839 int intOffset;
19840 selNum = AU_CUS_Debug_GetHex("======= Write abs Xbox ex:0xB932 -> Enter 0xB932 ============ \n");
19841 intOffset = (int)selNum;
19842 selNum = AU_CUS_Debug_GetHex("======= please enter value (0x0 ~ 0xFFFF) ============ \n");
19843 AU_nPRINT("======= Original [0x%X]=0x%-4X, \n", intOffset, (unsigned int)AU_CUS_ReadAbsXbox((MS_U32)intOffset));
19844 AU_CUS_WriteAbsXbox((MS_U32)intOffset, (MS_U32)selNum);
19845 AU_nPRINT("======= New [0x%x]=0x%-4X, \n", intOffset, (unsigned int)AU_CUS_ReadAbsXbox((MS_U32)intOffset));
19846
19847 }
19848 break;
19849 }
19850 }
19851 }
19852
AU_CUS_SingleFunctionDebugMenu(void)19853 MS_BOOL AU_CUS_SingleFunctionDebugMenu(void)
19854 {
19855 int arg1=0, arg2=0, arg3=0, arg4=0, arg5=0, arg6=0, arg7=0, arg8=0, arg9=0, arg10=0;
19856
19857 while(1)
19858 {
19859 AU_nPRINT("=========================================== Initialize, STR ===================================================================================================================================== \n");
19860 AU_nPRINT("(0x0000)API_AUDIO_CUSTOMER_InitializeModule(MS_U32 u32MiuNo, MS_U32 mad_va, API_AUDIO_CUSTOMER_OUTPUT_INFO OutputInfo) \n");
19861 AU_nPRINT("(0x0001)API_AUDIO_CUSTOMER_InitializeModule_IsFinish(void) \n");
19862 AU_nPRINT("(0x0002)API_AUDIO_CUSTOMER_Suspend(void) \n");
19863 AU_nPRINT("(0x0003)API_AUDIO_CUSTOMER_Resume(void) \n");
19864 AU_nPRINT("================================================================================================================================================================================================= \n");
19865 AU_nPRINT(" \n");
19866 AU_nPRINT("=========================================== Connect & Disconnect ================================================================================================================================ \n");
19867 AU_nPRINT("(0x0100)API_AUDIO_CUSTOMER_SetParserMode(API_AUDIO_CUSTOMER_PARSER_MODE pMode) \n");
19868 AU_nPRINT("(0x0101)API_AUDIO_CUSTOMER_ADEC_Connect(API_AUDIO_CUSTOMER_ADEC_INDEX currentConnect, API_AUDIO_CUSTOMER_ADEC_INPUT inputConnect) \n");
19869 AU_nPRINT("(0x0102)API_AUDIO_CUSTOMER_ADEC_Disconnect(API_AUDIO_CUSTOMER_ADEC_INDEX currentConnect) \n");
19870 AU_nPRINT("(0x0103)API_AUDIO_CUSTOMER_ADC_Connect(API_AUDIO_CUSTOMER_ADC_INDEX currentConnect, API_AUDIO_CUSTOMER_ADC_IN_PORT portNum) \n");
19871 AU_nPRINT("(0x0104)API_AUDIO_CUSTOMER_ADC_Disconnect(API_AUDIO_CUSTOMER_ADC_INDEX currentConnect, API_AUDIO_CUSTOMER_ADC_IN_PORT portNum) \n");
19872 AU_nPRINT("(0x0105)API_AUDIO_CUSTOMER_PCM_Mixer_Connect(API_AUDIO_CUSTOMER_PCM_MIXER_INDEX currentConnect, API_AUDIO_CUSTOMER_PCM_MIXER_INPUT inputConnect) \n");
19873 AU_nPRINT("(0x0106)API_AUDIO_CUSTOMER_PCM_Mixer_Disconnect(API_AUDIO_CUSTOMER_PCM_MIXER_INDEX currentConnect, API_AUDIO_CUSTOMER_PCM_MIXER_INPUT inputConnect) \n");
19874 AU_nPRINT("(0x0107)API_AUDIO_CUSTOMER_CH_Sound_Connect(API_AUDIO_CUSTOMER_CH_SOUND currentConnect, API_AUDIO_CUSTOMER_CH_INPUT inputConnect) \n");
19875 AU_nPRINT("(0x0108)API_AUDIO_CUSTOMER_CH_Sound_Disconnect(API_AUDIO_CUSTOMER_CH_SOUND currentConnect, API_AUDIO_CUSTOMER_CH_INPUT inputConnect) \n");
19876 AU_nPRINT("(0x0109)API_AUDIO_CUSTOMER_FW_MIXER_Connect(API_AUDIO_CUSTOMER_CH_SOUND currentConnect, API_AUDIO_CUSTOMER_CH_INPUT inputConnect) \n");
19877 AU_nPRINT("(0x010A)API_AUDIO_CUSTOMER_FW_MIXER_Disconnect(API_AUDIO_CUSTOMER_CH_SOUND currentConnect, API_AUDIO_CUSTOMER_CH_INPUT inputConnect) \n");
19878 AU_nPRINT("(0x010B)API_AUDIO_CUSTOMER_SE_Connect(API_AUDIO_CUSTOMER_CH_SOUND currentConnect, API_AUDIO_CUSTOMER_CH_INPUT inputConnect) \n");
19879 AU_nPRINT("(0x010C)API_AUDIO_CUSTOMER_SE_Disconnect(API_AUDIO_CUSTOMER_CH_SOUND currentConnect, API_AUDIO_CUSTOMER_CH_INPUT inputConnect) \n");
19880 AU_nPRINT("(0x010D)API_AUDIO_CUSTOMER_SNDOUT_Connect(API_AUDIO_CUSTOMER_CH_SOUND currentConnect, API_AUDIO_CUSTOMER_CH_INPUT inputConnect) \n");
19881 AU_nPRINT("(0x010E)API_AUDIO_CUSTOMER_SNDOUT_Disconnect(API_AUDIO_CUSTOMER_CH_SOUND currentConnect, API_AUDIO_CUSTOMER_CH_INPUT inputConnect) \n");
19882 AU_nPRINT("(0x010F)API_AUDIO_CUSTOMER_PCM_CAPTURE_Connect(API_AUDIO_CUSTOMER_CH_SOUND currentConnect, API_AUDIO_CUSTOMER_CH_INPUT inputConnect) \n");
19883 AU_nPRINT("(0x0110)API_AUDIO_CUSTOMER_PCM_CAPTURE_Disconnect(API_AUDIO_CUSTOMER_CH_SOUND currentConnect, API_AUDIO_CUSTOMER_CH_INPUT inputConnect) \n");
19884 AU_nPRINT("(0x0111)API_AUDIO_CUSTOMER_MP3_ENC_Connect(API_AUDIO_CUSTOMER_MP3_ENC_INPUT inputConnect) \n");
19885 AU_nPRINT("(0x0112)API_AUDIO_CUSTOMER_MP3_ENC_Disconnect(API_AUDIO_CUSTOMER_MP3_ENC_INPUT inputConnect) \n");
19886 AU_nPRINT("(0x0113)API_AUDIO_CUSTOMER_AAC_ENC_Connect(API_AUDIO_CUSTOMER_AAC_ENC_INPUT inputConnect) \n");
19887 AU_nPRINT("(0x0114)API_AUDIO_CUSTOMER_AAC_ENC_Disconnect(API_AUDIO_CUSTOMER_AAC_ENC_INPUT inputConnect) \n");
19888 AU_nPRINT("================================================================================================================================================================================================= \n");
19889 AU_nPRINT(" \n");
19890 AU_nPRINT("=========================================== Start & Stop ======================================================================================================================================== \n");
19891 AU_nPRINT("(0x0200)API_AUDIO_CUSTOMER_SetCodecType(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_CODEC_TYPE audioType) \n");
19892 AU_nPRINT("(0x0201)API_AUDIO_CUSTOMER_StartDecoding(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex) \n");
19893 AU_nPRINT("(0x0202)API_AUDIO_CUSTOMER_StopDecoding(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex) \n");
19894 AU_nPRINT("(0x0203)API_AUDIO_CUSTOMER_PauseDecoding(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex) \n");
19895 AU_nPRINT("(0x0204)API_AUDIO_CUSTOMER_SetMainDecoderOutput(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex) \n");
19896 AU_nPRINT("================================================================================================================================================================================================= \n");
19897 AU_nPRINT(" \n");
19898 AU_nPRINT("=========================================== SPDIF =============================================================================================================================================== \n");
19899 AU_nPRINT("(0x0300)API_AUDIO_CUSTOMER_SPDIF_TX_SetOutputType(API_AUDIO_CUSTOMER_SPDIF_TX_MODE eSPDIFMode) \n");
19900 AU_nPRINT("(0x0301)API_AUDIO_CUSTOMER_SPDIF_TX_GetOutputType(void); \n");
19901 AU_nPRINT("(0x0302)API_AUDIO_CUSTOMER_SPDIF_TX_SetCopyInfo(API_AUDIO_CUSTOMER_SPDIF_COPYRIGHT copyInfo) \n");
19902 AU_nPRINT("(0x0303)API_AUDIO_CUSTOMER_SPDIF_TX_SetCategoryCode(MS_U8 categoryCode) \n");
19903 AU_nPRINT("(0x0304)API_AUDIO_CUSTOMER_SPDIF_TX_SetLightOnOff(MS_BOOL bOnOff) \n");
19904 AU_nPRINT("(0x0305)API_AUDIO_CUSTOMER_SPDIF_TX_SetMonitorOnOff(MS_BOOL bOnOff) \n");
19905 AU_nPRINT("(0x0306)API_AUDIO_CUSTOMER_SPDIF_TX_ChannelStatus_CTRL(API_AUDIO_CUSTOMER_SPDIF_CS_TYPE cs_mode, API_AUDIO_CUSTOMER_SPDIF_CS_TYPE_STATUS status); \n");
19906 AU_nPRINT("================================================================================================================================================================================================= \n");
19907 AU_nPRINT(" \n");
19908 AU_nPRINT("=========================================== HDMI ================================================================================================================================================ \n");
19909 AU_nPRINT("(0x0400)API_AUDIO_CUSTOMER_HDMI_RX_GetAudioMode(API_AUDIO_CUSTOMER_HDMI_RX_CODEC_TYPE *pHDMIMode) \n");
19910 AU_nPRINT("(0x0401)API_AUDIO_CUSTOMER_HDMI_RX_GetCopyInfo(API_AUDIO_CUSTOMER_SPDIF_COPYRIGHT *pCopyInfo) \n");
19911 AU_nPRINT("(0x0402)API_AUDIO_CUSTOMER_HDMI_RX_SetAudioReturnChannel(MS_BOOL bOnOff) \n");
19912 AU_nPRINT("(0x0403)API_AUDIO_CUSTOMER_HDMI_RX_SetMonitorOnOff(MS_BOOL bOnOff) \n");
19913 AU_nPRINT("(0x0404)API_AUDIO_CUSTOMER_HDMI_TX_SetOutputType(API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_TYPE eHDMIMode) \n");
19914 AU_nPRINT("(0x0405)API_AUDIO_CUSTOMER_HDMI_TX_SetMonitorOnOff(MS_BOOL bOnOff) \n");
19915 AU_nPRINT("================================================================================================================================================================================================= \n");
19916 AU_nPRINT(" \n");
19917 AU_nPRINT("=========================================== ATV ================================================================================================================================================= \n");
19918 AU_nPRINT("(0x0500)API_AUDIO_CUSTOMER_SIF_SetInputSource(API_AUDIO_CUSTOMER_SIF_INPUT sifSource) \n");
19919 AU_nPRINT("(0x0501)API_AUDIO_CUSTOMER_SIF_SetHighDevMode(API_AUDIO_CUSTOMER_SIF_HIDEV_BW bandwidth, MS_BOOL bOnOff) \n");
19920 AU_nPRINT("(0x0502)API_AUDIO_CUSTOMER_SIF_SetAudioStandard(API_AUDIO_CUSTOMER_SIF_STANDARD sifStandard) \n");
19921 AU_nPRINT("(0x0503)API_AUDIO_CUSTOMER_SIF_SetSoundMode(API_AUDIO_CUSTOMER_SIF_AUDIOMODE_TYPE u8SifSoundMode) \n");
19922 AU_nPRINT("(0x0504)API_AUDIO_CUSTOMER_SIF_GetSoundMode(void) \n");
19923 AU_nPRINT("(0x0505)API_AUDIO_CUSTOMER_SIF_SetMonitorOnOff(MS_BOOL bOnOff) \n");
19924 AU_nPRINT("(0x0506)API_AUDIO_CUSTOMER_SIF_SetAutoMute(MS_BOOL bOnOff) \n");
19925 AU_nPRINT("(0x0507)API_AUDIO_CUSTOMER_SIF_StartAutoStandardDetection(void) \n");
19926 AU_nPRINT("(0x0508)API_AUDIO_CUSTOMER_SIF_SetThreshold(API_AUDIO_CUSTOMER_SIF_THR_TBL_TYPE *ThrTbl) \n");
19927 AU_nPRINT("(0x0509)API_AUDIO_CUSTOMER_SIF_SetPALType(API_AUDIO_CUSTOMER_SIF_PAL_TYPE pal_type) \n");
19928 AU_nPRINT("(0x050A)API_AUDIO_CUSTOMER_SIF_SendCmd(API_AUDIO_CUSTOMER_SIF_CmdType enAudSifCommand, MS_U8 comm_arg1, MS_U8 comm_arg2) \n");
19929 AU_nPRINT("(0x050B)API_AUDIO_CUSTOMER_SIF_GetAudioStatus(API_AUDIO_CUSTOMER_SIF_AUDIOSTATUS *eCurrentAudioStatus) \n");
19930 AU_nPRINT("(0x050C)API_AUDIO_CUSTOMER_SIF_IsPALType(API_AUDIO_CUSTOMER_SIF_PAL_TYPE pal_type) \n");
19931 AU_nPRINT("(0x050D)API_AUDIO_CUSTOMER_SIF_SetPrescale(API_AUDIO_CUSTOMER_SIF_GAIN_TYPE gain_type, MS_S32 db_value) \n");
19932 AU_nPRINT("================================================================================================================================================================================================= \n");
19933 AU_nPRINT(" \n");
19934 AU_nPRINT("=========================================== Decoder ============================================================================================================================================= \n");
19935 AU_nPRINT("(0x0600)API_AUDIO_CUSTOMER_SetSyncMode(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_BOOL bOnOff) \n");
19936 AU_nPRINT("(0x0601)API_AUDIO_CUSTOMER_GetDecodingType(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_CODEC_TYPE *pAudioType) \n");
19937 AU_nPRINT("(0x0602)API_AUDIO_CUSTOMER_SetDualMonoOutMode(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_DUALMONO_MODE outputMode) \n");
19938 AU_nPRINT("(0x0603)API_AUDIO_CUSTOMER_GetESInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, void * pAudioESInfo) \n");
19939 AU_nPRINT("(0x0604)API_AUDIO_CUSTOMER_IsESExist(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex) \n");
19940 AU_nPRINT("(0x0605)API_AUDIO_CUSTOMER_SetAudioDescription(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_BOOL bOnOff) \n");
19941 AU_nPRINT("(0x0606)API_AUDIO_CUSTOMER_SetTrickMode(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_TRICK_MODE eTrickMode) \n");
19942 AU_nPRINT("(0x0607)API_AUDIO_CUSTOMER_GetBufferStatus(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_U32 *pMaxSize, MS_U32 *pFreeSize) \n");
19943 AU_nPRINT("(0x0608)API_AUDIO_CUSTOMER_SetAdecPcmPath(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_ADEC_PCM_PATH pcmPath) \n");
19944 AU_nPRINT("(0x0609)API_AUDIO_CUSTOMER_AdecPcmReady(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex) \n");
19945 AU_nPRINT("(0x060A)API_AUDIO_CUSTOMER_AdecPcmGet(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, void * pOutPcm, MS_U32 u32Size) \n");
19946 AU_nPRINT("(0x060B)API_AUDIO_CUSTOMER_AdecRegisterDecodeDoneCallback(pfnAudioCustomerAdecDecodeDone pfnDecodeDoneCallBack) \n");
19947 AU_nPRINT("(0x060C)API_AUDIO_CUSTOMER_AdecRegisterEndOfStreamCallback(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, pfnAudioCustomerAdecEndOfStream pfnEndOfStreamCallBack) \n");
19948 AU_nPRINT("(0x060D)API_AUDIO_CUSTOMER_AdecRegisterUnderrunCallback(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, pfnAudioCustomerAdecUnderrun pfnUnderrunCallBack) \n");
19949 AU_nPRINT("(0x060E)API_AUDIO_CUSTOMER_Auto_Recovery_SetMonitorOnOff(MS_BOOL bOnOff) \n");
19950 AU_nPRINT("================================================================================================================================================================================================= \n");
19951 AU_nPRINT(" \n");
19952 AU_nPRINT("=========================================== Common Decoder ====================================================================================================================================== \n");
19953 AU_nPRINT("(0x0700)API_AUDIO_CUSTOMER_COMMON_DECODER_Open(void * pData) \n");
19954 AU_nPRINT("(0x0701)API_AUDIO_CUSTOMER_COMMON_DECODER_Close(MS_S32 s32DeviceID) \n");
19955 AU_nPRINT("(0x0702)API_AUDIO_CUSTOMER_COMMON_DECODER_Start(MS_S32 s32DeviceID) \n");
19956 AU_nPRINT("(0x0703)API_AUDIO_CUSTOMER_COMMON_DECODER_Stop(MS_S32 s32DeviceID) \n");
19957 AU_nPRINT("(0x0704)API_AUDIO_CUSTOMER_COMMON_DECODER_Set(MS_S32 s32DeviceID, API_AUDIO_CUSTOMER_COMMON_DECODER_COMMAND Cmd, void* pData) \n");
19958 AU_nPRINT("(0x0705)API_AUDIO_CUSTOMER_COMMON_DECODER_Get(MS_S32 s32DeviceID, API_AUDIO_CUSTOMER_COMMON_DECODER_COMMAND Cmd, void* pData) \n");
19959 AU_nPRINT("(0x0706)API_AUDIO_CUSTOMER_COMMON_DECODER_Read(MS_S32 s32DeviceID, void* pBuf, MS_U32 u32Size) \n");
19960 AU_nPRINT("(0x0707)API_AUDIO_CUSTOMER_COMMON_DECODER_Write(MS_S32 s32DeviceID, void* pBuf, MS_U32 u32Size) \n");
19961 AU_nPRINT("(0x0708)API_AUDIO_CUSTOMER_COMMON_DECODER_Flush(MS_S32 s32DeviceID) \n");
19962 AU_nPRINT("================================================================================================================================================================================================= \n");
19963 AU_nPRINT(" \n");
19964 AU_nPRINT("=========================================== Common ============================================================================================================================================== \n");
19965 AU_nPRINT("(0x0800)API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_PARAM_TYPE paramType, void *pParam) \n");
19966 AU_nPRINT("(0x0801)API_AUDIO_CUSTOMER_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_CODEC_TYPE audioType, API_AUDIO_CUSTOMER_INFO_TYPE infoType, void *pInfo) \n");
19967 AU_nPRINT("================================================================================================================================================================================================= \n");
19968 AU_nPRINT(" \n");
19969 AU_nPRINT("=========================================== Customized patch ==================================================================================================================================== \n");
19970 AU_nPRINT("(0x0900)API_AUDIO_CUSTOMIZED_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMIZED_PATCH_PARAM_TYPE paramType, void *pParam) \n");
19971 AU_nPRINT("(0x0901)API_AUDIO_CUSTOMIZED_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMIZED_PATCH_INFO_TYPE infoType, void *pInfo) \n");
19972 AU_nPRINT("================================================================================================================================================================================================= \n");
19973 AU_nPRINT(" \n");
19974 AU_nPRINT("=========================================== Clip play for ES ==================================================================================================================================== \n");
19975 AU_nPRINT("(0x0A00)API_AUDIO_CUSTOMER_PlayClipDecoder(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_CLIP_DEC_PARAM clipInfo, MS_U32 bufSize, void *pBufClip, pfnAudioCustomerAdecoderClipDone pfnCallBack) \n");
19976 AU_nPRINT("(0x0A01)API_AUDIO_CUSTOMER_StopClipDecoder(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex) \n");
19977 AU_nPRINT("(0x0A02)API_AUDIO_CUSTOMER_PauseClipDecoder(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex) \n");
19978 AU_nPRINT("(0x0A03)API_AUDIO_CUSTOMER_ResumeClipDecoder(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex) \n");
19979 AU_nPRINT("================================================================================================================================================================================================= \n");
19980 AU_nPRINT(" \n");
19981 AU_nPRINT("=========================================== Clip play for PCM =================================================================================================================================== \n");
19982 AU_nPRINT("(0x0B00)API_AUDIO_CUSTOMER_PlayClipMixer(API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex) \n");
19983 AU_nPRINT("(0x0B01)API_AUDIO_CUSTOMER_StopClipMixer(API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex) \n");
19984 AU_nPRINT("(0x0B02)API_AUDIO_CUSTOMER_PauseClipMixer(API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex) \n");
19985 AU_nPRINT("(0x0B03)API_AUDIO_CUSTOMER_ResumeClipMixer(API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex) \n");
19986 AU_nPRINT("================================================================================================================================================================================================= \n");
19987 AU_nPRINT(" \n");
19988 AU_nPRINT("=========================================== Gain, Mute & Delay ================================================================================================================================== \n");
19989 AU_nPRINT("---Gain--- \n");
19990 AU_nPRINT("(0x0C00)API_AUDIO_CUSTOMER_SetAudioDescriptionGain(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_U32 gain) \n");
19991 AU_nPRINT("(0x0C01)API_AUDIO_CUSTOMER_SetPCMMixerInputGain(API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex, MS_U32 gain) \n");
19992 AU_nPRINT("(0x0C02)API_AUDIO_CUSTOMER_SetFWMixerChannelGain(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect, API_AUDIO_CUSTOMER_FWM_INPUT inputConnect, MS_U32 gain) \n");
19993 AU_nPRINT("(0x0C03)API_AUDIO_CUSTOMER_SetI2SOutGain(MS_U32 gain) \n");
19994 AU_nPRINT("(0x0C04)API_AUDIO_CUSTOMER_SetLineOutGain(API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex, MS_U32 gain) \n");
19995 AU_nPRINT("(0x0C05)API_AUDIO_CUSTOMER_SetSPDIFOutGain(MS_U32 gain) \n");
19996 AU_nPRINT("(0x0C06)API_AUDIO_CUSTOMER_SetHDMIOutGain(MS_U32 gain) \n");
19997 AU_nPRINT("---Mute--- \n");
19998 AU_nPRINT("(0x0C07)API_AUDIO_CUSTOMER_SetPCMMixerInputMute(API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex, MS_BOOL bOnOff) \n");
19999 AU_nPRINT("(0x0C08)API_AUDIO_CUSTOMER_SetFWMixerChannelMute(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect, API_AUDIO_CUSTOMER_FWM_INPUT inputConnect, MS_BOOL bOnOff) \n");
20000 AU_nPRINT("(0x0C09)API_AUDIO_CUSTOMER_SetI2SOutMute(MS_BOOL bOnOff) \n");
20001 AU_nPRINT("(0x0C0A)API_AUDIO_CUSTOMER_SetLineOutMute(API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex, MS_BOOL bOnOff) \n");
20002 AU_nPRINT("(0x0C0B)API_AUDIO_CUSTOMER_SetSPDIFOutMute(MS_BOOL bOnOff) \n");
20003 AU_nPRINT("(0x0C0C)API_AUDIO_CUSTOMER_SetHDMIOutMute(MS_BOOL bOnOff) \n");
20004 AU_nPRINT("(0x0C0D)API_AUDIO_CUSTOMER_GetI2SOutMuteStatus(MS_BOOL *pOnOff) \n");
20005 AU_nPRINT("(0x0C0E)API_AUDIO_CUSTOMER_GetLineOutMuteStatus(API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex, MS_BOOL *pOnOff) \n");
20006 AU_nPRINT("(0x0C0F)API_AUDIO_CUSTOMER_GetSPDIFOutMuteStatus(MS_BOOL *pOnOff) \n");
20007 AU_nPRINT("(0x0C10)API_AUDIO_CUSTOMER_MuteDuringLimitedTime_Input(MS_U32 per_50ms, API_AUDIO_CUSTOMER_FWM_INDEX eFWM, API_AUDIO_CUSTOMER_FWM_INPUT eCh) \n");
20008 AU_nPRINT("(0x0C11)API_AUDIO_CUSTOMER_MuteDuringLimitedTime_Output(MS_U32 per_50ms, API_AUDIO_CUSTOMER_OUTPUT_TYPE ePort) \n");
20009 AU_nPRINT("---Delay--- \n");
20010 AU_nPRINT("(0x0C12)API_AUDIO_CUSTOMER_SetChannelDelay(API_AUDIO_CUSTOMER_CH_SOUND ch, MS_U32 delay) \n");
20011 AU_nPRINT("(0x0C13)API_AUDIO_CUSTOMER_SetAudioDelay(MS_U32 delayTime) \n");
20012 AU_nPRINT("(0x0C14)API_AUDIO_CUSTOMER_SetSpdifDelay(MS_U32 delayTime) \n");
20013 AU_nPRINT("(0x0C15)API_AUDIO_CUSTOMER_SetHdmiDelay(MS_U32 delayTime) \n");
20014 AU_nPRINT("================================================================================================================================================================================================= \n");
20015 AU_nPRINT(" \n");
20016 AU_nPRINT("=========================================== AENC ================================================================================================================================================ \n");
20017 AU_nPRINT("(0x0D00)API_AUDIO_CUSTOMER_AENC_Start(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat) \n");
20018 AU_nPRINT("(0x0D01)API_AUDIO_CUSTOMER_AENC_Stop(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat) \n");
20019 AU_nPRINT("(0x0D02)API_AUDIO_CUSTOMER_AENC_RegisterCallback(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat, pfnAudioCustomerAENCDataHandling pfnCallBack) \n");
20020 AU_nPRINT("(0x0D03)API_AUDIO_CUSTOMER_AENC_SetInfo(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat, API_AUDIO_CUSTOMER_AENC_INFO info) \n");
20021 AU_nPRINT("(0x0D04)API_AUDIO_CUSTOMER_AENC_GetInfo(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat, API_AUDIO_CUSTOMER_AENC_INFO *pInfo) \n");
20022 AU_nPRINT("(0x0D05)API_AUDIO_CUSTOMER_AENC_SetGain(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat, MS_U32 gain) \n");
20023 AU_nPRINT("(0x0D06)API_AUDIO_CUSTOMER_AENC_CopyData(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat, MS_U8 *pDest, MS_U8 *pBufAddr, MS_U32 datasize, MS_U8 *pRStart, MS_U8 *pREnd) \n");
20024 AU_nPRINT("(0x0D07)API_AUDIO_CUSTOMER_AENC_ReleaseData(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat, MS_U8 *pBufAddr, MS_U32 datasize) \n");
20025 AU_nPRINT("================================================================================================================================================================================================= \n");
20026 AU_nPRINT(" \n");
20027 AU_nPRINT("=========================================== PCM Capture ========================================================================================================================================= \n");
20028 AU_nPRINT("(0x0E00)API_AUDIO_CUSTOMER_PCM_StartUpload(API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect) \n");
20029 AU_nPRINT("(0x0E01)API_AUDIO_CUSTOMER_PCM_StopUpload(API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect) \n");
20030 AU_nPRINT("(0x0E02)API_AUDIO_CUSTOMER_PCM_RegisterSendPCMCallback(API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect, pfnAudioCustomerPCMSending pfnCallBack) \n");
20031 AU_nPRINT("(0x0E03)API_AUDIO_CUSTOMER_PCM_SetGain(API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect, MS_U32 gain) \n");
20032 AU_nPRINT("(0x0E04)API_AUDIO_CUSTOMER_PCM_SetMute(API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect, MS_BOOL bOnOff) \n");
20033 AU_nPRINT("(0x0E05)API_AUDIO_CUSTOMER_PCM_SetRequestSizeInMs(MS_U32 request_ms) \n");
20034 AU_nPRINT("================================================================================================================================================================================================= \n");
20035 AU_nPRINT(" \n");
20036 AU_nPRINT("=========================================== PCM IO Control ====================================================================================================================================== \n");
20037 AU_nPRINT("(0x0F00)API_AUDIO_CUSTOMER_PCM_Open(API_AUDIO_CUSTOMER_PCMIO_PARAM *pData) \n");
20038 AU_nPRINT("(0x0F01)API_AUDIO_CUSTOMER_PCM_Close(MS_S32 s32DeviceId) \n");
20039 AU_nPRINT("(0x0F02)API_AUDIO_CUSTOMER_PCM_Start(MS_S32 s32DeviceId) \n");
20040 AU_nPRINT("(0x0F03)API_AUDIO_CUSTOMER_PCM_Stop(MS_S32 s32DeviceId) \n");
20041 AU_nPRINT("(0x0F04)API_AUDIO_CUSTOMER_PCM_Set(MS_S32 s32DeviceId, MS_U32 u32Cmd, const void *pData) \n");
20042 AU_nPRINT("(0x0F05)API_AUDIO_CUSTOMER_PCM_Get(MS_S32 s32DeviceId, MS_U32 u32Cmd, void *pData) \n");
20043 AU_nPRINT("(0x0F06)API_AUDIO_CUSTOMER_PCM_Read(MS_S32 s32DeviceId, void *pBuf, MS_U32 u32Size) \n");
20044 AU_nPRINT("(0x0F07)API_AUDIO_CUSTOMER_PCM_Write(MS_S32 s32DeviceId, const void *pBuf, MS_U32 u32Size) \n");
20045 AU_nPRINT("(0x0F08)API_AUDIO_CUSTOMER_PCM_Flush(MS_S32 s32DeviceId) \n");
20046 AU_nPRINT("================================================================================================================================================================================================= \n");
20047 AU_nPRINT(" \n");
20048 AU_nPRINT("=========================================== MM New Mode ========================================================================================================================================= \n");
20049 AU_nPRINT("(0x1000)API_AUDIO_CUSTOMER_GetDDRInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_DDRINFO DDRInfo) \n");
20050 AU_nPRINT("(0x1001)API_AUDIO_CUSTOMER_MM2_initAesInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex) \n");
20051 AU_nPRINT("(0x1002)API_AUDIO_CUSTOMER_MM2_checkAesInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_AES_INFO *aes_info) \n");
20052 AU_nPRINT("(0x1003)API_AUDIO_CUSTOMER_MM2_inputAesFinished(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_U32 es_size, MS_BOOL ptsExist, MS_U64 pts) \n");
20053 AU_nPRINT("(0x1004)API_AUDIO_CUSTOMER_MM2_AD_initAesInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_U32 es_size, MS_BOOL ptsExist, MS_U64 pts) \n");
20054 AU_nPRINT("(0x1005)API_AUDIO_CUSTOMER_MM2_AD_checkAesInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_U32 es_size, MS_BOOL ptsExist, MS_U64 pts) \n");
20055 AU_nPRINT("(0x1006)API_AUDIO_CUSTOMER_MM2_AD_inputAesFinished(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_U32 es_size, MS_BOOL ptsExist, MS_U64 pts) \n");
20056 AU_nPRINT("================================================================================================================================================================================================= \n");
20057 AU_nPRINT(" \n");
20058 AU_nPRINT("=========================================== MStar Sound Effect ================================================================================================================================== \n");
20059 AU_nPRINT("(0x1100)API_AUDIO_CUSTOMER_MSTAR_SE_Enable(API_AUDIO_CUSTOMER_MSTAR_SE_TYPE Type, MS_BOOL bOnOff) \n");
20060 AU_nPRINT("(0x1101)API_AUDIO_CUSTOMER_MSTAR_SE_SET_GEQ(MS_U8 u8band, MS_S8 s8level) \n");
20061 AU_nPRINT("(0x1102)API_AUDIO_CUSTOMER_MSTAR_SE_SET_PEQCoef(API_AUDIO_CUSTOMER_MSTAR_PEQ_COEF *peq_coef) \n");
20062 AU_nPRINT("(0x1103)API_AUDIO_CUSTOMER_MSTAR_SE_SET_HPFCoef(API_AUDIO_CUSTOMER_MSTAR_HPF_COEF *hpf_coef) \n");
20063 AU_nPRINT("(0x1104)API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_MODE(API_AUDIO_CUSTOMER_MSTAR_AVC_MODE mode) \n");
20064 AU_nPRINT("(0x1105)API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_LEVEL(MS_U16 u16level) \n");
20065 AU_nPRINT("(0x1106)API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_Begin(MS_U16 u16Begin) \n");
20066 AU_nPRINT("(0x1107)API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_End(MS_U16 u16End) \n");
20067 AU_nPRINT("(0x1108)API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_End(MS_U16 u16End) \n");
20068 AU_nPRINT("(0x1109)API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_S_MODE_OFFSET(MS_U16 u16offset) \n");
20069 AU_nPRINT("(0x110A)API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_AttackTime(MS_U8 AvcAT) \n");
20070 AU_nPRINT("(0x110B)API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_ReleaseTime(MS_U8 AvcRT) \n");
20071 AU_nPRINT("(0x110C)API_AUDIO_CUSTOMER_MSTAR_SE_SET_DRC_LEVEL(MS_U16 u16level) \n");
20072 AU_nPRINT("(0x110D)API_AUDIO_CUSTOMER_MSTAR_SE_SET_BALANCE(MS_U16 Lbalance, MS_U16 Rbalance) \n");
20073 AU_nPRINT("(0x110E)API_AUDIO_CUSTOMER_MSTAR_SE_SET_NR_Threshold(MS_U16 u16level) \n");
20074 AU_nPRINT("(0x110F)API_AUDIO_CUSTOMER_MSTAR_SE_GET_NR_Status(void) \n");
20075 AU_nPRINT("================================================================================================================================================================================================= \n");
20076 AU_nPRINT(" \n");
20077 AU_nPRINT("=========================================== Advanced Sound Effect =============================================================================================================================== \n");
20078 AU_nPRINT("(0x1200)API_AUDIO_CUSTOMER_DTS_SE_Enable(API_AUDIO_CUSTOMER_DTS_SE_TYPE seType) \n");
20079 AU_nPRINT("(0x1201)API_AUDIO_CUSTOMER_DTS_SE_ProcessUnit_Enable(API_AUDIO_CUSTOMER_DTS_SE_UNIT_TYPE seUnit, MS_BOOL bOnOff) \n");
20080 AU_nPRINT("(0x1202)API_AUDIO_CUSTOMER_DTS_SE_SetParam(API_AUDIO_CUSTOMER_DTS_SE_PARAM_TYPE param, MS_U32 u32value) \n");
20081 AU_nPRINT("(0x1203)API_AUDIO_CUSTOMER_Dolby_DAP_Enable(MS_BOOL bOnOff) \n");
20082 AU_nPRINT("(0x1204)API_AUDIO_CUSTOMER_Dolby_DAP_ProcessUnit_Enable(MS_BOOL bOnOff) \n");
20083 AU_nPRINT("(0x1205)API_AUDIO_CUSTOMER_Dolby_DAP_SetParam(API_AUDIO_CUSTOMER_DOLBY_DAP_PARAM dap_params) \n");
20084 AU_nPRINT("================================================================================================================================================================================================= \n");
20085 AU_nPRINT(" \n");
20086 AU_nPRINT("(0x9999) exit \n");
20087 AU_nPRINT("Select Command (Start from 0x) : \n");
20088
20089 arg1 = AU_CUS_Debug_GetHex("");
20090 int nUnused = 0;
20091 nUnused = nUnused;
20092
20093 switch(arg1)
20094 {
20095 /* Initialize, STR */
20096 case 0x0000:
20097 {
20098 API_AUDIO_CUSTOMER_OUTPUT_INFO OutputInfo;
20099 API_AUDIO_CUSTOMER_CHIP_PLATFORM chipPlatform;
20100 MS_U32 adec_pa = 0;
20101 MS_U32 adec_va = 0;
20102
20103 memset((void *)(&OutputInfo), 0, sizeof(OutputInfo));
20104
20105 OutputInfo.SpeakerOut = API_AUDIO_CUSTOMER_I2S_OUTPUT;
20106 OutputInfo.HpOut = API_AUDIO_CUSTOMER_HP_OUTPUT;
20107 OutputInfo.ScartOut = API_AUDIO_CUSTOMER_LINEOUT3_OUTPUT;
20108 OutputInfo.MonitorOut = API_AUDIO_CUSTOMER_LINEOUT0_OUTPUT;
20109
20110 AU_nPRINT("Chip Platform (0:TV, 1: STB):\n");
20111 arg2 = AU_CUS_Debug_GetDec();
20112 chipPlatform = (API_AUDIO_CUSTOMER_CHIP_PLATFORM)arg2;
20113
20114 adec_pa = MApi_AUDIO_GetDspMadBaseAddr(2);
20115
20116 adec_va = MsOS_MPool_PA2KSEG1(adec_pa);
20117 if(adec_va != 0)
20118 {
20119 API_AUDIO_CUSTOMER_InitializeModule(0, adec_va, OutputInfo, chipPlatform);
20120 API_AUDIO_CUSTOMER_FW_MIXER_Connect(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5);
20121 }
20122 }
20123 break;
20124
20125 case 0x0001:
20126 {
20127 AU_nPRINT("InitializeModule_IsFinish (%d) \n", (unsigned int)API_AUDIO_CUSTOMER_InitializeModule_IsFinish() );
20128 }
20129 break;
20130
20131 case 0x0002:
20132 {
20133 AU_nPRINT("Suspend: \n");
20134 API_AUDIO_CUSTOMER_Suspend();
20135 }
20136 break;
20137
20138 case 0x0003:
20139 {
20140 AU_nPRINT("Resume: \n");
20141 API_AUDIO_CUSTOMER_Resume();
20142 }
20143 break;
20144
20145 /* Connect & Disconnect */
20146 case 0x0100:
20147 {
20148 AU_nPRINT("////////////////////////////////////////////////////////////////////////////////\n");
20149 AU_nPRINT("// mode 0:\n");
20150 AU_nPRINT("// AFIFO_0-> ES1\n");
20151 AU_nPRINT("// AFIFO_1-> ES2\n");
20152 AU_nPRINT("// AFIFO_2-> ES3\n");
20153 AU_nPRINT("// AFIFO_3-> ES4\n");
20154 AU_nPRINT("// mode 1:\n");
20155 AU_nPRINT("// AFIFO_2-> ES1\n");
20156 AU_nPRINT("// AFIFO_3-> ES2\n");
20157 AU_nPRINT("// AFIFO_0-> ES3\n");
20158 AU_nPRINT("// AFIFO_1-> ES4\n");
20159 AU_nPRINT("// mode 2:\n");
20160 AU_nPRINT("// AFIFO_1-> ES1\n");
20161 AU_nPRINT("// AFIFO_2-> ES2\n");
20162 AU_nPRINT("// AFIFO_0-> ES3\n");
20163 AU_nPRINT("// AFIFO_3-> ES4\n");
20164 AU_nPRINT("// mode 3:\n");
20165 AU_nPRINT("// AFIFO_0-> ES1\n");
20166 AU_nPRINT("// AFIFO_1-> ES2\n");
20167 AU_nPRINT("// AFIFO_2-> ES3\n");
20168 AU_nPRINT("// AFIFO_3-> ES4\n");
20169 AU_nPRINT("////////////////////////////////////////////////////////////////////////////////\n");
20170 AU_nPRINT("mode:\n");
20171
20172 arg2 = AU_CUS_Debug_GetDec();
20173 API_AUDIO_CUSTOMER_PARSER_MODE pMode = (API_AUDIO_CUSTOMER_PARSER_MODE)arg2;
20174
20175 API_AUDIO_CUSTOMER_SetParserMode(pMode);
20176 }
20177 break;
20178
20179 case 0x0101:
20180 {
20181 AU_nPRINT("currentConnect:\n");
20182 arg2 = AU_CUS_Debug_GetDec();
20183 AU_nPRINT("inputConnect:\n");
20184 arg3 = AU_CUS_Debug_GetDec();
20185
20186 API_AUDIO_CUSTOMER_ADEC_INDEX currentConnect = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
20187 API_AUDIO_CUSTOMER_ADEC_INPUT inputConnect = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg3;
20188
20189 API_AUDIO_CUSTOMER_ADEC_Connect(currentConnect, inputConnect);
20190 }
20191 break;
20192
20193 case 0x0102:
20194 {
20195 AU_nPRINT("currentConnect:\n");
20196 arg2 = AU_CUS_Debug_GetDec();
20197
20198 API_AUDIO_CUSTOMER_ADEC_INDEX currentConnect = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
20199
20200 API_AUDIO_CUSTOMER_ADEC_Disconnect(currentConnect);
20201 }
20202 break;
20203
20204 case 0x0103:
20205 {
20206 AU_nPRINT("currentConnect:\n");
20207 arg2 = AU_CUS_Debug_GetDec();
20208 AU_nPRINT("portNum:\n");
20209 arg3 = AU_CUS_Debug_GetDec();
20210
20211 API_AUDIO_CUSTOMER_ADEC_INDEX currentConnect = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
20212 API_AUDIO_CUSTOMER_ADC_IN_PORT portNum = (API_AUDIO_CUSTOMER_ADC_IN_PORT)arg3;
20213
20214 API_AUDIO_CUSTOMER_ADC_Connect(currentConnect, portNum);
20215 }
20216 break;
20217
20218 case 0x0104:
20219 {
20220 AU_nPRINT("currentConnect:\n");
20221 arg2 = AU_CUS_Debug_GetDec();
20222 AU_nPRINT("portNum:\n");
20223 arg3 = AU_CUS_Debug_GetDec();
20224
20225 API_AUDIO_CUSTOMER_ADEC_INDEX currentConnect = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
20226 API_AUDIO_CUSTOMER_ADC_IN_PORT portNum = (API_AUDIO_CUSTOMER_ADC_IN_PORT)arg3;
20227
20228 API_AUDIO_CUSTOMER_ADC_Disconnect(currentConnect, portNum);
20229 }
20230 break;
20231
20232 case 0x0105:
20233 {
20234 AU_nPRINT("currentConnect:\n");
20235 arg2 = AU_CUS_Debug_GetDec();
20236 AU_nPRINT("inputConnect:\n");
20237 arg3 = AU_CUS_Debug_GetDec();
20238
20239 API_AUDIO_CUSTOMER_PCM_MIXER_INDEX currentConnect = (API_AUDIO_CUSTOMER_PCM_MIXER_INDEX)arg2;
20240 API_AUDIO_CUSTOMER_PCM_MIXER_INPUT inputConnect = (API_AUDIO_CUSTOMER_PCM_MIXER_INPUT)arg3;
20241
20242 API_AUDIO_CUSTOMER_PCM_Mixer_Connect(currentConnect, inputConnect);
20243 }
20244 break;
20245
20246 case 0x0106:
20247 {
20248 AU_nPRINT("currentConnect:\n");
20249 arg2 = AU_CUS_Debug_GetDec();
20250 AU_nPRINT("inputConnect:\n");
20251 arg3 = AU_CUS_Debug_GetDec();
20252
20253 API_AUDIO_CUSTOMER_PCM_MIXER_INDEX currentConnect = (API_AUDIO_CUSTOMER_PCM_MIXER_INDEX)arg2;
20254 API_AUDIO_CUSTOMER_PCM_MIXER_INPUT inputConnect = (API_AUDIO_CUSTOMER_PCM_MIXER_INPUT)arg3;
20255
20256 API_AUDIO_CUSTOMER_PCM_Mixer_Disconnect(currentConnect, inputConnect);
20257 }
20258 break;
20259
20260 case 0x0107:
20261 {
20262 AU_nPRINT("currentConnect:\n");
20263 arg2 = AU_CUS_Debug_GetDec();
20264 AU_nPRINT("inputConnect:\n");
20265 arg3 = AU_CUS_Debug_GetDec();
20266
20267 API_AUDIO_CUSTOMER_CH_SOUND currentConnect = (API_AUDIO_CUSTOMER_CH_SOUND)arg2;
20268 API_AUDIO_CUSTOMER_CH_INPUT inputConnect = (API_AUDIO_CUSTOMER_CH_INPUT)arg3;
20269
20270 API_AUDIO_CUSTOMER_CH_Sound_Connect(currentConnect, inputConnect);
20271 }
20272 break;
20273
20274 case 0x0108:
20275 {
20276 AU_nPRINT("currentConnect:\n");
20277 arg2 = AU_CUS_Debug_GetDec();
20278 AU_nPRINT("inputConnect:\n");
20279 arg3 = AU_CUS_Debug_GetDec();
20280
20281 API_AUDIO_CUSTOMER_CH_SOUND currentConnect = (API_AUDIO_CUSTOMER_CH_SOUND)arg2;
20282 API_AUDIO_CUSTOMER_CH_INPUT inputConnect = (API_AUDIO_CUSTOMER_CH_INPUT)arg3;
20283
20284 API_AUDIO_CUSTOMER_CH_Sound_Disconnect(currentConnect, inputConnect);
20285 }
20286 break;
20287
20288 case 0x0109:
20289 {
20290 AU_nPRINT("currentConnect:\n");
20291 arg2 = AU_CUS_Debug_GetDec();
20292 AU_nPRINT("inputConnect:\n");
20293 arg3 = AU_CUS_Debug_GetDec();
20294
20295 API_AUDIO_CUSTOMER_FWM_INDEX currentConnect = (API_AUDIO_CUSTOMER_FWM_INDEX)arg2;
20296 API_AUDIO_CUSTOMER_FWM_INPUT inputConnect = (API_AUDIO_CUSTOMER_FWM_INPUT)arg3;
20297
20298 API_AUDIO_CUSTOMER_FW_MIXER_Connect(currentConnect, inputConnect);
20299 }
20300 break;
20301
20302 case 0x010A:
20303 {
20304 AU_nPRINT("currentConnect:\n");
20305 arg2 = AU_CUS_Debug_GetDec();
20306 AU_nPRINT("inputConnect:\n");
20307 arg3 = AU_CUS_Debug_GetDec();
20308
20309 API_AUDIO_CUSTOMER_FWM_INDEX currentConnect = (API_AUDIO_CUSTOMER_FWM_INDEX)arg2;
20310 API_AUDIO_CUSTOMER_FWM_INPUT inputConnect = (API_AUDIO_CUSTOMER_FWM_INPUT)arg3;
20311
20312 API_AUDIO_CUSTOMER_FW_MIXER_Disconnect(currentConnect, inputConnect);
20313 }
20314 break;
20315
20316 case 0x010B:
20317 {
20318 AU_nPRINT("currentConnect:\n");
20319 arg2 = AU_CUS_Debug_GetDec();
20320 AU_nPRINT("inputConnect:\n");
20321 arg3 = AU_CUS_Debug_GetDec();
20322
20323 API_AUDIO_CUSTOMER_SE_INDEX currentConnect = (API_AUDIO_CUSTOMER_SE_INDEX)arg2;
20324 API_AUDIO_CUSTOMER_SE_INPUT inputConnect = (API_AUDIO_CUSTOMER_SE_INPUT)arg3;
20325
20326 API_AUDIO_CUSTOMER_SE_Connect(currentConnect, inputConnect);
20327 }
20328 break;
20329
20330 case 0x010C:
20331 {
20332 AU_nPRINT("currentConnect:\n");
20333 arg2 = AU_CUS_Debug_GetDec();
20334 AU_nPRINT("inputConnect:\n");
20335 arg3 = AU_CUS_Debug_GetDec();
20336
20337 API_AUDIO_CUSTOMER_SE_INDEX currentConnect = (API_AUDIO_CUSTOMER_SE_INDEX)arg2;
20338 API_AUDIO_CUSTOMER_SE_INPUT inputConnect = (API_AUDIO_CUSTOMER_SE_INPUT)arg3;
20339
20340 API_AUDIO_CUSTOMER_SE_Disconnect(currentConnect, inputConnect);
20341 }
20342 break;
20343
20344 case 0x010D:
20345 {
20346 AU_nPRINT("currentConnect:\n");
20347 arg2 = AU_CUS_Debug_GetDec();
20348 AU_nPRINT("inputConnect:\n");
20349 arg3 = AU_CUS_Debug_GetDec();
20350
20351 API_AUDIO_CUSTOMER_SOUNDOUT_INDEX currentConnect = (API_AUDIO_CUSTOMER_SOUNDOUT_INDEX)arg2;
20352 API_AUDIO_CUSTOMER_SOUNDOUT_INPUT inputConnect = (API_AUDIO_CUSTOMER_SOUNDOUT_INPUT)arg3;
20353
20354 API_AUDIO_CUSTOMER_SNDOUT_Connect(currentConnect, inputConnect);
20355 }
20356 break;
20357
20358 case 0x010E:
20359 {
20360 AU_nPRINT("currentConnect:\n");
20361 arg2 = AU_CUS_Debug_GetDec();
20362 AU_nPRINT("inputConnect:\n");
20363 arg3 = AU_CUS_Debug_GetDec();
20364
20365 API_AUDIO_CUSTOMER_SOUNDOUT_INDEX currentConnect = (API_AUDIO_CUSTOMER_SOUNDOUT_INDEX)arg2;
20366 API_AUDIO_CUSTOMER_SOUNDOUT_INPUT inputConnect = (API_AUDIO_CUSTOMER_SOUNDOUT_INPUT)arg3;
20367
20368 API_AUDIO_CUSTOMER_SNDOUT_Disconnect(currentConnect, inputConnect);
20369 }
20370 break;
20371
20372 case 0x010F:
20373 {
20374 AU_nPRINT("currentConnect:\n");
20375 arg2 = AU_CUS_Debug_GetDec();
20376 AU_nPRINT("inputConnect:\n");
20377 arg3 = AU_CUS_Debug_GetDec();
20378
20379 API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect = (API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX)arg2;
20380 API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT inputConnect = (API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT)arg3;
20381
20382 API_AUDIO_CUSTOMER_PCM_CAPTURE_Connect(currentConnect, inputConnect);
20383 }
20384 break;
20385
20386 case 0x0110:
20387 {
20388 AU_nPRINT("currentConnect:\n");
20389 arg2 = AU_CUS_Debug_GetDec();
20390 AU_nPRINT("inputConnect:\n");
20391 arg3 = AU_CUS_Debug_GetDec();
20392
20393 API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect = (API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX)arg2;
20394 API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT inputConnect = (API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT)arg3;
20395
20396 API_AUDIO_CUSTOMER_PCM_CAPTURE_Disconnect(currentConnect, inputConnect);
20397 }
20398 break;
20399
20400 case 0x0111:
20401 {
20402 AU_nPRINT("inputConnect:\n");
20403 arg2 = AU_CUS_Debug_GetDec();
20404
20405 API_AUDIO_CUSTOMER_MP3_ENC_INPUT inputConnect = (API_AUDIO_CUSTOMER_MP3_ENC_INPUT)arg2;
20406
20407 API_AUDIO_CUSTOMER_MP3_ENC_Connect(inputConnect);
20408 }
20409 break;
20410
20411 case 0x0112:
20412 {
20413 AU_nPRINT("inputConnect:\n");
20414 arg2 = AU_CUS_Debug_GetDec();
20415
20416 API_AUDIO_CUSTOMER_MP3_ENC_INPUT inputConnect = (API_AUDIO_CUSTOMER_MP3_ENC_INPUT)arg2;
20417
20418 API_AUDIO_CUSTOMER_MP3_ENC_Disconnect(inputConnect);
20419 }
20420 break;
20421
20422 case 0x0113:
20423 {
20424 AU_nPRINT("inputConnect:\n");
20425 arg2 = AU_CUS_Debug_GetDec();
20426
20427 API_AUDIO_CUSTOMER_AAC_ENC_INPUT inputConnect = (API_AUDIO_CUSTOMER_AAC_ENC_INPUT)arg2;
20428
20429 API_AUDIO_CUSTOMER_AAC_ENC_Connect(inputConnect);
20430 }
20431 break;
20432
20433 case 0x0114:
20434 {
20435 AU_nPRINT("inputConnect:\n");
20436 arg2 = AU_CUS_Debug_GetDec();
20437
20438 API_AUDIO_CUSTOMER_AAC_ENC_INPUT inputConnect = (API_AUDIO_CUSTOMER_AAC_ENC_INPUT)arg2;
20439
20440 API_AUDIO_CUSTOMER_AAC_ENC_Disconnect(inputConnect);
20441 }
20442 break;
20443
20444 /* Start & Stop */
20445 case 0x0200:
20446 {
20447 AU_nPRINT("adecIndex:\n");
20448 arg2 = AU_CUS_Debug_GetDec();
20449 AU_nPRINT("audioType:\n");
20450 arg3 = AU_CUS_Debug_GetDec();
20451
20452 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
20453 API_AUDIO_CUSTOMER_CODEC_TYPE audioType = (API_AUDIO_CUSTOMER_CODEC_TYPE)arg3;
20454
20455 API_AUDIO_CUSTOMER_SetCodecType(adecIndex, audioType);
20456 }
20457 break;
20458
20459 case 0x0201:
20460 {
20461 AU_nPRINT("adecIndex:\n");
20462 arg2 = AU_CUS_Debug_GetDec();
20463
20464 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
20465
20466 API_AUDIO_CUSTOMER_StartDecoding(adecIndex);
20467 }
20468 break;
20469
20470 case 0x0202:
20471 {
20472 AU_nPRINT("adecIndex:\n");
20473 arg2 = AU_CUS_Debug_GetDec();
20474
20475 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
20476
20477 API_AUDIO_CUSTOMER_StopDecoding(adecIndex);
20478 }
20479 break;
20480
20481 case 0x0203:
20482 {
20483 AU_nPRINT("adecIndex:\n");
20484 arg2 = AU_CUS_Debug_GetDec();
20485
20486 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
20487
20488 API_AUDIO_CUSTOMER_PauseDecoding(adecIndex);
20489 }
20490 break;
20491
20492 case 0x0204:
20493 {
20494 AU_nPRINT("adecIndex:\n");
20495 arg2 = AU_CUS_Debug_GetDec();
20496
20497 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
20498
20499 API_AUDIO_CUSTOMER_SetMainDecoderOutput(adecIndex);
20500 }
20501 break;
20502
20503 /* SPDIF */
20504 case 0x0300:
20505 {
20506 AU_nPRINT("eSPDIFMode:\n");
20507 arg2 = AU_CUS_Debug_GetDec();
20508 AU_nPRINT("bForced:\n");
20509 arg3 = AU_CUS_Debug_GetDec();
20510
20511 API_AUDIO_CUSTOMER_SPDIF_TX_MODE eSPDIFMode = (API_AUDIO_CUSTOMER_SPDIF_TX_MODE)arg2;
20512
20513 API_AUDIO_CUSTOMER_SPDIF_TX_SetOutputType(eSPDIFMode);
20514 }
20515 break;
20516
20517 case 0x0301:
20518 {
20519 API_AUDIO_CUSTOMER_SPDIF_TX_MODE Ret = API_AUDIO_CUSTOMER_SPDIF_TX_GetOutputType();
20520
20521 AU_nPRINT("API_AUDIO_CUSTOMER_SPDIF_TX_MODE: %d\n", Ret);
20522 }
20523 break;
20524
20525 case 0x0302:
20526 {
20527 AU_nPRINT("copyInfo:\n");
20528 arg2 = AU_CUS_Debug_GetDec();
20529
20530 API_AUDIO_CUSTOMER_SPDIF_COPYRIGHT copyInfo = (API_AUDIO_CUSTOMER_SPDIF_COPYRIGHT)arg2;
20531
20532 API_AUDIO_CUSTOMER_SPDIF_TX_SetCopyInfo(copyInfo);
20533 }
20534 break;
20535
20536 case 0x0303:
20537 {
20538 AU_nPRINT("categoryCode:\n");
20539 arg2 = AU_CUS_Debug_GetDec();
20540
20541 MS_U8 categoryCode = (MS_U8)arg2;
20542
20543 API_AUDIO_CUSTOMER_SPDIF_TX_SetCategoryCode(categoryCode);
20544 }
20545 break;
20546
20547 case 0x0304:
20548 {
20549 AU_nPRINT("bOnOff:\n");
20550 arg2 = AU_CUS_Debug_GetDec();
20551
20552 MS_BOOL bOnOff = (MS_U8)arg2;
20553
20554 API_AUDIO_CUSTOMER_SPDIF_TX_SetLightOnOff(bOnOff);
20555 }
20556 break;
20557
20558 case 0x0305:
20559 {
20560 AU_nPRINT("bOnOff:\n");
20561 arg2 = AU_CUS_Debug_GetDec();
20562
20563 MS_BOOL bOnOff = (MS_U8)arg2;
20564
20565 API_AUDIO_CUSTOMER_SPDIF_TX_SetMonitorOnOff(bOnOff);
20566 }
20567 break;
20568
20569 case 0x0306:
20570 {
20571 AU_nPRINT("SPDIF_CS_TYPE:\n");
20572 arg2 = AU_CUS_Debug_GetDec();
20573 AU_nPRINT("SPDIF_CS_TYPE_STATUS:\n");
20574 arg3 = AU_CUS_Debug_GetDec();
20575
20576 API_AUDIO_CUSTOMER_SPDIF_CS_TYPE eSPDIFCsType = (API_AUDIO_CUSTOMER_SPDIF_CS_TYPE)arg2;
20577 API_AUDIO_CUSTOMER_SPDIF_CS_TYPE_STATUS eSPDIFCsTypeStatus = (API_AUDIO_CUSTOMER_SPDIF_CS_TYPE_STATUS)arg3;
20578
20579 API_AUDIO_CUSTOMER_SPDIF_TX_ChannelStatus_CTRL(eSPDIFCsType, eSPDIFCsTypeStatus);
20580 }
20581 break;
20582
20583 /* HDMI */
20584 case 0x0400:
20585 {
20586 API_AUDIO_CUSTOMER_CODEC_TYPE HDMIMode = API_AUDIO_CUSTOMER_CODEC_TYPE_INVALID;
20587
20588 API_AUDIO_CUSTOMER_HDMI_RX_GetAudioMode(&HDMIMode);
20589
20590 AU_nPRINT("get HDMIMode:%x\n", (unsigned int)HDMIMode);
20591 }
20592 break;
20593
20594 case 0x0401:
20595 {
20596 API_AUDIO_CUSTOMER_SPDIF_COPYRIGHT copyInfo = API_AUDIO_CUSTOMER_SPDIF_COPYRIGHT_INVALID;
20597
20598 API_AUDIO_CUSTOMER_HDMI_RX_GetCopyInfo(©Info);
20599
20600 AU_nPRINT("get HDMI copyInfo:%x\n", (unsigned int)copyInfo);
20601 }
20602 break;
20603
20604 case 0x0402:
20605 {
20606 AU_nPRINT("bOnOff:\n");
20607 arg2 = AU_CUS_Debug_GetDec();
20608
20609 MS_BOOL bOnOff = (MS_BOOL)arg2;
20610
20611 API_AUDIO_CUSTOMER_HDMI_RX_SetAudioReturnChannel(bOnOff);
20612 }
20613 break;
20614
20615 case 0x0403:
20616 {
20617 AU_nPRINT("bOnOff:\n");
20618 arg2 = AU_CUS_Debug_GetDec();
20619
20620 MS_BOOL bOnOff = (MS_BOOL)arg2;
20621
20622 API_AUDIO_CUSTOMER_HDMI_RX_SetMonitorOnOff(bOnOff);
20623 }
20624 break;
20625
20626 case 0x0404:
20627 {
20628 AU_nPRINT("eHDMIMode:\n");
20629 arg2 = AU_CUS_Debug_GetDec();
20630
20631 API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_TYPE eHDMIMode = (API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_TYPE)arg2;
20632
20633 API_AUDIO_CUSTOMER_HDMI_TX_SetOutputType(eHDMIMode);
20634 }
20635 break;
20636
20637 case 0x0405:
20638 {
20639 AU_nPRINT("bOnOff:\n");
20640 arg2 = AU_CUS_Debug_GetDec();
20641
20642 MS_BOOL bOnOff = (MS_BOOL)arg2;
20643
20644 API_AUDIO_CUSTOMER_HDMI_TX_SetMonitorOnOff(bOnOff);
20645 }
20646 break;
20647
20648 /* ATV */
20649 case 0x0500:
20650 {
20651 AU_nPRINT("sifSource:\n");
20652 arg2 = AU_CUS_Debug_GetDec();
20653
20654 API_AUDIO_CUSTOMER_SIF_INPUT sifSource = (API_AUDIO_CUSTOMER_SIF_INPUT)arg2;
20655
20656 API_AUDIO_CUSTOMER_SIF_SetInputSource(sifSource);
20657 }
20658 break;
20659
20660 case 0x0501:
20661 {
20662 AU_nPRINT("bandwidth:\n");
20663 arg2 = AU_CUS_Debug_GetDec();
20664
20665 AU_nPRINT("bOnOff:\n");
20666 arg3 = AU_CUS_Debug_GetDec();
20667
20668 API_AUDIO_CUSTOMER_SIF_HIDEV_BW bandwidth = (API_AUDIO_CUSTOMER_SIF_HIDEV_BW)arg2;
20669 MS_BOOL bOnOff = (MS_BOOL)arg3;
20670
20671 API_AUDIO_CUSTOMER_SIF_SetHighDevMode(bandwidth, bOnOff);
20672 }
20673 break;
20674
20675 case 0x0502:
20676 {
20677 AU_nPRINT("sifStandard:\n");
20678 arg2 = AU_CUS_Debug_GetDec();
20679
20680 API_AUDIO_CUSTOMER_SIF_STANDARD sifStandard = (API_AUDIO_CUSTOMER_SIF_STANDARD)arg2;
20681
20682 API_AUDIO_CUSTOMER_SIF_SetAudioStandard(sifStandard);
20683 }
20684 break;
20685
20686 case 0x0503:
20687 {
20688 AU_nPRINT("u8SifSoundMode:\n");
20689 arg2 = AU_CUS_Debug_GetDec();
20690
20691 API_AUDIO_CUSTOMER_SIF_AUDIOMODE_TYPE u8SifSoundMode = (API_AUDIO_CUSTOMER_SIF_AUDIOMODE_TYPE)arg2;
20692
20693 API_AUDIO_CUSTOMER_SIF_SetSoundMode(u8SifSoundMode);
20694 }
20695 break;
20696
20697 case 0x0504:
20698 {
20699 AU_nPRINT("API_AUDIO_CUSTOMER_SIF_GetSoundMode: %d\n", (unsigned int)API_AUDIO_CUSTOMER_SIF_GetSoundMode());
20700 }
20701 break;
20702
20703 case 0x0505:
20704 {
20705 AU_nPRINT("bOnOff:\n");
20706 arg2 = AU_CUS_Debug_GetDec();
20707
20708 MS_BOOL bOnOff = (MS_BOOL)arg2;
20709
20710 API_AUDIO_CUSTOMER_SIF_SetMonitorOnOff(bOnOff);
20711 }
20712 break;
20713
20714 case 0x0506:
20715 {
20716 AU_nPRINT("bOnOff:\n");
20717 arg2 = AU_CUS_Debug_GetDec();
20718
20719 MS_BOOL bOnOff = (MS_BOOL)arg2;
20720
20721 API_AUDIO_CUSTOMER_SIF_SetAutoMute(bOnOff);
20722 }
20723 break;
20724
20725 case 0x0507:
20726 {
20727 AU_nPRINT("SIF_StartAutoStandardDetection:\n");
20728
20729 API_AUDIO_CUSTOMER_SIF_StartAutoStandardDetection();
20730 }
20731 break;
20732
20733 case 0x0508:/* need to refine */
20734 {
20735 AU_nPRINT("\n");
20736 }
20737 break;
20738
20739 case 0x0509:
20740 {
20741 AU_nPRINT("pal_type:\n");
20742 arg2 = AU_CUS_Debug_GetDec();
20743
20744 API_AUDIO_CUSTOMER_SIF_PAL_TYPE pal_type = (API_AUDIO_CUSTOMER_SIF_PAL_TYPE)arg2;
20745
20746 API_AUDIO_CUSTOMER_SIF_SetPALType(pal_type);
20747 }
20748 break;
20749
20750 case 0x050A:
20751 {
20752 AU_nPRINT("enAudSifCommand:\n");
20753 arg2 = AU_CUS_Debug_GetDec();
20754
20755 AU_nPRINT("comm_arg1:\n");
20756 arg3 = AU_CUS_Debug_GetDec();
20757
20758 AU_nPRINT("comm_arg2:\n");
20759 arg4 = AU_CUS_Debug_GetDec();
20760
20761 API_AUDIO_CUSTOMER_SIF_CmdType enAudSifCommand = (API_AUDIO_CUSTOMER_SIF_CmdType)arg2;
20762 MS_U8 comm_arg1 = (MS_U8)arg3;
20763 MS_U8 comm_arg2 = (MS_U8)arg4;
20764
20765 API_AUDIO_CUSTOMER_SIF_SendCmd(enAudSifCommand, comm_arg1, comm_arg2);
20766 }
20767 break;
20768
20769 case 0x050B:
20770 {
20771 API_AUDIO_CUSTOMER_SIF_AUDIOSTATUS eCurrentAudioStatus = API_AUDIO_CUSTOMER_SIF_E_STATE_AUDIO_NO_CARRIER;
20772
20773 API_AUDIO_CUSTOMER_SIF_GetAudioStatus(&eCurrentAudioStatus);
20774
20775 AU_nPRINT("eCurrentAudioStatus: 0x%x\n", eCurrentAudioStatus);
20776 }
20777 break;
20778
20779 case 0x050C:
20780 {
20781 AU_nPRINT("pal_type:\n");
20782 arg2 = AU_CUS_Debug_GetDec();
20783
20784 API_AUDIO_CUSTOMER_SIF_PAL_TYPE pal_type = (API_AUDIO_CUSTOMER_SIF_PAL_TYPE)arg2;
20785
20786 AU_nPRINT("API_AUDIO_CUSTOMER_SIF_IsPALType(0x%x): 0x%x\n", pal_type, API_AUDIO_CUSTOMER_SIF_IsPALType(pal_type));
20787 }
20788 break;
20789
20790 case 0x050D:
20791 {
20792 AU_nPRINT("gain_type:\n");
20793 arg2 = AU_CUS_Debug_GetHex("");
20794
20795 AU_nPRINT("db_value:\n");
20796 arg3 = AU_CUS_Debug_GetDec();
20797
20798 API_AUDIO_CUSTOMER_SIF_GAIN_TYPE gain_type = (API_AUDIO_CUSTOMER_SIF_GAIN_TYPE)arg2;
20799 MS_S32 db_value = (MS_S32)arg3;
20800
20801 API_AUDIO_CUSTOMER_SIF_SetPrescale(gain_type, db_value);
20802 }
20803 break;
20804
20805 /* Decoder */
20806 case 0x0600:
20807 {
20808 AU_nPRINT("adecIndex:\n");
20809 arg2 = AU_CUS_Debug_GetDec();
20810 AU_nPRINT("bOnOff:\n");
20811 arg3 = AU_CUS_Debug_GetDec();
20812
20813 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
20814 MS_BOOL bOnOff = (MS_BOOL)arg3;
20815
20816 API_AUDIO_CUSTOMER_SetSyncMode(adecIndex, bOnOff);
20817 }
20818 break;
20819
20820 case 0x0601:
20821 {
20822 AU_nPRINT("adecIndex:\n");
20823 arg2 = AU_CUS_Debug_GetDec();
20824
20825 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
20826 API_AUDIO_CUSTOMER_CODEC_TYPE audioType = API_AUDIO_CUSTOMER_CODEC_TYPE_UNKNOWN;
20827
20828 API_AUDIO_CUSTOMER_GetDecodingType(adecIndex, &audioType);
20829
20830 AU_nPRINT("get audioType:%x\n", (unsigned int)audioType);
20831
20832 }
20833 break;
20834
20835 case 0x0602:
20836 {
20837 AU_nPRINT("adecIndex:\n");
20838 arg2 = AU_CUS_Debug_GetDec();
20839 AU_nPRINT("outputMode:\n");
20840 arg3 = AU_CUS_Debug_GetDec();
20841
20842 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
20843 API_AUDIO_CUSTOMER_DUALMONO_MODE outputMode = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg3;
20844
20845 API_AUDIO_CUSTOMER_SetDualMonoOutMode(adecIndex, outputMode);
20846 }
20847 break;
20848
20849 case 0x0603:
20850 {
20851 AU_nPRINT("adecIndex:\n");
20852 arg2 = AU_CUS_Debug_GetDec();
20853
20854 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
20855 void * pAudioESInfo = NULL;
20856
20857 API_AUDIO_CUSTOMER_GetESInfo(adecIndex, &pAudioESInfo);
20858 }
20859 break;
20860
20861 case 0x0604:
20862 {
20863 AU_nPRINT("adecIndex:\n");
20864 arg2 = AU_CUS_Debug_GetDec();
20865
20866 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
20867
20868 API_AUDIO_CUSTOMER_IsESExist(adecIndex);
20869
20870 if(adecIndex == API_AUDIO_CUSTOMER_ADEC0)
20871 {
20872 AU_nPRINT("get g_audio_customer_ADEC0_bESExist:%x\n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC0_bESExist);
20873 }
20874 else if(adecIndex == API_AUDIO_CUSTOMER_ADEC1)
20875 {
20876 AU_nPRINT("get g_audio_customer_ADEC1_bESExist:%x\n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC1_bESExist);
20877 }
20878 }
20879 break;
20880
20881 case 0x0605:
20882 {
20883 AU_nPRINT("adecIndex:\n");
20884 arg2 = AU_CUS_Debug_GetDec();
20885 AU_nPRINT("bOnOff:\n");
20886 arg3 = AU_CUS_Debug_GetDec();
20887
20888 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
20889 MS_BOOL bOnOff = (MS_BOOL)arg3;
20890
20891 API_AUDIO_CUSTOMER_SetAudioDescription(adecIndex, bOnOff);
20892 }
20893 break;
20894
20895 case 0x0606:
20896 {
20897 AU_nPRINT("adecIndex:\n");
20898 arg2 = AU_CUS_Debug_GetDec();
20899 AU_nPRINT("eTrickMode:\n");
20900 arg3 = AU_CUS_Debug_GetDec();
20901
20902 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
20903 API_AUDIO_CUSTOMER_TRICK_MODE eTrickMode = (API_AUDIO_CUSTOMER_TRICK_MODE)arg3;
20904
20905 API_AUDIO_CUSTOMER_SetTrickMode(adecIndex, eTrickMode);
20906 }
20907 break;
20908
20909 case 0x0607:
20910 {
20911 AU_nPRINT("adecIndex:\n");
20912 arg2 = AU_CUS_Debug_GetDec();
20913
20914 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
20915 MS_U32 maxSize = 0;
20916 MS_U32 freeSize = 0;
20917
20918 API_AUDIO_CUSTOMER_GetBufferStatus(adecIndex, &maxSize, &freeSize);
20919
20920 AU_nPRINT("get maxSize:%x\n", (unsigned int)maxSize);
20921 AU_nPRINT("get freeSize:%x\n", (unsigned int)freeSize);
20922 }
20923 break;
20924
20925 case 0x0608:
20926 {
20927 AU_nPRINT("adecIndex:\n");
20928 arg2 = AU_CUS_Debug_GetDec();
20929 AU_nPRINT("path:\n");
20930 arg3 = AU_CUS_Debug_GetDec();
20931
20932 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
20933 API_AUDIO_CUSTOMER_ADEC_PCM_PATH path = (API_AUDIO_CUSTOMER_ADEC_PCM_PATH)arg3;
20934
20935 API_AUDIO_CUSTOMER_SetAdecPcmPath(adecIndex, path);
20936 }
20937 break;
20938
20939 case 0x0609:
20940 {
20941 AU_nPRINT("adecIndex:\n");
20942 arg2 = AU_CUS_Debug_GetDec();
20943
20944 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
20945
20946 API_AUDIO_CUSTOMER_AdecPcmReady(adecIndex);
20947 }
20948 break;
20949
20950 case 0x060A://need to refine
20951 {
20952 AU_nPRINT("adecIndex:\n");
20953 arg2 = AU_CUS_Debug_GetDec();
20954
20955 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
20956 void * pOutPcm = NULL;
20957 MS_U32 u32Size = 0;
20958
20959 API_AUDIO_CUSTOMER_AdecPcmGet(adecIndex, pOutPcm, u32Size);
20960 }
20961 break;
20962
20963 case 0x060B://need to refine
20964 {
20965 pfnAudioCustomerAdecDecodeDone pfnDecodeDoneCallBack = NULL;
20966
20967 API_AUDIO_CUSTOMER_AdecRegisterDecodeDoneCallback(pfnDecodeDoneCallBack);
20968 }
20969 break;
20970
20971 case 0x060C:
20972 {
20973 AU_nPRINT("\n");
20974 }
20975 break;
20976
20977 case 0x060D:
20978 {
20979 AU_nPRINT("\n");
20980 }
20981 break;
20982
20983 case 0x060E:
20984 {
20985 AU_nPRINT("bOnOff:\n");
20986 arg2 = AU_CUS_Debug_GetDec();
20987
20988 MS_BOOL bOnOff = (MS_BOOL)arg2;
20989
20990 API_AUDIO_CUSTOMER_Auto_Recovery_SetMonitorOnOff(bOnOff);
20991 }
20992 break;
20993
20994 /* Common Decoder */
20995 case 0x0700:/* need to refine */
20996 {
20997 AU_nPRINT("\n");
20998 }
20999 break;
21000
21001 case 0x0701:/* need to refine */
21002 {
21003 AU_nPRINT("\n");
21004 }
21005 break;
21006
21007 case 0x0702:/* need to refine */
21008 {
21009 AU_nPRINT("\n");
21010 }
21011 break;
21012
21013 case 0x0703:/* need to refine */
21014 {
21015 AU_nPRINT("\n");
21016 }
21017 break;
21018
21019 case 0x0704:/* need to refine */
21020 {
21021 AU_nPRINT("\n");
21022 }
21023 break;
21024
21025 case 0x0705:/* need to refine */
21026 {
21027 AU_nPRINT("\n");
21028 }
21029 break;
21030
21031 case 0x0706:/* need to refine */
21032 {
21033 AU_nPRINT("\n");
21034 }
21035 break;
21036
21037 case 0x0707:/* need to refine */
21038 {
21039 AU_nPRINT("\n");
21040 }
21041 break;
21042
21043 case 0x0708:/* need to refine */
21044 {
21045 AU_nPRINT("\n");
21046 }
21047 break;
21048
21049 /* Common */
21050 case 0x0800:
21051 {
21052 AU_nPRINT("adecIndex:\n");
21053 arg2 = AU_CUS_Debug_GetDec();
21054
21055 AU_nPRINT("paramType:\n");
21056 arg3 = AU_CUS_Debug_GetDec();
21057
21058 AU_nPRINT("Param:\n");
21059 arg4 = AU_CUS_Debug_GetDec();
21060 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
21061 API_AUDIO_CUSTOMER_ADEC_INDEX paramType = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg3;
21062 void *pParam = &arg4;
21063
21064 API_AUDIO_CUSTOMER_SetAudioParam(adecIndex, paramType, pParam);
21065 }
21066 break;
21067
21068 case 0x0801:
21069 {
21070 AU_nPRINT("adecIndex:\n");
21071 arg2 = AU_CUS_Debug_GetDec();
21072 AU_nPRINT("infoType:\n");
21073 arg3 = AU_CUS_Debug_GetDec();
21074
21075 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
21076 API_AUDIO_CUSTOMER_INFO_TYPE infoType = (API_AUDIO_CUSTOMER_INFO_TYPE)arg3;
21077
21078 MS_U32 info = 0;
21079 API_AUDIO_CUSTOMER_GetAudioInfo(adecIndex, infoType, &info);
21080
21081 AU_nPRINT("info: %d\n", (unsigned int)info);
21082 }
21083 break;
21084
21085 /* Customized patch */
21086 case 0x0900:
21087 {
21088 AU_nPRINT("adecIndex:\n");
21089 arg2 = AU_CUS_Debug_GetDec();
21090 AU_nPRINT("paramType:\n");
21091 arg3 = AU_CUS_Debug_GetDec();
21092 AU_nPRINT("Param:\n");
21093 arg4 = AU_CUS_Debug_GetDec();
21094
21095 API_AUDIO_CUSTOMIZED_PATCH_SetAudioParam(arg2, arg3, (void*)&arg4);
21096 }
21097 break;
21098
21099 case 0x0901:/* need to refine */
21100 {
21101 AU_nPRINT("\n");
21102 }
21103 break;
21104
21105 /* Clip Play for ES */
21106 case 0x0A00:
21107 {
21108 AU_nPRINT("adecIndex:\n");
21109 arg2 = AU_CUS_Debug_GetDec();
21110 AU_nPRINT("repeatNumber:\n");
21111 arg3 = AU_CUS_Debug_GetDec();
21112 }
21113 break;
21114
21115 case 0x0A01:
21116 {
21117 AU_nPRINT("adecIndex:\n");
21118 arg2 = AU_CUS_Debug_GetDec();
21119
21120 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
21121
21122 API_AUDIO_CUSTOMER_StopClipDecoder(adecIndex);
21123 }
21124 break;
21125
21126 case 0x0A02:
21127 {
21128 AU_nPRINT("adecIndex:\n");
21129 arg2 = AU_CUS_Debug_GetDec();
21130
21131 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
21132
21133 API_AUDIO_CUSTOMER_PauseClipDecoder(adecIndex);
21134 }
21135 break;
21136
21137 case 0x0A03:
21138 {
21139 AU_nPRINT("adecIndex:\n");
21140 arg2 = AU_CUS_Debug_GetDec();
21141
21142 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
21143
21144 API_AUDIO_CUSTOMER_ResumeClipDecoder(adecIndex);
21145 }
21146 break;
21147
21148 /* Clip Play for PCM */
21149 case 0x0B00:/* need to refine */
21150 {
21151 AU_nPRINT("mixerIndex:\n");
21152 arg2 = AU_CUS_Debug_GetDec();
21153 AU_nPRINT("numOfChannel:\n");
21154 arg3 = AU_CUS_Debug_GetDec();
21155 AU_nPRINT("bitPerSample:\n");
21156 arg4 = AU_CUS_Debug_GetDec();
21157 AU_nPRINT("samplingFreq:\n");
21158 arg5 = AU_CUS_Debug_GetDec();
21159 AU_nPRINT("endianType:\n");
21160 arg6 = AU_CUS_Debug_GetDec();
21161 AU_nPRINT("signedType:\n");
21162 arg7 = AU_CUS_Debug_GetDec();
21163 AU_nPRINT("repeatNumber:\n");
21164 arg8 = AU_CUS_Debug_GetDec();
21165 AU_nPRINT("bufSize:\n");
21166 arg9 = AU_CUS_Debug_GetDec();
21167
21168 API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex = (API_AUDIO_CUSTOMER_MIXER_INDEX)arg2;
21169 API_AUDIO_CUSTOMER_CLIP_MIX_PARAM clipInfo;
21170 MS_U32 bufSize;
21171 void *pBufClip = NULL;
21172 pfnAudioCustomerAmixerClipDone pfnCallBack = NULL;
21173 memset((void *)(&clipInfo), 0, sizeof(clipInfo));
21174
21175 clipInfo.numOfChannel = (MS_U32)arg3;
21176 clipInfo.bitPerSample = (MS_U32)arg4;
21177 clipInfo.samplingFreq = (API_AUDIO_CUSTOMER_SAMPLING_FREQ)arg5;
21178 clipInfo.endianType = (API_AUDIO_CUSTOMER_PCM_ENDIAN)arg6;
21179 clipInfo.signedType = (API_AUDIO_CUSTOMER_PCM_SIGNED_STATUS)arg7;
21180 clipInfo.repeatNumber = (MS_U32)arg8;
21181 bufSize = (MS_U32)arg9;
21182
21183 API_AUDIO_CUSTOMER_PlayClipMixer(mixerIndex, clipInfo, bufSize, pBufClip, pfnCallBack);
21184 }
21185 break;
21186
21187 case 0x0B01:
21188 {
21189 AU_nPRINT("mixerIndex:\n");
21190 arg2 = AU_CUS_Debug_GetDec();
21191
21192 API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex = (API_AUDIO_CUSTOMER_MIXER_INDEX)arg2;
21193
21194 API_AUDIO_CUSTOMER_StopClipMixer(mixerIndex);
21195 }
21196 break;
21197
21198 case 0x0B02:
21199 {
21200 AU_nPRINT("mixerIndex:\n");
21201 arg2 = AU_CUS_Debug_GetDec();
21202
21203 API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex = (API_AUDIO_CUSTOMER_MIXER_INDEX)arg2;
21204
21205 API_AUDIO_CUSTOMER_PauseClipMixer(mixerIndex);
21206 }
21207 break;
21208
21209 case 0x0B03:
21210 {
21211 AU_nPRINT("mixerIndex:\n");
21212 arg2 = AU_CUS_Debug_GetDec();
21213
21214 API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex = (API_AUDIO_CUSTOMER_MIXER_INDEX)arg2;
21215
21216 API_AUDIO_CUSTOMER_ResumeClipMixer(mixerIndex);
21217 }
21218 break;
21219
21220 /* Gain, Mute & Delay */
21221 //---Gain---
21222 case 0x0C00:
21223 {
21224 AU_nPRINT("adecIndex:\n");
21225 arg2 = AU_CUS_Debug_GetDec();
21226 AU_nPRINT("gain:\n");
21227 arg3 = AU_CUS_Debug_GetDec();
21228
21229 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
21230 MS_U32 gain = (MS_U32)arg3;
21231
21232 API_AUDIO_CUSTOMER_SetAudioDescriptionGain(adecIndex, gain);
21233 }
21234 break;
21235
21236 case 0x0C01:
21237 {
21238 AU_nPRINT("mixerIndex:\n");
21239 arg2 = AU_CUS_Debug_GetDec();
21240 AU_nPRINT("gain:\n");
21241 arg3 = AU_CUS_Debug_GetDec();
21242
21243 API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex = (API_AUDIO_CUSTOMER_MIXER_INDEX)arg2;
21244 MS_U32 gain = (MS_U32)arg3;
21245
21246 API_AUDIO_CUSTOMER_SetPCMMixerInputGain(mixerIndex, gain);
21247 }
21248 break;
21249
21250 case 0x0C02:
21251 {
21252 AU_nPRINT("currentConnect:\n");
21253 arg2 = AU_CUS_Debug_GetDec();
21254 AU_nPRINT("inputConnect:\n");
21255 arg3 = AU_CUS_Debug_GetDec();
21256 AU_nPRINT("gain:\n");
21257 arg4 = AU_CUS_Debug_GetDec();
21258
21259 API_AUDIO_CUSTOMER_FWM_INDEX currentConnect = (API_AUDIO_CUSTOMER_FWM_INDEX)arg2;
21260 API_AUDIO_CUSTOMER_FWM_INPUT inputConnect = (API_AUDIO_CUSTOMER_FWM_INPUT)arg3;
21261 MS_U32 gain = (MS_U32)arg4;
21262
21263 API_AUDIO_CUSTOMER_SetFWMixerChannelGain(currentConnect, inputConnect, gain);
21264 }
21265 break;
21266
21267 case 0x0C03:
21268 {
21269 AU_nPRINT("gain:\n");
21270 arg2 = AU_CUS_Debug_GetDec();
21271
21272 MS_U32 gain = (MS_U32)arg2;
21273
21274 API_AUDIO_CUSTOMER_SetI2SOutGain(gain);
21275 }
21276 break;
21277
21278 case 0x0C04:
21279 {
21280 AU_nPRINT("lineIndex:\n");
21281 arg2 = AU_CUS_Debug_GetDec();
21282 AU_nPRINT("gain:\n");
21283 arg3 = AU_CUS_Debug_GetDec();
21284
21285 API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex = (API_AUDIO_CUSTOMER_LINE_OUT_IDX)arg2;
21286 MS_U32 gain = (MS_U32)arg3;
21287
21288 API_AUDIO_CUSTOMER_SetLineOutGain(lineIndex, gain);
21289 }
21290 break;
21291
21292 case 0x0C05:
21293 {
21294 AU_nPRINT("gain:\n");
21295 arg2 = AU_CUS_Debug_GetDec();
21296
21297 MS_U32 gain = (MS_U32)arg2;
21298
21299 API_AUDIO_CUSTOMER_SetSPDIFOutGain(gain);
21300 }
21301 break;
21302
21303 case 0x0C06:
21304 {
21305 AU_nPRINT("gain:\n");
21306 arg2 = AU_CUS_Debug_GetDec();
21307
21308 MS_U32 gain = (MS_U32)arg2;
21309
21310 API_AUDIO_CUSTOMER_SetHDMIOutGain(gain);
21311 }
21312 break;
21313
21314 //---Mute---
21315 case 0x0C07:
21316 {
21317 AU_nPRINT("mixerIndex:\n");
21318 arg2 = AU_CUS_Debug_GetDec();
21319 AU_nPRINT("bOnOff:\n");
21320 arg3 = AU_CUS_Debug_GetDec();
21321
21322 API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex = (API_AUDIO_CUSTOMER_MIXER_INDEX)arg2;
21323 MS_BOOL bOnOff = (MS_BOOL)arg3;
21324
21325 API_AUDIO_CUSTOMER_SetPCMMixerInputMute(mixerIndex, bOnOff);
21326 }
21327 break;
21328
21329 case 0x0C08:
21330 {
21331 AU_nPRINT("currentConnect:\n");
21332 arg2 = AU_CUS_Debug_GetDec();
21333 AU_nPRINT("inputConnect:\n");
21334 arg3 = AU_CUS_Debug_GetDec();
21335 AU_nPRINT("bOnOff:\n");
21336 arg4 = AU_CUS_Debug_GetDec();
21337
21338 API_AUDIO_CUSTOMER_FWM_INDEX currentConnect = (API_AUDIO_CUSTOMER_FWM_INDEX)arg2;
21339 API_AUDIO_CUSTOMER_FWM_INPUT inputConnect = (API_AUDIO_CUSTOMER_FWM_INPUT)arg3;
21340 MS_BOOL bOnOff = (MS_BOOL)arg4;
21341
21342 API_AUDIO_CUSTOMER_SetFWMixerChannelMute(currentConnect, inputConnect, bOnOff);
21343 }
21344 break;
21345
21346 case 0x0C09:
21347 {
21348 AU_nPRINT("bOnOff:\n");
21349 arg2 = AU_CUS_Debug_GetDec();
21350
21351 MS_BOOL bOnOff = (MS_BOOL)arg2;
21352
21353 API_AUDIO_CUSTOMER_SetI2SOutMute(bOnOff);
21354 }
21355 break;
21356
21357 case 0x0C0A:
21358 {
21359 AU_nPRINT("lineIndex:\n");
21360 arg2 = AU_CUS_Debug_GetDec();
21361 AU_nPRINT("bOnOff:\n");
21362 arg3 = AU_CUS_Debug_GetDec();
21363
21364 API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex = (API_AUDIO_CUSTOMER_LINE_OUT_IDX)arg2;
21365 MS_BOOL bOnOff = (MS_BOOL)arg3;
21366
21367 API_AUDIO_CUSTOMER_SetLineOutMute(lineIndex, bOnOff);
21368 }
21369 break;
21370
21371 case 0x0C0B:
21372 {
21373 AU_nPRINT("bOnOff:\n");
21374 arg2 = AU_CUS_Debug_GetDec();
21375
21376 MS_BOOL bOnOff = (MS_BOOL)arg2;
21377
21378 API_AUDIO_CUSTOMER_SetSPDIFOutMute(bOnOff);
21379 }
21380 break;
21381
21382 case 0x0C0C:
21383 {
21384 AU_nPRINT("bOnOff:\n");
21385 arg2 = AU_CUS_Debug_GetDec();
21386
21387 MS_BOOL bOnOff = (MS_BOOL)arg2;
21388
21389 API_AUDIO_CUSTOMER_SetHDMIOutMute(bOnOff);
21390 }
21391 break;
21392
21393 case 0x0C0D:
21394 {
21395 MS_BOOL onOff = FALSE;
21396
21397 API_AUDIO_CUSTOMER_GetI2SOutMuteStatus(&onOff);
21398
21399 AU_nPRINT("onOff:%x\n", onOff);
21400 }
21401 break;
21402
21403 case 0x0C0E:
21404 {
21405 AU_nPRINT("lineIndex:\n");
21406 arg2 = AU_CUS_Debug_GetDec();
21407
21408 API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex = (API_AUDIO_CUSTOMER_LINE_OUT_IDX)arg2;
21409 MS_BOOL onOff = FALSE;
21410
21411 API_AUDIO_CUSTOMER_GetLineOutMuteStatus(lineIndex, &onOff);
21412 AU_nPRINT("onOff:%x\n", onOff);
21413
21414 }
21415 break;
21416
21417 case 0x0C0F:
21418 {
21419 MS_BOOL onOff = FALSE;
21420
21421 API_AUDIO_CUSTOMER_GetSPDIFOutMuteStatus(&onOff);
21422
21423 AU_nPRINT("onOff:%x\n", onOff);
21424 }
21425 break;
21426
21427 case 0x0C10:
21428 {
21429 AU_nPRINT("per_50ms:\n");
21430 arg2 = AU_CUS_Debug_GetDec();
21431
21432 AU_nPRINT("eFM :\n");
21433 arg3 = AU_CUS_Debug_GetDec();
21434
21435 AU_nPRINT("port:\n");
21436 arg4 = AU_CUS_Debug_GetDec();
21437
21438 MS_U32 per_50ms = (MS_U32)arg2;
21439 API_AUDIO_CUSTOMER_FWM_INDEX eFM = arg3;
21440 API_AUDIO_CUSTOMER_FWM_INPUT port = arg4;
21441 API_AUDIO_CUSTOMER_MuteDuringLimitedTime_Input(per_50ms, eFM, port);
21442 }
21443 break;
21444
21445 case 0x0C11:
21446 {
21447 AU_nPRINT("per_50ms:\n");
21448 arg2 = AU_CUS_Debug_GetDec();
21449
21450 AU_nPRINT("port:\n");
21451 arg3 = AU_CUS_Debug_GetDec();
21452
21453 MS_U32 per_50ms = (MS_U32)arg2;
21454 API_AUDIO_CUSTOMER_OUTPUT_TYPE port = arg3;
21455 API_AUDIO_CUSTOMER_MuteDuringLimitedTime_Output(per_50ms, port);
21456 }
21457 break;
21458
21459 //---Delay---
21460 case 0x0C12:
21461 {
21462 AU_nPRINT("channel:(ch5 = 0, ch6 = 1)\n");
21463 arg2 = AU_CUS_Debug_GetDec();
21464 API_AUDIO_CUSTOMER_CH_SOUND channel = (API_AUDIO_CUSTOMER_CH_SOUND)arg2;
21465
21466 AU_nPRINT("delayTime:\n");
21467 arg3 = AU_CUS_Debug_GetDec();
21468 MS_U32 delayTime = (MS_U32)arg3;
21469
21470 API_AUDIO_CUSTOMER_SetChannelDelay(channel, delayTime);
21471 }
21472 break;
21473
21474 case 0x0C13:
21475 {
21476 AU_nPRINT("delayTime:\n");
21477 arg3 = AU_CUS_Debug_GetDec();
21478 MS_U32 delayTime = (MS_U32)arg3;
21479
21480 API_AUDIO_CUSTOMER_SetAudioDelay(delayTime);
21481 }
21482 break;
21483
21484 case 0x0C14:
21485 {
21486 AU_nPRINT("delayTime:\n");
21487 arg3 = AU_CUS_Debug_GetDec();
21488 MS_U32 delayTime = (MS_U32)arg3;
21489
21490 API_AUDIO_CUSTOMER_SetSpdifDelay(delayTime);
21491 }
21492 break;
21493
21494 case 0x0C15:
21495 {
21496 AU_nPRINT("delayTime:\n");
21497 arg3 = AU_CUS_Debug_GetDec();
21498 MS_U32 delayTime = (MS_U32)arg3;
21499
21500 API_AUDIO_CUSTOMER_SetHdmiDelay(delayTime);
21501 }
21502
21503 /* AENC */
21504 case 0x0D00:
21505 {
21506 AU_nPRINT("encFormat:\n");
21507 arg2 = AU_CUS_Debug_GetDec();
21508
21509 API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat = (API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT)arg2;
21510
21511 API_AUDIO_CUSTOMER_AENC_Start(encFormat);
21512 }
21513 break;
21514
21515 case 0x0D01:
21516 {
21517 AU_nPRINT("encFormat:\n");
21518 arg2 = AU_CUS_Debug_GetDec();
21519
21520 API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat = (API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT)arg2;
21521
21522 API_AUDIO_CUSTOMER_AENC_Stop(encFormat);
21523 }
21524 break;
21525
21526 case 0x0D02:
21527 {
21528 AU_nPRINT("encFormat:\n");
21529 arg2 = AU_CUS_Debug_GetDec();
21530
21531 API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat = (API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT)arg2;
21532 pfnAudioCustomerAENCDataHandling pfnCallBack = NULL;
21533
21534 API_AUDIO_CUSTOMER_AENC_RegisterCallback(encFormat, pfnCallBack);
21535 }
21536 break;
21537
21538 case 0x0D03://need to refine
21539 {
21540 AU_nPRINT("encFormat:\n");
21541 arg2 = AU_CUS_Debug_GetDec();
21542
21543 API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat = (API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT)arg2;
21544 API_AUDIO_CUSTOMER_AENC_INFO info;
21545
21546 memset((void *)(&info), 0, sizeof(info));
21547
21548 API_AUDIO_CUSTOMER_AENC_SetInfo(encFormat, info);
21549
21550 }
21551 break;
21552
21553 case 0x0D04://need to refine
21554 {
21555 AU_nPRINT("encFormat:\n");
21556 arg2 = AU_CUS_Debug_GetDec();
21557
21558 API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat = (API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT)arg2;
21559 API_AUDIO_CUSTOMER_AENC_INFO info;
21560
21561 memset((void *)(&info), 0, sizeof(info));
21562
21563 API_AUDIO_CUSTOMER_AENC_GetInfo(encFormat, &info);
21564 }
21565 break;
21566
21567 case 0x0D05:
21568 {
21569 arg2 = AU_CUS_Debug_GetDec();
21570 AU_nPRINT("enter value 0 ~ 1015\n");
21571 arg3 = AU_CUS_Debug_GetDec();
21572
21573 API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat = (API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT)arg2;
21574 MS_U32 gain = (MS_U8)arg3;
21575
21576 API_AUDIO_CUSTOMER_AENC_SetGain(encFormat, gain);
21577 }
21578 break;
21579
21580 case 0x0D06:/* need to refine */
21581 {
21582 AU_nPRINT("encFormat:\n");
21583 arg2 = AU_CUS_Debug_GetDec();
21584
21585 API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat = (API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT)arg2;
21586 MS_U8 *pDest = NULL;
21587 MS_U8 *pBufAddr = NULL;
21588 MS_U32 datasize = NULL;
21589 MS_U8 *pRStart = NULL;
21590 MS_U8 *pREnd = NULL;
21591
21592 API_AUDIO_CUSTOMER_AENC_CopyData(encFormat, pDest, pBufAddr, datasize, pRStart, pREnd);
21593 }
21594 break;
21595
21596 case 0x0D07:/* need to refine */
21597 {
21598 AU_nPRINT("encFormat:\n");
21599 arg2 = AU_CUS_Debug_GetDec();
21600
21601 API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat = (API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT)arg2;
21602 MS_U8 *pBufAddr = NULL;
21603 MS_U32 datasize = 0;
21604
21605 API_AUDIO_CUSTOMER_AENC_ReleaseData(encFormat, pBufAddr, datasize);
21606 }
21607 break;
21608
21609 /* PCM Capture */
21610 case 0x0E00:
21611 {
21612 AU_nPRINT("currentConnect:\n");
21613 arg2 = AU_CUS_Debug_GetDec();
21614
21615 API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect = (API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX)arg2;
21616
21617 API_AUDIO_CUSTOMER_PCM_StartUpload(currentConnect);
21618 }
21619 break;
21620
21621 case 0x0E01:
21622 {
21623 AU_nPRINT("currentConnect:\n");
21624 arg2 = AU_CUS_Debug_GetDec();
21625
21626 API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect = (API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX)arg2;
21627
21628 API_AUDIO_CUSTOMER_PCM_StopUpload(currentConnect);
21629 }
21630 break;
21631
21632 case 0x0E02:
21633 {
21634 AU_nPRINT("currentConnect:\n");
21635 arg2 = AU_CUS_Debug_GetDec();
21636
21637 API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect = (API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX)arg2;
21638 pfnAudioCustomerPCMSending pfnCallBack = NULL;
21639
21640 API_AUDIO_CUSTOMER_PCM_RegisterSendPCMCallback(currentConnect, pfnCallBack);
21641 }
21642 break;
21643
21644 case 0x0E03:
21645 {
21646 AU_nPRINT("currentConnect:\n");
21647 arg2 = AU_CUS_Debug_GetDec();
21648 AU_nPRINT("enter value 0 ~ 1015\n");
21649 arg3 = AU_CUS_Debug_GetDec();
21650 API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect = (API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX)arg2;
21651 MS_U32 gain = arg3;
21652
21653 API_AUDIO_CUSTOMER_PCM_SetGain(currentConnect, gain);
21654 }
21655 break;
21656
21657 case 0x0E04:
21658 {
21659 AU_nPRINT("currentConnect:\n");
21660 arg2 = AU_CUS_Debug_GetDec();
21661 AU_nPRINT("bOnOff\n");
21662 arg3 = AU_CUS_Debug_GetDec();
21663 API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect = (API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX)arg2;
21664 MS_BOOL bOnOff = arg3;
21665
21666 API_AUDIO_CUSTOMER_PCM_SetMute(currentConnect, bOnOff);
21667 }
21668 break;
21669
21670 case 0x0E05:
21671 {
21672 AU_nPRINT("request_ms:\n");
21673 arg2 = AU_CUS_Debug_GetDec();
21674 MS_U32 request_ms = arg2;
21675
21676 API_AUDIO_CUSTOMER_PCM_SetRequestSizeInMs(request_ms);
21677 }
21678 break;
21679
21680 /* PCM IO Control */
21681 case 0x0F00:/* need to refine */
21682 {
21683 AU_nPRINT("\n");
21684 }
21685 break;
21686
21687 case 0x0F01:/* need to refine */
21688 {
21689 AU_nPRINT("\n");
21690 }
21691 break;
21692
21693 case 0x0F02:/* need to refine */
21694 {
21695 AU_nPRINT("\n");
21696 }
21697 break;
21698
21699 case 0x0F03:/* need to refine */
21700 {
21701 AU_nPRINT("\n");
21702 }
21703 break;
21704
21705 case 0x0F04:/* need to refine */
21706 {
21707 AU_nPRINT("\n");
21708 }
21709 break;
21710
21711 case 0x0F05:/* need to refine */
21712 {
21713 AU_nPRINT("\n");
21714 }
21715 break;
21716
21717 case 0x0F06:/* need to refine */
21718 {
21719 AU_nPRINT("\n");
21720 }
21721 break;
21722
21723 case 0x0F07:/* need to refine */
21724 {
21725 AU_nPRINT("\n");
21726 }
21727 break;
21728
21729 case 0x0F08:/* need to refine */
21730 {
21731 AU_nPRINT("\n");
21732 }
21733 break;
21734
21735 /* MM New Mode */
21736 case 0x1000:
21737 {
21738 AU_nPRINT("adecIndex:\n");
21739 arg2 = AU_CUS_Debug_GetDec();
21740 AU_nPRINT("DDRInfo:\n");
21741 arg3 = AU_CUS_Debug_GetDec();
21742
21743 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
21744 API_AUDIO_CUSTOMER_DDRINFO DDRInfo = (API_AUDIO_CUSTOMER_DDRINFO)arg3;
21745
21746 API_AUDIO_CUSTOMER_GetDDRInfo(adecIndex, DDRInfo);
21747 }
21748 break;
21749
21750 case 0x1001:
21751 {
21752 AU_nPRINT("adecIndex:\n");
21753 arg2 = AU_CUS_Debug_GetDec();
21754
21755 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
21756
21757 API_AUDIO_CUSTOMER_MM2_initAesInfo(adecIndex);
21758 }
21759 break;
21760
21761 case 0x1002:
21762 {
21763 AU_nPRINT("adecIndex:\n");
21764 arg2 = AU_CUS_Debug_GetDec();
21765
21766 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
21767 API_AUDIO_CUSTOMER_AES_INFO *aes_info;
21768
21769 memset((void *)(&aes_info), 0, sizeof(aes_info));
21770
21771 API_AUDIO_CUSTOMER_MM2_checkAesInfo(adecIndex, aes_info);
21772 }
21773 break;
21774
21775 case 0x1003:/* need to refine */
21776 {
21777 AU_nPRINT("adecIndex:\n");
21778 arg2 = AU_CUS_Debug_GetDec();
21779 AU_nPRINT("es_size:\n");
21780 arg3 = AU_CUS_Debug_GetDec();
21781 AU_nPRINT("ptsExist:\n");
21782 arg4 = AU_CUS_Debug_GetDec();
21783 AU_nPRINT("pts:\n");
21784 arg5 = AU_CUS_Debug_GetDec();
21785
21786 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
21787 MS_U32 es_size = (MS_U32)arg3;
21788 MS_BOOL ptsExist = (MS_BOOL)arg4;
21789 MS_U64 pts = (MS_U64)arg5;
21790
21791 API_AUDIO_CUSTOMER_MM2_inputAesFinished(adecIndex, es_size, ptsExist, pts);
21792 }
21793 break;
21794
21795 case 0x1004:
21796 {
21797 AU_nPRINT("adecIndex:\n");
21798 arg2 = AU_CUS_Debug_GetDec();
21799
21800 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
21801
21802 API_AUDIO_CUSTOMER_MM2_AD_initAesInfo(adecIndex);
21803 }
21804 break;
21805
21806 case 0x1005:
21807 {
21808 AU_nPRINT("adecIndex:\n");
21809 arg2 = AU_CUS_Debug_GetDec();
21810
21811 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
21812 API_AUDIO_CUSTOMER_AES_INFO *aes_info;
21813
21814 memset((void *)(&aes_info), 0, sizeof(aes_info));
21815
21816 API_AUDIO_CUSTOMER_MM2_AD_checkAesInfo(adecIndex, aes_info);
21817 }
21818 break;
21819
21820 case 0x1006:/* need to refine */
21821 {
21822 AU_nPRINT("adecIndex:\n");
21823 arg2 = AU_CUS_Debug_GetDec();
21824 AU_nPRINT("es_size:\n");
21825 arg3 = AU_CUS_Debug_GetDec();
21826 AU_nPRINT("ptsExist:\n");
21827 arg4 = AU_CUS_Debug_GetDec();
21828 AU_nPRINT("pts:\n");
21829 arg5 = AU_CUS_Debug_GetDec();
21830
21831 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = (API_AUDIO_CUSTOMER_ADEC_INDEX)arg2;
21832 MS_U32 es_size = (MS_U32)arg3;
21833 MS_BOOL ptsExist = (MS_BOOL)arg4;
21834 MS_U64 pts = (MS_U64)arg5;
21835
21836 API_AUDIO_CUSTOMER_MM2_AD_inputAesFinished(adecIndex, es_size, ptsExist, pts);
21837 }
21838 break;
21839
21840 /* Mstar Sound Effect */
21841 case 0x1100:
21842 {
21843 AU_CUS_AQ_Tuning_MSTAR_SE_Enable();
21844 }
21845 break;
21846
21847 case 0x1101:
21848 {
21849 AU_CUS_AQ_Tuning_MSTAR_SE_SET_GEQ();
21850 }
21851 break;
21852
21853 case 0x1102:
21854 {
21855 AU_CUS_AQ_Tuning_MSTAR_SE_SET_PEQCoef();
21856 }
21857 break;
21858
21859 case 0x1103:
21860 {
21861 AU_CUS_AQ_Tuning_MSTAR_SE_SET_HPFCoef();
21862 }
21863 break;
21864
21865 case 0x1104:
21866 {
21867 AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_MODE();
21868 }
21869 break;
21870
21871 case 0x1105:
21872 {
21873 AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_LEVEL();
21874 }
21875 break;
21876
21877 case 0x1106:
21878 {
21879 AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_R_MODE_Begin();
21880 }
21881 break;
21882
21883 case 0x1107:
21884 {
21885 AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_R_MODE_End();
21886 }
21887 break;
21888
21889 case 0x1108:
21890 {
21891 AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_R_MODE_Slope();
21892 }
21893 break;
21894
21895 case 0x1109:
21896 {
21897 AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_S_MODE_OFFSET();
21898 }
21899 break;
21900
21901 case 0x110A:
21902 {
21903 AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_AttackTime();
21904 }
21905 break;
21906
21907 case 0x110B:
21908 {
21909 AU_CUS_AQ_Tuning_MSTAR_SE_SET_AVC_ReleaseTime();
21910 }
21911 break;
21912
21913 case 0x110C:
21914 {
21915 AU_CUS_AQ_Tuning_MSTAR_SE_SET_DRC_LEVEL();
21916 }
21917 break;
21918
21919 case 0x110D:
21920 {
21921 AU_CUS_AQ_Tuning_MSTAR_SE_SET_BALANCE();
21922 }
21923 break;
21924
21925 case 0x110E:
21926 {
21927 AU_CUS_AQ_Tuning_MSTAR_SE_SET_NR_Threshold();
21928 }
21929 break;
21930
21931 case 0x110F:/* need to refine */
21932 {
21933 AU_nPRINT("\n");
21934 }
21935 break;
21936
21937 /* Advanced Sound Effect */
21938 case 0x1200:
21939 {
21940 AU_CUS_AQ_Tuning_DTS_SE_Enable();
21941 }
21942 break;
21943
21944 case 0x1201:
21945 {
21946 AU_CUS_AQ_Tuning_DTS_SE_ProcessUnit_Enable();
21947 }
21948 break;
21949
21950 case 0x1202:
21951 {
21952 AU_CUS_AQ_Tuning_DTS_SE_SetParam();
21953 }
21954 break;
21955
21956 case 0x1203:
21957 {
21958 AU_CUS_AQ_Tuning_Dolby_DAP_Enable();
21959 }
21960 break;
21961
21962 case 0x1204:
21963 {
21964 AU_CUS_AQ_Tuning_Dolby_DAP_ProcessUnit_Enable();
21965 }
21966 break;
21967
21968 case 0x1205:
21969 {
21970 AU_CUS_AQ_Tuning_Dolby_DAP_SetParam();
21971 }
21972 break;
21973
21974 case 0x9999:
21975 {
21976 return TRUE;
21977 }
21978 break;
21979
21980 default:
21981 {
21982 return TRUE;
21983 }
21984 break;
21985 }
21986 }
21987
21988 AU_nPRINT("[AUDIO][%s] [%s] [%d] [arg1 = %d] \n", __FILE__, __FUNCTION__, __LINE__, (unsigned int)arg1);
21989 AU_nPRINT("[AUDIO][%s] [%s] [%d] [arg2 = %d] \n", __FILE__, __FUNCTION__, __LINE__, (unsigned int)arg2);
21990 AU_nPRINT("[AUDIO][%s] [%s] [%d] [arg3 = %d] \n", __FILE__, __FUNCTION__, __LINE__, (unsigned int)arg3);
21991 AU_nPRINT("[AUDIO][%s] [%s] [%d] [arg4 = %d] \n", __FILE__, __FUNCTION__, __LINE__, (unsigned int)arg4);
21992 AU_nPRINT("[AUDIO][%s] [%s] [%d] [arg5 = %d] \n", __FILE__, __FUNCTION__, __LINE__, (unsigned int)arg5);
21993 AU_nPRINT("[AUDIO][%s] [%s] [%d] [arg6 = %d] \n", __FILE__, __FUNCTION__, __LINE__, (unsigned int)arg6);
21994 AU_nPRINT("[AUDIO][%s] [%s] [%d] [arg7 = %d] \n", __FILE__, __FUNCTION__, __LINE__, (unsigned int)arg7);
21995 AU_nPRINT("[AUDIO][%s] [%s] [%d] [arg8 = %d] \n", __FILE__, __FUNCTION__, __LINE__, (unsigned int)arg8);
21996 AU_nPRINT("[AUDIO][%s] [%s] [%d] [arg9 = %d] \n", __FILE__, __FUNCTION__, __LINE__, (unsigned int)arg9);
21997 AU_nPRINT("[AUDIO][%s] [%s] [%d] [arg10 = %d] \n", __FILE__, __FUNCTION__, __LINE__, (unsigned int)arg10);
21998 AU_nPRINT("[AUDIO][%s] [%s] [%d] [------AUDIO_DEBUG------End] \n\n\n", __FILE__, __FUNCTION__, __LINE__);
21999 }
22000
AU_CUS_Show_Bifrost_Test_File_Option(void)22001 void AU_CUS_Show_Bifrost_Test_File_Option(void)
22002 {
22003 char usbMountPathString[256];
22004
22005 if(pstAudioCustomerShmData->g_audio_customer_scanf_bSupport)
22006 {
22007 strcpy( usbMountPathString, "/mnt/sda1/");
22008 }
22009 else
22010 {
22011 strcpy( usbMountPathString, "/media/ext1:/");
22012 }
22013
22014 AU_nPRINT("======================= AAC ======================= \n");
22015 AU_nPRINT("%s_Bifrost_Audio_only/AAC/ChID_voices_321_dp_audio1_adts.aac \n", usbMountPathString);
22016 AU_nPRINT("%s_Bifrost_Audio_only/AAC/DR_720k_321_HE-AAC.aac \n", usbMountPathString);
22017 AU_nPRINT("%s_Bifrost_Audio_only/AAC/heaac_v1_v2_sweep_258_ps.aac \n", usbMountPathString);
22018 AU_nPRINT("%s_Bifrost_Audio_only/AAC/jay.aac \n", usbMountPathString);
22019 AU_nPRINT("%s_Bifrost_Audio_only/AAC/MM_Audio_ESDump_hulu_errorFrame.aac \n", usbMountPathString);
22020 AU_nPRINT("%s_Bifrost_Audio_only/AAC/MM_Audio_ESDump_netflix_glitch.aac \n", usbMountPathString);
22021 AU_nPRINT(" \n");
22022 AU_nPRINT("======================= Datmos =================== \n");
22023 AU_nPRINT("%s_Bifrost_Audio_only/Datmos/Datmos_id_obj_voice_ddp.ac3 \n", usbMountPathString);
22024 AU_nPRINT("%s_Bifrost_Audio_only/Datmos/MM_Audio_ESDump_vudu_atmos.ac3 \n", usbMountPathString);
22025 AU_nPRINT(" \n");
22026 AU_nPRINT("======================= DD ======================= \n");
22027 AU_nPRINT("%s_Bifrost_Audio_only/DD/5ch_datarate_640_7_dd_h264.ac3 \n", usbMountPathString);
22028 AU_nPRINT("%s_Bifrost_Audio_only/DD/5ch_samplerate_44.1k_7_dd_h264.ac3 \n", usbMountPathString);
22029 AU_nPRINT("%s_Bifrost_Audio_only/DD/dd.ac3 \n", usbMountPathString);
22030 AU_nPRINT("%s_Bifrost_Audio_only/DD/Vudu_VS_On_Cutting.ac3 \n", usbMountPathString);
22031 AU_nPRINT(" \n");
22032 AU_nPRINT("======================= DDP ======================= \n");
22033 AU_nPRINT("%s_Bifrost_Audio_only/DDP/5ch_23fps_datarate_3024_7.ac3 \n", usbMountPathString);
22034 AU_nPRINT("%s_Bifrost_Audio_only/DDP/8ch_23fps_voices_id_21.ac3 \n", usbMountPathString);
22035 AU_nPRINT("%s_Bifrost_Audio_only/DDP/10k.ac3 \n", usbMountPathString);
22036 AU_nPRINT("%s_Bifrost_Audio_only/DDP/AUDIO_026_TC5.ac3 \n", usbMountPathString);
22037 AU_nPRINT("%s_Bifrost_Audio_only/DDP/ch_id.ac3 \n", usbMountPathString);
22038 AU_nPRINT("%s_Bifrost_Audio_only/DDP/ChID_voices_321_ddp.ac3 \n", usbMountPathString);
22039 AU_nPRINT("%s_Bifrost_Audio_only/DDP/ddp.ac3 \n", usbMountPathString);
22040 AU_nPRINT("%s_Bifrost_Audio_only/DDP/SR_32k_200_ddp.ac3 \n", usbMountPathString);
22041 AU_nPRINT(" \n");
22042 AU_nPRINT("======================= DDP_71 ==================== \n");
22043 AU_nPRINT("%s_Bifrost_Audio_only/DDP_71/7ch_ddp_25fps_channel_id.ac3 \n", usbMountPathString);
22044 AU_nPRINT("%s_Bifrost_Audio_only/DDP_71/8ch_Ls_Rs_dmx_Lb_Rb.ac3 \n", usbMountPathString);
22045 AU_nPRINT("%s_Bifrost_Audio_only/DDP_71/71.ac3 \n", usbMountPathString);
22046 AU_nPRINT(" \n");
22047 AU_nPRINT("======================= DRA ======================= \n");
22048 AU_nPRINT("%s_Bifrost_Audio_only/DRA/14-fl_dra512kbps_71ch_44khz_vbr.dra \n", usbMountPathString);
22049 AU_nPRINT("%s_Bifrost_Audio_only/DRA/ID1.0ch_64kbps_48khz_cbr.dra \n", usbMountPathString);
22050 AU_nPRINT("%s_Bifrost_Audio_only/DRA/ID2.0ch_128kbps_48khz_cbr.dra \n", usbMountPathString);
22051 AU_nPRINT("%s_Bifrost_Audio_only/DRA/ID5.1ch_384kbps_48khz_cbr.dra \n", usbMountPathString);
22052 AU_nPRINT("%s_Bifrost_Audio_only/DRA/ID7.1ch_512kbps_48khz_cbr.dra \n", usbMountPathString);
22053 AU_nPRINT("%s_Bifrost_Audio_only/DRA/m_96khz.dra \n", usbMountPathString);
22054 AU_nPRINT(" \n");
22055 AU_nPRINT("======================= DTS ======================= \n");
22056 AU_nPRINT("%s_Bifrost_Audio_only/DTS/44-1152-32tone-51.dtshd \n", usbMountPathString);
22057 AU_nPRINT("%s_Bifrost_Audio_only/DTS/44-1152-ChID51.dtshd \n", usbMountPathString);
22058 AU_nPRINT("%s_Bifrost_Audio_only/DTS/48-1152-32tone-51.dtshd \n", usbMountPathString);
22059 AU_nPRINT("%s_Bifrost_Audio_only/DTS/48-1509-ChID51.dtshd \n", usbMountPathString);
22060 AU_nPRINT(" \n");
22061 AU_nPRINT("======================= DTSLBR ======================= \n");
22062 AU_nPRINT("%s_Bifrost_Audio_only/DTSLBR/4824-256kbps-ChID51.dtshd \n", usbMountPathString);
22063 AU_nPRINT("%s_Bifrost_Audio_only/DTSLBR/LBRS-48-255kbps-ChID51-ed20.dtshd \n", usbMountPathString);
22064 AU_nPRINT("%s_Bifrost_Audio_only/DTSLBR/LBRS-48-318kbps-10tone-51.dtshd \n", usbMountPathString);
22065 AU_nPRINT("%s_Bifrost_Audio_only/DTSLBR/LBRS-48-384kbps-10tone-51-ed20.dtshd \n", usbMountPathString);
22066 AU_nPRINT(" \n");
22067 AU_nPRINT("======================= DTSXLL ======================= \n");
22068 AU_nPRINT("%s_Bifrost_Audio_only/DTSXLL/XLL_384000_96k_24b_DN.dtshd \n", usbMountPathString);
22069 AU_nPRINT("%s_Bifrost_Audio_only/DTSXLL/XLL_768000_48k_16b_DN.dtshd \n", usbMountPathString);
22070 AU_nPRINT("%s_Bifrost_Audio_only/DTSXLL/XLL_1509000_192k_16b_DN.dtshd \n", usbMountPathString);
22071 AU_nPRINT(" \n");
22072 AU_nPRINT("======================= ES_Bypass ======================= \n");
22073 AU_nPRINT("%s_Bifrost_Audio_only/ES_Bypass/dd_ESBypass.ac3 \n", usbMountPathString);
22074 AU_nPRINT("%s_Bifrost_Audio_only/ES_Bypass/ddp_ESBypass.ac3 \n", usbMountPathString);
22075 AU_nPRINT("%s_Bifrost_Audio_only/ES_Bypass/dts_ESBypass.dts \n", usbMountPathString);
22076 AU_nPRINT(" \n");
22077 AU_nPRINT("======================= FLAC ======================= \n");
22078 AU_nPRINT("%s_Bifrost_Audio_only/FLAC/naim-test-2-flac-24-48000.flac \n", usbMountPathString);
22079 AU_nPRINT("%s_Bifrost_Audio_only/FLAC/surround88.flac \n", usbMountPathString);
22080 AU_nPRINT(" \n");
22081 AU_nPRINT("======================= GAAC ======================= \n");
22082 AU_nPRINT("%s_Bifrost_Audio_only/GAAC/ChID_voices_321_dp_audio1_adts.aac \n", usbMountPathString);
22083 AU_nPRINT("%s_Bifrost_Audio_only/GAAC/DR_720k_321_HE-AAC.aac \n", usbMountPathString);
22084 AU_nPRINT("%s_Bifrost_Audio_only/GAAC/heaac_v1_v2_sweep_258_ps.aac \n", usbMountPathString);
22085 AU_nPRINT("%s_Bifrost_Audio_only/GAAC/jay.aac \n", usbMountPathString);
22086 AU_nPRINT(" \n");
22087 AU_nPRINT("======================= MP3 ======================= \n");
22088 AU_nPRINT("%s_Bifrost_Audio_only/MP3/32k.mp3 \n", usbMountPathString);
22089 AU_nPRINT("%s_Bifrost_Audio_only/MP3/44k.mp3 \n", usbMountPathString);
22090 AU_nPRINT("%s_Bifrost_Audio_only/MP3/48k.mp3 \n", usbMountPathString);
22091 AU_nPRINT(" \n");
22092 AU_nPRINT("======================= MP3_AD ==================== \n");
22093 AU_nPRINT("%s_Bifrost_Audio_only/MP3_AD/01_Main.mp3 \n", usbMountPathString);
22094 AU_nPRINT("%s_Bifrost_Audio_only/MP3_AD/02_AD.mp3 \n", usbMountPathString);
22095 AU_nPRINT(" \n");
22096 AU_nPRINT("======================= MPEG ======================= \n");
22097 AU_nPRINT("%s_Bifrost_Audio_only/MPEG/48_224.mpg \n", usbMountPathString);
22098 AU_nPRINT("%s_Bifrost_Audio_only/MPEG/441_128.mpg \n", usbMountPathString);
22099 AU_nPRINT("%s_Bifrost_Audio_only/MPEG/441_224.mpg \n", usbMountPathString);
22100 AU_nPRINT(" \n");
22101 AU_nPRINT("======================= OGG ======================= \n");
22102 AU_nPRINT("%s_Bifrost_Audio_only/OGG/IfCloudsKnow.ogg \n", usbMountPathString);
22103 AU_nPRINT(" \n");
22104 AU_nPRINT("======================= RA8 ======================= \n");
22105 AU_nPRINT("%s_Bifrost_Audio_only/RA8/Cartoon.ra8 \n", usbMountPathString);
22106 AU_nPRINT("%s_Bifrost_Audio_only/RA8/Chae_Yeon.ra8 \n", usbMountPathString);
22107 AU_nPRINT(" \n");
22108 AU_nPRINT("======================= WMA ======================= \n");
22109 AU_nPRINT("%s_Bifrost_Audio_only/WMA/01-God_Rest_You_Merry_Gentleman.wma \n", usbMountPathString);
22110 AU_nPRINT("%s_Bifrost_Audio_only/WMA/9.6Mbps.WMV9.1080p.WMA3.Experience.WMP10.wma \n", usbMountPathString);
22111 AU_nPRINT("%s_Bifrost_Audio_only/WMA/96kbps-10years.wma \n", usbMountPathString);
22112 AU_nPRINT("%s_Bifrost_Audio_only/WMA/background_music.wma \n", usbMountPathString);
22113 AU_nPRINT("%s_Bifrost_Audio_only/WMA/LoveLove-Love.wma \n", usbMountPathString);
22114 AU_nPRINT("%s_Bifrost_Audio_only/WMA/Rahana_wma10pro_2ch.wma \n", usbMountPathString);
22115 AU_nPRINT("%s_Bifrost_Audio_only/WMA/thais.wma \n", usbMountPathString);
22116 AU_nPRINT("%s_Bifrost_Audio_only/WMA/wmapro.wma \n", usbMountPathString);
22117 AU_nPRINT(" \n");
22118 AU_nPRINT("======================= XPCM ======================= \n");
22119 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/3_16K_64.wav \n", usbMountPathString);
22120 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/96k.wav \n", usbMountPathString);
22121 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/192k.wav \n", usbMountPathString);
22122 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/aLaw_48khz.wav \n", usbMountPathString);
22123 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-6000.wav \n", usbMountPathString);
22124 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-8000.wav \n", usbMountPathString);
22125 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-11025.wav \n", usbMountPathString);
22126 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-16000.wav \n", usbMountPathString);
22127 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-22050.wav \n", usbMountPathString);
22128 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-32000.wav \n", usbMountPathString);
22129 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-44100.wav \n", usbMountPathString);
22130 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-48000.wav \n", usbMountPathString);
22131 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-64000.wav \n", usbMountPathString);
22132 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-88200.wav \n", usbMountPathString);
22133 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-96000.wav \n", usbMountPathString);
22134 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-192000.wav \n", usbMountPathString);
22135 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-minus20dB-16bit-48000.wav \n", usbMountPathString);
22136 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/G5_MPEG2_DVD_LPCM_HD.Club-Alisan.wav \n", usbMountPathString);
22137 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/imaadpcm_48khz.wav \n", usbMountPathString);
22138 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/msadpcm_48khz.wav \n", usbMountPathString);
22139 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/NTS_AUDIO-006-TC1.wav \n", usbMountPathString);
22140 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/surround51_48khz.wav \n", usbMountPathString);
22141 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/tone16bit-44100.wav \n", usbMountPathString);
22142 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/tone16bit-88200.wav \n", usbMountPathString);
22143 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/uLaw_48khz.wav \n", usbMountPathString);
22144 AU_nPRINT(" \n");
22145 AU_nPRINT(" Enter input file path: \n");
22146 }
22147
AU_CUS_Show_Codec_Type_Option(void)22148 void AU_CUS_Show_Codec_Type_Option(void)
22149 {
22150 AU_nPRINT(" Codec type: \n");
22151 AU_nPRINT(" (01) API_AUDIO_CUSTOMER_CODEC_TYPE_PCM \n");
22152 AU_nPRINT(" (02) API_AUDIO_CUSTOMER_CODEC_TYPE_AC3 \n");
22153 AU_nPRINT(" (03) API_AUDIO_CUSTOMER_CODEC_TYPE_EAC3 \n");
22154 AU_nPRINT(" (04) API_AUDIO_CUSTOMER_CODEC_TYPE_MPEG \n");
22155 AU_nPRINT(" (05) API_AUDIO_CUSTOMER_CODEC_TYPE_AAC \n");
22156 AU_nPRINT(" (06) API_AUDIO_CUSTOMER_CODEC_TYPE_HEAAC \n");
22157 AU_nPRINT(" (07) API_AUDIO_CUSTOMER_CODEC_TYPE_DRA \n");
22158 AU_nPRINT(" (08) API_AUDIO_CUSTOMER_CODEC_TYPE_MP3 \n");
22159 AU_nPRINT(" (09) API_AUDIO_CUSTOMER_CODEC_TYPE_DTS \n");
22160 AU_nPRINT(" (10) API_AUDIO_CUSTOMER_CODEC_TYPE_SIF \n");
22161 AU_nPRINT(" (11) API_AUDIO_CUSTOMER_CODEC_TYPE_SIF_BTSC \n");
22162 AU_nPRINT(" (12) API_AUDIO_CUSTOMER_CODEC_TYPE_SIF_A2 \n");
22163 AU_nPRINT(" (13) API_AUDIO_CUSTOMER_CODEC_TYPE_DEFAULT \n");
22164 AU_nPRINT(" (14) API_AUDIO_CUSTOMER_CODEC_TYPE_NONE \n");
22165 AU_nPRINT(" (15) API_AUDIO_CUSTOMER_CODEC_TYPE_DTS_HD_MA \n");
22166 AU_nPRINT(" (16) API_AUDIO_CUSTOMER_CODEC_TYPE_DTS_EXPRESS \n");
22167 AU_nPRINT(" (17) API_AUDIO_CUSTOMER_CODEC_TYPE_DTS_CD \n");
22168 AU_nPRINT(" (18) API_AUDIO_CUSTOMER_CODEC_TYPE_WMA \n");
22169 AU_nPRINT(" (19) API_AUDIO_CUSTOMER_CODEC_TYPE_WMA_PRO \n");
22170 AU_nPRINT(" (20) API_AUDIO_CUSTOMER_CODEC_TYPE_XPCM \n");
22171 AU_nPRINT(" (21) API_AUDIO_CUSTOMER_CODEC_TYPE_RA8LBR \n");
22172 AU_nPRINT(" (22) API_AUDIO_CUSTOMER_CODEC_TYPE_FLAC \n");
22173 AU_nPRINT(" (23) API_AUDIO_CUSTOMER_CODEC_TYPE_VORBIS \n");
22174 AU_nPRINT(" (24) API_AUDIO_CUSTOMER_CODEC_TYPE_AMR_NB \n");
22175 AU_nPRINT(" (25) API_AUDIO_CUSTOMER_CODEC_TYPE_AMR_WB \n");
22176 AU_nPRINT(" (26) API_AUDIO_CUSTOMER_CODEC_TYPE_DolbyTrueHDBypass \n");
22177 AU_nPRINT(" (27) API_AUDIO_CUSTOMER_CODEC_TYPE_DVI \n");
22178 AU_nPRINT(" (28) API_AUDIO_CUSTOMER_CODEC_TYPE_ESBypass \n");
22179 }
22180
AU_CUS_DebugMenu(void)22181 MS_BOOL AU_CUS_DebugMenu(void)
22182 {
22183 int arg1=0;
22184 unsigned int arg2=0, arg3=0, arg4=0, arg5=0, arg6=0, arg7=0, arg8=0, arg9=0, arg10=0;
22185
22186 while(1)
22187 {
22188 AU_nPRINT("========================================================================================== \n");
22189 AU_nPRINT("(0xSHOW) pstAudioCustomerShmData->g_audio_customer_Init_Done (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Init_Done);
22190 AU_nPRINT("(0xSHOW) pstAudioCustomerShmData->g_audio_customer_scanf_bSupport (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_scanf_bSupport);
22191 AU_nPRINT("(0xSHOW) pstAudioCustomerShmData->g_audio_customer_Chip_Platform (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Chip_Platform);
22192 AU_nPRINT("(0xSHOW) g_audio_customer_internal_patch_SndR2_MS12_Pcmr_Metadata_Select (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_SndR2_MS12_Pcmr_Metadata_Select);
22193 AU_nPRINT("========================================================================================== \n");
22194 AU_nPRINT("(0x0000) pstAudioCustomerShmData->g_audio_customer_bEnableNonThreadPrintMsg (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_bEnableNonThreadPrintMsg);
22195 AU_nPRINT("(0x0001) pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg);
22196 AU_nPRINT("(0x0002) pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg_Interval(%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg_Interval);
22197 AU_nPRINT("(0x0003) pstAudioCustomerShmData->g_audio_customer_bThreadPrintMsg_Interval (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_bThreadPrintMsg_Interval);
22198 AU_nPRINT("(0x0004) (apiAUDIO / apiAUDIO_V2) g_api_audio_V2_bEnableNonThreadPrintMsg (%d) \n", (unsigned int)g_api_audio_V2_bEnableNonThreadPrintMsg);
22199 AU_nPRINT("(0x0005) (apiAUDIO / apiAUDIO_V2) g_api_audio_V2_bEnableThreadPrintMsg (%d) \n", (unsigned int)g_api_audio_V2_bEnableThreadPrintMsg);
22200 AU_nPRINT("(0x0006) (apiAUDIO / apiAUDIO_V2) g_api_audio_V2_bEnableReturnPrintMsg (%d) \n", (unsigned int)g_api_audio_V2_bEnableReturnPrintMsg);
22201 AU_nPRINT("(0x0007) Disable All Thread Monitor \n");
22202 AU_nPRINT("========================================================================================== \n");
22203 AU_nPRINT("(0x0100) [Demo] MP3 Encode \n");
22204 AU_nPRINT("(0x0101) [Demo] AAC Encode \n");
22205 AU_nPRINT("(0x0102) [Demo] CLIP Decoder play \n");
22206 AU_nPRINT("(0x0103) [Demo] PCM Capture \n");
22207 AU_nPRINT("(0x0104) [Demo] PCM IO write \n");
22208 AU_nPRINT("(0x0105) [Demo] Play All MM File (Audio only) \n");
22209 AU_nPRINT("(0x0106) [Demo] Play All MM AD File (Audio only) \n");
22210 AU_nPRINT("(0x0107) [Demo] XPCM-channel mask \n");
22211 AU_nPRINT("(0x0108) [Demo] HDMI RX Monitor Event \n");
22212 AU_nPRINT("========================================================================================== \n");
22213 AU_nPRINT("(0x0200) (0:Sync, 1: Freerun) pstAudioCustomerShmData->g_audio_customer_ADEC0_SyncMode (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC0_SyncMode);
22214 AU_nPRINT("(0x0201) (0:Sync, 1: Freerun) pstAudioCustomerShmData->g_audio_customer_ADEC1_SyncMode (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC1_SyncMode);
22215 AU_nPRINT("(0x0202) (0:Line, 1: RF) pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DolbyDRCMode (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DolbyDRCMode);
22216 AU_nPRINT("(0x0203) (0:LIne, 1: RF) pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3P_DolbyDRCMode (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3P_DolbyDRCMode);
22217 AU_nPRINT("(0x0204) (0:LTRT, 1: LORO) pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DownmixMode (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DownmixMode);
22218 AU_nPRINT("(0x0205) (0:LTRT, 1: LORO) pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3P_DownmixMode (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3P_DownmixMode);
22219 AU_nPRINT("(0x0206) (0:LR, 1:LL, 2:RR) pstAudioCustomerShmData->g_audio_customer_ADEC0_DualmonoMode (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC0_DualmonoMode);
22220 AU_nPRINT("(0x0207) (0:LR, 1:LL, 2:RR) pstAudioCustomerShmData->g_audio_customer_ADEC1_DualmonoMode (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC1_DualmonoMode);
22221 AU_nPRINT("========================================================================================== \n");
22222 AU_nPRINT("(0x0300) [DBG] AV Sync status \n");
22223 AU_nPRINT("(0x0301) [DBG] pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_Final_Auto_Audio_Delay (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_Final_Auto_Audio_Delay);
22224 AU_nPRINT("(0x0302) [DBG] pstAudioCustomerShmData->g_audio_customer_internal_patch_General_Buffer_Dump_bEnable (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_General_Buffer_Dump_bEnable);
22225 AU_nPRINT("(0x0303) [DBG] pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_I2S_Out (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_I2S_Out);
22226 AU_nPRINT("(0x0304) [DBG] pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_0_Out (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_0_Out);
22227 AU_nPRINT("(0x0305) [DBG] pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_1_Out (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_1_Out);
22228 AU_nPRINT("(0x0306) [DBG] pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_2_Out (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_2_Out);
22229 AU_nPRINT("(0x0307) [DBG] pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_3_Out (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_3_Out);
22230 AU_nPRINT("(0x0308) [DBG] pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_SPDIF_Out (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_SPDIF_Out);
22231 AU_nPRINT("(0x0309) [DBG] pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_HDMI_Out (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_HDMI_Out);
22232 AU_nPRINT("(0x0310) [DBG] Audio dump info \n");
22233 AU_nPRINT("(0x0311) [DBG] Se-DSP force encode without main sound \n");
22234 AU_nPRINT("(0x0312) [DBG] ASND-R2 force encode without main sound \n");
22235 AU_nPRINT("(0x0313) [DBG] AU_CUS_SetSourceInfo (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_SetSourceInfo_eSourceType);
22236 AU_nPRINT("(0x0314) [DBG] AU_CUS_InputSwitch (%d, %d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_InputSwitch_enSource, (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_InputSwitch_enGroup);
22237 AU_nPRINT("========================================================================================== \n");
22238 AU_nPRINT("(0x0400) pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_MonitorOnOff (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_MonitorOnOff);
22239 AU_nPRINT("(0x0401) pstAudioCustomerShmData->g_audio_customer_HDMI_RX_MonitorOnOff (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_HDMI_RX_MonitorOnOff);
22240 AU_nPRINT("(0x0402) pstAudioCustomerShmData->g_audio_customer_HDMI_TX_MonitorOnOff (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_HDMI_TX_MonitorOnOff);
22241 AU_nPRINT("(0x0403) pstAudioCustomerShmData->g_audio_customer_SIF_MonitorOnOff (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_SIF_MonitorOnOff);
22242 AU_nPRINT("(0x0404) pstAudioCustomerShmData->g_audio_customer_Auto_Recovery_MonitorOnOff (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Auto_Recovery_MonitorOnOff);
22243 AU_nPRINT("========================================================================================== \n");
22244 AU_nPRINT("(0x0500) AU_CUS_MuteDuringLimitedTime_Output(per_50ms, ePort) \n");
22245 AU_nPRINT("(0x0501) AU_CUS_MuteDuringLimitedTime_Input(per_50ms, eFWM, eCh) \n");
22246 AU_nPRINT("========================================================================================== \n");
22247 AU_nPRINT("(0x0600) pstAudioCustomerShmData->g_audio_customer_AU_ClipDecoderMonitor_Interval (%d) ms \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_ClipDecoderMonitor_Interval);
22248 AU_nPRINT("(0x0601) pstAudioCustomerShmData->g_audio_customer_AU_MP3EncodeMonitor_Interval (%d) ms \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_MP3EncodeMonitor_Interval);
22249 AU_nPRINT("(0x0602) pstAudioCustomerShmData->g_audio_customer_AU_MonitorService_Interval (%d) ms \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_MonitorService_Interval);
22250 AU_nPRINT("(0x0603) pstAudioCustomerShmData->g_audio_customer_AU_MuteDuringLimitedTime_Monitor_Interval (%d) ms \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_MuteDuringLimitedTime_Monitor_Interval);
22251 AU_nPRINT("(0x0604) pstAudioCustomerShmData->g_audio_customer_AU_AdecPcmOut_Interval (%d) ms \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_AdecPcmOut_Interval);
22252 AU_nPRINT("(0x0605) pstAudioCustomerShmData->g_audio_customer_AU_PCMCapture_Interval (%d) ms \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_PCMCapture_Interval);
22253 AU_nPRINT("(0x0606) pstAudioCustomerShmData->g_audio_customer_AU_EndOfStreamMonitor_Interval (%d) ms \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_EndOfStreamMonitor_Interval);
22254 AU_nPRINT("(0x0607) pstAudioCustomerShmData->g_audio_customer_AU_AdecUnderrun_Interval (%d) ms \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_AdecUnderrun_Interval);
22255 AU_nPRINT("(0x0608) pstAudioCustomerShmData->g_audio_customer_AU_Demo_MM_New_Mode_Play_Monitor_Interval (%d) ms \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_Demo_MM_New_Mode_Play_Monitor_Interval);
22256 AU_nPRINT("(0x0609) pstAudioCustomerShmData->g_audio_customer_AU_CUS_ADEC_SetMute_Delay (%d) ms \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_CUS_ADEC_SetMute_Delay);
22257 AU_nPRINT("(0x0610) g_audio_customer_internal_patch_Avoid_ADEC_Stop_Pop_Noise_mute_limited_time (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_Avoid_ADEC_Stop_Pop_Noise_mute_limited_time);
22258 AU_nPRINT("(0x0611) g_audio_customer_internal_patch_Avoid_ADEC_Pause_Pop_Noise_mute_limited_time (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_Avoid_ADEC_Pause_Pop_Noise_mute_limited_time);
22259 AU_nPRINT("(0x0612) pstAudioCustomerShmData->g_audio_customer_AU_CUS_SetPlayCmdByAdecSource_Delay (%d) ms \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_CUS_SetPlayCmdByAdecSource_Delay);
22260 AU_nPRINT("(0x0613) pstAudioCustomerShmData->g_audio_customer_AU_CUS_PauseDecoding_Delay (%d) ms \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_CUS_PauseDecoding_Delay);
22261 AU_nPRINT("========================================================================================== \n");
22262 AU_nPRINT("(0x0700) Input Source Change \n");
22263 AU_nPRINT("(0x0701) pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_MM_ES1_bEnable (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_MM_ES1_bEnable);
22264 AU_nPRINT("(0x0702) pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_PCM1_bEnable (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_PCM1_bEnable);
22265 AU_nPRINT("(0x0703) pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_HDMINPCM_bEnable (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_HDMINPCM_bEnable);
22266 AU_nPRINT("(0x0704) pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_MS12_METADATA_bEnable (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_MS12_METADATA_bEnable);
22267 AU_nPRINT("(0x0705) pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_HDMI_ES1_bEnable (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_HDMI_ES1_bEnable);
22268 AU_nPRINT("========================================================================================== \n");
22269 AU_nPRINT("(0x0800) SPDIF / HDMI TX Output Type \n");
22270 AU_nPRINT("(0x0801) HDMI ARC Enable \n");
22271 AU_nPRINT("========================================================================================== \n");
22272 AU_nPRINT("(0x0900) MStar AVC (HDMI) \n");
22273 AU_nPRINT("========================================================================================== \n");
22274 AU_nPRINT("(0x7202) log Audio Path \n");
22275 AU_nPRINT("(0x8888) Enable nDBG log in file \n");
22276 AU_nPRINT("(0x4444) Close nDBG log in file \n");
22277 AU_nPRINT("(0x1111) Refresh menu \n");
22278 AU_nPRINT("(0x1234) AU_CUS_SingleFunctionDebugMenu() \n");
22279 AU_nPRINT("========================================================================================== \n");
22280 AU_nPRINT("(0x9990) AU_CUS_Show_HashKey_Support() \n");
22281 AU_nPRINT("(0x9991) AU_CUS_AQ_Tuning_and_Dump_Data() \n");
22282 AU_nPRINT("(0x9992) AU_CUS_MCU_DUMP_R2_LOG() \n");
22283 AU_nPRINT("(0x9993) AU_CUS_Where_Am_I() \n");
22284 AU_nPRINT("(0x9994) AU_CUS_DDR_Dump_Debug() \n");
22285 AU_nPRINT("(0x9995) AU_CUS_Dump_Audio_Related_Bank() \n");
22286 AU_nPRINT("(0x9996) AU_CUS_SHOW_ALL_VERSION() \n");
22287 AU_nPRINT("(0x9997) AU_CUS_SIF_Debug() \n");
22288 AU_nPRINT("(0x9998) AU_CUS_RegDebug() \n");
22289 AU_nPRINT("(0x9999) EXIT \n");
22290 AU_nPRINT("========================================================================================== \n");
22291 AU_nPRINT("Please enter debug[Function arg2 arg3 arg4 arg5] => 0x1 0x1... \n");
22292 AU_nPRINT("[AUDIO][%s] [%s] [%d] [------AUDIO_DEBUG------Begin] \n\n\n", __FILE__, __FUNCTION__, __LINE__);
22293
22294 arg1 = AU_CUS_Debug_GetHex("");
22295 int nUnused = 0;
22296 nUnused = nUnused;
22297
22298 switch(arg1)
22299 {
22300 case 0x0000:
22301 {
22302 AU_nPRINT("pstAudioCustomerShmData->g_audio_customer_bEnableNonThreadPrintMsg: \n");
22303 arg2 = AU_CUS_Debug_GetDec();
22304
22305 pstAudioCustomerShmData->g_audio_customer_bEnableNonThreadPrintMsg = (MS_BOOL)arg2;
22306 }
22307 break;
22308
22309 case 0x0001:
22310 {
22311 AU_nPRINT("pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg: \n");
22312 arg2 = AU_CUS_Debug_GetDec();
22313
22314 pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg = (MS_BOOL)arg2;
22315 }
22316 break;
22317
22318 case 0x0002:
22319 {
22320 AU_nPRINT("pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg_Interval: \n");
22321 arg2 = AU_CUS_Debug_GetDec();
22322
22323 pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg_Interval = (MS_BOOL)arg2;
22324 }
22325 break;
22326
22327 case 0x0003:
22328 {
22329 AU_nPRINT("pstAudioCustomerShmData->g_audio_customer_bThreadPrintMsg_Interval: \n");
22330 arg2 = AU_CUS_Debug_GetDec();
22331
22332 pstAudioCustomerShmData->g_audio_customer_bThreadPrintMsg_Interval = (MS_BOOL)arg2;
22333 }
22334 break;
22335
22336 case 0x0004:
22337 {
22338 AU_nPRINT("g_api_audio_V2_bEnableNonThreadPrintMsg: \n");
22339 arg2 = AU_CUS_Debug_GetDec();
22340
22341 g_api_audio_V2_bEnableNonThreadPrintMsg = (MS_U8)arg2;
22342 }
22343 break;
22344
22345 case 0x0005:
22346 {
22347 AU_nPRINT("g_api_audio_V2_bEnableThreadPrintMsg: \n");
22348 arg2 = AU_CUS_Debug_GetDec();
22349
22350 g_api_audio_V2_bEnableThreadPrintMsg = (MS_U8)arg2;
22351 }
22352 break;
22353
22354 case 0x0006:
22355 {
22356 AU_nPRINT("g_api_audio_V2_bEnableReturnPrintMsg: \n");
22357 arg2 = AU_CUS_Debug_GetDec();
22358
22359 g_api_audio_V2_bEnableReturnPrintMsg = (MS_U8)arg2;
22360 }
22361 break;
22362
22363 case 0x0007:
22364 {
22365 AU_nPRINT("DisableAllThreadMonitor... \n");
22366 pstAudioCustomerShmData->g_audio_customer_AU_CUS_ClipDecoderMonitor_bEnable = FALSE;
22367 pstAudioCustomerShmData->g_audio_customer_AU_CUS_MP3EncodeMonitor_bEnable = FALSE;
22368 pstAudioCustomerShmData->g_audio_customer_AU_CUS_MonitorService_bEnable = FALSE;
22369 pstAudioCustomerShmData->g_audio_customer_AU_CUS_AACEncodeMonitor_bEnable = FALSE;
22370 pstAudioCustomerShmData->g_audio_customer_AU_CUS_MuteDuringLimitedTime_Monitor_bEnable = FALSE;
22371 pstAudioCustomerShmData->g_audio_customer_AU_CUS_AdecPcmOutMonitor_bEnable = FALSE;
22372 pstAudioCustomerShmData->g_audio_customer_AU_CUS_PCMCaptureMonitor_bEnable = FALSE;
22373 pstAudioCustomerShmData->g_audio_customer_AU_CUS_EndOfStreamMonitor_bEnable = FALSE;
22374 pstAudioCustomerShmData->g_audio_customer_AU_CUS_ADEC_Underrun_Monitor_bEnable = FALSE;
22375 pstAudioCustomerShmData->g_audio_customer_AU_CUS_PATCH_Dump_R2_Log_Monitor_bEnable = FALSE;
22376 pstAudioCustomerShmData->g_audio_customer_AU_CUS_INTERNAL_PATCH_Auto_Audio_Delay_Monitor_bEnable = FALSE;
22377 pstAudioCustomerShmData->g_audio_customer_AU_CUS_INTERNAL_PATCH_General_Dump_Buffer_Monitor_bEnable = FALSE;
22378 pstAudioCustomerShmData->g_audio_customer_AU_CUS_INTERNAL_PATCH_DDP_71_Auto_Bypass_Monitor_bEnable = FALSE;
22379 pstAudioCustomerShmData->g_audio_customer_AU_CUS_INTERNAL_PATCH_R2_Active_Monitor_bEnable = FALSE;
22380 pstAudioCustomerShmData->g_audio_customer_AU_CUS_Demo_MM_New_Mode_AD_Play_Monitor_bEnable = FALSE;
22381 pstAudioCustomerShmData->g_audio_customer_AU_CUS_Demo_MM_New_Mode_Play_Monitor_bEnable = FALSE;
22382 pstAudioCustomerShmData->g_audio_customer_AU_CUS_Demo_PCMIO_Play_Monitor_bEnable = FALSE;
22383 pstAudioCustomerShmData->g_audio_customer_AU_CUS_AV_Sync_Info_Monitor_bEnable = FALSE;
22384 pstAudioCustomerShmData->g_audio_customer_AU_CUS_ThreadPrintMsg_Monitor_bEnable = FALSE;
22385 }
22386 break;
22387
22388 case 0x0100:
22389 {
22390 int selNum_mp3Enc = 0;
22391 while(selNum_mp3Enc != 0x9999)
22392 {
22393 AU_nPRINT("============================================= \n");
22394 AU_nPRINT("** MP3_ENCODE ** \n");
22395 AU_nPRINT("============================================= \n");
22396 AU_nPRINT("0x01 Start \n");
22397 AU_nPRINT("0x02 Stop \n");
22398 AU_nPRINT("9999 Exit \n");
22399 selNum_mp3Enc = AU_CUS_Debug_GetHex("");
22400
22401 switch(selNum_mp3Enc)
22402 {
22403 case 0x01:
22404 {
22405 //Mp3 enc connect
22406 API_AUDIO_CUSTOMER_MP3_ENC_Connect(API_AUDIO_CUSTOMER_MP3_ENC_INPUT_CH5);
22407
22408 //Mp3 enc start
22409 API_AUDIO_CUSTOMER_AENC_Start(API_AUDIO_CUSTOMER_AENC_ENCODE_MP3);
22410 }
22411 break;
22412
22413 case 0x02:
22414 {
22415 //Mp3 enc Stop
22416 API_AUDIO_CUSTOMER_AENC_Stop(API_AUDIO_CUSTOMER_AENC_ENCODE_MP3);
22417
22418 //Mp3 enc disconnect
22419 API_AUDIO_CUSTOMER_MP3_ENC_Disconnect(API_AUDIO_CUSTOMER_MP3_ENC_INPUT_CH5);
22420 }
22421 break;
22422
22423 case 0x9999:
22424 {
22425 //Exit
22426 }
22427 break;
22428
22429 default:
22430 break;
22431 }
22432 }
22433 }
22434 break;
22435
22436 case 0x0101:
22437 {
22438 #if (UTPA_SUPPORT_AAC_ENCODE == 1)
22439 int selNum_aacEnc = 0;
22440 while(selNum_aacEnc != 0x9999)
22441 {
22442 AU_nPRINT("============================================= \n");
22443 AU_nPRINT("** AAC Encode ** \n");
22444 AU_nPRINT("============================================= \n");
22445 AU_nPRINT("0x01 Start \n");
22446 AU_nPRINT("0x02 Stop \n");
22447 AU_nPRINT("9999 Exit \n");
22448 selNum_aacEnc = AU_CUS_Debug_GetHex("");
22449
22450 switch(selNum_aacEnc)
22451 {
22452 case 0x01:
22453 {
22454 //PCM capture connect
22455 API_AUDIO_CUSTOMER_PCM_CAPTURE_Connect(API_AUDIO_CUSTOMER_PCM_CAPTURE1, API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_CH5);
22456
22457 //aac enc connect
22458 API_AUDIO_CUSTOMER_AAC_ENC_Connect(API_AUDIO_CUSTOMER_AAC_ENC_INPUT_PCM_CAPTURE1);
22459
22460 //aac enc setup gain
22461 API_AUDIO_CUSTOMER_AENC_SetGain(API_AUDIO_CUSTOMER_AENC_ENCODE_AAC, (MS_U32)919);//0dB
22462
22463 //aac enc start
22464 API_AUDIO_CUSTOMER_AENC_Start(API_AUDIO_CUSTOMER_AENC_ENCODE_AAC);
22465 }
22466 break;
22467 case 0x02:
22468 {
22469 //aac enc Stop
22470 API_AUDIO_CUSTOMER_AENC_Stop(API_AUDIO_CUSTOMER_AENC_ENCODE_AAC);
22471 }
22472 break;
22473 case 0x9999:
22474 {
22475 //Exit
22476 }
22477 break;
22478
22479 default:
22480 break;
22481 }
22482 }
22483 #endif
22484 }
22485 break;
22486
22487 case 0x0102:
22488 {
22489 int selNum_clipDec = 0;
22490 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = API_AUDIO_CUSTOMER_ADEC0;
22491 MS_U32 repeatNum = 1;
22492
22493 while(selNum_clipDec != 0x9999)
22494 {
22495 AU_nPRINT("============================================= \n");
22496 AU_nPRINT("** CLIP Decoder play ** \n");
22497 AU_nPRINT("============================================= \n");
22498 AU_nPRINT("0x01 Start \n");
22499 AU_nPRINT("0x02 Stop \n");
22500 AU_nPRINT("0x03 Pause \n");
22501 AU_nPRINT("0x04 Resume \n");
22502 AU_nPRINT("9999 Exit \n");
22503 selNum_clipDec = AU_CUS_Debug_GetHex("");
22504
22505 switch(selNum_clipDec)
22506 {
22507 case 0x01:
22508 {
22509 API_AUDIO_CUSTOMER_CH_INPUT chInput = API_AUDIO_CUSTOMER_CH_INPUT_ADEC0;
22510
22511 AU_nPRINT(" Enter ADEC index (0: ADEC0, 1: ADEC1) \n");
22512 adecIndex = AU_CUS_Debug_GetHex("");
22513
22514 if(adecIndex == API_AUDIO_CUSTOMER_ADEC0 || adecIndex == API_AUDIO_CUSTOMER_ADEC1)
22515 {
22516 switch(adecIndex)
22517 {
22518 case API_AUDIO_CUSTOMER_ADEC0:
22519 {
22520 chInput = API_AUDIO_CUSTOMER_CH_INPUT_ADEC0;
22521 }
22522 break;
22523
22524 case API_AUDIO_CUSTOMER_ADEC1:
22525 {
22526 chInput = API_AUDIO_CUSTOMER_CH_INPUT_ADEC1;
22527 }
22528 break;
22529
22530 default:
22531 break;
22532 }
22533
22534 AU_nPRINT(" Enter repeat time \n");
22535 repeatNum = AU_CUS_Debug_GetHex("");
22536
22537 //Connect ADEC
22538 API_AUDIO_CUSTOMER_ADEC_Connect(adecIndex, API_AUDIO_CUSTOMER_ADEC_INPUT_CLIP);
22539
22540 //Set Codec Type
22541 API_AUDIO_CUSTOMER_SetCodecType(adecIndex, API_AUDIO_CUSTOMER_CODEC_TYPE_MPEG);
22542
22543 //CH5 input connect
22544 API_AUDIO_CUSTOMER_CH_Sound_Connect(API_AUDIO_CUSTOMER_CH5_SOUND, chInput);
22545
22546 //FW mixer0 connect
22547 API_AUDIO_CUSTOMER_FW_MIXER_Connect(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5);
22548
22549 //FW mixer0 channel unmute
22550 API_AUDIO_CUSTOMER_SetFWMixerChannelMute(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5, FALSE);
22551
22552 //Play clip decoder
22553 API_AUDIO_CUSTOMER_CLIP_DEC_PARAM clipInfo;
22554 pfnAudioCustomerAdecoderClipDone pfnCallBack;
22555
22556 AU_UNUSED(clipInfo);
22557 AU_UNUSED(pfnCallBack);
22558
22559 clipInfo.clipType = API_AUDIO_CUSTOMER_CODEC_TYPE_MPEG;
22560 clipInfo.repeatNumber = repeatNum;
22561 pfnCallBack = &API_AUDIO_CUSTOMER_StopClipDecoder;
22562
22563 //API_AUDIO_CUSTOMER_PlayClipDecoder(adecIndex, clipInfo, MPEG_BIN_SIZE, (void *)mpeg_bin_var, pfnCallBack);
22564 }
22565 else
22566 {
22567 AU_nPRINT(" Invalid ADEC index \n");
22568 }
22569 }
22570 break;
22571
22572 case 0x02:
22573 {
22574 AU_nPRINT(" Enter ADEC index (0: ADEC0, 1: ADEC1) \n");
22575 adecIndex = AU_CUS_Debug_GetHex("");
22576
22577 if(adecIndex == API_AUDIO_CUSTOMER_ADEC0 || adecIndex == API_AUDIO_CUSTOMER_ADEC1)
22578 {
22579 //Stop clip decoder
22580 API_AUDIO_CUSTOMER_StopClipDecoder(adecIndex);
22581 }
22582 else
22583 {
22584 AU_nPRINT(" Invalid ADEC index \n");
22585 }
22586 }
22587 break;
22588
22589 case 0x03:
22590 {
22591 AU_nPRINT(" Enter ADEC index (0: ADEC0, 1: ADEC1) \n");
22592 adecIndex = AU_CUS_Debug_GetHex("");
22593
22594 if(adecIndex == API_AUDIO_CUSTOMER_ADEC0 || adecIndex == API_AUDIO_CUSTOMER_ADEC1)
22595 {
22596 //Pause clip decoder
22597 API_AUDIO_CUSTOMER_PauseClipDecoder(adecIndex);
22598 }
22599 else
22600 {
22601 AU_nPRINT(" Invalid ADEC index \n");
22602 }
22603 }
22604 break;
22605
22606 case 0x04:
22607 {
22608 AU_nPRINT(" Enter ADEC index (0: ADEC0, 1: ADEC1) \n");
22609 adecIndex = AU_CUS_Debug_GetHex("");
22610
22611 if(adecIndex == API_AUDIO_CUSTOMER_ADEC0 || adecIndex == API_AUDIO_CUSTOMER_ADEC1)
22612 {
22613 //Resume clip decoder
22614 API_AUDIO_CUSTOMER_ResumeClipDecoder(adecIndex);
22615 }
22616 else
22617 {
22618 AU_nPRINT(" Invalid ADEC index \n");
22619 }
22620 }
22621 break;
22622
22623 case 0x9999:
22624 {
22625 //Exit
22626 }
22627 break;
22628
22629 default:
22630 break;
22631 }
22632 }
22633 }
22634 break;
22635
22636 case 0x0103:
22637 {
22638 int selNum = -1;
22639 int PCMCapture_Index = -1;
22640 int PCMCapture_Input = -1;
22641 int PCMCapture_Source_Dump_To_File_bEnable = 0;
22642 MS_U32 request_ms = 50;
22643
22644 while(selNum != 0x9999)
22645 {
22646 AU_nPRINT("============================================= \n");
22647 AU_nPRINT("** PCM_CAPTURE ** \n");
22648 AU_nPRINT("============================================= \n");
22649 AU_nPRINT("(SHOW) selNum_PCMCapture_Index (%d) \n", PCMCapture_Index);
22650 AU_nPRINT("(SHOW) selNum_PCMCapture_Input (%d) \n", PCMCapture_Input);
22651 AU_nPRINT("(SHOW) pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE_Source_Dump_to_file_bEnable (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE_Source_Dump_to_file_bEnable);
22652 AU_nPRINT("(SHOW) pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE_Request_data_in_byte (%d) request_ms*48*2*2 \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE_Request_data_in_byte);
22653 AU_nPRINT("============================================= \n");
22654 AU_nPRINT("0x01 Start \n");
22655 AU_nPRINT("0x02 Stop \n");
22656 AU_nPRINT("9999 Exit \n");
22657 selNum = AU_CUS_Debug_GetHex("");
22658
22659 switch(selNum)
22660 {
22661 case 0x01:
22662 {
22663 AU_nPRINT(" Capture Index (0~2: Capture 0~2) \n");
22664 PCMCapture_Index = AU_CUS_Debug_GetHex("");
22665
22666 AU_nPRINT(" Capture Input (0~7) \n");
22667 AU_nPRINT(" 0: API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_CH5 \n");
22668 AU_nPRINT(" 1: API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_CH6 \n");
22669 AU_nPRINT(" 2: API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_CH7 \n");
22670 AU_nPRINT(" 3: API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_CH8 \n");
22671 AU_nPRINT(" 4: API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_PCM \n");
22672 AU_nPRINT(" 5: API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_PCM_DELAY \n");
22673 AU_nPRINT(" 6: API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_PCM_SE \n");
22674 AU_nPRINT(" 7: API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_MIXER \n");
22675 PCMCapture_Input = AU_CUS_Debug_GetHex("");
22676
22677 AU_nPRINT(" Capture source dump to file (for debuging check) (0: No, 1: Yes) \n");
22678 PCMCapture_Source_Dump_To_File_bEnable = AU_CUS_Debug_GetHex("");
22679 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE_Source_Dump_to_file_bEnable = (MS_BOOL)PCMCapture_Source_Dump_To_File_bEnable;
22680
22681 AU_nPRINT(" Set Request Size In Ms: \n");
22682 request_ms = AU_CUS_Debug_GetDec();
22683
22684 //PCM capture Set Request size in MS
22685 API_AUDIO_CUSTOMER_PCM_SetRequestSizeInMs(request_ms);
22686
22687 //PCM capture connect
22688 API_AUDIO_CUSTOMER_PCM_CAPTURE_Connect((API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX)PCMCapture_Index, (API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT)PCMCapture_Input);
22689
22690 //Setup callback function
22691 API_AUDIO_CUSTOMER_PCM_RegisterSendPCMCallback((API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX)PCMCapture_Index, (pfnAudioCustomerPCMSending)&AU_CUS_Demo_PCM_Capture_CallBackFun);
22692
22693 //PCM capture setup gain
22694 API_AUDIO_CUSTOMER_PCM_SetGain((API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX)PCMCapture_Index, (MS_U32)919);//0dB
22695
22696 //PCM start upload
22697 API_AUDIO_CUSTOMER_PCM_StartUpload((API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX)PCMCapture_Index);
22698 }
22699 break;
22700
22701 case 0x02:
22702 {
22703 //PCM Stop
22704 API_AUDIO_CUSTOMER_PCM_StopUpload(API_AUDIO_CUSTOMER_PCM_CAPTURE0);
22705 }
22706 break;
22707
22708 case 0x9999:
22709 {
22710 //Exit
22711 }
22712 break;
22713
22714 default:
22715 break;
22716 }
22717 }
22718 }
22719 break;
22720
22721 case 0x0104:
22722 {
22723 int selNum = 0;
22724 int SampleRate = 0;
22725 char* pInput_File_Name = NULL;
22726
22727 while(selNum != 0x9999)
22728 {
22729 AU_nPRINT("============================================= \n");
22730 AU_nPRINT("** PCM IO Write ** \n");
22731 AU_nPRINT("============================================= \n");
22732 AU_nPRINT("0x01 Start \n");
22733 AU_nPRINT("0x02 Stop \n");
22734 AU_nPRINT("9999 Exit \n");
22735
22736 selNum = AU_CUS_Debug_GetHex("");
22737
22738 switch(selNum)
22739 {
22740 case 0x01:
22741 {
22742 char usbMountPathString[256];
22743
22744 if(pstAudioCustomerShmData->g_audio_customer_scanf_bSupport)
22745 {
22746 strcpy( usbMountPathString, "/mnt/sda1/");
22747 }
22748 else
22749 {
22750 strcpy( usbMountPathString, "/media/ext1:/");
22751 }
22752
22753 AU_nPRINT("======================= PCM-IO ======================= \n");
22754 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/5000Hz_0dB-16bit-48000_tone.wav \n", usbMountPathString);
22755 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-6000.wav \n", usbMountPathString);
22756 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-8000.wav \n", usbMountPathString);
22757 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-11025.wav \n", usbMountPathString);
22758 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-16000.wav \n", usbMountPathString);
22759 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-22050.wav \n", usbMountPathString);
22760 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-32000.wav \n", usbMountPathString);
22761 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-44100.wav \n", usbMountPathString);
22762 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-48000.wav \n", usbMountPathString);
22763 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-64000.wav \n", usbMountPathString);
22764 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-88200.wav \n", usbMountPathString);
22765 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-96000.wav \n", usbMountPathString);
22766 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-0dB-16bit-192000.wav \n", usbMountPathString);
22767 AU_nPRINT("%s_Bifrost_Audio_only/XPCM/Cool_Edit_tone-minus20dB-16bit-48000.wav \n", usbMountPathString);
22768 AU_nPRINT("%s_Bifrost_Audio_only/PCMIO/MoodyLoop.wav \n", usbMountPathString);
22769 AU_nPRINT("%s_Bifrost_Audio_only/PCMIO/NTS_AUDIO-006-TC1.pcm \n", usbMountPathString);
22770 AU_nPRINT("%s_Bifrost_Audio_only/PCMIO/OUT2.wav \n", usbMountPathString);
22771 AU_nPRINT("%s_Bifrost_Audio_only/PCMIO/PCM_48KHz_16bit_stereo.pcm \n", usbMountPathString);
22772 AU_nPRINT("%s_Bifrost_Audio_only/PCMIO/Sine.pcm \n", usbMountPathString);
22773
22774 AU_nPRINT(" Enter input file path: \n");
22775 pInput_File_Name = AU_CUS_Debug_GetString();
22776
22777 //handle audio input file
22778 pAU_debug_input_file2 = AU_CUS_FileOpen(pInput_File_Name, "rb");
22779 if (pAU_debug_input_file2 == NULL)
22780 {
22781 AU_nPRINT("Open file FAIL!!\n");
22782 break;
22783 }
22784 fseek(pAU_debug_input_file2, 0, SEEK_END);
22785 pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_input_file_length = ftell(pAU_debug_input_file2);
22786 rewind(pAU_debug_input_file2);
22787 AU_nPRINT("pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_input_file_length = %d\n", pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_input_file_length);
22788
22789 //copy input file to readin buffer
22790 MS_U32 WrtBytes;
22791 AU_UNUSED(WrtBytes);
22792 AU_Demo_MM_File_read_in_buffer2 = AU_CUS_MemoryAlloc(pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_input_file_length);
22793 WrtBytes = fread(AU_Demo_MM_File_read_in_buffer2, 1, pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_input_file_length, pAU_debug_input_file2);
22794
22795 AU_nPRINT("Sample Rate (44100, 48000, 88200, 96000...): \n");
22796 SampleRate = AU_CUS_Debug_GetDec();
22797
22798 AU_nPRINT("Enter repeat time: \n");
22799 pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_repeatNum = AU_CUS_Debug_GetHex("");
22800
22801 memset((void *)&pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_pcmParam, 0x00, sizeof(API_AUDIO_CUSTOMER_PCMIO_PARAM));
22802 strcpy((char*)pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_pcmParam.u8Name, AU_HW_DMA_READER1);
22803 pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_pcmParam.u32BigEndian = 0;
22804 pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_pcmParam.u32BitWidth = 16;
22805 pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_pcmParam.u32BufferDuration = 80;
22806 pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_pcmParam.u32Channel = 2;
22807 pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_pcmParam.u32SampleRate = SampleRate;
22808 pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_pcmParam.u8MultiChFlag = 0;
22809
22810 //Enable PCMIO play monitor
22811 pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_UpperPlay = API_AUDIO_CUSTOMER_UPPER_PLAY;
22812 }
22813 break;
22814
22815 case 0x02:
22816 {
22817 MS_S32 s32DeviceId = 0;
22818
22819 AU_nPRINT(" Enter Device ID \n");
22820 s32DeviceId = AU_CUS_Debug_GetDec();
22821
22822 pstAudioCustomerShmData->g_audio_customer_AU_Demo_PCMIO_UpperPlay = API_AUDIO_CUSTOMER_UPPER_STOP;
22823
22824 AU_CUS_FileClose(pAU_debug_input_file2);
22825 AU_CUS_MemoryFree((void *)AU_Demo_MM_File_read_in_buffer2);
22826
22827 API_AUDIO_CUSTOMER_PCM_Stop(s32DeviceId);
22828 API_AUDIO_CUSTOMER_PCM_Flush(s32DeviceId);
22829 API_AUDIO_CUSTOMER_PCM_Close(s32DeviceId);
22830 }
22831 break;
22832
22833 case 0x9999:
22834 {
22835 //Exit
22836 }
22837 break;
22838
22839 default:
22840 break;
22841 }
22842 }
22843 }
22844 break;
22845
22846 case 0x0105:
22847 {
22848 API_AUDIO_CUSTOMER_ADEC_PCM_PATH AdecPcmPath = 0;
22849 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = API_AUDIO_CUSTOMER_ADEC_INDEX_INVALID;
22850 API_AUDIO_CUSTOMER_CODEC_TYPE codecType = API_AUDIO_CUSTOMER_CODEC_TYPE_INVALID;
22851 MS_BOOL ADEC_EOSCallback_bRegister = FALSE;
22852 MS_BOOL ADEC_UnderrunCallback_bRegister = FALSE;
22853 MS_U32 ADEC_UnderrunThreshold = 0;
22854 MS_U32 ADEC_UnderrunDebounceCnt = 0;
22855
22856 MS_U32 repeatNum = 1;
22857 int selNum_clipDec = 0;
22858 char* pInput_File_Name = NULL;
22859 int input_file_length = 0;
22860 int bDTSbypass = FALSE;
22861 int syncMode = 0;
22862 MS_U64 u64STCset = 0;
22863
22864 while(selNum_clipDec != 0x9999)
22865 {
22866 AU_nPRINT("=====================================================================================\n");
22867 AU_nPRINT("** AU Demo Play All MM File (Audio only) ** \n");
22868 AU_nPRINT("=====================================================================================\n");
22869 AU_nPRINT("(SHOW) File Path (%s) \n", pInput_File_Name);
22870 AU_nPRINT("(SHOW) AdecPcmPath (%d) \n", AdecPcmPath);
22871 AU_nPRINT("(SHOW) pstAudioCustomerShmData->g_audio_customer_ADEC0_End_Of_Stream_bRegister (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC0_End_Of_Stream_bRegister);
22872 AU_nPRINT("(SHOW) pstAudioCustomerShmData->g_audio_customer_ADEC1_End_Of_Stream_bRegister (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC1_End_Of_Stream_bRegister);
22873 AU_nPRINT("=====================================================================================\n");
22874 AU_nPRINT("(0x00) pstAudioCustomerShmData->g_audio_customer_ADEC_End_Of_Stream_TimeOutCnt (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC_End_Of_Stream_TimeOutCnt);
22875 AU_nPRINT("(0x01) Start \n");
22876 AU_nPRINT("(0x02) Stop \n");
22877 AU_nPRINT("(0x03) Pause \n");
22878 AU_nPRINT("(0x04) Resume \n");
22879 AU_nPRINT("(0x05) pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_pts_offset (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_pts_offset);
22880 AU_nPRINT("(9999) Exit \n");
22881 selNum_clipDec = AU_CUS_Debug_GetHex("");
22882
22883 switch(selNum_clipDec)
22884 {
22885 case 0x00:
22886 {
22887 unsigned int arg1 = 0;
22888 AU_nPRINT("g_audio_customer_ADEC_End_Of_Stream_TimeOutCnt:\n");
22889 arg1 = AU_CUS_Debug_GetDec();
22890
22891 pstAudioCustomerShmData->g_audio_customer_ADEC_End_Of_Stream_TimeOutCnt = arg1;
22892 }
22893 break;
22894
22895 case 0x01:
22896 {
22897 API_AUDIO_CUSTOMER_CH_INPUT chInput = API_AUDIO_CUSTOMER_CH_INPUT_ADEC0;
22898
22899 AU_CUS_Show_Bifrost_Test_File_Option();
22900 pInput_File_Name = AU_CUS_Debug_GetString();
22901
22902 //handle audio input file
22903 pAU_debug_input_file = AU_CUS_FileOpen(pInput_File_Name, "rb");
22904 if (pAU_debug_input_file == NULL)
22905 {
22906 AU_nPRINT("Open file FAIL!!\n");
22907 break;
22908 }
22909 fseek(pAU_debug_input_file, 0, SEEK_END);
22910 input_file_length = ftell(pAU_debug_input_file);
22911 rewind(pAU_debug_input_file);
22912 AU_nPRINT(" input_file_length = %d\n", input_file_length);
22913
22914 AU_nPRINT(" Enter ADEC index (0: ADEC0, 1: ADEC1) \n");
22915 adecIndex = AU_CUS_Debug_GetHex("");
22916
22917 AU_CUS_Show_Codec_Type_Option();
22918 codecType = AU_CUS_Debug_GetDec();
22919
22920 if(adecIndex == API_AUDIO_CUSTOMER_ADEC0 || adecIndex == API_AUDIO_CUSTOMER_ADEC1)
22921 {
22922 switch(adecIndex)
22923 {
22924 case API_AUDIO_CUSTOMER_ADEC0:
22925 {
22926 chInput = API_AUDIO_CUSTOMER_CH_INPUT_ADEC0;
22927 }
22928 break;
22929
22930 case API_AUDIO_CUSTOMER_ADEC1:
22931 {
22932 chInput = API_AUDIO_CUSTOMER_CH_INPUT_ADEC1;
22933 }
22934 break;
22935
22936 default:
22937 break;
22938 }
22939 AU_nPRINT(" Enter ADEC PCM Path (0:DSP_SRC, 1:MCU) \n");
22940 AdecPcmPath = AU_CUS_Debug_GetHex("");
22941
22942 AU_nPRINT(" Enter repeat time \n");
22943 repeatNum = AU_CUS_Debug_GetHex("");
22944
22945 AU_nPRINT(" Register ADEC EOS Callback (0:NO, 1:YES) \n");
22946 ADEC_EOSCallback_bRegister = AU_CUS_Debug_GetHex("");
22947
22948 AU_nPRINT(" Register ADEC Underrun Callback (0:NO, 1:YES) \n");
22949 ADEC_UnderrunCallback_bRegister = AU_CUS_Debug_GetHex("");
22950
22951 //Set pts offset
22952 if(syncMode == TRUE)
22953 {
22954 AU_nPRINT(" Enter pts offset: \n");
22955 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_pts_offset = AU_CUS_Debug_GetDec();
22956 }
22957
22958 //ADEC Connect
22959 API_AUDIO_CUSTOMER_ADEC_Connect(adecIndex, API_AUDIO_CUSTOMER_ADEC_INPUT_MM);
22960
22961 //Step1: Set codec type (for DecID)
22962 API_AUDIO_CUSTOMER_SetCodecType(adecIndex, codecType);
22963
22964 //check some codec need additinal parser.
22965 switch(codecType)
22966 {
22967 case API_AUDIO_CUSTOMER_CODEC_TYPE_DTS:
22968 {
22969 #if(DTS_AUDIO_PARSER_ENABLE)
22970 {
22971 AU_nPRINT(" DTS Bypass (0:Decode, 1:Bypass) \n");
22972 bDTSbypass = AU_CUS_Debug_GetHex("");
22973
22974 if(bDTSbypass)
22975 {
22976 API_AUDIO_CUSTOMER_SPDIF_TX_SetOutputType(API_AUDIO_CUSTOMER_SPDIF_TX_AUTO);
22977 API_AUDIO_CUSTOMER_HDMI_TX_SetOutputType(API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_NONPCM);
22978 }
22979 else
22980 {
22981 AU_CUS_DTS_Parser_ParseInputFile(pInput_File_Name);
22982 }
22983
22984 }
22985 #endif //#if(DTS_AUDIO_PARSER_ENABLE)
22986 }
22987 break;
22988
22989 case API_AUDIO_CUSTOMER_CODEC_TYPE_WMA:
22990 case API_AUDIO_CUSTOMER_CODEC_TYPE_WMA_PRO:
22991 {
22992 #if(WMA_AUDIO_PARSER_ENABLE)
22993 {
22994 input_file_length = AU_CUS_WMA_Parser_ParseInputFile(pInput_File_Name, input_file_length);
22995 }
22996 #endif //#if(WMA_AUDIO_PARSER_ENABLE)
22997 }
22998 break;
22999
23000 case API_AUDIO_CUSTOMER_CODEC_TYPE_XPCM:
23001 {
23002 #if(XPCM_AUDIO_PARSER_ENABLE)
23003 {
23004 AU_CUS_XPCM_Parser_ParseInputFile();
23005 }
23006 #endif //#if(XPCM_AUDIO_PARSER_ENABLE)
23007 }
23008 break;
23009
23010 case API_AUDIO_CUSTOMER_CODEC_TYPE_ESBypass:
23011 {
23012 int delaySample = 0;
23013 int pcm_samplerate = 48000;
23014 int hdmi_samplerate = 192000;
23015
23016 AU_nPRINT(" delaySample: (ex: 0) \n");
23017 delaySample = AU_CUS_Debug_GetDec();
23018
23019 AU_nPRINT(" pcm_samplerate: (ex: 48000) \n");
23020 pcm_samplerate = AU_CUS_Debug_GetDec();
23021
23022 AU_nPRINT(" hdmi_samplerate: (ex: 192000) \n");
23023 hdmi_samplerate = AU_CUS_Debug_GetDec();
23024
23025 API_AUDIO_CUSTOMIZED_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_PARAM_ES_PASSTHROUGH_DELAY_SAMPLE, &delaySample);
23026 API_AUDIO_CUSTOMIZED_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_PARAM_ES_PASSTHROUGH_PCM_SAMPLERATE, &pcm_samplerate);
23027 API_AUDIO_CUSTOMIZED_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_PARAM_ES_PASSTHROUGH_HDMI_SAMPLERATE, &hdmi_samplerate);
23028 }
23029
23030 default:
23031 {
23032 //no need additinal parser
23033 }
23034 break;
23035 }
23036
23037 //copy input file to readin buffer
23038 MS_U32 WrtBytes;
23039 AU_UNUSED(WrtBytes);
23040 AU_Demo_MM_File_read_in_buffer = AU_CUS_MemoryAlloc(input_file_length);
23041 WrtBytes = fread(AU_Demo_MM_File_read_in_buffer, 1, input_file_length, pAU_debug_input_file);
23042
23043 switch(AdecPcmPath)
23044 {
23045 case API_AUDIO_CUSTOMER_ADEC_PCM_PATH_DSP_SRC:
23046 {
23047 //Set Adec Pcm output path
23048 API_AUDIO_CUSTOMER_SetAdecPcmPath(adecIndex, API_AUDIO_CUSTOMER_ADEC_PCM_PATH_DSP_SRC);
23049 }
23050 break;
23051
23052 case API_AUDIO_CUSTOMER_ADEC_PCM_PATH_MCU:
23053 {
23054 pAU_Demo_MM_New_Mode_AdecPcmDump = AU_CUS_FileOpen(AU_DEMO_MM_NEW_MODE_GET_PCM_FILE_PATH, "wb");
23055
23056 //Set Adec Pcm output path
23057 API_AUDIO_CUSTOMER_SetAdecPcmPath(adecIndex, API_AUDIO_CUSTOMER_ADEC_PCM_PATH_MCU);
23058
23059 //Regist Adec Pcm decode done function
23060 API_AUDIO_CUSTOMER_AdecRegisterDecodeDoneCallback((pfnAudioCustomerAdecDecodeDone)&AU_CUS_Demo_MM_New_Mode_AdecPcmCallBackFun);
23061 }
23062 break;
23063
23064 default:
23065 break;
23066 }
23067
23068 if(ADEC_EOSCallback_bRegister)
23069 {
23070 //Register ADEC EOS Callback function
23071 API_AUDIO_CUSTOMER_AdecRegisterEndOfStreamCallback(adecIndex, (pfnAudioCustomerAdecEndOfStream)&AU_CUS_Demo_MM_New_Mode_EndOfStreamCallBackFun);
23072 }
23073
23074 if(ADEC_UnderrunCallback_bRegister)
23075 {
23076 AU_nPRINT(" Underrund threshold (in ms): (ex: 30) \n");
23077 ADEC_UnderrunThreshold = AU_CUS_Debug_GetDec();
23078
23079 AU_nPRINT(" Underrund Debounce cnt: (ex: 10) \n");
23080 ADEC_UnderrunDebounceCnt = AU_CUS_Debug_GetDec();
23081
23082 //Set Underrun threshold
23083 void* pParam = &ADEC_UnderrunThreshold;
23084 API_AUDIO_CUSTOMER_SetAudioParam(adecIndex, API_AUDIO_CUSTOMER_ADEC_PARAM_UNDERRUN_THRESHOLD_IN_MS, pParam);
23085
23086 //Set Underrun debounce cnt
23087 pParam = &ADEC_UnderrunDebounceCnt;
23088 API_AUDIO_CUSTOMER_SetAudioParam(adecIndex, API_AUDIO_CUSTOMER_ADEC_PARAM_UNDERRUN_DEBOUNCE_CNT, pParam);
23089
23090 //Register ADEC Underrun Callback function
23091 API_AUDIO_CUSTOMER_AdecRegisterUnderrunCallback(adecIndex, (pfnAudioCustomerAdecUnderrun)&AU_CUS_Demo_MM_New_Mode_AdecUnderrunCallBackFun);
23092 }
23093
23094 //Play MM New Mode decoder
23095 API_AUDIO_CUSTOMER_CLIP_DEC_PARAM clipInfo;
23096 clipInfo.clipType = codecType;
23097 clipInfo.repeatNumber = repeatNum;
23098 AU_CUS_Demo_MM_New_Mode_Play(adecIndex, clipInfo, input_file_length, (void *)AU_Demo_MM_File_read_in_buffer);
23099
23100 if(syncMode)
23101 {
23102 AU_nPRINT(" Sync mode on \n");
23103 }
23104 else
23105 {
23106 AU_nPRINT(" Sync mode off \n");
23107 }
23108 API_AUDIO_CUSTOMER_SetSyncMode(adecIndex, (MS_BOOL)syncMode);
23109
23110 //CH5 input connect
23111 API_AUDIO_CUSTOMER_CH_Sound_Connect(API_AUDIO_CUSTOMER_CH5_SOUND, chInput);
23112
23113 //FW mixer0 connect
23114 API_AUDIO_CUSTOMER_FW_MIXER_Connect(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5);
23115
23116 //FW mixer0 channel unmute
23117 API_AUDIO_CUSTOMER_SetFWMixerChannelMute(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5, FALSE);
23118
23119 //Set STC
23120 if(syncMode == TRUE)
23121 {
23122 u64STCset = MsOS_GetSystemTime() * 90;
23123 AU_nPRINT(" u64STCset = %-9lld \n", u64STCset);
23124 AU_nPRINT(" u64STCset = %-9lld ms \n", AU_CUS_long_div(u64STCset, 90));
23125 MApi_DMX_Stc_Set((MS_U32)(u64STCset>>32) , (MS_U32)u64STCset);
23126 }
23127
23128 }
23129 else
23130 {
23131 AU_nPRINT(" Invalid ADEC index \n");
23132 }
23133 }
23134 break;
23135
23136 case 0x02:
23137 {
23138 AU_nPRINT(" Enter ADEC index (0: ADEC0, 1: ADEC1) \n");
23139 adecIndex = AU_CUS_Debug_GetHex("");
23140
23141 if(adecIndex == API_AUDIO_CUSTOMER_ADEC0 || adecIndex == API_AUDIO_CUSTOMER_ADEC1)
23142 {
23143 //Stop MM New Mode decoder
23144 AU_CUS_Demo_MM_New_Mode_Stop(adecIndex);
23145
23146 //Free memory
23147 AU_CUS_MemoryFree((void *)AU_Demo_MM_File_read_in_buffer);
23148 }
23149 else
23150 {
23151 AU_nPRINT(" Invalid ADEC index \n");
23152 }
23153 }
23154 break;
23155
23156 case 0x03:
23157 {
23158 AU_nPRINT(" Enter ADEC index (0: ADEC0, 1: ADEC1) \n");
23159 adecIndex = AU_CUS_Debug_GetHex("");
23160
23161 if(adecIndex == API_AUDIO_CUSTOMER_ADEC0 || adecIndex == API_AUDIO_CUSTOMER_ADEC1)
23162 {
23163 //Pause MM New Mode decoder
23164 AU_CUS_Demo_MM_New_Mode_Pause(adecIndex);
23165 }
23166 else
23167 {
23168 AU_nPRINT(" Invalid ADEC index \n");
23169 }
23170 }
23171 break;
23172
23173 case 0x04:
23174 {
23175 AU_nPRINT(" Enter ADEC index (0: ADEC0, 1: ADEC1) \n");
23176 adecIndex = AU_CUS_Debug_GetHex("");
23177
23178 if(adecIndex == API_AUDIO_CUSTOMER_ADEC0 || adecIndex == API_AUDIO_CUSTOMER_ADEC1)
23179 {
23180 //Resume MM New Mode decoder
23181 AU_CUS_Demo_MM_New_Mode_Resume(adecIndex);
23182 }
23183 else
23184 {
23185 AU_nPRINT(" Invalid ADEC index \n");
23186 }
23187 }
23188 break;
23189
23190 case 0x05:
23191 {
23192 unsigned int arg1 = 0;
23193 AU_nPRINT("g_audio_customer_AU_AV_Sync_Info_pts_offset:\n");
23194 arg1 = AU_CUS_Debug_GetDec();
23195
23196 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_pts_offset = arg1;
23197 }
23198 break;
23199
23200 case 0x9999:
23201 {
23202 //Exit
23203 }
23204 break;
23205
23206 default:
23207 break;
23208 }
23209 }
23210 }
23211 break;
23212
23213 case 0x0106:
23214 {
23215 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = API_AUDIO_CUSTOMER_ADEC_INDEX_INVALID;
23216 API_AUDIO_CUSTOMER_CODEC_TYPE codecType = API_AUDIO_CUSTOMER_CODEC_TYPE_INVALID;
23217
23218 MS_U32 repeatNum = 1;
23219 int selNum_clipDec = 0;
23220 char* pInput_File_Name = NULL;
23221 int input_file_length = 0;
23222
23223 while(selNum_clipDec != 0x9999)
23224 {
23225 AU_nPRINT("=====================================================================================\n");
23226 AU_nPRINT("** AU Demo Play All MM AD File (Audio only) ** \n");
23227 AU_nPRINT("=====================================================================================\n");
23228 AU_nPRINT("(SHOW) File Path (%s) \n", pInput_File_Name);
23229 AU_nPRINT("=====================================================================================\n");
23230 AU_nPRINT("(0x01) Start \n");
23231 AU_nPRINT("(0x02) Stop \n");
23232 AU_nPRINT("(0x03) Pause \n");
23233 AU_nPRINT("(0x04) Resume \n");
23234 AU_nPRINT("(9999) Exit \n");
23235 selNum_clipDec = AU_CUS_Debug_GetHex("");
23236
23237 switch(selNum_clipDec)
23238 {
23239 case 0x01:
23240 {
23241 API_AUDIO_CUSTOMER_CH_INPUT chInput = API_AUDIO_CUSTOMER_CH_INPUT_ADEC0;
23242 AU_UNUSED(chInput);
23243
23244 AU_CUS_Show_Bifrost_Test_File_Option();
23245 pInput_File_Name = AU_CUS_Debug_GetString();
23246
23247 //handle audio input file
23248 pAU_debug_input_file3 = AU_CUS_FileOpen(pInput_File_Name, "rb");
23249 if (pAU_debug_input_file3 == NULL)
23250 {
23251 AU_nPRINT("Open file FAIL!!\n");
23252 break;
23253 }
23254 fseek(pAU_debug_input_file3, 0, SEEK_END);
23255 input_file_length = ftell(pAU_debug_input_file3);
23256 rewind(pAU_debug_input_file3);
23257 AU_nPRINT(" input_file_length = %d\n", input_file_length);
23258
23259 AU_nPRINT(" Enter ADEC index (0: ADEC0, 1: ADEC1) \n");
23260 adecIndex = AU_CUS_Debug_GetHex("");
23261
23262 AU_CUS_Show_Codec_Type_Option();
23263 codecType = AU_CUS_Debug_GetDec();
23264
23265 if(adecIndex == API_AUDIO_CUSTOMER_ADEC0 || adecIndex == API_AUDIO_CUSTOMER_ADEC1)
23266 {
23267 switch(adecIndex)
23268 {
23269 case API_AUDIO_CUSTOMER_ADEC0:
23270 {
23271 chInput = API_AUDIO_CUSTOMER_CH_INPUT_ADEC0;
23272 }
23273 break;
23274
23275 case API_AUDIO_CUSTOMER_ADEC1:
23276 {
23277 chInput = API_AUDIO_CUSTOMER_CH_INPUT_ADEC1;
23278 }
23279 break;
23280
23281 default:
23282 break;
23283 }
23284
23285 AU_nPRINT(" Enter repeat time \n");
23286 repeatNum = AU_CUS_Debug_GetHex("");
23287
23288 //Step 1: enable AD Play cmd
23289 API_AUDIO_CUSTOMER_SetAudioDescription(adecIndex, TRUE);
23290
23291 //copy input file to readin buffer
23292 MS_U32 WrtBytes;
23293 AU_UNUSED(WrtBytes);
23294 AU_Demo_MM_File_read_in_buffer3 = AU_CUS_MemoryAlloc(input_file_length);
23295 WrtBytes = fread(AU_Demo_MM_File_read_in_buffer3, 1, input_file_length, pAU_debug_input_file3);
23296
23297 //Play MM New Mode AD
23298 API_AUDIO_CUSTOMER_CLIP_DEC_PARAM clipInfo;
23299 clipInfo.clipType = codecType;
23300 clipInfo.repeatNumber = repeatNum;
23301
23302 AU_CUS_Demo_MM_New_Mode_AD_Play(adecIndex, clipInfo, input_file_length, (void *)AU_Demo_MM_File_read_in_buffer3);
23303 }
23304 else
23305 {
23306 AU_nPRINT(" Invalid ADEC index \n");
23307 }
23308 }
23309 break;
23310
23311 case 0x02:
23312 {
23313 AU_nPRINT(" Enter ADEC index (0: ADEC0, 1: ADEC1) \n");
23314 adecIndex = AU_CUS_Debug_GetHex("");
23315
23316 if(adecIndex == API_AUDIO_CUSTOMER_ADEC0 || adecIndex == API_AUDIO_CUSTOMER_ADEC1)
23317 {
23318 //disable AD function.
23319 API_AUDIO_CUSTOMER_SetAudioDescription(adecIndex, FALSE);
23320
23321 //Stop MM New Mode decoder
23322 AU_CUS_Demo_MM_New_Mode_AD_Stop(adecIndex);
23323
23324 //Free memory
23325 AU_CUS_MemoryFree((void *)AU_Demo_MM_File_read_in_buffer3);
23326 }
23327 else
23328 {
23329 AU_nPRINT(" Invalid ADEC index \n");
23330 }
23331 }
23332 break;
23333
23334 case 0x03:
23335 {
23336 AU_nPRINT(" Enter ADEC index (0: ADEC0, 1: ADEC1) \n");
23337 adecIndex = AU_CUS_Debug_GetHex("");
23338
23339 if(adecIndex == API_AUDIO_CUSTOMER_ADEC0 || adecIndex == API_AUDIO_CUSTOMER_ADEC1)
23340 {
23341 //Pause MM New Mode decoder
23342 AU_CUS_Demo_MM_New_Mode_AD_Pause(adecIndex);
23343 }
23344 else
23345 {
23346 AU_nPRINT(" Invalid ADEC index \n");
23347 }
23348 }
23349 break;
23350
23351 case 0x04:
23352 {
23353 AU_nPRINT(" Enter ADEC index (0: ADEC0, 1: ADEC1) \n");
23354 adecIndex = AU_CUS_Debug_GetHex("");
23355
23356 if(adecIndex == API_AUDIO_CUSTOMER_ADEC0 || adecIndex == API_AUDIO_CUSTOMER_ADEC1)
23357 {
23358 //Resume MM New Mode decoder
23359 AU_CUS_Demo_MM_New_Mode_AD_Resume(adecIndex);
23360 }
23361 else
23362 {
23363 AU_nPRINT(" Invalid ADEC index \n");
23364 }
23365 }
23366 break;
23367
23368 case 0x9999:
23369 {
23370 //Exit
23371 }
23372 break;
23373
23374 default:
23375 break;
23376 }
23377 }
23378 }
23379 break;
23380
23381 case 0x0107:
23382 {
23383 #if(UTPA_SUPPORT_XPCM_PARAM_CHANNEL_MASK)
23384 {
23385 int selNum = 0;
23386
23387 while(selNum != 0x9999)
23388 {
23389 AU_nPRINT("================================================= \n");
23390 AU_nPRINT("** XPCM channel mask ** \n");
23391 AU_nPRINT("================================================= \n");
23392 AU_nPRINT("default: (reset) 0x0 \n");
23393 AU_nPRINT("#define SPEAKER_FRONT_LEFT 0x1 \n");
23394 AU_nPRINT("#define SPEAKER_FRONT_RIGHT 0x2 \n");
23395 AU_nPRINT("#define SPEAKER_FRONT_CENTER 0x4 \n");
23396 AU_nPRINT("#define SPEAKER_LOW_FREQUENCY 0x8 \n");
23397 AU_nPRINT("#define SPEAKER_BACK_LEFT 0x10 \n");
23398 AU_nPRINT("#define SPEAKER_BACK_RIGHT 0x20 \n");
23399 AU_nPRINT("================================================= \n");
23400 AU_nPRINT("g_audio_customer_ADEC_Param_XPCM_ChannelMask_debug_Cmd 0x%x \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC_Param_XPCM_ChannelMask_debug_Cmd );
23401 AU_nPRINT("================================================= \n");
23402 AU_nPRINT("EXIT 0x9999 \n");
23403
23404 selNum = AU_CUS_Debug_GetHex("");
23405
23406 switch(selNum)
23407 {
23408 case 0x00:
23409 {
23410 pstAudioCustomerShmData->g_audio_customer_ADEC_Param_XPCM_ChannelMask_debug_Cmd = 0;
23411 }
23412 break;
23413
23414 case 0x01:
23415 case 0x02:
23416 case 0x04:
23417 case 0x08:
23418 case 0x10:
23419 case 0x20:
23420 {
23421 pstAudioCustomerShmData->g_audio_customer_ADEC_Param_XPCM_ChannelMask_debug_Cmd |= selNum;
23422 }
23423 break;
23424
23425 case 0x9999:
23426 {
23427 //Exit
23428 pstAudioCustomerShmData->g_audio_customer_ADEC_Param_XPCM_ChannelMask_debug_Cmd = 0;
23429 }
23430 break;
23431
23432 default:
23433 break;
23434 }
23435 }
23436 }
23437 #endif //#if(UTPA_SUPPORT_XPCM_PARAM_CHANNEL_MASK)
23438 }
23439 break;
23440
23441 case 0x0108:
23442 {
23443 #if(CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK)
23444 {
23445 AU_nPRINT("HDMI RX Monitor EVENT(0:Disable, 1: Enable)\n");
23446
23447 arg2 = AU_CUS_Debug_GetDec();
23448
23449 if(arg2 == 1)
23450 {
23451 API_AUDIO_CUSTOMIZED_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK_REGISTER, (pfnAudioCustomerHDMIMonitorEvent)&AU_CUS_Demo_HDMI_Monitor_Event_CallBackFun);
23452 }
23453
23454 if(arg2 == 0)
23455 {
23456 API_AUDIO_CUSTOMIZED_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_PARAM_HDMI_RX_MONITOR_EVENT_CALLBACK_REGISTER, NULL);
23457 }
23458 }
23459 #endif
23460 }
23461 break;
23462
23463 case 0x0200:
23464 {
23465 AU_nPRINT("(0:Sync, 1: Freerun) pstAudioCustomerShmData->g_audio_customer_ADEC0_SyncMode (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC0_SyncMode);
23466
23467 arg2 = AU_CUS_Debug_GetDec();
23468 API_AUDIO_CUSTOMER_SetSyncMode(API_AUDIO_CUSTOMER_ADEC0, (MS_BOOL)arg2);
23469 }
23470 break;
23471
23472 case 0x0201:
23473 {
23474 AU_nPRINT("(0:Sync, 1: Freerun) pstAudioCustomerShmData->g_audio_customer_ADEC1_SyncMode (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC1_SyncMode);
23475
23476 arg2 = AU_CUS_Debug_GetDec();
23477 API_AUDIO_CUSTOMER_SetSyncMode(API_AUDIO_CUSTOMER_ADEC1, (MS_BOOL)arg2);
23478 }
23479 break;
23480
23481 case 0x0202:
23482 {
23483 AU_nPRINT("(0:Line, 1: RF) pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DolbyDRCMode (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DolbyDRCMode);
23484
23485 arg2 = AU_CUS_Debug_GetDec();
23486
23487 void* mode = &arg2;
23488 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_ADEC_PARAM_AC3P_DRC_MODE, mode);
23489 }
23490 break;
23491
23492 case 0x0203:
23493 {
23494 AU_nPRINT("(0:Line, 1: RF) pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3P_DolbyDRCMode (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3P_DolbyDRCMode);
23495
23496 arg2 = AU_CUS_Debug_GetDec();
23497
23498 void* mode = &arg2;
23499 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC1, API_AUDIO_CUSTOMER_ADEC_PARAM_AC3P_DRC_MODE, mode);
23500 }
23501 break;
23502
23503 case 0x0204:
23504 {
23505 AU_nPRINT("(0:LTRT, 1: LORO) pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DownmixMode (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DownmixMode);
23506
23507 arg2 = AU_CUS_Debug_GetDec();
23508
23509 void* mode = &arg2;
23510 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_ADEC_PARAM_AC3P_DOWNMIX_MODE, mode);
23511 }
23512 break;
23513
23514 case 0x0205:
23515 {
23516 AU_nPRINT("(0:LTRT, 1: LORO) pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3P_DownmixMode (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3P_DownmixMode);
23517
23518 arg2 = AU_CUS_Debug_GetDec();
23519
23520 void* mode = &arg2;
23521 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC1, API_AUDIO_CUSTOMER_ADEC_PARAM_AC3P_DOWNMIX_MODE, mode);
23522 }
23523 break;
23524
23525 case 0x0206:
23526 {
23527 AU_nPRINT("(0:LR, 1:LL, 2:RR) pstAudioCustomerShmData->g_audio_customer_ADEC0_DualmonoMode (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC0_DualmonoMode);
23528
23529 arg2 = AU_CUS_Debug_GetDec();
23530 API_AUDIO_CUSTOMER_SetDualMonoOutMode(API_AUDIO_CUSTOMER_ADEC0, (API_AUDIO_CUSTOMER_DUALMONO_MODE)arg2);
23531 }
23532 break;
23533
23534 case 0x0207:
23535 {
23536 AU_nPRINT("(0:LR, 1:LL, 2:RR) pstAudioCustomerShmData->g_audio_customer_ADEC1_DualmonoMode (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC1_DualmonoMode);
23537
23538 arg2 = AU_CUS_Debug_GetDec();
23539 API_AUDIO_CUSTOMER_SetDualMonoOutMode(API_AUDIO_CUSTOMER_ADEC1, (API_AUDIO_CUSTOMER_DUALMONO_MODE)arg2);
23540 }
23541 break;
23542
23543 case 0x0300:
23544 {
23545 int selNum = 0;
23546
23547 while(selNum != 0x9999)
23548 {
23549 AU_nPRINT("============================================= \n");
23550 AU_nPRINT("** AV Sync Info ** \n");
23551 AU_nPRINT("============================================= \n");
23552 AU_nPRINT("0x01 Start \n");
23553 AU_nPRINT("0x02 Stop \n");
23554 AU_nPRINT("0x03 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_Monitor_Interval (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_Monitor_Interval );
23555 AU_nPRINT("SHOW pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_adecIndex (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_adecIndex );
23556 AU_nPRINT("9999 Exit \n");
23557 selNum = AU_CUS_Debug_GetHex("");
23558
23559 switch(selNum)
23560 {
23561 case 0x01:
23562 {
23563 AU_nPRINT(" Enter ADEC index (0: ADEC0, 1: ADEC1) \n");
23564 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_adecIndex = AU_CUS_Debug_GetHex("");
23565 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_bEnable = TRUE;
23566 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_COMMON_PARAM_DUMP_INFO_AVSYNC, 0);
23567 }
23568 break;
23569
23570 case 0x02:
23571 {
23572 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_bEnable = FALSE;
23573 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_COMMON_PARAM_DUMP_INFO_Off, 0);
23574 }
23575 break;
23576
23577 case 0x03:
23578 {
23579 AU_nPRINT(" Interval: \n");
23580 pstAudioCustomerShmData->g_audio_customer_AU_MP3EncodeMonitor_Interval = AU_CUS_Debug_GetDec();
23581 }
23582 break;
23583
23584 case 0x9999:
23585 {
23586 //Exit
23587 }
23588 break;
23589
23590 default:
23591 break;
23592 }
23593 }
23594 }
23595 break;
23596
23597 case 0x0301:
23598 {
23599 AU_nPRINT("Final_Auto_Audio_Delay: \n");
23600 arg2 = AU_CUS_Debug_GetDec();
23601 pstAudioCustomerShmData->g_audio_customer_internal_patch_MS12_HDMI_TX_PCM_Final_Auto_Audio_Delay = arg2;
23602 }
23603 break;
23604
23605 case 0x0302:
23606 {
23607 char* pInput_File_Name = NULL;
23608
23609 AU_nPRINT("General_Buffer_Dump_bEnable: \n");
23610 arg2 = AU_CUS_Debug_GetDec();
23611
23612 AU_nPRINT(" Enter input file path: ( ex: /tmp/General_Buffer_Dump.bin ) \n");
23613 pInput_File_Name = AU_CUS_Debug_GetString();
23614
23615 if(arg2 > 0)
23616 {
23617 pAU_GeneralBufferDumpFile = AU_CUS_FileOpen(pInput_File_Name, "wb");
23618
23619 AU_CUS_INTERNAL_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, AU_CUS_INTERNAL_PATCH_PARAM_GENERAL_BUFFER_DUMP_ENABLE, &arg2);
23620 }
23621 else
23622 {
23623 AU_CUS_INTERNAL_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, AU_CUS_INTERNAL_PATCH_PARAM_GENERAL_BUFFER_DUMP_ENABLE, &arg2);
23624
23625 if(pAU_GeneralBufferDumpFile != NULL)
23626 {
23627 AU_CUS_FileClose(pAU_GeneralBufferDumpFile);
23628 pAU_GeneralBufferDumpFile = NULL;
23629 }
23630 }
23631 }
23632 break;
23633
23634 case 0x0303:
23635 {
23636 AU_nPRINT("g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_I2S_Out: \n");
23637 arg2 = AU_CUS_Debug_GetDec();
23638 pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_I2S_Out = arg2;
23639
23640 API_AUDIO_CUSTOMER_SetI2SOutGain(pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_Gain);
23641 }
23642 break;
23643
23644 case 0x0304:
23645 {
23646 AU_nPRINT("g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_0_Out: \n");
23647 arg2 = AU_CUS_Debug_GetDec();
23648 pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_0_Out = arg2;
23649
23650 API_AUDIO_CUSTOMER_SetLineOutGain(API_AUDIO_CUSTOMER_LINE_OUT_0, pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_Gain);
23651 }
23652 break;
23653
23654 case 0x0305:
23655 {
23656 AU_nPRINT("g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_1_Out: \n");
23657 arg2 = AU_CUS_Debug_GetDec();
23658 pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_1_Out = arg2;
23659
23660 API_AUDIO_CUSTOMER_SetLineOutGain(API_AUDIO_CUSTOMER_LINE_OUT_1, pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_Gain);
23661 }
23662 break;
23663
23664 case 0x0306:
23665 {
23666 AU_nPRINT("g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_2_Out: \n");
23667 arg2 = AU_CUS_Debug_GetDec();
23668 pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_2_Out = arg2;
23669
23670 API_AUDIO_CUSTOMER_SetLineOutGain(API_AUDIO_CUSTOMER_LINE_OUT_2, pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_Gain);
23671 }
23672 break;
23673
23674 case 0x0307:
23675 {
23676 AU_nPRINT("g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_3_Out: \n");
23677 arg2 = AU_CUS_Debug_GetDec();
23678 pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_3_Out = arg2;
23679
23680 API_AUDIO_CUSTOMER_SetLineOutGain(API_AUDIO_CUSTOMER_LINE_OUT_3, pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_Gain);
23681 }
23682 break;
23683
23684 case 0x0308:
23685 {
23686 AU_nPRINT("g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_SPDIF_Out: \n");
23687 arg2 = AU_CUS_Debug_GetDec();
23688 pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_SPDIF_Out = arg2;
23689
23690 API_AUDIO_CUSTOMER_SetSPDIFOutGain(pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_Gain);
23691 }
23692 break;
23693
23694 case 0x0309:
23695 {
23696 AU_nPRINT("g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_HDMI_Out: \n");
23697 arg2 = AU_CUS_Debug_GetDec();
23698 pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_HDMI_Out = arg2;
23699
23700 API_AUDIO_CUSTOMER_SetHDMIOutGain(pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_Gain);
23701 }
23702 break;
23703
23704 case 0x0310:
23705 {
23706 int selNum = 0;
23707
23708 while(selNum != 0x9999)
23709 {
23710 AU_nPRINT("============================================= \n");
23711 AU_nPRINT("** Audio dump Info ** \n");
23712 AU_nPRINT("============================================= \n");
23713 AU_nPRINT("selNum(0x%x) \n", selNum);
23714 AU_nPRINT("0x00 DUMP_INFO_Off \n");
23715 AU_nPRINT("0x01 DUMP_INFO_AVSYNC \n");
23716 AU_nPRINT("0x02 DUMP_INFO_ADEC0 \n");
23717 AU_nPRINT("0x03 DUMP_INFO_IO_INFO \n");
23718 AU_nPRINT("0x04 DUMP_INFO_IO_INFO \n");
23719 AU_nPRINT("0x05 DUMP_INFO_ALL \n");
23720 AU_nPRINT("0x9999 Exit \n");
23721 selNum = AU_CUS_Debug_GetHex("");
23722
23723 switch(selNum)
23724 {
23725 case 0x00:
23726 {
23727 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_COMMON_PARAM_DUMP_INFO_Off, 0);
23728 }
23729 break;
23730
23731 case 0x01:
23732 {
23733 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_COMMON_PARAM_DUMP_INFO_AVSYNC, 0);
23734 }
23735 break;
23736
23737 case 0x02:
23738 {
23739 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_COMMON_PARAM_DUMP_INFO_ADEC0, 0);
23740 }
23741 break;
23742
23743 case 0x03:
23744 {
23745 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_COMMON_PARAM_DUMP_INFO_IO_INFO, 0);
23746 }
23747 break;
23748
23749 case 0x04:
23750 {
23751 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_COMMON_PARAM_DUMP_INFO_MM_FILE_AVSYNC, 0);
23752 }
23753 break;
23754
23755 case 0x05:
23756 {
23757 API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_COMMON_PARAM_DUMP_INFO_ALL, 0);
23758 }
23759 break;
23760
23761 case 0x9999:
23762 {
23763 //Exit
23764 }
23765 break;
23766
23767 default:
23768 break;
23769 }
23770 }
23771 }
23772 break;
23773
23774 case 0x0311:
23775 {
23776 int selNum = 0;
23777
23778 while(selNum != 0x9999)
23779 {
23780 AU_nPRINT("============================================= \n");
23781 AU_nPRINT("** Se-DSP force encode without main sound ** \n");
23782 AU_nPRINT("============================================= \n");
23783 #if(CUSTOMIZED_PATCH_PARAM_SEDSP_MS12_ENC_WO_MAIN_SND)
23784 AU_nPRINT("(SHOW)g_audio_customer_patch_HDMI_TX_SEDSP_DDE_WO_MAIN_SND_bEnable (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_patch_HDMI_TX_SEDSP_DDE_WO_MAIN_SND_bEnable);
23785 AU_nPRINT("(SHOW)g_audio_customer_patch_HDMI_TX_SEDSP_DDPE_WO_MAIN_SND_bEnable (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_patch_HDMI_TX_SEDSP_DDPE_WO_MAIN_SND_bEnable);
23786 AU_nPRINT("(SHOW)g_audio_customer_patch_SPDIF_TX_SEDSP_DDE_WO_MAIN_SND_bEnable (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_patch_SPDIF_TX_SEDSP_DDE_WO_MAIN_SND_bEnable);
23787 #endif //#if(CUSTOMIZED_PATCH_PARAM_SEDSP_MS12_ENC_WO_MAIN_SND)
23788 AU_nPRINT("============================================= \n");
23789 AU_nPRINT("selNum(0x%x) \n", selNum);
23790 AU_nPRINT("0x01 HDMI TX DDE without main sound \n");
23791 AU_nPRINT("0x02 HDMI TX DDPE without main sound \n");
23792 AU_nPRINT("0x03 SPDIF TX DDE without main sound \n");
23793 AU_nPRINT("0x04 Disable Se-DSP MS12 Encode without main sound \n");
23794 AU_nPRINT("0x9999 Exit \n");
23795 selNum = AU_CUS_Debug_GetHex("");
23796
23797 switch(selNum)
23798 {
23799 case 0x01:
23800 {
23801 //Set Decoder type
23802 API_AUDIO_CUSTOMER_SetCodecType(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_CODEC_TYPE_EAC3);
23803
23804 //Start decoding
23805 API_AUDIO_CUSTOMER_StartDecoding(API_AUDIO_CUSTOMER_ADEC0);
23806
23807 //Set HDMI TX output type (DD)
23808 API_AUDIO_CUSTOMER_HDMI_TX_SetOutputType(API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_NONPCM);
23809
23810 //Enable HDMI TX force DDE without main sound.
23811 API_AUDIO_CUSTOMIZED_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_PARAM_HDMI_TX_SEDSP_DDE_WO_MAIN_SND_ENABLE, NULL);
23812 }
23813 break;
23814
23815 case 0x02:
23816 {
23817 //Set Decoder type
23818 API_AUDIO_CUSTOMER_SetCodecType(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_CODEC_TYPE_EAC3);
23819
23820 //Start decoding
23821 API_AUDIO_CUSTOMER_StartDecoding(API_AUDIO_CUSTOMER_ADEC0);
23822
23823 //Set HDMI TX output type (DDP)
23824 API_AUDIO_CUSTOMER_HDMI_TX_SetOutputType(API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_EAC3);
23825
23826 //Enable HDMI TX force DDPE without main sound.
23827 API_AUDIO_CUSTOMIZED_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_PARAM_HDMI_TX_SEDSP_DDPE_WO_MAIN_SND_ENABLE, NULL);
23828 }
23829 break;
23830
23831 case 0x03:
23832 {
23833 //Set Decoder type
23834 API_AUDIO_CUSTOMER_SetCodecType(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_CODEC_TYPE_EAC3);
23835
23836 //Start decoding
23837 API_AUDIO_CUSTOMER_StartDecoding(API_AUDIO_CUSTOMER_ADEC0);
23838
23839 //Set HDMI TX output type (DD)
23840 API_AUDIO_CUSTOMER_HDMI_TX_SetOutputType(API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_NONPCM);
23841
23842 //Set SPDIF TX output type (DD)
23843 API_AUDIO_CUSTOMER_SPDIF_TX_SetOutputType(API_AUDIO_CUSTOMER_SPDIF_TX_AUTO);
23844
23845 //Enable SPDIF TX force DDE without main sound.
23846 API_AUDIO_CUSTOMIZED_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_PARAM_SPDIF_TX_SEDSP_DDE_WO_MAIN_SND_ENABLE, NULL);
23847 }
23848 break;
23849
23850 case 0x04:
23851 {
23852 //Disable HDMI TX force DDE/DDPE without main sound.
23853 API_AUDIO_CUSTOMIZED_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_PARAM_SEDSP_MS12_ENC_WO_MAIN_SND_DISABLE, NULL);
23854 }
23855 break;
23856
23857 case 0x9999:
23858 {
23859 //Exit
23860 }
23861 break;
23862
23863 default:
23864 break;
23865 }
23866 }
23867 }
23868 break;
23869
23870 case 0x0312:
23871 {
23872 int selNum = 0;
23873
23874 while(selNum != 0x9999)
23875 {
23876 AU_nPRINT("============================================= \n");
23877 AU_nPRINT("** ASND-R2 force encode without main sound ** \n");
23878 AU_nPRINT("============================================= \n");
23879 #if(CUSTOMIZED_PATCH_PARAM_SNDR2_MS12_ENC_WO_MAIN_SND)
23880 AU_nPRINT("(SHOW)g_audio_customer_patch_HDMI_ARC_SNDR2_DDE_WO_MAIN_SND_bEnable (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_patch_HDMI_ARC_SEDSP_DDE_WO_MAIN_SND_bEnable);
23881 AU_nPRINT("(SHOW)g_audio_customer_patch_HDMI_ARC_SNDR2_DDPE_WO_MAIN_SND_bEnable (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_patch_HDMI_ARC_SNDR2_DDPE_WO_MAIN_SND_bEnable);
23882 #endif //#if(CUSTOMIZED_PATCH_PARAM_SNDR2_MS12_ENC_WO_MAIN_SND)
23883 AU_nPRINT("============================================= \n");
23884 AU_nPRINT("selNum(0x%x) \n", selNum);
23885 AU_nPRINT("0x01 HDMI ARC DDE without main sound \n");
23886 AU_nPRINT("0x02 HDMI ARC DDPE without main sound \n");
23887 AU_nPRINT("0x03 Disable Snd-R2 MS12 Encode without main sound \n");
23888 AU_nPRINT("0x9999 Exit \n");
23889 selNum = AU_CUS_Debug_GetHex("");
23890
23891 switch(selNum)
23892 {
23893 case 0x01:
23894 {
23895 //Set Decoder type
23896 API_AUDIO_CUSTOMER_SetCodecType(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_CODEC_TYPE_EAC3);
23897
23898 //Start decoding
23899 API_AUDIO_CUSTOMER_StartDecoding(API_AUDIO_CUSTOMER_ADEC0);
23900
23901 //Set SPDIF TX output type (DD)
23902 API_AUDIO_CUSTOMER_SPDIF_TX_SetOutputType(API_AUDIO_CUSTOMER_SPDIF_TX_DD);
23903
23904 //Enable HDMI ARC force DDE without main sound.
23905 API_AUDIO_CUSTOMIZED_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_PARAM_HDMI_ARC_SEDSP_DDE_WO_MAIN_SND_ENABLE, NULL);
23906 }
23907 break;
23908
23909 case 0x02:
23910 {
23911 //Set Decoder type
23912 API_AUDIO_CUSTOMER_SetCodecType(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_CODEC_TYPE_EAC3);
23913
23914 //Start decoding
23915 API_AUDIO_CUSTOMER_StartDecoding(API_AUDIO_CUSTOMER_ADEC0);
23916
23917 //Set SPDIF TX output type (DDP)
23918 API_AUDIO_CUSTOMER_SPDIF_TX_SetOutputType(API_AUDIO_CUSTOMER_SPDIF_TX_AUTO);
23919
23920 //Enable HDMI ARC force DDE without main sound.
23921 API_AUDIO_CUSTOMIZED_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_PARAM_HDMI_ARC_SNDR2_DDPE_WO_MAIN_SND_ENABLE, NULL);
23922 }
23923 break;
23924
23925 case 0x03:
23926 {
23927 //Disable HDMI ARC force DDE/DDPE without main sound.
23928 API_AUDIO_CUSTOMIZED_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMIZED_PATCH_PARAM_SNDR2_MS12_ENC_WO_MAIN_SND_DISABLE, NULL);
23929 }
23930 break;
23931
23932 case 0x9999:
23933 {
23934 //Exit
23935 }
23936 break;
23937
23938 default:
23939 break;
23940 }
23941 }
23942 }
23943 break;
23944
23945 case 0x0313:
23946 {
23947 AU_nPRINT("eSourceType:\n");
23948 arg2 = AU_CUS_Debug_GetDec();
23949
23950 AU_CUS_SetSourceInfo((AUDIO_SOURCE_INFO_TYPE)arg2);
23951 }
23952 break;
23953
23954 case 0x0314:
23955 {
23956 AU_nPRINT("enSource:\n");
23957 arg2 = AU_CUS_Debug_GetDec();
23958
23959 AU_nPRINT("enGroup:\n");
23960 arg3 = AU_CUS_Debug_GetDec();
23961
23962 AU_CUS_InputSwitch((AUDIO_INPUT_TYPE)arg2, (AUDIO_SWITCH_GROUP)arg3);
23963 }
23964 break;
23965
23966 case 0x0400:
23967 {
23968 arg2 = AU_CUS_Debug_GetDec();
23969 pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_MonitorOnOff = arg2;
23970 }
23971 break;
23972
23973 case 0x0401:
23974 {
23975 arg2 = AU_CUS_Debug_GetDec();
23976 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_MonitorOnOff = arg2;
23977 }
23978 break;
23979
23980 case 0x0402:
23981 {
23982 arg2 = AU_CUS_Debug_GetDec();
23983 pstAudioCustomerShmData->g_audio_customer_HDMI_TX_MonitorOnOff = arg2;
23984 }
23985 break;
23986
23987 case 0x0403:
23988 {
23989 arg2 = AU_CUS_Debug_GetDec();
23990 pstAudioCustomerShmData->g_audio_customer_SIF_MonitorOnOff = arg2;
23991 }
23992 break;
23993
23994 case 0x0404:
23995 {
23996 arg2 = AU_CUS_Debug_GetDec();
23997 pstAudioCustomerShmData->g_audio_customer_Auto_Recovery_MonitorOnOff = arg2;
23998 }
23999 break;
24000
24001 case 0x0500:
24002 {
24003 AU_nPRINT("per_50ms:\n");
24004 arg2 = AU_CUS_Debug_GetDec();
24005
24006 AU_nPRINT("port:\n");
24007 arg3 = AU_CUS_Debug_GetDec();
24008
24009 MS_U32 per_50ms = (MS_U32)arg2;
24010 API_AUDIO_CUSTOMER_OUTPUT_TYPE port = arg3;
24011 AU_CUS_MuteDuringLimitedTime_Output(per_50ms, port);
24012 }
24013 break;
24014
24015 case 0x0501:
24016 {
24017 AU_nPRINT("per_50ms:\n");
24018 arg2 = AU_CUS_Debug_GetDec();
24019
24020 AU_nPRINT("eFM :\n");
24021 arg3 = AU_CUS_Debug_GetDec();
24022
24023 AU_nPRINT("port:\n");
24024 arg4 = AU_CUS_Debug_GetDec();
24025
24026 MS_U32 per_50ms = (MS_U32)arg2;
24027 API_AUDIO_CUSTOMER_FWM_INDEX eFM = arg3;
24028 API_AUDIO_CUSTOMER_FWM_INPUT port = arg4;
24029 AU_CUS_MuteDuringLimitedTime_Input(per_50ms, eFM, port);
24030 }
24031 break;
24032
24033 case 0x0600:
24034 {
24035 AU_nPRINT("arg2:\n");
24036 arg2 = AU_CUS_Debug_GetDec();
24037 pstAudioCustomerShmData->g_audio_customer_AU_ClipDecoderMonitor_Interval = arg2;
24038 }
24039 break;
24040
24041 case 0x0601:
24042 {
24043 AU_nPRINT("arg2:\n");
24044 arg2 = AU_CUS_Debug_GetDec();
24045 pstAudioCustomerShmData->g_audio_customer_AU_MP3EncodeMonitor_Interval = arg2;
24046 }
24047 break;
24048
24049 case 0x0602:
24050 {
24051 AU_nPRINT("arg2:\n");
24052 arg2 = AU_CUS_Debug_GetDec();
24053 pstAudioCustomerShmData->g_audio_customer_AU_MonitorService_Interval = arg2;
24054 }
24055 break;
24056
24057 case 0x0603:
24058 {
24059 AU_nPRINT("arg2:\n");
24060 arg2 = AU_CUS_Debug_GetDec();
24061 pstAudioCustomerShmData->g_audio_customer_AU_MuteDuringLimitedTime_Monitor_Interval = arg2;
24062 }
24063 break;
24064
24065 case 0x0604:
24066 {
24067 AU_nPRINT("arg2:\n");
24068 arg2 = AU_CUS_Debug_GetDec();
24069 pstAudioCustomerShmData->g_audio_customer_AU_AdecPcmOut_Interval = arg2;
24070 }
24071 break;
24072
24073 case 0x0605:
24074 {
24075 AU_nPRINT("arg2:\n");
24076 arg2 = AU_CUS_Debug_GetDec();
24077 pstAudioCustomerShmData->g_audio_customer_AU_PCMCapture_Interval = arg2;
24078 }
24079 break;
24080
24081 case 0x0606:
24082 {
24083 AU_nPRINT("arg2:\n");
24084 arg2 = AU_CUS_Debug_GetDec();
24085 pstAudioCustomerShmData->g_audio_customer_AU_EndOfStreamMonitor_Interval = arg2;
24086 }
24087 break;
24088
24089 case 0x0607:
24090 {
24091 AU_nPRINT("arg2:\n");
24092 arg2 = AU_CUS_Debug_GetDec();
24093 pstAudioCustomerShmData->g_audio_customer_AU_AdecUnderrun_Interval = arg2;
24094 }
24095 break;
24096
24097 case 0x0608:
24098 {
24099 AU_nPRINT("arg2:\n");
24100 arg2 = AU_CUS_Debug_GetDec();
24101 pstAudioCustomerShmData->g_audio_customer_AU_Demo_MM_New_Mode_Play_Monitor_Interval = arg2;
24102 }
24103 break;
24104
24105 case 0x0609:
24106 {
24107 AU_nPRINT("arg2:\n");
24108 arg2 = AU_CUS_Debug_GetDec();
24109 pstAudioCustomerShmData->g_audio_customer_AU_CUS_ADEC_SetMute_Delay = arg2;
24110 }
24111 break;
24112
24113 case 0x0610:
24114 {
24115 AU_nPRINT("arg2:\n");
24116 arg2 = AU_CUS_Debug_GetDec();
24117 pstAudioCustomerShmData->g_audio_customer_internal_patch_Avoid_ADEC_Stop_Pop_Noise_mute_limited_time = arg2;
24118 }
24119 break;
24120
24121 case 0x0611:
24122 {
24123 AU_nPRINT("arg2:\n");
24124 arg2 = AU_CUS_Debug_GetDec();
24125 pstAudioCustomerShmData->g_audio_customer_internal_patch_Avoid_ADEC_Pause_Pop_Noise_mute_limited_time = arg2;
24126 }
24127 break;
24128
24129 case 0x0612:
24130 {
24131 AU_nPRINT("arg2:\n");
24132 arg2 = AU_CUS_Debug_GetDec();
24133 pstAudioCustomerShmData->g_audio_customer_AU_CUS_SetPlayCmdByAdecSource_Delay = arg2;
24134 }
24135 break;
24136
24137 case 0x0613:
24138 {
24139 AU_nPRINT("arg2:\n");
24140 arg2 = AU_CUS_Debug_GetDec();
24141 pstAudioCustomerShmData->g_audio_customer_AU_CUS_PauseDecoding_Delay = arg2;
24142 }
24143 break;
24144
24145 case 0x0700:
24146 {
24147 API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex = API_AUDIO_CUSTOMER_ADEC_INDEX_INVALID;
24148 API_AUDIO_CUSTOMER_CODEC_TYPE adecType = API_AUDIO_CUSTOMER_CODEC_TYPE_INVALID;
24149 API_AUDIO_CUSTOMER_CH_INPUT ch5_Input = API_AUDIO_CUSTOMER_CH_INPUT_INVALID;
24150 API_AUDIO_CUSTOMER_CH_INPUT ch6_Input = API_AUDIO_CUSTOMER_CH_INPUT_INVALID;
24151 API_AUDIO_CUSTOMER_ADC_INDEX ADCIndex = API_AUDIO_CUSTOMER_ADC_INDEX_INVALID;
24152 API_AUDIO_CUSTOMER_ADC_IN_PORT ADC_In_portNum = API_AUDIO_CUSTOMER_ADC_IN_PORT_INVALID;
24153
24154 int selNum = 0;
24155
24156 while(selNum != 0x9999)
24157 {
24158 AU_nPRINT("============================================= \n");
24159 AU_nPRINT("** Input Source Change ** \n");
24160 AU_nPRINT("============================================= \n");
24161 AU_nPRINT("(0x01) DTV (ADEC :%d) (CH5 input: %d) (CH6 input: %d) \n", adecIndex, ch5_Input, ch6_Input);
24162 AU_nPRINT("(0x02) ATV (ADEC: %d) (CH5 input: %d) (CH6 input: %d) \n", adecIndex, ch5_Input, ch6_Input);
24163 AU_nPRINT("(0x03) HDMI (ADEC: %d) (CH5 input: %d) (CH6 input: %d) \n", adecIndex, ch5_Input, ch6_Input);
24164 AU_nPRINT("(0x04) Component \n");
24165 AU_nPRINT("(0x05) AV \n");
24166 AU_nPRINT("(9999) Exit \n");
24167 selNum = AU_CUS_Debug_GetHex("");
24168
24169 switch(selNum)
24170 {
24171 case 0x01: //DTV
24172 {
24173 AU_nPRINT(" Enter ADEC index (0: ADEC0, 1: ADEC1) \n");
24174 adecIndex = AU_CUS_Debug_GetHex("");
24175
24176 AU_nPRINT(" Enter Decoder TYPE (0: MPEQ, 1: AC3, 2:AAC) \n");
24177 adecType = AU_CUS_Debug_GetHex("");
24178
24179 switch(adecType)
24180 {
24181 case 1:
24182 {
24183 adecType = API_AUDIO_CUSTOMER_CODEC_TYPE_EAC3;
24184 }
24185 break;
24186
24187 case 2:
24188 {
24189 adecType = API_AUDIO_CUSTOMER_CODEC_TYPE_HEAAC;
24190 }
24191 break;
24192
24193 case 0:
24194 default:
24195 {
24196 adecType = API_AUDIO_CUSTOMER_CODEC_TYPE_MPEG;
24197 }
24198 break;
24199 }
24200
24201 if(adecIndex == API_AUDIO_CUSTOMER_ADEC0 || adecIndex == API_AUDIO_CUSTOMER_ADEC1)
24202 {
24203 switch(adecIndex)
24204 {
24205 case API_AUDIO_CUSTOMER_ADEC0:
24206 {
24207 ch5_Input = API_AUDIO_CUSTOMER_CH_INPUT_ADEC0;
24208 }
24209 break;
24210
24211 case API_AUDIO_CUSTOMER_ADEC1:
24212 {
24213 ch5_Input = API_AUDIO_CUSTOMER_CH_INPUT_ADEC1;
24214 }
24215 break;
24216
24217 default:
24218 break;
24219 }
24220
24221 //Connect ADEC to HDMI
24222 API_AUDIO_CUSTOMER_ADEC_Connect(adecIndex, API_AUDIO_CUSTOMER_ADEC_INPUT_DTV);
24223
24224 //Set Adec Pcm output path
24225 API_AUDIO_CUSTOMER_SetAdecPcmPath(adecIndex, API_AUDIO_CUSTOMER_ADEC_PCM_PATH_DSP_SRC);
24226
24227 //CH5 input connect
24228 API_AUDIO_CUSTOMER_CH_Sound_Connect(API_AUDIO_CUSTOMER_CH5_SOUND, ch5_Input);
24229
24230 //Set Decoder type
24231 API_AUDIO_CUSTOMER_SetCodecType(adecIndex, adecType);
24232
24233 //Start decoding
24234 API_AUDIO_CUSTOMER_StartDecoding(adecIndex);
24235
24236 //FW mixer0 connect
24237 API_AUDIO_CUSTOMER_FW_MIXER_Connect(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5);
24238
24239 //FW mixer0 channel unmute
24240 API_AUDIO_CUSTOMER_SetFWMixerChannelMute(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5, FALSE);
24241 }
24242 else
24243 {
24244 AU_nPRINT(" Invalid ADEC index \n");
24245 }
24246
24247 }
24248 break;
24249
24250 case 0x02: //ATV
24251 {
24252 AU_nPRINT(" Enter ATV TYPE (0: PAL, 1: BTSC) \n");
24253 adecType = AU_CUS_Debug_GetHex("");
24254 if(adecType == 0)
24255 {
24256 adecType = API_AUDIO_CUSTOMER_CODEC_TYPE_SIF_A2;
24257 }
24258 else
24259 {
24260 adecType = API_AUDIO_CUSTOMER_CODEC_TYPE_SIF_BTSC;
24261 }
24262
24263 //Connect ADEC_ATV
24264 API_AUDIO_CUSTOMER_ADEC_Connect(API_AUDIO_CUSTOMER_ADEC_ATV, API_AUDIO_CUSTOMER_ADEC_INPUT_ATV);
24265
24266 //CH5 input connect
24267 API_AUDIO_CUSTOMER_CH_Sound_Connect(API_AUDIO_CUSTOMER_CH5_SOUND, API_AUDIO_CUSTOMER_CH_INPUT_ADEC_ATV);
24268
24269 //Set SIF type
24270 API_AUDIO_CUSTOMER_SetCodecType(API_AUDIO_CUSTOMER_ADEC_ATV, adecType);
24271
24272 //Start decoding
24273 API_AUDIO_CUSTOMER_StartDecoding(API_AUDIO_CUSTOMER_ADEC_ATV);
24274
24275 //FW mixer0 connect
24276 API_AUDIO_CUSTOMER_FW_MIXER_Connect(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5);
24277
24278 //FW mixer0 channel unmute
24279 API_AUDIO_CUSTOMER_SetFWMixerChannelMute(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5, FALSE);
24280
24281 //Enable ATV Monitor
24282 API_AUDIO_CUSTOMER_SIF_SetMonitorOnOff(TRUE);
24283
24284 }
24285 break;
24286
24287 case 0x03: //HDMI
24288 {
24289 AU_nPRINT(" Enter ADEC index (0: ADEC0, 1: ADEC1) \n");
24290 adecIndex = AU_CUS_Debug_GetHex("");
24291
24292 if(adecIndex == API_AUDIO_CUSTOMER_ADEC0 || adecIndex == API_AUDIO_CUSTOMER_ADEC1)
24293 {
24294 switch(adecIndex)
24295 {
24296 case API_AUDIO_CUSTOMER_ADEC0:
24297 {
24298 ch5_Input = API_AUDIO_CUSTOMER_CH_INPUT_ADEC0;
24299 }
24300 break;
24301
24302 case API_AUDIO_CUSTOMER_ADEC1:
24303 {
24304 ch5_Input = API_AUDIO_CUSTOMER_CH_INPUT_ADEC1;
24305 }
24306 break;
24307
24308 default:
24309 break;
24310 }
24311
24312 //Connect ADEC to HDMI
24313 API_AUDIO_CUSTOMER_ADEC_Connect(adecIndex, API_AUDIO_CUSTOMER_ADEC_INPUT_HDMI);
24314
24315 //Set Adec Pcm output path
24316 API_AUDIO_CUSTOMER_SetAdecPcmPath(adecIndex, API_AUDIO_CUSTOMER_ADEC_PCM_PATH_DSP_SRC);
24317
24318 //CH5 input connect
24319 API_AUDIO_CUSTOMER_CH_Sound_Connect(API_AUDIO_CUSTOMER_CH5_SOUND, ch5_Input);
24320
24321 //Start decoding
24322 API_AUDIO_CUSTOMER_StartDecoding(adecIndex);
24323
24324 //FW mixer0 connect
24325 API_AUDIO_CUSTOMER_FW_MIXER_Connect(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5);
24326
24327 //FW mixer0 channel unmute
24328 API_AUDIO_CUSTOMER_SetFWMixerChannelMute(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5, FALSE);
24329
24330 //Enable HDMI RX Monitor
24331 API_AUDIO_CUSTOMER_HDMI_RX_SetMonitorOnOff(TRUE);
24332 }
24333 else
24334 {
24335 AU_nPRINT(" Invalid ADEC index \n");
24336 }
24337 }
24338 break;
24339
24340 case 0x04: //Component
24341 case 0x05: //AV
24342 {
24343 AU_nPRINT(" Enter ADC index: \n");
24344 AU_nPRINT(" (0) API_AUDIO_CUSTOMER_ADC0 \n");
24345 AU_nPRINT(" (1) API_AUDIO_CUSTOMER_ADC1 \n");
24346 ADCIndex = (API_AUDIO_CUSTOMER_ADC_INDEX)AU_CUS_Debug_GetHex("");
24347
24348 AU_nPRINT(" Enter ADC In Port Number: \n");
24349 AU_nPRINT(" (0x02) API_AUDIO_CUSTOMER_ADC0_IN_PORT_0 \n");
24350 AU_nPRINT(" (0x12) API_AUDIO_CUSTOMER_ADC0_IN_PORT_1 \n");
24351 AU_nPRINT(" (0x22) API_AUDIO_CUSTOMER_ADC0_IN_PORT_2 \n");
24352 AU_nPRINT(" (0x32) API_AUDIO_CUSTOMER_ADC0_IN_PORT_3 \n");
24353 AU_nPRINT(" (0xA2) API_AUDIO_CUSTOMER_ADC0_IN_PORT_4 \n");
24354 AU_nPRINT(" (0xB2) API_AUDIO_CUSTOMER_ADC0_IN_PORT_5 \n");
24355 AU_nPRINT(" (0x72) API_AUDIO_CUSTOMER_ADC0_MIC_IN \n");
24356 AU_nPRINT(" (0x09) API_AUDIO_CUSTOMER_ADC1_IN_PORT_0 \n");
24357 AU_nPRINT(" (0x19) API_AUDIO_CUSTOMER_ADC1_IN_PORT_1 \n");
24358 AU_nPRINT(" (0x29) API_AUDIO_CUSTOMER_ADC1_IN_PORT_2 \n");
24359 AU_nPRINT(" (0x39) API_AUDIO_CUSTOMER_ADC1_IN_PORT_3 \n");
24360 AU_nPRINT(" (0xA9) API_AUDIO_CUSTOMER_ADC1_IN_PORT_4 \n");
24361 AU_nPRINT(" (0xB9) API_AUDIO_CUSTOMER_ADC1_IN_PORT_5 \n");
24362 AU_nPRINT(" (0x79) API_AUDIO_CUSTOMER_ADC1_MIC_IN \n");
24363 ADC_In_portNum = (API_AUDIO_CUSTOMER_ADC_IN_PORT)AU_CUS_Debug_GetHex("");
24364
24365 AU_nPRINT("ADC_In_portNum = 0x%x \n", ADC_In_portNum);
24366
24367 //Connect ADC to ADC-in port
24368 API_AUDIO_CUSTOMER_ADC_Connect(ADCIndex, ADC_In_portNum);
24369
24370 switch(ADCIndex)
24371 {
24372 case API_AUDIO_CUSTOMER_ADC0:
24373 {
24374 ch5_Input = API_AUDIO_CUSTOMER_CH_INPUT_ADC0;
24375 }
24376 break;
24377
24378 case API_AUDIO_CUSTOMER_ADC1:
24379 {
24380 ch5_Input = API_AUDIO_CUSTOMER_CH_INPUT_ADC1;
24381 }
24382 break;
24383
24384 default:
24385 break;
24386 }
24387
24388 //CH5 input connect
24389 API_AUDIO_CUSTOMER_CH_Sound_Connect(API_AUDIO_CUSTOMER_CH5_SOUND, ch5_Input);
24390
24391 AU_nPRINT("[0x112C65]=0x%-4X,\n", AU_CUS_ReadAbsReg((MS_U32)0x112C65));
24392 AU_nPRINT("[0x112CE2]=0x%-4X,\n", AU_CUS_ReadAbsReg((MS_U32)0x112CE2));
24393
24394 //FW mixer0 connect
24395 API_AUDIO_CUSTOMER_FW_MIXER_Connect(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5);
24396
24397 //FW mixer0 channel unmute
24398 API_AUDIO_CUSTOMER_SetFWMixerChannelMute(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5, FALSE);
24399 }
24400 break;
24401
24402 case 9999:
24403 {
24404 //Exit
24405 }
24406 break;
24407
24408 default:
24409 break;
24410 }
24411 }
24412 }
24413 break;
24414
24415 case 0x0701:
24416 {
24417 AU_nPRINT("arg2:\n");
24418 arg2 = AU_CUS_Debug_GetDec();
24419
24420 if(arg2)
24421 {
24422 //[Debug] Dump MM ES1
24423 pAU_MMESDumpFile = AU_CUS_FileOpen("/tmp/MM_Audio_ES1_Dump.bin", "wb");
24424 if(pAU_MMESDumpFile == NULL)
24425 {
24426 AU_nPRINT("Open file FAIL!!\n");
24427 }
24428
24429 pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_MM_ES1_bEnable = arg2;
24430 pstAudioCustomerShmData->g_audio_customer_internal_patch_General_Buffer_Dump_bEnable = arg2;
24431 }
24432 else
24433 {
24434 //[Debug] Stop Dump ES1
24435 pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_MM_ES1_bEnable = arg2;
24436 pstAudioCustomerShmData->g_audio_customer_internal_patch_General_Buffer_Dump_bEnable = arg2;
24437
24438 if(pAU_MMESDumpFile != NULL)
24439 {
24440 AU_CUS_FileClose(pAU_MMESDumpFile);
24441 pAU_MMESDumpFile = NULL;
24442 }
24443 }
24444 }
24445 break;
24446
24447 case 0x0702:
24448 {
24449 AU_nPRINT("arg2:\n");
24450 arg2 = AU_CUS_Debug_GetDec();
24451
24452 if(arg2)
24453 {
24454 //[Debug] Dump DEC PCM1
24455 pAU_GeneralBufferDumpFile = AU_CUS_FileOpen("/tmp/General_Buffer_Dump1_DEC_PCM1_Buffer.pcm", "wb");
24456 if(pAU_GeneralBufferDumpFile == NULL)
24457 {
24458 AU_nPRINT("Open file FAIL!!\n");
24459 }
24460
24461 pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_PCM1_bEnable = arg2;
24462 pstAudioCustomerShmData->g_audio_customer_internal_patch_General_Buffer_Dump_bEnable = arg2;
24463 }
24464 else
24465 {
24466 //[Debug] Stop Dump DEC PCM1
24467 pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_PCM1_bEnable = arg2;
24468 pstAudioCustomerShmData->g_audio_customer_internal_patch_General_Buffer_Dump_bEnable = arg2;
24469
24470 if(pAU_GeneralBufferDumpFile != NULL)
24471 {
24472 AU_CUS_FileClose(pAU_GeneralBufferDumpFile);
24473 pAU_GeneralBufferDumpFile = NULL;
24474 }
24475 }
24476 }
24477 break;
24478
24479 case 0x0703:
24480 {
24481 AU_nPRINT("arg2:\n");
24482 arg2 = AU_CUS_Debug_GetDec();
24483
24484 if(arg2)
24485 {
24486 //[Debug] Dump HDMI NonPCM
24487 pAU_GeneralBufferDumpFile2 = AU_CUS_FileOpen("/tmp/General_Buffer_Dump2_HDMI_NPCM_Buffer.bin", "wb");
24488 if(pAU_GeneralBufferDumpFile2 == NULL)
24489 {
24490 AU_nPRINT("Open file FAIL!!\n");
24491 }
24492
24493 pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_HDMINPCM_bEnable = arg2;
24494 pstAudioCustomerShmData->g_audio_customer_internal_patch_General_Buffer_Dump_bEnable = arg2;
24495 }
24496 else
24497 {
24498 //[Debug] Stop Dump HDMI NonPCM
24499 pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_HDMINPCM_bEnable = arg2;
24500 pstAudioCustomerShmData->g_audio_customer_internal_patch_General_Buffer_Dump_bEnable = arg2;
24501
24502 if(pAU_GeneralBufferDumpFile2 != NULL)
24503 {
24504 AU_CUS_FileClose(pAU_GeneralBufferDumpFile2);
24505 pAU_GeneralBufferDumpFile2 = NULL;
24506 }
24507 }
24508
24509 }
24510 break;
24511
24512 case 0x0704:
24513 {
24514 AU_nPRINT("arg2:\n");
24515 arg2 = AU_CUS_Debug_GetDec();
24516
24517 if(arg2)
24518 {
24519 //[Debug] Dump MS12 DDPE Data
24520 pAU_GeneralBufferDumpFile3 = AU_CUS_FileOpen("/tmp/General_Buffer_Dump3_MS12_MetaData_Buffer.bin", "wb");
24521 if(pAU_GeneralBufferDumpFile3 == NULL)
24522 {
24523 AU_nPRINT("Open file FAIL!!\n");
24524 }
24525
24526 pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_MS12_METADATA_bEnable = arg2;
24527 pstAudioCustomerShmData->g_audio_customer_internal_patch_General_Buffer_Dump_bEnable = arg2;
24528 }
24529 else
24530 {
24531 //[Debug] Stop Dump MS12 DDPE Data
24532 pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_MS12_METADATA_bEnable = arg2;
24533 pstAudioCustomerShmData->g_audio_customer_internal_patch_General_Buffer_Dump_bEnable = arg2;
24534
24535 if(pAU_GeneralBufferDumpFile3 != NULL)
24536 {
24537 AU_CUS_FileClose(pAU_GeneralBufferDumpFile3);
24538 pAU_GeneralBufferDumpFile3 = NULL;
24539 }
24540 }
24541 }
24542 break;
24543
24544 case 0x0705:
24545 {
24546 AU_nPRINT("arg2:\n");
24547 arg2 = AU_CUS_Debug_GetDec();
24548
24549 if(arg2)
24550 {
24551 //[Debug] Dump HDMI ES1
24552 pAU_GeneralBufferDumpFile4 = AU_CUS_FileOpen("/tmp/HDMI_Audio_ES1_Dump.bin", "wb");
24553 if(pAU_GeneralBufferDumpFile4 == NULL)
24554 {
24555 AU_nPRINT("Open file FAIL!!\n");
24556 }
24557
24558 pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_HDMI_ES1_bEnable = arg2;
24559 pstAudioCustomerShmData->g_audio_customer_internal_patch_General_Buffer_Dump_bEnable = arg2;
24560 }
24561 else
24562 {
24563 //[Debug] Stop Dump HDMI ES1
24564 pstAudioCustomerShmData->g_audio_customer_internal_patch_Dump_HDMI_ES1_bEnable = arg2;
24565 pstAudioCustomerShmData->g_audio_customer_internal_patch_General_Buffer_Dump_bEnable = arg2;
24566
24567 if(pAU_GeneralBufferDumpFile4 != NULL)
24568 {
24569 AU_CUS_FileClose(pAU_GeneralBufferDumpFile4);
24570 pAU_GeneralBufferDumpFile4 = NULL;
24571 }
24572 }
24573 }
24574 break;
24575
24576 case 0x0800:
24577 {
24578 int selNum = 0;
24579 int ADEC0_bAtmos_Stream = 0;
24580 int ADEC1_bAtmos_Stream = 0;
24581 API_AUDIO_CUSTOMER_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_ADEC_INFO_AC3P_IS_ATMOS_STREAM, &ADEC0_bAtmos_Stream);
24582 API_AUDIO_CUSTOMER_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC1, API_AUDIO_CUSTOMER_ADEC_INFO_AC3P_IS_ATMOS_STREAM, &ADEC1_bAtmos_Stream);
24583
24584 while(selNum != 0x9999)
24585 {
24586 AU_nPRINT("============================================= \n");
24587 AU_nPRINT("** SPDIF TX output type ** \n");
24588 AU_nPRINT("============================================= \n");
24589 AU_nPRINT("pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_UpperOutputType (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_UpperOutputType);
24590 AU_nPRINT("pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_DriverOutputType (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_DriverOutputType);
24591 AU_nPRINT("0x00 SPDIF_TX_NONE \n");
24592 AU_nPRINT("0x01 SPDIF_TX_PCM \n");
24593 AU_nPRINT("0x02 SPDIF_TX_AUTO \n");
24594 AU_nPRINT("0x03 SPDIF_TX_BYPASS \n");
24595 AU_nPRINT("0x04 SPDIF_TX_TRANSCODE \n");
24596 AU_nPRINT("0x05 SPDIF_TX_DD \n");
24597 AU_nPRINT("============================================= \n");
24598 AU_nPRINT("** HDMI TX output type ** \n");
24599 AU_nPRINT("============================================= \n");
24600 AU_nPRINT("pstAudioCustomerShmData->g_audio_customer_HDMI_TX_UpperOutputType (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_HDMI_TX_UpperOutputType);
24601 AU_nPRINT("pstAudioCustomerShmData->g_audio_customer_HDMI_TX_DriverOutputType (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_HDMI_TX_DriverOutputType);
24602 AU_nPRINT("0x10 HDMI_TX_PCM (HDMI PCM) \n");
24603 AU_nPRINT("0x11 HDMI_TX_NONPCM (HDMI NPCM) \n");
24604 AU_nPRINT("0x12 HDMI_TX_EAC3_BYPASS (HDMI DDP bypass) \n");
24605 AU_nPRINT("0x13 HDMI_TX_EAC3 (HDMI DDP) \n");
24606 AU_nPRINT("============================================= \n");
24607 AU_nPRINT("ADEC0_bAtmos_Stream(%d) \n", (unsigned int)ADEC0_bAtmos_Stream);
24608 AU_nPRINT("ADEC1_bAtmos_Stream(%d) \n", (unsigned int)ADEC1_bAtmos_Stream);
24609 AU_nPRINT("bDDP_71_Stream(%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_bDDP_71_Stream);
24610 AU_nPRINT("g_audio_customer_internal_patch_DDP_71_Auto_Bypass_Debounce_Cnt (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_Debounce_Cnt);
24611 AU_nPRINT("g_audio_customer_internal_patch_DDP_71_Auto_Bypass_okFrmCnt (%d) \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_internal_patch_DDP_71_Auto_Bypass_okFrmCnt);
24612 AU_nPRINT("9999 Exit \n");
24613
24614 selNum = AU_CUS_Debug_GetHex("");
24615
24616 //Enable HDMI TX Monitor
24617 API_AUDIO_CUSTOMER_HDMI_TX_SetMonitorOnOff(TRUE);
24618
24619 switch(selNum)
24620 {
24621 case 0x00:
24622 case 0x01:
24623 case 0x02:
24624 case 0x03:
24625 case 0x04:
24626 case 0x05:
24627 {
24628 API_AUDIO_CUSTOMER_SPDIF_TX_SetOutputType((API_AUDIO_CUSTOMER_SPDIF_TX_MODE)selNum);
24629 }
24630 break;
24631
24632 case 0x10:
24633 {
24634 API_AUDIO_CUSTOMER_HDMI_TX_SetOutputType(API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_PCM);
24635 }
24636 break;
24637
24638 case 0x11:
24639 {
24640 API_AUDIO_CUSTOMER_HDMI_TX_SetOutputType(API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_NONPCM);
24641 }
24642 break;
24643
24644 case 0x12:
24645 {
24646 API_AUDIO_CUSTOMER_HDMI_TX_SetOutputType(API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_EAC3_BYPASS);
24647 }
24648 break;
24649
24650 case 0x13:
24651 {
24652 API_AUDIO_CUSTOMER_HDMI_TX_SetOutputType(API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_EAC3);
24653 }
24654 break;
24655
24656 default:
24657 case 0x9999:
24658 {
24659 //Exit
24660 }
24661 break;
24662 }
24663 }
24664 }
24665 break;
24666
24667 case 0x0801:
24668 {
24669 int arg1 = 0;
24670 MS_BOOL bEnable = FALSE;
24671
24672 AU_nPRINT("============================================= \n");
24673 AU_nPRINT("** HDMI ARC Enable/Disable ** \n");
24674 AU_nPRINT("============================================= \n");
24675 AU_nPRINT("Enter 1:Enable 0:Disable:\n");
24676 arg1 = AU_CUS_Debug_GetDec();
24677 bEnable = (MS_BOOL)arg1;
24678
24679 MDrv_HDMI_ARC_PINControl(INPUT_PORT_DVI0, bEnable, FALSE);
24680 MDrv_HDMI_ARC_PINControl(INPUT_PORT_DVI1, bEnable, FALSE);
24681 MDrv_HDMI_ARC_PINControl(INPUT_PORT_DVI2, bEnable, FALSE);
24682 MDrv_HDMI_ARC_PINControl(INPUT_PORT_DVI3, bEnable, FALSE);
24683 #if (0)
24684 if(bEnable)
24685 {
24686 MApi_CEC_TxSendMsg2(E_LA_AUDIO_SYS, E_MSG_ARC_REQUEST_ARC_INITATION,0 ,0);
24687 AU_CUS_Delay1MS(33);
24688 MApi_CEC_TxSendMsg2(E_LA_AUDIO_SYS, E_MSG_ARC_REPORT_ARC_INITIATED,0 ,0);
24689 }
24690 else
24691 {
24692 MApi_CEC_TxSendMsg2(E_LA_AUDIO_SYS, E_MSG_ARC_REQUEST_ARC_TERMINATION,0 ,0);
24693 AU_CUS_Delay1MS(33);
24694 MApi_CEC_TxSendMsg2(E_LA_AUDIO_SYS, E_MSG_ARC_REPORT_ARC_TERMINATED,0 ,0);
24695 }
24696 #endif
24697 }
24698 break;
24699
24700 case 0x0900:
24701 {
24702 int arg1 = 0;
24703 MS_BOOL bOnOff = FALSE;
24704 MS_U16 u16level = 0;
24705 MS_U16 u16offset = 0;
24706 API_AUDIO_CUSTOMER_MSTAR_AVC_MODE mode = API_AUDIO_CUSTOMER_AVC_NORMAL;
24707
24708 AU_nPRINT("============================================= \n");
24709 AU_nPRINT("** MSTAR AVC (HDMI) ** \n");
24710 AU_nPRINT("============================================= \n");
24711 AU_nPRINT("Enter 1:Enable 0:Disable:\n");
24712 arg1 = AU_CUS_Debug_GetDec();
24713 bOnOff = (MS_BOOL)arg1;
24714
24715 // API_AUDIO_CUSTOMER_SNDOUT_Connect should be set when audio systm init, here is just for demo
24716 API_AUDIO_CUSTOMER_SNDOUT_Connect(API_AUDIO_CUSTOMER_SOUNDOUT_HDMI_TX, API_AUDIO_CUSTOMER_SOUNDOUT_INPUT_DSPSE);
24717
24718 API_AUDIO_CUSTOMER_MSTAR_SE_Enable(API_AUDIO_CUSTOMER_AVC, bOnOff);
24719
24720 if(bOnOff == TRUE)
24721 {
24722 AU_nPRINT("Enter AVC level value: 0~80 (step: -0.5dB / range: 0 ~ -40dB)\n");
24723 arg1 = AU_CUS_Debug_GetDec();
24724 u16level = arg1;
24725 API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_LEVEL(u16level);
24726
24727 AU_nPRINT("Enter AVC S MODE OFFSET: +0dB ~ +12dB \n");
24728 arg1 = AU_CUS_Debug_GetDec();
24729 u16offset = arg1;
24730 API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_S_MODE_OFFSET(u16offset);
24731
24732 AU_nPRINT("Enter AVC mode-> 0:Linear 1:Shift 2:Normal\n");
24733 arg1 = AU_CUS_Debug_GetDec();
24734 mode = arg1;
24735 API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_MODE(mode);
24736 }
24737 }
24738 break;
24739
24740 case 0x7202:
24741 {
24742 pAU_nDBG_MenuLog_To_File = AU_CUS_FileOpen(AU_NDBG_MENULOG_TO_FILE_PATH, "wb");
24743 AU_CUS_ShowAudioBlockDiagram();
24744 }
24745 break;
24746
24747 case 0x8888:
24748 {
24749 pAU_nDBG_Log_To_File = AU_CUS_FileOpen(AU_NDBG_LOG_TO_FILE_PATH, "wb");
24750 pAU_nDBG_MenuLog_To_File = AU_CUS_FileOpen(AU_NDBG_MENULOG_TO_FILE_PATH, "wb");
24751 }
24752 break;
24753
24754 case 0x4444:
24755 {
24756 fflush(pAU_nDBG_Log_To_File);
24757 if (pAU_nDBG_Log_To_File != NULL)
24758 {
24759 AU_CUS_FileClose(pAU_nDBG_Log_To_File);
24760 pAU_nDBG_Log_To_File = NULL;
24761 }
24762 }
24763 break;
24764
24765 case 0x1111:
24766 {
24767 //refresh
24768 }
24769 break;
24770
24771 case 0x1234:
24772 {
24773 AU_CUS_SingleFunctionDebugMenu();
24774 }
24775 break;
24776
24777 case 0x9990:
24778 {
24779 AU_CUS_Show_HashKey_Support();
24780 }
24781 break;
24782
24783 case 0x9991:
24784 {
24785 AU_CUS_AQ_Tuning_and_Dump_Data();
24786 }
24787 break;
24788
24789 case 0x9992:
24790 {
24791 AU_CUS_MCU_DUMP_R2_LOG();
24792 }
24793 break;
24794
24795 case 0x9993:
24796 {
24797 AU_CUS_Where_Am_I();
24798 }
24799 break;
24800
24801 case 0x9994:
24802 {
24803 AU_CUS_DDR_Dump_Debug();
24804 }
24805 break;
24806
24807 case 0x9995:
24808 {
24809 AU_CUS_Dump_Audio_Related_Bank();
24810 }
24811 break;
24812
24813 case 0x9996:
24814 {
24815 AU_CUS_SHOW_ALL_VERSION();
24816 }
24817 break;
24818
24819 case 0x9997:
24820 {
24821 AU_CUS_SIF_Debug();
24822 }
24823 break;
24824
24825 case 0x9998:
24826 {
24827 AU_CUS_RegDebug();
24828 }
24829 break;
24830
24831 default:
24832 case 0x9999:
24833 {
24834 AU_nPRINT("\n\n\n\n\n\n\n\n");
24835 AU_nPRINT("============================================================ \n");
24836 AU_nPRINT(">>>> Exit AU_Debug menu, BYE BYE!!! Audio Bless You !!! <<<< \n");
24837 AU_nPRINT("============================================================ \n");
24838 AU_nPRINT("\n\n\n\n\n\n\n\n");
24839
24840 return TRUE;
24841 }
24842 break;
24843 }
24844
24845 AU_nPRINT("[AUDIO][%s] [%s] [%d] [arg1 = 0x%x] \n", __FILE__, __FUNCTION__, __LINE__, (unsigned int)arg1);
24846 AU_nPRINT("[AUDIO][%s] [%s] [%d] [arg2 = 0x%x] \n", __FILE__, __FUNCTION__, __LINE__, (unsigned int)arg2);
24847 AU_nPRINT("[AUDIO][%s] [%s] [%d] [arg3 = 0x%x] \n", __FILE__, __FUNCTION__, __LINE__, (unsigned int)arg3);
24848 AU_nPRINT("[AUDIO][%s] [%s] [%d] [arg4 = 0x%x] \n", __FILE__, __FUNCTION__, __LINE__, (unsigned int)arg4);
24849 AU_nPRINT("[AUDIO][%s] [%s] [%d] [arg5 = 0x%x] \n", __FILE__, __FUNCTION__, __LINE__, (unsigned int)arg5);
24850 AU_nPRINT("[AUDIO][%s] [%s] [%d] [arg6 = 0x%x] \n", __FILE__, __FUNCTION__, __LINE__, (unsigned int)arg6);
24851 AU_nPRINT("[AUDIO][%s] [%s] [%d] [arg7 = 0x%x] \n", __FILE__, __FUNCTION__, __LINE__, (unsigned int)arg7);
24852 AU_nPRINT("[AUDIO][%s] [%s] [%d] [arg8 = 0x%x] \n", __FILE__, __FUNCTION__, __LINE__, (unsigned int)arg8);
24853 AU_nPRINT("[AUDIO][%s] [%s] [%d] [arg9 = 0x%x] \n", __FILE__, __FUNCTION__, __LINE__, (unsigned int)arg9);
24854 AU_nPRINT("[AUDIO][%s] [%s] [%d] [arg10 = 0x%x] \n", __FILE__, __FUNCTION__, __LINE__, (unsigned int)arg10);
24855 AU_nPRINT("[AUDIO][%s] [%s] [%d] [------AUDIO_DEBUG------End] \n\n\n", __FILE__, __FUNCTION__, __LINE__);
24856 }
24857 }
24858
24859 #endif
24860
24861 //-------------------------------------------------------------------------------------------------------------------------------------
24862 // Until to debug menu, is the APIs open to customer, DO NOT add Internal function / variable / define.
24863 // Until to debug menu, is the APIs open to customer, DO NOT add Internal function / variable / define.
24864 // Until to debug menu, is the APIs open to customer, DO NOT add Internal function / variable / define.
24865 // please understand, it's important.
24866 //-------------------------------------------------------------------------------------------------------------------------------------
24867 /* Initialize, STR */
API_AUDIO_CUSTOMER_InitializeModule(MS_U32 u32MiuNo,MS_U32 mad_va,API_AUDIO_CUSTOMER_OUTPUT_INFO OutputInfo,API_AUDIO_CUSTOMER_CHIP_PLATFORM chipPlatform)24868 MS_BOOL API_AUDIO_CUSTOMER_InitializeModule(MS_U32 u32MiuNo, MS_U32 mad_va, API_AUDIO_CUSTOMER_OUTPUT_INFO OutputInfo, API_AUDIO_CUSTOMER_CHIP_PLATFORM chipPlatform)
24869 {
24870 MS_U32 mad_pa;
24871 Digital_Out_Device_Capability_t Device_Capability;
24872 API_AUDIO_CUSTOMER_DOLBY_DRC_MODE dolbyDrcMode = API_AUDIO_CUSTOMER_DOLBY_LINE_MODE;
24873 AU_UNUSED(dolbyDrcMode);
24874
24875 AU_CUS_ShmInit();
24876 AU_CUS_Mutex_Init();
24877
24878 pstAudioCustomerShmData->g_audio_customer_Chip_Platform = chipPlatform;
24879
24880 #ifdef CONFIG_API_HDMITX //TV dont have HDMI TX
24881 if(pstAudioCustomerShmData->g_audio_customer_Chip_Platform == API_AUDIO_CUSTOMER_CHIP_PLATFORM_STB)
24882 {
24883 #ifdef CONFIG_MBOOT
24884 {
24885 //do nothing
24886 }
24887 #else
24888 {
24889 //help to init HDMI for HDMI TX monitor.
24890 MApi_HDMITx_Init();
24891 }
24892 #endif
24893 }
24894 #endif
24895
24896 if(pstAudioCustomerShmData->g_audio_customer_Init_Done == TRUE)
24897 {
24898 AU_nPRINT("[AUDIO][%s] [%d] [Return for Double Init!!!] \n", __FUNCTION__, __LINE__);
24899 return TRUE;
24900 }
24901
24902 AU_nDBG("[u32MiuNo = 0x%x] \n", (unsigned int)u32MiuNo);
24903 AU_nDBG("[mad_va = 0x%x] \n", (unsigned int)mad_va);
24904 AU_nDBG("[OutputInfo.SpeakerOut = 0x%x] \n", (unsigned int)OutputInfo.SpeakerOut);
24905 AU_nDBG("[OutputInfo.HpOut = 0x%x] \n", (unsigned int)OutputInfo.HpOut);
24906 AU_nDBG("[OutputInfo.MonitorOut = 0x%x] \n", (unsigned int)OutputInfo.MonitorOut);
24907 AU_nDBG("[OutputInfo.ScartOut = 0x%x] \n", (unsigned int)OutputInfo.ScartOut);
24908 AU_nDBG("[OutputInfo.SpdifOut = 0x%x] \n", (unsigned int)OutputInfo.SpdifOut);
24909 AU_nDBG("[OutputInfo.ArcOut = 0x%x] \n", (unsigned int)OutputInfo.ArcOut);
24910 AU_nDBG("[OutputInfo.HDMIOut = 0x%x] \n", (unsigned int)OutputInfo.HDMIOut);
24911
24912 //write audio pre-init table
24913 MApi_AUDIO_WritePreInitTable();
24914
24915 //Set AUDIO DDR info
24916 mad_pa = (MS_U32)MsOS_MPool_VA2PA(mad_va);
24917 #if(UTPA_AUDIO_CHIP_TYPE_1D)
24918 {
24919 MApi_AUDIO_SetDspBaseAddr(DSP_SE, 0 , mad_pa + u32MiuNo);
24920 }
24921 #else
24922 {
24923 MApi_AUDIO_SetDspBaseAddr(DSP_ADV, 0 , mad_pa + u32MiuNo);
24924 }
24925 #endif
24926
24927 //Set output info
24928 MApi_AUDIO_SetOutputInfo((AUDIO_OUT_INFO*)&OutputInfo);
24929
24930 //audio init
24931 MApi_AUDIO_Initialize();
24932
24933 //Initialize audio global variable
24934 memset((void *)&madCallBack, 0, sizeof(St_Audio_Callback_Func));
24935 memset((void *)&clipDecoderInfo, 0, sizeof(St_Audio_Clip_Decoder_Info));
24936 AU_CUS_Initial_Register_Bank_By_ChipType();
24937
24938 //Create thread
24939 AU_CUS_CreateThread();
24940
24941 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
24942 {
24943 AU_CUS_KERNEL_DEBUG_PROC_init();
24944 }
24945 #endif
24946
24947 //set device default capability
24948 memset((void *)&Device_Capability, 0, sizeof(Device_Capability));
24949 Device_Capability.support_codec = 1;
24950 MApi_AUDIO_DigitalOut_SetDeviceCapability(DIGITAL_HDMI_ARC_OUTPUT, CODEC_DD , &Device_Capability);
24951 MApi_AUDIO_DigitalOut_SetDeviceCapability(DIGITAL_HDMI_ARC_OUTPUT, CODEC_AAC, &Device_Capability);
24952 MApi_AUDIO_DigitalOut_SetDeviceCapability(DIGITAL_HDMI_ARC_OUTPUT, CODEC_DDP, &Device_Capability);
24953 MApi_AUDIO_DigitalOut_SetDeviceCapability(DIGITAL_HDMI_ARC_OUTPUT, CODEC_DTS, &Device_Capability);
24954
24955 //init FWM connect
24956 AU_CUS_FW_MIXER_Connect(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5);
24957 AU_CUS_FW_MIXER_Connect(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH6);
24958 AU_CUS_FW_MIXER_Connect(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH8);
24959
24960 //init FWM gain to 0dB
24961 AU_CUS_SetFWMixerChannelGain(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5, 919);
24962 AU_CUS_SetFWMixerChannelGain(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH6, 919);
24963 AU_CUS_SetFWMixerChannelGain(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH8, 919);
24964
24965 //init FWM0 Mute status
24966 AU_CUS_SetFWMixerChannelMute(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5, FALSE);
24967 AU_CUS_SetFWMixerChannelMute(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH6, TRUE);
24968 AU_CUS_SetFWMixerChannelMute(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH8, FALSE);
24969
24970 #if(CUSTOMIZED_INTERNAL_PATCH_LIMITED_AUDIO_DELAY_ENABLE)
24971 {
24972 AU_CUS_SetAudioDelay((MS_U32)AUDIO_DELAY_LOWER_BOUND);
24973 }
24974 #endif
24975
24976 //init ADEC0 codec type to AC3
24977 #if(CUSTOMIZED_INTERNAL_PATCH_ADEC0_INITIAL_CODEC_TYPE_AC3_ENABLE)
24978 {
24979 AU_CUS_ADEC_Connect(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_ADEC_INPUT_MM);
24980 AU_CUS_SetCodecType(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_CODEC_TYPE_AC3);
24981 }
24982 #endif
24983
24984 #if(CUSTOMIZED_INTERNAL_PATCH_ADEC0_INITIAL_DOLBY_DRC_LINE_MODE)
24985 {
24986 AU_CUS_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_ADEC_PARAM_AC3P_DRC_MODE, &dolbyDrcMode);
24987 }
24988 #endif
24989
24990 //update Audio Init flag
24991 pstAudioCustomerShmData->g_audio_customer_Init_Done = TRUE;
24992
24993 #if(CUSTOMIZED_INTERNAL_PATCH_R2_ACTIVE_MONITOR_ENABLE)
24994 {
24995 //do nothing
24996 }
24997 #else
24998 {
24999 g_api_audio_InitializeModule_R2_bActive = TRUE;
25000 }
25001 #endif
25002
25003 return TRUE;
25004 }
25005
API_AUDIO_CUSTOMER_InitializeModule_IsFinish(void)25006 MS_BOOL API_AUDIO_CUSTOMER_InitializeModule_IsFinish(void)
25007 {
25008 return g_api_audio_InitializeModule_R2_bActive;
25009 }
25010
API_AUDIO_CUSTOMER_Suspend(void)25011 MS_BOOL API_AUDIO_CUSTOMER_Suspend(void)
25012 {
25013 pstAudioCustomerShmData->g_audio_customer_Init_Done = FALSE;
25014 pstAudioCustomerShmData->g_audio_customer_STR_bSuspendStart = TRUE;
25015 pstAudioCustomerShmData->g_audio_customer_STR_bResumeFinish = FALSE;
25016 g_api_audio_InitializeModule_R2_bActive = FALSE;
25017
25018 //let HDMI RX monitor alive when next HDMI Connect.
25019 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type = API_AUDIO_CUSTOMER_CODEC_TYPE_UNKNOWN;
25020 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Previous_Codec_Type = API_AUDIO_CUSTOMER_CODEC_TYPE_UNKNOWN;
25021
25022 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Init_Done = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Init_Done);
25023 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_STR_bSuspendStart = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_STR_bSuspendStart);
25024 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_STR_bResumeFinish = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_STR_bResumeFinish);
25025 AU_nDBG("[g_api_audio_InitializeModule_R2_bActive = %d] \n", (unsigned int)g_api_audio_InitializeModule_R2_bActive);
25026 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type);
25027 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Previous_Codec_Type = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Previous_Codec_Type);
25028
25029 #if(UTPA_SUPPORT_SET_POWER_ON)
25030 {
25031 MApi_AUDIO_SetPowerOn(FALSE);
25032 }
25033 #endif
25034
25035 return TRUE;
25036 }
25037
API_AUDIO_CUSTOMER_Resume(void)25038 MS_BOOL API_AUDIO_CUSTOMER_Resume(void)
25039 {
25040 MS_BOOL Sound_Out_I2S_bMute_Backup = FALSE;
25041 MS_BOOL Sound_Out_Line0_bMute_Backup = FALSE;
25042 MS_BOOL Sound_Out_Line1_bMute_Backup = FALSE;
25043 MS_BOOL Sound_Out_Line2_bMute_Backup = FALSE;
25044 MS_BOOL Sound_Out_Line3_bMute_Backup = FALSE;
25045 MS_BOOL Sound_Out_SPDIF_bMute_Backup = FALSE;
25046
25047 pstAudioCustomerShmData->g_audio_customer_STR_bSuspendStart = FALSE;
25048 pstAudioCustomerShmData->g_audio_customer_STR_bResumeFinish = FALSE;
25049
25050 //avoid pop noise
25051 Sound_Out_I2S_bMute_Backup = pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_bMute;
25052 Sound_Out_Line0_bMute_Backup = pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_bMute;
25053 Sound_Out_Line1_bMute_Backup = pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_bMute;
25054 Sound_Out_Line2_bMute_Backup = pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_bMute;
25055 Sound_Out_Line3_bMute_Backup = pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_bMute;
25056 Sound_Out_SPDIF_bMute_Backup = pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_bMute;
25057
25058 AU_CUS_SetI2SOutMute(TRUE);
25059 AU_CUS_SetLineOutMute(API_AUDIO_CUSTOMER_LINE_OUT_0, TRUE);
25060 AU_CUS_SetLineOutMute(API_AUDIO_CUSTOMER_LINE_OUT_1, TRUE);
25061 AU_CUS_SetLineOutMute(API_AUDIO_CUSTOMER_LINE_OUT_2, TRUE);
25062 AU_CUS_SetLineOutMute(API_AUDIO_CUSTOMER_LINE_OUT_3, TRUE);
25063 AU_CUS_SetSPDIFOutMute(TRUE);
25064
25065 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Init_Done = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Init_Done);
25066 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_STR_bSuspendStart = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_STR_bSuspendStart);
25067 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_STR_bResumeFinish = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_STR_bResumeFinish);
25068 AU_nDBG("[g_api_audio_InitializeModule_R2_bActive = %d] \n", (unsigned int)g_api_audio_InitializeModule_R2_bActive);
25069
25070 //write audio pre-init table
25071 MApi_AUDIO_WritePreInitTable();
25072
25073 //wait for AMP init
25074 AU_CUS_Delay1MS(1);
25075
25076 //audio init
25077 MApi_AUDIO_Initialize();
25078
25079 #if(CUSTOMIZED_INTERNAL_PATCH_STR_RESUME_ADC_FAST_CHARGE_ENABLE)
25080 {
25081 //ADC Fast charge (Begin)
25082 AU_CUS_WriteAbsMaskReg(REG_ADC_FAST_CHARGE, 0x1000, 0x1000);
25083 }
25084 #endif
25085
25086 #if(UTPA_SUPPORT_AC3P_INFOTYPE_HDMITX_BYPASS_ENABLE)
25087 {
25088 //reset g_DDPBypassenable_1 and g_DDPBypassenable_2 to default value for HDMI RX monitor
25089 MApi_AUDIO_SetAC3PInfo(Audio_AC3P_infoType_hdmiTxBypass_enable, DDPBYPASSENABLE_1_DEFAULT, 0);
25090 MApi_AUDIO_SetAC3PInfo(Audio_AC3P_infoType_hdmiTxBypass_enable, DDPBYPASSENABLE_2_DEFAULT, 1);
25091 }
25092 #endif
25093
25094 //set device default capability
25095 Digital_Out_Device_Capability_t Device_Capability;
25096 Device_Capability.support_codec = 1;
25097 MApi_AUDIO_DigitalOut_SetDeviceCapability(DIGITAL_HDMI_ARC_OUTPUT, CODEC_DD , &Device_Capability);
25098 MApi_AUDIO_DigitalOut_SetDeviceCapability(DIGITAL_HDMI_ARC_OUTPUT, CODEC_AAC, &Device_Capability);
25099 MApi_AUDIO_DigitalOut_SetDeviceCapability(DIGITAL_HDMI_ARC_OUTPUT, CODEC_DDP, &Device_Capability);
25100 MApi_AUDIO_DigitalOut_SetDeviceCapability(DIGITAL_HDMI_ARC_OUTPUT, CODEC_DTS, &Device_Capability);
25101
25102 #if(CUSTOMIZED_INTERNAL_PATCH_ADEC0_INITIAL_CODEC_TYPE_AC3_ENABLE)
25103 {
25104 AU_CUS_ADEC_Connect(API_AUDIO_CUSTOMER_ADEC0, pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect);
25105 AU_CUS_SetCodecType(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_CODEC_TYPE_AC3);
25106 }
25107 #endif
25108
25109 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperPlay = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperPlay);
25110 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect);
25111 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperCodec = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperCodec);
25112 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC0_SyncMode = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC0_SyncMode);
25113
25114 if(pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperPlay == API_AUDIO_CUSTOMER_UPPER_PLAY)
25115 {
25116 AU_CUS_ADEC_Connect(API_AUDIO_CUSTOMER_ADEC0, pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect);
25117 AU_CUS_SetCodecType(API_AUDIO_CUSTOMER_ADEC0, pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperCodec);
25118 AU_CUS_StartDecoding(API_AUDIO_CUSTOMER_ADEC0);
25119 AU_CUS_SetSyncMode(API_AUDIO_CUSTOMER_ADEC0, pstAudioCustomerShmData->g_audio_customer_ADEC0_SyncMode);
25120 }
25121
25122 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperPlay = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperPlay);
25123 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect);
25124 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperCodec = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperCodec);
25125 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC1_SyncMode = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC1_SyncMode);
25126
25127 if(pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperPlay == API_AUDIO_CUSTOMER_UPPER_PLAY)
25128 {
25129 AU_CUS_ADEC_Connect(API_AUDIO_CUSTOMER_ADEC1, pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect);
25130 AU_CUS_SetCodecType(API_AUDIO_CUSTOMER_ADEC1, pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperCodec);
25131 AU_CUS_StartDecoding(API_AUDIO_CUSTOMER_ADEC1);
25132 AU_CUS_SetSyncMode(API_AUDIO_CUSTOMER_ADEC1, pstAudioCustomerShmData->g_audio_customer_ADEC1_SyncMode);
25133 }
25134
25135 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_UpperPlay = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_UpperPlay);
25136 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Connect = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Connect);
25137 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_UpperSifType = 0x%x] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_UpperSifType);
25138
25139 if(pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_UpperPlay == API_AUDIO_CUSTOMER_UPPER_PLAY)
25140 {
25141 AU_CUS_ADEC_Connect(API_AUDIO_CUSTOMER_ADEC_ATV, pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Connect);
25142 AU_CUS_SetCodecType(API_AUDIO_CUSTOMER_ADEC_ATV, pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_UpperSifType);
25143 AU_CUS_StartDecoding(API_AUDIO_CUSTOMER_ADEC_ATV);
25144 }
25145
25146 if(pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DolbyDRCMode > API_AUDIO_CUSTOMER_DOLBY_DRC_MODE_INVALID)
25147 {
25148 AU_CUS_SetAudioParam(API_AUDIO_CUSTOMER_ADEC0, API_AUDIO_CUSTOMER_ADEC_PARAM_AC3P_DRC_MODE, &pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DolbyDRCMode);
25149 }
25150
25151 if(pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3P_DolbyDRCMode > API_AUDIO_CUSTOMER_DOLBY_DRC_MODE_INVALID)
25152 {
25153 AU_CUS_SetAudioParam(API_AUDIO_CUSTOMER_ADEC1, API_AUDIO_CUSTOMER_ADEC_PARAM_AC3P_DRC_MODE, &pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3P_DolbyDRCMode);
25154 }
25155
25156 AU_CUS_CH_Sound_Connect(API_AUDIO_CUSTOMER_CH5_SOUND, pstAudioCustomerShmData->g_audio_customer_CH5_Sound_Connect);
25157 AU_CUS_CH_Sound_Connect(API_AUDIO_CUSTOMER_CH6_SOUND, pstAudioCustomerShmData->g_audio_customer_CH6_Sound_Connect);
25158 AU_CUS_CH_Sound_Connect(API_AUDIO_CUSTOMER_CH8_SOUND, pstAudioCustomerShmData->g_audio_customer_CH8_Sound_Connect);
25159
25160 AU_CUS_FW_MIXER_Connect(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5);
25161 AU_CUS_FW_MIXER_Connect(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH6);
25162 AU_CUS_FW_MIXER_Connect(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH8);
25163
25164 AU_CUS_SetFWMixerChannelGain(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5, pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_Gain[API_AUDIO_CUSTOMER_FWM_INPUT_CH5]);
25165 AU_CUS_SetFWMixerChannelGain(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH6, pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_Gain[API_AUDIO_CUSTOMER_FWM_INPUT_CH6]);
25166 AU_CUS_SetFWMixerChannelGain(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH8, pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_Gain[API_AUDIO_CUSTOMER_FWM_INPUT_CH8]);
25167
25168 AU_CUS_SetFWMixerChannelMute(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH5, pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH5]);
25169 AU_CUS_SetFWMixerChannelMute(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH6, pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH6]);
25170 AU_CUS_SetFWMixerChannelMute(API_AUDIO_CUSTOMER_FWM0, API_AUDIO_CUSTOMER_FWM_INPUT_CH8, pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH8]);
25171
25172 AU_CUS_SetI2SOutGain(pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_Gain);
25173 AU_CUS_SetI2SOutMute(Sound_Out_I2S_bMute_Backup);
25174
25175 AU_CUS_SetLineOutGain(API_AUDIO_CUSTOMER_LINE_OUT_0, pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_Gain);
25176 AU_CUS_SetLineOutGain(API_AUDIO_CUSTOMER_LINE_OUT_1, pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_Gain);
25177 AU_CUS_SetLineOutGain(API_AUDIO_CUSTOMER_LINE_OUT_2, pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_Gain);
25178 AU_CUS_SetLineOutGain(API_AUDIO_CUSTOMER_LINE_OUT_3, pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_Gain);
25179
25180 AU_CUS_SetLineOutMute(API_AUDIO_CUSTOMER_LINE_OUT_0, Sound_Out_Line0_bMute_Backup);
25181 AU_CUS_SetLineOutMute(API_AUDIO_CUSTOMER_LINE_OUT_1, Sound_Out_Line1_bMute_Backup);
25182 AU_CUS_SetLineOutMute(API_AUDIO_CUSTOMER_LINE_OUT_2, Sound_Out_Line2_bMute_Backup);
25183 AU_CUS_SetLineOutMute(API_AUDIO_CUSTOMER_LINE_OUT_3, Sound_Out_Line3_bMute_Backup);
25184
25185 AU_CUS_SetSPDIFOutGain(pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_Gain);
25186 AU_CUS_SetSPDIFOutMute(Sound_Out_SPDIF_bMute_Backup);
25187
25188 pstAudioCustomerShmData->g_audio_customer_Init_Done = TRUE;
25189 pstAudioCustomerShmData->g_audio_customer_STR_bResumeFinish = TRUE;
25190 g_api_audio_InitializeModule_R2_bActive = TRUE;
25191
25192 #if(CUSTOMIZED_INTERNAL_PATCH_STR_RESUME_ADC_FAST_CHARGE_ENABLE)
25193 {
25194 //ADC Fast charge (End)
25195 AU_CUS_WriteAbsMaskReg(REG_ADC_FAST_CHARGE, 0x1000, 0x0000);
25196 }
25197 #endif
25198
25199 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_Init_Done = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_Init_Done);
25200 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_STR_bSuspendStart = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_STR_bSuspendStart);
25201 AU_nDBG("[pstAudioCustomerShmData->g_audio_customer_STR_bResumeFinish = %d] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_STR_bResumeFinish);
25202 AU_nDBG("[g_api_audio_InitializeModule_R2_bActive = %d] \n", (unsigned int)g_api_audio_InitializeModule_R2_bActive);
25203
25204 return TRUE;
25205 }
25206
25207 /* Connect & Disconnect */
API_AUDIO_CUSTOMER_SetParserMode(API_AUDIO_CUSTOMER_PARSER_MODE ParserMode)25208 MS_BOOL API_AUDIO_CUSTOMER_SetParserMode(API_AUDIO_CUSTOMER_PARSER_MODE ParserMode)
25209 {
25210 AU_nDBG("[ParserMode = 0x%x] \n", (unsigned int)ParserMode);
25211
25212 pstAudioCustomerShmData->g_audio_customer_PARSER_Mode = ParserMode;
25213
25214 ////////////////////////////////////////////////////////////////////////////////
25215 // mode 0:
25216 // AFIFO_0-> ES1
25217 // AFIFO_1-> ES2
25218 // AFIFO_2-> ES3
25219 // AFIFO_3-> ES4
25220 // mode 1:
25221 // AFIFO_2-> ES1
25222 // AFIFO_3-> ES2
25223 // AFIFO_0-> ES3
25224 // AFIFO_1-> ES4
25225 // mode 2:
25226 // AFIFO_1-> ES1
25227 // AFIFO_2-> ES2
25228 // AFIFO_0-> ES3
25229 // AFIFO_3-> ES4
25230 // mode 3:
25231 // AFIFO_0-> ES1
25232 // AFIFO_2-> ES2
25233 // AFIFO_1-> ES3
25234 // AFIFO_3-> ES4
25235 ////////////////////////////////////////////////////////////////////////////////
25236 switch(ParserMode)
25237 {
25238 case API_AUDIO_CUSTOMER_PARSER_MODE_0:
25239 {
25240 pstAudioCustomerShmData->g_audio_customer_PARSER_A_Connect = API_AUDIO_CUSTOMER_PARSER_INPUT_AFIFO0;
25241 pstAudioCustomerShmData->g_audio_customer_PARSER_B_Connect = API_AUDIO_CUSTOMER_PARSER_INPUT_AFIFO1;
25242 pstAudioCustomerShmData->g_audio_customer_PARSER_C_Connect = API_AUDIO_CUSTOMER_PARSER_INPUT_AFIFO2;
25243 pstAudioCustomerShmData->g_audio_customer_PARSER_D_Connect = API_AUDIO_CUSTOMER_PARSER_INPUT_AFIFO3;
25244 }
25245 break;
25246
25247 case API_AUDIO_CUSTOMER_PARSER_MODE_1:
25248 {
25249 pstAudioCustomerShmData->g_audio_customer_PARSER_A_Connect = API_AUDIO_CUSTOMER_PARSER_INPUT_AFIFO2;
25250 pstAudioCustomerShmData->g_audio_customer_PARSER_B_Connect = API_AUDIO_CUSTOMER_PARSER_INPUT_AFIFO3;
25251 pstAudioCustomerShmData->g_audio_customer_PARSER_C_Connect = API_AUDIO_CUSTOMER_PARSER_INPUT_AFIFO0;
25252 pstAudioCustomerShmData->g_audio_customer_PARSER_D_Connect = API_AUDIO_CUSTOMER_PARSER_INPUT_AFIFO1;
25253 }
25254 break;
25255
25256 case API_AUDIO_CUSTOMER_PARSER_MODE_2:
25257 {
25258 pstAudioCustomerShmData->g_audio_customer_PARSER_A_Connect = API_AUDIO_CUSTOMER_PARSER_INPUT_AFIFO1;
25259 pstAudioCustomerShmData->g_audio_customer_PARSER_B_Connect = API_AUDIO_CUSTOMER_PARSER_INPUT_AFIFO2;
25260 pstAudioCustomerShmData->g_audio_customer_PARSER_C_Connect = API_AUDIO_CUSTOMER_PARSER_INPUT_AFIFO0;
25261 pstAudioCustomerShmData->g_audio_customer_PARSER_D_Connect = API_AUDIO_CUSTOMER_PARSER_INPUT_AFIFO3;
25262 }
25263 break;
25264
25265 case API_AUDIO_CUSTOMER_PARSER_MODE_3:
25266 {
25267 pstAudioCustomerShmData->g_audio_customer_PARSER_A_Connect = API_AUDIO_CUSTOMER_PARSER_INPUT_AFIFO0;
25268 pstAudioCustomerShmData->g_audio_customer_PARSER_B_Connect = API_AUDIO_CUSTOMER_PARSER_INPUT_AFIFO2;
25269 pstAudioCustomerShmData->g_audio_customer_PARSER_C_Connect = API_AUDIO_CUSTOMER_PARSER_INPUT_AFIFO1;
25270 pstAudioCustomerShmData->g_audio_customer_PARSER_D_Connect = API_AUDIO_CUSTOMER_PARSER_INPUT_AFIFO3;
25271 }
25272 break;
25273
25274 default:
25275 break;
25276 }
25277
25278 MApi_AUDIO_SetCommAudioInfo(Audio_Comm_infoType_Set_Parser, (MS_U32)ParserMode, 0);
25279
25280 return TRUE;
25281 }
25282
API_AUDIO_CUSTOMER_ADEC_Connect(API_AUDIO_CUSTOMER_ADEC_INDEX currentConnect,API_AUDIO_CUSTOMER_ADEC_INPUT inputConnect)25283 MS_BOOL API_AUDIO_CUSTOMER_ADEC_Connect(API_AUDIO_CUSTOMER_ADEC_INDEX currentConnect, API_AUDIO_CUSTOMER_ADEC_INPUT inputConnect)
25284 {
25285 AU_nDBG("[currentConnect = 0x%x] [inputConnect = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect);
25286
25287 return AU_CUS_ADEC_Connect(currentConnect, inputConnect);
25288 }
25289
API_AUDIO_CUSTOMER_ADEC_Disconnect(API_AUDIO_CUSTOMER_ADEC_INDEX currentConnect)25290 MS_BOOL API_AUDIO_CUSTOMER_ADEC_Disconnect(API_AUDIO_CUSTOMER_ADEC_INDEX currentConnect)
25291 {
25292 AU_nDBG("[currentConnect = 0x%x] \n", (unsigned int)currentConnect);
25293
25294 return AU_CUS_ADEC_Disconnect(currentConnect);
25295 }
25296
API_AUDIO_CUSTOMER_ADC_Connect(API_AUDIO_CUSTOMER_ADC_INDEX currentConnect,API_AUDIO_CUSTOMER_ADC_IN_PORT portNum)25297 MS_BOOL API_AUDIO_CUSTOMER_ADC_Connect(API_AUDIO_CUSTOMER_ADC_INDEX currentConnect, API_AUDIO_CUSTOMER_ADC_IN_PORT portNum)
25298 {
25299 AU_nDBG("[currentConnect = 0x%x][portNum = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)portNum);
25300
25301 return AU_CUS_ADC_Connect(currentConnect, portNum);
25302 }
25303
API_AUDIO_CUSTOMER_ADC_Disconnect(API_AUDIO_CUSTOMER_ADC_INDEX currentConnect,API_AUDIO_CUSTOMER_ADC_IN_PORT portNum)25304 MS_BOOL API_AUDIO_CUSTOMER_ADC_Disconnect(API_AUDIO_CUSTOMER_ADC_INDEX currentConnect, API_AUDIO_CUSTOMER_ADC_IN_PORT portNum)
25305 {
25306 AU_nDBG("[currentConnect = 0x%x][portNum = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)portNum);
25307
25308 return AU_CUS_ADC_Disconnect(currentConnect, portNum);
25309 }
25310
API_AUDIO_CUSTOMER_PCM_Mixer_Connect(API_AUDIO_CUSTOMER_PCM_MIXER_INDEX currentConnect,API_AUDIO_CUSTOMER_PCM_MIXER_INPUT inputConnect)25311 MS_BOOL API_AUDIO_CUSTOMER_PCM_Mixer_Connect(API_AUDIO_CUSTOMER_PCM_MIXER_INDEX currentConnect, API_AUDIO_CUSTOMER_PCM_MIXER_INPUT inputConnect)
25312 {
25313 AU_nDBG("[currentConnect = 0x%x] [inputConnect = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect);
25314
25315 return FALSE;
25316 }
25317
API_AUDIO_CUSTOMER_PCM_Mixer_Disconnect(API_AUDIO_CUSTOMER_PCM_MIXER_INDEX currentConnect,API_AUDIO_CUSTOMER_PCM_MIXER_INPUT inputConnect)25318 MS_BOOL API_AUDIO_CUSTOMER_PCM_Mixer_Disconnect(API_AUDIO_CUSTOMER_PCM_MIXER_INDEX currentConnect, API_AUDIO_CUSTOMER_PCM_MIXER_INPUT inputConnect)
25319 {
25320 AU_nDBG("[currentConnect = 0x%x] [inputConnect = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect);
25321
25322 return FALSE;
25323 }
25324
API_AUDIO_CUSTOMER_CH_Sound_Connect(API_AUDIO_CUSTOMER_CH_SOUND currentConnect,API_AUDIO_CUSTOMER_CH_INPUT inputConnect)25325 MS_BOOL API_AUDIO_CUSTOMER_CH_Sound_Connect(API_AUDIO_CUSTOMER_CH_SOUND currentConnect, API_AUDIO_CUSTOMER_CH_INPUT inputConnect)
25326 {
25327 AU_nDBG("[currectChannel = 0x%x] [inputConnect = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect);
25328
25329 return AU_CUS_CH_Sound_Connect(currentConnect, inputConnect);
25330 }
25331
API_AUDIO_CUSTOMER_CH_Sound_Disconnect(API_AUDIO_CUSTOMER_CH_SOUND currentConnect,API_AUDIO_CUSTOMER_CH_INPUT inputConnect)25332 MS_BOOL API_AUDIO_CUSTOMER_CH_Sound_Disconnect(API_AUDIO_CUSTOMER_CH_SOUND currentConnect, API_AUDIO_CUSTOMER_CH_INPUT inputConnect)
25333 {
25334 AU_nDBG("[currectChannel = 0x%x] [inputConnect = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect);
25335
25336 return AU_CUS_CH_Sound_Disconnect(currentConnect, inputConnect);
25337 }
25338
API_AUDIO_CUSTOMER_FW_MIXER_Connect(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect,API_AUDIO_CUSTOMER_FWM_INPUT inputConnect)25339 MS_BOOL API_AUDIO_CUSTOMER_FW_MIXER_Connect(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect, API_AUDIO_CUSTOMER_FWM_INPUT inputConnect)
25340 {
25341 AU_nDBG("[currentConnect = 0x%x] [inputConnect = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect);
25342
25343 return AU_CUS_FW_MIXER_Connect(currentConnect, inputConnect);
25344 }
25345
API_AUDIO_CUSTOMER_FW_MIXER_Disconnect(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect,API_AUDIO_CUSTOMER_FWM_INPUT inputConnect)25346 MS_BOOL API_AUDIO_CUSTOMER_FW_MIXER_Disconnect(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect, API_AUDIO_CUSTOMER_FWM_INPUT inputConnect)
25347 {
25348 AU_nDBG("[currentConnect = 0x%x] [inputConnect = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect);
25349
25350 return AU_CUS_FW_MIXER_Disconnect(currentConnect, inputConnect);
25351 }
25352
API_AUDIO_CUSTOMER_SE_Connect(API_AUDIO_CUSTOMER_SE_INDEX currentConnect,API_AUDIO_CUSTOMER_SE_INPUT inputConnect)25353 MS_BOOL API_AUDIO_CUSTOMER_SE_Connect(API_AUDIO_CUSTOMER_SE_INDEX currentConnect, API_AUDIO_CUSTOMER_SE_INPUT inputConnect)
25354 {
25355 AU_nDBG("[currentConnect = 0x%x] [inputConnect = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect);
25356
25357 return FALSE;
25358 }
25359
API_AUDIO_CUSTOMER_SE_Disconnect(API_AUDIO_CUSTOMER_SE_INDEX currentConnect,API_AUDIO_CUSTOMER_SE_INPUT inputConnect)25360 MS_BOOL API_AUDIO_CUSTOMER_SE_Disconnect(API_AUDIO_CUSTOMER_SE_INDEX currentConnect, API_AUDIO_CUSTOMER_SE_INPUT inputConnect)
25361 {
25362 AU_nDBG("[currentConnect = 0x%x] [inputConnect = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect);
25363
25364 return FALSE;
25365 }
25366
API_AUDIO_CUSTOMER_SNDOUT_Connect(API_AUDIO_CUSTOMER_SOUNDOUT_INDEX currentConnect,API_AUDIO_CUSTOMER_SOUNDOUT_INPUT inputConnect)25367 MS_BOOL API_AUDIO_CUSTOMER_SNDOUT_Connect(API_AUDIO_CUSTOMER_SOUNDOUT_INDEX currentConnect, API_AUDIO_CUSTOMER_SOUNDOUT_INPUT inputConnect)
25368 {
25369 AU_nDBG("[currentConnect = 0x%x] [inputConnect = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect);
25370
25371 return AU_CUS_SNDOUT_Connect(currentConnect, inputConnect);
25372 }
25373
API_AUDIO_CUSTOMER_SNDOUT_Disconnect(API_AUDIO_CUSTOMER_SOUNDOUT_INDEX currentConnect,API_AUDIO_CUSTOMER_SOUNDOUT_INPUT inputConnect)25374 MS_BOOL API_AUDIO_CUSTOMER_SNDOUT_Disconnect(API_AUDIO_CUSTOMER_SOUNDOUT_INDEX currentConnect, API_AUDIO_CUSTOMER_SOUNDOUT_INPUT inputConnect)
25375 {
25376 AU_nDBG("[currentConnect = 0x%x] [inputConnect = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect);
25377
25378 return AU_CUS_SNDOUT_Disconnect(currentConnect, inputConnect);
25379 }
25380
API_AUDIO_CUSTOMER_PCM_CAPTURE_Connect(API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect,API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT inputConnect)25381 MS_BOOL API_AUDIO_CUSTOMER_PCM_CAPTURE_Connect(API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect, API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT inputConnect)
25382 {
25383 AU_nDBG("[currentConnect = 0x%x] [inputConnect = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect);
25384
25385 switch(currentConnect)
25386 {
25387 case API_AUDIO_CUSTOMER_PCM_CAPTURE0:
25388 {
25389 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_Connect = inputConnect;
25390 }
25391 break;
25392
25393 case API_AUDIO_CUSTOMER_PCM_CAPTURE1:
25394 {
25395 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE1_Connect = inputConnect;
25396 }
25397 break;
25398
25399 case API_AUDIO_CUSTOMER_PCM_CAPTURE2:
25400 {
25401 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE2_Connect = inputConnect;
25402 }
25403 break;
25404
25405 default:
25406 break;
25407 }
25408
25409 return TRUE;
25410 }
25411
API_AUDIO_CUSTOMER_PCM_CAPTURE_Disconnect(API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect,API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT inputConnect)25412 MS_BOOL API_AUDIO_CUSTOMER_PCM_CAPTURE_Disconnect(API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect, API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT inputConnect)
25413 {
25414 AU_nDBG("[currentConnect = 0x%x] [inputConnect = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect);
25415
25416 switch(currentConnect)
25417 {
25418 case API_AUDIO_CUSTOMER_PCM_CAPTURE0:
25419 {
25420 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_Connect = API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_INVALID;
25421 }
25422 break;
25423
25424 case API_AUDIO_CUSTOMER_PCM_CAPTURE1:
25425 {
25426 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE1_Connect = API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_INVALID;
25427 }
25428 break;
25429
25430 case API_AUDIO_CUSTOMER_PCM_CAPTURE2:
25431 {
25432 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE2_Connect = API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_INVALID;
25433 }
25434 break;
25435
25436 default:
25437 break;
25438 }
25439
25440 return TRUE;
25441 }
25442
API_AUDIO_CUSTOMER_MP3_ENC_Connect(API_AUDIO_CUSTOMER_MP3_ENC_INPUT inputConnect)25443 MS_BOOL API_AUDIO_CUSTOMER_MP3_ENC_Connect(API_AUDIO_CUSTOMER_MP3_ENC_INPUT inputConnect)
25444 {
25445 AU_nDBG("[inputConnect = 0x%x] \n", (unsigned int)inputConnect);
25446
25447 pstAudioCustomerShmData->g_audio_customer_MP3_ENC_Connect = inputConnect;
25448
25449 return TRUE;
25450 }
25451
API_AUDIO_CUSTOMER_MP3_ENC_Disconnect(API_AUDIO_CUSTOMER_MP3_ENC_INPUT inputConnect)25452 MS_BOOL API_AUDIO_CUSTOMER_MP3_ENC_Disconnect(API_AUDIO_CUSTOMER_MP3_ENC_INPUT inputConnect)
25453 {
25454 AU_nDBG("[inputConnect = 0x%x] \n", (unsigned int)inputConnect);
25455
25456 pstAudioCustomerShmData->g_audio_customer_MP3_ENC_Connect = API_AUDIO_CUSTOMER_MP3_ENC_INPUT_INVALID;
25457
25458 return TRUE;
25459 }
25460
API_AUDIO_CUSTOMER_AAC_ENC_Connect(API_AUDIO_CUSTOMER_AAC_ENC_INPUT inputConnect)25461 MS_BOOL API_AUDIO_CUSTOMER_AAC_ENC_Connect(API_AUDIO_CUSTOMER_AAC_ENC_INPUT inputConnect)
25462 {
25463 AU_nDBG("[inputConnect = 0x%x] \n", (unsigned int)inputConnect);
25464
25465 pstAudioCustomerShmData->g_audio_customer_AAC_ENC_Connect = inputConnect;
25466
25467 return TRUE;
25468 }
25469
API_AUDIO_CUSTOMER_AAC_ENC_Disconnect(API_AUDIO_CUSTOMER_AAC_ENC_INPUT inputConnect)25470 MS_BOOL API_AUDIO_CUSTOMER_AAC_ENC_Disconnect(API_AUDIO_CUSTOMER_AAC_ENC_INPUT inputConnect)
25471 {
25472 AU_nDBG("[inputConnect = 0x%x] \n", (unsigned int)inputConnect);
25473
25474 pstAudioCustomerShmData->g_audio_customer_AAC_ENC_Connect = API_AUDIO_CUSTOMER_AAC_ENC_INPUT_INVALID;
25475
25476 return TRUE;
25477 }
25478
25479 /* Start & Stop */
API_AUDIO_CUSTOMER_SetCodecType(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMER_CODEC_TYPE audioType)25480 MS_BOOL API_AUDIO_CUSTOMER_SetCodecType(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_CODEC_TYPE audioType)
25481 {
25482 AU_nDBG("[adecIndex = 0x%x] [audioType = 0x%x] \n", (unsigned int)adecIndex, (unsigned int)audioType);
25483
25484 switch(adecIndex)
25485 {
25486 case API_AUDIO_CUSTOMER_ADEC0:
25487 {
25488 pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperCodec = audioType;
25489 }
25490 break;
25491
25492 case API_AUDIO_CUSTOMER_ADEC1:
25493 {
25494 pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperCodec = audioType;
25495 }
25496 break;
25497
25498 case API_AUDIO_CUSTOMER_ADEC_ATV:
25499 {
25500 pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_UpperSifType = audioType;
25501 }
25502 break;
25503
25504 default:
25505 break;
25506 }
25507
25508 return AU_CUS_SetCodecType(adecIndex, audioType);
25509 }
25510
API_AUDIO_CUSTOMER_StartDecoding(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)25511 MS_BOOL API_AUDIO_CUSTOMER_StartDecoding(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
25512 {
25513 AU_nDBG("[adecIndex = 0x%x]\n", (unsigned int)adecIndex);
25514
25515 return AU_CUS_StartDecoding(adecIndex);
25516 }
25517
API_AUDIO_CUSTOMER_StopDecoding(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)25518 MS_BOOL API_AUDIO_CUSTOMER_StopDecoding(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
25519 {
25520 AU_nDBG("[adecIndex = 0x%x] \n", (unsigned int)adecIndex);
25521
25522 return AU_CUS_StopDecoding(adecIndex);
25523 }
25524
API_AUDIO_CUSTOMER_PauseDecoding(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)25525 MS_BOOL API_AUDIO_CUSTOMER_PauseDecoding(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
25526 {
25527 AU_nDBG("[adecIndex = 0x%x] \n", (unsigned int)adecIndex);
25528
25529 return AU_CUS_PauseDecoding(adecIndex);
25530 }
25531
API_AUDIO_CUSTOMER_SetMainDecoderOutput(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)25532 MS_BOOL API_AUDIO_CUSTOMER_SetMainDecoderOutput(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
25533 {
25534 AU_nDBG("[adecIndex = 0x%x] \n", (unsigned int)adecIndex);
25535
25536 pstAudioCustomerShmData->g_audio_customer_MainDecoderOutput = adecIndex;
25537
25538 if(pstAudioCustomerShmData->g_audio_customer_MainDecoderOutput == API_AUDIO_CUSTOMER_ADEC0)
25539 {
25540 AU_CUS_SetSourceInfo(AU_CUS_ConvertCustomerADECSourceToDriverSourceType(pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect));
25541 }
25542 else if(pstAudioCustomerShmData->g_audio_customer_MainDecoderOutput == API_AUDIO_CUSTOMER_ADEC1)
25543 {
25544 AU_CUS_SetSourceInfo(AU_CUS_ConvertCustomerADECSourceToDriverSourceType(pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect));
25545 }
25546 else if(pstAudioCustomerShmData->g_audio_customer_MainDecoderOutput == API_AUDIO_CUSTOMER_ADEC_ATV)
25547 {
25548 AU_CUS_SetSourceInfo(AU_CUS_ConvertCustomerADECSourceToDriverSourceType(pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Connect));
25549 }
25550
25551 return TRUE;
25552 }
25553
25554 /* SPDIF */
API_AUDIO_CUSTOMER_SPDIF_TX_SetOutputType(API_AUDIO_CUSTOMER_SPDIF_TX_MODE eSPDIFMode)25555 MS_BOOL API_AUDIO_CUSTOMER_SPDIF_TX_SetOutputType(API_AUDIO_CUSTOMER_SPDIF_TX_MODE eSPDIFMode)
25556 {
25557 pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_UpperOutputType = eSPDIFMode;
25558
25559 AU_nDBG("[eSPDIFMode = 0x%x] \n", (unsigned int)eSPDIFMode);
25560
25561 AU_CUS_SPDIF_TX_SetOutputType(pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_UpperOutputType);
25562
25563 return TRUE;
25564 }
25565
API_AUDIO_CUSTOMER_SPDIF_TX_GetOutputType(void)25566 API_AUDIO_CUSTOMER_SPDIF_TX_MODE API_AUDIO_CUSTOMER_SPDIF_TX_GetOutputType(void)
25567 {
25568 API_AUDIO_CUSTOMER_SPDIF_TX_MODE Ret = API_AUDIO_CUSTOMER_SPDIF_TX_MODE_INVALID;
25569
25570 AUDIO_SPDIF_OUTPUT_TYPE mode = (AUDIO_SPDIF_OUTPUT_TYPE)MApi_AUDIO_SPDIF_GetMode();
25571 switch(mode)
25572 {
25573 case SPDIF_OUT_PCM:
25574 {
25575 Ret = API_AUDIO_CUSTOMER_SPDIF_TX_PCM;
25576 }
25577 break;
25578
25579 case SPDIF_OUT_AUTO:
25580 {
25581 if(pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_UpperOutputType == API_AUDIO_CUSTOMER_SPDIF_TX_AUTO)
25582 {
25583 Ret = API_AUDIO_CUSTOMER_SPDIF_TX_AUTO;
25584 }
25585 else if(pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_UpperOutputType == API_AUDIO_CUSTOMER_SPDIF_TX_DD)
25586 {
25587 Ret = API_AUDIO_CUSTOMER_SPDIF_TX_DD;
25588 }
25589 else
25590 {
25591 Ret = API_AUDIO_CUSTOMER_SPDIF_TX_AUTO;
25592 }
25593 }
25594 break;
25595
25596 case SPDIF_OUT_BYPASS:
25597 {
25598 #if(CUSTOMIZED_INTERNAL_PATCH_DDP_71_AUTO_BYPASS_ENABLE && CUSTOMIZED_INTERNAL_PATCH_DDP_71_AUTO_BYPASS_TV_HDMI_ARC)
25599 {
25600 if(pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_UpperOutputType == API_AUDIO_CUSTOMER_SPDIF_TX_AUTO)
25601 {
25602 Ret = API_AUDIO_CUSTOMER_SPDIF_TX_AUTO;
25603 }
25604 else if(pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_UpperOutputType == API_AUDIO_CUSTOMER_SPDIF_TX_DD)
25605 {
25606 Ret = API_AUDIO_CUSTOMER_SPDIF_TX_DD;
25607 }
25608 else
25609 {
25610 Ret = API_AUDIO_CUSTOMER_SPDIF_TX_AUTO;
25611 }
25612 }
25613 #else
25614 {
25615 Ret = API_AUDIO_CUSTOMER_SPDIF_TX_BYPASS;
25616 }
25617 #endif
25618 }
25619 break;
25620
25621 case SPDIF_OUT_TRANSCODE:
25622 {
25623 Ret = API_AUDIO_CUSTOMER_SPDIF_TX_TRANSCODE;
25624 }
25625 break;
25626
25627 case SPDIF_OUT_NONE:
25628 {
25629 Ret = API_AUDIO_CUSTOMER_SPDIF_TX_NONE;
25630 }
25631 break;
25632
25633 default:
25634 {
25635 Ret = API_AUDIO_CUSTOMER_SPDIF_TX_NONE;
25636 }
25637 break;
25638 }
25639
25640 AU_nDBG("[Ret = 0x%x] \n", (unsigned int)Ret);
25641
25642 return Ret;
25643 }
25644
API_AUDIO_CUSTOMER_SPDIF_TX_SetCopyInfo(API_AUDIO_CUSTOMER_SPDIF_COPYRIGHT copyInfo)25645 MS_BOOL API_AUDIO_CUSTOMER_SPDIF_TX_SetCopyInfo(API_AUDIO_CUSTOMER_SPDIF_COPYRIGHT copyInfo)
25646 {
25647 AU_nDBG("[copyInfo = 0x%x] \n", (unsigned int)copyInfo);
25648
25649 pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_CopyInfo = copyInfo;
25650
25651 switch(copyInfo)
25652 {
25653 case API_AUDIO_CUSTOMER_SPDIF_COPY_FREE: /* cp-bit : 1, L-bit : 0 */
25654 {
25655 MApi_AUDIO_SPDIF_SetSCMS(1, 0);
25656 }
25657 break;
25658
25659 case API_AUDIO_CUSTOMER_SPDIF_COPY_NO_MORE: /* cp-bit : 0, L-bit : 1 */
25660 {
25661 MApi_AUDIO_SPDIF_SetSCMS(1, 0);
25662 }
25663 break;
25664
25665 case API_AUDIO_CUSTOMER_SPDIF_COPY_ONCE: /* cp-bit : 0, L-bit : 0 */
25666 {
25667 MApi_AUDIO_SPDIF_SetSCMS(0, 0);
25668 }
25669 break;
25670
25671 case API_AUDIO_CUSTOMER_SPDIF_COPY_NEVER: /* cp-bit : 0, L-bit : 1 */
25672 {
25673 MApi_AUDIO_SPDIF_SetSCMS(0, 1);
25674 }
25675 break;
25676
25677 default:
25678 {
25679 MApi_AUDIO_SPDIF_SetSCMS(0, 0);
25680 }
25681 break;
25682
25683 }
25684
25685 return TRUE;
25686 }
25687
API_AUDIO_CUSTOMER_SPDIF_TX_SetCategoryCode(MS_U8 categoryCode)25688 MS_BOOL API_AUDIO_CUSTOMER_SPDIF_TX_SetCategoryCode(MS_U8 categoryCode)
25689 {
25690 AU_nDBG("[categoryCode = 0x%x] \n", (unsigned int)categoryCode);
25691
25692 pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_CategoryCode = categoryCode;
25693
25694 return TRUE;
25695 }
25696
API_AUDIO_CUSTOMER_SPDIF_TX_SetLightOnOff(MS_BOOL bOnOff)25697 MS_BOOL API_AUDIO_CUSTOMER_SPDIF_TX_SetLightOnOff(MS_BOOL bOnOff)
25698 {
25699 AU_nDBG("[bOnOff = 0x%x] \n", (unsigned int)bOnOff);
25700
25701 pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_LightOnOff = bOnOff;
25702
25703 MApi_AUDIO_SPDIF_HWEN(bOnOff);
25704
25705 return TRUE;
25706 }
25707
API_AUDIO_CUSTOMER_SPDIF_TX_SetMonitorOnOff(MS_BOOL bOnOff)25708 MS_BOOL API_AUDIO_CUSTOMER_SPDIF_TX_SetMonitorOnOff(MS_BOOL bOnOff)
25709 {
25710 AU_nDBG("[bOnOff = 0x%x] \n", (unsigned int)bOnOff);
25711
25712 pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_MonitorOnOff = bOnOff;
25713
25714 return TRUE;
25715 }
25716
API_AUDIO_CUSTOMER_SPDIF_TX_ChannelStatus_CTRL(API_AUDIO_CUSTOMER_SPDIF_CS_TYPE cs_mode,API_AUDIO_CUSTOMER_SPDIF_CS_TYPE_STATUS status)25717 MS_BOOL API_AUDIO_CUSTOMER_SPDIF_TX_ChannelStatus_CTRL(API_AUDIO_CUSTOMER_SPDIF_CS_TYPE cs_mode, API_AUDIO_CUSTOMER_SPDIF_CS_TYPE_STATUS status)
25718 {
25719 AU_nDBG("[cs_mode = 0x%x] [status = 0x%x]\n", (unsigned int)cs_mode, (unsigned int)status);
25720
25721 pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_ChannelStatus_Type = cs_mode;
25722 pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_ChannelStatus_Type_Status = status;
25723
25724 MApi_AUDIO_SPDIF_ChannelStatus_CTRL(cs_mode, status);
25725
25726 return TRUE;
25727 }
25728
25729 /* HDMI */
API_AUDIO_CUSTOMER_HDMI_RX_GetAudioMode(API_AUDIO_CUSTOMER_CODEC_TYPE * pHDMIMode)25730 MS_BOOL API_AUDIO_CUSTOMER_HDMI_RX_GetAudioMode(API_AUDIO_CUSTOMER_CODEC_TYPE *pHDMIMode)
25731 {
25732 AU_CUS_HDMI_RX_GetAudioMode();
25733
25734 *pHDMIMode = pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Current_Codec_Type;
25735
25736 AU_nThreadDBG("[HDMI Mode = 0x%x] \n", *((unsigned int *)pHDMIMode));
25737
25738 return TRUE;
25739 }
25740
API_AUDIO_CUSTOMER_HDMI_RX_GetCopyInfo(API_AUDIO_CUSTOMER_SPDIF_COPYRIGHT * pCopyInfo)25741 MS_BOOL API_AUDIO_CUSTOMER_HDMI_RX_GetCopyInfo(API_AUDIO_CUSTOMER_SPDIF_COPYRIGHT *pCopyInfo)
25742 {
25743 *pCopyInfo = API_AUDIO_CUSTOMER_SPDIF_COPY_ONCE;
25744
25745 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_CopyInfo = *pCopyInfo;
25746
25747 AU_nThreadDBG("[*pCopyInfo = 0x%x] \n", *pCopyInfo);
25748
25749 return TRUE;
25750 }
25751
API_AUDIO_CUSTOMER_HDMI_RX_SetAudioReturnChannel(MS_BOOL bOnOff)25752 MS_BOOL API_AUDIO_CUSTOMER_HDMI_RX_SetAudioReturnChannel(MS_BOOL bOnOff)
25753 {
25754 AU_nDBG("[bOnOff = 0x%x] \n", (unsigned int)bOnOff);
25755
25756 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_AudioReturnChannel = bOnOff;
25757
25758 return TRUE;
25759 }
25760
API_AUDIO_CUSTOMER_HDMI_RX_SetMonitorOnOff(MS_BOOL bOnOff)25761 MS_BOOL API_AUDIO_CUSTOMER_HDMI_RX_SetMonitorOnOff(MS_BOOL bOnOff)
25762 {
25763 AU_nDBG("[bOnOff = 0x%x] \n", (unsigned int)bOnOff);
25764
25765 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_MonitorOnOff = bOnOff;
25766
25767 if(bOnOff == FALSE)
25768 {
25769 pstAudioCustomerShmData->g_audio_customer_HDMI_RX_Previous_Codec_Type = API_AUDIO_CUSTOMER_CODEC_TYPE_UNKNOWN;
25770 }
25771
25772 return TRUE;
25773 }
25774
API_AUDIO_CUSTOMER_HDMI_TX_SetOutputType(API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_TYPE eHDMIMode)25775 MS_BOOL API_AUDIO_CUSTOMER_HDMI_TX_SetOutputType(API_AUDIO_CUSTOMER_HDMI_TX_OUTPUT_TYPE eHDMIMode)
25776 {
25777 AU_nDBG("[eHDMIMode = 0x%x] \n", (unsigned int)eHDMIMode);
25778 #ifdef CONFIG_API_HDMITX //TV dont have HDMI TX
25779 pstAudioCustomerShmData->g_audio_customer_HDMI_TX_UpperOutputType = eHDMIMode;
25780 AU_CUS_HDMI_TX_SetOutputType(pstAudioCustomerShmData->g_audio_customer_HDMI_TX_UpperOutputType);
25781 return TRUE;
25782 #else
25783 AU_nPRINT("TV don't support API_AUDIO_CUSTOMER_HDMI_TX_SetOutputType\n");
25784 return FALSE;
25785 #endif
25786 }
25787
API_AUDIO_CUSTOMER_HDMI_TX_SetMonitorOnOff(MS_BOOL bOnOff)25788 MS_BOOL API_AUDIO_CUSTOMER_HDMI_TX_SetMonitorOnOff(MS_BOOL bOnOff)
25789 {
25790 AU_nDBG("[bOnOff = 0x%x] \n", (unsigned int)bOnOff);
25791 #ifdef CONFIG_API_HDMITX //TV dont have HDMI TX
25792 pstAudioCustomerShmData->g_audio_customer_HDMI_TX_MonitorOnOff = bOnOff;
25793 return TRUE;
25794 #else
25795 AU_nPRINT("TV don't support API_AUDIO_CUSTOMER_HDMI_TX_SetMonitorOnOff\n");
25796 return FALSE;
25797 #endif
25798 }
25799
25800 /* ATV */
API_AUDIO_CUSTOMER_SIF_SetInputSource(API_AUDIO_CUSTOMER_SIF_INPUT sifSource)25801 MS_BOOL API_AUDIO_CUSTOMER_SIF_SetInputSource(API_AUDIO_CUSTOMER_SIF_INPUT sifSource)
25802 {
25803 AU_nDBG("[sifSource = %d] \n", (unsigned int)sifSource);
25804
25805 switch(sifSource)
25806 {
25807 case API_AUDIO_CUSTOMER_SIF_INPUT_EXTERNAL:
25808 {
25809 MApi_AUDIO_SIF_SendCmd(MSAPI_AUD_SIF_CMD_SET_ADC_FROM_VIF_PATH, FALSE, 0); // set SIF mode
25810 }
25811 break;
25812 case API_AUDIO_CUSTOMER_SIF_INPUT_INTERNAL:
25813 {
25814 MApi_AUDIO_SIF_SendCmd(MSAPI_AUD_SIF_CMD_SET_ADC_FROM_VIF_PATH, TRUE, 0); // set VIF mode
25815 }
25816 break;
25817 default:
25818 break;
25819 }
25820
25821 return TRUE;
25822 }
25823
API_AUDIO_CUSTOMER_SIF_SetHighDevMode(API_AUDIO_CUSTOMER_SIF_HIDEV_BW bandwidth,MS_BOOL bOnOff)25824 MS_BOOL API_AUDIO_CUSTOMER_SIF_SetHighDevMode(API_AUDIO_CUSTOMER_SIF_HIDEV_BW bandwidth, MS_BOOL bOnOff)
25825 {
25826 AU_nDBG("[bandwidth = 0x%x] [bOnOff = 0x%x] \n", (unsigned int)bandwidth, (unsigned int)bOnOff);
25827
25828 switch(bOnOff)
25829 {
25830 case TRUE:
25831 {
25832 MApi_AUDIO_SIF_SendCmd(MSAPI_AUD_SIF_CMD_ENABLE_HIDEV, TRUE, 0);
25833 MApi_AUDIO_SIF_SendCmd(MSAPI_AUD_SIF_CMD_SET_HIDEV_FILTER_BW_LEVEL, bandwidth, 0);
25834 }
25835 break;
25836 case FALSE:
25837 {
25838 MApi_AUDIO_SIF_SendCmd(MSAPI_AUD_SIF_CMD_ENABLE_HIDEV, FALSE, 0);
25839 }
25840 break;
25841 default:
25842 break;
25843 }
25844
25845 return TRUE;
25846 }
25847
API_AUDIO_CUSTOMER_SIF_SetAudioStandard(API_AUDIO_CUSTOMER_SIF_STANDARD sifStandard)25848 MS_BOOL API_AUDIO_CUSTOMER_SIF_SetAudioStandard(API_AUDIO_CUSTOMER_SIF_STANDARD sifStandard)
25849 {
25850 AU_nDBG("[sifStandard = 0x%x] \n", (unsigned int)sifStandard);
25851
25852 if((sifStandard < API_AUDIO_CUSTOMER_SIF_BG) || (sifStandard > API_AUDIO_CUSTOMER_SIF_M_EIA_J))
25853 {
25854 return FALSE;
25855 }
25856
25857 SIF_AudioStandard = sifStandard;
25858
25859 MApi_AUDIO_SIF_SetStandard((AUDIOSTANDARD_TYPE)sifStandard);
25860
25861 switch(sifStandard)
25862 {
25863 case API_AUDIO_CUSTOMER_SIF_BG:
25864 case API_AUDIO_CUSTOMER_SIF_DK:
25865 case API_AUDIO_CUSTOMER_SIF_M:
25866 {
25867 if(FALSE == MApi_AUDIO_SIF_IsPALType(AU_SIF_PAL_MONO))
25868 {
25869 MApi_AUDIO_SIF_SetPALType(AU_SIF_PAL_MONO);
25870 }
25871 }
25872 break;
25873
25874 case API_AUDIO_CUSTOMER_SIF_BG_A2:
25875 case API_AUDIO_CUSTOMER_SIF_DK1_A2:
25876 case API_AUDIO_CUSTOMER_SIF_DK2_A2:
25877 case API_AUDIO_CUSTOMER_SIF_DK3_A2:
25878 case API_AUDIO_CUSTOMER_SIF_M_A2:
25879 {
25880 if(FALSE == MApi_AUDIO_SIF_IsPALType(AU_SIF_PAL_A2))
25881 {
25882 MApi_AUDIO_SIF_SetPALType(AU_SIF_PAL_A2);
25883 }
25884 }
25885 break;
25886
25887 case API_AUDIO_CUSTOMER_SIF_I:
25888 {
25889 if(MApi_AUDIO_SIF_GetSoundMode() >= E_AUDIOMODE_NICAM_MONO && MApi_AUDIO_SIF_GetSoundMode() <= E_AUDIOMODE_NICAM_DUAL_AB)
25890 {
25891 MApi_AUDIO_SIF_SetPALType(AU_SIF_PAL_NICAM);
25892 }
25893 else
25894 {
25895 MApi_AUDIO_SIF_SetPALType(AU_SIF_PAL_MONO);
25896 }
25897 }
25898 break;
25899
25900 case API_AUDIO_CUSTOMER_SIF_BG_NICAM:
25901 case API_AUDIO_CUSTOMER_SIF_DK_NICAM:
25902 case API_AUDIO_CUSTOMER_SIF_L:
25903 {
25904 if(FALSE == MApi_AUDIO_SIF_IsPALType(AU_SIF_PAL_NICAM))
25905 {
25906 MApi_AUDIO_SIF_SetPALType(AU_SIF_PAL_NICAM);
25907 }
25908 }
25909 break;
25910
25911 default:
25912 break;
25913 }
25914
25915 return TRUE;
25916 }
25917
API_AUDIO_CUSTOMER_SIF_SetSoundMode(API_AUDIO_CUSTOMER_SIF_AUDIOMODE_TYPE u8SifSoundMode)25918 MS_BOOL API_AUDIO_CUSTOMER_SIF_SetSoundMode(API_AUDIO_CUSTOMER_SIF_AUDIOMODE_TYPE u8SifSoundMode)
25919 {
25920 AU_nDBG("[u8SifSoundMode = 0x%x] \n", (unsigned int)u8SifSoundMode);
25921
25922 SIF_AudioMode = (AUDIOMODE_TYPE)u8SifSoundMode;
25923 MApi_AUDIO_SIF_SetSoundMode((MS_U8)u8SifSoundMode);
25924 return TRUE;
25925 }
25926
API_AUDIO_CUSTOMER_SIF_GetSoundMode(void)25927 API_AUDIO_CUSTOMER_SIF_AUDIOMODE_TYPE API_AUDIO_CUSTOMER_SIF_GetSoundMode(void)
25928 {
25929 API_AUDIO_CUSTOMER_SIF_AUDIOMODE_TYPE Ret = API_AUDIO_CUSTOMER_SIF_AUDIOMODE_INVALID;
25930 AUDIOSTATUS eCurrentAudioStatus;
25931
25932 MApi_AUDIO_SIF_GetAudioStatus(&eCurrentAudioStatus);
25933
25934 Ret = (API_AUDIO_CUSTOMER_SIF_AUDIOMODE_TYPE)MApi_AUDIO_SIF_GetSoundMode();
25935
25936 AU_nThreadDBG("[Ret = 0x%x] \n", (unsigned int)Ret);
25937
25938 return Ret;
25939 }
25940
API_AUDIO_CUSTOMER_SIF_SetMonitorOnOff(MS_BOOL bOnOff)25941 MS_BOOL API_AUDIO_CUSTOMER_SIF_SetMonitorOnOff(MS_BOOL bOnOff)
25942 {
25943 AU_nDBG("[bOnOff = 0x%x] \n", (unsigned int)bOnOff);
25944
25945 pstAudioCustomerShmData->g_audio_customer_SIF_MonitorOnOff = bOnOff;
25946
25947 return TRUE;
25948 }
25949
API_AUDIO_CUSTOMER_SIF_SetAutoMute(MS_BOOL bOnOff)25950 MS_BOOL API_AUDIO_CUSTOMER_SIF_SetAutoMute(MS_BOOL bOnOff)
25951 {
25952 AU_nDBG("[bOnOff = 0x%x] \n", (unsigned int)bOnOff);
25953
25954 switch(bOnOff)
25955 {
25956 case TRUE:
25957 {
25958 MApi_AUDIO_SIF_SendCmd(MSAPI_AUD_SIF_CMD_ENABLE_AUTO_MUTE, TRUE, 0);
25959 }
25960 break;
25961 case FALSE:
25962 {
25963 MApi_AUDIO_SIF_SendCmd(MSAPI_AUD_SIF_CMD_ENABLE_AUTO_MUTE, FALSE, 0);
25964 }
25965 break;
25966 default:
25967 break;
25968 }
25969
25970 return TRUE;
25971 }
25972
API_AUDIO_CUSTOMER_SIF_StartAutoStandardDetection(void)25973 API_AUDIO_CUSTOMER_SIF_STANDARD API_AUDIO_CUSTOMER_SIF_StartAutoStandardDetection(void)
25974 {
25975 AU_nDBG("\n");
25976
25977 MApi_AUDIO_SIF_StartAutoStandardDetection(); //Set Command
25978 AU_CUS_Delay1MS(50); //@todo: need fine tune
25979
25980 return (API_AUDIO_CUSTOMER_SIF_STANDARD)MApi_AUDIO_SIF_GetResultOfAutoStandardDetection(); //Get Result
25981 }
25982
API_AUDIO_CUSTOMER_SIF_SetThreshold(API_AUDIO_CUSTOMER_SIF_THR_TBL_TYPE * ThrTbl)25983 MS_BOOL API_AUDIO_CUSTOMER_SIF_SetThreshold(API_AUDIO_CUSTOMER_SIF_THR_TBL_TYPE *ThrTbl)
25984 {
25985 AU_nDBG("\n");
25986
25987 MApi_AUDIO_SIF_SetThreshold((THR_TBL_TYPE*)ThrTbl);
25988
25989 return TRUE;
25990 }
25991
API_AUDIO_CUSTOMER_SIF_SetPALType(API_AUDIO_CUSTOMER_SIF_PAL_TYPE pal_type)25992 MS_BOOL API_AUDIO_CUSTOMER_SIF_SetPALType(API_AUDIO_CUSTOMER_SIF_PAL_TYPE pal_type)
25993 {
25994 AU_nThreadDBG("[pal_type = 0x%x] \n", (unsigned int)pal_type);
25995
25996 MApi_AUDIO_SIF_SetPALType((AUDIO_SIF_PAL_TYPE)pal_type);
25997
25998 return TRUE;
25999 }
26000
API_AUDIO_CUSTOMER_SIF_SendCmd(API_AUDIO_CUSTOMER_SIF_CmdType enAudSifCommand,MS_U8 comm_arg1,MS_U8 comm_arg2)26001 MS_BOOL API_AUDIO_CUSTOMER_SIF_SendCmd(API_AUDIO_CUSTOMER_SIF_CmdType enAudSifCommand, MS_U8 comm_arg1, MS_U8 comm_arg2)
26002 {
26003 AU_nDBG("[enAudSifCommand = 0x%x] [comm_arg1 = 0x%x] [comm_arg2 = 0x%x] \n", (unsigned int)enAudSifCommand, (unsigned int)comm_arg1, (unsigned int)comm_arg2);
26004
26005 MApi_AUDIO_SIF_SendCmd((En_AUD_SIF_CmdType)enAudSifCommand, (MS_U8)comm_arg1, (MS_U8)comm_arg2);
26006
26007 return TRUE;
26008 }
26009
API_AUDIO_CUSTOMER_SIF_GetAudioStatus(API_AUDIO_CUSTOMER_SIF_AUDIOSTATUS * eCurrentAudioStatus)26010 MS_BOOL API_AUDIO_CUSTOMER_SIF_GetAudioStatus(API_AUDIO_CUSTOMER_SIF_AUDIOSTATUS *eCurrentAudioStatus)
26011 {
26012 MS_BOOL Ret = FALSE;
26013
26014 AUDIOSTATUS CurrentCarrierStatus = E_STATE_AUDIO_NO_CARRIER;
26015 Ret = MApi_AUDIO_SIF_GetAudioStatus(&CurrentCarrierStatus);
26016 *eCurrentAudioStatus = CurrentCarrierStatus;
26017
26018 AU_nThreadDBG("[*eCurrentAudioStatus = 0x%x]\n", (unsigned int)(*eCurrentAudioStatus));
26019
26020 return Ret;
26021 }
26022
API_AUDIO_CUSTOMER_SIF_IsPALType(API_AUDIO_CUSTOMER_SIF_PAL_TYPE pal_type)26023 MS_BOOL API_AUDIO_CUSTOMER_SIF_IsPALType(API_AUDIO_CUSTOMER_SIF_PAL_TYPE pal_type)
26024 {
26025 AU_nDBG("[pal_type = 0x%x] \n", pal_type);
26026
26027 return MApi_AUDIO_SIF_IsPALType((AUDIO_SIF_PAL_TYPE)pal_type);
26028 }
26029
API_AUDIO_CUSTOMER_SIF_SetPrescale(API_AUDIO_CUSTOMER_SIF_GAIN_TYPE gain_type,MS_S32 db_value)26030 MS_BOOL API_AUDIO_CUSTOMER_SIF_SetPrescale(API_AUDIO_CUSTOMER_SIF_GAIN_TYPE gain_type, MS_S32 db_value)
26031 {
26032 AU_nDBG("[db_value = 0x%x] \n", (unsigned int)db_value);
26033
26034 MApi_AUDIO_SIF_SetPrescale((AUDIO_SIF_GAIN_TYPE)gain_type, db_value);
26035
26036 return TRUE;
26037 }
26038
26039 /* Decoder */
API_AUDIO_CUSTOMER_SetSyncMode(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,MS_BOOL bOnOff)26040 MS_BOOL API_AUDIO_CUSTOMER_SetSyncMode(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_BOOL bOnOff)
26041 {
26042 AU_nDBG("[adecIndex = 0x%X] [bOnOff = 0x%X] \n", (unsigned int)adecIndex, (unsigned int)bOnOff);
26043
26044 return AU_CUS_SetSyncMode(adecIndex, bOnOff);
26045 }
26046
API_AUDIO_CUSTOMER_GetDecodingType(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMER_CODEC_TYPE * pAudioType)26047 MS_BOOL API_AUDIO_CUSTOMER_GetDecodingType(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_CODEC_TYPE *pAudioType)
26048 {
26049 switch(adecIndex)
26050 {
26051 case API_AUDIO_CUSTOMER_ADEC0:
26052 {
26053 *pAudioType = pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperCodec;
26054 }
26055 break;
26056
26057 case API_AUDIO_CUSTOMER_ADEC1:
26058 {
26059 *pAudioType = pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperCodec;
26060 }
26061 break;
26062
26063 case API_AUDIO_CUSTOMER_ADEC_ATV:
26064 {
26065 *pAudioType = pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_UpperSifType;
26066 }
26067 break;
26068
26069 default:
26070 break;
26071 }
26072
26073 AU_nThreadDBG("[adecIndex = 0x%X][*pAudioType = 0x%X]\n", (unsigned int)adecIndex, (unsigned int)*pAudioType);
26074
26075 return TRUE;
26076 }
26077
API_AUDIO_CUSTOMER_SetDualMonoOutMode(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMER_DUALMONO_MODE outputMode)26078 MS_BOOL API_AUDIO_CUSTOMER_SetDualMonoOutMode(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_DUALMONO_MODE outputMode)
26079 {
26080 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
26081
26082 AU_nDBG("[adecIndex = 0x%x] [outputMode = 0x%x] \n", (unsigned int)adecIndex, (unsigned int)outputMode);
26083
26084 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
26085
26086 switch(adecIndex)
26087 {
26088 case API_AUDIO_CUSTOMER_ADEC0:
26089 {
26090 pstAudioCustomerShmData->g_audio_customer_ADEC0_DualmonoMode = outputMode;
26091 }
26092 break;
26093 case API_AUDIO_CUSTOMER_ADEC1:
26094 {
26095 pstAudioCustomerShmData->g_audio_customer_ADEC1_DualmonoMode = outputMode;
26096 }
26097 break;
26098
26099 default:
26100 break;
26101 }
26102 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_SoundMode, (MS_U32)outputMode);
26103
26104 return TRUE;
26105 }
26106
API_AUDIO_CUSTOMER_GetESInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,void * pAudioESInfo)26107 MS_BOOL API_AUDIO_CUSTOMER_GetESInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, void * pAudioESInfo)
26108 {
26109 /* Need to refine log */
26110 AU_nThreadDBG("[adecIndex = 0x%x] \n", (unsigned int)adecIndex);
26111
26112 return TRUE;
26113 }
26114
API_AUDIO_CUSTOMER_IsESExist(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)26115 MS_BOOL API_AUDIO_CUSTOMER_IsESExist(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
26116 {
26117 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
26118 MS_U32 es_exist = 0;
26119
26120 AU_nThreadDBG("[adecIndex = 0x%x] \n", (unsigned int)adecIndex);
26121
26122 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
26123
26124 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_DecStatus, (void *)&es_exist);
26125
26126 switch(adecIndex)
26127 {
26128 case API_AUDIO_CUSTOMER_ADEC0:
26129 {
26130 pstAudioCustomerShmData->g_audio_customer_ADEC0_bESExist = (MS_BOOL)es_exist;
26131 }
26132 break;
26133
26134 case API_AUDIO_CUSTOMER_ADEC1:
26135 {
26136 pstAudioCustomerShmData->g_audio_customer_ADEC1_bESExist = (MS_BOOL)es_exist;
26137 }
26138 break;
26139
26140 default:
26141 break;
26142 }
26143
26144 return TRUE;
26145 }
26146
API_AUDIO_CUSTOMER_SetAudioDescription(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,MS_BOOL bOnOff)26147 MS_BOOL API_AUDIO_CUSTOMER_SetAudioDescription(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_BOOL bOnOff)
26148 {
26149 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
26150
26151 AU_nDBG("[adecIndex = %u] [bOnOff = %u] \n", (unsigned int)adecIndex, (unsigned int)bOnOff);
26152
26153 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
26154
26155 switch(adecIndex)
26156 {
26157 case API_AUDIO_CUSTOMER_ADEC0:
26158 {
26159 pstAudioCustomerShmData->g_audio_customer_ADEC0_AD_bMain = bOnOff;
26160 }
26161 break;
26162
26163 case API_AUDIO_CUSTOMER_ADEC1:
26164 {
26165 pstAudioCustomerShmData->g_audio_customer_ADEC1_AD_bMain = bOnOff;
26166 }
26167 break;
26168
26169 default:
26170 break;
26171 }
26172
26173 switch(bOnOff)
26174 {
26175 case TRUE:
26176 {
26177 MApi_AUDIO_SetADOutputMode(AD_OUT_BOTH);
26178 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_playControl, (MS_U32)MMA_PLAY_AD);
26179 }
26180 break;
26181 case FALSE:
26182 {
26183 MApi_AUDIO_SetADOutputMode(AD_OUT_NONE);
26184 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_playControl, (MS_U32)MMA_STOP_AD);
26185 }
26186 break;
26187 default:
26188 break;
26189 }
26190
26191 return TRUE;
26192 }
26193
API_AUDIO_CUSTOMER_SetTrickMode(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMER_TRICK_MODE eTrickMode)26194 MS_BOOL API_AUDIO_CUSTOMER_SetTrickMode(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_TRICK_MODE eTrickMode)
26195 {
26196 MS_BOOL syncMode = FALSE;
26197 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
26198
26199 AU_nDBG("[adecIndex = 0x%X] [eTrickMode = 0x%X] \n", (unsigned int)adecIndex, (unsigned int)eTrickMode);
26200
26201 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
26202
26203 switch(adecIndex)
26204 {
26205 case API_AUDIO_CUSTOMER_ADEC0:
26206 {
26207 pstAudioCustomerShmData->g_audio_customer_ADEC0_TrickMode = eTrickMode;
26208 syncMode = pstAudioCustomerShmData->g_audio_customer_ADEC0_SyncMode;
26209 }
26210 break;
26211
26212 case API_AUDIO_CUSTOMER_ADEC1:
26213 {
26214 pstAudioCustomerShmData->g_audio_customer_ADEC1_TrickMode = eTrickMode;
26215 syncMode = pstAudioCustomerShmData->g_audio_customer_ADEC1_SyncMode;
26216 }
26217 break;
26218
26219 default:
26220 break;
26221 }
26222
26223 if (eTrickMode == API_AUDIO_CUSTOMER_TRICK_NONE)
26224 {
26225 if(syncMode)
26226 {
26227 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_playControl, MMA_AVSYNC);
26228 }
26229 else
26230 {
26231 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_playControl, MMA_FREERUN);
26232 }
26233 }
26234
26235 return TRUE;
26236 }
26237
API_AUDIO_CUSTOMER_GetBufferStatus(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,MS_U32 * pMaxSize,MS_U32 * pFreeSize)26238 MS_BOOL API_AUDIO_CUSTOMER_GetBufferStatus(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_U32 *pMaxSize, MS_U32 *pFreeSize)
26239 {
26240 MS_U32 *pCurrLevel = 0;
26241
26242 AUDIO_DEC_ID DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
26243
26244
26245 if(pMaxSize != NULL && pCurrLevel != NULL )
26246 {
26247 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_UNI_ES_Size, (void*)pMaxSize);
26248 MApi_AUDIO_GetAudioInfo2(DecID, Audio_infoType_esBuf_currLevel, (void*)pCurrLevel);
26249 *pFreeSize = *pMaxSize - *pCurrLevel;
26250 }
26251 else
26252 {
26253 return FALSE;
26254 }
26255
26256 AU_nDBG("[adecIndex = 0x%X] [pMaxSize = 0x%X] [pFreeSize = 0x%X]\n", (unsigned int)adecIndex, *((unsigned int *)pMaxSize), *((unsigned int *)pFreeSize));
26257
26258 return TRUE;
26259 }
26260
API_AUDIO_CUSTOMER_SetAdecPcmPath(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMER_ADEC_PCM_PATH pcmPath)26261 MS_BOOL API_AUDIO_CUSTOMER_SetAdecPcmPath(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_ADEC_PCM_PATH pcmPath)
26262 {
26263 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
26264
26265 AU_nDBG("[adecIndex = 0x%X] [pcmPath = 0x%X] \n", (unsigned int)adecIndex, (unsigned int)pcmPath);
26266
26267 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
26268
26269 switch(adecIndex)
26270 {
26271 case API_AUDIO_CUSTOMER_ADEC0:
26272 {
26273 pstAudioCustomerShmData->g_audio_customer_ADEC0_PCM_OutputPath = pcmPath;
26274 }
26275 break;
26276
26277 case API_AUDIO_CUSTOMER_ADEC1:
26278 {
26279 pstAudioCustomerShmData->g_audio_customer_ADEC1_PCM_OutputPath = pcmPath;
26280 }
26281 break;
26282
26283 default:
26284 break;
26285 }
26286
26287 if(pcmPath == API_AUDIO_CUSTOMER_ADEC_PCM_PATH_MCU)
26288 {
26289 AU_CUS_AdecPcmInit(DecID, FALSE);
26290 }
26291
26292 return TRUE;
26293 }
26294
API_AUDIO_CUSTOMER_AdecPcmReady(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)26295 MS_BOOL API_AUDIO_CUSTOMER_AdecPcmReady(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
26296 {
26297 API_AUDIO_MM_PCM_Info* pPcmInfo;
26298
26299 if ( pAdecPcmHandle == NULL )
26300 {
26301 AU_nPRINT("pAdecPcmHandle i null");
26302 return FALSE;
26303 }
26304
26305 AUDIO_DEC_ID decID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
26306
26307 pPcmInfo = &pAdecPcmHandle->PcmInfo;
26308
26309 if ( MApi_AUDIO_GetAudioInfo2(decID, Audio_infoType_UNI_PCM1_Info, (void *)pPcmInfo ) != TRUE )
26310 {
26311 AU_nPRINT("can not get PCM1 Info");
26312 return FALSE;
26313 }
26314
26315 if ( pAdecPcmHandle->u32LastDecodeFrame == pPcmInfo->U32DecodeFrame )
26316 {
26317 return FALSE;
26318 }
26319
26320 AU_nDBG("%s: U32DecodeFrame=%u, U32WrtAddr=%p, U32WrtBytes=%u\r\n", __FUNCTION__, (unsigned int)pPcmInfo->U32DecodeFrame, (void *) pPcmInfo->U32WrtAddr, (unsigned int)pPcmInfo->U32WrtBytes);
26321
26322 pAdecPcmHandle->u32LastDecodeFrame = pPcmInfo->U32DecodeFrame;
26323
26324 return TRUE;
26325 }
26326
API_AUDIO_CUSTOMER_AdecPcmGet(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,void * pOutPcm,MS_U32 u32Size)26327 MS_U32 API_AUDIO_CUSTOMER_AdecPcmGet(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, void * pOutPcm, MS_U32 u32Size)
26328 {
26329 API_AUDIO_MM_PCM_BufControl * pPcmCtrl = NULL;
26330 MS_U32 u32Size_temp = 0;
26331 volatile void * pSrcVPtr;
26332
26333 if ( pAdecPcmHandle == NULL )
26334 {
26335 return 0;
26336 }
26337
26338 AUDIO_DEC_ID decID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
26339
26340 pPcmCtrl = &pAdecPcmHandle->PcmBuf;
26341 pPcmCtrl->u32BufWrPtr = pAdecPcmHandle->PcmInfo.U32WrtAddr;
26342
26343 if(u32Size > pAdecPcmHandle->PcmInfo.U32WrtBytes) u32Size = pAdecPcmHandle->PcmInfo.U32WrtBytes;
26344
26345 if ((pPcmCtrl->u32BufEndAddr - pPcmCtrl->u32BufWrPtr) >= u32Size)
26346 {
26347 pSrcVPtr = (volatile void *) MsOS_MPool_PA2KSEG1(pPcmCtrl->u32BufWrPtr);
26348
26349 memcpy(pOutPcm, (void *) pSrcVPtr, u32Size);
26350 }
26351 else
26352 {
26353 volatile MS_U8 *u32_dstPtr;
26354
26355 //copy tail
26356 u32_dstPtr = (volatile MS_U8 *)pOutPcm;
26357 pSrcVPtr = (volatile void *) MsOS_MPool_PA2KSEG1(pPcmCtrl->u32BufWrPtr);
26358 u32Size_temp = pPcmCtrl->u32BufEndAddr - pPcmCtrl->u32BufWrPtr;
26359
26360 memcpy((void *) u32_dstPtr, (void *) pSrcVPtr, u32Size_temp);
26361
26362 //copy head
26363 u32_dstPtr = u32_dstPtr + u32Size_temp;
26364 pSrcVPtr = (volatile void *) MsOS_MPool_PA2KSEG1(pPcmCtrl->u32BufStartAddr);
26365 u32Size_temp = u32Size - u32Size_temp;
26366
26367 memcpy((void *) u32_dstPtr, (void *) pSrcVPtr, u32Size_temp);
26368 }
26369
26370 if (pAU_AdecPcmDumpFile != NULL && pstAudioCustomerShmData->g_audio_customer_bEnableAdecPcmDump == TRUE)
26371 {
26372 AU_CUS_FileWrite((void*)pOutPcm, sizeof(MS_U8), pAdecPcmHandle->PcmInfo.U32WrtBytes, pAU_AdecPcmDumpFile);
26373 }
26374
26375 MsOS_FlushMemory();
26376
26377 MApi_AUDIO_SetAudioParam2(decID, Audio_ParamType_UNI_PCMOutCnt, u32Size);
26378
26379 return u32Size;
26380 }
26381
API_AUDIO_CUSTOMER_AdecRegisterDecodeDoneCallback(pfnAudioCustomerAdecDecodeDone pfnDecodeDoneCallBack)26382 MS_BOOL API_AUDIO_CUSTOMER_AdecRegisterDecodeDoneCallback(pfnAudioCustomerAdecDecodeDone pfnDecodeDoneCallBack)
26383 {
26384 AU_nDBG("[pfnDecodeDoneCallBack = 0x%X] \n", (unsigned int)pfnDecodeDoneCallBack);
26385 madCallBack.pFunc_AdecDecDone = pfnDecodeDoneCallBack;
26386 return TRUE;
26387 }
26388
API_AUDIO_CUSTOMER_AdecRegisterEndOfStreamCallback(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,pfnAudioCustomerAdecEndOfStream pfnEndOfStreamCallBack)26389 MS_BOOL API_AUDIO_CUSTOMER_AdecRegisterEndOfStreamCallback(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, pfnAudioCustomerAdecEndOfStream pfnEndOfStreamCallBack)
26390 {
26391 AU_nDBG("[adecIndex = 0x%x][pfnEndOfStreamCallBack = 0x%X] \n", (unsigned int)adecIndex, (unsigned int)pfnEndOfStreamCallBack);
26392
26393 switch(adecIndex)
26394 {
26395 case API_AUDIO_CUSTOMER_ADEC0:
26396 {
26397 if(pfnEndOfStreamCallBack)
26398 {
26399 AU_nDBG("\n");
26400 pstAudioCustomerShmData->g_audio_customer_ADEC0_End_Of_Stream_bRegister = TRUE;
26401 madCallBack.pFunc_Adec0_EndOfStream = pfnEndOfStreamCallBack;
26402 }
26403 else
26404 {
26405 AU_nDBG("\n");
26406 pstAudioCustomerShmData->g_audio_customer_ADEC0_End_Of_Stream_bRegister = FALSE;
26407 madCallBack.pFunc_Adec0_EndOfStream = NULL;
26408 }
26409 }
26410 break;
26411
26412 case API_AUDIO_CUSTOMER_ADEC1:
26413 {
26414 if(pfnEndOfStreamCallBack)
26415 {
26416 AU_nDBG("\n");
26417 pstAudioCustomerShmData->g_audio_customer_ADEC1_End_Of_Stream_bRegister = TRUE;
26418 madCallBack.pFunc_Adec1_EndOfStream = pfnEndOfStreamCallBack;
26419 }
26420 else
26421 {
26422 AU_nDBG("\n");
26423 pstAudioCustomerShmData->g_audio_customer_ADEC1_End_Of_Stream_bRegister = FALSE;
26424 madCallBack.pFunc_Adec1_EndOfStream = NULL;
26425 }
26426 }
26427 break;
26428
26429 default:
26430 {
26431 AU_nDBG("\n");
26432 pstAudioCustomerShmData->g_audio_customer_ADEC0_End_Of_Stream_bRegister = FALSE;
26433 pstAudioCustomerShmData->g_audio_customer_ADEC1_End_Of_Stream_bRegister = FALSE;
26434 madCallBack.pFunc_Adec0_EndOfStream = NULL;
26435 madCallBack.pFunc_Adec1_EndOfStream = NULL;
26436 }
26437 break;
26438 }
26439
26440 return TRUE;
26441 }
26442
API_AUDIO_CUSTOMER_AdecRegisterUnderrunCallback(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,pfnAudioCustomerAdecUnderrun pfnUnderrunCallBack)26443 MS_BOOL API_AUDIO_CUSTOMER_AdecRegisterUnderrunCallback(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, pfnAudioCustomerAdecUnderrun pfnUnderrunCallBack)
26444 {
26445 AU_nDBG("[adecIndex = 0x%x][pfnUnderrunCallBack = 0x%X] \n", (unsigned int)adecIndex, (unsigned int)pfnUnderrunCallBack);
26446
26447 switch(adecIndex)
26448 {
26449 case API_AUDIO_CUSTOMER_ADEC0:
26450 {
26451 if(pfnUnderrunCallBack)
26452 {
26453 AU_nDBG("\n");
26454 pstAudioCustomerShmData->g_audio_customer_ADEC0_Underrun_bRegister = TRUE;
26455 madCallBack.pFunc_Adec0_Underrun= pfnUnderrunCallBack;
26456 }
26457 else
26458 {
26459 AU_nDBG("\n");
26460 pstAudioCustomerShmData->g_audio_customer_ADEC0_Underrun_bRegister = FALSE;
26461 madCallBack.pFunc_Adec0_Underrun = NULL;
26462 }
26463 }
26464 break;
26465
26466 case API_AUDIO_CUSTOMER_ADEC1:
26467 {
26468 if(pfnUnderrunCallBack)
26469 {
26470 AU_nDBG("\n");
26471 pstAudioCustomerShmData->g_audio_customer_ADEC1_Underrun_bRegister = TRUE;
26472 madCallBack.pFunc_Adec1_Underrun = pfnUnderrunCallBack;
26473 }
26474 else
26475 {
26476 AU_nDBG("\n");
26477 pstAudioCustomerShmData->g_audio_customer_ADEC1_Underrun_bRegister = FALSE;
26478 madCallBack.pFunc_Adec1_Underrun = NULL;
26479 }
26480 }
26481 break;
26482
26483 default:
26484 {
26485 AU_nDBG("\n");
26486 pstAudioCustomerShmData->g_audio_customer_ADEC0_Underrun_bRegister = FALSE;
26487 pstAudioCustomerShmData->g_audio_customer_ADEC1_Underrun_bRegister = FALSE;
26488 madCallBack.pFunc_Adec0_Underrun = NULL;
26489 madCallBack.pFunc_Adec1_Underrun = NULL;
26490 }
26491 break;
26492 }
26493
26494 return TRUE;
26495 }
26496
API_AUDIO_CUSTOMER_Auto_Recovery_SetMonitorOnOff(MS_BOOL bOnOff)26497 MS_BOOL API_AUDIO_CUSTOMER_Auto_Recovery_SetMonitorOnOff(MS_BOOL bOnOff)
26498 {
26499 AU_nDBG("[bOnOff = 0x%x] \n", (unsigned int)bOnOff);
26500
26501 pstAudioCustomerShmData->g_audio_customer_Auto_Recovery_MonitorOnOff = bOnOff;
26502
26503 return TRUE;
26504 }
26505
26506 /* Common Decoder */
API_AUDIO_CUSTOMER_COMMON_DECODER_Open(void * pData)26507 MS_S32 API_AUDIO_CUSTOMER_COMMON_DECODER_Open(void * pData)
26508 {
26509 AU_nDBG("\n");
26510
26511 #if(UTPA_SUPPORT_COMMON_DECODER_API)
26512 {
26513 return AU_CUS_COMMON_DECODER_Open(pData);
26514 }
26515 #else
26516 {
26517 return FALSE;
26518 }
26519 #endif //#if(UTPA_SUPPORT_COMMON_DECODER_API)
26520 }
26521
API_AUDIO_CUSTOMER_COMMON_DECODER_Close(MS_S32 s32DeviceID)26522 MS_S32 API_AUDIO_CUSTOMER_COMMON_DECODER_Close(MS_S32 s32DeviceID)
26523 {
26524 AU_nDBG("[s32DeviceID = %ld] \n", (signed long)s32DeviceID);
26525
26526 #if(UTPA_SUPPORT_COMMON_DECODER_API)
26527 {
26528 return AU_CUS_COMMON_DECODER_Close(s32DeviceID);
26529 }
26530 #else
26531 {
26532 return FALSE;
26533 }
26534 #endif //#if(UTPA_SUPPORT_COMMON_DECODER_API)
26535 }
26536
API_AUDIO_CUSTOMER_COMMON_DECODER_Start(MS_S32 s32DeviceID)26537 MS_S32 API_AUDIO_CUSTOMER_COMMON_DECODER_Start(MS_S32 s32DeviceID)
26538 {
26539 AU_nDBG("[s32DeviceID = %ld] \n", (signed long)s32DeviceID);
26540
26541 #if(UTPA_SUPPORT_COMMON_DECODER_API)
26542 {
26543 return AU_CUS_COMMON_DECODER_Start(s32DeviceID);
26544 }
26545 #else
26546 {
26547 return FALSE;
26548 }
26549 #endif //#if(UTPA_SUPPORT_COMMON_DECODER_API)
26550 }
26551
API_AUDIO_CUSTOMER_COMMON_DECODER_Stop(MS_S32 s32DeviceID)26552 MS_S32 API_AUDIO_CUSTOMER_COMMON_DECODER_Stop(MS_S32 s32DeviceID)
26553 {
26554 AU_nDBG("[s32DeviceID = %ld] \n", (signed long)s32DeviceID);
26555
26556 #if(UTPA_SUPPORT_COMMON_DECODER_API)
26557 {
26558 return AU_CUS_COMMON_DECODER_Stop(s32DeviceID);
26559 }
26560 #else
26561 {
26562 return FALSE;
26563 }
26564 #endif //#if(UTPA_SUPPORT_COMMON_DECODER_API)
26565 }
26566
API_AUDIO_CUSTOMER_COMMON_DECODER_Set(MS_S32 s32DeviceID,API_AUDIO_CUSTOMER_COMMON_DECODER_COMMAND Cmd,void * pData)26567 MS_S32 API_AUDIO_CUSTOMER_COMMON_DECODER_Set(MS_S32 s32DeviceID, API_AUDIO_CUSTOMER_COMMON_DECODER_COMMAND Cmd, void* pData)
26568 {
26569 AU_nDBG("[s32DeviceID = %ld] \n", (signed long)s32DeviceID);
26570
26571 #if(UTPA_SUPPORT_COMMON_DECODER_API)
26572 {
26573 return AU_CUS_COMMON_DECODER_Set(s32DeviceID, Cmd, pData);
26574 }
26575 #else
26576 {
26577 return FALSE;
26578 }
26579 #endif //#if(UTPA_SUPPORT_COMMON_DECODER_API)
26580 }
26581
API_AUDIO_CUSTOMER_COMMON_DECODER_Get(MS_S32 s32DeviceID,API_AUDIO_CUSTOMER_COMMON_DECODER_COMMAND Cmd,void * pData)26582 MS_S32 API_AUDIO_CUSTOMER_COMMON_DECODER_Get(MS_S32 s32DeviceID, API_AUDIO_CUSTOMER_COMMON_DECODER_COMMAND Cmd, void* pData)
26583 {
26584 AU_nDBG("[s32DeviceID = %ld] \n", (signed long)s32DeviceID);
26585
26586 #if(UTPA_SUPPORT_COMMON_DECODER_API)
26587 {
26588 return AU_CUS_COMMON_DECODER_Get(s32DeviceID, Cmd, pData);
26589 }
26590 #else
26591 {
26592 return FALSE;
26593 }
26594 #endif //#if(UTPA_SUPPORT_COMMON_DECODER_API)
26595 }
26596
API_AUDIO_CUSTOMER_COMMON_DECODER_Read(MS_S32 s32DeviceID,void * pBuf,MS_U32 u32Size)26597 MS_U32 API_AUDIO_CUSTOMER_COMMON_DECODER_Read(MS_S32 s32DeviceID, void* pBuf, MS_U32 u32Size)
26598 {
26599 AU_nDBG("[s32DeviceID = %ld] [u32Size = 0x%x] \n", (signed long)s32DeviceID, (unsigned int)u32Size);
26600
26601 #if(UTPA_SUPPORT_COMMON_DECODER_API)
26602 {
26603 return AU_CUS_COMMON_DECODER_Read(s32DeviceID, pBuf, u32Size);
26604 }
26605 #else
26606 {
26607 return FALSE;
26608 }
26609 #endif //#if(UTPA_SUPPORT_COMMON_DECODER_API)
26610 }
26611
API_AUDIO_CUSTOMER_COMMON_DECODER_Write(MS_S32 s32DeviceID,void * pBuf,MS_U32 u32Size)26612 MS_U32 API_AUDIO_CUSTOMER_COMMON_DECODER_Write(MS_S32 s32DeviceID, void* pBuf, MS_U32 u32Size)
26613 {
26614 AU_nDBG("[s32DeviceID = %ld] [u32Size = 0x%x] \n", (signed long)s32DeviceID, (unsigned int)u32Size);
26615
26616 #if(UTPA_SUPPORT_COMMON_DECODER_API)
26617 {
26618 return AU_CUS_COMMON_DECODER_Write(s32DeviceID, pBuf, u32Size);
26619 }
26620 #else
26621 {
26622 return FALSE;
26623 }
26624 #endif //#if(UTPA_SUPPORT_COMMON_DECODER_API)
26625 }
26626
API_AUDIO_CUSTOMER_COMMON_DECODER_Flush(MS_S32 s32DeviceID)26627 MS_S32 API_AUDIO_CUSTOMER_COMMON_DECODER_Flush(MS_S32 s32DeviceID)
26628 {
26629 AU_nDBG("[s32DeviceID = %ld] \n", (signed long)s32DeviceID);
26630
26631 #if(UTPA_SUPPORT_COMMON_DECODER_API)
26632 {
26633 return AU_CUS_COMMON_DECODER_Flush(s32DeviceID);
26634 }
26635 #else
26636 {
26637 return FALSE;
26638 }
26639 #endif //#if(UTPA_SUPPORT_COMMON_DECODER_API)
26640 }
26641
26642 /* Common */
API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMER_PARAM_TYPE paramType,void * pParam)26643 MS_BOOL API_AUDIO_CUSTOMER_SetAudioParam(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_PARAM_TYPE paramType, void *pParam)
26644 {
26645 AU_nThreadDBG("[adecIndex = 0x%X] [paramType = 0x%X] \n", (unsigned int)adecIndex, (unsigned int)paramType);
26646
26647 return AU_CUS_SetAudioParam(adecIndex, paramType, pParam);
26648 }
26649
API_AUDIO_CUSTOMER_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMER_INFO_TYPE infoType,void * pInfo)26650 MS_BOOL API_AUDIO_CUSTOMER_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_INFO_TYPE infoType, void *pInfo)
26651 {
26652 AU_nThreadDBG("[adecIndex = 0x%X] [infoType = 0x%X] \n", (unsigned int)adecIndex, (unsigned int)infoType);
26653
26654 return AU_CUS_GetAudioInfo(adecIndex, infoType, pInfo);
26655 }
26656
26657 /* Customized patch */
API_AUDIO_CUSTOMIZED_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMIZED_PATCH_PARAM_TYPE paramType,void * pParam)26658 MS_BOOL API_AUDIO_CUSTOMIZED_PATCH_SetAudioParam(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMIZED_PATCH_PARAM_TYPE paramType, void *pParam)
26659 {
26660 AU_nThreadDBG("[adecIndex = 0x%X] [paramType = 0x%X] \n", (unsigned int)adecIndex, (unsigned int)paramType);
26661
26662 return AU_CUS_PATCH_SetAudioParam(adecIndex, paramType, pParam);
26663 }
26664
API_AUDIO_CUSTOMIZED_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMIZED_PATCH_INFO_TYPE infoType,void * pInfo)26665 MS_BOOL API_AUDIO_CUSTOMIZED_PATCH_GetAudioInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMIZED_PATCH_INFO_TYPE infoType, void *pInfo)
26666 {
26667 AU_nThreadDBG("[adecIndex = 0x%X] [infoType = 0x%X] \n", (unsigned int)adecIndex, (unsigned int)infoType);
26668
26669 return AU_CUS_PATCH_GetAudioInfo(adecIndex, infoType, pInfo);
26670 }
26671
26672 /* Clip Play for ES */
API_AUDIO_CUSTOMER_PlayClipDecoder(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMER_CLIP_DEC_PARAM clipInfo,MS_U32 bufSize,void * pBufClip,pfnAudioCustomerAdecoderClipDone pfnCallBack)26673 MS_BOOL API_AUDIO_CUSTOMER_PlayClipDecoder(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_CLIP_DEC_PARAM clipInfo, MS_U32 bufSize, void *pBufClip, pfnAudioCustomerAdecoderClipDone pfnCallBack)
26674 {
26675 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
26676
26677 AU_nDBG("[adecIndex = 0x%x] \n", (unsigned int)adecIndex);
26678 AU_nDBG("[clipInfo.clipType = 0x%x] \n", (unsigned int)clipInfo.clipType);
26679 AU_nDBG("[clipInfo.repeatNumber = 0x%x] \n", (unsigned int)clipInfo.repeatNumber);
26680 AU_nDBG("[bufSize = 0x%x] \n", (unsigned int)bufSize);
26681
26682 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
26683
26684 if(pfnCallBack == NULL)
26685 {
26686 AU_nPRINT("[Error] [%s] [Call-Back function is NULL] \n", __FUNCTION__);
26687 return FALSE;
26688 }
26689
26690 madCallBack.pFunc_ClipDec = pfnCallBack;
26691
26692 // Buffer init
26693 AU_CUS_ClipDecoderBufInit(DecID);
26694
26695 // For safety, clean the memory
26696 memset((void *)(pClipDecESBufInfo->u32BufStartAddr_V), 0, pClipDecESBufInfo->u32BufSize);
26697 memset((void *)(pClipDecExtBufInfo->u32BufStartAddr_V), 0, pClipDecExtBufInfo->u32BufSize);
26698
26699 // Save clip info in driver and set play command
26700 AU_CUS_ClipDecoderPlay(adecIndex, clipInfo);
26701
26702 // Copy clip data to External buffer
26703 if(bufSize <= pClipDecExtBufInfo->u32BufSize)
26704 {
26705 memcpy((void *)(pClipDecExtBufInfo->u32BufWptr_V), pBufClip, bufSize);
26706 pClipDecExtBufInfo->u32BufWptr_V += bufSize;
26707 clipDecoderInfo.address = pBufClip;
26708 clipDecoderInfo.u32Size = bufSize;
26709 clipDecoderInfo.u8Sink = adecIndex;
26710 clipDecoderInfo.decID = DecID;
26711 clipDecoderInfo.u32RepeatNum = clipInfo.repeatNumber;
26712 clipDecoderInfo.bIsPause = FALSE;
26713 clipDecoderInfo.bIsStart = TRUE;
26714 }
26715 else
26716 {
26717 // Size larger than both ES buffer and external buffer
26718 AU_nPRINT("[Error] [%s] [ES size(0x%X) is too large] \n", __FUNCTION__, (unsigned int)bufSize);
26719 return FALSE;
26720 }
26721
26722
26723 return TRUE;
26724 }
26725
API_AUDIO_CUSTOMER_StopClipDecoder(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)26726 MS_BOOL API_AUDIO_CUSTOMER_StopClipDecoder(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
26727 {
26728 AUDIO_DEC_ID DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
26729
26730 AU_nDBG("[adecIndex = 0x%x] \n", (unsigned int)adecIndex);
26731
26732 clipDecoderInfo.bIsStart = FALSE;
26733
26734 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_playControl, MMA_STOP);
26735
26736 return TRUE;
26737 }
26738
API_AUDIO_CUSTOMER_PauseClipDecoder(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)26739 MS_BOOL API_AUDIO_CUSTOMER_PauseClipDecoder(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
26740 {
26741 AUDIO_DEC_ID DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
26742
26743 AU_nDBG("[adecIndex = 0x%x] \n", (unsigned int)adecIndex);
26744
26745 clipDecoderInfo.bIsPause = TRUE;
26746
26747 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_playControl, MMA_PAUSE);
26748
26749 return TRUE;
26750 }
26751
API_AUDIO_CUSTOMER_ResumeClipDecoder(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)26752 MS_BOOL API_AUDIO_CUSTOMER_ResumeClipDecoder(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
26753 {
26754 AUDIO_DEC_ID DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
26755
26756 AU_nDBG("[adecIndex = 0x%x] \n", (unsigned int)adecIndex);
26757
26758 clipDecoderInfo.bIsPause = FALSE;
26759
26760 MApi_AUDIO_SetAudioParam2(DecID, Audio_ParamType_playControl, MMA_PLAY_FILE);
26761
26762 return TRUE;
26763 }
26764
26765
26766 /* Clip Play for PCM */
API_AUDIO_CUSTOMER_PlayClipMixer(API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex,API_AUDIO_CUSTOMER_CLIP_MIX_PARAM clipInfo,MS_U32 bufSize,void * pBufClip,pfnAudioCustomerAmixerClipDone pfnCallBack)26767 MS_BOOL API_AUDIO_CUSTOMER_PlayClipMixer(API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex, API_AUDIO_CUSTOMER_CLIP_MIX_PARAM clipInfo, MS_U32 bufSize, void *pBufClip, pfnAudioCustomerAmixerClipDone pfnCallBack)
26768 {
26769 AU_nDBG("[mixerIndex = 0x%x] \n", (unsigned int)mixerIndex);
26770 AU_nDBG("[clipInfo.numOfChannel = 0x%x] \n", (unsigned int)clipInfo.numOfChannel);
26771 AU_nDBG("[clipInfo.bitPerSample = 0x%x] \n", (unsigned int)clipInfo.bitPerSample);
26772 AU_nDBG("[clipInfo.samplingFreq = 0x%x] \n", (unsigned int)clipInfo.samplingFreq);
26773 AU_nDBG("[clipInfo.endianType = 0x%x] \n", (unsigned int)clipInfo.endianType);
26774 AU_nDBG("[clipInfo.signedType = 0x%x] \n", (unsigned int)clipInfo.signedType);
26775 AU_nDBG("[clipInfo.repeatNumber = 0x%x] \n", (unsigned int)clipInfo.repeatNumber);
26776 AU_nDBG("[bufSize = 0x%x] \n", (unsigned int)bufSize);
26777
26778 return FALSE;
26779 }
26780
API_AUDIO_CUSTOMER_StopClipMixer(API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex)26781 MS_BOOL API_AUDIO_CUSTOMER_StopClipMixer(API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex)
26782 {
26783 AU_nDBG("[mixerIndex = 0x%x] \n", (unsigned int)mixerIndex);
26784
26785 return FALSE;
26786 }
26787
API_AUDIO_CUSTOMER_PauseClipMixer(API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex)26788 MS_BOOL API_AUDIO_CUSTOMER_PauseClipMixer(API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex)
26789 {
26790 AU_nDBG("[mixerIndex = 0x%x] \n", (unsigned int)mixerIndex);
26791
26792 return FALSE;
26793 }
26794
API_AUDIO_CUSTOMER_ResumeClipMixer(API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex)26795 MS_BOOL API_AUDIO_CUSTOMER_ResumeClipMixer(API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex)
26796 {
26797 AU_nDBG("[mixerIndex = 0x%x] \n", (unsigned int)mixerIndex);
26798
26799 return FALSE;
26800 }
26801
26802 /* Gain, Mute & Delay */
26803
26804 /**
26805 * API_AUDIO_CUSTOMER_SetAudioDescriptionGain
26806 * gain Scale : 0.125dB
26807 * gain Range : -114.875dB ~ 12dB
26808 * ex. gain 0 = -114.875dB; gain 1015 = 12dB
26809 */
API_AUDIO_CUSTOMER_SetAudioDescriptionGain(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,MS_U32 gain)26810 MS_BOOL API_AUDIO_CUSTOMER_SetAudioDescriptionGain(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_U32 gain)
26811 {
26812 int vol1, vol2;
26813 MS_U32 uAbsVolume;
26814 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
26815
26816 AU_nDBG("[adecIndex = 0x%x] \n", (unsigned int)adecIndex);
26817 AU_nDBG("[gain = %d] \n", (unsigned int)gain);
26818
26819 switch(adecIndex)
26820 {
26821 case API_AUDIO_CUSTOMER_ADEC0:
26822 {
26823 pstAudioCustomerShmData->g_audio_customer_ADEC0_AD_Gain = gain;
26824 }
26825 break;
26826
26827 case API_AUDIO_CUSTOMER_ADEC1:
26828 {
26829 pstAudioCustomerShmData->g_audio_customer_ADEC1_AD_Gain = gain;
26830 }
26831 break;
26832
26833 default:
26834 break;
26835 }
26836
26837 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
26838
26839 vol1 = (1015 - (int)gain)/8;
26840 vol2 = (1015 - (int)gain) - vol1*8;
26841
26842 uAbsVolume = ((vol1&0x7F)<<8)+((vol2&0x7)<<5);
26843 uAbsVolume = uAbsVolume >> 5;
26844
26845 MApi_AUDIO_SetAudioParam2(DecID, Audio_R2_SHM_PARAM_AD_Volume, uAbsVolume);
26846
26847 return TRUE;
26848 }
26849
26850 /**
26851 * API_AUDIO_CUSTOMER_SetPCMMixerInputGain
26852 * gain Scale : 0.125dB
26853 * gain Range : -114.875dB ~ 12dB
26854 * ex. gain 0 = -114.875dB; gain 1015 = 12dB
26855 */
API_AUDIO_CUSTOMER_SetPCMMixerInputGain(API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex,MS_U32 gain)26856 MS_BOOL API_AUDIO_CUSTOMER_SetPCMMixerInputGain(API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex, MS_U32 gain)
26857 {
26858 AU_nDBG("[mixerIndex = 0x%x] \n", (unsigned int)mixerIndex);
26859 AU_nDBG("[gain = 0x%x] \n", (unsigned int)gain);
26860
26861 return FALSE;
26862 }
26863
26864 /**
26865 * API_AUDIO_CUSTOMER_SetFWMixerChannelGain
26866 * gain Scale : 0.125dB
26867 * gain Range : -114.875dB ~ 12dB
26868 * ex. gain 0 = -114.875dB; gain 1015 = 12dB
26869 */
API_AUDIO_CUSTOMER_SetFWMixerChannelGain(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect,API_AUDIO_CUSTOMER_FWM_INPUT inputConnect,MS_U32 gain)26870 MS_BOOL API_AUDIO_CUSTOMER_SetFWMixerChannelGain(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect, API_AUDIO_CUSTOMER_FWM_INPUT inputConnect, MS_U32 gain)
26871 {
26872 AU_nDBG("[currentConnect = 0x%x] [inputConnect = 0x%x] [gain = %d] \n", (unsigned int)currentConnect, (unsigned int)inputConnect, (unsigned int)gain);
26873
26874 return AU_CUS_SetFWMixerChannelGain(currentConnect, inputConnect, gain);
26875 }
26876
26877 /**
26878 * API_AUDIO_CUSTOMER_SetI2SOutGain
26879 * gain Scale : 0.125dB
26880 * gain Range : -114.875dB ~ 12dB
26881 * ex. gain 0 = -114.875dB; gain 1015 = 12dB
26882 */
API_AUDIO_CUSTOMER_SetI2SOutGain(MS_U32 gain)26883 MS_BOOL API_AUDIO_CUSTOMER_SetI2SOutGain(MS_U32 gain)
26884 {
26885 AU_nDBG("[gain = %d] \n", (unsigned int)gain);
26886
26887 return AU_CUS_SetI2SOutGain(gain);
26888 }
26889
26890 /**
26891 * API_AUDIO_CUSTOMER_SetLineOutGain
26892 * gain Scale : 0.125dB
26893 * gain Range : -114.875dB ~ 12dB
26894 * ex. gain 0 = -114.875dB; gain 1015 = 12dB
26895 */
API_AUDIO_CUSTOMER_SetLineOutGain(API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex,MS_U32 gain)26896 MS_BOOL API_AUDIO_CUSTOMER_SetLineOutGain(API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex, MS_U32 gain)
26897 {
26898 AU_nDBG("[lineIndex = %d] [gain = %d] \n", (unsigned int)lineIndex, (unsigned int)gain);
26899
26900 return AU_CUS_SetLineOutGain(lineIndex, gain);
26901 }
26902
26903 /**
26904 * API_AUDIO_CUSTOMER_SetSPDIFOutGain
26905 * gain Scale : 0.125dB
26906 * gain Range : -114.875dB ~ 12dB
26907 * ex. gain 0 = -114.875dB; gain 1015 = 12dB
26908 */
API_AUDIO_CUSTOMER_SetSPDIFOutGain(MS_U32 gain)26909 MS_BOOL API_AUDIO_CUSTOMER_SetSPDIFOutGain(MS_U32 gain)
26910 {
26911 AU_nDBG("[gain = %d] \n", (unsigned int)gain);
26912
26913 return AU_CUS_SetSPDIFOutGain(gain);
26914 }
26915
26916 /**
26917 * API_AUDIO_CUSTOMER_SetHDMIOutGain
26918 * gain Scale : 0.125dB
26919 * gain Range : -114.875dB ~ 12dB
26920 * ex. gain 0 = -114.875dB; gain 1015 = 12dB
26921 */
API_AUDIO_CUSTOMER_SetHDMIOutGain(MS_U32 gain)26922 MS_BOOL API_AUDIO_CUSTOMER_SetHDMIOutGain(MS_U32 gain)
26923 {
26924 int vol1, vol2;
26925
26926 AU_nDBG("[gain = %d] \n", (unsigned int)gain);
26927
26928 pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_Gain = gain;
26929 gain = gain + pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_HDMI_Out;
26930
26931 vol1 = (1015 - (int)gain)/8;
26932 vol2 = (1015 - (int)gain) - vol1*8;
26933 MApi_AUDIO_SetAbsoluteVolume(AUDIO_T3_PATH_HDMI, vol1, vol2);
26934
26935 return TRUE;
26936 }
26937
API_AUDIO_CUSTOMER_SetPCMMixerInputMute(API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex,MS_BOOL bOnOff)26938 MS_BOOL API_AUDIO_CUSTOMER_SetPCMMixerInputMute(API_AUDIO_CUSTOMER_MIXER_INDEX mixerIndex, MS_BOOL bOnOff)
26939 {
26940 AU_nDBG("[mixerIndex = 0x%x] [bOnOff = 0x%x] \n", (unsigned int)mixerIndex, (unsigned int)bOnOff);
26941
26942 return FALSE;
26943 }
26944
API_AUDIO_CUSTOMER_SetFWMixerChannelMute(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect,API_AUDIO_CUSTOMER_FWM_INPUT inputConnect,MS_BOOL bOnOff)26945 MS_BOOL API_AUDIO_CUSTOMER_SetFWMixerChannelMute(API_AUDIO_CUSTOMER_FWM_INDEX currentConnect, API_AUDIO_CUSTOMER_FWM_INPUT inputConnect, MS_BOOL bOnOff)
26946 {
26947 AU_nDBG("[currentConnect = 0x%x] [inputConnect = 0x%x] [bOnOff = 0x%x] \n", (unsigned int)currentConnect, (unsigned int)inputConnect, (unsigned int)bOnOff);
26948
26949 return AU_CUS_SetFWMixerChannelMute(currentConnect, inputConnect, bOnOff);
26950 }
26951
API_AUDIO_CUSTOMER_SetI2SOutMute(MS_BOOL bOnOff)26952 MS_BOOL API_AUDIO_CUSTOMER_SetI2SOutMute(MS_BOOL bOnOff)
26953 {
26954 AU_nDBG("[bOnOff = 0x%x] \n", (unsigned int)bOnOff);
26955
26956 return AU_CUS_SetI2SOutMute(bOnOff);
26957 }
26958
API_AUDIO_CUSTOMER_SetLineOutMute(API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex,MS_BOOL bOnOff)26959 MS_BOOL API_AUDIO_CUSTOMER_SetLineOutMute(API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex, MS_BOOL bOnOff)
26960 {
26961 AU_nDBG("[lineIndex = %d] [bOnOff = 0x%x] \n", lineIndex, bOnOff);
26962
26963 return AU_CUS_SetLineOutMute(lineIndex, bOnOff);
26964 }
26965
API_AUDIO_CUSTOMER_SetSPDIFOutMute(MS_BOOL bOnOff)26966 MS_BOOL API_AUDIO_CUSTOMER_SetSPDIFOutMute(MS_BOOL bOnOff)
26967 {
26968 AU_nDBG("[bOnOff = 0x%x] \n", (unsigned int)bOnOff);
26969
26970 return AU_CUS_SetSPDIFOutMute(bOnOff);
26971 }
26972
API_AUDIO_CUSTOMER_SetHDMIOutMute(MS_BOOL bOnOff)26973 MS_BOOL API_AUDIO_CUSTOMER_SetHDMIOutMute(MS_BOOL bOnOff)
26974 {
26975 AU_nDBG("[bOnOff = 0x%x] \n", (unsigned int)bOnOff);
26976
26977 return AU_CUS_SetHDMIOutMute(bOnOff);
26978 }
26979
API_AUDIO_CUSTOMER_GetI2SOutMuteStatus(MS_BOOL * pOnOff)26980 MS_BOOL API_AUDIO_CUSTOMER_GetI2SOutMuteStatus(MS_BOOL *pOnOff)
26981 {
26982 *pOnOff = pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_bMute;
26983
26984 AU_nDBG("[pOnOff = 0x%x] \n", *pOnOff);
26985
26986 return TRUE;
26987 }
26988
API_AUDIO_CUSTOMER_GetLineOutMuteStatus(API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex,MS_BOOL * pOnOff)26989 MS_BOOL API_AUDIO_CUSTOMER_GetLineOutMuteStatus(API_AUDIO_CUSTOMER_LINE_OUT_IDX lineIndex, MS_BOOL *pOnOff)
26990 {
26991 switch(lineIndex)
26992 {
26993 case API_AUDIO_CUSTOMER_LINE_OUT_0:
26994 {
26995 *pOnOff = pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_bMute;
26996 }
26997 break;
26998
26999 case API_AUDIO_CUSTOMER_LINE_OUT_1:
27000 {
27001 *pOnOff = pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_bMute;
27002 }
27003 break;
27004
27005 case API_AUDIO_CUSTOMER_LINE_OUT_2:
27006 {
27007 *pOnOff = pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_bMute;
27008 }
27009 break;
27010
27011 case API_AUDIO_CUSTOMER_LINE_OUT_3:
27012 {
27013 *pOnOff = pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_bMute;
27014 }
27015 break;
27016
27017 default:
27018 break;
27019 }
27020
27021 AU_nDBG("[lineIndex = %d] [bOnOff = 0x%x] \n", lineIndex, *pOnOff);
27022
27023 return TRUE;
27024 }
27025
API_AUDIO_CUSTOMER_GetSPDIFOutMuteStatus(MS_BOOL * pOnOff)27026 MS_BOOL API_AUDIO_CUSTOMER_GetSPDIFOutMuteStatus(MS_BOOL *pOnOff)
27027 {
27028 *pOnOff = pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_bMute;
27029
27030 AU_nDBG("[pOnOff = 0x%x] \n", *pOnOff);
27031
27032 return TRUE;
27033 }
27034
API_AUDIO_CUSTOMER_MuteDuringLimitedTime_Input(MS_U32 per_50ms,API_AUDIO_CUSTOMER_FWM_INDEX eFWM,API_AUDIO_CUSTOMER_FWM_INPUT eCh)27035 MS_BOOL API_AUDIO_CUSTOMER_MuteDuringLimitedTime_Input(MS_U32 per_50ms, API_AUDIO_CUSTOMER_FWM_INDEX eFWM, API_AUDIO_CUSTOMER_FWM_INPUT eCh)
27036 {
27037 AU_nDBG("[per_50ms = %d] [eFWM = 0x%x] [eCh = 0x%x] \n", (unsigned int)per_50ms, (unsigned int)eFWM, (unsigned int)eCh);
27038
27039 return AU_CUS_MuteDuringLimitedTime_Input(per_50ms, eFWM, eCh);
27040 }
27041
API_AUDIO_CUSTOMER_MuteDuringLimitedTime_Output(MS_U32 per_50ms,API_AUDIO_CUSTOMER_OUTPUT_TYPE ePort)27042 MS_BOOL API_AUDIO_CUSTOMER_MuteDuringLimitedTime_Output(MS_U32 per_50ms, API_AUDIO_CUSTOMER_OUTPUT_TYPE ePort)
27043 {
27044 AU_nDBG("[per_50ms = %d] [ePort = 0x%x] \n", (unsigned int)per_50ms, (unsigned int)ePort);
27045
27046 return AU_CUS_MuteDuringLimitedTime_Output(per_50ms, ePort);
27047 }
27048
API_AUDIO_CUSTOMER_SetChannelDelay(API_AUDIO_CUSTOMER_CH_SOUND ch,MS_U32 delay)27049 MS_BOOL API_AUDIO_CUSTOMER_SetChannelDelay(API_AUDIO_CUSTOMER_CH_SOUND ch, MS_U32 delay)
27050 {
27051 AU_nDBG("[delay = 0x%x] \n", (unsigned int)delay);
27052
27053 switch(ch)
27054 {
27055 case API_AUDIO_CUSTOMER_CH5_SOUND:
27056 {
27057 pstAudioCustomerShmData->g_audio_customer_CH5_Sound_inDelay = delay;
27058 }
27059 break;
27060
27061 case API_AUDIO_CUSTOMER_CH6_SOUND:
27062 {
27063 pstAudioCustomerShmData->g_audio_customer_CH6_Sound_inDelay = delay;
27064 }
27065 break;
27066
27067 case API_AUDIO_CUSTOMER_CH7_SOUND:
27068 {
27069 pstAudioCustomerShmData->g_audio_customer_CH7_Sound_inDelay = delay;
27070 }
27071 break;
27072
27073 case API_AUDIO_CUSTOMER_CH8_SOUND:
27074 {
27075 pstAudioCustomerShmData->g_audio_customer_CH8_Sound_inDelay = delay;
27076 }
27077 break;
27078
27079 default:
27080 break;
27081 }
27082
27083 return AU_CUS_SetChannelDelay(ch, delay);
27084 }
27085
API_AUDIO_CUSTOMER_SetAudioDelay(MS_U32 delay)27086 MS_BOOL API_AUDIO_CUSTOMER_SetAudioDelay(MS_U32 delay)
27087 {
27088 AU_nThreadDBG("[delay = 0x%x] \n", (unsigned int)delay);
27089
27090 pstAudioCustomerShmData->g_audio_customer_SE_UpperDelay = delay;
27091
27092 return AU_CUS_SetAudioDelay(delay);
27093 }
27094
API_AUDIO_CUSTOMER_SetSpdifDelay(MS_U32 delay)27095 MS_BOOL API_AUDIO_CUSTOMER_SetSpdifDelay(MS_U32 delay)
27096 {
27097 AU_nThreadDBG("[delayTime = 0x%x] \n", (unsigned int)delay);
27098
27099 pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_UpperDelay = delay;
27100
27101 return AU_CUS_SetSpdifDelay(delay);
27102 }
27103
API_AUDIO_CUSTOMER_SetHdmiDelay(MS_U32 delay)27104 MS_BOOL API_AUDIO_CUSTOMER_SetHdmiDelay(MS_U32 delay)
27105 {
27106 AU_nThreadDBG("[delayTime = 0x%x] \n", (unsigned int)delay);
27107
27108 pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_UpperDelay = delay;
27109
27110 return AU_CUS_SetHdmiDelay(delay);
27111 }
27112
27113 /* AENC */
API_AUDIO_CUSTOMER_AENC_Start(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat)27114 MS_BOOL API_AUDIO_CUSTOMER_AENC_Start(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat)
27115 {
27116 AU_nDBG("[encFormat = 0x%x] \n", (unsigned int)encFormat);
27117
27118 if(firstGetEncodeTimeFlag == TRUE)
27119 {
27120 firstGetEncodeTimeFlag = FALSE;//clear global valiable
27121 }
27122
27123 switch(encFormat)
27124 {
27125 case API_AUDIO_CUSTOMER_AENC_ENCODE_MP3:
27126 {
27127 API_AUDIO_CUSTOMER_MP3_ENC_INPUT mp3EncodeInput = pstAudioCustomerShmData->g_audio_customer_MP3_ENC_Connect;
27128 AUDIO_CAPTURE_SOURCE_TYPE captureSourceType = E_CAPTURE_MAX_NUM;
27129
27130 pAU_MP3EncDumpFile = AU_CUS_FileOpen("/tmp/MP3EncDump.mp3", "wb");
27131 if(pAU_MP3EncDumpFile == FALSE)
27132 {
27133 AU_nPRINT("[A] [Error] [%s] [open file for MP3EncDump.mp3 fail] \n", __FUNCTION__);
27134 }
27135
27136 memset((void *)(&AENC_INFO), 0x0, sizeof(AENC_INFO));
27137
27138 AENC_INFO.status = API_AUDIO_CUSTOMER_AENC_STATUS_PLAY;
27139 AENC_INFO.codec = API_AUDIO_CUSTOMER_AENC_ENCODE_MP3;
27140 AENC_INFO.channel = API_AUDIO_CUSTOMER_AENC_STEREO;
27141 AENC_INFO.bitrate = API_AUDIO_CUSTOMER_AENC_BIT_128K;
27142
27143 if(mp3EncodeInput == API_AUDIO_CUSTOMER_MP3_ENC_INPUT_CH5)
27144 {
27145 captureSourceType = E_CAPTURE_CH5;
27146 }
27147 else if(mp3EncodeInput == API_AUDIO_CUSTOMER_MP3_ENC_INPUT_CH6)
27148 {
27149 captureSourceType = E_CAPTURE_CH6;
27150 }
27151 else
27152 {
27153 AU_nPRINT("[A] [Error] [%s] [wrong mp3 encode input :0x%x] \n", __FUNCTION__, captureSourceType);
27154 }
27155
27156 if(AU_CUS_MP3EncodeInit(AU_CUS_MP3EncCallBack, captureSourceType) == TRUE)
27157 {
27158 firstGetEncodeTimeFlag = TRUE;
27159 pstAudioCustomerShmData->g_audio_customer_MP3_ENC_bEnable = TRUE;
27160 }
27161 else
27162 {
27163 AU_nPRINT("[A] [Error] [%s] [mp3 encode init fail] \n", __FUNCTION__);
27164 return FALSE;
27165 }
27166 }
27167 break;
27168
27169 case API_AUDIO_CUSTOMER_AENC_ENCODE_AAC:
27170 {
27171
27172 #if (UTPA_SUPPORT_AAC_ENCODE == 1)
27173 API_AUDIO_CUSTOMER_AAC_ENC_INPUT aacEncodeInput = pstAudioCustomerShmData->g_audio_customer_AAC_ENC_Connect;
27174 API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT captureCustomerSourceType = API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT_MAX;
27175 AUDIO_CAPTURE_SOURCE_TYPE captureDriverSourceType = E_CAPTURE_MAX_NUM;
27176 MS_S32 retAACEnc = -1;
27177 tMp4AacEncParams aacEncParams;
27178
27179 /* create AAC encode related debug files */
27180 if(pstAudioCustomerShmData->g_audio_customer_AENC_bDumpEncData)
27181 {
27182 pAU_AACEncDumpFile = AU_CUS_FileOpen("/tmp/AACEncDump.aac", "wb");
27183 if(pAU_AACEncDumpFile == FALSE)
27184 {
27185 AU_nPRINT("[A] [Error] [%s] [open file for AACEncDump.aac fail] \n", __FUNCTION__);
27186 }
27187
27188 pAU_AACEncPCMCaptureDumpFile = AU_CUS_FileOpen("/tmp/AACEncPCMDump.pcm", "wb");
27189 if(pAU_AACEncPCMCaptureDumpFile == FALSE)
27190 {
27191 AU_nPRINT("[A] [Error] [%s] [open file for AACEncPCMDump.pcm set fail] \n", __FUNCTION__);
27192 }
27193 }
27194
27195 /* save AAC encode related information in driver side */
27196 memset((void *)(&AENC_INFO), 0x0, sizeof(AENC_INFO));
27197 AENC_INFO.status = API_AUDIO_CUSTOMER_AENC_STATUS_PLAY;
27198 AENC_INFO.codec = API_AUDIO_CUSTOMER_AENC_ENCODE_AAC;
27199 AENC_INFO.channel = API_AUDIO_CUSTOMER_AENC_STEREO;
27200
27201 /* prepare AAC encode related parameters */
27202 memset((void *)(&aacEncParams), 0x0, sizeof(aacEncParams));
27203 aacEncParams.NumberOfChannels = 2;
27204 aacEncParams.SamplingFrequency = 48000;
27205 aacEncParams.OutputFormat = FORMAT_ADTS;
27206 aacEncParams.OutputBitRate = 128000;
27207 aacEncParams.ChannelMode = JOINT_STEREO;
27208 aacEncParams.BandWidthSel= 50;
27209
27210 /* open AAC encode handler */
27211 retAACEnc = Mpeg4AacEnc_Create(&aacEncodeHandler);
27212 if (retAACEnc != E_EMZ_SUCCESS)
27213 {
27214 AU_nPRINT("[A] [Error] [create aacEncodeHandler fail (%d)] \n", (int)retAACEnc);
27215 return FALSE;
27216 }
27217
27218 /* set AAC encode parameters */
27219 retAACEnc = Mpeg4AacEnc_Reset(aacEncodeHandler, &aacEncParams);
27220 if (retAACEnc != E_EMZ_SUCCESS)
27221 {
27222 AU_nPRINT("[A] [Error] [reset(%d) 0x%x fail] \n", (int)retAACEnc, (unsigned int)aacEncParams.OutputFormat);
27223 return FALSE;
27224 }
27225
27226 /* get PCM capture input */
27227 if(aacEncodeInput == API_AUDIO_CUSTOMER_AAC_ENC_INPUT_PCM_CAPTURE0)
27228 {
27229 captureCustomerSourceType = pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_Connect;
27230 AACEncPCMCaptureDevice = E_DEVICE0;
27231 }
27232 else if(aacEncodeInput == API_AUDIO_CUSTOMER_AAC_ENC_INPUT_PCM_CAPTURE1)
27233 {
27234 captureCustomerSourceType = pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE1_Connect;
27235 AACEncPCMCaptureDevice = E_DEVICE1;
27236 }
27237 else
27238 {
27239 AU_nPRINT("[A] [Error] [%s] [wrong aac encode input :0x%x] \n", __FUNCTION__, captureDriverSourceType);
27240 captureCustomerSourceType = pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_Connect;
27241 AACEncPCMCaptureDevice = E_DEVICE0;
27242 }
27243 captureDriverSourceType = AU_CUS_ConvertCustomerCaptureInputToDriverInput(captureCustomerSourceType);
27244
27245 /* init and start PCM capture */
27246 if(AU_CUS_AACEncodeInit(captureDriverSourceType) == TRUE)
27247 {
27248 firstGetEncodeTimeFlag = TRUE;
27249 pstAudioCustomerShmData->g_audio_customer_AAC_ENC_bEnable = TRUE;
27250 }
27251 else
27252 {
27253 AU_nPRINT("[A] [Error] [%s] [aac encode init fail] \n", __FUNCTION__);
27254 return FALSE;
27255 }
27256 #endif
27257
27258 }
27259 break;
27260
27261 default:
27262 {
27263 AU_nPRINT("[A] [Error] [%s] [wrong audio encoding type: 0x%X] \n", __FUNCTION__, encFormat);
27264 }
27265 break;
27266 }
27267
27268 return TRUE;
27269 }
27270
API_AUDIO_CUSTOMER_AENC_Stop(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat)27271 MS_BOOL API_AUDIO_CUSTOMER_AENC_Stop(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat)
27272 {
27273 AU_nDBG("[encFormat = 0x%x] \n", (unsigned int)encFormat);
27274
27275 switch(encFormat)
27276 {
27277 case API_AUDIO_CUSTOMER_AENC_ENCODE_MP3:
27278 {
27279 pstAudioCustomerShmData->g_audio_customer_MP3_ENC_bEnable = FALSE;
27280
27281 memset(&AENC_INFO, 0, sizeof(API_AUDIO_CUSTOMER_AENC_INFO));
27282
27283 AENC_INFO.status = API_AUDIO_CUSTOMER_AENC_STATUS_STOP;
27284
27285 MApi_AUDIO_PCMCapture_Stop(E_DEVICE2);
27286
27287 AU_CUS_FileClose(pAU_MP3EncDumpFile);
27288
27289 AU_CUS_MemoryFree((void *)pMP3EncBuffer);
27290 }
27291 break;
27292
27293 case API_AUDIO_CUSTOMER_AENC_ENCODE_AAC:
27294 {
27295
27296 #if (UTPA_SUPPORT_AAC_ENCODE == 1)
27297 if(pstAudioCustomerShmData->g_audio_customer_AAC_ENC_bEnable == TRUE)
27298 {
27299 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
27300 {
27301 mutex_lock(&AU_Customer_AACEncode_mutex_lock);
27302 }
27303 #else //User Space
27304 {
27305 OS_OBTAIN_MUTEX(AU_Customer_AACEncode_mutex_lock, MSOS_WAIT_FOREVER);
27306 }
27307 #endif
27308
27309 MS_S32 retAACEnc = -1;
27310 pstAudioCustomerShmData->g_audio_customer_AAC_ENC_bEnable = FALSE;
27311
27312 memset(&AENC_INFO, 0, sizeof(API_AUDIO_CUSTOMER_AENC_INFO));
27313 AENC_INFO.status = API_AUDIO_CUSTOMER_AENC_STATUS_STOP;
27314
27315 MApi_AUDIO_PCMCapture_Stop(AACEncPCMCaptureDevice);
27316 if(aacEncodeHandler != NULL)
27317 {
27318 retAACEnc = Mpeg4AacEnc_Delete(aacEncodeHandler);
27319 if(retAACEnc < 0)
27320 {
27321 AU_nPRINT("[A] [Error] [%s] [Abnormal msg(0x%X) when delete AAC encode handler] \n", __FUNCTION__, (int)retAACEnc);
27322 }
27323 }
27324
27325 if(pAU_AACEncDumpFile != NULL)
27326 {
27327 AU_CUS_FileClose(pAU_AACEncDumpFile);
27328 pAU_AACEncDumpFile = NULL;
27329 }
27330
27331 if(pAU_AACEncPCMCaptureDumpFile != NULL)
27332 {
27333 AU_CUS_FileClose(pAU_AACEncPCMCaptureDumpFile);
27334 pAU_AACEncPCMCaptureDumpFile = NULL;
27335 }
27336
27337 if(pAACEncPCMBuffer != NULL)
27338 {
27339 AU_CUS_MemoryFree((void *)pAACEncPCMBuffer);
27340 pAACEncPCMBuffer = NULL;
27341 }
27342
27343 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
27344 {
27345 mutex_unlock(&AU_Customer_AACEncode_mutex_lock);
27346 }
27347 #else //User Space
27348 {
27349 OS_RELEASE_MUTEX(AU_Customer_AACEncode_mutex_lock);
27350 }
27351 #endif
27352 }
27353 #endif
27354
27355 }
27356 break;
27357
27358 default:
27359 {
27360 AU_nPRINT("[A] [Error] [%s] [wrong audio encoding type: 0x%x] \n", __FUNCTION__, encFormat);
27361 }
27362 break;
27363 }
27364 return FALSE;
27365 }
27366
API_AUDIO_CUSTOMER_AENC_RegisterCallback(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat,pfnAudioCustomerAENCDataHandling pfnCallBack)27367 MS_BOOL API_AUDIO_CUSTOMER_AENC_RegisterCallback(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat, pfnAudioCustomerAENCDataHandling pfnCallBack)
27368 {
27369 AU_nDBG("[encFormat = 0x%x] \n", (unsigned int)encFormat);
27370
27371 switch(encFormat)
27372 {
27373 case API_AUDIO_CUSTOMER_AENC_ENCODE_MP3:
27374 {
27375 madCallBack.pFunc_AencMP3 = pfnCallBack;
27376 }
27377 break;
27378
27379 case API_AUDIO_CUSTOMER_AENC_ENCODE_AAC:
27380 {
27381 madCallBack.pFunc_AencAAC = pfnCallBack;
27382 }
27383 break;
27384
27385 default:
27386 {
27387 AU_nPRINT("[A] [Error] [%s] [wrong audio encoding type: 0x%x] \n", __FUNCTION__, encFormat);
27388 }
27389 break;
27390 }
27391
27392 return TRUE;
27393 }
27394
API_AUDIO_CUSTOMER_AENC_SetInfo(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat,API_AUDIO_CUSTOMER_AENC_INFO info)27395 MS_BOOL API_AUDIO_CUSTOMER_AENC_SetInfo(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat, API_AUDIO_CUSTOMER_AENC_INFO info)
27396 {
27397 AU_nDBG("[encFormat = 0x%x] \n", (unsigned int)encFormat);
27398 AU_nDBG("[info.status = 0x%x] \n", (unsigned int)info.status);
27399 AU_nDBG("[info.codec = 0x%x] \n", (unsigned int)info.codec);
27400 AU_nDBG("[info.errorCount = 0x%x] \n", (unsigned int)info.errorCount);
27401 AU_nDBG("[info.inputCount = 0x%x] \n", (unsigned int)info.inputCount);
27402 AU_nDBG("[info.underflowCount = 0x%x] \n", (unsigned int)info.underflowCount);
27403 AU_nDBG("[info.overflowCount = 0x%x] \n", (unsigned int)info.overflowCount);
27404 AU_nDBG("[info.channel = 0x%x] \n", (unsigned int)info.channel);
27405 AU_nDBG("[info.bitrate = 0x%x] \n", (unsigned int)info.bitrate);
27406
27407 return TRUE;
27408 }
27409
API_AUDIO_CUSTOMER_AENC_GetInfo(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat,API_AUDIO_CUSTOMER_AENC_INFO * pInfo)27410 MS_BOOL API_AUDIO_CUSTOMER_AENC_GetInfo(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat, API_AUDIO_CUSTOMER_AENC_INFO *pInfo)
27411 {
27412 AU_nDBG("[encFormat = 0x%x] \n", (unsigned int)encFormat);
27413 AU_nDBG("[pInfo->status = 0x%x] \n", (unsigned int)pInfo->status);
27414 AU_nDBG("[pInfo->codec = 0x%x] \n", (unsigned int)pInfo->codec);
27415 AU_nDBG("[pInfo->errorCount = 0x%x] \n", (unsigned int)pInfo->errorCount);
27416 AU_nDBG("[pInfo->inputCount = 0x%x] \n", (unsigned int)pInfo->inputCount);
27417 AU_nDBG("[pInfo->underflowCount = 0x%x] \n", (unsigned int)pInfo->underflowCount);
27418 AU_nDBG("[pInfo->overflowCount = 0x%x] \n", (unsigned int)pInfo->overflowCount);
27419 AU_nDBG("[pInfo->channel = 0x%x] \n", (unsigned int)pInfo->channel);
27420 AU_nDBG("[pInfo->bitrate = 0x%x] \n", (unsigned int)pInfo->bitrate);
27421
27422 return TRUE;
27423 }
27424
27425 /**
27426 * API_AUDIO_CUSTOMER_AENC_SetGain
27427 * gain Scale : 0.125dB
27428 * gain Range : -114.875dB ~ 12dB
27429 * ex. gain 0 = -114.875dB; gain 1015 = 12dB
27430 */
API_AUDIO_CUSTOMER_AENC_SetGain(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat,MS_U32 gain)27431 MS_BOOL API_AUDIO_CUSTOMER_AENC_SetGain(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat, MS_U32 gain)
27432 {
27433 MS_U32 mainVol, fineVol;
27434
27435 AU_nDBG("[encFormat = 0x%x] \n", (unsigned int)encFormat);
27436 AU_nDBG("[gain = %d] \n", (unsigned int)gain);
27437
27438 mainVol = (1015 - (int)gain)/8;
27439 fineVol = (1015 - (int)gain) - mainVol*8;
27440
27441 pstAudioCustomerShmData->g_audio_customer_AENC_Gain = gain;
27442
27443 switch(encFormat)
27444 {
27445 case API_AUDIO_CUSTOMER_AENC_ENCODE_MP3:
27446 {
27447 AU_nPRINT("[A] [Error] [%s] [not support mp3 volume adjust right now: 0x%X] \n", __FUNCTION__, encFormat);
27448 }
27449 break;
27450
27451 case API_AUDIO_CUSTOMER_AENC_ENCODE_AAC:
27452 {
27453 API_AUDIO_CUSTOMER_AAC_ENC_INPUT aacEncodeInput = pstAudioCustomerShmData->g_audio_customer_AAC_ENC_Connect;
27454
27455 switch(aacEncodeInput)
27456 {
27457 case API_AUDIO_CUSTOMER_AAC_ENC_INPUT_PCM_CAPTURE0:
27458 {
27459 MApi_AUDIO_SetAbsoluteVolume(AUDIO_T3_PATH_PCM_CAPTURE1, (MS_U8)mainVol, (MS_U8)fineVol);
27460 }
27461 break;
27462
27463 case API_AUDIO_CUSTOMER_AAC_ENC_INPUT_PCM_CAPTURE1:
27464 {
27465 MApi_AUDIO_SetAbsoluteVolume(AUDIO_T3_PATH_PCM_CAPTURE2, (MS_U8)mainVol, (MS_U8)fineVol);
27466 }
27467 break;
27468
27469 default:
27470 {
27471 AU_nPRINT("[A] [Error] [%s] [unsupport aac encode input: %x] \n", __FUNCTION__, aacEncodeInput);
27472 return FALSE;
27473 }
27474 break;
27475 }
27476 }
27477 break;
27478
27479 default:
27480 {
27481 AU_nPRINT("[A] [Error] [%s] [wrong audio encoding type: 0x%X] \n", __FUNCTION__, encFormat);
27482 }
27483 break;
27484 }
27485 return TRUE;
27486 }
27487
API_AUDIO_CUSTOMER_AENC_CopyData(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat,MS_U8 * pDest,MS_U8 * pBufAddr,MS_U32 datasize,MS_U8 * pRStart,MS_U8 * pREnd)27488 MS_BOOL API_AUDIO_CUSTOMER_AENC_CopyData(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat, MS_U8 *pDest, MS_U8 *pBufAddr, MS_U32 datasize, MS_U8 *pRStart, MS_U8 *pREnd)
27489 {
27490 AU_nDBG("[encFormat = 0x%x] [datasize = 0x%x] \n", (unsigned int)encFormat, (unsigned int)datasize);
27491
27492 return TRUE;
27493 }
27494
API_AUDIO_CUSTOMER_AENC_ReleaseData(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat,MS_U8 * pBufAddr,MS_U32 datasize)27495 MS_BOOL API_AUDIO_CUSTOMER_AENC_ReleaseData(API_AUDIO_CUSTOMER_AENC_ENCODING_FORMAT encFormat, MS_U8 *pBufAddr, MS_U32 datasize)
27496 {
27497 AU_nDBG("[encFormat = 0x%x] [datasize = 0x%x] \n", (unsigned int)encFormat, (unsigned int)datasize);
27498
27499 return TRUE;
27500 }
27501
27502 /* PCM Capture */
API_AUDIO_CUSTOMER_PCM_StartUpload(API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect)27503 MS_BOOL API_AUDIO_CUSTOMER_PCM_StartUpload(API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect)
27504 {
27505 API_AUDIO_CUSTOMER_PCM_CAPTURE_INPUT captureInput;
27506 AUDIO_DEVICE_TYPE captureDriverDeviceType;
27507 AUDIO_CAPTURE_SOURCE_TYPE captureDriverSourceType;
27508
27509 AU_nDBG("[currentConnect = 0x%x] \n", (unsigned int)currentConnect);
27510
27511 if(pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE_Source_Dump_to_file_bEnable)
27512 {
27513 pAU_PcmCaptureSourceDumpFile = AU_CUS_FileOpen(AU_PCM_CAPTURE_SOURCE_DUMP_PATH, "wb");
27514 if(pAU_PcmCaptureSourceDumpFile == FALSE)
27515 {
27516 AU_nPRINT("[A] [Error] [%s] [%d] [open dump file is fail !] \n", __FUNCTION__, __LINE__);
27517 }
27518 }
27519
27520 switch(currentConnect)
27521 {
27522 case API_AUDIO_CUSTOMER_PCM_CAPTURE0:
27523 {
27524 captureInput = pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_Connect;
27525 captureDriverDeviceType = E_DEVICE0;
27526 }
27527 break;
27528
27529 case API_AUDIO_CUSTOMER_PCM_CAPTURE1:
27530 {
27531 captureInput = pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE1_Connect;
27532 captureDriverDeviceType = E_DEVICE1;
27533 }
27534 break;
27535
27536 case API_AUDIO_CUSTOMER_PCM_CAPTURE2:
27537 {
27538 captureInput = pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE2_Connect;
27539 captureDriverDeviceType = E_DEVICE2;
27540 }
27541 break;
27542
27543 default:
27544 {
27545 AU_nPRINT("[A] [Error] [%s] [unsupport pcm capture index: %x] \n", __FUNCTION__, currentConnect);
27546 return FALSE;
27547 }
27548 break;
27549 }
27550
27551 captureDriverSourceType = AU_CUS_ConvertCustomerCaptureInputToDriverInput(captureInput);
27552
27553 if(AU_CUS_PCMCaptureInit(captureDriverDeviceType, captureDriverSourceType) == TRUE)
27554 {
27555 if(currentConnect == API_AUDIO_CUSTOMER_PCM_CAPTURE0)
27556 {
27557 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_bEnable = TRUE;
27558 }
27559 else if(currentConnect == API_AUDIO_CUSTOMER_PCM_CAPTURE1)
27560 {
27561 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE1_bEnable = TRUE;
27562
27563 }
27564 else if(currentConnect == API_AUDIO_CUSTOMER_PCM_CAPTURE2)
27565 {
27566 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE2_bEnable = TRUE;
27567 }
27568 }
27569 else
27570 {
27571 AU_nPRINT("[A] [Error] [%s] [pcm capture init fail] \n", __FUNCTION__);
27572 return FALSE;
27573 }
27574
27575 return TRUE;
27576 }
27577
API_AUDIO_CUSTOMER_PCM_StopUpload(API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect)27578 MS_BOOL API_AUDIO_CUSTOMER_PCM_StopUpload(API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect)
27579 {
27580 AUDIO_DEVICE_TYPE captureDriverDeviceType;
27581
27582 AU_nDBG("[currentConnect = 0x%x] \n", (unsigned int)currentConnect);
27583
27584 switch(currentConnect)
27585 {
27586 case API_AUDIO_CUSTOMER_PCM_CAPTURE0:
27587 {
27588 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_bEnable = FALSE;
27589 captureDriverDeviceType = E_DEVICE0;
27590 }
27591 break;
27592
27593 case API_AUDIO_CUSTOMER_PCM_CAPTURE1:
27594 {
27595 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE1_bEnable = FALSE;
27596 captureDriverDeviceType = E_DEVICE1;
27597 }
27598 break;
27599
27600 case API_AUDIO_CUSTOMER_PCM_CAPTURE2:
27601 {
27602 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE2_bEnable = FALSE;
27603 captureDriverDeviceType = E_DEVICE2;
27604 }
27605 break;
27606
27607 default:
27608 {
27609 AU_nPRINT("[A] [Error] [%s] [unsupport pcm capture index: %x] \n", __FUNCTION__, currentConnect);
27610 return FALSE;
27611 }
27612 break;
27613 }
27614
27615 MApi_AUDIO_PCMCapture_Stop(captureDriverDeviceType);
27616
27617 if(pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE_Source_Dump_to_file_bEnable)
27618 {
27619 AU_CUS_FileClose(pAU_PcmCaptureSourceDumpFile);
27620 }
27621
27622 AU_CUS_MemoryFree((void *)pPCMCaptureBuffer);
27623
27624 return TRUE;
27625 }
27626
API_AUDIO_CUSTOMER_PCM_RegisterSendPCMCallback(API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect,pfnAudioCustomerPCMSending pfnCallBack)27627 MS_BOOL API_AUDIO_CUSTOMER_PCM_RegisterSendPCMCallback(API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect, pfnAudioCustomerPCMSending pfnCallBack)
27628 {
27629 AU_nDBG("[currentConnect = 0x%x] \n", (unsigned int)currentConnect);
27630
27631 madCallBack.pFunc_PCMCaptureDone = pfnCallBack;
27632
27633 return TRUE;
27634 }
27635
27636 /**
27637 * API_AUDIO_CUSTOMER_PCM_SetGain
27638 * gain Scale : 0.125dB
27639 * gain Range : -114.875dB ~ 12dB
27640 * ex. gain 0 = -114.875dB; gain 1015 = 12dB
27641 */
API_AUDIO_CUSTOMER_PCM_SetGain(API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect,MS_U32 gain)27642 MS_BOOL API_AUDIO_CUSTOMER_PCM_SetGain(API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect, MS_U32 gain)
27643 {
27644 MS_U32 mainVol, fineVol;
27645
27646 AU_nDBG("[currentConnect = 0x%x] \n", (unsigned int)currentConnect);
27647 AU_nDBG("[gain = %d] \n", (unsigned int)gain);
27648
27649 mainVol = (1015 - (int)gain)/8;
27650 fineVol = (1015 - (int)gain) - mainVol*8;
27651
27652 switch(currentConnect)
27653 {
27654 case API_AUDIO_CUSTOMER_PCM_CAPTURE0:
27655 {
27656 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_Gain = gain;
27657 MApi_AUDIO_SetAbsoluteVolume(AUDIO_T3_PATH_PCM_CAPTURE1, (MS_U8)mainVol, (MS_U8)fineVol);
27658 }
27659 break;
27660
27661 case API_AUDIO_CUSTOMER_PCM_CAPTURE1:
27662 {
27663 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE1_Gain = gain;
27664 MApi_AUDIO_SetAbsoluteVolume(AUDIO_T3_PATH_PCM_CAPTURE2, (MS_U8)mainVol, (MS_U8)fineVol);
27665 }
27666 break;
27667
27668 default:
27669 {
27670 AU_nPRINT("[A] [Error] [%s] [unsupport pcm capture index: %x] \n", __FUNCTION__, currentConnect);
27671 return FALSE;
27672 }
27673 break;
27674 }
27675
27676 return TRUE;
27677 }
27678
API_AUDIO_CUSTOMER_PCM_SetMute(API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect,MS_BOOL bOnOff)27679 MS_BOOL API_AUDIO_CUSTOMER_PCM_SetMute(API_AUDIO_CUSTOMER_PCM_CAPTURE_INDEX currentConnect, MS_BOOL bOnOff)
27680 {
27681 AU_nDBG("[currentConnect = 0x%x] \n", (unsigned int)currentConnect);
27682 AU_nDBG("[bOnOff = 0x%x] \n", (unsigned int)bOnOff);
27683
27684 switch(currentConnect)
27685 {
27686 case API_AUDIO_CUSTOMER_PCM_CAPTURE0:
27687 {
27688 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_bMute = bOnOff;
27689 MApi_AUDIO_SetMute(AUDIO_T3_PATH_PCM_CAPTURE1, pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_bMute);
27690 }
27691 break;
27692
27693 case API_AUDIO_CUSTOMER_PCM_CAPTURE1:
27694 {
27695 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE1_bMute = bOnOff;
27696 MApi_AUDIO_SetMute(AUDIO_T3_PATH_PCM_CAPTURE2, pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE1_bMute);
27697 }
27698 break;
27699
27700 default:
27701 {
27702 AU_nPRINT("[A] [Error] [%s] [unsupport pcm capture index: %x] \n", __FUNCTION__, currentConnect);
27703 return FALSE;
27704 }
27705 break;
27706 }
27707
27708 return TRUE;
27709 }
27710
API_AUDIO_CUSTOMER_PCM_SetRequestSizeInMs(MS_U32 request_ms)27711 MS_BOOL API_AUDIO_CUSTOMER_PCM_SetRequestSizeInMs(MS_U32 request_ms)
27712 {
27713 AU_nDBG("[request_ms = %d] \n", (unsigned int)request_ms);
27714
27715 pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE_Request_data_in_byte = request_ms*48*2*2; /* request_ms in 48KHz, 16bits, stereo PCM */
27716
27717 return TRUE;
27718 }
27719
27720 /* PCM IO Control */
API_AUDIO_CUSTOMER_PCM_Open(API_AUDIO_CUSTOMER_PCMIO_PARAM * pData)27721 MS_S32 API_AUDIO_CUSTOMER_PCM_Open(API_AUDIO_CUSTOMER_PCMIO_PARAM *pData)
27722 {
27723 AUDIO_PCM_INFO_t PcmInfo;
27724 MS_U32 name_size = 0;
27725 AU_nDBG("Device Name = %s \n", pData->u8Name);
27726
27727 if(pData == NULL)
27728 {
27729 return -1;
27730 }
27731
27732 memset((void *)&PcmInfo, 0x00, sizeof(AUDIO_PCM_INFO_t));
27733 PcmInfo.u32StructVersion = AUDIO_PCM_INFO_VERSION;
27734 PcmInfo.u32StructSize = sizeof(PcmInfo);
27735 name_size = strlen((char*)pData->u8Name);
27736 if(name_size >= sizeof(PcmInfo.u8Name))
27737 {
27738 name_size = sizeof(PcmInfo.u8Name) - 1;
27739 }
27740 memset((void*)PcmInfo.u8Name, '\0', sizeof(PcmInfo.u8Name));
27741 strncpy((char*)PcmInfo.u8Name, (char*)pData->u8Name, name_size);
27742 PcmInfo.u8MultiChFlag = pData->u8MultiChFlag;
27743 PcmInfo.u32BufferDuration = pData->u32BufferDuration;
27744 PcmInfo.u32Channel = pData->u32Channel;
27745 PcmInfo.u32SampleRate = pData->u32SampleRate;
27746 PcmInfo.u32BitWidth = pData->u32BitWidth;
27747 //PcmInfo.u32BigEndian = pData->u32BigEndian; //Wait PcmInfo.u32BigEndian fix in all utopia
27748 if((strcmp((char *)AUDIO_PCM_CAPTURE1, (char *)pData->u8Name) == 0) ||
27749 (strcmp((char *)AUDIO_PCM_CAPTURE2, (char *)pData->u8Name) == 0))
27750 {
27751 PcmInfo.u8CaptureFlag = TRUE;
27752 }
27753
27754 return MApi_AUDIO_PCM_Open((void*)&PcmInfo);
27755 }
27756
API_AUDIO_CUSTOMER_PCM_Close(MS_S32 s32DeviceId)27757 MS_S32 API_AUDIO_CUSTOMER_PCM_Close(MS_S32 s32DeviceId)
27758 {
27759 AU_nDBG("[s32DeviceId = 0x%x]\n", (unsigned int)s32DeviceId);
27760
27761 return MApi_AUDIO_PCM_Close(s32DeviceId);
27762 }
27763
API_AUDIO_CUSTOMER_PCM_Start(MS_S32 s32DeviceId)27764 MS_S32 API_AUDIO_CUSTOMER_PCM_Start(MS_S32 s32DeviceId)
27765 {
27766 AU_nDBG("[s32DeviceId = 0x%x]\n", (unsigned int)s32DeviceId);
27767
27768 return MApi_AUDIO_PCM_Start(s32DeviceId);
27769 }
27770
API_AUDIO_CUSTOMER_PCM_Stop(MS_S32 s32DeviceId)27771 MS_S32 API_AUDIO_CUSTOMER_PCM_Stop(MS_S32 s32DeviceId)
27772 {
27773 AU_nDBG("[s32DeviceId = 0x%x]\n", (unsigned int)s32DeviceId);
27774
27775 return MApi_AUDIO_PCM_Stop(s32DeviceId);
27776 }
27777
API_AUDIO_CUSTOMER_PCM_Set(MS_S32 s32DeviceId,MS_U32 u32Cmd,const void * pData)27778 MS_S32 API_AUDIO_CUSTOMER_PCM_Set(MS_S32 s32DeviceId, MS_U32 u32Cmd, const void *pData)
27779 {
27780 AU_nDBG("[s32DeviceId = 0x%x] [u32Cmd = 0x%x]\n", (unsigned int)s32DeviceId, (unsigned int)u32Cmd);
27781
27782 return MApi_AUDIO_PCM_Set(s32DeviceId, u32Cmd, pData);
27783 }
27784
API_AUDIO_CUSTOMER_PCM_Get(MS_S32 s32DeviceId,MS_U32 u32Cmd,void * pData)27785 MS_S32 API_AUDIO_CUSTOMER_PCM_Get(MS_S32 s32DeviceId, MS_U32 u32Cmd, void *pData)
27786 {
27787 AU_nThreadDBG("[s32DeviceId = 0x%x] [u32Cmd = 0x%x]\n", (unsigned int)s32DeviceId, (unsigned int)u32Cmd);
27788
27789 return MApi_AUDIO_PCM_Get(s32DeviceId, u32Cmd, pData);
27790 }
27791
API_AUDIO_CUSTOMER_PCM_Read(MS_S32 s32DeviceId,void * pBuf,MS_U32 u32Size)27792 MS_U32 API_AUDIO_CUSTOMER_PCM_Read(MS_S32 s32DeviceId, void *pBuf, MS_U32 u32Size)
27793 {
27794 AU_nDBG("[s32DeviceId = 0x%x] [u32Size = 0x%x]\n", (unsigned int)s32DeviceId, (unsigned int)u32Size);
27795
27796 return MApi_AUDIO_PCM_Read(s32DeviceId, pBuf, u32Size);
27797 }
27798
API_AUDIO_CUSTOMER_PCM_Write(MS_S32 s32DeviceId,const void * pBuf,MS_U32 u32Size)27799 MS_U32 API_AUDIO_CUSTOMER_PCM_Write(MS_S32 s32DeviceId, const void *pBuf, MS_U32 u32Size)
27800 {
27801 AU_nThreadDBG("[s32DeviceId = 0x%x] [u32Size = 0x%x]\n", (unsigned int)s32DeviceId, (unsigned int)u32Size);
27802
27803 return MApi_AUDIO_PCM_Write(s32DeviceId, pBuf, u32Size);
27804 }
27805
API_AUDIO_CUSTOMER_PCM_Flush(MS_S32 s32DeviceId)27806 MS_S32 API_AUDIO_CUSTOMER_PCM_Flush(MS_S32 s32DeviceId)
27807 {
27808 AU_nDBG("[s32DeviceId = 0x%x]\n", (unsigned int)s32DeviceId);
27809
27810 return MApi_AUDIO_PCM_Flush(s32DeviceId);
27811 }
27812
27813 /* MM New Mode */
API_AUDIO_CUSTOMER_GetDDRInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMER_DDRINFO DDRInfo)27814 MS_PHY API_AUDIO_CUSTOMER_GetDDRInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_DDRINFO DDRInfo)
27815 {
27816 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
27817
27818 AU_nThreadDBG("[adecIndex = 0x%x]\n", (unsigned int)adecIndex);
27819
27820 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
27821
27822 return MApi_AUDIO_GetDDRInfo(DecID, (EN_AUDIO_DDRINFO)DDRInfo);
27823 }
27824
API_AUDIO_CUSTOMER_MM2_initAesInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)27825 MS_BOOL API_AUDIO_CUSTOMER_MM2_initAesInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
27826 {
27827 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
27828 MS_BOOL Ret = FALSE;
27829
27830 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
27831 {
27832 mutex_lock(&AU_Customer_MM2_initAesInfo_mutex_lock);
27833 }
27834 #else //User Space
27835 {
27836 OS_OBTAIN_MUTEX(AU_Customer_MM2_initAesInfo_mutex_lock, MSOS_WAIT_FOREVER);
27837 }
27838 #endif
27839
27840 AU_nDBG("[adecIndex = 0x%x]\n", (unsigned int)adecIndex);
27841
27842 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_inputAesFinished_cnt = 0;
27843
27844 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
27845 Ret = MApi_AUDIO_MM2_initAesInfo(DecID);
27846
27847 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
27848 {
27849 mutex_unlock(&AU_Customer_MM2_initAesInfo_mutex_lock);
27850 }
27851 #else //User Space
27852 {
27853 OS_RELEASE_MUTEX(AU_Customer_MM2_initAesInfo_mutex_lock);
27854 }
27855 #endif
27856
27857 return Ret;
27858 }
27859
API_AUDIO_CUSTOMER_MM2_checkAesInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMER_AES_INFO * aes_info)27860 MS_BOOL API_AUDIO_CUSTOMER_MM2_checkAesInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_AES_INFO *aes_info)
27861 {
27862 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
27863
27864 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
27865 {
27866 mutex_lock(&AU_Customer_MM2_checkAesInfo_mutex_lock);
27867 }
27868 #else //User Space
27869 {
27870 OS_OBTAIN_MUTEX(AU_Customer_MM2_checkAesInfo_mutex_lock, MSOS_WAIT_FOREVER);
27871 }
27872 #endif
27873
27874 AU_nThreadDBG("[adecIndex = 0x%x]\n", (unsigned int)adecIndex);
27875
27876 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
27877 MApi_AUDIO_MM2_checkAesInfo(DecID, (AES_INFO*)aes_info);
27878
27879 if(pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_bEnable)
27880 {
27881 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_aes_info.aes_base_addr = aes_info->aes_base_addr;
27882 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_aes_info.aes_end_addr = aes_info->aes_end_addr;
27883 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_aes_info.aes_BufSize = aes_info->aes_BufSize;
27884 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_aes_info.aes_write_addr = aes_info->aes_write_addr;
27885 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_aes_info.aes_read_addr = aes_info->aes_read_addr;
27886 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_aes_info.aes_freeSpace = aes_info->aes_freeSpace;
27887 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_aes_info.aes_level = aes_info->aes_level;
27888 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_aes_info.aes_ptsCnt = aes_info->aes_ptsCnt;
27889 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_aes_info.aes_lastPTS = aes_info->aes_lastPTS;
27890 }
27891
27892 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
27893 {
27894 mutex_unlock(&AU_Customer_MM2_checkAesInfo_mutex_lock);
27895 }
27896 #else //User Space
27897 {
27898 OS_RELEASE_MUTEX(AU_Customer_MM2_checkAesInfo_mutex_lock);
27899 }
27900 #endif
27901
27902 return TRUE;
27903 }
27904
API_AUDIO_CUSTOMER_MM2_inputAesFinished(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,MS_U32 es_size,MS_BOOL ptsExist,MS_U64 pts)27905 MS_BOOL API_AUDIO_CUSTOMER_MM2_inputAesFinished(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_U32 es_size, MS_BOOL ptsExist, MS_U64 pts)
27906 {
27907 AUDIO_DEC_ID DecID = AU_DEC_INVALID;
27908 MS_BOOL ret = FALSE;
27909 AES_INFO currentAESInfo;
27910 MS_U32 pEsdump_addr;
27911 MS_U32 size_tmp;
27912 MS_U32 SE_base_addr;
27913
27914 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
27915 {
27916 mutex_lock(&AU_Customer_MM2_inputAesFinished_mutex_lock);
27917 }
27918 #else //User Space
27919 {
27920 OS_OBTAIN_MUTEX(AU_Customer_MM2_inputAesFinished_mutex_lock, MSOS_WAIT_FOREVER);
27921 }
27922 #endif
27923
27924 if(pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_inputAesFinished_cnt <= 10)
27925 {
27926 AU_nDBG("[cnt:%-7d][adecIndex = 0x%x][es_size = 0x%x][ptsExist = 0x%x][div(pts,90) = %lld] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_inputAesFinished_cnt, (unsigned int)adecIndex, (unsigned int)es_size, (unsigned int)ptsExist, (unsigned long long)AU_CUS_long_div(pts, 90) );
27927 }
27928 else
27929 {
27930 AU_nThreadDBG("[cnt:%-7d][adecIndex = 0x%x][es_size = 0x%x][ptsExist = 0x%x][div(pts,90) = %lld] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_inputAesFinished_cnt, (unsigned int)adecIndex, (unsigned int)es_size, (unsigned int)ptsExist, (unsigned long long)AU_CUS_long_div(pts, 90) );
27931 }
27932
27933 DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
27934 ret = MApi_AUDIO_MM2_inputAesFinished(DecID, es_size, ptsExist, pts);
27935 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_inputAesFinished_ret = ret;
27936 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_inputAesFinished_cnt ++;
27937
27938 if(pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_bEnable)
27939 {
27940 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_Upper_es_size = es_size;
27941 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_Upper_ptsExist = ptsExist;
27942 pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_Upper_pts = pts;
27943 }
27944
27945 if((ret == TRUE) && (pAU_MMESDumpFile != NULL))
27946 {
27947 SE_base_addr = MApi_AUDIO_GetDspMadBaseAddr(1);
27948
27949 MApi_AUDIO_MM2_checkAesInfo(DecID, ¤tAESInfo);
27950
27951 if(es_size > (currentAESInfo.aes_write_addr - currentAESInfo.aes_base_addr))
27952 {
27953 pEsdump_addr = currentAESInfo.aes_write_addr + currentAESInfo.aes_BufSize - es_size;
27954 size_tmp = es_size - (currentAESInfo.aes_write_addr - currentAESInfo.aes_base_addr);
27955 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(SE_base_addr + pEsdump_addr), sizeof(char), size_tmp, pAU_MMESDumpFile);
27956 size_tmp = es_size - size_tmp;
27957 pEsdump_addr = currentAESInfo.aes_base_addr;
27958 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(SE_base_addr + pEsdump_addr), sizeof(char), size_tmp, pAU_MMESDumpFile);
27959 }
27960 else
27961 {
27962 pEsdump_addr = currentAESInfo.aes_write_addr - es_size;
27963 AU_CUS_FileWrite((void*)MsOS_MPool_PA2KSEG1(SE_base_addr + pEsdump_addr), sizeof(char), es_size, pAU_MMESDumpFile);
27964 }
27965 }
27966
27967 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
27968 {
27969 mutex_unlock(&AU_Customer_MM2_inputAesFinished_mutex_lock);
27970 }
27971 #else //User Space
27972 {
27973 OS_RELEASE_MUTEX(AU_Customer_MM2_inputAesFinished_mutex_lock);
27974 }
27975 #endif
27976
27977 return ret;
27978 }
27979
API_AUDIO_CUSTOMER_MM2_AD_initAesInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)27980 MS_BOOL API_AUDIO_CUSTOMER_MM2_AD_initAesInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex)
27981 {
27982 AUDIO_DEC_ID Main_DecID = AU_DEC_INVALID;
27983 AUDIO_DEC_ID AD_DecID = AU_DEC_INVALID;
27984 MS_BOOL Ret = FALSE;
27985
27986 AU_nDBG("[adecIndex = 0x%x]\n", (unsigned int)adecIndex);
27987
27988 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
27989 {
27990 mutex_lock(&AU_Customer_MM2_initAesInfo_mutex_lock);
27991 }
27992 #else //User Space
27993 {
27994 OS_OBTAIN_MUTEX(AU_Customer_MM2_initAesInfo_mutex_lock, MSOS_WAIT_FOREVER);
27995 }
27996 #endif
27997
27998
27999 Main_DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
28000 AD_DecID = AU_CUS_ConvertDriverMainDecIDtoDriverAdDecID(Main_DecID);
28001 Ret = MApi_AUDIO_MM2_initAesInfo(AD_DecID);
28002
28003
28004 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
28005 {
28006 mutex_unlock(&AU_Customer_MM2_initAesInfo_mutex_lock);
28007 }
28008 #else //User Space
28009 {
28010 OS_RELEASE_MUTEX(AU_Customer_MM2_initAesInfo_mutex_lock);
28011 }
28012 #endif
28013
28014 return Ret;
28015 }
28016
API_AUDIO_CUSTOMER_MM2_AD_checkAesInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,API_AUDIO_CUSTOMER_AES_INFO * aes_info)28017 MS_BOOL API_AUDIO_CUSTOMER_MM2_AD_checkAesInfo(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, API_AUDIO_CUSTOMER_AES_INFO *aes_info)
28018 {
28019 AUDIO_DEC_ID Main_DecID = AU_DEC_INVALID;
28020 AUDIO_DEC_ID AD_DecID = AU_DEC_INVALID;
28021
28022 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
28023 {
28024 mutex_lock(&AU_Customer_MM2_checkAesInfo_mutex_lock);
28025 }
28026 #else //User Space
28027 {
28028 OS_OBTAIN_MUTEX(AU_Customer_MM2_checkAesInfo_mutex_lock, MSOS_WAIT_FOREVER);
28029 }
28030 #endif
28031
28032 AU_nThreadDBG("[adecIndex = 0x%x]\n", (unsigned int)adecIndex);
28033
28034 Main_DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
28035 AD_DecID = AU_CUS_ConvertDriverMainDecIDtoDriverAdDecID(Main_DecID);
28036
28037 MApi_AUDIO_MM2_checkAesInfo(AD_DecID, (AES_INFO*)aes_info);
28038
28039 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
28040 {
28041 mutex_unlock(&AU_Customer_MM2_checkAesInfo_mutex_lock);
28042 }
28043 #else //User Space
28044 {
28045 OS_RELEASE_MUTEX(AU_Customer_MM2_checkAesInfo_mutex_lock);
28046 }
28047 #endif
28048
28049 return TRUE;
28050 }
28051
API_AUDIO_CUSTOMER_MM2_AD_inputAesFinished(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex,MS_U32 es_size,MS_BOOL ptsExist,MS_U64 pts)28052 MS_BOOL API_AUDIO_CUSTOMER_MM2_AD_inputAesFinished(API_AUDIO_CUSTOMER_ADEC_INDEX adecIndex, MS_U32 es_size, MS_BOOL ptsExist, MS_U64 pts)
28053 {
28054 AUDIO_DEC_ID Main_DecID = AU_DEC_INVALID;
28055 AUDIO_DEC_ID AD_DecID = AU_DEC_INVALID;
28056 MS_BOOL ret = FALSE;
28057
28058 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
28059 {
28060 mutex_lock(&AU_Customer_MM2_inputAesFinished_mutex_lock);
28061 }
28062 #else //User Space
28063 {
28064 OS_OBTAIN_MUTEX(AU_Customer_MM2_inputAesFinished_mutex_lock, MSOS_WAIT_FOREVER);
28065 }
28066 #endif
28067
28068 if(pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_inputAesFinished_cnt <= 10)
28069 {
28070 AU_nDBG("[cnt:%-7d][adecIndex = 0x%x][es_size = 0x%x][ptsExist = 0x%x][div(pts,90) = %lld] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_inputAesFinished_cnt, (unsigned int)adecIndex, (unsigned int)es_size, (unsigned int)ptsExist, (unsigned long long)AU_CUS_long_div(pts, 90) );
28071 }
28072 else
28073 {
28074 AU_nThreadDBG("[cnt:%-7d][adecIndex = 0x%x][es_size = 0x%x][ptsExist = 0x%x][div(pts,90) = %lld] \n", (unsigned int)pstAudioCustomerShmData->g_audio_customer_AU_AV_Sync_Info_inputAesFinished_cnt, (unsigned int)adecIndex, (unsigned int)es_size, (unsigned int)ptsExist, (unsigned long long)AU_CUS_long_div(pts, 90) );
28075 }
28076
28077 Main_DecID = AU_CUS_ConvertCustomerAdecIndexToDriverDecID(adecIndex);
28078 AD_DecID = AU_CUS_ConvertDriverMainDecIDtoDriverAdDecID(Main_DecID);
28079 ret = MApi_AUDIO_MM2_inputAesFinished(AD_DecID, es_size, ptsExist, pts);
28080
28081 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
28082 {
28083 mutex_unlock(&AU_Customer_MM2_inputAesFinished_mutex_lock);
28084 }
28085 #else //User Space
28086 {
28087 OS_RELEASE_MUTEX(AU_Customer_MM2_inputAesFinished_mutex_lock);
28088 }
28089 #endif
28090
28091 return ret;
28092 }
28093
28094 /* Mstar Sound Effect */
API_AUDIO_CUSTOMER_MSTAR_SE_Enable(API_AUDIO_CUSTOMER_MSTAR_SE_TYPE Type,MS_BOOL bOnOff)28095 MS_BOOL API_AUDIO_CUSTOMER_MSTAR_SE_Enable(API_AUDIO_CUSTOMER_MSTAR_SE_TYPE Type, MS_BOOL bOnOff)
28096 {
28097 Sound_ENABLE_Type seType;
28098
28099 AU_nDBG("[Type = 0x%x] [bOnOff = 0x%x]\n", (unsigned int)Type, (unsigned int)bOnOff);
28100
28101 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_Enable[Type] = bOnOff;
28102 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_Enable_UpperSetCnt[Type] += 1;
28103
28104 seType = AU_CUS_ConvertCustomerMstarSndTypeToDriverMstarSndType(Type);
28105 return MApi_SND_ProcessEnable(seType, bOnOff);
28106 }
28107
API_AUDIO_CUSTOMER_MSTAR_SE_SET_GEQ(MS_U8 u8band,MS_S8 s8level)28108 MS_BOOL API_AUDIO_CUSTOMER_MSTAR_SE_SET_GEQ(MS_U8 u8band, MS_S8 s8level)
28109 {
28110 AU_nDBG("[u8band = 0x%x] [s8level = 0x%x]\n", (unsigned int)u8band, (unsigned int)s8level);
28111
28112 if(u8band < MSTAR_SE_GEQ_MAX_BAND)
28113 {
28114 AU_nDBG("\n");
28115
28116 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_GEQ[u8band] = s8level;
28117 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_GEQ_UpperSetCnt[u8band]++;
28118
28119 return MApi_SND_SetParam1(Sound_SET_PARAM_AbsoluteEQ, u8band, (MS_U8)s8level);
28120 }
28121 else
28122 {
28123 AU_nDBG("\n");
28124
28125 return FALSE;
28126 }
28127 }
28128
API_AUDIO_CUSTOMER_MSTAR_SE_SET_PEQCoef(API_AUDIO_CUSTOMER_MSTAR_PEQ_COEF * peq_coef)28129 MS_BOOL API_AUDIO_CUSTOMER_MSTAR_SE_SET_PEQCoef(API_AUDIO_CUSTOMER_MSTAR_PEQ_COEF *peq_coef)
28130 {
28131 AUDIO_PEQ_COEF PEQCoef = {0,};
28132
28133 AU_nDBG("[peq_coef->band = 0x%x]\n", (unsigned int)peq_coef->band);
28134 AU_nDBG("[peq_coef->a0 = 0x%x]\n", (unsigned int)peq_coef->a0);
28135 AU_nDBG("[peq_coef->a1 = 0x%x]\n", (unsigned int)peq_coef->a1);
28136 AU_nDBG("[peq_coef->a2 = 0x%x]\n", (unsigned int)peq_coef->a2);
28137 AU_nDBG("[peq_coef->b1 = 0x%x]\n", (unsigned int)peq_coef->b1);
28138 AU_nDBG("[peq_coef->b2 = 0x%x]\n", (unsigned int)peq_coef->b2);
28139 AU_nDBG("[peq_coef->enable = 0x%x]\n", (unsigned int)peq_coef->enable);
28140 AU_nDBG("[peq_coef->scale = 0x%x]\n", (unsigned int)peq_coef->scale);
28141
28142 if(peq_coef->band < MSTAR_SE_PEQ_MAX_BAND)
28143 {
28144 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[peq_coef->band].band = peq_coef->band;
28145 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[peq_coef->band].a0 = peq_coef->a0;
28146 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[peq_coef->band].a1 = peq_coef->a1;
28147 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[peq_coef->band].a2 = peq_coef->a2;
28148 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[peq_coef->band].b1 = peq_coef->b1;
28149 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[peq_coef->band].b2 = peq_coef->b2;
28150 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[peq_coef->band].enable = peq_coef->enable;
28151 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef[peq_coef->band].scale = peq_coef->scale;
28152 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_PEQCoef_UpperSetCnt[peq_coef->band] +=1 ;
28153 }
28154 else
28155 {
28156 AU_nDBG("\n");
28157
28158 return FALSE;
28159 }
28160
28161 PEQCoef.band = peq_coef->band;
28162 PEQCoef.sfs = 1;
28163
28164 if(peq_coef->scale > 1)
28165 {
28166 PEQCoef.scale = peq_coef->scale;
28167 }
28168 else
28169 {
28170 PEQCoef.scale = 1;
28171 }
28172
28173 PEQCoef.a0 = peq_coef->a0;
28174 PEQCoef.a1 = peq_coef->a1;
28175 PEQCoef.a2 = peq_coef->a2;
28176 PEQCoef.b1 = peq_coef->b1;
28177 PEQCoef.b2 = peq_coef->b2;
28178 PEQCoef.type = AUDIO_COEF_PEQ;
28179 PEQCoef.enable = peq_coef->enable;
28180 PEQCoef.precision = AUDIO_DOUBLE_PRECISION;
28181
28182 MApi_AUDIO_SetPEQCoef(&PEQCoef);
28183
28184 return TRUE;
28185 }
28186
API_AUDIO_CUSTOMER_MSTAR_SE_SET_HPFCoef(API_AUDIO_CUSTOMER_MSTAR_HPF_COEF * hpf_coef)28187 MS_BOOL API_AUDIO_CUSTOMER_MSTAR_SE_SET_HPFCoef(API_AUDIO_CUSTOMER_MSTAR_HPF_COEF *hpf_coef)
28188 {
28189 AUDIO_PEQ_COEF HPFCoef;
28190
28191 AU_nDBG("[hpf_coef->a0 = 0x%x]\n", (unsigned int)hpf_coef->a0);
28192 AU_nDBG("[hpf_coef->a1 = 0x%x]\n", (unsigned int)hpf_coef->a1);
28193 AU_nDBG("[hpf_coef->a2 = 0x%x]\n", (unsigned int)hpf_coef->a2);
28194 AU_nDBG("[hpf_coef->b1 = 0x%x]\n", (unsigned int)hpf_coef->b1);
28195 AU_nDBG("[hpf_coef->b2 = 0x%x]\n", (unsigned int)hpf_coef->b2);
28196
28197 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_HPFCoef.a0 = hpf_coef->a0;
28198 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_HPFCoef.a1 = hpf_coef->a1;
28199 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_HPFCoef.a2 = hpf_coef->a2;
28200 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_HPFCoef.b1 = hpf_coef->b1;
28201 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_HPFCoef.b2 = hpf_coef->b2;
28202 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_HPFCoef_UpperSetCnt += 1;
28203
28204 HPFCoef.a0 = hpf_coef->a0;
28205 HPFCoef.a1 = hpf_coef->a1;
28206 HPFCoef.a2 = hpf_coef->a2;
28207 HPFCoef.b1 = hpf_coef->b1;
28208 HPFCoef.b2 = hpf_coef->b2;
28209 HPFCoef.sfs = 1;
28210 HPFCoef.type = AUDIO_COEF_HPF;
28211
28212 MApi_AUDIO_SetPEQCoef(&HPFCoef);
28213
28214 return TRUE;
28215 }
28216
API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_MODE(API_AUDIO_CUSTOMER_MSTAR_AVC_MODE mode)28217 MS_BOOL API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_MODE(API_AUDIO_CUSTOMER_MSTAR_AVC_MODE mode)
28218 {
28219 AU_nDBG("[mode = 0x%x]\n", (unsigned int)mode);
28220
28221 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_MODE = mode;
28222 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_MODE_UpperSetCnt += 1;
28223
28224 return MApi_SND_SetParam1(Sound_SET_PARAM_Avc_Mode, mode, 0);
28225 }
28226
API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_LEVEL(MS_U16 u16level)28227 MS_BOOL API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_LEVEL(MS_U16 u16level)
28228 {
28229 AU_nDBG("[u16level = 0x%x]\n", (unsigned int)u16level);
28230
28231 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_LEVEL = u16level;
28232 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_LEVEL_UpperSetCnt += 1;
28233
28234 return MApi_SND_SetParam1(Sound_SET_PARAM_Avc_Threshold, u16level, 0);
28235 }
28236
API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_Begin(MS_U16 u16Begin)28237 MS_BOOL API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_Begin(MS_U16 u16Begin)
28238 {
28239 AU_nDBG("[u16Begin = 0x%x]\n", (unsigned int)u16Begin);
28240
28241 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_R_MODE_Begin = u16Begin;
28242 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_R_MODE_Begin_UpperSetCnt += 1;
28243
28244 #if(UTPA_SUPPORT_AVC_R_MODE)
28245 {
28246 return MApi_SND_SetParam1(Sound_SET_PARAM_Avc_R_Begin, u16Begin, 0);
28247 }
28248 #else
28249 {
28250 return FALSE;
28251 }
28252 #endif
28253 }
28254
API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_End(MS_U16 u16End)28255 MS_BOOL API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_End(MS_U16 u16End)
28256 {
28257 AU_nDBG("[u16End = 0x%x]\n", (unsigned int)u16End);
28258
28259 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_R_MODE_End = u16End;
28260 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_R_MODE_End_UpperSetCnt += 1;
28261
28262 #if(UTPA_SUPPORT_AVC_R_MODE)
28263 {
28264 return MApi_SND_SetParam1(Sound_SET_PARAM_Avc_R_End, u16End, 0);
28265 }
28266 #else
28267 {
28268 return FALSE;
28269 }
28270 #endif
28271 }
28272
API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_Slope(MS_U16 u16Slope)28273 MS_BOOL API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_Slope(MS_U16 u16Slope)
28274 {
28275 AU_nDBG("[u16Slope = 0x%x]\n", (unsigned int)u16Slope);
28276
28277 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_R_MODE_Slope = u16Slope;
28278 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_R_MODE_Slope_UpperSetCnt += 1;
28279
28280 #if(UTPA_SUPPORT_AVC_R_MODE)
28281 {
28282 if( (u16Slope>=1) && (u16Slope<=3) )
28283 {
28284 return MApi_SND_SetParam1(Sound_SET_PARAM_Avc_R_Slope, u16Slope, 0);
28285 }
28286 else
28287 {
28288 return FALSE;
28289 }
28290 }
28291 #else
28292 {
28293 return FALSE;
28294 }
28295 #endif
28296 }
28297
API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_S_MODE_OFFSET(MS_U16 u16offset)28298 MS_BOOL API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_S_MODE_OFFSET(MS_U16 u16offset)
28299 {
28300 AU_nDBG("[u16offset = 0x%x]\n", (unsigned int)u16offset);
28301
28302 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_S_MODE_OFFSET = u16offset;
28303 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_S_MODE_OFFSET_UpperSetCnt += 1;
28304
28305 return MApi_SND_SetParam1(Sound_SET_PARAM_AVC_S_Offset, u16offset, 0);
28306 }
28307
API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_AttackTime(MS_U8 AvcAT)28308 MS_BOOL API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_AttackTime(MS_U8 AvcAT)
28309 {
28310 AU_nDBG("[AvcAT = 0x%x]\n", (unsigned int)AvcAT);
28311
28312 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_AttackTime = AvcAT;
28313 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_AttackTime_UpperSetCnt += 1;
28314
28315 MApi_AUDIO_SetAvcAT(AvcAT);
28316
28317 return TRUE;
28318 }
28319
API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_ReleaseTime(MS_U8 AvcRT)28320 MS_BOOL API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_ReleaseTime(MS_U8 AvcRT)
28321 {
28322 AU_nDBG("[AvcRT = 0x%x]\n", (unsigned int)AvcRT);
28323
28324 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_ReleaseTime = AvcRT;
28325 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_AVC_ReleaseTime_UpperSetCnt += 1;
28326
28327 MApi_AUDIO_SetAvcRT(AvcRT);
28328
28329 return TRUE;
28330 }
28331
API_AUDIO_CUSTOMER_MSTAR_SE_SET_DRC_LEVEL(MS_U16 u16level)28332 MS_BOOL API_AUDIO_CUSTOMER_MSTAR_SE_SET_DRC_LEVEL(MS_U16 u16level)
28333 {
28334 AU_nDBG("[u16level = 0x%x]\n", (unsigned int)u16level);
28335
28336 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_DRC_LEVEL = u16level;
28337 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_DRC_LEVEL_UpperSetCnt += 1;
28338
28339 return MApi_SND_SetParam1(Sound_SET_PARAM_Drc_Threshold, u16level, 0);
28340 }
28341
API_AUDIO_CUSTOMER_MSTAR_SE_SET_BALANCE(MS_U16 Lbalance,MS_U16 Rbalance)28342 MS_BOOL API_AUDIO_CUSTOMER_MSTAR_SE_SET_BALANCE(MS_U16 Lbalance, MS_U16 Rbalance)
28343 {
28344 AU_nDBG("[Lbalance = 0x%x] [Lbalance = 0x%x]\n", (unsigned int)Lbalance, (unsigned int)Rbalance);
28345
28346 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_BALANCE_L = Lbalance;
28347 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_BALANCE_R = Rbalance;
28348 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_BALANCE_UpperSetCnt += 1;
28349
28350 return MApi_SND_SetParam1(Sound_SET_PARAM_AbsoluteBalance, Lbalance, Rbalance);
28351 }
28352
API_AUDIO_CUSTOMER_MSTAR_SE_SET_NR_Threshold(MS_U16 u16level)28353 MS_BOOL API_AUDIO_CUSTOMER_MSTAR_SE_SET_NR_Threshold(MS_U16 u16level)
28354 {
28355 AU_nDBG("[u16level = 0x%x] \n", (unsigned int)u16level);
28356
28357 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_NR_Threshold = u16level;
28358 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_SET_NR_Threshold_UpperSetCnt += 1;
28359
28360 return MApi_SND_SetParam1(Sound_SET_PARAM_NR_Threshold, u16level, 0);
28361 }
28362
API_AUDIO_CUSTOMER_MSTAR_SE_GET_NR_Status()28363 MS_S32 API_AUDIO_CUSTOMER_MSTAR_SE_GET_NR_Status()
28364 {
28365 pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_GET_NR_Threshold = (int)MApi_AUDIO_GetCommAudioInfo(Audio_Comm_infoType_getNR_Status);
28366
28367 AU_nThreadDBG("[pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_GET_NR_Threshold = %d] \n", (int)pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_GET_NR_Threshold);
28368
28369 return pstAudioCustomerShmData->g_audio_customer_MSTAR_SE_GET_NR_Threshold;
28370 }
28371
28372 /* Advanced Sound Effect */
API_AUDIO_CUSTOMER_DTS_SE_Enable(API_AUDIO_CUSTOMER_DTS_SE_TYPE seType)28373 MS_BOOL API_AUDIO_CUSTOMER_DTS_SE_Enable(API_AUDIO_CUSTOMER_DTS_SE_TYPE seType)
28374 {
28375 ADVSND_TYPE DtsSndType = ADV_NONE;
28376
28377 AU_nDBG("[seType = 0x%x]\n", (unsigned int)seType);
28378
28379 pstAudioCustomerShmData->g_audio_customer_DTS_SE_Enable[seType] = TRUE;
28380 pstAudioCustomerShmData->g_audio_customer_DTS_SE_Enable_UpperSetCnt[seType] += 1;
28381
28382 DtsSndType = AU_CUS_ConvertCustomerDtsSndTypeToDriverDtsSndType(seType);
28383 MApi_AUDIO_ADVSOUND_ProcessEnable(DtsSndType);
28384 return TRUE;
28385 }
28386
API_AUDIO_CUSTOMER_DTS_SE_ProcessUnit_Enable(API_AUDIO_CUSTOMER_DTS_SE_UNIT_TYPE seUnit,MS_BOOL bOnOff)28387 MS_BOOL API_AUDIO_CUSTOMER_DTS_SE_ProcessUnit_Enable(API_AUDIO_CUSTOMER_DTS_SE_UNIT_TYPE seUnit, MS_BOOL bOnOff)
28388 {
28389 ADVFUNC DtsSndUnit = SRS_THEATERSOUND_TOTAL;
28390
28391 AU_nDBG("[seUnit = 0x%x] [bOnOff = 0x%x]\n", (unsigned int)seUnit, (unsigned int)bOnOff);
28392
28393 pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable[seUnit] = bOnOff;
28394 pstAudioCustomerShmData->g_audio_customer_DTS_SE_ProcessUnit_Enable_UpperSetCnt[seUnit] += 1;
28395
28396 DtsSndUnit = AU_CUS_ConvertCustomerDtsSndUnitToDriverDtsSndUnitType(seUnit);
28397 MApi_AUDIO_ADVSOUND_SubProcessEnable(DtsSndUnit, bOnOff);
28398 return TRUE;
28399 }
28400
API_AUDIO_CUSTOMER_DTS_SE_SetParam(API_AUDIO_CUSTOMER_DTS_SE_PARAM_TYPE param,MS_U32 u32value)28401 MS_BOOL API_AUDIO_CUSTOMER_DTS_SE_SetParam(API_AUDIO_CUSTOMER_DTS_SE_PARAM_TYPE param, MS_U32 u32value)
28402 {
28403 ADVSND_PARAM DtsSndParam = SRS_THEATERSOUND_TOTAL;
28404
28405 AU_nDBG("[param = 0x%x] [u32value = 0x%x]\n", (unsigned int)param, (unsigned int)u32value);
28406
28407 DtsSndParam = AU_CUS_ConvertCustomerDtsSndParamToDriverDtsSndParam(param, u32value);
28408 if(DtsSndParam > 0)
28409 {
28410 pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam[param] = u32value;
28411 pstAudioCustomerShmData->g_audio_customer_DTS_SE_SetParam_UpperSetCnt[param] += 1;
28412
28413 MApi_AUDIO_ADVSND_SetParam(DtsSndParam, u32value, 1);
28414 return TRUE;
28415 }
28416 else
28417 {
28418 return FALSE;
28419 }
28420 }
28421
API_AUDIO_CUSTOMER_Dolby_DAP_Enable(MS_BOOL bOnOff)28422 MS_BOOL API_AUDIO_CUSTOMER_Dolby_DAP_Enable(MS_BOOL bOnOff)
28423 {
28424 AU_nDBG("[bOnOff = %d] \n", (unsigned int)bOnOff);
28425
28426 #if(UTPA_SUPPORT_DOLBY_DAP)
28427 {
28428 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_Enable = bOnOff;
28429 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_Enable_UpperSetCnt += 1;
28430
28431 if(bOnOff)
28432 {
28433 if(MApi_AUDIO_ADVSOUND_ProcessEnable(DOLBY_DAP) == FALSE)
28434 {
28435 AU_nPRINT("MApi_AUDIO_ADVSOUND_ProcessEnable DOLBY_DAP FAIL.\n");
28436 return FALSE;
28437 }
28438 }
28439 else
28440 {
28441 MApi_AUDIO_ADVSOUND_SubProcessEnable(DOLBY_DAP_EN, FALSE);
28442 }
28443 }
28444 #endif
28445
28446 return TRUE;
28447 }
28448
API_AUDIO_CUSTOMER_Dolby_DAP_ProcessUnit_Enable(MS_BOOL bOnOff)28449 MS_BOOL API_AUDIO_CUSTOMER_Dolby_DAP_ProcessUnit_Enable(MS_BOOL bOnOff)
28450 {
28451 AU_nDBG("[bOnOff = %d] \n", (unsigned int)bOnOff);
28452
28453 #if(UTPA_SUPPORT_DOLBY_DAP)
28454 {
28455 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_ProcessUnit_Enable = bOnOff;
28456 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_ProcessUnit_Enable_UpperSetCnt += 1;
28457
28458 MApi_AUDIO_ADVSOUND_SubProcessEnable(DOLBY_DAP_EN, bOnOff);
28459 }
28460 #endif
28461
28462 return TRUE;
28463 }
28464
API_AUDIO_CUSTOMER_Dolby_DAP_SetParam(API_AUDIO_CUSTOMER_DOLBY_DAP_PARAM dap_params)28465 MS_BOOL API_AUDIO_CUSTOMER_Dolby_DAP_SetParam(API_AUDIO_CUSTOMER_DOLBY_DAP_PARAM dap_params)
28466 {
28467 int i = 0, j = 0;
28468
28469 AU_nDBG("\n");
28470
28471 AU_UNUSED(i);
28472 AU_UNUSED(j);
28473
28474 #if(UTPA_SUPPORT_DOLBY_DAP)
28475 {
28476 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.pregain = dap_params.pregain;
28477 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.postgain = dap_params.postgain;
28478 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.systemgain = dap_params.systemgain;
28479 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.surround_decoder_enable = dap_params.surround_decoder_enable;
28480 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.virtualizer_enable = dap_params.virtualizer_enable;
28481 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.headphone_reverb = dap_params.headphone_reverb;
28482 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.speaker_angle = dap_params.speaker_angle;
28483 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.speaker_start = dap_params.speaker_start;
28484 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.surround_boost = dap_params.surround_boost;
28485 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.mi_ieq_enable = dap_params.mi_ieq_enable;
28486 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.mi_dv_enable = dap_params.mi_dv_enable;
28487 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.mi_de_enable = dap_params.mi_de_enable;
28488 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.mi_surround_enable = dap_params.mi_surround_enable;
28489
28490 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.calibration_boost = dap_params.calibration_boost;
28491
28492 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.leveler_amount = dap_params.leveler_amount;
28493 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.leveler_input = dap_params.leveler_input;
28494 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.leveler_output = dap_params.leveler_output;
28495 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.leveler_enable = dap_params.leveler_enable;
28496
28497 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.modeler_enable = dap_params.modeler_enable;
28498 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.modeler_calibration = dap_params.modeler_calibration;
28499
28500 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.ieq_enable = dap_params.ieq_enable;
28501 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.ieq_amount = dap_params.ieq_amount;
28502 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.ieq_nb_bands = dap_params.ieq_nb_bands;
28503
28504 for(i= 0; i < DOLBY_DAP_IEQ_MAX_BANDS; i++)
28505 {
28506 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_center[i] = dap_params.a_ieq_band_center[i];
28507 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_ieq_band_target[i] = dap_params.a_ieq_band_target[i];
28508 }
28509
28510 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.de_enable = dap_params.de_enable;
28511 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.de_amount = dap_params.de_amount;
28512 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.de_ducking = dap_params.de_ducking;
28513
28514 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.volmax_boost = dap_params.volmax_boost;
28515
28516 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.geq_enable = dap_params.geq_enable;
28517 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.geq_nb_bands = dap_params.geq_nb_bands;
28518 for(i= 0; i < DOLBY_DAP_GEQ_MAX_BANDS; i++)
28519 {
28520 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_center[i] = dap_params.a_geq_band_center[i];
28521 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_geq_band_target[i] = dap_params.a_geq_band_target[i];
28522 }
28523
28524 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.optimizer_enable = dap_params.optimizer_enable;
28525 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.optimizer_nb_bands = dap_params.optimizer_nb_bands;
28526 for(i= 0; i < DOLBY_DAP_OPT_MAX_BANDS; i++)
28527 {
28528 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_center_freq[i] = dap_params.a_opt_band_center_freq[i];
28529 }
28530 for(i= 0; i < DOLBY_DAP_MAX_CHANNELS; i++)
28531 {
28532 for(j= 0; j < DOLBY_DAP_OPT_MAX_BANDS; j++)
28533 {
28534 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_opt_band_gain[i][j] = dap_params.a_opt_band_gain[i][j];
28535 }
28536 }
28537
28538 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.bass_enable = dap_params.bass_enable;
28539 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.bass_boost = dap_params.bass_boost;
28540 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.bass_cutoff = dap_params.bass_cutoff;
28541 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.bass_width = dap_params.bass_width;
28542
28543 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.reg_nb_bands = dap_params.reg_nb_bands;
28544 for(i= 0; i < DOLBY_DAP_REG_MAX_BANDS; i++)
28545 {
28546 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_band_center[i] = dap_params.a_reg_band_center[i];
28547 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_low_thresholds[i] = dap_params.a_reg_low_thresholds[i];
28548 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_high_thresholds[i] = dap_params.a_reg_high_thresholds[i];
28549 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.a_reg_isolated_bands[i] = dap_params.a_reg_isolated_bands[i];
28550 }
28551
28552 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.regulator_overdrive = dap_params.regulator_overdrive;
28553 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.regulator_timbre = dap_params.regulator_timbre;
28554 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.regulator_distortion = dap_params.regulator_distortion;
28555 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.regulator_mode = dap_params.regulator_mode;
28556 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.regulator_enable = dap_params.regulator_enable;
28557 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.virtual_bass_mode = dap_params.virtual_bass_mode;
28558 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.virtual_bass_low_src_freq = dap_params.virtual_bass_low_src_freq;
28559 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.virtual_bass_high_src_freq = dap_params.virtual_bass_high_src_freq;
28560 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.virtual_bass_overall_gain = dap_params.virtual_bass_overall_gain;
28561 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.virtual_bass_slope_gain = dap_params.virtual_bass_slope_gain;
28562 for(i= 0; i < 3; i++)
28563 {
28564 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.virtual_bass_subgain[i] = dap_params.virtual_bass_subgain[i];
28565 }
28566 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.virtual_bass_mix_low_freq = dap_params.virtual_bass_mix_low_freq;
28567 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam.virtual_bass_mix_high_freq = dap_params.virtual_bass_mix_high_freq;
28568
28569 pstAudioCustomerShmData->g_audio_customer_Dolby_DAP_SetParam_UpperSetCnt += 1;
28570 MApi_AUDIO_COPY_Parameter(DOLBY_DAP_SET_PARAMS, (MS_U32 *)(&dap_params), sizeof(API_AUDIO_CUSTOMER_DOLBY_DAP_PARAM));
28571 }
28572 #endif
28573
28574 return TRUE;
28575 }
28576
28577 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
28578 /* Initialize, STR */
28579 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_InitializeModule);
28580 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_InitializeModule_IsFinish);
28581 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_Suspend);
28582 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_Resume);
28583
28584 /* Connect & Disconnect */
28585 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetParserMode);
28586 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_ADEC_Connect);
28587 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_ADEC_Disconnect);
28588 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_ADC_Connect);
28589 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_ADC_Disconnect);
28590 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PCM_Mixer_Connect);
28591 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PCM_Mixer_Disconnect);
28592 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_CH_Sound_Connect);
28593 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_CH_Sound_Disconnect);
28594 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_FW_MIXER_Connect);
28595 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_FW_MIXER_Disconnect);
28596 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SE_Connect);
28597 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SE_Disconnect);
28598 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SNDOUT_Connect);
28599 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SNDOUT_Disconnect);
28600 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PCM_CAPTURE_Connect);
28601 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PCM_CAPTURE_Disconnect);
28602 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MP3_ENC_Connect);
28603 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MP3_ENC_Disconnect);
28604 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_AAC_ENC_Connect);
28605 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_AAC_ENC_Disconnect);
28606
28607 /* Start & Stop */
28608 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetCodecType);
28609 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_StartDecoding);
28610 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_StopDecoding);
28611 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PauseDecoding);
28612 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetMainDecoderOutput);
28613
28614 /* SPDIF */
28615 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SPDIF_TX_SetOutputType);
28616 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SPDIF_TX_GetOutputType);
28617 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SPDIF_TX_SetCopyInfo);
28618 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SPDIF_TX_SetCategoryCode);
28619 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SPDIF_TX_SetLightOnOff);
28620 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SPDIF_TX_SetMonitorOnOff);
28621 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SPDIF_TX_ChannelStatus_CTRL);
28622
28623 /* HDMI */
28624 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_HDMI_RX_GetAudioMode);
28625 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_HDMI_RX_GetCopyInfo);
28626 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_HDMI_RX_SetAudioReturnChannel);
28627 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_HDMI_RX_SetMonitorOnOff);
28628 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_HDMI_TX_SetOutputType);
28629 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_HDMI_TX_SetMonitorOnOff);
28630
28631 /* ATV */
28632 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SIF_SetInputSource);
28633 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SIF_SetHighDevMode);
28634 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SIF_SetAudioStandard);
28635 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SIF_SetSoundMode);
28636 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SIF_GetSoundMode);
28637 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SIF_SetMonitorOnOff);
28638 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SIF_SetAutoMute);
28639 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SIF_StartAutoStandardDetection);
28640 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SIF_SetThreshold);
28641 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SIF_SetPALType);
28642 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SIF_SendCmd);
28643 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SIF_GetAudioStatus);
28644 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SIF_IsPALType);
28645 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SIF_SetPrescale);
28646
28647 /* Decoder */
28648 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetSyncMode);
28649 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_GetDecodingType);
28650 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetDualMonoOutMode);
28651 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_GetESInfo);
28652 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_IsESExist);
28653 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetAudioDescription);
28654 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetTrickMode);
28655 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_GetBufferStatus);
28656 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetAdecPcmPath);
28657 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_AdecPcmReady);
28658 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_AdecPcmGet);
28659 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_AdecRegisterDecodeDoneCallback);
28660 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_AdecRegisterEndOfStreamCallback);
28661 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_AdecRegisterUnderrunCallback);
28662 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_Auto_Recovery_SetMonitorOnOff);
28663
28664 /* Common Decoder */
28665 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_COMMON_DECODER_Open);
28666 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_COMMON_DECODER_Close);
28667 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_COMMON_DECODER_Start);
28668 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_COMMON_DECODER_Stop);
28669 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_COMMON_DECODER_Set);
28670 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_COMMON_DECODER_Get);
28671 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_COMMON_DECODER_Read);
28672 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_COMMON_DECODER_Write);
28673 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_COMMON_DECODER_Flush);
28674
28675 /* Common */
28676 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetAudioParam);
28677 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_GetAudioInfo);
28678
28679 /* Customized patch */
28680 EXPORT_SYMBOL(API_AUDIO_CUSTOMIZED_PATCH_SetAudioParam);
28681 EXPORT_SYMBOL(API_AUDIO_CUSTOMIZED_PATCH_GetAudioInfo);
28682
28683 /* Clip Play for ES */
28684 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PlayClipDecoder);
28685 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_StopClipDecoder);
28686 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PauseClipDecoder);
28687 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_ResumeClipDecoder);
28688
28689 /* Clip Play for PCM */
28690 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PlayClipMixer);
28691 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_StopClipMixer);
28692 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PauseClipMixer);
28693 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_ResumeClipMixer);
28694
28695 /* Gain, Mute & Delay */
28696 //---Gain---
28697 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetAudioDescriptionGain);
28698 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetPCMMixerInputGain);
28699 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetFWMixerChannelGain);
28700 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetI2SOutGain);
28701 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetLineOutGain);
28702 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetSPDIFOutGain);
28703 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetHDMIOutGain);
28704 //---Mute---
28705 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetPCMMixerInputMute);
28706 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetFWMixerChannelMute);
28707 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetI2SOutMute);
28708 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetLineOutMute);
28709 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetSPDIFOutMute);
28710 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetHDMIOutMute);
28711 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_GetI2SOutMuteStatus);
28712 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_GetLineOutMuteStatus);
28713 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_GetSPDIFOutMuteStatus);
28714 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MuteDuringLimitedTime_Input);
28715 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MuteDuringLimitedTime_Output);
28716 //---Delay---
28717 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetChannelDelay);
28718 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetAudioDelay);
28719 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetSpdifDelay);
28720 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_SetHdmiDelay);
28721
28722 /* AENC */
28723 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_AENC_Start);
28724 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_AENC_Stop);
28725 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_AENC_RegisterCallback);
28726 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_AENC_SetInfo);
28727 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_AENC_GetInfo);
28728 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_AENC_SetGain);
28729 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_AENC_CopyData);
28730 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_AENC_ReleaseData);
28731
28732 /* PCM Capture */
28733 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PCM_StartUpload);
28734 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PCM_StopUpload);
28735 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PCM_RegisterSendPCMCallback);
28736 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PCM_SetGain);
28737 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PCM_SetMute);
28738 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PCM_SetRequestSizeInMs);
28739
28740 /* PCM IO Control */
28741 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PCM_Open);
28742 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PCM_Close);
28743 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PCM_Start);
28744 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PCM_Stop);
28745 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PCM_Set);
28746 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PCM_Get);
28747 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PCM_Read);
28748 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PCM_Write);
28749 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_PCM_Flush);
28750
28751 /* MM New Mode */
28752 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_GetDDRInfo);
28753 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MM2_initAesInfo);
28754 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MM2_checkAesInfo);
28755 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MM2_inputAesFinished);
28756 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MM2_AD_initAesInfo);
28757 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MM2_AD_checkAesInfo);
28758 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MM2_AD_inputAesFinished);
28759
28760 /* Mstar Sound Effect */
28761 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MSTAR_SE_Enable);
28762 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MSTAR_SE_SET_GEQ);
28763 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MSTAR_SE_SET_PEQCoef);
28764 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MSTAR_SE_SET_HPFCoef);
28765 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_MODE);
28766 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_LEVEL);
28767 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_Begin);
28768 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_End);
28769 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_R_MODE_Slope);
28770 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_S_MODE_OFFSET);
28771 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_AttackTime);
28772 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MSTAR_SE_SET_AVC_ReleaseTime);
28773 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MSTAR_SE_SET_DRC_LEVEL);
28774 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MSTAR_SE_SET_BALANCE);
28775 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MSTAR_SE_SET_NR_Threshold);
28776 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_MSTAR_SE_GET_NR_Status);
28777
28778 /* Advanced Sound Effect */
28779 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_DTS_SE_Enable);
28780 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_DTS_SE_ProcessUnit_Enable);
28781 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_DTS_SE_SetParam);
28782 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_Dolby_DAP_Enable);
28783 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_Dolby_DAP_ProcessUnit_Enable);
28784 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_Dolby_DAP_SetParam);
28785
28786 /* Debug */
28787 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_DebugMenu);
28788 EXPORT_SYMBOL(API_AUDIO_CUSTOMER_DebugMenu_Non_Scanf_ParseCommand);
28789 #endif //#ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
28790
28791 //=====================================================================================================================================
28792 // DebugMenu Begin (debug menu Always put on the bottom)
28793 //=====================================================================================================================================
28794 /*
28795
28796 ===============================================================================
28797 * * * How to use * * *
28798 ===============================================================================
28799
28800 ================================
28801 (0100) [Demo] MP3 Encode
28802 ================================
28803 d -> 26 -> d99 -> 100
28804 1. Start
28805 2. Stop
28806 3. Exit
28807 dump file in /tmp/MP3EncDump.mp3
28808
28809 cp -f /tmp/MP3EncDump.mp3 /tmp/usb/sda/sda1/
28810 sync
28811
28812 ================================
28813 (0101) [Demo] AAC Encode
28814 ================================
28815 d -> 26 -> d99 -> 101
28816 1. Start
28817 2. Stop
28818 3. Exit
28819
28820 dump file in /tmp/AACEncDump.aac
28821 /tmp/AACEncPCMDump.pcm
28822
28823 cp -f /tmp/AACEncDump.aac /tmp/usb/sda/sda1/
28824 cp -f /tmp/AACEncPCMDump.pcm /tmp/usb/sda/sda1/
28825 sync
28826
28827
28828 ================================
28829 (0102) [Demo] CLIP Decoder play
28830 ================================
28831 d -> 26 -> d99 -> 102
28832 1. Start
28833 2. Stop
28834 3. Pause
28835 4. Resume
28836 5. Exit
28837
28838 ================================
28839 (0103) [Demo] PCM Capture
28840 ================================
28841 d -> 26 -> d99 -> 103
28842 1. Start
28843 2. Stop
28844 3. Exit
28845
28846 dump file in AU_PCM_CAPTURE_SOURCE_DUMP_PATH
28847
28848 cp -f AU_PCM_CAPTURE_SOURCE_DUMP_PATH /tmp/usb/sda/sda1/
28849 sync
28850
28851 ================================
28852 Check PC Counter when DSP Dead
28853 ================================
28854 For DEC-DSP
28855 Read 1602FE = pc[15:0] , 1602FC= pc[23:16]
28856
28857 For SE-DSP
28858 Read 1602CE = pc[15:0] , 1602CC= pc[23:16]
28859
28860 ===============================================================================
28861 * * * Note * * *
28862 ===============================================================================
28863
28864 */
28865
AU_CUS_DumpRegInfo(void)28866 void AU_CUS_DumpRegInfo(void)
28867 {
28868 int i = 0, intOffset = 0;
28869 AU_nPRINT("\n\n\n\n\n");
28870 AU_nPRINT(" ====[Audio]==== \n");
28871 AU_nPRINT("--------------------------------------[112A Bank]--------------------------------------------------\n");
28872 //--------------------------------------------112A_20 ~ 112A_2F--------------------------------------------
28873 intOffset = (int)0x112a00;
28874 i = 0x2;
28875 #if 0 //because some customer will re-define printf(), it will cause always "\n" in each function call
28876 for(j = 0; j<= 7; j++)
28877 {
28878 unsigned int temp_reg = intOffset + 16*i + 2*j;
28879 AU_nPRINT("[0x%x]=0x%-4X,", temp_reg, AU_CUS_ReadAbsReg((MS_U32)temp_reg));
28880 }
28881 AU_nPRINT(" @@ \n");
28882 #endif
28883 AU_nPRINT("[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X, @@ \n",
28884 (intOffset + 16*i + 2*0), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*0)),
28885 (intOffset + 16*i + 2*1), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*1)),
28886 (intOffset + 16*i + 2*2), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*2)),
28887 (intOffset + 16*i + 2*3), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*3)),
28888 (intOffset + 16*i + 2*4), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*4)),
28889 (intOffset + 16*i + 2*5), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*5)),
28890 (intOffset + 16*i + 2*6), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*6)),
28891 (intOffset + 16*i + 2*7), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*7)) );
28892
28893 //--------------------------------------------112A_A0 ~ 112A_AF--------------------------------------------
28894 intOffset = (int)0x112a00;
28895 i = 0xa;
28896 #if 0 //because some customer will re-define printf(), it will cause always "\n" in each function call
28897 for(j = 0; j<= 7; j++)
28898 {
28899 unsigned int temp_reg = intOffset + 16*i + 2*j;
28900 AU_nPRINT("[0x%x]=0x%-4X,", temp_reg, AU_CUS_ReadAbsReg((MS_U32)temp_reg));
28901 }
28902 AU_nPRINT(" @@ \n");
28903 #endif
28904 AU_nPRINT("[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X, @@ \n",
28905 (intOffset + 16*i + 2*0), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*0)),
28906 (intOffset + 16*i + 2*1), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*1)),
28907 (intOffset + 16*i + 2*2), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*2)),
28908 (intOffset + 16*i + 2*3), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*3)),
28909 (intOffset + 16*i + 2*4), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*4)),
28910 (intOffset + 16*i + 2*5), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*5)),
28911 (intOffset + 16*i + 2*6), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*6)),
28912 (intOffset + 16*i + 2*7), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*7)) );
28913
28914 AU_nPRINT("--------------------------------------[112C Bank]--------------------------------------------------\n");
28915 //--------------------------------------------112C_00 ~ 112C_0F--------------------------------------------
28916 intOffset = (int)0x112c00;
28917 i = 0;
28918 #if 0 //because some customer will re-define printf(), it will cause always "\n" in each function call
28919 for(j = 0; j<= 7; j++)
28920 {
28921 unsigned int temp_reg = intOffset + 16*i + 2*j;
28922 AU_nPRINT("[0x%x]=0x%-4X,", temp_reg, AU_CUS_ReadAbsReg((MS_U32)temp_reg));
28923 }
28924 AU_nPRINT(" @@ \n");
28925 #endif
28926 AU_nPRINT("[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X, @@ \n",
28927 (intOffset + 16*i + 2*0), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*0)),
28928 (intOffset + 16*i + 2*1), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*1)),
28929 (intOffset + 16*i + 2*2), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*2)),
28930 (intOffset + 16*i + 2*3), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*3)),
28931 (intOffset + 16*i + 2*4), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*4)),
28932 (intOffset + 16*i + 2*5), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*5)),
28933 (intOffset + 16*i + 2*6), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*6)),
28934 (intOffset + 16*i + 2*7), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*7)) );
28935
28936 //--------------------------------------------112C_40 ~ 112C_4F--------------------------------------------
28937 intOffset = (int)0x112c00;
28938 i = 4;
28939 #if 0 //because some customer will re-define printf(), it will cause always "\n" in each function call
28940 for(j = 0; j<= 7; j++)
28941 {
28942 unsigned int temp_reg = intOffset + 16*i + 2*j;
28943 AU_nPRINT("[0x%x]=0x%-4X,", temp_reg, AU_CUS_ReadAbsReg((MS_U32)temp_reg));
28944 }
28945 AU_nPRINT(" @@ \n");
28946 #endif
28947 AU_nPRINT("[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X, @@ \n",
28948 (intOffset + 16*i + 2*0), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*0)),
28949 (intOffset + 16*i + 2*1), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*1)),
28950 (intOffset + 16*i + 2*2), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*2)),
28951 (intOffset + 16*i + 2*3), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*3)),
28952 (intOffset + 16*i + 2*4), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*4)),
28953 (intOffset + 16*i + 2*5), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*5)),
28954 (intOffset + 16*i + 2*6), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*6)),
28955 (intOffset + 16*i + 2*7), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*7)) );
28956
28957 //--------------------------------------------112C_60 ~ 112C_6F--------------------------------------------
28958 intOffset = (int)0x112c00;
28959 i = 6;
28960 #if 0 //because some customer will re-define printf(), it will cause always "\n" in each function call
28961 for(j = 0; j<= 7; j++)
28962 {
28963 unsigned int temp_reg = intOffset + 16*i + 2*j;
28964 AU_nPRINT("[0x%x]=0x%-4X,", temp_reg, AU_CUS_ReadAbsReg((MS_U32)temp_reg));
28965 }
28966 AU_nPRINT(" @@ \n");
28967 #endif
28968 AU_nPRINT("[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X, @@ \n",
28969 (intOffset + 16*i + 2*0), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*0)),
28970 (intOffset + 16*i + 2*1), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*1)),
28971 (intOffset + 16*i + 2*2), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*2)),
28972 (intOffset + 16*i + 2*3), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*3)),
28973 (intOffset + 16*i + 2*4), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*4)),
28974 (intOffset + 16*i + 2*5), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*5)),
28975 (intOffset + 16*i + 2*6), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*6)),
28976 (intOffset + 16*i + 2*7), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*7)) );
28977
28978 AU_nPRINT("--------------------------------------[112D Bank]--------------------------------------------------\n");
28979 //--------------------------------------------112D_00 ~ 112D_0F--------------------------------------------
28980 intOffset = (int)0x112d00;
28981 i = 0;
28982 #if 0 //because some customer will re-define printf(), it will cause always "\n" in each function call
28983 for(j = 0; j<= 7; j++)
28984 {
28985 unsigned int temp_reg = intOffset + 16*i + 2*j;
28986 AU_nPRINT("[0x%x]=0x%-4X,", temp_reg, AU_CUS_ReadAbsReg((MS_U32)temp_reg));
28987 }
28988 AU_nPRINT(" @@ \n");
28989 #endif
28990 AU_nPRINT("[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X, @@ \n",
28991 (intOffset + 16*i + 2*0), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*0)),
28992 (intOffset + 16*i + 2*1), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*1)),
28993 (intOffset + 16*i + 2*2), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*2)),
28994 (intOffset + 16*i + 2*3), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*3)),
28995 (intOffset + 16*i + 2*4), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*4)),
28996 (intOffset + 16*i + 2*5), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*5)),
28997 (intOffset + 16*i + 2*6), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*6)),
28998 (intOffset + 16*i + 2*7), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*7)) );
28999
29000 //--------------------------------------------112D_30 ~ 112D_3F--------------------------------------------
29001 intOffset = (int)0x112d00;
29002 i = 3;
29003 #if 0 //because some customer will re-define printf(), it will cause always "\n" in each function call
29004 for(j = 0; j<= 7; j++)
29005 {
29006 unsigned int temp_reg = intOffset + 16*i + 2*j;
29007 AU_nPRINT("[0x%x]=0x%-4X,", temp_reg, AU_CUS_ReadAbsReg((MS_U32)temp_reg));
29008 }
29009 AU_nPRINT(" @@ \n");
29010 #endif
29011 AU_nPRINT("[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X, @@ \n",
29012 (intOffset + 16*i + 2*0), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*0)),
29013 (intOffset + 16*i + 2*1), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*1)),
29014 (intOffset + 16*i + 2*2), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*2)),
29015 (intOffset + 16*i + 2*3), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*3)),
29016 (intOffset + 16*i + 2*4), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*4)),
29017 (intOffset + 16*i + 2*5), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*5)),
29018 (intOffset + 16*i + 2*6), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*6)),
29019 (intOffset + 16*i + 2*7), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*7)) );
29020
29021 //--------------------------------------------112D_50 ~ 112D_5F--------------------------------------------
29022 intOffset = (int)0x112d00;
29023 i = 5;
29024 #if 0 //because some customer will re-define printf(), it will cause always "\n" in each function call
29025 for(j = 0; j<= 7; j++)
29026 {
29027 unsigned int temp_reg = intOffset + 16*i + 2*j;
29028 AU_nPRINT("[0x%x]=0x%-4X,", temp_reg, AU_CUS_ReadAbsReg((MS_U32)temp_reg));
29029 }
29030 AU_nPRINT(" @@ \n");
29031 #endif
29032 AU_nPRINT("[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X, @@ \n",
29033 (intOffset + 16*i + 2*0), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*0)),
29034 (intOffset + 16*i + 2*1), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*1)),
29035 (intOffset + 16*i + 2*2), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*2)),
29036 (intOffset + 16*i + 2*3), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*3)),
29037 (intOffset + 16*i + 2*4), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*4)),
29038 (intOffset + 16*i + 2*5), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*5)),
29039 (intOffset + 16*i + 2*6), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*6)),
29040 (intOffset + 16*i + 2*7), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*7)) );
29041
29042 //--------------------------------------------112D_80 ~ 112D_8F--------------------------------------------
29043 intOffset = (int)0x112d00;
29044 i = 8;
29045 #if 0 //because some customer will re-define printf(), it will cause always "\n" in each function call
29046 for(j = 0; j<= 7; j++)
29047 {
29048 unsigned int temp_reg = intOffset + 16*i + 2*j;
29049 AU_nPRINT("[0x%x]=0x%-4X,", temp_reg, AU_CUS_ReadAbsReg((MS_U32)temp_reg));
29050 }
29051 AU_nPRINT(" @@ \n");
29052 #endif
29053 AU_nPRINT("[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X, @@ \n",
29054 (intOffset + 16*i + 2*0), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*0)),
29055 (intOffset + 16*i + 2*1), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*1)),
29056 (intOffset + 16*i + 2*2), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*2)),
29057 (intOffset + 16*i + 2*3), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*3)),
29058 (intOffset + 16*i + 2*4), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*4)),
29059 (intOffset + 16*i + 2*5), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*5)),
29060 (intOffset + 16*i + 2*6), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*6)),
29061 (intOffset + 16*i + 2*7), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*7)) );
29062
29063 AU_nPRINT("--------------------------------------[1603 Bank]--------------------------------------------------\n");
29064 //--------------------------------------------1603_90 ~ 1603_9F--------------------------------------------
29065 intOffset = (int)0x160300;
29066 i = 9;
29067 #if 0 //because some customer will re-define printf(), it will cause always "\n" in each function call
29068 for(j = 0; j<= 7; j++)
29069 {
29070 unsigned int temp_reg = intOffset + 16*i + 2*j;
29071 AU_nPRINT("[0x%x]=0x%-4X,", temp_reg, AU_CUS_ReadAbsReg((MS_U32)temp_reg));
29072 }
29073 AU_nPRINT(" @@ \n");
29074 #endif
29075 AU_nPRINT("[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X, @@ \n",
29076 (intOffset + 16*i + 2*0), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*0)),
29077 (intOffset + 16*i + 2*1), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*1)),
29078 (intOffset + 16*i + 2*2), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*2)),
29079 (intOffset + 16*i + 2*3), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*3)),
29080 (intOffset + 16*i + 2*4), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*4)),
29081 (intOffset + 16*i + 2*5), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*5)),
29082 (intOffset + 16*i + 2*6), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*6)),
29083 (intOffset + 16*i + 2*7), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*7)) );
29084
29085 AU_nPRINT("--------------------------------------[112E Bank]--------------------------------------------------\n");
29086 //--------------------------------------------112E_90 ~ 112E_9F--------------------------------------------
29087 intOffset = (int)0x112E00;
29088 i = 9;
29089 #if 0 //because some customer will re-define printf(), it will cause always "\n" in each function call
29090 for(j = 0; j<= 7; j++)
29091 {
29092 unsigned int temp_reg = intOffset + 16*i + 2*j;
29093 AU_nPRINT("[0x%x]=0x%-4X,", temp_reg, AU_CUS_ReadAbsReg((MS_U32)temp_reg));
29094 }
29095 AU_nPRINT(" @@ \n");
29096 #endif
29097 AU_nPRINT("[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X,[0x%x]=0x%-4X, @@ \n",
29098 (intOffset + 16*i + 2*0), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*0)),
29099 (intOffset + 16*i + 2*1), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*1)),
29100 (intOffset + 16*i + 2*2), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*2)),
29101 (intOffset + 16*i + 2*3), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*3)),
29102 (intOffset + 16*i + 2*4), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*4)),
29103 (intOffset + 16*i + 2*5), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*5)),
29104 (intOffset + 16*i + 2*6), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*6)),
29105 (intOffset + 16*i + 2*7), AU_CUS_ReadAbsReg((MS_U32)(intOffset + 16*i + 2*7)) );
29106
29107 AU_nPRINT(" ====[Audio]==== \n");
29108 }
29109
29110
AU_CUS_ShowAudioBlockDiagram(void)29111 void AU_CUS_ShowAudioBlockDiagram(void)
29112 {
29113 int temp = -1;
29114
29115 AU_CUS_DumpRegInfo();
29116 AU_nPRINT("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
29117 AU_nPRINT(" _________________ _________________ ___________________ ___________________ \n");
29118 AU_nPRINT("|ADEC0 | |ADEC1 | |ADEC_ATV | |Sound Effect | \n");
29119 AU_nPRINT("|.................| |.................| |...................| |...................| \n");
29120 AU_nPRINT("|Input (%-4d)| |Input (%-4d)| |Input (%-4d)| |Input (%-4d)| \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect , (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect , (int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Connect , (int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Connect );
29121 AU_nPRINT("|.................| |.................| |...................| |...................| \n");
29122 AU_nPRINT("|ID (%-4d)| |ID (%-4d)| |ID (%-4d)| |Basic SE: | \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_DecID , (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_DecID , (int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_DecID );
29123 AU_nPRINT("|UpperCodec (%-4d)| |UpperCodec (%-4d)| |UpperSifType (%-4d)| |function01 (xxxx)| \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperCodec , (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperCodec , (int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_UpperSifType );
29124 AU_nPRINT("|DriverCodec(%-4d)| |DriverCodec(%-4d)| |DriverSifType(%-4d)| |function02 (xxxx)| \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_DriverCodec , (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_DriverCodec , (int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_DriverSifType );
29125 AU_nPRINT("|UpperPlay (%-4d)| |UpperPlay (%-4d)| |UpperPlay (%-4d)| |function03 (xxxx)| \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_UpperPlay , (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_UpperPlay , (int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_UpperPlay );
29126 AU_nPRINT("|DriverPlay (%-4d)| |DriverPlay (%-4d)| |DriverPlay (%-4d)| |function04 (xxxx)| \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_DriverPlay , (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_DriverPlay , (int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_DriverPlay );
29127 AU_nPRINT("|.................| |.................| |...................| |function05 (xxxx)| \n");
29128 AU_nPRINT("|bMM (%-4d)| |bMM (%-4d)| |PreScale(A2): | |function06 (xxxx)| \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_bMM , (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_bMM );
29129 AU_nPRINT("|.................| |.................| |A2_FM (%-4d)| |function07 (xxxx)| \n" , (int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Prescale_A2_FM );
29130 AU_nPRINT("|Sync (%-4d)| |Sync (%-4d)| |NICAM (%-4d)| |function08 (xxxx)| \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_SyncMode , (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_SyncMode , (int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Prescale_NICAM );
29131 AU_nPRINT("|DRC (%-4d)| |DRC (%-4d)| |AM (%-4d)| |function09 (xxxx)| \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DolbyDRCMode , (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3P_DolbyDRCMode , (int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Prescale_AM );
29132 AU_nPRINT("|DMX (%-4d)| |DMX (%-4d)| |HIDEV (%-4d)| |function10 (xxxx)| \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_AC3P_DownmixMode , (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_AC3P_DownmixMode , (int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Prescale_HIDEV );
29133 AU_nPRINT("|Dual (%-4d)| |Dual (%-4d)| |FM_M (%-4d)| |function11 (xxxx)| \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_DualmonoMode , (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_DualmonoMode , (int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Prescale_FM_M );
29134 AU_nPRINT("|Trick (%-4d)| |Trick (%-4d)| |HIDEV_M (%-4d)| |function12 (xxxx)| \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_TrickMode , (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_TrickMode , (int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Prescale_HIDEV_M );
29135 AU_nPRINT("|.................| |.................| |...................| |function13 (xxxx)| \n");
29136 AU_nPRINT("|AD_bMain (%-4d)| |AD_bMain (%-4d)| |PreScale(BTSC): | |function14 (xxxx)| \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_AD_bMain , (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_AD_bMain );
29137 AU_nPRINT("|AD_Gain (%-4d)| |AD_Gain (%-4d)| |BTSC (%-4d)| |function15 (xxxx)| \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_AD_Gain , (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_AD_Gain , (int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Prescale_BTSC );
29138 AU_nPRINT("|.................| |.................| |BTSC_MONO (%-4d)| |function16 (xxxx)| \n" , (int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Prescale_BTSC_MONO );
29139 AU_nPRINT("|Gain (%-4d)| |Gain (%-4d)| |BTSC_STEREO (%-4d)| |...................| \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_Gain , (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_Gain , (int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Prescale_BTSC_STEREO );
29140 AU_nPRINT("|Mute (%-4d)| |Mute (%-4d)| |BTSC_SAP (%-4d)| |ADV SE: | \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_bMute , (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_bMute , (int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Prescale_BTSC_SAP );
29141 AU_nPRINT("|_________________| |_________________| |___________________| |function01 (xxxx)| \n");
29142 AU_nPRINT(" |function02 (xxxx)| \n");
29143 AU_nPRINT(" |function03 (xxxx)| \n");
29144 AU_nPRINT(" |function04 (xxxx)| \n");
29145 AU_nPRINT(" |function05 (xxxx)| \n");
29146 AU_nPRINT(" |function06 (xxxx)| \n");
29147 AU_nPRINT(" |function07 (xxxx)| \n");
29148 AU_nPRINT(" |function08 (xxxx)| \n");
29149 AU_nPRINT(" |___________________| \n");
29150 AU_nPRINT(" \n");
29151 AU_nPRINT("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
29152 AU_nPRINT(" \n");
29153 AU_nPRINT(" @ \n");
29154 AU_nPRINT(" @@ \n");
29155 AU_nPRINT(" _____ @ @ ___________ _____ \n");
29156 AU_nPRINT("|AFIFO| @ @ |PARSER A | | | \n");
29157 AU_nPRINT("| 0 |=>@ @=>|-----------|=>| | \n");
29158 AU_nPRINT("|_____| @ @ |Input(%-4d)| | | \n", (int)pstAudioCustomerShmData->g_audio_customer_PARSER_A_Connect );
29159 AU_nPRINT(" @ @ |___________| | | \n");
29160 AU_nPRINT(" _____ @ @ ___________ |ADEC0| \n");
29161 AU_nPRINT("|AFIFO| @ @ |PARSER B | | | \n");
29162 AU_nPRINT("| 1 |=>@ @=>|-----------|=>| | \n");
29163 AU_nPRINT("|_____| @ @ |Input(%-4d)| | | \n", (int)pstAudioCustomerShmData->g_audio_customer_PARSER_B_Connect );
29164 AU_nPRINT(" @ @ |___________| |_____| \n");
29165 AU_nPRINT(" _____ @ @ ___________ _____ \n");
29166 AU_nPRINT("|AFIFO| @ @ |PARSER C | | | \n");
29167 AU_nPRINT("| 2 |=>@ @=>|-----------|=>| | \n");
29168 AU_nPRINT("|_____| @ @ |Input(%-4d)| | | \n", (int)pstAudioCustomerShmData->g_audio_customer_PARSER_C_Connect );
29169 AU_nPRINT(" @ @ |___________| | | \n");
29170 AU_nPRINT(" _____ @ @ ___________ |ADEC1| \n");
29171 AU_nPRINT("|AFIFO| @ @ |PARSER D | | | \n");
29172 AU_nPRINT("| 3 |=>@ @=>|-----------|=>| | \n");
29173 AU_nPRINT("|_____| @ @ |Input(%-4d)| | | \n", (int)pstAudioCustomerShmData->g_audio_customer_PARSER_D_Connect );
29174 AU_nPRINT(" @ @ |___________| |_____| \n");
29175 AU_nPRINT(" @ @ \n");
29176 AU_nPRINT(" @@ \n");
29177 AU_nPRINT(" @ \n");
29178 AU_nPRINT(" \n");
29179 AU_nPRINT("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
29180 AU_nPRINT(" \n");
29181 AU_nPRINT(" ___________________ @ \n");
29182 AU_nPRINT("| ADEC PCM PATH | @@ \n");
29183 AU_nPRINT("| _______________ | @ @ ___ \n");
29184 AU_nPRINT("| | ADEC0 | | @ @ | | \n");
29185 AU_nPRINT("| |---------------|====>@ @==>|MCU| \n");
29186 AU_nPRINT("| |PcmPath (%-4d)| | @ @ |___| \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_PCM_OutputPath);
29187 AU_nPRINT("| |_______________| | @ @ \n");
29188 AU_nPRINT("| _______________ | @ @ ___ \n");
29189 AU_nPRINT("| | ADEC1 | | @ @ | | \n");
29190 AU_nPRINT("| |---------------|====>@ @==>|DSP| \n");
29191 AU_nPRINT("| |PcmPath (%-4d)| | @ @ |___| \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_PCM_OutputPath);
29192 AU_nPRINT("| |_______________| | @ @ \n");
29193 AU_nPRINT("|___________________| @ @ \n");
29194 AU_nPRINT(" @@ \n");
29195 AU_nPRINT(" @ \n");
29196 AU_nPRINT(" \n");
29197 AU_nPRINT("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
29198 AU_nPRINT(" _____ ___________ _______________ \n");
29199 AU_nPRINT("| | R2 DMA | DSP Dec out | \n");
29200 AU_nPRINT("|_____|___________|_______________| \n");
29201 AU_nPRINT("|ADEC0| R2_DMA_1 |R2_DEC_ISR1_EN | \n");
29202 AU_nPRINT("| | (0x80) | (0x80) | \n");
29203 AU_nPRINT("|_____|___________|_______________| \n");
29204 AU_nPRINT("|ADEC1| R2_DMA_2 |R2_DEC_ISR2_EN | \n");
29205 AU_nPRINT("| | (0x82) | (0x83) | \n");
29206 AU_nPRINT("| | 1R1D not | | \n");
29207 AU_nPRINT("|_____|_Support___|_______________| \n");
29208 AU_nPRINT(" \n");
29209 AU_nPRINT("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
29210 AU_nPRINT(" \n");
29211 AU_nPRINT(" @ \n");
29212 AU_nPRINT(" @@ \n");
29213 AU_nPRINT(" @ @ @ \n");
29214 AU_nPRINT(" _____ @@ ___________ @ @ _____________ @ ___________________ \n");
29215 AU_nPRINT("| 0 | @ @ |ADEC0 | @ @ |CH7 Sound | @@ | Sound Output | \n");
29216 AU_nPRINT("|DTV |=>@ @=>|-----------|==>@ @====>|(SCART) |===========================>@ @ | _______________ | \n");
29217 AU_nPRINT("|_____| @ @ |Input(%-4d)| @ @ |PATH 7 | @ @ | |Speaker | | \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_Connect );
29218 AU_nPRINT(" _____ @ @ |ID (%-4d)| @ @ |-------------|.. @ @ | |---------------| | \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_DecID );
29219 AU_nPRINT("| 1 | @ @ |bMM (%-4d)| @ @ |Input (%-4d)| | @ @ | |Input (%-4d)| | \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_bMM , (int)pstAudioCustomerShmData->g_audio_customer_CH7_Sound_Connect , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_Connect );
29220 AU_nPRINT("|HDMI |=>@ @ |Gain (%-4d)| @ @ |inDelay(%-4d)| | @ @ | |Gain (%-4d)| | \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_Gain , (int)pstAudioCustomerShmData->g_audio_customer_CH7_Sound_inDelay , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_Gain );
29221 AU_nPRINT("|_____| @ @ |Mute (%-4d)| @ @ |_____________| | @ @ | |GainComp (%-4d)| | \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC0_bMute , (int)pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_I2S_Out );
29222 AU_nPRINT(" _____ @ @ |___________| @ @ _____________ | ____________________ @ @ | |Mute (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_I2S_bMute );
29223 AU_nPRINT("| 2 | @ @ @ @ |CH5 Sound | |=>| FW Mixer | @ @=>| |_______________| | \n");
29224 AU_nPRINT("|MM |=>@ @ ___________ @ @====>|(Main) | | ____________ | @ @ | _______________ | \n");
29225 AU_nPRINT("|_____| @ @ |ADEC1 | @ @ |-------------|.. | |FW Mixer0 | | @ @ | |Line0 | | \n");
29226 AU_nPRINT(" _____ @ @=>|-----------|==>@ @ |Input (%-4d)| | | |(FWM0) |====>@ @ | |---------------| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_CH5_Sound_Connect );
29227 AU_nPRINT("| 6 | @ @ |Input(%-4d)| @ @ |inDelay(%-4d)| | | |PATH 4 | | @ @ | |Input (%-4d)| | \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_Connect , (int)pstAudioCustomerShmData->g_audio_customer_CH5_Sound_inDelay , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_Connect );
29228 AU_nPRINT("|MMUNI|=>@ @ |ID (%-4d)| @ @ |_____________| | | |------------| | @ @ | |Gain (%-4d)| | \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_DecID , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_Gain );
29229 AU_nPRINT("|_____| @ @ |bMM (%-4d)| @ @ _____________ | | |CH5 | | @ @ | |GainComp (%-4d)| | \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_bMM , (int)pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_0_Out );
29230 AU_nPRINT(" _____ @ @ |Gain (%-4d)| @ @ |CH6 Sound | |=>| |C[CH5](%-4d)| | @ @ | |Mute (%-4d)| | \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_Gain , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Connect[API_AUDIO_CUSTOMER_FWM_INPUT_CH5] , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line0_bMute );
29231 AU_nPRINT("| 3 | @ @ |Mute (%-4d)| @ @====>|(Sub) | | |Gain (%-4d)| | @ @ | |_______________| | \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC1_bMute , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_Gain[API_AUDIO_CUSTOMER_FWM_INPUT_CH5] );
29232 AU_nPRINT("|CLIP |=>@ @ |___________| @ @ |-------------|===>| |Mute (%-4d)| | @ @ | _______________ | \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH5] );
29233 AU_nPRINT("|_____| @@ @ @ |Input (%-4d)| | |------------| | @ @ | |Line1 | | \n" , (int)pstAudioCustomerShmData->g_audio_customer_CH6_Sound_Connect );
29234 AU_nPRINT(" @ @ @ |inDelay(%-4d)| |=>| |CH6 | | @ @ | |---------------| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_CH6_Sound_inDelay );
29235 AU_nPRINT(" @ @ |_____________| | | |C[CH6](%-4d)| | @ @ | |Input (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Connect[API_AUDIO_CUSTOMER_FWM_INPUT_CH6] , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_Connect );
29236 AU_nPRINT(" _____ ___________ @ @ _____________ | | |Gain (%-4d)| | @ @ | |Gain (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_Gain[API_AUDIO_CUSTOMER_FWM_INPUT_CH6] , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_Gain );
29237 AU_nPRINT("| 4 | |ADEC_ATV | @ @ |CH8 Sound | | | |Mute (%-4d)| | @ @ | |GainComp (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH6] , (int)pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_1_Out );
29238 AU_nPRINT("|ATV |======>|-----------|==>@ @ |=>|(DMA) | | | |------------| | @ @ | |Mute (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line1_bMute );
29239 AU_nPRINT("|_____| |Input(%-4d)| @ @ | |-------------|.. | |CH7 | | @ @ | |_______________| | \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_Connect);
29240 AU_nPRINT(" |ID (%-4d)| @ @ | |Input (%-4d)| | |Input(%-4d) | | @ @ | _______________ | \n", (int)pstAudioCustomerShmData->g_audio_customer_ADEC_ATV_DecID , (int)pstAudioCustomerShmData->g_audio_customer_CH8_Sound_Connect , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Connect[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] );
29241 AU_nPRINT(" |___________| @ @ | |inDelay(%-4d)| | |Gain (%-4d) | | @ @ | |Line2 | | \n" , (int)pstAudioCustomerShmData->g_audio_customer_CH8_Sound_inDelay , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_Gain[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] );
29242 AU_nPRINT(" _____ @ @ | |_____________| | |Mute (%-4d) | | @ @ | |---------------| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] );
29243 AU_nPRINT("| 5 | @ @ | | |------------| | @ @ | |Input (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_Connect );
29244 AU_nPRINT("|HDMI |======================>@ @ | | |CH8 | | @ @ | |Gain (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_Gain );
29245 AU_nPRINT("|_____| @ @ | | |Input(%-4d) | | @ @ | |GainComp (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Connect[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] , (int)pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_2_Out );
29246 AU_nPRINT(" _____ @ @ @ | | |Gain (%-4d) | | @ @ | |Mute (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_Gain[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line2_bMute );
29247 AU_nPRINT("|Line | @@ @ @ | | |Mute (%-4d) | | @ @ | |_______________| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] );
29248 AU_nPRINT("|In-0 |=>@ @ @ @ | | |____________| | @ @ | _______________ | \n" );
29249 AU_nPRINT("|-----| @ @ @ @ | | | | @ @ | |Line3 | | \n" );
29250 AU_nPRINT("|Line | @ @ @ @ | | ______|_____ | @ @ | |---------------| | \n");
29251 AU_nPRINT("|In-1 |=>@ @ ___________ @ @ | | |Delay0 | | @ @ | |Input (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_Connect );
29252 AU_nPRINT("|-----| @ @ |ADC0 | @ @ | | |(DLY0) |====>@ @ | |Gain (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_Gain );
29253 AU_nPRINT("|Line | @ @=>|-----------|==>@ @ | | |PATH ? | | @ @ | |GainComp (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_LINE_3_Out );
29254 AU_nPRINT("|In-2 |=>@ @ |Input(%-4d)| @ @ | | |------------| | @ @ | |Mute (%-4d)| | \n", (int)pstAudioCustomerShmData->g_audio_customer_ADC0_Connect , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_Line3_bMute );
29255 AU_nPRINT("|-----| @ @ | | @ @ | | |Delay (%-4d)| | @ @ | |_______________| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer0_Channel_Delay );
29256 AU_nPRINT("|Line | @ @ |___________| @ @ | | |____________| | @ @ | | \n");
29257 AU_nPRINT("|In-3 |=>@ @ @ @ | | : | @ @ | _______________ | \n");
29258 AU_nPRINT("|-----| @ @ ___________ @ @ | | : | @ @ | |SPDIF | | \n");
29259 AU_nPRINT("|Line | @ @ |ADC1 | @ @ | | ..........: | @ @ | |---------------| | \n");
29260 AU_nPRINT("|In-4 |=>@ @ |-----------|==>@ @ | | : ____________ | @ @ | |Input (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_Connect );
29261 AU_nPRINT("|-----| @ @=>|Input(%-4d)| @ @ | | : |FW Mixer1 | | @ @ | |Gain (%-4d)| | \n", (int)pstAudioCustomerShmData->g_audio_customer_ADC1_Connect , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_Gain );
29262 AU_nPRINT("|Line | @ @ | | @ @ | | : |(FWM1) |====>@ @ | |GainComp (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_SPDIF_Out );
29263 AU_nPRINT("|In-5 |=>@ @ |___________| @ @ | | : |PATH ? | | @ @ | |Mute (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_bMute );
29264 AU_nPRINT("|-----| @ @ @ @ | | : |------------| | @ @ | |UpperDly (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_UpperDelay );
29265 AU_nPRINT("|Mic | @ @ @ @ | | : |CH5 | | @ @ | |DriverDly(%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_SPDIF_DriverDelay );
29266 AU_nPRINT("|In |=>@ @ @ @ | | : |C[CH5](%-4d)| | @ @ | |Mode (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Connect[API_AUDIO_CUSTOMER_FWM_INPUT_CH5] , (int)pstAudioCustomerShmData->g_audio_customer_SPDIF_TX_UpperOutputType );
29267 AU_nPRINT("|_____| @@ @ @ | | : |Gain (%-4d)| | @ @ | |fg (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Channel_Gain[API_AUDIO_CUSTOMER_FWM_INPUT_CH5] , (int)pstAudioCustomerShmData->g_audio_customer_MainDecoderOutput );
29268 AU_nPRINT(" @ @ @ | | : |Mute (%-4d)| | @ @ | |_______________| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Channel_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH5] );
29269 AU_nPRINT(" _____ @ @ | | : |------------| | @ @ | _______________ | \n" );
29270 AU_nPRINT("| | @ @ | | : |CH6 | | @ @ | |ARC | | \n" );
29271 AU_nPRINT("|SCART|======================>@ @ | | : |C[CH6](%-4d)| | @ @ | |---------------| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Connect[API_AUDIO_CUSTOMER_FWM_INPUT_CH6] );
29272 AU_nPRINT("|_____| @ @ | | : |Gain (%-4d)| | @ @ | |Mode (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Channel_Gain[API_AUDIO_CUSTOMER_FWM_INPUT_CH6] , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_ARC_mode );
29273 AU_nPRINT(" __________ @ @ | | : |Mute (%-4d)| | @ @ | |_______________| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Channel_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH6] );
29274 AU_nPRINT("|R2DMA_DSP1| @ @ | | : |------------| | @ @ | _______________ | \n");
29275 AU_nPRINT("|----------|=================>@ @ | | : |CH7 | | @ @ | |HDMI | | \n");
29276 AU_nPRINT("|bEn (%-4d)| @ @ | | : |Input(%-4d) | | @ @ | |---------------| | \n", (int)temp , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Connect[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] );
29277 AU_nPRINT("|__________| @ @ | | : |Gain (%-4d) | | @ @ | |Input (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Channel_Gain[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_Connect );
29278 AU_nPRINT(" __________ @ @ @ | | : |Mute (%-4d) | | @ @ | |Gain (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Channel_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_Gain );
29279 AU_nPRINT("|R2DMA_DSP3| @@ @ @ | | : |------------| | @ @ | |GainComp (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_internal_patch_HW_SRC_Gain_Compensate_HDMI_Out );
29280 AU_nPRINT("|----------|======>@ @ @ @ | | : |CH8 | | @ @ | |Mute (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_bMute );
29281 AU_nPRINT("|bEn (%-4d)| @ @ @ @ | | : |Input(%-4d) | | @ @ | |UpperDly (%-4d)| | \n", (int)temp , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Connect[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_UpperDelay );
29282 AU_nPRINT("|__________| @ @ @ @ | | : |Gain (%-4d) | | @ @ | |DriverDly(%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Channel_Gain[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] , (int)pstAudioCustomerShmData->g_audio_customer_Sound_Out_HDMI_DriverDelay );
29283 AU_nPRINT(" __________ @ @=======>@ @ | | : |Mute (%-4d) | | @ @ | |Mode (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Channel_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] , (int)pstAudioCustomerShmData->g_audio_customer_HDMI_TX_UpperOutputType );
29284 AU_nPRINT("|SWDMA_DSP3| @ @ @ @ | | : |____________| | @ @ | |_______________| | \n");
29285 AU_nPRINT("|----------|======>@ @ @ @ | | : | | @ @ |___________________| \n");
29286 AU_nPRINT("|bEn (%-4d)| @ @ @ @ | | : ______|_____ | @ @ \n", (int)temp );
29287 AU_nPRINT("|__________| @@ @ @ | | : |Delay1 | | @ @ \n");
29288 AU_nPRINT(" @ @ @ | | : |(DLY1) |====>@ @ \n");
29289 AU_nPRINT(" @ @ | | : |PATH ? | | @ @ \n");
29290 AU_nPRINT(" @ @ | | : |------------| | @ @ \n");
29291 AU_nPRINT(" @ @ | | : |Delay (%-4d)| | @ @ \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer1_Channel_Delay );
29292 AU_nPRINT(" @ @ | | : |____________| | @ @ \n");
29293 AU_nPRINT(" @ @ @ | | : : | @ @ \n");
29294 AU_nPRINT(" __________ @@ @@ | | : : | @ @ \n");
29295 AU_nPRINT("|HWDMA_Read| @ @ @ | | : ........: | @ @ \n");
29296 AU_nPRINT("|----------|======>@ @ | | : : ____________ | @ @ \n");
29297 AU_nPRINT("|bEn (%-4d)| @ @ | | : :|FW Mixer2 | | @ @ \n", (int)temp );
29298 AU_nPRINT("|__________| @ @.............. | : :|(FWM2) |====>@ @ \n");
29299 AU_nPRINT(" @ @ | : :|PATH ? | | @ @ \n");
29300 AU_nPRINT(" @ @ | : :|------------| | @ @ \n");
29301 AU_nPRINT(" |===>@ @ | : :|CH5 | | @ @ \n");
29302 AU_nPRINT(" | @@ | : :|C[CH5](%-4d)| | @ @ \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Connect[API_AUDIO_CUSTOMER_FWM_INPUT_CH5] );
29303 AU_nPRINT(" | @ | : :|Gain (%-4d)| | @ @ \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Channel_Gain[API_AUDIO_CUSTOMER_FWM_INPUT_CH5] );
29304 AU_nPRINT(" | | : :|Mute (%-4d)| | @ @ \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Channel_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH5] );
29305 AU_nPRINT(" |____________ | : :|------------| | @ @ \n");
29306 AU_nPRINT(" | | : :|CH6 | | @ @ \n");
29307 AU_nPRINT(" | | : :|C[CH6](%-4d)| | @ @ \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Connect[API_AUDIO_CUSTOMER_FWM_INPUT_CH6] );
29308 AU_nPRINT(" | | : :|Gain (%-4d)| | @ @ \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Channel_Gain[API_AUDIO_CUSTOMER_FWM_INPUT_CH6] );
29309 AU_nPRINT(" | | : :|Mute (%-4d)| | @ @ \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Channel_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH6] );
29310 AU_nPRINT(" | | : :|------------| | @ @ \n");
29311 AU_nPRINT(" | | : :|CH7 | | @ @ \n");
29312 AU_nPRINT(" | | : :|Input(%-4d) | | @ @ \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Connect[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] );
29313 AU_nPRINT(" | | : :|Gain (%-4d) | | @ @ \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Channel_Gain[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] );
29314 AU_nPRINT(" | | : :|Mute (%-4d) | | @ @ \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Channel_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] );
29315 AU_nPRINT(" | | : :|------------| | @ @ \n");
29316 AU_nPRINT(" | | : :|CH8 | | @ @ \n");
29317 AU_nPRINT(" | | : :|Input(%-4d) | | @ @ \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Connect[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] );
29318 AU_nPRINT(" | | : :|Gain (%-4d) | | @ @ \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Channel_Gain[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] );
29319 AU_nPRINT(" | | : :|Mute (%-4d) | | @ @ \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Channel_bMute[API_AUDIO_CUSTOMER_FWM_INPUT_CH8] );
29320 AU_nPRINT(" | | : :|____________| | @ @ \n");
29321 AU_nPRINT(" | | : : | | @ @ \n");
29322 AU_nPRINT(" | | : : ______|_____ | @ @ \n");
29323 AU_nPRINT(" | | : :|Delay2 | | @ @ \n");
29324 AU_nPRINT(" | | : :|(DLY0) |====>@ @ \n");
29325 AU_nPRINT(" | | : :|PATH ? | | @ @ \n");
29326 AU_nPRINT(" | | : :|------------| | @ @ \n");
29327 AU_nPRINT(" | | : :|Delay (%-4d)| | @ @ \n" , (int)pstAudioCustomerShmData->g_audio_customer_FW_Mixer2_Channel_Delay );
29328 AU_nPRINT(" | | : :|____________| | @ @ \n");
29329 AU_nPRINT(" | | : : | | @ @ \n");
29330 AU_nPRINT(" | | : : | | @ @ \n");
29331 AU_nPRINT(" | | : : | | @ @ \n");
29332 AU_nPRINT(" | | : : | | @ @ \n");
29333 AU_nPRINT(" | | : : | | @ @ \n");
29334 AU_nPRINT(" | | : :....... | | @ @ \n");
29335 AU_nPRINT(" | | : | | | @ @ \n");
29336 AU_nPRINT(" | | : | | | @ @ \n");
29337 AU_nPRINT(" | | :...... | | | @ @ \n");
29338 AU_nPRINT(" | | | | | | @ @ \n");
29339 AU_nPRINT(" | |_______|__|__|______| @ @ \n");
29340 AU_nPRINT(" | | | | @ @ \n");
29341 AU_nPRINT(" | @@@@@@@@@@@@@@@ @ @ \n");
29342 AU_nPRINT(" | @ @ @ @ \n");
29343 AU_nPRINT(" | @@@@@@@@@@@ @ @ \n");
29344 AU_nPRINT(" | ________|______ @ @ \n");
29345 AU_nPRINT(" | |Audio | @ @ \n");
29346 AU_nPRINT(" | |Delay | @ @ \n");
29347 AU_nPRINT(" | |PATH 5 |====>@ @ \n");
29348 AU_nPRINT(" | |---------------| @ @ \n");
29349 AU_nPRINT(" | |UpperDly (%-4d)| @ @ \n" , (int)pstAudioCustomerShmData->g_audio_customer_SE_UpperDelay );
29350 AU_nPRINT(" | |DriverDly(%-4d)| @ @ \n" , (int)pstAudioCustomerShmData->g_audio_customer_SE_DriverDelay );
29351 AU_nPRINT(" | |_______________| @ @ \n");
29352 AU_nPRINT(" | |Sound | @ @ \n");
29353 AU_nPRINT(" | |Effect | @ @ \n");
29354 AU_nPRINT(" | |(PreR2) |====>@ @ \n");
29355 AU_nPRINT(" | |PATH ? | @ @ \n");
29356 AU_nPRINT(" | |---------------| @ @ \n");
29357 AU_nPRINT(" | |Input (%-4d) | @ @ \n" , (int)pstAudioCustomerShmData->g_audio_customer_SE_PreR2_Connect );
29358 AU_nPRINT(" | |_______________| @ @ \n");
29359 AU_nPRINT(" | |Sound | @ @ \n");
29360 AU_nPRINT(" | |Effect | @ @ \n");
29361 AU_nPRINT(" | |(DSPSE) |====>@ @ \n");
29362 AU_nPRINT(" | |PATH 6 | @ @ \n");
29363 AU_nPRINT(" | |---------------| @ @ \n");
29364 AU_nPRINT(" | |Input (%-4d) | @ @ \n" , (int)pstAudioCustomerShmData->g_audio_customer_SE_DspSE_Connect );
29365 AU_nPRINT(" | |_______________| @ @ \n");
29366 AU_nPRINT(" | |Sound | @ @ \n");
29367 AU_nPRINT(" | |Effect | @ @ \n");
29368 AU_nPRINT(" | |(PostR2) |====>@ @ \n");
29369 AU_nPRINT(" | |PATH ? | @ @ \n");
29370 AU_nPRINT(" | |---------------| @ @ \n");
29371 AU_nPRINT(" | |Input (%-4d) | @ @ \n" , (int)pstAudioCustomerShmData->g_audio_customer_SE_PostR2_Connect );
29372 AU_nPRINT(" | |_______________| @ @ \n");
29373 AU_nPRINT(" | @ @ \n");
29374 AU_nPRINT(" | @ @ \n");
29375 AU_nPRINT(" | @@ \n");
29376 AU_nPRINT(" | @ \n");
29377 AU_nPRINT(" | \n");
29378 AU_nPRINT(" | \n");
29379 AU_nPRINT(" ____________________ | \n");
29380 AU_nPRINT("| AMixer | | \n");
29381 AU_nPRINT("| ______________ | | \n");
29382 AU_nPRINT("| |AMIXER0 | | | \n");
29383 AU_nPRINT("| |--------------|==>| | \n");
29384 AU_nPRINT("| |C[AMIX0](%-4d)| | | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_Connect[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX0] );
29385 AU_nPRINT("| |ID (%-4d)| | | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_ID[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX0] );
29386 AU_nPRINT("| |Gain (%-4d)| | | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_Gain[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX0] );
29387 AU_nPRINT("| |Mute (%-4d)| | | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_bMute[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX0] );
29388 AU_nPRINT("| |______________| | | \n");
29389 AU_nPRINT("| ______________ | | \n");
29390 AU_nPRINT("| |AMIXER1 | | | \n");
29391 AU_nPRINT("| |--------------|==>| | \n");
29392 AU_nPRINT("| |C[AMIX1](%-4d)| | | @ __________________ \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_Connect[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX1] );
29393 AU_nPRINT("| |ID (%-4d)| | | @@ | PCM Capture | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_ID[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX1] );
29394 AU_nPRINT("| |Gain (%-4d)| | | ______________ @ @ | ______________ | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_Gain[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX1] );
29395 AU_nPRINT("| |Mute (%-4d)| | | |CH5 |==========>@ @ | |PCM Capture0 | | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_bMute[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX1] );
29396 AU_nPRINT("| |______________| | | |______________| @ @=>| |--------------| | \n");
29397 AU_nPRINT("| ______________ | | |CH6 |==========>@ @ | |Input (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_Connect );
29398 AU_nPRINT("| |AMIXER2 | | | |______________| @ @ | |bEn (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_bEnable );
29399 AU_nPRINT("| |--------------|==>| | |CH7 |==========>@ @ | |Gain (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_Gain );
29400 AU_nPRINT("| |C[AMIX2](%-4d)| | | |______________| @ @ | |Mute (%-4d)| | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_Connect[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX2] , (int)pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_bMute );
29401 AU_nPRINT("| |ID (%-4d)| | | |CH8 |==========>@ @ | |Delay (%-4d)| | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_ID[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX2] , (int)pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE0_Delay );
29402 AU_nPRINT("| |Gain (%-4d)| | | |______________| @ @ | |______________| | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_Gain[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX2] );
29403 AU_nPRINT("| |Mute (%-4d)| | | |PCM |==========>@ @ | | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_bMute[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX2] );
29404 AU_nPRINT("| |______________| | | |______________| @ @ | ______________ | \n");
29405 AU_nPRINT("| ______________ | | |PCM_Delay |==========>@ @ | |PCM Capture1 | | \n");
29406 AU_nPRINT("| |AMIXER3 | | | |______________| @ @=>| |--------------| | \n");
29407 AU_nPRINT("| |--------------|==>| | |PCM_SE |==========>@ @ | |Input (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE1_Connect );
29408 AU_nPRINT("| |C[AMIX3](%-4d)| | | |______________| @ @ | |bEn (%-4d)| | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_Connect[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX3] , (int)pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE1_bEnable );
29409 AU_nPRINT("| |ID (%-4d)| | | |MIXER |==========>@ @ | |Gain (%-4d)| | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_ID[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX3] , (int)pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE1_Gain );
29410 AU_nPRINT("| |Gain (%-4d)| | | |______________| @ @ | |Mute (%-4d)| | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_Gain[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX3] , (int)pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE1_bMute );
29411 AU_nPRINT("| |Mute (%-4d)| __|__ | |FWM0 |==========>@ @ | |Delay (%-4d)| | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_bMute[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX3] , (int)pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE1_Delay );
29412 AU_nPRINT("| |______________||PCM | | |______________| @ @ | |______________| | \n");
29413 AU_nPRINT("| ______________ |Mixer|..| |FWM1 |==========>@ @ | | \n");
29414 AU_nPRINT("| |AMIXER4 ||_____| |______________| @ @ | | \n");
29415 AU_nPRINT("| |--------------| | |FWM2 |==========>@ @ | | \n");
29416 AU_nPRINT("| |C[AMIX4](%-4d)|==>| |______________| @ @ | | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_Connect[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX4] );
29417 AU_nPRINT("| |ID (%-4d)| | @ @ | | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_ID[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX4] );
29418 AU_nPRINT("| |Gain (%-4d)| | @ @ | | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_Gain[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX4] );
29419 AU_nPRINT("| |Mute (%-4d)| | @ @ | | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_bMute[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX4] );
29420 AU_nPRINT("| |______________| | @ @ | | \n");
29421 AU_nPRINT("| ______________ | @ @ | | \n");
29422 AU_nPRINT("| |AMIXER5 | | @ @ | | \n");
29423 AU_nPRINT("| |--------------|==>| ___ @ @ @ | | \n");
29424 AU_nPRINT("| |C[AMIX5](%-4d)| | | | @@ ___________ @ @ | ______________ | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_Connect[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX5] );
29425 AU_nPRINT("| |ID (%-4d)| | |Ch5|=>@ @ |MP3_ENC | @ @ | |PCM Capture2 | | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_ID[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX5] );
29426 AU_nPRINT("| |Gain (%-4d)| | |___| @ @ |-----------| @ @ | |--------------| | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_Gain[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX5] );
29427 AU_nPRINT("| |Mute (%-4d)| | ___ @ @=>|Input(%-4d)|=>@ @=>| |Input (%-4d)| | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_bMute[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX5] , (int)pstAudioCustomerShmData->g_audio_customer_MP3_ENC_Connect , (int)pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE2_Connect );
29428 AU_nPRINT("| |______________| | | | @ @ |bEn (%-4d)| @ @ | |bEn (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_MP3_ENC_bEnable , (int)pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE2_bEnable );
29429 AU_nPRINT("| ______________ | |Ch6|=>@ @ |___________| @ @ | |Gain (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE2_Gain );
29430 AU_nPRINT("| |AMIXER6 | | |___| @@ @@ | |Mute (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE2_bMute );
29431 AU_nPRINT("| |--------------|==>| @ @ | |Delay (%-4d)| | \n" , (int)pstAudioCustomerShmData->g_audio_customer_PCM_CAPTURE2_Delay );
29432 AU_nPRINT("| |C[AMIX6](%-4d)| | | |______________| | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_Connect[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX6] );
29433 AU_nPRINT("| |ID (%-4d)| | | | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_ID[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX6] );
29434 AU_nPRINT("| |Gain (%-4d)| | |__________________| \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_Gain[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX6] );
29435 AU_nPRINT("| |Mute (%-4d)| | \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_bMute[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX6] );
29436 AU_nPRINT("| |______________| | ______________ @ \n");
29437 AU_nPRINT("| ______________ | | | @@ ______________ \n");
29438 AU_nPRINT("| |AMIXER7 | | |PCM Capture0 |=>@ @ |AENC_ENC | \n");
29439 AU_nPRINT("| |--------------|==>| |______________| @ @ |--------------| \n");
29440 AU_nPRINT("| |C[AMIX7](%-4d)| | ______________ @ @===>|Input (%-4d)| \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_Connect[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX7] , (int)pstAudioCustomerShmData->g_audio_customer_AAC_ENC_Connect );
29441 AU_nPRINT("| |ID (%-4d)| | | | @ @ |bEn (%-4d)| \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_ID[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX7] , (int)pstAudioCustomerShmData->g_audio_customer_AAC_ENC_bEnable );
29442 AU_nPRINT("| |Gain (%-4d)| | |PCM Capture 1 |=>@ @ |______________| \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_Gain[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX7] );
29443 AU_nPRINT("| |Mute (%-4d)| | |______________| @@ \n", (int)pstAudioCustomerShmData->g_audio_customer_PCM_Mixer_bMute[API_AUDIO_CUSTOMER_PCM_MIXER_INPUT_AMIX7] );
29444 AU_nPRINT("| |______________| | @ \n");
29445 AU_nPRINT("|____________________| \n");
29446 AU_nPRINT(" \n");
29447 AU_nPRINT(" \n");
29448 AU_nPRINT(" \n");
29449 AU_nPRINT(" \n");
29450 AU_nPRINT(" \n");
29451 AU_nPRINT(" \n");
29452 AU_nPRINT("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
29453 AU_nPRINT("\n\n\n\n\n");
29454 }
29455
AU_CUS_Command_Parser(audio_tunnel * pAudio_tunnel)29456 static EN_COMMNAD_INDEX AU_CUS_Command_Parser(audio_tunnel* pAudio_tunnel)
29457 {
29458 MS_U32 i = 0;
29459
29460 for(i = AU_DebugMenu_IDX; i < API_AUDIO_CUSTOMER_MAX_COMMNAD_IDX; i++)
29461 {
29462 if(strlen(pAudio_tunnel->name) != strlen(API_AUDIO_CUSTOMER_COMMNAD_INFO[i].cCommmandName))
29463 {
29464 continue;
29465 }
29466
29467 if(AU_CUS_strcmp(pAudio_tunnel->name, API_AUDIO_CUSTOMER_COMMNAD_INFO[i].cCommmandName, strlen(API_AUDIO_CUSTOMER_COMMNAD_INFO[i].cCommmandName)) == 0)
29468 {
29469 return API_AUDIO_CUSTOMER_COMMNAD_INFO[i].u32CommmandIndex;
29470 }
29471 }
29472
29473 AU_nPRINT("[A][%s] [%d] unsupport function\n", __FUNCTION__, __LINE__);
29474 return API_AUDIO_CUSTOMER_MAX_COMMNAD_IDX;
29475 }
29476
29477 /* Debug */
API_AUDIO_CUSTOMER_DebugMenu(void * pVoid,MS_BOOL scanf_bSupport)29478 void API_AUDIO_CUSTOMER_DebugMenu(void * pVoid, MS_BOOL scanf_bSupport)
29479 {
29480 API_AUDIO_CUSTOMER_DEBUG_PARAM *dbg_param_t;
29481 audio_tunnel* pAudio_tunnel_set_param;
29482 pAudio_tunnel_set_param = (audio_tunnel*)pVoid;
29483 dbg_param_t = (API_AUDIO_CUSTOMER_DEBUG_PARAM*)pAudio_tunnel_set_param->pdata;
29484 AU_UNUSED(dbg_param_t);
29485
29486 API_AUDIO_CUSTOMER_DEBUG_INFO *dbg_info_t;
29487 audio_tunnel* pAudio_tunnel_get_info;
29488 pAudio_tunnel_get_info = (audio_tunnel*)pVoid;
29489 dbg_info_t = (API_AUDIO_CUSTOMER_DEBUG_INFO*)pAudio_tunnel_get_info->pdata;
29490 AU_UNUSED(dbg_info_t);
29491
29492 #if 0
29493 AU_nPRINT("[AUDIO][%s] [%d] [param = %ld] [param2 = %ld] [param3 = %ld] [param4 = %ld] [param5 = %ld] [param6 = %ld] [param7 = %ld] [param8 = %ld] [param9 = %ld] [param10 = %ld]\n", __FUNCTION__, __LINE__,
29494 dbg_param_t->Dbg_Param,
29495 dbg_param_t->Dbg_Param2,
29496 dbg_param_t->Dbg_Param3,
29497 dbg_param_t->Dbg_Param4,
29498 dbg_param_t->Dbg_Param5,
29499 dbg_param_t->Dbg_Param6,
29500 dbg_param_t->Dbg_Param7,
29501 dbg_param_t->Dbg_Param8,
29502 dbg_param_t->Dbg_Param9,
29503 dbg_param_t->Dbg_Param10
29504 );
29505
29506 AU_nPRINT("[AUDIO][%s] [%d] [Info = %ld] [Info2 = %ld] [Info3 = %ld] [Info4 = %ld] [Info5 = %ld] [Info6 = %ld] [Info7 = %ld] [Info8 = %ld] [Info9 = %ld] [Info10 = %ld]\n", __FUNCTION__, __LINE__,
29507 dbg_info_t->Dbg_Info,
29508 dbg_info_t->Dbg_Info2,
29509 dbg_info_t->Dbg_Info3,
29510 dbg_info_t->Dbg_Info4,
29511 dbg_info_t->Dbg_Info5,
29512 dbg_info_t->Dbg_Info6,
29513 dbg_info_t->Dbg_Info7,
29514 dbg_info_t->Dbg_Info8,
29515 dbg_info_t->Dbg_Info9,
29516 dbg_info_t->Dbg_Info10
29517 );
29518 #endif
29519
29520 EN_COMMNAD_INDEX command_index = API_AUDIO_CUSTOMER_MAX_COMMNAD_IDX;
29521
29522 command_index = AU_CUS_Command_Parser(pAudio_tunnel_set_param);
29523 command_index = AU_CUS_Command_Parser(pAudio_tunnel_get_info);
29524
29525 AU_CUS_ShmInit();
29526 AU_CUS_Mutex_Init();
29527
29528 // For applications that don't use scanf, change the behavior so that
29529 // AU_CUS_DebugMenu() will sleep until new arguments from newly added API
29530 // API_AUDIO_CUSTOMER_DebugMenu_Non_Scanf_ParseCommand() become available.
29531 pstAudioCustomerShmData->g_audio_customer_scanf_bSupport = scanf_bSupport;
29532
29533 switch(command_index)
29534 {
29535 case AU_DebugMenu_IDX:
29536 {
29537 if(pstAudioCustomerShmData->g_audio_customer_scanf_bSupport == TRUE)
29538 {
29539 AU_CUS_DebugMenu();
29540 }
29541 else if(pstAudioCustomerShmData->g_audio_customer_scanf_bSupport == FALSE) //NON_SCANF version: Allow debug menu to work without scanf
29542 {
29543 AU_CUS_CreateDebugMenuThread();
29544 }
29545 }
29546 break;
29547
29548 default:
29549 break;
29550 }
29551 return;
29552 }
29553
API_AUDIO_CUSTOMER_DebugMenu_Non_Scanf_ParseCommand(char * cmdString)29554 void API_AUDIO_CUSTOMER_DebugMenu_Non_Scanf_ParseCommand(char *cmdString)
29555 {
29556
29557 #ifdef MSOS_TYPE_LINUX_KERNEL //Kernel Space
29558 //not support in Kernel Space
29559
29560 #else
29561 char *cmd;
29562 int index=0;
29563
29564 non_scanf_paramIdx = 0;
29565 non_scanf_paramsCount = 0;
29566 memset(non_scanf_params, 0, NON_SCANF_DEBUG_CMD_PARAMS_MAX);
29567 memset(non_scanf_paramsHex, 0, NON_SCANF_DEBUG_CMD_PARAMS_MAX);
29568 memset(non_scanf_paramsStr, 0, AU_DEBUG_INPUT_STR_LENGTH +1);
29569
29570 cmd = strtok(cmdString, ";");
29571 while(cmd != NULL)
29572 {
29573 if(cmd[0] < 0x30 || cmd[0] > 0x39) // not integer (0 ~ 9)
29574 {
29575 // store the str in global var, only one string is supported in the command so far.
29576 strcpy(non_scanf_paramsStr, cmd);
29577 AU_nPRINT("String: \033[0;33m %s \033[0m", non_scanf_paramsStr);
29578 }
29579 else
29580 {
29581 // parse the str in both decimal and heximal just in case
29582 non_scanf_params[index] = strtoul(cmd, (char**) NULL, 10);
29583 non_scanf_paramsHex[index] = strtoul(cmd, (char**) NULL, 16);
29584 }
29585 index++;
29586
29587 cmd = strtok(NULL, ";");
29588 if(index >= NON_SCANF_DEBUG_CMD_PARAMS_MAX)
29589 {
29590 break;
29591 }
29592 }
29593 non_scanf_paramsCount = index;
29594
29595 AU_nPRINT("\033[0;33m NON_SCANF: Parse debug command:");
29596 for(index = 0; index < non_scanf_paramsCount; index++)
29597 {
29598 AU_nPRINT("%d ", non_scanf_params[index]);
29599 }
29600 AU_nPRINT("\033[0m \n");
29601 #endif
29602 }
29603
API_AUDIO_CUSTOMER_Testing_7202(void * pVoid)29604 MS_BOOL API_AUDIO_CUSTOMER_Testing_7202(void * pVoid)
29605 {
29606 AU_CUS_Where_Am_I();
29607
29608 //================================================================================================
29609 // AUDIO_BLOCK_DIAGRAM
29610 //================================================================================================
29611 audio_tunnel* pAudio_tunnel_audio_block_diagram;
29612 pAudio_tunnel_audio_block_diagram = (audio_tunnel*)pVoid;
29613 int global_test = 1;
29614
29615 if(AU_CUS_strcmp(pAudio_tunnel_audio_block_diagram->name, "AUDIO_BLOCK_DIAGRAM", 19) == 0)
29616 {
29617 pAU_nDBG_Log_To_File = AU_CUS_FileOpen(AU_NDBG_LOG_TO_FILE_PATH, "wb");
29618 pAU_nDBG_MenuLog_To_File = AU_CUS_FileOpen(AU_NDBG_MENULOG_TO_FILE_PATH, "wb");
29619
29620 AU_CUS_ShowAudioBlockDiagram();
29621
29622 pstAudioCustomerShmData->g_audio_customer_bEnableNonThreadPrintMsg = TRUE;
29623 pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg = TRUE;
29624
29625 AU_nDBG("[global_test = 0x%x] \n", global_test);
29626 AU_nThreadDBG("[global_test = 0x%x] \n", global_test);
29627
29628 AU_CUS_SHOW_ALL_VERSION();
29629
29630 pstAudioCustomerShmData->g_audio_customer_bEnableNonThreadPrintMsg = FALSE;
29631 pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg = FALSE;
29632 AU_nDBG("[global_test = 0x%x] \n", global_test);
29633 AU_nThreadDBG("[global_test = 0x%x] \n", global_test);
29634 }
29635
29636 //================================================================================================
29637 // SET_PARAM_TEST
29638 //================================================================================================
29639 API_AUDIO_CUSTOMER_DEBUG_PARAM *dbg_param_t;
29640
29641 audio_tunnel* pAudio_tunnel_set_param;
29642 pAudio_tunnel_set_param = (audio_tunnel*)pVoid;
29643
29644 if(AU_CUS_strcmp(pAudio_tunnel_set_param->name, "SET_PARAM_TEST", 14) == 0)
29645 {
29646 dbg_param_t = (API_AUDIO_CUSTOMER_DEBUG_PARAM*)pAudio_tunnel_set_param->pdata;
29647
29648 AU_nPRINT("[AUDIO][%s] [%d] [param = %ld] [param2 = %ld] [param3 = %ld] [param4 = %ld] [param5 = %ld] [param6 = %ld] [param7 = %ld] [param8 = %ld] [param9 = %ld] [param10 = %ld]\n", __FUNCTION__, __LINE__,
29649 (long int)dbg_param_t->Dbg_Param,
29650 (long int)dbg_param_t->Dbg_Param2,
29651 (long int)dbg_param_t->Dbg_Param3,
29652 (long int)dbg_param_t->Dbg_Param4,
29653 (long int)dbg_param_t->Dbg_Param5,
29654 (long int)dbg_param_t->Dbg_Param6,
29655 (long int)dbg_param_t->Dbg_Param7,
29656 (long int)dbg_param_t->Dbg_Param8,
29657 (long int)dbg_param_t->Dbg_Param9,
29658 (long int)dbg_param_t->Dbg_Param10
29659 );
29660
29661 return TRUE;
29662 }
29663
29664 //================================================================================================
29665 // GET_INFO_TEST
29666 //================================================================================================
29667 API_AUDIO_CUSTOMER_DEBUG_INFO *dbg_info_t;
29668
29669 audio_tunnel* pAudio_tunnel_get_info;
29670 pAudio_tunnel_get_info = (audio_tunnel*)pVoid;
29671
29672 if(AU_CUS_strcmp(pAudio_tunnel_get_info->name, "GET_INFO_TEST", 13) == 0)
29673 {
29674 dbg_info_t = (API_AUDIO_CUSTOMER_DEBUG_INFO*)pAudio_tunnel_get_info->pdata;
29675
29676 dbg_info_t->Dbg_Info = 1;
29677 dbg_info_t->Dbg_Info2 = 2;
29678 dbg_info_t->Dbg_Info3 = 3;
29679 dbg_info_t->Dbg_Info4 = 4;
29680 dbg_info_t->Dbg_Info5 = 5;
29681 dbg_info_t->Dbg_Info6 = 6;
29682 dbg_info_t->Dbg_Info7 = 7;
29683 dbg_info_t->Dbg_Info8 = 8;
29684 dbg_info_t->Dbg_Info9 = 9;
29685 dbg_info_t->Dbg_Info10 = 10;
29686
29687 return TRUE;
29688 }
29689
29690 //================================================================================================
29691 // OPEN_AU_NDBG_LOG
29692 //================================================================================================
29693 audio_tunnel* pAudio_tunnel_open_au_ndbg_log;
29694 pAudio_tunnel_open_au_ndbg_log = (audio_tunnel*)pVoid;
29695
29696 if(AU_CUS_strcmp(pAudio_tunnel_open_au_ndbg_log->name, "OPEN_AU_NDBG_LOG", 16) == 0)
29697 {
29698 pAU_nDBG_Log_To_File = AU_CUS_FileOpen(AU_NDBG_LOG_TO_FILE_PATH, "wb");
29699 pAU_nDBG_MenuLog_To_File = AU_CUS_FileOpen(AU_NDBG_MENULOG_TO_FILE_PATH, "wb");
29700
29701 pstAudioCustomerShmData->g_audio_customer_bEnableNonThreadPrintMsg = TRUE;
29702 pstAudioCustomerShmData->g_audio_customer_bEnableThreadPrintMsg = TRUE;
29703 AU_nDBG("[global_test = 0x%x] \n", global_test);
29704 AU_nThreadDBG("[global_test = 0x%x] \n", global_test);
29705 }
29706
29707
29708 return TRUE;
29709 }
29710
29711
29712 //=====================================================================================================================================
29713 // HAL_AUDIO_DebugMenu End (debug menu Always put on the bottom)
29714 //=====================================================================================================================================
29715
29716 //------------------------------------------------------------------------------------------------
29717 //Bellow must be EMPTY!!!! DO NOT add any code!!!! (For Version Check)
29718 //------------------------------------------------------------------------------------------------
29719
29720 //0x9996
AU_CUS_SHOW_ALL_VERSION(void)29721 void AU_CUS_SHOW_ALL_VERSION(void)
29722 {
29723 AU_nPRINT("\n\n\n\n\n\n");
29724 AU_nPRINT("[---------------------------------------------]\n");
29725 AU_nPRINT("[AUDIO].....ChipType......||[0x%-4X] ||]\n", AUDIO_CHIP_TYPE);
29726 AU_CUS_WriteAbsReg(REG_BANK_ADEC_DSP_DBG, 0x9000); AU_CUS_Delay1MS(100); //100ms
29727 AU_nPRINT("[AUDIO_9000]ADEC-DSP(9000)||[0x%-4X][0x%-4X]||]\n", AU_CUS_ReadAbsReg(REG_BANK_ADEC_DSP_RESULT1), AU_CUS_ReadAbsReg(REG_BANK_ADEC_DSP_RESULT2)); AU_CUS_Delay1MS(100); //100ms
29728 AU_CUS_WriteAbsReg(REG_BANK_ADEC_DSP_DBG, 0x9100); AU_CUS_Delay1MS(100); //100ms
29729 AU_nPRINT("[AUDIO_9100]ADEC-DSP(9100)||[0x%-4X][0x%-4X]||]\n", AU_CUS_ReadAbsReg(REG_BANK_ADEC_DSP_RESULT1), AU_CUS_ReadAbsReg(REG_BANK_ADEC_DSP_RESULT2)); AU_CUS_Delay1MS(100); //100ms
29730 AU_CUS_WriteAbsReg(REG_BANK_ADEC_DSP_DBG, 0x9200); AU_CUS_Delay1MS(100); //100ms
29731 AU_nPRINT("[AUDIO_9200]ADEC-DSP(9200)||[0x%-4X][0x%-4X]||]\n", AU_CUS_ReadAbsReg(REG_BANK_ADEC_DSP_RESULT1), AU_CUS_ReadAbsReg(REG_BANK_ADEC_DSP_RESULT2)); AU_CUS_Delay1MS(100); //100ms
29732 AU_CUS_WriteAbsReg(REG_BANK_ASND_DSP_DBG, 0x9000); AU_CUS_Delay1MS(100); //100ms
29733 AU_nPRINT("[AUDIO_9000]SE-DSP(9000) ||[0x%-4X][0x%-4X]||]\n", AU_CUS_ReadAbsReg(REG_BANK_ASND_DSP_RESULT1), AU_CUS_ReadAbsReg(REG_BANK_ASND_DSP_RESULT2)); AU_CUS_Delay1MS(100); //100ms
29734 AU_CUS_WriteAbsReg(REG_BANK_ASND_DSP_DBG, 0x9100); AU_CUS_Delay1MS(100); //100ms
29735 AU_nPRINT("[AUDIO_9100]SE-DSP(9100) ||[0x%-4X][0x%-4X]||]\n", AU_CUS_ReadAbsReg(REG_BANK_ASND_DSP_RESULT1), AU_CUS_ReadAbsReg(REG_BANK_ASND_DSP_RESULT2)); AU_CUS_Delay1MS(100); //100ms
29736 AU_CUS_WriteAbsReg(REG_BANK_ASND_DSP_DBG, 0x9200); AU_CUS_Delay1MS(100); //100ms
29737 AU_nPRINT("[AUDIO_9200]SE-DSP(9200) ||[0x%-4X][0x%-4X]||]\n", AU_CUS_ReadAbsReg(REG_BANK_ASND_DSP_RESULT1), AU_CUS_ReadAbsReg(REG_BANK_ASND_DSP_RESULT2)); AU_CUS_Delay1MS(100); //100ms
29738 AU_nPRINT("[AUDIO].....DEC-R2........||[0x%-4X] ||]\n", AU_CUS_ReadAbsReg(REG_BANK_DEC_R2_VERSION) ); AU_CUS_Delay1MS(100); //100ms
29739 AU_nPRINT("[AUDIO].....SE-R2.........||[0x%-4X] ||]\n", AU_CUS_ReadAbsReg(REG_BANK_SND_R2_VERSION) ); AU_CUS_Delay1MS(100); //100ms
29740 AU_nPRINT("[AUDIO].....VERSION.......||[0x%-4X][0x%-4X]||]\n", __LINE__, AU_VERSION);
29741 AU_nPRINT("[---------------------------------------------]\n\n\n\n\n\n");
29742 }
29743 //------------------------------------------------------------------------------------------------
29744 //Bellow must be EMPTY!!!! DO NOT add any code!!!! (For Version Check)
29745 //------------------------------------------------------------------------------------------------
29746
29747 #endif // #ifdef ROLLS_ROYCE
29748