apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame^] | 1 | #include "osdef.h" |
| 2 | |
| 3 | #ifdef TC |
| 4 | #include <stdio.h> |
| 5 | #include <string.h> |
| 6 | #include <conio.h> |
| 7 | #include <dos.h> |
| 8 | #endif |
| 9 | |
| 10 | |
| 11 | #ifdef LINUX_XF86 |
| 12 | #include "xf86.h" |
| 13 | #include "xf86PciInfo.h" |
| 14 | #include "xgi.h" |
| 15 | #include "xgi_regs.h" |
| 16 | #endif |
| 17 | |
| 18 | #ifdef LINUX_KERNEL |
| 19 | #include <asm/io.h> |
| 20 | #include <linux/types.h> |
| 21 | #include <linux/version.h> |
| 22 | #include "XGIfb.h" |
| 23 | /*#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) |
| 24 | #include <video/XGIfb.h> |
| 25 | #else |
| 26 | #include <linux/XGIfb.h> |
| 27 | #endif*/ |
| 28 | #endif |
| 29 | |
| 30 | #ifdef WIN2000 |
| 31 | #include <dderror.h> |
| 32 | #include <devioctl.h> |
| 33 | #include <miniport.h> |
| 34 | #include <ntddvdeo.h> |
| 35 | #include <video.h> |
| 36 | |
| 37 | #include "xgiv.h" |
| 38 | #include "dd_i2c.h" |
| 39 | #include "tools.h" |
| 40 | #endif |
| 41 | |
| 42 | #include "vb_def.h" |
| 43 | #include "vgatypes.h" |
| 44 | #include "vb_struct.h" |
| 45 | #include "vb_util.h" |
| 46 | #include "vb_table.h" |
| 47 | |
| 48 | |
| 49 | |
| 50 | #define IndexMask 0xff |
| 51 | #ifndef XGI_MASK_DUAL_CHIP |
| 52 | #define XGI_MASK_DUAL_CHIP 0x04 /* SR3A */ |
| 53 | #endif |
| 54 | |
| 55 | |
| 56 | |
| 57 | BOOLEAN XGI_IsLCDDualLink(PVB_DEVICE_INFO pVBInfo); |
| 58 | BOOLEAN XGI_SetCRT2Group301(USHORT ModeNo, PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo); |
| 59 | BOOLEAN XGI_BacklightByDrv(PVB_DEVICE_INFO pVBInfo); |
| 60 | |
| 61 | BOOLEAN XGI_IsLCDON(PVB_DEVICE_INFO pVBInfo); |
| 62 | BOOLEAN XGI_DisableChISLCD(PVB_DEVICE_INFO pVBInfo); |
| 63 | BOOLEAN XGI_EnableChISLCD(PVB_DEVICE_INFO pVBInfo); |
| 64 | BOOLEAN XGI_AjustCRT2Rate(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,USHORT *i, PVB_DEVICE_INFO pVBInfo); |
| 65 | BOOLEAN XGI_SearchModeID( USHORT ModeNo,USHORT *ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 66 | BOOLEAN XGI_GetLCDInfo(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 67 | BOOLEAN XGISetModeNew( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT ModeNo ) ; |
| 68 | BOOLEAN XGI_BridgeIsOn(PVB_DEVICE_INFO pVBInfo); |
| 69 | UCHAR XGI_GetModePtr( USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo); |
| 70 | USHORT XGI_GetOffset(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo); |
| 71 | USHORT XGI_GetRatePtrCRT2( PXGI_HW_DEVICE_INFO pXGIHWDE, USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo ); |
| 72 | USHORT XGI_GetResInfo(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 73 | USHORT XGI_GetColorDepth(USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo); |
| 74 | USHORT XGI_GetVGAHT2(PVB_DEVICE_INFO pVBInfo); |
| 75 | USHORT XGI_GetVCLK2Ptr(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo); |
| 76 | void XGI_VBLongWait(PVB_DEVICE_INFO pVBInfo); |
| 77 | void XGI_SaveCRT2Info(USHORT ModeNo, PVB_DEVICE_INFO pVBInfo); |
| 78 | void XGI_GetCRT2Data(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 79 | void XGI_GetCRT2ResInfo(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 80 | void XGI_PreSetGroup1(USHORT ModeNo,USHORT ModeIdIndex, PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 81 | void XGI_SetGroup1(USHORT ModeNo,USHORT ModeIdIndex, PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 82 | void XGI_SetLockRegs(USHORT ModeNo,USHORT ModeIdIndex, PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 83 | void XGI_SetLCDRegs(USHORT ModeNo,USHORT ModeIdIndex, PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 84 | void XGI_SetGroup2(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo); |
| 85 | void XGI_SetGroup3(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 86 | void XGI_SetGroup4(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo); |
| 87 | void XGI_SetGroup5(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 88 | void* XGI_GetLcdPtr(USHORT BX, USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 89 | void* XGI_GetTVPtr(USHORT BX, USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 90 | void XGI_FirePWDEnable(PVB_DEVICE_INFO pVBInfo); |
| 91 | void XGI_EnableGatingCRT(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo); |
| 92 | void XGI_DisableGatingCRT(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo); |
| 93 | void XGI_SetPanelDelay(USHORT tempbl, PVB_DEVICE_INFO pVBInfo); |
| 94 | void XGI_SetPanelPower(USHORT tempah,USHORT tempbl, PVB_DEVICE_INFO pVBInfo); |
| 95 | void XGI_EnablePWD( PVB_DEVICE_INFO pVBInfo); |
| 96 | void XGI_DisablePWD( PVB_DEVICE_INFO pVBInfo); |
| 97 | void XGI_AutoThreshold( PVB_DEVICE_INFO pVBInfo); |
| 98 | void XGI_SetTap4Regs( PVB_DEVICE_INFO pVBInfo); |
| 99 | |
| 100 | void XGI_DisplayOn(PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo); |
| 101 | void XGI_DisplayOff( PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo ); |
| 102 | void XGI_SetCRT1Group(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo); |
| 103 | void XGI_SetXG21CRTC(USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 104 | void XGI_SetXG21LCD(PVB_DEVICE_INFO pVBInfo,USHORT RefreshRateTableIndex,USHORT ModeNo); |
| 105 | void XGI_SetXG27CRTC(USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 106 | void XGI_SetXG27LCD(PVB_DEVICE_INFO pVBInfo,USHORT RefreshRateTableIndex,USHORT ModeNo); |
| 107 | void XGI_UpdateXG21CRTC(USHORT ModeNo, PVB_DEVICE_INFO pVBInfo, USHORT RefreshRateTableIndex); |
| 108 | void XGI_WaitDisply(PVB_DEVICE_INFO pVBInfo); |
| 109 | void XGI_SenseCRT1(PVB_DEVICE_INFO pVBInfo); |
| 110 | void XGI_SetSeqRegs(USHORT ModeNo,USHORT StandTableIndex,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo); |
| 111 | void XGI_SetMiscRegs(USHORT StandTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 112 | void XGI_SetCRTCRegs(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT StandTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 113 | void XGI_SetATTRegs(USHORT ModeNo,USHORT StandTableIndex,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo ); |
| 114 | void XGI_SetGRCRegs(USHORT StandTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 115 | void XGI_ClearExt1Regs(PVB_DEVICE_INFO pVBInfo); |
| 116 | |
| 117 | void XGI_SetSync(USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo); |
| 118 | void XGI_SetCRT1CRTC(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo,PXGI_HW_DEVICE_INFO HwDeviceExtension); |
| 119 | void XGI_SetCRT1Timing_H(PVB_DEVICE_INFO pVBInfo,PXGI_HW_DEVICE_INFO HwDeviceExtension); |
| 120 | void XGI_SetCRT1Timing_V(USHORT ModeIdIndex,USHORT ModeNo,PVB_DEVICE_INFO pVBInfo); |
| 121 | void XGI_SetCRT1DE(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo); |
| 122 | void XGI_SetCRT1VCLK(USHORT ModeNo,USHORT ModeIdIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 123 | void XGI_SetCRT1FIFO(USHORT ModeNo,PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo); |
| 124 | void XGI_SetCRT1ModeRegs(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo); |
| 125 | void XGI_SetVCLKState(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo); |
| 126 | |
| 127 | void XGI_LoadDAC(USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo); |
| 128 | void XGI_WriteDAC(USHORT dl, USHORT ah, USHORT al, USHORT dh, PVB_DEVICE_INFO pVBInfo); |
| 129 | /*void XGI_ClearBuffer(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,PVB_DEVICE_INFO pVBInfo);*/ |
| 130 | void XGI_SetLCDAGroup(USHORT ModeNo,USHORT ModeIdIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo); |
| 131 | void XGI_GetLVDSResInfo( USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo); |
| 132 | void XGI_GetLVDSData(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo); |
| 133 | void XGI_ModCRT1Regs(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo); |
| 134 | void XGI_SetLVDSRegs(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo); |
| 135 | void XGI_UpdateModeInfo(PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo); |
| 136 | void XGI_GetVGAType(PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo); |
| 137 | void XGI_GetVBType(PVB_DEVICE_INFO pVBInfo); |
| 138 | void XGI_GetVBInfo(USHORT ModeNo,USHORT ModeIdIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo); |
| 139 | void XGI_GetTVInfo(USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo); |
| 140 | void XGI_SetCRT2ECLK( USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo); |
| 141 | void InitTo330Pointer(UCHAR,PVB_DEVICE_INFO pVBInfo); |
| 142 | void XGI_GetLCDSync(USHORT* HSyncWidth, USHORT* VSyncWidth, PVB_DEVICE_INFO pVBInfo); |
| 143 | void XGI_DisableBridge(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo); |
| 144 | void XGI_EnableBridge(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo); |
| 145 | void XGI_SetCRT2VCLK(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 146 | void XGI_OEM310Setting(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 147 | void XGI_SetDelayComp(PVB_DEVICE_INFO pVBInfo); |
| 148 | void XGI_SetLCDCap(PVB_DEVICE_INFO pVBInfo); |
| 149 | void XGI_SetLCDCap_A(USHORT tempcx,PVB_DEVICE_INFO pVBInfo); |
| 150 | void XGI_SetLCDCap_B(USHORT tempcx,PVB_DEVICE_INFO pVBInfo); |
| 151 | void SetSpectrum(PVB_DEVICE_INFO pVBInfo); |
| 152 | void XGI_SetAntiFlicker(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 153 | void XGI_SetEdgeEnhance(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 154 | void XGI_SetPhaseIncr(PVB_DEVICE_INFO pVBInfo); |
| 155 | void XGI_SetYFilter(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 156 | void XGI_GetTVPtrIndex2(USHORT* tempbx,UCHAR* tempcl,UCHAR* tempch, PVB_DEVICE_INFO pVBInfo); |
| 157 | USHORT XGI_GetTVPtrIndex( PVB_DEVICE_INFO pVBInfo ); |
| 158 | void XGI_SetCRT2ModeRegs(USHORT ModeNo,PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo ); |
| 159 | void XGI_CloseCRTC(PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo); |
| 160 | void XGI_OpenCRTC(PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo); |
| 161 | void XGI_GetRAMDAC2DATA(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo); |
| 162 | void XGI_UnLockCRT2(PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo); |
| 163 | void XGI_LockCRT2(PXGI_HW_DEVICE_INFO, PVB_DEVICE_INFO pVBInfo); |
| 164 | void XGINew_EnableCRT2(PVB_DEVICE_INFO pVBInfo); |
| 165 | void XGINew_LCD_Wait_Time(UCHAR DelayTime, PVB_DEVICE_INFO pVBInfo); |
| 166 | void XGI_LongWait(PVB_DEVICE_INFO pVBInfo); |
| 167 | void XGI_SetCRT1Offset( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex , PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo ); |
| 168 | void XGI_GetLCDVCLKPtr(UCHAR* di_0,UCHAR *di_1, PVB_DEVICE_INFO pVBInfo); |
| 169 | UCHAR XGI_GetVCLKPtr(USHORT RefreshRateTableIndex,USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo); |
| 170 | void XGI_GetVCLKLen(UCHAR tempal,UCHAR* di_0,UCHAR* di_1, PVB_DEVICE_INFO pVBInfo); |
| 171 | USHORT XGI_GetLCDCapPtr(PVB_DEVICE_INFO pVBInfo); |
| 172 | USHORT XGI_GetLCDCapPtr1(PVB_DEVICE_INFO pVBInfo); |
| 173 | XGI301C_Tap4TimingStruct* XGI_GetTap4Ptr(USHORT tempcx, PVB_DEVICE_INFO pVBInfo); |
| 174 | void XGI_SetXG21FPBits(PVB_DEVICE_INFO pVBInfo); |
| 175 | void XGI_SetXG27FPBits(PVB_DEVICE_INFO pVBInfo); |
| 176 | UCHAR XGI_XG21GetPSCValue(PVB_DEVICE_INFO pVBInfo); |
| 177 | UCHAR XGI_XG27GetPSCValue(PVB_DEVICE_INFO pVBInfo); |
| 178 | void XGI_XG21BLSignalVDD(USHORT tempbh,USHORT tempbl, PVB_DEVICE_INFO pVBInfo); |
| 179 | void XGI_XG27BLSignalVDD(USHORT tempbh,USHORT tempbl, PVB_DEVICE_INFO pVBInfo); |
| 180 | void XGI_XG21SetPanelDelay(USHORT tempbl, PVB_DEVICE_INFO pVBInfo); |
| 181 | BOOLEAN XGI_XG21CheckLVDSMode(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ); |
| 182 | void XGI_SetXG21LVDSPara(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ); |
| 183 | void XGI_SetXG27LVDSPara(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ); |
| 184 | UCHAR XGI_SetDefaultVCLK( PVB_DEVICE_INFO pVBInfo ); |
| 185 | |
| 186 | extern void ReadVBIOSTablData( UCHAR ChipType , PVB_DEVICE_INFO pVBInfo); |
| 187 | #ifdef WIN2000 |
| 188 | /* [Billy] 2007/05/17 For CH7007 */ |
| 189 | extern UCHAR CH7007TVReg_UNTSC[][8],CH7007TVReg_ONTSC[][8],CH7007TVReg_UPAL[][8],CH7007TVReg_OPAL[][8]; |
| 190 | extern UCHAR CH7007TVCRT1UNTSC_H[][10],CH7007TVCRT1ONTSC_H[][10],CH7007TVCRT1UPAL_H[][10],CH7007TVCRT1OPAL_H[][10] ; |
| 191 | extern UCHAR CH7007TVCRT1UNTSC_V[][10],CH7007TVCRT1ONTSC_V[][10],CH7007TVCRT1UPAL_V[][10],CH7007TVCRT1OPAL_V[][10] ; |
| 192 | extern UCHAR XGI7007_CHTVVCLKUNTSC[],XGI7007_CHTVVCLKONTSC[],XGI7007_CHTVVCLKUPAL[],XGI7007_CHTVVCLKOPAL[]; |
| 193 | |
| 194 | extern BOOLEAN XGI_XG21CheckCH7007TVMode(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) ; |
| 195 | extern void SetCH7007Regs(PXGI_HW_DEVICE_INFO HwDeviceExtension, USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) ; |
| 196 | extern VP_STATUS TurnOnCH7007(PHW_DEVICE_EXTENSION pHWDE) ; |
| 197 | extern VP_STATUS TurnOffCH7007(PHW_DEVICE_EXTENSION pHWDE) ; |
| 198 | extern BOOLEAN IsCH7007TVMode(PVB_DEVICE_INFO pVBInfo) ; |
| 199 | #endif |
| 200 | |
| 201 | /* USHORT XGINew_flag_clearbuffer; 0: no clear frame buffer 1:clear frame buffer */ |
| 202 | |
| 203 | |
| 204 | |
| 205 | |
| 206 | |
| 207 | USHORT XGINew_MDA_DAC[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 208 | 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, |
| 209 | 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, |
| 210 | 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F, |
| 211 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| 212 | 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, |
| 213 | 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, |
| 214 | 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F}; |
| 215 | |
| 216 | USHORT XGINew_CGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, |
| 217 | 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, |
| 218 | 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, |
| 219 | 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, |
| 220 | 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, |
| 221 | 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, |
| 222 | 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, |
| 223 | 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F}; |
| 224 | |
| 225 | USHORT XGINew_EGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x05,0x15, |
| 226 | 0x20,0x30,0x24,0x34,0x21,0x31,0x25,0x35, |
| 227 | 0x08,0x18,0x0C,0x1C,0x09,0x19,0x0D,0x1D, |
| 228 | 0x28,0x38,0x2C,0x3C,0x29,0x39,0x2D,0x3D, |
| 229 | 0x02,0x12,0x06,0x16,0x03,0x13,0x07,0x17, |
| 230 | 0x22,0x32,0x26,0x36,0x23,0x33,0x27,0x37, |
| 231 | 0x0A,0x1A,0x0E,0x1E,0x0B,0x1B,0x0F,0x1F, |
| 232 | 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F}; |
| 233 | |
| 234 | USHORT XGINew_VGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, |
| 235 | 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, |
| 236 | 0x00,0x05,0x08,0x0B,0x0E,0x11,0x14,0x18, |
| 237 | 0x1C,0x20,0x24,0x28,0x2D,0x32,0x38,0x3F, |
| 238 | |
| 239 | 0x00,0x10,0x1F,0x2F,0x3F,0x1F,0x27,0x2F, |
| 240 | 0x37,0x3F,0x2D,0x31,0x36,0x3A,0x3F,0x00, |
| 241 | 0x07,0x0E,0x15,0x1C,0x0E,0x11,0x15,0x18, |
| 242 | 0x1C,0x14,0x16,0x18,0x1A,0x1C,0x00,0x04, |
| 243 | 0x08,0x0C,0x10,0x08,0x0A,0x0C,0x0E,0x10, |
| 244 | 0x0B,0x0C,0x0D,0x0F,0x10}; |
| 245 | |
| 246 | |
| 247 | /* --------------------------------------------------------------------- */ |
| 248 | /* Function : InitTo330Pointer */ |
| 249 | /* Input : */ |
| 250 | /* Output : */ |
| 251 | /* Description : */ |
| 252 | /* --------------------------------------------------------------------- */ |
| 253 | void InitTo330Pointer( UCHAR ChipType ,PVB_DEVICE_INFO pVBInfo) |
| 254 | { |
| 255 | pVBInfo->SModeIDTable = (XGI_StStruct *) XGI330_SModeIDTable ; |
| 256 | pVBInfo->StandTable = (XGI_StandTableStruct *) XGI330_StandTable ; |
| 257 | pVBInfo->EModeIDTable = (XGI_ExtStruct *) XGI330_EModeIDTable ; |
| 258 | pVBInfo->RefIndex = (XGI_Ext2Struct *) XGI330_RefIndex ; |
| 259 | pVBInfo->XGINEWUB_CRT1Table = (XGI_CRT1TableStruct *) XGI_CRT1Table ; |
| 260 | |
| 261 | /* add for new UNIVGABIOS */ |
| 262 | /* XGINew_UBLCDDataTable = (XGI_LCDDataTablStruct *) XGI_LCDDataTable ; */ |
| 263 | /* XGINew_UBTVDataTable = (XGI_TVDataTablStruct *) XGI_TVDataTable ; */ |
| 264 | |
| 265 | |
| 266 | if ( ChipType >= XG40 ) |
| 267 | { |
| 268 | pVBInfo->MCLKData = (XGI_MCLKDataStruct *) XGI340New_MCLKData ; |
| 269 | pVBInfo->ECLKData = (XGI_ECLKDataStruct *) XGI340_ECLKData ; |
| 270 | } |
| 271 | else |
| 272 | { |
| 273 | pVBInfo->MCLKData = (XGI_MCLKDataStruct *) XGI330New_MCLKData ; |
| 274 | pVBInfo->ECLKData = (XGI_ECLKDataStruct *) XGI330_ECLKData ; |
| 275 | } |
| 276 | |
| 277 | pVBInfo->VCLKData = (XGI_VCLKDataStruct *) XGI_VCLKData ; |
| 278 | pVBInfo->VBVCLKData = (XGI_VBVCLKDataStruct *) XGI_VBVCLKData ; |
| 279 | pVBInfo->ScreenOffset = XGI330_ScreenOffset ; |
| 280 | pVBInfo->StResInfo = (XGI_StResInfoStruct *) XGI330_StResInfo ; |
| 281 | pVBInfo->ModeResInfo = (XGI_ModeResInfoStruct *) XGI330_ModeResInfo ; |
| 282 | |
| 283 | pVBInfo->pOutputSelect = &XGI330_OutputSelect ; |
| 284 | pVBInfo->pSoftSetting = &XGI330_SoftSetting ; |
| 285 | pVBInfo->pSR07 = &XGI330_SR07 ; |
| 286 | pVBInfo->LCDResInfo = 0 ; |
| 287 | pVBInfo->LCDTypeInfo = 0 ; |
| 288 | pVBInfo->LCDInfo = 0 ; |
| 289 | pVBInfo->VBInfo = 0 ; |
| 290 | pVBInfo->TVInfo = 0; |
| 291 | |
| 292 | |
| 293 | pVBInfo->SR15 = XGI340_SR13 ; |
| 294 | pVBInfo->CR40 = XGI340_cr41 ; |
| 295 | pVBInfo->SR25 = XGI330_sr25 ; |
| 296 | pVBInfo->pSR31 = &XGI330_sr31 ; |
| 297 | pVBInfo->pSR32 = &XGI330_sr32 ; |
| 298 | pVBInfo->CR6B = XGI340_CR6B ; |
| 299 | pVBInfo->CR6E = XGI340_CR6E ; |
| 300 | pVBInfo->CR6F = XGI340_CR6F ; |
| 301 | pVBInfo->CR89 = XGI340_CR89 ; |
| 302 | pVBInfo->AGPReg = XGI340_AGPReg ; |
| 303 | pVBInfo->SR16 = XGI340_SR16 ; |
| 304 | pVBInfo->pCRCF = &XG40_CRCF ; |
| 305 | pVBInfo->pXGINew_DRAMTypeDefinition = &XG40_DRAMTypeDefinition ; |
| 306 | |
| 307 | |
| 308 | pVBInfo->CR49 = XGI330_CR49 ; |
| 309 | pVBInfo->pSR1F = &XGI330_SR1F ; |
| 310 | pVBInfo->pSR21 = &XGI330_SR21 ; |
| 311 | pVBInfo->pSR22 = &XGI330_SR22 ; |
| 312 | pVBInfo->pSR23 = &XGI330_SR23 ; |
| 313 | pVBInfo->pSR24 = &XGI330_SR24 ; |
| 314 | pVBInfo->pSR33 = &XGI330_SR33 ; |
| 315 | |
| 316 | |
| 317 | |
| 318 | pVBInfo->pCRT2Data_1_2 = &XGI330_CRT2Data_1_2 ; |
| 319 | pVBInfo->pCRT2Data_4_D = &XGI330_CRT2Data_4_D ; |
| 320 | pVBInfo->pCRT2Data_4_E = &XGI330_CRT2Data_4_E ; |
| 321 | pVBInfo->pCRT2Data_4_10 = &XGI330_CRT2Data_4_10 ; |
| 322 | pVBInfo->pRGBSenseData = &XGI330_RGBSenseData ; |
| 323 | pVBInfo->pVideoSenseData = &XGI330_VideoSenseData ; |
| 324 | pVBInfo->pYCSenseData = &XGI330_YCSenseData ; |
| 325 | pVBInfo->pRGBSenseData2 = &XGI330_RGBSenseData2 ; |
| 326 | pVBInfo->pVideoSenseData2 = &XGI330_VideoSenseData2 ; |
| 327 | pVBInfo->pYCSenseData2 = &XGI330_YCSenseData2 ; |
| 328 | |
| 329 | pVBInfo->NTSCTiming = XGI330_NTSCTiming ; |
| 330 | pVBInfo->PALTiming = XGI330_PALTiming ; |
| 331 | pVBInfo->HiTVExtTiming = XGI330_HiTVExtTiming ; |
| 332 | pVBInfo->HiTVSt1Timing = XGI330_HiTVSt1Timing ; |
| 333 | pVBInfo->HiTVSt2Timing = XGI330_HiTVSt2Timing ; |
| 334 | pVBInfo->HiTVTextTiming = XGI330_HiTVTextTiming ; |
| 335 | pVBInfo->YPbPr750pTiming = XGI330_YPbPr750pTiming ; |
| 336 | pVBInfo->YPbPr525pTiming = XGI330_YPbPr525pTiming ; |
| 337 | pVBInfo->YPbPr525iTiming = XGI330_YPbPr525iTiming ; |
| 338 | pVBInfo->HiTVGroup3Data = XGI330_HiTVGroup3Data ; |
| 339 | pVBInfo->HiTVGroup3Simu = XGI330_HiTVGroup3Simu ; |
| 340 | pVBInfo->HiTVGroup3Text = XGI330_HiTVGroup3Text ; |
| 341 | pVBInfo->Ren525pGroup3 = XGI330_Ren525pGroup3 ; |
| 342 | pVBInfo->Ren750pGroup3 = XGI330_Ren750pGroup3 ; |
| 343 | |
| 344 | |
| 345 | pVBInfo->TimingH = (XGI_TimingHStruct *) XGI_TimingH ; |
| 346 | pVBInfo->TimingV = (XGI_TimingVStruct *) XGI_TimingV ; |
| 347 | pVBInfo->UpdateCRT1 = (XGI_XG21CRT1Struct *) XGI_UpdateCRT1Table ; |
| 348 | |
| 349 | pVBInfo->CHTVVCLKUNTSC = XGI330_CHTVVCLKUNTSC ; |
| 350 | pVBInfo->CHTVVCLKONTSC = XGI330_CHTVVCLKONTSC ; |
| 351 | pVBInfo->CHTVVCLKUPAL = XGI330_CHTVVCLKUPAL ; |
| 352 | pVBInfo->CHTVVCLKOPAL = XGI330_CHTVVCLKOPAL ; |
| 353 | |
| 354 | /* 310 customization related */ |
| 355 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 356 | pVBInfo->LCDCapList = XGI_LCDDLCapList ; |
| 357 | else |
| 358 | pVBInfo->LCDCapList = XGI_LCDCapList ; |
| 359 | |
| 360 | if ( ( ChipType == XG21 ) || ( ChipType == XG27 ) ) |
| 361 | pVBInfo->XG21_LVDSCapList = XGI21_LCDCapList ; |
| 362 | |
| 363 | pVBInfo->XGI_TVDelayList = XGI301TVDelayList ; |
| 364 | pVBInfo->XGI_TVDelayList2 = XGI301TVDelayList2 ; |
| 365 | |
| 366 | |
| 367 | pVBInfo->pXGINew_I2CDefinition = &XG40_I2CDefinition ; |
| 368 | |
| 369 | if ( ChipType >= XG20 ) |
| 370 | pVBInfo->pXGINew_CR97 = &XG20_CR97 ; |
| 371 | |
| 372 | if ( ChipType == XG27 ) |
| 373 | { |
| 374 | pVBInfo->MCLKData = (XGI_MCLKDataStruct *) XGI27New_MCLKData ; |
| 375 | pVBInfo->CR40 = XGI27_cr41 ; |
| 376 | pVBInfo->pXGINew_CR97 = &XG27_CR97 ; |
| 377 | pVBInfo->pSR36 = &XG27_SR36 ; |
| 378 | pVBInfo->pCR8F = &XG27_CR8F ; |
| 379 | pVBInfo->pCRD0 = XG27_CRD0 ; |
| 380 | pVBInfo->pCRDE = XG27_CRDE ; |
| 381 | pVBInfo->pSR40 = &XG27_SR40 ; |
| 382 | pVBInfo->pSR41 = &XG27_SR41 ; |
| 383 | |
| 384 | } |
| 385 | |
| 386 | if ( ChipType >= XG20 ) |
| 387 | { |
| 388 | pVBInfo->pDVOSetting = &XG21_DVOSetting ; |
| 389 | pVBInfo->pCR2E = &XG21_CR2E ; |
| 390 | pVBInfo->pCR2F = &XG21_CR2F ; |
| 391 | pVBInfo->pCR46 = &XG21_CR46 ; |
| 392 | pVBInfo->pCR47 = &XG21_CR47 ; |
| 393 | } |
| 394 | |
| 395 | } |
| 396 | |
| 397 | |
| 398 | |
| 399 | |
| 400 | |
| 401 | |
| 402 | /* --------------------------------------------------------------------- */ |
| 403 | /* Function : XGISetModeNew */ |
| 404 | /* Input : */ |
| 405 | /* Output : */ |
| 406 | /* Description : */ |
| 407 | /* --------------------------------------------------------------------- */ |
| 408 | BOOLEAN XGISetModeNew( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT ModeNo ) |
| 409 | { |
| 410 | USHORT ModeIdIndex ; |
| 411 | /* PUCHAR pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress ; */ |
| 412 | VB_DEVICE_INFO VBINF; |
| 413 | PVB_DEVICE_INFO pVBInfo = &VBINF; |
| 414 | pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase ; |
| 415 | pVBInfo->BaseAddr = (ULONG)HwDeviceExtension->pjIOAddress ; |
| 416 | pVBInfo->IF_DEF_LVDS = 0 ; |
| 417 | pVBInfo->IF_DEF_CH7005 = 0 ; |
| 418 | pVBInfo->IF_DEF_LCDA = 1 ; |
| 419 | pVBInfo->IF_DEF_CH7017 = 0 ; |
| 420 | pVBInfo->IF_DEF_CH7007 = 0 ; /* [Billy] 2007/05/14 */ |
| 421 | pVBInfo->IF_DEF_VideoCapture = 0 ; |
| 422 | pVBInfo->IF_DEF_ScaleLCD = 0 ; |
| 423 | pVBInfo->IF_DEF_OEMUtil = 0 ; |
| 424 | pVBInfo->IF_DEF_PWD = 0 ; |
| 425 | |
| 426 | |
| 427 | if ( HwDeviceExtension->jChipType >= XG20 ) /* kuku 2004/06/25 */ |
| 428 | { |
| 429 | pVBInfo->IF_DEF_YPbPr = 0 ; |
| 430 | pVBInfo->IF_DEF_HiVision = 0 ; |
| 431 | pVBInfo->IF_DEF_CRT2Monitor = 0 ; |
| 432 | pVBInfo->VBType = 0 ; /*set VBType default 0*/ |
| 433 | } |
| 434 | else if ( HwDeviceExtension->jChipType >= XG40 ) |
| 435 | { |
| 436 | pVBInfo->IF_DEF_YPbPr = 1 ; |
| 437 | pVBInfo->IF_DEF_HiVision = 1 ; |
| 438 | pVBInfo->IF_DEF_CRT2Monitor = 1 ; |
| 439 | } |
| 440 | else |
| 441 | { |
| 442 | pVBInfo->IF_DEF_YPbPr = 1 ; |
| 443 | pVBInfo->IF_DEF_HiVision = 1 ; |
| 444 | pVBInfo->IF_DEF_CRT2Monitor = 0 ; |
| 445 | } |
| 446 | |
| 447 | pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14 ; |
| 448 | pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24 ; |
| 449 | pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10 ; |
| 450 | pVBInfo->P3ce = pVBInfo->BaseAddr + 0x1e ; |
| 451 | pVBInfo->P3c2 = pVBInfo->BaseAddr + 0x12 ; |
| 452 | pVBInfo->P3cc = pVBInfo->BaseAddr + 0x1C ; |
| 453 | pVBInfo->P3ca = pVBInfo->BaseAddr + 0x1a ; |
| 454 | pVBInfo->P3c6 = pVBInfo->BaseAddr + 0x16 ; |
| 455 | pVBInfo->P3c7 = pVBInfo->BaseAddr + 0x17 ; |
| 456 | pVBInfo->P3c8 = pVBInfo->BaseAddr + 0x18 ; |
| 457 | pVBInfo->P3c9 = pVBInfo->BaseAddr + 0x19 ; |
| 458 | pVBInfo->P3da = pVBInfo->BaseAddr + 0x2A ; |
| 459 | pVBInfo->Part0Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_00 ; |
| 460 | pVBInfo->Part1Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_04 ; |
| 461 | pVBInfo->Part2Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_10 ; |
| 462 | pVBInfo->Part3Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_12 ; |
| 463 | pVBInfo->Part4Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 ; |
| 464 | pVBInfo->Part5Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 + 2 ; |
| 465 | |
| 466 | if ( HwDeviceExtension->jChipType == XG21 ) /* for x86 Linux, XG21 LVDS */ |
| 467 | { |
| 468 | if ( ( XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) & 0xE0 ) == 0xC0 ) |
| 469 | { |
| 470 | pVBInfo->IF_DEF_LVDS = 1 ; |
| 471 | } |
| 472 | } |
| 473 | if ( HwDeviceExtension->jChipType == XG27 ) |
| 474 | { |
| 475 | if ( ( XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) & 0xE0 ) == 0xC0 ) |
| 476 | { |
| 477 | if ( XGINew_GetReg1( pVBInfo->P3d4 , 0x30 ) & 0x20 ) |
| 478 | { |
| 479 | pVBInfo->IF_DEF_LVDS = 1 ; |
| 480 | } |
| 481 | } |
| 482 | } |
| 483 | |
| 484 | if ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 */ |
| 485 | XGI_GetVBType( pVBInfo ) ; |
| 486 | |
| 487 | InitTo330Pointer( HwDeviceExtension->jChipType, pVBInfo ) ; |
| 488 | #ifdef WIN2000 |
| 489 | ReadVBIOSTablData( HwDeviceExtension->jChipType , pVBInfo) ; |
| 490 | #endif |
| 491 | if ( ModeNo & 0x80 ) |
| 492 | { |
| 493 | ModeNo = ModeNo & 0x7F ; |
| 494 | /* XGINew_flag_clearbuffer = 0 ; */ |
| 495 | } |
| 496 | /* else |
| 497 | { |
| 498 | XGINew_flag_clearbuffer = 1 ; |
| 499 | } |
| 500 | */ |
| 501 | XGINew_SetReg1( pVBInfo->P3c4 , 0x05 , 0x86 ) ; |
| 502 | |
| 503 | if ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 1.Openkey */ |
| 504 | XGI_UnLockCRT2( HwDeviceExtension , pVBInfo ) ; |
| 505 | |
| 506 | XGI_SearchModeID( ModeNo , &ModeIdIndex, pVBInfo ) ; |
| 507 | |
| 508 | XGI_GetVGAType(HwDeviceExtension, pVBInfo) ; |
| 509 | |
| 510 | if ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 */ |
| 511 | { |
| 512 | XGI_GetVBInfo(ModeNo , ModeIdIndex , HwDeviceExtension, pVBInfo ) ; |
| 513 | XGI_GetTVInfo(ModeNo , ModeIdIndex, pVBInfo ) ; |
| 514 | XGI_GetLCDInfo(ModeNo , ModeIdIndex, pVBInfo ) ; |
| 515 | XGI_DisableBridge( HwDeviceExtension,pVBInfo ) ; |
| 516 | /* XGI_OpenCRTC( HwDeviceExtension, pVBInfo ) ; */ |
| 517 | |
| 518 | if ( pVBInfo->VBInfo & ( SetSimuScanMode | SetCRT2ToLCDA ) ) |
| 519 | { |
| 520 | XGI_SetCRT1Group(HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 521 | |
| 522 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 523 | { |
| 524 | XGI_SetLCDAGroup(ModeNo , ModeIdIndex , HwDeviceExtension, pVBInfo ) ; |
| 525 | } |
| 526 | } |
| 527 | else |
| 528 | { |
| 529 | if ( !( pVBInfo->VBInfo & SwitchToCRT2) ) |
| 530 | { |
| 531 | XGI_SetCRT1Group( HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 532 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 533 | { |
| 534 | XGI_SetLCDAGroup( ModeNo , ModeIdIndex , HwDeviceExtension, pVBInfo ) ; |
| 535 | } |
| 536 | } |
| 537 | } |
| 538 | |
| 539 | if ( pVBInfo->VBInfo & ( SetSimuScanMode | SwitchToCRT2 ) ) |
| 540 | { |
| 541 | switch( HwDeviceExtension->ujVBChipID ) |
| 542 | { |
| 543 | case VB_CHIP_301: |
| 544 | XGI_SetCRT2Group301( ModeNo , HwDeviceExtension, pVBInfo ) ; /*add for CRT2 */ |
| 545 | break ; |
| 546 | |
| 547 | case VB_CHIP_302: |
| 548 | XGI_SetCRT2Group301(ModeNo , HwDeviceExtension, pVBInfo ) ; /*add for CRT2 */ |
| 549 | break ; |
| 550 | |
| 551 | default: |
| 552 | break ; |
| 553 | } |
| 554 | } |
| 555 | |
| 556 | XGI_SetCRT2ModeRegs( ModeNo, HwDeviceExtension,pVBInfo ) ; |
| 557 | XGI_OEM310Setting( ModeNo, ModeIdIndex,pVBInfo ) ; /*0212*/ |
| 558 | XGI_CloseCRTC( HwDeviceExtension, pVBInfo ) ; |
| 559 | XGI_EnableBridge( HwDeviceExtension ,pVBInfo) ; |
| 560 | } /* !XG20 */ |
| 561 | else |
| 562 | { |
| 563 | #ifdef WIN2000 |
| 564 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 565 | { |
| 566 | |
| 567 | VideoDebugPrint((0, "XGISetModeNew: pVBIfo->IF_DEF_CH7007==1\n")); |
| 568 | pVBInfo->VBType = VB_CH7007 ; |
| 569 | XGI_GetVBInfo(ModeNo , ModeIdIndex , HwDeviceExtension, pVBInfo ) ; |
| 570 | XGI_GetTVInfo(ModeNo , ModeIdIndex, pVBInfo ) ; |
| 571 | XGI_GetLCDInfo(ModeNo , ModeIdIndex, pVBInfo ) ; |
| 572 | if( !(XGI_XG21CheckCH7007TVMode(ModeNo, ModeIdIndex, pVBInfo )) ) |
| 573 | { |
| 574 | return FALSE; |
| 575 | } |
| 576 | } |
| 577 | #endif |
| 578 | |
| 579 | |
| 580 | if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 581 | { |
| 582 | if ( !XGI_XG21CheckLVDSMode(ModeNo , ModeIdIndex, pVBInfo) ) |
| 583 | { |
| 584 | return FALSE; |
| 585 | } |
| 586 | } |
| 587 | |
| 588 | if ( ModeNo <= 0x13 ) |
| 589 | { |
| 590 | pVBInfo->ModeType = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag & ModeInfoFlag; |
| 591 | } |
| 592 | else |
| 593 | { |
| 594 | pVBInfo->ModeType = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag & ModeInfoFlag; |
| 595 | } |
| 596 | |
| 597 | pVBInfo->SetFlag = 0 ; |
| 598 | if ( pVBInfo->IF_DEF_CH7007 != 1 ) |
| 599 | { |
| 600 | pVBInfo->VBInfo = DisableCRT2Display ; |
| 601 | } |
| 602 | |
| 603 | |
| 604 | XGI_DisplayOff(HwDeviceExtension, pVBInfo) ; |
| 605 | |
| 606 | XGI_SetCRT1Group(HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 607 | |
| 608 | XGI_DisplayOn( HwDeviceExtension, pVBInfo ) ; |
| 609 | /* |
| 610 | if( HwDeviceExtension->jChipType == XG21 ) |
| 611 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x09 , ~0x80 , 0x80 ) ; |
| 612 | */ |
| 613 | } |
| 614 | |
| 615 | |
| 616 | /* |
| 617 | if ( ModeNo <= 0x13 ) |
| 618 | { |
| 619 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 620 | } |
| 621 | else |
| 622 | { |
| 623 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 624 | } |
| 625 | pVBInfo->ModeType = modeflag&ModeInfoFlag ; |
| 626 | pVBInfo->SetFlag = 0x00 ; |
| 627 | pVBInfo->VBInfo = DisableCRT2Display ; |
| 628 | temp = XGINew_CheckMemorySize( HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 629 | |
| 630 | if ( temp == 0 ) |
| 631 | return( 0 ) ; |
| 632 | |
| 633 | XGI_DisplayOff( HwDeviceExtension, pVBInfo) ; |
| 634 | XGI_SetCRT1Group( HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 635 | XGI_DisplayOn( HwDeviceExtension, pVBInfo) ; |
| 636 | */ |
| 637 | |
| 638 | XGI_UpdateModeInfo( HwDeviceExtension, pVBInfo ) ; |
| 639 | |
| 640 | if ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 */ |
| 641 | { |
| 642 | XGI_LockCRT2( HwDeviceExtension, pVBInfo ) ; |
| 643 | } |
| 644 | |
| 645 | return( TRUE ) ; |
| 646 | } |
| 647 | |
| 648 | |
| 649 | /* --------------------------------------------------------------------- */ |
| 650 | /* Function : XGI_SetCRT1Group */ |
| 651 | /* Input : */ |
| 652 | /* Output : */ |
| 653 | /* Description : */ |
| 654 | /* --------------------------------------------------------------------- */ |
| 655 | void XGI_SetCRT1Group( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 656 | { |
| 657 | USHORT StandTableIndex , |
| 658 | RefreshRateTableIndex , |
| 659 | b3CC , |
| 660 | temp ; |
| 661 | |
| 662 | USHORT XGINew_P3cc = pVBInfo->P3cc; |
| 663 | |
| 664 | /* XGINew_CRT1Mode = ModeNo ; // SaveModeID */ |
| 665 | StandTableIndex = XGI_GetModePtr( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 666 | /* XGI_SetBIOSData(ModeNo , ModeIdIndex ) ; */ |
| 667 | /* XGI_ClearBankRegs( ModeNo , ModeIdIndex ) ; */ |
| 668 | XGI_SetSeqRegs( ModeNo , StandTableIndex , ModeIdIndex, pVBInfo ) ; |
| 669 | XGI_SetMiscRegs( StandTableIndex, pVBInfo ) ; |
| 670 | XGI_SetCRTCRegs( HwDeviceExtension , StandTableIndex, pVBInfo) ; |
| 671 | XGI_SetATTRegs( ModeNo , StandTableIndex , ModeIdIndex, pVBInfo ) ; |
| 672 | XGI_SetGRCRegs( StandTableIndex, pVBInfo ) ; |
| 673 | XGI_ClearExt1Regs(pVBInfo) ; |
| 674 | |
| 675 | /* if ( pVBInfo->IF_DEF_ExpLink ) */ |
| 676 | if ( HwDeviceExtension->jChipType == XG27 ) |
| 677 | { |
| 678 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 679 | { |
| 680 | XGI_SetDefaultVCLK( pVBInfo ) ; |
| 681 | } |
| 682 | } |
| 683 | |
| 684 | temp = ~ProgrammingCRT2 ; |
| 685 | pVBInfo->SetFlag &= temp ; |
| 686 | pVBInfo->SelectCRT2Rate = 0 ; |
| 687 | |
| 688 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 689 | { |
| 690 | if ( pVBInfo->VBInfo & ( SetSimuScanMode | SetCRT2ToLCDA | SetInSlaveMode ) ) |
| 691 | { |
| 692 | pVBInfo->SetFlag |= ProgrammingCRT2 ; |
| 693 | } |
| 694 | } |
| 695 | |
| 696 | RefreshRateTableIndex = XGI_GetRatePtrCRT2( HwDeviceExtension, ModeNo , ModeIdIndex, pVBInfo ) ; |
| 697 | if ( RefreshRateTableIndex != 0xFFFF ) |
| 698 | { |
| 699 | XGI_SetSync( RefreshRateTableIndex, pVBInfo ) ; |
| 700 | XGI_SetCRT1CRTC( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo, HwDeviceExtension ) ; |
| 701 | XGI_SetCRT1DE( HwDeviceExtension , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 702 | XGI_SetCRT1Offset( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
| 703 | XGI_SetCRT1VCLK( ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ; |
| 704 | } |
| 705 | |
| 706 | if ( ( HwDeviceExtension->jChipType >= XG20 )&& |
| 707 | ( HwDeviceExtension->jChipType < XG27 ) ) /* fix H/W DCLK/2 bug */ |
| 708 | { |
| 709 | if ( ( ModeNo == 0x00 ) | (ModeNo == 0x01) ) |
| 710 | { |
| 711 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , 0x4E) ; |
| 712 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , 0xE9) ; |
| 713 | b3CC =(UCHAR) XGINew_GetReg2(XGINew_P3cc) ; |
| 714 | XGINew_SetReg3(XGINew_P3cc , (b3CC |= 0x0C) ) ; |
| 715 | } |
| 716 | else if ( ( ModeNo == 0x04) | ( ModeNo == 0x05) | ( ModeNo == 0x0D) ) |
| 717 | { |
| 718 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , 0x1B) ; |
| 719 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , 0xE3) ; |
| 720 | b3CC = (UCHAR)XGINew_GetReg2(XGINew_P3cc) ; |
| 721 | XGINew_SetReg3(XGINew_P3cc , (b3CC |= 0x0C) ) ; |
| 722 | } |
| 723 | } |
| 724 | |
| 725 | if ( HwDeviceExtension->jChipType >= XG21 ) |
| 726 | { |
| 727 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) ; |
| 728 | if ( temp & 0xA0 ) |
| 729 | { |
| 730 | |
| 731 | /*XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~0x20 ) ;*/ /* Enable write GPIOF */ |
| 732 | /*XGINew_SetRegAND( pVBInfo->P3d4 , 0x48 , ~0x20 ) ;*/ /* P. DWN */ |
| 733 | /* XG21 CRT1 Timing */ |
| 734 | if ( HwDeviceExtension->jChipType == XG27 ) |
| 735 | XGI_SetXG27CRTC( ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo ); |
| 736 | else |
| 737 | XGI_SetXG21CRTC( ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo ); |
| 738 | |
| 739 | XGI_UpdateXG21CRTC( ModeNo , pVBInfo , RefreshRateTableIndex) ; |
| 740 | |
| 741 | if ( HwDeviceExtension->jChipType == XG27 ) |
| 742 | XGI_SetXG27LCD( pVBInfo , RefreshRateTableIndex , ModeNo ); |
| 743 | else |
| 744 | XGI_SetXG21LCD( pVBInfo , RefreshRateTableIndex , ModeNo ); |
| 745 | |
| 746 | if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 747 | { |
| 748 | if ( HwDeviceExtension->jChipType == XG27 ) |
| 749 | XGI_SetXG27LVDSPara(ModeNo,ModeIdIndex, pVBInfo ); |
| 750 | else |
| 751 | XGI_SetXG21LVDSPara(ModeNo,ModeIdIndex, pVBInfo ); |
| 752 | } |
| 753 | /*XGINew_SetRegOR( pVBInfo->P3d4 , 0x48 , 0x20 ) ;*/ /* P. ON */ |
| 754 | } |
| 755 | } |
| 756 | |
| 757 | pVBInfo->SetFlag &= ( ~ProgrammingCRT2 ) ; |
| 758 | XGI_SetCRT1FIFO( ModeNo , HwDeviceExtension, pVBInfo ) ; |
| 759 | XGI_SetCRT1ModeRegs( HwDeviceExtension , ModeNo , ModeIdIndex , RefreshRateTableIndex , pVBInfo) ; |
| 760 | |
| 761 | |
| 762 | /* XGI_LoadCharacter(); //dif ifdef TVFont */ |
| 763 | |
| 764 | XGI_LoadDAC( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 765 | /* XGI_ClearBuffer( HwDeviceExtension , ModeNo, pVBInfo ) ; */ |
| 766 | #ifdef WIN2000 |
| 767 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) /* [Billy] 2007/05/14 */ |
| 768 | { |
| 769 | VideoDebugPrint((0, "XGI_SetCRT1Group: VBInfo->IF_DEF_CH7007==1\n")); |
| 770 | SetCH7007Regs(HwDeviceExtension, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo ) ; /* 07/05/28 */ |
| 771 | } |
| 772 | #endif |
| 773 | } |
| 774 | |
| 775 | |
| 776 | /* --------------------------------------------------------------------- */ |
| 777 | /* Function : XGI_GetModePtr */ |
| 778 | /* Input : */ |
| 779 | /* Output : */ |
| 780 | /* Description : */ |
| 781 | /* --------------------------------------------------------------------- */ |
| 782 | UCHAR XGI_GetModePtr( USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 783 | { |
| 784 | UCHAR index ; |
| 785 | |
| 786 | if ( ModeNo <= 0x13 ) |
| 787 | index = pVBInfo->SModeIDTable[ ModeIdIndex ].St_StTableIndex ; |
| 788 | else |
| 789 | { |
| 790 | if ( pVBInfo->ModeType <= 0x02 ) |
| 791 | index = 0x1B ; /* 02 -> ModeEGA */ |
| 792 | else |
| 793 | index = 0x0F ; |
| 794 | } |
| 795 | return( index ) ; /* Get pVBInfo->StandTable index */ |
| 796 | } |
| 797 | |
| 798 | |
| 799 | /* --------------------------------------------------------------------- */ |
| 800 | /* Function : XGI_SetBIOSData */ |
| 801 | /* Input : */ |
| 802 | /* Output : */ |
| 803 | /* Description : */ |
| 804 | /* --------------------------------------------------------------------- */ |
| 805 | /*UCHAR XGI_SetBIOSData( USHORT ModeNo , USHORT ModeIdIndex ) |
| 806 | { |
| 807 | return( 0 ) ; |
| 808 | } |
| 809 | */ |
| 810 | |
| 811 | /* --------------------------------------------------------------------- */ |
| 812 | /* Function : XGI_ClearBankRegs */ |
| 813 | /* Input : */ |
| 814 | /* Output : */ |
| 815 | /* Description : */ |
| 816 | /* --------------------------------------------------------------------- */ |
| 817 | /*UCHAR XGI_ClearBankRegs( USHORT ModeNo , USHORT ModeIdIndex ) |
| 818 | { |
| 819 | return( 0 ) ; |
| 820 | } |
| 821 | */ |
| 822 | |
| 823 | /* --------------------------------------------------------------------- */ |
| 824 | /* Function : XGI_SetSeqRegs */ |
| 825 | /* Input : */ |
| 826 | /* Output : */ |
| 827 | /* Description : */ |
| 828 | /* --------------------------------------------------------------------- */ |
| 829 | void XGI_SetSeqRegs( USHORT ModeNo , USHORT StandTableIndex , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 830 | { |
| 831 | UCHAR tempah , |
| 832 | SRdata ; |
| 833 | |
| 834 | USHORT i , |
| 835 | modeflag ; |
| 836 | |
| 837 | if ( ModeNo <= 0x13 ) |
| 838 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 839 | else |
| 840 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 841 | |
| 842 | XGINew_SetReg1( pVBInfo->P3c4 , 0x00 , 0x03 ) ; /* Set SR0 */ |
| 843 | tempah=pVBInfo->StandTable[ StandTableIndex ].SR[ 0 ] ; |
| 844 | |
| 845 | i = SetCRT2ToLCDA ; |
| 846 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 847 | { |
| 848 | tempah |= 0x01 ; |
| 849 | } |
| 850 | else |
| 851 | { |
| 852 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToLCD ) ) |
| 853 | { |
| 854 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 855 | tempah |= 0x01 ; |
| 856 | } |
| 857 | } |
| 858 | |
| 859 | tempah |= 0x20 ; /* screen off */ |
| 860 | XGINew_SetReg1( pVBInfo->P3c4 , 0x01 , tempah ) ; /* Set SR1 */ |
| 861 | |
| 862 | for( i = 02 ; i <= 04 ; i++ ) |
| 863 | { |
| 864 | SRdata = pVBInfo->StandTable[ StandTableIndex ].SR[ i - 1 ] ; /* Get SR2,3,4 from file */ |
| 865 | XGINew_SetReg1( pVBInfo->P3c4 , i , SRdata ) ; /* Set SR2 3 4 */ |
| 866 | } |
| 867 | } |
| 868 | |
| 869 | |
| 870 | /* --------------------------------------------------------------------- */ |
| 871 | /* Function : XGI_SetMiscRegs */ |
| 872 | /* Input : */ |
| 873 | /* Output : */ |
| 874 | /* Description : */ |
| 875 | /* --------------------------------------------------------------------- */ |
| 876 | void XGI_SetMiscRegs( USHORT StandTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 877 | { |
| 878 | UCHAR Miscdata ; |
| 879 | |
| 880 | Miscdata = pVBInfo->StandTable[ StandTableIndex ].MISC ; /* Get Misc from file */ |
| 881 | /* |
| 882 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 883 | { |
| 884 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 885 | { |
| 886 | Miscdata |= 0x0C ; |
| 887 | } |
| 888 | } |
| 889 | */ |
| 890 | |
| 891 | XGINew_SetReg3( pVBInfo->P3c2 , Miscdata ) ; /* Set Misc(3c2) */ |
| 892 | } |
| 893 | |
| 894 | |
| 895 | /* --------------------------------------------------------------------- */ |
| 896 | /* Function : XGI_SetCRTCRegs */ |
| 897 | /* Input : */ |
| 898 | /* Output : */ |
| 899 | /* Description : */ |
| 900 | /* --------------------------------------------------------------------- */ |
| 901 | void XGI_SetCRTCRegs( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT StandTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 902 | { |
| 903 | UCHAR CRTCdata ; |
| 904 | USHORT i ; |
| 905 | |
| 906 | CRTCdata = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x11 ) ; |
| 907 | CRTCdata &= 0x7f ; |
| 908 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , CRTCdata ) ; /* Unlock CRTC */ |
| 909 | |
| 910 | for( i = 0 ; i <= 0x18 ; i++ ) |
| 911 | { |
| 912 | CRTCdata = pVBInfo->StandTable[ StandTableIndex ].CRTC[ i ] ; /* Get CRTC from file */ |
| 913 | XGINew_SetReg1( pVBInfo->P3d4 , i , CRTCdata ) ; /* Set CRTC( 3d4 ) */ |
| 914 | } |
| 915 | /* |
| 916 | if ( ( HwDeviceExtension->jChipType == XGI_630 )&& ( HwDeviceExtension->jChipRevision == 0x30 ) ) |
| 917 | { |
| 918 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 919 | { |
| 920 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToTV ) ) |
| 921 | { |
| 922 | XGINew_SetReg1( pVBInfo->P3d4 , 0x18 , 0xFE ) ; |
| 923 | } |
| 924 | } |
| 925 | } |
| 926 | */ |
| 927 | } |
| 928 | |
| 929 | |
| 930 | /* --------------------------------------------------------------------- */ |
| 931 | /* Function : */ |
| 932 | /* Input : */ |
| 933 | /* Output : */ |
| 934 | /* Description : */ |
| 935 | /* --------------------------------------------------------------------- */ |
| 936 | void XGI_SetATTRegs( USHORT ModeNo , USHORT StandTableIndex , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 937 | { |
| 938 | UCHAR ARdata ; |
| 939 | USHORT i , |
| 940 | modeflag ; |
| 941 | |
| 942 | if ( ModeNo <= 0x13 ) |
| 943 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 944 | else |
| 945 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 946 | |
| 947 | for( i = 0 ; i <= 0x13 ; i++ ) |
| 948 | { |
| 949 | ARdata = pVBInfo->StandTable[ StandTableIndex ].ATTR[ i ] ; |
| 950 | if ( modeflag & Charx8Dot ) /* ifndef Dot9 */ |
| 951 | { |
| 952 | if ( i == 0x13 ) |
| 953 | { |
| 954 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 955 | ARdata = 0 ; |
| 956 | else |
| 957 | { |
| 958 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToLCD ) ) |
| 959 | { |
| 960 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 961 | ARdata = 0 ; |
| 962 | } |
| 963 | } |
| 964 | } |
| 965 | } |
| 966 | |
| 967 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ |
| 968 | XGINew_SetReg3( pVBInfo->P3c0 , i ) ; /* set index */ |
| 969 | XGINew_SetReg3( pVBInfo->P3c0 , ARdata ) ; /* set data */ |
| 970 | } |
| 971 | |
| 972 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ |
| 973 | XGINew_SetReg3( pVBInfo->P3c0 , 0x14 ) ; /* set index */ |
| 974 | XGINew_SetReg3( pVBInfo->P3c0 , 0x00 ) ; /* set data */ |
| 975 | XGINew_GetReg2( pVBInfo->P3da ) ; /* Enable Attribute */ |
| 976 | XGINew_SetReg3( pVBInfo->P3c0 , 0x20 ) ; |
| 977 | } |
| 978 | |
| 979 | |
| 980 | /* --------------------------------------------------------------------- */ |
| 981 | /* Function : XGI_SetGRCRegs */ |
| 982 | /* Input : */ |
| 983 | /* Output : */ |
| 984 | /* Description : */ |
| 985 | /* --------------------------------------------------------------------- */ |
| 986 | void XGI_SetGRCRegs( USHORT StandTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 987 | { |
| 988 | UCHAR GRdata ; |
| 989 | USHORT i ; |
| 990 | |
| 991 | for( i = 0 ; i <= 0x08 ; i++ ) |
| 992 | { |
| 993 | GRdata = pVBInfo->StandTable[ StandTableIndex ].GRC[ i ] ; /* Get GR from file */ |
| 994 | XGINew_SetReg1( pVBInfo->P3ce , i , GRdata ) ; /* Set GR(3ce) */ |
| 995 | } |
| 996 | |
| 997 | if ( pVBInfo->ModeType > ModeVGA ) |
| 998 | { |
| 999 | GRdata = ( UCHAR )XGINew_GetReg1( pVBInfo->P3ce , 0x05 ) ; |
| 1000 | GRdata &= 0xBF ; /* 256 color disable */ |
| 1001 | XGINew_SetReg1( pVBInfo->P3ce , 0x05 , GRdata ) ; |
| 1002 | } |
| 1003 | } |
| 1004 | |
| 1005 | |
| 1006 | /* --------------------------------------------------------------------- */ |
| 1007 | /* Function : XGI_ClearExt1Regs */ |
| 1008 | /* Input : */ |
| 1009 | /* Output : */ |
| 1010 | /* Description : */ |
| 1011 | /* --------------------------------------------------------------------- */ |
| 1012 | void XGI_ClearExt1Regs(PVB_DEVICE_INFO pVBInfo) |
| 1013 | { |
| 1014 | USHORT i ; |
| 1015 | |
| 1016 | for( i = 0x0A ; i <= 0x0E ; i++ ) |
| 1017 | XGINew_SetReg1( pVBInfo->P3c4 , i , 0x00 ) ; /* Clear SR0A-SR0E */ |
| 1018 | } |
| 1019 | |
| 1020 | |
| 1021 | /* --------------------------------------------------------------------- */ |
| 1022 | /* Function : XGI_SetDefaultVCLK */ |
| 1023 | /* Input : */ |
| 1024 | /* Output : */ |
| 1025 | /* Description : */ |
| 1026 | /* --------------------------------------------------------------------- */ |
| 1027 | UCHAR XGI_SetDefaultVCLK( PVB_DEVICE_INFO pVBInfo ) |
| 1028 | { |
| 1029 | |
| 1030 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x31 , ~0x30 , 0x20 ) ; |
| 1031 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ 0 ].SR2B ) ; |
| 1032 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ 0 ].SR2C ) ; |
| 1033 | |
| 1034 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x31 , ~0x30 , 0x10 ) ; |
| 1035 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ 1 ].SR2B ) ; |
| 1036 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ 1 ].SR2C ) ; |
| 1037 | |
| 1038 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x31 , ~0x30 ) ; |
| 1039 | return( 0 ) ; |
| 1040 | } |
| 1041 | |
| 1042 | |
| 1043 | /* --------------------------------------------------------------------- */ |
| 1044 | /* Function : XGI_GetRatePtrCRT2 */ |
| 1045 | /* Input : */ |
| 1046 | /* Output : */ |
| 1047 | /* Description : */ |
| 1048 | /* --------------------------------------------------------------------- */ |
| 1049 | USHORT XGI_GetRatePtrCRT2( PXGI_HW_DEVICE_INFO pXGIHWDE, USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 1050 | { |
| 1051 | SHORT LCDRefreshIndex[] = { 0x00 , 0x00 , 0x03 , 0x01 } , |
| 1052 | LCDARefreshIndex[] = { 0x00 , 0x00 , 0x03 , 0x01 , 0x01 , 0x01 , 0x01 } ; |
| 1053 | |
| 1054 | USHORT RefreshRateTableIndex , i , |
| 1055 | modeflag , index , temp ; |
| 1056 | |
| 1057 | if ( ModeNo <= 0x13 ) |
| 1058 | { |
| 1059 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 1060 | } |
| 1061 | else |
| 1062 | { |
| 1063 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 1064 | } |
| 1065 | |
| 1066 | if ( pVBInfo->IF_DEF_CH7005 == 1 ) |
| 1067 | { |
| 1068 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 1069 | { |
| 1070 | if ( modeflag & HalfDCLK ) |
| 1071 | return( 0 ) ; |
| 1072 | } |
| 1073 | } |
| 1074 | |
| 1075 | if ( ModeNo < 0x14 ) |
| 1076 | return( 0xFFFF ) ; |
| 1077 | |
| 1078 | index = XGINew_GetReg1( pVBInfo->P3d4 , 0x33 ) ; |
| 1079 | index = index >> pVBInfo->SelectCRT2Rate ; |
| 1080 | index &= 0x0F ; |
| 1081 | |
| 1082 | if ( pVBInfo->LCDInfo & LCDNonExpanding ) |
| 1083 | index = 0 ; |
| 1084 | |
| 1085 | if ( index > 0 ) |
| 1086 | index-- ; |
| 1087 | |
| 1088 | if ( pVBInfo->SetFlag & ProgrammingCRT2 ) |
| 1089 | { |
| 1090 | if ( pVBInfo->IF_DEF_CH7005 == 1 ) |
| 1091 | { |
| 1092 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 1093 | { |
| 1094 | index = 0 ; |
| 1095 | } |
| 1096 | } |
| 1097 | |
| 1098 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 1099 | { |
| 1100 | if( pVBInfo->IF_DEF_LVDS == 0 ) |
| 1101 | { |
| 1102 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 1103 | temp = LCDARefreshIndex[ pVBInfo->LCDResInfo & 0x0F ] ; /* 301b */ |
| 1104 | else |
| 1105 | temp = LCDRefreshIndex[ pVBInfo->LCDResInfo & 0x0F ] ; |
| 1106 | |
| 1107 | if ( index > temp ) |
| 1108 | { |
| 1109 | index = temp ; |
| 1110 | } |
| 1111 | } |
| 1112 | else |
| 1113 | { |
| 1114 | index = 0 ; |
| 1115 | } |
| 1116 | } |
| 1117 | } |
| 1118 | |
| 1119 | RefreshRateTableIndex = pVBInfo->EModeIDTable[ ModeIdIndex ].REFindex ; |
| 1120 | ModeNo = pVBInfo->RefIndex[ RefreshRateTableIndex ].ModeID ; |
| 1121 | if ( pXGIHWDE->jChipType >= XG20 ) /* for XG20, XG21, XG27 */ |
| 1122 | { |
| 1123 | /* |
| 1124 | if ( pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag & XG2xNotSupport ) |
| 1125 | { |
| 1126 | index++; |
| 1127 | } |
| 1128 | */ |
| 1129 | if ( ( pVBInfo->RefIndex[ RefreshRateTableIndex ].XRes == 800 ) && |
| 1130 | ( pVBInfo->RefIndex[ RefreshRateTableIndex ].YRes == 600 ) ) |
| 1131 | { |
| 1132 | index++; |
| 1133 | } |
| 1134 | /* Alan 10/19/2007; do the similiar adjustment like XGISearchCRT1Rate() */ |
| 1135 | if ( ( pVBInfo->RefIndex[ RefreshRateTableIndex ].XRes == 1024 ) && |
| 1136 | ( pVBInfo->RefIndex[ RefreshRateTableIndex ].YRes == 768 ) ) |
| 1137 | { |
| 1138 | index++; |
| 1139 | } |
| 1140 | if ( ( pVBInfo->RefIndex[ RefreshRateTableIndex ].XRes == 1280 ) && |
| 1141 | ( pVBInfo->RefIndex[ RefreshRateTableIndex ].YRes == 1024 ) ) |
| 1142 | { |
| 1143 | index++; |
| 1144 | } |
| 1145 | } |
| 1146 | |
| 1147 | i = 0 ; |
| 1148 | do |
| 1149 | { |
| 1150 | if ( pVBInfo->RefIndex[ RefreshRateTableIndex + i ].ModeID != ModeNo ) |
| 1151 | break ; |
| 1152 | temp = pVBInfo->RefIndex[ RefreshRateTableIndex + i ].Ext_InfoFlag ; |
| 1153 | temp &= ModeInfoFlag ; |
| 1154 | if ( temp < pVBInfo->ModeType ) |
| 1155 | break ; |
| 1156 | i++ ; |
| 1157 | index-- ; |
| 1158 | |
| 1159 | } while( index != 0xFFFF ) ; |
| 1160 | if ( !( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) ) |
| 1161 | { |
| 1162 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 1163 | { |
| 1164 | temp = pVBInfo->RefIndex[ RefreshRateTableIndex + i - 1 ].Ext_InfoFlag ; |
| 1165 | if ( temp & InterlaceMode ) |
| 1166 | { |
| 1167 | i++ ; |
| 1168 | } |
| 1169 | } |
| 1170 | } |
| 1171 | i-- ; |
| 1172 | if ( ( pVBInfo->SetFlag & ProgrammingCRT2 ) ) |
| 1173 | { |
| 1174 | temp = XGI_AjustCRT2Rate( ModeNo , ModeIdIndex , RefreshRateTableIndex , &i, pVBInfo) ; |
| 1175 | } |
| 1176 | return( RefreshRateTableIndex + i ) ; /*return(0x01|(temp1<<1)); */ |
| 1177 | } |
| 1178 | |
| 1179 | |
| 1180 | /* --------------------------------------------------------------------- */ |
| 1181 | /* Function : XGI_AjustCRT2Rate */ |
| 1182 | /* Input : */ |
| 1183 | /* Output : */ |
| 1184 | /* Description : */ |
| 1185 | /* --------------------------------------------------------------------- */ |
| 1186 | BOOLEAN XGI_AjustCRT2Rate( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex , USHORT *i, PVB_DEVICE_INFO pVBInfo ) |
| 1187 | { |
| 1188 | USHORT tempax , |
| 1189 | tempbx , |
| 1190 | resinfo , |
| 1191 | modeflag , |
| 1192 | infoflag ; |
| 1193 | |
| 1194 | if ( ModeNo <= 0x13 ) |
| 1195 | { |
| 1196 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag */ |
| 1197 | } |
| 1198 | else |
| 1199 | { |
| 1200 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 1201 | } |
| 1202 | |
| 1203 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 1204 | tempbx = pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].ModeID ; |
| 1205 | tempax = 0 ; |
| 1206 | |
| 1207 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 1208 | { |
| 1209 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 1210 | { |
| 1211 | tempax |= SupportRAMDAC2 ; |
| 1212 | |
| 1213 | if ( pVBInfo->VBType & VB_XGI301C ) |
| 1214 | tempax |= SupportCRT2in301C ; |
| 1215 | } |
| 1216 | |
| 1217 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) /* 301b */ |
| 1218 | { |
| 1219 | tempax |= SupportLCD ; |
| 1220 | |
| 1221 | if ( pVBInfo->LCDResInfo != Panel1280x1024 ) |
| 1222 | { |
| 1223 | if ( pVBInfo->LCDResInfo != Panel1280x960 ) |
| 1224 | { |
| 1225 | if ( pVBInfo->LCDInfo & LCDNonExpanding ) |
| 1226 | { |
| 1227 | if ( resinfo >= 9 ) |
| 1228 | { |
| 1229 | tempax = 0 ; |
| 1230 | return( 0 ) ; |
| 1231 | } |
| 1232 | } |
| 1233 | } |
| 1234 | } |
| 1235 | } |
| 1236 | |
| 1237 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) /* for HiTV */ |
| 1238 | { |
| 1239 | if ( ( pVBInfo->VBType & VB_XGI301LV ) && ( pVBInfo->VBExtInfo == VB_YPbPr1080i ) ) |
| 1240 | { |
| 1241 | tempax |= SupportYPbPr ; |
| 1242 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 1243 | { |
| 1244 | if ( resinfo == 4 ) |
| 1245 | return( 0 ) ; |
| 1246 | |
| 1247 | if ( resinfo == 3 ) |
| 1248 | return( 0 ) ; |
| 1249 | |
| 1250 | if ( resinfo > 7 ) |
| 1251 | return( 0 ) ; |
| 1252 | } |
| 1253 | } |
| 1254 | else |
| 1255 | { |
| 1256 | tempax |= SupportHiVisionTV ; |
| 1257 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 1258 | { |
| 1259 | if ( resinfo == 4 ) |
| 1260 | return( 0 ) ; |
| 1261 | |
| 1262 | if ( resinfo == 3 ) |
| 1263 | { |
| 1264 | if ( pVBInfo->SetFlag & TVSimuMode ) |
| 1265 | return( 0 ) ; |
| 1266 | } |
| 1267 | |
| 1268 | if ( resinfo > 7 ) |
| 1269 | return( 0 ) ; |
| 1270 | } |
| 1271 | } |
| 1272 | } |
| 1273 | else |
| 1274 | { |
| 1275 | if ( pVBInfo->VBInfo & ( SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | SetCRT2ToSCART | SetCRT2ToYPbPr | SetCRT2ToHiVisionTV ) ) |
| 1276 | { |
| 1277 | tempax |= SupportTV ; |
| 1278 | |
| 1279 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 1280 | { |
| 1281 | tempax |= SupportTV1024 ; |
| 1282 | } |
| 1283 | |
| 1284 | if ( !( pVBInfo->VBInfo & SetPALTV ) ) |
| 1285 | { |
| 1286 | if ( modeflag & NoSupportSimuTV ) |
| 1287 | { |
| 1288 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 1289 | { |
| 1290 | if ( !( pVBInfo->VBInfo & SetNotSimuMode ) ) |
| 1291 | { |
| 1292 | return( 0 ) ; |
| 1293 | } |
| 1294 | } |
| 1295 | } |
| 1296 | } |
| 1297 | } |
| 1298 | } |
| 1299 | } |
| 1300 | else /* for LVDS */ |
| 1301 | { |
| 1302 | if ( pVBInfo->IF_DEF_CH7005 == 1 ) |
| 1303 | { |
| 1304 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 1305 | { |
| 1306 | tempax |= SupportCHTV ; |
| 1307 | } |
| 1308 | } |
| 1309 | |
| 1310 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 1311 | { |
| 1312 | tempax |= SupportLCD ; |
| 1313 | |
| 1314 | if ( resinfo > 0x08 ) |
| 1315 | return( 0 ) ; /* 1024x768 */ |
| 1316 | |
| 1317 | if ( pVBInfo->LCDResInfo < Panel1024x768 ) |
| 1318 | { |
| 1319 | if ( resinfo > 0x07 ) |
| 1320 | return( 0 ) ; /* 800x600 */ |
| 1321 | |
| 1322 | if ( resinfo == 0x04 ) |
| 1323 | return( 0 ) ; /* 512x384 */ |
| 1324 | } |
| 1325 | } |
| 1326 | } |
| 1327 | |
| 1328 | for( ; pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].ModeID == tempbx ; ( *i )-- ) |
| 1329 | { |
| 1330 | infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].Ext_InfoFlag ; |
| 1331 | if ( infoflag & tempax ) |
| 1332 | { |
| 1333 | return( 1 ) ; |
| 1334 | } |
| 1335 | if ( ( *i ) == 0 ) |
| 1336 | break ; |
| 1337 | } |
| 1338 | |
| 1339 | for( ( *i ) = 0 ; ; ( *i )++ ) |
| 1340 | { |
| 1341 | infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].Ext_InfoFlag ; |
| 1342 | if ( pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].ModeID != tempbx ) |
| 1343 | { |
| 1344 | return( 0 ) ; |
| 1345 | } |
| 1346 | |
| 1347 | if ( infoflag & tempax ) |
| 1348 | { |
| 1349 | return( 1 ) ; |
| 1350 | } |
| 1351 | } |
| 1352 | return( 1 ) ; |
| 1353 | } |
| 1354 | |
| 1355 | |
| 1356 | /* --------------------------------------------------------------------- */ |
| 1357 | /* Function : XGI_SetSync */ |
| 1358 | /* Input : */ |
| 1359 | /* Output : */ |
| 1360 | /* Description : */ |
| 1361 | /* --------------------------------------------------------------------- */ |
| 1362 | void XGI_SetSync(USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 1363 | { |
| 1364 | USHORT sync , |
| 1365 | temp ; |
| 1366 | |
| 1367 | sync = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag >> 8 ; /* di+0x00 */ |
| 1368 | sync &= 0xC0 ; |
| 1369 | temp = 0x2F ; |
| 1370 | temp |= sync ; |
| 1371 | XGINew_SetReg3( pVBInfo->P3c2 , temp ) ; /* Set Misc(3c2) */ |
| 1372 | } |
| 1373 | |
| 1374 | |
| 1375 | /* --------------------------------------------------------------------- */ |
| 1376 | /* Function : XGI_SetCRT1CRTC */ |
| 1377 | /* Input : */ |
| 1378 | /* Output : */ |
| 1379 | /* Description : */ |
| 1380 | /* --------------------------------------------------------------------- */ |
| 1381 | void XGI_SetCRT1CRTC( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo, PXGI_HW_DEVICE_INFO HwDeviceExtension ) |
| 1382 | { |
| 1383 | UCHAR index , |
| 1384 | data ; |
| 1385 | |
| 1386 | USHORT i ; |
| 1387 | |
| 1388 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; /* Get index */ |
| 1389 | index = index&IndexMask ; |
| 1390 | |
| 1391 | data =( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x11 ) ; |
| 1392 | data &= 0x7F ; |
| 1393 | XGINew_SetReg1(pVBInfo->P3d4,0x11,data); /* Unlock CRTC */ |
| 1394 | |
| 1395 | for( i = 0 ; i < 8 ; i++ ) |
| 1396 | pVBInfo->TimingH[ 0 ].data[ i ] = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ i ] ; |
| 1397 | |
| 1398 | for( i = 0 ; i < 7 ; i++ ) |
| 1399 | pVBInfo->TimingV[ 0 ].data[ i ] = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ i + 8 ] ; |
| 1400 | |
| 1401 | XGI_SetCRT1Timing_H( pVBInfo, HwDeviceExtension ) ; |
| 1402 | |
| 1403 | |
| 1404 | |
| 1405 | XGI_SetCRT1Timing_V( ModeIdIndex , ModeNo, pVBInfo ) ; |
| 1406 | |
| 1407 | |
| 1408 | if( pVBInfo->ModeType > 0x03 ) |
| 1409 | XGINew_SetReg1( pVBInfo->P3d4 , 0x14 , 0x4F ) ; |
| 1410 | } |
| 1411 | |
| 1412 | |
| 1413 | /* --------------------------------------------------------------------- */ |
| 1414 | /* Function : XGI_SetCRT1Timing_H */ |
| 1415 | /* Input : */ |
| 1416 | /* Output : */ |
| 1417 | /* Description : */ |
| 1418 | /* --------------------------------------------------------------------- */ |
| 1419 | void XGI_SetCRT1Timing_H( PVB_DEVICE_INFO pVBInfo, PXGI_HW_DEVICE_INFO HwDeviceExtension ) |
| 1420 | { |
| 1421 | UCHAR data , data1, pushax; |
| 1422 | USHORT i , j ; |
| 1423 | |
| 1424 | /* XGINew_SetReg1( pVBInfo->P3d4 , 0x51 , 0 ) ; */ |
| 1425 | /* XGINew_SetReg1( pVBInfo->P3d4 , 0x56 , 0 ) ; */ |
| 1426 | /* XGINew_SetRegANDOR( pVBInfo->P3d4 ,0x11 , 0x7f , 0x00 ) ; */ |
| 1427 | |
| 1428 | data = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x11 ) ; /* unlock cr0-7 */ |
| 1429 | data &= 0x7F ; |
| 1430 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , data ) ; |
| 1431 | |
| 1432 | data = pVBInfo->TimingH[ 0 ].data[ 0 ] ; |
| 1433 | XGINew_SetReg1( pVBInfo->P3d4 , 0 , data ) ; |
| 1434 | |
| 1435 | for( i = 0x01 ; i <= 0x04 ; i++ ) |
| 1436 | { |
| 1437 | data = pVBInfo->TimingH[ 0 ].data[ i ] ; |
| 1438 | XGINew_SetReg1( pVBInfo->P3d4 , ( USHORT )( i + 1 ) , data ) ; |
| 1439 | } |
| 1440 | |
| 1441 | for( i = 0x05 ; i <= 0x06 ; i++ ) |
| 1442 | { |
| 1443 | data = pVBInfo->TimingH[ 0 ].data[ i ]; |
| 1444 | XGINew_SetReg1( pVBInfo->P3c4 ,( USHORT )( i + 6 ) , data ) ; |
| 1445 | } |
| 1446 | |
| 1447 | j = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x0e ) ; |
| 1448 | j &= 0x1F ; |
| 1449 | data = pVBInfo->TimingH[ 0 ].data[ 7 ] ; |
| 1450 | data &= 0xE0 ; |
| 1451 | data |= j ; |
| 1452 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0e , data ) ; |
| 1453 | |
| 1454 | if ( HwDeviceExtension->jChipType >= XG20 ) |
| 1455 | { |
| 1456 | data = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x04 ) ; |
| 1457 | data = data - 1 ; |
| 1458 | XGINew_SetReg1( pVBInfo->P3d4 , 0x04 , data ) ; |
| 1459 | data = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x05 ) ; |
| 1460 | data1 = data ; |
| 1461 | data1 &= 0xE0 ; |
| 1462 | data &= 0x1F ; |
| 1463 | if ( data == 0 ) |
| 1464 | { |
| 1465 | pushax = data ; |
| 1466 | data = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x0c ) ; |
| 1467 | data &= 0xFB ; |
| 1468 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0c , data ) ; |
| 1469 | data = pushax ; |
| 1470 | } |
| 1471 | data = data - 1 ; |
| 1472 | data |= data1 ; |
| 1473 | XGINew_SetReg1( pVBInfo->P3d4 , 0x05 , data ) ; |
| 1474 | data = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x0e ) ; |
| 1475 | data = data >> 5 ; |
| 1476 | data = data + 3 ; |
| 1477 | if ( data > 7 ) |
| 1478 | data = data - 7 ; |
| 1479 | data = data << 5 ; |
| 1480 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0e , ~0xE0 , data ) ; |
| 1481 | } |
| 1482 | } |
| 1483 | |
| 1484 | |
| 1485 | /* --------------------------------------------------------------------- */ |
| 1486 | /* Function : XGI_SetCRT1Timing_V */ |
| 1487 | /* Input : */ |
| 1488 | /* Output : */ |
| 1489 | /* Description : */ |
| 1490 | /* --------------------------------------------------------------------- */ |
| 1491 | void XGI_SetCRT1Timing_V( USHORT ModeIdIndex , USHORT ModeNo,PVB_DEVICE_INFO pVBInfo ) |
| 1492 | { |
| 1493 | UCHAR data ; |
| 1494 | USHORT i , j ; |
| 1495 | |
| 1496 | /* XGINew_SetReg1( pVBInfo->P3d4 , 0x51 , 0 ) ; */ |
| 1497 | /* XGINew_SetReg1( pVBInfo->P3d4 , 0x56 , 0 ) ; */ |
| 1498 | /* XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x11 , 0x7f , 0x00 ) ; */ |
| 1499 | |
| 1500 | for( i = 0x00 ; i <= 0x01 ; i++ ) |
| 1501 | { |
| 1502 | data = pVBInfo->TimingV[ 0 ].data[ i ] ; |
| 1503 | XGINew_SetReg1( pVBInfo->P3d4 , ( USHORT )( i + 6 ) , data ) ; |
| 1504 | } |
| 1505 | |
| 1506 | for( i = 0x02 ; i <= 0x03 ; i++ ) |
| 1507 | { |
| 1508 | data = pVBInfo->TimingV[ 0 ].data[ i ] ; |
| 1509 | XGINew_SetReg1( pVBInfo->P3d4 , ( USHORT )( i + 0x0e ) , data ) ; |
| 1510 | } |
| 1511 | |
| 1512 | for( i = 0x04 ; i <= 0x05 ; i++ ) |
| 1513 | { |
| 1514 | data = pVBInfo->TimingV[ 0 ].data[ i ] ; |
| 1515 | XGINew_SetReg1( pVBInfo->P3d4 , ( USHORT )( i + 0x11 ) , data ) ; |
| 1516 | } |
| 1517 | |
| 1518 | j = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x0a ) ; |
| 1519 | j &= 0xC0 ; |
| 1520 | data = pVBInfo->TimingV[ 0 ].data[ 6 ] ; |
| 1521 | data &= 0x3F ; |
| 1522 | data |= j ; |
| 1523 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0a , data ) ; |
| 1524 | |
| 1525 | data = pVBInfo->TimingV[ 0 ].data[ 6 ] ; |
| 1526 | data &= 0x80 ; |
| 1527 | data = data >> 2 ; |
| 1528 | |
| 1529 | if ( ModeNo <= 0x13 ) |
| 1530 | i = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 1531 | else |
| 1532 | i = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 1533 | |
| 1534 | i &= DoubleScanMode ; |
| 1535 | if ( i ) |
| 1536 | data |= 0x80 ; |
| 1537 | |
| 1538 | j = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x09 ) ; |
| 1539 | j &= 0x5F ; |
| 1540 | data |= j ; |
| 1541 | XGINew_SetReg1( pVBInfo->P3d4 , 0x09 , data ) ; |
| 1542 | } |
| 1543 | |
| 1544 | |
| 1545 | /* --------------------------------------------------------------------- */ |
| 1546 | /* Function : XGI_SetXG21CRTC */ |
| 1547 | /* Input : Stand or enhance CRTC table */ |
| 1548 | /* Output : Fill CRT Hsync/Vsync to SR2E/SR2F/SR30/SR33/SR34/SR3F */ |
| 1549 | /* Description : Set LCD timing */ |
| 1550 | /* --------------------------------------------------------------------- */ |
| 1551 | void XGI_SetXG21CRTC(USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo) |
| 1552 | { |
| 1553 | UCHAR StandTableIndex, index, Tempax, Tempbx, Tempcx, Tempdx ; |
| 1554 | USHORT Temp1, Temp2, Temp3 ; |
| 1555 | |
| 1556 | if ( ModeNo <= 0x13 ) |
| 1557 | { |
| 1558 | StandTableIndex = XGI_GetModePtr( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 1559 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 4 ] ; /* CR04 HRS */ |
| 1560 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , Tempax ) ; /* SR2E [7:0]->HRS */ |
| 1561 | Tempbx = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 5 ] ; /* Tempbx: CR05 HRE */ |
| 1562 | Tempbx &= 0x1F ; /* Tempbx: HRE[4:0] */ |
| 1563 | Tempcx = Tempax ; |
| 1564 | Tempcx &= 0xE0 ; /* Tempcx: HRS[7:5] */ |
| 1565 | Tempdx = Tempcx | Tempbx ; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */ |
| 1566 | if ( Tempbx < ( Tempax & 0x1F ) ) /* IF HRE < HRS */ |
| 1567 | Tempdx |= 0x20 ; /* Tempdx: HRE = HRE + 0x20 */ |
| 1568 | Tempdx <<= 2 ; /* Tempdx << 2 */ |
| 1569 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , Tempdx ) ; /* SR2F [7:2]->HRE */ |
| 1570 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , 0xE3 , 00 ) ; |
| 1571 | |
| 1572 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 16 ] ; /* Tempax: CR16 VRS */ |
| 1573 | Tempbx = Tempax ; /* Tempbx=Tempax */ |
| 1574 | Tempax &= 0x01 ; /* Tempax: VRS[0] */ |
| 1575 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x33 , Tempax ) ; /* SR33[0]->VRS */ |
| 1576 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 7 ] ; /* Tempax: CR7 VRS */ |
| 1577 | Tempdx = Tempbx >> 1 ; /* Tempdx: VRS[7:1] */ |
| 1578 | Tempcx = Tempax & 0x04 ; /* Tempcx: CR7[2] */ |
| 1579 | Tempcx <<= 5 ; /* Tempcx[7]: VRS[8] */ |
| 1580 | Tempdx |= Tempcx ; /* Tempdx: VRS[8:1] */ |
| 1581 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , Tempdx ) ; /* SR34[7:0]: VRS[8:1] */ |
| 1582 | |
| 1583 | Temp1 = Tempcx << 1 ; /* Temp1[8]: VRS[8] UCHAR -> USHORT */ |
| 1584 | Temp1 |= Tempbx ; /* Temp1[8:0]: VRS[8:0] */ |
| 1585 | Tempax &= 0x80 ; /* Tempax[7]: CR7[7] */ |
| 1586 | Temp2 = Tempax << 2 ; /* Temp2[9]: VRS[9] */ |
| 1587 | Temp1 |= Temp2 ; /* Temp1[9:0]: VRS[9:0] */ |
| 1588 | |
| 1589 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 17 ] ; /* CR16 VRE */ |
| 1590 | Tempax &= 0x0F ; /* Tempax[3:0]: VRE[3:0] */ |
| 1591 | Temp2 = Temp1 & 0x3F0 ; /* Temp2[9:4]: VRS[9:4] */ |
| 1592 | Temp2 |= Tempax ; /* Temp2[9:0]: VRE[9:0] */ |
| 1593 | Temp3 = Temp1 & 0x0F ; /* Temp3[3:0]: VRS[3:0] */ |
| 1594 | if ( Tempax < Temp3 ) /* VRE[3:0]<VRS[3:0] */ |
| 1595 | Temp2 |= 0x10 ; /* Temp2: VRE + 0x10 */ |
| 1596 | Temp2 &= 0xFF ; /* Temp2[7:0]: VRE[7:0] */ |
| 1597 | Tempax = (UCHAR)Temp2 ; /* Tempax[7:0]: VRE[7:0] */ |
| 1598 | Tempax <<= 2 ; /* Tempax << 2: VRE[5:0] */ |
| 1599 | Temp1 &= 0x600 ; /* Temp1[10:9]: VRS[10:9] */ |
| 1600 | Temp1 >>= 9 ; /* [10:9]->[1:0] */ |
| 1601 | Tempbx = (UCHAR)Temp1 ; /* Tempbx[1:0]: VRS[10:9] */ |
| 1602 | Tempax |= Tempbx ; /* VRE[5:0]VRS[10:9] */ |
| 1603 | Tempax &= 0x7F ; |
| 1604 | XGINew_SetReg1( pVBInfo->P3c4 , 0x3F , Tempax ) ; /* SR3F D[7:2]->VRE D[1:0]->VRS */ |
| 1605 | } |
| 1606 | else |
| 1607 | { |
| 1608 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 1609 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 3 ] ; /* Tempax: CR4 HRS */ |
| 1610 | Tempcx = Tempax ; /* Tempcx: HRS */ |
| 1611 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , Tempax ) ; /* SR2E[7:0]->HRS */ |
| 1612 | |
| 1613 | Tempdx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 5 ] ; /* SRB */ |
| 1614 | Tempdx &= 0xC0 ; /* Tempdx[7:6]: SRB[7:6] */ |
| 1615 | Temp1 = Tempdx ; /* Temp1[7:6]: HRS[9:8] */ |
| 1616 | Temp1 <<= 2 ; /* Temp1[9:8]: HRS[9:8] */ |
| 1617 | Temp1 |= Tempax ; /* Temp1[9:0]: HRS[9:0] */ |
| 1618 | |
| 1619 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 4 ] ; /* CR5 HRE */ |
| 1620 | Tempax &= 0x1F ; /* Tempax[4:0]: HRE[4:0] */ |
| 1621 | |
| 1622 | Tempbx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 6 ] ; /* SRC */ |
| 1623 | Tempbx &= 0x04 ; /* Tempbx[2]: HRE[5] */ |
| 1624 | Tempbx <<= 3 ; /* Tempbx[5]: HRE[5] */ |
| 1625 | Tempax |= Tempbx ; /* Tempax[5:0]: HRE[5:0] */ |
| 1626 | |
| 1627 | Temp2 = Temp1 & 0x3C0 ; /* Temp2[9:6]: HRS[9:6] */ |
| 1628 | Temp2 |= Tempax ; /* Temp2[9:0]: HRE[9:0] */ |
| 1629 | |
| 1630 | Tempcx &= 0x3F ; /* Tempcx[5:0]: HRS[5:0] */ |
| 1631 | if( Tempax < Tempcx ) /* HRE < HRS */ |
| 1632 | Temp2 |= 0x40 ; /* Temp2 + 0x40 */ |
| 1633 | |
| 1634 | Temp2 &= 0xFF ; |
| 1635 | Tempax = (UCHAR)Temp2 ; /* Tempax: HRE[7:0] */ |
| 1636 | Tempax <<= 2 ; /* Tempax[7:2]: HRE[5:0] */ |
| 1637 | Tempdx >>= 6 ; /* Tempdx[7:6]->[1:0] HRS[9:8] */ |
| 1638 | Tempax |= Tempdx ; /* HRE[5:0]HRS[9:8] */ |
| 1639 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , Tempax ) ; /* SR2F D[7:2]->HRE, D[1:0]->HRS */ |
| 1640 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , 0xE3 , 00 ) ; |
| 1641 | |
| 1642 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 10 ] ; /* CR10 VRS */ |
| 1643 | Tempbx = Tempax ; /* Tempbx: VRS */ |
| 1644 | Tempax &= 0x01 ; /* Tempax[0]: VRS[0] */ |
| 1645 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x33 , Tempax ) ; /* SR33[0]->VRS[0] */ |
| 1646 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 9 ] ; /* CR7[2][7] VRE */ |
| 1647 | Tempcx = Tempbx >> 1 ; /* Tempcx[6:0]: VRS[7:1] */ |
| 1648 | Tempdx = Tempax & 0x04 ; /* Tempdx[2]: CR7[2] */ |
| 1649 | Tempdx <<= 5 ; /* Tempdx[7]: VRS[8] */ |
| 1650 | Tempcx |= Tempdx ; /* Tempcx[7:0]: VRS[8:1] */ |
| 1651 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , Tempcx ) ; /* SR34[8:1]->VRS */ |
| 1652 | |
| 1653 | Temp1 = Tempdx ; /* Temp1[7]: Tempdx[7] */ |
| 1654 | Temp1 <<= 1 ; /* Temp1[8]: VRS[8] */ |
| 1655 | Temp1 |= Tempbx ; /* Temp1[8:0]: VRS[8:0] */ |
| 1656 | Tempax &= 0x80 ; |
| 1657 | Temp2 = Tempax << 2 ; /* Temp2[9]: VRS[9] */ |
| 1658 | Temp1 |= Temp2 ; /* Temp1[9:0]: VRS[9:0] */ |
| 1659 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempax: SRA */ |
| 1660 | Tempax &= 0x08 ; /* Tempax[3]: VRS[3] */ |
| 1661 | Temp2 = Tempax ; |
| 1662 | Temp2 <<= 7 ; /* Temp2[10]: VRS[10] */ |
| 1663 | Temp1 |= Temp2 ; /* Temp1[10:0]: VRS[10:0] */ |
| 1664 | |
| 1665 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 11 ] ; /* Tempax: CR11 VRE */ |
| 1666 | Tempax &= 0x0F ; /* Tempax[3:0]: VRE[3:0] */ |
| 1667 | Tempbx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempbx: SRA */ |
| 1668 | Tempbx &= 0x20 ; /* Tempbx[5]: VRE[5] */ |
| 1669 | Tempbx >>= 1 ; /* Tempbx[4]: VRE[4] */ |
| 1670 | Tempax |= Tempbx ; /* Tempax[4:0]: VRE[4:0] */ |
| 1671 | Temp2 = Temp1 & 0x7E0 ; /* Temp2[10:5]: VRS[10:5] */ |
| 1672 | Temp2 |= Tempax ; /* Temp2[10:5]: VRE[10:5] */ |
| 1673 | |
| 1674 | Temp3 = Temp1 & 0x1F ; /* Temp3[4:0]: VRS[4:0] */ |
| 1675 | if ( Tempax < Temp3 ) /* VRE < VRS */ |
| 1676 | Temp2 |= 0x20 ; /* VRE + 0x20 */ |
| 1677 | |
| 1678 | Temp2 &= 0xFF ; |
| 1679 | Tempax = (UCHAR)Temp2 ; /* Tempax: VRE[7:0] */ |
| 1680 | Tempax <<= 2 ; /* Tempax[7:0]; VRE[5:0]00 */ |
| 1681 | Temp1 &= 0x600 ; /* Temp1[10:9]: VRS[10:9] */ |
| 1682 | Temp1 >>= 9 ; /* Temp1[1:0]: VRS[10:9] */ |
| 1683 | Tempbx = (UCHAR)Temp1 ; |
| 1684 | Tempax |= Tempbx ; /* Tempax[7:0]: VRE[5:0]VRS[10:9] */ |
| 1685 | Tempax &= 0x7F ; |
| 1686 | XGINew_SetReg1( pVBInfo->P3c4 , 0x3F , Tempax ) ; /* SR3F D[7:2]->VRE D[1:0]->VRS */ |
| 1687 | } |
| 1688 | } |
| 1689 | |
| 1690 | void XGI_SetXG27CRTC(USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo) |
| 1691 | { |
| 1692 | USHORT StandTableIndex, index, Tempax, Tempbx, Tempcx, Tempdx ; |
| 1693 | |
| 1694 | if ( ModeNo <= 0x13 ) |
| 1695 | { |
| 1696 | StandTableIndex = XGI_GetModePtr( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 1697 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 4 ] ; /* CR04 HRS */ |
| 1698 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , Tempax ) ; /* SR2E [7:0]->HRS */ |
| 1699 | Tempbx = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 5 ] ; /* Tempbx: CR05 HRE */ |
| 1700 | Tempbx &= 0x1F ; /* Tempbx: HRE[4:0] */ |
| 1701 | Tempcx = Tempax ; |
| 1702 | Tempcx &= 0xE0 ; /* Tempcx: HRS[7:5] */ |
| 1703 | Tempdx = Tempcx | Tempbx ; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */ |
| 1704 | if ( Tempbx < ( Tempax & 0x1F ) ) /* IF HRE < HRS */ |
| 1705 | Tempdx |= 0x20 ; /* Tempdx: HRE = HRE + 0x20 */ |
| 1706 | Tempdx <<= 2 ; /* Tempdx << 2 */ |
| 1707 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , Tempdx ) ; /* SR2F [7:2]->HRE */ |
| 1708 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , 0xE3 , 00 ) ; |
| 1709 | |
| 1710 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 16 ] ; /* Tempax: CR10 VRS */ |
| 1711 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , Tempax ) ; /* SR34[7:0]->VRS */ |
| 1712 | Tempcx = Tempax ; /* Tempcx=Tempax=VRS[7:0] */ |
| 1713 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 7 ] ; /* Tempax[7][2]: CR7[7][2] VRS[9][8] */ |
| 1714 | Tempbx = Tempax ; /* Tempbx=CR07 */ |
| 1715 | Tempax &= 0x04 ; /* Tempax[2]: CR07[2] VRS[8] */ |
| 1716 | Tempax >>= 2; |
| 1717 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x01, Tempax ) ; /* SR35 D[0]->VRS D[8] */ |
| 1718 | Tempcx |= (Tempax << 8) ; /* Tempcx[8] |= VRS[8] */ |
| 1719 | Tempcx |= (Tempbx & 0x80)<<2; /* Tempcx[9] |= VRS[9] */ |
| 1720 | |
| 1721 | |
| 1722 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 17 ] ; /* CR11 VRE */ |
| 1723 | Tempax &= 0x0F ; /* Tempax: VRE[3:0] */ |
| 1724 | Tempbx = Tempcx ; /* Tempbx=Tempcx=VRS[9:0] */ |
| 1725 | Tempbx &= 0x3F0 ; /* Tempbx[9:4]: VRS[9:4] */ |
| 1726 | Tempbx |= Tempax ; /* Tempbx[9:0]: VRE[9:0] */ |
| 1727 | if ( Tempax <= (Tempcx & 0x0F) ) /* VRE[3:0]<=VRS[3:0] */ |
| 1728 | Tempbx |= 0x10 ; /* Tempbx: VRE + 0x10 */ |
| 1729 | Tempax = (UCHAR)Tempbx & 0xFF; /* Tempax[7:0]: VRE[7:0] */ |
| 1730 | Tempax <<= 2 ; /* Tempax << 2: VRE[5:0] */ |
| 1731 | Tempcx = (Tempcx&0x600)>>8; /* Tempcx VRS[10:9] */ |
| 1732 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0xFC, Tempax ) ; /* SR3F D[7:2]->VRE D[5:0] */ |
| 1733 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x06, Tempcx ) ; /* SR35 D[2:1]->VRS[10:9] */ |
| 1734 | } |
| 1735 | else |
| 1736 | { |
| 1737 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 1738 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 3 ] ; /* Tempax: CR4 HRS */ |
| 1739 | Tempbx = Tempax ; /* Tempbx: HRS[7:0] */ |
| 1740 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , Tempax ) ; /* SR2E[7:0]->HRS */ |
| 1741 | |
| 1742 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 5 ] ; /* SR0B */ |
| 1743 | Tempax &= 0xC0 ; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/ |
| 1744 | Tempbx |= (Tempax << 2); /* Tempbx: HRS[9:0] */ |
| 1745 | |
| 1746 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 4 ] ; /* CR5 HRE */ |
| 1747 | Tempax &= 0x1F ; /* Tempax[4:0]: HRE[4:0] */ |
| 1748 | Tempcx = Tempax ; /* Tempcx: HRE[4:0] */ |
| 1749 | |
| 1750 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 6 ] ; /* SRC */ |
| 1751 | Tempax &= 0x04 ; /* Tempax[2]: HRE[5] */ |
| 1752 | Tempax <<= 3 ; /* Tempax[5]: HRE[5] */ |
| 1753 | Tempcx |= Tempax ; /* Tempcx[5:0]: HRE[5:0] */ |
| 1754 | |
| 1755 | Tempbx = Tempbx & 0x3C0 ; /* Tempbx[9:6]: HRS[9:6] */ |
| 1756 | Tempbx |= Tempcx ; /* Tempbx: HRS[9:6]HRE[5:0] */ |
| 1757 | |
| 1758 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 3 ] ; /* Tempax: CR4 HRS */ |
| 1759 | Tempax &= 0x3F ; /* Tempax: HRS[5:0] */ |
| 1760 | if( Tempcx <= Tempax ) /* HRE[5:0] < HRS[5:0] */ |
| 1761 | Tempbx += 0x40 ; /* Tempbx= Tempbx + 0x40 : HRE[9:0]*/ |
| 1762 | |
| 1763 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 5 ] ; /* SR0B */ |
| 1764 | Tempax &= 0xC0 ; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/ |
| 1765 | Tempax >>= 6; /* Tempax[1:0]: HRS[9:8]*/ |
| 1766 | Tempax |= ((Tempbx << 2) & 0xFF); /* Tempax[7:2]: HRE[5:0] */ |
| 1767 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , Tempax ) ; /* SR2F [7:2][1:0]: HRE[5:0]HRS[9:8] */ |
| 1768 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , 0xE3 , 00 ) ; |
| 1769 | |
| 1770 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 10 ] ; /* CR10 VRS */ |
| 1771 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , Tempax ) ; /* SR34[7:0]->VRS[7:0] */ |
| 1772 | |
| 1773 | Tempcx = Tempax ; /* Tempcx <= VRS[7:0] */ |
| 1774 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 9 ] ; /* CR7[7][2] VRS[9][8] */ |
| 1775 | Tempbx = Tempax ; /* Tempbx <= CR07[7:0] */ |
| 1776 | Tempax = Tempax & 0x04 ; /* Tempax[2]: CR7[2]: VRS[8] */ |
| 1777 | Tempax >>= 2 ; /* Tempax[0]: VRS[8] */ |
| 1778 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x01 , Tempax ) ; /* SR35[0]: VRS[8] */ |
| 1779 | Tempcx |= (Tempax<<8) ; /* Tempcx <= VRS[8:0] */ |
| 1780 | Tempcx |= ((Tempbx&0x80)<<2) ; /* Tempcx <= VRS[9:0] */ |
| 1781 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempax: SR0A */ |
| 1782 | Tempax &= 0x08; /* SR0A[3] VRS[10] */ |
| 1783 | Tempcx |= (Tempax<<7) ; /* Tempcx <= VRS[10:0] */ |
| 1784 | |
| 1785 | |
| 1786 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 11 ] ; /* Tempax: CR11 VRE */ |
| 1787 | Tempax &= 0x0F ; /* Tempax[3:0]: VRE[3:0] */ |
| 1788 | Tempbx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempbx: SR0A */ |
| 1789 | Tempbx &= 0x20 ; /* Tempbx[5]: SR0A[5]: VRE[4] */ |
| 1790 | Tempbx >>= 1 ; /* Tempbx[4]: VRE[4] */ |
| 1791 | Tempax |= Tempbx ; /* Tempax[4:0]: VRE[4:0] */ |
| 1792 | Tempbx = Tempcx ; /* Tempbx: VRS[10:0] */ |
| 1793 | Tempbx &= 0x7E0 ; /* Tempbx[10:5]: VRS[10:5] */ |
| 1794 | Tempbx |= Tempax ; /* Tempbx: VRS[10:5]VRE[4:0] */ |
| 1795 | |
| 1796 | if ( Tempbx <= Tempcx ) /* VRE <= VRS */ |
| 1797 | Tempbx |= 0x20 ; /* VRE + 0x20 */ |
| 1798 | |
| 1799 | Tempax = (Tempbx<<2) & 0xFF ; /* Tempax: Tempax[7:0]; VRE[5:0]00 */ |
| 1800 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0xFC , Tempax ) ; /* SR3F[7:2]:VRE[5:0] */ |
| 1801 | Tempax = Tempcx >> 8; |
| 1802 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x07 , Tempax ) ; /* SR35[2:0]:VRS[10:8] */ |
| 1803 | } |
| 1804 | } |
| 1805 | |
| 1806 | |
| 1807 | /* --------------------------------------------------------------------- */ |
| 1808 | /* Function : XGI_SetXG21LCD */ |
| 1809 | /* Input : */ |
| 1810 | /* Output : FCLK duty cycle, FCLK delay compensation */ |
| 1811 | /* Description : All values set zero */ |
| 1812 | /* --------------------------------------------------------------------- */ |
| 1813 | void XGI_SetXG21LCD(PVB_DEVICE_INFO pVBInfo,USHORT RefreshRateTableIndex,USHORT ModeNo) |
| 1814 | { |
| 1815 | USHORT Data , Temp , b3CC ; |
| 1816 | USHORT XGI_P3cc ; |
| 1817 | |
| 1818 | XGI_P3cc = pVBInfo->P3cc ; |
| 1819 | |
| 1820 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2E , 0x00 ) ; |
| 1821 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2F , 0x00 ) ; |
| 1822 | XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , 0x00 ) ; |
| 1823 | XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , 0x00 ) ; |
| 1824 | if ( ((*pVBInfo->pDVOSetting)&0xC0) == 0xC0 ) |
| 1825 | { |
| 1826 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2E , *pVBInfo->pCR2E ) ; |
| 1827 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2F , *pVBInfo->pCR2F ) ; |
| 1828 | XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , *pVBInfo->pCR46 ) ; |
| 1829 | XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , *pVBInfo->pCR47 ) ; |
| 1830 | } |
| 1831 | |
| 1832 | Temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; |
| 1833 | |
| 1834 | if ( Temp & 0x01 ) |
| 1835 | { |
| 1836 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x06 , 0x40 ) ; /* 18 bits FP */ |
| 1837 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x09 , 0x40 ) ; |
| 1838 | } |
| 1839 | |
| 1840 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x1E , 0x01 ) ; /* Negative blank polarity */ |
| 1841 | |
| 1842 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x30 , ~0x20 ) ; |
| 1843 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x35 , ~0x80 ) ; |
| 1844 | |
| 1845 | if ( ModeNo <= 0x13 ) |
| 1846 | { |
| 1847 | b3CC = (UCHAR) XGINew_GetReg2( XGI_P3cc ) ; |
| 1848 | if ( b3CC & 0x40 ) |
| 1849 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */ |
| 1850 | if ( b3CC & 0x80 ) |
| 1851 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */ |
| 1852 | } |
| 1853 | else |
| 1854 | { |
| 1855 | Data = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 1856 | if ( Data & 0x4000 ) |
| 1857 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */ |
| 1858 | if ( Data & 0x8000 ) |
| 1859 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */ |
| 1860 | } |
| 1861 | } |
| 1862 | |
| 1863 | void XGI_SetXG27LCD(PVB_DEVICE_INFO pVBInfo,USHORT RefreshRateTableIndex,USHORT ModeNo) |
| 1864 | { |
| 1865 | USHORT Data , Temp , b3CC ; |
| 1866 | USHORT XGI_P3cc ; |
| 1867 | |
| 1868 | XGI_P3cc = pVBInfo->P3cc ; |
| 1869 | |
| 1870 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2E , 0x00 ) ; |
| 1871 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2F , 0x00 ) ; |
| 1872 | XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , 0x00 ) ; |
| 1873 | XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , 0x00 ) ; |
| 1874 | |
| 1875 | Temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; |
| 1876 | if ( ( Temp & 0x03 ) == 0 ) /* dual 12 */ |
| 1877 | { |
| 1878 | XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , 0x13 ) ; |
| 1879 | XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , 0x13 ) ; |
| 1880 | } |
| 1881 | |
| 1882 | if ( ((*pVBInfo->pDVOSetting)&0xC0) == 0xC0 ) |
| 1883 | { |
| 1884 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2E , *pVBInfo->pCR2E ) ; |
| 1885 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2F , *pVBInfo->pCR2F ) ; |
| 1886 | XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , *pVBInfo->pCR46 ) ; |
| 1887 | XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , *pVBInfo->pCR47 ) ; |
| 1888 | } |
| 1889 | |
| 1890 | XGI_SetXG27FPBits(pVBInfo); |
| 1891 | |
| 1892 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x1E , 0x01 ) ; /* Negative blank polarity */ |
| 1893 | |
| 1894 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x30 , ~0x20 ) ; /* Hsync polarity */ |
| 1895 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x35 , ~0x80 ) ; /* Vsync polarity */ |
| 1896 | |
| 1897 | if ( ModeNo <= 0x13 ) |
| 1898 | { |
| 1899 | b3CC = (UCHAR) XGINew_GetReg2( XGI_P3cc ) ; |
| 1900 | if ( b3CC & 0x40 ) |
| 1901 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */ |
| 1902 | if ( b3CC & 0x80 ) |
| 1903 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */ |
| 1904 | } |
| 1905 | else |
| 1906 | { |
| 1907 | Data = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 1908 | if ( Data & 0x4000 ) |
| 1909 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */ |
| 1910 | if ( Data & 0x8000 ) |
| 1911 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */ |
| 1912 | } |
| 1913 | } |
| 1914 | |
| 1915 | /* --------------------------------------------------------------------- */ |
| 1916 | /* Function : XGI_UpdateXG21CRTC */ |
| 1917 | /* Input : */ |
| 1918 | /* Output : CRT1 CRTC */ |
| 1919 | /* Description : Modify CRT1 Hsync/Vsync to fix LCD mode timing */ |
| 1920 | /* --------------------------------------------------------------------- */ |
| 1921 | void XGI_UpdateXG21CRTC( USHORT ModeNo , PVB_DEVICE_INFO pVBInfo , USHORT RefreshRateTableIndex ) |
| 1922 | { |
| 1923 | int i , index = -1; |
| 1924 | |
| 1925 | XGINew_SetRegAND( pVBInfo->P3d4 , 0x11 , 0x7F ) ; /* Unlock CR0~7 */ |
| 1926 | if ( ModeNo <= 0x13 ) |
| 1927 | { |
| 1928 | for( i = 0 ; i < 12 ; i++ ) |
| 1929 | { |
| 1930 | if ( ModeNo == pVBInfo->UpdateCRT1[ i ].ModeID ) |
| 1931 | index = i ; |
| 1932 | } |
| 1933 | } |
| 1934 | else |
| 1935 | { |
| 1936 | if ( ModeNo == 0x2E && ( pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC == RES640x480x60 ) ) |
| 1937 | index = 12 ; |
| 1938 | else if ( ModeNo == 0x2E && ( pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC == RES640x480x72 ) ) |
| 1939 | index = 13 ; |
| 1940 | else if ( ModeNo == 0x2F ) |
| 1941 | index = 14 ; |
| 1942 | else if ( ModeNo == 0x50 ) |
| 1943 | index = 15 ; |
| 1944 | else if ( ModeNo == 0x59 ) |
| 1945 | index = 16 ; |
| 1946 | } |
| 1947 | |
| 1948 | if( index != -1 ) |
| 1949 | { |
| 1950 | XGINew_SetReg1( pVBInfo->P3d4 , 0x02 , pVBInfo->UpdateCRT1[ index ].CR02 ) ; |
| 1951 | XGINew_SetReg1( pVBInfo->P3d4 , 0x03 , pVBInfo->UpdateCRT1[ index ].CR03 ) ; |
| 1952 | XGINew_SetReg1( pVBInfo->P3d4 , 0x15 , pVBInfo->UpdateCRT1[ index ].CR15 ) ; |
| 1953 | XGINew_SetReg1( pVBInfo->P3d4 , 0x16 , pVBInfo->UpdateCRT1[ index ].CR16 ) ; |
| 1954 | } |
| 1955 | } |
| 1956 | |
| 1957 | |
| 1958 | /* --------------------------------------------------------------------- */ |
| 1959 | /* Function : XGI_SetCRT1DE */ |
| 1960 | /* Input : */ |
| 1961 | /* Output : */ |
| 1962 | /* Description : */ |
| 1963 | /* --------------------------------------------------------------------- */ |
| 1964 | void XGI_SetCRT1DE( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT ModeNo,USHORT ModeIdIndex , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 1965 | { |
| 1966 | USHORT resindex , |
| 1967 | tempax , |
| 1968 | tempbx , |
| 1969 | tempcx , |
| 1970 | temp , |
| 1971 | modeflag ; |
| 1972 | |
| 1973 | UCHAR data ; |
| 1974 | |
| 1975 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 1976 | |
| 1977 | if ( ModeNo <= 0x13 ) |
| 1978 | { |
| 1979 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 1980 | tempax = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 1981 | tempbx = pVBInfo->StResInfo[ resindex ].VTotal ; |
| 1982 | } |
| 1983 | else |
| 1984 | { |
| 1985 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 1986 | tempax = pVBInfo->ModeResInfo[ resindex ].HTotal ; |
| 1987 | tempbx = pVBInfo->ModeResInfo[ resindex ].VTotal ; |
| 1988 | } |
| 1989 | |
| 1990 | if ( modeflag & HalfDCLK ) |
| 1991 | tempax = tempax >> 1 ; |
| 1992 | |
| 1993 | if ( ModeNo > 0x13 ) |
| 1994 | { |
| 1995 | if ( modeflag & HalfDCLK ) |
| 1996 | tempax = tempax << 1 ; |
| 1997 | |
| 1998 | temp = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 1999 | |
| 2000 | if ( temp & InterlaceMode ) |
| 2001 | tempbx = tempbx >> 1 ; |
| 2002 | |
| 2003 | if ( modeflag & DoubleScanMode ) |
| 2004 | tempbx = tempbx << 1 ; |
| 2005 | } |
| 2006 | |
| 2007 | tempcx = 8 ; |
| 2008 | |
| 2009 | /* if ( !( modeflag & Charx8Dot ) ) */ |
| 2010 | /* tempcx = 9 ; */ |
| 2011 | |
| 2012 | tempax /= tempcx ; |
| 2013 | tempax -= 1 ; |
| 2014 | tempbx -= 1 ; |
| 2015 | tempcx = tempax ; |
| 2016 | temp = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x11 ) ; |
| 2017 | data = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x11 ) ; |
| 2018 | data &= 0x7F ; |
| 2019 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , data ) ; /* Unlock CRTC */ |
| 2020 | XGINew_SetReg1( pVBInfo->P3d4 , 0x01 , ( USHORT )( tempcx & 0xff ) ) ; |
| 2021 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x0b , ~0x0c , ( USHORT )( ( tempcx & 0x0ff00 ) >> 10 ) ) ; |
| 2022 | XGINew_SetReg1( pVBInfo->P3d4 , 0x12 , ( USHORT )( tempbx & 0xff ) ) ; |
| 2023 | tempax = 0 ; |
| 2024 | tempbx = tempbx >> 8 ; |
| 2025 | |
| 2026 | if ( tempbx & 0x01 ) |
| 2027 | tempax |= 0x02 ; |
| 2028 | |
| 2029 | if ( tempbx & 0x02 ) |
| 2030 | tempax |= 0x40 ; |
| 2031 | |
| 2032 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x42 , tempax ) ; |
| 2033 | data =( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x07 ) ; |
| 2034 | data &= 0xFF ; |
| 2035 | tempax = 0 ; |
| 2036 | |
| 2037 | if ( tempbx & 0x04 ) |
| 2038 | tempax |= 0x02 ; |
| 2039 | |
| 2040 | XGINew_SetRegANDOR( pVBInfo->P3d4 ,0x0a , ~0x02 , tempax ) ; |
| 2041 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , temp ) ; |
| 2042 | } |
| 2043 | |
| 2044 | |
| 2045 | /* --------------------------------------------------------------------- */ |
| 2046 | /* Function : XGI_GetResInfo */ |
| 2047 | /* Input : */ |
| 2048 | /* Output : */ |
| 2049 | /* Description : */ |
| 2050 | /* --------------------------------------------------------------------- */ |
| 2051 | USHORT XGI_GetResInfo(USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 2052 | { |
| 2053 | USHORT resindex ; |
| 2054 | |
| 2055 | if ( ModeNo <= 0x13 ) |
| 2056 | { |
| 2057 | resindex = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */ |
| 2058 | } |
| 2059 | else |
| 2060 | { |
| 2061 | resindex = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */ |
| 2062 | } |
| 2063 | return( resindex ) ; |
| 2064 | } |
| 2065 | |
| 2066 | |
| 2067 | /* --------------------------------------------------------------------- */ |
| 2068 | /* Function : XGI_SetCRT1Offset */ |
| 2069 | /* Input : */ |
| 2070 | /* Output : */ |
| 2071 | /* Description : */ |
| 2072 | /* --------------------------------------------------------------------- */ |
| 2073 | void XGI_SetCRT1Offset( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex , PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo ) |
| 2074 | { |
| 2075 | USHORT temp , |
| 2076 | ah , |
| 2077 | al , |
| 2078 | temp2 , |
| 2079 | i , |
| 2080 | DisplayUnit ; |
| 2081 | |
| 2082 | /* GetOffset */ |
| 2083 | temp = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeInfo ; |
| 2084 | temp = temp >> 8 ; |
| 2085 | temp = pVBInfo->ScreenOffset[ temp ] ; |
| 2086 | |
| 2087 | temp2 = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 2088 | temp2 &= InterlaceMode ; |
| 2089 | |
| 2090 | if ( temp2 ) |
| 2091 | temp = temp << 1; |
| 2092 | |
| 2093 | temp2 = pVBInfo->ModeType - ModeEGA ; |
| 2094 | |
| 2095 | switch( temp2 ) |
| 2096 | { |
| 2097 | case 0: |
| 2098 | temp2 = 1 ; |
| 2099 | break ; |
| 2100 | case 1: |
| 2101 | temp2 = 2 ; |
| 2102 | break ; |
| 2103 | case 2: |
| 2104 | temp2 = 4 ; |
| 2105 | break ; |
| 2106 | case 3: |
| 2107 | temp2 = 4 ; |
| 2108 | break ; |
| 2109 | case 4: |
| 2110 | temp2 = 6 ; |
| 2111 | break; |
| 2112 | case 5: |
| 2113 | temp2 = 8 ; |
| 2114 | break ; |
| 2115 | default: |
| 2116 | break ; |
| 2117 | } |
| 2118 | |
| 2119 | if ( ( ModeNo >= 0x26 ) && ( ModeNo <= 0x28 ) ) |
| 2120 | temp = temp * temp2 + temp2 / 2 ; |
| 2121 | else |
| 2122 | temp *= temp2 ; |
| 2123 | |
| 2124 | /* SetOffset */ |
| 2125 | DisplayUnit = temp ; |
| 2126 | temp2 = temp ; |
| 2127 | temp = temp >> 8 ; /* ah */ |
| 2128 | temp &= 0x0F ; |
| 2129 | i = XGINew_GetReg1( pVBInfo->P3c4 , 0x0E ) ; |
| 2130 | i &= 0xF0 ; |
| 2131 | i |= temp ; |
| 2132 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0E , i ) ; |
| 2133 | |
| 2134 | temp =( UCHAR )temp2 ; |
| 2135 | temp &= 0xFF ; /* al */ |
| 2136 | XGINew_SetReg1( pVBInfo->P3d4 , 0x13 , temp ) ; |
| 2137 | |
| 2138 | /* SetDisplayUnit */ |
| 2139 | temp2 = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 2140 | temp2 &= InterlaceMode ; |
| 2141 | if ( temp2 ) |
| 2142 | DisplayUnit >>= 1 ; |
| 2143 | |
| 2144 | DisplayUnit = DisplayUnit << 5 ; |
| 2145 | ah = ( DisplayUnit & 0xff00 ) >> 8 ; |
| 2146 | al = DisplayUnit & 0x00ff ; |
| 2147 | if ( al == 0 ) |
| 2148 | ah += 1 ; |
| 2149 | else |
| 2150 | ah += 2 ; |
| 2151 | |
| 2152 | if ( HwDeviceExtension->jChipType >= XG20 ) |
| 2153 | if ( ( ModeNo == 0x4A ) | (ModeNo == 0x49 ) ) |
| 2154 | ah -= 1 ; |
| 2155 | |
| 2156 | XGINew_SetReg1( pVBInfo->P3c4 , 0x10 , ah ) ; |
| 2157 | } |
| 2158 | |
| 2159 | |
| 2160 | /* --------------------------------------------------------------------- */ |
| 2161 | /* Function : XGI_SetCRT1VCLK */ |
| 2162 | /* Input : */ |
| 2163 | /* Output : */ |
| 2164 | /* Description : */ |
| 2165 | /* --------------------------------------------------------------------- */ |
| 2166 | void XGI_SetCRT1VCLK( USHORT ModeNo , USHORT ModeIdIndex , |
| 2167 | PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 2168 | { |
| 2169 | UCHAR index , data ; |
| 2170 | USHORT vclkindex ; |
| 2171 | |
| 2172 | if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 2173 | { |
| 2174 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ; |
| 2175 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x31 ) & 0xCF ; |
| 2176 | XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , data ) ; |
| 2177 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ index ].SR2B ) ; |
| 2178 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ index ].SR2C ) ; |
| 2179 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2D , 0x01 ) ; |
| 2180 | } |
| 2181 | else if ( ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) && ( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) |
| 2182 | { |
| 2183 | vclkindex = XGI_GetVCLK2Ptr( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
| 2184 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x31 ) & 0xCF ; |
| 2185 | XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , data ) ; |
| 2186 | data = pVBInfo->VBVCLKData[ vclkindex ].Part4_A ; |
| 2187 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , data ) ; |
| 2188 | data = pVBInfo->VBVCLKData[ vclkindex ].Part4_B ; |
| 2189 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , data ) ; |
| 2190 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2D , 0x01 ) ; |
| 2191 | } |
| 2192 | else |
| 2193 | { |
| 2194 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ; |
| 2195 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x31 ) & 0xCF ; |
| 2196 | XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , data ) ; |
| 2197 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ index ].SR2B ) ; |
| 2198 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ index ].SR2C ) ; |
| 2199 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2D , 0x01 ) ; |
| 2200 | } |
| 2201 | |
| 2202 | if ( HwDeviceExtension->jChipType >= XG20 ) |
| 2203 | { |
| 2204 | if ( pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag & HalfDCLK ) |
| 2205 | { |
| 2206 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x2B ) ; |
| 2207 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , data ) ; |
| 2208 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x2C ) ; |
| 2209 | index = data ; |
| 2210 | index &= 0xE0 ; |
| 2211 | data &= 0x1F ; |
| 2212 | data = data << 1 ; |
| 2213 | data += 1 ; |
| 2214 | data |= index ; |
| 2215 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , data ) ; |
| 2216 | } |
| 2217 | } |
| 2218 | } |
| 2219 | |
| 2220 | |
| 2221 | /* --------------------------------------------------------------------- */ |
| 2222 | /* Function : XGI_SetCRT1FIFO */ |
| 2223 | /* Input : */ |
| 2224 | /* Output : */ |
| 2225 | /* Description : */ |
| 2226 | /* --------------------------------------------------------------------- */ |
| 2227 | void XGI_SetCRT1FIFO( USHORT ModeNo , PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo ) |
| 2228 | { |
| 2229 | USHORT data ; |
| 2230 | |
| 2231 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x3D ) ; |
| 2232 | data &= 0xfe ; |
| 2233 | XGINew_SetReg1( pVBInfo->P3c4 , 0x3D , data ) ; /* diable auto-threshold */ |
| 2234 | |
| 2235 | if ( ModeNo > 0x13 ) |
| 2236 | { |
| 2237 | XGINew_SetReg1( pVBInfo->P3c4 , 0x08 , 0x34 ) ; |
| 2238 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x09 ) ; |
| 2239 | data &= 0xC0 ; |
| 2240 | XGINew_SetReg1( pVBInfo->P3c4 , 0x09 , data | 0x30) ; |
| 2241 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x3D ) ; |
| 2242 | data |= 0x01 ; |
| 2243 | XGINew_SetReg1( pVBInfo->P3c4 , 0x3D , data ) ; |
| 2244 | } |
| 2245 | else |
| 2246 | { |
| 2247 | if (HwDeviceExtension->jChipType == XG27) |
| 2248 | { |
| 2249 | XGINew_SetReg1( pVBInfo->P3c4 , 0x08 , 0x0E ) ; |
| 2250 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x09 ) ; |
| 2251 | data &= 0xC0 ; |
| 2252 | XGINew_SetReg1( pVBInfo->P3c4 , 0x09 , data | 0x20 ) ; |
| 2253 | } |
| 2254 | else |
| 2255 | { |
| 2256 | XGINew_SetReg1( pVBInfo->P3c4 , 0x08 , 0xAE ) ; |
| 2257 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x09 ) ; |
| 2258 | data &= 0xF0 ; |
| 2259 | XGINew_SetReg1( pVBInfo->P3c4 , 0x09 , data ) ; |
| 2260 | } |
| 2261 | } |
| 2262 | |
| 2263 | if (HwDeviceExtension->jChipType == XG21) |
| 2264 | { |
| 2265 | XGI_SetXG21FPBits(pVBInfo); /* Fix SR9[7:6] can't read back */ |
| 2266 | } |
| 2267 | } |
| 2268 | |
| 2269 | |
| 2270 | /* --------------------------------------------------------------------- */ |
| 2271 | /* Function : XGI_SetCRT1ModeRegs */ |
| 2272 | /* Input : */ |
| 2273 | /* Output : */ |
| 2274 | /* Description : */ |
| 2275 | /* --------------------------------------------------------------------- */ |
| 2276 | void XGI_SetCRT1ModeRegs( PXGI_HW_DEVICE_INFO HwDeviceExtension , |
| 2277 | USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo ) |
| 2278 | { |
| 2279 | USHORT data , |
| 2280 | data2 , |
| 2281 | data3 , |
| 2282 | infoflag = 0 , |
| 2283 | modeflag , |
| 2284 | resindex , |
| 2285 | xres ; |
| 2286 | |
| 2287 | if ( ModeNo > 0x13 ) |
| 2288 | { |
| 2289 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 2290 | infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 2291 | } |
| 2292 | else |
| 2293 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag */ |
| 2294 | |
| 2295 | if ( XGINew_GetReg1( pVBInfo->P3d4 , 0x31 ) & 0x01 ) |
| 2296 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x1F , 0x3F , 0x00 ) ; |
| 2297 | |
| 2298 | if ( ModeNo > 0x13 ) |
| 2299 | data = infoflag ; |
| 2300 | else |
| 2301 | data = 0 ; |
| 2302 | |
| 2303 | data2 = 0 ; |
| 2304 | |
| 2305 | if ( ModeNo > 0x13 ) |
| 2306 | { |
| 2307 | if ( pVBInfo->ModeType > 0x02 ) |
| 2308 | { |
| 2309 | data2 |= 0x02 ; |
| 2310 | data3 = pVBInfo->ModeType - ModeVGA ; |
| 2311 | data3 = data3 << 2 ; |
| 2312 | data2 |= data3 ; |
| 2313 | } |
| 2314 | } |
| 2315 | |
| 2316 | data &= InterlaceMode ; |
| 2317 | |
| 2318 | if ( data ) |
| 2319 | data2 |= 0x20 ; |
| 2320 | |
| 2321 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x06 , ~0x3F , data2 ) ; |
| 2322 | /* XGINew_SetReg1(pVBInfo->P3c4,0x06,data2); */ |
| 2323 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 2324 | if ( ModeNo <= 0x13 ) |
| 2325 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 2326 | else |
| 2327 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */ |
| 2328 | |
| 2329 | data = 0x0000 ; |
| 2330 | if ( infoflag & InterlaceMode ) |
| 2331 | { |
| 2332 | if ( xres == 1024 ) |
| 2333 | data = 0x0035 ; |
| 2334 | else if ( xres == 1280 ) |
| 2335 | data = 0x0048 ; |
| 2336 | } |
| 2337 | |
| 2338 | data2 = data & 0x00FF ; |
| 2339 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x19 , 0xFF , data2 ) ; |
| 2340 | data2 = ( data & 0xFF00 ) >> 8 ; |
| 2341 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x19 , 0xFC , data2 ) ; |
| 2342 | |
| 2343 | if( modeflag & HalfDCLK ) |
| 2344 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xF7 , 0x08 ) ; |
| 2345 | |
| 2346 | data2 = 0 ; |
| 2347 | |
| 2348 | if ( modeflag & LineCompareOff ) |
| 2349 | data2 |= 0x08 ; |
| 2350 | |
| 2351 | if ( ModeNo > 0x13 ) |
| 2352 | { |
| 2353 | if ( pVBInfo->ModeType == ModeEGA ) |
| 2354 | data2 |= 0x40 ; |
| 2355 | } |
| 2356 | |
| 2357 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0F , ~0x48 , data2 ) ; |
| 2358 | data = 0x60 ; |
| 2359 | if ( pVBInfo->ModeType != ModeText ) |
| 2360 | { |
| 2361 | data = data ^ 0x60 ; |
| 2362 | if ( pVBInfo->ModeType != ModeEGA ) |
| 2363 | { |
| 2364 | data = data ^ 0xA0 ; |
| 2365 | } |
| 2366 | } |
| 2367 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x21 , 0x1F , data ) ; |
| 2368 | |
| 2369 | XGI_SetVCLKState( HwDeviceExtension , ModeNo , RefreshRateTableIndex, pVBInfo) ; |
| 2370 | |
| 2371 | /* if(modeflag&HalfDCLK)//030305 fix lowresolution bug */ |
| 2372 | /* if(XGINew_IF_DEF_NEW_LOWRES) */ |
| 2373 | /* XGI_VesaLowResolution(ModeNo,ModeIdIndex);//030305 fix lowresolution bug */ |
| 2374 | |
| 2375 | data=XGINew_GetReg1( pVBInfo->P3d4 , 0x31 ) ; |
| 2376 | |
| 2377 | if (HwDeviceExtension->jChipType == XG27 ) |
| 2378 | { |
| 2379 | if ( data & 0x40 ) |
| 2380 | data = 0x2c ; |
| 2381 | else |
| 2382 | data = 0x6c ; |
| 2383 | XGINew_SetReg1( pVBInfo->P3d4 , 0x52 , data ) ; |
| 2384 | XGINew_SetRegOR( pVBInfo->P3d4 , 0x51 , 0x10 ) ; |
| 2385 | } |
| 2386 | else |
| 2387 | if (HwDeviceExtension->jChipType >= XG20 ) |
| 2388 | { |
| 2389 | if ( data & 0x40 ) |
| 2390 | data = 0x33 ; |
| 2391 | else |
| 2392 | data = 0x73 ; |
| 2393 | XGINew_SetReg1( pVBInfo->P3d4 , 0x52 , data ) ; |
| 2394 | XGINew_SetReg1( pVBInfo->P3d4 , 0x51 , 0x02 ) ; |
| 2395 | } |
| 2396 | else |
| 2397 | { |
| 2398 | if ( data & 0x40 ) |
| 2399 | data = 0x2c ; |
| 2400 | else |
| 2401 | data = 0x6c ; |
| 2402 | XGINew_SetReg1( pVBInfo->P3d4 , 0x52 , data ) ; |
| 2403 | } |
| 2404 | |
| 2405 | } |
| 2406 | |
| 2407 | |
| 2408 | /* --------------------------------------------------------------------- */ |
| 2409 | /* Function : XGI_SetVCLKState */ |
| 2410 | /* Input : */ |
| 2411 | /* Output : */ |
| 2412 | /* Description : */ |
| 2413 | /* --------------------------------------------------------------------- */ |
| 2414 | void XGI_SetVCLKState( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT ModeNo , USHORT RefreshRateTableIndex,PVB_DEVICE_INFO pVBInfo ) |
| 2415 | { |
| 2416 | USHORT data , |
| 2417 | data2 = 0 ; |
| 2418 | SHORT VCLK ; |
| 2419 | |
| 2420 | UCHAR index ; |
| 2421 | |
| 2422 | if ( ModeNo <= 0x13 ) |
| 2423 | VCLK = 0 ; |
| 2424 | else |
| 2425 | { |
| 2426 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ; |
| 2427 | index &= IndexMask ; |
| 2428 | VCLK = pVBInfo->VCLKData[ index ].CLOCK ; |
| 2429 | } |
| 2430 | |
| 2431 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x32 ) ; |
| 2432 | data &= 0xf3 ; |
| 2433 | if ( VCLK >= 200 ) |
| 2434 | data |= 0x0c ; /* VCLK > 200 */ |
| 2435 | |
| 2436 | if ( HwDeviceExtension->jChipType >= XG20 ) |
| 2437 | data &= ~0x04 ; /* 2 pixel mode */ |
| 2438 | |
| 2439 | XGINew_SetReg1( pVBInfo->P3c4 , 0x32 , data ) ; |
| 2440 | |
| 2441 | if ( HwDeviceExtension->jChipType < XG20 ) |
| 2442 | { |
| 2443 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x1F ) ; |
| 2444 | data &= 0xE7 ; |
| 2445 | if ( VCLK < 200 ) |
| 2446 | data |= 0x10 ; |
| 2447 | XGINew_SetReg1( pVBInfo->P3c4 , 0x1F , data ) ; |
| 2448 | } |
| 2449 | |
| 2450 | /* Jong for Adavantech LCD ripple issue |
| 2451 | if ( ( VCLK >= 0 ) && ( VCLK < 135 ) ) |
| 2452 | data2 = 0x03 ; |
| 2453 | else if ( ( VCLK >= 135 ) && ( VCLK < 160 ) ) |
| 2454 | data2 = 0x02 ; |
| 2455 | else if ( ( VCLK >= 160 ) && ( VCLK < 260 ) ) |
| 2456 | data2 = 0x01 ; |
| 2457 | else if ( VCLK > 260 ) |
| 2458 | data2 = 0x00 ; |
| 2459 | */ |
| 2460 | data2 = 0x00 ; |
| 2461 | |
| 2462 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x07 , 0xFC , data2 ) ; |
| 2463 | if (HwDeviceExtension->jChipType >= XG27 ) |
| 2464 | { |
| 2465 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x40 , 0xFC , data2&0x03 ) ; |
| 2466 | } |
| 2467 | |
| 2468 | |
| 2469 | } |
| 2470 | |
| 2471 | |
| 2472 | /* --------------------------------------------------------------------- */ |
| 2473 | /* Function : XGI_VesaLowResolution */ |
| 2474 | /* Input : */ |
| 2475 | /* Output : */ |
| 2476 | /* Description : */ |
| 2477 | /* --------------------------------------------------------------------- */ |
| 2478 | /*void XGI_VesaLowResolution( USHORT ModeNo , USHORT ModeIdIndex ,PVB_DEVICE_INFO pVBInfo) |
| 2479 | { |
| 2480 | USHORT modeflag; |
| 2481 | |
| 2482 | if ( ModeNo > 0x13 ) |
| 2483 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 2484 | else |
| 2485 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 2486 | |
| 2487 | if ( ModeNo > 0x13 ) |
| 2488 | { |
| 2489 | if ( modeflag & DoubleScanMode ) |
| 2490 | { |
| 2491 | if ( modeflag & HalfDCLK ) |
| 2492 | { |
| 2493 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 2494 | { |
| 2495 | if ( !( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) ) |
| 2496 | { |
| 2497 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 2498 | { |
| 2499 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xf7 , 0x00 ) ; |
| 2500 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0f , 0x7f , 0x00 ) ; |
| 2501 | return ; |
| 2502 | } |
| 2503 | } |
| 2504 | } |
| 2505 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0f , 0xff , 0x80 ) ; |
| 2506 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xf7 , 0x00 ) ; |
| 2507 | return ; |
| 2508 | } |
| 2509 | } |
| 2510 | } |
| 2511 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0f , 0x7f , 0x00 ) ; |
| 2512 | } |
| 2513 | */ |
| 2514 | |
| 2515 | /* --------------------------------------------------------------------- */ |
| 2516 | /* Function : XGI_LoadDAC */ |
| 2517 | /* Input : */ |
| 2518 | /* Output : */ |
| 2519 | /* Description : */ |
| 2520 | /* --------------------------------------------------------------------- */ |
| 2521 | void XGI_LoadDAC( USHORT ModeNo , USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo ) |
| 2522 | { |
| 2523 | USHORT data , data2 , time , |
| 2524 | i , j , k , m , n , o , |
| 2525 | si , di , bx , dl , al , ah , dh , |
| 2526 | *table = NULL ; |
| 2527 | |
| 2528 | if ( ModeNo <= 0x13 ) |
| 2529 | data = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 2530 | else |
| 2531 | data = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 2532 | |
| 2533 | data &= DACInfoFlag ; |
| 2534 | time = 64 ; |
| 2535 | |
| 2536 | if ( data == 0x00 ) |
| 2537 | table = XGINew_MDA_DAC ; |
| 2538 | else if ( data == 0x08 ) |
| 2539 | table = XGINew_CGA_DAC ; |
| 2540 | else if ( data == 0x10 ) |
| 2541 | table = XGINew_EGA_DAC ; |
| 2542 | else if ( data == 0x18 ) |
| 2543 | { |
| 2544 | time = 256 ; |
| 2545 | table = XGINew_VGA_DAC ; |
| 2546 | } |
| 2547 | |
| 2548 | if ( time == 256 ) |
| 2549 | j = 16 ; |
| 2550 | else |
| 2551 | j = time ; |
| 2552 | |
| 2553 | XGINew_SetReg3( pVBInfo->P3c6 , 0xFF ) ; |
| 2554 | XGINew_SetReg3( pVBInfo->P3c8 , 0x00 ) ; |
| 2555 | |
| 2556 | for( i = 0 ; i < j ; i++ ) |
| 2557 | { |
| 2558 | data = table[ i ] ; |
| 2559 | |
| 2560 | for( k = 0 ; k < 3 ; k++ ) |
| 2561 | { |
| 2562 | data2 = 0 ; |
| 2563 | |
| 2564 | if ( data & 0x01 ) |
| 2565 | data2 = 0x2A ; |
| 2566 | |
| 2567 | if ( data & 0x02 ) |
| 2568 | data2 += 0x15 ; |
| 2569 | |
| 2570 | XGINew_SetReg3( pVBInfo->P3c9 , data2 ) ; |
| 2571 | data = data >> 2 ; |
| 2572 | } |
| 2573 | } |
| 2574 | |
| 2575 | if ( time == 256 ) |
| 2576 | { |
| 2577 | for( i = 16 ; i < 32 ; i++ ) |
| 2578 | { |
| 2579 | data = table[ i ] ; |
| 2580 | |
| 2581 | for( k = 0 ; k < 3 ; k++ ) |
| 2582 | XGINew_SetReg3( pVBInfo->P3c9 , data ) ; |
| 2583 | } |
| 2584 | |
| 2585 | si = 32 ; |
| 2586 | |
| 2587 | for( m = 0 ; m < 9 ; m++ ) |
| 2588 | { |
| 2589 | di = si ; |
| 2590 | bx = si + 0x04 ; |
| 2591 | dl = 0 ; |
| 2592 | |
| 2593 | for( n = 0 ; n < 3 ; n++ ) |
| 2594 | { |
| 2595 | for( o = 0 ; o < 5 ; o++ ) |
| 2596 | { |
| 2597 | dh = table[ si ] ; |
| 2598 | ah = table[ di ] ; |
| 2599 | al = table[ bx ] ; |
| 2600 | si++ ; |
| 2601 | XGI_WriteDAC( dl , ah , al , dh, pVBInfo ) ; |
| 2602 | } |
| 2603 | |
| 2604 | si -= 2 ; |
| 2605 | |
| 2606 | for( o = 0 ; o < 3 ; o++ ) |
| 2607 | { |
| 2608 | dh = table[ bx ] ; |
| 2609 | ah = table[ di ] ; |
| 2610 | al = table[ si ] ; |
| 2611 | si-- ; |
| 2612 | XGI_WriteDAC( dl , ah , al , dh, pVBInfo ) ; |
| 2613 | } |
| 2614 | |
| 2615 | dl++ ; |
| 2616 | } |
| 2617 | |
| 2618 | si += 5 ; |
| 2619 | } |
| 2620 | } |
| 2621 | } |
| 2622 | |
| 2623 | |
| 2624 | /* --------------------------------------------------------------------- */ |
| 2625 | /* Function : XGI_WriteDAC */ |
| 2626 | /* Input : */ |
| 2627 | /* Output : */ |
| 2628 | /* Description : */ |
| 2629 | /* --------------------------------------------------------------------- */ |
| 2630 | void XGI_WriteDAC( USHORT dl , USHORT ah , USHORT al , USHORT dh,PVB_DEVICE_INFO pVBInfo ) |
| 2631 | { |
| 2632 | USHORT temp , bh , bl ; |
| 2633 | |
| 2634 | bh = ah ; |
| 2635 | bl = al ; |
| 2636 | |
| 2637 | if ( dl != 0 ) |
| 2638 | { |
| 2639 | temp = bh ; |
| 2640 | bh = dh ; |
| 2641 | dh = temp ; |
| 2642 | if ( dl == 1 ) |
| 2643 | { |
| 2644 | temp = bl ; |
| 2645 | bl = dh ; |
| 2646 | dh = temp ; |
| 2647 | } |
| 2648 | else |
| 2649 | { |
| 2650 | temp = bl ; |
| 2651 | bl = bh ; |
| 2652 | bh = temp ; |
| 2653 | } |
| 2654 | } |
| 2655 | XGINew_SetReg3( pVBInfo->P3c9 , ( USHORT )dh ) ; |
| 2656 | XGINew_SetReg3( pVBInfo->P3c9 , ( USHORT )bh ) ; |
| 2657 | XGINew_SetReg3( pVBInfo->P3c9 , ( USHORT )bl ) ; |
| 2658 | } |
| 2659 | |
| 2660 | #if 0 |
| 2661 | /* --------------------------------------------------------------------- */ |
| 2662 | /* Function : XGI_ClearBuffer */ |
| 2663 | /* Input : */ |
| 2664 | /* Output : */ |
| 2665 | /* Description : */ |
| 2666 | /* --------------------------------------------------------------------- */ |
| 2667 | void XGI_ClearBuffer( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT ModeNo, PVB_DEVICE_INFO pVBInfo) |
| 2668 | { |
| 2669 | PVOID VideoMemoryAddress = ( PVOID )HwDeviceExtension->pjVideoMemoryAddress ; |
| 2670 | ULONG AdapterMemorySize = ( ULONG )HwDeviceExtension->ulVideoMemorySize ; |
| 2671 | PUSHORT pBuffer ; |
| 2672 | #ifndef LINUX_XF86 |
| 2673 | int i ; |
| 2674 | #endif |
| 2675 | |
| 2676 | if ( pVBInfo->ModeType >= ModeEGA ) |
| 2677 | { |
| 2678 | if ( ModeNo > 0x13 ) |
| 2679 | { |
| 2680 | AdapterMemorySize = 0x40000 ; /* clear 256k */ |
| 2681 | /* GetDRAMSize( HwDeviceExtension ) ; */ |
| 2682 | XGI_SetMemory( VideoMemoryAddress , AdapterMemorySize , 0 ) ; |
| 2683 | } |
| 2684 | else |
| 2685 | { |
| 2686 | /* |
| 2687 | pBuffer = VideoMemoryAddress ; |
| 2688 | for( i = 0 ; i < 0x4000 ; i++ ) |
| 2689 | pBuffer[ i ] = 0x0000 ; |
| 2690 | */ |
| 2691 | } |
| 2692 | } |
| 2693 | else |
| 2694 | { |
| 2695 | pBuffer = VideoMemoryAddress ; |
| 2696 | if ( pVBInfo->ModeType < ModeCGA ) |
| 2697 | { |
| 2698 | /* |
| 2699 | for ( i = 0 ; i < 0x4000 ; i++ ) |
| 2700 | pBuffer[ i ] = 0x0720 ; |
| 2701 | */ |
| 2702 | } |
| 2703 | else |
| 2704 | XGI_SetMemory( VideoMemoryAddress , 0x8000 , 0 ) ; |
| 2705 | } |
| 2706 | } |
| 2707 | |
| 2708 | #endif |
| 2709 | /* --------------------------------------------------------------------- */ |
| 2710 | /* Function : XGI_SetLCDAGroup */ |
| 2711 | /* Input : */ |
| 2712 | /* Output : */ |
| 2713 | /* Description : */ |
| 2714 | /* --------------------------------------------------------------------- */ |
| 2715 | void XGI_SetLCDAGroup( USHORT ModeNo , USHORT ModeIdIndex , PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo ) |
| 2716 | { |
| 2717 | USHORT RefreshRateTableIndex ; |
| 2718 | /* USHORT temp ; */ |
| 2719 | |
| 2720 | /* pVBInfo->SelectCRT2Rate = 0 ; */ |
| 2721 | |
| 2722 | pVBInfo->SetFlag |= ProgrammingCRT2 ; |
| 2723 | RefreshRateTableIndex = XGI_GetRatePtrCRT2( HwDeviceExtension, ModeNo , ModeIdIndex, pVBInfo ) ; |
| 2724 | XGI_GetLVDSResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 2725 | XGI_GetLVDSData( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo); |
| 2726 | XGI_ModCRT1Regs( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
| 2727 | XGI_SetLVDSRegs( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2728 | XGI_SetCRT2ECLK( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2729 | } |
| 2730 | |
| 2731 | |
| 2732 | /* --------------------------------------------------------------------- */ |
| 2733 | /* Function : XGI_GetLVDSResInfo */ |
| 2734 | /* Input : */ |
| 2735 | /* Output : */ |
| 2736 | /* Description : */ |
| 2737 | /* --------------------------------------------------------------------- */ |
| 2738 | void XGI_GetLVDSResInfo( USHORT ModeNo , USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo ) |
| 2739 | { |
| 2740 | USHORT resindex , xres , yres , modeflag ; |
| 2741 | |
| 2742 | if ( ModeNo <= 0x13 ) |
| 2743 | { |
| 2744 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */ |
| 2745 | } |
| 2746 | else |
| 2747 | { |
| 2748 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */ |
| 2749 | } |
| 2750 | |
| 2751 | |
| 2752 | /* if ( ModeNo > 0x13 ) */ |
| 2753 | /* modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; */ |
| 2754 | /* else */ |
| 2755 | /* modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; */ |
| 2756 | |
| 2757 | if ( ModeNo <= 0x13 ) |
| 2758 | { |
| 2759 | resindex = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */ |
| 2760 | } |
| 2761 | else |
| 2762 | { |
| 2763 | resindex = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */ |
| 2764 | } |
| 2765 | |
| 2766 | /* resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; */ |
| 2767 | |
| 2768 | if ( ModeNo <= 0x13 ) |
| 2769 | { |
| 2770 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 2771 | yres = pVBInfo->StResInfo[ resindex ].VTotal ; |
| 2772 | } |
| 2773 | else |
| 2774 | { |
| 2775 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; |
| 2776 | yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; |
| 2777 | } |
| 2778 | if ( ModeNo > 0x13 ) |
| 2779 | { |
| 2780 | if ( modeflag & HalfDCLK ) |
| 2781 | xres = xres << 1 ; |
| 2782 | |
| 2783 | if ( modeflag & DoubleScanMode ) |
| 2784 | yres = yres << 1 ; |
| 2785 | } |
| 2786 | /* if ( modeflag & Charx8Dot ) */ |
| 2787 | /* { */ |
| 2788 | |
| 2789 | if ( xres == 720 ) |
| 2790 | xres = 640 ; |
| 2791 | |
| 2792 | /* } */ |
| 2793 | pVBInfo->VGAHDE = xres ; |
| 2794 | pVBInfo->HDE = xres ; |
| 2795 | pVBInfo->VGAVDE = yres ; |
| 2796 | pVBInfo->VDE = yres ; |
| 2797 | } |
| 2798 | |
| 2799 | |
| 2800 | /* --------------------------------------------------------------------- */ |
| 2801 | /* Function : XGI_GetLVDSData */ |
| 2802 | /* Input : */ |
| 2803 | /* Output : */ |
| 2804 | /* Description : */ |
| 2805 | /* --------------------------------------------------------------------- */ |
| 2806 | void XGI_GetLVDSData( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 2807 | { |
| 2808 | USHORT tempbx ; |
| 2809 | XGI330_LVDSDataStruct *LCDPtr = NULL ; |
| 2810 | XGI330_CHTVDataStruct *TVPtr = NULL ; |
| 2811 | |
| 2812 | tempbx = 2 ; |
| 2813 | |
| 2814 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 2815 | { |
| 2816 | LCDPtr = ( XGI330_LVDSDataStruct * )XGI_GetLcdPtr( tempbx, ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo) ; |
| 2817 | pVBInfo->VGAHT = LCDPtr->VGAHT ; |
| 2818 | pVBInfo->VGAVT = LCDPtr->VGAVT ; |
| 2819 | pVBInfo->HT = LCDPtr->LCDHT ; |
| 2820 | pVBInfo->VT = LCDPtr->LCDVT ; |
| 2821 | } |
| 2822 | if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 2823 | { |
| 2824 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 2825 | { |
| 2826 | TVPtr = ( XGI330_CHTVDataStruct * )XGI_GetTVPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2827 | pVBInfo->VGAHT = TVPtr->VGAHT ; |
| 2828 | pVBInfo->VGAVT = TVPtr->VGAVT ; |
| 2829 | pVBInfo->HT = TVPtr->LCDHT ; |
| 2830 | pVBInfo->VT = TVPtr->LCDVT ; |
| 2831 | } |
| 2832 | } |
| 2833 | |
| 2834 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 2835 | { |
| 2836 | if ( !( pVBInfo->LCDInfo & ( SetLCDtoNonExpanding | EnableScalingLCD ) ) ) |
| 2837 | { |
| 2838 | if ( ( pVBInfo->LCDResInfo == Panel1024x768 ) || ( pVBInfo->LCDResInfo == Panel1024x768x75 ) ) |
| 2839 | { |
| 2840 | pVBInfo->HDE = 1024 ; |
| 2841 | pVBInfo->VDE = 768 ; |
| 2842 | } |
| 2843 | else if ( ( pVBInfo->LCDResInfo == Panel1280x1024 ) || ( pVBInfo->LCDResInfo == Panel1280x1024x75 ) ) |
| 2844 | { |
| 2845 | pVBInfo->HDE = 1280 ; |
| 2846 | pVBInfo->VDE = 1024 ; |
| 2847 | } |
| 2848 | else if ( pVBInfo->LCDResInfo == Panel1400x1050 ) |
| 2849 | { |
| 2850 | pVBInfo->HDE = 1400 ; |
| 2851 | pVBInfo->VDE = 1050 ; |
| 2852 | } |
| 2853 | else |
| 2854 | { |
| 2855 | pVBInfo->HDE = 1600 ; |
| 2856 | pVBInfo->VDE = 1200 ; |
| 2857 | } |
| 2858 | } |
| 2859 | } |
| 2860 | } |
| 2861 | |
| 2862 | |
| 2863 | /* --------------------------------------------------------------------- */ |
| 2864 | /* Function : XGI_ModCRT1Regs */ |
| 2865 | /* Input : */ |
| 2866 | /* Output : */ |
| 2867 | /* Description : */ |
| 2868 | /* --------------------------------------------------------------------- */ |
| 2869 | void XGI_ModCRT1Regs( USHORT ModeNo , USHORT ModeIdIndex , |
| 2870 | USHORT RefreshRateTableIndex , PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo ) |
| 2871 | { |
| 2872 | UCHAR index ; |
| 2873 | USHORT tempbx , i ; |
| 2874 | XGI_LVDSCRT1HDataStruct *LCDPtr = NULL ; |
| 2875 | XGI_LVDSCRT1VDataStruct *LCDPtr1 =NULL ; |
| 2876 | /* XGI330_CHTVDataStruct *TVPtr = NULL ; */ |
| 2877 | XGI_CH7007TV_TimingHStruct *CH7007TV_TimingHPtr = NULL; |
| 2878 | XGI_CH7007TV_TimingVStruct *CH7007TV_TimingVPtr = NULL; |
| 2879 | |
| 2880 | if( ModeNo <= 0x13 ) |
| 2881 | index = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; |
| 2882 | else |
| 2883 | index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; |
| 2884 | |
| 2885 | index= index & IndexMask ; |
| 2886 | |
| 2887 | if ( ( pVBInfo->IF_DEF_ScaleLCD == 0 ) || ( ( pVBInfo->IF_DEF_ScaleLCD == 1 ) && ( !( pVBInfo->LCDInfo & EnableScalingLCD ) ) ) ) |
| 2888 | { |
| 2889 | tempbx = 0 ; |
| 2890 | |
| 2891 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 2892 | { |
| 2893 | LCDPtr = ( XGI_LVDSCRT1HDataStruct * )XGI_GetLcdPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2894 | |
| 2895 | for( i = 0 ; i < 8 ; i++ ) |
| 2896 | pVBInfo->TimingH[ 0 ].data[ i ] = LCDPtr[ 0 ].Reg[ i ] ; |
| 2897 | } |
| 2898 | |
| 2899 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 2900 | { |
| 2901 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 2902 | { |
| 2903 | CH7007TV_TimingHPtr = ( XGI_CH7007TV_TimingHStruct *)XGI_GetTVPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2904 | |
| 2905 | for( i = 0 ; i < 8 ; i++ ) |
| 2906 | pVBInfo->TimingH[ 0 ].data[ i ] = CH7007TV_TimingHPtr[ 0 ].data[ i ] ; |
| 2907 | } |
| 2908 | } |
| 2909 | |
| 2910 | /* if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 2911 | { |
| 2912 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 2913 | TVPtr = ( XGI330_CHTVDataStruct *)XGI_GetTVPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2914 | } */ |
| 2915 | |
| 2916 | XGI_SetCRT1Timing_H(pVBInfo,HwDeviceExtension) ; |
| 2917 | |
| 2918 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 2919 | { |
| 2920 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , CH7007TV_TimingHPtr[ 0 ].data[ 8 ] ) ; |
| 2921 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , CH7007TV_TimingHPtr[ 0 ].data[ 9 ] ) ; |
| 2922 | } |
| 2923 | |
| 2924 | tempbx = 1 ; |
| 2925 | |
| 2926 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 2927 | { |
| 2928 | LCDPtr1 = ( XGI_LVDSCRT1VDataStruct * )XGI_GetLcdPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2929 | for( i = 0 ; i < 7 ; i++ ) |
| 2930 | pVBInfo->TimingV[ 0 ].data[ i ] = LCDPtr1[ 0 ].Reg[ i ] ; |
| 2931 | } |
| 2932 | |
| 2933 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 2934 | { |
| 2935 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 2936 | { |
| 2937 | CH7007TV_TimingVPtr = ( XGI_CH7007TV_TimingVStruct *)XGI_GetTVPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2938 | |
| 2939 | for( i = 0 ; i < 7 ; i++ ) |
| 2940 | pVBInfo->TimingV[ 0 ].data[ i ] = CH7007TV_TimingVPtr[ 0 ].data[ i ] ; |
| 2941 | } |
| 2942 | } |
| 2943 | /* if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 2944 | { |
| 2945 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 2946 | TVPtr = ( XGI330_CHTVDataStruct *)XGI_GetTVPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2947 | } */ |
| 2948 | |
| 2949 | XGI_SetCRT1Timing_V( ModeIdIndex , ModeNo , pVBInfo) ; |
| 2950 | |
| 2951 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 2952 | { |
| 2953 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x33 , ~0x01 , CH7007TV_TimingVPtr[ 0 ].data[ 7 ]&0x01 ) ; |
| 2954 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , CH7007TV_TimingVPtr[ 0 ].data[8 ] ) ; |
| 2955 | XGINew_SetReg1( pVBInfo->P3c4 , 0x3F , CH7007TV_TimingVPtr[ 0 ].data[9 ] ) ; |
| 2956 | |
| 2957 | } |
| 2958 | } |
| 2959 | } |
| 2960 | |
| 2961 | |
| 2962 | |
| 2963 | /* --------------------------------------------------------------------- */ |
| 2964 | /* Function : XGI_SetLVDSRegs */ |
| 2965 | /* Input : */ |
| 2966 | /* Output : */ |
| 2967 | /* Description : */ |
| 2968 | /* --------------------------------------------------------------------- */ |
| 2969 | void XGI_SetLVDSRegs( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 2970 | { |
| 2971 | USHORT tempbx , tempax , tempcx , tempdx , push1 , push2 , modeflag ; |
| 2972 | unsigned long temp , temp1 , temp2 , temp3 , push3 ; |
| 2973 | XGI330_LCDDataDesStruct *LCDPtr = NULL ; |
| 2974 | XGI330_LCDDataDesStruct2 *LCDPtr1 = NULL ; |
| 2975 | |
| 2976 | if ( ModeNo > 0x13 ) |
| 2977 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 2978 | else |
| 2979 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 2980 | |
| 2981 | if ( !( pVBInfo->SetFlag & Win9xDOSMode ) ) |
| 2982 | { |
| 2983 | if ( ( pVBInfo->IF_DEF_CH7017 == 0 ) || ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) |
| 2984 | { |
| 2985 | if ( pVBInfo->IF_DEF_OEMUtil == 1 ) |
| 2986 | { |
| 2987 | tempbx = 8 ; |
| 2988 | LCDPtr = ( XGI330_LCDDataDesStruct * )XGI_GetLcdPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2989 | } |
| 2990 | |
| 2991 | if ( ( pVBInfo->IF_DEF_OEMUtil == 0 ) || ( LCDPtr == 0 ) ) |
| 2992 | { |
| 2993 | tempbx = 3 ; |
| 2994 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 2995 | LCDPtr1 = ( XGI330_LCDDataDesStruct2 * )XGI_GetLcdPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2996 | else |
| 2997 | LCDPtr = ( XGI330_LCDDataDesStruct * )XGI_GetLcdPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2998 | } |
| 2999 | |
| 3000 | XGI_GetLCDSync( &tempax , &tempbx ,pVBInfo) ; |
| 3001 | push1 = tempbx ; |
| 3002 | push2 = tempax ; |
| 3003 | |
| 3004 | /* GetLCDResInfo */ |
| 3005 | if ( ( pVBInfo->LCDResInfo == Panel1024x768 ) || ( pVBInfo->LCDResInfo == Panel1024x768x75 ) ) |
| 3006 | { |
| 3007 | tempax = 1024 ; |
| 3008 | tempbx = 768 ; |
| 3009 | } |
| 3010 | else if ( ( pVBInfo->LCDResInfo == Panel1280x1024 ) || ( pVBInfo->LCDResInfo == Panel1280x1024x75 ) ) |
| 3011 | { |
| 3012 | tempax = 1280 ; |
| 3013 | tempbx = 1024 ; |
| 3014 | } |
| 3015 | else if ( pVBInfo->LCDResInfo == Panel1400x1050 ) |
| 3016 | { |
| 3017 | tempax = 1400 ; |
| 3018 | tempbx = 1050 ; |
| 3019 | } |
| 3020 | else |
| 3021 | { |
| 3022 | tempax = 1600 ; |
| 3023 | tempbx = 1200 ; |
| 3024 | } |
| 3025 | |
| 3026 | if ( pVBInfo->LCDInfo & SetLCDtoNonExpanding ) |
| 3027 | { |
| 3028 | pVBInfo->HDE=tempax; |
| 3029 | pVBInfo->VDE=tempbx; |
| 3030 | pVBInfo->VGAHDE=tempax; |
| 3031 | pVBInfo->VGAVDE=tempbx; |
| 3032 | } |
| 3033 | |
| 3034 | if ( ( pVBInfo->IF_DEF_ScaleLCD == 1 ) && ( pVBInfo->LCDInfo & EnableScalingLCD ) ) |
| 3035 | { |
| 3036 | tempax=pVBInfo->HDE; |
| 3037 | tempbx=pVBInfo->VDE; |
| 3038 | } |
| 3039 | |
| 3040 | tempax = pVBInfo->HT ; |
| 3041 | |
| 3042 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 3043 | tempbx = LCDPtr1->LCDHDES ; |
| 3044 | else |
| 3045 | tempbx = LCDPtr->LCDHDES ; |
| 3046 | |
| 3047 | tempcx = pVBInfo->HDE ; |
| 3048 | tempbx = tempbx & 0x0fff ; |
| 3049 | tempcx += tempbx ; |
| 3050 | |
| 3051 | if ( tempcx >= tempax ) |
| 3052 | tempcx -= tempax ; |
| 3053 | |
| 3054 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1A , tempbx & 0x07 ) ; |
| 3055 | |
| 3056 | tempcx = tempcx >> 3 ; |
| 3057 | tempbx = tempbx >> 3 ; |
| 3058 | |
| 3059 | XGINew_SetReg1( pVBInfo->Part1Port , 0x16 , ( USHORT )( tempbx & 0xff ) ) ; |
| 3060 | XGINew_SetReg1( pVBInfo->Part1Port , 0x17 , ( USHORT )( tempcx & 0xff ) ) ; |
| 3061 | |
| 3062 | tempax = pVBInfo->HT ; |
| 3063 | |
| 3064 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 3065 | tempbx = LCDPtr1->LCDHRS ; |
| 3066 | else |
| 3067 | tempbx = LCDPtr->LCDHRS ; |
| 3068 | |
| 3069 | tempcx = push2 ; |
| 3070 | |
| 3071 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 3072 | tempcx = LCDPtr1->LCDHSync ; |
| 3073 | |
| 3074 | tempcx += tempbx ; |
| 3075 | |
| 3076 | if ( tempcx >= tempax ) |
| 3077 | tempcx -= tempax ; |
| 3078 | |
| 3079 | tempax = tempbx & 0x07 ; |
| 3080 | tempax = tempax >> 5 ; |
| 3081 | tempcx = tempcx >> 3 ; |
| 3082 | tempbx = tempbx >> 3 ; |
| 3083 | |
| 3084 | tempcx &= 0x1f ; |
| 3085 | tempax |= tempcx ; |
| 3086 | |
| 3087 | XGINew_SetReg1( pVBInfo->Part1Port , 0x15 , tempax ) ; |
| 3088 | XGINew_SetReg1( pVBInfo->Part1Port , 0x14 , ( USHORT )( tempbx & 0xff ) ) ; |
| 3089 | |
| 3090 | tempax = pVBInfo->VT ; |
| 3091 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 3092 | tempbx = LCDPtr1->LCDVDES ; |
| 3093 | else |
| 3094 | tempbx = LCDPtr->LCDVDES ; |
| 3095 | tempcx = pVBInfo->VDE ; |
| 3096 | |
| 3097 | tempbx = tempbx & 0x0fff ; |
| 3098 | tempcx += tempbx ; |
| 3099 | if ( tempcx >= tempax ) |
| 3100 | tempcx -= tempax ; |
| 3101 | |
| 3102 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1b , ( USHORT )( tempbx & 0xff ) ) ; |
| 3103 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1c , ( USHORT )( tempcx & 0xff ) ) ; |
| 3104 | |
| 3105 | tempbx = ( tempbx >> 8 ) & 0x07 ; |
| 3106 | tempcx = ( tempcx >> 8 ) & 0x07 ; |
| 3107 | |
| 3108 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1d , ( USHORT )( ( tempcx << 3 ) | tempbx ) ) ; |
| 3109 | |
| 3110 | tempax = pVBInfo->VT ; |
| 3111 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 3112 | tempbx = LCDPtr1->LCDVRS ; |
| 3113 | else |
| 3114 | tempbx = LCDPtr->LCDVRS ; |
| 3115 | |
| 3116 | /* tempbx = tempbx >> 4 ; */ |
| 3117 | tempcx = push1 ; |
| 3118 | |
| 3119 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 3120 | tempcx = LCDPtr1->LCDVSync ; |
| 3121 | |
| 3122 | tempcx += tempbx ; |
| 3123 | if ( tempcx >= tempax ) |
| 3124 | tempcx -= tempax ; |
| 3125 | |
| 3126 | XGINew_SetReg1( pVBInfo->Part1Port , 0x18 , ( USHORT )( tempbx & 0xff ) ) ; |
| 3127 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x19 , ~0x0f , ( USHORT )( tempcx & 0x0f ) ) ; |
| 3128 | |
| 3129 | tempax = ( ( tempbx >> 8 ) & 0x07 ) << 3 ; |
| 3130 | |
| 3131 | tempbx = pVBInfo->VGAVDE ; |
| 3132 | if ( tempbx != pVBInfo->VDE ) |
| 3133 | tempax |= 0x40 ; |
| 3134 | |
| 3135 | if ( pVBInfo->LCDInfo & EnableLVDSDDA ) |
| 3136 | tempax |= 0x40 ; |
| 3137 | |
| 3138 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x1a , 0x07 , tempax ) ; |
| 3139 | |
| 3140 | tempcx = pVBInfo->VGAVT ; |
| 3141 | tempbx = pVBInfo->VDE ; |
| 3142 | tempax = pVBInfo->VGAVDE ; |
| 3143 | tempcx -= tempax ; |
| 3144 | |
| 3145 | temp = tempax ; /* 0430 ylshieh */ |
| 3146 | temp1 = ( temp << 18 ) / tempbx ; |
| 3147 | |
| 3148 | tempdx = ( USHORT )( ( temp << 18 ) % tempbx ) ; |
| 3149 | |
| 3150 | if ( tempdx != 0 ) |
| 3151 | temp1 += 1 ; |
| 3152 | |
| 3153 | temp2 = temp1 ; |
| 3154 | push3 = temp2 ; |
| 3155 | |
| 3156 | XGINew_SetReg1( pVBInfo->Part1Port , 0x37 , ( USHORT )( temp2 & 0xff ) ) ; |
| 3157 | XGINew_SetReg1( pVBInfo->Part1Port , 0x36 , ( USHORT )( ( temp2 >> 8 ) & 0xff ) ) ; |
| 3158 | |
| 3159 | tempbx = ( USHORT )( temp2 >> 16 ) ; |
| 3160 | tempax = tempbx & 0x03 ; |
| 3161 | |
| 3162 | tempbx = pVBInfo->VGAVDE ; |
| 3163 | if ( tempbx == pVBInfo->VDE ) |
| 3164 | tempax |= 0x04 ; |
| 3165 | |
| 3166 | XGINew_SetReg1( pVBInfo->Part1Port , 0x35 , tempax ) ; |
| 3167 | |
| 3168 | if ( pVBInfo->VBType & VB_XGI301C ) |
| 3169 | { |
| 3170 | temp2 = push3 ; |
| 3171 | XGINew_SetReg1( pVBInfo->Part4Port , 0x3c , ( USHORT )( temp2 & 0xff ) ) ; |
| 3172 | XGINew_SetReg1( pVBInfo->Part4Port , 0x3b , ( USHORT )( ( temp2 >> 8 ) & 0xff ) ) ; |
| 3173 | tempbx = ( USHORT )( temp2 >> 16 ) ; |
| 3174 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x3a , ~0xc0 , ( USHORT )( ( tempbx & 0xff ) << 6 ) ) ; |
| 3175 | |
| 3176 | tempcx = pVBInfo->VGAVDE ; |
| 3177 | if ( tempcx == pVBInfo->VDE ) |
| 3178 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x30 , ~0x0c , 0x00 ) ; |
| 3179 | else |
| 3180 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x30 , ~0x0c , 0x08 ) ; |
| 3181 | } |
| 3182 | |
| 3183 | tempcx = pVBInfo->VGAHDE ; |
| 3184 | tempbx = pVBInfo->HDE ; |
| 3185 | |
| 3186 | temp1 = tempcx << 16 ; |
| 3187 | |
| 3188 | tempax = ( USHORT )( temp1 / tempbx ) ; |
| 3189 | |
| 3190 | if ( ( tempbx & 0xffff ) == ( tempcx & 0xffff ) ) |
| 3191 | tempax = 65535 ; |
| 3192 | |
| 3193 | temp3 = tempax ; |
| 3194 | temp1 = pVBInfo->VGAHDE << 16 ; |
| 3195 | |
| 3196 | temp1 /= temp3 ; |
| 3197 | temp3 = temp3 << 16 ; |
| 3198 | temp1 -= 1 ; |
| 3199 | |
| 3200 | temp3 = ( temp3 & 0xffff0000 ) + ( temp1 & 0xffff ) ; |
| 3201 | |
| 3202 | tempax = ( USHORT )( temp3 & 0xff ) ; |
| 3203 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1f , tempax ) ; |
| 3204 | |
| 3205 | temp1 = pVBInfo->VGAVDE << 18 ; |
| 3206 | temp1 = temp1 / push3 ; |
| 3207 | tempbx = ( USHORT )( temp1 & 0xffff ) ; |
| 3208 | |
| 3209 | if ( pVBInfo->LCDResInfo == Panel1024x768 ) |
| 3210 | tempbx -= 1 ; |
| 3211 | |
| 3212 | tempax = ( ( tempbx >> 8 ) & 0xff ) << 3 ; |
| 3213 | tempax |= ( USHORT )( ( temp3 >> 8 ) & 0x07 ) ; |
| 3214 | XGINew_SetReg1( pVBInfo->Part1Port , 0x20 , ( USHORT )( tempax & 0xff ) ) ; |
| 3215 | XGINew_SetReg1( pVBInfo->Part1Port , 0x21 , ( USHORT )( tempbx & 0xff ) ) ; |
| 3216 | |
| 3217 | temp3 = temp3 >> 16 ; |
| 3218 | |
| 3219 | if ( modeflag & HalfDCLK ) |
| 3220 | temp3 = temp3 >> 1 ; |
| 3221 | |
| 3222 | XGINew_SetReg1(pVBInfo->Part1Port , 0x22 , ( USHORT )( ( temp3 >> 8 ) & 0xff ) ) ; |
| 3223 | XGINew_SetReg1(pVBInfo->Part1Port , 0x23 , ( USHORT )( temp3 & 0xff ) ) ; |
| 3224 | } |
| 3225 | } |
| 3226 | } |
| 3227 | |
| 3228 | |
| 3229 | /* --------------------------------------------------------------------- */ |
| 3230 | /* Function : XGI_SetCRT2ECLK */ |
| 3231 | /* Input : */ |
| 3232 | /* Output : */ |
| 3233 | /* Description : */ |
| 3234 | /* --------------------------------------------------------------------- */ |
| 3235 | void XGI_SetCRT2ECLK( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 3236 | { |
| 3237 | UCHAR di_0 , di_1 , tempal ; |
| 3238 | int i ; |
| 3239 | |
| 3240 | tempal = XGI_GetVCLKPtr( RefreshRateTableIndex , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 3241 | XGI_GetVCLKLen( tempal , &di_0 , &di_1, pVBInfo ) ; |
| 3242 | XGI_GetLCDVCLKPtr( &di_0 , &di_1, pVBInfo ) ; |
| 3243 | |
| 3244 | for( i = 0 ; i < 4 ; i++ ) |
| 3245 | { |
| 3246 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x31 , ~0x30 , ( USHORT )( 0x10 * i ) ) ; |
| 3247 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 3248 | { |
| 3249 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2b , di_0 ) ; |
| 3250 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2c , di_1 ) ; |
| 3251 | } |
| 3252 | else if ( ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) && ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) ) |
| 3253 | { |
| 3254 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2e , di_0 ) ; |
| 3255 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2f , di_1 ) ; |
| 3256 | } |
| 3257 | else |
| 3258 | { |
| 3259 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2b , di_0 ) ; |
| 3260 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2c , di_1 ) ; |
| 3261 | } |
| 3262 | } |
| 3263 | } |
| 3264 | |
| 3265 | |
| 3266 | /* --------------------------------------------------------------------- */ |
| 3267 | /* Function : XGI_UpdateModeInfo */ |
| 3268 | /* Input : */ |
| 3269 | /* Output : */ |
| 3270 | /* Description : */ |
| 3271 | /* --------------------------------------------------------------------- */ |
| 3272 | void XGI_UpdateModeInfo( PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo ) |
| 3273 | { |
| 3274 | USHORT tempcl , |
| 3275 | tempch , |
| 3276 | temp , |
| 3277 | tempbl , |
| 3278 | tempax ; |
| 3279 | |
| 3280 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 3281 | { |
| 3282 | tempcl = 0 ; |
| 3283 | tempch = 0 ; |
| 3284 | temp = XGINew_GetReg1( pVBInfo->P3c4 , 0x01 ) ; |
| 3285 | |
| 3286 | if ( !( temp & 0x20 ) ) |
| 3287 | { |
| 3288 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x17 ) ; |
| 3289 | if ( temp & 0x80 ) |
| 3290 | { |
| 3291 | if ( ( HwDeviceExtension->jChipType >= XG20 ) || ( HwDeviceExtension->jChipType >= XG40 ) ) |
| 3292 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x53 ) ; |
| 3293 | else |
| 3294 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x63 ) ; |
| 3295 | |
| 3296 | if ( !( temp & 0x40 ) ) |
| 3297 | tempcl |= ActiveCRT1 ; |
| 3298 | } |
| 3299 | } |
| 3300 | |
| 3301 | temp = XGINew_GetReg1( pVBInfo->Part1Port , 0x2e ) ; |
| 3302 | temp &= 0x0f ; |
| 3303 | |
| 3304 | if ( !( temp == 0x08 ) ) |
| 3305 | { |
| 3306 | tempax = XGINew_GetReg1( pVBInfo->Part1Port , 0x13 ) ; /* Check ChannelA by Part1_13 [2003/10/03] */ |
| 3307 | if ( tempax & 0x04 ) |
| 3308 | tempcl = tempcl | ActiveLCD ; |
| 3309 | |
| 3310 | temp &= 0x05 ; |
| 3311 | |
| 3312 | if ( !( tempcl & ActiveLCD ) ) |
| 3313 | if ( temp == 0x01 ) |
| 3314 | tempcl |= ActiveCRT2 ; |
| 3315 | |
| 3316 | if ( temp == 0x04 ) |
| 3317 | tempcl |= ActiveLCD ; |
| 3318 | |
| 3319 | if ( temp == 0x05 ) |
| 3320 | { |
| 3321 | temp = XGINew_GetReg1( pVBInfo->Part2Port , 0x00 ) ; |
| 3322 | |
| 3323 | if( !( temp & 0x08 ) ) |
| 3324 | tempch |= ActiveAVideo ; |
| 3325 | |
| 3326 | if ( !( temp & 0x04 ) ) |
| 3327 | tempch |= ActiveSVideo ; |
| 3328 | |
| 3329 | if ( temp & 0x02 ) |
| 3330 | tempch |= ActiveSCART ; |
| 3331 | |
| 3332 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 3333 | { |
| 3334 | if ( temp & 0x01 ) |
| 3335 | tempch |= ActiveHiTV ; |
| 3336 | } |
| 3337 | |
| 3338 | if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) |
| 3339 | { |
| 3340 | temp = XGINew_GetReg1( pVBInfo->Part2Port , 0x4d ) ; |
| 3341 | |
| 3342 | if ( temp & 0x10 ) |
| 3343 | tempch |= ActiveYPbPr ; |
| 3344 | } |
| 3345 | |
| 3346 | if ( tempch != 0 ) |
| 3347 | tempcl |= ActiveTV ; |
| 3348 | } |
| 3349 | } |
| 3350 | |
| 3351 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x3d ) ; |
| 3352 | if ( tempcl & ActiveLCD ) |
| 3353 | { |
| 3354 | if ( ( pVBInfo->SetFlag & ReserveTVOption ) ) |
| 3355 | { |
| 3356 | if ( temp & ActiveTV ) |
| 3357 | tempcl |= ActiveTV ; |
| 3358 | } |
| 3359 | } |
| 3360 | temp = tempcl ; |
| 3361 | tempbl = ~ModeSwitchStatus ; |
| 3362 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x3d , tempbl , temp ) ; |
| 3363 | |
| 3364 | if ( !( pVBInfo->SetFlag & ReserveTVOption ) ) |
| 3365 | XGINew_SetReg1( pVBInfo->P3d4 , 0x3e , tempch ) ; |
| 3366 | } |
| 3367 | else |
| 3368 | { |
| 3369 | return ; |
| 3370 | } |
| 3371 | } |
| 3372 | |
| 3373 | |
| 3374 | /* --------------------------------------------------------------------- */ |
| 3375 | /* Function : XGI_GetVGAType */ |
| 3376 | /* Input : */ |
| 3377 | /* Output : */ |
| 3378 | /* Description : */ |
| 3379 | /* --------------------------------------------------------------------- */ |
| 3380 | void XGI_GetVGAType( PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo) |
| 3381 | { |
| 3382 | /* |
| 3383 | if ( HwDeviceExtension->jChipType >= XG20 ) |
| 3384 | { |
| 3385 | pVBInfo->Set_VGAType = XG20; |
| 3386 | } |
| 3387 | else if ( HwDeviceExtension->jChipType >= XG40 ) |
| 3388 | { |
| 3389 | pVBInfo->Set_VGAType = VGA_XGI340 ; |
| 3390 | } |
| 3391 | */ |
| 3392 | pVBInfo->Set_VGAType = HwDeviceExtension->jChipType; |
| 3393 | } |
| 3394 | |
| 3395 | |
| 3396 | /* --------------------------------------------------------------------- */ |
| 3397 | /* Function : XGI_GetVBType */ |
| 3398 | /* Input : */ |
| 3399 | /* Output : */ |
| 3400 | /* Description : */ |
| 3401 | /* --------------------------------------------------------------------- */ |
| 3402 | void XGI_GetVBType(PVB_DEVICE_INFO pVBInfo) |
| 3403 | { |
| 3404 | USHORT flag , tempbx , tempah ; |
| 3405 | |
| 3406 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 3407 | { |
| 3408 | pVBInfo->VBType = VB_CH7007 ; |
| 3409 | return; |
| 3410 | } |
| 3411 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3412 | { |
| 3413 | tempbx = VB_XGI302B ; |
| 3414 | flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x00 ) ; |
| 3415 | if ( flag != 0x02 ) |
| 3416 | { |
| 3417 | tempbx = VB_XGI301 ; |
| 3418 | flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x01 ) ; |
| 3419 | if ( flag >= 0xB0 ) |
| 3420 | { |
| 3421 | tempbx = VB_XGI301B ; |
| 3422 | if ( flag >= 0xC0 ) |
| 3423 | { |
| 3424 | tempbx = VB_XGI301C ; |
| 3425 | if ( flag >= 0xD0 ) |
| 3426 | { |
| 3427 | tempbx = VB_XGI301LV ; |
| 3428 | if ( flag >= 0xE0 ) |
| 3429 | { |
| 3430 | tempbx = VB_XGI302LV ; |
| 3431 | tempah = XGINew_GetReg1( pVBInfo->Part4Port , 0x39 ) ; |
| 3432 | if ( tempah != 0xFF ) |
| 3433 | tempbx = VB_XGI301C ; |
| 3434 | } |
| 3435 | } |
| 3436 | } |
| 3437 | |
| 3438 | if ( tempbx & ( VB_XGI301B | VB_XGI302B ) ) |
| 3439 | { |
| 3440 | flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x23 ) ; |
| 3441 | |
| 3442 | if ( !( flag & 0x02 ) ) |
| 3443 | tempbx = tempbx | VB_NoLCD ; |
| 3444 | } |
| 3445 | } |
| 3446 | } |
| 3447 | pVBInfo->VBType = tempbx ; |
| 3448 | } |
| 3449 | /* |
| 3450 | else if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 3451 | pVBInfo->VBType = VB_CH7017 ; |
| 3452 | else //LVDS |
| 3453 | pVBInfo->VBType = VB_LVDS_NS ; |
| 3454 | */ |
| 3455 | |
| 3456 | } |
| 3457 | |
| 3458 | |
| 3459 | /* --------------------------------------------------------------------- */ |
| 3460 | /* Function : XGI_GetVBInfo */ |
| 3461 | /* Input : */ |
| 3462 | /* Output : */ |
| 3463 | /* Description : */ |
| 3464 | /* --------------------------------------------------------------------- */ |
| 3465 | void XGI_GetVBInfo( USHORT ModeNo , USHORT ModeIdIndex , PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo ) |
| 3466 | { |
| 3467 | USHORT tempax , |
| 3468 | push , |
| 3469 | tempbx , |
| 3470 | temp , |
| 3471 | modeflag ; |
| 3472 | |
| 3473 | if ( ModeNo <= 0x13 ) |
| 3474 | { |
| 3475 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 3476 | } |
| 3477 | else |
| 3478 | { |
| 3479 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 3480 | } |
| 3481 | |
| 3482 | pVBInfo->SetFlag = 0 ; |
| 3483 | pVBInfo->ModeType = modeflag & ModeInfoFlag ; |
| 3484 | tempbx = 0 ; |
| 3485 | |
| 3486 | if ( pVBInfo->VBType & 0xFFFF ) |
| 3487 | { |
| 3488 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x30 ) ; /* Check Display Device */ |
| 3489 | tempbx = tempbx | temp ; |
| 3490 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x31 ) ; |
| 3491 | push = temp ; |
| 3492 | push = push << 8 ; |
| 3493 | tempax = temp << 8 ; |
| 3494 | tempbx = tempbx | tempax ; |
| 3495 | temp = ( SetCRT2ToDualEdge | SetCRT2ToYPbPr | SetCRT2ToLCDA | SetInSlaveMode | DisableCRT2Display ) ; |
| 3496 | temp = 0xFFFF ^ temp ; |
| 3497 | tempbx &= temp ; |
| 3498 | |
| 3499 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) ; |
| 3500 | |
| 3501 | if ( pVBInfo->IF_DEF_LCDA == 1 ) |
| 3502 | { |
| 3503 | |
| 3504 | if ( ( pVBInfo->Set_VGAType >= XG20 ) || ( pVBInfo->Set_VGAType >= XG40 )) |
| 3505 | { |
| 3506 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3507 | { |
| 3508 | /* if ( ( pVBInfo->VBType & VB_XGI302B ) || ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) ) */ |
| 3509 | if ( pVBInfo->VBType & ( VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 3510 | { |
| 3511 | if ( temp & EnableDualEdge ) |
| 3512 | { |
| 3513 | tempbx |= SetCRT2ToDualEdge ; |
| 3514 | |
| 3515 | if ( temp & SetToLCDA ) |
| 3516 | tempbx |= SetCRT2ToLCDA ; |
| 3517 | } |
| 3518 | } |
| 3519 | } |
| 3520 | else if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 3521 | { |
| 3522 | if ( pVBInfo->VBType & VB_CH7017 ) |
| 3523 | { |
| 3524 | if ( temp & EnableDualEdge ) |
| 3525 | { |
| 3526 | tempbx |= SetCRT2ToDualEdge ; |
| 3527 | |
| 3528 | if ( temp & SetToLCDA ) |
| 3529 | tempbx |= SetCRT2ToLCDA ; |
| 3530 | } |
| 3531 | } |
| 3532 | } |
| 3533 | } |
| 3534 | } |
| 3535 | |
| 3536 | if ( pVBInfo->IF_DEF_YPbPr == 1 ) |
| 3537 | { |
| 3538 | if ( ( ( pVBInfo->IF_DEF_LVDS == 0 ) && ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) ) ) |
| 3539 | || ( ( pVBInfo->IF_DEF_CH7017 == 1 ) && ( pVBInfo->VBType&VB_CH7017 ) ) || ( (pVBInfo->IF_DEF_CH7007 == 1) && (pVBInfo->VBType&VB_CH7007) ) ) /* [Billy] 07/05/04 */ |
| 3540 | { |
| 3541 | if ( temp & SetYPbPr ) /* temp = CR38 */ |
| 3542 | { |
| 3543 | if ( pVBInfo->IF_DEF_HiVision == 1 ) |
| 3544 | { |
| 3545 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; /* shampoo add for new scratch */ |
| 3546 | temp &= YPbPrMode ; |
| 3547 | tempbx |= SetCRT2ToHiVisionTV ; |
| 3548 | |
| 3549 | if ( temp != YPbPrMode1080i ) { |
| 3550 | tempbx &= ( ~SetCRT2ToHiVisionTV ) ; |
| 3551 | tempbx |= SetCRT2ToYPbPr ; } |
| 3552 | } |
| 3553 | |
| 3554 | /* tempbx |= SetCRT2ToYPbPr ; */ |
| 3555 | } |
| 3556 | } |
| 3557 | } |
| 3558 | |
| 3559 | tempax = push ; /* restore CR31 */ |
| 3560 | |
| 3561 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3562 | { |
| 3563 | if ( pVBInfo->IF_DEF_YPbPr == 1 ) |
| 3564 | { |
| 3565 | if ( pVBInfo->IF_DEF_HiVision == 1 ) |
| 3566 | temp = 0x09FC ; |
| 3567 | else |
| 3568 | temp = 0x097C ; |
| 3569 | } |
| 3570 | else |
| 3571 | { |
| 3572 | if ( pVBInfo->IF_DEF_HiVision == 1 ) |
| 3573 | temp = 0x01FC ; |
| 3574 | else |
| 3575 | temp = 0x017C ; |
| 3576 | } |
| 3577 | } |
| 3578 | else /* 3nd party chip */ |
| 3579 | { |
| 3580 | if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 3581 | temp = ( SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA ) ; |
| 3582 | else if ( pVBInfo->IF_DEF_CH7007 == 1 ) /* [Billy] 07/05/03 */ |
| 3583 | { |
| 3584 | temp = SetCRT2ToTV ; |
| 3585 | } |
| 3586 | else |
| 3587 | temp = SetCRT2ToLCD ; |
| 3588 | } |
| 3589 | |
| 3590 | if ( !( tempbx & temp ) ) |
| 3591 | { |
| 3592 | tempax |= DisableCRT2Display ; |
| 3593 | tempbx = 0 ; |
| 3594 | } |
| 3595 | |
| 3596 | if ( pVBInfo->IF_DEF_LCDA == 1 ) /* Select Display Device */ |
| 3597 | { |
| 3598 | if ( !( pVBInfo->VBType & VB_NoLCD ) ) |
| 3599 | { |
| 3600 | if ( tempbx & SetCRT2ToLCDA ) |
| 3601 | { |
| 3602 | if ( tempbx & SetSimuScanMode ) |
| 3603 | tempbx &= ( ~( SetCRT2ToLCD | SetCRT2ToRAMDAC | SwitchToCRT2 ) ) ; |
| 3604 | else |
| 3605 | tempbx &= ( ~( SetCRT2ToLCD | SetCRT2ToRAMDAC | SetCRT2ToTV | SwitchToCRT2 ) ) ; |
| 3606 | } |
| 3607 | } |
| 3608 | } |
| 3609 | |
| 3610 | /* shampoo add */ |
| 3611 | if ( !( tempbx & ( SwitchToCRT2 | SetSimuScanMode ) ) ) /* for driver abnormal */ |
| 3612 | { |
| 3613 | if ( pVBInfo->IF_DEF_CRT2Monitor == 1 ) |
| 3614 | { |
| 3615 | if ( tempbx & SetCRT2ToRAMDAC ) |
| 3616 | { |
| 3617 | tempbx &= ( 0xFF00 | SetCRT2ToRAMDAC | SwitchToCRT2 | SetSimuScanMode ) ; |
| 3618 | tempbx &= ( 0x00FF | ( ~SetCRT2ToYPbPr ) ) ; |
| 3619 | } |
| 3620 | } |
| 3621 | else |
| 3622 | tempbx &= ( ~( SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV ) ) ; |
| 3623 | } |
| 3624 | |
| 3625 | if ( !( pVBInfo->VBType & VB_NoLCD ) ) |
| 3626 | { |
| 3627 | if ( tempbx & SetCRT2ToLCD ) |
| 3628 | { |
| 3629 | tempbx &= ( 0xFF00 | SetCRT2ToLCD | SwitchToCRT2 | SetSimuScanMode ) ; |
| 3630 | tempbx &= ( 0x00FF | ( ~SetCRT2ToYPbPr ) ) ; |
| 3631 | } |
| 3632 | } |
| 3633 | |
| 3634 | if ( tempbx & SetCRT2ToSCART ) |
| 3635 | { |
| 3636 | tempbx &= ( 0xFF00 | SetCRT2ToSCART | SwitchToCRT2 | SetSimuScanMode ) ; |
| 3637 | tempbx &= ( 0x00FF | ( ~SetCRT2ToYPbPr ) ) ; |
| 3638 | } |
| 3639 | |
| 3640 | if ( pVBInfo->IF_DEF_YPbPr == 1 ) |
| 3641 | { |
| 3642 | if ( tempbx & SetCRT2ToYPbPr ) |
| 3643 | tempbx &= ( 0xFF00 | SwitchToCRT2 | SetSimuScanMode ) ; |
| 3644 | } |
| 3645 | |
| 3646 | if ( pVBInfo->IF_DEF_HiVision == 1 ) |
| 3647 | { |
| 3648 | if ( tempbx & SetCRT2ToHiVisionTV ) |
| 3649 | tempbx &= ( 0xFF00 | SetCRT2ToHiVisionTV | SwitchToCRT2 | SetSimuScanMode ) ; |
| 3650 | } |
| 3651 | |
| 3652 | if ( tempax & DisableCRT2Display ) /* Set Display Device Info */ |
| 3653 | { |
| 3654 | if ( !( tempbx & ( SwitchToCRT2 | SetSimuScanMode ) ) ) |
| 3655 | tempbx = DisableCRT2Display ; |
| 3656 | } |
| 3657 | |
| 3658 | if ( !( tempbx & DisableCRT2Display ) ) |
| 3659 | { |
| 3660 | if ( ( !( tempbx & DriverMode ) ) || ( !( modeflag & CRT2Mode ) ) ) |
| 3661 | { |
| 3662 | if ( pVBInfo->IF_DEF_LCDA == 1 ) |
| 3663 | { |
| 3664 | if ( !( tempbx & SetCRT2ToLCDA ) ) |
| 3665 | tempbx |= ( SetInSlaveMode | SetSimuScanMode ) ; |
| 3666 | } |
| 3667 | |
| 3668 | if ( pVBInfo->IF_DEF_VideoCapture == 1 ) |
| 3669 | { |
| 3670 | if ( ( ( HwDeviceExtension->jChipType == XG40 ) && ( pVBInfo->Set_VGAType == XG40 ) ) |
| 3671 | || ( ( HwDeviceExtension->jChipType == XG41 ) && ( pVBInfo->Set_VGAType == XG41 ) ) |
| 3672 | || ( ( HwDeviceExtension->jChipType == XG42 ) && ( pVBInfo->Set_VGAType == XG42 ) ) |
| 3673 | || ( ( HwDeviceExtension->jChipType == XG45 ) && ( pVBInfo->Set_VGAType == XG45 ) ) ) |
| 3674 | { |
| 3675 | if ( ModeNo <= 13 ) |
| 3676 | { |
| 3677 | if ( !( tempbx & SetCRT2ToRAMDAC ) ) /*CRT2 not need to support*/ |
| 3678 | { |
| 3679 | tempbx &= ( 0x00FF | ( ~SetInSlaveMode ) ) ; |
| 3680 | pVBInfo->SetFlag |= EnableVCMode ; |
| 3681 | } |
| 3682 | } |
| 3683 | } |
| 3684 | } |
| 3685 | } |
| 3686 | |
| 3687 | /*LCD+TV can't support in slave mode (Force LCDA+TV->LCDB)*/ |
| 3688 | if ( ( tempbx & SetInSlaveMode ) && ( tempbx & SetCRT2ToLCDA ) ) |
| 3689 | { |
| 3690 | tempbx ^= ( SetCRT2ToLCD | SetCRT2ToLCDA | SetCRT2ToDualEdge ) ; |
| 3691 | pVBInfo->SetFlag |= ReserveTVOption ; |
| 3692 | } |
| 3693 | } |
| 3694 | } |
| 3695 | |
| 3696 | pVBInfo->VBInfo = tempbx ; |
| 3697 | } |
| 3698 | |
| 3699 | |
| 3700 | /* --------------------------------------------------------------------- */ |
| 3701 | /* Function : XGI_GetTVInfo */ |
| 3702 | /* Input : */ |
| 3703 | /* Output : */ |
| 3704 | /* Description : */ |
| 3705 | /* --------------------------------------------------------------------- */ |
| 3706 | void XGI_GetTVInfo( USHORT ModeNo , USHORT ModeIdIndex ,PVB_DEVICE_INFO pVBInfo ) |
| 3707 | { |
| 3708 | USHORT temp , |
| 3709 | tempbx = 0 , |
| 3710 | resinfo = 0 , |
| 3711 | modeflag , |
| 3712 | index1 ; |
| 3713 | |
| 3714 | tempbx = 0 ; |
| 3715 | resinfo = 0 ; |
| 3716 | |
| 3717 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 3718 | { |
| 3719 | if ( ModeNo <= 0x13 ) |
| 3720 | { |
| 3721 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag */ |
| 3722 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */ |
| 3723 | } |
| 3724 | else |
| 3725 | { |
| 3726 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 3727 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */ |
| 3728 | } |
| 3729 | |
| 3730 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 3731 | { |
| 3732 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; |
| 3733 | tempbx = temp; |
| 3734 | if ( tempbx & SetPALTV ) |
| 3735 | { |
| 3736 | tempbx &= ( SetCHTVOverScan | SetPALMTV | SetPALNTV | SetPALTV ) ; |
| 3737 | if ( tempbx & SetPALMTV ) |
| 3738 | tempbx &= ~SetPALTV ; /* set to NTSC if PAL-M */ |
| 3739 | } |
| 3740 | else |
| 3741 | tempbx &= ( SetCHTVOverScan | SetNTSCJ | SetPALTV ) ; |
| 3742 | /* |
| 3743 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3744 | { |
| 3745 | index1 = XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) ; //PAL-M/PAL-N Info |
| 3746 | temp2 = ( index1 & 0xC0 ) >> 5 ; //00:PAL, 01:PAL-M, 10:PAL-N |
| 3747 | tempbx |= temp2 ; |
| 3748 | if ( temp2 & 0x02 ) //PAL-M |
| 3749 | tempbx &= ( ~SetPALTV ) ; |
| 3750 | } |
| 3751 | */ |
| 3752 | } |
| 3753 | |
| 3754 | if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 3755 | { |
| 3756 | tempbx = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; |
| 3757 | |
| 3758 | if ( tempbx & TVOverScan ) |
| 3759 | tempbx |= SetCHTVOverScan ; |
| 3760 | } |
| 3761 | |
| 3762 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) /* [Billy] 07/05/04 */ |
| 3763 | { |
| 3764 | tempbx = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; |
| 3765 | |
| 3766 | if ( tempbx & TVOverScan ) |
| 3767 | { |
| 3768 | tempbx |= SetCHTVOverScan ; |
| 3769 | } |
| 3770 | } |
| 3771 | |
| 3772 | |
| 3773 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3774 | { |
| 3775 | if ( pVBInfo->VBInfo & SetCRT2ToSCART ) |
| 3776 | tempbx |= SetPALTV ; |
| 3777 | } |
| 3778 | |
| 3779 | if ( pVBInfo->IF_DEF_YPbPr == 1 ) |
| 3780 | { |
| 3781 | if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) |
| 3782 | { |
| 3783 | index1 = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; |
| 3784 | index1 &= YPbPrMode ; |
| 3785 | |
| 3786 | if ( index1 == YPbPrMode525i ) |
| 3787 | tempbx |= SetYPbPrMode525i ; |
| 3788 | |
| 3789 | if ( index1 == YPbPrMode525p ) |
| 3790 | tempbx = tempbx | SetYPbPrMode525p; |
| 3791 | if ( index1 == YPbPrMode750p) |
| 3792 | tempbx = tempbx | SetYPbPrMode750p; |
| 3793 | } |
| 3794 | } |
| 3795 | |
| 3796 | if ( pVBInfo->IF_DEF_HiVision == 1 ) |
| 3797 | { |
| 3798 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 3799 | { |
| 3800 | tempbx = tempbx | SetYPbPrMode1080i | SetPALTV ; |
| 3801 | } |
| 3802 | } |
| 3803 | |
| 3804 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3805 | { /* shampoo */ |
| 3806 | if ( ( pVBInfo->VBInfo & SetInSlaveMode ) && ( !( pVBInfo->VBInfo & SetNotSimuMode ) ) ) |
| 3807 | tempbx |= TVSimuMode ; |
| 3808 | |
| 3809 | if ( !( tempbx & SetPALTV ) && ( modeflag > 13 ) && ( resinfo == 8 ) ) /* NTSC 1024x768, */ |
| 3810 | tempbx |= NTSC1024x768 ; |
| 3811 | |
| 3812 | tempbx |= RPLLDIV2XO ; |
| 3813 | |
| 3814 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 3815 | { |
| 3816 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 3817 | tempbx &=( ~RPLLDIV2XO ) ; |
| 3818 | } |
| 3819 | else |
| 3820 | { |
| 3821 | if ( tempbx & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) |
| 3822 | tempbx &= ( ~RPLLDIV2XO ) ; |
| 3823 | else if ( !( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) ) |
| 3824 | { |
| 3825 | if ( tempbx & TVSimuMode ) |
| 3826 | tempbx &= ( ~RPLLDIV2XO ) ; |
| 3827 | } |
| 3828 | } |
| 3829 | } |
| 3830 | } |
| 3831 | pVBInfo->TVInfo = tempbx ; |
| 3832 | } |
| 3833 | |
| 3834 | |
| 3835 | /* --------------------------------------------------------------------- */ |
| 3836 | /* Function : XGI_GetLCDInfo */ |
| 3837 | /* Input : */ |
| 3838 | /* Output : */ |
| 3839 | /* Description : */ |
| 3840 | /* --------------------------------------------------------------------- */ |
| 3841 | BOOLEAN XGI_GetLCDInfo( USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo) |
| 3842 | { |
| 3843 | USHORT temp , |
| 3844 | tempax , |
| 3845 | tempbx , |
| 3846 | modeflag , |
| 3847 | resinfo = 0 , |
| 3848 | LCDIdIndex ; |
| 3849 | |
| 3850 | pVBInfo->LCDResInfo = 0 ; |
| 3851 | pVBInfo->LCDTypeInfo = 0 ; |
| 3852 | pVBInfo->LCDInfo = 0 ; |
| 3853 | |
| 3854 | if ( ModeNo <= 0x13 ) |
| 3855 | { |
| 3856 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag // */ |
| 3857 | } |
| 3858 | else |
| 3859 | { |
| 3860 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 3861 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo// */ |
| 3862 | } |
| 3863 | |
| 3864 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x36 ) ; /* Get LCD Res.Info */ |
| 3865 | tempbx = temp & 0x0F ; |
| 3866 | |
| 3867 | if ( tempbx == 0 ) |
| 3868 | tempbx = Panel1024x768 ; /* default */ |
| 3869 | |
| 3870 | /* LCD75 [2003/8/22] Vicent */ |
| 3871 | if ( ( tempbx == Panel1024x768 ) || ( tempbx == Panel1280x1024 ) ) |
| 3872 | { |
| 3873 | if ( pVBInfo->VBInfo & DriverMode ) |
| 3874 | { |
| 3875 | tempax = XGINew_GetReg1( pVBInfo->P3d4 , 0x33 ) ; |
| 3876 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 3877 | tempax &= 0x0F ; |
| 3878 | else |
| 3879 | tempax = tempax >> 4 ; |
| 3880 | |
| 3881 | if ( ( resinfo == 6 ) || ( resinfo == 9 ) ) |
| 3882 | { |
| 3883 | if ( tempax >= 3 ) |
| 3884 | tempbx |= PanelRef75Hz ; |
| 3885 | } |
| 3886 | else if ( ( resinfo == 7 ) || ( resinfo == 8 ) ) |
| 3887 | { |
| 3888 | if ( tempax >= 4 ) |
| 3889 | tempbx |= PanelRef75Hz ; |
| 3890 | } |
| 3891 | } |
| 3892 | } |
| 3893 | |
| 3894 | pVBInfo->LCDResInfo = tempbx ; |
| 3895 | |
| 3896 | /* End of LCD75 */ |
| 3897 | |
| 3898 | if( pVBInfo->IF_DEF_OEMUtil == 1 ) |
| 3899 | { |
| 3900 | pVBInfo->LCDTypeInfo = ( temp & 0xf0 ) >> 4 ; |
| 3901 | } |
| 3902 | |
| 3903 | if ( !( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) |
| 3904 | { |
| 3905 | return 0; |
| 3906 | } |
| 3907 | |
| 3908 | tempbx = 0 ; |
| 3909 | |
| 3910 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; |
| 3911 | |
| 3912 | temp &= ( ScalingLCD | LCDNonExpanding | LCDSyncBit | SetPWDEnable ) ; |
| 3913 | |
| 3914 | if ( ( pVBInfo->IF_DEF_ScaleLCD == 1 ) && ( temp & LCDNonExpanding ) ) |
| 3915 | temp &= ~EnableScalingLCD ; |
| 3916 | |
| 3917 | tempbx |= temp ; |
| 3918 | |
| 3919 | LCDIdIndex = XGI_GetLCDCapPtr1(pVBInfo) ; |
| 3920 | |
| 3921 | tempax = pVBInfo->LCDCapList[ LCDIdIndex ].LCD_Capability ; |
| 3922 | |
| 3923 | if ( pVBInfo->IF_DEF_LVDS == 0 ) /* shampoo */ |
| 3924 | { |
| 3925 | if ( ( ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) ) && ( tempax & LCDDualLink ) ) |
| 3926 | { |
| 3927 | tempbx |= SetLCDDualLink ; |
| 3928 | } |
| 3929 | } |
| 3930 | |
| 3931 | if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 3932 | { |
| 3933 | if ( tempax & LCDDualLink ) |
| 3934 | { |
| 3935 | tempbx |= SetLCDDualLink ; |
| 3936 | } |
| 3937 | } |
| 3938 | |
| 3939 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3940 | { |
| 3941 | if ( ( pVBInfo->LCDResInfo == Panel1400x1050 ) && ( pVBInfo->VBInfo & SetCRT2ToLCD ) && ( ModeNo > 0x13 ) && ( resinfo == 9 ) && ( !( tempbx & EnableScalingLCD ) ) ) |
| 3942 | tempbx |= SetLCDtoNonExpanding ; /* set to center in 1280x1024 LCDB for Panel1400x1050 */ |
| 3943 | } |
| 3944 | |
| 3945 | /* |
| 3946 | if ( tempax & LCDBToA ) |
| 3947 | { |
| 3948 | tempbx |= SetLCDBToA ; |
| 3949 | } |
| 3950 | */ |
| 3951 | |
| 3952 | if ( pVBInfo->IF_DEF_ExpLink == 1 ) |
| 3953 | { |
| 3954 | if ( modeflag & HalfDCLK ) |
| 3955 | { |
| 3956 | /* if ( !( pVBInfo->LCDInfo&LCDNonExpanding ) ) */ |
| 3957 | if ( !( tempbx & SetLCDtoNonExpanding ) ) |
| 3958 | { |
| 3959 | tempbx |= EnableLVDSDDA ; |
| 3960 | } |
| 3961 | else |
| 3962 | { |
| 3963 | if ( ModeNo > 0x13 ) |
| 3964 | { |
| 3965 | if ( pVBInfo->LCDResInfo == Panel1024x768 ) |
| 3966 | { |
| 3967 | if ( resinfo == 4 ) |
| 3968 | { /* 512x384 */ |
| 3969 | tempbx |= EnableLVDSDDA ; |
| 3970 | } |
| 3971 | } |
| 3972 | } |
| 3973 | } |
| 3974 | } |
| 3975 | } |
| 3976 | |
| 3977 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 3978 | { |
| 3979 | if ( pVBInfo->VBInfo & SetNotSimuMode ) |
| 3980 | { |
| 3981 | tempbx |= LCDVESATiming ; |
| 3982 | } |
| 3983 | } |
| 3984 | else |
| 3985 | { |
| 3986 | tempbx |= LCDVESATiming ; |
| 3987 | } |
| 3988 | |
| 3989 | pVBInfo->LCDInfo = tempbx ; |
| 3990 | |
| 3991 | if ( pVBInfo->IF_DEF_PWD == 1 ) |
| 3992 | { |
| 3993 | if ( pVBInfo->LCDInfo & SetPWDEnable ) |
| 3994 | { |
| 3995 | if ( ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) ) |
| 3996 | { |
| 3997 | if ( !( tempax & PWDEnable ) ) |
| 3998 | { |
| 3999 | pVBInfo->LCDInfo &= ~SetPWDEnable ; |
| 4000 | } |
| 4001 | } |
| 4002 | } |
| 4003 | } |
| 4004 | |
| 4005 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 4006 | { |
| 4007 | if ( tempax & ( LockLCDBToA | StLCDBToA ) ) |
| 4008 | { |
| 4009 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 4010 | { |
| 4011 | if ( !( tempax & LockLCDBToA ) ) |
| 4012 | { |
| 4013 | if ( ModeNo <= 0x13 ) |
| 4014 | { |
| 4015 | pVBInfo->VBInfo &= ~( SetSimuScanMode | SetInSlaveMode | SetCRT2ToLCD ) ; |
| 4016 | pVBInfo->VBInfo |= SetCRT2ToLCDA | SetCRT2ToDualEdge ; |
| 4017 | } |
| 4018 | } |
| 4019 | } |
| 4020 | } |
| 4021 | } |
| 4022 | |
| 4023 | /* |
| 4024 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 4025 | { |
| 4026 | if ( tempax & ( LockLCDBToA | StLCDBToA ) ) |
| 4027 | { |
| 4028 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 4029 | { |
| 4030 | if ( !( ( !( tempax & LockLCDBToA ) ) && ( ModeNo > 0x13 ) ) ) |
| 4031 | { |
| 4032 | pVBInfo->VBInfo&=~(SetSimuScanMode|SetInSlaveMode|SetCRT2ToLCD); |
| 4033 | pVBInfo->VBInfo|=SetCRT2ToLCDA|SetCRT2ToDualEdge; |
| 4034 | } |
| 4035 | } |
| 4036 | } |
| 4037 | } |
| 4038 | */ |
| 4039 | |
| 4040 | return( 1 ) ; |
| 4041 | } |
| 4042 | |
| 4043 | |
| 4044 | /* --------------------------------------------------------------------- */ |
| 4045 | /* Function : XGI_SearchModeID */ |
| 4046 | /* Input : */ |
| 4047 | /* Output : */ |
| 4048 | /* Description : */ |
| 4049 | /* --------------------------------------------------------------------- */ |
| 4050 | BOOLEAN XGI_SearchModeID( USHORT ModeNo , USHORT *ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 4051 | { |
| 4052 | |
| 4053 | #ifdef TC |
| 4054 | |
| 4055 | if ( ModeNo <= 5 ) |
| 4056 | ModeNo |= 1 ; |
| 4057 | |
| 4058 | if ( ModeNo <= 0x13 ) |
| 4059 | { |
| 4060 | /* for (*ModeIdIndex=0;*ModeIdIndex<sizeof(pVBInfo->SModeIDTable)/sizeof(XGI_StStruct);(*ModeIdIndex)++) */ |
| 4061 | for( *ModeIdIndex = 0 ; ; ( *ModeIdIndex )++ ) |
| 4062 | { |
| 4063 | if ( pVBInfo->SModeIDTable[ *ModeIdIndex ].St_ModeID == ModeNo ) |
| 4064 | break ; |
| 4065 | if ( pVBInfo->SModeIDTable[ *ModeIdIndex ].St_ModeID == 0xFF ) |
| 4066 | return( FALSE ) ; |
| 4067 | } |
| 4068 | |
| 4069 | VGA_INFO = ( PUCHAR )MK_FP( 0 , 0x489 ) ; |
| 4070 | |
| 4071 | if ( ModeNo == 0x07 ) |
| 4072 | { |
| 4073 | if ( ( *VGA_INFO & 0x10 ) != 0 ) |
| 4074 | ( *ModeIdIndex )++ ; /* 400 lines */ |
| 4075 | /* else 350 lines */ |
| 4076 | } |
| 4077 | |
| 4078 | if ( ModeNo <= 3 ) |
| 4079 | { |
| 4080 | if ( ( *VGA_INFO & 0x80 ) == 0 ) |
| 4081 | { |
| 4082 | ( *ModeIdIndex )++ ; |
| 4083 | if ( ( *VGA_INFO & 0x10 ) != 0 ) |
| 4084 | ( *ModeIdIndex )++ ; /* 400 lines */ |
| 4085 | /* else 350 lines */ |
| 4086 | } |
| 4087 | /* else 200 lines */ |
| 4088 | } |
| 4089 | } |
| 4090 | else |
| 4091 | { |
| 4092 | /* for (*ModeIdIndex=0;*ModeIdIndex<sizeof(pVBInfo->EModeIDTable)/sizeof(XGI_ExtStruct);(*ModeIdIndex)++) */ |
| 4093 | for( *ModeIdIndex = 0 ; ; ( *ModeIdIndex )++ ) |
| 4094 | { |
| 4095 | if ( pVBInfo->EModeIDTable[ *ModeIdIndex ].Ext_ModeID == ModeNo ) |
| 4096 | break ; |
| 4097 | if ( pVBInfo->EModeIDTable[ *ModeIdIndex ].Ext_ModeID == 0xFF ) |
| 4098 | return( FALSE ) ; |
| 4099 | } |
| 4100 | } |
| 4101 | |
| 4102 | |
| 4103 | #endif |
| 4104 | |
| 4105 | #ifdef WIN2000 |
| 4106 | |
| 4107 | if ( ModeNo <= 5 ) |
| 4108 | ModeNo |= 1 ; |
| 4109 | if ( ModeNo <= 0x13 ) |
| 4110 | { |
| 4111 | /* for (*ModeIdIndex=0;*ModeIdIndex<sizeof(pVBInfo->SModeIDTable)/sizeof(XGI_StStruct);(*ModeIdIndex)++) */ |
| 4112 | for( *ModeIdIndex = 0 ; ; ( *ModeIdIndex )++ ) |
| 4113 | { |
| 4114 | if ( pVBInfo->SModeIDTable[ *ModeIdIndex ].St_ModeID == ModeNo ) |
| 4115 | break ; |
| 4116 | if ( pVBInfo->SModeIDTable[ *ModeIdIndex ].St_ModeID == 0xFF ) |
| 4117 | return( FALSE ) ; |
| 4118 | } |
| 4119 | |
| 4120 | if ( ModeNo == 0x07 ) |
| 4121 | ( *ModeIdIndex )++ ; /* 400 lines */ |
| 4122 | |
| 4123 | if ( ModeNo <=3 ) |
| 4124 | ( *ModeIdIndex ) += 2 ; /* 400 lines */ |
| 4125 | /* else 350 lines */ |
| 4126 | } |
| 4127 | else |
| 4128 | { |
| 4129 | /* for (*ModeIdIndex=0;*ModeIdIndex<sizeof(pVBInfo->EModeIDTable)/sizeof(XGI_ExtStruct);(*ModeIdIndex)++) */ |
| 4130 | for( *ModeIdIndex = 0 ; ; ( *ModeIdIndex )++ ) |
| 4131 | { |
| 4132 | if ( pVBInfo->EModeIDTable[ *ModeIdIndex ].Ext_ModeID == ModeNo ) |
| 4133 | break ; |
| 4134 | if ( pVBInfo->EModeIDTable[ *ModeIdIndex ].Ext_ModeID == 0xFF ) |
| 4135 | return( FALSE ) ; |
| 4136 | } |
| 4137 | } |
| 4138 | |
| 4139 | #endif |
| 4140 | |
| 4141 | #ifdef LINUX /* chiawen for linux solution */ |
| 4142 | |
| 4143 | if ( ModeNo <= 5 ) |
| 4144 | ModeNo |= 1 ; |
| 4145 | if ( ModeNo <= 0x13 ) |
| 4146 | { |
| 4147 | /* for (*ModeIdIndex=0;*ModeIdIndex<sizeof(pVBInfo->SModeIDTable)/sizeof(XGI_StStruct);(*ModeIdIndex)++) */ |
| 4148 | for( *ModeIdIndex = 0 ; ; ( *ModeIdIndex )++ ) |
| 4149 | { |
| 4150 | if ( pVBInfo->SModeIDTable[ *ModeIdIndex ].St_ModeID == ModeNo ) |
| 4151 | break ; |
| 4152 | if ( pVBInfo->SModeIDTable[ *ModeIdIndex ].St_ModeID == 0xFF ) |
| 4153 | return( FALSE ) ; |
| 4154 | } |
| 4155 | |
| 4156 | if ( ModeNo == 0x07 ) |
| 4157 | ( *ModeIdIndex )++ ; /* 400 lines */ |
| 4158 | |
| 4159 | if ( ModeNo <= 3 ) |
| 4160 | ( *ModeIdIndex ) += 2 ; /* 400 lines */ |
| 4161 | /* else 350 lines */ |
| 4162 | } |
| 4163 | else |
| 4164 | { |
| 4165 | /* for (*ModeIdIndex=0;*ModeIdIndex<sizeof(pVBInfo->EModeIDTable)/sizeof(XGI_ExtStruct);(*ModeIdIndex)++) */ |
| 4166 | for( *ModeIdIndex = 0 ; ; ( *ModeIdIndex )++ ) |
| 4167 | { |
| 4168 | if ( pVBInfo->EModeIDTable[ *ModeIdIndex ].Ext_ModeID == ModeNo ) |
| 4169 | break ; |
| 4170 | if ( pVBInfo->EModeIDTable[ *ModeIdIndex ].Ext_ModeID == 0xFF ) |
| 4171 | return( FALSE ) ; |
| 4172 | } |
| 4173 | } |
| 4174 | |
| 4175 | #endif |
| 4176 | |
| 4177 | return( TRUE ) ; |
| 4178 | } |
| 4179 | |
| 4180 | |
| 4181 | |
| 4182 | |
| 4183 | /* win2000 MM adapter not support standard mode! */ |
| 4184 | |
| 4185 | /* --------------------------------------------------------------------- */ |
| 4186 | /* Function : */ |
| 4187 | /* Input : */ |
| 4188 | /* Output : */ |
| 4189 | /* Description : */ |
| 4190 | /* --------------------------------------------------------------------- */ |
| 4191 | BOOLEAN XGINew_CheckMemorySize(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo) |
| 4192 | { |
| 4193 | USHORT memorysize , |
| 4194 | modeflag , |
| 4195 | temp , |
| 4196 | temp1 , |
| 4197 | tmp ; |
| 4198 | |
| 4199 | /* if ( ( HwDeviceExtension->jChipType == XGI_650 ) || |
| 4200 | ( HwDeviceExtension->jChipType == XGI_650M ) ) |
| 4201 | { |
| 4202 | return( TRUE ) ; |
| 4203 | } */ |
| 4204 | |
| 4205 | if ( ModeNo <= 0x13 ) |
| 4206 | { |
| 4207 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 4208 | } |
| 4209 | else { |
| 4210 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 4211 | } |
| 4212 | |
| 4213 | /* ModeType = modeflag&ModeInfoFlag ; // Get mode type */ |
| 4214 | |
| 4215 | memorysize = modeflag & MemoryInfoFlag ; |
| 4216 | memorysize = memorysize > MemorySizeShift ; |
| 4217 | memorysize++ ; /* Get memory size */ |
| 4218 | |
| 4219 | temp = XGINew_GetReg1( pVBInfo->P3c4 , 0x14 ) ; /* Get DRAM Size */ |
| 4220 | tmp = temp ; |
| 4221 | |
| 4222 | if ( HwDeviceExtension->jChipType == XG40 ) |
| 4223 | { |
| 4224 | temp = 1 << ( ( temp & 0x0F0 ) >> 4 ) ; /* memory size per channel SR14[7:4] */ |
| 4225 | if ( ( tmp & 0x0c ) == 0x0C ) /* Qual channels */ |
| 4226 | { |
| 4227 | temp <<= 2 ; |
| 4228 | } |
| 4229 | else if ( ( tmp & 0x0c ) == 0x08 ) /* Dual channels */ |
| 4230 | { |
| 4231 | temp <<= 1 ; |
| 4232 | } |
| 4233 | } |
| 4234 | else if ( HwDeviceExtension->jChipType == XG42 ) |
| 4235 | { |
| 4236 | temp = 1 << ( ( temp & 0x0F0 ) >> 4 ) ; /* memory size per channel SR14[7:4] */ |
| 4237 | if ( ( tmp & 0x04 ) == 0x04 ) /* Dual channels */ |
| 4238 | { |
| 4239 | temp <<= 1 ; |
| 4240 | } |
| 4241 | } |
| 4242 | else if ( HwDeviceExtension->jChipType == XG45 ) |
| 4243 | { |
| 4244 | temp = 1 << ( ( temp & 0x0F0 ) >> 4 ) ; /* memory size per channel SR14[7:4] */ |
| 4245 | if ( ( tmp & 0x0c ) == 0x0C ) /* Qual channels */ |
| 4246 | { |
| 4247 | temp <<= 2 ; |
| 4248 | } |
| 4249 | else if ( ( tmp & 0x0c ) == 0x08 ) /* triple channels */ |
| 4250 | { |
| 4251 | temp1 = temp ; |
| 4252 | temp <<= 1 ; |
| 4253 | temp += temp1 ; |
| 4254 | } |
| 4255 | else if ( ( tmp & 0x0c ) == 0x04 ) /* Dual channels */ |
| 4256 | { |
| 4257 | temp <<= 1 ; |
| 4258 | } |
| 4259 | } |
| 4260 | if ( temp < memorysize ) |
| 4261 | return( FALSE ) ; |
| 4262 | else |
| 4263 | return( TRUE ) ; |
| 4264 | } |
| 4265 | |
| 4266 | |
| 4267 | /* --------------------------------------------------------------------- */ |
| 4268 | /* Function : XGINew_IsLowResolution */ |
| 4269 | /* Input : */ |
| 4270 | /* Output : */ |
| 4271 | /* Description : */ |
| 4272 | /* --------------------------------------------------------------------- */ |
| 4273 | /*void XGINew_IsLowResolution( USHORT ModeNo , USHORT ModeIdIndex, BOOLEAN XGINew_CheckMemorySize(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo) |
| 4274 | { |
| 4275 | USHORT data ; |
| 4276 | USHORT ModeFlag ; |
| 4277 | |
| 4278 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x0F ) ; |
| 4279 | data &= 0x7F ; |
| 4280 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0F , data ) ; |
| 4281 | |
| 4282 | if ( ModeNo > 0x13 ) |
| 4283 | { |
| 4284 | ModeFlag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 4285 | if ( ( ModeFlag & HalfDCLK ) && ( ModeFlag & DoubleScanMode ) ) |
| 4286 | { |
| 4287 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x0F ) ; |
| 4288 | data |= 0x80 ; |
| 4289 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0F , data ) ; |
| 4290 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x01 ) ; |
| 4291 | data &= 0xF7 ; |
| 4292 | XGINew_SetReg1( pVBInfo->P3c4 , 0x01 , data ) ; |
| 4293 | } |
| 4294 | } |
| 4295 | } |
| 4296 | |
| 4297 | */ |
| 4298 | |
| 4299 | /* --------------------------------------------------------------------- */ |
| 4300 | /* Function : XGI_DisplayOn */ |
| 4301 | /* Input : */ |
| 4302 | /* Output : */ |
| 4303 | /* Description : */ |
| 4304 | /* --------------------------------------------------------------------- */ |
| 4305 | void XGI_DisplayOn( PXGI_HW_DEVICE_INFO pXGIHWDE , PVB_DEVICE_INFO pVBInfo ) |
| 4306 | { |
| 4307 | |
| 4308 | XGINew_SetRegANDOR(pVBInfo->P3c4,0x01,0xDF,0x00); |
| 4309 | if ( pXGIHWDE->jChipType == XG21 ) |
| 4310 | { |
| 4311 | if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 4312 | { |
| 4313 | if (!(XGI_XG21GetPSCValue( pVBInfo )&0x1)) |
| 4314 | { |
| 4315 | XGI_XG21BLSignalVDD( 0x01 , 0x01, pVBInfo ) ; /* LVDS VDD on */ |
| 4316 | XGI_XG21SetPanelDelay( 2,pVBInfo ) ; |
| 4317 | } |
| 4318 | if (!(XGI_XG21GetPSCValue( pVBInfo )&0x20)) |
| 4319 | { |
| 4320 | XGI_XG21BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* LVDS signal on */ |
| 4321 | } |
| 4322 | XGI_XG21SetPanelDelay( 3,pVBInfo ) ; |
| 4323 | XGI_XG21BLSignalVDD( 0x02 , 0x02, pVBInfo ) ; /* LVDS backlight on */ |
| 4324 | } |
| 4325 | else |
| 4326 | { |
| 4327 | XGI_XG21BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* DVO/DVI signal on */ |
| 4328 | } |
| 4329 | |
| 4330 | } |
| 4331 | |
| 4332 | if (pVBInfo->IF_DEF_CH7007 == 1) /* [Billy] 07/05/23 For CH7007 */ |
| 4333 | { |
| 4334 | #ifdef WIN2000 |
| 4335 | if ( IsCH7007TVMode( pVBInfo ) ) |
| 4336 | { |
| 4337 | TurnOnCH7007(pXGIHWDE->pDevice) ; /* 07/05/28 */ |
| 4338 | } |
| 4339 | #endif |
| 4340 | |
| 4341 | } |
| 4342 | |
| 4343 | |
| 4344 | if ( pXGIHWDE->jChipType == XG27 ) |
| 4345 | { |
| 4346 | if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 4347 | { |
| 4348 | if (!(XGI_XG27GetPSCValue( pVBInfo )&0x1)) |
| 4349 | { |
| 4350 | XGI_XG27BLSignalVDD( 0x01 , 0x01, pVBInfo ) ; /* LVDS VDD on */ |
| 4351 | XGI_XG21SetPanelDelay( 2,pVBInfo ) ; |
| 4352 | } |
| 4353 | if (!(XGI_XG27GetPSCValue( pVBInfo )&0x20)) |
| 4354 | { |
| 4355 | XGI_XG27BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* LVDS signal on */ |
| 4356 | } |
| 4357 | XGI_XG21SetPanelDelay( 3,pVBInfo ) ; |
| 4358 | XGI_XG27BLSignalVDD( 0x02 , 0x02, pVBInfo ) ; /* LVDS backlight on */ |
| 4359 | } |
| 4360 | else |
| 4361 | { |
| 4362 | XGI_XG27BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* DVO/DVI signal on */ |
| 4363 | } |
| 4364 | |
| 4365 | } |
| 4366 | } |
| 4367 | |
| 4368 | |
| 4369 | /* --------------------------------------------------------------------- */ |
| 4370 | /* Function : XGI_DisplayOff */ |
| 4371 | /* Input : */ |
| 4372 | /* Output : */ |
| 4373 | /* Description : */ |
| 4374 | /* --------------------------------------------------------------------- */ |
| 4375 | void XGI_DisplayOff( PXGI_HW_DEVICE_INFO pXGIHWDE , PVB_DEVICE_INFO pVBInfo ) |
| 4376 | { |
| 4377 | |
| 4378 | if ( pXGIHWDE->jChipType == XG21 ) |
| 4379 | { |
| 4380 | if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 4381 | { |
| 4382 | XGI_XG21BLSignalVDD( 0x02 , 0x00, pVBInfo ) ; /* LVDS backlight off */ |
| 4383 | XGI_XG21SetPanelDelay( 3,pVBInfo ) ; |
| 4384 | } |
| 4385 | else |
| 4386 | { |
| 4387 | XGI_XG21BLSignalVDD( 0x20 , 0x00, pVBInfo ) ; /* DVO/DVI signal off */ |
| 4388 | } |
| 4389 | } |
| 4390 | |
| 4391 | if (pVBInfo->IF_DEF_CH7007 == 1) /*[Billy] 07/05/23 For CH7007 */ |
| 4392 | { |
| 4393 | /* if( IsCH7007TVMode( pVBInfo ) == 0 ) */ |
| 4394 | { |
| 4395 | #ifdef WIN2000 |
| 4396 | TurnOffCH7007(pXGIHWDE->pDevice) ; /* 07/05/28 */ |
| 4397 | #endif |
| 4398 | } |
| 4399 | } |
| 4400 | |
| 4401 | |
| 4402 | if ( pXGIHWDE->jChipType == XG27 ) |
| 4403 | { |
| 4404 | if ((XGI_XG27GetPSCValue( pVBInfo )&0x2)) |
| 4405 | { |
| 4406 | XGI_XG27BLSignalVDD( 0x02 , 0x00, pVBInfo ) ; /* LVDS backlight off */ |
| 4407 | XGI_XG21SetPanelDelay( 3,pVBInfo ) ; |
| 4408 | } |
| 4409 | |
| 4410 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 4411 | { |
| 4412 | XGI_XG27BLSignalVDD( 0x20 , 0x00, pVBInfo ) ; /* DVO/DVI signal off */ |
| 4413 | } |
| 4414 | } |
| 4415 | |
| 4416 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xDF , 0x20 ) ; |
| 4417 | } |
| 4418 | |
| 4419 | |
| 4420 | /* --------------------------------------------------------------------- */ |
| 4421 | /* Function : XGI_WaitDisply */ |
| 4422 | /* Input : */ |
| 4423 | /* Output : */ |
| 4424 | /* Description : chiawen for sensecrt1 */ |
| 4425 | /* --------------------------------------------------------------------- */ |
| 4426 | void XGI_WaitDisply( PVB_DEVICE_INFO pVBInfo ) |
| 4427 | { |
| 4428 | while( ( XGINew_GetReg2( pVBInfo->P3da ) & 0x01 ) ) |
| 4429 | break ; |
| 4430 | |
| 4431 | while( !( XGINew_GetReg2( pVBInfo->P3da ) & 0x01 ) ) |
| 4432 | break ; |
| 4433 | } |
| 4434 | |
| 4435 | /* --------------------------------------------------------------------- */ |
| 4436 | /* Function : XGI_SenseCRT1 */ |
| 4437 | /* Input : */ |
| 4438 | /* Output : */ |
| 4439 | /* Description : */ |
| 4440 | /* --------------------------------------------------------------------- */ |
| 4441 | |
| 4442 | void XGI_SenseCRT1( PVB_DEVICE_INFO pVBInfo ) |
| 4443 | { |
| 4444 | UCHAR CRTCData[ 17 ] = { 0x5F , 0x4F , 0x50 , 0x82 , 0x55 , 0x81 , |
| 4445 | 0x0B , 0x3E , 0xE9 , 0x0B , 0xDF , 0xE7 , |
| 4446 | 0x04 , 0x00 , 0x00 , 0x05 , 0x00 } ; |
| 4447 | |
| 4448 | UCHAR SR01 = 0 , SR1F = 0 , SR07 = 0 , SR06 = 0 ; |
| 4449 | |
| 4450 | UCHAR CR17 , CR63 , SR31 ; |
| 4451 | USHORT temp ; |
| 4452 | UCHAR DAC_TEST_PARMS[ 3 ] = { 0x0F , 0x0F , 0x0F } ; |
| 4453 | |
| 4454 | int i ; |
| 4455 | XGINew_SetReg1( pVBInfo->P3c4 , 0x05 , 0x86 ) ; |
| 4456 | |
| 4457 | /* [2004/05/06] Vicent to fix XG42 single LCD sense to CRT+LCD */ |
| 4458 | XGINew_SetReg1( pVBInfo->P3d4 , 0x57 , 0x4A ) ; |
| 4459 | XGINew_SetReg1( pVBInfo->P3d4 , 0x53 , ( UCHAR )( XGINew_GetReg1( pVBInfo->P3d4 , 0x53 ) | 0x02 ) ) ; |
| 4460 | |
| 4461 | SR31 = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x31 ) ; |
| 4462 | CR63 = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x63 ) ; |
| 4463 | SR01 = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x01 ) ; |
| 4464 | |
| 4465 | XGINew_SetReg1( pVBInfo->P3c4 , 0x01 , ( UCHAR )( SR01 & 0xDF ) ) ; |
| 4466 | XGINew_SetReg1( pVBInfo->P3d4 , 0x63 , ( UCHAR )( CR63 & 0xBF ) ) ; |
| 4467 | |
| 4468 | CR17 = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x17 ) ; |
| 4469 | XGINew_SetReg1( pVBInfo->P3d4 , 0x17 , ( UCHAR )( CR17 | 0x80 ) ) ; |
| 4470 | |
| 4471 | SR1F = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x1F ) ; |
| 4472 | XGINew_SetReg1( pVBInfo->P3c4 , 0x1F , ( UCHAR )( SR1F | 0x04 ) ) ; |
| 4473 | |
| 4474 | SR07 = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x07 ) ; |
| 4475 | XGINew_SetReg1( pVBInfo->P3c4 , 0x07 , ( UCHAR )( SR07 & 0xFB ) ) ; |
| 4476 | SR06 = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x06 ) ; |
| 4477 | XGINew_SetReg1( pVBInfo->P3c4 , 0x06 , ( UCHAR )( SR06 & 0xC3 ) ) ; |
| 4478 | |
| 4479 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , 0x00 ) ; |
| 4480 | |
| 4481 | for( i = 0 ; i < 8 ; i++ ) |
| 4482 | XGINew_SetReg1( pVBInfo->P3d4 , ( USHORT )i , CRTCData[ i ] ) ; |
| 4483 | |
| 4484 | for( i = 8 ; i < 11 ; i++ ) |
| 4485 | XGINew_SetReg1( pVBInfo->P3d4 , ( USHORT )( i + 8 ) , CRTCData[ i ] ) ; |
| 4486 | |
| 4487 | for( i = 11 ; i < 13 ; i++ ) |
| 4488 | XGINew_SetReg1( pVBInfo->P3d4 , ( USHORT )( i + 4 ) , CRTCData[ i ] ) ; |
| 4489 | |
| 4490 | for( i = 13 ; i < 16 ; i++ ) |
| 4491 | XGINew_SetReg1( pVBInfo->P3c4 , ( USHORT )( i - 3 ) , CRTCData[ i ] ) ; |
| 4492 | |
| 4493 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0E , ( UCHAR )( CRTCData[ 16 ] & 0xE0 ) ) ; |
| 4494 | |
| 4495 | XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , 0x00 ) ; |
| 4496 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , 0x1B ) ; |
| 4497 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , 0xE1 ) ; |
| 4498 | |
| 4499 | XGINew_SetReg3( pVBInfo->P3c8 , 0x00 ) ; |
| 4500 | |
| 4501 | for( i = 0 ; i < 256 ; i++ ) |
| 4502 | { |
| 4503 | XGINew_SetReg3( ( pVBInfo->P3c8 + 1 ) , ( UCHAR )DAC_TEST_PARMS[ 0 ] ) ; |
| 4504 | XGINew_SetReg3( ( pVBInfo->P3c8 + 1 ) , ( UCHAR )DAC_TEST_PARMS[ 1 ] ) ; |
| 4505 | XGINew_SetReg3( ( pVBInfo->P3c8 + 1 ) , ( UCHAR )DAC_TEST_PARMS[ 2 ] ) ; |
| 4506 | } |
| 4507 | |
| 4508 | XGI_VBLongWait( pVBInfo ) ; |
| 4509 | XGI_VBLongWait( pVBInfo ) ; |
| 4510 | XGI_VBLongWait( pVBInfo ) ; |
| 4511 | |
| 4512 | XGINew_LCD_Wait_Time( 0x01 , pVBInfo ) ; |
| 4513 | |
| 4514 | XGI_WaitDisply( pVBInfo ) ; |
| 4515 | temp = XGINew_GetReg2( pVBInfo->P3c2 ) ; |
| 4516 | |
| 4517 | if( temp & 0x10 ) |
| 4518 | { |
| 4519 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x32 , 0xDF , 0x20 ) ; |
| 4520 | } |
| 4521 | else |
| 4522 | { |
| 4523 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x32 , 0xDF , 0x00 ) ; |
| 4524 | } |
| 4525 | |
| 4526 | /* alan, avoid display something, set BLACK DAC if not restore DAC */ |
| 4527 | XGINew_SetReg3( pVBInfo->P3c8 , 0x00 ) ; |
| 4528 | |
| 4529 | for( i = 0 ; i < 256 ; i++ ) |
| 4530 | { |
| 4531 | XGINew_SetReg3( ( pVBInfo->P3c8 + 1 ) , 0 ) ; |
| 4532 | XGINew_SetReg3( ( pVBInfo->P3c8 + 1 ) , 0 ) ; |
| 4533 | XGINew_SetReg3( ( pVBInfo->P3c8 + 1 ) , 0 ) ; |
| 4534 | } |
| 4535 | |
| 4536 | XGINew_SetReg1( pVBInfo->P3c4 , 0x01 , SR01 ) ; |
| 4537 | XGINew_SetReg1( pVBInfo->P3d4 , 0x63 , CR63 ) ; |
| 4538 | XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , SR31 ) ; |
| 4539 | |
| 4540 | /* [2004/05/11] Vicent */ |
| 4541 | XGINew_SetReg1( pVBInfo->P3d4 , 0x53 , ( UCHAR )( XGINew_GetReg1( pVBInfo->P3d4 , 0x53 ) & 0xFD ) ) ; |
| 4542 | XGINew_SetReg1( pVBInfo->P3c4 , 0x1F , ( UCHAR ) SR1F ) ; |
| 4543 | } |
| 4544 | |
| 4545 | |
| 4546 | |
| 4547 | |
| 4548 | |
| 4549 | #ifdef TC |
| 4550 | /* --------------------------------------------------------------------- */ |
| 4551 | /* Function : INT1AReturnCode */ |
| 4552 | /* Input : */ |
| 4553 | /* Output : */ |
| 4554 | /* Description : */ |
| 4555 | /* --------------------------------------------------------------------- */ |
| 4556 | int INT1AReturnCode( union REGS regs ) |
| 4557 | { |
| 4558 | if ( regs.x.cflag ) |
| 4559 | { |
| 4560 | /* printf( "Error to find pci device!\n" ) ; */ |
| 4561 | return( 1 ) ; |
| 4562 | } |
| 4563 | |
| 4564 | switch(regs.h.ah) |
| 4565 | { |
| 4566 | case 0: return 0; |
| 4567 | break ; |
| 4568 | case 0x81: |
| 4569 | printf( "Function not support\n" ) ; |
| 4570 | break ; |
| 4571 | case 0x83: |
| 4572 | printf( "bad vendor id\n" ) ; |
| 4573 | break ; |
| 4574 | case 0x86: |
| 4575 | printf( "device not found\n" ) ; |
| 4576 | break ; |
| 4577 | case 0x87: |
| 4578 | printf( "bad register number\n" ) ; |
| 4579 | break ; |
| 4580 | case 0x88: |
| 4581 | printf( "set failed\n" ) ; |
| 4582 | break ; |
| 4583 | case 0x89: |
| 4584 | printf( "buffer too small" ) ; |
| 4585 | break ; |
| 4586 | default: |
| 4587 | break ; |
| 4588 | } |
| 4589 | return( 1 ) ; |
| 4590 | } |
| 4591 | |
| 4592 | |
| 4593 | /* --------------------------------------------------------------------- */ |
| 4594 | /* Function : FindPCIIOBase */ |
| 4595 | /* Input : */ |
| 4596 | /* Output : */ |
| 4597 | /* Description : */ |
| 4598 | /* --------------------------------------------------------------------- */ |
| 4599 | unsigned FindPCIIOBase( unsigned index , unsigned deviceid ) |
| 4600 | { |
| 4601 | union REGS regs ; |
| 4602 | |
| 4603 | regs.h.ah = 0xb1 ; /* PCI_FUNCTION_ID */ |
| 4604 | regs.h.al = 0x02 ; /* FIND_PCI_DEVICE */ |
| 4605 | regs.x.cx = deviceid ; |
| 4606 | regs.x.dx = 0x1039 ; |
| 4607 | regs.x.si = index ; /* find n-th device */ |
| 4608 | |
| 4609 | int86( 0x1A , ®s , ®s ) ; |
| 4610 | |
| 4611 | if ( INT1AReturnCode( regs ) != 0 ) |
| 4612 | return( 0 ) ; |
| 4613 | |
| 4614 | /* regs.h.bh bus number */ |
| 4615 | /* regs.h.bl device number */ |
| 4616 | regs.h.ah = 0xb1 ; /* PCI_FUNCTION_ID */ |
| 4617 | regs.h.al = 0x09 ; /* READ_CONFIG_WORD */ |
| 4618 | regs.x.cx = deviceid ; |
| 4619 | regs.x.dx = 0x1039 ; |
| 4620 | regs.x.di = 0x18 ; /* register number */ |
| 4621 | int86( 0x1A , ®s , ®s ) ; |
| 4622 | |
| 4623 | if ( INT1AReturnCode( regs ) != 0 ) |
| 4624 | return( 0 ) ; |
| 4625 | |
| 4626 | return( regs.x.cx ) ; |
| 4627 | } |
| 4628 | |
| 4629 | #endif |
| 4630 | |
| 4631 | |
| 4632 | |
| 4633 | #ifdef TC |
| 4634 | /* --------------------------------------------------------------------- */ |
| 4635 | /* Function : main */ |
| 4636 | /* Input : */ |
| 4637 | /* Output : */ |
| 4638 | /* Description : */ |
| 4639 | /* --------------------------------------------------------------------- */ |
| 4640 | void main(int argc, char *argv[]) |
| 4641 | { |
| 4642 | XGI_HW_DEVICE_INFO HwDeviceExtension ; |
| 4643 | USHORT temp ; |
| 4644 | USHORT ModeNo ; |
| 4645 | |
| 4646 | /* HwDeviceExtension.pjVirtualRomBase =(PUCHAR) MK_FP(0xC000,0); */ |
| 4647 | /* HwDeviceExtension.pjVideoMemoryAddress = (PUCHAR)MK_FP(0xA000,0); */ |
| 4648 | |
| 4649 | |
| 4650 | HwDeviceExtension.pjIOAddress = ( FindPCIIOBase( 0 ,0x6300 ) & 0xFF80 ) + 0x30 ; |
| 4651 | HwDeviceExtension.jChipType = XGI_340 ; |
| 4652 | |
| 4653 | |
| 4654 | |
| 4655 | /* HwDeviceExtension.pjIOAddress = ( FindPCIIOBase( 0 , 0x5315 ) & 0xFF80 ) + 0x30 ; */ |
| 4656 | |
| 4657 | HwDeviceExtension.pjIOAddress = ( FindPCIIOBase( 0 , 0x330 ) & 0xFF80 ) + 0x30 ; |
| 4658 | HwDeviceExtension.jChipType = XGI_340 ; |
| 4659 | |
| 4660 | |
| 4661 | HwDeviceExtension.ujVBChipID = VB_CHIP_301 ; |
| 4662 | StrCpy(HwDeviceExtension.szVBIOSVer , "0.84" ) ; |
| 4663 | HwDeviceExtension.bSkipDramSizing = FALSE ; |
| 4664 | HwDeviceExtension.ulVideoMemorySize = 0 ; |
| 4665 | |
| 4666 | if ( argc == 2 ) |
| 4667 | { |
| 4668 | ModeNo = atoi( argv[ 1 ] ) ; |
| 4669 | } |
| 4670 | else |
| 4671 | { |
| 4672 | ModeNo = 0x2e ; |
| 4673 | /* ModeNo = 0x37 ; 1024x768x 4bpp */ |
| 4674 | /* ModeNo = 0x38 ; 1024x768x 8bpp */ |
| 4675 | /* ModeNo = 0x4A ; 1024x768x 16bpp */ |
| 4676 | /* ModeNo = 0x47 ; 800x600x 16bpp */ |
| 4677 | } |
| 4678 | |
| 4679 | /* XGIInitNew( &HwDeviceExtension ) ; */ |
| 4680 | XGISetModeNew( &HwDeviceExtension , ModeNo ) ; |
| 4681 | } |
| 4682 | #endif |
| 4683 | |
| 4684 | |
| 4685 | /* --------------------------------------------------------------------- */ |
| 4686 | /* Function : XGI_WaitDisplay */ |
| 4687 | /* Input : */ |
| 4688 | /* Output : */ |
| 4689 | /* Description : */ |
| 4690 | /* --------------------------------------------------------------------- */ |
| 4691 | void XGI_WaitDisplay( PVB_DEVICE_INFO pVBInfo ) |
| 4692 | { |
| 4693 | while( !( XGINew_GetReg2( pVBInfo->P3da ) & 0x01 ) ) ; |
| 4694 | |
| 4695 | while( XGINew_GetReg2( pVBInfo->P3da ) & 0x01 ) ; |
| 4696 | } |
| 4697 | |
| 4698 | |
| 4699 | |
| 4700 | |
| 4701 | /* --------------------------------------------------------------------- */ |
| 4702 | /* Function : XGI_SetCRT2Group301 */ |
| 4703 | /* Input : */ |
| 4704 | /* Output : */ |
| 4705 | /* Description : */ |
| 4706 | /* --------------------------------------------------------------------- */ |
| 4707 | BOOLEAN XGI_SetCRT2Group301( USHORT ModeNo , PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo ) |
| 4708 | { |
| 4709 | USHORT tempbx , |
| 4710 | ModeIdIndex , |
| 4711 | RefreshRateTableIndex ; |
| 4712 | |
| 4713 | tempbx=pVBInfo->VBInfo ; |
| 4714 | pVBInfo->SetFlag |= ProgrammingCRT2 ; |
| 4715 | XGI_SearchModeID( ModeNo , &ModeIdIndex, pVBInfo ) ; |
| 4716 | pVBInfo->SelectCRT2Rate = 4 ; |
| 4717 | RefreshRateTableIndex = XGI_GetRatePtrCRT2( HwDeviceExtension, ModeNo , ModeIdIndex, pVBInfo ) ; |
| 4718 | XGI_SaveCRT2Info( ModeNo, pVBInfo ) ; |
| 4719 | XGI_GetCRT2ResInfo( ModeNo , ModeIdIndex, pVBInfo) ; |
| 4720 | XGI_GetCRT2Data( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 4721 | XGI_PreSetGroup1( ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ; |
| 4722 | XGI_SetGroup1( ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ; |
| 4723 | XGI_SetLockRegs( ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ; |
| 4724 | XGI_SetGroup2( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
| 4725 | XGI_SetLCDRegs(ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ; |
| 4726 | XGI_SetTap4Regs(pVBInfo) ; |
| 4727 | XGI_SetGroup3(ModeNo, ModeIdIndex, pVBInfo); |
| 4728 | XGI_SetGroup4( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
| 4729 | XGI_SetCRT2VCLK( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 4730 | XGI_SetGroup5( ModeNo , ModeIdIndex, pVBInfo) ; |
| 4731 | XGI_AutoThreshold( pVBInfo) ; |
| 4732 | return 1 ; |
| 4733 | } |
| 4734 | |
| 4735 | |
| 4736 | /* --------------------------------------------------------------------- */ |
| 4737 | /* Function : XGI_AutoThreshold */ |
| 4738 | /* Input : */ |
| 4739 | /* Output : */ |
| 4740 | /* Description : */ |
| 4741 | /* --------------------------------------------------------------------- */ |
| 4742 | void XGI_AutoThreshold( PVB_DEVICE_INFO pVBInfo ) |
| 4743 | { |
| 4744 | if ( !( pVBInfo->SetFlag & Win9xDOSMode ) ) |
| 4745 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x01 , 0x40 ) ; |
| 4746 | } |
| 4747 | |
| 4748 | |
| 4749 | /* --------------------------------------------------------------------- */ |
| 4750 | /* Function : XGI_SaveCRT2Info */ |
| 4751 | /* Input : */ |
| 4752 | /* Output : */ |
| 4753 | /* Description : */ |
| 4754 | /* --------------------------------------------------------------------- */ |
| 4755 | void XGI_SaveCRT2Info( USHORT ModeNo , PVB_DEVICE_INFO pVBInfo) |
| 4756 | { |
| 4757 | USHORT temp1 , |
| 4758 | temp2 ; |
| 4759 | |
| 4760 | XGINew_SetReg1( pVBInfo->P3d4 , 0x34 , ModeNo ) ; /* reserve CR34 for CRT1 Mode No */ |
| 4761 | temp1 = ( pVBInfo->VBInfo&SetInSlaveMode ) >> 8 ; |
| 4762 | temp2 = ~( SetInSlaveMode >> 8 ) ; |
| 4763 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x31 , temp2 , temp1 ) ; |
| 4764 | } |
| 4765 | |
| 4766 | |
| 4767 | /* --------------------------------------------------------------------- */ |
| 4768 | /* Function : XGI_GetCRT2ResInfo */ |
| 4769 | /* Input : */ |
| 4770 | /* Output : */ |
| 4771 | /* Description : */ |
| 4772 | /* --------------------------------------------------------------------- */ |
| 4773 | void XGI_GetCRT2ResInfo( USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 4774 | { |
| 4775 | USHORT xres , |
| 4776 | yres , |
| 4777 | modeflag , |
| 4778 | resindex ; |
| 4779 | |
| 4780 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo) ; |
| 4781 | if ( ModeNo <= 0x13 ) |
| 4782 | { |
| 4783 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 4784 | yres = pVBInfo->StResInfo[ resindex ].VTotal ; |
| 4785 | /* modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; si+St_ResInfo */ |
| 4786 | } |
| 4787 | else |
| 4788 | { |
| 4789 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */ |
| 4790 | yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; /* yres->bx */ |
| 4791 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex].Ext_ModeFlag ; /* si+St_ModeFlag */ |
| 4792 | |
| 4793 | /* if ( pVBInfo->IF_DEF_FSTN ) |
| 4794 | { |
| 4795 | xres *= 2 ; |
| 4796 | yres *= 2 ; |
| 4797 | } |
| 4798 | else |
| 4799 | { |
| 4800 | */ |
| 4801 | if ( modeflag & HalfDCLK ) |
| 4802 | xres *= 2; |
| 4803 | |
| 4804 | if ( modeflag & DoubleScanMode ) |
| 4805 | yres *= 2 ; |
| 4806 | /* } */ |
| 4807 | } |
| 4808 | |
| 4809 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 4810 | { |
| 4811 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 4812 | { |
| 4813 | if ( pVBInfo->LCDResInfo == Panel1600x1200 ) |
| 4814 | { |
| 4815 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) |
| 4816 | { |
| 4817 | if ( yres == 1024 ) |
| 4818 | yres = 1056 ; |
| 4819 | } |
| 4820 | } |
| 4821 | |
| 4822 | if ( pVBInfo->LCDResInfo == Panel1280x1024 ) |
| 4823 | { |
| 4824 | if ( yres == 400 ) |
| 4825 | yres = 405 ; |
| 4826 | else if ( yres == 350 ) |
| 4827 | yres = 360 ; |
| 4828 | |
| 4829 | if ( pVBInfo->LCDInfo & LCDVESATiming ) |
| 4830 | { |
| 4831 | if ( yres == 360 ) |
| 4832 | yres = 375 ; |
| 4833 | } |
| 4834 | } |
| 4835 | |
| 4836 | if ( pVBInfo->LCDResInfo == Panel1024x768 ) |
| 4837 | { |
| 4838 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) |
| 4839 | { |
| 4840 | if ( !( pVBInfo->LCDInfo & LCDNonExpanding ) ) |
| 4841 | { |
| 4842 | if ( yres == 350 ) |
| 4843 | yres = 357 ; |
| 4844 | else if ( yres == 400 ) |
| 4845 | yres = 420 ; |
| 4846 | else if ( yres == 480 ) |
| 4847 | yres = 525 ; |
| 4848 | } |
| 4849 | } |
| 4850 | } |
| 4851 | } |
| 4852 | |
| 4853 | if ( xres == 720 ) |
| 4854 | xres = 640 ; |
| 4855 | } |
| 4856 | |
| 4857 | pVBInfo->VGAHDE = xres ; |
| 4858 | pVBInfo->HDE = xres ; |
| 4859 | pVBInfo->VGAVDE = yres ; |
| 4860 | pVBInfo->VDE = yres ; |
| 4861 | } |
| 4862 | |
| 4863 | |
| 4864 | /* --------------------------------------------------------------------- */ |
| 4865 | /* Function : XGI_IsLCDDualLink */ |
| 4866 | /* Input : */ |
| 4867 | /* Output : */ |
| 4868 | /* Description : */ |
| 4869 | /* --------------------------------------------------------------------- */ |
| 4870 | BOOLEAN XGI_IsLCDDualLink( PVB_DEVICE_INFO pVBInfo ) |
| 4871 | { |
| 4872 | |
| 4873 | if ( ( ( ( pVBInfo->VBInfo & SetCRT2ToLCD ) | SetCRT2ToLCDA ) ) && ( pVBInfo->LCDInfo & SetLCDDualLink ) ) /* shampoo0129 */ |
| 4874 | return ( 1 ) ; |
| 4875 | |
| 4876 | return( 0 ) ; |
| 4877 | } |
| 4878 | |
| 4879 | |
| 4880 | /* --------------------------------------------------------------------- */ |
| 4881 | /* Function : XGI_GetCRT2Data */ |
| 4882 | /* Input : */ |
| 4883 | /* Output : */ |
| 4884 | /* Description : */ |
| 4885 | /* --------------------------------------------------------------------- */ |
| 4886 | void XGI_GetCRT2Data( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 4887 | { |
| 4888 | USHORT tempax = 0, |
| 4889 | tempbx , |
| 4890 | modeflag , |
| 4891 | resinfo ; |
| 4892 | |
| 4893 | XGI_LCDDataStruct *LCDPtr = NULL ; |
| 4894 | XGI_TVDataStruct *TVPtr = NULL ; |
| 4895 | |
| 4896 | if ( ModeNo <= 0x13 ) |
| 4897 | { |
| 4898 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 4899 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; |
| 4900 | } |
| 4901 | else |
| 4902 | { |
| 4903 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ |
| 4904 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 4905 | } |
| 4906 | |
| 4907 | pVBInfo->NewFlickerMode = 0 ; |
| 4908 | pVBInfo->RVBHRS = 50 ; |
| 4909 | |
| 4910 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 4911 | { |
| 4912 | XGI_GetRAMDAC2DATA( ModeNo , ModeIdIndex , RefreshRateTableIndex,pVBInfo ) ; |
| 4913 | return ; |
| 4914 | } |
| 4915 | |
| 4916 | tempbx = 4 ; |
| 4917 | |
| 4918 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 4919 | { |
| 4920 | LCDPtr = (XGI_LCDDataStruct* )XGI_GetLcdPtr( tempbx, ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 4921 | |
| 4922 | pVBInfo->RVBHCMAX = LCDPtr->RVBHCMAX ; |
| 4923 | pVBInfo->RVBHCFACT = LCDPtr->RVBHCFACT ; |
| 4924 | pVBInfo->VGAHT = LCDPtr->VGAHT ; |
| 4925 | pVBInfo->VGAVT = LCDPtr->VGAVT ; |
| 4926 | pVBInfo->HT = LCDPtr->LCDHT ; |
| 4927 | pVBInfo->VT = LCDPtr->LCDVT ; |
| 4928 | |
| 4929 | if ( pVBInfo->LCDResInfo == Panel1024x768 ) |
| 4930 | { |
| 4931 | tempax = 1024 ; |
| 4932 | tempbx = 768 ; |
| 4933 | |
| 4934 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) |
| 4935 | { |
| 4936 | if ( pVBInfo->VGAVDE == 357 ) |
| 4937 | tempbx = 527 ; |
| 4938 | else if ( pVBInfo->VGAVDE == 420 ) |
| 4939 | tempbx = 620 ; |
| 4940 | else if ( pVBInfo->VGAVDE == 525 ) |
| 4941 | tempbx = 775 ; |
| 4942 | else if ( pVBInfo->VGAVDE == 600 ) |
| 4943 | tempbx = 775 ; |
| 4944 | /* else if(pVBInfo->VGAVDE==350) tempbx=560; */ |
| 4945 | /* else if(pVBInfo->VGAVDE==400) tempbx=640; */ |
| 4946 | else |
| 4947 | tempbx = 768 ; |
| 4948 | } |
| 4949 | else |
| 4950 | tempbx = 768 ; |
| 4951 | } |
| 4952 | else if ( pVBInfo->LCDResInfo == Panel1024x768x75 ) |
| 4953 | { |
| 4954 | tempax = 1024 ; |
| 4955 | tempbx = 768 ; |
| 4956 | } |
| 4957 | else if ( pVBInfo->LCDResInfo == Panel1280x1024 ) |
| 4958 | { |
| 4959 | tempax = 1280 ; |
| 4960 | if ( pVBInfo->VGAVDE == 360 ) |
| 4961 | tempbx = 768 ; |
| 4962 | else if ( pVBInfo->VGAVDE == 375 ) |
| 4963 | tempbx = 800 ; |
| 4964 | else if ( pVBInfo->VGAVDE == 405 ) |
| 4965 | tempbx = 864 ; |
| 4966 | else |
| 4967 | tempbx = 1024 ; |
| 4968 | } |
| 4969 | else if ( pVBInfo->LCDResInfo == Panel1280x1024x75 ) |
| 4970 | { |
| 4971 | tempax = 1280 ; |
| 4972 | tempbx = 1024 ; |
| 4973 | } |
| 4974 | else if ( pVBInfo->LCDResInfo == Panel1280x960 ) |
| 4975 | { |
| 4976 | tempax = 1280 ; |
| 4977 | if ( pVBInfo->VGAVDE == 350 ) |
| 4978 | tempbx = 700 ; |
| 4979 | else if ( pVBInfo->VGAVDE == 400 ) |
| 4980 | tempbx = 800 ; |
| 4981 | else if ( pVBInfo->VGAVDE == 1024 ) |
| 4982 | tempbx = 960 ; |
| 4983 | else |
| 4984 | tempbx = 960 ; |
| 4985 | } |
| 4986 | else if ( pVBInfo->LCDResInfo == Panel1400x1050 ) |
| 4987 | { |
| 4988 | tempax = 1400 ; |
| 4989 | tempbx = 1050 ; |
| 4990 | |
| 4991 | if ( pVBInfo->VGAVDE == 1024 ) |
| 4992 | { |
| 4993 | tempax = 1280 ; |
| 4994 | tempbx = 1024 ; |
| 4995 | } |
| 4996 | } |
| 4997 | else if ( pVBInfo->LCDResInfo == Panel1600x1200 ) |
| 4998 | { |
| 4999 | tempax = 1600 ; |
| 5000 | tempbx = 1200 ; /* alan 10/14/2003 */ |
| 5001 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) |
| 5002 | { |
| 5003 | if ( pVBInfo->VGAVDE == 350 ) |
| 5004 | tempbx = 875 ; |
| 5005 | else if ( pVBInfo->VGAVDE == 400 ) |
| 5006 | tempbx = 1000 ; |
| 5007 | } |
| 5008 | } |
| 5009 | |
| 5010 | if ( pVBInfo->LCDInfo & LCDNonExpanding ) |
| 5011 | { |
| 5012 | tempax = pVBInfo->VGAHDE ; |
| 5013 | tempbx = pVBInfo->VGAVDE ; |
| 5014 | } |
| 5015 | |
| 5016 | pVBInfo->HDE = tempax ; |
| 5017 | pVBInfo->VDE = tempbx ; |
| 5018 | return ; |
| 5019 | } |
| 5020 | |
| 5021 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV ) ) |
| 5022 | { |
| 5023 | tempbx = 4 ; |
| 5024 | TVPtr = ( XGI_TVDataStruct * )XGI_GetTVPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 5025 | |
| 5026 | pVBInfo->RVBHCMAX = TVPtr->RVBHCMAX ; |
| 5027 | pVBInfo->RVBHCFACT = TVPtr->RVBHCFACT ; |
| 5028 | pVBInfo->VGAHT = TVPtr->VGAHT ; |
| 5029 | pVBInfo->VGAVT = TVPtr->VGAVT ; |
| 5030 | pVBInfo->HDE = TVPtr->TVHDE ; |
| 5031 | pVBInfo->VDE = TVPtr->TVVDE ; |
| 5032 | pVBInfo->RVBHRS = TVPtr->RVBHRS ; |
| 5033 | pVBInfo->NewFlickerMode = TVPtr->FlickerMode ; |
| 5034 | |
| 5035 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 5036 | { |
| 5037 | if ( resinfo == 0x08 ) |
| 5038 | pVBInfo->NewFlickerMode = 0x40 ; |
| 5039 | else if ( resinfo == 0x09 ) |
| 5040 | pVBInfo->NewFlickerMode = 0x40 ; |
| 5041 | else if ( resinfo == 0x12 ) |
| 5042 | pVBInfo->NewFlickerMode = 0x40 ; |
| 5043 | |
| 5044 | if ( pVBInfo->VGAVDE == 350 ) |
| 5045 | pVBInfo->TVInfo |= TVSimuMode ; |
| 5046 | |
| 5047 | tempax = ExtHiTVHT ; |
| 5048 | tempbx = ExtHiTVVT ; |
| 5049 | |
| 5050 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 5051 | { |
| 5052 | if ( pVBInfo->TVInfo & TVSimuMode ) |
| 5053 | { |
| 5054 | tempax = StHiTVHT ; |
| 5055 | tempbx = StHiTVVT ; |
| 5056 | |
| 5057 | if ( !( modeflag & Charx8Dot ) ) |
| 5058 | { |
| 5059 | tempax = StHiTextTVHT ; |
| 5060 | tempbx = StHiTextTVVT ; |
| 5061 | } |
| 5062 | } |
| 5063 | } |
| 5064 | } |
| 5065 | else if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) |
| 5066 | { |
| 5067 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) |
| 5068 | { |
| 5069 | tempax = YPbPrTV750pHT ; /* Ext750pTVHT */ |
| 5070 | tempbx = YPbPrTV750pVT ; /* Ext750pTVVT */ |
| 5071 | } |
| 5072 | |
| 5073 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) |
| 5074 | { |
| 5075 | tempax = YPbPrTV525pHT ; /* Ext525pTVHT */ |
| 5076 | tempbx = YPbPrTV525pVT ; /* Ext525pTVVT */ |
| 5077 | } |
| 5078 | else if ( pVBInfo->TVInfo & SetYPbPrMode525i ) |
| 5079 | { |
| 5080 | tempax = YPbPrTV525iHT ; /* Ext525iTVHT */ |
| 5081 | tempbx = YPbPrTV525iVT ; /* Ext525iTVVT */ |
| 5082 | if ( pVBInfo->TVInfo & NTSC1024x768 ) |
| 5083 | tempax = NTSC1024x768HT ; |
| 5084 | } |
| 5085 | } |
| 5086 | else |
| 5087 | { |
| 5088 | tempax = PALHT ; |
| 5089 | tempbx = PALVT ; |
| 5090 | if ( !( pVBInfo->TVInfo & SetPALTV ) ) |
| 5091 | { |
| 5092 | tempax = NTSCHT ; |
| 5093 | tempbx = NTSCVT ; |
| 5094 | if ( pVBInfo->TVInfo & NTSC1024x768 ) |
| 5095 | tempax = NTSC1024x768HT ; |
| 5096 | } |
| 5097 | } |
| 5098 | |
| 5099 | pVBInfo->HT = tempax ; |
| 5100 | pVBInfo->VT = tempbx ; |
| 5101 | return ; |
| 5102 | } |
| 5103 | } |
| 5104 | |
| 5105 | |
| 5106 | /* --------------------------------------------------------------------- */ |
| 5107 | /* Function : XGI_SetCRT2VCLK */ |
| 5108 | /* Input : */ |
| 5109 | /* Output : */ |
| 5110 | /* Description : */ |
| 5111 | /* --------------------------------------------------------------------- */ |
| 5112 | void XGI_SetCRT2VCLK( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 5113 | { |
| 5114 | UCHAR di_0 , |
| 5115 | di_1 , |
| 5116 | tempal ; |
| 5117 | |
| 5118 | tempal = XGI_GetVCLKPtr( RefreshRateTableIndex , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 5119 | XGI_GetVCLKLen( tempal, &di_0 , &di_1, pVBInfo ) ; |
| 5120 | XGI_GetLCDVCLKPtr( &di_0 , &di_1, pVBInfo ) ; |
| 5121 | |
| 5122 | if ( pVBInfo->VBType & VB_XGI301 ) /* shampoo 0129 */ |
| 5123 | { /* 301 */ |
| 5124 | XGINew_SetReg1(pVBInfo->Part4Port , 0x0A , 0x10 ) ; |
| 5125 | XGINew_SetReg1(pVBInfo->Part4Port , 0x0B , di_1 ) ; |
| 5126 | XGINew_SetReg1(pVBInfo->Part4Port , 0x0A , di_0 ) ; |
| 5127 | } |
| 5128 | else |
| 5129 | { /* 301b/302b/301lv/302lv */ |
| 5130 | XGINew_SetReg1( pVBInfo->Part4Port , 0x0A , di_0 ) ; |
| 5131 | XGINew_SetReg1( pVBInfo->Part4Port , 0x0B , di_1 ) ; |
| 5132 | } |
| 5133 | |
| 5134 | XGINew_SetReg1( pVBInfo->Part4Port , 0x00 , 0x12 ) ; |
| 5135 | |
| 5136 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 5137 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x12 , 0x28 ) ; |
| 5138 | else |
| 5139 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x12 , 0x08 ) ; |
| 5140 | } |
| 5141 | |
| 5142 | |
| 5143 | /* --------------------------------------------------------------------- */ |
| 5144 | /* Function : XGI_GETLCDVCLKPtr */ |
| 5145 | /* Input : */ |
| 5146 | /* Output : al -> VCLK Index */ |
| 5147 | /* Description : */ |
| 5148 | /* --------------------------------------------------------------------- */ |
| 5149 | void XGI_GetLCDVCLKPtr( UCHAR* di_0 , UCHAR *di_1, PVB_DEVICE_INFO pVBInfo ) |
| 5150 | { |
| 5151 | USHORT index ; |
| 5152 | |
| 5153 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 5154 | { |
| 5155 | if ( pVBInfo->IF_DEF_ScaleLCD == 1 ) |
| 5156 | { |
| 5157 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 5158 | return ; |
| 5159 | } |
| 5160 | |
| 5161 | /* index = XGI_GetLCDCapPtr(pVBInfo) ; */ |
| 5162 | index = XGI_GetLCDCapPtr1( pVBInfo) ; |
| 5163 | |
| 5164 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 5165 | { /* LCDB */ |
| 5166 | *di_0 = pVBInfo->LCDCapList[ index ].LCUCHAR_VCLKData1 ; |
| 5167 | *di_1 = pVBInfo->LCDCapList[ index ].LCUCHAR_VCLKData2 ; |
| 5168 | } |
| 5169 | else |
| 5170 | { /* LCDA */ |
| 5171 | *di_0 = pVBInfo->LCDCapList[ index ].LCDA_VCLKData1 ; |
| 5172 | *di_1 = pVBInfo->LCDCapList[ index ].LCDA_VCLKData2 ; |
| 5173 | } |
| 5174 | } |
| 5175 | return ; |
| 5176 | } |
| 5177 | |
| 5178 | |
| 5179 | /* --------------------------------------------------------------------- */ |
| 5180 | /* Function : XGI_GetVCLKPtr */ |
| 5181 | /* Input : */ |
| 5182 | /* Output : */ |
| 5183 | /* Description : */ |
| 5184 | /* --------------------------------------------------------------------- */ |
| 5185 | UCHAR XGI_GetVCLKPtr(USHORT RefreshRateTableIndex,USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo) |
| 5186 | { |
| 5187 | |
| 5188 | USHORT index , |
| 5189 | modeflag ; |
| 5190 | #ifndef LINUX_XF86 |
| 5191 | USHORT tempbx ; |
| 5192 | #endif |
| 5193 | |
| 5194 | UCHAR tempal ; |
| 5195 | UCHAR *CHTVVCLKPtr = NULL ; |
| 5196 | |
| 5197 | if ( ModeNo <= 0x13 ) |
| 5198 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 5199 | else |
| 5200 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ |
| 5201 | |
| 5202 | |
| 5203 | if ( ( pVBInfo->SetFlag & ProgrammingCRT2 ) && ( !( pVBInfo->LCDInfo & EnableScalingLCD ) ) ) |
| 5204 | { /* {LCDA/LCDB} */ |
| 5205 | index = XGI_GetLCDCapPtr(pVBInfo) ; |
| 5206 | tempal = pVBInfo->LCDCapList[ index ].LCD_VCLK ; |
| 5207 | |
| 5208 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 5209 | return tempal ; |
| 5210 | |
| 5211 | /* {TV} */ |
| 5212 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV| VB_XGI302LV| VB_XGI301C ) ) |
| 5213 | { |
| 5214 | if(pVBInfo->VBInfo&SetCRT2ToHiVisionTV) |
| 5215 | { |
| 5216 | tempal = HiTVVCLKDIV2; |
| 5217 | if(!(pVBInfo->TVInfo & RPLLDIV2XO)) |
| 5218 | tempal = HiTVVCLK; |
| 5219 | if(pVBInfo->TVInfo & TVSimuMode) |
| 5220 | { |
| 5221 | tempal = HiTVSimuVCLK; |
| 5222 | if(!(modeflag & Charx8Dot)) |
| 5223 | tempal = HiTVTextVCLK; |
| 5224 | |
| 5225 | } |
| 5226 | return tempal; |
| 5227 | } |
| 5228 | |
| 5229 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) |
| 5230 | { |
| 5231 | tempal = YPbPr750pVCLK ; |
| 5232 | return tempal ; |
| 5233 | } |
| 5234 | |
| 5235 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) |
| 5236 | { |
| 5237 | tempal = YPbPr525pVCLK ; |
| 5238 | return tempal ; |
| 5239 | } |
| 5240 | |
| 5241 | tempal = NTSC1024VCLK ; |
| 5242 | |
| 5243 | if ( !( pVBInfo->TVInfo & NTSC1024x768 ) ) |
| 5244 | { |
| 5245 | tempal = TVVCLKDIV2 ; |
| 5246 | if ( !( pVBInfo->TVInfo & RPLLDIV2XO ) ) |
| 5247 | tempal = TVVCLK ; |
| 5248 | } |
| 5249 | |
| 5250 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 5251 | return tempal ; |
| 5252 | } |
| 5253 | /*else |
| 5254 | if((pVBInfo->IF_DEF_CH7017==1)&&(pVBInfo->VBType&VB_CH7017)) |
| 5255 | { |
| 5256 | if(ModeNo<=0x13) |
| 5257 | *tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC; |
| 5258 | else |
| 5259 | *tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; |
| 5260 | *tempal = *tempal & 0x1F; |
| 5261 | |
| 5262 | tempbx = 0; |
| 5263 | if(pVBInfo->TVInfo & SetPALTV) |
| 5264 | tempbx = tempbx + 2; |
| 5265 | if(pVBInfo->TVInfo & SetCHTVOverScan) |
| 5266 | tempbx++; |
| 5267 | tempbx = tempbx << 1; |
| 5268 | } */ |
| 5269 | } /* {End of VB} */ |
| 5270 | |
| 5271 | if((pVBInfo->IF_DEF_CH7007==1)&&(pVBInfo->VBType&VB_CH7007)) /* [Billy] 07/05/08 CH7007 */ |
| 5272 | { |
| 5273 | /* VideoDebugPrint((0, "XGI_GetVCLKPtr: pVBInfo->IF_DEF_CH7007==1\n")); */ |
| 5274 | if ( (pVBInfo->VBInfo & SetCRT2ToTV) ) |
| 5275 | { |
| 5276 | if( ModeNo <= 0x13 ) |
| 5277 | { |
| 5278 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; |
| 5279 | } |
| 5280 | else |
| 5281 | { |
| 5282 | tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; |
| 5283 | } |
| 5284 | |
| 5285 | tempal = tempal & 0x0F; |
| 5286 | tempbx = 0; |
| 5287 | |
| 5288 | if(pVBInfo->TVInfo & SetPALTV) |
| 5289 | { |
| 5290 | tempbx = tempbx + 2; |
| 5291 | } |
| 5292 | if(pVBInfo->TVInfo & SetCHTVOverScan) |
| 5293 | { |
| 5294 | tempbx++; |
| 5295 | } |
| 5296 | /** tempbx = tempbx << 1; CH7007 ? **/ |
| 5297 | |
| 5298 | /*[Billy]07/05/29 CH7007*/ |
| 5299 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 5300 | { |
| 5301 | switch( tempbx ) |
| 5302 | { |
| 5303 | case 0: |
| 5304 | CHTVVCLKPtr = XGI7007_CHTVVCLKUNTSC ; |
| 5305 | break ; |
| 5306 | case 1: |
| 5307 | CHTVVCLKPtr = XGI7007_CHTVVCLKONTSC ; |
| 5308 | break ; |
| 5309 | case 2: |
| 5310 | CHTVVCLKPtr = XGI7007_CHTVVCLKUPAL ; |
| 5311 | break ; |
| 5312 | case 3: |
| 5313 | CHTVVCLKPtr = XGI7007_CHTVVCLKOPAL ; |
| 5314 | break ; |
| 5315 | default: |
| 5316 | break ; |
| 5317 | |
| 5318 | } |
| 5319 | } |
| 5320 | /*else |
| 5321 | { |
| 5322 | switch( tempbx ) |
| 5323 | { |
| 5324 | case 0: |
| 5325 | CHTVVCLKPtr = pVBInfo->CHTVVCLKUNTSC ; |
| 5326 | break ; |
| 5327 | case 1: |
| 5328 | CHTVVCLKPtr = pVBInfo->CHTVVCLKONTSC ; |
| 5329 | break ; |
| 5330 | case 2: |
| 5331 | CHTVVCLKPtr = pVBInfo->CHTVVCLKUPAL ; |
| 5332 | break ; |
| 5333 | case 3: |
| 5334 | CHTVVCLKPtr = pVBInfo->CHTVVCLKOPAL ; |
| 5335 | break ; |
| 5336 | default: |
| 5337 | break ; |
| 5338 | } |
| 5339 | }*/ |
| 5340 | |
| 5341 | tempal = CHTVVCLKPtr[ tempal ] ; |
| 5342 | return tempal ; |
| 5343 | } |
| 5344 | |
| 5345 | } |
| 5346 | |
| 5347 | tempal = ( UCHAR )XGINew_GetReg2( ( pVBInfo->P3ca + 0x02 ) ) ; |
| 5348 | tempal = tempal >> 2 ; |
| 5349 | tempal &= 0x03 ; |
| 5350 | |
| 5351 | if ( ( pVBInfo->LCDInfo & EnableScalingLCD ) && ( modeflag & Charx8Dot ) ) /* for Dot8 Scaling LCD */ |
| 5352 | tempal = tempal ^ tempal ; /* ; set to VCLK25MHz always */ |
| 5353 | |
| 5354 | if ( ModeNo <= 0x13 ) |
| 5355 | return tempal ; |
| 5356 | |
| 5357 | tempal = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ; |
| 5358 | return tempal ; |
| 5359 | } |
| 5360 | |
| 5361 | |
| 5362 | /* --------------------------------------------------------------------- */ |
| 5363 | /* Function : XGI_GetVCLKLen */ |
| 5364 | /* Input : */ |
| 5365 | /* Output : */ |
| 5366 | /* Description : */ |
| 5367 | /* --------------------------------------------------------------------- */ |
| 5368 | void XGI_GetVCLKLen(UCHAR tempal,UCHAR* di_0,UCHAR* di_1, PVB_DEVICE_INFO pVBInfo) |
| 5369 | { |
| 5370 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) /* [Billy] 2007/05/16 */ |
| 5371 | { |
| 5372 | /* VideoDebugPrint((0, "XGI_GetVCLKLen: pVBInfo->IF_DEF_CH7007==1\n")); */ |
| 5373 | *di_0 = ( UCHAR )XGI_CH7007VCLKData[ tempal ].SR2B ; |
| 5374 | *di_1 = ( UCHAR )XGI_CH7007VCLKData[ tempal ].SR2C ; |
| 5375 | } |
| 5376 | else if ( pVBInfo->VBType & ( VB_XGI301 | VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 5377 | { |
| 5378 | if ( ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) && ( pVBInfo->SetFlag & ProgrammingCRT2 ) ) |
| 5379 | { |
| 5380 | *di_0 = ( UCHAR )XGI_VBVCLKData[ tempal ].SR2B ; |
| 5381 | *di_1 = XGI_VBVCLKData[ tempal ].SR2C ; |
| 5382 | } |
| 5383 | } |
| 5384 | else |
| 5385 | { |
| 5386 | *di_0 = XGI_VCLKData[ tempal ].SR2B ; |
| 5387 | *di_1 = XGI_VCLKData[ tempal ].SR2C ; |
| 5388 | } |
| 5389 | } |
| 5390 | |
| 5391 | |
| 5392 | /* --------------------------------------------------------------------- */ |
| 5393 | /* Function : XGI_SetCRT2Offset */ |
| 5394 | /* Input : */ |
| 5395 | /* Output : */ |
| 5396 | /* Description : */ |
| 5397 | /* --------------------------------------------------------------------- */ |
| 5398 | void XGI_SetCRT2Offset( USHORT ModeNo , |
| 5399 | USHORT ModeIdIndex , USHORT RefreshRateTableIndex , PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo ) |
| 5400 | { |
| 5401 | USHORT offset ; |
| 5402 | UCHAR temp ; |
| 5403 | |
| 5404 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 5405 | { |
| 5406 | return ; |
| 5407 | } |
| 5408 | |
| 5409 | offset = XGI_GetOffset( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
| 5410 | temp = ( UCHAR )( offset & 0xFF ) ; |
| 5411 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , temp ) ; |
| 5412 | temp =( UCHAR)( ( offset & 0xFF00 ) >> 8 ) ; |
| 5413 | XGINew_SetReg1( pVBInfo->Part1Port , 0x09 , temp ) ; |
| 5414 | temp =( UCHAR )( ( ( offset >> 3 ) & 0xFF ) + 1 ) ; |
| 5415 | XGINew_SetReg1( pVBInfo->Part1Port , 0x03 , temp ) ; |
| 5416 | } |
| 5417 | |
| 5418 | |
| 5419 | /* --------------------------------------------------------------------- */ |
| 5420 | /* Function : XGI_GetOffset */ |
| 5421 | /* Input : */ |
| 5422 | /* Output : */ |
| 5423 | /* Description : */ |
| 5424 | /* --------------------------------------------------------------------- */ |
| 5425 | USHORT XGI_GetOffset(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension,PVB_DEVICE_INFO pVBInfo) |
| 5426 | { |
| 5427 | USHORT temp , |
| 5428 | colordepth , |
| 5429 | modeinfo , |
| 5430 | index , |
| 5431 | infoflag , |
| 5432 | ColorDepth[] = { 0x01 , 0x02 , 0x04 } ; |
| 5433 | |
| 5434 | modeinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeInfo ; |
| 5435 | if ( ModeNo <= 0x14 ) |
| 5436 | infoflag = 0 ; |
| 5437 | else |
| 5438 | infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 5439 | |
| 5440 | |
| 5441 | index = ( modeinfo >> 8 ) & 0xFF ; |
| 5442 | |
| 5443 | temp = pVBInfo->ScreenOffset[ index ] ; |
| 5444 | |
| 5445 | if ( infoflag & InterlaceMode ) |
| 5446 | { |
| 5447 | temp = temp << 1 ; |
| 5448 | } |
| 5449 | |
| 5450 | colordepth = XGI_GetColorDepth( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 5451 | |
| 5452 | if ( ( ModeNo >= 0x7C ) && ( ModeNo <= 0x7E ) ) |
| 5453 | { |
| 5454 | temp = ModeNo - 0x7C ; |
| 5455 | colordepth = ColorDepth[ temp ] ; |
| 5456 | temp = 0x6B ; |
| 5457 | if ( infoflag & InterlaceMode ) |
| 5458 | { |
| 5459 | temp = temp << 1 ; |
| 5460 | } |
| 5461 | return( temp * colordepth ) ; |
| 5462 | } |
| 5463 | else |
| 5464 | return( temp * colordepth ) ; |
| 5465 | } |
| 5466 | |
| 5467 | |
| 5468 | /* --------------------------------------------------------------------- */ |
| 5469 | /* Function : XGI_SetCRT2FIFO */ |
| 5470 | /* Input : */ |
| 5471 | /* Output : */ |
| 5472 | /* Description : */ |
| 5473 | /* --------------------------------------------------------------------- */ |
| 5474 | void XGI_SetCRT2FIFO( PVB_DEVICE_INFO pVBInfo) |
| 5475 | { |
| 5476 | XGINew_SetReg1( pVBInfo->Part1Port , 0x01 , 0x3B ) ; /* threshold high ,disable auto threshold */ |
| 5477 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x02 , ~( 0x3F ) , 0x04 ) ; /* threshold low default 04h */ |
| 5478 | } |
| 5479 | |
| 5480 | |
| 5481 | /* --------------------------------------------------------------------- */ |
| 5482 | /* Function : XGI_PreSetGroup1 */ |
| 5483 | /* Input : */ |
| 5484 | /* Output : */ |
| 5485 | /* Description : */ |
| 5486 | /* --------------------------------------------------------------------- */ |
| 5487 | void XGI_PreSetGroup1(USHORT ModeNo , USHORT ModeIdIndex ,PXGI_HW_DEVICE_INFO HwDeviceExtension, |
| 5488 | USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 5489 | { |
| 5490 | USHORT tempcx = 0 , |
| 5491 | CRT1Index = 0 , |
| 5492 | resinfo = 0 ; |
| 5493 | |
| 5494 | if ( ModeNo > 0x13 ) |
| 5495 | { |
| 5496 | CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 5497 | CRT1Index &= IndexMask ; |
| 5498 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 5499 | } |
| 5500 | |
| 5501 | XGI_SetCRT2Offset( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
| 5502 | XGI_SetCRT2FIFO(pVBInfo) ; |
| 5503 | /* XGI_SetCRT2Sync(ModeNo,RefreshRateTableIndex); */ |
| 5504 | |
| 5505 | for( tempcx = 4 ; tempcx < 7 ; tempcx++ ) |
| 5506 | { |
| 5507 | XGINew_SetReg1( pVBInfo->Part1Port , tempcx , 0x0 ) ; |
| 5508 | } |
| 5509 | |
| 5510 | XGINew_SetReg1( pVBInfo->Part1Port , 0x50 , 0x00 ) ; |
| 5511 | XGINew_SetReg1( pVBInfo->Part1Port , 0x02 , 0x44 ) ; /* temp 0206 */ |
| 5512 | } |
| 5513 | |
| 5514 | |
| 5515 | /* --------------------------------------------------------------------- */ |
| 5516 | /* Function : XGI_SetGroup1 */ |
| 5517 | /* Input : */ |
| 5518 | /* Output : */ |
| 5519 | /* Description : */ |
| 5520 | /* --------------------------------------------------------------------- */ |
| 5521 | void XGI_SetGroup1( USHORT ModeNo , USHORT ModeIdIndex , |
| 5522 | PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 5523 | { |
| 5524 | USHORT temp = 0 , |
| 5525 | tempax = 0 , |
| 5526 | tempbx = 0 , |
| 5527 | tempcx = 0 , |
| 5528 | pushbx = 0 , |
| 5529 | CRT1Index = 0 , |
| 5530 | modeflag , |
| 5531 | resinfo = 0 ; |
| 5532 | |
| 5533 | if ( ModeNo > 0x13 ) |
| 5534 | { |
| 5535 | CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 5536 | CRT1Index &= IndexMask ; |
| 5537 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 5538 | } |
| 5539 | |
| 5540 | if ( ModeNo <= 0x13 ) |
| 5541 | { |
| 5542 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 5543 | } |
| 5544 | else |
| 5545 | { |
| 5546 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 5547 | } |
| 5548 | |
| 5549 | /* bainy change table name */ |
| 5550 | if ( modeflag & HalfDCLK ) |
| 5551 | { |
| 5552 | temp = ( pVBInfo->VGAHT / 2 - 1 ) & 0x0FF ; /* BTVGA2HT 0x08,0x09 */ |
| 5553 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , temp ) ; |
| 5554 | temp = ( ( ( pVBInfo->VGAHT / 2 - 1 ) & 0xFF00 ) >> 8 ) << 4 ; |
| 5555 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x09 , ~0x0F0 , temp ) ; |
| 5556 | temp = ( pVBInfo->VGAHDE / 2 + 16 ) & 0x0FF ; /* BTVGA2HDEE 0x0A,0x0C */ |
| 5557 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0A , temp ) ; |
| 5558 | tempcx = ( ( pVBInfo->VGAHT - pVBInfo->VGAHDE ) / 2 ) >> 2 ; |
| 5559 | pushbx = pVBInfo->VGAHDE / 2 + 16 ; |
| 5560 | tempcx = tempcx >> 1 ; |
| 5561 | tempbx = pushbx + tempcx ; /* bx BTVGA@HRS 0x0B,0x0C */ |
| 5562 | tempcx += tempbx ; |
| 5563 | |
| 5564 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 5565 | { |
| 5566 | tempbx = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 4 ] ; |
| 5567 | tempbx |= ( ( pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 14 ] & 0xC0 ) << 2 ) ; |
| 5568 | tempbx = ( tempbx - 3 ) << 3 ; /* (VGAHRS-3)*8 */ |
| 5569 | tempcx = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[ 5 ] ; |
| 5570 | tempcx &= 0x1F ; |
| 5571 | temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 15 ] ; |
| 5572 | temp = ( temp & 0x04 ) << ( 5 - 2 ) ; /* VGAHRE D[5] */ |
| 5573 | tempcx = ( ( tempcx | temp ) - 3 ) << 3 ; /* (VGAHRE-3)*8 */ |
| 5574 | } |
| 5575 | |
| 5576 | tempbx += 4 ; |
| 5577 | tempcx += 4 ; |
| 5578 | |
| 5579 | if ( tempcx > ( pVBInfo->VGAHT / 2 ) ) |
| 5580 | tempcx = pVBInfo->VGAHT / 2 ; |
| 5581 | |
| 5582 | temp = tempbx & 0x00FF ; |
| 5583 | |
| 5584 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0B , temp ) ; |
| 5585 | } |
| 5586 | else |
| 5587 | { |
| 5588 | temp = ( pVBInfo->VGAHT - 1 ) & 0x0FF ; /* BTVGA2HT 0x08,0x09 */ |
| 5589 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , temp ) ; |
| 5590 | temp = ( ( ( pVBInfo->VGAHT - 1 ) & 0xFF00 ) >> 8 ) << 4 ; |
| 5591 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x09 , ~0x0F0 , temp ) ; |
| 5592 | temp = ( pVBInfo->VGAHDE + 16 ) & 0x0FF ; /* BTVGA2HDEE 0x0A,0x0C */ |
| 5593 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0A , temp ) ; |
| 5594 | tempcx = ( pVBInfo->VGAHT - pVBInfo->VGAHDE ) >> 2 ; /* cx */ |
| 5595 | pushbx = pVBInfo->VGAHDE + 16 ; |
| 5596 | tempcx = tempcx >> 1 ; |
| 5597 | tempbx = pushbx + tempcx ; /* bx BTVGA@HRS 0x0B,0x0C */ |
| 5598 | tempcx += tempbx ; |
| 5599 | |
| 5600 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 5601 | { |
| 5602 | tempbx = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 3 ] ; |
| 5603 | tempbx |= ( ( pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 5 ] & 0xC0 ) << 2 ) ; |
| 5604 | tempbx = ( tempbx - 3 ) << 3 ; /* (VGAHRS-3)*8 */ |
| 5605 | tempcx = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 4 ] ; |
| 5606 | tempcx &= 0x1F ; |
| 5607 | temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 6 ] ; |
| 5608 | temp = ( temp & 0x04 ) << ( 5 - 2 ) ; /* VGAHRE D[5] */ |
| 5609 | tempcx = ( ( tempcx | temp ) - 3 ) << 3 ; /* (VGAHRE-3)*8 */ |
| 5610 | tempbx += 16 ; |
| 5611 | tempcx += 16 ; |
| 5612 | } |
| 5613 | |
| 5614 | if ( tempcx > pVBInfo->VGAHT ) |
| 5615 | tempcx = pVBInfo->VGAHT ; |
| 5616 | |
| 5617 | temp = tempbx & 0x00FF ; |
| 5618 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0B , temp ) ; |
| 5619 | } |
| 5620 | |
| 5621 | tempax = ( tempax & 0x00FF ) | ( tempbx & 0xFF00 ) ; |
| 5622 | tempbx = pushbx ; |
| 5623 | tempbx = ( tempbx & 0x00FF ) | ( ( tempbx & 0xFF00 ) << 4 ) ; |
| 5624 | tempax |= ( tempbx & 0xFF00 ) ; |
| 5625 | temp = ( tempax & 0xFF00 ) >> 8 ; |
| 5626 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0C , temp ) ; |
| 5627 | temp = tempcx & 0x00FF ; |
| 5628 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0D , temp ) ; |
| 5629 | tempcx = ( pVBInfo->VGAVT - 1 ) ; |
| 5630 | temp = tempcx & 0x00FF ; |
| 5631 | |
| 5632 | if ( pVBInfo->IF_DEF_CH7005 == 1 ) |
| 5633 | { |
| 5634 | if ( pVBInfo->VBInfo & 0x0C ) |
| 5635 | { |
| 5636 | temp-- ; |
| 5637 | } |
| 5638 | } |
| 5639 | |
| 5640 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0E , temp ) ; |
| 5641 | tempbx = pVBInfo->VGAVDE - 1 ; |
| 5642 | temp = tempbx & 0x00FF ; |
| 5643 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0F , temp ) ; |
| 5644 | temp = ( ( tempbx & 0xFF00 ) << 3 ) >> 8 ; |
| 5645 | temp |= ( ( tempcx & 0xFF00 ) >> 8 ) ; |
| 5646 | XGINew_SetReg1( pVBInfo->Part1Port , 0x12 , temp ) ; |
| 5647 | |
| 5648 | tempax = pVBInfo->VGAVDE ; |
| 5649 | tempbx = pVBInfo->VGAVDE ; |
| 5650 | tempcx = pVBInfo->VGAVT ; |
| 5651 | tempbx = ( pVBInfo->VGAVT + pVBInfo->VGAVDE ) >> 1 ; /* BTVGA2VRS 0x10,0x11 */ |
| 5652 | tempcx = ( ( pVBInfo->VGAVT - pVBInfo->VGAVDE ) >> 4 ) + tempbx + 1 ; /* BTVGA2VRE 0x11 */ |
| 5653 | |
| 5654 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 5655 | { |
| 5656 | tempbx = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 10 ] ; |
| 5657 | temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 9 ] ; |
| 5658 | |
| 5659 | if ( temp & 0x04 ) |
| 5660 | tempbx |= 0x0100 ; |
| 5661 | |
| 5662 | if ( temp & 0x080 ) |
| 5663 | tempbx |= 0x0200 ; |
| 5664 | |
| 5665 | temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 14 ] ; |
| 5666 | |
| 5667 | if ( temp & 0x08 ) |
| 5668 | tempbx |= 0x0400 ; |
| 5669 | |
| 5670 | temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 11 ] ; |
| 5671 | tempcx = ( tempcx & 0xFF00 ) | ( temp & 0x00FF ) ; |
| 5672 | } |
| 5673 | |
| 5674 | temp = tempbx & 0x00FF ; |
| 5675 | XGINew_SetReg1( pVBInfo->Part1Port , 0x10 , temp ) ; |
| 5676 | temp = ( ( tempbx & 0xFF00 ) >> 8 ) << 4 ; |
| 5677 | temp = ( ( tempcx & 0x000F ) | ( temp ) ) ; |
| 5678 | XGINew_SetReg1( pVBInfo->Part1Port , 0x11 , temp ) ; |
| 5679 | tempax = 0 ; |
| 5680 | |
| 5681 | if ( modeflag & DoubleScanMode ) |
| 5682 | tempax |= 0x80 ; |
| 5683 | |
| 5684 | if ( modeflag & HalfDCLK ) |
| 5685 | tempax |= 0x40 ; |
| 5686 | |
| 5687 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2C , ~0x0C0 , tempax ) ; |
| 5688 | } |
| 5689 | |
| 5690 | |
| 5691 | /* --------------------------------------------------------------------- */ |
| 5692 | /* Function : XGI_SetLockRegs */ |
| 5693 | /* Input : */ |
| 5694 | /* Output : */ |
| 5695 | /* Description : */ |
| 5696 | /* --------------------------------------------------------------------- */ |
| 5697 | void XGI_SetLockRegs( USHORT ModeNo , USHORT ModeIdIndex , |
| 5698 | PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 5699 | { |
| 5700 | USHORT push1 , |
| 5701 | push2 , |
| 5702 | tempax , |
| 5703 | tempbx = 0 , |
| 5704 | tempcx , |
| 5705 | temp , |
| 5706 | resinfo , |
| 5707 | modeflag , |
| 5708 | CRT1Index ; |
| 5709 | |
| 5710 | if ( ModeNo <= 0x13 ) |
| 5711 | { |
| 5712 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 5713 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; |
| 5714 | } |
| 5715 | else |
| 5716 | { |
| 5717 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ |
| 5718 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 5719 | CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 5720 | CRT1Index &= IndexMask; |
| 5721 | } |
| 5722 | |
| 5723 | if ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) |
| 5724 | { |
| 5725 | return ; |
| 5726 | } |
| 5727 | |
| 5728 | temp = 0xFF ; /* set MAX HT */ |
| 5729 | XGINew_SetReg1( pVBInfo->Part1Port , 0x03 , temp ) ; |
| 5730 | /* if ( modeflag & Charx8Dot ) tempcx = 0x08 ; */ |
| 5731 | /* else */ |
| 5732 | tempcx=0x08; |
| 5733 | |
| 5734 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 5735 | modeflag |= Charx8Dot ; |
| 5736 | |
| 5737 | tempax = pVBInfo->VGAHDE ; /* 0x04 Horizontal Display End */ |
| 5738 | |
| 5739 | if ( modeflag & HalfDCLK ) |
| 5740 | tempax = tempax >> 1 ; |
| 5741 | |
| 5742 | tempax = ( tempax / tempcx ) - 1 ; |
| 5743 | tempbx |= ( ( tempax & 0x00FF ) << 8 ) ; |
| 5744 | temp = tempax & 0x00FF ; |
| 5745 | XGINew_SetReg1( pVBInfo->Part1Port , 0x04 , temp ) ; |
| 5746 | |
| 5747 | temp = ( tempbx & 0xFF00 ) >> 8 ; |
| 5748 | |
| 5749 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 5750 | { |
| 5751 | if ( !( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) ) |
| 5752 | temp += 2 ; |
| 5753 | |
| 5754 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 5755 | { |
| 5756 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 5757 | { |
| 5758 | if ( pVBInfo->VBExtInfo == VB_YPbPr1080i ) |
| 5759 | { |
| 5760 | if ( resinfo == 7 ) |
| 5761 | temp -= 2 ; |
| 5762 | } |
| 5763 | } |
| 5764 | else |
| 5765 | if ( resinfo == 7 ) |
| 5766 | temp -= 2 ; |
| 5767 | } |
| 5768 | } |
| 5769 | |
| 5770 | XGINew_SetReg1( pVBInfo->Part1Port , 0x05 , temp ) ; /* 0x05 Horizontal Display Start */ |
| 5771 | XGINew_SetReg1( pVBInfo->Part1Port , 0x06 , 0x03 ) ; /* 0x06 Horizontal Blank end */ |
| 5772 | |
| 5773 | if ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) |
| 5774 | { /* 030226 bainy */ |
| 5775 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 5776 | tempax = pVBInfo->VGAHT ; |
| 5777 | else |
| 5778 | tempax = XGI_GetVGAHT2( pVBInfo) ; |
| 5779 | } |
| 5780 | |
| 5781 | if ( tempax >= pVBInfo->VGAHT ) |
| 5782 | { |
| 5783 | tempax = pVBInfo->VGAHT ; |
| 5784 | } |
| 5785 | |
| 5786 | if ( modeflag & HalfDCLK ) |
| 5787 | { |
| 5788 | tempax = tempax >> 1 ; |
| 5789 | } |
| 5790 | |
| 5791 | tempax = ( tempax / tempcx ) - 5 ; |
| 5792 | tempcx = tempax ; /* 20030401 0x07 horizontal Retrace Start */ |
| 5793 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 5794 | { |
| 5795 | temp = ( tempbx & 0x00FF ) - 1 ; |
| 5796 | if ( !( modeflag & HalfDCLK ) ) |
| 5797 | { |
| 5798 | temp -= 6 ; |
| 5799 | if ( pVBInfo->TVInfo & TVSimuMode ) |
| 5800 | { |
| 5801 | temp -= 4 ; |
| 5802 | if ( ModeNo > 0x13 ) |
| 5803 | temp -= 10 ; |
| 5804 | } |
| 5805 | } |
| 5806 | } |
| 5807 | else |
| 5808 | { |
| 5809 | /* tempcx = tempbx & 0x00FF ; */ |
| 5810 | tempbx = ( tempbx & 0xFF00 ) >> 8 ; |
| 5811 | tempcx = ( tempcx + tempbx ) >> 1 ; |
| 5812 | temp = ( tempcx & 0x00FF ) + 2 ; |
| 5813 | |
| 5814 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 5815 | { |
| 5816 | temp -= 1 ; |
| 5817 | if ( !( modeflag & HalfDCLK ) ) |
| 5818 | { |
| 5819 | if ( ( modeflag & Charx8Dot ) ) |
| 5820 | { |
| 5821 | temp += 4 ; |
| 5822 | if ( pVBInfo->VGAHDE >= 800 ) |
| 5823 | { |
| 5824 | temp -= 6 ; |
| 5825 | } |
| 5826 | } |
| 5827 | } |
| 5828 | } |
| 5829 | else |
| 5830 | { |
| 5831 | if ( !( modeflag & HalfDCLK ) ) |
| 5832 | { |
| 5833 | temp -= 4 ; |
| 5834 | if ( pVBInfo->LCDResInfo != Panel1280x960 ) |
| 5835 | { |
| 5836 | if( pVBInfo->VGAHDE >= 800 ) |
| 5837 | { |
| 5838 | temp -= 7 ; |
| 5839 | if ( pVBInfo->ModeType == ModeEGA ) |
| 5840 | { |
| 5841 | if ( pVBInfo->VGAVDE == 1024 ) |
| 5842 | { |
| 5843 | temp += 15 ; |
| 5844 | if ( pVBInfo->LCDResInfo != Panel1280x1024 ) |
| 5845 | { |
| 5846 | temp += 7 ; |
| 5847 | } |
| 5848 | } |
| 5849 | } |
| 5850 | |
| 5851 | if ( pVBInfo->VGAHDE >= 1280 ) |
| 5852 | { |
| 5853 | if ( pVBInfo->LCDResInfo != Panel1280x960 ) |
| 5854 | { |
| 5855 | if ( pVBInfo->LCDInfo & LCDNonExpanding ) |
| 5856 | { |
| 5857 | temp += 28 ; |
| 5858 | } |
| 5859 | } |
| 5860 | } |
| 5861 | } |
| 5862 | } |
| 5863 | } |
| 5864 | } |
| 5865 | } |
| 5866 | |
| 5867 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , temp ) ; /* 0x07 Horizontal Retrace Start */ |
| 5868 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0 ) ; /* 0x08 Horizontal Retrace End */ |
| 5869 | |
| 5870 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 5871 | { |
| 5872 | if ( pVBInfo->TVInfo & TVSimuMode ) |
| 5873 | { |
| 5874 | if ( ( ModeNo == 0x06 ) || ( ModeNo == 0x10 ) || ( ModeNo == 0x11 ) || ( ModeNo == 0x13 ) || ( ModeNo == 0x0F ) ) |
| 5875 | { |
| 5876 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x5b ) ; |
| 5877 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x03 ) ; |
| 5878 | } |
| 5879 | |
| 5880 | if ( ( ModeNo == 0x00 ) || ( ModeNo == 0x01 ) ) |
| 5881 | { |
| 5882 | if ( pVBInfo->TVInfo & SetNTSCTV ) |
| 5883 | { |
| 5884 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x2A ) ; |
| 5885 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x61 ) ; |
| 5886 | } |
| 5887 | else |
| 5888 | { |
| 5889 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x2A ) ; |
| 5890 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x41 ) ; |
| 5891 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0C , 0xF0 ) ; |
| 5892 | } |
| 5893 | } |
| 5894 | |
| 5895 | if ( ( ModeNo == 0x02 ) || ( ModeNo == 0x03 ) || ( ModeNo == 0x07 ) ) |
| 5896 | { |
| 5897 | if ( pVBInfo->TVInfo & SetNTSCTV ) |
| 5898 | { |
| 5899 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x54 ) ; |
| 5900 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x00 ) ; |
| 5901 | } |
| 5902 | else |
| 5903 | { |
| 5904 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x55 ) ; |
| 5905 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x00 ) ; |
| 5906 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0C , 0xF0 ) ; |
| 5907 | } |
| 5908 | } |
| 5909 | |
| 5910 | if ( ( ModeNo == 0x04 ) || ( ModeNo == 0x05 ) || ( ModeNo == 0x0D ) || ( ModeNo == 0x50 ) ) |
| 5911 | { |
| 5912 | if ( pVBInfo->TVInfo & SetNTSCTV ) |
| 5913 | { |
| 5914 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x30 ) ; |
| 5915 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x03 ) ; |
| 5916 | } |
| 5917 | else |
| 5918 | { |
| 5919 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x2f ) ; |
| 5920 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x02 ) ; |
| 5921 | } |
| 5922 | } |
| 5923 | } |
| 5924 | } |
| 5925 | |
| 5926 | XGINew_SetReg1( pVBInfo->Part1Port , 0x18 , 0x03 ) ; /* 0x18 SR0B */ |
| 5927 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x19 , 0xF0 , 0x00 ) ; |
| 5928 | XGINew_SetReg1( pVBInfo->Part1Port , 0x09 , 0xFF ) ; /* 0x09 Set Max VT */ |
| 5929 | |
| 5930 | tempbx = pVBInfo->VGAVT ; |
| 5931 | push1 = tempbx ; |
| 5932 | tempcx = 0x121 ; |
| 5933 | tempbx = pVBInfo->VGAVDE ; /* 0x0E Virtical Display End */ |
| 5934 | |
| 5935 | if ( tempbx == 357 ) |
| 5936 | tempbx = 350 ; |
| 5937 | if ( tempbx == 360 ) |
| 5938 | tempbx =350 ; |
| 5939 | if ( tempbx == 375 ) |
| 5940 | tempbx = 350 ; |
| 5941 | if ( tempbx == 405 ) |
| 5942 | tempbx = 400 ; |
| 5943 | if ( tempbx == 525 ) |
| 5944 | tempbx = 480 ; |
| 5945 | |
| 5946 | push2 = tempbx ; |
| 5947 | |
| 5948 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 5949 | { |
| 5950 | if ( pVBInfo->LCDResInfo == Panel1024x768 ) |
| 5951 | { |
| 5952 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) |
| 5953 | { |
| 5954 | if ( tempbx == 350 ) |
| 5955 | tempbx += 5 ; |
| 5956 | if ( tempbx == 480 ) |
| 5957 | tempbx += 5 ; |
| 5958 | } |
| 5959 | } |
| 5960 | } |
| 5961 | tempbx-- ; |
| 5962 | temp = tempbx & 0x00FF ; |
| 5963 | tempbx-- ; |
| 5964 | temp = tempbx & 0x00FF ; |
| 5965 | XGINew_SetReg1( pVBInfo->Part1Port , 0x10 ,temp ) ; /* 0x10 vertical Blank Start */ |
| 5966 | tempbx = push2 ; |
| 5967 | tempbx-- ; |
| 5968 | temp = tempbx & 0x00FF ; |
| 5969 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0E , temp ) ; |
| 5970 | |
| 5971 | if ( tempbx & 0x0100 ) |
| 5972 | { |
| 5973 | tempcx |= 0x0002 ; |
| 5974 | } |
| 5975 | |
| 5976 | tempax = 0x000B ; |
| 5977 | |
| 5978 | if ( modeflag & DoubleScanMode ) |
| 5979 | { |
| 5980 | tempax |= 0x08000 ; |
| 5981 | } |
| 5982 | |
| 5983 | if ( tempbx & 0x0200 ) |
| 5984 | { |
| 5985 | tempcx |= 0x0040 ; |
| 5986 | } |
| 5987 | |
| 5988 | temp = ( tempax & 0xFF00 ) >> 8 ; |
| 5989 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0B , temp ) ; |
| 5990 | |
| 5991 | if ( tempbx & 0x0400 ) |
| 5992 | { |
| 5993 | tempcx |= 0x0600 ; |
| 5994 | } |
| 5995 | |
| 5996 | XGINew_SetReg1( pVBInfo->Part1Port , 0x11 , 0x00 ) ; /* 0x11 Vertival Blank End */ |
| 5997 | |
| 5998 | tempax = push1 ; |
| 5999 | tempax -= tempbx ; /* 0x0C Vertical Retrace Start */ |
| 6000 | tempax = tempax >> 2 ; |
| 6001 | push1 = tempax ; /* push ax */ |
| 6002 | |
| 6003 | if ( resinfo != 0x09 ) |
| 6004 | { |
| 6005 | tempax = tempax << 1 ; |
| 6006 | tempbx += tempax ; |
| 6007 | } |
| 6008 | |
| 6009 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6010 | { |
| 6011 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 6012 | { |
| 6013 | if ( pVBInfo->TVInfo & SetYPbPrMode1080i ) |
| 6014 | tempbx -= 10 ; |
| 6015 | else |
| 6016 | { |
| 6017 | if ( pVBInfo->TVInfo & TVSimuMode ) |
| 6018 | { |
| 6019 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 6020 | { |
| 6021 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 6022 | { |
| 6023 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) ) |
| 6024 | tempbx += 40 ; |
| 6025 | } |
| 6026 | else |
| 6027 | tempbx += 40 ; |
| 6028 | } |
| 6029 | } |
| 6030 | } |
| 6031 | } |
| 6032 | else |
| 6033 | tempbx -= 10 ; |
| 6034 | } |
| 6035 | else |
| 6036 | { |
| 6037 | if ( pVBInfo->TVInfo & TVSimuMode ) |
| 6038 | { |
| 6039 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 6040 | { |
| 6041 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 6042 | { |
| 6043 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) ) |
| 6044 | tempbx += 40 ; |
| 6045 | } |
| 6046 | else |
| 6047 | tempbx += 40 ; |
| 6048 | } |
| 6049 | } |
| 6050 | } |
| 6051 | tempax = push1 ; |
| 6052 | tempax = tempax >> 2 ; |
| 6053 | tempax++ ; |
| 6054 | tempax += tempbx ; |
| 6055 | push1 = tempax ; /* push ax */ |
| 6056 | |
| 6057 | if ( ( pVBInfo->TVInfo & SetPALTV ) ) |
| 6058 | { |
| 6059 | if ( tempbx <= 513 ) |
| 6060 | { |
| 6061 | if ( tempax >= 513 ) |
| 6062 | { |
| 6063 | tempbx = 513 ; |
| 6064 | } |
| 6065 | } |
| 6066 | } |
| 6067 | |
| 6068 | temp = tempbx & 0x00FF ; |
| 6069 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0C , temp ) ; |
| 6070 | tempbx-- ; |
| 6071 | temp = tempbx & 0x00FF ; |
| 6072 | XGINew_SetReg1( pVBInfo->Part1Port , 0x10 , temp ) ; |
| 6073 | |
| 6074 | if ( tempbx & 0x0100 ) |
| 6075 | { |
| 6076 | tempcx |= 0x0008 ; |
| 6077 | } |
| 6078 | |
| 6079 | if ( tempbx & 0x0200 ) |
| 6080 | { |
| 6081 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x0B , 0x0FF , 0x20 ) ; |
| 6082 | } |
| 6083 | |
| 6084 | tempbx++ ; |
| 6085 | |
| 6086 | if ( tempbx & 0x0100 ) |
| 6087 | { |
| 6088 | tempcx |= 0x0004 ; |
| 6089 | } |
| 6090 | |
| 6091 | if ( tempbx & 0x0200 ) |
| 6092 | { |
| 6093 | tempcx |= 0x0080 ; |
| 6094 | } |
| 6095 | |
| 6096 | if ( tempbx & 0x0400 ) |
| 6097 | { |
| 6098 | tempcx |= 0x0C00 ; |
| 6099 | } |
| 6100 | |
| 6101 | tempbx = push1 ; /* pop ax */ |
| 6102 | temp = tempbx & 0x00FF ; |
| 6103 | temp &= 0x0F ; |
| 6104 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0D , temp ) ; /* 0x0D vertical Retrace End */ |
| 6105 | |
| 6106 | if ( tempbx & 0x0010 ) |
| 6107 | { |
| 6108 | tempcx |= 0x2000 ; |
| 6109 | } |
| 6110 | |
| 6111 | temp = tempcx & 0x00FF ; |
| 6112 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0A , temp ) ; /* 0x0A CR07 */ |
| 6113 | temp = ( tempcx & 0x0FF00 ) >> 8 ; |
| 6114 | XGINew_SetReg1( pVBInfo->Part1Port , 0x17 , temp ) ; /* 0x17 SR0A */ |
| 6115 | tempax = modeflag ; |
| 6116 | temp = ( tempax & 0xFF00 ) >> 8 ; |
| 6117 | |
| 6118 | temp = ( temp >> 1 ) & 0x09 ; |
| 6119 | |
| 6120 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6121 | temp |= 0x01 ; |
| 6122 | |
| 6123 | XGINew_SetReg1( pVBInfo->Part1Port , 0x16 , temp ) ; /* 0x16 SR01 */ |
| 6124 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0F , 0 ) ; /* 0x0F CR14 */ |
| 6125 | XGINew_SetReg1( pVBInfo->Part1Port , 0x12 , 0 ) ; /* 0x12 CR17 */ |
| 6126 | |
| 6127 | if ( pVBInfo->LCDInfo & LCDRGB18Bit ) |
| 6128 | temp = 0x80 ; |
| 6129 | else |
| 6130 | temp = 0x00 ; |
| 6131 | |
| 6132 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1A , temp ) ; /* 0x1A SR0E */ |
| 6133 | |
| 6134 | return ; |
| 6135 | } |
| 6136 | |
| 6137 | |
| 6138 | /* --------------------------------------------------------------------- */ |
| 6139 | /* Function : XGI_SetGroup2 */ |
| 6140 | /* Input : */ |
| 6141 | /* Output : */ |
| 6142 | /* Description : */ |
| 6143 | /* --------------------------------------------------------------------- */ |
| 6144 | void XGI_SetGroup2( USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, |
| 6145 | PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo ) |
| 6146 | { |
| 6147 | USHORT i , |
| 6148 | j , |
| 6149 | tempax , |
| 6150 | tempbx , |
| 6151 | tempcx , |
| 6152 | temp , |
| 6153 | push1 , |
| 6154 | push2 , |
| 6155 | modeflag , |
| 6156 | resinfo , |
| 6157 | crt2crtc ; |
| 6158 | UCHAR *TimingPoint ; |
| 6159 | |
| 6160 | ULONG longtemp , |
| 6161 | tempeax , |
| 6162 | tempebx , |
| 6163 | temp2 , |
| 6164 | tempecx ; |
| 6165 | |
| 6166 | if ( ModeNo <= 0x13 ) |
| 6167 | { |
| 6168 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 6169 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; |
| 6170 | crt2crtc = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; |
| 6171 | } |
| 6172 | else |
| 6173 | { |
| 6174 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ |
| 6175 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 6176 | crt2crtc = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ; |
| 6177 | } |
| 6178 | |
| 6179 | tempax = 0 ; |
| 6180 | |
| 6181 | if ( !( pVBInfo->VBInfo & SetCRT2ToAVIDEO ) ) |
| 6182 | tempax |= 0x0800 ; |
| 6183 | |
| 6184 | if ( !( pVBInfo->VBInfo & SetCRT2ToSVIDEO ) ) |
| 6185 | tempax |= 0x0400 ; |
| 6186 | |
| 6187 | if ( pVBInfo->VBInfo & SetCRT2ToSCART ) |
| 6188 | tempax |= 0x0200 ; |
| 6189 | |
| 6190 | if ( !( pVBInfo->TVInfo & SetPALTV ) ) |
| 6191 | tempax |= 0x1000 ; |
| 6192 | |
| 6193 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6194 | tempax |= 0x0100 ; |
| 6195 | |
| 6196 | if ( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) |
| 6197 | tempax &= 0xfe00 ; |
| 6198 | |
| 6199 | tempax = ( tempax & 0xff00 ) >> 8 ; |
| 6200 | |
| 6201 | XGINew_SetReg1( pVBInfo->Part2Port , 0x0 , tempax ) ; |
| 6202 | TimingPoint = pVBInfo->NTSCTiming ; |
| 6203 | |
| 6204 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 6205 | { |
| 6206 | TimingPoint = pVBInfo->PALTiming ; |
| 6207 | } |
| 6208 | |
| 6209 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6210 | { |
| 6211 | TimingPoint = pVBInfo->HiTVExtTiming ; |
| 6212 | |
| 6213 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 6214 | TimingPoint = pVBInfo->HiTVSt2Timing ; |
| 6215 | |
| 6216 | if ( pVBInfo->SetFlag & TVSimuMode ) |
| 6217 | TimingPoint = pVBInfo->HiTVSt1Timing ; |
| 6218 | |
| 6219 | if ( !(modeflag & Charx8Dot) ) |
| 6220 | TimingPoint = pVBInfo->HiTVTextTiming ; |
| 6221 | } |
| 6222 | |
| 6223 | if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) |
| 6224 | { |
| 6225 | if ( pVBInfo->TVInfo & SetYPbPrMode525i ) |
| 6226 | TimingPoint = pVBInfo->YPbPr525iTiming ; |
| 6227 | |
| 6228 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) |
| 6229 | TimingPoint = pVBInfo->YPbPr525pTiming ; |
| 6230 | |
| 6231 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) |
| 6232 | TimingPoint = pVBInfo->YPbPr750pTiming ; |
| 6233 | } |
| 6234 | |
| 6235 | for( i = 0x01 , j = 0 ; i <= 0x2D ; i++ , j++ ) |
| 6236 | { |
| 6237 | XGINew_SetReg1( pVBInfo->Part2Port , i , TimingPoint[ j ] ) ; |
| 6238 | } |
| 6239 | |
| 6240 | for( i = 0x39 ; i <= 0x45 ; i++ , j++ ) |
| 6241 | { |
| 6242 | XGINew_SetReg1( pVBInfo->Part2Port , i , TimingPoint[ j ] ) ; /* di->temp2[j] */ |
| 6243 | } |
| 6244 | |
| 6245 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 6246 | { |
| 6247 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x3A , 0x1F , 0x00 ) ; |
| 6248 | } |
| 6249 | |
| 6250 | temp = pVBInfo->NewFlickerMode ; |
| 6251 | temp &= 0x80 ; |
| 6252 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x0A , 0xFF , temp ) ; |
| 6253 | |
| 6254 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6255 | tempax = 950 ; |
| 6256 | |
| 6257 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 6258 | tempax = 520 ; |
| 6259 | else |
| 6260 | tempax = 440 ; |
| 6261 | |
| 6262 | if ( pVBInfo->VDE <= tempax ) |
| 6263 | { |
| 6264 | tempax -= pVBInfo->VDE ; |
| 6265 | tempax = tempax >> 2 ; |
| 6266 | tempax = ( tempax & 0x00FF ) | ( ( tempax & 0x00FF ) << 8 ) ; |
| 6267 | push1 = tempax ; |
| 6268 | temp = ( tempax & 0xFF00 ) >> 8 ; |
| 6269 | temp += ( USHORT )TimingPoint[ 0 ] ; |
| 6270 | |
| 6271 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6272 | { |
| 6273 | if ( pVBInfo->VBInfo & ( SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | SetCRT2ToSCART | SetCRT2ToYPbPr ) ) |
| 6274 | { |
| 6275 | tempcx=pVBInfo->VGAHDE; |
| 6276 | if ( tempcx >= 1024 ) |
| 6277 | { |
| 6278 | temp = 0x17 ; /* NTSC */ |
| 6279 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 6280 | temp = 0x19 ; /* PAL */ |
| 6281 | } |
| 6282 | } |
| 6283 | } |
| 6284 | |
| 6285 | XGINew_SetReg1( pVBInfo->Part2Port , 0x01 , temp ) ; |
| 6286 | tempax = push1 ; |
| 6287 | temp = ( tempax & 0xFF00 ) >> 8 ; |
| 6288 | temp += TimingPoint[ 1 ] ; |
| 6289 | |
| 6290 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6291 | { |
| 6292 | if ( ( pVBInfo->VBInfo & ( SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | SetCRT2ToSCART | SetCRT2ToYPbPr ) ) ) |
| 6293 | { |
| 6294 | tempcx = pVBInfo->VGAHDE ; |
| 6295 | if ( tempcx >= 1024 ) |
| 6296 | { |
| 6297 | temp = 0x1D ; /* NTSC */ |
| 6298 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 6299 | temp = 0x52 ; /* PAL */ |
| 6300 | } |
| 6301 | } |
| 6302 | } |
| 6303 | XGINew_SetReg1( pVBInfo->Part2Port , 0x02 , temp ) ; |
| 6304 | } |
| 6305 | |
| 6306 | /* 301b */ |
| 6307 | tempcx = pVBInfo->HT ; |
| 6308 | |
| 6309 | if ( XGI_IsLCDDualLink( pVBInfo ) ) |
| 6310 | tempcx = tempcx >> 1 ; |
| 6311 | |
| 6312 | tempcx -= 2 ; |
| 6313 | temp = tempcx & 0x00FF ; |
| 6314 | XGINew_SetReg1( pVBInfo->Part2Port , 0x1B , temp ) ; |
| 6315 | |
| 6316 | temp = ( tempcx & 0xFF00 ) >> 8 ; |
| 6317 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x1D , ~0x0F , temp ) ; |
| 6318 | |
| 6319 | tempcx = pVBInfo->HT >> 1 ; |
| 6320 | push1 = tempcx ; /* push cx */ |
| 6321 | tempcx += 7 ; |
| 6322 | |
| 6323 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6324 | { |
| 6325 | tempcx -= 4 ; |
| 6326 | } |
| 6327 | |
| 6328 | temp = tempcx & 0x00FF ; |
| 6329 | temp = temp << 4 ; |
| 6330 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x22 , 0x0F , temp ) ; |
| 6331 | |
| 6332 | tempbx = TimingPoint[ j ] | ( ( TimingPoint[ j + 1 ] ) << 8 ) ; |
| 6333 | tempbx += tempcx ; |
| 6334 | push2 = tempbx ; |
| 6335 | temp = tempbx & 0x00FF ; |
| 6336 | XGINew_SetReg1( pVBInfo->Part2Port , 0x24 , temp ) ; |
| 6337 | temp = ( tempbx & 0xFF00 ) >> 8 ; |
| 6338 | temp = temp << 4 ; |
| 6339 | XGINew_SetRegANDOR(pVBInfo->Part2Port,0x25,0x0F,temp); |
| 6340 | |
| 6341 | tempbx=push2; |
| 6342 | tempbx=tempbx+8; |
| 6343 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6344 | { |
| 6345 | tempbx=tempbx-4; |
| 6346 | tempcx=tempbx; |
| 6347 | } |
| 6348 | |
| 6349 | temp = ( tempbx & 0x00FF ) << 4 ; |
| 6350 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x29 , 0x0F , temp ) ; |
| 6351 | |
| 6352 | j += 2 ; |
| 6353 | tempcx += ( TimingPoint[ j ] | ( ( TimingPoint[ j + 1 ] ) << 8 ) ) ; |
| 6354 | temp = tempcx & 0x00FF ; |
| 6355 | XGINew_SetReg1( pVBInfo->Part2Port , 0x27 , temp ) ; |
| 6356 | temp = ( ( tempcx & 0xFF00 ) >> 8 ) << 4 ; |
| 6357 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x28 , 0x0F , temp ) ; |
| 6358 | |
| 6359 | tempcx += 8 ; |
| 6360 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6361 | { |
| 6362 | tempcx -= 4 ; |
| 6363 | } |
| 6364 | |
| 6365 | temp = tempcx & 0xFF ; |
| 6366 | temp = temp << 4 ; |
| 6367 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x2A , 0x0F , temp ) ; |
| 6368 | |
| 6369 | tempcx = push1 ; /* pop cx */ |
| 6370 | j += 2 ; |
| 6371 | temp = TimingPoint[ j ] | ( ( TimingPoint[ j + 1 ] ) << 8 ) ; |
| 6372 | tempcx -= temp ; |
| 6373 | temp = tempcx & 0x00FF ; |
| 6374 | temp = temp << 4 ; |
| 6375 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x2D , 0x0F ,temp ) ; |
| 6376 | |
| 6377 | tempcx -= 11 ; |
| 6378 | |
| 6379 | if ( !( pVBInfo->VBInfo & SetCRT2ToTV ) ) |
| 6380 | { |
| 6381 | tempax = XGI_GetVGAHT2( pVBInfo) ; |
| 6382 | tempcx = tempax - 1 ; |
| 6383 | } |
| 6384 | temp = tempcx & 0x00FF ; |
| 6385 | XGINew_SetReg1( pVBInfo->Part2Port , 0x2E , temp ) ; |
| 6386 | |
| 6387 | tempbx = pVBInfo->VDE ; |
| 6388 | |
| 6389 | if ( pVBInfo->VGAVDE == 360 ) |
| 6390 | tempbx = 746 ; |
| 6391 | if ( pVBInfo->VGAVDE == 375 ) |
| 6392 | tempbx = 746 ; |
| 6393 | if ( pVBInfo->VGAVDE == 405 ) |
| 6394 | tempbx = 853 ; |
| 6395 | |
| 6396 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 6397 | { |
| 6398 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6399 | { |
| 6400 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) |
| 6401 | tempbx = tempbx >> 1 ; |
| 6402 | } |
| 6403 | else |
| 6404 | tempbx = tempbx >> 1 ; |
| 6405 | } |
| 6406 | |
| 6407 | tempbx -= 2 ; |
| 6408 | temp = tempbx & 0x00FF ; |
| 6409 | |
| 6410 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6411 | { |
| 6412 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 6413 | { |
| 6414 | if ( pVBInfo->TVInfo & SetYPbPrMode1080i ) |
| 6415 | { |
| 6416 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 6417 | { |
| 6418 | if ( ModeNo == 0x2f ) |
| 6419 | temp += 1 ; |
| 6420 | } |
| 6421 | } |
| 6422 | } |
| 6423 | else |
| 6424 | { |
| 6425 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 6426 | { |
| 6427 | if ( ModeNo == 0x2f ) |
| 6428 | temp += 1 ; |
| 6429 | } |
| 6430 | } |
| 6431 | } |
| 6432 | |
| 6433 | XGINew_SetReg1( pVBInfo->Part2Port , 0x2F , temp ) ; |
| 6434 | |
| 6435 | temp = ( tempcx & 0xFF00 ) >> 8 ; |
| 6436 | temp |= ( ( tempbx & 0xFF00 ) >> 8 ) << 6 ; |
| 6437 | |
| 6438 | if ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) ) |
| 6439 | { |
| 6440 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 6441 | { |
| 6442 | if ( pVBInfo->TVInfo & SetYPbPrMode1080i ) |
| 6443 | { |
| 6444 | temp |= 0x10 ; |
| 6445 | |
| 6446 | if ( !( pVBInfo->VBInfo & SetCRT2ToSVIDEO ) ) |
| 6447 | temp |= 0x20 ; |
| 6448 | } |
| 6449 | } |
| 6450 | else |
| 6451 | { |
| 6452 | temp |= 0x10 ; |
| 6453 | if ( !( pVBInfo->VBInfo & SetCRT2ToSVIDEO ) ) |
| 6454 | temp |= 0x20 ; |
| 6455 | } |
| 6456 | } |
| 6457 | |
| 6458 | XGINew_SetReg1( pVBInfo->Part2Port , 0x30 , temp ) ; |
| 6459 | |
| 6460 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) /* TV gatingno */ |
| 6461 | { |
| 6462 | tempbx = pVBInfo->VDE ; |
| 6463 | tempcx = tempbx - 2 ; |
| 6464 | |
| 6465 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 6466 | { |
| 6467 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) |
| 6468 | tempbx = tempbx >> 1 ; |
| 6469 | } |
| 6470 | |
| 6471 | if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) ) |
| 6472 | { |
| 6473 | temp=0; |
| 6474 | if( tempcx & 0x0400 ) |
| 6475 | temp |= 0x20 ; |
| 6476 | |
| 6477 | if ( tempbx & 0x0400 ) |
| 6478 | temp |= 0x40 ; |
| 6479 | |
| 6480 | XGINew_SetReg1( pVBInfo->Part4Port , 0x10 , temp ) ; |
| 6481 | } |
| 6482 | |
| 6483 | temp = ( ( ( tempbx - 3 ) & 0x0300 ) >> 8 ) << 5 ; |
| 6484 | XGINew_SetReg1( pVBInfo->Part2Port , 0x46 , temp ) ; |
| 6485 | temp = ( tempbx - 3 ) & 0x00FF ; |
| 6486 | XGINew_SetReg1( pVBInfo->Part2Port , 0x47 , temp ) ; |
| 6487 | } |
| 6488 | |
| 6489 | tempbx = tempbx & 0x00FF ; |
| 6490 | |
| 6491 | if ( !( modeflag & HalfDCLK ) ) |
| 6492 | { |
| 6493 | tempcx = pVBInfo->VGAHDE ; |
| 6494 | if ( tempcx >= pVBInfo->HDE ) |
| 6495 | { |
| 6496 | tempbx |= 0x2000 ; |
| 6497 | tempax &= 0x00FF ; |
| 6498 | } |
| 6499 | } |
| 6500 | |
| 6501 | tempcx = 0x0101 ; |
| 6502 | |
| 6503 | if( pVBInfo->VBInfo & SetCRT2ToTV ) { /*301b*/ |
| 6504 | if(pVBInfo->VGAHDE>=1024) |
| 6505 | { |
| 6506 | tempcx=0x1920; |
| 6507 | if(pVBInfo->VGAHDE>=1280) |
| 6508 | { |
| 6509 | tempcx=0x1420; |
| 6510 | tempbx=tempbx&0xDFFF; |
| 6511 | } |
| 6512 | } |
| 6513 | } |
| 6514 | |
| 6515 | if ( !( tempbx & 0x2000 ) ) |
| 6516 | { |
| 6517 | if ( modeflag & HalfDCLK ) |
| 6518 | { |
| 6519 | tempcx = ( tempcx & 0xFF00 ) | ( ( tempcx & 0x00FF ) << 1 ) ; |
| 6520 | } |
| 6521 | |
| 6522 | push1 = tempbx ; |
| 6523 | tempeax = pVBInfo->VGAHDE ; |
| 6524 | tempebx = ( tempcx & 0xFF00 ) >> 8 ; |
| 6525 | longtemp = tempeax * tempebx ; |
| 6526 | tempecx = tempcx & 0x00FF ; |
| 6527 | longtemp = longtemp / tempecx ; |
| 6528 | |
| 6529 | /* 301b */ |
| 6530 | tempecx = 8 * 1024 ; |
| 6531 | |
| 6532 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6533 | { |
| 6534 | tempecx = tempecx * 8 ; |
| 6535 | } |
| 6536 | |
| 6537 | longtemp = longtemp * tempecx ; |
| 6538 | tempecx = pVBInfo->HDE ; |
| 6539 | temp2 = longtemp % tempecx ; |
| 6540 | tempeax = longtemp / tempecx ; |
| 6541 | if ( temp2 != 0 ) |
| 6542 | { |
| 6543 | tempeax += 1 ; |
| 6544 | } |
| 6545 | |
| 6546 | tempax = ( USHORT )tempeax ; |
| 6547 | |
| 6548 | /* 301b */ |
| 6549 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6550 | { |
| 6551 | tempcx = ( ( tempax & 0xFF00 ) >> 5 ) >> 8 ; |
| 6552 | } |
| 6553 | /* end 301b */ |
| 6554 | |
| 6555 | tempbx = push1 ; |
| 6556 | tempbx =( USHORT )( ( ( tempeax & 0x0000FF00 ) & 0x1F00 ) | ( tempbx & 0x00FF ) ) ; |
| 6557 | tempax =( USHORT )( ( ( tempeax & 0x000000FF ) << 8 ) | ( tempax & 0x00FF ) ) ; |
| 6558 | temp = ( tempax & 0xFF00 ) >> 8 ; |
| 6559 | } |
| 6560 | else |
| 6561 | { |
| 6562 | temp = ( tempax & 0x00FF ) >> 8 ; |
| 6563 | } |
| 6564 | |
| 6565 | XGINew_SetReg1( pVBInfo->Part2Port , 0x44 , temp ) ; |
| 6566 | temp = ( tempbx & 0xFF00 ) >> 8 ; |
| 6567 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x45 , ~0x03F , temp ) ; |
| 6568 | temp = tempcx & 0x00FF ; |
| 6569 | |
| 6570 | if ( tempbx & 0x2000 ) |
| 6571 | temp = 0 ; |
| 6572 | |
| 6573 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCD ) ) |
| 6574 | temp |= 0x18 ; |
| 6575 | |
| 6576 | XGINew_SetRegANDOR(pVBInfo->Part2Port,0x46,~0x1F,temp); |
| 6577 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 6578 | { |
| 6579 | tempbx = 0x0382 ; |
| 6580 | tempcx = 0x007e ; |
| 6581 | } |
| 6582 | else |
| 6583 | { |
| 6584 | tempbx = 0x0369 ; |
| 6585 | tempcx = 0x0061 ; |
| 6586 | } |
| 6587 | |
| 6588 | temp = tempbx & 0x00FF ; |
| 6589 | XGINew_SetReg1( pVBInfo->Part2Port , 0x4b , temp ) ; |
| 6590 | temp = tempcx & 0x00FF ; |
| 6591 | XGINew_SetReg1( pVBInfo->Part2Port , 0x4c , temp ) ; |
| 6592 | |
| 6593 | temp = ( ( tempcx & 0xFF00 ) >> 8 ) & 0x03 ; |
| 6594 | temp = temp << 2 ; |
| 6595 | temp |= ( ( tempbx & 0xFF00 ) >> 8 ) & 0x03 ; |
| 6596 | |
| 6597 | if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) |
| 6598 | { |
| 6599 | temp |= 0x10 ; |
| 6600 | |
| 6601 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) |
| 6602 | temp |= 0x20 ; |
| 6603 | |
| 6604 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) |
| 6605 | temp |= 0x60 ; |
| 6606 | } |
| 6607 | |
| 6608 | XGINew_SetReg1( pVBInfo->Part2Port , 0x4d , temp ) ; |
| 6609 | temp=XGINew_GetReg1( pVBInfo->Part2Port , 0x43 ) ; /* 301b change */ |
| 6610 | XGINew_SetReg1( pVBInfo->Part2Port , 0x43 , ( USHORT )( temp - 3 ) ) ; |
| 6611 | |
| 6612 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) |
| 6613 | { |
| 6614 | if ( pVBInfo->TVInfo & NTSC1024x768 ) |
| 6615 | { |
| 6616 | TimingPoint = XGI_NTSC1024AdjTime ; |
| 6617 | for( i = 0x1c , j = 0 ; i <= 0x30 ; i++ , j++ ) |
| 6618 | { |
| 6619 | XGINew_SetReg1( pVBInfo->Part2Port , i , TimingPoint[ j ] ) ; |
| 6620 | } |
| 6621 | XGINew_SetReg1( pVBInfo->Part2Port , 0x43 , 0x72 ) ; |
| 6622 | } |
| 6623 | } |
| 6624 | |
| 6625 | /* [ycchen] 01/14/03 Modify for 301C PALM Support */ |
| 6626 | if ( pVBInfo->VBType & VB_XGI301C ) |
| 6627 | { |
| 6628 | if ( pVBInfo->TVInfo & SetPALMTV ) |
| 6629 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x4E , ~0x08 , 0x08 ) ; /* PALM Mode */ |
| 6630 | } |
| 6631 | |
| 6632 | if ( pVBInfo->TVInfo & SetPALMTV ) |
| 6633 | { |
| 6634 | tempax = ( UCHAR )XGINew_GetReg1( pVBInfo->Part2Port , 0x01 ) ; |
| 6635 | tempax-- ; |
| 6636 | XGINew_SetRegAND( pVBInfo->Part2Port , 0x01 , tempax ) ; |
| 6637 | |
| 6638 | /* if ( !( pVBInfo->VBType & VB_XGI301C ) ) */ |
| 6639 | XGINew_SetRegAND( pVBInfo->Part2Port , 0x00 , 0xEF ) ; |
| 6640 | } |
| 6641 | |
| 6642 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6643 | { |
| 6644 | if ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) |
| 6645 | { |
| 6646 | XGINew_SetReg1( pVBInfo->Part2Port , 0x0B , 0x00 ) ; |
| 6647 | } |
| 6648 | } |
| 6649 | |
| 6650 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 6651 | { |
| 6652 | return ; |
| 6653 | } |
| 6654 | } |
| 6655 | |
| 6656 | |
| 6657 | /* --------------------------------------------------------------------- */ |
| 6658 | /* Function : XGI_SetLCDRegs */ |
| 6659 | /* Input : */ |
| 6660 | /* Output : */ |
| 6661 | /* Description : */ |
| 6662 | /* --------------------------------------------------------------------- */ |
| 6663 | void XGI_SetLCDRegs(USHORT ModeNo,USHORT ModeIdIndex, PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo) |
| 6664 | { |
| 6665 | USHORT push1 , |
| 6666 | push2 , |
| 6667 | pushbx , |
| 6668 | tempax , |
| 6669 | tempbx , |
| 6670 | tempcx , |
| 6671 | temp , |
| 6672 | tempah , |
| 6673 | tempbh , |
| 6674 | tempch , |
| 6675 | resinfo , |
| 6676 | modeflag , |
| 6677 | CRT1Index ; |
| 6678 | |
| 6679 | XGI_LCDDesStruct *LCDBDesPtr = NULL ; |
| 6680 | |
| 6681 | |
| 6682 | if ( ModeNo <= 0x13 ) |
| 6683 | { |
| 6684 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 6685 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; |
| 6686 | } |
| 6687 | else |
| 6688 | { |
| 6689 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ |
| 6690 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 6691 | CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 6692 | CRT1Index &= IndexMask ; |
| 6693 | } |
| 6694 | |
| 6695 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCD ) ) |
| 6696 | { |
| 6697 | return ; |
| 6698 | } |
| 6699 | |
| 6700 | tempbx = pVBInfo->HDE ; /* RHACTE=HDE-1 */ |
| 6701 | |
| 6702 | if ( XGI_IsLCDDualLink( pVBInfo ) ) |
| 6703 | tempbx = tempbx >> 1 ; |
| 6704 | |
| 6705 | tempbx -= 1 ; |
| 6706 | temp = tempbx & 0x00FF ; |
| 6707 | XGINew_SetReg1( pVBInfo->Part2Port , 0x2C , temp ) ; |
| 6708 | temp = ( tempbx & 0xFF00 ) >> 8 ; |
| 6709 | temp = temp << 4 ; |
| 6710 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x2B , 0x0F , temp ) ; |
| 6711 | temp = 0x01 ; |
| 6712 | |
| 6713 | if ( pVBInfo->LCDResInfo == Panel1280x1024 ) |
| 6714 | { |
| 6715 | if ( pVBInfo->ModeType == ModeEGA ) |
| 6716 | { |
| 6717 | if ( pVBInfo->VGAHDE >= 1024 ) |
| 6718 | { |
| 6719 | temp = 0x02 ; |
| 6720 | if ( pVBInfo->LCDInfo & LCDVESATiming ) |
| 6721 | temp = 0x01 ; |
| 6722 | } |
| 6723 | } |
| 6724 | } |
| 6725 | |
| 6726 | XGINew_SetReg1( pVBInfo->Part2Port , 0x0B , temp ) ; |
| 6727 | tempbx = pVBInfo->VDE ; /* RTVACTEO=(VDE-1)&0xFF */ |
| 6728 | push1 = tempbx ; |
| 6729 | tempbx-- ; |
| 6730 | temp = tempbx & 0x00FF ; |
| 6731 | XGINew_SetReg1( pVBInfo->Part2Port , 0x03 , temp ) ; |
| 6732 | temp = ( ( tempbx & 0xFF00 ) >> 8 ) & 0x07 ; |
| 6733 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x0C , ~0x07 , temp ) ; |
| 6734 | |
| 6735 | tempcx = pVBInfo->VT - 1 ; |
| 6736 | push2 = tempcx + 1 ; |
| 6737 | temp = tempcx & 0x00FF ; /* RVTVT=VT-1 */ |
| 6738 | XGINew_SetReg1( pVBInfo->Part2Port , 0x19 , temp ) ; |
| 6739 | temp = ( tempcx & 0xFF00 ) >> 8 ; |
| 6740 | temp = temp << 5 ; |
| 6741 | XGINew_SetReg1( pVBInfo->Part2Port , 0x1A , temp ) ; |
| 6742 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x09 , 0xF0 , 0x00 ) ; |
| 6743 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x0A , 0xF0 , 0x00 ) ; |
| 6744 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x17 , 0xFB , 0x00 ) ; |
| 6745 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x18 , 0xDF , 0x00 ) ; |
| 6746 | |
| 6747 | /* Customized LCDB Des no add */ |
| 6748 | tempbx = 5 ; |
| 6749 | LCDBDesPtr = ( XGI_LCDDesStruct * )XGI_GetLcdPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 6750 | tempah = pVBInfo->LCDResInfo ; |
| 6751 | tempah &= PanelResInfo ; |
| 6752 | |
| 6753 | if ( ( tempah == Panel1024x768 ) || ( tempah == Panel1024x768x75 ) ) |
| 6754 | { |
| 6755 | tempbx = 1024 ; |
| 6756 | tempcx = 768 ; |
| 6757 | } |
| 6758 | else if ( ( tempah == Panel1280x1024 ) || ( tempah == Panel1280x1024x75 ) ) |
| 6759 | { |
| 6760 | tempbx = 1280 ; |
| 6761 | tempcx = 1024 ; |
| 6762 | } |
| 6763 | else if ( tempah == Panel1400x1050 ) |
| 6764 | { |
| 6765 | tempbx = 1400 ; |
| 6766 | tempcx = 1050 ; |
| 6767 | } |
| 6768 | else |
| 6769 | { |
| 6770 | tempbx = 1600 ; |
| 6771 | tempcx = 1200 ; |
| 6772 | } |
| 6773 | |
| 6774 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 6775 | { |
| 6776 | tempbx = pVBInfo->HDE ; |
| 6777 | tempcx = pVBInfo->VDE ; |
| 6778 | } |
| 6779 | |
| 6780 | pushbx = tempbx ; |
| 6781 | tempax = pVBInfo->VT ; |
| 6782 | pVBInfo->LCDHDES = LCDBDesPtr->LCDHDES ; |
| 6783 | pVBInfo->LCDHRS = LCDBDesPtr->LCDHRS ; |
| 6784 | pVBInfo->LCDVDES = LCDBDesPtr->LCDVDES ; |
| 6785 | pVBInfo->LCDVRS = LCDBDesPtr->LCDVRS ; |
| 6786 | tempbx = pVBInfo->LCDVDES ; |
| 6787 | tempcx += tempbx ; |
| 6788 | |
| 6789 | if ( tempcx >= tempax ) |
| 6790 | tempcx -= tempax ; /* lcdvdes */ |
| 6791 | |
| 6792 | temp = tempbx & 0x00FF ; /* RVEQ1EQ=lcdvdes */ |
| 6793 | XGINew_SetReg1( pVBInfo->Part2Port , 0x05 , temp ) ; |
| 6794 | temp = tempcx & 0x00FF ; |
| 6795 | XGINew_SetReg1( pVBInfo->Part2Port , 0x06 , temp ) ; |
| 6796 | tempch = ( ( tempcx & 0xFF00 ) >> 8 ) & 0x07 ; |
| 6797 | tempbh = ( ( tempbx & 0xFF00 ) >> 8 ) & 0x07 ; |
| 6798 | tempah = tempch ; |
| 6799 | tempah = tempah << 3 ; |
| 6800 | tempah |= tempbh ; |
| 6801 | XGINew_SetReg1( pVBInfo->Part2Port , 0x02 , tempah ) ; |
| 6802 | |
| 6803 | /* getlcdsync() */ |
| 6804 | XGI_GetLCDSync( &tempax , &tempbx,pVBInfo ) ; |
| 6805 | tempcx = tempbx ; |
| 6806 | tempax = pVBInfo->VT ; |
| 6807 | tempbx = pVBInfo->LCDVRS ; |
| 6808 | |
| 6809 | /* if ( SetLCD_Info & EnableScalingLCD ) */ |
| 6810 | tempcx += tempbx ; |
| 6811 | if ( tempcx >= tempax ) |
| 6812 | tempcx -= tempax ; |
| 6813 | |
| 6814 | temp = tempbx & 0x00FF ; /* RTVACTEE=lcdvrs */ |
| 6815 | XGINew_SetReg1( pVBInfo->Part2Port , 0x04 , temp ) ; |
| 6816 | temp = ( tempbx & 0xFF00 ) >> 8 ; |
| 6817 | temp = temp << 4 ; |
| 6818 | temp |= ( tempcx & 0x000F ) ; |
| 6819 | XGINew_SetReg1( pVBInfo->Part2Port , 0x01 , temp ) ; |
| 6820 | tempcx = pushbx ; |
| 6821 | tempax = pVBInfo->HT ; |
| 6822 | tempbx = pVBInfo->LCDHDES ; |
| 6823 | tempbx &= 0x0FFF ; |
| 6824 | |
| 6825 | if ( XGI_IsLCDDualLink( pVBInfo ) ) |
| 6826 | { |
| 6827 | tempax = tempax >> 1 ; |
| 6828 | tempbx = tempbx >> 1 ; |
| 6829 | tempcx = tempcx >> 1 ; |
| 6830 | } |
| 6831 | |
| 6832 | if ( pVBInfo->VBType & VB_XGI302LV ) |
| 6833 | tempbx += 1 ; |
| 6834 | |
| 6835 | if ( pVBInfo->VBType & VB_XGI301C ) /* tap4 */ |
| 6836 | tempbx += 1 ; |
| 6837 | |
| 6838 | tempcx += tempbx ; |
| 6839 | |
| 6840 | if ( tempcx >= tempax ) |
| 6841 | tempcx -= tempax ; |
| 6842 | |
| 6843 | temp = tempbx & 0x00FF ; |
| 6844 | XGINew_SetReg1( pVBInfo->Part2Port , 0x1F , temp ) ; /* RHBLKE=lcdhdes */ |
| 6845 | temp = ( ( tempbx & 0xFF00 ) >> 8 ) << 4 ; |
| 6846 | XGINew_SetReg1( pVBInfo->Part2Port , 0x20 , temp ) ; |
| 6847 | temp = tempcx & 0x00FF ; |
| 6848 | XGINew_SetReg1( pVBInfo->Part2Port , 0x23 , temp ) ; /* RHEQPLE=lcdhdee */ |
| 6849 | temp = ( tempcx & 0xFF00 ) >> 8 ; |
| 6850 | XGINew_SetReg1( pVBInfo->Part2Port , 0x25 , temp ) ; |
| 6851 | |
| 6852 | /* getlcdsync() */ |
| 6853 | XGI_GetLCDSync( &tempax , &tempbx ,pVBInfo) ; |
| 6854 | tempcx = tempax ; |
| 6855 | tempax = pVBInfo->HT ; |
| 6856 | tempbx = pVBInfo->LCDHRS ; |
| 6857 | /* if ( SetLCD_Info & EnableScalingLCD) */ |
| 6858 | if ( XGI_IsLCDDualLink( pVBInfo) ) |
| 6859 | { |
| 6860 | tempax = tempax >> 1 ; |
| 6861 | tempbx = tempbx >> 1 ; |
| 6862 | tempcx = tempcx >> 1 ; |
| 6863 | } |
| 6864 | |
| 6865 | if ( pVBInfo->VBType & VB_XGI302LV ) |
| 6866 | tempbx += 1 ; |
| 6867 | |
| 6868 | tempcx += tempbx ; |
| 6869 | |
| 6870 | if ( tempcx >= tempax ) |
| 6871 | tempcx -= tempax ; |
| 6872 | |
| 6873 | temp = tempbx & 0x00FF ; /* RHBURSTS=lcdhrs */ |
| 6874 | XGINew_SetReg1( pVBInfo->Part2Port , 0x1C , temp ) ; |
| 6875 | |
| 6876 | temp = ( tempbx & 0xFF00 ) >> 8 ; |
| 6877 | temp = temp << 4 ; |
| 6878 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x1D , ~0x0F0 , temp ) ; |
| 6879 | temp = tempcx & 0x00FF ; /* RHSYEXP2S=lcdhre */ |
| 6880 | XGINew_SetReg1( pVBInfo->Part2Port , 0x21 , temp ) ; |
| 6881 | |
| 6882 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) |
| 6883 | { |
| 6884 | if ( pVBInfo->VGAVDE == 525 ) |
| 6885 | { |
| 6886 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6887 | { |
| 6888 | temp = 0xC6 ; |
| 6889 | } |
| 6890 | else |
| 6891 | temp = 0xC4 ; |
| 6892 | |
| 6893 | XGINew_SetReg1( pVBInfo->Part2Port , 0x2f , temp ) ; |
| 6894 | XGINew_SetReg1( pVBInfo->Part2Port , 0x30 , 0xB3 ) ; |
| 6895 | } |
| 6896 | |
| 6897 | if ( pVBInfo->VGAVDE == 420 ) |
| 6898 | { |
| 6899 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6900 | { |
| 6901 | temp = 0x4F ; |
| 6902 | } |
| 6903 | else |
| 6904 | temp = 0x4E ; |
| 6905 | XGINew_SetReg1( pVBInfo->Part2Port , 0x2f , temp ) ; |
| 6906 | } |
| 6907 | } |
| 6908 | } |
| 6909 | |
| 6910 | |
| 6911 | /* --------------------------------------------------------------------- */ |
| 6912 | /* Function : XGI_GetTap4Ptr */ |
| 6913 | /* Input : */ |
| 6914 | /* Output : di -> Tap4 Reg. Setting Pointer */ |
| 6915 | /* Description : */ |
| 6916 | /* --------------------------------------------------------------------- */ |
| 6917 | XGI301C_Tap4TimingStruct* XGI_GetTap4Ptr(USHORT tempcx, PVB_DEVICE_INFO pVBInfo) |
| 6918 | { |
| 6919 | USHORT tempax , |
| 6920 | tempbx , |
| 6921 | i ; |
| 6922 | |
| 6923 | XGI301C_Tap4TimingStruct *Tap4TimingPtr ; |
| 6924 | |
| 6925 | if ( tempcx == 0 ) |
| 6926 | { |
| 6927 | tempax = pVBInfo->VGAHDE ; |
| 6928 | tempbx = pVBInfo->HDE ; |
| 6929 | } |
| 6930 | else |
| 6931 | { |
| 6932 | tempax = pVBInfo->VGAVDE ; |
| 6933 | tempbx = pVBInfo->VDE ; |
| 6934 | } |
| 6935 | |
| 6936 | if ( tempax < tempbx ) |
| 6937 | return &EnlargeTap4Timing[ 0 ] ; |
| 6938 | else if( tempax == tempbx ) |
| 6939 | return &NoScaleTap4Timing[ 0 ] ; /* 1:1 */ |
| 6940 | else |
| 6941 | Tap4TimingPtr = NTSCTap4Timing ; /* NTSC */ |
| 6942 | |
| 6943 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 6944 | Tap4TimingPtr = PALTap4Timing ; |
| 6945 | |
| 6946 | |
| 6947 | if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) |
| 6948 | { |
| 6949 | if ( pVBInfo->TVInfo & SetYPbPrMode525i ) |
| 6950 | Tap4TimingPtr = YPbPr525iTap4Timing ; |
| 6951 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) |
| 6952 | Tap4TimingPtr = YPbPr525pTap4Timing ; |
| 6953 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) |
| 6954 | Tap4TimingPtr = YPbPr750pTap4Timing ; |
| 6955 | } |
| 6956 | |
| 6957 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6958 | Tap4TimingPtr = HiTVTap4Timing ; |
| 6959 | |
| 6960 | i = 0 ; |
| 6961 | while( Tap4TimingPtr[ i ].DE != 0xFFFF ) |
| 6962 | { |
| 6963 | if ( Tap4TimingPtr[ i ].DE == tempax ) |
| 6964 | break ; |
| 6965 | i++ ; |
| 6966 | } |
| 6967 | return &Tap4TimingPtr[ i ] ; |
| 6968 | } |
| 6969 | |
| 6970 | |
| 6971 | /* --------------------------------------------------------------------- */ |
| 6972 | /* Function : XGI_SetTap4Regs */ |
| 6973 | /* Input : */ |
| 6974 | /* Output : */ |
| 6975 | /* Description : */ |
| 6976 | /* --------------------------------------------------------------------- */ |
| 6977 | void XGI_SetTap4Regs( PVB_DEVICE_INFO pVBInfo) |
| 6978 | { |
| 6979 | USHORT i , |
| 6980 | j ; |
| 6981 | |
| 6982 | XGI301C_Tap4TimingStruct *Tap4TimingPtr ; |
| 6983 | |
| 6984 | if ( !( pVBInfo->VBType & VB_XGI301C ) ) |
| 6985 | return ; |
| 6986 | |
| 6987 | #ifndef Tap4 |
| 6988 | XGINew_SetRegAND( pVBInfo->Part2Port , 0x4E , 0xEB ) ; /* Disable Tap4 */ |
| 6989 | #else /* Tap4 Setting */ |
| 6990 | |
| 6991 | Tap4TimingPtr = XGI_GetTap4Ptr( 0 , pVBInfo) ; /* Set Horizontal Scaling */ |
| 6992 | for( i = 0x80 , j = 0 ; i <= 0xBF ; i++ , j++ ) |
| 6993 | XGINew_SetReg1( pVBInfo->Part2Port , i , Tap4TimingPtr->Reg[ j ] ) ; |
| 6994 | |
| 6995 | if ( ( pVBInfo->VBInfo & SetCRT2ToTV ) && ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) ) ) |
| 6996 | { |
| 6997 | Tap4TimingPtr = XGI_GetTap4Ptr( 1 , pVBInfo); /* Set Vertical Scaling */ |
| 6998 | for( i = 0xC0 , j = 0 ; i < 0xFF ; i++ , j++ ) |
| 6999 | XGINew_SetReg1( pVBInfo->Part2Port , i , Tap4TimingPtr->Reg[ j ] ) ; |
| 7000 | } |
| 7001 | |
| 7002 | if ( ( pVBInfo->VBInfo & SetCRT2ToTV ) && ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) ) ) |
| 7003 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x4E , ~0x14 , 0x04 ) ; /* Enable V.Scaling */ |
| 7004 | else |
| 7005 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x4E , ~0x14 , 0x10 ) ; /* Enable H.Scaling */ |
| 7006 | #endif |
| 7007 | } |
| 7008 | |
| 7009 | /* --------------------------------------------------------------------- */ |
| 7010 | /* Function : XGI_SetGroup3 */ |
| 7011 | /* Input : */ |
| 7012 | /* Output : */ |
| 7013 | /* Description : */ |
| 7014 | /* --------------------------------------------------------------------- */ |
| 7015 | void XGI_SetGroup3(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo) |
| 7016 | { |
| 7017 | USHORT i; |
| 7018 | UCHAR *tempdi; |
| 7019 | USHORT modeflag; |
| 7020 | |
| 7021 | if(ModeNo<=0x13) |
| 7022 | { |
| 7023 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 7024 | } |
| 7025 | else |
| 7026 | { |
| 7027 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ |
| 7028 | } |
| 7029 | |
| 7030 | |
| 7031 | XGINew_SetReg1(pVBInfo->Part3Port,0x00,0x00); |
| 7032 | if(pVBInfo->TVInfo&SetPALTV) |
| 7033 | { |
| 7034 | XGINew_SetReg1(pVBInfo->Part3Port,0x13,0xFA); |
| 7035 | XGINew_SetReg1(pVBInfo->Part3Port,0x14,0xC8); |
| 7036 | } |
| 7037 | else |
| 7038 | { |
| 7039 | XGINew_SetReg1(pVBInfo->Part3Port,0x13,0xF5); |
| 7040 | XGINew_SetReg1(pVBInfo->Part3Port,0x14,0xB7); |
| 7041 | } |
| 7042 | |
| 7043 | if(!(pVBInfo->VBInfo&SetCRT2ToTV)) |
| 7044 | { |
| 7045 | return; |
| 7046 | } |
| 7047 | |
| 7048 | if(pVBInfo->TVInfo&SetPALMTV) |
| 7049 | { |
| 7050 | XGINew_SetReg1(pVBInfo->Part3Port,0x13,0xFA); |
| 7051 | XGINew_SetReg1(pVBInfo->Part3Port,0x14,0xC8); |
| 7052 | XGINew_SetReg1(pVBInfo->Part3Port,0x3D,0xA8); |
| 7053 | } |
| 7054 | |
| 7055 | if((pVBInfo->VBInfo&SetCRT2ToHiVisionTV)|| (pVBInfo->VBInfo&SetCRT2ToYPbPr)) |
| 7056 | { |
| 7057 | if(pVBInfo->TVInfo & SetYPbPrMode525i) |
| 7058 | { |
| 7059 | return; |
| 7060 | } |
| 7061 | tempdi=pVBInfo->HiTVGroup3Data; |
| 7062 | if(pVBInfo->SetFlag&TVSimuMode) |
| 7063 | { |
| 7064 | tempdi=pVBInfo->HiTVGroup3Simu; |
| 7065 | if(!(modeflag&Charx8Dot)) |
| 7066 | { |
| 7067 | tempdi=pVBInfo->HiTVGroup3Text; |
| 7068 | } |
| 7069 | } |
| 7070 | |
| 7071 | if(pVBInfo->TVInfo & SetYPbPrMode525p) |
| 7072 | { |
| 7073 | tempdi=pVBInfo->Ren525pGroup3; |
| 7074 | } |
| 7075 | if(pVBInfo->TVInfo & SetYPbPrMode750p) |
| 7076 | { |
| 7077 | tempdi=pVBInfo->Ren750pGroup3; |
| 7078 | } |
| 7079 | |
| 7080 | for(i=0;i<=0x3E;i++) |
| 7081 | { |
| 7082 | XGINew_SetReg1(pVBInfo->Part3Port,i,tempdi[i]); |
| 7083 | } |
| 7084 | if(pVBInfo->VBType&VB_XGI301C) /* Marcovision */ |
| 7085 | { |
| 7086 | if(pVBInfo->TVInfo & SetYPbPrMode525p) |
| 7087 | { |
| 7088 | XGINew_SetReg1(pVBInfo->Part3Port,0x28,0x3f); |
| 7089 | } |
| 7090 | } |
| 7091 | } |
| 7092 | return; |
| 7093 | } /* {end of XGI_SetGroup3} */ |
| 7094 | |
| 7095 | |
| 7096 | /* --------------------------------------------------------------------- */ |
| 7097 | /* Function : XGI_SetGroup4 */ |
| 7098 | /* Input : */ |
| 7099 | /* Output : */ |
| 7100 | /* Description : */ |
| 7101 | /* --------------------------------------------------------------------- */ |
| 7102 | void XGI_SetGroup4(USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo) |
| 7103 | { |
| 7104 | USHORT tempax , |
| 7105 | tempcx , |
| 7106 | tempbx , |
| 7107 | modeflag , |
| 7108 | temp , |
| 7109 | temp2 ; |
| 7110 | |
| 7111 | ULONG tempebx , |
| 7112 | tempeax , |
| 7113 | templong ; |
| 7114 | |
| 7115 | |
| 7116 | if ( ModeNo <= 0x13 ) |
| 7117 | { |
| 7118 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 7119 | } |
| 7120 | else |
| 7121 | { |
| 7122 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ |
| 7123 | } |
| 7124 | |
| 7125 | temp = pVBInfo->RVBHCFACT ; |
| 7126 | XGINew_SetReg1( pVBInfo->Part4Port , 0x13 , temp ) ; |
| 7127 | |
| 7128 | tempbx = pVBInfo->RVBHCMAX ; |
| 7129 | temp = tempbx & 0x00FF ; |
| 7130 | XGINew_SetReg1( pVBInfo->Part4Port , 0x14 , temp ) ; |
| 7131 | temp2 = ( ( tempbx & 0xFF00 ) >> 8 ) << 7 ; |
| 7132 | tempcx = pVBInfo->VGAHT - 1 ; |
| 7133 | temp = tempcx & 0x00FF ; |
| 7134 | XGINew_SetReg1( pVBInfo->Part4Port , 0x16 , temp ) ; |
| 7135 | |
| 7136 | temp =( ( tempcx & 0xFF00 ) >> 8 ) << 3 ; |
| 7137 | temp2 |= temp ; |
| 7138 | |
| 7139 | tempcx = pVBInfo->VGAVT - 1 ; |
| 7140 | if ( !( pVBInfo->VBInfo & SetCRT2ToTV ) ) |
| 7141 | { |
| 7142 | tempcx -= 5 ; |
| 7143 | } |
| 7144 | |
| 7145 | temp = tempcx & 0x00FF ; |
| 7146 | XGINew_SetReg1( pVBInfo->Part4Port , 0x17 , temp ) ; |
| 7147 | temp = temp2 | ( ( tempcx & 0xFF00 ) >> 8 ) ; |
| 7148 | XGINew_SetReg1( pVBInfo->Part4Port , 0x15 , temp ) ; |
| 7149 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x0D , 0x08 ) ; |
| 7150 | tempcx = pVBInfo->VBInfo ; |
| 7151 | tempbx = pVBInfo->VGAHDE ; |
| 7152 | |
| 7153 | if ( modeflag & HalfDCLK ) |
| 7154 | { |
| 7155 | tempbx = tempbx >> 1 ; |
| 7156 | } |
| 7157 | |
| 7158 | if ( XGI_IsLCDDualLink( pVBInfo ) ) |
| 7159 | tempbx = tempbx >> 1 ; |
| 7160 | |
| 7161 | if(tempcx&SetCRT2ToHiVisionTV) |
| 7162 | { |
| 7163 | temp=0; |
| 7164 | if(tempbx<=1024) |
| 7165 | temp=0xA0; |
| 7166 | if(tempbx == 1280) |
| 7167 | temp = 0xC0; |
| 7168 | } |
| 7169 | else if(tempcx&SetCRT2ToTV) |
| 7170 | { |
| 7171 | temp=0xA0; |
| 7172 | if(tempbx <= 800) |
| 7173 | temp=0x80; |
| 7174 | } |
| 7175 | else |
| 7176 | { |
| 7177 | temp=0x80; |
| 7178 | if(pVBInfo->VBInfo&SetCRT2ToLCD) |
| 7179 | { |
| 7180 | temp=0; |
| 7181 | if(tempbx>800) |
| 7182 | temp=0x60; |
| 7183 | } |
| 7184 | } |
| 7185 | |
| 7186 | if ( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) |
| 7187 | { |
| 7188 | temp = 0x00 ; |
| 7189 | if ( pVBInfo->VGAHDE == 1280 ) |
| 7190 | temp = 0x40 ; |
| 7191 | if ( pVBInfo->VGAHDE == 1024 ) |
| 7192 | temp = 0x20 ; |
| 7193 | } |
| 7194 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x0E , ~0xEF , temp ) ; |
| 7195 | |
| 7196 | tempebx = pVBInfo->VDE ; |
| 7197 | |
| 7198 | if ( tempcx & SetCRT2ToHiVisionTV ) |
| 7199 | { |
| 7200 | if ( !( temp & 0xE000 ) ) |
| 7201 | tempbx = tempbx >> 1 ; |
| 7202 | } |
| 7203 | |
| 7204 | tempcx = pVBInfo->RVBHRS ; |
| 7205 | temp = tempcx & 0x00FF ; |
| 7206 | XGINew_SetReg1( pVBInfo->Part4Port , 0x18 , temp ); |
| 7207 | |
| 7208 | tempeax = pVBInfo->VGAVDE ; |
| 7209 | tempcx |= 0x04000 ; |
| 7210 | |
| 7211 | |
| 7212 | if ( tempeax <= tempebx ) |
| 7213 | { |
| 7214 | tempcx=(tempcx&(~0x4000)); |
| 7215 | tempeax = pVBInfo->VGAVDE ; |
| 7216 | } |
| 7217 | else |
| 7218 | { |
| 7219 | tempeax -= tempebx ; |
| 7220 | } |
| 7221 | |
| 7222 | |
| 7223 | templong = ( tempeax * 256 * 1024 ) % tempebx ; |
| 7224 | tempeax = ( tempeax * 256 * 1024 ) / tempebx ; |
| 7225 | tempebx = tempeax ; |
| 7226 | |
| 7227 | if ( templong != 0 ) |
| 7228 | { |
| 7229 | tempebx++ ; |
| 7230 | } |
| 7231 | |
| 7232 | |
| 7233 | temp = ( USHORT )( tempebx & 0x000000FF ) ; |
| 7234 | XGINew_SetReg1( pVBInfo->Part4Port , 0x1B , temp ) ; |
| 7235 | |
| 7236 | temp = ( USHORT )( ( tempebx & 0x0000FF00 ) >> 8 ) ; |
| 7237 | XGINew_SetReg1( pVBInfo->Part4Port , 0x1A , temp ) ; |
| 7238 | tempbx = ( USHORT )( tempebx >> 16 ) ; |
| 7239 | temp = tempbx & 0x00FF ; |
| 7240 | temp = temp << 4 ; |
| 7241 | temp |= ( ( tempcx & 0xFF00 ) >> 8 ) ; |
| 7242 | XGINew_SetReg1( pVBInfo->Part4Port , 0x19 , temp ) ; |
| 7243 | |
| 7244 | /* 301b */ |
| 7245 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 7246 | { |
| 7247 | temp = 0x0028 ; |
| 7248 | XGINew_SetReg1( pVBInfo->Part4Port , 0x1C , temp ) ; |
| 7249 | tempax = pVBInfo->VGAHDE ; |
| 7250 | if ( modeflag & HalfDCLK ) |
| 7251 | { |
| 7252 | tempax = tempax >> 1 ; |
| 7253 | } |
| 7254 | |
| 7255 | if ( XGI_IsLCDDualLink( pVBInfo ) ) |
| 7256 | tempax = tempax >> 1 ; |
| 7257 | |
| 7258 | /* if((pVBInfo->VBInfo&(SetCRT2ToLCD))||((pVBInfo->TVInfo&SetYPbPrMode525p)||(pVBInfo->TVInfo&SetYPbPrMode750p))) { */ |
| 7259 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 7260 | { |
| 7261 | if ( tempax > 800 ) |
| 7262 | tempax -= 800 ; |
| 7263 | } |
| 7264 | else |
| 7265 | { |
| 7266 | if ( pVBInfo->VGAHDE > 800 ) |
| 7267 | { |
| 7268 | if ( pVBInfo->VGAHDE == 1024 ) |
| 7269 | tempax = ( tempax * 25 / 32 ) - 1 ; |
| 7270 | else |
| 7271 | tempax = ( tempax * 20 / 32 ) - 1 ; |
| 7272 | } |
| 7273 | } |
| 7274 | tempax -= 1 ; |
| 7275 | |
| 7276 | /* |
| 7277 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToHiVisionTV ) ) |
| 7278 | { |
| 7279 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 7280 | { |
| 7281 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) ) |
| 7282 | { |
| 7283 | if ( pVBInfo->VGAHDE > 800 ) |
| 7284 | { |
| 7285 | if ( pVBInfo->VGAHDE == 1024 ) |
| 7286 | tempax = ( tempax * 25 / 32 ) - 1 ; |
| 7287 | else |
| 7288 | tempax = ( tempax * 20 / 32 ) - 1 ; |
| 7289 | } |
| 7290 | } |
| 7291 | } |
| 7292 | else |
| 7293 | { |
| 7294 | if ( pVBInfo->VGAHDE > 800 ) |
| 7295 | { |
| 7296 | if ( pVBInfo->VGAHDE == 1024 ) |
| 7297 | tempax = ( tempax * 25 / 32 ) - 1 ; |
| 7298 | else |
| 7299 | tempax = ( tempax * 20 / 32 ) - 1 ; |
| 7300 | } |
| 7301 | } |
| 7302 | } |
| 7303 | */ |
| 7304 | |
| 7305 | temp = ( tempax & 0xFF00 ) >> 8 ; |
| 7306 | temp = ( ( temp & 0x0003 ) << 4 ) ; |
| 7307 | XGINew_SetReg1( pVBInfo->Part4Port , 0x1E , temp ) ; |
| 7308 | temp = ( tempax & 0x00FF ) ; |
| 7309 | XGINew_SetReg1( pVBInfo->Part4Port , 0x1D , temp ) ; |
| 7310 | |
| 7311 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToHiVisionTV ) ) |
| 7312 | { |
| 7313 | if ( pVBInfo->VGAHDE > 800 ) |
| 7314 | { |
| 7315 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x1E , 0x08 ) ; |
| 7316 | } |
| 7317 | } |
| 7318 | temp = 0x0036 ; |
| 7319 | |
| 7320 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 7321 | { |
| 7322 | if ( !( pVBInfo->TVInfo & ( NTSC1024x768 | SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) ) |
| 7323 | { |
| 7324 | temp |= 0x0001 ; |
| 7325 | if ( ( pVBInfo->VBInfo & SetInSlaveMode ) && ( !( pVBInfo->TVInfo & TVSimuMode ) ) ) |
| 7326 | temp &= ( ~0x0001 ) ; |
| 7327 | } |
| 7328 | } |
| 7329 | |
| 7330 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x1F , 0x00C0 , temp ) ; |
| 7331 | tempbx = pVBInfo->HT ; |
| 7332 | if ( XGI_IsLCDDualLink( pVBInfo ) ) |
| 7333 | tempbx = tempbx >> 1 ; |
| 7334 | tempbx = ( tempbx >> 1 ) - 2 ; |
| 7335 | temp = ( ( tempbx & 0x0700 ) >> 8 ) << 3 ; |
| 7336 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x21 , 0x00C0 , temp ) ; |
| 7337 | temp = tempbx & 0x00FF ; |
| 7338 | XGINew_SetReg1( pVBInfo->Part4Port , 0x22 , temp ) ; |
| 7339 | } |
| 7340 | /* end 301b */ |
| 7341 | |
| 7342 | if ( pVBInfo->ISXPDOS == 0 ) |
| 7343 | XGI_SetCRT2VCLK( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 7344 | } |
| 7345 | |
| 7346 | |
| 7347 | /* --------------------------------------------------------------------- */ |
| 7348 | /* Function : XGI_SetGroup5 */ |
| 7349 | /* Input : */ |
| 7350 | /* Output : */ |
| 7351 | /* Description : */ |
| 7352 | /* --------------------------------------------------------------------- */ |
| 7353 | void XGI_SetGroup5( USHORT ModeNo , USHORT ModeIdIndex , PVB_DEVICE_INFO pVBInfo) |
| 7354 | { |
| 7355 | USHORT Pindex , |
| 7356 | Pdata ; |
| 7357 | |
| 7358 | Pindex = pVBInfo->Part5Port ; |
| 7359 | Pdata = pVBInfo->Part5Port + 1 ; |
| 7360 | if ( pVBInfo->ModeType == ModeVGA ) |
| 7361 | { |
| 7362 | if ( !( pVBInfo->VBInfo & ( SetInSlaveMode | LoadDACFlag | CRT2DisplayFlag ) ) ) |
| 7363 | { |
| 7364 | XGINew_EnableCRT2(pVBInfo) ; |
| 7365 | /* LoadDAC2(pVBInfo->Part5Port,ModeNo,ModeIdIndex); */ |
| 7366 | } |
| 7367 | } |
| 7368 | return ; |
| 7369 | } |
| 7370 | |
| 7371 | |
| 7372 | /* --------------------------------------------------------------------- */ |
| 7373 | /* Function : XGI_GetLcdPtr */ |
| 7374 | /* Input : */ |
| 7375 | /* Output : */ |
| 7376 | /* Description : */ |
| 7377 | /* --------------------------------------------------------------------- */ |
| 7378 | void* XGI_GetLcdPtr( USHORT BX , USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 7379 | { |
| 7380 | USHORT i , |
| 7381 | tempdx , |
| 7382 | tempcx , |
| 7383 | tempbx , |
| 7384 | tempal , |
| 7385 | modeflag , |
| 7386 | table ; |
| 7387 | |
| 7388 | XGI330_LCDDataTablStruct *tempdi = 0 ; |
| 7389 | |
| 7390 | |
| 7391 | tempbx = BX; |
| 7392 | |
| 7393 | if ( ModeNo <= 0x13 ) |
| 7394 | { |
| 7395 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 7396 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; |
| 7397 | } |
| 7398 | else |
| 7399 | { |
| 7400 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 7401 | tempal = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ; |
| 7402 | } |
| 7403 | |
| 7404 | tempal = tempal & 0x0f ; |
| 7405 | |
| 7406 | if ( tempbx <= 1 ) /* ExpLink */ |
| 7407 | { |
| 7408 | if ( ModeNo <= 0x13 ) |
| 7409 | { |
| 7410 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; /* find no Ext_CRT2CRTC2 */ |
| 7411 | } |
| 7412 | else |
| 7413 | { |
| 7414 | tempal= pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ; |
| 7415 | } |
| 7416 | |
| 7417 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 7418 | { |
| 7419 | if ( ModeNo <= 0x13 ) |
| 7420 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC2 ; |
| 7421 | else |
| 7422 | tempal= pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC2 ; |
| 7423 | } |
| 7424 | |
| 7425 | if ( tempbx & 0x01 ) |
| 7426 | tempal = ( tempal >> 4 ) ; |
| 7427 | |
| 7428 | tempal = ( tempal & 0x0f ) ; |
| 7429 | } |
| 7430 | |
| 7431 | tempcx = LCDLenList[ tempbx ] ; /* mov cl,byte ptr cs:LCDLenList[bx] */ |
| 7432 | |
| 7433 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) /* ScaleLCD */ |
| 7434 | { |
| 7435 | if ( ( tempbx == 5 ) || ( tempbx ) == 7 ) |
| 7436 | tempcx = LCDDesDataLen2 ; |
| 7437 | else if ( ( tempbx == 3 ) || ( tempbx == 8 ) ) |
| 7438 | tempcx = LVDSDesDataLen2 ; |
| 7439 | } |
| 7440 | /* mov di, word ptr cs:LCDDataList[bx] */ |
| 7441 | /* tempdi=pVideoMemory[LCDDataList+tempbx*2]|(pVideoMemory[LCDDataList+tempbx*2+1]<<8); */ |
| 7442 | |
| 7443 | switch( tempbx ) |
| 7444 | { |
| 7445 | case 0: |
| 7446 | tempdi = XGI_EPLLCDCRT1Ptr_H ; |
| 7447 | break ; |
| 7448 | case 1: |
| 7449 | tempdi = XGI_EPLLCDCRT1Ptr_V ; |
| 7450 | break ; |
| 7451 | case 2: |
| 7452 | tempdi = XGI_EPLLCDDataPtr ; |
| 7453 | break ; |
| 7454 | case 3: |
| 7455 | tempdi = XGI_EPLLCDDesDataPtr ; |
| 7456 | break ; |
| 7457 | case 4: |
| 7458 | tempdi = XGI_LCDDataTable ; |
| 7459 | break ; |
| 7460 | case 5: |
| 7461 | tempdi = XGI_LCDDesDataTable ; |
| 7462 | break ; |
| 7463 | case 6: |
| 7464 | tempdi = XGI_EPLCHLCDRegPtr ; |
| 7465 | break ; |
| 7466 | case 7: |
| 7467 | case 8: |
| 7468 | case 9: |
| 7469 | tempdi = 0 ; |
| 7470 | break ; |
| 7471 | default: |
| 7472 | break ; |
| 7473 | } |
| 7474 | |
| 7475 | if ( tempdi == 0x00 ) /* OEMUtil */ |
| 7476 | return 0 ; |
| 7477 | |
| 7478 | table = tempbx ; |
| 7479 | i = 0 ; |
| 7480 | |
| 7481 | while( tempdi[ i ].PANELID != 0xff ) |
| 7482 | { |
| 7483 | tempdx = pVBInfo->LCDResInfo ; |
| 7484 | if ( tempbx & 0x0080 ) /* OEMUtil */ |
| 7485 | { |
| 7486 | tempbx &= ( ~0x0080 ) ; |
| 7487 | tempdx = pVBInfo->LCDTypeInfo ; |
| 7488 | } |
| 7489 | |
| 7490 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 7491 | tempdx &= ( ~PanelResInfo ) ; |
| 7492 | |
| 7493 | if ( tempdi[ i ].PANELID == tempdx ) |
| 7494 | { |
| 7495 | tempbx = tempdi[ i ].MASK ; |
| 7496 | tempdx = pVBInfo->LCDInfo ; |
| 7497 | |
| 7498 | if ( ModeNo <= 0x13 ) /* alan 09/10/2003 */ |
| 7499 | tempdx |= SetLCDStdMode ; |
| 7500 | |
| 7501 | if ( modeflag & HalfDCLK ) |
| 7502 | tempdx |= SetLCDLowResolution ; |
| 7503 | |
| 7504 | tempbx &= tempdx; |
| 7505 | if ( tempbx == tempdi[ i ].CAP ) |
| 7506 | break ; |
| 7507 | } |
| 7508 | i++ ; |
| 7509 | } |
| 7510 | |
| 7511 | if ( table == 0 ) |
| 7512 | { |
| 7513 | switch( tempdi[ i ].DATAPTR ) |
| 7514 | { |
| 7515 | case 0: |
| 7516 | return &XGI_LVDSCRT11024x768_1_H[ tempal ] ; |
| 7517 | break ; |
| 7518 | case 1: |
| 7519 | return &XGI_LVDSCRT11024x768_2_H[ tempal ] ; |
| 7520 | break ; |
| 7521 | case 2: |
| 7522 | return &XGI_LVDSCRT11280x1024_1_H[ tempal ] ; |
| 7523 | break ; |
| 7524 | case 3: |
| 7525 | return &XGI_LVDSCRT11280x1024_2_H[ tempal ] ; |
| 7526 | break ; |
| 7527 | case 4: |
| 7528 | return &XGI_LVDSCRT11400x1050_1_H[ tempal ] ; |
| 7529 | break ; |
| 7530 | case 5: |
| 7531 | return &XGI_LVDSCRT11400x1050_2_H[ tempal ] ; |
| 7532 | break ; |
| 7533 | case 6: |
| 7534 | return &XGI_LVDSCRT11600x1200_1_H[ tempal ] ; |
| 7535 | break ; |
| 7536 | case 7: |
| 7537 | return &XGI_LVDSCRT11024x768_1_Hx75[ tempal ] ; |
| 7538 | break ; |
| 7539 | case 8: |
| 7540 | return &XGI_LVDSCRT11024x768_2_Hx75[ tempal ] ; |
| 7541 | break ; |
| 7542 | case 9: |
| 7543 | return &XGI_LVDSCRT11280x1024_1_Hx75[ tempal ] ; |
| 7544 | break ; |
| 7545 | case 10: |
| 7546 | return &XGI_LVDSCRT11280x1024_2_Hx75[ tempal ] ; |
| 7547 | break ; |
| 7548 | default: |
| 7549 | break ; |
| 7550 | } |
| 7551 | } |
| 7552 | else if ( table == 1 ) |
| 7553 | { |
| 7554 | switch( tempdi[ i ].DATAPTR ) |
| 7555 | { |
| 7556 | case 0: |
| 7557 | return &XGI_LVDSCRT11024x768_1_V[ tempal ] ; |
| 7558 | break ; |
| 7559 | case 1: |
| 7560 | return &XGI_LVDSCRT11024x768_2_V[ tempal ] ; |
| 7561 | break ; |
| 7562 | case 2: |
| 7563 | return &XGI_LVDSCRT11280x1024_1_V[ tempal ] ; |
| 7564 | break ; |
| 7565 | case 3: |
| 7566 | return &XGI_LVDSCRT11280x1024_2_V[ tempal ] ; |
| 7567 | break ; |
| 7568 | case 4: |
| 7569 | return &XGI_LVDSCRT11400x1050_1_V[ tempal ] ; |
| 7570 | break ; |
| 7571 | case 5: |
| 7572 | return &XGI_LVDSCRT11400x1050_2_V[ tempal ] ; |
| 7573 | break ; |
| 7574 | case 6: |
| 7575 | return &XGI_LVDSCRT11600x1200_1_V[ tempal ] ; |
| 7576 | break ; |
| 7577 | case 7: |
| 7578 | return &XGI_LVDSCRT11024x768_1_Vx75[ tempal ] ; |
| 7579 | break ; |
| 7580 | case 8: |
| 7581 | return &XGI_LVDSCRT11024x768_2_Vx75[ tempal ] ; |
| 7582 | break ; |
| 7583 | case 9: |
| 7584 | return &XGI_LVDSCRT11280x1024_1_Vx75[ tempal ] ; |
| 7585 | break ; |
| 7586 | case 10: |
| 7587 | return &XGI_LVDSCRT11280x1024_2_Vx75[ tempal ] ; |
| 7588 | break ; |
| 7589 | default: |
| 7590 | break ; |
| 7591 | } |
| 7592 | } |
| 7593 | else if ( table == 2 ) |
| 7594 | { |
| 7595 | switch( tempdi[ i ].DATAPTR ) |
| 7596 | { |
| 7597 | case 0: |
| 7598 | return &XGI_LVDS1024x768Data_1[ tempal ] ; |
| 7599 | break ; |
| 7600 | case 1: |
| 7601 | return &XGI_LVDS1024x768Data_2[ tempal ] ; |
| 7602 | break ; |
| 7603 | case 2: |
| 7604 | return &XGI_LVDS1280x1024Data_1[ tempal ] ; |
| 7605 | break ; |
| 7606 | case 3: |
| 7607 | return &XGI_LVDS1280x1024Data_2[ tempal ] ; |
| 7608 | break ; |
| 7609 | case 4: |
| 7610 | return &XGI_LVDS1400x1050Data_1[ tempal ] ; |
| 7611 | break ; |
| 7612 | case 5: |
| 7613 | return &XGI_LVDS1400x1050Data_2[ tempal ] ; |
| 7614 | break ; |
| 7615 | case 6: |
| 7616 | return &XGI_LVDS1600x1200Data_1[ tempal ] ; |
| 7617 | break ; |
| 7618 | case 7: |
| 7619 | return &XGI_LVDSNoScalingData[ tempal ] ; |
| 7620 | break ; |
| 7621 | case 8: |
| 7622 | return &XGI_LVDS1024x768Data_1x75[ tempal ] ; |
| 7623 | break ; |
| 7624 | case 9: |
| 7625 | return &XGI_LVDS1024x768Data_2x75[ tempal ] ; |
| 7626 | break ; |
| 7627 | case 10: |
| 7628 | return &XGI_LVDS1280x1024Data_1x75[ tempal ] ; |
| 7629 | break ; |
| 7630 | case 11: |
| 7631 | return &XGI_LVDS1280x1024Data_2x75[ tempal ] ; |
| 7632 | break ; |
| 7633 | case 12: |
| 7634 | return &XGI_LVDSNoScalingDatax75[ tempal ] ; |
| 7635 | break ; |
| 7636 | default: |
| 7637 | break ; |
| 7638 | } |
| 7639 | } |
| 7640 | else if ( table == 3 ) |
| 7641 | { |
| 7642 | switch( tempdi[ i ].DATAPTR ) |
| 7643 | { |
| 7644 | case 0: |
| 7645 | return &XGI_LVDS1024x768Des_1[ tempal ] ; |
| 7646 | break ; |
| 7647 | case 1: |
| 7648 | return &XGI_LVDS1024x768Des_3[ tempal ] ; |
| 7649 | break ; |
| 7650 | case 2: |
| 7651 | return &XGI_LVDS1024x768Des_2[ tempal ] ; |
| 7652 | break ; |
| 7653 | case 3: |
| 7654 | return &XGI_LVDS1280x1024Des_1[ tempal ] ; |
| 7655 | break ; |
| 7656 | case 4: |
| 7657 | return &XGI_LVDS1280x1024Des_2[ tempal ] ; |
| 7658 | break ; |
| 7659 | case 5: |
| 7660 | return &XGI_LVDS1400x1050Des_1[ tempal ] ; |
| 7661 | break ; |
| 7662 | case 6: |
| 7663 | return &XGI_LVDS1400x1050Des_2[ tempal ] ; |
| 7664 | break ; |
| 7665 | case 7: |
| 7666 | return &XGI_LVDS1600x1200Des_1[ tempal ] ; |
| 7667 | break ; |
| 7668 | case 8: |
| 7669 | return &XGI_LVDSNoScalingDesData[ tempal ] ; |
| 7670 | break ; |
| 7671 | case 9: |
| 7672 | return &XGI_LVDS1024x768Des_1x75[ tempal ] ; |
| 7673 | break ; |
| 7674 | case 10: |
| 7675 | return &XGI_LVDS1024x768Des_3x75[ tempal ] ; |
| 7676 | break ; |
| 7677 | case 11: |
| 7678 | return &XGI_LVDS1024x768Des_2x75[ tempal ] ; |
| 7679 | break; |
| 7680 | case 12: |
| 7681 | return &XGI_LVDS1280x1024Des_1x75[ tempal ] ; |
| 7682 | break ; |
| 7683 | case 13: |
| 7684 | return &XGI_LVDS1280x1024Des_2x75[ tempal ] ; |
| 7685 | break ; |
| 7686 | case 14: |
| 7687 | return &XGI_LVDSNoScalingDesDatax75[ tempal ] ; |
| 7688 | break ; |
| 7689 | default: |
| 7690 | break ; |
| 7691 | } |
| 7692 | } |
| 7693 | else if ( table == 4 ) |
| 7694 | { |
| 7695 | switch( tempdi[ i ].DATAPTR ) |
| 7696 | { |
| 7697 | case 0: |
| 7698 | return &XGI_ExtLCD1024x768Data[ tempal ] ; |
| 7699 | break ; |
| 7700 | case 1: |
| 7701 | return &XGI_StLCD1024x768Data[ tempal ] ; |
| 7702 | break ; |
| 7703 | case 2: |
| 7704 | return &XGI_CetLCD1024x768Data[ tempal ] ; |
| 7705 | break ; |
| 7706 | case 3: |
| 7707 | return &XGI_ExtLCD1280x1024Data[ tempal ] ; |
| 7708 | break ; |
| 7709 | case 4: |
| 7710 | return &XGI_StLCD1280x1024Data[ tempal ] ; |
| 7711 | break ; |
| 7712 | case 5: |
| 7713 | return &XGI_CetLCD1280x1024Data[ tempal ] ; |
| 7714 | break ; |
| 7715 | case 6: |
| 7716 | return &XGI_ExtLCD1400x1050Data[ tempal ] ; |
| 7717 | break ; |
| 7718 | case 7: |
| 7719 | return &XGI_StLCD1400x1050Data[ tempal ] ; |
| 7720 | break ; |
| 7721 | case 8: |
| 7722 | return &XGI_CetLCD1400x1050Data[ tempal ] ; |
| 7723 | break ; |
| 7724 | case 9: |
| 7725 | return &XGI_ExtLCD1600x1200Data[ tempal ] ; |
| 7726 | break ; |
| 7727 | case 10: |
| 7728 | return &XGI_StLCD1600x1200Data[ tempal ] ; |
| 7729 | break ; |
| 7730 | case 11: |
| 7731 | return &XGI_NoScalingData[ tempal ] ; |
| 7732 | break ; |
| 7733 | case 12: |
| 7734 | return &XGI_ExtLCD1024x768x75Data[ tempal ] ; |
| 7735 | break ; |
| 7736 | case 13: |
| 7737 | return &XGI_ExtLCD1024x768x75Data[ tempal ] ; |
| 7738 | break ; |
| 7739 | case 14: |
| 7740 | return &XGI_CetLCD1024x768x75Data[ tempal ] ; |
| 7741 | break ; |
| 7742 | case 15: |
| 7743 | return &XGI_ExtLCD1280x1024x75Data[ tempal ] ; |
| 7744 | break ; |
| 7745 | case 16: |
| 7746 | return &XGI_StLCD1280x1024x75Data[ tempal ] ; |
| 7747 | break; |
| 7748 | case 17: |
| 7749 | return &XGI_CetLCD1280x1024x75Data[ tempal ] ; |
| 7750 | break; |
| 7751 | case 18: |
| 7752 | return &XGI_NoScalingDatax75[ tempal ] ; |
| 7753 | break ; |
| 7754 | default: |
| 7755 | break ; |
| 7756 | } |
| 7757 | } |
| 7758 | else if ( table == 5 ) |
| 7759 | { |
| 7760 | switch( tempdi[ i ].DATAPTR ) |
| 7761 | { |
| 7762 | case 0: |
| 7763 | return &XGI_ExtLCDDes1024x768Data[ tempal ] ; |
| 7764 | break ; |
| 7765 | case 1: |
| 7766 | return &XGI_StLCDDes1024x768Data[ tempal ] ; |
| 7767 | break ; |
| 7768 | case 2: |
| 7769 | return &XGI_CetLCDDes1024x768Data[ tempal ] ; |
| 7770 | break ; |
| 7771 | case 3: |
| 7772 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7773 | return &XGI_ExtLCDDLDes1280x1024Data[ tempal ] ; |
| 7774 | else |
| 7775 | return &XGI_ExtLCDDes1280x1024Data[ tempal ] ; |
| 7776 | break ; |
| 7777 | case 4: |
| 7778 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7779 | return &XGI_StLCDDLDes1280x1024Data[ tempal ] ; |
| 7780 | else |
| 7781 | return &XGI_StLCDDes1280x1024Data[ tempal ] ; |
| 7782 | break ; |
| 7783 | case 5: |
| 7784 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7785 | return &XGI_CetLCDDLDes1280x1024Data[ tempal ] ; |
| 7786 | else |
| 7787 | return &XGI_CetLCDDes1280x1024Data[ tempal ] ; |
| 7788 | break ; |
| 7789 | case 6: |
| 7790 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7791 | return &XGI_ExtLCDDLDes1400x1050Data[ tempal ] ; |
| 7792 | else |
| 7793 | return &XGI_ExtLCDDes1400x1050Data[ tempal ] ; |
| 7794 | break ; |
| 7795 | case 7: |
| 7796 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7797 | return &XGI_StLCDDLDes1400x1050Data[ tempal ] ; |
| 7798 | else |
| 7799 | return &XGI_StLCDDes1400x1050Data[ tempal ] ; |
| 7800 | break ; |
| 7801 | case 8: |
| 7802 | return &XGI_CetLCDDes1400x1050Data[ tempal ] ; |
| 7803 | break ; |
| 7804 | case 9: |
| 7805 | return &XGI_CetLCDDes1400x1050Data2[ tempal ] ; |
| 7806 | break ; |
| 7807 | case 10: |
| 7808 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7809 | return &XGI_ExtLCDDLDes1600x1200Data[ tempal ] ; |
| 7810 | else |
| 7811 | return &XGI_ExtLCDDes1600x1200Data[ tempal ] ; |
| 7812 | break ; |
| 7813 | case 11: |
| 7814 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7815 | return &XGI_StLCDDLDes1600x1200Data[ tempal ] ; |
| 7816 | else |
| 7817 | return &XGI_StLCDDes1600x1200Data[ tempal ] ; |
| 7818 | break ; |
| 7819 | case 12: |
| 7820 | return &XGI_NoScalingDesData[ tempal ] ; |
| 7821 | break; |
| 7822 | case 13: |
| 7823 | return &XGI_ExtLCDDes1024x768x75Data[ tempal ] ; |
| 7824 | break ; |
| 7825 | case 14: |
| 7826 | return &XGI_StLCDDes1024x768x75Data[ tempal ] ; |
| 7827 | break ; |
| 7828 | case 15: |
| 7829 | return &XGI_CetLCDDes1024x768x75Data[ tempal ] ; |
| 7830 | break ; |
| 7831 | case 16: |
| 7832 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7833 | return &XGI_ExtLCDDLDes1280x1024x75Data[ tempal ] ; |
| 7834 | else |
| 7835 | return &XGI_ExtLCDDes1280x1024x75Data[ tempal ] ; |
| 7836 | break ; |
| 7837 | case 17: |
| 7838 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7839 | return &XGI_StLCDDLDes1280x1024x75Data[ tempal ] ; |
| 7840 | else |
| 7841 | return &XGI_StLCDDes1280x1024x75Data[ tempal ] ; |
| 7842 | break ; |
| 7843 | case 18: |
| 7844 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7845 | return &XGI_CetLCDDLDes1280x1024x75Data[ tempal ] ; |
| 7846 | else |
| 7847 | return &XGI_CetLCDDes1280x1024x75Data[ tempal ] ; |
| 7848 | break ; |
| 7849 | case 19: |
| 7850 | return &XGI_NoScalingDesDatax75[ tempal ] ; |
| 7851 | break ; |
| 7852 | default: |
| 7853 | break ; |
| 7854 | } |
| 7855 | } |
| 7856 | else if ( table == 6 ) |
| 7857 | { |
| 7858 | switch( tempdi[ i ].DATAPTR ) |
| 7859 | { |
| 7860 | case 0: |
| 7861 | return &XGI_CH7017LV1024x768[ tempal ] ; |
| 7862 | break ; |
| 7863 | case 1: |
| 7864 | return &XGI_CH7017LV1400x1050[ tempal ] ; |
| 7865 | break ; |
| 7866 | default: |
| 7867 | break ; |
| 7868 | } |
| 7869 | } |
| 7870 | return 0 ; |
| 7871 | } |
| 7872 | |
| 7873 | |
| 7874 | /* --------------------------------------------------------------------- */ |
| 7875 | /* Function : XGI_GetTVPtr */ |
| 7876 | /* Input : */ |
| 7877 | /* Output : */ |
| 7878 | /* Description : */ |
| 7879 | /* --------------------------------------------------------------------- */ |
| 7880 | void* XGI_GetTVPtr (USHORT BX,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 7881 | { |
| 7882 | USHORT i , tempdx , tempbx , tempal , modeflag , table ; |
| 7883 | XGI330_TVDataTablStruct *tempdi = 0 ; |
| 7884 | |
| 7885 | tempbx = BX ; |
| 7886 | |
| 7887 | if ( ModeNo <= 0x13 ) |
| 7888 | { |
| 7889 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 7890 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; |
| 7891 | } |
| 7892 | else |
| 7893 | { |
| 7894 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 7895 | tempal = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ; |
| 7896 | } |
| 7897 | |
| 7898 | tempal = tempal & 0x3f ; |
| 7899 | table = tempbx ; |
| 7900 | |
| 7901 | switch( tempbx ) |
| 7902 | { |
| 7903 | case 0: |
| 7904 | tempdi = 0 ; /*EPLCHTVCRT1Ptr_H;*/ |
| 7905 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 7906 | { |
| 7907 | tempdi = XGI_EPLCHTVCRT1Ptr; |
| 7908 | } |
| 7909 | break ; |
| 7910 | case 1: |
| 7911 | tempdi = 0 ; /*EPLCHTVCRT1Ptr_V;*/ |
| 7912 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 7913 | { |
| 7914 | tempdi = XGI_EPLCHTVCRT1Ptr; |
| 7915 | } |
| 7916 | break ; |
| 7917 | case 2: |
| 7918 | tempdi = XGI_EPLCHTVDataPtr ; |
| 7919 | break ; |
| 7920 | case 3: |
| 7921 | tempdi = 0 ; |
| 7922 | break ; |
| 7923 | case 4: |
| 7924 | tempdi = XGI_TVDataTable ; |
| 7925 | break ; |
| 7926 | case 5: |
| 7927 | tempdi = 0 ; |
| 7928 | break ; |
| 7929 | case 6: |
| 7930 | tempdi = XGI_EPLCHTVRegPtr ; |
| 7931 | break ; |
| 7932 | default: |
| 7933 | break ; |
| 7934 | } |
| 7935 | |
| 7936 | if ( tempdi == 0x00 ) /* OEMUtil */ |
| 7937 | return( 0 ) ; |
| 7938 | |
| 7939 | tempdx = pVBInfo->TVInfo ; |
| 7940 | |
| 7941 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 7942 | tempdx = tempdx | SetTVLockMode ; |
| 7943 | |
| 7944 | if ( modeflag & HalfDCLK ) |
| 7945 | tempdx = tempdx | SetTVLowResolution ; |
| 7946 | |
| 7947 | i = 0 ; |
| 7948 | |
| 7949 | while( tempdi[ i ].MASK != 0xffff ) |
| 7950 | { |
| 7951 | if ( ( tempdx & tempdi[ i ].MASK ) == tempdi[ i ].CAP ) |
| 7952 | break ; |
| 7953 | i++ ; |
| 7954 | } |
| 7955 | |
| 7956 | if ( table == 0x00 ) /* 07/05/22 */ |
| 7957 | { |
| 7958 | #ifdef WIN2000 |
| 7959 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 7960 | { |
| 7961 | switch( tempdi[ i ].DATAPTR ) |
| 7962 | { |
| 7963 | case 0: |
| 7964 | return &CH7007TVCRT1UNTSC_H[ tempal ] ; |
| 7965 | break ; |
| 7966 | case 1: |
| 7967 | return &CH7007TVCRT1ONTSC_H[ tempal ] ; |
| 7968 | break ; |
| 7969 | case 2: |
| 7970 | return &CH7007TVCRT1UPAL_H[ tempal ] ; |
| 7971 | break ; |
| 7972 | case 3: |
| 7973 | return &CH7007TVCRT1OPAL_H[ tempal ] ; |
| 7974 | break ; |
| 7975 | default: |
| 7976 | break ; |
| 7977 | } |
| 7978 | } |
| 7979 | #endif |
| 7980 | } |
| 7981 | else if ( table == 0x01 ) |
| 7982 | { |
| 7983 | #ifdef WIN2000 |
| 7984 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 7985 | { |
| 7986 | switch( tempdi[ i ].DATAPTR ) |
| 7987 | { |
| 7988 | case 0: |
| 7989 | return &CH7007TVCRT1UNTSC_V[ tempal ] ; |
| 7990 | break ; |
| 7991 | case 1: |
| 7992 | return &CH7007TVCRT1ONTSC_V[ tempal ] ; |
| 7993 | break ; |
| 7994 | case 2: |
| 7995 | return &CH7007TVCRT1UPAL_V[ tempal ] ; |
| 7996 | break ; |
| 7997 | case 3: |
| 7998 | return &CH7007TVCRT1OPAL_V[ tempal ] ; |
| 7999 | break ; |
| 8000 | default: |
| 8001 | break ; |
| 8002 | } |
| 8003 | } |
| 8004 | #endif |
| 8005 | } |
| 8006 | else if ( table == 0x04 ) |
| 8007 | { |
| 8008 | switch( tempdi[ i ].DATAPTR ) |
| 8009 | { |
| 8010 | case 0: |
| 8011 | return &XGI_ExtPALData[ tempal ] ; |
| 8012 | break ; |
| 8013 | case 1: |
| 8014 | return &XGI_ExtNTSCData[ tempal ] ; |
| 8015 | break ; |
| 8016 | case 2: |
| 8017 | return &XGI_StPALData[ tempal ] ; |
| 8018 | break ; |
| 8019 | case 3: |
| 8020 | return &XGI_StNTSCData[ tempal ] ; |
| 8021 | break ; |
| 8022 | case 4: |
| 8023 | return &XGI_ExtHiTVData[ tempal ] ; |
| 8024 | break ; |
| 8025 | case 5: |
| 8026 | return &XGI_St2HiTVData[ tempal ] ; |
| 8027 | break ; |
| 8028 | case 6: |
| 8029 | return &XGI_ExtYPbPr525iData[ tempal ] ; |
| 8030 | break ; |
| 8031 | case 7: |
| 8032 | return &XGI_ExtYPbPr525pData[ tempal ] ; |
| 8033 | break ; |
| 8034 | case 8: |
| 8035 | return &XGI_ExtYPbPr750pData[ tempal ] ; |
| 8036 | break ; |
| 8037 | case 9: |
| 8038 | return &XGI_StYPbPr525iData[ tempal ] ; |
| 8039 | break ; |
| 8040 | case 10: |
| 8041 | return &XGI_StYPbPr525pData[ tempal ] ; |
| 8042 | break ; |
| 8043 | case 11: |
| 8044 | return &XGI_StYPbPr750pData[ tempal ] ; |
| 8045 | break; |
| 8046 | case 12: /* avoid system hang */ |
| 8047 | return &XGI_ExtNTSCData[ tempal ] ; |
| 8048 | break ; |
| 8049 | case 13: |
| 8050 | return &XGI_St1HiTVData[ tempal ] ; |
| 8051 | break ; |
| 8052 | default: |
| 8053 | break ; |
| 8054 | } |
| 8055 | } |
| 8056 | else if( table == 0x02 ) |
| 8057 | { |
| 8058 | switch( tempdi[ i ].DATAPTR ) |
| 8059 | { |
| 8060 | case 0: |
| 8061 | return &XGI_CHTVUNTSCData[ tempal ] ; |
| 8062 | break ; |
| 8063 | case 1: |
| 8064 | return &XGI_CHTVONTSCData[ tempal ] ; |
| 8065 | break ; |
| 8066 | case 2: |
| 8067 | return &XGI_CHTVUPALData[ tempal ] ; |
| 8068 | break ; |
| 8069 | case 3: |
| 8070 | return &XGI_CHTVOPALData[ tempal ] ; |
| 8071 | break ; |
| 8072 | default: |
| 8073 | break ; |
| 8074 | } |
| 8075 | } |
| 8076 | else if( table == 0x06 ) |
| 8077 | { |
| 8078 | #ifdef WIN2000 |
| 8079 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 8080 | { |
| 8081 | /* VideoDebugPrint((0, "XGI_GetTVPtr: pVBInfo->IF_DEF_CH7007==1\n")); */ |
| 8082 | switch( tempdi[ i ].DATAPTR ) |
| 8083 | { |
| 8084 | case 0: |
| 8085 | return &CH7007TVReg_UNTSC[ tempal ] ; |
| 8086 | break ; |
| 8087 | case 1: |
| 8088 | return &CH7007TVReg_ONTSC[ tempal ] ; |
| 8089 | break ; |
| 8090 | case 2: |
| 8091 | return &CH7007TVReg_UPAL[ tempal ] ; |
| 8092 | break ; |
| 8093 | case 3: |
| 8094 | return &CH7007TVReg_OPAL[ tempal ] ; |
| 8095 | break ; |
| 8096 | default: |
| 8097 | break ; |
| 8098 | } |
| 8099 | } |
| 8100 | else |
| 8101 | { |
| 8102 | switch( tempdi[ i ].DATAPTR ) |
| 8103 | { |
| 8104 | case 0: |
| 8105 | return &XGI_CHTVRegUNTSC[ tempal ] ; |
| 8106 | break ; |
| 8107 | case 1: |
| 8108 | return &XGI_CHTVRegONTSC[ tempal ] ; |
| 8109 | break ; |
| 8110 | case 2: |
| 8111 | return &XGI_CHTVRegUPAL[ tempal ] ; |
| 8112 | break ; |
| 8113 | case 3: |
| 8114 | return &XGI_CHTVRegOPAL[ tempal ] ; |
| 8115 | break ; |
| 8116 | default: |
| 8117 | break ; |
| 8118 | } |
| 8119 | } |
| 8120 | #endif |
| 8121 | } |
| 8122 | return( 0 ) ; |
| 8123 | } |
| 8124 | |
| 8125 | |
| 8126 | /* --------------------------------------------------------------------- */ |
| 8127 | /* Function : XGI_BacklightByDrv */ |
| 8128 | /* Input : */ |
| 8129 | /* Output : TRUE -> Skip backlight control */ |
| 8130 | /* Description : */ |
| 8131 | /* --------------------------------------------------------------------- */ |
| 8132 | BOOLEAN XGI_BacklightByDrv( PVB_DEVICE_INFO pVBInfo ) |
| 8133 | { |
| 8134 | UCHAR tempah ; |
| 8135 | |
| 8136 | tempah = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x3A ) ; |
| 8137 | if ( tempah & BacklightControlBit ) |
| 8138 | return TRUE ; |
| 8139 | else |
| 8140 | return FALSE ; |
| 8141 | } |
| 8142 | |
| 8143 | |
| 8144 | /* --------------------------------------------------------------------- */ |
| 8145 | /* Function : XGI_FirePWDDisable */ |
| 8146 | /* Input : */ |
| 8147 | /* Output : */ |
| 8148 | /* Description : Turn off VDD & Backlight : Fire disable procedure */ |
| 8149 | /* --------------------------------------------------------------------- */ |
| 8150 | /* |
| 8151 | void XGI_FirePWDDisable( PVB_DEVICE_INFO pVBInfo ) |
| 8152 | { |
| 8153 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x26 , 0x00 , 0xFC ) ; |
| 8154 | } |
| 8155 | */ |
| 8156 | |
| 8157 | /* --------------------------------------------------------------------- */ |
| 8158 | /* Function : XGI_FirePWDEnable */ |
| 8159 | /* Input : */ |
| 8160 | /* Output : */ |
| 8161 | /* Description : Turn on VDD & Backlight : Fire enable procedure */ |
| 8162 | /* --------------------------------------------------------------------- */ |
| 8163 | void XGI_FirePWDEnable(PVB_DEVICE_INFO pVBInfo ) |
| 8164 | { |
| 8165 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x26 , 0x03 , 0xFC ) ; |
| 8166 | } |
| 8167 | |
| 8168 | |
| 8169 | /* --------------------------------------------------------------------- */ |
| 8170 | /* Function : XGI_EnableGatingCRT */ |
| 8171 | /* Input : */ |
| 8172 | /* Output : */ |
| 8173 | /* Description : */ |
| 8174 | /* --------------------------------------------------------------------- */ |
| 8175 | void XGI_EnableGatingCRT(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo) |
| 8176 | { |
| 8177 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x63 , 0xBF , 0x40 ) ; |
| 8178 | } |
| 8179 | |
| 8180 | |
| 8181 | /* --------------------------------------------------------------------- */ |
| 8182 | /* Function : XGI_DisableGatingCRT */ |
| 8183 | /* Input : */ |
| 8184 | /* Output : */ |
| 8185 | /* Description : */ |
| 8186 | /* --------------------------------------------------------------------- */ |
| 8187 | void XGI_DisableGatingCRT(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo) |
| 8188 | { |
| 8189 | |
| 8190 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x63 , 0xBF , 0x00 ) ; |
| 8191 | } |
| 8192 | |
| 8193 | |
| 8194 | /* --------------------------------------------------------------------- */ |
| 8195 | /* Function : XGI_SetPanelDelay */ |
| 8196 | /* Input : */ |
| 8197 | /* Output : */ |
| 8198 | /* Description : */ |
| 8199 | /* I/P : bl : 1 ; T1 : the duration between CPL on and signal on */ |
| 8200 | /* : bl : 2 ; T2 : the duration signal on and Vdd on */ |
| 8201 | /* : bl : 3 ; T3 : the duration between CPL off and signal off */ |
| 8202 | /* : bl : 4 ; T4 : the duration signal off and Vdd off */ |
| 8203 | /* --------------------------------------------------------------------- */ |
| 8204 | void XGI_SetPanelDelay(USHORT tempbl, PVB_DEVICE_INFO pVBInfo) |
| 8205 | { |
| 8206 | USHORT index ; |
| 8207 | |
| 8208 | index = XGI_GetLCDCapPtr(pVBInfo) ; |
| 8209 | |
| 8210 | if ( tempbl == 1 ) |
| 8211 | XGINew_LCD_Wait_Time( pVBInfo->LCDCapList[ index ].PSC_S1, pVBInfo ) ; |
| 8212 | |
| 8213 | if ( tempbl == 2 ) |
| 8214 | XGINew_LCD_Wait_Time( pVBInfo->LCDCapList[ index ].PSC_S2, pVBInfo ) ; |
| 8215 | |
| 8216 | if ( tempbl == 3 ) |
| 8217 | XGINew_LCD_Wait_Time( pVBInfo->LCDCapList[ index ].PSC_S3, pVBInfo ) ; |
| 8218 | |
| 8219 | if ( tempbl == 4 ) |
| 8220 | XGINew_LCD_Wait_Time( pVBInfo->LCDCapList[ index ].PSC_S4, pVBInfo ) ; |
| 8221 | } |
| 8222 | |
| 8223 | |
| 8224 | /* --------------------------------------------------------------------- */ |
| 8225 | /* Function : XGI_SetPanelPower */ |
| 8226 | /* Input : */ |
| 8227 | /* Output : */ |
| 8228 | /* Description : */ |
| 8229 | /* I/O : ah = 0011b = 03h ; Backlight on, Power on */ |
| 8230 | /* = 0111b = 07h ; Backlight on, Power off */ |
| 8231 | /* = 1011b = 0Bh ; Backlight off, Power on */ |
| 8232 | /* = 1111b = 0Fh ; Backlight off, Power off */ |
| 8233 | /* --------------------------------------------------------------------- */ |
| 8234 | void XGI_SetPanelPower(USHORT tempah,USHORT tempbl, PVB_DEVICE_INFO pVBInfo) |
| 8235 | { |
| 8236 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 8237 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x26 , tempbl , tempah ) ; |
| 8238 | else |
| 8239 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x11 , tempbl , tempah ) ; |
| 8240 | } |
| 8241 | |
| 8242 | UCHAR XG21GPIODataTransfer(UCHAR ujDate) |
| 8243 | { |
| 8244 | UCHAR ujRet = 0; |
| 8245 | UCHAR i = 0; |
| 8246 | |
| 8247 | for (i=0; i<8; i++) |
| 8248 | { |
| 8249 | ujRet = ujRet << 1; |
| 8250 | /* ujRet |= GETBITS(ujDate >> i, 0:0); */ |
| 8251 | ujRet |= (ujDate >> i) & 1; |
| 8252 | } |
| 8253 | |
| 8254 | return ujRet; |
| 8255 | } |
| 8256 | |
| 8257 | /*----------------------------------------------------------------------------*/ |
| 8258 | /* output */ |
| 8259 | /* bl[5] : LVDS signal */ |
| 8260 | /* bl[1] : LVDS backlight */ |
| 8261 | /* bl[0] : LVDS VDD */ |
| 8262 | /*----------------------------------------------------------------------------*/ |
| 8263 | UCHAR XGI_XG21GetPSCValue(PVB_DEVICE_INFO pVBInfo) |
| 8264 | { |
| 8265 | UCHAR CR4A,temp; |
| 8266 | |
| 8267 | CR4A = XGINew_GetReg1( pVBInfo->P3d4 , 0x4A ) ; |
| 8268 | XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~0x23 ) ; /* enable GPIO write */ |
| 8269 | |
| 8270 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x48 ) ; |
| 8271 | |
| 8272 | temp = XG21GPIODataTransfer(temp); |
| 8273 | temp &= 0x23; |
| 8274 | XGINew_SetReg1( pVBInfo->P3d4 , 0x4A , CR4A ) ; |
| 8275 | return temp; |
| 8276 | } |
| 8277 | |
| 8278 | /*----------------------------------------------------------------------------*/ |
| 8279 | /* output */ |
| 8280 | /* bl[5] : LVDS signal */ |
| 8281 | /* bl[1] : LVDS backlight */ |
| 8282 | /* bl[0] : LVDS VDD */ |
| 8283 | /*----------------------------------------------------------------------------*/ |
| 8284 | UCHAR XGI_XG27GetPSCValue(PVB_DEVICE_INFO pVBInfo) |
| 8285 | { |
| 8286 | UCHAR CR4A,CRB4,temp; |
| 8287 | |
| 8288 | CR4A = XGINew_GetReg1( pVBInfo->P3d4 , 0x4A ) ; |
| 8289 | XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~0x0C ) ; /* enable GPIO write */ |
| 8290 | |
| 8291 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x48 ) ; |
| 8292 | |
| 8293 | temp &= 0x0C; |
| 8294 | temp >>= 2; |
| 8295 | XGINew_SetReg1( pVBInfo->P3d4 , 0x4A , CR4A ) ; |
| 8296 | CRB4 = XGINew_GetReg1( pVBInfo->P3d4 , 0xB4 ) ; |
| 8297 | temp |= ((CRB4&0x04)<<3); |
| 8298 | return temp; |
| 8299 | } |
| 8300 | /*----------------------------------------------------------------------------*/ |
| 8301 | /* input */ |
| 8302 | /* bl[5] : 1;LVDS signal on */ |
| 8303 | /* bl[1] : 1;LVDS backlight on */ |
| 8304 | /* bl[0] : 1:LVDS VDD on */ |
| 8305 | /* bh: 100000b : clear bit 5, to set bit5 */ |
| 8306 | /* 000010b : clear bit 1, to set bit1 */ |
| 8307 | /* 000001b : clear bit 0, to set bit0 */ |
| 8308 | /*----------------------------------------------------------------------------*/ |
| 8309 | void XGI_XG21BLSignalVDD(USHORT tempbh,USHORT tempbl, PVB_DEVICE_INFO pVBInfo) |
| 8310 | { |
| 8311 | UCHAR CR4A,temp; |
| 8312 | |
| 8313 | CR4A = XGINew_GetReg1( pVBInfo->P3d4 , 0x4A ) ; |
| 8314 | tempbh &= 0x23; |
| 8315 | tempbl &= 0x23; |
| 8316 | XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~tempbh ) ; /* enable GPIO write */ |
| 8317 | |
| 8318 | if (tempbh&0x20) |
| 8319 | { |
| 8320 | temp = (tempbl>>4)&0x02; |
| 8321 | |
| 8322 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0xB4 , ~0x02 , temp) ; /* CR B4[1] */ |
| 8323 | |
| 8324 | } |
| 8325 | |
| 8326 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x48 ) ; |
| 8327 | |
| 8328 | temp = XG21GPIODataTransfer(temp); |
| 8329 | temp &= ~tempbh; |
| 8330 | temp |= tempbl; |
| 8331 | XGINew_SetReg1( pVBInfo->P3d4 , 0x48 , temp ) ; |
| 8332 | } |
| 8333 | |
| 8334 | void XGI_XG27BLSignalVDD(USHORT tempbh,USHORT tempbl, PVB_DEVICE_INFO pVBInfo) |
| 8335 | { |
| 8336 | UCHAR CR4A,temp; |
| 8337 | USHORT tempbh0,tempbl0; |
| 8338 | |
| 8339 | tempbh0 = tempbh; |
| 8340 | tempbl0 = tempbl; |
| 8341 | tempbh0 &= 0x20; |
| 8342 | tempbl0 &= 0x20; |
| 8343 | tempbh0 >>= 3; |
| 8344 | tempbl0 >>= 3; |
| 8345 | |
| 8346 | if (tempbh&0x20) |
| 8347 | { |
| 8348 | temp = (tempbl>>4)&0x02; |
| 8349 | |
| 8350 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0xB4 , ~0x02 , temp) ; /* CR B4[1] */ |
| 8351 | |
| 8352 | } |
| 8353 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0xB4 , ~tempbh0 , tempbl0 ) ; |
| 8354 | |
| 8355 | CR4A = XGINew_GetReg1( pVBInfo->P3d4 , 0x4A ) ; |
| 8356 | tempbh &= 0x03; |
| 8357 | tempbl &= 0x03; |
| 8358 | tempbh <<= 2; |
| 8359 | tempbl <<= 2; /* GPIOC,GPIOD */ |
| 8360 | XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~tempbh ) ; /* enable GPIO write */ |
| 8361 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x48 , ~tempbh , tempbl ) ; |
| 8362 | } |
| 8363 | |
| 8364 | /* --------------------------------------------------------------------- */ |
| 8365 | USHORT XGI_GetLVDSOEMTableIndex(PVB_DEVICE_INFO pVBInfo) |
| 8366 | { |
| 8367 | USHORT index ; |
| 8368 | |
| 8369 | index = XGINew_GetReg1( pVBInfo->P3d4 , 0x36 ) ; |
| 8370 | if (index<sizeof(XGI21_LCDCapList)/sizeof(XGI21_LVDSCapStruct)) |
| 8371 | { |
| 8372 | return index; |
| 8373 | } |
| 8374 | return 0; |
| 8375 | } |
| 8376 | |
| 8377 | /* --------------------------------------------------------------------- */ |
| 8378 | /* Function : XGI_XG21SetPanelDelay */ |
| 8379 | /* Input : */ |
| 8380 | /* Output : */ |
| 8381 | /* Description : */ |
| 8382 | /* I/P : bl : 1 ; T1 : the duration between CPL on and signal on */ |
| 8383 | /* : bl : 2 ; T2 : the duration signal on and Vdd on */ |
| 8384 | /* : bl : 3 ; T3 : the duration between CPL off and signal off */ |
| 8385 | /* : bl : 4 ; T4 : the duration signal off and Vdd off */ |
| 8386 | /* --------------------------------------------------------------------- */ |
| 8387 | void XGI_XG21SetPanelDelay(USHORT tempbl, PVB_DEVICE_INFO pVBInfo) |
| 8388 | { |
| 8389 | USHORT index ; |
| 8390 | |
| 8391 | index = XGI_GetLVDSOEMTableIndex( pVBInfo ); |
| 8392 | if ( tempbl == 1 ) |
| 8393 | XGINew_LCD_Wait_Time( pVBInfo->XG21_LVDSCapList[ index ].PSC_S1, pVBInfo ) ; |
| 8394 | |
| 8395 | if ( tempbl == 2 ) |
| 8396 | XGINew_LCD_Wait_Time( pVBInfo->XG21_LVDSCapList[ index ].PSC_S2, pVBInfo ) ; |
| 8397 | |
| 8398 | if ( tempbl == 3 ) |
| 8399 | XGINew_LCD_Wait_Time( pVBInfo->XG21_LVDSCapList[ index ].PSC_S3, pVBInfo ) ; |
| 8400 | |
| 8401 | if ( tempbl == 4 ) |
| 8402 | XGINew_LCD_Wait_Time( pVBInfo->XG21_LVDSCapList[ index ].PSC_S4, pVBInfo ) ; |
| 8403 | } |
| 8404 | |
| 8405 | BOOLEAN XGI_XG21CheckLVDSMode(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 8406 | { |
| 8407 | USHORT xres , |
| 8408 | yres , |
| 8409 | colordepth , |
| 8410 | modeflag , |
| 8411 | resindex , |
| 8412 | lvdstableindex; |
| 8413 | |
| 8414 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 8415 | if ( ModeNo <= 0x13 ) |
| 8416 | { |
| 8417 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 8418 | yres = pVBInfo->StResInfo[ resindex ].VTotal ; |
| 8419 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 8420 | } |
| 8421 | else |
| 8422 | { |
| 8423 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */ |
| 8424 | yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; /* yres->bx */ |
| 8425 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex].Ext_ModeFlag ; /* si+St_ModeFlag */ |
| 8426 | } |
| 8427 | |
| 8428 | if ( !( modeflag & Charx8Dot ) ) |
| 8429 | { |
| 8430 | xres /= 9; |
| 8431 | xres *= 8; |
| 8432 | } |
| 8433 | |
| 8434 | if ( ModeNo > 0x13 ) |
| 8435 | { |
| 8436 | if ( ( ModeNo>0x13 ) && ( modeflag & HalfDCLK ) ) |
| 8437 | { |
| 8438 | xres *= 2 ; |
| 8439 | } |
| 8440 | if ( ( ModeNo>0x13 ) && ( modeflag & DoubleScanMode ) ) |
| 8441 | { |
| 8442 | yres *= 2 ; |
| 8443 | } |
| 8444 | } |
| 8445 | |
| 8446 | lvdstableindex = XGI_GetLVDSOEMTableIndex( pVBInfo ); |
| 8447 | if ( xres > (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE) ) |
| 8448 | return FALSE; |
| 8449 | |
| 8450 | if ( yres > (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE) ) |
| 8451 | return FALSE; |
| 8452 | |
| 8453 | if ( ModeNo > 0x13 ) |
| 8454 | { |
| 8455 | if ( ( xres != (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE) ) || |
| 8456 | ( yres != (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE)) ) |
| 8457 | { |
| 8458 | colordepth = XGI_GetColorDepth( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 8459 | if ( colordepth > 2 ) |
| 8460 | { |
| 8461 | return FALSE; |
| 8462 | } |
| 8463 | } |
| 8464 | } |
| 8465 | return TRUE; |
| 8466 | } |
| 8467 | |
| 8468 | void XGI_SetXG21FPBits(PVB_DEVICE_INFO pVBInfo) |
| 8469 | { |
| 8470 | UCHAR temp; |
| 8471 | |
| 8472 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; /* D[0] 1: 18bit */ |
| 8473 | temp = ( temp & 1 ) << 6; |
| 8474 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x06 , ~0x40 , temp ) ; /* SR06[6] 18bit Dither */ |
| 8475 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x09 , ~0xc0 , temp | 0x80 ) ; /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: dual 12bits */ |
| 8476 | |
| 8477 | } |
| 8478 | |
| 8479 | void XGI_SetXG27FPBits(PVB_DEVICE_INFO pVBInfo) |
| 8480 | { |
| 8481 | UCHAR temp; |
| 8482 | |
| 8483 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; /* D[1:0] 01: 18bit, 00: dual 12, 10: single 24 */ |
| 8484 | temp = ( temp & 3 ) << 6; |
| 8485 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x06 , ~0xc0 , temp & 0x80 ) ; /* SR06[7]0: dual 12/1: single 24 [6] 18bit Dither <= 0 h/w recommend */ |
| 8486 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x09 , ~0xc0 , temp | 0x80 ) ; /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: 24bits */ |
| 8487 | |
| 8488 | } |
| 8489 | |
| 8490 | void XGI_SetXG21LVDSPara(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 8491 | { |
| 8492 | UCHAR temp,Miscdata; |
| 8493 | USHORT xres , |
| 8494 | yres , |
| 8495 | modeflag , |
| 8496 | resindex , |
| 8497 | lvdstableindex ; |
| 8498 | USHORT LVDSHT,LVDSHBS,LVDSHRS,LVDSHRE,LVDSHBE; |
| 8499 | USHORT LVDSVT,LVDSVBS,LVDSVRS,LVDSVRE,LVDSVBE; |
| 8500 | USHORT value; |
| 8501 | |
| 8502 | lvdstableindex = XGI_GetLVDSOEMTableIndex( pVBInfo ); |
| 8503 | |
| 8504 | temp = (UCHAR) ( ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability & (LCDPolarity << 8 ) ) >> 8 ); |
| 8505 | temp &= LCDPolarity; |
| 8506 | Miscdata =(UCHAR) XGINew_GetReg2(pVBInfo->P3cc) ; |
| 8507 | |
| 8508 | XGINew_SetReg3( pVBInfo->P3c2 , (Miscdata & 0x3F) | temp ) ; |
| 8509 | |
| 8510 | temp = (UCHAR) ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability & LCDPolarity ) ; |
| 8511 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x80 , temp&0x80 ) ; /* SR35[7] FP VSync polarity */ |
| 8512 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , ~0x20 , (temp&0x40)>>1 ) ; /* SR30[5] FP HSync polarity */ |
| 8513 | |
| 8514 | XGI_SetXG21FPBits(pVBInfo); |
| 8515 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 8516 | if ( ModeNo <= 0x13 ) |
| 8517 | { |
| 8518 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 8519 | yres = pVBInfo->StResInfo[ resindex ].VTotal ; |
| 8520 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 8521 | } |
| 8522 | else |
| 8523 | { |
| 8524 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */ |
| 8525 | yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; /* yres->bx */ |
| 8526 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex].Ext_ModeFlag ; /* si+St_ModeFlag */ |
| 8527 | } |
| 8528 | |
| 8529 | if (!( modeflag & Charx8Dot )) |
| 8530 | xres = xres * 8 / 9; |
| 8531 | |
| 8532 | LVDSHT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHT; |
| 8533 | |
| 8534 | LVDSHBS = xres + ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE - xres ) / 2 ; |
| 8535 | if ( ( ModeNo<=0x13 ) && ( modeflag & HalfDCLK ) ) |
| 8536 | { |
| 8537 | LVDSHBS -= xres/4 ; |
| 8538 | } |
| 8539 | if (LVDSHBS > LVDSHT) LVDSHBS -= LVDSHT ; |
| 8540 | |
| 8541 | LVDSHRS = LVDSHBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHFP ; |
| 8542 | if (LVDSHRS > LVDSHT) LVDSHRS -= LVDSHT ; |
| 8543 | |
| 8544 | LVDSHRE = LVDSHRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHSYNC ; |
| 8545 | if (LVDSHRE > LVDSHT) LVDSHRE -= LVDSHT ; |
| 8546 | |
| 8547 | LVDSHBE = LVDSHBS + LVDSHT - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE ; |
| 8548 | |
| 8549 | LVDSVT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVT; |
| 8550 | |
| 8551 | LVDSVBS = yres + ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE - yres ) / 2 ; |
| 8552 | if ( ( ModeNo>0x13 ) && ( modeflag & DoubleScanMode ) ) |
| 8553 | { |
| 8554 | LVDSVBS += yres/2 ; |
| 8555 | } |
| 8556 | if (LVDSVBS > LVDSVT) LVDSVBS -= LVDSVT ; |
| 8557 | |
| 8558 | LVDSVRS = LVDSVBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVFP ; |
| 8559 | if (LVDSVRS > LVDSVT) LVDSVRS -= LVDSVT ; |
| 8560 | |
| 8561 | LVDSVRE = LVDSVRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVSYNC ; |
| 8562 | if (LVDSVRE > LVDSVT) LVDSVRE -= LVDSVT ; |
| 8563 | |
| 8564 | LVDSVBE = LVDSVBS + LVDSVT - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE ; |
| 8565 | |
| 8566 | temp = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x11 ) ; |
| 8567 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , temp & 0x7f ) ; /* Unlock CRTC */ |
| 8568 | |
| 8569 | if (!( modeflag & Charx8Dot )) |
| 8570 | { |
| 8571 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x1 , 0x1 ) ; |
| 8572 | } |
| 8573 | |
| 8574 | /* HT SR0B[1:0] CR00 */ |
| 8575 | value = ( LVDSHT >> 3 ) - 5; |
| 8576 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0x03 , ( value & 0x300 ) >> 8 ) ; |
| 8577 | XGINew_SetReg1( pVBInfo->P3d4 , 0x0 , (value & 0xFF) ) ; |
| 8578 | |
| 8579 | /* HBS SR0B[5:4] CR02 */ |
| 8580 | value = ( LVDSHBS >> 3 ) - 1; |
| 8581 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0x30 , ( value & 0x300 ) >> 4 ) ; |
| 8582 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2 , (value & 0xFF) ) ; |
| 8583 | |
| 8584 | /* HBE SR0C[1:0] CR05[7] CR03[4:0] */ |
| 8585 | value = ( LVDSHBE >> 3 ) - 1; |
| 8586 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0C , ~0x03 , ( value & 0xC0 ) >> 6 ) ; |
| 8587 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x05 , ~0x80 , ( value & 0x20 ) << 2 ) ; |
| 8588 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x03 , ~0x1F , value & 0x1F ) ; |
| 8589 | |
| 8590 | /* HRS SR0B[7:6] CR04 */ |
| 8591 | value = ( LVDSHRS >> 3 ) + 2; |
| 8592 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0xC0 , ( value & 0x300 ) >> 2 ) ; |
| 8593 | XGINew_SetReg1( pVBInfo->P3d4 , 0x4 , (value & 0xFF) ) ; |
| 8594 | |
| 8595 | /* Panel HRS SR2F[1:0] SR2E[7:0] */ |
| 8596 | value--; |
| 8597 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x2F , ~0x03 , ( value & 0x300 ) >> 8 ) ; |
| 8598 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , (value & 0xFF) ) ; |
| 8599 | |
| 8600 | /* HRE SR0C[2] CR05[4:0] */ |
| 8601 | value = ( LVDSHRE >> 3 ) + 2; |
| 8602 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0C , ~0x04 , ( value & 0x20 ) >> 3 ) ; |
| 8603 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x05 , ~0x1F , value & 0x1F ) ; |
| 8604 | |
| 8605 | /* Panel HRE SR2F[7:2] */ |
| 8606 | value--; |
| 8607 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x2F , ~0xFC , value << 2 ) ; |
| 8608 | |
| 8609 | /* VT SR0A[0] CR07[5][0] CR06 */ |
| 8610 | value = LVDSVT - 2 ; |
| 8611 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x01 , ( value & 0x400 ) >> 10 ) ; |
| 8612 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x20 , ( value & 0x200 ) >> 4 ) ; |
| 8613 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x01 , ( value & 0x100 ) >> 8 ) ; |
| 8614 | XGINew_SetReg1( pVBInfo->P3d4 , 0x06 , (value & 0xFF) ) ; |
| 8615 | |
| 8616 | /* VBS SR0A[2] CR09[5] CR07[3] CR15 */ |
| 8617 | value = LVDSVBS - 1 ; |
| 8618 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x04 , ( value & 0x400 ) >> 8 ) ; |
| 8619 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x09 , ~0x20 , ( value & 0x200 ) >> 4 ) ; |
| 8620 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x08 , ( value & 0x100 ) >> 5 ) ; |
| 8621 | XGINew_SetReg1( pVBInfo->P3d4 , 0x15 , (value & 0xFF) ) ; |
| 8622 | |
| 8623 | /* VBE SR0A[4] CR16 */ |
| 8624 | value = LVDSVBE - 1; |
| 8625 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x10 , ( value & 0x100 ) >> 4 ) ; |
| 8626 | XGINew_SetReg1( pVBInfo->P3d4 , 0x16 , (value & 0xFF) ) ; |
| 8627 | |
| 8628 | /* VRS SR0A[3] CR7[7][2] CR10 */ |
| 8629 | value = LVDSVRS - 1 ; |
| 8630 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x08 , ( value & 0x400 ) >> 7 ) ; |
| 8631 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x80 , ( value & 0x200 ) >> 2 ) ; |
| 8632 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x04 , ( value & 0x100 ) >> 6 ) ; |
| 8633 | XGINew_SetReg1( pVBInfo->P3d4 , 0x10 , (value & 0xFF) ) ; |
| 8634 | |
| 8635 | /* Panel VRS SR3F[1:0] SR34[7:0] SR33[0] */ |
| 8636 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0x03 , ( value & 0x600 ) >> 9 ) ; |
| 8637 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , (value >> 1) & 0xFF ) ; |
| 8638 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x33 , ~0x01 , value & 0x01 ) ; |
| 8639 | |
| 8640 | /* VRE SR0A[5] CR11[3:0] */ |
| 8641 | value = LVDSVRE - 1; |
| 8642 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x20 , ( value & 0x10 ) << 1 ) ; |
| 8643 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x11 , ~0x0F , value & 0x0F ) ; |
| 8644 | |
| 8645 | /* Panel VRE SR3F[7:2] */ /* SR3F[7] has to be 0, h/w bug */ |
| 8646 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0xFC , ( value << 2 ) & 0x7C ) ; |
| 8647 | |
| 8648 | for ( temp=0, value = 0; temp < 3; temp++) |
| 8649 | { |
| 8650 | |
| 8651 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x31 , ~0x30 , value ) ; |
| 8652 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData1) ; |
| 8653 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData2) ; |
| 8654 | value += 0x10; |
| 8655 | } |
| 8656 | |
| 8657 | if (!( modeflag & Charx8Dot )) |
| 8658 | { |
| 8659 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ |
| 8660 | XGINew_SetReg3( pVBInfo->P3c0 , 0x13 ) ; /* set index */ |
| 8661 | XGINew_SetReg3( pVBInfo->P3c0 , 0x00 ) ; /* set data, panning = 0, shift left 1 dot*/ |
| 8662 | |
| 8663 | XGINew_GetReg2( pVBInfo->P3da ) ; /* Enable Attribute */ |
| 8664 | XGINew_SetReg3( pVBInfo->P3c0 , 0x20 ) ; |
| 8665 | |
| 8666 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ |
| 8667 | } |
| 8668 | |
| 8669 | |
| 8670 | } |
| 8671 | |
| 8672 | /* no shadow case */ |
| 8673 | void XGI_SetXG27LVDSPara(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 8674 | { |
| 8675 | UCHAR temp,Miscdata; |
| 8676 | USHORT xres , |
| 8677 | yres , |
| 8678 | modeflag , |
| 8679 | resindex , |
| 8680 | lvdstableindex ; |
| 8681 | USHORT LVDSHT,LVDSHBS,LVDSHRS,LVDSHRE,LVDSHBE; |
| 8682 | USHORT LVDSVT,LVDSVBS,LVDSVRS,LVDSVRE,LVDSVBE; |
| 8683 | USHORT value; |
| 8684 | |
| 8685 | lvdstableindex = XGI_GetLVDSOEMTableIndex( pVBInfo ); |
| 8686 | temp = (UCHAR) ( ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability & (LCDPolarity << 8 ) ) >> 8 ); |
| 8687 | temp &= LCDPolarity; |
| 8688 | Miscdata =(UCHAR) XGINew_GetReg2(pVBInfo->P3cc) ; |
| 8689 | |
| 8690 | XGINew_SetReg3( pVBInfo->P3c2 , (Miscdata & 0x3F) | temp ) ; |
| 8691 | |
| 8692 | temp = (UCHAR) ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability & LCDPolarity ) ; |
| 8693 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x80 , temp&0x80 ) ; /* SR35[7] FP VSync polarity */ |
| 8694 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , ~0x20 , (temp&0x40)>>1 ) ; /* SR30[5] FP HSync polarity */ |
| 8695 | |
| 8696 | XGI_SetXG27FPBits(pVBInfo); |
| 8697 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 8698 | if ( ModeNo <= 0x13 ) |
| 8699 | { |
| 8700 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 8701 | yres = pVBInfo->StResInfo[ resindex ].VTotal ; |
| 8702 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 8703 | } |
| 8704 | else |
| 8705 | { |
| 8706 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */ |
| 8707 | yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; /* yres->bx */ |
| 8708 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex].Ext_ModeFlag ; /* si+St_ModeFlag */ |
| 8709 | } |
| 8710 | |
| 8711 | if (!( modeflag & Charx8Dot )) |
| 8712 | xres = xres * 8 / 9; |
| 8713 | |
| 8714 | LVDSHT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHT; |
| 8715 | |
| 8716 | LVDSHBS = xres + ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE - xres ) / 2 ; |
| 8717 | if ( ( ModeNo<=0x13 ) && ( modeflag & HalfDCLK ) ) |
| 8718 | { |
| 8719 | LVDSHBS -= xres/4 ; |
| 8720 | } |
| 8721 | if (LVDSHBS > LVDSHT) LVDSHBS -= LVDSHT ; |
| 8722 | |
| 8723 | LVDSHRS = LVDSHBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHFP ; |
| 8724 | if (LVDSHRS > LVDSHT) LVDSHRS -= LVDSHT ; |
| 8725 | |
| 8726 | LVDSHRE = LVDSHRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHSYNC ; |
| 8727 | if (LVDSHRE > LVDSHT) LVDSHRE -= LVDSHT ; |
| 8728 | |
| 8729 | LVDSHBE = LVDSHBS + LVDSHT - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE ; |
| 8730 | |
| 8731 | LVDSVT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVT; |
| 8732 | |
| 8733 | LVDSVBS = yres + ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE - yres ) / 2 ; |
| 8734 | if ( ( ModeNo>0x13 ) && ( modeflag & DoubleScanMode ) ) |
| 8735 | { |
| 8736 | LVDSVBS += yres/2 ; |
| 8737 | } |
| 8738 | if (LVDSVBS > LVDSVT) LVDSVBS -= LVDSVT ; |
| 8739 | |
| 8740 | LVDSVRS = LVDSVBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVFP ; |
| 8741 | if (LVDSVRS > LVDSVT) LVDSVRS -= LVDSVT ; |
| 8742 | |
| 8743 | LVDSVRE = LVDSVRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVSYNC ; |
| 8744 | if (LVDSVRE > LVDSVT) LVDSVRE -= LVDSVT ; |
| 8745 | |
| 8746 | LVDSVBE = LVDSVBS + LVDSVT - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE ; |
| 8747 | |
| 8748 | temp = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x11 ) ; |
| 8749 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , temp & 0x7f ) ; /* Unlock CRTC */ |
| 8750 | |
| 8751 | if (!( modeflag & Charx8Dot )) |
| 8752 | { |
| 8753 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x1 , 0x1 ) ; |
| 8754 | } |
| 8755 | |
| 8756 | /* HT SR0B[1:0] CR00 */ |
| 8757 | value = ( LVDSHT >> 3 ) - 5; |
| 8758 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0x03 , ( value & 0x300 ) >> 8 ) ; |
| 8759 | XGINew_SetReg1( pVBInfo->P3d4 , 0x0 , (value & 0xFF) ) ; |
| 8760 | |
| 8761 | /* HBS SR0B[5:4] CR02 */ |
| 8762 | value = ( LVDSHBS >> 3 ) - 1; |
| 8763 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0x30 , ( value & 0x300 ) >> 4 ) ; |
| 8764 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2 , (value & 0xFF) ) ; |
| 8765 | |
| 8766 | /* HBE SR0C[1:0] CR05[7] CR03[4:0] */ |
| 8767 | value = ( LVDSHBE >> 3 ) - 1; |
| 8768 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0C , ~0x03 , ( value & 0xC0 ) >> 6 ) ; |
| 8769 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x05 , ~0x80 , ( value & 0x20 ) << 2 ) ; |
| 8770 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x03 , ~0x1F , value & 0x1F ) ; |
| 8771 | |
| 8772 | /* HRS SR0B[7:6] CR04 */ |
| 8773 | value = ( LVDSHRS >> 3 ) + 2; |
| 8774 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0xC0 , ( value & 0x300 ) >> 2 ) ; |
| 8775 | XGINew_SetReg1( pVBInfo->P3d4 , 0x4 , (value & 0xFF) ) ; |
| 8776 | |
| 8777 | /* Panel HRS SR2F[1:0] SR2E[7:0] */ |
| 8778 | value--; |
| 8779 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x2F , ~0x03 , ( value & 0x300 ) >> 8 ) ; |
| 8780 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , (value & 0xFF) ) ; |
| 8781 | |
| 8782 | /* HRE SR0C[2] CR05[4:0] */ |
| 8783 | value = ( LVDSHRE >> 3 ) + 2; |
| 8784 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0C , ~0x04 , ( value & 0x20 ) >> 3 ) ; |
| 8785 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x05 , ~0x1F , value & 0x1F ) ; |
| 8786 | |
| 8787 | /* Panel HRE SR2F[7:2] */ |
| 8788 | value--; |
| 8789 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x2F , ~0xFC , value << 2 ) ; |
| 8790 | |
| 8791 | /* VT SR0A[0] CR07[5][0] CR06 */ |
| 8792 | value = LVDSVT - 2 ; |
| 8793 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x01 , ( value & 0x400 ) >> 10 ) ; |
| 8794 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x20 , ( value & 0x200 ) >> 4 ) ; |
| 8795 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x01 , ( value & 0x100 ) >> 8 ) ; |
| 8796 | XGINew_SetReg1( pVBInfo->P3d4 , 0x06 , (value & 0xFF) ) ; |
| 8797 | |
| 8798 | /* VBS SR0A[2] CR09[5] CR07[3] CR15 */ |
| 8799 | value = LVDSVBS - 1 ; |
| 8800 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x04 , ( value & 0x400 ) >> 8 ) ; |
| 8801 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x09 , ~0x20 , ( value & 0x200 ) >> 4 ) ; |
| 8802 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x08 , ( value & 0x100 ) >> 5 ) ; |
| 8803 | XGINew_SetReg1( pVBInfo->P3d4 , 0x15 , (value & 0xFF) ) ; |
| 8804 | |
| 8805 | /* VBE SR0A[4] CR16 */ |
| 8806 | value = LVDSVBE - 1; |
| 8807 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x10 , ( value & 0x100 ) >> 4 ) ; |
| 8808 | XGINew_SetReg1( pVBInfo->P3d4 , 0x16 , (value & 0xFF) ) ; |
| 8809 | |
| 8810 | /* VRS SR0A[3] CR7[7][2] CR10 */ |
| 8811 | value = LVDSVRS - 1 ; |
| 8812 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x08 , ( value & 0x400 ) >> 7 ) ; |
| 8813 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x80 , ( value & 0x200 ) >> 2 ) ; |
| 8814 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x04 , ( value & 0x100 ) >> 6 ) ; |
| 8815 | XGINew_SetReg1( pVBInfo->P3d4 , 0x10 , (value & 0xFF) ) ; |
| 8816 | |
| 8817 | /* Panel VRS SR35[2:0] SR34[7:0] */ |
| 8818 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x07 , ( value & 0x700 ) >> 8 ) ; |
| 8819 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , value & 0xFF ) ; |
| 8820 | |
| 8821 | /* VRE SR0A[5] CR11[3:0] */ |
| 8822 | value = LVDSVRE - 1; |
| 8823 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x20 , ( value & 0x10 ) << 1 ) ; |
| 8824 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x11 , ~0x0F , value & 0x0F ) ; |
| 8825 | |
| 8826 | /* Panel VRE SR3F[7:2] */ |
| 8827 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0xFC , ( value << 2 ) & 0xFC ) ; |
| 8828 | |
| 8829 | for ( temp=0, value = 0; temp < 3; temp++) |
| 8830 | { |
| 8831 | |
| 8832 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x31 , ~0x30 , value ) ; |
| 8833 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData1) ; |
| 8834 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData2) ; |
| 8835 | value += 0x10; |
| 8836 | } |
| 8837 | |
| 8838 | if (!( modeflag & Charx8Dot )) |
| 8839 | { |
| 8840 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ |
| 8841 | XGINew_SetReg3( pVBInfo->P3c0 , 0x13 ) ; /* set index */ |
| 8842 | XGINew_SetReg3( pVBInfo->P3c0 , 0x00 ) ; /* set data, panning = 0, shift left 1 dot*/ |
| 8843 | |
| 8844 | XGINew_GetReg2( pVBInfo->P3da ) ; /* Enable Attribute */ |
| 8845 | XGINew_SetReg3( pVBInfo->P3c0 , 0x20 ) ; |
| 8846 | |
| 8847 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ |
| 8848 | } |
| 8849 | |
| 8850 | |
| 8851 | } |
| 8852 | |
| 8853 | /* --------------------------------------------------------------------- */ |
| 8854 | /* Function : XGI_IsLCDON */ |
| 8855 | /* Input : */ |
| 8856 | /* Output : FALSE : Skip PSC Control */ |
| 8857 | /* TRUE: Disable PSC */ |
| 8858 | /* Description : */ |
| 8859 | /* --------------------------------------------------------------------- */ |
| 8860 | BOOLEAN XGI_IsLCDON(PVB_DEVICE_INFO pVBInfo) |
| 8861 | { |
| 8862 | USHORT tempax ; |
| 8863 | |
| 8864 | tempax = pVBInfo->VBInfo ; |
| 8865 | if ( tempax & SetCRT2ToDualEdge ) |
| 8866 | return FALSE ; |
| 8867 | else if ( tempax & ( DisableCRT2Display | SwitchToCRT2 | SetSimuScanMode ) ) |
| 8868 | return TRUE ; |
| 8869 | |
| 8870 | return FALSE ; |
| 8871 | } |
| 8872 | |
| 8873 | |
| 8874 | /* --------------------------------------------------------------------- */ |
| 8875 | /* Function : XGI_EnablePWD */ |
| 8876 | /* Input : */ |
| 8877 | /* Output : */ |
| 8878 | /* Description : */ |
| 8879 | /* --------------------------------------------------------------------- */ |
| 8880 | void XGI_EnablePWD( PVB_DEVICE_INFO pVBInfo ) |
| 8881 | { |
| 8882 | USHORT index , |
| 8883 | temp ; |
| 8884 | |
| 8885 | index = XGI_GetLCDCapPtr(pVBInfo) ; |
| 8886 | temp = pVBInfo->LCDCapList[ index ].PWD_2B ; |
| 8887 | XGINew_SetReg1( pVBInfo->Part4Port , 0x2B , temp ) ; |
| 8888 | XGINew_SetReg1( pVBInfo->Part4Port , 0x2C , pVBInfo->LCDCapList[ index ].PWD_2C ) ; |
| 8889 | XGINew_SetReg1( pVBInfo->Part4Port , 0x2D , pVBInfo->LCDCapList[ index ].PWD_2D ) ; |
| 8890 | XGINew_SetReg1( pVBInfo->Part4Port , 0x2E , pVBInfo->LCDCapList[ index ].PWD_2E ) ; |
| 8891 | XGINew_SetReg1( pVBInfo->Part4Port , 0x2F , pVBInfo->LCDCapList[ index ].PWD_2F ) ; |
| 8892 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x27 , 0x80 ) ; /* enable PWD */ |
| 8893 | } |
| 8894 | |
| 8895 | |
| 8896 | /* --------------------------------------------------------------------- */ |
| 8897 | /* Function : XGI_DisablePWD */ |
| 8898 | /* Input : */ |
| 8899 | /* Output : */ |
| 8900 | /* Description : */ |
| 8901 | /* --------------------------------------------------------------------- */ |
| 8902 | void XGI_DisablePWD( PVB_DEVICE_INFO pVBInfo ) |
| 8903 | { |
| 8904 | XGINew_SetRegAND( pVBInfo->Part4Port , 0x27 , 0x7F ) ; /* disable PWD */ |
| 8905 | } |
| 8906 | |
| 8907 | |
| 8908 | /* --------------------------------------------------------------------- */ |
| 8909 | /* Function : XGI_DisableChISLCD */ |
| 8910 | /* Input : */ |
| 8911 | /* Output : FALSE -> Not LCD Mode */ |
| 8912 | /* Description : */ |
| 8913 | /* --------------------------------------------------------------------- */ |
| 8914 | BOOLEAN XGI_DisableChISLCD(PVB_DEVICE_INFO pVBInfo) |
| 8915 | { |
| 8916 | USHORT tempbx , |
| 8917 | tempah ; |
| 8918 | |
| 8919 | tempbx = pVBInfo->SetFlag & ( DisableChA | DisableChB ) ; |
| 8920 | tempah = ~( ( USHORT )XGINew_GetReg1( pVBInfo->Part1Port , 0x2E ) ) ; |
| 8921 | |
| 8922 | if ( tempbx & ( EnableChA | DisableChA ) ) |
| 8923 | { |
| 8924 | if ( !( tempah & 0x08 ) ) /* Chk LCDA Mode */ |
| 8925 | return FALSE ; |
| 8926 | } |
| 8927 | |
| 8928 | if ( !( tempbx & ( EnableChB | DisableChB ) ) ) |
| 8929 | return FALSE ; |
| 8930 | |
| 8931 | if ( tempah & 0x01 ) /* Chk LCDB Mode */ |
| 8932 | return TRUE ; |
| 8933 | |
| 8934 | return FALSE ; |
| 8935 | } |
| 8936 | |
| 8937 | |
| 8938 | /* --------------------------------------------------------------------- */ |
| 8939 | /* Function : XGI_EnableChISLCD */ |
| 8940 | /* Input : */ |
| 8941 | /* Output : 0 -> Not LCD mode */ |
| 8942 | /* Description : */ |
| 8943 | /* --------------------------------------------------------------------- */ |
| 8944 | BOOLEAN XGI_EnableChISLCD(PVB_DEVICE_INFO pVBInfo) |
| 8945 | { |
| 8946 | USHORT tempbx , |
| 8947 | tempah ; |
| 8948 | |
| 8949 | |
| 8950 | tempbx = pVBInfo->SetFlag & ( EnableChA | EnableChB ) ; |
| 8951 | tempah = ~( ( USHORT )XGINew_GetReg1( pVBInfo->Part1Port , 0x2E ) ) ; |
| 8952 | |
| 8953 | if ( tempbx & ( EnableChA | DisableChA ) ) |
| 8954 | { |
| 8955 | if ( !( tempah & 0x08 ) ) /* Chk LCDA Mode */ |
| 8956 | return FALSE ; |
| 8957 | } |
| 8958 | |
| 8959 | if ( !( tempbx & ( EnableChB | DisableChB ) ) ) |
| 8960 | return FALSE ; |
| 8961 | |
| 8962 | if ( tempah & 0x01 ) /* Chk LCDB Mode */ |
| 8963 | return TRUE ; |
| 8964 | |
| 8965 | return FALSE ; |
| 8966 | } |
| 8967 | |
| 8968 | |
| 8969 | /* --------------------------------------------------------------------- */ |
| 8970 | /* Function : XGI_GetLCDCapPtr */ |
| 8971 | /* Input : */ |
| 8972 | /* Output : */ |
| 8973 | /* Description : */ |
| 8974 | /* --------------------------------------------------------------------- */ |
| 8975 | USHORT XGI_GetLCDCapPtr( PVB_DEVICE_INFO pVBInfo ) |
| 8976 | { |
| 8977 | UCHAR tempal , |
| 8978 | tempah , |
| 8979 | tempbl , |
| 8980 | i ; |
| 8981 | |
| 8982 | tempah = XGINew_GetReg1( pVBInfo->P3d4 , 0x36 ) ; |
| 8983 | tempal = tempah & 0x0F ; |
| 8984 | tempah = tempah & 0xF0 ; |
| 8985 | i = 0 ; |
| 8986 | tempbl = pVBInfo->LCDCapList[ i ].LCD_ID ; |
| 8987 | |
| 8988 | while( tempbl != 0xFF ) |
| 8989 | { |
| 8990 | if ( tempbl & 0x80 ) /* OEMUtil */ |
| 8991 | { |
| 8992 | tempal = tempah ; |
| 8993 | tempbl = tempbl & ~( 0x80 ) ; |
| 8994 | } |
| 8995 | |
| 8996 | if ( tempal == tempbl ) |
| 8997 | break ; |
| 8998 | |
| 8999 | i++ ; |
| 9000 | |
| 9001 | tempbl = pVBInfo->LCDCapList[ i ].LCD_ID ; |
| 9002 | } |
| 9003 | |
| 9004 | return i ; |
| 9005 | } |
| 9006 | |
| 9007 | |
| 9008 | /* --------------------------------------------------------------------- */ |
| 9009 | /* Function : XGI_GetLCDCapPtr1 */ |
| 9010 | /* Input : */ |
| 9011 | /* Output : */ |
| 9012 | /* Description : */ |
| 9013 | /* --------------------------------------------------------------------- */ |
| 9014 | USHORT XGI_GetLCDCapPtr1( PVB_DEVICE_INFO pVBInfo ) |
| 9015 | { |
| 9016 | USHORT tempah , |
| 9017 | tempal , |
| 9018 | tempbl , |
| 9019 | i ; |
| 9020 | |
| 9021 | tempal = pVBInfo->LCDResInfo ; |
| 9022 | tempah = pVBInfo->LCDTypeInfo ; |
| 9023 | |
| 9024 | i = 0 ; |
| 9025 | tempbl = pVBInfo->LCDCapList[ i ].LCD_ID; |
| 9026 | |
| 9027 | while( tempbl != 0xFF ) |
| 9028 | { |
| 9029 | if ( ( tempbl & 0x80 ) && ( tempbl != 0x80 ) ) |
| 9030 | { |
| 9031 | tempal = tempah ; |
| 9032 | tempbl &= ~0x80 ; |
| 9033 | } |
| 9034 | |
| 9035 | if ( tempal == tempbl ) |
| 9036 | break ; |
| 9037 | |
| 9038 | i++ ; |
| 9039 | tempbl = pVBInfo->LCDCapList[ i ].LCD_ID ; |
| 9040 | } |
| 9041 | |
| 9042 | if ( tempbl == 0xFF ) |
| 9043 | { |
| 9044 | pVBInfo->LCDResInfo = Panel1024x768 ; |
| 9045 | pVBInfo->LCDTypeInfo = 0 ; |
| 9046 | i = 0 ; |
| 9047 | } |
| 9048 | |
| 9049 | return i ; |
| 9050 | } |
| 9051 | |
| 9052 | |
| 9053 | /* --------------------------------------------------------------------- */ |
| 9054 | /* Function : XGI_GetLCDSync */ |
| 9055 | /* Input : */ |
| 9056 | /* Output : */ |
| 9057 | /* Description : */ |
| 9058 | /* --------------------------------------------------------------------- */ |
| 9059 | void XGI_GetLCDSync( USHORT* HSyncWidth , USHORT* VSyncWidth, PVB_DEVICE_INFO pVBInfo ) |
| 9060 | { |
| 9061 | USHORT Index ; |
| 9062 | |
| 9063 | Index = XGI_GetLCDCapPtr(pVBInfo) ; |
| 9064 | *HSyncWidth = pVBInfo->LCDCapList[ Index ].LCD_HSyncWidth ; |
| 9065 | *VSyncWidth = pVBInfo->LCDCapList[ Index ].LCD_VSyncWidth ; |
| 9066 | |
| 9067 | return ; |
| 9068 | } |
| 9069 | |
| 9070 | |
| 9071 | |
| 9072 | /* --------------------------------------------------------------------- */ |
| 9073 | /* Function : XGI_EnableBridge */ |
| 9074 | /* Input : */ |
| 9075 | /* Output : */ |
| 9076 | /* Description : */ |
| 9077 | /* --------------------------------------------------------------------- */ |
| 9078 | void XGI_EnableBridge( PXGI_HW_DEVICE_INFO HwDeviceExtension , PVB_DEVICE_INFO pVBInfo) |
| 9079 | { |
| 9080 | USHORT tempbl , |
| 9081 | tempah ; |
| 9082 | |
| 9083 | if ( pVBInfo->SetFlag == Win9xDOSMode ) |
| 9084 | { |
| 9085 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9086 | { |
| 9087 | XGI_DisplayOn( HwDeviceExtension, pVBInfo) ; |
| 9088 | return ; |
| 9089 | } |
| 9090 | else /* LVDS or CH7017 */ |
| 9091 | return ; |
| 9092 | } |
| 9093 | |
| 9094 | |
| 9095 | if ( HwDeviceExtension->jChipType < XG40 ) |
| 9096 | { |
| 9097 | if ( !XGI_DisableChISLCD(pVBInfo) ) |
| 9098 | { |
| 9099 | if ( ( XGI_EnableChISLCD(pVBInfo) ) || ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) |
| 9100 | { |
| 9101 | if ( pVBInfo->LCDInfo & SetPWDEnable ) |
| 9102 | { |
| 9103 | XGI_EnablePWD( pVBInfo); |
| 9104 | } |
| 9105 | else |
| 9106 | { |
| 9107 | pVBInfo->LCDInfo &= ( ~SetPWDEnable ) ; |
| 9108 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9109 | { |
| 9110 | tempbl = 0xFD ; |
| 9111 | tempah = 0x02 ; |
| 9112 | } |
| 9113 | else |
| 9114 | { |
| 9115 | tempbl = 0xFB ; |
| 9116 | tempah = 0x00 ; |
| 9117 | } |
| 9118 | |
| 9119 | XGI_SetPanelPower( tempah , tempbl, pVBInfo ) ; |
| 9120 | XGI_SetPanelDelay( 1,pVBInfo ) ; |
| 9121 | } |
| 9122 | } |
| 9123 | } |
| 9124 | } /* Not 340 */ |
| 9125 | |
| 9126 | |
| 9127 | |
| 9128 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9129 | { |
| 9130 | if ( !( pVBInfo->SetFlag & DisableChA ) ) |
| 9131 | { |
| 9132 | if ( pVBInfo->SetFlag & EnableChA ) |
| 9133 | { |
| 9134 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1E , 0x20 ) ; /* Power on */ |
| 9135 | } |
| 9136 | else |
| 9137 | { |
| 9138 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) /* SetCRT2ToLCDA ) */ |
| 9139 | { |
| 9140 | XGINew_SetReg1(pVBInfo->Part1Port,0x1E,0x20); /* Power on */ |
| 9141 | } |
| 9142 | } |
| 9143 | } |
| 9144 | |
| 9145 | if ( !( pVBInfo->SetFlag & DisableChB ) ) |
| 9146 | { |
| 9147 | if ( ( pVBInfo->SetFlag & EnableChB ) || ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToTV | SetCRT2ToRAMDAC ) ) ) |
| 9148 | { |
| 9149 | tempah = ( UCHAR )XGINew_GetReg1( pVBInfo->P3c4 , 0x32 ) ; |
| 9150 | tempah &= 0xDF; |
| 9151 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 9152 | { |
| 9153 | if ( !( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) ) |
| 9154 | tempah |= 0x20 ; |
| 9155 | } |
| 9156 | XGINew_SetReg1( pVBInfo->P3c4 , 0x32 , tempah ) ; |
| 9157 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x1E , 0x20 ) ; |
| 9158 | |
| 9159 | |
| 9160 | tempah = ( UCHAR )XGINew_GetReg1( pVBInfo->Part1Port , 0x2E ) ; |
| 9161 | |
| 9162 | if ( !( tempah & 0x80 ) ) |
| 9163 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x2E , 0x80 ) ; /* BVBDOENABLE = 1 */ |
| 9164 | |
| 9165 | XGINew_SetRegAND( pVBInfo->Part1Port , 0x00 , 0x7F ) ; /* BScreenOFF = 0 */ |
| 9166 | } |
| 9167 | } |
| 9168 | |
| 9169 | if ( ( pVBInfo->SetFlag & ( EnableChA | EnableChB ) ) || ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) ) |
| 9170 | { |
| 9171 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x00 , ~0xE0 , 0x20 ) ; /* shampoo 0129 */ |
| 9172 | if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) ) |
| 9173 | { |
| 9174 | if ( !XGI_DisableChISLCD(pVBInfo) ) |
| 9175 | { |
| 9176 | if ( XGI_EnableChISLCD( pVBInfo) || ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) |
| 9177 | XGINew_SetRegAND( pVBInfo->Part4Port ,0x2A , 0x7F ) ; /* LVDS PLL power on */ |
| 9178 | } |
| 9179 | XGINew_SetRegAND( pVBInfo->Part4Port , 0x30 , 0x7F ) ; /* LVDS Driver power on */ |
| 9180 | } |
| 9181 | } |
| 9182 | |
| 9183 | tempah = 0x00 ; |
| 9184 | |
| 9185 | if ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) |
| 9186 | { |
| 9187 | tempah = 0xc0 ; |
| 9188 | |
| 9189 | if ( !( pVBInfo->VBInfo & SetSimuScanMode ) ) |
| 9190 | { |
| 9191 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 9192 | { |
| 9193 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) |
| 9194 | { |
| 9195 | tempah = tempah & 0x40; |
| 9196 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 9197 | tempah = tempah ^ 0xC0 ; |
| 9198 | |
| 9199 | if ( pVBInfo->SetFlag & DisableChB ) |
| 9200 | tempah &= 0xBF ; |
| 9201 | |
| 9202 | if ( pVBInfo->SetFlag & DisableChA ) |
| 9203 | tempah &= 0x7F ; |
| 9204 | |
| 9205 | if ( pVBInfo->SetFlag & EnableChB ) |
| 9206 | tempah |= 0x40 ; |
| 9207 | |
| 9208 | if ( pVBInfo->SetFlag & EnableChA ) |
| 9209 | tempah |= 0x80 ; |
| 9210 | } |
| 9211 | } |
| 9212 | } |
| 9213 | } |
| 9214 | |
| 9215 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x1F , tempah ) ; /* EnablePart4_1F */ |
| 9216 | |
| 9217 | if ( pVBInfo->SetFlag & Win9xDOSMode ) |
| 9218 | { |
| 9219 | XGI_DisplayOn( HwDeviceExtension, pVBInfo) ; |
| 9220 | return ; |
| 9221 | } |
| 9222 | |
| 9223 | if ( !( pVBInfo->SetFlag & DisableChA ) ) |
| 9224 | { |
| 9225 | XGI_VBLongWait( pVBInfo) ; |
| 9226 | if ( !( pVBInfo->SetFlag & GatingCRT ) ) |
| 9227 | { |
| 9228 | XGI_DisableGatingCRT( HwDeviceExtension, pVBInfo ) ; |
| 9229 | XGI_DisplayOn( HwDeviceExtension, pVBInfo) ; |
| 9230 | XGI_VBLongWait( pVBInfo) ; |
| 9231 | } |
| 9232 | } |
| 9233 | } /* 301 */ |
| 9234 | else /* LVDS */ |
| 9235 | { |
| 9236 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 9237 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x1E , 0x20 ) ; /* enable CRT2 */ |
| 9238 | |
| 9239 | |
| 9240 | |
| 9241 | tempah = ( UCHAR )XGINew_GetReg1( pVBInfo->Part1Port , 0x2E ) ; |
| 9242 | if ( !( tempah & 0x80 ) ) |
| 9243 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x2E , 0x80 ) ; /* BVBDOENABLE = 1 */ |
| 9244 | |
| 9245 | XGINew_SetRegAND(pVBInfo->Part1Port,0x00,0x7F); |
| 9246 | XGI_DisplayOn( HwDeviceExtension, pVBInfo); |
| 9247 | } /* End of VB */ |
| 9248 | |
| 9249 | |
| 9250 | if ( HwDeviceExtension->jChipType < XG40 ) |
| 9251 | { |
| 9252 | if ( !XGI_EnableChISLCD(pVBInfo) ) |
| 9253 | { |
| 9254 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 9255 | { |
| 9256 | if ( XGI_BacklightByDrv(pVBInfo) ) |
| 9257 | return ; |
| 9258 | } |
| 9259 | else |
| 9260 | return ; |
| 9261 | } |
| 9262 | |
| 9263 | if ( pVBInfo->LCDInfo & SetPWDEnable ) |
| 9264 | { |
| 9265 | XGI_FirePWDEnable(pVBInfo) ; |
| 9266 | return ; |
| 9267 | } |
| 9268 | |
| 9269 | XGI_SetPanelDelay( 2,pVBInfo ) ; |
| 9270 | |
| 9271 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9272 | { |
| 9273 | tempah = 0x01 ; |
| 9274 | tempbl = 0xFE ; /* turn on backlght */ |
| 9275 | } |
| 9276 | else |
| 9277 | { |
| 9278 | tempbl = 0xF7 ; |
| 9279 | tempah = 0x00 ; |
| 9280 | } |
| 9281 | XGI_SetPanelPower( tempah , tempbl , pVBInfo) ; |
| 9282 | } |
| 9283 | } |
| 9284 | |
| 9285 | |
| 9286 | /* --------------------------------------------------------------------- */ |
| 9287 | /* Function : XGI_DisableBridge */ |
| 9288 | /* Input : */ |
| 9289 | /* Output : */ |
| 9290 | /* Description : */ |
| 9291 | /* --------------------------------------------------------------------- */ |
| 9292 | void XGI_DisableBridge(PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo) |
| 9293 | { |
| 9294 | USHORT tempax , |
| 9295 | tempbx , |
| 9296 | tempah = 0 , |
| 9297 | tempbl = 0 ; |
| 9298 | |
| 9299 | if ( pVBInfo->SetFlag == Win9xDOSMode ) |
| 9300 | return ; |
| 9301 | |
| 9302 | |
| 9303 | if ( HwDeviceExtension->jChipType < XG40 ) |
| 9304 | { |
| 9305 | if ( ( !( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) || ( XGI_DisableChISLCD(pVBInfo) ) ) |
| 9306 | { |
| 9307 | if ( !XGI_IsLCDON(pVBInfo) ) |
| 9308 | { |
| 9309 | if ( pVBInfo->LCDInfo & SetPWDEnable ) |
| 9310 | XGI_EnablePWD( pVBInfo) ; |
| 9311 | else |
| 9312 | { |
| 9313 | pVBInfo->LCDInfo &= ~SetPWDEnable ; |
| 9314 | XGI_DisablePWD(pVBInfo) ; |
| 9315 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9316 | { |
| 9317 | tempbx = 0xFE ; /* not 01h */ |
| 9318 | tempax = 0 ; |
| 9319 | } |
| 9320 | else |
| 9321 | { |
| 9322 | tempbx = 0xF7 ; /* not 08h */ |
| 9323 | tempax = 0x08 ; |
| 9324 | } |
| 9325 | XGI_SetPanelPower( tempax , tempbx , pVBInfo) ; |
| 9326 | XGI_SetPanelDelay( 3,pVBInfo ) ; |
| 9327 | } |
| 9328 | } /* end if(!XGI_IsLCDON(pVBInfo)) */ |
| 9329 | } |
| 9330 | } |
| 9331 | |
| 9332 | /* if ( CH7017 ) |
| 9333 | { |
| 9334 | if ( !( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2toLCDA ) ) || ( XGI_DisableChISLCD(pVBInfo) ) ) |
| 9335 | { |
| 9336 | if ( !XGI_IsLCDON(pVBInfo) ) |
| 9337 | { |
| 9338 | if ( DISCHARGE ) |
| 9339 | { |
| 9340 | tempbx = XGINew_GetCH7005( 0x61 ) ; |
| 9341 | if ( tempbx < 0x01 ) //first time we power up |
| 9342 | XGINew_SetCH7005( 0x0066 ) ; //and disable power sequence |
| 9343 | else |
| 9344 | XGINew_SetCH7005( 0x5f66 ) ; //leave VDD on - disable power |
| 9345 | } |
| 9346 | } |
| 9347 | } |
| 9348 | } */ |
| 9349 | |
| 9350 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B| VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9351 | { |
| 9352 | tempah = 0x3F ; |
| 9353 | if ( !( pVBInfo->VBInfo & ( DisableCRT2Display | SetSimuScanMode ) ) ) |
| 9354 | { |
| 9355 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 9356 | { |
| 9357 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) |
| 9358 | { |
| 9359 | tempah = 0x7F; /* Disable Channel A */ |
| 9360 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) |
| 9361 | tempah = 0xBF ; /* Disable Channel B */ |
| 9362 | |
| 9363 | if ( pVBInfo->SetFlag & DisableChB ) |
| 9364 | tempah &= 0xBF ; /* force to disable Cahnnel */ |
| 9365 | |
| 9366 | if ( pVBInfo->SetFlag & DisableChA ) |
| 9367 | tempah &= 0x7F ; /* Force to disable Channel B */ |
| 9368 | } |
| 9369 | } |
| 9370 | } |
| 9371 | |
| 9372 | XGINew_SetRegAND( pVBInfo->Part4Port , 0x1F , tempah ) ; /* disable part4_1f */ |
| 9373 | |
| 9374 | if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) ) |
| 9375 | { |
| 9376 | if ( ( ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) || ( XGI_DisableChISLCD(pVBInfo) ) || ( XGI_IsLCDON(pVBInfo) ) ) |
| 9377 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x30 , 0x80 ) ; /* LVDS Driver power down */ |
| 9378 | } |
| 9379 | |
| 9380 | if ( ( pVBInfo->SetFlag & DisableChA ) || ( pVBInfo->VBInfo & ( DisableCRT2Display | SetCRT2ToLCDA | SetSimuScanMode ) ) ) |
| 9381 | { |
| 9382 | if ( pVBInfo->SetFlag & GatingCRT ) |
| 9383 | XGI_EnableGatingCRT( HwDeviceExtension, pVBInfo ) ; |
| 9384 | XGI_DisplayOff( HwDeviceExtension, pVBInfo) ; |
| 9385 | } |
| 9386 | |
| 9387 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 9388 | { |
| 9389 | if ( ( pVBInfo->SetFlag & DisableChA ) || ( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) |
| 9390 | XGINew_SetRegAND( pVBInfo->Part1Port , 0x1e , 0xdf ) ; /* Power down */ |
| 9391 | } |
| 9392 | |
| 9393 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x32 , 0xdf ) ; /* disable TV as primary VGA swap */ |
| 9394 | |
| 9395 | if ( ( pVBInfo->VBInfo & ( SetSimuScanMode | SetCRT2ToDualEdge ) ) ) |
| 9396 | XGINew_SetRegAND(pVBInfo->Part2Port,0x00,0xdf); |
| 9397 | |
| 9398 | if ( ( pVBInfo->SetFlag & DisableChB ) || ( pVBInfo->VBInfo & ( DisableCRT2Display | SetSimuScanMode ) ) |
| 9399 | || ( ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) && ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV ) ) ) ) |
| 9400 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x00 , 0x80 ) ; /* BScreenOff=1 */ |
| 9401 | |
| 9402 | if ( ( pVBInfo->SetFlag & DisableChB ) || ( pVBInfo->VBInfo & ( DisableCRT2Display | SetSimuScanMode ) ) |
| 9403 | || ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) || ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV ) ) ) |
| 9404 | { |
| 9405 | tempah= XGINew_GetReg1( pVBInfo->Part1Port , 0x00 ) ; /* save Part1 index 0 */ |
| 9406 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x00 , 0x10 ) ; /* BTDAC = 1, avoid VB reset */ |
| 9407 | XGINew_SetRegAND( pVBInfo->Part1Port , 0x1E , 0xDF ) ; /* disable CRT2 */ |
| 9408 | XGINew_SetReg1( pVBInfo->Part1Port , 0x00 , tempah ) ; /* restore Part1 index 0 */ |
| 9409 | } |
| 9410 | } |
| 9411 | else /* {301} */ |
| 9412 | { |
| 9413 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToTV ) ) |
| 9414 | { |
| 9415 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x00 , 0x80 ) ; /* BScreenOff=1 */ |
| 9416 | XGINew_SetRegAND( pVBInfo->Part1Port , 0x1E , 0xDF ) ; /* Disable CRT2 */ |
| 9417 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x32 , 0xDF ) ; /* Disable TV asPrimary VGA swap */ |
| 9418 | } |
| 9419 | |
| 9420 | if ( pVBInfo->VBInfo & ( DisableCRT2Display | SetCRT2ToLCDA | SetSimuScanMode ) ) |
| 9421 | XGI_DisplayOff( HwDeviceExtension, pVBInfo) ; |
| 9422 | } |
| 9423 | |
| 9424 | |
| 9425 | |
| 9426 | |
| 9427 | if ( HwDeviceExtension->jChipType < XG40 ) |
| 9428 | { |
| 9429 | if ( !( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) || ( XGI_DisableChISLCD(pVBInfo) ) || ( XGI_IsLCDON(pVBInfo) ) ) |
| 9430 | { |
| 9431 | if ( pVBInfo->LCDInfo & SetPWDEnable ) |
| 9432 | { |
| 9433 | if ( pVBInfo->LCDInfo & SetPWDEnable ) |
| 9434 | XGI_BacklightByDrv(pVBInfo) ; |
| 9435 | else |
| 9436 | { |
| 9437 | XGI_SetPanelDelay( 4 ,pVBInfo) ; |
| 9438 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 9439 | { |
| 9440 | tempbl = 0xFD ; |
| 9441 | tempah = 0x00 ; |
| 9442 | } |
| 9443 | else |
| 9444 | { |
| 9445 | tempbl = 0xFB ; |
| 9446 | tempah = 0x04 ; |
| 9447 | } |
| 9448 | } |
| 9449 | } |
| 9450 | XGI_SetPanelPower( tempah , tempbl , pVBInfo) ; |
| 9451 | } |
| 9452 | } |
| 9453 | } |
| 9454 | |
| 9455 | |
| 9456 | /* --------------------------------------------------------------------- */ |
| 9457 | /* Function : XGI_GetTVPtrIndex */ |
| 9458 | /* Input : */ |
| 9459 | /* Output : */ |
| 9460 | /* Description : bx 0 : ExtNTSC */ |
| 9461 | /* 1 : StNTSC */ |
| 9462 | /* 2 : ExtPAL */ |
| 9463 | /* 3 : StPAL */ |
| 9464 | /* 4 : ExtHiTV */ |
| 9465 | /* 5 : StHiTV */ |
| 9466 | /* 6 : Ext525i */ |
| 9467 | /* 7 : St525i */ |
| 9468 | /* 8 : Ext525p */ |
| 9469 | /* 9 : St525p */ |
| 9470 | /* A : Ext750p */ |
| 9471 | /* B : St750p */ |
| 9472 | /* --------------------------------------------------------------------- */ |
| 9473 | USHORT XGI_GetTVPtrIndex( PVB_DEVICE_INFO pVBInfo ) |
| 9474 | { |
| 9475 | USHORT tempbx = 0 ; |
| 9476 | |
| 9477 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 9478 | tempbx = 2 ; |
| 9479 | if ( pVBInfo->TVInfo & SetYPbPrMode1080i ) |
| 9480 | tempbx = 4 ; |
| 9481 | if ( pVBInfo->TVInfo & SetYPbPrMode525i ) |
| 9482 | tempbx = 6 ; |
| 9483 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) |
| 9484 | tempbx = 8 ; |
| 9485 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) |
| 9486 | tempbx = 10 ; |
| 9487 | if ( pVBInfo->TVInfo & TVSimuMode ) |
| 9488 | tempbx++ ; |
| 9489 | |
| 9490 | return tempbx ; |
| 9491 | } |
| 9492 | |
| 9493 | |
| 9494 | /* --------------------------------------------------------------------- */ |
| 9495 | /* Function : XGI_OEM310Setting */ |
| 9496 | /* Input : */ |
| 9497 | /* Output : */ |
| 9498 | /* Description : Customized Param. for 301 */ |
| 9499 | /* --------------------------------------------------------------------- */ |
| 9500 | void XGI_OEM310Setting( USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo) |
| 9501 | { |
| 9502 | if ( pVBInfo->SetFlag & Win9xDOSMode ) |
| 9503 | return ; |
| 9504 | |
| 9505 | /* GetPart1IO(); */ |
| 9506 | XGI_SetDelayComp(pVBInfo) ; |
| 9507 | |
| 9508 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 9509 | XGI_SetLCDCap(pVBInfo) ; |
| 9510 | |
| 9511 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 9512 | { |
| 9513 | /* GetPart2IO() */ |
| 9514 | XGI_SetPhaseIncr(pVBInfo) ; |
| 9515 | XGI_SetYFilter( ModeNo , ModeIdIndex,pVBInfo ) ; |
| 9516 | XGI_SetAntiFlicker( ModeNo , ModeIdIndex,pVBInfo ) ; |
| 9517 | |
| 9518 | if ( pVBInfo->VBType&VB_XGI301) |
| 9519 | XGI_SetEdgeEnhance( ModeNo , ModeIdIndex ,pVBInfo) ; |
| 9520 | } |
| 9521 | } |
| 9522 | |
| 9523 | |
| 9524 | /* --------------------------------------------------------------------- */ |
| 9525 | /* Function : XGI_SetDelayComp */ |
| 9526 | /* Input : */ |
| 9527 | /* Output : */ |
| 9528 | /* Description : */ |
| 9529 | /* --------------------------------------------------------------------- */ |
| 9530 | void XGI_SetDelayComp( PVB_DEVICE_INFO pVBInfo ) |
| 9531 | { |
| 9532 | USHORT index ; |
| 9533 | |
| 9534 | UCHAR tempah , |
| 9535 | tempbl , |
| 9536 | tempbh ; |
| 9537 | |
| 9538 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9539 | { |
| 9540 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA | SetCRT2ToTV | SetCRT2ToRAMDAC ) ) |
| 9541 | { |
| 9542 | tempbl = 0; |
| 9543 | tempbh = 0; |
| 9544 | |
| 9545 | index = XGI_GetTVPtrIndex(pVBInfo ) ; /* Get TV Delay */ |
| 9546 | tempbl = pVBInfo->XGI_TVDelayList[ index ] ; |
| 9547 | |
| 9548 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9549 | tempbl = pVBInfo->XGI_TVDelayList2[ index ] ; |
| 9550 | |
| 9551 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) |
| 9552 | tempbl = tempbl >> 4 ; |
| 9553 | /* |
| 9554 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 9555 | tempbl = CRT2Delay1 ; // Get CRT2 Delay |
| 9556 | |
| 9557 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9558 | tempbl = CRT2Delay2 ; |
| 9559 | */ |
| 9560 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 9561 | { |
| 9562 | index = XGI_GetLCDCapPtr(pVBInfo) ; /* Get LCD Delay */ |
| 9563 | tempbh=pVBInfo->LCDCapList[ index ].LCD_DelayCompensation ; |
| 9564 | |
| 9565 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) |
| 9566 | tempbl = tempbh ; |
| 9567 | } |
| 9568 | |
| 9569 | tempbl &= 0x0F ; |
| 9570 | tempbh &= 0xF0 ; |
| 9571 | tempah = XGINew_GetReg1( pVBInfo->Part1Port , 0x2D ) ; |
| 9572 | |
| 9573 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV ) ) /* Channel B */ |
| 9574 | { |
| 9575 | tempah &= 0xF0 ; |
| 9576 | tempah |= tempbl ; |
| 9577 | } |
| 9578 | |
| 9579 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) /* Channel A */ |
| 9580 | { |
| 9581 | tempah &= 0x0F ; |
| 9582 | tempah |= tempbh ; |
| 9583 | } |
| 9584 | XGINew_SetReg1(pVBInfo->Part1Port,0x2D,tempah); |
| 9585 | } |
| 9586 | } |
| 9587 | else if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 9588 | { |
| 9589 | tempbl = 0; |
| 9590 | tempbh = 0; |
| 9591 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 9592 | { |
| 9593 | tempah = pVBInfo->LCDCapList[ XGI_GetLCDCapPtr(pVBInfo) ].LCD_DelayCompensation ; /* / Get LCD Delay */ |
| 9594 | tempah &= 0x0f ; |
| 9595 | tempah = tempah << 4 ; |
| 9596 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2D , 0x0f , tempah ) ; |
| 9597 | } |
| 9598 | } |
| 9599 | } |
| 9600 | |
| 9601 | |
| 9602 | /* --------------------------------------------------------------------- */ |
| 9603 | /* Function : XGI_SetLCDCap */ |
| 9604 | /* Input : */ |
| 9605 | /* Output : */ |
| 9606 | /* Description : */ |
| 9607 | /* --------------------------------------------------------------------- */ |
| 9608 | void XGI_SetLCDCap( PVB_DEVICE_INFO pVBInfo ) |
| 9609 | { |
| 9610 | USHORT tempcx ; |
| 9611 | |
| 9612 | tempcx = pVBInfo->LCDCapList[ XGI_GetLCDCapPtr(pVBInfo) ].LCD_Capability ; |
| 9613 | |
| 9614 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9615 | { |
| 9616 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9617 | { /* 301LV/302LV only */ |
| 9618 | /* Set 301LV Capability */ |
| 9619 | XGINew_SetReg1( pVBInfo->Part4Port , 0x24 , ( UCHAR )( tempcx & 0x1F ) ) ; |
| 9620 | } |
| 9621 | /* VB Driving */ |
| 9622 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x0D , ~( ( EnableVBCLKDRVLOW | EnablePLLSPLOW ) >> 8 ) , ( USHORT )( ( tempcx & ( EnableVBCLKDRVLOW | EnablePLLSPLOW ) ) >> 8 ) ) ; |
| 9623 | } |
| 9624 | |
| 9625 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9626 | { |
| 9627 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 9628 | XGI_SetLCDCap_B( tempcx,pVBInfo ) ; |
| 9629 | else if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 9630 | XGI_SetLCDCap_A( tempcx,pVBInfo ) ; |
| 9631 | |
| 9632 | if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) ) |
| 9633 | { |
| 9634 | if ( tempcx & EnableSpectrum ) |
| 9635 | SetSpectrum( pVBInfo) ; |
| 9636 | } |
| 9637 | } |
| 9638 | else /* LVDS,CH7017 */ |
| 9639 | XGI_SetLCDCap_A( tempcx, pVBInfo ) ; |
| 9640 | } |
| 9641 | |
| 9642 | |
| 9643 | /* --------------------------------------------------------------------- */ |
| 9644 | /* Function : XGI_SetLCDCap_A */ |
| 9645 | /* Input : */ |
| 9646 | /* Output : */ |
| 9647 | /* Description : */ |
| 9648 | /* --------------------------------------------------------------------- */ |
| 9649 | void XGI_SetLCDCap_A(USHORT tempcx,PVB_DEVICE_INFO pVBInfo) |
| 9650 | { |
| 9651 | USHORT temp ; |
| 9652 | |
| 9653 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; |
| 9654 | |
| 9655 | if ( temp & LCDRGB18Bit ) |
| 9656 | { |
| 9657 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x19 , 0x0F , ( USHORT )( 0x20 | ( tempcx & 0x00C0 ) ) ) ; /* Enable Dither */ |
| 9658 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x1A , 0x7F , 0x80 ) ; |
| 9659 | } |
| 9660 | else |
| 9661 | { |
| 9662 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x19 , 0x0F , ( USHORT )( 0x30 | ( tempcx & 0x00C0 ) ) ) ; |
| 9663 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x1A , 0x7F , 0x00 ) ; |
| 9664 | } |
| 9665 | |
| 9666 | /* |
| 9667 | if ( tempcx & EnableLCD24bpp ) // 24bits |
| 9668 | { |
| 9669 | XGINew_SetRegANDOR(pVBInfo->Part1Port,0x19, 0x0F,(USHORT)(0x30|(tempcx&0x00C0)) ); |
| 9670 | XGINew_SetRegANDOR(pVBInfo->Part1Port,0x1A,0x7F,0x00); |
| 9671 | } |
| 9672 | else |
| 9673 | { |
| 9674 | XGINew_SetRegANDOR(pVBInfo->Part1Port,0x19, 0x0F,(USHORT)(0x20|(tempcx&0x00C0)) );//Enable Dither |
| 9675 | XGINew_SetRegANDOR(pVBInfo->Part1Port,0x1A,0x7F,0x80); |
| 9676 | } |
| 9677 | */ |
| 9678 | } |
| 9679 | |
| 9680 | |
| 9681 | /* --------------------------------------------------------------------- */ |
| 9682 | /* Function : XGI_SetLCDCap_B */ |
| 9683 | /* Input : cx -> LCD Capability */ |
| 9684 | /* Output : */ |
| 9685 | /* Description : */ |
| 9686 | /* --------------------------------------------------------------------- */ |
| 9687 | void XGI_SetLCDCap_B(USHORT tempcx,PVB_DEVICE_INFO pVBInfo) |
| 9688 | { |
| 9689 | if ( tempcx & EnableLCD24bpp ) /* 24bits */ |
| 9690 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x1A , 0xE0 , ( USHORT )( ( ( tempcx & 0x00ff ) >> 6 ) | 0x0c ) ) ; |
| 9691 | else |
| 9692 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x1A , 0xE0 , ( USHORT )( ( ( tempcx & 0x00ff ) >> 6 ) | 0x18 ) ) ; /* Enable Dither */ |
| 9693 | } |
| 9694 | |
| 9695 | |
| 9696 | /* --------------------------------------------------------------------- */ |
| 9697 | /* Function : SetSpectrum */ |
| 9698 | /* Input : */ |
| 9699 | /* Output : */ |
| 9700 | /* Description : */ |
| 9701 | /* --------------------------------------------------------------------- */ |
| 9702 | void SetSpectrum( PVB_DEVICE_INFO pVBInfo ) |
| 9703 | { |
| 9704 | USHORT index ; |
| 9705 | |
| 9706 | index = XGI_GetLCDCapPtr(pVBInfo) ; |
| 9707 | |
| 9708 | XGINew_SetRegAND( pVBInfo->Part4Port , 0x30 , 0x8F ) ; /* disable down spectrum D[4] */ |
| 9709 | XGI_LongWait(pVBInfo) ; |
| 9710 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x30 , 0x20 ) ; /* reset spectrum */ |
| 9711 | XGI_LongWait(pVBInfo) ; |
| 9712 | |
| 9713 | XGINew_SetReg1( pVBInfo->Part4Port , 0x31 , pVBInfo->LCDCapList[ index ].Spectrum_31 ) ; |
| 9714 | XGINew_SetReg1( pVBInfo->Part4Port , 0x32 , pVBInfo->LCDCapList[ index ].Spectrum_32 ) ; |
| 9715 | XGINew_SetReg1( pVBInfo->Part4Port , 0x33 , pVBInfo->LCDCapList[ index ].Spectrum_33 ) ; |
| 9716 | XGINew_SetReg1( pVBInfo->Part4Port , 0x34 , pVBInfo->LCDCapList[ index ].Spectrum_34 ) ; |
| 9717 | XGI_LongWait(pVBInfo) ; |
| 9718 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x30 , 0x40 ) ; /* enable spectrum */ |
| 9719 | } |
| 9720 | |
| 9721 | |
| 9722 | /* --------------------------------------------------------------------- */ |
| 9723 | /* Function : XGI_SetAntiFlicker */ |
| 9724 | /* Input : */ |
| 9725 | /* Output : */ |
| 9726 | /* Description : Set TV Customized Param. */ |
| 9727 | /* --------------------------------------------------------------------- */ |
| 9728 | void XGI_SetAntiFlicker( USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo ) |
| 9729 | { |
| 9730 | USHORT tempbx , |
| 9731 | index ; |
| 9732 | |
| 9733 | UCHAR tempah ; |
| 9734 | |
| 9735 | if (pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) |
| 9736 | return ; |
| 9737 | |
| 9738 | tempbx = XGI_GetTVPtrIndex(pVBInfo ) ; |
| 9739 | tempbx &= 0xFE ; |
| 9740 | |
| 9741 | if ( ModeNo <= 0x13 ) |
| 9742 | { |
| 9743 | index = pVBInfo->SModeIDTable[ ModeIdIndex ].VB_StTVFlickerIndex ; |
| 9744 | } |
| 9745 | else |
| 9746 | { |
| 9747 | index = pVBInfo->EModeIDTable[ ModeIdIndex ].VB_ExtTVFlickerIndex ; |
| 9748 | } |
| 9749 | |
| 9750 | tempbx += index ; |
| 9751 | tempah = TVAntiFlickList[ tempbx ] ; |
| 9752 | tempah = tempah << 4 ; |
| 9753 | |
| 9754 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x0A , 0x8F , tempah ) ; |
| 9755 | } |
| 9756 | |
| 9757 | |
| 9758 | /* --------------------------------------------------------------------- */ |
| 9759 | /* Function : XGI_SetEdgeEnhance */ |
| 9760 | /* Input : */ |
| 9761 | /* Output : */ |
| 9762 | /* Description : */ |
| 9763 | /* --------------------------------------------------------------------- */ |
| 9764 | void XGI_SetEdgeEnhance( USHORT ModeNo , USHORT ModeIdIndex , PVB_DEVICE_INFO pVBInfo) |
| 9765 | { |
| 9766 | USHORT tempbx , |
| 9767 | index ; |
| 9768 | |
| 9769 | UCHAR tempah ; |
| 9770 | |
| 9771 | |
| 9772 | tempbx = XGI_GetTVPtrIndex(pVBInfo ) ; |
| 9773 | tempbx &= 0xFE ; |
| 9774 | |
| 9775 | if ( ModeNo <= 0x13 ) |
| 9776 | { |
| 9777 | index = pVBInfo->SModeIDTable[ ModeIdIndex ].VB_StTVEdgeIndex ; |
| 9778 | } |
| 9779 | else |
| 9780 | { |
| 9781 | index = pVBInfo->EModeIDTable[ ModeIdIndex ].VB_ExtTVEdgeIndex ; |
| 9782 | } |
| 9783 | |
| 9784 | tempbx += index ; |
| 9785 | tempah = TVEdgeList[ tempbx ] ; |
| 9786 | tempah = tempah << 5 ; |
| 9787 | |
| 9788 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x3A , 0x1F , tempah ) ; |
| 9789 | } |
| 9790 | |
| 9791 | |
| 9792 | /* --------------------------------------------------------------------- */ |
| 9793 | /* Function : XGI_SetPhaseIncr */ |
| 9794 | /* Input : */ |
| 9795 | /* Output : */ |
| 9796 | /* Description : */ |
| 9797 | /* --------------------------------------------------------------------- */ |
| 9798 | void XGI_SetPhaseIncr( PVB_DEVICE_INFO pVBInfo ) |
| 9799 | { |
| 9800 | USHORT tempbx ; |
| 9801 | |
| 9802 | UCHAR tempcl , |
| 9803 | tempch ; |
| 9804 | |
| 9805 | ULONG tempData ; |
| 9806 | |
| 9807 | XGI_GetTVPtrIndex2( &tempbx , &tempcl , &tempch, pVBInfo ) ; /* bx, cl, ch */ |
| 9808 | tempData = TVPhaseList[ tempbx ] ; |
| 9809 | |
| 9810 | XGINew_SetReg1( pVBInfo->Part2Port , 0x31 , ( USHORT )( tempData & 0x000000FF ) ) ; |
| 9811 | XGINew_SetReg1( pVBInfo->Part2Port , 0x32 , ( USHORT )( ( tempData & 0x0000FF00 ) >> 8 ) ) ; |
| 9812 | XGINew_SetReg1( pVBInfo->Part2Port , 0x33 , ( USHORT )( ( tempData & 0x00FF0000 ) >> 16 ) ) ; |
| 9813 | XGINew_SetReg1( pVBInfo->Part2Port , 0x34 , ( USHORT )( ( tempData & 0xFF000000 ) >> 24 ) ) ; |
| 9814 | } |
| 9815 | |
| 9816 | |
| 9817 | /* --------------------------------------------------------------------- */ |
| 9818 | /* Function : XGI_SetYFilter */ |
| 9819 | /* Input : */ |
| 9820 | /* Output : */ |
| 9821 | /* Description : */ |
| 9822 | /* --------------------------------------------------------------------- */ |
| 9823 | void XGI_SetYFilter( USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo) |
| 9824 | { |
| 9825 | USHORT tempbx , |
| 9826 | index ; |
| 9827 | |
| 9828 | UCHAR tempcl , |
| 9829 | tempch , |
| 9830 | tempal , |
| 9831 | *filterPtr ; |
| 9832 | |
| 9833 | XGI_GetTVPtrIndex2( &tempbx , &tempcl , &tempch, pVBInfo ) ; /* bx, cl, ch */ |
| 9834 | |
| 9835 | switch( tempbx ) |
| 9836 | { |
| 9837 | case 0x00: |
| 9838 | case 0x04: |
| 9839 | filterPtr = NTSCYFilter1 ; |
| 9840 | break ; |
| 9841 | |
| 9842 | case 0x01: |
| 9843 | filterPtr = PALYFilter1 ; |
| 9844 | break ; |
| 9845 | |
| 9846 | case 0x02: |
| 9847 | case 0x05: |
| 9848 | case 0x0D: |
| 9849 | filterPtr = PALMYFilter1 ; |
| 9850 | break ; |
| 9851 | |
| 9852 | case 0x03: |
| 9853 | filterPtr = PALNYFilter1 ; |
| 9854 | break ; |
| 9855 | |
| 9856 | case 0x08: |
| 9857 | case 0x0C: |
| 9858 | filterPtr = NTSCYFilter2 ; |
| 9859 | break ; |
| 9860 | |
| 9861 | case 0x0A: |
| 9862 | filterPtr = PALMYFilter2 ; |
| 9863 | break ; |
| 9864 | |
| 9865 | case 0x0B: |
| 9866 | filterPtr = PALNYFilter2 ; |
| 9867 | break ; |
| 9868 | |
| 9869 | case 0x09: |
| 9870 | filterPtr = PALYFilter2 ; |
| 9871 | break ; |
| 9872 | |
| 9873 | default: |
| 9874 | return ; |
| 9875 | } |
| 9876 | |
| 9877 | if ( ModeNo <= 0x13 ) |
| 9878 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].VB_StTVYFilterIndex ; |
| 9879 | else |
| 9880 | tempal = pVBInfo->EModeIDTable[ ModeIdIndex ].VB_ExtTVYFilterIndex ; |
| 9881 | |
| 9882 | if ( tempcl == 0 ) |
| 9883 | index = tempal * 4; |
| 9884 | else |
| 9885 | index = tempal * 7; |
| 9886 | |
| 9887 | if ( ( tempcl == 0 ) && ( tempch == 1 ) ) |
| 9888 | { |
| 9889 | XGINew_SetReg1( pVBInfo->Part2Port , 0x35 , 0 ) ; |
| 9890 | XGINew_SetReg1( pVBInfo->Part2Port , 0x36 , 0 ) ; |
| 9891 | XGINew_SetReg1( pVBInfo->Part2Port , 0x37 , 0 ) ; |
| 9892 | XGINew_SetReg1( pVBInfo->Part2Port , 0x38 , filterPtr[ index++ ] ) ; |
| 9893 | } |
| 9894 | else |
| 9895 | { |
| 9896 | XGINew_SetReg1( pVBInfo->Part2Port , 0x35 , filterPtr[ index++ ] ) ; |
| 9897 | XGINew_SetReg1( pVBInfo->Part2Port , 0x36 , filterPtr[ index++ ] ) ; |
| 9898 | XGINew_SetReg1( pVBInfo->Part2Port , 0x37 , filterPtr[ index++ ] ) ; |
| 9899 | XGINew_SetReg1( pVBInfo->Part2Port , 0x38 , filterPtr[ index++ ] ) ; |
| 9900 | } |
| 9901 | |
| 9902 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9903 | { |
| 9904 | XGINew_SetReg1( pVBInfo->Part2Port , 0x48 , filterPtr[ index++ ] ) ; |
| 9905 | XGINew_SetReg1( pVBInfo->Part2Port , 0x49 , filterPtr[ index++ ] ) ; |
| 9906 | XGINew_SetReg1( pVBInfo->Part2Port , 0x4A , filterPtr[ index++ ] ) ; |
| 9907 | } |
| 9908 | } |
| 9909 | |
| 9910 | |
| 9911 | /* --------------------------------------------------------------------- */ |
| 9912 | /* Function : XGI_GetTVPtrIndex2 */ |
| 9913 | /* Input : */ |
| 9914 | /* Output : bx 0 : NTSC */ |
| 9915 | /* 1 : PAL */ |
| 9916 | /* 2 : PALM */ |
| 9917 | /* 3 : PALN */ |
| 9918 | /* 4 : NTSC1024x768 */ |
| 9919 | /* 5 : PAL-M 1024x768 */ |
| 9920 | /* 6-7: reserved */ |
| 9921 | /* cl 0 : YFilter1 */ |
| 9922 | /* 1 : YFilter2 */ |
| 9923 | /* ch 0 : 301A */ |
| 9924 | /* 1 : 301B/302B/301LV/302LV */ |
| 9925 | /* Description : */ |
| 9926 | /* --------------------------------------------------------------------- */ |
| 9927 | void XGI_GetTVPtrIndex2(USHORT* tempbx,UCHAR* tempcl,UCHAR* tempch, PVB_DEVICE_INFO pVBInfo) |
| 9928 | { |
| 9929 | *tempbx = 0 ; |
| 9930 | *tempcl = 0 ; |
| 9931 | *tempch = 0 ; |
| 9932 | |
| 9933 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 9934 | *tempbx = 1 ; |
| 9935 | |
| 9936 | if ( pVBInfo->TVInfo & SetPALMTV ) |
| 9937 | *tempbx = 2 ; |
| 9938 | |
| 9939 | if ( pVBInfo->TVInfo & SetPALNTV ) |
| 9940 | *tempbx = 3 ; |
| 9941 | |
| 9942 | if ( pVBInfo->TVInfo & NTSC1024x768 ) |
| 9943 | { |
| 9944 | *tempbx = 4 ; |
| 9945 | if ( pVBInfo->TVInfo & SetPALMTV ) |
| 9946 | *tempbx = 5 ; |
| 9947 | } |
| 9948 | |
| 9949 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9950 | { |
| 9951 | if ( ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) || ( pVBInfo->TVInfo & TVSimuMode ) ) |
| 9952 | { |
| 9953 | *tempbx += 8 ; |
| 9954 | *tempcl += 1 ; |
| 9955 | } |
| 9956 | } |
| 9957 | |
| 9958 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9959 | (*tempch)++ ; |
| 9960 | } |
| 9961 | |
| 9962 | |
| 9963 | /* --------------------------------------------------------------------- */ |
| 9964 | /* Function : XGI_SetCRT2ModeRegs */ |
| 9965 | /* Input : */ |
| 9966 | /* Output : */ |
| 9967 | /* Description : Origin code for crt2group */ |
| 9968 | /* --------------------------------------------------------------------- */ |
| 9969 | void XGI_SetCRT2ModeRegs(USHORT ModeNo,PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo) |
| 9970 | { |
| 9971 | USHORT tempbl ; |
| 9972 | SHORT tempcl ; |
| 9973 | |
| 9974 | UCHAR tempah ; |
| 9975 | |
| 9976 | /* XGINew_SetReg1( pVBInfo->Part1Port , 0x03 , 0x00 ) ; // fix write part1 index 0 BTDRAM bit Bug */ |
| 9977 | tempah=0; |
| 9978 | if ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) |
| 9979 | { |
| 9980 | tempah=XGINew_GetReg1( pVBInfo->Part1Port , 0x00 ) ; |
| 9981 | tempah &= ~0x10 ; /* BTRAMDAC */ |
| 9982 | tempah |= 0x40 ; /* BTRAM */ |
| 9983 | |
| 9984 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD ) ) |
| 9985 | { |
| 9986 | tempah=0x40; /* BTDRAM */ |
| 9987 | if ( ModeNo > 0x13 ) |
| 9988 | { |
| 9989 | tempcl = pVBInfo->ModeType ; |
| 9990 | tempcl -= ModeVGA ; |
| 9991 | if ( tempcl >= 0 ) |
| 9992 | { |
| 9993 | tempah = ( 0x008 >> tempcl ) ; /* BT Color */ |
| 9994 | if ( tempah == 0 ) |
| 9995 | tempah = 1 ; |
| 9996 | tempah |= 0x040 ; |
| 9997 | } |
| 9998 | } |
| 9999 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 10000 | tempah ^= 0x50 ; /* BTDAC */ |
| 10001 | } |
| 10002 | } |
| 10003 | |
| 10004 | /* 0210 shampoo |
| 10005 | if ( pVBInfo->VBInfo & DisableCRT2Display ) |
| 10006 | { |
| 10007 | tempah = 0 ; |
| 10008 | } |
| 10009 | |
| 10010 | XGINew_SetReg1( pVBInfo->Part1Port , 0x00 , tempah ) ; |
| 10011 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD ) ) |
| 10012 | { |
| 10013 | tempcl = pVBInfo->ModeType ; |
| 10014 | if ( ModeNo > 0x13 ) |
| 10015 | { |
| 10016 | tempcl -= ModeVGA ; |
| 10017 | if ( ( tempcl > 0 ) || ( tempcl == 0 ) ) |
| 10018 | { |
| 10019 | tempah=(0x008>>tempcl) ; |
| 10020 | if ( tempah == 0 ) |
| 10021 | tempah = 1 ; |
| 10022 | tempah |= 0x040; |
| 10023 | } |
| 10024 | } |
| 10025 | else |
| 10026 | { |
| 10027 | tempah = 0x040 ; |
| 10028 | } |
| 10029 | |
| 10030 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 10031 | { |
| 10032 | tempah = ( tempah ^ 0x050 ) ; |
| 10033 | } |
| 10034 | } |
| 10035 | */ |
| 10036 | |
| 10037 | XGINew_SetReg1( pVBInfo->Part1Port , 0x00 , tempah ) ; |
| 10038 | tempah = 0x08 ; |
| 10039 | tempbl = 0xf0 ; |
| 10040 | |
| 10041 | if ( pVBInfo->VBInfo & DisableCRT2Display ) |
| 10042 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ; |
| 10043 | else |
| 10044 | { |
| 10045 | tempah = 0x00 ; |
| 10046 | tempbl = 0xff ; |
| 10047 | |
| 10048 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 10049 | { |
| 10050 | if ( ( pVBInfo->VBInfo & SetCRT2ToLCDA ) && ( !( pVBInfo->VBInfo & SetSimuScanMode ) ) ) |
| 10051 | { |
| 10052 | tempbl &= 0xf7 ; |
| 10053 | tempah |= 0x01 ; |
| 10054 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ; |
| 10055 | } |
| 10056 | else |
| 10057 | { |
| 10058 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 10059 | { |
| 10060 | tempbl &= 0xf7 ; |
| 10061 | tempah |= 0x01 ; |
| 10062 | } |
| 10063 | |
| 10064 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD ) ) |
| 10065 | { |
| 10066 | tempbl &= 0xf8 ; |
| 10067 | tempah = 0x01 ; |
| 10068 | |
| 10069 | if ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) |
| 10070 | tempah |= 0x02 ; |
| 10071 | |
| 10072 | if ( !( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) ) |
| 10073 | { |
| 10074 | tempah = tempah ^ 0x05 ; |
| 10075 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCD ) ) |
| 10076 | tempah = tempah ^ 0x01 ; |
| 10077 | } |
| 10078 | |
| 10079 | if ( !( pVBInfo->VBInfo & SetCRT2ToDualEdge ) ) |
| 10080 | tempah |= 0x08 ; |
| 10081 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ; |
| 10082 | } |
| 10083 | else |
| 10084 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ; |
| 10085 | } |
| 10086 | } |
| 10087 | else |
| 10088 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ; |
| 10089 | } |
| 10090 | |
| 10091 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 10092 | { |
| 10093 | tempah &= ( ~0x08 ) ; |
| 10094 | if ( ( pVBInfo->ModeType == ModeVGA ) && ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) ) |
| 10095 | { |
| 10096 | tempah |= 0x010 ; |
| 10097 | } |
| 10098 | tempah |= 0x080 ; |
| 10099 | |
| 10100 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 10101 | { |
| 10102 | /* if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) */ |
| 10103 | /* { */ |
| 10104 | tempah |= 0x020 ; |
| 10105 | if ( ModeNo > 0x13 ) |
| 10106 | { |
| 10107 | if ( pVBInfo->VBInfo & DriverMode ) |
| 10108 | tempah = tempah ^ 0x20 ; |
| 10109 | } |
| 10110 | /* } */ |
| 10111 | } |
| 10112 | |
| 10113 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x0D , ~0x0BF , tempah ) ; |
| 10114 | tempah = 0 ; |
| 10115 | |
| 10116 | if ( pVBInfo->LCDInfo & SetLCDDualLink ) |
| 10117 | tempah |= 0x40 ; |
| 10118 | |
| 10119 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 10120 | { |
| 10121 | /* if ( ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) ) && ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) ) */ |
| 10122 | /* { */ |
| 10123 | if ( pVBInfo->TVInfo & RPLLDIV2XO ) |
| 10124 | tempah |= 0x40 ; |
| 10125 | /* } */ |
| 10126 | } |
| 10127 | |
| 10128 | if ( ( pVBInfo->LCDResInfo == Panel1280x1024 ) || ( pVBInfo->LCDResInfo == Panel1280x1024x75 ) ) |
| 10129 | tempah |= 0x80 ; |
| 10130 | |
| 10131 | if ( pVBInfo->LCDResInfo == Panel1280x960 ) |
| 10132 | tempah |= 0x80 ; |
| 10133 | |
| 10134 | XGINew_SetReg1( pVBInfo->Part4Port , 0x0C , tempah ) ; |
| 10135 | } |
| 10136 | |
| 10137 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 10138 | { |
| 10139 | tempah = 0 ; |
| 10140 | tempbl = 0xfb ; |
| 10141 | |
| 10142 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) |
| 10143 | { |
| 10144 | tempbl=0xff; |
| 10145 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 10146 | tempah |= 0x04 ; /* shampoo 0129 */ |
| 10147 | } |
| 10148 | |
| 10149 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x13 , tempbl , tempah ) ; |
| 10150 | tempah = 0x00 ; |
| 10151 | tempbl = 0xcf ; |
| 10152 | if ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) |
| 10153 | { |
| 10154 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) |
| 10155 | tempah |= 0x30 ; |
| 10156 | } |
| 10157 | |
| 10158 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2c , tempbl , tempah ) ; |
| 10159 | tempah = 0 ; |
| 10160 | tempbl = 0x3f ; |
| 10161 | |
| 10162 | if ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) |
| 10163 | { |
| 10164 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) |
| 10165 | tempah |= 0xc0 ; |
| 10166 | } |
| 10167 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x21 , tempbl , tempah ) ; |
| 10168 | } |
| 10169 | |
| 10170 | tempah = 0 ; |
| 10171 | tempbl = 0x7f ; |
| 10172 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) |
| 10173 | { |
| 10174 | tempbl = 0xff ; |
| 10175 | if ( !( pVBInfo->VBInfo & SetCRT2ToDualEdge ) ) |
| 10176 | tempah |= 0x80 ; |
| 10177 | } |
| 10178 | |
| 10179 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x23 , tempbl , tempah ) ; |
| 10180 | |
| 10181 | if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) ) |
| 10182 | { |
| 10183 | if ( pVBInfo->LCDInfo & SetLCDDualLink ) |
| 10184 | { |
| 10185 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x27 , 0x20 ) ; |
| 10186 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x34 , 0x10 ) ; |
| 10187 | } |
| 10188 | } |
| 10189 | } |
| 10190 | |
| 10191 | |
| 10192 | /* --------------------------------------------------------------------- */ |
| 10193 | /* Function : XGI_CloseCRTC */ |
| 10194 | /* Input : */ |
| 10195 | /* Output : */ |
| 10196 | /* Description : */ |
| 10197 | /* --------------------------------------------------------------------- */ |
| 10198 | void XGI_CloseCRTC( PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo ) |
| 10199 | { |
| 10200 | USHORT tempbx ; |
| 10201 | |
| 10202 | tempbx = 0 ; |
| 10203 | |
| 10204 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 10205 | tempbx = 0x08A0 ; |
| 10206 | |
| 10207 | |
| 10208 | } |
| 10209 | |
| 10210 | |
| 10211 | /* --------------------------------------------------------------------- */ |
| 10212 | /* Function : XGI_OpenCRTC */ |
| 10213 | /* Input : */ |
| 10214 | /* Output : */ |
| 10215 | /* Description : */ |
| 10216 | /* --------------------------------------------------------------------- */ |
| 10217 | void XGI_OpenCRTC( PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo ) |
| 10218 | { |
| 10219 | USHORT tempbx ; |
| 10220 | |
| 10221 | tempbx = 0 ; |
| 10222 | |
| 10223 | |
| 10224 | } |
| 10225 | |
| 10226 | |
| 10227 | /* --------------------------------------------------------------------- */ |
| 10228 | /* Function : XGI_GetRAMDAC2DATA */ |
| 10229 | /* Input : */ |
| 10230 | /* Output : */ |
| 10231 | /* Description : */ |
| 10232 | /* --------------------------------------------------------------------- */ |
| 10233 | void XGI_GetRAMDAC2DATA(USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex, PVB_DEVICE_INFO pVBInfo ) |
| 10234 | { |
| 10235 | USHORT tempax , |
| 10236 | tempbx , |
| 10237 | temp1 , |
| 10238 | temp2 , |
| 10239 | modeflag = 0 , |
| 10240 | tempcx , |
| 10241 | StandTableIndex , |
| 10242 | CRT1Index ; |
| 10243 | |
| 10244 | pVBInfo->RVBHCMAX = 1 ; |
| 10245 | pVBInfo->RVBHCFACT = 1 ; |
| 10246 | |
| 10247 | if ( ModeNo <= 0x13 ) |
| 10248 | { |
| 10249 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 10250 | StandTableIndex = XGI_GetModePtr( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 10251 | tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 0 ] ; |
| 10252 | tempbx = pVBInfo->StandTable[StandTableIndex ].CRTC[ 6 ] ; |
| 10253 | temp1 = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 7 ] ; |
| 10254 | } |
| 10255 | else |
| 10256 | { |
| 10257 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 10258 | CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 10259 | CRT1Index &= IndexMask ; |
| 10260 | temp1 = ( USHORT )pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 0 ] ; |
| 10261 | temp2 = ( USHORT )pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 5 ] ; |
| 10262 | tempax = ( temp1 & 0xFF ) | ( ( temp2 & 0x03 ) << 8 ) ; |
| 10263 | tempbx = ( USHORT )pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 8 ] ; |
| 10264 | tempcx = ( USHORT )pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 14 ] << 8 ; |
| 10265 | tempcx &= 0x0100 ; |
| 10266 | tempcx = tempcx << 2 ; |
| 10267 | tempbx |= tempcx; |
| 10268 | temp1 = ( USHORT )pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 9 ] ; |
| 10269 | } |
| 10270 | |
| 10271 | if ( temp1 & 0x01 ) |
| 10272 | tempbx |= 0x0100 ; |
| 10273 | |
| 10274 | if ( temp1 & 0x20 ) |
| 10275 | tempbx |= 0x0200 ; |
| 10276 | tempax += 5 ; |
| 10277 | |
| 10278 | if ( modeflag & Charx8Dot ) |
| 10279 | tempax *= 8 ; |
| 10280 | else |
| 10281 | tempax *= 9 ; |
| 10282 | |
| 10283 | pVBInfo->VGAHT = tempax ; |
| 10284 | pVBInfo->HT = tempax ; |
| 10285 | tempbx++ ; |
| 10286 | pVBInfo->VGAVT = tempbx ; |
| 10287 | pVBInfo->VT = tempbx ; |
| 10288 | } |
| 10289 | |
| 10290 | |
| 10291 | |
| 10292 | /* --------------------------------------------------------------------- */ |
| 10293 | /* Function : XGI_GetColorDepth */ |
| 10294 | /* Input : */ |
| 10295 | /* Output : */ |
| 10296 | /* Description : */ |
| 10297 | /* --------------------------------------------------------------------- */ |
| 10298 | USHORT XGI_GetColorDepth(USHORT ModeNo , USHORT ModeIdIndex, PVB_DEVICE_INFO pVBInfo) |
| 10299 | { |
| 10300 | USHORT ColorDepth[ 6 ] = { 1 , 2 , 4 , 4 , 6 , 8 } ; |
| 10301 | SHORT index ; |
| 10302 | USHORT modeflag ; |
| 10303 | |
| 10304 | if ( ModeNo <= 0x13 ) |
| 10305 | { |
| 10306 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 10307 | } |
| 10308 | else |
| 10309 | { |
| 10310 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 10311 | } |
| 10312 | |
| 10313 | index=(modeflag&ModeInfoFlag)-ModeEGA; |
| 10314 | |
| 10315 | if ( index < 0 ) |
| 10316 | index = 0 ; |
| 10317 | |
| 10318 | return( ColorDepth[ index ] ) ; |
| 10319 | } |
| 10320 | |
| 10321 | |
| 10322 | |
| 10323 | /* --------------------------------------------------------------------- */ |
| 10324 | /* Function : XGI_UnLockCRT2 */ |
| 10325 | /* Input : */ |
| 10326 | /* Output : */ |
| 10327 | /* Description : */ |
| 10328 | /* --------------------------------------------------------------------- */ |
| 10329 | void XGI_UnLockCRT2( PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo ) |
| 10330 | { |
| 10331 | |
| 10332 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2f , 0xFF , 0x01 ) ; |
| 10333 | |
| 10334 | } |
| 10335 | |
| 10336 | |
| 10337 | /* --------------------------------------------------------------------- */ |
| 10338 | /* Function : XGI_LockCRT2 */ |
| 10339 | /* Input : */ |
| 10340 | /* Output : */ |
| 10341 | /* Description : */ |
| 10342 | /* --------------------------------------------------------------------- */ |
| 10343 | void XGI_LockCRT2( PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_INFO pVBInfo ) |
| 10344 | { |
| 10345 | |
| 10346 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2F , 0xFE , 0x00 ) ; |
| 10347 | |
| 10348 | |
| 10349 | } |
| 10350 | |
| 10351 | |
| 10352 | /* --------------------------------------------------------------------- */ |
| 10353 | /* Function : XGINew_EnableCRT2 */ |
| 10354 | /* Input : */ |
| 10355 | /* Output : */ |
| 10356 | /* Description : */ |
| 10357 | /* --------------------------------------------------------------------- */ |
| 10358 | void XGINew_EnableCRT2( PVB_DEVICE_INFO pVBInfo) |
| 10359 | { |
| 10360 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x1E , 0xFF , 0x20 ) ; |
| 10361 | } |
| 10362 | |
| 10363 | |
| 10364 | |
| 10365 | /* --------------------------------------------------------------------- */ |
| 10366 | /* Function : */ |
| 10367 | /* Input : */ |
| 10368 | /* Output : */ |
| 10369 | /* Description : */ |
| 10370 | /* --------------------------------------------------------------------- */ |
| 10371 | void XGINew_LCD_Wait_Time(UCHAR DelayTime, PVB_DEVICE_INFO pVBInfo) |
| 10372 | { |
| 10373 | USHORT i , |
| 10374 | j ; |
| 10375 | |
| 10376 | ULONG temp , |
| 10377 | flag ; |
| 10378 | |
| 10379 | flag = 0 ; |
| 10380 | //printk("XGINew_LCD_Wait_Time"); |
| 10381 | //return; |
| 10382 | for( i = 0 ; i < DelayTime ; i++ ) |
| 10383 | { |
| 10384 | for( j = 0 ; j < 66 ; j++ ) |
| 10385 | { |
| 10386 | |
| 10387 | temp = XGINew_GetReg3( 0x61 ) ; |
| 10388 | |
| 10389 | //temp &= 0x10000000; |
| 10390 | temp &= 0x10; |
| 10391 | if ( temp == flag ) |
| 10392 | continue ; |
| 10393 | |
| 10394 | flag = temp ; |
| 10395 | } |
| 10396 | } |
| 10397 | } |
| 10398 | |
| 10399 | |
| 10400 | |
| 10401 | |
| 10402 | /* --------------------------------------------------------------------- */ |
| 10403 | /* Function : XGI_BridgeIsOn */ |
| 10404 | /* Input : */ |
| 10405 | /* Output : */ |
| 10406 | /* Description : */ |
| 10407 | /* --------------------------------------------------------------------- */ |
| 10408 | BOOLEAN XGI_BridgeIsOn( PVB_DEVICE_INFO pVBInfo ) |
| 10409 | { |
| 10410 | USHORT flag ; |
| 10411 | |
| 10412 | if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 10413 | { |
| 10414 | return( 1 ) ; |
| 10415 | } |
| 10416 | else |
| 10417 | { |
| 10418 | flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x00 ) ; |
| 10419 | if ( ( flag == 1 ) || ( flag == 2 ) ) |
| 10420 | return( 1 ) ; /* 301b */ |
| 10421 | else |
| 10422 | return( 0 ) ; |
| 10423 | } |
| 10424 | } |
| 10425 | |
| 10426 | |
| 10427 | |
| 10428 | /* --------------------------------------------------------------------- */ |
| 10429 | /* Function : XGI_LongWait */ |
| 10430 | /* Input : */ |
| 10431 | /* Output : */ |
| 10432 | /* Description : */ |
| 10433 | /* --------------------------------------------------------------------- */ |
| 10434 | void XGI_LongWait(PVB_DEVICE_INFO pVBInfo) |
| 10435 | { |
| 10436 | USHORT i ; |
| 10437 | |
| 10438 | i = XGINew_GetReg1( pVBInfo->P3c4 , 0x1F ) ; |
| 10439 | |
| 10440 | if ( !( i & 0xC0 ) ) |
| 10441 | { |
| 10442 | for( i = 0 ; i < 0xFFFF ; i++ ) |
| 10443 | { |
| 10444 | if ( !( XGINew_GetReg2( pVBInfo->P3da ) & 0x08 ) ) |
| 10445 | break ; |
| 10446 | } |
| 10447 | |
| 10448 | for( i = 0 ; i < 0xFFFF ; i++ ) |
| 10449 | { |
| 10450 | if ( ( XGINew_GetReg2( pVBInfo->P3da ) & 0x08 ) ) |
| 10451 | break ; |
| 10452 | } |
| 10453 | } |
| 10454 | } |
| 10455 | |
| 10456 | |
| 10457 | /* --------------------------------------------------------------------- */ |
| 10458 | /* Function : XGI_VBLongWait */ |
| 10459 | /* Input : */ |
| 10460 | /* Output : */ |
| 10461 | /* Description : */ |
| 10462 | /* --------------------------------------------------------------------- */ |
| 10463 | void XGI_VBLongWait( PVB_DEVICE_INFO pVBInfo ) |
| 10464 | { |
| 10465 | USHORT tempal , |
| 10466 | temp , |
| 10467 | i , |
| 10468 | j ; |
| 10469 | return ; |
| 10470 | if ( !( pVBInfo->VBInfo & SetCRT2ToTV ) ) |
| 10471 | { |
| 10472 | temp = 0 ; |
| 10473 | for( i = 0 ; i < 3 ; i++ ) |
| 10474 | { |
| 10475 | for( j = 0 ; j < 100 ; j++ ) |
| 10476 | { |
| 10477 | tempal = XGINew_GetReg2( pVBInfo->P3da ) ; |
| 10478 | if ( temp & 0x01 ) |
| 10479 | { /* VBWaitMode2 */ |
| 10480 | if ( ( tempal & 0x08 ) ) |
| 10481 | { |
| 10482 | continue ; |
| 10483 | } |
| 10484 | |
| 10485 | if ( !( tempal & 0x08 ) ) |
| 10486 | { |
| 10487 | break ; |
| 10488 | } |
| 10489 | } |
| 10490 | else |
| 10491 | { /* VBWaitMode1 */ |
| 10492 | if ( !( tempal & 0x08 ) ) |
| 10493 | { |
| 10494 | continue ; |
| 10495 | } |
| 10496 | |
| 10497 | if ( ( tempal & 0x08 ) ) |
| 10498 | { |
| 10499 | break ; |
| 10500 | } |
| 10501 | } |
| 10502 | } |
| 10503 | temp = temp ^ 0x01 ; |
| 10504 | } |
| 10505 | } |
| 10506 | else |
| 10507 | { |
| 10508 | XGI_LongWait(pVBInfo) ; |
| 10509 | } |
| 10510 | return ; |
| 10511 | } |
| 10512 | |
| 10513 | |
| 10514 | |
| 10515 | |
| 10516 | /* --------------------------------------------------------------------- */ |
| 10517 | /* Function : XGI_GetVGAHT2 */ |
| 10518 | /* Input : */ |
| 10519 | /* Output : */ |
| 10520 | /* Description : */ |
| 10521 | /* --------------------------------------------------------------------- */ |
| 10522 | USHORT XGI_GetVGAHT2( PVB_DEVICE_INFO pVBInfo ) |
| 10523 | { |
| 10524 | ULONG tempax , |
| 10525 | tempbx ; |
| 10526 | |
| 10527 | tempbx = ( ( pVBInfo->VGAVT - pVBInfo->VGAVDE ) * pVBInfo->RVBHCMAX ) & 0xFFFF ; |
| 10528 | tempax = ( pVBInfo->VT - pVBInfo->VDE ) * pVBInfo->RVBHCFACT ; |
| 10529 | tempax = ( tempax * pVBInfo->HT ) /tempbx ; |
| 10530 | |
| 10531 | return( ( USHORT )tempax ) ; |
| 10532 | } |
| 10533 | |
| 10534 | |
| 10535 | /* --------------------------------------------------------------------- */ |
| 10536 | /* Function : XGI_GetVCLK2Ptr */ |
| 10537 | /* Input : */ |
| 10538 | /* Output : */ |
| 10539 | /* Description : */ |
| 10540 | /* --------------------------------------------------------------------- */ |
| 10541 | USHORT XGI_GetVCLK2Ptr( USHORT ModeNo , USHORT ModeIdIndex , USHORT RefreshRateTableIndex , PXGI_HW_DEVICE_INFO HwDeviceExtension ,PVB_DEVICE_INFO pVBInfo) |
| 10542 | { |
| 10543 | USHORT tempbx ; |
| 10544 | |
| 10545 | USHORT LCDXlat1VCLK[ 4 ] = { VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 } ; |
| 10546 | USHORT LCDXlat2VCLK[ 4 ] = { VCLK108_2 + 5 , VCLK108_2 + 5 , VCLK108_2 + 5 , VCLK108_2 + 5 } ; |
| 10547 | USHORT LVDSXlat1VCLK[ 4 ] = { VCLK40 , VCLK40 , VCLK40 , VCLK40 } ; |
| 10548 | USHORT LVDSXlat2VCLK[ 4 ] = { VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 } ; |
| 10549 | USHORT LVDSXlat3VCLK[ 4 ] = { VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 } ; |
| 10550 | |
| 10551 | USHORT CRT2Index , VCLKIndex ; |
| 10552 | USHORT modeflag , resinfo ; |
| 10553 | UCHAR *CHTVVCLKPtr = NULL ; |
| 10554 | |
| 10555 | if ( ModeNo <= 0x13 ) |
| 10556 | { |
| 10557 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 10558 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; |
| 10559 | CRT2Index = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; |
| 10560 | } |
| 10561 | else |
| 10562 | { |
| 10563 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ |
| 10564 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 10565 | CRT2Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ; |
| 10566 | } |
| 10567 | |
| 10568 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 10569 | { |
| 10570 | CRT2Index = CRT2Index >> 6 ; /* for LCD */ |
| 10571 | if ( ( ( pVBInfo->VBInfo & SetCRT2ToLCD ) | SetCRT2ToLCDA ) ) /*301b*/ |
| 10572 | { |
| 10573 | if ( pVBInfo->LCDResInfo != Panel1024x768 ) |
| 10574 | { |
| 10575 | VCLKIndex = LCDXlat2VCLK[ CRT2Index ] ; |
| 10576 | } |
| 10577 | else |
| 10578 | { |
| 10579 | VCLKIndex = LCDXlat1VCLK[ CRT2Index ] ; |
| 10580 | } |
| 10581 | } |
| 10582 | else /* for TV */ |
| 10583 | { |
| 10584 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 10585 | { |
| 10586 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 10587 | { |
| 10588 | if ( pVBInfo->SetFlag & RPLLDIV2XO ) |
| 10589 | { |
| 10590 | VCLKIndex = HiTVVCLKDIV2 ; |
| 10591 | |
| 10592 | |
| 10593 | VCLKIndex += 25 ; |
| 10594 | |
| 10595 | } |
| 10596 | else |
| 10597 | { |
| 10598 | VCLKIndex = HiTVVCLK ; |
| 10599 | |
| 10600 | |
| 10601 | VCLKIndex += 25 ; |
| 10602 | |
| 10603 | } |
| 10604 | |
| 10605 | if ( pVBInfo->SetFlag & TVSimuMode ) |
| 10606 | { |
| 10607 | if( modeflag & Charx8Dot ) |
| 10608 | { |
| 10609 | VCLKIndex = HiTVSimuVCLK ; |
| 10610 | |
| 10611 | |
| 10612 | VCLKIndex += 25 ; |
| 10613 | |
| 10614 | } |
| 10615 | else |
| 10616 | { |
| 10617 | VCLKIndex = HiTVTextVCLK ; |
| 10618 | |
| 10619 | |
| 10620 | VCLKIndex += 25 ; |
| 10621 | |
| 10622 | } |
| 10623 | } |
| 10624 | |
| 10625 | if ( pVBInfo->VBType & VB_XGI301LV ) /* 301lv */ |
| 10626 | { |
| 10627 | if ( !( pVBInfo->VBExtInfo == VB_YPbPr1080i ) ) |
| 10628 | { |
| 10629 | VCLKIndex = YPbPr750pVCLK ; |
| 10630 | if ( !( pVBInfo->VBExtInfo == VB_YPbPr750p ) ) |
| 10631 | { |
| 10632 | VCLKIndex = YPbPr525pVCLK ; |
| 10633 | if ( !( pVBInfo->VBExtInfo == VB_YPbPr525p ) ) |
| 10634 | { |
| 10635 | VCLKIndex = YPbPr525iVCLK_2 ; |
| 10636 | if ( !( pVBInfo->SetFlag & RPLLDIV2XO ) ) |
| 10637 | VCLKIndex = YPbPr525iVCLK ; |
| 10638 | } |
| 10639 | } |
| 10640 | } |
| 10641 | } |
| 10642 | } |
| 10643 | else |
| 10644 | { |
| 10645 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 10646 | { |
| 10647 | if ( pVBInfo->SetFlag & RPLLDIV2XO ) |
| 10648 | { |
| 10649 | VCLKIndex = TVVCLKDIV2 ; |
| 10650 | |
| 10651 | |
| 10652 | VCLKIndex += 25 ; |
| 10653 | |
| 10654 | } |
| 10655 | else |
| 10656 | { |
| 10657 | VCLKIndex = TVVCLK ; |
| 10658 | |
| 10659 | |
| 10660 | VCLKIndex += 25 ; |
| 10661 | |
| 10662 | } |
| 10663 | } |
| 10664 | } |
| 10665 | } |
| 10666 | else |
| 10667 | { /* for CRT2 */ |
| 10668 | VCLKIndex = ( UCHAR )XGINew_GetReg2( ( pVBInfo->P3ca + 0x02 ) ) ; /* Port 3cch */ |
| 10669 | VCLKIndex = ( ( VCLKIndex >> 2 ) & 0x03 ) ; |
| 10670 | if ( ModeNo > 0x13 ) |
| 10671 | { |
| 10672 | VCLKIndex = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ; /* di+Ext_CRTVCLK */ |
| 10673 | VCLKIndex &= IndexMask ; |
| 10674 | } |
| 10675 | } |
| 10676 | } |
| 10677 | } |
| 10678 | else |
| 10679 | { /* LVDS */ |
| 10680 | if ( ModeNo <= 0x13 ) |
| 10681 | VCLKIndex = CRT2Index ; |
| 10682 | else |
| 10683 | VCLKIndex = CRT2Index ; |
| 10684 | |
| 10685 | if ( pVBInfo->IF_DEF_CH7005 == 1 ) |
| 10686 | { |
| 10687 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCD ) ) |
| 10688 | { |
| 10689 | VCLKIndex &= 0x1f ; |
| 10690 | tempbx = 0 ; |
| 10691 | |
| 10692 | if ( pVBInfo->VBInfo & SetPALTV ) |
| 10693 | tempbx += 2 ; |
| 10694 | |
| 10695 | if ( pVBInfo->VBInfo & SetCHTVOverScan ) |
| 10696 | tempbx += 1 ; |
| 10697 | |
| 10698 | switch( tempbx ) |
| 10699 | { |
| 10700 | case 0: |
| 10701 | CHTVVCLKPtr = pVBInfo->CHTVVCLKUNTSC ; |
| 10702 | break ; |
| 10703 | case 1: |
| 10704 | CHTVVCLKPtr = pVBInfo->CHTVVCLKONTSC ; |
| 10705 | break; |
| 10706 | case 2: |
| 10707 | CHTVVCLKPtr = pVBInfo->CHTVVCLKUPAL ; |
| 10708 | break ; |
| 10709 | case 3: |
| 10710 | CHTVVCLKPtr = pVBInfo->CHTVVCLKOPAL ; |
| 10711 | break ; |
| 10712 | default: |
| 10713 | break ; |
| 10714 | } |
| 10715 | |
| 10716 | VCLKIndex = CHTVVCLKPtr[ VCLKIndex ] ; |
| 10717 | } |
| 10718 | } |
| 10719 | else |
| 10720 | { |
| 10721 | VCLKIndex = VCLKIndex >> 6 ; |
| 10722 | if ( ( pVBInfo->LCDResInfo == Panel800x600 ) || ( pVBInfo->LCDResInfo == Panel320x480 ) ) |
| 10723 | VCLKIndex = LVDSXlat1VCLK[ VCLKIndex ] ; |
| 10724 | else if ( ( pVBInfo->LCDResInfo == Panel1024x768 ) || ( pVBInfo->LCDResInfo == Panel1024x768x75 ) ) |
| 10725 | VCLKIndex = LVDSXlat2VCLK[ VCLKIndex ] ; |
| 10726 | else |
| 10727 | VCLKIndex = LVDSXlat3VCLK[ VCLKIndex ] ; |
| 10728 | } |
| 10729 | } |
| 10730 | /* VCLKIndex = VCLKIndex&IndexMask ; */ |
| 10731 | |
| 10732 | |
| 10733 | |
| 10734 | return( VCLKIndex ) ; |
| 10735 | } |
| 10736 | |