📄 misc.c
字号:
//**********************************************************************************************************
// The Software is proprietary, confidential, and valuable to Realtek Semiconductor
// Corporation ("Realtek"). All rights, including but not limited to copyrights,
// patents, trademarks, trade secrets, mask work rights, and other similar rights and interests,
// are reserved to Realtek. Without prior written consent from Realtek, copying, reproduction,
// modification, distribution, or otherwise is strictly prohibited. The Software shall be
// kept strictly in confidence, and shall not be disclosed to or otherwise accessed by
// any third party. @ <2003> - <2008> The Software is provided "AS IS" without any warranty of any kind,
// express, implied, statutory or otherwise.
//**********************************************************************************************************
//----------------------------------------------------------------------------------------------------
// ID Code : Misc.c No.0000
// Update Note :
//----------------------------------------------------------------------------------------------------
#define __MISC__
#include "Common\Header\Include.h"
//Anderson 071219 for 2545LR, 248xRD, 248xRD
#if(_SCALER_SERIES_TYPE == _RTD2472D_SERIES)
//--------------------------------------------------
// Description : Language Index
// Input Value : None
// Output Value :
//--------------------------------------------------
void CMiscProtectLangauge(void)
{
BYTE Tmp = stGlobalData3.LanguageType;
#if(_OSD_TYPE == _BENQ_OSD)
if(stGlobalData0.Language > _PORTUGUESE_BENQ)
{
stGlobalData0.Language = _ENGLISH_BENQ;
}
if((stGlobalData0.Language >= _JAPAN_BENQ) && (stGlobalData0.Language <= _CHINESE_S_BENQ))
stGlobalData3.LanguageType = _EASTERN_LANGUAGE;
else
stGlobalData3.LanguageType = _WESTERN_LANGUAGE;
if(Tmp != stGlobalData3.LanguageType)
CEepromSaveGlobalData3();
#else//_GENERIC_OSD
if(stGlobalData0.Language == _LANGUAGE_AMOUNT_GENERIC)
{
stGlobalData0.Language=_ENGLISH_GENERIC;
}
#endif
}
//----------------------------------------------------------------------------------------------------
// Polling Events
//----------------------------------------------------------------------------------------------------
//--------------------------------------------------
// Description : Stable flag polling event
// Input Value : None
// Output Value : Return _TRUE if event occurs
//--------------------------------------------------
bit CMiscStableFlagPollingEvent(void)
{
if((bit)CScalerGetBit(_STABLE_MEASURE_4F, _BIT7))
{
return _TRUE;
}
else
{
return _FALSE;
}
}
//--------------------------------------------------
// Description : Hsync Type Detection Auto Run flag polling event
// Input Value : None
// Output Value : Return _TRUE if event occurs
//--------------------------------------------------
bit CMiscHsyncTypeAutoRunFlagPollingEvent(void)
{
if((bit)CScalerGetBit(_VSYNC_COUNTER_LEVEL_MSB_4C, _BIT7))
{
return _TRUE;
}
else
{
return _FALSE;
}
}
//--------------------------------------------------
// Description : Measure start/end polling event
// Input Value : None
// Output Value : Return _TRUE if measure finished
//--------------------------------------------------
bit CMiscModeMeasurePollingEvent(void)//cyyeh V008_20080806
{
if((bit)CScalerGetBit(_MEAS_HS_PERIOD_H_52, _BIT7))
{
if(!(bit)CScalerGetBit(_STABLE_PERIOD_H_50, _BIT7))
{
return _TRUE;
}
else
{
return _FALSE;
}
}
else
{
if(!(bit)CScalerGetBit(_MEAS_HS_PERIOD_H_52, _BIT5))
{
return _TRUE;
}
else
{
return _FALSE;
}
}
}
#if((_TMDS_SUPPORT == _ON) || (_HDMI_SUPPORT == _ON)||(_DP_SUPPORT == _ON))
//--------------------------------------------------
// Description : Auto measure start/end polling event
// Input Value : None
// Output Value : Return _TRUE if auto measure finished
//--------------------------------------------------
bit CMiscAutoMeasurePollingEvent(void)
{
if(!(bit)CScalerGetBit(_AUTO_ADJ_CTRL1_7D, _BIT0))
{
return _TRUE;
}
else
{
return _FALSE;
}
}
#endif
//--------------------------------------------------
// Description : Apply double buffer polling event
// Input Value : None
// Output Value : Return _TRUE if apply double buffer finished
//--------------------------------------------------
bit CMiscApplyDoubleBufferPollingEvent(void)
{
if(!(bit)CScalerGetBit(_VGIP_CTRL_10, _BIT5))
{
return _TRUE;
}
else
{
return _FALSE;
}
}
#if(((_TMDS_SUPPORT == _ON) || (_HDMI_SUPPORT == _ON)) && (_DVI_LONG_CABLE_SUPPORT == _ON))
//--------------------------------------------------
// Description : TMDS transition measure polling event
// Input Value : None
// Output Value : Return _TRUE if measure finished
//--------------------------------------------------
bit CMiscTMDSMeasureEvent(void)
{
CScalerPageSelect(_PAGE2);
if(!(bit)CScalerGetBit(_P2_TMDS_MEAS_RESULT0_A2, _BIT7))
{
return _TRUE;
}
else
{
return _FALSE;
}
}
#endif // End of #if(((_TMDS_SUPPORT == _ON) || (_HDMI_SUPPORT == _ON)) && (_DVI_LONG_CABLE_SUPPORT == _ON))
//Anderson 080107 for RTD2122
#if(((_MCU_TYPE == _REALTEK_RTD2120) || (_MCU_TYPE == _REALTEK_RTD2122)) && (_MEMORY_LOCATION == _FLASH))
//--------------------------------------------------
// Description : MCU re-flash event
// Input Value : None
// Output Value : Return _TRUE if erase finished
//--------------------------------------------------
bit CMiscFlashEraseEvent(void)
{
if(!(bit)(MCU_FC_PAGE_ERASE_FF39 & _BIT0))
{
return _TRUE;
}
else
{
return _FALSE;
}
}
#endif // End of #if(((_MCU_TYPE == _REALTEK_RTD2120) || (_MCU_TYPE == _REALTEK_RTD2122))&& (_MEMORY_LOCATION == _FLASH))
//Anderson 080107 for RTD2122
//----------------------------------------------------------------------------------------------------
// Misc Functions
//----------------------------------------------------------------------------------------------------
//--------------------------------------------------
// Description : Enable double buffer
// Input Value : None
// Output Value : None
//--------------------------------------------------
void CMiscEnableDoubleBuffer(void)
{
CScalerSetBit(_VGIP_CTRL_10, ~_BIT4, _BIT4);
}
//--------------------------------------------------
// Description : Disable double buffer
// Input Value : None
// Output Value : None
//--------------------------------------------------
void CMiscDisableDoubleBuffer(void)
{
CScalerSetBit(_VGIP_CTRL_10, ~_BIT4, 0x00);
}
//--------------------------------------------------
// Description : Apply double buffer
// Input Value : None
// Output Value : None
//--------------------------------------------------
void CMiscApplyDoubleBuffer(void)
{
if((bit)CScalerGetBit(_VGIP_CTRL_10, _BIT4))
{
CScalerSetBit(_VGIP_CTRL_10, ~_BIT5, _BIT5);
CTimerPollingEventProc(60, CMiscApplyDoubleBufferPollingEvent);
}
}
//--------------------------------------------------
// Description : Clear status Reg[02] and Reg[03]
// Input Value : None
// Output Value : None
//--------------------------------------------------
void CMiscClearStatusRegister(void)
{
CScalerSetByte(_STATUS0_02, 0x00);
CScalerSetByte(_STATUS1_03, 0x00);
}
//--------------------------------------------------
// Description : Set pin share
// Input Value : None
// Output Value : None
//--------------------------------------------------
void CMiscSetPinShare(void)
{
//Anderson 080310 for 247xRD, 248xRD Start
#if(_SCALER_TYPE == _RTD2472D)
#if(_MCU_TYPE == _REALTEK_EMBEDDED)
MCU_PIN_SHARE_CTRL00_FF94 = (((BYTE)_PIN_41<<6) | (_PIN_42<<4) | (_PIN_43<<2) | (_PIN_54));
MCU_PIN_SHARE_CTRL01_FF95 = (((BYTE)_PIN_45<<6) | (_PIN_119<<3) | (_PIN_126));
MCU_PIN_SHARE_CTRL02_FF96 = (((BYTE)_PIN_58_59_DDC1_ENABLE<<7) | (_PIN_58<<4) | (_PIN_59<<1));
MCU_PIN_SHARE_CTRL03_FF97 = (((BYTE)_PIN_46<<6) | (_PIN_51<<4) | (_PIN_64));
MCU_PIN_SHARE_CTRL04_FF98 = (((BYTE)_PIN_52<<6) | (_PIN_66<<3) | (_PIN_67));
MCU_PIN_SHARE_CTRL05_FF99 = (((BYTE)_PIN_53<<6) | (_PIN_69<<3) | (_PIN_70));
MCU_PIN_SHARE_CTRL06_FF9A = (((BYTE)_PIN_47<<6) | (_PIN_55<<3) | (_PIN_63));
MCU_PIN_SHARE_CTRL07_FF9B = (((BYTE)_PIN_48<<6) | (_PIN_68<<3) | (_PIN_71));
MCU_PIN_SHARE_CTRL08_FF9C = (((BYTE)_PIN_44<<5) | (_PIN_96<<3) | (_PIN_97));
MCU_PIN_SHARE_CTRL09_FF9D = (((BYTE)_PIN_74to83<<6) | (_PIN_99<<3) | (_PIN_100));
MCU_PIN_SHARE_CTRL0A_FF9E = (((BYTE)_PIN_98<<6) | (_PIN_102<<3) | (_PIN_105));
MCU_PIN_SHARE_CTRL0B_FF9F = (((BYTE)_PIN_50<<5) | (_PIN_101<<3) | (_PIN_108));
MCU_PIN_SHARE_CTRL0C_FFA0 = (((BYTE)_PIN_103<<4) | (_PIN_104<<1));
MCU_PIN_SHARE_CTRL0D_FFA1 = (((BYTE)_PIN_109<<4) | (_PIN_110));
MCU_PIN_SHARE_CTRL0E_FFA2 = (((BYTE)_PIN_111<<4) | (_PIN_112));
MCU_PIN_SHARE_CTRL0F_FFA3 = (((BYTE)_PIN_56_57_IIC_ENABLE<<7) | (_PIN_56<<4) | (_PIN_57<<1));
MCU_PIN_SHARE_CTRL10_FFA4 = (((BYTE)_PIN_113<<5) | (_PIN_121_122_DDC3_ENABLE<<4) | (_PIN_121<<2) | (_PIN_122));
MCU_PIN_SHARE_CTRL11_FFA5 = (((BYTE)_PIN_65<<5) | (_PIN_123_124_DDC2_ENABLE<<4) | (_PIN_123<<2) | (_PIN_124));
MCU_PIN_SHARE_CTRL12_FFA6 = (((BYTE)_PIN_72<<5) | (_PIN_114<<2));
#else
pData[0] = (((BYTE)_PIN_41<<6) | (_PIN_42<<4) | (_PIN_43<<2) | (_PIN_54));
pData[1] = (((BYTE)_PIN_45<<6) | (_PIN_119<<3) | (_PIN_126));
pData[2] = (((BYTE)_PIN_58_59_DDC1_ENABLE<<7) | (_PIN_58<<4) | (_PIN_59<<1));
CScalerPageSelect(_PAGEE);
CScalerWrite(_PE_PIN_SHARE_CTRL00_D4, 3, pData, _AUTOINC);
pData[0] = (((BYTE)_PIN_46<<6) | (_PIN_51<<4) | (_PIN_64));
pData[1] = (((BYTE)_PIN_52<<6) | (_PIN_66<<3) | (_PIN_67));
pData[2] = (((BYTE)_PIN_53<<6) | (_PIN_69<<3) | (_PIN_70));
pData[3] = (((BYTE)_PIN_47<<6) | (_PIN_55<<3) | (_PIN_63));
pData[4] = (((BYTE)_PIN_48<<6) | (_PIN_68<<3) | (_PIN_71));
pData[5] = (((BYTE)_PIN_44<<5) | (_PIN_96<<3) | (_PIN_97));
pData[6] = (((BYTE)_PIN_74to83<<6) | (_PIN_99<<3) | (_PIN_100));
pData[7] = (((BYTE)_PIN_98<<6) | (_PIN_102<<3) | (_PIN_105));
pData[8] = (((BYTE)_PIN_50<<5) | (_PIN_101<<3) | (_PIN_108));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -