source.c
来自「很难得的最好的rtd3523系列原厂源码LCD驱动开发」· C语言 代码 · 共 656 行 · 第 1/2 页
C
656 行
//----------------------------------------------------------------------------------------------------
// ID Code : Source.c No.0002
// Update Note :
//
//----------------------------------------------------------------------------------------------------
#define __SOURCE__
#include "..\Header\Include.h"
//--------------------------------------------------
// Description : Scan all input port and select active port
// Input Value : None
// Output Value : Return _TRUE if the selected input source is exist
//--------------------------------------------------
bit CSourceHandler(void)
{
#if (_SOURCE_AUTOCHANGE_ENABLE == _TRUE)
BYTE cnt;
CSourceScanInputPort(); //set signal available in InputPortInfo[x]
CSourceSelectInputPort();
for(cnt=_INPUT_PORT_0;cnt<_INPUT_PORT_MAX;cnt++)
{
if(GET_INPUTSIGNAL_AVAILABLE(cnt) && GET_INPUTPORT_SELECT(cnt))
{
stSystemData.InputSource = cnt;
return _TRUE;
}
}
return _FALSE;
#else //x.hu, mannul source change
CSourceScanInputPort(); //set signal available or not in InputPortInfo[x]
CSourceSelectInputPort(); //set current port to be select, clr others
if(GET_INPUTSIGNAL_AVAILABLE(stSystemData.InputSource) && GET_INPUTPORT_SELECT(stSystemData.InputSource)) {
return _TRUE;
}
return _FALSE;
#endif //end of #if (_SOURCE_AUTOCHANGE_ENABLE == _TRUE)
}
//--------------------------------------------------
// Description : Initial input port setting, we have to run this at firmware startup
// Input Value : None
// Output Value : None
//--------------------------------------------------
void CSourceInitialInputPort(void)
{
BYTE cnt;
#if (_SOURCE_AUTOCHANGE_ENABLE == _TRUE)
SET_INPUTSYNC_TYPE(_NO_SYNC_STATE);
for(cnt=_INPUT_PORT_0;cnt<_INPUT_PORT_MAX;cnt++)
{
CLR_INPUTPORT_SELECT(cnt);
CLR_INPUTSIGNAL_AVAILABLE(cnt);
switch(cnt)
{
case _INPUT_PORT_0:
SET_INPUTPORT_TYPE(cnt, _INPUT_PORT_TYPE_0);
break;
case _INPUT_PORT_1:
SET_INPUTPORT_TYPE(cnt, _INPUT_PORT_TYPE_1);
break;
case _INPUT_PORT_2:
SET_INPUTPORT_TYPE(cnt, _INPUT_PORT_TYPE_2);
break;
case _INPUT_PORT_3:
SET_INPUTPORT_TYPE(cnt, _INPUT_PORT_TYPE_3);
break;
}
}
#else //x.hu, mannul source change
SET_INPUTSYNC_TYPE(_NO_SYNC_STATE);
for(cnt=_INPUT_PORT_0;cnt<_INPUT_PORT_MAX;cnt++)
{
CLR_INPUTPORT_SELECT(cnt);
CLR_INPUTSIGNAL_AVAILABLE(cnt);
switch(cnt)
{
case _INPUT_PORT_0:
SET_INPUTPORT_TYPE(cnt, _INPUT_PORT_TYPE_0);
break;
case _INPUT_PORT_1:
SET_INPUTPORT_TYPE(cnt, _INPUT_PORT_TYPE_1);
break;
case _INPUT_PORT_2:
SET_INPUTPORT_TYPE(cnt, _INPUT_PORT_TYPE_2);
break;
case _INPUT_PORT_3:
SET_INPUTPORT_TYPE(cnt, _INPUT_PORT_TYPE_3);
break;
}
}
//x.hu, test to initial source select
//if (stSystemData.InputSource>=_INPUT_PORT_MAX)
// stSystemData.InputSource = _INPUT_PORT_0;
//SET_INPUTPORT_SELECT(stSystemData.InputSource);
#endif //end of #if (_SOURCE_AUTOCHANGE_ENABLE == _TRUE)
}
//--------------------------------------------------
// Description : Check connect pin and scan all input port to obtain if the signal is available
// Input Value : None
// Output Value : None
//--------------------------------------------------
void CSourceScanInputPort(void)//Update by Realtek at 20050617
{
#if (_SOURCE_AUTOCHANGE_ENABLE == _TRUE)
/*
BYTE cnt;
for(cnt=_INPUT_PORT_0;cnt<_INPUT_PORT_MAX;cnt++)
{
switch(GET_INPUTPORT_TYPE(cnt))
{
#if(_YPBPR_SUPPORT == _ON)
case _YPBPR_A0_PORT:
#endif
case _DSUB_A0_PORT:
if(CSourceScanInputPortVGA(_ANALOG_SOURCE_0))
{
if((bit)CScalerGetBit(_SYNC_SELECT_47, _BIT4))
SET_INPUT_HS_SELECTION(cnt);
else
CLR_INPUT_HS_SELECTION(cnt);
SET_INPUTSIGNAL_AVAILABLE(cnt);
}
else
CLR_INPUTSIGNAL_AVAILABLE(cnt);
break;
#if(_YPBPR_SUPPORT == _ON)
case _YPBPR_A1_PORT:
#endif
case _DSUB_A1_PORT:
if(CSourceScanInputPortVGA(_ANALOG_SOURCE_1))
{
if((bit)CScalerGetBit(_SYNC_SELECT_47, _BIT4))
SET_INPUT_HS_SELECTION(cnt);
else
CLR_INPUT_HS_SELECTION(cnt);
SET_INPUTSIGNAL_AVAILABLE(cnt);
}
else
CLR_INPUTSIGNAL_AVAILABLE(cnt);
break;
#if(_TMDS_SUPPORT == _ON)
case _DVI_PORT:
if(CSourceScanInputPortDVI(_DE_ONLY_OFF))
SET_INPUTSIGNAL_AVAILABLE(cnt);
#if(_DVI_DE_ONLY_SUPPORT == _ON)
else if(CSourceScanInputPortDVI(_DE_ONLY_ON))
SET_INPUTSIGNAL_AVAILABLE(cnt);
#endif
else
CLR_INPUTSIGNAL_AVAILABLE(cnt);
break;
case _DVI_I_A0_PORT:
if(CSourceScanInputPortDVI(_DE_ONLY_OFF))
SET_INPUTSIGNAL_AVAILABLE(cnt);
#if(_DVI_DE_ONLY_SUPPORT == _ON)
else if(CSourceScanInputPortDVI(_DE_ONLY_ON))
SET_INPUTSIGNAL_AVAILABLE(cnt);
#endif
else if(CSourceScanInputPortVGA(_ANALOG_SOURCE_0))
{
if((bit)CScalerGetBit(_SYNC_SELECT_47, _BIT4))
SET_INPUT_HS_SELECTION(cnt);
else
CLR_INPUT_HS_SELECTION(cnt);
SET_INPUTSIGNAL_AVAILABLE(cnt);
}
else
CLR_INPUTSIGNAL_AVAILABLE(cnt);
break;
case _DVI_I_A1_PORT:
if(CSourceScanInputPortDVI(_DE_ONLY_OFF))
SET_INPUTSIGNAL_AVAILABLE(cnt);
#if(_DVI_DE_ONLY_SUPPORT == _ON)
else if(CSourceScanInputPortDVI(_DE_ONLY_ON))
SET_INPUTSIGNAL_AVAILABLE(cnt);
#endif
else if(CSourceScanInputPortVGA(_ANALOG_SOURCE_1))
{
if((bit)CScalerGetBit(_SYNC_SELECT_47, _BIT4))
SET_INPUT_HS_SELECTION(cnt);
else
CLR_INPUT_HS_SELECTION(cnt);
SET_INPUTSIGNAL_AVAILABLE(cnt);
}
else
CLR_INPUTSIGNAL_AVAILABLE(cnt);
break;
#endif
#if(_VIDEO_SUPPORT == _ON)
case _VIDEO_AV_PORT:
CVideoPowerState(_VIDEO_NORMAL);
CVideoDataEnable(_ENABLE);
if(CVideoIsExist(_AV_CHANNEL))
SET_INPUTSIGNAL_AVAILABLE(cnt);
else
CLR_INPUTSIGNAL_AVAILABLE(cnt);
break;
case _VIDEO_AV2_PORT:
CVideoPowerState(_VIDEO_NORMAL);
CVideoDataEnable(_ENABLE);
if(CVideoIsExist(_AV2_CHANNEL))
SET_INPUTSIGNAL_AVAILABLE(cnt);
else
CLR_INPUTSIGNAL_AVAILABLE(cnt);
break;
case _VIDEO_SV_PORT:
CVideoPowerState(_VIDEO_NORMAL);
CVideoDataEnable(_ENABLE);
if(CVideoIsExist(_SV_CHANNEL))
SET_INPUTSIGNAL_AVAILABLE(cnt);
else
CLR_INPUTSIGNAL_AVAILABLE(cnt);
break;
#endif
}
}
*/
//version 200D
BYTE cnt;
SET_INPUTSYNC_TYPE(_NO_SYNC_STATE);
for(cnt=_INPUT_PORT_0;cnt<_INPUT_PORT_MAX;cnt++)
{
CLR_INPUTPORT_SELECT(cnt);
CLR_INPUTSIGNAL_AVAILABLE(cnt);
switch(cnt)
{
case _INPUT_PORT_0:
SET_INPUTPORT_TYPE(cnt, _INPUT_PORT_TYPE_0);
break;
case _INPUT_PORT_1:
SET_INPUTPORT_TYPE(cnt, _INPUT_PORT_TYPE_1);
break;
case _INPUT_PORT_2:
SET_INPUTPORT_TYPE(cnt, _INPUT_PORT_TYPE_2);
break;
case _INPUT_PORT_3:
SET_INPUTPORT_TYPE(cnt, _INPUT_PORT_TYPE_3);
break;
}
}
#else //x.hu, mannul source change
BYTE channel;
if (stSystemData.InputSource >= _INPUT_PORT_MAX) {
stSystemData.InputSource = _INPUT_PORT_0;
CEepromSaveSystemData();
}
switch(GET_INPUTPORT_TYPE(stSystemData.InputSource))
{
#if(_YPBPR_SUPPORT == _ON)
case _YPBPR_A0_PORT:
#endif
case _DSUB_A0_PORT:
if(CSourceScanInputPortVGA(_ANALOG_SOURCE_0))
{
if((bit)CScalerGetBit(_SYNC_SELECT_47, _BIT4))
SET_INPUT_HS_SELECTION(stSystemData.InputSource);
else
CLR_INPUT_HS_SELECTION(stSystemData.InputSource);
SET_INPUTSIGNAL_AVAILABLE(stSystemData.InputSource);
}
else
CLR_INPUTSIGNAL_AVAILABLE(stSystemData.InputSource);
break;
#if(_YPBPR_SUPPORT == _ON)
case _YPBPR_A1_PORT:
#endif
case _DSUB_A1_PORT:
if(CSourceScanInputPortVGA(_ANALOG_SOURCE_1))
{
if((bit)CScalerGetBit(_SYNC_SELECT_47, _BIT4))
SET_INPUT_HS_SELECTION(stSystemData.InputSource);
else
CLR_INPUT_HS_SELECTION(stSystemData.InputSource);
SET_INPUTSIGNAL_AVAILABLE(stSystemData.InputSource);
}
else
CLR_INPUTSIGNAL_AVAILABLE(stSystemData.InputSource);
break;
#if(_TMDS_SUPPORT == _ON)
case _DVI_PORT:
if(CSourceScanInputPortDVI(_DE_ONLY_OFF))
SET_INPUTSIGNAL_AVAILABLE(stSystemData.InputSource);
#if(_DVI_DE_ONLY_SUPPORT == _ON)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?