⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cddsp_d.c

📁 这是一个VCD解码的学习资料,主要是CD SERVO 的一些源代码!以供大家参考!
💻 C
字号:
/*
** FILE 
** cddsp_d.c
**
** DESCRIPTION
** CDDSP detection
*/

#include "config.h"
#include "regmap.h"
#include "global.h"
#include "cdfunc.h"
#include "cdxa.h"

#include "user_init.h"

/*
** cddsp_detect()
**
** DESCRIPTION
** try to detect cddsp interface type
**
** METHOD/ALGORITHM:
** set drive to the table entries and try to see if it synced?
**
** *NOTE* 
*/
static	const	UINT16	cddsp_config_table[]	= 
{
  CDDSP_SONY_BASIC,
  CDDSP_I2S_BASIC,
  0,
};


#define	SetCDDSPConfig(c)	(regs0->cddsp_config = (c))
#define	ResetCDDSP()		(regs0->cddsp_control = RF_CDDSP_RESET | RF_CDDSP_STOP | RF_CDDSP_PAUSE)
#define	StartCDDSP()		(regs0->cddsp_control = 0)
#define SetCDDSPPointer(x,y)	{SET_CDDSP_VX(x); SET_CDDSP_VY(y);}

#define	CDDSP_DETECT_WAIT	(4*RTC_TICKS)	/* 4-seconds */


UINT32	cddsp_detect(void)
{
  int	i;

  UINT32 config;
  int	 done   = 0;

  if ((gettrkcna(1)&CNA_MASK_TYPE)!=CNA_DATA)
  {
    return CDDSP_CONFIG;
  }

  i = 0;
  do 
  {
    config = cddsp_config_table[i++];
    if (config==0) break;

    /*
    ** use 1st track to check
    */
    cd_func_playtrack(1);
    SetCDDSPConfig(config | RF_CD_DATA_descramble);
    ResetCDDSP();
    StartCDDSP();
    SetCDDSPPointer(0,0);

    /* wait for about 4 second */
    regs0->rtc_31_16 = 0;
    do
    {
      if (GET_CDDSP_VY()>0)
      {
	done = 1;
	break;
      }
    } while (regs0->rtc_15_0 < CDDSP_DETECT_WAIT); 
  } while (!done);

  /*
  ** if detect failed, fall back to default value
  */
  if (config==0)
  {
    config = CDDSP_CONFIG;
#ifdef	MONE_CDDSP_DETECT
    psprintf(linebuf, "CDDSP config fallback to default %04x\n", config);
    epp_write_slow(linebuf);
#endif
  }
  return config;
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -