SACD_dbg.c
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:3k
源码类别:

DVD

开发平台:

Others

  1. /*
  2. File: SACD_dbg.c
  3. Desc: Implementation files for SACD debug functions.
  4. Author: Jerry CAI
  5.         ZORAN China
  6. Created on: Sep 4, 2003
  7. */
  8. #include "config.h"
  9. #include "includesysdefs.h"
  10. #include "playcoresampsamp_gen.h"
  11. #include "Playcoretimingtiming.h"
  12. #include "cpuv186tserio.h"
  13. #if D_SUPPORT_SACD
  14. SAMP(ErrCode) SAMP(DAC_Init)(void)
  15. {
  16.   //DAC_Initialize_For_SACD();
  17.   return SAMP(ERR_OK);
  18. }
  19. /*
  20. Desc: called at the end of SACD playback. Restore audio DAC for playing medias other than SACD.
  21. */
  22. SAMP(ErrCode) SAMP(DAC_Term)(void)
  23. {
  24.   DAC_Initialize();
  25.   return SAMP(ERR_OK);
  26. }
  27. /*
  28. Desc: Inform audio DAC about the audio format. Audio DAC is often adaptive so there is nothing to do.
  29. input:  UINT32 streamType6ch, streamType2ch, 0=DSD, 1=PCM (AV2188 support PCM input only).
  30.         UINT32 pcmUpsampling6ch, pcmUpsampling2ch. PCM only1 = 1fs 2 = 2fs 4 = 4fs (AV2188 is adaptive)
  31.         UINT32 baseFrequency, 44, 48, 96 (AV2188 is adaptive).
  32. */
  33. SAMP(ErrCode) SAMP(DAC_SetMode)(UINT32 streamType6ch, UINT32 pcmUpsampling6ch,
  34.                     UINT32 streamType2ch, UINT32 pcmUpsampling2ch, UINT32 baseFrequency)
  35. {
  36. #if 0
  37.   if(0 == streamType6ch && 0 == streamType2ch)
  38.   {
  39.    DAC_SetMute(TRUE);
  40.    return SAMP(ERR_INVALID_PARAM); //not support DSD
  41.   }
  42. #endif
  43.   return SAMP(ERR_OK);
  44. }
  45. SAMP(ErrCode) SAMP(UART_Init)(void)
  46. {
  47.   return SAMP(ERR_OK);
  48. }
  49. SAMP(ErrCode) SAMP(UART_Term)(void)
  50. {
  51.   return SAMP(ERR_OK);
  52. }
  53. /*
  54. UART_Read
  55. Desc: Read a message from UART with timeout.
  56. In: timeout, in centiseconds.
  57. Out: None
  58. Return: SAMP(ERR_OK) - operation successful.
  59.         ERR_FAILED - Required number of bytes could not be read within given timeout.
  60.         ERR_INVALID_PARAM - Invalid values specified for parameters.
  61. */
  62. SAMP(ErrCode) SAMP(UART_Read)(char* pBuff, UINT16 toRead, UINT16 timeout, UINT16*  pNumRead)
  63. {
  64. UINT16 i;
  65.    UINT32 ulStartTime, ulCurrTime;
  66.    if(NULL == pBuff || 0 == toRead)
  67.    {
  68.      return SAMP(ERR_INVALID_PARAM);
  69.    }
  70.    ulStartTime= timing_get_clock();
  71.    for(i = 0; i < toRead; i++)
  72.    {
  73.       //wait for a key hit until time out.
  74.     while(0xffff != timeout && 0 == kbhit())
  75.       {
  76.        ulCurrTime= timing_get_clock();
  77.        if(timeout < (timing_get_diff(ulStartTime, ulCurrTime)/10000))
  78.        {
  79.         *pNumRead = i;
  80.         return SAMP(ERR_FAILED);
  81.        }
  82.       }
  83.       pBuff[i] = Getch();
  84.    }
  85.    *pNumRead = toRead;
  86.    return SAMP(ERR_OK);
  87. }
  88. /*
  89. UART_Write
  90. Desc: Write a message to UART with timeout.
  91. In: timeout, in centiseconds.
  92. Out: None
  93. Return: SAMP(ERR_OK) - operation successful.
  94.         SAMP(ERR_FAILED) - Required number of bytes could not be written within given timeout.
  95.         SAMP(ERR_INVALID_PARAM) - Invalid values specified for parameters.
  96. */
  97. SAMP(ErrCode) SAMP(UART_Write)(char* pBuff, UINT16 toWrite, UINT16 timeout, UINT16*  pNumWritten)
  98. {
  99. UINT16 i;
  100.    UINT32 ulStartTime, ulCurrTime;
  101.    if(NULL == pBuff || 0 == toWrite)
  102.    {
  103.      return SAMP(ERR_INVALID_PARAM);
  104.    }
  105.    ulStartTime= timing_get_clock();
  106.    for(i = 0; i < toWrite; i++)
  107.    {
  108.        //check time out.
  109.        ulCurrTime= timing_get_clock();
  110.        if(timeout < (timing_get_diff(ulStartTime, ulCurrTime)/10000))
  111.        {
  112.         *pNumWritten = i;
  113.         return SAMP(ERR_FAILED);
  114.        }
  115.       Putch(pBuff[i]);
  116.    }
  117.    *pNumWritten = toWrite;
  118.    return SAMP(ERR_OK);
  119. }
  120. #endif