SACD_dbg.c
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:3k
- /*
- File: SACD_dbg.c
- Desc: Implementation files for SACD debug functions.
- Author: Jerry CAI
- ZORAN China
- Created on: Sep 4, 2003
- */
- #include "config.h"
- #include "includesysdefs.h"
- #include "playcoresampsamp_gen.h"
- #include "Playcoretimingtiming.h"
- #include "cpuv186tserio.h"
- #if D_SUPPORT_SACD
- SAMP(ErrCode) SAMP(DAC_Init)(void)
- {
- //DAC_Initialize_For_SACD();
- return SAMP(ERR_OK);
- }
- /*
- Desc: called at the end of SACD playback. Restore audio DAC for playing medias other than SACD.
- */
- SAMP(ErrCode) SAMP(DAC_Term)(void)
- {
- DAC_Initialize();
- return SAMP(ERR_OK);
- }
- /*
- Desc: Inform audio DAC about the audio format. Audio DAC is often adaptive so there is nothing to do.
- input: UINT32 streamType6ch, streamType2ch, 0=DSD, 1=PCM (AV2188 support PCM input only).
- UINT32 pcmUpsampling6ch, pcmUpsampling2ch. PCM only1 = 1fs 2 = 2fs 4 = 4fs (AV2188 is adaptive)
- UINT32 baseFrequency, 44, 48, 96 (AV2188 is adaptive).
- */
- SAMP(ErrCode) SAMP(DAC_SetMode)(UINT32 streamType6ch, UINT32 pcmUpsampling6ch,
- UINT32 streamType2ch, UINT32 pcmUpsampling2ch, UINT32 baseFrequency)
- {
- #if 0
- if(0 == streamType6ch && 0 == streamType2ch)
- {
- DAC_SetMute(TRUE);
- return SAMP(ERR_INVALID_PARAM); //not support DSD
- }
- #endif
- return SAMP(ERR_OK);
- }
- SAMP(ErrCode) SAMP(UART_Init)(void)
- {
- return SAMP(ERR_OK);
- }
- SAMP(ErrCode) SAMP(UART_Term)(void)
- {
- return SAMP(ERR_OK);
- }
- /*
- UART_Read
- Desc: Read a message from UART with timeout.
- In: timeout, in centiseconds.
- Out: None
- Return: SAMP(ERR_OK) - operation successful.
- ERR_FAILED - Required number of bytes could not be read within given timeout.
- ERR_INVALID_PARAM - Invalid values specified for parameters.
- */
- SAMP(ErrCode) SAMP(UART_Read)(char* pBuff, UINT16 toRead, UINT16 timeout, UINT16* pNumRead)
- {
- UINT16 i;
- UINT32 ulStartTime, ulCurrTime;
- if(NULL == pBuff || 0 == toRead)
- {
- return SAMP(ERR_INVALID_PARAM);
- }
- ulStartTime= timing_get_clock();
- for(i = 0; i < toRead; i++)
- {
- //wait for a key hit until time out.
- while(0xffff != timeout && 0 == kbhit())
- {
- ulCurrTime= timing_get_clock();
- if(timeout < (timing_get_diff(ulStartTime, ulCurrTime)/10000))
- {
- *pNumRead = i;
- return SAMP(ERR_FAILED);
- }
- }
- pBuff[i] = Getch();
- }
- *pNumRead = toRead;
- return SAMP(ERR_OK);
- }
- /*
- UART_Write
- Desc: Write a message to UART with timeout.
- In: timeout, in centiseconds.
- Out: None
- Return: SAMP(ERR_OK) - operation successful.
- SAMP(ERR_FAILED) - Required number of bytes could not be written within given timeout.
- SAMP(ERR_INVALID_PARAM) - Invalid values specified for parameters.
- */
- SAMP(ErrCode) SAMP(UART_Write)(char* pBuff, UINT16 toWrite, UINT16 timeout, UINT16* pNumWritten)
- {
- UINT16 i;
- UINT32 ulStartTime, ulCurrTime;
- if(NULL == pBuff || 0 == toWrite)
- {
- return SAMP(ERR_INVALID_PARAM);
- }
- ulStartTime= timing_get_clock();
- for(i = 0; i < toWrite; i++)
- {
- //check time out.
- ulCurrTime= timing_get_clock();
- if(timeout < (timing_get_diff(ulStartTime, ulCurrTime)/10000))
- {
- *pNumWritten = i;
- return SAMP(ERR_FAILED);
- }
- Putch(pBuff[i]);
- }
- *pNumWritten = toWrite;
- return SAMP(ERR_OK);
- }
- #endif