📄 cddsp_d.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 + -