📄 hal1.c
字号:
_WriteTVEGainWithChromPhase(GAIN_YC, 0x4764, 0x0054); //Kevin1.25, add
_WriteTVEGainWithChromPhase(GAIN_CAV, 0x1ce1, 0x10a4); //Kevin1.25, add
#endif
W99AV_WriteTVERegDW(FAIN_G, 0x3772, 0x0000);
break;
}
#endif //#ifdef SUPPORT_NTSC443
break;
case SETUP_SCREEN_TV_SYSTEM_PAL:
switch (_bVideoOutput)
{
case SETUP_SCREEN_VIDEO_OUTPUT_NORMAL:
W99AV_WriteTVERegDW(TVE_CR0, 0x0080, 0x0200);
#ifdef SUPPORT_2_CVBS
W99AV_WriteTVERegDW(TVE_CR1, 0x2000, 0x0000);
#else //Kevin1.05, turn off AVO0
W99AV_WriteTVERegDW(TVE_CR1, 0x2400, 0x0000);
#endif
#ifndef SUPPORT_ADJUST_CHROM_PHASE
//Kevin1.23DMTech, based on Joie 2004/2/9
//W99AV_WriteTVERegDW(GAIN_YC, 0x4662, 0x0052); //without boost circuit
W99AV_WriteTVERegDW(GAIN_YC, 0x4866, 0x0052) ; //with boost circuit
#else
_WriteTVEGainWithChromPhase(GAIN_YC, 0x4866, 0x0052); //Kevin1.25, add
#endif
break;
case SETUP_SCREEN_VIDEO_OUTPUT_YUV:
W99AV_WriteTVERegDW(TVE_CR0, 0x0080, 0x0200);
W99AV_WriteTVERegDW(TVE_CR1, 0x2002, 0x0000);
#ifndef SUPPORT_ADJUST_CHROM_PHASE
W99AV_WriteTVERegDW(GAIN_YC, 0x4662, 0x0052);
W99AV_WriteTVERegDW(GAIN_CAV, 0xa0a0, 0x00a4);
#else
_WriteTVEGainWithChromPhase(GAIN_YC, 0x4662, 0x0052); //Kevin1.25, add
_WriteTVEGainWithChromPhase(GAIN_CAV, 0xa0a0, 0x00a4); //Kevin1.25, add
#endif
break;
case SETUP_SCREEN_VIDEO_OUTPUT_RGB:
#ifndef RGB_NO_SYNC_ON_G
W99AV_WriteTVERegDW(TVE_CR0, 0x0080, 0x0240);
#else //kevin2.39, for SCART Macrovision: RGB sync is on the composite line
W99AV_WriteTVERegDW(TVE_CR0, 0x0080, 0x0200);
#endif
W99AV_WriteTVERegDW(TVE_CR1, 0x2004, 0x0000);
#ifndef SUPPORT_ADJUST_CHROM_PHASE
W99AV_WriteTVERegDW(GAIN_YC, 0x4662, 0x0052);
W99AV_WriteTVERegDW(GAIN_CAV, 0x1ce1, 0x10a4);
#else
_WriteTVEGainWithChromPhase(GAIN_YC, 0x4662, 0x0052); //Kevin1.25, add
_WriteTVEGainWithChromPhase(GAIN_CAV, 0x1ce1, 0x10a4); //Kevin1.25, add
#endif
W99AV_WriteTVERegDW(FAIN_G, 0x3772, 0x0000);
break;
}
break;
case SETUP_SCREEN_TV_SYSTEM_PAL_M:
switch (_bVideoOutput)
{
case SETUP_SCREEN_VIDEO_OUTPUT_NORMAL:
W99AV_WriteTVERegDW(TVE_CR0, 0x0040, 0x0200);
#ifdef SUPPORT_2_CVBS
W99AV_WriteTVERegDW(TVE_CR1, 0x2000, 0x0000);
#else //Kevin1.05, turn off AVO0
W99AV_WriteTVERegDW(TVE_CR1, 0x2400, 0x0000);
#endif
#ifndef SUPPORT_ADJUST_CHROM_PHASE
W99AV_WriteTVERegDW(GAIN_YC, 0x4662, 0x0052);
#else
_WriteTVEGainWithChromPhase(GAIN_YC, 0x4662, 0x0052); //Kevin1.25, add
#endif
break;
case SETUP_SCREEN_VIDEO_OUTPUT_YUV:
W99AV_WriteTVERegDW(TVE_CR0, 0x0040, 0x0200);
W99AV_WriteTVERegDW(TVE_CR1, 0x2002, 0x0000);
#ifndef SUPPORT_ADJUST_CHROM_PHASE
W99AV_WriteTVERegDW(GAIN_YC, 0x4662, 0x0052);
W99AV_WriteTVERegDW(GAIN_CAV, 0xa0a0, 0x00a4);
#else
_WriteTVEGainWithChromPhase(GAIN_YC, 0x4662, 0x0052); //Kevin1.25, add
_WriteTVEGainWithChromPhase(GAIN_CAV, 0xa0a0, 0x00a4); //Kevin1.25, add
#endif
break;
case SETUP_SCREEN_VIDEO_OUTPUT_RGB:
#ifndef RGB_NO_SYNC_ON_G
W99AV_WriteTVERegDW(TVE_CR0, 0x0040, 0x0240);
#else //kevin2.39, for SCART Macrovision: RGB sync is on the composite line
W99AV_WriteTVERegDW(TVE_CR0, 0x0040, 0x0200);
#endif
W99AV_WriteTVERegDW(TVE_CR1, 0x2004, 0x0000);
#ifndef SUPPORT_ADJUST_CHROM_PHASE
W99AV_WriteTVERegDW(GAIN_YC, 0x4662, 0x0052);
W99AV_WriteTVERegDW(GAIN_CAV, 0x1ce1, 0x10a4);
#else
_WriteTVEGainWithChromPhase(GAIN_YC, 0x4662, 0x0052); //Kevin1.25, add
_WriteTVEGainWithChromPhase(GAIN_CAV, 0x1ce1, 0x10a4); //Kevin1.25, add
#endif
W99AV_WriteTVERegDW(FAIN_G, 0x3772, 0x0000);
break;
}
break;
case SETUP_SCREEN_TV_SYSTEM_PAL_N:
switch (_bVideoOutput)
{
case SETUP_SCREEN_VIDEO_OUTPUT_NORMAL:
W99AV_WriteTVERegDW(TVE_CR0, 0x00c0, 0x0200);
#ifdef SUPPORT_2_CVBS
W99AV_WriteTVERegDW(TVE_CR1, 0x2000, 0x0000);
#else //Kevin1.05, turn off AVO0
W99AV_WriteTVERegDW(TVE_CR1, 0x2400, 0x0000);
#endif
#ifndef SUPPORT_ADJUST_CHROM_PHASE
W99AV_WriteTVERegDW(GAIN_YC, 0x4662, 0x0052);
#else
_WriteTVEGainWithChromPhase(GAIN_YC, 0x4662, 0x0052); //Kevin1.25, add
#endif
break;
case SETUP_SCREEN_VIDEO_OUTPUT_YUV:
W99AV_WriteTVERegDW(TVE_CR0, 0x00c0, 0x0200);
W99AV_WriteTVERegDW(TVE_CR1, 0x2002, 0x0000);
#ifndef SUPPORT_ADJUST_CHROM_PHASE
W99AV_WriteTVERegDW(GAIN_YC, 0x4662, 0x0052);
W99AV_WriteTVERegDW(GAIN_CAV, 0xa0a0, 0x00a4);
#else
_WriteTVEGainWithChromPhase(GAIN_YC, 0x4662, 0x0052); //Kevin1.25, add
_WriteTVEGainWithChromPhase(GAIN_CAV, 0xa0a0, 0x00a4); //Kevin1.25, add
#endif
break;
case SETUP_SCREEN_VIDEO_OUTPUT_RGB:
#ifndef RGB_NO_SYNC_ON_G
W99AV_WriteTVERegDW(TVE_CR0, 0x00c0, 0x0240);
#else //kevin2.39, for SCART Macrovision: RGB sync is on the composite line
W99AV_WriteTVERegDW(TVE_CR0, 0x00c0, 0x0200);
#endif
W99AV_WriteTVERegDW(TVE_CR1, 0x2004, 0x0000);
#ifndef SUPPORT_ADJUST_CHROM_PHASE
W99AV_WriteTVERegDW(GAIN_YC, 0x4662, 0x0052);
W99AV_WriteTVERegDW(GAIN_CAV, 0x1ce1, 0x10a4);
#else
_WriteTVEGainWithChromPhase(GAIN_YC, 0x4662, 0x0052); //Kevin1.25, add
_WriteTVEGainWithChromPhase(GAIN_CAV, 0x1ce1, 0x10a4); //Kevin1.25, add
#endif
W99AV_WriteTVERegDW(FAIN_G, 0x3772, 0x0000);
break;
}
break;
}
}
//Kevin1.05, GPCR2 bit17: Hsync/Vsync signal for VGA
W99AV_WriteRegDW(GPCR2,LOWORD(__dwHAL1Temp), HIWORD(__dwHAL1Temp));
///// Macrovision /////
if(__SetupInfo.bProgressiveScan != SETUP_PROGRESSIVE_SCAN_ON) //Interlaced
{
if (!_bAPSType) // Disable Microvison
{
//Kevin1.24, move here to fix white horizontal line when NEXT
//tinhsun 2003/07/08
W99AV_WriteTVERegDW(MV0, 0x0000, 0x0000);
W99AV_WriteTVERegDW(MV4, 0x0000, 0x0000);
}
else if ( __bTVType == SETUP_SCREEN_TV_SYSTEM_NTSC)
{
switch(_bAPSType)
{
case 1: //NTSC AGC mode, Joie 2003/07/08
W99AV_WriteTVERegDW(MV0, 0x0036, 0x0000);
W99AV_WriteTVERegDW(MV1, 0x111D, 0x1125);
W99AV_WriteTVERegDW(MV2, 0x1B3C, 0x241B);
W99AV_WriteTVERegDW(MV3, 0x07F8, 0x0000);
W99AV_WriteTVERegDW(MV4, 0x0F0F, 0x0060);
W99AV_WriteTVERegDW(MV5, 0x2CA0, 0x03FF);
break;
case 2: //AGC+2 line colorstripe APS type2
W99AV_WriteTVERegDW(MV0, 0x003E, 0x0000);
W99AV_WriteTVERegDW(MV1, 0x111D, 0x1125);
W99AV_WriteTVERegDW(MV2, 0x1B3C, 0x241B);
W99AV_WriteTVERegDW(MV3, 0x07F8, 0x0000);
W99AV_WriteTVERegDW(MV4, 0x0F0F, 0x0160);
W99AV_WriteTVERegDW(MV5, 0x2CA0, 0x03FF);
break;
case 3: //AGC+4 line colorstripe APS type3
W99AV_WriteTVERegDW(MV0, 0x003E, 0x0000);
W99AV_WriteTVERegDW(MV1, 0x1517, 0x1521);
W99AV_WriteTVERegDW(MV2, 0x1BB6, 0x241B);
W99AV_WriteTVERegDW(MV3, 0x07F8, 0x0000);
W99AV_WriteTVERegDW(MV4, 0x0F0F, 0x0160);
W99AV_WriteTVERegDW(MV5, 0x2CA0, 0x03FF);
break;
}
}
else // for PAL mode
{
//PAL mode, Joie 2003/07/08
W99AV_WriteTVERegDW(MV0, 0x0036, 0x0000);
W99AV_WriteTVERegDW(MV1, 0x221A, 0x222A);
W99AV_WriteTVERegDW(MV2, 0x1CA8, 0x143D);
W99AV_WriteTVERegDW(MV3, 0x03FE, 0x0154);
W99AV_WriteTVERegDW(MV4, 0x7EFE, 0x0060);
W99AV_WriteTVERegDW(MV5, 0x2780, 0x0155);
}
}
else //Progressive Scan
{
//By Macrovison's email, P-scan are only allowed to be component (Y,Pb,Pr) and are only allowed to be 625 and 525 line standards
//908 TVE supports only 525p MV for P-scan
if (_bVideoOutput == SETUP_SCREEN_VIDEO_OUTPUT_YUV_PSCAN && __bTVType == SETUP_SCREEN_TV_SYSTEM_NTSC)
{
if (!_bAPSType) // Disable Microvison
{
//525p MV needs to set bit[12] mv_en only
_dwHALTemp=W99AV_ReadTVERegDW(TVE_CR1);
_dwHALTemp &= ~0x00001000;
W99AV_WriteTVERegDW(TVE_CR1, LOWORD(_dwHALTemp), HIWORD(_dwHALTemp));
}
else
{
//Kevin1.08, AGC amp cycling, but not fixed
W99AV_WriteTVERegDW(MV0, 0x0024, 0x0000);
//525p MV needs to set bit[12] mv_en only
_dwHALTemp=W99AV_ReadTVERegDW(TVE_CR1);
_dwHALTemp |= 0x00001000;
W99AV_WriteTVERegDW(TVE_CR1, LOWORD(_dwHALTemp), HIWORD(_dwHALTemp));
}
}
}
} //end of _TVModeSet()
void _TVEncoderOff (void)
{
// Chuan0.83, CT908 don't need to use I2C programming
W99AV_WriteTVERegDW(TVE_CR1, 0x0f00, 0x0000); //turn off 4 DACs
}
// ************TV encoder relative setting function part end*******************
//# [2-1]Audio DAC setting relative function begin
// *************************************************************************
// Function : _CheckDACAbility
// Description : Check DAC's ability and do relative setting, ex
// downsample/ PCM length
// Arguments : None
// Return : None
// Side Effect : _bSampleFreq value will be modified
// Notice : must set _bDownSample value if it need downsample
// *************************************************************************
//kevin908, comment
/*
void _CheckDACAbility(void)
{
// Step 0: default setting is None
_bDownSample=HAL_DOWNSAMPLE_NONE; // disable downsample action
#if AUDIO_DAC == DAC_W6630_ONLY
// Step 1: check DAC cability -- PCM Length
// W6630 only support 16/18/20 bit
// [1] Assume 24BIT/ 20BIT -------> 16BIT
if ( _bSampleFreq >= HAL_AUDIO_24BIT_16K )
{
_bSampleFreq= _bSampleFreq- HAL_AUDIO_24BIT_16K+ HAL_AUDIO_16BIT_16K;
}
else
if ( _bSampleFreq >= HAL_AUDIO_20BIT_16K )
{
_bSampleFreq= _bSampleFreq- HAL_AUDIO_20BIT_16K+ HAL_AUDIO_16BIT_16K;
}
// Step 2: check DAC cability -- Downsample
// W6630 only support 32/ 44.1/ 48K, and don't care setup setting
// [2] Assume 96K to 48K
if ( _bSampleFreq == HAL_AUDIO_16BIT_96K )
{
_bSampleFreq= HAL_AUDIO_16BIT_48K;
_bDownSample=HAL_DOWNSAMPLE_LPCM_96TO48; // enable downsample action
}
else
_bDownSample=HAL_DOWNSAMPLE_NONE; // disable downsample action
#endif // #ifdef AUDIO_DAC == DAC_W6630_ONLY
}
*/
//#######################################################################
// Function : _GetSampleFreq
// Description : Get sample frequency value for specify audio DAC
// Parameters :
// Return : None
// Side Effect :
//######################################################################
void _GetSampleFreq(BYTE bDACType, BYTE bSampleFreq)
{
switch(bDACType)
{
default:
case HAL_DAC_PCM1723:
case HAL_DAC_PCM1720:
// define for PCM 1723 Audio DAC programming
// register 2, for 16 bit word resolution, change bit(4,3) for the other resolution
// bit 4 3 word resolution
// 0 0 16 bit
// 0 1 20 bit
// 1 0 24 bit
// bit[10:9]=10 for register 2 ;
// bit[8:5]=1001 for audio output format is L,R => STEREO
// register 3, for 48k sample rate, change bit(7,4) for the other bit rate
// bit5 bit4 Multiple bit7 bit6 Sampling
// 0 0 Normal 32/44.1/48k 0 0 44.1k group
// 0 1 Double 64/88.2/96k 0 1 48k group
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -