blob: bd7f73898644e75483e7d2abf763a220cfe6fcbf [file] [log] [blame]
#include "osdef.h"
#ifdef TC
#include <stdio.h>
#include <string.h>
#include <conio.h>
#include <dos.h>
#endif
#ifdef LINUX_XF86
#include "xf86.h"
#include "xf86PciInfo.h"
#include "xgi.h"
#include "xgi_regs.h"
#endif
#ifdef LINUX_KERNEL
#include <asm/io.h>
#include <linux/types.h>
#include <linux/version.h>
#include "XGIfb.h"
/*#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#include <video/XGIfb.h>
#else
#include <linux/XGIfb.h>
#endif*/
#endif
#ifdef WIN2000
#include <dderror.h>
#include <devioctl.h>
#include <miniport.h>
#include <ntddvdeo.h>
#include <video.h>
#include "xgiv.h"
#include "dd_i2c.h"
#include "tools.h"
#endif
#include "vb_def.h"
#include "vgatypes.h"
#include "vb_struct.h"
#include "vb_util.h"
#include "vb_table.h"
#define IndexMask 0xff
#ifndef XGI_MASK_DUAL_CHIP
#define XGI_MASK_DUAL_CHIP 0x04 /* SR3A */
#endif
BOOLEAN XGI_IsLCDDualLink(PVB_DEVICE_INFO pVBInfo);
BOOLEAN XGI_SetCRT2Group301(USHORT ModeNo, PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo);
BOOLEAN XGI_BacklightByDrv(PVB_DEVICE_INFO pVBInfo);
BOOLEAN XGI_IsLCDON(PVB_DEVICE_INFO pVBInfo);
BOOLEAN XGI_DisableChISLCD(PVB_DEVICE_INFO pVBInfo);
BOOLEAN XGI_EnableChISLCD(PVB_DEVICE_INFO pVBInfo);
BOOLEAN XGI_AjustCRT2Rate(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,USHORT *i, PVB_DEVICE_INFO pVBInfo);
BOOLEAN XGI_SearchModeID( USHORT ModeNo,USHORT *ModeIdIndex, PVB_DEVICE_INFO pVBInfo);
BOOLEAN XGI_GetLCDInfo(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo);
BOOLEAN XGISetModeNew( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT ModeNo ) ;
BOOLEAN XGI_BridgeIsOn(PVB_DEVICE_INFO pVBInfo);
UCHAR XGI_GetModePtr( USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo);
USHORT XGI_GetOffset(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo);
USHORT XGI_GetRatePtrCRT2( PXGI_HW_DEVICE_INFO pXGIHWDE, USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo );
USHORT XGI_GetResInfo(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo);
USHORT XGI_GetColorDepth(USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo);
USHORT XGI_GetVGAHT2(PVB_DEVICE_INFO pVBInfo);
USHORT XGI_GetVCLK2Ptr(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo);
void XGI_VBLongWait(PVB_DEVICE_INFO pVBInfo);
void XGI_SaveCRT2Info(USHORT ModeNo, PVB_DEVICE_INFO pVBInfo);
void XGI_GetCRT2Data(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_GetCRT2ResInfo(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_PreSetGroup1(USHORT ModeNo,USHORT ModeIdIndex, PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_SetGroup1(USHORT ModeNo,USHORT ModeIdIndex, PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_SetLockRegs(USHORT ModeNo,USHORT ModeIdIndex, PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_SetLCDRegs(USHORT ModeNo,USHORT ModeIdIndex, PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_SetGroup2(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo);
void XGI_SetGroup3(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_SetGroup4(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo);
void XGI_SetGroup5(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo);
void* XGI_GetLcdPtr(USHORT BX, USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo);
void* XGI_GetTVPtr(USHORT BX, USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_FirePWDEnable(PVB_DEVICE_INFO pVBInfo);
void XGI_EnableGatingCRT(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo);
void XGI_DisableGatingCRT(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo);
void XGI_SetPanelDelay(USHORT tempbl, PVB_DEVICE_INFO pVBInfo);
void XGI_SetPanelPower(USHORT tempah,USHORT tempbl, PVB_DEVICE_INFO pVBInfo);
void XGI_EnablePWD( PVB_DEVICE_INFO pVBInfo);
void XGI_DisablePWD( PVB_DEVICE_INFO pVBInfo);
void XGI_AutoThreshold( PVB_DEVICE_INFO pVBInfo);
void XGI_SetTap4Regs( PVB_DEVICE_INFO pVBInfo);
void XGI_DisplayOn(PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo);
void XGI_DisplayOff( PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo );
void XGI_SetCRT1Group(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo);
void XGI_SetXG21CRTC(USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_SetXG21LCD(PVB_DEVICE_INFO pVBInfo,USHORT RefreshRateTableIndex,USHORT ModeNo);
void XGI_SetXG27CRTC(USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_SetXG27LCD(PVB_DEVICE_INFO pVBInfo,USHORT RefreshRateTableIndex,USHORT ModeNo);
void XGI_UpdateXG21CRTC(USHORT ModeNo, PVB_DEVICE_INFO pVBInfo, USHORT RefreshRateTableIndex);
void XGI_WaitDisply(PVB_DEVICE_INFO pVBInfo);
void XGI_SenseCRT1(PVB_DEVICE_INFO pVBInfo);
void XGI_SetSeqRegs(USHORT ModeNo,USHORT StandTableIndex,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo);
void XGI_SetMiscRegs(USHORT StandTableIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_SetCRTCRegs(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT StandTableIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_SetATTRegs(USHORT ModeNo,USHORT StandTableIndex,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo );
void XGI_SetGRCRegs(USHORT StandTableIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_ClearExt1Regs(PVB_DEVICE_INFO pVBInfo);
void XGI_SetSync(USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo);
void XGI_SetCRT1CRTC(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo,PXGI_HW_DEVICE_INFO HwDeviceExtension);
void XGI_SetCRT1Timing_H(PVB_DEVICE_INFO pVBInfo,PXGI_HW_DEVICE_INFO HwDeviceExtension);
void XGI_SetCRT1Timing_V(USHORT ModeIdIndex,USHORT ModeNo,PVB_DEVICE_INFO pVBInfo);
void XGI_SetCRT1DE(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo);
void XGI_SetCRT1VCLK(USHORT ModeNo,USHORT ModeIdIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_SetCRT1FIFO(USHORT ModeNo,PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo);
void XGI_SetCRT1ModeRegs(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo);
void XGI_SetVCLKState(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo);
void XGI_LoadDAC(USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo);
void XGI_WriteDAC(USHORT dl, USHORT ah, USHORT al, USHORT dh, PVB_DEVICE_INFO pVBInfo);
/*void XGI_ClearBuffer(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,PVB_DEVICE_INFO pVBInfo);*/
void XGI_SetLCDAGroup(USHORT ModeNo,USHORT ModeIdIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo);
void XGI_GetLVDSResInfo( USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo);
void XGI_GetLVDSData(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo);
void XGI_ModCRT1Regs(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo);
void XGI_SetLVDSRegs(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo);
void XGI_UpdateModeInfo(PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo);
void XGI_GetVGAType(PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo);
void XGI_GetVBType(PVB_DEVICE_INFO pVBInfo);
void XGI_GetVBInfo(USHORT ModeNo,USHORT ModeIdIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo);
void XGI_GetTVInfo(USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo);
void XGI_SetCRT2ECLK( USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo);
void InitTo330Pointer(UCHAR,PVB_DEVICE_INFO pVBInfo);
void XGI_GetLCDSync(USHORT* HSyncWidth, USHORT* VSyncWidth, PVB_DEVICE_INFO pVBInfo);
void XGI_DisableBridge(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo);
void XGI_EnableBridge(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo);
void XGI_SetCRT2VCLK(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_OEM310Setting(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_SetDelayComp(PVB_DEVICE_INFO pVBInfo);
void XGI_SetLCDCap(PVB_DEVICE_INFO pVBInfo);
void XGI_SetLCDCap_A(USHORT tempcx,PVB_DEVICE_INFO pVBInfo);
void XGI_SetLCDCap_B(USHORT tempcx,PVB_DEVICE_INFO pVBInfo);
void SetSpectrum(PVB_DEVICE_INFO pVBInfo);
void XGI_SetAntiFlicker(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_SetEdgeEnhance(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_SetPhaseIncr(PVB_DEVICE_INFO pVBInfo);
void XGI_SetYFilter(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_GetTVPtrIndex2(USHORT* tempbx,UCHAR* tempcl,UCHAR* tempch, PVB_DEVICE_INFO pVBInfo);
USHORT XGI_GetTVPtrIndex( PVB_DEVICE_INFO pVBInfo );
void XGI_SetCRT2ModeRegs(USHORT ModeNo,PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo );
void XGI_CloseCRTC(PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo);
void XGI_OpenCRTC(PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo);
void XGI_GetRAMDAC2DATA(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_UnLockCRT2(PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo);
void XGI_LockCRT2(PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo);
void XGINew_EnableCRT2(PVB_DEVICE_INFO pVBInfo);
void XGINew_LCD_Wait_Time(UCHAR DelayTime, PVB_DEVICE_INFO pVBInfo);
void XGI_LongWait(PVB_DEVICE_INFO pVBInfo);
void XGI_SetCRT1Offset( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex , PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo );
void XGI_GetLCDVCLKPtr(UCHAR* di_0,UCHAR *di_1, PVB_DEVICE_INFO pVBInfo);
UCHAR XGI_GetVCLKPtr(USHORT RefreshRateTableIndex,USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo);
void XGI_GetVCLKLen(UCHAR tempal,UCHAR* di_0,UCHAR* di_1, PVB_DEVICE_INFO pVBInfo);
USHORT XGI_GetLCDCapPtr(PVB_DEVICE_INFO pVBInfo);
USHORT XGI_GetLCDCapPtr1(PVB_DEVICE_INFO pVBInfo);
XGI301C_Tap4TimingStruct* XGI_GetTap4Ptr(USHORT tempcx, PVB_DEVICE_INFO pVBInfo);
void XGI_SetXG21FPBits(PVB_DEVICE_INFO pVBInfo);
void XGI_SetXG27FPBits(PVB_DEVICE_INFO pVBInfo);
UCHAR XGI_XG21GetPSCValue(PVB_DEVICE_INFO pVBInfo);
UCHAR XGI_XG27GetPSCValue(PVB_DEVICE_INFO pVBInfo);
void XGI_XG21BLSignalVDD(USHORT tempbh,USHORT tempbl, PVB_DEVICE_INFO pVBInfo);
void XGI_XG27BLSignalVDD(USHORT tempbh,USHORT tempbl, PVB_DEVICE_INFO pVBInfo);
void XGI_XG21SetPanelDelay(USHORT tempbl, PVB_DEVICE_INFO pVBInfo);
BOOLEAN XGI_XG21CheckLVDSMode(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo );
void XGI_SetXG21LVDSPara(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo );
void XGI_SetXG27LVDSPara(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo );
UCHAR XGI_SetDefaultVCLK( PVB_DEVICE_INFO pVBInfo );
extern void ReadVBIOSTablData( UCHAR ChipType , PVB_DEVICE_INFO pVBInfo);
#ifdef WIN2000
/* [Billy] 2007/05/17 For CH7007 */
extern UCHAR CH7007TVReg_UNTSC[][8],CH7007TVReg_ONTSC[][8],CH7007TVReg_UPAL[][8],CH7007TVReg_OPAL[][8];
extern UCHAR CH7007TVCRT1UNTSC_H[][10],CH7007TVCRT1ONTSC_H[][10],CH7007TVCRT1UPAL_H[][10],CH7007TVCRT1OPAL_H[][10] ;
extern UCHAR CH7007TVCRT1UNTSC_V[][10],CH7007TVCRT1ONTSC_V[][10],CH7007TVCRT1UPAL_V[][10],CH7007TVCRT1OPAL_V[][10] ;
extern UCHAR XGI7007_CHTVVCLKUNTSC[],XGI7007_CHTVVCLKONTSC[],XGI7007_CHTVVCLKUPAL[],XGI7007_CHTVVCLKOPAL[];
extern BOOLEAN XGI_XG21CheckCH7007TVMode(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) ;
extern void SetCH7007Regs(PXGI_HW_DEVICE_INFO HwDeviceExtension, USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) ;
extern VP_STATUS TurnOnCH7007(PHW_DEVICE_EXTENSION pHWDE) ;
extern VP_STATUS TurnOffCH7007(PHW_DEVICE_EXTENSION pHWDE) ;
extern BOOLEAN IsCH7007TVMode(PVB_DEVICE_INFO pVBInfo) ;
#endif
/* USHORT XGINew_flag_clearbuffer; 0: no clear frame buffer 1:clear frame buffer */
USHORT XGINew_MDA_DAC[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F};
USHORT XGINew_CGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F};
USHORT XGINew_EGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x05,0x15,
0x20,0x30,0x24,0x34,0x21,0x31,0x25,0x35,
0x08,0x18,0x0C,0x1C,0x09,0x19,0x0D,0x1D,
0x28,0x38,0x2C,0x3C,0x29,0x39,0x2D,0x3D,
0x02,0x12,0x06,0x16,0x03,0x13,0x07,0x17,
0x22,0x32,0x26,0x36,0x23,0x33,0x27,0x37,
0x0A,0x1A,0x0E,0x1E,0x0B,0x1B,0x0F,0x1F,
0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F};
USHORT XGINew_VGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
0x00,0x05,0x08,0x0B,0x0E,0x11,0x14,0x18,
0x1C,0x20,0x24,0x28,0x2D,0x32,0x38,0x3F,
0x00,0x10,0x1F,0x2F,0x3F,0x1F,0x27,0x2F,
0x37,0x3F,0x2D,0x31,0x36,0x3A,0x3F,0x00,
0x07,0x0E,0x15,0x1C,0x0E,0x11,0x15,0x18,
0x1C,0x14,0x16,0x18,0x1A,0x1C,0x00,0x04,
0x08,0x0C,0x10,0x08,0x0A,0x0C,0x0E,0x10,
0x0B,0x0C,0x0D,0x0F,0x10};
/* --------------------------------------------------------------------- */
/* Function : InitTo330Pointer */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void InitTo330Pointer( UCHAR ChipType ,PVB_DEVICE_INFO pVBInfo)
{
pVBInfo->SModeIDTable = (XGI_StStruct *) XGI330_SModeIDTable ;
pVBInfo->StandTable = (XGI_StandTableStruct *) XGI330_StandTable ;
pVBInfo->EModeIDTable = (XGI_ExtStruct *) XGI330_EModeIDTable ;
pVBInfo->RefIndex = (XGI_Ext2Struct *) XGI330_RefIndex ;
pVBInfo->XGINEWUB_CRT1Table = (XGI_CRT1TableStruct *) XGI_CRT1Table ;
/* add for new UNIVGABIOS */
/* XGINew_UBLCDDataTable = (XGI_LCDDataTablStruct *) XGI_LCDDataTable ; */
/* XGINew_UBTVDataTable = (XGI_TVDataTablStruct *) XGI_TVDataTable ; */
if ( ChipType >= XG40 )
{
pVBInfo->MCLKData = (XGI_MCLKDataStruct *) XGI340New_MCLKData ;
pVBInfo->ECLKData = (XGI_ECLKDataStruct *) XGI340_ECLKData ;
}
else
{
pVBInfo->MCLKData = (XGI_MCLKDataStruct *) XGI330New_MCLKData ;
pVBInfo->ECLKData = (XGI_ECLKDataStruct *) XGI330_ECLKData ;
}
pVBInfo->VCLKData = (XGI_VCLKDataStruct *) XGI_VCLKData ;
pVBInfo->VBVCLKData = (XGI_VBVCLKDataStruct *) XGI_VBVCLKData ;
pVBInfo->ScreenOffset = XGI330_ScreenOffset ;
pVBInfo->StResInfo = (XGI_StResInfoStruct *) XGI330_StResInfo ;
pVBInfo->ModeResInfo = (XGI_ModeResInfoStruct *) XGI330_ModeResInfo ;
pVBInfo->pOutputSelect = &XGI330_OutputSelect ;
pVBInfo->pSoftSetting = &XGI330_SoftSetting ;
pVBInfo->pSR07 = &XGI330_SR07 ;
pVBInfo->LCDResInfo = 0 ;
pVBInfo->LCDTypeInfo = 0 ;
pVBInfo->LCDInfo = 0 ;
pVBInfo->VBInfo = 0 ;
pVBInfo->TVInfo = 0;
pVBInfo->SR15 = XGI340_SR13 ;
pVBInfo->CR40 = XGI340_cr41 ;
pVBInfo->SR25 = XGI330_sr25 ;
pVBInfo->pSR31 = &XGI330_sr31 ;
pVBInfo->pSR32 = &XGI330_sr32 ;
pVBInfo->CR6B = XGI340_CR6B ;
pVBInfo->CR6E = XGI340_CR6E ;
pVBInfo->CR6F = XGI340_CR6F ;
pVBInfo->CR89 = XGI340_CR89 ;
pVBInfo->AGPReg = XGI340_AGPReg ;
pVBInfo->SR16 = XGI340_SR16 ;
pVBInfo->pCRCF = &XG40_CRCF ;
pVBInfo->pXGINew_DRAMTypeDefinition = &XG40_DRAMTypeDefinition ;
pVBInfo->CR49 = XGI330_CR49 ;
pVBInfo->pSR1F = &XGI330_SR1F ;
pVBInfo->pSR21 = &XGI330_SR21 ;
pVBInfo->pSR22 = &XGI330_SR22 ;
pVBInfo->pSR23 = &XGI330_SR23 ;
pVBInfo->pSR24 = &XGI330_SR24 ;
pVBInfo->pSR33 = &XGI330_SR33 ;
pVBInfo->pCRT2Data_1_2 = &XGI330_CRT2Data_1_2 ;
pVBInfo->pCRT2Data_4_D = &XGI330_CRT2Data_4_D ;
pVBInfo->pCRT2Data_4_E = &XGI330_CRT2Data_4_E ;
pVBInfo->pCRT2Data_4_10 = &XGI330_CRT2Data_4_10 ;
pVBInfo->pRGBSenseData = &XGI330_RGBSenseData ;
pVBInfo->pVideoSenseData = &XGI330_VideoSenseData ;
pVBInfo->pYCSenseData = &XGI330_YCSenseData ;
pVBInfo->pRGBSenseData2 = &XGI330_RGBSenseData2 ;
pVBInfo->pVideoSenseData2 = &XGI330_VideoSenseData2 ;
pVBInfo->pYCSenseData2 = &XGI330_YCSenseData2 ;
pVBInfo->NTSCTiming = XGI330_NTSCTiming ;
pVBInfo->PALTiming = XGI330_PALTiming ;
pVBInfo->HiTVExtTiming = XGI330_HiTVExtTiming ;
pVBInfo->HiTVSt1Timing = XGI330_HiTVSt1Timing ;
pVBInfo->HiTVSt2Timing = XGI330_HiTVSt2Timing ;
pVBInfo->HiTVTextTiming = XGI330_HiTVTextTiming ;
pVBInfo->YPbPr750pTiming = XGI330_YPbPr750pTiming ;
pVBInfo->YPbPr525pTiming = XGI330_YPbPr525pTiming ;
pVBInfo->YPbPr525iTiming = XGI330_YPbPr525iTiming ;
pVBInfo->HiTVGroup3Data = XGI330_HiTVGroup3Data ;
pVBInfo->HiTVGroup3Simu = XGI330_HiTVGroup3Simu ;
pVBInfo->HiTVGroup3Text = XGI330_HiTVGroup3Text ;
pVBInfo->Ren525pGroup3 = XGI330_Ren525pGroup3 ;
pVBInfo->Ren750pGroup3 = XGI330_Ren750pGroup3 ;
pVBInfo->TimingH = (XGI_TimingHStruct *) XGI_TimingH ;
pVBInfo->TimingV = (XGI_TimingVStruct *) XGI_TimingV ;
pVBInfo->UpdateCRT1 = (XGI_XG21CRT1Struct *) XGI_UpdateCRT1Table ;
pVBInfo->CHTVVCLKUNTSC = XGI330_CHTVVCLKUNTSC ;
pVBInfo->CHTVVCLKONTSC = XGI330_CHTVVCLKONTSC ;
pVBInfo->CHTVVCLKUPAL = XGI330_CHTVVCLKUPAL ;
pVBInfo->CHTVVCLKOPAL = XGI330_CHTVVCLKOPAL ;
/* 310 customization related */
if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) )
pVBInfo->LCDCapList = XGI_LCDDLCapList ;
else
pVBInfo->LCDCapList = XGI_LCDCapList ;
if ( ( ChipType == XG21 ) || ( ChipType == XG27 ) )
pVBInfo->XG21_LVDSCapList = XGI21_LCDCapList ;
pVBInfo->XGI_TVDelayList = XGI301TVDelayList ;
pVBInfo->XGI_TVDelayList2 = XGI301TVDelayList2 ;
pVBInfo->pXGINew_I2CDefinition = &XG40_I2CDefinition ;
if ( ChipType >= XG20 )
pVBInfo->pXGINew_CR97 = &XG20_CR97 ;
if ( ChipType == XG27 )
{
pVBInfo->MCLKData = (XGI_MCLKDataStruct *) XGI27New_MCLKData ;
pVBInfo->CR40 = XGI27_cr41 ;
pVBInfo->pXGINew_CR97 = &XG27_CR97 ;
pVBInfo->pSR36 = &XG27_SR36 ;
pVBInfo->pCR8F = &XG27_CR8F ;
pVBInfo->pCRD0 = XG27_CRD0 ;
pVBInfo->pCRDE = XG27_CRDE ;
pVBInfo->pSR40 = &XG27_SR40 ;
pVBInfo->pSR41 = &XG27_SR41 ;
}
if ( ChipType >= XG20 )
{
pVBInfo->pDVOSetting = &XG21_DVOSetting ;
pVBInfo->pCR2E = &XG21_CR2E ;
pVBInfo->pCR2F = &XG21_CR2F ;
pVBInfo->pCR46 = &XG21_CR46 ;
pVBInfo->pCR47 = &XG21_CR47 ;
}
}
/* --------------------------------------------------------------------- */
/* Function : XGISetModeNew */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
BOOLEAN XGISetModeNew( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT ModeNo )
{
USHORT ModeIdIndex ;
/* PUCHAR pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress ; */
VB_DEVICE_INFO VBINF;
PVB_DEVICE_INFO pVBInfo = &VBINF;
pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase ;
pVBInfo->BaseAddr = (ULONG)HwDeviceExtension->pjIOAddress ;
pVBInfo->IF_DEF_LVDS = 0 ;
pVBInfo->IF_DEF_CH7005 = 0 ;
pVBInfo->IF_DEF_LCDA = 1 ;
pVBInfo->IF_DEF_CH7017 = 0 ;
pVBInfo->IF_DEF_CH7007 = 0 ; /* [Billy] 2007/05/14 */
pVBInfo->IF_DEF_VideoCapture = 0 ;
pVBInfo->IF_DEF_ScaleLCD = 0 ;
pVBInfo->IF_DEF_OEMUtil = 0 ;
pVBInfo->IF_DEF_PWD = 0 ;
if ( HwDeviceExtension->jChipType >= XG20 ) /* kuku 2004/06/25 */
{
pVBInfo->IF_DEF_YPbPr = 0 ;
pVBInfo->IF_DEF_HiVision = 0 ;
pVBInfo->IF_DEF_CRT2Monitor = 0 ;
pVBInfo->VBType = 0 ; /*set VBType default 0*/
}
else if ( HwDeviceExtension->jChipType >= XG40 )
{
pVBInfo->IF_DEF_YPbPr = 1 ;
pVBInfo->IF_DEF_HiVision = 1 ;
pVBInfo->IF_DEF_CRT2Monitor = 1 ;
}
else
{
pVBInfo->IF_DEF_YPbPr = 1 ;
pVBInfo->IF_DEF_HiVision = 1 ;
pVBInfo->IF_DEF_CRT2Monitor = 0 ;
}
pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14 ;
pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24 ;
pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10 ;
pVBInfo->P3ce = pVBInfo->BaseAddr + 0x1e ;
pVBInfo->P3c2 = pVBInfo->BaseAddr + 0x12 ;
pVBInfo->P3cc = pVBInfo->BaseAddr + 0x1C ;
pVBInfo->P3ca = pVBInfo->BaseAddr + 0x1a ;
pVBInfo->P3c6 = pVBInfo->BaseAddr + 0x16 ;
pVBInfo->P3c7 = pVBInfo->BaseAddr + 0x17 ;
pVBInfo->P3c8 = pVBInfo->BaseAddr + 0x18 ;
pVBInfo->P3c9 = pVBInfo->BaseAddr + 0x19 ;
pVBInfo->P3da = pVBInfo->BaseAddr + 0x2A ;
pVBInfo->Part0Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_00 ;
pVBInfo->Part1Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_04 ;
pVBInfo->Part2Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_10 ;
pVBInfo->Part3Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_12 ;
pVBInfo->Part4Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 ;
pVBInfo->Part5Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 + 2 ;
if ( HwDeviceExtension->jChipType == XG21 ) /* for x86 Linux, XG21 LVDS */
{
if ( ( XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) & 0xE0 ) == 0xC0 )
{
pVBInfo->IF_DEF_LVDS = 1 ;
}
}
if ( HwDeviceExtension->jChipType == XG27 )
{
if ( ( XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) & 0xE0 ) == 0xC0 )
{
if ( XGINew_GetReg1( pVBInfo->P3d4 , 0x30 ) & 0x20 )
{
pVBInfo->IF_DEF_LVDS = 1 ;
}
}
}
if ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 */
XGI_GetVBType( pVBInfo ) ;
InitTo330Pointer( HwDeviceExtension->jChipType, pVBInfo ) ;
#ifdef WIN2000
ReadVBIOSTablData( HwDeviceExtension->jChipType , pVBInfo) ;
#endif
if ( ModeNo & 0x80 )
{
ModeNo = ModeNo & 0x7F ;
/* XGINew_flag_clearbuffer = 0 ; */
}
/* else
{
XGINew_flag_clearbuffer = 1 ;
}
*/
XGINew_SetReg1( pVBInfo->P3c4 , 0x05 , 0x86 ) ;
if ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 1.Openkey */
XGI_UnLockCRT2( HwDeviceExtension , pVBInfo ) ;
XGI_SearchModeID( ModeNo , &ModeIdIndex, pVBInfo ) ;
XGI_GetVGAType(HwDeviceExtension, pVBInfo) ;
if ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 */
{
XGI_GetVBInfo(ModeNo , ModeIdIndex , HwDeviceExtension, pVBInfo ) ;
XGI_GetTVInfo(ModeNo , ModeIdIndex, pVBInfo ) ;
XGI_GetLCDInfo(ModeNo , ModeIdIndex, pVBInfo ) ;
XGI_DisableBridge( HwDeviceExtension,pVBInfo ) ;
/* XGI_OpenCRTC( HwDeviceExtension, pVBInfo ) ; */
if ( pVBInfo->VBInfo & ( SetSimuScanMode | SetCRT2ToLCDA ) )
{
XGI_SetCRT1Group(HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ;
if ( pVBInfo->VBInfo & SetCRT2ToLCDA )
{
XGI_SetLCDAGroup(ModeNo , ModeIdIndex , HwDeviceExtension, pVBInfo ) ;
}
}
else
{
if ( !( pVBInfo->VBInfo & SwitchToCRT2) )
{
XGI_SetCRT1Group( HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ;
if ( pVBInfo->VBInfo & SetCRT2ToLCDA )
{
XGI_SetLCDAGroup( ModeNo , ModeIdIndex , HwDeviceExtension, pVBInfo ) ;
}
}
}
if ( pVBInfo->VBInfo & ( SetSimuScanMode | SwitchToCRT2 ) )
{
switch( HwDeviceExtension->ujVBChipID )
{
case VB_CHIP_301:
XGI_SetCRT2Group301( ModeNo , HwDeviceExtension, pVBInfo ) ; /*add for CRT2 */
break ;
case VB_CHIP_302:
XGI_SetCRT2Group301(ModeNo , HwDeviceExtension, pVBInfo ) ; /*add for CRT2 */
break ;
default:
break ;
}
}
XGI_SetCRT2ModeRegs( ModeNo, HwDeviceExtension,pVBInfo ) ;
XGI_OEM310Setting( ModeNo, ModeIdIndex,pVBInfo ) ; /*0212*/
XGI_CloseCRTC( HwDeviceExtension, pVBInfo ) ;
XGI_EnableBridge( HwDeviceExtension ,pVBInfo) ;
} /* !XG20 */
else
{
#ifdef WIN2000
if ( pVBInfo->IF_DEF_CH7007 == 1 )
{
VideoDebugPrint((0, "XGISetModeNew: pVBIfo->IF_DEF_CH7007==1\n"));
pVBInfo->VBType = VB_CH7007 ;
XGI_GetVBInfo(ModeNo , ModeIdIndex , HwDeviceExtension, pVBInfo ) ;
XGI_GetTVInfo(ModeNo , ModeIdIndex, pVBInfo ) ;
XGI_GetLCDInfo(ModeNo , ModeIdIndex, pVBInfo ) ;
if( !(XGI_XG21CheckCH7007TVMode(ModeNo, ModeIdIndex, pVBInfo )) )
{
return FALSE;
}
}
#endif
if ( pVBInfo->IF_DEF_LVDS == 1 )
{
if ( !XGI_XG21CheckLVDSMode(ModeNo , ModeIdIndex, pVBInfo) )
{
return FALSE;
}
}
if ( ModeNo <= 0x13 )
{
pVBInfo->ModeType = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag & ModeInfoFlag;
}
else
{
pVBInfo->ModeType = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag & ModeInfoFlag;
}
pVBInfo->SetFlag = 0 ;
if ( pVBInfo->IF_DEF_CH7007 != 1 )
{
pVBInfo->VBInfo = DisableCRT2Display ;
}
XGI_DisplayOff(HwDeviceExtension, pVBInfo) ;
XGI_SetCRT1Group(HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ;
XGI_DisplayOn( HwDeviceExtension, pVBInfo ) ;
/*
if( HwDeviceExtension->jChipType == XG21 )
XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x09 , ~0x80 , 0x80 ) ;
*/
}
/*
if ( ModeNo <= 0x13 )
{
modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ;
}
else
{
modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
}
pVBInfo->ModeType = modeflag&ModeInfoFlag ;
pVBInfo->SetFlag = 0x00 ;
pVBInfo->VBInfo = DisableCRT2Display ;
temp = XGINew_CheckMemorySize( HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ;
if ( temp == 0 )
return( 0 ) ;
XGI_DisplayOff( HwDeviceExtension, pVBInfo) ;
XGI_SetCRT1Group( HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ;
XGI_DisplayOn( HwDeviceExtension, pVBInfo) ;
*/
XGI_UpdateModeInfo( HwDeviceExtension, pVBInfo ) ;
if ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 */
{
XGI_LockCRT2( HwDeviceExtension, pVBInfo ) ;
}
return( TRUE ) ;
}
/* --------------------------------------------------------------------- */
/* Function : XGI_SetCRT1Group */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGI_SetCRT1Group( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo )
{
USHORT StandTableIndex ,
RefreshRateTableIndex ,
b3CC ,
temp ;
USHORT XGINew_P3cc = pVBInfo->P3cc;
/* XGINew_CRT1Mode = ModeNo ; // SaveModeID */
StandTableIndex = XGI_GetModePtr( ModeNo , ModeIdIndex, pVBInfo ) ;
/* XGI_SetBIOSData(ModeNo , ModeIdIndex ) ; */
/* XGI_ClearBankRegs( ModeNo , ModeIdIndex ) ; */
XGI_SetSeqRegs( ModeNo , StandTableIndex , ModeIdIndex, pVBInfo ) ;
XGI_SetMiscRegs( StandTableIndex, pVBInfo ) ;
XGI_SetCRTCRegs( HwDeviceExtension , StandTableIndex, pVBInfo) ;
XGI_SetATTRegs( ModeNo , StandTableIndex , ModeIdIndex, pVBInfo ) ;
XGI_SetGRCRegs( StandTableIndex, pVBInfo ) ;
XGI_ClearExt1Regs(pVBInfo) ;
/* if ( pVBInfo->IF_DEF_ExpLink ) */
if ( HwDeviceExtension->jChipType == XG27 )
{
if ( pVBInfo->IF_DEF_LVDS == 0 )
{
XGI_SetDefaultVCLK( pVBInfo ) ;
}
}
temp = ~ProgrammingCRT2 ;
pVBInfo->SetFlag &= temp ;
pVBInfo->SelectCRT2Rate = 0 ;
if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
{
if ( pVBInfo->VBInfo & ( SetSimuScanMode | SetCRT2ToLCDA | SetInSlaveMode ) )
{
pVBInfo->SetFlag |= ProgrammingCRT2 ;
}
}
RefreshRateTableIndex = XGI_GetRatePtrCRT2( HwDeviceExtension, ModeNo , ModeIdIndex, pVBInfo ) ;
if ( RefreshRateTableIndex != 0xFFFF )
{
XGI_SetSync( RefreshRateTableIndex, pVBInfo ) ;
XGI_SetCRT1CRTC( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo, HwDeviceExtension ) ;
XGI_SetCRT1DE( HwDeviceExtension , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ;
XGI_SetCRT1Offset( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ;
XGI_SetCRT1VCLK( ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ;
}
if ( ( HwDeviceExtension->jChipType >= XG20 )&&
( HwDeviceExtension->jChipType < XG27 ) ) /* fix H/W DCLK/2 bug */
{
if ( ( ModeNo == 0x00 ) | (ModeNo == 0x01) )
{
XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , 0x4E) ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , 0xE9) ;
b3CC =(UCHAR) XGINew_GetReg2(XGINew_P3cc) ;
XGINew_SetReg3(XGINew_P3cc , (b3CC |= 0x0C) ) ;
}
else if ( ( ModeNo == 0x04) | ( ModeNo == 0x05) | ( ModeNo == 0x0D) )
{
XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , 0x1B) ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , 0xE3) ;
b3CC = (UCHAR)XGINew_GetReg2(XGINew_P3cc) ;
XGINew_SetReg3(XGINew_P3cc , (b3CC |= 0x0C) ) ;
}
}
if ( HwDeviceExtension->jChipType >= XG21 )
{
temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) ;
if ( temp & 0xA0 )
{
/*XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~0x20 ) ;*/ /* Enable write GPIOF */
/*XGINew_SetRegAND( pVBInfo->P3d4 , 0x48 , ~0x20 ) ;*/ /* P. DWN */
/* XG21 CRT1 Timing */
if ( HwDeviceExtension->jChipType == XG27 )
XGI_SetXG27CRTC( ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo );
else
XGI_SetXG21CRTC( ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo );
XGI_UpdateXG21CRTC( ModeNo , pVBInfo , RefreshRateTableIndex) ;
if ( HwDeviceExtension->jChipType == XG27 )
XGI_SetXG27LCD( pVBInfo , RefreshRateTableIndex , ModeNo );
else
XGI_SetXG21LCD( pVBInfo , RefreshRateTableIndex , ModeNo );
if ( pVBInfo->IF_DEF_LVDS == 1 )
{
if ( HwDeviceExtension->jChipType == XG27 )
XGI_SetXG27LVDSPara(ModeNo,ModeIdIndex, pVBInfo );
else
XGI_SetXG21LVDSPara(ModeNo,ModeIdIndex, pVBInfo );
}
/*XGINew_SetRegOR( pVBInfo->P3d4 , 0x48 , 0x20 ) ;*/ /* P. ON */
}
}
pVBInfo->SetFlag &= ( ~ProgrammingCRT2 ) ;
XGI_SetCRT1FIFO( ModeNo , HwDeviceExtension, pVBInfo ) ;
XGI_SetCRT1ModeRegs( HwDeviceExtension , ModeNo , ModeIdIndex , RefreshRateTableIndex , pVBInfo) ;
/* XGI_LoadCharacter(); //dif ifdef TVFont */
XGI_LoadDAC( ModeNo , ModeIdIndex, pVBInfo ) ;
/* XGI_ClearBuffer( HwDeviceExtension , ModeNo, pVBInfo ) ; */
#ifdef WIN2000
if ( pVBInfo->IF_DEF_CH7007 == 1 ) /* [Billy] 2007/05/14 */
{
VideoDebugPrint((0, "XGI_SetCRT1Group: VBInfo->IF_DEF_CH7007==1\n"));
SetCH7007Regs(HwDeviceExtension, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo ) ; /* 07/05/28 */
}
#endif
}
/* --------------------------------------------------------------------- */
/* Function : XGI_GetModePtr */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
UCHAR XGI_GetModePtr( USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo )
{
UCHAR index ;
if ( ModeNo <= 0x13 )
index = pVBInfo->SModeIDTable[ ModeIdIndex ].St_StTableIndex ;
else
{
if ( pVBInfo->ModeType <= 0x02 )
index = 0x1B ; /* 02 -> ModeEGA */
else
index = 0x0F ;
}
return( index ) ; /* Get pVBInfo->StandTable index */
}
/* --------------------------------------------------------------------- */
/* Function : XGI_SetBIOSData */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
/*UCHAR XGI_SetBIOSData( USHORT ModeNo , USHORT ModeIdIndex )
{
return( 0 ) ;
}
*/
/* --------------------------------------------------------------------- */
/* Function : XGI_ClearBankRegs */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
/*UCHAR XGI_ClearBankRegs( USHORT ModeNo , USHORT ModeIdIndex )
{
return( 0 ) ;
}
*/
/* --------------------------------------------------------------------- */
/* Function : XGI_SetSeqRegs */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGI_SetSeqRegs( USHORT ModeNo , USHORT StandTableIndex , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo )
{
UCHAR tempah ,
SRdata ;
USHORT i ,
modeflag ;
if ( ModeNo <= 0x13 )
modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ;
else
modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x00 , 0x03 ) ; /* Set SR0 */
tempah=pVBInfo->StandTable[ StandTableIndex ].SR[ 0 ] ;
i = SetCRT2ToLCDA ;
if ( pVBInfo->VBInfo & SetCRT2ToLCDA )
{
tempah |= 0x01 ;
}
else
{
if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToLCD ) )
{
if ( pVBInfo->VBInfo & SetInSlaveMode )
tempah |= 0x01 ;
}
}
tempah |= 0x20 ; /* screen off */
XGINew_SetReg1( pVBInfo->P3c4 , 0x01 , tempah ) ; /* Set SR1 */
for( i = 02 ; i <= 04 ; i++ )
{
SRdata = pVBInfo->StandTable[ StandTableIndex ].SR[ i - 1 ] ; /* Get SR2,3,4 from file */
XGINew_SetReg1( pVBInfo->P3c4 , i , SRdata ) ; /* Set SR2 3 4 */
}
}
/* --------------------------------------------------------------------- */
/* Function : XGI_SetMiscRegs */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGI_SetMiscRegs( USHORT StandTableIndex, PVB_DEVICE_INFO pVBInfo )
{
UCHAR Miscdata ;
Miscdata = pVBInfo->StandTable[ StandTableIndex ].MISC ; /* Get Misc from file */
/*
if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
{
if ( pVBInfo->VBInfo & SetCRT2ToLCDA )
{
Miscdata |= 0x0C ;
}
}
*/
XGINew_SetReg3( pVBInfo->P3c2 , Miscdata ) ; /* Set Misc(3c2) */
}
/* --------------------------------------------------------------------- */
/* Function : XGI_SetCRTCRegs */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGI_SetCRTCRegs( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT StandTableIndex, PVB_DEVICE_INFO pVBInfo )
{
UCHAR CRTCdata ;
USHORT i ;
CRTCdata = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x11 ) ;
CRTCdata &= 0x7f ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , CRTCdata ) ; /* Unlock CRTC */
for( i = 0 ; i <= 0x18 ; i++ )
{
CRTCdata = pVBInfo->StandTable[ StandTableIndex ].CRTC[ i ] ; /* Get CRTC from file */
XGINew_SetReg1( pVBInfo->P3d4 , i , CRTCdata ) ; /* Set CRTC( 3d4 ) */
}
/*
if ( ( HwDeviceExtension->jChipType == XGI_630 )&& ( HwDeviceExtension->jChipRevision == 0x30 ) )
{
if ( pVBInfo->VBInfo & SetInSlaveMode )
{
if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToTV ) )
{
XGINew_SetReg1( pVBInfo->P3d4 , 0x18 , 0xFE ) ;
}
}
}
*/
}
/* --------------------------------------------------------------------- */
/* Function : */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGI_SetATTRegs( USHORT ModeNo , USHORT StandTableIndex , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo )
{
UCHAR ARdata ;
USHORT i ,
modeflag ;
if ( ModeNo <= 0x13 )
modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ;
else
modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
for( i = 0 ; i <= 0x13 ; i++ )
{
ARdata = pVBInfo->StandTable[ StandTableIndex ].ATTR[ i ] ;
if ( modeflag & Charx8Dot ) /* ifndef Dot9 */
{
if ( i == 0x13 )
{
if ( pVBInfo->VBInfo & SetCRT2ToLCDA )
ARdata = 0 ;
else
{
if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToLCD ) )
{
if ( pVBInfo->VBInfo & SetInSlaveMode )
ARdata = 0 ;
}
}
}
}
XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */
XGINew_SetReg3( pVBInfo->P3c0 , i ) ; /* set index */
XGINew_SetReg3( pVBInfo->P3c0 , ARdata ) ; /* set data */
}
XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */
XGINew_SetReg3( pVBInfo->P3c0 , 0x14 ) ; /* set index */
XGINew_SetReg3( pVBInfo->P3c0 , 0x00 ) ; /* set data */
XGINew_GetReg2( pVBInfo->P3da ) ; /* Enable Attribute */
XGINew_SetReg3( pVBInfo->P3c0 , 0x20 ) ;
}
/* --------------------------------------------------------------------- */
/* Function : XGI_SetGRCRegs */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGI_SetGRCRegs( USHORT StandTableIndex, PVB_DEVICE_INFO pVBInfo )
{
UCHAR GRdata ;
USHORT i ;
for( i = 0 ; i <= 0x08 ; i++ )
{
GRdata = pVBInfo->StandTable[ StandTableIndex ].GRC[ i ] ; /* Get GR from file */
XGINew_SetReg1( pVBInfo->P3ce , i , GRdata ) ; /* Set GR(3ce) */
}
if ( pVBInfo->ModeType > ModeVGA )
{
GRdata = ( UCHAR )XGINew_GetReg1( pVBInfo->P3ce , 0x05 ) ;
GRdata &= 0xBF ; /* 256 color disable */
XGINew_SetReg1( pVBInfo->P3ce , 0x05 , GRdata ) ;
}
}
/* --------------------------------------------------------------------- */
/* Function : XGI_ClearExt1Regs */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGI_ClearExt1Regs(PVB_DEVICE_INFO pVBInfo)
{
USHORT i ;
for( i = 0x0A ; i <= 0x0E ; i++ )
XGINew_SetReg1( pVBInfo->P3c4 , i , 0x00 ) ; /* Clear SR0A-SR0E */
}
/* --------------------------------------------------------------------- */
/* Function : XGI_SetDefaultVCLK */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
UCHAR XGI_SetDefaultVCLK( PVB_DEVICE_INFO pVBInfo )
{
XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x31 , ~0x30 , 0x20 ) ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ 0 ].SR2B ) ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ 0 ].SR2C ) ;
XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x31 , ~0x30 , 0x10 ) ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ 1 ].SR2B ) ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ 1 ].SR2C ) ;
XGINew_SetRegAND( pVBInfo->P3c4 , 0x31 , ~0x30 ) ;
return( 0 ) ;
}
/* --------------------------------------------------------------------- */
/* Function : XGI_GetRatePtrCRT2 */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
USHORT XGI_GetRatePtrCRT2( PXGI_HW_DEVICE_INFO pXGIHWDE, USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo )
{
SHORT LCDRefreshIndex[] = { 0x00 , 0x00 , 0x03 , 0x01 } ,
LCDARefreshIndex[] = { 0x00 , 0x00 , 0x03 , 0x01 , 0x01 , 0x01 , 0x01 } ;
USHORT RefreshRateTableIndex , i ,
modeflag , index , temp ;
if ( ModeNo <= 0x13 )
{
modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ;
}
else
{
modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
}
if ( pVBInfo->IF_DEF_CH7005 == 1 )
{
if ( pVBInfo->VBInfo & SetCRT2ToTV )
{
if ( modeflag & HalfDCLK )
return( 0 ) ;
}
}
if ( ModeNo < 0x14 )
return( 0xFFFF ) ;
index = XGINew_GetReg1( pVBInfo->P3d4 , 0x33 ) ;
index = index >> pVBInfo->SelectCRT2Rate ;
index &= 0x0F ;
if ( pVBInfo->LCDInfo & LCDNonExpanding )
index = 0 ;
if ( index > 0 )
index-- ;
if ( pVBInfo->SetFlag & ProgrammingCRT2 )
{
if ( pVBInfo->IF_DEF_CH7005 == 1 )
{
if ( pVBInfo->VBInfo & SetCRT2ToTV )
{
index = 0 ;
}
}
if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) )
{
if( pVBInfo->IF_DEF_LVDS == 0 )
{
if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
temp = LCDARefreshIndex[ pVBInfo->LCDResInfo & 0x0F ] ; /* 301b */
else
temp = LCDRefreshIndex[ pVBInfo->LCDResInfo & 0x0F ] ;
if ( index > temp )
{
index = temp ;
}
}
else
{
index = 0 ;
}
}
}
RefreshRateTableIndex = pVBInfo->EModeIDTable[ ModeIdIndex ].REFindex ;
ModeNo = pVBInfo->RefIndex[ RefreshRateTableIndex ].ModeID ;
if ( pXGIHWDE->jChipType >= XG20 ) /* for XG20, XG21, XG27 */
{
/*
if ( pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag & XG2xNotSupport )
{
index++;
}
*/
if ( ( pVBInfo->RefIndex[ RefreshRateTableIndex ].XRes == 800 ) &&
( pVBInfo->RefIndex[ RefreshRateTableIndex ].YRes == 600 ) )
{
index++;
}
/* Alan 10/19/2007; do the similiar adjustment like XGISearchCRT1Rate() */
if ( ( pVBInfo->RefIndex[ RefreshRateTableIndex ].XRes == 1024 ) &&
( pVBInfo->RefIndex[ RefreshRateTableIndex ].YRes == 768 ) )
{
index++;
}
if ( ( pVBInfo->RefIndex[ RefreshRateTableIndex ].XRes == 1280 ) &&
( pVBInfo->RefIndex[ RefreshRateTableIndex ].YRes == 1024 ) )
{
index++;
}
}
i = 0 ;
do
{
if ( pVBInfo->RefIndex[ RefreshRateTableIndex + i ].ModeID != ModeNo )
break ;
temp = pVBInfo->RefIndex[ RefreshRateTableIndex + i ].Ext_InfoFlag ;
temp &= ModeInfoFlag ;
if ( temp < pVBInfo->ModeType )
break ;
i++ ;
index-- ;
} while( index != 0xFFFF ) ;
if ( !( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) )
{
if ( pVBInfo->VBInfo & SetInSlaveMode )
{
temp = pVBInfo->RefIndex[ RefreshRateTableIndex + i - 1 ].Ext_InfoFlag ;
if ( temp & InterlaceMode )
{
i++ ;
}
}
}
i-- ;
if ( ( pVBInfo->SetFlag & ProgrammingCRT2 ) )
{
temp = XGI_AjustCRT2Rate( ModeNo , ModeIdIndex , RefreshRateTableIndex , &i, pVBInfo) ;
}
return( RefreshRateTableIndex + i ) ; /*return(0x01|(temp1<<1)); */
}
/* --------------------------------------------------------------------- */
/* Function : XGI_AjustCRT2Rate */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
BOOLEAN XGI_AjustCRT2Rate( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex , USHORT *i, PVB_DEVICE_INFO pVBInfo )
{
USHORT tempax ,
tempbx ,
resinfo ,
modeflag ,
infoflag ;
if ( ModeNo <= 0x13 )
{
modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag */
}
else
{
modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
}
resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ;
tempbx = pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].ModeID ;
tempax = 0 ;
if ( pVBInfo->IF_DEF_LVDS == 0 )
{
if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC )
{
tempax |= SupportRAMDAC2 ;
if ( pVBInfo->VBType & VB_XGI301C )
tempax |= SupportCRT2in301C ;
}
if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) /* 301b */
{
tempax |= SupportLCD ;
if ( pVBInfo->LCDResInfo != Panel1280x1024 )
{
if ( pVBInfo->LCDResInfo != Panel1280x960 )
{
if ( pVBInfo->LCDInfo & LCDNonExpanding )
{
if ( resinfo >= 9 )
{
tempax = 0 ;
return( 0 ) ;
}
}
}
}
}
if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) /* for HiTV */
{
if ( ( pVBInfo->VBType & VB_XGI301LV ) && ( pVBInfo->VBExtInfo == VB_YPbPr1080i ) )
{
tempax |= SupportYPbPr ;
if ( pVBInfo->VBInfo & SetInSlaveMode )
{
if ( resinfo == 4 )
return( 0 ) ;
if ( resinfo == 3 )
return( 0 ) ;
if ( resinfo > 7 )
return( 0 ) ;
}
}
else
{
tempax |= SupportHiVisionTV ;
if ( pVBInfo->VBInfo & SetInSlaveMode )
{
if ( resinfo == 4 )
return( 0 ) ;
if ( resinfo == 3 )
{
if ( pVBInfo->SetFlag & TVSimuMode )
return( 0 ) ;
}
if ( resinfo > 7 )
return( 0 ) ;
}
}
}
else
{
if ( pVBInfo->VBInfo & ( SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | SetCRT2ToSCART | SetCRT2ToYPbPr | SetCRT2ToHiVisionTV ) )
{
tempax |= SupportTV ;
if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
{
tempax |= SupportTV1024 ;
}
if ( !( pVBInfo->VBInfo & SetPALTV ) )
{
if ( modeflag & NoSupportSimuTV )
{
if ( pVBInfo->VBInfo & SetInSlaveMode )
{
if ( !( pVBInfo->VBInfo & SetNotSimuMode ) )
{
return( 0 ) ;
}
}
}
}
}
}
}
else /* for LVDS */
{
if ( pVBInfo->IF_DEF_CH7005 == 1 )
{
if ( pVBInfo->VBInfo & SetCRT2ToTV )
{
tempax |= SupportCHTV ;
}
}
if ( pVBInfo->VBInfo & SetCRT2ToLCD )
{
tempax |= SupportLCD ;
if ( resinfo > 0x08 )
return( 0 ) ; /* 1024x768 */
if ( pVBInfo->LCDResInfo < Panel1024x768 )
{
if ( resinfo > 0x07 )
return( 0 ) ; /* 800x600 */
if ( resinfo == 0x04 )
return( 0 ) ; /* 512x384 */
}
}
}
for( ; pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].ModeID == tempbx ; ( *i )-- )
{
infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].Ext_InfoFlag ;
if ( infoflag & tempax )
{
return( 1 ) ;
}
if ( ( *i ) == 0 )
break ;
}
for( ( *i ) = 0 ; ; ( *i )++ )
{
infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].Ext_InfoFlag ;
if ( pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].ModeID != tempbx )
{
return( 0 ) ;
}
if ( infoflag & tempax )
{
return( 1 ) ;
}
}
return( 1 ) ;
}
/* --------------------------------------------------------------------- */
/* Function : XGI_SetSync */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGI_SetSync(USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo )
{
USHORT sync ,
temp ;
sync = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag >> 8 ; /* di+0x00 */
sync &= 0xC0 ;
temp = 0x2F ;
temp |= sync ;
XGINew_SetReg3( pVBInfo->P3c2 , temp ) ; /* Set Misc(3c2) */
}
/* --------------------------------------------------------------------- */
/* Function : XGI_SetCRT1CRTC */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGI_SetCRT1CRTC( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo, PXGI_HW_DEVICE_INFO HwDeviceExtension )
{
UCHAR index ,
data ;
USHORT i ;
index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; /* Get index */
index = index&IndexMask ;
data =( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x11 ) ;
data &= 0x7F ;
XGINew_SetReg1(pVBInfo->P3d4,0x11,data); /* Unlock CRTC */
for( i = 0 ; i < 8 ; i++ )
pVBInfo->TimingH[ 0 ].data[ i ] = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ i ] ;
for( i = 0 ; i < 7 ; i++ )
pVBInfo->TimingV[ 0 ].data[ i ] = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ i + 8 ] ;
XGI_SetCRT1Timing_H( pVBInfo, HwDeviceExtension ) ;
XGI_SetCRT1Timing_V( ModeIdIndex , ModeNo, pVBInfo ) ;
if( pVBInfo->ModeType > 0x03 )
XGINew_SetReg1( pVBInfo->P3d4 , 0x14 , 0x4F ) ;
}
/* --------------------------------------------------------------------- */
/* Function : XGI_SetCRT1Timing_H */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGI_SetCRT1Timing_H( PVB_DEVICE_INFO pVBInfo, PXGI_HW_DEVICE_INFO HwDeviceExtension )
{
UCHAR data , data1, pushax;
USHORT i , j ;
/* XGINew_SetReg1( pVBInfo->P3d4 , 0x51 , 0 ) ; */
/* XGINew_SetReg1( pVBInfo->P3d4 , 0x56 , 0 ) ; */
/* XGINew_SetRegANDOR( pVBInfo->P3d4 ,0x11 , 0x7f , 0x00 ) ; */
data = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x11 ) ; /* unlock cr0-7 */
data &= 0x7F ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , data ) ;
data = pVBInfo->TimingH[ 0 ].data[ 0 ] ;
XGINew_SetReg1( pVBInfo->P3d4 , 0 , data ) ;
for( i = 0x01 ; i <= 0x04 ; i++ )
{
data = pVBInfo->TimingH[ 0 ].data[ i ] ;
XGINew_SetReg1( pVBInfo->P3d4 , ( USHORT )( i + 1 ) , data ) ;
}
for( i = 0x05 ; i <= 0x06 ; i++ )
{
data = pVBInfo->TimingH[ 0 ].data[ i ];
XGINew_SetReg1( pVBInfo->P3c4 ,( USHORT )( i + 6 ) , data ) ;
}
j = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x0e ) ;
j &= 0x1F ;
data = pVBInfo->TimingH[ 0 ].data[ 7 ] ;
data &= 0xE0 ;
data |= j ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x0e , data ) ;
if ( HwDeviceExtension->jChipType >= XG20 )
{
data = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x04 ) ;
data = data - 1 ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x04 , data ) ;
data = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x05 ) ;
data1 = data ;
data1 &= 0xE0 ;
data &= 0x1F ;
if ( data == 0 )
{
pushax = data ;
data = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x0c ) ;
data &= 0xFB ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x0c , data ) ;
data = pushax ;
}
data = data - 1 ;
data |= data1 ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x05 , data ) ;
data = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x0e ) ;
data = data >> 5 ;
data = data + 3 ;
if ( data > 7 )
data = data - 7 ;
data = data << 5 ;
XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0e , ~0xE0 , data ) ;
}
}
/* --------------------------------------------------------------------- */
/* Function : XGI_SetCRT1Timing_V */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGI_SetCRT1Timing_V( USHORT ModeIdIndex , USHORT ModeNo,PVB_DEVICE_INFO pVBInfo )
{
UCHAR data ;
USHORT i , j ;
/* XGINew_SetReg1( pVBInfo->P3d4 , 0x51 , 0 ) ; */
/* XGINew_SetReg1( pVBInfo->P3d4 , 0x56 , 0 ) ; */
/* XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x11 , 0x7f , 0x00 ) ; */
for( i = 0x00 ; i <= 0x01 ; i++ )
{
data = pVBInfo->TimingV[ 0 ].data[ i ] ;
XGINew_SetReg1( pVBInfo->P3d4 , ( USHORT )( i + 6 ) , data ) ;
}
for( i = 0x02 ; i <= 0x03 ; i++ )
{
data = pVBInfo->TimingV[ 0 ].data[ i ] ;
XGINew_SetReg1( pVBInfo->P3d4 , ( USHORT )( i + 0x0e ) , data ) ;
}
for( i = 0x04 ; i <= 0x05 ; i++ )
{
data = pVBInfo->TimingV[ 0 ].data[ i ] ;
XGINew_SetReg1( pVBInfo->P3d4 , ( USHORT )( i + 0x11 ) , data ) ;
}
j = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x0a ) ;
j &= 0xC0 ;
data = pVBInfo->TimingV[ 0 ].data[ 6 ] ;
data &= 0x3F ;
data |= j ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x0a , data ) ;
data = pVBInfo->TimingV[ 0 ].data[ 6 ] ;
data &= 0x80 ;
data = data >> 2 ;
if ( ModeNo <= 0x13 )
i = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ;
else
i = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
i &= DoubleScanMode ;
if ( i )
data |= 0x80 ;
j = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x09 ) ;
j &= 0x5F ;
data |= j ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x09 , data ) ;
}
/* --------------------------------------------------------------------- */
/* Function : XGI_SetXG21CRTC */
/* Input : Stand or enhance CRTC table */
/* Output : Fill CRT Hsync/Vsync to SR2E/SR2F/SR30/SR33/SR34/SR3F */
/* Description : Set LCD timing */
/* --------------------------------------------------------------------- */
void XGI_SetXG21CRTC(USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo)
{
UCHAR StandTableIndex, index, Tempax, Tempbx, Tempcx, Tempdx ;
USHORT Temp1, Temp2, Temp3 ;
if ( ModeNo <= 0x13 )
{
StandTableIndex = XGI_GetModePtr( ModeNo , ModeIdIndex, pVBInfo ) ;
Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 4 ] ; /* CR04 HRS */
XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , Tempax ) ; /* SR2E [7:0]->HRS */
Tempbx = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 5 ] ; /* Tempbx: CR05 HRE */
Tempbx &= 0x1F ; /* Tempbx: HRE[4:0] */
Tempcx = Tempax ;
Tempcx &= 0xE0 ; /* Tempcx: HRS[7:5] */
Tempdx = Tempcx | Tempbx ; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */
if ( Tempbx < ( Tempax & 0x1F ) ) /* IF HRE < HRS */
Tempdx |= 0x20 ; /* Tempdx: HRE = HRE + 0x20 */
Tempdx <<= 2 ; /* Tempdx << 2 */
XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , Tempdx ) ; /* SR2F [7:2]->HRE */
XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , 0xE3 , 00 ) ;
Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 16 ] ; /* Tempax: CR16 VRS */
Tempbx = Tempax ; /* Tempbx=Tempax */
Tempax &= 0x01 ; /* Tempax: VRS[0] */
XGINew_SetRegOR( pVBInfo->P3c4 , 0x33 , Tempax ) ; /* SR33[0]->VRS */
Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 7 ] ; /* Tempax: CR7 VRS */
Tempdx = Tempbx >> 1 ; /* Tempdx: VRS[7:1] */
Tempcx = Tempax & 0x04 ; /* Tempcx: CR7[2] */
Tempcx <<= 5 ; /* Tempcx[7]: VRS[8] */
Tempdx |= Tempcx ; /* Tempdx: VRS[8:1] */
XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , Tempdx ) ; /* SR34[7:0]: VRS[8:1] */
Temp1 = Tempcx << 1 ; /* Temp1[8]: VRS[8] UCHAR -> USHORT */
Temp1 |= Tempbx ; /* Temp1[8:0]: VRS[8:0] */
Tempax &= 0x80 ; /* Tempax[7]: CR7[7] */
Temp2 = Tempax << 2 ; /* Temp2[9]: VRS[9] */
Temp1 |= Temp2 ; /* Temp1[9:0]: VRS[9:0] */
Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 17 ] ; /* CR16 VRE */
Tempax &= 0x0F ; /* Tempax[3:0]: VRE[3:0] */
Temp2 = Temp1 & 0x3F0 ; /* Temp2[9:4]: VRS[9:4] */
Temp2 |= Tempax ; /* Temp2[9:0]: VRE[9:0] */
Temp3 = Temp1 & 0x0F ; /* Temp3[3:0]: VRS[3:0] */
if ( Tempax < Temp3 ) /* VRE[3:0]<VRS[3:0] */
Temp2 |= 0x10 ; /* Temp2: VRE + 0x10 */
Temp2 &= 0xFF ; /* Temp2[7:0]: VRE[7:0] */
Tempax = (UCHAR)Temp2 ; /* Tempax[7:0]: VRE[7:0] */
Tempax <<= 2 ; /* Tempax << 2: VRE[5:0] */
Temp1 &= 0x600 ; /* Temp1[10:9]: VRS[10:9] */
Temp1 >>= 9 ; /* [10:9]->[1:0] */
Tempbx = (UCHAR)Temp1 ; /* Tempbx[1:0]: VRS[10:9] */
Tempax |= Tempbx ; /* VRE[5:0]VRS[10:9] */
Tempax &= 0x7F ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x3F , Tempax ) ; /* SR3F D[7:2]->VRE D[1:0]->VRS */
}
else
{
index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ;
Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 3 ] ; /* Tempax: CR4 HRS */
Tempcx = Tempax ; /* Tempcx: HRS */
XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , Tempax ) ; /* SR2E[7:0]->HRS */
Tempdx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 5 ] ; /* SRB */
Tempdx &= 0xC0 ; /* Tempdx[7:6]: SRB[7:6] */
Temp1 = Tempdx ; /* Temp1[7:6]: HRS[9:8] */
Temp1 <<= 2 ; /* Temp1[9:8]: HRS[9:8] */
Temp1 |= Tempax ; /* Temp1[9:0]: HRS[9:0] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 4 ] ; /* CR5 HRE */
Tempax &= 0x1F ; /* Tempax[4:0]: HRE[4:0] */
Tempbx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 6 ] ; /* SRC */
Tempbx &= 0x04 ; /* Tempbx[2]: HRE[5] */
Tempbx <<= 3 ; /* Tempbx[5]: HRE[5] */
Tempax |= Tempbx ; /* Tempax[5:0]: HRE[5:0] */
Temp2 = Temp1 & 0x3C0 ; /* Temp2[9:6]: HRS[9:6] */
Temp2 |= Tempax ; /* Temp2[9:0]: HRE[9:0] */
Tempcx &= 0x3F ; /* Tempcx[5:0]: HRS[5:0] */
if( Tempax < Tempcx ) /* HRE < HRS */
Temp2 |= 0x40 ; /* Temp2 + 0x40 */
Temp2 &= 0xFF ;
Tempax = (UCHAR)Temp2 ; /* Tempax: HRE[7:0] */
Tempax <<= 2 ; /* Tempax[7:2]: HRE[5:0] */
Tempdx >>= 6 ; /* Tempdx[7:6]->[1:0] HRS[9:8] */
Tempax |= Tempdx ; /* HRE[5:0]HRS[9:8] */
XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , Tempax ) ; /* SR2F D[7:2]->HRE, D[1:0]->HRS */
XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , 0xE3 , 00 ) ;
Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 10 ] ; /* CR10 VRS */
Tempbx = Tempax ; /* Tempbx: VRS */
Tempax &= 0x01 ; /* Tempax[0]: VRS[0] */
XGINew_SetRegOR( pVBInfo->P3c4 , 0x33 , Tempax ) ; /* SR33[0]->VRS[0] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 9 ] ; /* CR7[2][7] VRE */
Tempcx = Tempbx >> 1 ; /* Tempcx[6:0]: VRS[7:1] */
Tempdx = Tempax & 0x04 ; /* Tempdx[2]: CR7[2] */
Tempdx <<= 5 ; /* Tempdx[7]: VRS[8] */
Tempcx |= Tempdx ; /* Tempcx[7:0]: VRS[8:1] */
XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , Tempcx ) ; /* SR34[8:1]->VRS */
Temp1 = Tempdx ; /* Temp1[7]: Tempdx[7] */
Temp1 <<= 1 ; /* Temp1[8]: VRS[8] */
Temp1 |= Tempbx ; /* Temp1[8:0]: VRS[8:0] */
Tempax &= 0x80 ;
Temp2 = Tempax << 2 ; /* Temp2[9]: VRS[9] */
Temp1 |= Temp2 ; /* Temp1[9:0]: VRS[9:0] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempax: SRA */
Tempax &= 0x08 ; /* Tempax[3]: VRS[3] */
Temp2 = Tempax ;
Temp2 <<= 7 ; /* Temp2[10]: VRS[10] */
Temp1 |= Temp2 ; /* Temp1[10:0]: VRS[10:0] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 11 ] ; /* Tempax: CR11 VRE */
Tempax &= 0x0F ; /* Tempax[3:0]: VRE[3:0] */
Tempbx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempbx: SRA */
Tempbx &= 0x20 ; /* Tempbx[5]: VRE[5] */
Tempbx >>= 1 ; /* Tempbx[4]: VRE[4] */
Tempax |= Tempbx ; /* Tempax[4:0]: VRE[4:0] */
Temp2 = Temp1 & 0x7E0 ; /* Temp2[10:5]: VRS[10:5] */
Temp2 |= Tempax ; /* Temp2[10:5]: VRE[10:5] */
Temp3 = Temp1 & 0x1F ; /* Temp3[4:0]: VRS[4:0] */
if ( Tempax < Temp3 ) /* VRE < VRS */
Temp2 |= 0x20 ; /* VRE + 0x20 */
Temp2 &= 0xFF ;
Tempax = (UCHAR)Temp2 ; /* Tempax: VRE[7:0] */
Tempax <<= 2 ; /* Tempax[7:0]; VRE[5:0]00 */
Temp1 &= 0x600 ; /* Temp1[10:9]: VRS[10:9] */
Temp1 >>= 9 ; /* Temp1[1:0]: VRS[10:9] */
Tempbx = (UCHAR)Temp1 ;
Tempax |= Tempbx ; /* Tempax[7:0]: VRE[5:0]VRS[10:9] */
Tempax &= 0x7F ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x3F , Tempax ) ; /* SR3F D[7:2]->VRE D[1:0]->VRS */
}
}
void XGI_SetXG27CRTC(USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo)
{
USHORT StandTableIndex, index, Tempax, Tempbx, Tempcx, Tempdx ;
if ( ModeNo <= 0x13 )
{
StandTableIndex = XGI_GetModePtr( ModeNo , ModeIdIndex, pVBInfo ) ;
Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 4 ] ; /* CR04 HRS */
XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , Tempax ) ; /* SR2E [7:0]->HRS */
Tempbx = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 5 ] ; /* Tempbx: CR05 HRE */
Tempbx &= 0x1F ; /* Tempbx: HRE[4:0] */
Tempcx = Tempax ;
Tempcx &= 0xE0 ; /* Tempcx: HRS[7:5] */
Tempdx = Tempcx | Tempbx ; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */
if ( Tempbx < ( Tempax & 0x1F ) ) /* IF HRE < HRS */
Tempdx |= 0x20 ; /* Tempdx: HRE = HRE + 0x20 */
Tempdx <<= 2 ; /* Tempdx << 2 */
XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , Tempdx ) ; /* SR2F [7:2]->HRE */
XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , 0xE3 , 00 ) ;
Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 16 ] ; /* Tempax: CR10 VRS */
XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , Tempax ) ; /* SR34[7:0]->VRS */
Tempcx = Tempax ; /* Tempcx=Tempax=VRS[7:0] */
Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 7 ] ; /* Tempax[7][2]: CR7[7][2] VRS[9][8] */
Tempbx = Tempax ; /* Tempbx=CR07 */
Tempax &= 0x04 ; /* Tempax[2]: CR07[2] VRS[8] */
Tempax >>= 2;
XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x01, Tempax ) ; /* SR35 D[0]->VRS D[8] */
Tempcx |= (Tempax << 8) ; /* Tempcx[8] |= VRS[8] */
Tempcx |= (Tempbx & 0x80)<<2; /* Tempcx[9] |= VRS[9] */
Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 17 ] ; /* CR11 VRE */
Tempax &= 0x0F ; /* Tempax: VRE[3:0] */
Tempbx = Tempcx ; /* Tempbx=Tempcx=VRS[9:0] */
Tempbx &= 0x3F0 ; /* Tempbx[9:4]: VRS[9:4] */
Tempbx |= Tempax ; /* Tempbx[9:0]: VRE[9:0] */
if ( Tempax <= (Tempcx & 0x0F) ) /* VRE[3:0]<=VRS[3:0] */
Tempbx |= 0x10 ; /* Tempbx: VRE + 0x10 */
Tempax = (UCHAR)Tempbx & 0xFF; /* Tempax[7:0]: VRE[7:0] */
Tempax <<= 2 ; /* Tempax << 2: VRE[5:0] */
Tempcx = (Tempcx&0x600)>>8; /* Tempcx VRS[10:9] */
XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0xFC, Tempax ) ; /* SR3F D[7:2]->VRE D[5:0] */
XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x06, Tempcx ) ; /* SR35 D[2:1]->VRS[10:9] */
}
else
{
index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ;
Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 3 ] ; /* Tempax: CR4 HRS */
Tempbx = Tempax ; /* Tempbx: HRS[7:0] */
XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , Tempax ) ; /* SR2E[7:0]->HRS */
Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 5 ] ; /* SR0B */
Tempax &= 0xC0 ; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/
Tempbx |= (Tempax << 2); /* Tempbx: HRS[9:0] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 4 ] ; /* CR5 HRE */
Tempax &= 0x1F ; /* Tempax[4:0]: HRE[4:0] */
Tempcx = Tempax ; /* Tempcx: HRE[4:0] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 6 ] ; /* SRC */
Tempax &= 0x04 ; /* Tempax[2]: HRE[5] */
Tempax <<= 3 ; /* Tempax[5]: HRE[5] */
Tempcx |= Tempax ; /* Tempcx[5:0]: HRE[5:0] */
Tempbx = Tempbx & 0x3C0 ; /* Tempbx[9:6]: HRS[9:6] */
Tempbx |= Tempcx ; /* Tempbx: HRS[9:6]HRE[5:0] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 3 ] ; /* Tempax: CR4 HRS */
Tempax &= 0x3F ; /* Tempax: HRS[5:0] */
if( Tempcx <= Tempax ) /* HRE[5:0] < HRS[5:0] */
Tempbx += 0x40 ; /* Tempbx= Tempbx + 0x40 : HRE[9:0]*/
Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 5 ] ; /* SR0B */
Tempax &= 0xC0 ; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/
Tempax >>= 6; /* Tempax[1:0]: HRS[9:8]*/
Tempax |= ((Tempbx << 2) & 0xFF); /* Tempax[7:2]: HRE[5:0] */
XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , Tempax ) ; /* SR2F [7:2][1:0]: HRE[5:0]HRS[9:8] */
XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , 0xE3 , 00 ) ;
Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 10 ] ; /* CR10 VRS */
XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , Tempax ) ; /* SR34[7:0]->VRS[7:0] */
Tempcx = Tempax ; /* Tempcx <= VRS[7:0] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 9 ] ; /* CR7[7][2] VRS[9][8] */
Tempbx = Tempax ; /* Tempbx <= CR07[7:0] */
Tempax = Tempax & 0x04 ; /* Tempax[2]: CR7[2]: VRS[8] */
Tempax >>= 2 ; /* Tempax[0]: VRS[8] */
XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x01 , Tempax ) ; /* SR35[0]: VRS[8] */
Tempcx |= (Tempax<<8) ; /* Tempcx <= VRS[8:0] */
Tempcx |= ((Tempbx&0x80)<<2) ; /* Tempcx <= VRS[9:0] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempax: SR0A */
Tempax &= 0x08; /* SR0A[3] VRS[10] */
Tempcx |= (Tempax<<7) ; /* Tempcx <= VRS[10:0] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 11 ] ; /* Tempax: CR11 VRE */
Tempax &= 0x0F ; /* Tempax[3:0]: VRE[3:0] */
Tempbx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempbx: SR0A */
Tempbx &= 0x20 ; /* Tempbx[5]: SR0A[5]: VRE[4] */
Tempbx >>= 1 ; /* Tempbx[4]: VRE[4] */
Tempax |= Tempbx ; /* Tempax[4:0]: VRE[4:0] */
Tempbx = Tempcx ; /* Tempbx: VRS[10:0] */
Tempbx &= 0x7E0 ; /* Tempbx[10:5]: VRS[10:5] */
Tempbx |= Tempax ; /* Tempbx: VRS[10:5]VRE[4:0] */
if ( Tempbx <= Tempcx ) /* VRE <= VRS */
Tempbx |= 0x20 ; /* VRE + 0x20 */
Tempax = (Tempbx<<2) & 0xFF ; /* Tempax: Tempax[7:0]; VRE[5:0]00 */
XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0xFC , Tempax ) ; /* SR3F[7:2]:VRE[5:0] */
Tempax = Tempcx >> 8;
XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x07 , Tempax ) ; /* SR35[2:0]:VRS[10:8] */
}
}
/* --------------------------------------------------------------------- */
/* Function : XGI_SetXG21LCD */
/* Input : */
/* Output : FCLK duty cycle, FCLK delay compensation */
/* Description : All values set zero */
/* --------------------------------------------------------------------- */
void XGI_SetXG21LCD(PVB_DEVICE_INFO pVBInfo,USHORT RefreshRateTableIndex,USHORT ModeNo)
{
USHORT Data , Temp , b3CC ;
USHORT XGI_P3cc ;
XGI_P3cc = pVBInfo->P3cc ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x2E , 0x00 ) ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x2F , 0x00 ) ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , 0x00 ) ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , 0x00 ) ;
if ( ((*pVBInfo->pDVOSetting)&0xC0) == 0xC0 )
{
XGINew_SetReg1( pVBInfo->P3d4 , 0x2E , *pVBInfo->pCR2E ) ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x2F , *pVBInfo->pCR2F ) ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , *pVBInfo->pCR46 ) ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , *pVBInfo->pCR47 ) ;
}
Temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ;
if ( Temp & 0x01 )
{
XGINew_SetRegOR( pVBInfo->P3c4 , 0x06 , 0x40 ) ; /* 18 bits FP */
XGINew_SetRegOR( pVBInfo->P3c4 , 0x09 , 0x40 ) ;
}
XGINew_SetRegOR( pVBInfo->P3c4 , 0x1E , 0x01 ) ; /* Negative blank polarity */
XGINew_SetRegAND( pVBInfo->P3c4 , 0x30 , ~0x20 ) ;
XGINew_SetRegAND( pVBInfo->P3c4 , 0x35 , ~0x80 ) ;
if ( ModeNo <= 0x13 )
{
b3CC = (UCHAR) XGINew_GetReg2( XGI_P3cc ) ;
if ( b3CC & 0x40 )
XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */
if ( b3CC & 0x80 )
XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */
}
else
{
Data = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ;
if ( Data & 0x4000 )
XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */
if ( Data & 0x8000 )
XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */
}
}
void XGI_SetXG27LCD(PVB_DEVICE_INFO pVBInfo,USHORT RefreshRateTableIndex,USHORT ModeNo)
{
USHORT Data , Temp , b3CC ;
USHORT XGI_P3cc ;
XGI_P3cc = pVBInfo->P3cc ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x2E , 0x00 ) ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x2F , 0x00 ) ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , 0x00 ) ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , 0x00 ) ;
Temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ;
if ( ( Temp & 0x03 ) == 0 ) /* dual 12 */
{
XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , 0x13 ) ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , 0x13 ) ;
}
if ( ((*pVBInfo->pDVOSetting)&0xC0) == 0xC0 )
{
XGINew_SetReg1( pVBInfo->P3d4 , 0x2E , *pVBInfo->pCR2E ) ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x2F , *pVBInfo->pCR2F ) ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , *pVBInfo->pCR46 ) ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , *pVBInfo->pCR47 ) ;
}
XGI_SetXG27FPBits(pVBInfo);
XGINew_SetRegOR( pVBInfo->P3c4 , 0x1E , 0x01 ) ; /* Negative blank polarity */
XGINew_SetRegAND( pVBInfo->P3c4 , 0x30 , ~0x20 ) ; /* Hsync polarity */
XGINew_SetRegAND( pVBInfo->P3c4 , 0x35 , ~0x80 ) ; /* Vsync polarity */
if ( ModeNo <= 0x13 )
{
b3CC = (UCHAR) XGINew_GetReg2( XGI_P3cc ) ;
if ( b3CC & 0x40 )
XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */
if ( b3CC & 0x80 )
XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */
}
else
{
Data = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ;
if ( Data & 0x4000 )
XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */
if ( Data & 0x8000 )
XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */
}
}
/* --------------------------------------------------------------------- */
/* Function : XGI_UpdateXG21CRTC */
/* Input : */
/* Output : CRT1 CRTC */
/* Description : Modify CRT1 Hsync/Vsync to fix LCD mode timing */
/* --------------------------------------------------------------------- */
void XGI_UpdateXG21CRTC( USHORT ModeNo , PVB_DEVICE_INFO pVBInfo , USHORT RefreshRateTableIndex )
{
int i , index = -1;
XGINew_SetRegAND( pVBInfo->P3d4 , 0x11 , 0x7F ) ; /* Unlock CR0~7 */
if ( ModeNo <= 0x13 )
{
for( i = 0 ; i < 12 ; i++ )
{
if ( ModeNo == pVBInfo->UpdateCRT1[ i ].ModeID )
index = i ;
}
}
else
{
if ( ModeNo == 0x2E && ( pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC == RES640x480x60 ) )
index = 12 ;
else if ( ModeNo == 0x2E && ( pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC == RES640x480x72 ) )
index = 13 ;
else if ( ModeNo == 0x2F )
index = 14 ;
else if ( ModeNo == 0x50 )
index = 15 ;
else if ( ModeNo == 0x59 )
index = 16 ;
}
if( index != -1 )
{
XGINew_SetReg1( pVBInfo->P3d4 , 0x02 , pVBInfo->UpdateCRT1[ index ].CR02 ) ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x03 , pVBInfo->UpdateCRT1[ index ].CR03 ) ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x15 , pVBInfo->UpdateCRT1[ index ].CR15 ) ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x16 , pVBInfo->UpdateCRT1[ index ].CR16 ) ;
}
}
/* --------------------------------------------------------------------- */
/* Function : XGI_SetCRT1DE */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGI_SetCRT1DE( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT ModeNo,USHORT ModeIdIndex , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo )
{
USHORT resindex ,
tempax ,
tempbx ,
tempcx ,
temp ,
modeflag ;
UCHAR data ;
resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ;
if ( ModeNo <= 0x13 )
{
modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ;
tempax = pVBInfo->StResInfo[ resindex ].HTotal ;
tempbx = pVBInfo->StResInfo[ resindex ].VTotal ;
}
else
{
modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
tempax = pVBInfo->ModeResInfo[ resindex ].HTotal ;
tempbx = pVBInfo->ModeResInfo[ resindex ].VTotal ;
}
if ( modeflag & HalfDCLK )
tempax = tempax >> 1 ;
if ( ModeNo > 0x13 )
{
if ( modeflag & HalfDCLK )
tempax = tempax << 1 ;
temp = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ;
if ( temp & InterlaceMode )
tempbx = tempbx >> 1 ;
if ( modeflag & DoubleScanMode )
tempbx = tempbx << 1 ;
}
tempcx = 8 ;
/* if ( !( modeflag & Charx8Dot ) ) */
/* tempcx = 9 ; */
tempax /= tempcx ;
tempax -= 1 ;
tempbx -= 1 ;
tempcx = tempax ;
temp = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x11 ) ;
data = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x11 ) ;
data &= 0x7F ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , data ) ; /* Unlock CRTC */
XGINew_SetReg1( pVBInfo->P3d4 , 0x01 , ( USHORT )( tempcx & 0xff ) ) ;
XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x0b , ~0x0c , ( USHORT )( ( tempcx & 0x0ff00 ) >> 10 ) ) ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x12 , ( USHORT )( tempbx & 0xff ) ) ;
tempax = 0 ;
tempbx = tempbx >> 8 ;
if ( tempbx & 0x01 )
tempax |= 0x02 ;
if ( tempbx & 0x02 )
tempax |= 0x40 ;
XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x42 , tempax ) ;
data =( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x07 ) ;
data &= 0xFF ;
tempax = 0 ;
if ( tempbx & 0x04 )
tempax |= 0x02 ;
XGINew_SetRegANDOR( pVBInfo->P3d4 ,0x0a , ~0x02 , tempax ) ;
XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , temp ) ;
}
/* --------------------------------------------------------------------- */
/* Function : XGI_GetResInfo */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
USHORT XGI_GetResInfo(USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo )
{
USHORT resindex ;
if ( ModeNo <= 0x13 )
{
resindex = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */
}
else
{
resindex = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */
}
return( resindex ) ;
}
/* --------------------------------------------------------------------- */
/* Function : XGI_SetCRT1Offset */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGI_SetCRT1Offset( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex , PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo )
{
USHORT temp ,
ah ,
al ,
temp2 ,
i ,
DisplayUnit ;
/* GetOffset */
temp = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeInfo ;
temp = temp >> 8 ;
temp = pVBInfo->ScreenOffset[ temp ] ;
temp2 = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ;
temp2 &= InterlaceMode ;
if ( temp2 )
temp = temp << 1;
temp2 = pVBInfo->ModeType - ModeEGA ;
switch( temp2 )
{
case 0:
temp2 = 1 ;
break ;
case 1:
temp2 = 2 ;
break ;
case 2:
temp2 = 4 ;
break ;
case 3:
temp2 = 4 ;
break ;
case 4:
temp2 = 6 ;
break;
case 5:
temp2 = 8 ;
break ;
default:
break ;
}
if ( ( ModeNo >= 0x26 ) && ( ModeNo <= 0x28 ) )
temp = temp * temp2 + temp2 / 2 ;
else
temp *= temp2 ;
/* SetOffset */
DisplayUnit = temp ;
temp2 = temp ;
temp = temp >> 8 ; /* ah */
temp &= 0x0F ;
i = XGINew_GetReg1( pVBInfo->P3c4 , 0x0E ) ;
i &= 0xF0 ;
i |= temp ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x0E , i ) ;
temp =( UCHAR )temp2 ;
temp &= 0xFF ; /* al */
XGINew_SetReg1( pVBInfo->P3d4 , 0x13 , temp ) ;
/* SetDisplayUnit */
temp2 = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ;
temp2 &= InterlaceMode ;
if ( temp2 )
DisplayUnit >>= 1 ;
DisplayUnit = DisplayUnit << 5 ;
ah = ( DisplayUnit & 0xff00 ) >> 8 ;
al = DisplayUnit & 0x00ff ;
if ( al == 0 )
ah += 1 ;
else
ah += 2 ;
if ( HwDeviceExtension->jChipType >= XG20 )
if ( ( ModeNo == 0x4A ) | (ModeNo == 0x49 ) )
ah -= 1 ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x10 , ah ) ;
}
/* --------------------------------------------------------------------- */
/* Function : XGI_SetCRT1VCLK */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGI_SetCRT1VCLK( USHORT ModeNo , USHORT ModeIdIndex ,
PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo )
{
UCHAR index , data ;
USHORT vclkindex ;
if ( pVBInfo->IF_DEF_LVDS == 1 )
{
index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ;
data = XGINew_GetReg1( pVBInfo->P3c4 , 0x31 ) & 0xCF ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , data ) ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ index ].SR2B ) ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ index ].SR2C ) ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x2D , 0x01 ) ;
}
else if ( ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) && ( pVBInfo->VBInfo & SetCRT2ToLCDA ) )
{
vclkindex = XGI_GetVCLK2Ptr( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ;
data = XGINew_GetReg1( pVBInfo->P3c4 , 0x31 ) & 0xCF ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , data ) ;
data = pVBInfo->VBVCLKData[ vclkindex ].Part4_A ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , data ) ;
data = pVBInfo->VBVCLKData[ vclkindex ].Part4_B ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , data ) ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x2D , 0x01 ) ;
}
else
{
index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ;
data = XGINew_GetReg1( pVBInfo->P3c4 , 0x31 ) & 0xCF ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , data ) ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ index ].SR2B ) ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ index ].SR2C ) ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x2D , 0x01 ) ;
}
if ( HwDeviceExtension->jChipType >= XG20 )
{
if ( pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag & HalfDCLK )
{
data = XGINew_GetReg1( pVBInfo->P3c4 , 0x2B ) ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , data ) ;
data = XGINew_GetReg1( pVBInfo->P3c4 , 0x2C ) ;
index = data ;
index &= 0xE0 ;
data &= 0x1F ;
data = data << 1 ;
data += 1 ;
data |= index ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , data ) ;
}
}
}
/* --------------------------------------------------------------------- */
/* Function : XGI_SetCRT1FIFO */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGI_SetCRT1FIFO( USHORT ModeNo , PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo )
{
USHORT data ;
data = XGINew_GetReg1( pVBInfo->P3c4 , 0x3D ) ;
data &= 0xfe ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x3D , data ) ; /* diable auto-threshold */
if ( ModeNo > 0x13 )
{
XGINew_SetReg1( pVBInfo->P3c4 , 0x08 , 0x34 ) ;
data = XGINew_GetReg1( pVBInfo->P3c4 , 0x09 ) ;
data &= 0xC0 ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x09 , data | 0x30) ;
data = XGINew_GetReg1( pVBInfo->P3c4 , 0x3D ) ;
data |= 0x01 ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x3D , data ) ;
}
else
{
if (HwDeviceExtension->jChipType == XG27)
{
XGINew_SetReg1( pVBInfo->P3c4 , 0x08 , 0x0E ) ;
data = XGINew_GetReg1( pVBInfo->P3c4 , 0x09 ) ;
data &= 0xC0 ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x09 , data | 0x20 ) ;
}
else
{
XGINew_SetReg1( pVBInfo->P3c4 , 0x08 , 0xAE ) ;
data = XGINew_GetReg1( pVBInfo->P3c4 , 0x09 ) ;
data &= 0xF0 ;
XGINew_SetReg1( pVBInfo->P3c4 , 0x09 , data ) ;
}
}
if (HwDeviceExtension->jChipType == XG21)
{
XGI_SetXG21FPBits(pVBInfo); /* Fix SR9[7:6] can't read back */
}
}
/* --------------------------------------------------------------------- */
/* Function : XGI_SetCRT1ModeRegs */
/* Input : */
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
void XGI_SetCRT1ModeRegs( PXGI_HW_DEVICE_INFO HwDeviceExtension ,
USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo )
{
USHORT data ,
data2 ,
data3 ,
infoflag = 0 ,
modeflag ,
resindex ,
xres ;
if ( ModeNo > 0x13 )
{
modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ;
}
else
modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag */
if ( XGINew_GetReg1( pVBInfo->P3d4 , 0x31 ) & 0x01 )
XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x1F , 0x3F , 0x00 ) ;
if ( ModeNo > 0x13 )
data = infoflag ;
else
data = 0 ;
data2 = 0 ;
if ( ModeNo > 0x13 )
{
if ( pVBInfo->ModeType > 0x02 )
{
data2 |= 0x02 ;
data3 = pVBInfo->ModeType - ModeVGA ;
data3 = data3 << 2 ;
data2 |= data3 ;
}
}
data &= InterlaceMode ;
if ( data )
data2 |= 0x20 ;
XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x06 , ~0x3F , data2 ) ;
/* XGINew_SetReg1(pVBInfo->P3c4,0x06,data2); */
resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ;
if ( ModeNo <= 0x13 )
xres = pVBInfo->StResInfo[ resindex ].HTotal ;
else
xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */
data = 0x0000 ;
if ( infoflag & InterlaceMode )
{
if ( xres == 1024 )
data = 0x0035 ;
else if ( xres == 1280 )
data = 0x0048 ;
}
data2 = data & 0x00FF ;
XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x19 , 0xFF , data2 ) ;
data2 = ( data & 0xFF00 ) >> 8 ;
XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x19 , 0xFC , data2 ) ;
if( modeflag & HalfDCLK )
XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xF7 , 0x08 ) ;
data2 = 0 ;
if ( modeflag & LineCompareOff )
data2 |= 0x08 ;
if ( ModeNo > 0x13 )
{
if ( pVBInfo->ModeType == ModeEGA )
data2 |= 0x40 ;
}
XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0F , ~0x48 , data2 ) ;
data = 0x60 ;
if ( pVBInfo->ModeType != ModeText )
{
data = data ^ 0x60 ;
if ( pVBInfo->ModeType != ModeEGA )
{
data = data ^ 0xA0 ;
}
}
XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x21 , 0x1F , data ) ;
XGI_SetVCLKState( HwDeviceExtension , ModeNo , RefreshRateTableIndex, pVBInfo) ;
/* if(modeflag&HalfDCLK)//030305 fix lowresolution bug */
/* if(XGINew_IF_DEF_NEW_LOWRES) */