3 #include <linux/types.h>
4 #include <linux/version.h>
10 #include "vb_struct.h"
16 #define IndexMask 0xff
17 #ifndef XGI_MASK_DUAL_CHIP
18 #define XGI_MASK_DUAL_CHIP 0x04 /* SR3A */
23 BOOLEAN
XGI_IsLCDDualLink(PVB_DEVICE_INFO pVBInfo
);
24 BOOLEAN
XGI_SetCRT2Group301(USHORT ModeNo
, PXGI_HW_DEVICE_INFO HwDeviceExtension
,PVB_DEVICE_INFO pVBInfo
);
25 BOOLEAN
XGI_BacklightByDrv(PVB_DEVICE_INFO pVBInfo
);
27 BOOLEAN
XGI_IsLCDON(PVB_DEVICE_INFO pVBInfo
);
28 BOOLEAN
XGI_DisableChISLCD(PVB_DEVICE_INFO pVBInfo
);
29 BOOLEAN
XGI_EnableChISLCD(PVB_DEVICE_INFO pVBInfo
);
30 BOOLEAN
XGI_AjustCRT2Rate(USHORT ModeNo
,USHORT ModeIdIndex
,USHORT RefreshRateTableIndex
,USHORT
*i
, PVB_DEVICE_INFO pVBInfo
);
31 BOOLEAN
XGI_SearchModeID( USHORT ModeNo
,USHORT
*ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
);
32 BOOLEAN
XGI_GetLCDInfo(USHORT ModeNo
,USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
);
33 BOOLEAN
XGISetModeNew( PXGI_HW_DEVICE_INFO HwDeviceExtension
, USHORT ModeNo
) ;
34 BOOLEAN
XGI_BridgeIsOn(PVB_DEVICE_INFO pVBInfo
);
35 UCHAR
XGI_GetModePtr( USHORT ModeNo
,USHORT ModeIdIndex
,PVB_DEVICE_INFO pVBInfo
);
36 USHORT
XGI_GetOffset(USHORT ModeNo
,USHORT ModeIdIndex
,USHORT RefreshRateTableIndex
,PXGI_HW_DEVICE_INFO HwDeviceExtension
,PVB_DEVICE_INFO pVBInfo
);
37 USHORT
XGI_GetRatePtrCRT2( PXGI_HW_DEVICE_INFO pXGIHWDE
, USHORT ModeNo
,USHORT ModeIdIndex
,PVB_DEVICE_INFO pVBInfo
);
38 USHORT
XGI_GetResInfo(USHORT ModeNo
,USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
);
39 USHORT
XGI_GetColorDepth(USHORT ModeNo
,USHORT ModeIdIndex
,PVB_DEVICE_INFO pVBInfo
);
40 USHORT
XGI_GetVGAHT2(PVB_DEVICE_INFO pVBInfo
);
41 USHORT
XGI_GetVCLK2Ptr(USHORT ModeNo
,USHORT ModeIdIndex
,USHORT RefreshRateTableIndex
,PXGI_HW_DEVICE_INFO HwDeviceExtension
,PVB_DEVICE_INFO pVBInfo
);
42 void XGI_VBLongWait(PVB_DEVICE_INFO pVBInfo
);
43 void XGI_SaveCRT2Info(USHORT ModeNo
, PVB_DEVICE_INFO pVBInfo
);
44 void XGI_GetCRT2Data(USHORT ModeNo
,USHORT ModeIdIndex
,USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
);
45 void XGI_GetCRT2ResInfo(USHORT ModeNo
,USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
);
46 void XGI_PreSetGroup1(USHORT ModeNo
,USHORT ModeIdIndex
, PXGI_HW_DEVICE_INFO HwDeviceExtension
,USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
);
47 void XGI_SetGroup1(USHORT ModeNo
,USHORT ModeIdIndex
, PXGI_HW_DEVICE_INFO HwDeviceExtension
,USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
);
48 void XGI_SetLockRegs(USHORT ModeNo
,USHORT ModeIdIndex
, PXGI_HW_DEVICE_INFO HwDeviceExtension
,USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
);
49 void XGI_SetLCDRegs(USHORT ModeNo
,USHORT ModeIdIndex
, PXGI_HW_DEVICE_INFO HwDeviceExtension
,USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
);
50 void XGI_SetGroup2(USHORT ModeNo
,USHORT ModeIdIndex
,USHORT RefreshRateTableIndex
,PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
);
51 void XGI_SetGroup3(USHORT ModeNo
,USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
);
52 void XGI_SetGroup4(USHORT ModeNo
,USHORT ModeIdIndex
,USHORT RefreshRateTableIndex
,PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
);
53 void XGI_SetGroup5(USHORT ModeNo
,USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
);
54 void* XGI_GetLcdPtr(USHORT BX
, USHORT ModeNo
, USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
);
55 void* XGI_GetTVPtr(USHORT BX
, USHORT ModeNo
,USHORT ModeIdIndex
,USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
);
56 void XGI_FirePWDEnable(PVB_DEVICE_INFO pVBInfo
);
57 void XGI_EnableGatingCRT(PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
);
58 void XGI_DisableGatingCRT(PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
);
59 void XGI_SetPanelDelay(USHORT tempbl
, PVB_DEVICE_INFO pVBInfo
);
60 void XGI_SetPanelPower(USHORT tempah
,USHORT tempbl
, PVB_DEVICE_INFO pVBInfo
);
61 void XGI_EnablePWD( PVB_DEVICE_INFO pVBInfo
);
62 void XGI_DisablePWD( PVB_DEVICE_INFO pVBInfo
);
63 void XGI_AutoThreshold( PVB_DEVICE_INFO pVBInfo
);
64 void XGI_SetTap4Regs( PVB_DEVICE_INFO pVBInfo
);
66 void XGI_DisplayOn(PXGI_HW_DEVICE_INFO
, PVB_DEVICE_INFO pVBInfo
);
67 void XGI_DisplayOff( PXGI_HW_DEVICE_INFO
, PVB_DEVICE_INFO pVBInfo
);
68 void XGI_SetCRT1Group(PXGI_HW_DEVICE_INFO HwDeviceExtension
,USHORT ModeNo
,USHORT ModeIdIndex
,PVB_DEVICE_INFO pVBInfo
);
69 void XGI_SetXG21CRTC(USHORT ModeNo
, USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
);
70 void XGI_SetXG21LCD(PVB_DEVICE_INFO pVBInfo
,USHORT RefreshRateTableIndex
,USHORT ModeNo
);
71 void XGI_SetXG27CRTC(USHORT ModeNo
, USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
);
72 void XGI_SetXG27LCD(PVB_DEVICE_INFO pVBInfo
,USHORT RefreshRateTableIndex
,USHORT ModeNo
);
73 void XGI_UpdateXG21CRTC(USHORT ModeNo
, PVB_DEVICE_INFO pVBInfo
, USHORT RefreshRateTableIndex
);
74 void XGI_WaitDisply(PVB_DEVICE_INFO pVBInfo
);
75 void XGI_SenseCRT1(PVB_DEVICE_INFO pVBInfo
);
76 void XGI_SetSeqRegs(USHORT ModeNo
,USHORT StandTableIndex
,USHORT ModeIdIndex
,PVB_DEVICE_INFO pVBInfo
);
77 void XGI_SetMiscRegs(USHORT StandTableIndex
, PVB_DEVICE_INFO pVBInfo
);
78 void XGI_SetCRTCRegs(PXGI_HW_DEVICE_INFO HwDeviceExtension
,USHORT StandTableIndex
, PVB_DEVICE_INFO pVBInfo
);
79 void XGI_SetATTRegs(USHORT ModeNo
,USHORT StandTableIndex
,USHORT ModeIdIndex
,PVB_DEVICE_INFO pVBInfo
);
80 void XGI_SetGRCRegs(USHORT StandTableIndex
, PVB_DEVICE_INFO pVBInfo
);
81 void XGI_ClearExt1Regs(PVB_DEVICE_INFO pVBInfo
);
83 void XGI_SetSync(USHORT RefreshRateTableIndex
,PVB_DEVICE_INFO pVBInfo
);
84 void XGI_SetCRT1CRTC(USHORT ModeNo
,USHORT ModeIdIndex
,USHORT RefreshRateTableIndex
,PVB_DEVICE_INFO pVBInfo
,PXGI_HW_DEVICE_INFO HwDeviceExtension
);
85 void XGI_SetCRT1Timing_H(PVB_DEVICE_INFO pVBInfo
,PXGI_HW_DEVICE_INFO HwDeviceExtension
);
86 void XGI_SetCRT1Timing_V(USHORT ModeIdIndex
,USHORT ModeNo
,PVB_DEVICE_INFO pVBInfo
);
87 void XGI_SetCRT1DE(PXGI_HW_DEVICE_INFO HwDeviceExtension
,USHORT ModeNo
,USHORT ModeIdIndex
,USHORT RefreshRateTableIndex
,PVB_DEVICE_INFO pVBInfo
);
88 void XGI_SetCRT1VCLK(USHORT ModeNo
,USHORT ModeIdIndex
,PXGI_HW_DEVICE_INFO HwDeviceExtension
,USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
);
89 void XGI_SetCRT1FIFO(USHORT ModeNo
,PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
);
90 void XGI_SetCRT1ModeRegs(PXGI_HW_DEVICE_INFO HwDeviceExtension
,USHORT ModeNo
,USHORT ModeIdIndex
,USHORT RefreshRateTableIndex
,PVB_DEVICE_INFO pVBInfo
);
91 void XGI_SetVCLKState(PXGI_HW_DEVICE_INFO HwDeviceExtension
,USHORT ModeNo
,USHORT RefreshRateTableIndex
,PVB_DEVICE_INFO pVBInfo
);
93 void XGI_LoadDAC(USHORT ModeNo
,USHORT ModeIdIndex
,PVB_DEVICE_INFO pVBInfo
);
94 void XGI_WriteDAC(USHORT dl
, USHORT ah
, USHORT al
, USHORT dh
, PVB_DEVICE_INFO pVBInfo
);
95 /*void XGI_ClearBuffer(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,PVB_DEVICE_INFO pVBInfo);*/
96 void XGI_SetLCDAGroup(USHORT ModeNo
,USHORT ModeIdIndex
,PXGI_HW_DEVICE_INFO HwDeviceExtension
,PVB_DEVICE_INFO pVBInfo
);
97 void XGI_GetLVDSResInfo( USHORT ModeNo
,USHORT ModeIdIndex
,PVB_DEVICE_INFO pVBInfo
);
98 void XGI_GetLVDSData(USHORT ModeNo
,USHORT ModeIdIndex
,USHORT RefreshRateTableIndex
,PVB_DEVICE_INFO pVBInfo
);
99 void XGI_ModCRT1Regs(USHORT ModeNo
,USHORT ModeIdIndex
,USHORT RefreshRateTableIndex
,PXGI_HW_DEVICE_INFO HwDeviceExtension
,PVB_DEVICE_INFO pVBInfo
);
100 void XGI_SetLVDSRegs(USHORT ModeNo
,USHORT ModeIdIndex
,USHORT RefreshRateTableIndex
,PVB_DEVICE_INFO pVBInfo
);
101 void XGI_UpdateModeInfo(PXGI_HW_DEVICE_INFO HwDeviceExtension
,PVB_DEVICE_INFO pVBInfo
);
102 void XGI_GetVGAType(PXGI_HW_DEVICE_INFO HwDeviceExtension
,PVB_DEVICE_INFO pVBInfo
);
103 void XGI_GetVBType(PVB_DEVICE_INFO pVBInfo
);
104 void XGI_GetVBInfo(USHORT ModeNo
,USHORT ModeIdIndex
,PXGI_HW_DEVICE_INFO HwDeviceExtension
,PVB_DEVICE_INFO pVBInfo
);
105 void XGI_GetTVInfo(USHORT ModeNo
,USHORT ModeIdIndex
,PVB_DEVICE_INFO pVBInfo
);
106 void XGI_SetCRT2ECLK( USHORT ModeNo
,USHORT ModeIdIndex
,USHORT RefreshRateTableIndex
,PVB_DEVICE_INFO pVBInfo
);
107 void InitTo330Pointer(UCHAR
,PVB_DEVICE_INFO pVBInfo
);
108 void XGI_GetLCDSync(USHORT
* HSyncWidth
, USHORT
* VSyncWidth
, PVB_DEVICE_INFO pVBInfo
);
109 void XGI_DisableBridge(PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
);
110 void XGI_EnableBridge(PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
);
111 void XGI_SetCRT2VCLK(USHORT ModeNo
,USHORT ModeIdIndex
,USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
);
112 void XGI_OEM310Setting(USHORT ModeNo
,USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
);
113 void XGI_SetDelayComp(PVB_DEVICE_INFO pVBInfo
);
114 void XGI_SetLCDCap(PVB_DEVICE_INFO pVBInfo
);
115 void XGI_SetLCDCap_A(USHORT tempcx
,PVB_DEVICE_INFO pVBInfo
);
116 void XGI_SetLCDCap_B(USHORT tempcx
,PVB_DEVICE_INFO pVBInfo
);
117 void SetSpectrum(PVB_DEVICE_INFO pVBInfo
);
118 void XGI_SetAntiFlicker(USHORT ModeNo
,USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
);
119 void XGI_SetEdgeEnhance(USHORT ModeNo
,USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
);
120 void XGI_SetPhaseIncr(PVB_DEVICE_INFO pVBInfo
);
121 void XGI_SetYFilter(USHORT ModeNo
,USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
);
122 void XGI_GetTVPtrIndex2(USHORT
* tempbx
,UCHAR
* tempcl
,UCHAR
* tempch
, PVB_DEVICE_INFO pVBInfo
);
123 USHORT
XGI_GetTVPtrIndex( PVB_DEVICE_INFO pVBInfo
);
124 void XGI_SetCRT2ModeRegs(USHORT ModeNo
,PXGI_HW_DEVICE_INFO
, PVB_DEVICE_INFO pVBInfo
);
125 void XGI_CloseCRTC(PXGI_HW_DEVICE_INFO
, PVB_DEVICE_INFO pVBInfo
);
126 void XGI_OpenCRTC(PXGI_HW_DEVICE_INFO
, PVB_DEVICE_INFO pVBInfo
);
127 void XGI_GetRAMDAC2DATA(USHORT ModeNo
,USHORT ModeIdIndex
,USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
);
128 void XGI_UnLockCRT2(PXGI_HW_DEVICE_INFO
, PVB_DEVICE_INFO pVBInfo
);
129 void XGI_LockCRT2(PXGI_HW_DEVICE_INFO
, PVB_DEVICE_INFO pVBInfo
);
130 void XGINew_EnableCRT2(PVB_DEVICE_INFO pVBInfo
);
131 void XGINew_LCD_Wait_Time(UCHAR DelayTime
, PVB_DEVICE_INFO pVBInfo
);
132 void XGI_LongWait(PVB_DEVICE_INFO pVBInfo
);
133 void XGI_SetCRT1Offset( USHORT ModeNo
, USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
, PXGI_HW_DEVICE_INFO HwDeviceExtension
,PVB_DEVICE_INFO pVBInfo
);
134 void XGI_GetLCDVCLKPtr(UCHAR
* di_0
,UCHAR
*di_1
, PVB_DEVICE_INFO pVBInfo
);
135 UCHAR
XGI_GetVCLKPtr(USHORT RefreshRateTableIndex
,USHORT ModeNo
,USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
);
136 void XGI_GetVCLKLen(UCHAR tempal
,UCHAR
* di_0
,UCHAR
* di_1
, PVB_DEVICE_INFO pVBInfo
);
137 USHORT
XGI_GetLCDCapPtr(PVB_DEVICE_INFO pVBInfo
);
138 USHORT
XGI_GetLCDCapPtr1(PVB_DEVICE_INFO pVBInfo
);
139 XGI301C_Tap4TimingStruct
* XGI_GetTap4Ptr(USHORT tempcx
, PVB_DEVICE_INFO pVBInfo
);
140 void XGI_SetXG21FPBits(PVB_DEVICE_INFO pVBInfo
);
141 void XGI_SetXG27FPBits(PVB_DEVICE_INFO pVBInfo
);
142 UCHAR
XGI_XG21GetPSCValue(PVB_DEVICE_INFO pVBInfo
);
143 UCHAR
XGI_XG27GetPSCValue(PVB_DEVICE_INFO pVBInfo
);
144 void XGI_XG21BLSignalVDD(USHORT tempbh
,USHORT tempbl
, PVB_DEVICE_INFO pVBInfo
);
145 void XGI_XG27BLSignalVDD(USHORT tempbh
,USHORT tempbl
, PVB_DEVICE_INFO pVBInfo
);
146 void XGI_XG21SetPanelDelay(USHORT tempbl
, PVB_DEVICE_INFO pVBInfo
);
147 BOOLEAN
XGI_XG21CheckLVDSMode(USHORT ModeNo
,USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
);
148 void XGI_SetXG21LVDSPara(USHORT ModeNo
,USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
);
149 void XGI_SetXG27LVDSPara(USHORT ModeNo
,USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
);
150 UCHAR
XGI_SetDefaultVCLK( PVB_DEVICE_INFO pVBInfo
);
152 extern void ReadVBIOSTablData( UCHAR ChipType
, PVB_DEVICE_INFO pVBInfo
);
154 /* USHORT XGINew_flag_clearbuffer; 0: no clear frame buffer 1:clear frame buffer */
160 USHORT XGINew_MDA_DAC
[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
161 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
162 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
163 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
164 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
165 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
166 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
167 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F};
169 USHORT XGINew_CGA_DAC
[]={0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
170 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
171 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
172 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
173 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
174 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
175 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
176 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F};
178 USHORT XGINew_EGA_DAC
[]={0x00,0x10,0x04,0x14,0x01,0x11,0x05,0x15,
179 0x20,0x30,0x24,0x34,0x21,0x31,0x25,0x35,
180 0x08,0x18,0x0C,0x1C,0x09,0x19,0x0D,0x1D,
181 0x28,0x38,0x2C,0x3C,0x29,0x39,0x2D,0x3D,
182 0x02,0x12,0x06,0x16,0x03,0x13,0x07,0x17,
183 0x22,0x32,0x26,0x36,0x23,0x33,0x27,0x37,
184 0x0A,0x1A,0x0E,0x1E,0x0B,0x1B,0x0F,0x1F,
185 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F};
187 USHORT XGINew_VGA_DAC
[]={0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
188 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
189 0x00,0x05,0x08,0x0B,0x0E,0x11,0x14,0x18,
190 0x1C,0x20,0x24,0x28,0x2D,0x32,0x38,0x3F,
192 0x00,0x10,0x1F,0x2F,0x3F,0x1F,0x27,0x2F,
193 0x37,0x3F,0x2D,0x31,0x36,0x3A,0x3F,0x00,
194 0x07,0x0E,0x15,0x1C,0x0E,0x11,0x15,0x18,
195 0x1C,0x14,0x16,0x18,0x1A,0x1C,0x00,0x04,
196 0x08,0x0C,0x10,0x08,0x0A,0x0C,0x0E,0x10,
197 0x0B,0x0C,0x0D,0x0F,0x10};
200 /* --------------------------------------------------------------------- */
201 /* Function : InitTo330Pointer */
205 /* --------------------------------------------------------------------- */
206 void InitTo330Pointer( UCHAR ChipType
,PVB_DEVICE_INFO pVBInfo
)
208 pVBInfo
->SModeIDTable
= (XGI_StStruct
*) XGI330_SModeIDTable
;
209 pVBInfo
->StandTable
= (XGI_StandTableStruct
*) XGI330_StandTable
;
210 pVBInfo
->EModeIDTable
= (XGI_ExtStruct
*) XGI330_EModeIDTable
;
211 pVBInfo
->RefIndex
= (XGI_Ext2Struct
*) XGI330_RefIndex
;
212 pVBInfo
->XGINEWUB_CRT1Table
= (XGI_CRT1TableStruct
*) XGI_CRT1Table
;
214 /* add for new UNIVGABIOS */
215 /* XGINew_UBLCDDataTable = (XGI_LCDDataTablStruct *) XGI_LCDDataTable ; */
216 /* XGINew_UBTVDataTable = (XGI_TVDataTablStruct *) XGI_TVDataTable ; */
219 if ( ChipType
>= XG40
)
221 pVBInfo
->MCLKData
= (XGI_MCLKDataStruct
*) XGI340New_MCLKData
;
222 pVBInfo
->ECLKData
= (XGI_ECLKDataStruct
*) XGI340_ECLKData
;
226 pVBInfo
->MCLKData
= (XGI_MCLKDataStruct
*) XGI330New_MCLKData
;
227 pVBInfo
->ECLKData
= (XGI_ECLKDataStruct
*) XGI330_ECLKData
;
230 pVBInfo
->VCLKData
= (XGI_VCLKDataStruct
*) XGI_VCLKData
;
231 pVBInfo
->VBVCLKData
= (XGI_VBVCLKDataStruct
*) XGI_VBVCLKData
;
232 pVBInfo
->ScreenOffset
= XGI330_ScreenOffset
;
233 pVBInfo
->StResInfo
= (XGI_StResInfoStruct
*) XGI330_StResInfo
;
234 pVBInfo
->ModeResInfo
= (XGI_ModeResInfoStruct
*) XGI330_ModeResInfo
;
236 pVBInfo
->pOutputSelect
= &XGI330_OutputSelect
;
237 pVBInfo
->pSoftSetting
= &XGI330_SoftSetting
;
238 pVBInfo
->pSR07
= &XGI330_SR07
;
239 pVBInfo
->LCDResInfo
= 0 ;
240 pVBInfo
->LCDTypeInfo
= 0 ;
241 pVBInfo
->LCDInfo
= 0 ;
242 pVBInfo
->VBInfo
= 0 ;
246 pVBInfo
->SR15
= XGI340_SR13
;
247 pVBInfo
->CR40
= XGI340_cr41
;
248 pVBInfo
->SR25
= XGI330_sr25
;
249 pVBInfo
->pSR31
= &XGI330_sr31
;
250 pVBInfo
->pSR32
= &XGI330_sr32
;
251 pVBInfo
->CR6B
= XGI340_CR6B
;
252 pVBInfo
->CR6E
= XGI340_CR6E
;
253 pVBInfo
->CR6F
= XGI340_CR6F
;
254 pVBInfo
->CR89
= XGI340_CR89
;
255 pVBInfo
->AGPReg
= XGI340_AGPReg
;
256 pVBInfo
->SR16
= XGI340_SR16
;
257 pVBInfo
->pCRCF
= &XG40_CRCF
;
258 pVBInfo
->pXGINew_DRAMTypeDefinition
= &XG40_DRAMTypeDefinition
;
261 pVBInfo
->CR49
= XGI330_CR49
;
262 pVBInfo
->pSR1F
= &XGI330_SR1F
;
263 pVBInfo
->pSR21
= &XGI330_SR21
;
264 pVBInfo
->pSR22
= &XGI330_SR22
;
265 pVBInfo
->pSR23
= &XGI330_SR23
;
266 pVBInfo
->pSR24
= &XGI330_SR24
;
267 pVBInfo
->pSR33
= &XGI330_SR33
;
271 pVBInfo
->pCRT2Data_1_2
= &XGI330_CRT2Data_1_2
;
272 pVBInfo
->pCRT2Data_4_D
= &XGI330_CRT2Data_4_D
;
273 pVBInfo
->pCRT2Data_4_E
= &XGI330_CRT2Data_4_E
;
274 pVBInfo
->pCRT2Data_4_10
= &XGI330_CRT2Data_4_10
;
275 pVBInfo
->pRGBSenseData
= &XGI330_RGBSenseData
;
276 pVBInfo
->pVideoSenseData
= &XGI330_VideoSenseData
;
277 pVBInfo
->pYCSenseData
= &XGI330_YCSenseData
;
278 pVBInfo
->pRGBSenseData2
= &XGI330_RGBSenseData2
;
279 pVBInfo
->pVideoSenseData2
= &XGI330_VideoSenseData2
;
280 pVBInfo
->pYCSenseData2
= &XGI330_YCSenseData2
;
282 pVBInfo
->NTSCTiming
= XGI330_NTSCTiming
;
283 pVBInfo
->PALTiming
= XGI330_PALTiming
;
284 pVBInfo
->HiTVExtTiming
= XGI330_HiTVExtTiming
;
285 pVBInfo
->HiTVSt1Timing
= XGI330_HiTVSt1Timing
;
286 pVBInfo
->HiTVSt2Timing
= XGI330_HiTVSt2Timing
;
287 pVBInfo
->HiTVTextTiming
= XGI330_HiTVTextTiming
;
288 pVBInfo
->YPbPr750pTiming
= XGI330_YPbPr750pTiming
;
289 pVBInfo
->YPbPr525pTiming
= XGI330_YPbPr525pTiming
;
290 pVBInfo
->YPbPr525iTiming
= XGI330_YPbPr525iTiming
;
291 pVBInfo
->HiTVGroup3Data
= XGI330_HiTVGroup3Data
;
292 pVBInfo
->HiTVGroup3Simu
= XGI330_HiTVGroup3Simu
;
293 pVBInfo
->HiTVGroup3Text
= XGI330_HiTVGroup3Text
;
294 pVBInfo
->Ren525pGroup3
= XGI330_Ren525pGroup3
;
295 pVBInfo
->Ren750pGroup3
= XGI330_Ren750pGroup3
;
298 pVBInfo
->TimingH
= (XGI_TimingHStruct
*) XGI_TimingH
;
299 pVBInfo
->TimingV
= (XGI_TimingVStruct
*) XGI_TimingV
;
300 pVBInfo
->UpdateCRT1
= (XGI_XG21CRT1Struct
*) XGI_UpdateCRT1Table
;
302 pVBInfo
->CHTVVCLKUNTSC
= XGI330_CHTVVCLKUNTSC
;
303 pVBInfo
->CHTVVCLKONTSC
= XGI330_CHTVVCLKONTSC
;
304 pVBInfo
->CHTVVCLKUPAL
= XGI330_CHTVVCLKUPAL
;
305 pVBInfo
->CHTVVCLKOPAL
= XGI330_CHTVVCLKOPAL
;
307 /* 310 customization related */
308 if ( ( pVBInfo
->VBType
& VB_XGI301LV
) || ( pVBInfo
->VBType
& VB_XGI302LV
) )
309 pVBInfo
->LCDCapList
= XGI_LCDDLCapList
;
311 pVBInfo
->LCDCapList
= XGI_LCDCapList
;
313 if ( ( ChipType
== XG21
) || ( ChipType
== XG27
) )
314 pVBInfo
->XG21_LVDSCapList
= XGI21_LCDCapList
;
316 pVBInfo
->XGI_TVDelayList
= XGI301TVDelayList
;
317 pVBInfo
->XGI_TVDelayList2
= XGI301TVDelayList2
;
320 pVBInfo
->pXGINew_I2CDefinition
= &XG40_I2CDefinition
;
322 if ( ChipType
>= XG20
)
323 pVBInfo
->pXGINew_CR97
= &XG20_CR97
;
325 if ( ChipType
== XG27
)
327 pVBInfo
->MCLKData
= (XGI_MCLKDataStruct
*) XGI27New_MCLKData
;
328 pVBInfo
->CR40
= XGI27_cr41
;
329 pVBInfo
->pXGINew_CR97
= &XG27_CR97
;
330 pVBInfo
->pSR36
= &XG27_SR36
;
331 pVBInfo
->pCR8F
= &XG27_CR8F
;
332 pVBInfo
->pCRD0
= XG27_CRD0
;
333 pVBInfo
->pCRDE
= XG27_CRDE
;
334 pVBInfo
->pSR40
= &XG27_SR40
;
335 pVBInfo
->pSR41
= &XG27_SR41
;
339 if ( ChipType
>= XG20
)
341 pVBInfo
->pDVOSetting
= &XG21_DVOSetting
;
342 pVBInfo
->pCR2E
= &XG21_CR2E
;
343 pVBInfo
->pCR2F
= &XG21_CR2F
;
344 pVBInfo
->pCR46
= &XG21_CR46
;
345 pVBInfo
->pCR47
= &XG21_CR47
;
355 /* --------------------------------------------------------------------- */
356 /* Function : XGISetModeNew */
360 /* --------------------------------------------------------------------- */
361 BOOLEAN
XGISetModeNew( PXGI_HW_DEVICE_INFO HwDeviceExtension
, USHORT ModeNo
)
364 /* PUCHAR pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress ; */
365 VB_DEVICE_INFO VBINF
;
366 PVB_DEVICE_INFO pVBInfo
= &VBINF
;
367 pVBInfo
->ROMAddr
= HwDeviceExtension
->pjVirtualRomBase
;
368 pVBInfo
->BaseAddr
= (ULONG
)HwDeviceExtension
->pjIOAddress
;
369 pVBInfo
->IF_DEF_LVDS
= 0 ;
370 pVBInfo
->IF_DEF_CH7005
= 0 ;
371 pVBInfo
->IF_DEF_LCDA
= 1 ;
372 pVBInfo
->IF_DEF_CH7017
= 0 ;
373 pVBInfo
->IF_DEF_CH7007
= 0 ; /* [Billy] 2007/05/14 */
374 pVBInfo
->IF_DEF_VideoCapture
= 0 ;
375 pVBInfo
->IF_DEF_ScaleLCD
= 0 ;
376 pVBInfo
->IF_DEF_OEMUtil
= 0 ;
377 pVBInfo
->IF_DEF_PWD
= 0 ;
380 if ( HwDeviceExtension
->jChipType
>= XG20
) /* kuku 2004/06/25 */
382 pVBInfo
->IF_DEF_YPbPr
= 0 ;
383 pVBInfo
->IF_DEF_HiVision
= 0 ;
384 pVBInfo
->IF_DEF_CRT2Monitor
= 0 ;
385 pVBInfo
->VBType
= 0 ; /*set VBType default 0*/
387 else if ( HwDeviceExtension
->jChipType
>= XG40
)
389 pVBInfo
->IF_DEF_YPbPr
= 1 ;
390 pVBInfo
->IF_DEF_HiVision
= 1 ;
391 pVBInfo
->IF_DEF_CRT2Monitor
= 1 ;
395 pVBInfo
->IF_DEF_YPbPr
= 1 ;
396 pVBInfo
->IF_DEF_HiVision
= 1 ;
397 pVBInfo
->IF_DEF_CRT2Monitor
= 0 ;
400 pVBInfo
->P3c4
= pVBInfo
->BaseAddr
+ 0x14 ;
401 pVBInfo
->P3d4
= pVBInfo
->BaseAddr
+ 0x24 ;
402 pVBInfo
->P3c0
= pVBInfo
->BaseAddr
+ 0x10 ;
403 pVBInfo
->P3ce
= pVBInfo
->BaseAddr
+ 0x1e ;
404 pVBInfo
->P3c2
= pVBInfo
->BaseAddr
+ 0x12 ;
405 pVBInfo
->P3cc
= pVBInfo
->BaseAddr
+ 0x1C ;
406 pVBInfo
->P3ca
= pVBInfo
->BaseAddr
+ 0x1a ;
407 pVBInfo
->P3c6
= pVBInfo
->BaseAddr
+ 0x16 ;
408 pVBInfo
->P3c7
= pVBInfo
->BaseAddr
+ 0x17 ;
409 pVBInfo
->P3c8
= pVBInfo
->BaseAddr
+ 0x18 ;
410 pVBInfo
->P3c9
= pVBInfo
->BaseAddr
+ 0x19 ;
411 pVBInfo
->P3da
= pVBInfo
->BaseAddr
+ 0x2A ;
412 pVBInfo
->Part0Port
= pVBInfo
->BaseAddr
+ XGI_CRT2_PORT_00
;
413 pVBInfo
->Part1Port
= pVBInfo
->BaseAddr
+ XGI_CRT2_PORT_04
;
414 pVBInfo
->Part2Port
= pVBInfo
->BaseAddr
+ XGI_CRT2_PORT_10
;
415 pVBInfo
->Part3Port
= pVBInfo
->BaseAddr
+ XGI_CRT2_PORT_12
;
416 pVBInfo
->Part4Port
= pVBInfo
->BaseAddr
+ XGI_CRT2_PORT_14
;
417 pVBInfo
->Part5Port
= pVBInfo
->BaseAddr
+ XGI_CRT2_PORT_14
+ 2 ;
419 if ( HwDeviceExtension
->jChipType
== XG21
) /* for x86 Linux, XG21 LVDS */
421 if ( ( XGINew_GetReg1( pVBInfo
->P3d4
, 0x38 ) & 0xE0 ) == 0xC0 )
423 pVBInfo
->IF_DEF_LVDS
= 1 ;
426 if ( HwDeviceExtension
->jChipType
== XG27
)
428 if ( ( XGINew_GetReg1( pVBInfo
->P3d4
, 0x38 ) & 0xE0 ) == 0xC0 )
430 if ( XGINew_GetReg1( pVBInfo
->P3d4
, 0x30 ) & 0x20 )
432 pVBInfo
->IF_DEF_LVDS
= 1 ;
437 if ( HwDeviceExtension
->jChipType
< XG20
) /* kuku 2004/06/25 */
438 XGI_GetVBType( pVBInfo
) ;
440 InitTo330Pointer( HwDeviceExtension
->jChipType
, pVBInfo
) ;
443 ModeNo
= ModeNo
& 0x7F ;
444 /* XGINew_flag_clearbuffer = 0 ; */
448 XGINew_flag_clearbuffer = 1 ;
451 XGINew_SetReg1( pVBInfo
->P3c4
, 0x05 , 0x86 ) ;
453 if ( HwDeviceExtension
->jChipType
< XG20
) /* kuku 2004/06/25 1.Openkey */
454 XGI_UnLockCRT2( HwDeviceExtension
, pVBInfo
) ;
456 XGI_SearchModeID( ModeNo
, &ModeIdIndex
, pVBInfo
) ;
458 XGI_GetVGAType(HwDeviceExtension
, pVBInfo
) ;
460 if ( HwDeviceExtension
->jChipType
< XG20
) /* kuku 2004/06/25 */
462 XGI_GetVBInfo(ModeNo
, ModeIdIndex
, HwDeviceExtension
, pVBInfo
) ;
463 XGI_GetTVInfo(ModeNo
, ModeIdIndex
, pVBInfo
) ;
464 XGI_GetLCDInfo(ModeNo
, ModeIdIndex
, pVBInfo
) ;
465 XGI_DisableBridge( HwDeviceExtension
,pVBInfo
) ;
466 /* XGI_OpenCRTC( HwDeviceExtension, pVBInfo ) ; */
468 if ( pVBInfo
->VBInfo
& ( SetSimuScanMode
| SetCRT2ToLCDA
) )
470 XGI_SetCRT1Group(HwDeviceExtension
, ModeNo
, ModeIdIndex
, pVBInfo
) ;
472 if ( pVBInfo
->VBInfo
& SetCRT2ToLCDA
)
474 XGI_SetLCDAGroup(ModeNo
, ModeIdIndex
, HwDeviceExtension
, pVBInfo
) ;
479 if ( !( pVBInfo
->VBInfo
& SwitchToCRT2
) )
481 XGI_SetCRT1Group( HwDeviceExtension
, ModeNo
, ModeIdIndex
, pVBInfo
) ;
482 if ( pVBInfo
->VBInfo
& SetCRT2ToLCDA
)
484 XGI_SetLCDAGroup( ModeNo
, ModeIdIndex
, HwDeviceExtension
, pVBInfo
) ;
489 if ( pVBInfo
->VBInfo
& ( SetSimuScanMode
| SwitchToCRT2
) )
491 switch( HwDeviceExtension
->ujVBChipID
)
494 XGI_SetCRT2Group301( ModeNo
, HwDeviceExtension
, pVBInfo
) ; /*add for CRT2 */
498 XGI_SetCRT2Group301(ModeNo
, HwDeviceExtension
, pVBInfo
) ; /*add for CRT2 */
506 XGI_SetCRT2ModeRegs( ModeNo
, HwDeviceExtension
,pVBInfo
) ;
507 XGI_OEM310Setting( ModeNo
, ModeIdIndex
,pVBInfo
) ; /*0212*/
508 XGI_CloseCRTC( HwDeviceExtension
, pVBInfo
) ;
509 XGI_EnableBridge( HwDeviceExtension
,pVBInfo
) ;
513 if (pVBInfo
->IF_DEF_LVDS
== 1)
514 if (!XGI_XG21CheckLVDSMode(ModeNo
, ModeIdIndex
, pVBInfo
))
517 if ( ModeNo
<= 0x13 )
519 pVBInfo
->ModeType
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
& ModeInfoFlag
;
523 pVBInfo
->ModeType
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
& ModeInfoFlag
;
526 pVBInfo
->SetFlag
= 0 ;
527 if ( pVBInfo
->IF_DEF_CH7007
!= 1 )
529 pVBInfo
->VBInfo
= DisableCRT2Display
;
533 XGI_DisplayOff(HwDeviceExtension
, pVBInfo
) ;
535 XGI_SetCRT1Group(HwDeviceExtension
, ModeNo
, ModeIdIndex
, pVBInfo
) ;
537 XGI_DisplayOn( HwDeviceExtension
, pVBInfo
) ;
539 if( HwDeviceExtension->jChipType == XG21 )
540 XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x09 , ~0x80 , 0x80 ) ;
546 if ( ModeNo <= 0x13 )
548 modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ;
552 modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
554 pVBInfo->ModeType = modeflag&ModeInfoFlag ;
555 pVBInfo->SetFlag = 0x00 ;
556 pVBInfo->VBInfo = DisableCRT2Display ;
557 temp = XGINew_CheckMemorySize( HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ;
562 XGI_DisplayOff( HwDeviceExtension, pVBInfo) ;
563 XGI_SetCRT1Group( HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ;
564 XGI_DisplayOn( HwDeviceExtension, pVBInfo) ;
567 XGI_UpdateModeInfo( HwDeviceExtension
, pVBInfo
) ;
569 if ( HwDeviceExtension
->jChipType
< XG20
) /* kuku 2004/06/25 */
571 XGI_LockCRT2( HwDeviceExtension
, pVBInfo
) ;
578 /* --------------------------------------------------------------------- */
579 /* Function : XGI_SetCRT1Group */
583 /* --------------------------------------------------------------------- */
584 void XGI_SetCRT1Group( PXGI_HW_DEVICE_INFO HwDeviceExtension
, USHORT ModeNo
, USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
)
586 USHORT StandTableIndex
,
587 RefreshRateTableIndex
,
591 USHORT XGINew_P3cc
= pVBInfo
->P3cc
;
593 /* XGINew_CRT1Mode = ModeNo ; // SaveModeID */
594 StandTableIndex
= XGI_GetModePtr( ModeNo
, ModeIdIndex
, pVBInfo
) ;
595 /* XGI_SetBIOSData(ModeNo , ModeIdIndex ) ; */
596 /* XGI_ClearBankRegs( ModeNo , ModeIdIndex ) ; */
597 XGI_SetSeqRegs( ModeNo
, StandTableIndex
, ModeIdIndex
, pVBInfo
) ;
598 XGI_SetMiscRegs( StandTableIndex
, pVBInfo
) ;
599 XGI_SetCRTCRegs( HwDeviceExtension
, StandTableIndex
, pVBInfo
) ;
600 XGI_SetATTRegs( ModeNo
, StandTableIndex
, ModeIdIndex
, pVBInfo
) ;
601 XGI_SetGRCRegs( StandTableIndex
, pVBInfo
) ;
602 XGI_ClearExt1Regs(pVBInfo
) ;
604 /* if ( pVBInfo->IF_DEF_ExpLink ) */
605 if ( HwDeviceExtension
->jChipType
== XG27
)
607 if ( pVBInfo
->IF_DEF_LVDS
== 0 )
609 XGI_SetDefaultVCLK( pVBInfo
) ;
613 temp
= ~ProgrammingCRT2
;
614 pVBInfo
->SetFlag
&= temp
;
615 pVBInfo
->SelectCRT2Rate
= 0 ;
617 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
619 if ( pVBInfo
->VBInfo
& ( SetSimuScanMode
| SetCRT2ToLCDA
| SetInSlaveMode
) )
621 pVBInfo
->SetFlag
|= ProgrammingCRT2
;
625 RefreshRateTableIndex
= XGI_GetRatePtrCRT2( HwDeviceExtension
, ModeNo
, ModeIdIndex
, pVBInfo
) ;
626 if ( RefreshRateTableIndex
!= 0xFFFF )
628 XGI_SetSync( RefreshRateTableIndex
, pVBInfo
) ;
629 XGI_SetCRT1CRTC( ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
, HwDeviceExtension
) ;
630 XGI_SetCRT1DE( HwDeviceExtension
, ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
) ;
631 XGI_SetCRT1Offset( ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, HwDeviceExtension
, pVBInfo
) ;
632 XGI_SetCRT1VCLK( ModeNo
, ModeIdIndex
, HwDeviceExtension
, RefreshRateTableIndex
, pVBInfo
) ;
635 if ( ( HwDeviceExtension
->jChipType
>= XG20
)&&
636 ( HwDeviceExtension
->jChipType
< XG27
) ) /* fix H/W DCLK/2 bug */
638 if ( ( ModeNo
== 0x00 ) | (ModeNo
== 0x01) )
640 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2B , 0x4E) ;
641 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2C , 0xE9) ;
642 b3CC
=(UCHAR
) XGINew_GetReg2(XGINew_P3cc
) ;
643 XGINew_SetReg3(XGINew_P3cc
, (b3CC
|= 0x0C) ) ;
645 else if ( ( ModeNo
== 0x04) | ( ModeNo
== 0x05) | ( ModeNo
== 0x0D) )
647 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2B , 0x1B) ;
648 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2C , 0xE3) ;
649 b3CC
= (UCHAR
)XGINew_GetReg2(XGINew_P3cc
) ;
650 XGINew_SetReg3(XGINew_P3cc
, (b3CC
|= 0x0C) ) ;
654 if ( HwDeviceExtension
->jChipType
>= XG21
)
656 temp
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x38 ) ;
660 /*XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~0x20 ) ;*/ /* Enable write GPIOF */
661 /*XGINew_SetRegAND( pVBInfo->P3d4 , 0x48 , ~0x20 ) ;*/ /* P. DWN */
662 /* XG21 CRT1 Timing */
663 if ( HwDeviceExtension
->jChipType
== XG27
)
664 XGI_SetXG27CRTC( ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
);
666 XGI_SetXG21CRTC( ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
);
668 XGI_UpdateXG21CRTC( ModeNo
, pVBInfo
, RefreshRateTableIndex
) ;
670 if ( HwDeviceExtension
->jChipType
== XG27
)
671 XGI_SetXG27LCD( pVBInfo
, RefreshRateTableIndex
, ModeNo
);
673 XGI_SetXG21LCD( pVBInfo
, RefreshRateTableIndex
, ModeNo
);
675 if ( pVBInfo
->IF_DEF_LVDS
== 1 )
677 if ( HwDeviceExtension
->jChipType
== XG27
)
678 XGI_SetXG27LVDSPara(ModeNo
,ModeIdIndex
, pVBInfo
);
680 XGI_SetXG21LVDSPara(ModeNo
,ModeIdIndex
, pVBInfo
);
682 /*XGINew_SetRegOR( pVBInfo->P3d4 , 0x48 , 0x20 ) ;*/ /* P. ON */
686 pVBInfo
->SetFlag
&= ( ~ProgrammingCRT2
) ;
687 XGI_SetCRT1FIFO( ModeNo
, HwDeviceExtension
, pVBInfo
) ;
688 XGI_SetCRT1ModeRegs( HwDeviceExtension
, ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
) ;
691 /* XGI_LoadCharacter(); //dif ifdef TVFont */
693 XGI_LoadDAC( ModeNo
, ModeIdIndex
, pVBInfo
) ;
694 /* XGI_ClearBuffer( HwDeviceExtension , ModeNo, pVBInfo ) ; */
698 /* --------------------------------------------------------------------- */
699 /* Function : XGI_GetModePtr */
703 /* --------------------------------------------------------------------- */
704 UCHAR
XGI_GetModePtr( USHORT ModeNo
, USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
)
708 if ( ModeNo
<= 0x13 )
709 index
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_StTableIndex
;
712 if ( pVBInfo
->ModeType
<= 0x02 )
713 index
= 0x1B ; /* 02 -> ModeEGA */
717 return( index
) ; /* Get pVBInfo->StandTable index */
721 /* --------------------------------------------------------------------- */
722 /* Function : XGI_SetBIOSData */
726 /* --------------------------------------------------------------------- */
727 /*UCHAR XGI_SetBIOSData( USHORT ModeNo , USHORT ModeIdIndex )
733 /* --------------------------------------------------------------------- */
734 /* Function : XGI_ClearBankRegs */
738 /* --------------------------------------------------------------------- */
739 /*UCHAR XGI_ClearBankRegs( USHORT ModeNo , USHORT ModeIdIndex )
745 /* --------------------------------------------------------------------- */
746 /* Function : XGI_SetSeqRegs */
750 /* --------------------------------------------------------------------- */
751 void XGI_SetSeqRegs( USHORT ModeNo
, USHORT StandTableIndex
, USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
)
759 if ( ModeNo
<= 0x13 )
760 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
;
762 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
;
764 XGINew_SetReg1( pVBInfo
->P3c4
, 0x00 , 0x03 ) ; /* Set SR0 */
765 tempah
=pVBInfo
->StandTable
[ StandTableIndex
].SR
[ 0 ] ;
768 if ( pVBInfo
->VBInfo
& SetCRT2ToLCDA
)
774 if ( pVBInfo
->VBInfo
& ( SetCRT2ToTV
| SetCRT2ToLCD
) )
776 if ( pVBInfo
->VBInfo
& SetInSlaveMode
)
781 tempah
|= 0x20 ; /* screen off */
782 XGINew_SetReg1( pVBInfo
->P3c4
, 0x01 , tempah
) ; /* Set SR1 */
784 for( i
= 02 ; i
<= 04 ; i
++ )
786 SRdata
= pVBInfo
->StandTable
[ StandTableIndex
].SR
[ i
- 1 ] ; /* Get SR2,3,4 from file */
787 XGINew_SetReg1( pVBInfo
->P3c4
, i
, SRdata
) ; /* Set SR2 3 4 */
792 /* --------------------------------------------------------------------- */
793 /* Function : XGI_SetMiscRegs */
797 /* --------------------------------------------------------------------- */
798 void XGI_SetMiscRegs( USHORT StandTableIndex
, PVB_DEVICE_INFO pVBInfo
)
802 Miscdata
= pVBInfo
->StandTable
[ StandTableIndex
].MISC
; /* Get Misc from file */
804 if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
806 if ( pVBInfo->VBInfo & SetCRT2ToLCDA )
813 XGINew_SetReg3( pVBInfo
->P3c2
, Miscdata
) ; /* Set Misc(3c2) */
817 /* --------------------------------------------------------------------- */
818 /* Function : XGI_SetCRTCRegs */
822 /* --------------------------------------------------------------------- */
823 void XGI_SetCRTCRegs( PXGI_HW_DEVICE_INFO HwDeviceExtension
, USHORT StandTableIndex
, PVB_DEVICE_INFO pVBInfo
)
828 CRTCdata
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3d4
, 0x11 ) ;
830 XGINew_SetReg1( pVBInfo
->P3d4
, 0x11 , CRTCdata
) ; /* Unlock CRTC */
832 for( i
= 0 ; i
<= 0x18 ; i
++ )
834 CRTCdata
= pVBInfo
->StandTable
[ StandTableIndex
].CRTC
[ i
] ; /* Get CRTC from file */
835 XGINew_SetReg1( pVBInfo
->P3d4
, i
, CRTCdata
) ; /* Set CRTC( 3d4 ) */
838 if ( ( HwDeviceExtension->jChipType == XGI_630 )&& ( HwDeviceExtension->jChipRevision == 0x30 ) )
840 if ( pVBInfo->VBInfo & SetInSlaveMode )
842 if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToTV ) )
844 XGINew_SetReg1( pVBInfo->P3d4 , 0x18 , 0xFE ) ;
852 /* --------------------------------------------------------------------- */
857 /* --------------------------------------------------------------------- */
858 void XGI_SetATTRegs( USHORT ModeNo
, USHORT StandTableIndex
, USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
)
864 if ( ModeNo
<= 0x13 )
865 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
;
867 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
;
869 for( i
= 0 ; i
<= 0x13 ; i
++ )
871 ARdata
= pVBInfo
->StandTable
[ StandTableIndex
].ATTR
[ i
] ;
872 if ( modeflag
& Charx8Dot
) /* ifndef Dot9 */
876 if ( pVBInfo
->VBInfo
& SetCRT2ToLCDA
)
880 if ( pVBInfo
->VBInfo
& ( SetCRT2ToTV
| SetCRT2ToLCD
) )
882 if ( pVBInfo
->VBInfo
& SetInSlaveMode
)
889 XGINew_GetReg2( pVBInfo
->P3da
) ; /* reset 3da */
890 XGINew_SetReg3( pVBInfo
->P3c0
, i
) ; /* set index */
891 XGINew_SetReg3( pVBInfo
->P3c0
, ARdata
) ; /* set data */
894 XGINew_GetReg2( pVBInfo
->P3da
) ; /* reset 3da */
895 XGINew_SetReg3( pVBInfo
->P3c0
, 0x14 ) ; /* set index */
896 XGINew_SetReg3( pVBInfo
->P3c0
, 0x00 ) ; /* set data */
897 XGINew_GetReg2( pVBInfo
->P3da
) ; /* Enable Attribute */
898 XGINew_SetReg3( pVBInfo
->P3c0
, 0x20 ) ;
902 /* --------------------------------------------------------------------- */
903 /* Function : XGI_SetGRCRegs */
907 /* --------------------------------------------------------------------- */
908 void XGI_SetGRCRegs( USHORT StandTableIndex
, PVB_DEVICE_INFO pVBInfo
)
913 for( i
= 0 ; i
<= 0x08 ; i
++ )
915 GRdata
= pVBInfo
->StandTable
[ StandTableIndex
].GRC
[ i
] ; /* Get GR from file */
916 XGINew_SetReg1( pVBInfo
->P3ce
, i
, GRdata
) ; /* Set GR(3ce) */
919 if ( pVBInfo
->ModeType
> ModeVGA
)
921 GRdata
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3ce
, 0x05 ) ;
922 GRdata
&= 0xBF ; /* 256 color disable */
923 XGINew_SetReg1( pVBInfo
->P3ce
, 0x05 , GRdata
) ;
928 /* --------------------------------------------------------------------- */
929 /* Function : XGI_ClearExt1Regs */
933 /* --------------------------------------------------------------------- */
934 void XGI_ClearExt1Regs(PVB_DEVICE_INFO pVBInfo
)
938 for( i
= 0x0A ; i
<= 0x0E ; i
++ )
939 XGINew_SetReg1( pVBInfo
->P3c4
, i
, 0x00 ) ; /* Clear SR0A-SR0E */
943 /* --------------------------------------------------------------------- */
944 /* Function : XGI_SetDefaultVCLK */
948 /* --------------------------------------------------------------------- */
949 UCHAR
XGI_SetDefaultVCLK( PVB_DEVICE_INFO pVBInfo
)
952 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x31 , ~0x30 , 0x20 ) ;
953 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2B , pVBInfo
->VCLKData
[ 0 ].SR2B
) ;
954 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2C , pVBInfo
->VCLKData
[ 0 ].SR2C
) ;
956 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x31 , ~0x30 , 0x10 ) ;
957 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2B , pVBInfo
->VCLKData
[ 1 ].SR2B
) ;
958 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2C , pVBInfo
->VCLKData
[ 1 ].SR2C
) ;
960 XGINew_SetRegAND( pVBInfo
->P3c4
, 0x31 , ~0x30 ) ;
965 /* --------------------------------------------------------------------- */
966 /* Function : XGI_GetRatePtrCRT2 */
970 /* --------------------------------------------------------------------- */
971 USHORT
XGI_GetRatePtrCRT2( PXGI_HW_DEVICE_INFO pXGIHWDE
, USHORT ModeNo
, USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
)
973 SHORT LCDRefreshIndex
[] = { 0x00 , 0x00 , 0x03 , 0x01 } ,
974 LCDARefreshIndex
[] = { 0x00 , 0x00 , 0x03 , 0x01 , 0x01 , 0x01 , 0x01 } ;
976 USHORT RefreshRateTableIndex
, i
,
977 modeflag
, index
, temp
;
979 if ( ModeNo
<= 0x13 )
981 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
;
985 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
;
988 if ( pVBInfo
->IF_DEF_CH7005
== 1 )
990 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
992 if ( modeflag
& HalfDCLK
)
1000 index
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x33 ) ;
1001 index
= index
>> pVBInfo
->SelectCRT2Rate
;
1004 if ( pVBInfo
->LCDInfo
& LCDNonExpanding
)
1010 if ( pVBInfo
->SetFlag
& ProgrammingCRT2
)
1012 if ( pVBInfo
->IF_DEF_CH7005
== 1 )
1014 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
1020 if ( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToLCDA
) )
1022 if( pVBInfo
->IF_DEF_LVDS
== 0 )
1024 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
1025 temp
= LCDARefreshIndex
[ pVBInfo
->LCDResInfo
& 0x0F ] ; /* 301b */
1027 temp
= LCDRefreshIndex
[ pVBInfo
->LCDResInfo
& 0x0F ] ;
1041 RefreshRateTableIndex
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].REFindex
;
1042 ModeNo
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].ModeID
;
1043 if ( pXGIHWDE
->jChipType
>= XG20
) /* for XG20, XG21, XG27 */
1046 if ( pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag & XG2xNotSupport )
1051 if ( ( pVBInfo
->RefIndex
[ RefreshRateTableIndex
].XRes
== 800 ) &&
1052 ( pVBInfo
->RefIndex
[ RefreshRateTableIndex
].YRes
== 600 ) )
1056 /* Alan 10/19/2007; do the similiar adjustment like XGISearchCRT1Rate() */
1057 if ( ( pVBInfo
->RefIndex
[ RefreshRateTableIndex
].XRes
== 1024 ) &&
1058 ( pVBInfo
->RefIndex
[ RefreshRateTableIndex
].YRes
== 768 ) )
1062 if ( ( pVBInfo
->RefIndex
[ RefreshRateTableIndex
].XRes
== 1280 ) &&
1063 ( pVBInfo
->RefIndex
[ RefreshRateTableIndex
].YRes
== 1024 ) )
1072 if ( pVBInfo
->RefIndex
[ RefreshRateTableIndex
+ i
].ModeID
!= ModeNo
)
1074 temp
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
+ i
].Ext_InfoFlag
;
1075 temp
&= ModeInfoFlag
;
1076 if ( temp
< pVBInfo
->ModeType
)
1081 } while( index
!= 0xFFFF ) ;
1082 if ( !( pVBInfo
->VBInfo
& SetCRT2ToRAMDAC
) )
1084 if ( pVBInfo
->VBInfo
& SetInSlaveMode
)
1086 temp
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
+ i
- 1 ].Ext_InfoFlag
;
1087 if ( temp
& InterlaceMode
)
1094 if ( ( pVBInfo
->SetFlag
& ProgrammingCRT2
) )
1096 temp
= XGI_AjustCRT2Rate( ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, &i
, pVBInfo
) ;
1098 return( RefreshRateTableIndex
+ i
) ; /*return(0x01|(temp1<<1)); */
1102 /* --------------------------------------------------------------------- */
1103 /* Function : XGI_AjustCRT2Rate */
1107 /* --------------------------------------------------------------------- */
1108 BOOLEAN
XGI_AjustCRT2Rate( USHORT ModeNo
, USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
, USHORT
*i
, PVB_DEVICE_INFO pVBInfo
)
1116 if ( ModeNo
<= 0x13 )
1118 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
; /* si+St_ModeFlag */
1122 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
;
1125 resinfo
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_RESINFO
;
1126 tempbx
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
+ ( *i
) ].ModeID
;
1129 if ( pVBInfo
->IF_DEF_LVDS
== 0 )
1131 if ( pVBInfo
->VBInfo
& SetCRT2ToRAMDAC
)
1133 tempax
|= SupportRAMDAC2
;
1135 if ( pVBInfo
->VBType
& VB_XGI301C
)
1136 tempax
|= SupportCRT2in301C
;
1139 if ( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToLCDA
) ) /* 301b */
1141 tempax
|= SupportLCD
;
1143 if ( pVBInfo
->LCDResInfo
!= Panel1280x1024
)
1145 if ( pVBInfo
->LCDResInfo
!= Panel1280x960
)
1147 if ( pVBInfo
->LCDInfo
& LCDNonExpanding
)
1159 if ( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
) /* for HiTV */
1161 if ( ( pVBInfo
->VBType
& VB_XGI301LV
) && ( pVBInfo
->VBExtInfo
== VB_YPbPr1080i
) )
1163 tempax
|= SupportYPbPr
;
1164 if ( pVBInfo
->VBInfo
& SetInSlaveMode
)
1178 tempax
|= SupportHiVisionTV
;
1179 if ( pVBInfo
->VBInfo
& SetInSlaveMode
)
1186 if ( pVBInfo
->SetFlag
& TVSimuMode
)
1197 if ( pVBInfo
->VBInfo
& ( SetCRT2ToAVIDEO
| SetCRT2ToSVIDEO
| SetCRT2ToSCART
| SetCRT2ToYPbPr
| SetCRT2ToHiVisionTV
) )
1199 tempax
|= SupportTV
;
1201 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
1203 tempax
|= SupportTV1024
;
1206 if ( !( pVBInfo
->VBInfo
& SetPALTV
) )
1208 if ( modeflag
& NoSupportSimuTV
)
1210 if ( pVBInfo
->VBInfo
& SetInSlaveMode
)
1212 if ( !( pVBInfo
->VBInfo
& SetNotSimuMode
) )
1224 if ( pVBInfo
->IF_DEF_CH7005
== 1 )
1226 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
1228 tempax
|= SupportCHTV
;
1232 if ( pVBInfo
->VBInfo
& SetCRT2ToLCD
)
1234 tempax
|= SupportLCD
;
1236 if ( resinfo
> 0x08 )
1237 return( 0 ) ; /* 1024x768 */
1239 if ( pVBInfo
->LCDResInfo
< Panel1024x768
)
1241 if ( resinfo
> 0x07 )
1242 return( 0 ) ; /* 800x600 */
1244 if ( resinfo
== 0x04 )
1245 return( 0 ) ; /* 512x384 */
1250 for( ; pVBInfo
->RefIndex
[ RefreshRateTableIndex
+ ( *i
) ].ModeID
== tempbx
; ( *i
)-- )
1252 infoflag
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
+ ( *i
) ].Ext_InfoFlag
;
1253 if ( infoflag
& tempax
)
1261 for( ( *i
) = 0 ; ; ( *i
)++ )
1263 infoflag
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
+ ( *i
) ].Ext_InfoFlag
;
1264 if ( pVBInfo
->RefIndex
[ RefreshRateTableIndex
+ ( *i
) ].ModeID
!= tempbx
)
1269 if ( infoflag
& tempax
)
1278 /* --------------------------------------------------------------------- */
1279 /* Function : XGI_SetSync */
1283 /* --------------------------------------------------------------------- */
1284 void XGI_SetSync(USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
)
1289 sync
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_InfoFlag
>> 8 ; /* di+0x00 */
1293 XGINew_SetReg3( pVBInfo
->P3c2
, temp
) ; /* Set Misc(3c2) */
1297 /* --------------------------------------------------------------------- */
1298 /* Function : XGI_SetCRT1CRTC */
1302 /* --------------------------------------------------------------------- */
1303 void XGI_SetCRT1CRTC( USHORT ModeNo
, USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
,PVB_DEVICE_INFO pVBInfo
, PXGI_HW_DEVICE_INFO HwDeviceExtension
)
1310 index
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRT1CRTC
; /* Get index */
1311 index
= index
&IndexMask
;
1313 data
=( UCHAR
)XGINew_GetReg1( pVBInfo
->P3d4
, 0x11 ) ;
1315 XGINew_SetReg1(pVBInfo
->P3d4
,0x11,data
); /* Unlock CRTC */
1317 for( i
= 0 ; i
< 8 ; i
++ )
1318 pVBInfo
->TimingH
[ 0 ].data
[ i
] = pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ i
] ;
1320 for( i
= 0 ; i
< 7 ; i
++ )
1321 pVBInfo
->TimingV
[ 0 ].data
[ i
] = pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ i
+ 8 ] ;
1323 XGI_SetCRT1Timing_H( pVBInfo
, HwDeviceExtension
) ;
1327 XGI_SetCRT1Timing_V( ModeIdIndex
, ModeNo
, pVBInfo
) ;
1330 if( pVBInfo
->ModeType
> 0x03 )
1331 XGINew_SetReg1( pVBInfo
->P3d4
, 0x14 , 0x4F ) ;
1335 /* --------------------------------------------------------------------- */
1336 /* Function : XGI_SetCRT1Timing_H */
1340 /* --------------------------------------------------------------------- */
1341 void XGI_SetCRT1Timing_H( PVB_DEVICE_INFO pVBInfo
, PXGI_HW_DEVICE_INFO HwDeviceExtension
)
1343 UCHAR data
, data1
, pushax
;
1346 /* XGINew_SetReg1( pVBInfo->P3d4 , 0x51 , 0 ) ; */
1347 /* XGINew_SetReg1( pVBInfo->P3d4 , 0x56 , 0 ) ; */
1348 /* XGINew_SetRegANDOR( pVBInfo->P3d4 ,0x11 , 0x7f , 0x00 ) ; */
1350 data
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3d4
, 0x11 ) ; /* unlock cr0-7 */
1352 XGINew_SetReg1( pVBInfo
->P3d4
, 0x11 , data
) ;
1354 data
= pVBInfo
->TimingH
[ 0 ].data
[ 0 ] ;
1355 XGINew_SetReg1( pVBInfo
->P3d4
, 0 , data
) ;
1357 for( i
= 0x01 ; i
<= 0x04 ; i
++ )
1359 data
= pVBInfo
->TimingH
[ 0 ].data
[ i
] ;
1360 XGINew_SetReg1( pVBInfo
->P3d4
, ( USHORT
)( i
+ 1 ) , data
) ;
1363 for( i
= 0x05 ; i
<= 0x06 ; i
++ )
1365 data
= pVBInfo
->TimingH
[ 0 ].data
[ i
];
1366 XGINew_SetReg1( pVBInfo
->P3c4
,( USHORT
)( i
+ 6 ) , data
) ;
1369 j
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3c4
, 0x0e ) ;
1371 data
= pVBInfo
->TimingH
[ 0 ].data
[ 7 ] ;
1374 XGINew_SetReg1( pVBInfo
->P3c4
, 0x0e , data
) ;
1376 if ( HwDeviceExtension
->jChipType
>= XG20
)
1378 data
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3d4
, 0x04 ) ;
1380 XGINew_SetReg1( pVBInfo
->P3d4
, 0x04 , data
) ;
1381 data
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3d4
, 0x05 ) ;
1388 data
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3c4
, 0x0c ) ;
1390 XGINew_SetReg1( pVBInfo
->P3c4
, 0x0c , data
) ;
1395 XGINew_SetReg1( pVBInfo
->P3d4
, 0x05 , data
) ;
1396 data
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3c4
, 0x0e ) ;
1402 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0e , ~0xE0 , data
) ;
1407 /* --------------------------------------------------------------------- */
1408 /* Function : XGI_SetCRT1Timing_V */
1412 /* --------------------------------------------------------------------- */
1413 void XGI_SetCRT1Timing_V( USHORT ModeIdIndex
, USHORT ModeNo
,PVB_DEVICE_INFO pVBInfo
)
1418 /* XGINew_SetReg1( pVBInfo->P3d4 , 0x51 , 0 ) ; */
1419 /* XGINew_SetReg1( pVBInfo->P3d4 , 0x56 , 0 ) ; */
1420 /* XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x11 , 0x7f , 0x00 ) ; */
1422 for( i
= 0x00 ; i
<= 0x01 ; i
++ )
1424 data
= pVBInfo
->TimingV
[ 0 ].data
[ i
] ;
1425 XGINew_SetReg1( pVBInfo
->P3d4
, ( USHORT
)( i
+ 6 ) , data
) ;
1428 for( i
= 0x02 ; i
<= 0x03 ; i
++ )
1430 data
= pVBInfo
->TimingV
[ 0 ].data
[ i
] ;
1431 XGINew_SetReg1( pVBInfo
->P3d4
, ( USHORT
)( i
+ 0x0e ) , data
) ;
1434 for( i
= 0x04 ; i
<= 0x05 ; i
++ )
1436 data
= pVBInfo
->TimingV
[ 0 ].data
[ i
] ;
1437 XGINew_SetReg1( pVBInfo
->P3d4
, ( USHORT
)( i
+ 0x11 ) , data
) ;
1440 j
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3c4
, 0x0a ) ;
1442 data
= pVBInfo
->TimingV
[ 0 ].data
[ 6 ] ;
1445 XGINew_SetReg1( pVBInfo
->P3c4
, 0x0a , data
) ;
1447 data
= pVBInfo
->TimingV
[ 0 ].data
[ 6 ] ;
1451 if ( ModeNo
<= 0x13 )
1452 i
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
;
1454 i
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
;
1456 i
&= DoubleScanMode
;
1460 j
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3d4
, 0x09 ) ;
1463 XGINew_SetReg1( pVBInfo
->P3d4
, 0x09 , data
) ;
1467 /* --------------------------------------------------------------------- */
1468 /* Function : XGI_SetXG21CRTC */
1469 /* Input : Stand or enhance CRTC table */
1470 /* Output : Fill CRT Hsync/Vsync to SR2E/SR2F/SR30/SR33/SR34/SR3F */
1471 /* Description : Set LCD timing */
1472 /* --------------------------------------------------------------------- */
1473 void XGI_SetXG21CRTC(USHORT ModeNo
, USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
)
1475 UCHAR StandTableIndex
, index
, Tempax
, Tempbx
, Tempcx
, Tempdx
;
1476 USHORT Temp1
, Temp2
, Temp3
;
1478 if ( ModeNo
<= 0x13 )
1480 StandTableIndex
= XGI_GetModePtr( ModeNo
, ModeIdIndex
, pVBInfo
) ;
1481 Tempax
= pVBInfo
->StandTable
[ StandTableIndex
].CRTC
[ 4 ] ; /* CR04 HRS */
1482 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2E , Tempax
) ; /* SR2E [7:0]->HRS */
1483 Tempbx
= pVBInfo
->StandTable
[ StandTableIndex
].CRTC
[ 5 ] ; /* Tempbx: CR05 HRE */
1484 Tempbx
&= 0x1F ; /* Tempbx: HRE[4:0] */
1486 Tempcx
&= 0xE0 ; /* Tempcx: HRS[7:5] */
1487 Tempdx
= Tempcx
| Tempbx
; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */
1488 if ( Tempbx
< ( Tempax
& 0x1F ) ) /* IF HRE < HRS */
1489 Tempdx
|= 0x20 ; /* Tempdx: HRE = HRE + 0x20 */
1490 Tempdx
<<= 2 ; /* Tempdx << 2 */
1491 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2F , Tempdx
) ; /* SR2F [7:2]->HRE */
1492 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x30 , 0xE3 , 00 ) ;
1494 Tempax
= pVBInfo
->StandTable
[ StandTableIndex
].CRTC
[ 16 ] ; /* Tempax: CR16 VRS */
1495 Tempbx
= Tempax
; /* Tempbx=Tempax */
1496 Tempax
&= 0x01 ; /* Tempax: VRS[0] */
1497 XGINew_SetRegOR( pVBInfo
->P3c4
, 0x33 , Tempax
) ; /* SR33[0]->VRS */
1498 Tempax
= pVBInfo
->StandTable
[ StandTableIndex
].CRTC
[ 7 ] ; /* Tempax: CR7 VRS */
1499 Tempdx
= Tempbx
>> 1 ; /* Tempdx: VRS[7:1] */
1500 Tempcx
= Tempax
& 0x04 ; /* Tempcx: CR7[2] */
1501 Tempcx
<<= 5 ; /* Tempcx[7]: VRS[8] */
1502 Tempdx
|= Tempcx
; /* Tempdx: VRS[8:1] */
1503 XGINew_SetReg1( pVBInfo
->P3c4
, 0x34 , Tempdx
) ; /* SR34[7:0]: VRS[8:1] */
1505 Temp1
= Tempcx
<< 1 ; /* Temp1[8]: VRS[8] UCHAR -> USHORT */
1506 Temp1
|= Tempbx
; /* Temp1[8:0]: VRS[8:0] */
1507 Tempax
&= 0x80 ; /* Tempax[7]: CR7[7] */
1508 Temp2
= Tempax
<< 2 ; /* Temp2[9]: VRS[9] */
1509 Temp1
|= Temp2
; /* Temp1[9:0]: VRS[9:0] */
1511 Tempax
= pVBInfo
->StandTable
[ StandTableIndex
].CRTC
[ 17 ] ; /* CR16 VRE */
1512 Tempax
&= 0x0F ; /* Tempax[3:0]: VRE[3:0] */
1513 Temp2
= Temp1
& 0x3F0 ; /* Temp2[9:4]: VRS[9:4] */
1514 Temp2
|= Tempax
; /* Temp2[9:0]: VRE[9:0] */
1515 Temp3
= Temp1
& 0x0F ; /* Temp3[3:0]: VRS[3:0] */
1516 if ( Tempax
< Temp3
) /* VRE[3:0]<VRS[3:0] */
1517 Temp2
|= 0x10 ; /* Temp2: VRE + 0x10 */
1518 Temp2
&= 0xFF ; /* Temp2[7:0]: VRE[7:0] */
1519 Tempax
= (UCHAR
)Temp2
; /* Tempax[7:0]: VRE[7:0] */
1520 Tempax
<<= 2 ; /* Tempax << 2: VRE[5:0] */
1521 Temp1
&= 0x600 ; /* Temp1[10:9]: VRS[10:9] */
1522 Temp1
>>= 9 ; /* [10:9]->[1:0] */
1523 Tempbx
= (UCHAR
)Temp1
; /* Tempbx[1:0]: VRS[10:9] */
1524 Tempax
|= Tempbx
; /* VRE[5:0]VRS[10:9] */
1526 XGINew_SetReg1( pVBInfo
->P3c4
, 0x3F , Tempax
) ; /* SR3F D[7:2]->VRE D[1:0]->VRS */
1530 index
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRT1CRTC
;
1531 Tempax
= pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ 3 ] ; /* Tempax: CR4 HRS */
1532 Tempcx
= Tempax
; /* Tempcx: HRS */
1533 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2E , Tempax
) ; /* SR2E[7:0]->HRS */
1535 Tempdx
= pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ 5 ] ; /* SRB */
1536 Tempdx
&= 0xC0 ; /* Tempdx[7:6]: SRB[7:6] */
1537 Temp1
= Tempdx
; /* Temp1[7:6]: HRS[9:8] */
1538 Temp1
<<= 2 ; /* Temp1[9:8]: HRS[9:8] */
1539 Temp1
|= Tempax
; /* Temp1[9:0]: HRS[9:0] */
1541 Tempax
= pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ 4 ] ; /* CR5 HRE */
1542 Tempax
&= 0x1F ; /* Tempax[4:0]: HRE[4:0] */
1544 Tempbx
= pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ 6 ] ; /* SRC */
1545 Tempbx
&= 0x04 ; /* Tempbx[2]: HRE[5] */
1546 Tempbx
<<= 3 ; /* Tempbx[5]: HRE[5] */
1547 Tempax
|= Tempbx
; /* Tempax[5:0]: HRE[5:0] */
1549 Temp2
= Temp1
& 0x3C0 ; /* Temp2[9:6]: HRS[9:6] */
1550 Temp2
|= Tempax
; /* Temp2[9:0]: HRE[9:0] */
1552 Tempcx
&= 0x3F ; /* Tempcx[5:0]: HRS[5:0] */
1553 if( Tempax
< Tempcx
) /* HRE < HRS */
1554 Temp2
|= 0x40 ; /* Temp2 + 0x40 */
1557 Tempax
= (UCHAR
)Temp2
; /* Tempax: HRE[7:0] */
1558 Tempax
<<= 2 ; /* Tempax[7:2]: HRE[5:0] */
1559 Tempdx
>>= 6 ; /* Tempdx[7:6]->[1:0] HRS[9:8] */
1560 Tempax
|= Tempdx
; /* HRE[5:0]HRS[9:8] */
1561 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2F , Tempax
) ; /* SR2F D[7:2]->HRE, D[1:0]->HRS */
1562 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x30 , 0xE3 , 00 ) ;
1564 Tempax
= pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ 10 ] ; /* CR10 VRS */
1565 Tempbx
= Tempax
; /* Tempbx: VRS */
1566 Tempax
&= 0x01 ; /* Tempax[0]: VRS[0] */
1567 XGINew_SetRegOR( pVBInfo
->P3c4
, 0x33 , Tempax
) ; /* SR33[0]->VRS[0] */
1568 Tempax
= pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ 9 ] ; /* CR7[2][7] VRE */
1569 Tempcx
= Tempbx
>> 1 ; /* Tempcx[6:0]: VRS[7:1] */
1570 Tempdx
= Tempax
& 0x04 ; /* Tempdx[2]: CR7[2] */
1571 Tempdx
<<= 5 ; /* Tempdx[7]: VRS[8] */
1572 Tempcx
|= Tempdx
; /* Tempcx[7:0]: VRS[8:1] */
1573 XGINew_SetReg1( pVBInfo
->P3c4
, 0x34 , Tempcx
) ; /* SR34[8:1]->VRS */
1575 Temp1
= Tempdx
; /* Temp1[7]: Tempdx[7] */
1576 Temp1
<<= 1 ; /* Temp1[8]: VRS[8] */
1577 Temp1
|= Tempbx
; /* Temp1[8:0]: VRS[8:0] */
1579 Temp2
= Tempax
<< 2 ; /* Temp2[9]: VRS[9] */
1580 Temp1
|= Temp2
; /* Temp1[9:0]: VRS[9:0] */
1581 Tempax
= pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ 14 ] ; /* Tempax: SRA */
1582 Tempax
&= 0x08 ; /* Tempax[3]: VRS[3] */
1584 Temp2
<<= 7 ; /* Temp2[10]: VRS[10] */
1585 Temp1
|= Temp2
; /* Temp1[10:0]: VRS[10:0] */
1587 Tempax
= pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ 11 ] ; /* Tempax: CR11 VRE */
1588 Tempax
&= 0x0F ; /* Tempax[3:0]: VRE[3:0] */
1589 Tempbx
= pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ 14 ] ; /* Tempbx: SRA */
1590 Tempbx
&= 0x20 ; /* Tempbx[5]: VRE[5] */
1591 Tempbx
>>= 1 ; /* Tempbx[4]: VRE[4] */
1592 Tempax
|= Tempbx
; /* Tempax[4:0]: VRE[4:0] */
1593 Temp2
= Temp1
& 0x7E0 ; /* Temp2[10:5]: VRS[10:5] */
1594 Temp2
|= Tempax
; /* Temp2[10:5]: VRE[10:5] */
1596 Temp3
= Temp1
& 0x1F ; /* Temp3[4:0]: VRS[4:0] */
1597 if ( Tempax
< Temp3
) /* VRE < VRS */
1598 Temp2
|= 0x20 ; /* VRE + 0x20 */
1601 Tempax
= (UCHAR
)Temp2
; /* Tempax: VRE[7:0] */
1602 Tempax
<<= 2 ; /* Tempax[7:0]; VRE[5:0]00 */
1603 Temp1
&= 0x600 ; /* Temp1[10:9]: VRS[10:9] */
1604 Temp1
>>= 9 ; /* Temp1[1:0]: VRS[10:9] */
1605 Tempbx
= (UCHAR
)Temp1
;
1606 Tempax
|= Tempbx
; /* Tempax[7:0]: VRE[5:0]VRS[10:9] */
1608 XGINew_SetReg1( pVBInfo
->P3c4
, 0x3F , Tempax
) ; /* SR3F D[7:2]->VRE D[1:0]->VRS */
1612 void XGI_SetXG27CRTC(USHORT ModeNo
, USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
)
1614 USHORT StandTableIndex
, index
, Tempax
, Tempbx
, Tempcx
, Tempdx
;
1616 if ( ModeNo
<= 0x13 )
1618 StandTableIndex
= XGI_GetModePtr( ModeNo
, ModeIdIndex
, pVBInfo
) ;
1619 Tempax
= pVBInfo
->StandTable
[ StandTableIndex
].CRTC
[ 4 ] ; /* CR04 HRS */
1620 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2E , Tempax
) ; /* SR2E [7:0]->HRS */
1621 Tempbx
= pVBInfo
->StandTable
[ StandTableIndex
].CRTC
[ 5 ] ; /* Tempbx: CR05 HRE */
1622 Tempbx
&= 0x1F ; /* Tempbx: HRE[4:0] */
1624 Tempcx
&= 0xE0 ; /* Tempcx: HRS[7:5] */
1625 Tempdx
= Tempcx
| Tempbx
; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */
1626 if ( Tempbx
< ( Tempax
& 0x1F ) ) /* IF HRE < HRS */
1627 Tempdx
|= 0x20 ; /* Tempdx: HRE = HRE + 0x20 */
1628 Tempdx
<<= 2 ; /* Tempdx << 2 */
1629 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2F , Tempdx
) ; /* SR2F [7:2]->HRE */
1630 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x30 , 0xE3 , 00 ) ;
1632 Tempax
= pVBInfo
->StandTable
[ StandTableIndex
].CRTC
[ 16 ] ; /* Tempax: CR10 VRS */
1633 XGINew_SetReg1( pVBInfo
->P3c4
, 0x34 , Tempax
) ; /* SR34[7:0]->VRS */
1634 Tempcx
= Tempax
; /* Tempcx=Tempax=VRS[7:0] */
1635 Tempax
= pVBInfo
->StandTable
[ StandTableIndex
].CRTC
[ 7 ] ; /* Tempax[7][2]: CR7[7][2] VRS[9][8] */
1636 Tempbx
= Tempax
; /* Tempbx=CR07 */
1637 Tempax
&= 0x04 ; /* Tempax[2]: CR07[2] VRS[8] */
1639 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x35 , ~0x01, Tempax
) ; /* SR35 D[0]->VRS D[8] */
1640 Tempcx
|= (Tempax
<< 8) ; /* Tempcx[8] |= VRS[8] */
1641 Tempcx
|= (Tempbx
& 0x80)<<2; /* Tempcx[9] |= VRS[9] */
1644 Tempax
= pVBInfo
->StandTable
[ StandTableIndex
].CRTC
[ 17 ] ; /* CR11 VRE */
1645 Tempax
&= 0x0F ; /* Tempax: VRE[3:0] */
1646 Tempbx
= Tempcx
; /* Tempbx=Tempcx=VRS[9:0] */
1647 Tempbx
&= 0x3F0 ; /* Tempbx[9:4]: VRS[9:4] */
1648 Tempbx
|= Tempax
; /* Tempbx[9:0]: VRE[9:0] */
1649 if ( Tempax
<= (Tempcx
& 0x0F) ) /* VRE[3:0]<=VRS[3:0] */
1650 Tempbx
|= 0x10 ; /* Tempbx: VRE + 0x10 */
1651 Tempax
= (UCHAR
)Tempbx
& 0xFF; /* Tempax[7:0]: VRE[7:0] */
1652 Tempax
<<= 2 ; /* Tempax << 2: VRE[5:0] */
1653 Tempcx
= (Tempcx
&0x600)>>8; /* Tempcx VRS[10:9] */
1654 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x3F , ~0xFC, Tempax
) ; /* SR3F D[7:2]->VRE D[5:0] */
1655 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x35 , ~0x06, Tempcx
) ; /* SR35 D[2:1]->VRS[10:9] */
1659 index
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRT1CRTC
;
1660 Tempax
= pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ 3 ] ; /* Tempax: CR4 HRS */
1661 Tempbx
= Tempax
; /* Tempbx: HRS[7:0] */
1662 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2E , Tempax
) ; /* SR2E[7:0]->HRS */
1664 Tempax
= pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ 5 ] ; /* SR0B */
1665 Tempax
&= 0xC0 ; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/
1666 Tempbx
|= (Tempax
<< 2); /* Tempbx: HRS[9:0] */
1668 Tempax
= pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ 4 ] ; /* CR5 HRE */
1669 Tempax
&= 0x1F ; /* Tempax[4:0]: HRE[4:0] */
1670 Tempcx
= Tempax
; /* Tempcx: HRE[4:0] */
1672 Tempax
= pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ 6 ] ; /* SRC */
1673 Tempax
&= 0x04 ; /* Tempax[2]: HRE[5] */
1674 Tempax
<<= 3 ; /* Tempax[5]: HRE[5] */
1675 Tempcx
|= Tempax
; /* Tempcx[5:0]: HRE[5:0] */
1677 Tempbx
= Tempbx
& 0x3C0 ; /* Tempbx[9:6]: HRS[9:6] */
1678 Tempbx
|= Tempcx
; /* Tempbx: HRS[9:6]HRE[5:0] */
1680 Tempax
= pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ 3 ] ; /* Tempax: CR4 HRS */
1681 Tempax
&= 0x3F ; /* Tempax: HRS[5:0] */
1682 if( Tempcx
<= Tempax
) /* HRE[5:0] < HRS[5:0] */
1683 Tempbx
+= 0x40 ; /* Tempbx= Tempbx + 0x40 : HRE[9:0]*/
1685 Tempax
= pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ 5 ] ; /* SR0B */
1686 Tempax
&= 0xC0 ; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/
1687 Tempax
>>= 6; /* Tempax[1:0]: HRS[9:8]*/
1688 Tempax
|= ((Tempbx
<< 2) & 0xFF); /* Tempax[7:2]: HRE[5:0] */
1689 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2F , Tempax
) ; /* SR2F [7:2][1:0]: HRE[5:0]HRS[9:8] */
1690 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x30 , 0xE3 , 00 ) ;
1692 Tempax
= pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ 10 ] ; /* CR10 VRS */
1693 XGINew_SetReg1( pVBInfo
->P3c4
, 0x34 , Tempax
) ; /* SR34[7:0]->VRS[7:0] */
1695 Tempcx
= Tempax
; /* Tempcx <= VRS[7:0] */
1696 Tempax
= pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ 9 ] ; /* CR7[7][2] VRS[9][8] */
1697 Tempbx
= Tempax
; /* Tempbx <= CR07[7:0] */
1698 Tempax
= Tempax
& 0x04 ; /* Tempax[2]: CR7[2]: VRS[8] */
1699 Tempax
>>= 2 ; /* Tempax[0]: VRS[8] */
1700 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x35 , ~0x01 , Tempax
) ; /* SR35[0]: VRS[8] */
1701 Tempcx
|= (Tempax
<<8) ; /* Tempcx <= VRS[8:0] */
1702 Tempcx
|= ((Tempbx
&0x80)<<2) ; /* Tempcx <= VRS[9:0] */
1703 Tempax
= pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ 14 ] ; /* Tempax: SR0A */
1704 Tempax
&= 0x08; /* SR0A[3] VRS[10] */
1705 Tempcx
|= (Tempax
<<7) ; /* Tempcx <= VRS[10:0] */
1708 Tempax
= pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ 11 ] ; /* Tempax: CR11 VRE */
1709 Tempax
&= 0x0F ; /* Tempax[3:0]: VRE[3:0] */
1710 Tempbx
= pVBInfo
->XGINEWUB_CRT1Table
[ index
].CR
[ 14 ] ; /* Tempbx: SR0A */
1711 Tempbx
&= 0x20 ; /* Tempbx[5]: SR0A[5]: VRE[4] */
1712 Tempbx
>>= 1 ; /* Tempbx[4]: VRE[4] */
1713 Tempax
|= Tempbx
; /* Tempax[4:0]: VRE[4:0] */
1714 Tempbx
= Tempcx
; /* Tempbx: VRS[10:0] */
1715 Tempbx
&= 0x7E0 ; /* Tempbx[10:5]: VRS[10:5] */
1716 Tempbx
|= Tempax
; /* Tempbx: VRS[10:5]VRE[4:0] */
1718 if ( Tempbx
<= Tempcx
) /* VRE <= VRS */
1719 Tempbx
|= 0x20 ; /* VRE + 0x20 */
1721 Tempax
= (Tempbx
<<2) & 0xFF ; /* Tempax: Tempax[7:0]; VRE[5:0]00 */
1722 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x3F , ~0xFC , Tempax
) ; /* SR3F[7:2]:VRE[5:0] */
1723 Tempax
= Tempcx
>> 8;
1724 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x35 , ~0x07 , Tempax
) ; /* SR35[2:0]:VRS[10:8] */
1729 /* --------------------------------------------------------------------- */
1730 /* Function : XGI_SetXG21LCD */
1732 /* Output : FCLK duty cycle, FCLK delay compensation */
1733 /* Description : All values set zero */
1734 /* --------------------------------------------------------------------- */
1735 void XGI_SetXG21LCD(PVB_DEVICE_INFO pVBInfo
,USHORT RefreshRateTableIndex
,USHORT ModeNo
)
1737 USHORT Data
, Temp
, b3CC
;
1740 XGI_P3cc
= pVBInfo
->P3cc
;
1742 XGINew_SetReg1( pVBInfo
->P3d4
, 0x2E , 0x00 ) ;
1743 XGINew_SetReg1( pVBInfo
->P3d4
, 0x2F , 0x00 ) ;
1744 XGINew_SetReg1( pVBInfo
->P3d4
, 0x46 , 0x00 ) ;
1745 XGINew_SetReg1( pVBInfo
->P3d4
, 0x47 , 0x00 ) ;
1746 if ( ((*pVBInfo
->pDVOSetting
)&0xC0) == 0xC0 )
1748 XGINew_SetReg1( pVBInfo
->P3d4
, 0x2E , *pVBInfo
->pCR2E
) ;
1749 XGINew_SetReg1( pVBInfo
->P3d4
, 0x2F , *pVBInfo
->pCR2F
) ;
1750 XGINew_SetReg1( pVBInfo
->P3d4
, 0x46 , *pVBInfo
->pCR46
) ;
1751 XGINew_SetReg1( pVBInfo
->P3d4
, 0x47 , *pVBInfo
->pCR47
) ;
1754 Temp
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x37 ) ;
1758 XGINew_SetRegOR( pVBInfo
->P3c4
, 0x06 , 0x40 ) ; /* 18 bits FP */
1759 XGINew_SetRegOR( pVBInfo
->P3c4
, 0x09 , 0x40 ) ;
1762 XGINew_SetRegOR( pVBInfo
->P3c4
, 0x1E , 0x01 ) ; /* Negative blank polarity */
1764 XGINew_SetRegAND( pVBInfo
->P3c4
, 0x30 , ~0x20 ) ;
1765 XGINew_SetRegAND( pVBInfo
->P3c4
, 0x35 , ~0x80 ) ;
1767 if ( ModeNo
<= 0x13 )
1769 b3CC
= (UCHAR
) XGINew_GetReg2( XGI_P3cc
) ;
1771 XGINew_SetRegOR( pVBInfo
->P3c4
, 0x30 , 0x20 ) ; /* Hsync polarity */
1773 XGINew_SetRegOR( pVBInfo
->P3c4
, 0x35 , 0x80 ) ; /* Vsync polarity */
1777 Data
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_InfoFlag
;
1778 if ( Data
& 0x4000 )
1779 XGINew_SetRegOR( pVBInfo
->P3c4
, 0x30 , 0x20 ) ; /* Hsync polarity */
1780 if ( Data
& 0x8000 )
1781 XGINew_SetRegOR( pVBInfo
->P3c4
, 0x35 , 0x80 ) ; /* Vsync polarity */
1785 void XGI_SetXG27LCD(PVB_DEVICE_INFO pVBInfo
,USHORT RefreshRateTableIndex
,USHORT ModeNo
)
1787 USHORT Data
, Temp
, b3CC
;
1790 XGI_P3cc
= pVBInfo
->P3cc
;
1792 XGINew_SetReg1( pVBInfo
->P3d4
, 0x2E , 0x00 ) ;
1793 XGINew_SetReg1( pVBInfo
->P3d4
, 0x2F , 0x00 ) ;
1794 XGINew_SetReg1( pVBInfo
->P3d4
, 0x46 , 0x00 ) ;
1795 XGINew_SetReg1( pVBInfo
->P3d4
, 0x47 , 0x00 ) ;
1797 Temp
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x37 ) ;
1798 if ( ( Temp
& 0x03 ) == 0 ) /* dual 12 */
1800 XGINew_SetReg1( pVBInfo
->P3d4
, 0x46 , 0x13 ) ;
1801 XGINew_SetReg1( pVBInfo
->P3d4
, 0x47 , 0x13 ) ;
1804 if ( ((*pVBInfo
->pDVOSetting
)&0xC0) == 0xC0 )
1806 XGINew_SetReg1( pVBInfo
->P3d4
, 0x2E , *pVBInfo
->pCR2E
) ;
1807 XGINew_SetReg1( pVBInfo
->P3d4
, 0x2F , *pVBInfo
->pCR2F
) ;
1808 XGINew_SetReg1( pVBInfo
->P3d4
, 0x46 , *pVBInfo
->pCR46
) ;
1809 XGINew_SetReg1( pVBInfo
->P3d4
, 0x47 , *pVBInfo
->pCR47
) ;
1812 XGI_SetXG27FPBits(pVBInfo
);
1814 XGINew_SetRegOR( pVBInfo
->P3c4
, 0x1E , 0x01 ) ; /* Negative blank polarity */
1816 XGINew_SetRegAND( pVBInfo
->P3c4
, 0x30 , ~0x20 ) ; /* Hsync polarity */
1817 XGINew_SetRegAND( pVBInfo
->P3c4
, 0x35 , ~0x80 ) ; /* Vsync polarity */
1819 if ( ModeNo
<= 0x13 )
1821 b3CC
= (UCHAR
) XGINew_GetReg2( XGI_P3cc
) ;
1823 XGINew_SetRegOR( pVBInfo
->P3c4
, 0x30 , 0x20 ) ; /* Hsync polarity */
1825 XGINew_SetRegOR( pVBInfo
->P3c4
, 0x35 , 0x80 ) ; /* Vsync polarity */
1829 Data
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_InfoFlag
;
1830 if ( Data
& 0x4000 )
1831 XGINew_SetRegOR( pVBInfo
->P3c4
, 0x30 , 0x20 ) ; /* Hsync polarity */
1832 if ( Data
& 0x8000 )
1833 XGINew_SetRegOR( pVBInfo
->P3c4
, 0x35 , 0x80 ) ; /* Vsync polarity */
1837 /* --------------------------------------------------------------------- */
1838 /* Function : XGI_UpdateXG21CRTC */
1840 /* Output : CRT1 CRTC */
1841 /* Description : Modify CRT1 Hsync/Vsync to fix LCD mode timing */
1842 /* --------------------------------------------------------------------- */
1843 void XGI_UpdateXG21CRTC( USHORT ModeNo
, PVB_DEVICE_INFO pVBInfo
, USHORT RefreshRateTableIndex
)
1847 XGINew_SetRegAND( pVBInfo
->P3d4
, 0x11 , 0x7F ) ; /* Unlock CR0~7 */
1848 if ( ModeNo
<= 0x13 )
1850 for( i
= 0 ; i
< 12 ; i
++ )
1852 if ( ModeNo
== pVBInfo
->UpdateCRT1
[ i
].ModeID
)
1858 if ( ModeNo
== 0x2E && ( pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRT1CRTC
== RES640x480x60
) )
1860 else if ( ModeNo
== 0x2E && ( pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRT1CRTC
== RES640x480x72
) )
1862 else if ( ModeNo
== 0x2F )
1864 else if ( ModeNo
== 0x50 )
1866 else if ( ModeNo
== 0x59 )
1872 XGINew_SetReg1( pVBInfo
->P3d4
, 0x02 , pVBInfo
->UpdateCRT1
[ index
].CR02
) ;
1873 XGINew_SetReg1( pVBInfo
->P3d4
, 0x03 , pVBInfo
->UpdateCRT1
[ index
].CR03
) ;
1874 XGINew_SetReg1( pVBInfo
->P3d4
, 0x15 , pVBInfo
->UpdateCRT1
[ index
].CR15
) ;
1875 XGINew_SetReg1( pVBInfo
->P3d4
, 0x16 , pVBInfo
->UpdateCRT1
[ index
].CR16
) ;
1880 /* --------------------------------------------------------------------- */
1881 /* Function : XGI_SetCRT1DE */
1885 /* --------------------------------------------------------------------- */
1886 void XGI_SetCRT1DE( PXGI_HW_DEVICE_INFO HwDeviceExtension
, USHORT ModeNo
,USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
)
1897 resindex
= XGI_GetResInfo( ModeNo
, ModeIdIndex
, pVBInfo
) ;
1899 if ( ModeNo
<= 0x13 )
1901 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
;
1902 tempax
= pVBInfo
->StResInfo
[ resindex
].HTotal
;
1903 tempbx
= pVBInfo
->StResInfo
[ resindex
].VTotal
;
1907 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
;
1908 tempax
= pVBInfo
->ModeResInfo
[ resindex
].HTotal
;
1909 tempbx
= pVBInfo
->ModeResInfo
[ resindex
].VTotal
;
1912 if ( modeflag
& HalfDCLK
)
1913 tempax
= tempax
>> 1 ;
1915 if ( ModeNo
> 0x13 )
1917 if ( modeflag
& HalfDCLK
)
1918 tempax
= tempax
<< 1 ;
1920 temp
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_InfoFlag
;
1922 if ( temp
& InterlaceMode
)
1923 tempbx
= tempbx
>> 1 ;
1925 if ( modeflag
& DoubleScanMode
)
1926 tempbx
= tempbx
<< 1 ;
1931 /* if ( !( modeflag & Charx8Dot ) ) */
1938 temp
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3d4
, 0x11 ) ;
1939 data
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3d4
, 0x11 ) ;
1941 XGINew_SetReg1( pVBInfo
->P3d4
, 0x11 , data
) ; /* Unlock CRTC */
1942 XGINew_SetReg1( pVBInfo
->P3d4
, 0x01 , ( USHORT
)( tempcx
& 0xff ) ) ;
1943 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x0b , ~0x0c , ( USHORT
)( ( tempcx
& 0x0ff00 ) >> 10 ) ) ;
1944 XGINew_SetReg1( pVBInfo
->P3d4
, 0x12 , ( USHORT
)( tempbx
& 0xff ) ) ;
1946 tempbx
= tempbx
>> 8 ;
1948 if ( tempbx
& 0x01 )
1951 if ( tempbx
& 0x02 )
1954 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x07 , ~0x42 , tempax
) ;
1955 data
=( UCHAR
)XGINew_GetReg1( pVBInfo
->P3d4
, 0x07 ) ;
1959 if ( tempbx
& 0x04 )
1962 XGINew_SetRegANDOR( pVBInfo
->P3d4
,0x0a , ~0x02 , tempax
) ;
1963 XGINew_SetReg1( pVBInfo
->P3d4
, 0x11 , temp
) ;
1967 /* --------------------------------------------------------------------- */
1968 /* Function : XGI_GetResInfo */
1972 /* --------------------------------------------------------------------- */
1973 USHORT
XGI_GetResInfo(USHORT ModeNo
, USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
)
1977 if ( ModeNo
<= 0x13 )
1979 resindex
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ResInfo
; /* si+St_ResInfo */
1983 resindex
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_RESINFO
; /* si+Ext_ResInfo */
1985 return( resindex
) ;
1989 /* --------------------------------------------------------------------- */
1990 /* Function : XGI_SetCRT1Offset */
1994 /* --------------------------------------------------------------------- */
1995 void XGI_SetCRT1Offset( USHORT ModeNo
, USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
, PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
)
2005 temp
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeInfo
;
2007 temp
= pVBInfo
->ScreenOffset
[ temp
] ;
2009 temp2
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_InfoFlag
;
2010 temp2
&= InterlaceMode
;
2015 temp2
= pVBInfo
->ModeType
- ModeEGA
;
2041 if ( ( ModeNo
>= 0x26 ) && ( ModeNo
<= 0x28 ) )
2042 temp
= temp
* temp2
+ temp2
/ 2 ;
2047 DisplayUnit
= temp
;
2049 temp
= temp
>> 8 ; /* ah */
2051 i
= XGINew_GetReg1( pVBInfo
->P3c4
, 0x0E ) ;
2054 XGINew_SetReg1( pVBInfo
->P3c4
, 0x0E , i
) ;
2056 temp
=( UCHAR
)temp2
;
2057 temp
&= 0xFF ; /* al */
2058 XGINew_SetReg1( pVBInfo
->P3d4
, 0x13 , temp
) ;
2060 /* SetDisplayUnit */
2061 temp2
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_InfoFlag
;
2062 temp2
&= InterlaceMode
;
2066 DisplayUnit
= DisplayUnit
<< 5 ;
2067 ah
= ( DisplayUnit
& 0xff00 ) >> 8 ;
2068 al
= DisplayUnit
& 0x00ff ;
2074 if ( HwDeviceExtension
->jChipType
>= XG20
)
2075 if ( ( ModeNo
== 0x4A ) | (ModeNo
== 0x49 ) )
2078 XGINew_SetReg1( pVBInfo
->P3c4
, 0x10 , ah
) ;
2082 /* --------------------------------------------------------------------- */
2083 /* Function : XGI_SetCRT1VCLK */
2087 /* --------------------------------------------------------------------- */
2088 void XGI_SetCRT1VCLK( USHORT ModeNo
, USHORT ModeIdIndex
,
2089 PXGI_HW_DEVICE_INFO HwDeviceExtension
, USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
)
2091 UCHAR index
, data
;
2094 if ( pVBInfo
->IF_DEF_LVDS
== 1 )
2096 index
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRTVCLK
;
2097 data
= XGINew_GetReg1( pVBInfo
->P3c4
, 0x31 ) & 0xCF ;
2098 XGINew_SetReg1( pVBInfo
->P3c4
, 0x31 , data
) ;
2099 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2B , pVBInfo
->VCLKData
[ index
].SR2B
) ;
2100 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2C , pVBInfo
->VCLKData
[ index
].SR2C
) ;
2101 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2D , 0x01 ) ;
2103 else if ( ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) ) && ( pVBInfo
->VBInfo
& SetCRT2ToLCDA
) )
2105 vclkindex
= XGI_GetVCLK2Ptr( ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, HwDeviceExtension
, pVBInfo
) ;
2106 data
= XGINew_GetReg1( pVBInfo
->P3c4
, 0x31 ) & 0xCF ;
2107 XGINew_SetReg1( pVBInfo
->P3c4
, 0x31 , data
) ;
2108 data
= pVBInfo
->VBVCLKData
[ vclkindex
].Part4_A
;
2109 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2B , data
) ;
2110 data
= pVBInfo
->VBVCLKData
[ vclkindex
].Part4_B
;
2111 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2C , data
) ;
2112 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2D , 0x01 ) ;
2116 index
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRTVCLK
;
2117 data
= XGINew_GetReg1( pVBInfo
->P3c4
, 0x31 ) & 0xCF ;
2118 XGINew_SetReg1( pVBInfo
->P3c4
, 0x31 , data
) ;
2119 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2B , pVBInfo
->VCLKData
[ index
].SR2B
) ;
2120 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2C , pVBInfo
->VCLKData
[ index
].SR2C
) ;
2121 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2D , 0x01 ) ;
2124 if ( HwDeviceExtension
->jChipType
>= XG20
)
2126 if ( pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
& HalfDCLK
)
2128 data
= XGINew_GetReg1( pVBInfo
->P3c4
, 0x2B ) ;
2129 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2B , data
) ;
2130 data
= XGINew_GetReg1( pVBInfo
->P3c4
, 0x2C ) ;
2137 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2C , data
) ;
2143 /* --------------------------------------------------------------------- */
2144 /* Function : XGI_SetCRT1FIFO */
2148 /* --------------------------------------------------------------------- */
2149 void XGI_SetCRT1FIFO( USHORT ModeNo
, PXGI_HW_DEVICE_INFO HwDeviceExtension
,PVB_DEVICE_INFO pVBInfo
)
2153 data
= XGINew_GetReg1( pVBInfo
->P3c4
, 0x3D ) ;
2155 XGINew_SetReg1( pVBInfo
->P3c4
, 0x3D , data
) ; /* diable auto-threshold */
2157 if ( ModeNo
> 0x13 )
2159 XGINew_SetReg1( pVBInfo
->P3c4
, 0x08 , 0x34 ) ;
2160 data
= XGINew_GetReg1( pVBInfo
->P3c4
, 0x09 ) ;
2162 XGINew_SetReg1( pVBInfo
->P3c4
, 0x09 , data
| 0x30) ;
2163 data
= XGINew_GetReg1( pVBInfo
->P3c4
, 0x3D ) ;
2165 XGINew_SetReg1( pVBInfo
->P3c4
, 0x3D , data
) ;
2169 if (HwDeviceExtension
->jChipType
== XG27
)
2171 XGINew_SetReg1( pVBInfo
->P3c4
, 0x08 , 0x0E ) ;
2172 data
= XGINew_GetReg1( pVBInfo
->P3c4
, 0x09 ) ;
2174 XGINew_SetReg1( pVBInfo
->P3c4
, 0x09 , data
| 0x20 ) ;
2178 XGINew_SetReg1( pVBInfo
->P3c4
, 0x08 , 0xAE ) ;
2179 data
= XGINew_GetReg1( pVBInfo
->P3c4
, 0x09 ) ;
2181 XGINew_SetReg1( pVBInfo
->P3c4
, 0x09 , data
) ;
2185 if (HwDeviceExtension
->jChipType
== XG21
)
2187 XGI_SetXG21FPBits(pVBInfo
); /* Fix SR9[7:6] can't read back */
2192 /* --------------------------------------------------------------------- */
2193 /* Function : XGI_SetCRT1ModeRegs */
2197 /* --------------------------------------------------------------------- */
2198 void XGI_SetCRT1ModeRegs( PXGI_HW_DEVICE_INFO HwDeviceExtension
,
2199 USHORT ModeNo
, USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
,PVB_DEVICE_INFO pVBInfo
)
2209 if ( ModeNo
> 0x13 )
2211 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
;
2212 infoflag
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_InfoFlag
;
2215 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
; /* si+St_ModeFlag */
2217 if ( XGINew_GetReg1( pVBInfo
->P3d4
, 0x31 ) & 0x01 )
2218 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x1F , 0x3F , 0x00 ) ;
2220 if ( ModeNo
> 0x13 )
2227 if ( ModeNo
> 0x13 )
2229 if ( pVBInfo
->ModeType
> 0x02 )
2232 data3
= pVBInfo
->ModeType
- ModeVGA
;
2233 data3
= data3
<< 2 ;
2238 data
&= InterlaceMode
;
2243 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x06 , ~0x3F , data2
) ;
2244 /* XGINew_SetReg1(pVBInfo->P3c4,0x06,data2); */
2245 resindex
= XGI_GetResInfo( ModeNo
, ModeIdIndex
, pVBInfo
) ;
2246 if ( ModeNo
<= 0x13 )
2247 xres
= pVBInfo
->StResInfo
[ resindex
].HTotal
;
2249 xres
= pVBInfo
->ModeResInfo
[ resindex
].HTotal
; /* xres->ax */
2252 if ( infoflag
& InterlaceMode
)
2256 else if ( xres
== 1280 )
2260 data2
= data
& 0x00FF ;
2261 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x19 , 0xFF , data2
) ;
2262 data2
= ( data
& 0xFF00 ) >> 8 ;
2263 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x19 , 0xFC , data2
) ;
2265 if( modeflag
& HalfDCLK
)
2266 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x01 , 0xF7 , 0x08 ) ;
2270 if ( modeflag
& LineCompareOff
)
2273 if ( ModeNo
> 0x13 )
2275 if ( pVBInfo
->ModeType
== ModeEGA
)
2279 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0F , ~0x48 , data2
) ;
2281 if ( pVBInfo
->ModeType
!= ModeText
)
2283 data
= data
^ 0x60 ;
2284 if ( pVBInfo
->ModeType
!= ModeEGA
)
2286 data
= data
^ 0xA0 ;
2289 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x21 , 0x1F , data
) ;
2291 XGI_SetVCLKState( HwDeviceExtension
, ModeNo
, RefreshRateTableIndex
, pVBInfo
) ;
2293 /* if(modeflag&HalfDCLK)//030305 fix lowresolution bug */
2294 /* if(XGINew_IF_DEF_NEW_LOWRES) */
2295 /* XGI_VesaLowResolution(ModeNo,ModeIdIndex);//030305 fix lowresolution bug */
2297 data
=XGINew_GetReg1( pVBInfo
->P3d4
, 0x31 ) ;
2299 if (HwDeviceExtension
->jChipType
== XG27
)
2305 XGINew_SetReg1( pVBInfo
->P3d4
, 0x52 , data
) ;
2306 XGINew_SetRegOR( pVBInfo
->P3d4
, 0x51 , 0x10 ) ;
2309 if (HwDeviceExtension
->jChipType
>= XG20
)
2315 XGINew_SetReg1( pVBInfo
->P3d4
, 0x52 , data
) ;
2316 XGINew_SetReg1( pVBInfo
->P3d4
, 0x51 , 0x02 ) ;
2324 XGINew_SetReg1( pVBInfo
->P3d4
, 0x52 , data
) ;
2330 /* --------------------------------------------------------------------- */
2331 /* Function : XGI_SetVCLKState */
2335 /* --------------------------------------------------------------------- */
2336 void XGI_SetVCLKState( PXGI_HW_DEVICE_INFO HwDeviceExtension
, USHORT ModeNo
, USHORT RefreshRateTableIndex
,PVB_DEVICE_INFO pVBInfo
)
2344 if ( ModeNo
<= 0x13 )
2348 index
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRTVCLK
;
2349 index
&= IndexMask
;
2350 VCLK
= pVBInfo
->VCLKData
[ index
].CLOCK
;
2353 data
= XGINew_GetReg1( pVBInfo
->P3c4
, 0x32 ) ;
2356 data
|= 0x0c ; /* VCLK > 200 */
2358 if ( HwDeviceExtension
->jChipType
>= XG20
)
2359 data
&= ~0x04 ; /* 2 pixel mode */
2361 XGINew_SetReg1( pVBInfo
->P3c4
, 0x32 , data
) ;
2363 if ( HwDeviceExtension
->jChipType
< XG20
)
2365 data
= XGINew_GetReg1( pVBInfo
->P3c4
, 0x1F ) ;
2369 XGINew_SetReg1( pVBInfo
->P3c4
, 0x1F , data
) ;
2372 /* Jong for Adavantech LCD ripple issue
2373 if ( ( VCLK >= 0 ) && ( VCLK < 135 ) )
2375 else if ( ( VCLK >= 135 ) && ( VCLK < 160 ) )
2377 else if ( ( VCLK >= 160 ) && ( VCLK < 260 ) )
2379 else if ( VCLK > 260 )
2384 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x07 , 0xFC , data2
) ;
2385 if (HwDeviceExtension
->jChipType
>= XG27
)
2387 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x40 , 0xFC , data2
&0x03 ) ;
2394 /* --------------------------------------------------------------------- */
2395 /* Function : XGI_VesaLowResolution */
2399 /* --------------------------------------------------------------------- */
2400 /*void XGI_VesaLowResolution( USHORT ModeNo , USHORT ModeIdIndex ,PVB_DEVICE_INFO pVBInfo)
2404 if ( ModeNo > 0x13 )
2405 modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
2407 modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ;
2409 if ( ModeNo > 0x13 )
2411 if ( modeflag & DoubleScanMode )
2413 if ( modeflag & HalfDCLK )
2415 if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
2417 if ( !( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) )
2419 if ( pVBInfo->VBInfo & SetInSlaveMode )
2421 XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xf7 , 0x00 ) ;
2422 XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0f , 0x7f , 0x00 ) ;
2427 XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0f , 0xff , 0x80 ) ;
2428 XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xf7 , 0x00 ) ;
2433 XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0f , 0x7f , 0x00 ) ;
2437 /* --------------------------------------------------------------------- */
2438 /* Function : XGI_LoadDAC */
2442 /* --------------------------------------------------------------------- */
2443 void XGI_LoadDAC( USHORT ModeNo
, USHORT ModeIdIndex
,PVB_DEVICE_INFO pVBInfo
)
2445 USHORT data
, data2
, time
,
2446 i
, j
, k
, m
, n
, o
,
2447 si
, di
, bx
, dl
, al
, ah
, dh
,
2450 if ( ModeNo
<= 0x13 )
2451 data
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
;
2453 data
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
;
2455 data
&= DACInfoFlag
;
2459 table
= XGINew_MDA_DAC
;
2460 else if ( data
== 0x08 )
2461 table
= XGINew_CGA_DAC
;
2462 else if ( data
== 0x10 )
2463 table
= XGINew_EGA_DAC
;
2464 else if ( data
== 0x18 )
2467 table
= XGINew_VGA_DAC
;
2475 XGINew_SetReg3( pVBInfo
->P3c6
, 0xFF ) ;
2476 XGINew_SetReg3( pVBInfo
->P3c8
, 0x00 ) ;
2478 for( i
= 0 ; i
< j
; i
++ )
2482 for( k
= 0 ; k
< 3 ; k
++ )
2492 XGINew_SetReg3( pVBInfo
->P3c9
, data2
) ;
2499 for( i
= 16 ; i
< 32 ; i
++ )
2503 for( k
= 0 ; k
< 3 ; k
++ )
2504 XGINew_SetReg3( pVBInfo
->P3c9
, data
) ;
2509 for( m
= 0 ; m
< 9 ; m
++ )
2515 for( n
= 0 ; n
< 3 ; n
++ )
2517 for( o
= 0 ; o
< 5 ; o
++ )
2523 XGI_WriteDAC( dl
, ah
, al
, dh
, pVBInfo
) ;
2528 for( o
= 0 ; o
< 3 ; o
++ )
2534 XGI_WriteDAC( dl
, ah
, al
, dh
, pVBInfo
) ;
2546 /* --------------------------------------------------------------------- */
2547 /* Function : XGI_WriteDAC */
2551 /* --------------------------------------------------------------------- */
2552 void XGI_WriteDAC( USHORT dl
, USHORT ah
, USHORT al
, USHORT dh
,PVB_DEVICE_INFO pVBInfo
)
2554 USHORT temp
, bh
, bl
;
2577 XGINew_SetReg3( pVBInfo
->P3c9
, ( USHORT
)dh
) ;
2578 XGINew_SetReg3( pVBInfo
->P3c9
, ( USHORT
)bh
) ;
2579 XGINew_SetReg3( pVBInfo
->P3c9
, ( USHORT
)bl
) ;
2582 /* --------------------------------------------------------------------- */
2583 /* Function : XGI_SetLCDAGroup */
2587 /* --------------------------------------------------------------------- */
2588 void XGI_SetLCDAGroup( USHORT ModeNo
, USHORT ModeIdIndex
, PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
)
2590 USHORT RefreshRateTableIndex
;
2593 /* pVBInfo->SelectCRT2Rate = 0 ; */
2595 pVBInfo
->SetFlag
|= ProgrammingCRT2
;
2596 RefreshRateTableIndex
= XGI_GetRatePtrCRT2( HwDeviceExtension
, ModeNo
, ModeIdIndex
, pVBInfo
) ;
2597 XGI_GetLVDSResInfo( ModeNo
, ModeIdIndex
, pVBInfo
) ;
2598 XGI_GetLVDSData( ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
);
2599 XGI_ModCRT1Regs( ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, HwDeviceExtension
, pVBInfo
) ;
2600 XGI_SetLVDSRegs( ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
) ;
2601 XGI_SetCRT2ECLK( ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
) ;
2605 /* --------------------------------------------------------------------- */
2606 /* Function : XGI_GetLVDSResInfo */
2610 /* --------------------------------------------------------------------- */
2611 void XGI_GetLVDSResInfo( USHORT ModeNo
, USHORT ModeIdIndex
,PVB_DEVICE_INFO pVBInfo
)
2613 USHORT resindex
, xres
, yres
, modeflag
;
2615 if ( ModeNo
<= 0x13 )
2617 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ResInfo
; /* si+St_ResInfo */
2621 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_RESINFO
; /* si+Ext_ResInfo */
2625 /* if ( ModeNo > 0x13 ) */
2626 /* modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; */
2628 /* modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; */
2630 if ( ModeNo
<= 0x13 )
2632 resindex
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ResInfo
; /* si+St_ResInfo */
2636 resindex
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_RESINFO
; /* si+Ext_ResInfo */
2639 /* resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; */
2641 if ( ModeNo
<= 0x13 )
2643 xres
= pVBInfo
->StResInfo
[ resindex
].HTotal
;
2644 yres
= pVBInfo
->StResInfo
[ resindex
].VTotal
;
2648 xres
= pVBInfo
->ModeResInfo
[ resindex
].HTotal
;
2649 yres
= pVBInfo
->ModeResInfo
[ resindex
].VTotal
;
2651 if ( ModeNo
> 0x13 )
2653 if ( modeflag
& HalfDCLK
)
2656 if ( modeflag
& DoubleScanMode
)
2659 /* if ( modeflag & Charx8Dot ) */
2666 pVBInfo
->VGAHDE
= xres
;
2667 pVBInfo
->HDE
= xres
;
2668 pVBInfo
->VGAVDE
= yres
;
2669 pVBInfo
->VDE
= yres
;
2673 /* --------------------------------------------------------------------- */
2674 /* Function : XGI_GetLVDSData */
2678 /* --------------------------------------------------------------------- */
2679 void XGI_GetLVDSData( USHORT ModeNo
, USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
)
2682 XGI330_LVDSDataStruct
*LCDPtr
= NULL
;
2683 XGI330_CHTVDataStruct
*TVPtr
= NULL
;
2687 if ( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToLCDA
) )
2689 LCDPtr
= ( XGI330_LVDSDataStruct
* )XGI_GetLcdPtr( tempbx
, ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
) ;
2690 pVBInfo
->VGAHT
= LCDPtr
->VGAHT
;
2691 pVBInfo
->VGAVT
= LCDPtr
->VGAVT
;
2692 pVBInfo
->HT
= LCDPtr
->LCDHT
;
2693 pVBInfo
->VT
= LCDPtr
->LCDVT
;
2695 if ( pVBInfo
->IF_DEF_CH7017
== 1 )
2697 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
2699 TVPtr
= ( XGI330_CHTVDataStruct
* )XGI_GetTVPtr( tempbx
, ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
) ;
2700 pVBInfo
->VGAHT
= TVPtr
->VGAHT
;
2701 pVBInfo
->VGAVT
= TVPtr
->VGAVT
;
2702 pVBInfo
->HT
= TVPtr
->LCDHT
;
2703 pVBInfo
->VT
= TVPtr
->LCDVT
;
2707 if ( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToLCDA
) )
2709 if ( !( pVBInfo
->LCDInfo
& ( SetLCDtoNonExpanding
| EnableScalingLCD
) ) )
2711 if ( ( pVBInfo
->LCDResInfo
== Panel1024x768
) || ( pVBInfo
->LCDResInfo
== Panel1024x768x75
) )
2713 pVBInfo
->HDE
= 1024 ;
2714 pVBInfo
->VDE
= 768 ;
2716 else if ( ( pVBInfo
->LCDResInfo
== Panel1280x1024
) || ( pVBInfo
->LCDResInfo
== Panel1280x1024x75
) )
2718 pVBInfo
->HDE
= 1280 ;
2719 pVBInfo
->VDE
= 1024 ;
2721 else if ( pVBInfo
->LCDResInfo
== Panel1400x1050
)
2723 pVBInfo
->HDE
= 1400 ;
2724 pVBInfo
->VDE
= 1050 ;
2728 pVBInfo
->HDE
= 1600 ;
2729 pVBInfo
->VDE
= 1200 ;
2736 /* --------------------------------------------------------------------- */
2737 /* Function : XGI_ModCRT1Regs */
2741 /* --------------------------------------------------------------------- */
2742 void XGI_ModCRT1Regs( USHORT ModeNo
, USHORT ModeIdIndex
,
2743 USHORT RefreshRateTableIndex
, PXGI_HW_DEVICE_INFO HwDeviceExtension
,PVB_DEVICE_INFO pVBInfo
)
2747 XGI_LVDSCRT1HDataStruct
*LCDPtr
= NULL
;
2748 XGI_LVDSCRT1VDataStruct
*LCDPtr1
=NULL
;
2749 /* XGI330_CHTVDataStruct *TVPtr = NULL ; */
2750 XGI_CH7007TV_TimingHStruct
*CH7007TV_TimingHPtr
= NULL
;
2751 XGI_CH7007TV_TimingVStruct
*CH7007TV_TimingVPtr
= NULL
;
2753 if( ModeNo
<= 0x13 )
2754 index
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_CRT2CRTC
;
2756 index
= pVBInfo
->RefIndex
[RefreshRateTableIndex
].Ext_CRT2CRTC
;
2758 index
= index
& IndexMask
;
2760 if ( ( pVBInfo
->IF_DEF_ScaleLCD
== 0 ) || ( ( pVBInfo
->IF_DEF_ScaleLCD
== 1 ) && ( !( pVBInfo
->LCDInfo
& EnableScalingLCD
) ) ) )
2764 if ( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToLCDA
) )
2766 LCDPtr
= ( XGI_LVDSCRT1HDataStruct
* )XGI_GetLcdPtr( tempbx
, ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
) ;
2768 for( i
= 0 ; i
< 8 ; i
++ )
2769 pVBInfo
->TimingH
[ 0 ].data
[ i
] = LCDPtr
[ 0 ].Reg
[ i
] ;
2772 if ( pVBInfo
->IF_DEF_CH7007
== 1 )
2774 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
2776 CH7007TV_TimingHPtr
= ( XGI_CH7007TV_TimingHStruct
*)XGI_GetTVPtr( tempbx
, ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
) ;
2778 for( i
= 0 ; i
< 8 ; i
++ )
2779 pVBInfo
->TimingH
[ 0 ].data
[ i
] = CH7007TV_TimingHPtr
[ 0 ].data
[ i
] ;
2783 /* if ( pVBInfo->IF_DEF_CH7017 == 1 )
2785 if ( pVBInfo->VBInfo & SetCRT2ToTV )
2786 TVPtr = ( XGI330_CHTVDataStruct *)XGI_GetTVPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ;
2789 XGI_SetCRT1Timing_H(pVBInfo
,HwDeviceExtension
) ;
2791 if ( pVBInfo
->IF_DEF_CH7007
== 1 )
2793 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2E , CH7007TV_TimingHPtr
[ 0 ].data
[ 8 ] ) ;
2794 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2F , CH7007TV_TimingHPtr
[ 0 ].data
[ 9 ] ) ;
2799 if ( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToLCDA
) )
2801 LCDPtr1
= ( XGI_LVDSCRT1VDataStruct
* )XGI_GetLcdPtr( tempbx
, ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
) ;
2802 for( i
= 0 ; i
< 7 ; i
++ )
2803 pVBInfo
->TimingV
[ 0 ].data
[ i
] = LCDPtr1
[ 0 ].Reg
[ i
] ;
2806 if ( pVBInfo
->IF_DEF_CH7007
== 1 )
2808 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
2810 CH7007TV_TimingVPtr
= ( XGI_CH7007TV_TimingVStruct
*)XGI_GetTVPtr( tempbx
, ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
) ;
2812 for( i
= 0 ; i
< 7 ; i
++ )
2813 pVBInfo
->TimingV
[ 0 ].data
[ i
] = CH7007TV_TimingVPtr
[ 0 ].data
[ i
] ;
2816 /* if ( pVBInfo->IF_DEF_CH7017 == 1 )
2818 if ( pVBInfo->VBInfo & SetCRT2ToTV )
2819 TVPtr = ( XGI330_CHTVDataStruct *)XGI_GetTVPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ;
2822 XGI_SetCRT1Timing_V( ModeIdIndex
, ModeNo
, pVBInfo
) ;
2824 if ( pVBInfo
->IF_DEF_CH7007
== 1 )
2826 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x33 , ~0x01 , CH7007TV_TimingVPtr
[ 0 ].data
[ 7 ]&0x01 ) ;
2827 XGINew_SetReg1( pVBInfo
->P3c4
, 0x34 , CH7007TV_TimingVPtr
[ 0 ].data
[8 ] ) ;
2828 XGINew_SetReg1( pVBInfo
->P3c4
, 0x3F , CH7007TV_TimingVPtr
[ 0 ].data
[9 ] ) ;
2836 /* --------------------------------------------------------------------- */
2837 /* Function : XGI_SetLVDSRegs */
2841 /* --------------------------------------------------------------------- */
2842 void XGI_SetLVDSRegs( USHORT ModeNo
, USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
)
2844 USHORT tempbx
, tempax
, tempcx
, tempdx
, push1
, push2
, modeflag
;
2845 unsigned long temp
, temp1
, temp2
, temp3
, push3
;
2846 XGI330_LCDDataDesStruct
*LCDPtr
= NULL
;
2847 XGI330_LCDDataDesStruct2
*LCDPtr1
= NULL
;
2849 if ( ModeNo
> 0x13 )
2850 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
;
2852 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
;
2854 if ( !( pVBInfo
->SetFlag
& Win9xDOSMode
) )
2856 if ( ( pVBInfo
->IF_DEF_CH7017
== 0 ) || ( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToLCDA
) ) )
2858 if ( pVBInfo
->IF_DEF_OEMUtil
== 1 )
2861 LCDPtr
= ( XGI330_LCDDataDesStruct
* )XGI_GetLcdPtr( tempbx
, ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
) ;
2864 if ( ( pVBInfo
->IF_DEF_OEMUtil
== 0 ) || ( LCDPtr
== 0 ) )
2867 if ( pVBInfo
->LCDInfo
& EnableScalingLCD
)
2868 LCDPtr1
= ( XGI330_LCDDataDesStruct2
* )XGI_GetLcdPtr( tempbx
, ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
) ;
2870 LCDPtr
= ( XGI330_LCDDataDesStruct
* )XGI_GetLcdPtr( tempbx
, ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
) ;
2873 XGI_GetLCDSync( &tempax
, &tempbx
,pVBInfo
) ;
2878 if ( ( pVBInfo
->LCDResInfo
== Panel1024x768
) || ( pVBInfo
->LCDResInfo
== Panel1024x768x75
) )
2883 else if ( ( pVBInfo
->LCDResInfo
== Panel1280x1024
) || ( pVBInfo
->LCDResInfo
== Panel1280x1024x75
) )
2888 else if ( pVBInfo
->LCDResInfo
== Panel1400x1050
)
2899 if ( pVBInfo
->LCDInfo
& SetLCDtoNonExpanding
)
2901 pVBInfo
->HDE
=tempax
;
2902 pVBInfo
->VDE
=tempbx
;
2903 pVBInfo
->VGAHDE
=tempax
;
2904 pVBInfo
->VGAVDE
=tempbx
;
2907 if ( ( pVBInfo
->IF_DEF_ScaleLCD
== 1 ) && ( pVBInfo
->LCDInfo
& EnableScalingLCD
) )
2909 tempax
=pVBInfo
->HDE
;
2910 tempbx
=pVBInfo
->VDE
;
2913 tempax
= pVBInfo
->HT
;
2915 if ( pVBInfo
->LCDInfo
& EnableScalingLCD
)
2916 tempbx
= LCDPtr1
->LCDHDES
;
2918 tempbx
= LCDPtr
->LCDHDES
;
2920 tempcx
= pVBInfo
->HDE
;
2921 tempbx
= tempbx
& 0x0fff ;
2924 if ( tempcx
>= tempax
)
2927 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x1A , tempbx
& 0x07 ) ;
2929 tempcx
= tempcx
>> 3 ;
2930 tempbx
= tempbx
>> 3 ;
2932 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x16 , ( USHORT
)( tempbx
& 0xff ) ) ;
2933 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x17 , ( USHORT
)( tempcx
& 0xff ) ) ;
2935 tempax
= pVBInfo
->HT
;
2937 if ( pVBInfo
->LCDInfo
& EnableScalingLCD
)
2938 tempbx
= LCDPtr1
->LCDHRS
;
2940 tempbx
= LCDPtr
->LCDHRS
;
2944 if ( pVBInfo
->LCDInfo
& EnableScalingLCD
)
2945 tempcx
= LCDPtr1
->LCDHSync
;
2949 if ( tempcx
>= tempax
)
2952 tempax
= tempbx
& 0x07 ;
2953 tempax
= tempax
>> 5 ;
2954 tempcx
= tempcx
>> 3 ;
2955 tempbx
= tempbx
>> 3 ;
2960 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x15 , tempax
) ;
2961 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x14 , ( USHORT
)( tempbx
& 0xff ) ) ;
2963 tempax
= pVBInfo
->VT
;
2964 if ( pVBInfo
->LCDInfo
& EnableScalingLCD
)
2965 tempbx
= LCDPtr1
->LCDVDES
;
2967 tempbx
= LCDPtr
->LCDVDES
;
2968 tempcx
= pVBInfo
->VDE
;
2970 tempbx
= tempbx
& 0x0fff ;
2972 if ( tempcx
>= tempax
)
2975 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x1b , ( USHORT
)( tempbx
& 0xff ) ) ;
2976 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x1c , ( USHORT
)( tempcx
& 0xff ) ) ;
2978 tempbx
= ( tempbx
>> 8 ) & 0x07 ;
2979 tempcx
= ( tempcx
>> 8 ) & 0x07 ;
2981 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x1d , ( USHORT
)( ( tempcx
<< 3 ) | tempbx
) ) ;
2983 tempax
= pVBInfo
->VT
;
2984 if ( pVBInfo
->LCDInfo
& EnableScalingLCD
)
2985 tempbx
= LCDPtr1
->LCDVRS
;
2987 tempbx
= LCDPtr
->LCDVRS
;
2989 /* tempbx = tempbx >> 4 ; */
2992 if ( pVBInfo
->LCDInfo
& EnableScalingLCD
)
2993 tempcx
= LCDPtr1
->LCDVSync
;
2996 if ( tempcx
>= tempax
)
2999 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x18 , ( USHORT
)( tempbx
& 0xff ) ) ;
3000 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x19 , ~0x0f , ( USHORT
)( tempcx
& 0x0f ) ) ;
3002 tempax
= ( ( tempbx
>> 8 ) & 0x07 ) << 3 ;
3004 tempbx
= pVBInfo
->VGAVDE
;
3005 if ( tempbx
!= pVBInfo
->VDE
)
3008 if ( pVBInfo
->LCDInfo
& EnableLVDSDDA
)
3011 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x1a , 0x07 , tempax
) ;
3013 tempcx
= pVBInfo
->VGAVT
;
3014 tempbx
= pVBInfo
->VDE
;
3015 tempax
= pVBInfo
->VGAVDE
;
3018 temp
= tempax
; /* 0430 ylshieh */
3019 temp1
= ( temp
<< 18 ) / tempbx
;
3021 tempdx
= ( USHORT
)( ( temp
<< 18 ) % tempbx
) ;
3029 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x37 , ( USHORT
)( temp2
& 0xff ) ) ;
3030 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x36 , ( USHORT
)( ( temp2
>> 8 ) & 0xff ) ) ;
3032 tempbx
= ( USHORT
)( temp2
>> 16 ) ;
3033 tempax
= tempbx
& 0x03 ;
3035 tempbx
= pVBInfo
->VGAVDE
;
3036 if ( tempbx
== pVBInfo
->VDE
)
3039 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x35 , tempax
) ;
3041 if ( pVBInfo
->VBType
& VB_XGI301C
)
3044 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x3c , ( USHORT
)( temp2
& 0xff ) ) ;
3045 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x3b , ( USHORT
)( ( temp2
>> 8 ) & 0xff ) ) ;
3046 tempbx
= ( USHORT
)( temp2
>> 16 ) ;
3047 XGINew_SetRegANDOR( pVBInfo
->Part4Port
, 0x3a , ~0xc0 , ( USHORT
)( ( tempbx
& 0xff ) << 6 ) ) ;
3049 tempcx
= pVBInfo
->VGAVDE
;
3050 if ( tempcx
== pVBInfo
->VDE
)
3051 XGINew_SetRegANDOR( pVBInfo
->Part4Port
, 0x30 , ~0x0c , 0x00 ) ;
3053 XGINew_SetRegANDOR( pVBInfo
->Part4Port
, 0x30 , ~0x0c , 0x08 ) ;
3056 tempcx
= pVBInfo
->VGAHDE
;
3057 tempbx
= pVBInfo
->HDE
;
3059 temp1
= tempcx
<< 16 ;
3061 tempax
= ( USHORT
)( temp1
/ tempbx
) ;
3063 if ( ( tempbx
& 0xffff ) == ( tempcx
& 0xffff ) )
3067 temp1
= pVBInfo
->VGAHDE
<< 16 ;
3070 temp3
= temp3
<< 16 ;
3073 temp3
= ( temp3
& 0xffff0000 ) + ( temp1
& 0xffff ) ;
3075 tempax
= ( USHORT
)( temp3
& 0xff ) ;
3076 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x1f , tempax
) ;
3078 temp1
= pVBInfo
->VGAVDE
<< 18 ;
3079 temp1
= temp1
/ push3
;
3080 tempbx
= ( USHORT
)( temp1
& 0xffff ) ;
3082 if ( pVBInfo
->LCDResInfo
== Panel1024x768
)
3085 tempax
= ( ( tempbx
>> 8 ) & 0xff ) << 3 ;
3086 tempax
|= ( USHORT
)( ( temp3
>> 8 ) & 0x07 ) ;
3087 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x20 , ( USHORT
)( tempax
& 0xff ) ) ;
3088 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x21 , ( USHORT
)( tempbx
& 0xff ) ) ;
3090 temp3
= temp3
>> 16 ;
3092 if ( modeflag
& HalfDCLK
)
3093 temp3
= temp3
>> 1 ;
3095 XGINew_SetReg1(pVBInfo
->Part1Port
, 0x22 , ( USHORT
)( ( temp3
>> 8 ) & 0xff ) ) ;
3096 XGINew_SetReg1(pVBInfo
->Part1Port
, 0x23 , ( USHORT
)( temp3
& 0xff ) ) ;
3102 /* --------------------------------------------------------------------- */
3103 /* Function : XGI_SetCRT2ECLK */
3107 /* --------------------------------------------------------------------- */
3108 void XGI_SetCRT2ECLK( USHORT ModeNo
, USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
)
3110 UCHAR di_0
, di_1
, tempal
;
3113 tempal
= XGI_GetVCLKPtr( RefreshRateTableIndex
, ModeNo
, ModeIdIndex
, pVBInfo
) ;
3114 XGI_GetVCLKLen( tempal
, &di_0
, &di_1
, pVBInfo
) ;
3115 XGI_GetLCDVCLKPtr( &di_0
, &di_1
, pVBInfo
) ;
3117 for( i
= 0 ; i
< 4 ; i
++ )
3119 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x31 , ~0x30 , ( USHORT
)( 0x10 * i
) ) ;
3120 if ( pVBInfo
->IF_DEF_CH7007
== 1 )
3122 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2b , di_0
) ;
3123 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2c , di_1
) ;
3125 else if ( ( !( pVBInfo
->VBInfo
& SetCRT2ToLCDA
) ) && ( !( pVBInfo
->VBInfo
& SetInSlaveMode
) ) )
3127 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2e , di_0
) ;
3128 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2f , di_1
) ;
3132 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2b , di_0
) ;
3133 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2c , di_1
) ;
3139 /* --------------------------------------------------------------------- */
3140 /* Function : XGI_UpdateModeInfo */
3144 /* --------------------------------------------------------------------- */
3145 void XGI_UpdateModeInfo( PXGI_HW_DEVICE_INFO HwDeviceExtension
,PVB_DEVICE_INFO pVBInfo
)
3153 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
3157 temp
= XGINew_GetReg1( pVBInfo
->P3c4
, 0x01 ) ;
3159 if ( !( temp
& 0x20 ) )
3161 temp
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x17 ) ;
3164 if ( ( HwDeviceExtension
->jChipType
>= XG20
) || ( HwDeviceExtension
->jChipType
>= XG40
) )
3165 temp
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x53 ) ;
3167 temp
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x63 ) ;
3169 if ( !( temp
& 0x40 ) )
3170 tempcl
|= ActiveCRT1
;
3174 temp
= XGINew_GetReg1( pVBInfo
->Part1Port
, 0x2e ) ;
3177 if ( !( temp
== 0x08 ) )
3179 tempax
= XGINew_GetReg1( pVBInfo
->Part1Port
, 0x13 ) ; /* Check ChannelA by Part1_13 [2003/10/03] */
3180 if ( tempax
& 0x04 )
3181 tempcl
= tempcl
| ActiveLCD
;
3185 if ( !( tempcl
& ActiveLCD
) )
3187 tempcl
|= ActiveCRT2
;
3190 tempcl
|= ActiveLCD
;
3194 temp
= XGINew_GetReg1( pVBInfo
->Part2Port
, 0x00 ) ;
3196 if( !( temp
& 0x08 ) )
3197 tempch
|= ActiveAVideo
;
3199 if ( !( temp
& 0x04 ) )
3200 tempch
|= ActiveSVideo
;
3203 tempch
|= ActiveSCART
;
3205 if ( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
)
3208 tempch
|= ActiveHiTV
;
3211 if ( pVBInfo
->VBInfo
& SetCRT2ToYPbPr
)
3213 temp
= XGINew_GetReg1( pVBInfo
->Part2Port
, 0x4d ) ;
3216 tempch
|= ActiveYPbPr
;
3220 tempcl
|= ActiveTV
;
3224 temp
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x3d ) ;
3225 if ( tempcl
& ActiveLCD
)
3227 if ( ( pVBInfo
->SetFlag
& ReserveTVOption
) )
3229 if ( temp
& ActiveTV
)
3230 tempcl
|= ActiveTV
;
3234 tempbl
= ~ModeSwitchStatus
;
3235 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x3d , tempbl
, temp
) ;
3237 if ( !( pVBInfo
->SetFlag
& ReserveTVOption
) )
3238 XGINew_SetReg1( pVBInfo
->P3d4
, 0x3e , tempch
) ;
3247 /* --------------------------------------------------------------------- */
3248 /* Function : XGI_GetVGAType */
3252 /* --------------------------------------------------------------------- */
3253 void XGI_GetVGAType( PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
)
3256 if ( HwDeviceExtension->jChipType >= XG20 )
3258 pVBInfo->Set_VGAType = XG20;
3260 else if ( HwDeviceExtension->jChipType >= XG40 )
3262 pVBInfo->Set_VGAType = VGA_XGI340 ;
3265 pVBInfo
->Set_VGAType
= HwDeviceExtension
->jChipType
;
3269 /* --------------------------------------------------------------------- */
3270 /* Function : XGI_GetVBType */
3274 /* --------------------------------------------------------------------- */
3275 void XGI_GetVBType(PVB_DEVICE_INFO pVBInfo
)
3277 USHORT flag
, tempbx
, tempah
;
3279 if ( pVBInfo
->IF_DEF_CH7007
== 1 )
3281 pVBInfo
->VBType
= VB_CH7007
;
3284 if ( pVBInfo
->IF_DEF_LVDS
== 0 )
3286 tempbx
= VB_XGI302B
;
3287 flag
= XGINew_GetReg1( pVBInfo
->Part4Port
, 0x00 ) ;
3290 tempbx
= VB_XGI301
;
3291 flag
= XGINew_GetReg1( pVBInfo
->Part4Port
, 0x01 ) ;
3294 tempbx
= VB_XGI301B
;
3297 tempbx
= VB_XGI301C
;
3300 tempbx
= VB_XGI301LV
;
3303 tempbx
= VB_XGI302LV
;
3304 tempah
= XGINew_GetReg1( pVBInfo
->Part4Port
, 0x39 ) ;
3305 if ( tempah
!= 0xFF )
3306 tempbx
= VB_XGI301C
;
3311 if ( tempbx
& ( VB_XGI301B
| VB_XGI302B
) )
3313 flag
= XGINew_GetReg1( pVBInfo
->Part4Port
, 0x23 ) ;
3315 if ( !( flag
& 0x02 ) )
3316 tempbx
= tempbx
| VB_NoLCD
;
3320 pVBInfo
->VBType
= tempbx
;
3323 else if ( pVBInfo->IF_DEF_CH7017 == 1 )
3324 pVBInfo->VBType = VB_CH7017 ;
3326 pVBInfo->VBType = VB_LVDS_NS ;
3332 /* --------------------------------------------------------------------- */
3333 /* Function : XGI_GetVBInfo */
3337 /* --------------------------------------------------------------------- */
3338 void XGI_GetVBInfo( USHORT ModeNo
, USHORT ModeIdIndex
, PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
)
3346 if ( ModeNo
<= 0x13 )
3348 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
;
3352 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
;
3355 pVBInfo
->SetFlag
= 0 ;
3356 pVBInfo
->ModeType
= modeflag
& ModeInfoFlag
;
3359 if ( pVBInfo
->VBType
& 0xFFFF )
3361 temp
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x30 ) ; /* Check Display Device */
3362 tempbx
= tempbx
| temp
;
3363 temp
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x31 ) ;
3366 tempax
= temp
<< 8 ;
3367 tempbx
= tempbx
| tempax
;
3368 temp
= ( SetCRT2ToDualEdge
| SetCRT2ToYPbPr
| SetCRT2ToLCDA
| SetInSlaveMode
| DisableCRT2Display
) ;
3369 temp
= 0xFFFF ^ temp
;
3372 temp
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x38 ) ;
3374 if ( pVBInfo
->IF_DEF_LCDA
== 1 )
3377 if ( ( pVBInfo
->Set_VGAType
>= XG20
) || ( pVBInfo
->Set_VGAType
>= XG40
))
3379 if ( pVBInfo
->IF_DEF_LVDS
== 0 )
3381 /* if ( ( pVBInfo->VBType & VB_XGI302B ) || ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) ) */
3382 if ( pVBInfo
->VBType
& ( VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
3384 if ( temp
& EnableDualEdge
)
3386 tempbx
|= SetCRT2ToDualEdge
;
3388 if ( temp
& SetToLCDA
)
3389 tempbx
|= SetCRT2ToLCDA
;
3393 else if ( pVBInfo
->IF_DEF_CH7017
== 1 )
3395 if ( pVBInfo
->VBType
& VB_CH7017
)
3397 if ( temp
& EnableDualEdge
)
3399 tempbx
|= SetCRT2ToDualEdge
;
3401 if ( temp
& SetToLCDA
)
3402 tempbx
|= SetCRT2ToLCDA
;
3409 if ( pVBInfo
->IF_DEF_YPbPr
== 1 )
3411 if ( ( ( pVBInfo
->IF_DEF_LVDS
== 0 ) && ( ( pVBInfo
->VBType
& VB_XGI301LV
) || ( pVBInfo
->VBType
& VB_XGI302LV
) || ( pVBInfo
->VBType
& VB_XGI301C
) ) )
3412 || ( ( pVBInfo
->IF_DEF_CH7017
== 1 ) && ( pVBInfo
->VBType
&VB_CH7017
) ) || ( (pVBInfo
->IF_DEF_CH7007
== 1) && (pVBInfo
->VBType
&VB_CH7007
) ) ) /* [Billy] 07/05/04 */
3414 if ( temp
& SetYPbPr
) /* temp = CR38 */
3416 if ( pVBInfo
->IF_DEF_HiVision
== 1 )
3418 temp
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x35 ) ; /* shampoo add for new scratch */
3420 tempbx
|= SetCRT2ToHiVisionTV
;
3422 if ( temp
!= YPbPrMode1080i
) {
3423 tempbx
&= ( ~SetCRT2ToHiVisionTV
) ;
3424 tempbx
|= SetCRT2ToYPbPr
; }
3427 /* tempbx |= SetCRT2ToYPbPr ; */
3432 tempax
= push
; /* restore CR31 */
3434 if ( pVBInfo
->IF_DEF_LVDS
== 0 )
3436 if ( pVBInfo
->IF_DEF_YPbPr
== 1 )
3438 if ( pVBInfo
->IF_DEF_HiVision
== 1 )
3445 if ( pVBInfo
->IF_DEF_HiVision
== 1 )
3451 else /* 3nd party chip */
3453 if ( pVBInfo
->IF_DEF_CH7017
== 1 )
3454 temp
= ( SetCRT2ToTV
| SetCRT2ToLCD
| SetCRT2ToLCDA
) ;
3455 else if ( pVBInfo
->IF_DEF_CH7007
== 1 ) /* [Billy] 07/05/03 */
3457 temp
= SetCRT2ToTV
;
3460 temp
= SetCRT2ToLCD
;
3463 if ( !( tempbx
& temp
) )
3465 tempax
|= DisableCRT2Display
;
3469 if ( pVBInfo
->IF_DEF_LCDA
== 1 ) /* Select Display Device */
3471 if ( !( pVBInfo
->VBType
& VB_NoLCD
) )
3473 if ( tempbx
& SetCRT2ToLCDA
)
3475 if ( tempbx
& SetSimuScanMode
)
3476 tempbx
&= ( ~( SetCRT2ToLCD
| SetCRT2ToRAMDAC
| SwitchToCRT2
) ) ;
3478 tempbx
&= ( ~( SetCRT2ToLCD
| SetCRT2ToRAMDAC
| SetCRT2ToTV
| SwitchToCRT2
) ) ;
3484 if ( !( tempbx
& ( SwitchToCRT2
| SetSimuScanMode
) ) ) /* for driver abnormal */
3486 if ( pVBInfo
->IF_DEF_CRT2Monitor
== 1 )
3488 if ( tempbx
& SetCRT2ToRAMDAC
)
3490 tempbx
&= ( 0xFF00 | SetCRT2ToRAMDAC
| SwitchToCRT2
| SetSimuScanMode
) ;
3491 tempbx
&= ( 0x00FF | ( ~SetCRT2ToYPbPr
) ) ;
3495 tempbx
&= ( ~( SetCRT2ToRAMDAC
| SetCRT2ToLCD
| SetCRT2ToTV
) ) ;
3498 if ( !( pVBInfo
->VBType
& VB_NoLCD
) )
3500 if ( tempbx
& SetCRT2ToLCD
)
3502 tempbx
&= ( 0xFF00 | SetCRT2ToLCD
| SwitchToCRT2
| SetSimuScanMode
) ;
3503 tempbx
&= ( 0x00FF | ( ~SetCRT2ToYPbPr
) ) ;
3507 if ( tempbx
& SetCRT2ToSCART
)
3509 tempbx
&= ( 0xFF00 | SetCRT2ToSCART
| SwitchToCRT2
| SetSimuScanMode
) ;
3510 tempbx
&= ( 0x00FF | ( ~SetCRT2ToYPbPr
) ) ;
3513 if ( pVBInfo
->IF_DEF_YPbPr
== 1 )
3515 if ( tempbx
& SetCRT2ToYPbPr
)
3516 tempbx
&= ( 0xFF00 | SwitchToCRT2
| SetSimuScanMode
) ;
3519 if ( pVBInfo
->IF_DEF_HiVision
== 1 )
3521 if ( tempbx
& SetCRT2ToHiVisionTV
)
3522 tempbx
&= ( 0xFF00 | SetCRT2ToHiVisionTV
| SwitchToCRT2
| SetSimuScanMode
) ;
3525 if ( tempax
& DisableCRT2Display
) /* Set Display Device Info */
3527 if ( !( tempbx
& ( SwitchToCRT2
| SetSimuScanMode
) ) )
3528 tempbx
= DisableCRT2Display
;
3531 if ( !( tempbx
& DisableCRT2Display
) )
3533 if ( ( !( tempbx
& DriverMode
) ) || ( !( modeflag
& CRT2Mode
) ) )
3535 if ( pVBInfo
->IF_DEF_LCDA
== 1 )
3537 if ( !( tempbx
& SetCRT2ToLCDA
) )
3538 tempbx
|= ( SetInSlaveMode
| SetSimuScanMode
) ;
3541 if ( pVBInfo
->IF_DEF_VideoCapture
== 1 )
3543 if ( ( ( HwDeviceExtension
->jChipType
== XG40
) && ( pVBInfo
->Set_VGAType
== XG40
) )
3544 || ( ( HwDeviceExtension
->jChipType
== XG41
) && ( pVBInfo
->Set_VGAType
== XG41
) )
3545 || ( ( HwDeviceExtension
->jChipType
== XG42
) && ( pVBInfo
->Set_VGAType
== XG42
) )
3546 || ( ( HwDeviceExtension
->jChipType
== XG45
) && ( pVBInfo
->Set_VGAType
== XG45
) ) )
3550 if ( !( tempbx
& SetCRT2ToRAMDAC
) ) /*CRT2 not need to support*/
3552 tempbx
&= ( 0x00FF | ( ~SetInSlaveMode
) ) ;
3553 pVBInfo
->SetFlag
|= EnableVCMode
;
3560 /*LCD+TV can't support in slave mode (Force LCDA+TV->LCDB)*/
3561 if ( ( tempbx
& SetInSlaveMode
) && ( tempbx
& SetCRT2ToLCDA
) )
3563 tempbx
^= ( SetCRT2ToLCD
| SetCRT2ToLCDA
| SetCRT2ToDualEdge
) ;
3564 pVBInfo
->SetFlag
|= ReserveTVOption
;
3569 pVBInfo
->VBInfo
= tempbx
;
3573 /* --------------------------------------------------------------------- */
3574 /* Function : XGI_GetTVInfo */
3578 /* --------------------------------------------------------------------- */
3579 void XGI_GetTVInfo( USHORT ModeNo
, USHORT ModeIdIndex
,PVB_DEVICE_INFO pVBInfo
)
3590 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
3592 if ( ModeNo
<= 0x13 )
3594 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
; /* si+St_ModeFlag */
3595 resinfo
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ResInfo
; /* si+St_ResInfo */
3599 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
;
3600 resinfo
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_RESINFO
; /* si+Ext_ResInfo */
3603 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
3605 temp
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x35 ) ;
3607 if ( tempbx
& SetPALTV
)
3609 tempbx
&= ( SetCHTVOverScan
| SetPALMTV
| SetPALNTV
| SetPALTV
) ;
3610 if ( tempbx
& SetPALMTV
)
3611 tempbx
&= ~SetPALTV
; /* set to NTSC if PAL-M */
3614 tempbx
&= ( SetCHTVOverScan
| SetNTSCJ
| SetPALTV
) ;
3616 if ( pVBInfo->IF_DEF_LVDS == 0 )
3618 index1 = XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) ; //PAL-M/PAL-N Info
3619 temp2 = ( index1 & 0xC0 ) >> 5 ; //00:PAL, 01:PAL-M, 10:PAL-N
3621 if ( temp2 & 0x02 ) //PAL-M
3622 tempbx &= ( ~SetPALTV ) ;
3627 if ( pVBInfo
->IF_DEF_CH7017
== 1 )
3629 tempbx
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x35 ) ;
3631 if ( tempbx
& TVOverScan
)
3632 tempbx
|= SetCHTVOverScan
;
3635 if ( pVBInfo
->IF_DEF_CH7007
== 1 ) /* [Billy] 07/05/04 */
3637 tempbx
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x35 ) ;
3639 if ( tempbx
& TVOverScan
)
3641 tempbx
|= SetCHTVOverScan
;
3646 if ( pVBInfo
->IF_DEF_LVDS
== 0 )
3648 if ( pVBInfo
->VBInfo
& SetCRT2ToSCART
)
3649 tempbx
|= SetPALTV
;
3652 if ( pVBInfo
->IF_DEF_YPbPr
== 1 )
3654 if ( pVBInfo
->VBInfo
& SetCRT2ToYPbPr
)
3656 index1
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x35 ) ;
3657 index1
&= YPbPrMode
;
3659 if ( index1
== YPbPrMode525i
)
3660 tempbx
|= SetYPbPrMode525i
;
3662 if ( index1
== YPbPrMode525p
)
3663 tempbx
= tempbx
| SetYPbPrMode525p
;
3664 if ( index1
== YPbPrMode750p
)
3665 tempbx
= tempbx
| SetYPbPrMode750p
;
3669 if ( pVBInfo
->IF_DEF_HiVision
== 1 )
3671 if ( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
)
3673 tempbx
= tempbx
| SetYPbPrMode1080i
| SetPALTV
;
3677 if ( pVBInfo
->IF_DEF_LVDS
== 0 )
3679 if ( ( pVBInfo
->VBInfo
& SetInSlaveMode
) && ( !( pVBInfo
->VBInfo
& SetNotSimuMode
) ) )
3680 tempbx
|= TVSimuMode
;
3682 if ( !( tempbx
& SetPALTV
) && ( modeflag
> 13 ) && ( resinfo
== 8 ) ) /* NTSC 1024x768, */
3683 tempbx
|= NTSC1024x768
;
3685 tempbx
|= RPLLDIV2XO
;
3687 if ( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
)
3689 if ( pVBInfo
->VBInfo
& SetInSlaveMode
)
3690 tempbx
&=( ~RPLLDIV2XO
) ;
3694 if ( tempbx
& ( SetYPbPrMode525p
| SetYPbPrMode750p
) )
3695 tempbx
&= ( ~RPLLDIV2XO
) ;
3696 else if ( !( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) ) )
3698 if ( tempbx
& TVSimuMode
)
3699 tempbx
&= ( ~RPLLDIV2XO
) ;
3704 pVBInfo
->TVInfo
= tempbx
;
3708 /* --------------------------------------------------------------------- */
3709 /* Function : XGI_GetLCDInfo */
3713 /* --------------------------------------------------------------------- */
3714 BOOLEAN
XGI_GetLCDInfo( USHORT ModeNo
, USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
)
3723 pVBInfo
->LCDResInfo
= 0 ;
3724 pVBInfo
->LCDTypeInfo
= 0 ;
3725 pVBInfo
->LCDInfo
= 0 ;
3727 if ( ModeNo
<= 0x13 )
3729 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
; /* si+St_ModeFlag // */
3733 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
;
3734 resinfo
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_RESINFO
; /* si+Ext_ResInfo// */
3737 temp
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x36 ) ; /* Get LCD Res.Info */
3738 tempbx
= temp
& 0x0F ;
3741 tempbx
= Panel1024x768
; /* default */
3743 /* LCD75 [2003/8/22] Vicent */
3744 if ( ( tempbx
== Panel1024x768
) || ( tempbx
== Panel1280x1024
) )
3746 if ( pVBInfo
->VBInfo
& DriverMode
)
3748 tempax
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x33 ) ;
3749 if ( pVBInfo
->VBInfo
& SetCRT2ToLCDA
)
3752 tempax
= tempax
>> 4 ;
3754 if ( ( resinfo
== 6 ) || ( resinfo
== 9 ) )
3757 tempbx
|= PanelRef75Hz
;
3759 else if ( ( resinfo
== 7 ) || ( resinfo
== 8 ) )
3762 tempbx
|= PanelRef75Hz
;
3767 pVBInfo
->LCDResInfo
= tempbx
;
3771 if( pVBInfo
->IF_DEF_OEMUtil
== 1 )
3773 pVBInfo
->LCDTypeInfo
= ( temp
& 0xf0 ) >> 4 ;
3776 if ( !( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToLCDA
) ) )
3783 temp
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x37 ) ;
3785 temp
&= ( ScalingLCD
| LCDNonExpanding
| LCDSyncBit
| SetPWDEnable
) ;
3787 if ( ( pVBInfo
->IF_DEF_ScaleLCD
== 1 ) && ( temp
& LCDNonExpanding
) )
3788 temp
&= ~EnableScalingLCD
;
3792 LCDIdIndex
= XGI_GetLCDCapPtr1(pVBInfo
) ;
3794 tempax
= pVBInfo
->LCDCapList
[ LCDIdIndex
].LCD_Capability
;
3796 if ( pVBInfo
->IF_DEF_LVDS
== 0 ) /* shampoo */
3798 if ( ( ( pVBInfo
->VBType
& VB_XGI302LV
) || ( pVBInfo
->VBType
& VB_XGI301C
) ) && ( tempax
& LCDDualLink
) )
3800 tempbx
|= SetLCDDualLink
;
3804 if ( pVBInfo
->IF_DEF_CH7017
== 1 )
3806 if ( tempax
& LCDDualLink
)
3808 tempbx
|= SetLCDDualLink
;
3812 if ( pVBInfo
->IF_DEF_LVDS
== 0 )
3814 if ( ( pVBInfo
->LCDResInfo
== Panel1400x1050
) && ( pVBInfo
->VBInfo
& SetCRT2ToLCD
) && ( ModeNo
> 0x13 ) && ( resinfo
== 9 ) && ( !( tempbx
& EnableScalingLCD
) ) )
3815 tempbx
|= SetLCDtoNonExpanding
; /* set to center in 1280x1024 LCDB for Panel1400x1050 */
3819 if ( tempax & LCDBToA )
3821 tempbx |= SetLCDBToA ;
3825 if ( pVBInfo
->IF_DEF_ExpLink
== 1 )
3827 if ( modeflag
& HalfDCLK
)
3829 /* if ( !( pVBInfo->LCDInfo&LCDNonExpanding ) ) */
3830 if ( !( tempbx
& SetLCDtoNonExpanding
) )
3832 tempbx
|= EnableLVDSDDA
;
3836 if ( ModeNo
> 0x13 )
3838 if ( pVBInfo
->LCDResInfo
== Panel1024x768
)
3842 tempbx
|= EnableLVDSDDA
;
3850 if ( pVBInfo
->VBInfo
& SetInSlaveMode
)
3852 if ( pVBInfo
->VBInfo
& SetNotSimuMode
)
3854 tempbx
|= LCDVESATiming
;
3859 tempbx
|= LCDVESATiming
;
3862 pVBInfo
->LCDInfo
= tempbx
;
3864 if ( pVBInfo
->IF_DEF_PWD
== 1 )
3866 if ( pVBInfo
->LCDInfo
& SetPWDEnable
)
3868 if ( ( pVBInfo
->VBType
& VB_XGI302LV
) || ( pVBInfo
->VBType
& VB_XGI301C
) )
3870 if ( !( tempax
& PWDEnable
) )
3872 pVBInfo
->LCDInfo
&= ~SetPWDEnable
;
3878 if ( pVBInfo
->IF_DEF_LVDS
== 0 )
3880 if ( tempax
& ( LockLCDBToA
| StLCDBToA
) )
3882 if ( pVBInfo
->VBInfo
& SetInSlaveMode
)
3884 if ( !( tempax
& LockLCDBToA
) )
3886 if ( ModeNo
<= 0x13 )
3888 pVBInfo
->VBInfo
&= ~( SetSimuScanMode
| SetInSlaveMode
| SetCRT2ToLCD
) ;
3889 pVBInfo
->VBInfo
|= SetCRT2ToLCDA
| SetCRT2ToDualEdge
;
3897 if ( pVBInfo->IF_DEF_LVDS == 0 )
3899 if ( tempax & ( LockLCDBToA | StLCDBToA ) )
3901 if ( pVBInfo->VBInfo & SetInSlaveMode )
3903 if ( !( ( !( tempax & LockLCDBToA ) ) && ( ModeNo > 0x13 ) ) )
3905 pVBInfo->VBInfo&=~(SetSimuScanMode|SetInSlaveMode|SetCRT2ToLCD);
3906 pVBInfo->VBInfo|=SetCRT2ToLCDA|SetCRT2ToDualEdge;
3917 /* --------------------------------------------------------------------- */
3918 /* Function : XGI_SearchModeID */
3922 /* --------------------------------------------------------------------- */
3923 BOOLEAN
XGI_SearchModeID( USHORT ModeNo
, USHORT
*ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
)
3928 #ifdef LINUX /* chiawen for linux solution */
3932 if ( ModeNo
<= 0x13 )
3934 /* for (*ModeIdIndex=0;*ModeIdIndex<sizeof(pVBInfo->SModeIDTable)/sizeof(XGI_StStruct);(*ModeIdIndex)++) */
3935 for( *ModeIdIndex
= 0 ; ; ( *ModeIdIndex
)++ )
3937 if (pVBInfo
->SModeIDTable
[*ModeIdIndex
].St_ModeID
== ModeNo
)
3939 if (pVBInfo
->SModeIDTable
[*ModeIdIndex
].St_ModeID
== 0xFF)
3943 if ( ModeNo
== 0x07 )
3944 ( *ModeIdIndex
)++ ; /* 400 lines */
3947 ( *ModeIdIndex
) += 2 ; /* 400 lines */
3948 /* else 350 lines */
3952 /* for (*ModeIdIndex=0;*ModeIdIndex<sizeof(pVBInfo->EModeIDTable)/sizeof(XGI_ExtStruct);(*ModeIdIndex)++) */
3953 for( *ModeIdIndex
= 0 ; ; ( *ModeIdIndex
)++ )
3955 if (pVBInfo
->EModeIDTable
[*ModeIdIndex
].Ext_ModeID
== ModeNo
)
3957 if (pVBInfo
->EModeIDTable
[*ModeIdIndex
].Ext_ModeID
== 0xFF)
3970 /* win2000 MM adapter not support standard mode! */
3972 /* --------------------------------------------------------------------- */
3977 /* --------------------------------------------------------------------- */
3978 BOOLEAN
XGINew_CheckMemorySize(PXGI_HW_DEVICE_INFO HwDeviceExtension
,USHORT ModeNo
,USHORT ModeIdIndex
,PVB_DEVICE_INFO pVBInfo
)
3986 /* if ( ( HwDeviceExtension->jChipType == XGI_650 ) ||
3987 ( HwDeviceExtension->jChipType == XGI_650M ) )
3992 if ( ModeNo
<= 0x13 )
3994 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
;
3997 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
;
4000 /* ModeType = modeflag&ModeInfoFlag ; // Get mode type */
4002 memorysize
= modeflag
& MemoryInfoFlag
;
4003 memorysize
= memorysize
> MemorySizeShift
;
4004 memorysize
++ ; /* Get memory size */
4006 temp
= XGINew_GetReg1( pVBInfo
->P3c4
, 0x14 ) ; /* Get DRAM Size */
4009 if ( HwDeviceExtension
->jChipType
== XG40
)
4011 temp
= 1 << ( ( temp
& 0x0F0 ) >> 4 ) ; /* memory size per channel SR14[7:4] */
4012 if ( ( tmp
& 0x0c ) == 0x0C ) /* Qual channels */
4016 else if ( ( tmp
& 0x0c ) == 0x08 ) /* Dual channels */
4021 else if ( HwDeviceExtension
->jChipType
== XG42
)
4023 temp
= 1 << ( ( temp
& 0x0F0 ) >> 4 ) ; /* memory size per channel SR14[7:4] */
4024 if ( ( tmp
& 0x04 ) == 0x04 ) /* Dual channels */
4029 else if ( HwDeviceExtension
->jChipType
== XG45
)
4031 temp
= 1 << ( ( temp
& 0x0F0 ) >> 4 ) ; /* memory size per channel SR14[7:4] */
4032 if ( ( tmp
& 0x0c ) == 0x0C ) /* Qual channels */
4036 else if ( ( tmp
& 0x0c ) == 0x08 ) /* triple channels */
4042 else if ( ( tmp
& 0x0c ) == 0x04 ) /* Dual channels */
4047 if (temp
< memorysize
)
4054 /* --------------------------------------------------------------------- */
4055 /* Function : XGINew_IsLowResolution */
4059 /* --------------------------------------------------------------------- */
4060 /*void XGINew_IsLowResolution( USHORT ModeNo , USHORT ModeIdIndex, BOOLEAN XGINew_CheckMemorySize(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo)
4065 data = XGINew_GetReg1( pVBInfo->P3c4 , 0x0F ) ;
4067 XGINew_SetReg1( pVBInfo->P3c4 , 0x0F , data ) ;
4069 if ( ModeNo > 0x13 )
4071 ModeFlag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ;
4072 if ( ( ModeFlag & HalfDCLK ) && ( ModeFlag & DoubleScanMode ) )
4074 data = XGINew_GetReg1( pVBInfo->P3c4 , 0x0F ) ;
4076 XGINew_SetReg1( pVBInfo->P3c4 , 0x0F , data ) ;
4077 data = XGINew_GetReg1( pVBInfo->P3c4 , 0x01 ) ;
4079 XGINew_SetReg1( pVBInfo->P3c4 , 0x01 , data ) ;
4086 /* --------------------------------------------------------------------- */
4087 /* Function : XGI_DisplayOn */
4091 /* --------------------------------------------------------------------- */
4092 void XGI_DisplayOn( PXGI_HW_DEVICE_INFO pXGIHWDE
, PVB_DEVICE_INFO pVBInfo
)
4095 XGINew_SetRegANDOR(pVBInfo
->P3c4
,0x01,0xDF,0x00);
4096 if ( pXGIHWDE
->jChipType
== XG21
)
4098 if ( pVBInfo
->IF_DEF_LVDS
== 1 )
4100 if (!(XGI_XG21GetPSCValue( pVBInfo
)&0x1))
4102 XGI_XG21BLSignalVDD( 0x01 , 0x01, pVBInfo
) ; /* LVDS VDD on */
4103 XGI_XG21SetPanelDelay( 2,pVBInfo
) ;
4105 if (!(XGI_XG21GetPSCValue( pVBInfo
)&0x20))
4107 XGI_XG21BLSignalVDD( 0x20 , 0x20, pVBInfo
) ; /* LVDS signal on */
4109 XGI_XG21SetPanelDelay( 3,pVBInfo
) ;
4110 XGI_XG21BLSignalVDD( 0x02 , 0x02, pVBInfo
) ; /* LVDS backlight on */
4114 XGI_XG21BLSignalVDD( 0x20 , 0x20, pVBInfo
) ; /* DVO/DVI signal on */
4119 if (pVBInfo
->IF_DEF_CH7007
== 1) /* [Billy] 07/05/23 For CH7007 */
4125 if ( pXGIHWDE
->jChipType
== XG27
)
4127 if ( pVBInfo
->IF_DEF_LVDS
== 1 )
4129 if (!(XGI_XG27GetPSCValue( pVBInfo
)&0x1))
4131 XGI_XG27BLSignalVDD( 0x01 , 0x01, pVBInfo
) ; /* LVDS VDD on */
4132 XGI_XG21SetPanelDelay( 2,pVBInfo
) ;
4134 if (!(XGI_XG27GetPSCValue( pVBInfo
)&0x20))
4136 XGI_XG27BLSignalVDD( 0x20 , 0x20, pVBInfo
) ; /* LVDS signal on */
4138 XGI_XG21SetPanelDelay( 3,pVBInfo
) ;
4139 XGI_XG27BLSignalVDD( 0x02 , 0x02, pVBInfo
) ; /* LVDS backlight on */
4143 XGI_XG27BLSignalVDD( 0x20 , 0x20, pVBInfo
) ; /* DVO/DVI signal on */
4150 /* --------------------------------------------------------------------- */
4151 /* Function : XGI_DisplayOff */
4155 /* --------------------------------------------------------------------- */
4156 void XGI_DisplayOff( PXGI_HW_DEVICE_INFO pXGIHWDE
, PVB_DEVICE_INFO pVBInfo
)
4159 if ( pXGIHWDE
->jChipType
== XG21
)
4161 if ( pVBInfo
->IF_DEF_LVDS
== 1 )
4163 XGI_XG21BLSignalVDD( 0x02 , 0x00, pVBInfo
) ; /* LVDS backlight off */
4164 XGI_XG21SetPanelDelay( 3,pVBInfo
) ;
4168 XGI_XG21BLSignalVDD( 0x20 , 0x00, pVBInfo
) ; /* DVO/DVI signal off */
4172 if (pVBInfo
->IF_DEF_CH7007
== 1) /*[Billy] 07/05/23 For CH7007 */
4174 /* if( IsCH7007TVMode( pVBInfo ) == 0 ) */
4180 if ( pXGIHWDE
->jChipType
== XG27
)
4182 if ((XGI_XG27GetPSCValue( pVBInfo
)&0x2))
4184 XGI_XG27BLSignalVDD( 0x02 , 0x00, pVBInfo
) ; /* LVDS backlight off */
4185 XGI_XG21SetPanelDelay( 3,pVBInfo
) ;
4188 if ( pVBInfo
->IF_DEF_LVDS
== 0 )
4190 XGI_XG27BLSignalVDD( 0x20 , 0x00, pVBInfo
) ; /* DVO/DVI signal off */
4194 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x01 , 0xDF , 0x20 ) ;
4198 /* --------------------------------------------------------------------- */
4199 /* Function : XGI_WaitDisply */
4202 /* Description : chiawen for sensecrt1 */
4203 /* --------------------------------------------------------------------- */
4204 void XGI_WaitDisply( PVB_DEVICE_INFO pVBInfo
)
4206 while( ( XGINew_GetReg2( pVBInfo
->P3da
) & 0x01 ) )
4209 while( !( XGINew_GetReg2( pVBInfo
->P3da
) & 0x01 ) )
4213 /* --------------------------------------------------------------------- */
4214 /* Function : XGI_SenseCRT1 */
4218 /* --------------------------------------------------------------------- */
4220 void XGI_SenseCRT1( PVB_DEVICE_INFO pVBInfo
)
4222 UCHAR CRTCData
[ 17 ] = { 0x5F , 0x4F , 0x50 , 0x82 , 0x55 , 0x81 ,
4223 0x0B , 0x3E , 0xE9 , 0x0B , 0xDF , 0xE7 ,
4224 0x04 , 0x00 , 0x00 , 0x05 , 0x00 } ;
4226 UCHAR SR01
= 0 , SR1F
= 0 , SR07
= 0 , SR06
= 0 ;
4228 UCHAR CR17
, CR63
, SR31
;
4230 UCHAR DAC_TEST_PARMS
[ 3 ] = { 0x0F , 0x0F , 0x0F } ;
4233 XGINew_SetReg1( pVBInfo
->P3c4
, 0x05 , 0x86 ) ;
4235 /* [2004/05/06] Vicent to fix XG42 single LCD sense to CRT+LCD */
4236 XGINew_SetReg1( pVBInfo
->P3d4
, 0x57 , 0x4A ) ;
4237 XGINew_SetReg1( pVBInfo
->P3d4
, 0x53 , ( UCHAR
)( XGINew_GetReg1( pVBInfo
->P3d4
, 0x53 ) | 0x02 ) ) ;
4239 SR31
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3c4
, 0x31 ) ;
4240 CR63
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3d4
, 0x63 ) ;
4241 SR01
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3c4
, 0x01 ) ;
4243 XGINew_SetReg1( pVBInfo
->P3c4
, 0x01 , ( UCHAR
)( SR01
& 0xDF ) ) ;
4244 XGINew_SetReg1( pVBInfo
->P3d4
, 0x63 , ( UCHAR
)( CR63
& 0xBF ) ) ;
4246 CR17
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3d4
, 0x17 ) ;
4247 XGINew_SetReg1( pVBInfo
->P3d4
, 0x17 , ( UCHAR
)( CR17
| 0x80 ) ) ;
4249 SR1F
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3c4
, 0x1F ) ;
4250 XGINew_SetReg1( pVBInfo
->P3c4
, 0x1F , ( UCHAR
)( SR1F
| 0x04 ) ) ;
4252 SR07
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3c4
, 0x07 ) ;
4253 XGINew_SetReg1( pVBInfo
->P3c4
, 0x07 , ( UCHAR
)( SR07
& 0xFB ) ) ;
4254 SR06
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3c4
, 0x06 ) ;
4255 XGINew_SetReg1( pVBInfo
->P3c4
, 0x06 , ( UCHAR
)( SR06
& 0xC3 ) ) ;
4257 XGINew_SetReg1( pVBInfo
->P3d4
, 0x11 , 0x00 ) ;
4259 for( i
= 0 ; i
< 8 ; i
++ )
4260 XGINew_SetReg1( pVBInfo
->P3d4
, ( USHORT
)i
, CRTCData
[ i
] ) ;
4262 for( i
= 8 ; i
< 11 ; i
++ )
4263 XGINew_SetReg1( pVBInfo
->P3d4
, ( USHORT
)( i
+ 8 ) , CRTCData
[ i
] ) ;
4265 for( i
= 11 ; i
< 13 ; i
++ )
4266 XGINew_SetReg1( pVBInfo
->P3d4
, ( USHORT
)( i
+ 4 ) , CRTCData
[ i
] ) ;
4268 for( i
= 13 ; i
< 16 ; i
++ )
4269 XGINew_SetReg1( pVBInfo
->P3c4
, ( USHORT
)( i
- 3 ) , CRTCData
[ i
] ) ;
4271 XGINew_SetReg1( pVBInfo
->P3c4
, 0x0E , ( UCHAR
)( CRTCData
[ 16 ] & 0xE0 ) ) ;
4273 XGINew_SetReg1( pVBInfo
->P3c4
, 0x31 , 0x00 ) ;
4274 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2B , 0x1B ) ;
4275 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2C , 0xE1 ) ;
4277 XGINew_SetReg3( pVBInfo
->P3c8
, 0x00 ) ;
4279 for( i
= 0 ; i
< 256 ; i
++ )
4281 XGINew_SetReg3( ( pVBInfo
->P3c8
+ 1 ) , ( UCHAR
)DAC_TEST_PARMS
[ 0 ] ) ;
4282 XGINew_SetReg3( ( pVBInfo
->P3c8
+ 1 ) , ( UCHAR
)DAC_TEST_PARMS
[ 1 ] ) ;
4283 XGINew_SetReg3( ( pVBInfo
->P3c8
+ 1 ) , ( UCHAR
)DAC_TEST_PARMS
[ 2 ] ) ;
4286 XGI_VBLongWait( pVBInfo
) ;
4287 XGI_VBLongWait( pVBInfo
) ;
4288 XGI_VBLongWait( pVBInfo
) ;
4290 XGINew_LCD_Wait_Time( 0x01 , pVBInfo
) ;
4292 XGI_WaitDisply( pVBInfo
) ;
4293 temp
= XGINew_GetReg2( pVBInfo
->P3c2
) ;
4297 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x32 , 0xDF , 0x20 ) ;
4301 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x32 , 0xDF , 0x00 ) ;
4304 /* alan, avoid display something, set BLACK DAC if not restore DAC */
4305 XGINew_SetReg3( pVBInfo
->P3c8
, 0x00 ) ;
4307 for( i
= 0 ; i
< 256 ; i
++ )
4309 XGINew_SetReg3( ( pVBInfo
->P3c8
+ 1 ) , 0 ) ;
4310 XGINew_SetReg3( ( pVBInfo
->P3c8
+ 1 ) , 0 ) ;
4311 XGINew_SetReg3( ( pVBInfo
->P3c8
+ 1 ) , 0 ) ;
4314 XGINew_SetReg1( pVBInfo
->P3c4
, 0x01 , SR01
) ;
4315 XGINew_SetReg1( pVBInfo
->P3d4
, 0x63 , CR63
) ;
4316 XGINew_SetReg1( pVBInfo
->P3c4
, 0x31 , SR31
) ;
4318 /* [2004/05/11] Vicent */
4319 XGINew_SetReg1( pVBInfo
->P3d4
, 0x53 , ( UCHAR
)( XGINew_GetReg1( pVBInfo
->P3d4
, 0x53 ) & 0xFD ) ) ;
4320 XGINew_SetReg1( pVBInfo
->P3c4
, 0x1F , ( UCHAR
) SR1F
) ;
4332 /* --------------------------------------------------------------------- */
4333 /* Function : XGI_WaitDisplay */
4337 /* --------------------------------------------------------------------- */
4338 void XGI_WaitDisplay( PVB_DEVICE_INFO pVBInfo
)
4340 while( !( XGINew_GetReg2( pVBInfo
->P3da
) & 0x01 ) ) ;
4342 while( XGINew_GetReg2( pVBInfo
->P3da
) & 0x01 ) ;
4348 /* --------------------------------------------------------------------- */
4349 /* Function : XGI_SetCRT2Group301 */
4353 /* --------------------------------------------------------------------- */
4354 BOOLEAN
XGI_SetCRT2Group301( USHORT ModeNo
, PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
)
4358 RefreshRateTableIndex
;
4360 tempbx
=pVBInfo
->VBInfo
;
4361 pVBInfo
->SetFlag
|= ProgrammingCRT2
;
4362 XGI_SearchModeID( ModeNo
, &ModeIdIndex
, pVBInfo
) ;
4363 pVBInfo
->SelectCRT2Rate
= 4 ;
4364 RefreshRateTableIndex
= XGI_GetRatePtrCRT2( HwDeviceExtension
, ModeNo
, ModeIdIndex
, pVBInfo
) ;
4365 XGI_SaveCRT2Info( ModeNo
, pVBInfo
) ;
4366 XGI_GetCRT2ResInfo( ModeNo
, ModeIdIndex
, pVBInfo
) ;
4367 XGI_GetCRT2Data( ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
) ;
4368 XGI_PreSetGroup1( ModeNo
, ModeIdIndex
, HwDeviceExtension
, RefreshRateTableIndex
, pVBInfo
) ;
4369 XGI_SetGroup1( ModeNo
, ModeIdIndex
, HwDeviceExtension
, RefreshRateTableIndex
, pVBInfo
) ;
4370 XGI_SetLockRegs( ModeNo
, ModeIdIndex
, HwDeviceExtension
, RefreshRateTableIndex
, pVBInfo
) ;
4371 XGI_SetGroup2( ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, HwDeviceExtension
, pVBInfo
) ;
4372 XGI_SetLCDRegs(ModeNo
, ModeIdIndex
, HwDeviceExtension
, RefreshRateTableIndex
, pVBInfo
) ;
4373 XGI_SetTap4Regs(pVBInfo
) ;
4374 XGI_SetGroup3(ModeNo
, ModeIdIndex
, pVBInfo
);
4375 XGI_SetGroup4( ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, HwDeviceExtension
, pVBInfo
) ;
4376 XGI_SetCRT2VCLK( ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
) ;
4377 XGI_SetGroup5( ModeNo
, ModeIdIndex
, pVBInfo
) ;
4378 XGI_AutoThreshold( pVBInfo
) ;
4383 /* --------------------------------------------------------------------- */
4384 /* Function : XGI_AutoThreshold */
4388 /* --------------------------------------------------------------------- */
4389 void XGI_AutoThreshold( PVB_DEVICE_INFO pVBInfo
)
4391 if ( !( pVBInfo
->SetFlag
& Win9xDOSMode
) )
4392 XGINew_SetRegOR( pVBInfo
->Part1Port
, 0x01 , 0x40 ) ;
4396 /* --------------------------------------------------------------------- */
4397 /* Function : XGI_SaveCRT2Info */
4401 /* --------------------------------------------------------------------- */
4402 void XGI_SaveCRT2Info( USHORT ModeNo
, PVB_DEVICE_INFO pVBInfo
)
4407 XGINew_SetReg1( pVBInfo
->P3d4
, 0x34 , ModeNo
) ; /* reserve CR34 for CRT1 Mode No */
4408 temp1
= ( pVBInfo
->VBInfo
&SetInSlaveMode
) >> 8 ;
4409 temp2
= ~( SetInSlaveMode
>> 8 ) ;
4410 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x31 , temp2
, temp1
) ;
4414 /* --------------------------------------------------------------------- */
4415 /* Function : XGI_GetCRT2ResInfo */
4419 /* --------------------------------------------------------------------- */
4420 void XGI_GetCRT2ResInfo( USHORT ModeNo
, USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
)
4427 resindex
= XGI_GetResInfo( ModeNo
, ModeIdIndex
, pVBInfo
) ;
4428 if ( ModeNo
<= 0x13 )
4430 xres
= pVBInfo
->StResInfo
[ resindex
].HTotal
;
4431 yres
= pVBInfo
->StResInfo
[ resindex
].VTotal
;
4432 /* modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; si+St_ResInfo */
4436 xres
= pVBInfo
->ModeResInfo
[ resindex
].HTotal
; /* xres->ax */
4437 yres
= pVBInfo
->ModeResInfo
[ resindex
].VTotal
; /* yres->bx */
4438 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
; /* si+St_ModeFlag */
4440 /* if ( pVBInfo->IF_DEF_FSTN )
4448 if ( modeflag
& HalfDCLK
)
4451 if ( modeflag
& DoubleScanMode
)
4456 if ( pVBInfo
->VBInfo
& SetCRT2ToLCD
)
4458 if ( pVBInfo
->IF_DEF_LVDS
== 0 )
4460 if ( pVBInfo
->LCDResInfo
== Panel1600x1200
)
4462 if ( !( pVBInfo
->LCDInfo
& LCDVESATiming
) )
4469 if ( pVBInfo
->LCDResInfo
== Panel1280x1024
)
4473 else if ( yres
== 350 )
4476 if ( pVBInfo
->LCDInfo
& LCDVESATiming
)
4483 if ( pVBInfo
->LCDResInfo
== Panel1024x768
)
4485 if ( !( pVBInfo
->LCDInfo
& LCDVESATiming
) )
4487 if ( !( pVBInfo
->LCDInfo
& LCDNonExpanding
) )
4491 else if ( yres
== 400 )
4493 else if ( yres
== 480 )
4504 pVBInfo
->VGAHDE
= xres
;
4505 pVBInfo
->HDE
= xres
;
4506 pVBInfo
->VGAVDE
= yres
;
4507 pVBInfo
->VDE
= yres
;
4511 /* --------------------------------------------------------------------- */
4512 /* Function : XGI_IsLCDDualLink */
4516 /* --------------------------------------------------------------------- */
4517 BOOLEAN
XGI_IsLCDDualLink( PVB_DEVICE_INFO pVBInfo
)
4520 if ( ( ( ( pVBInfo
->VBInfo
& SetCRT2ToLCD
) | SetCRT2ToLCDA
) ) && ( pVBInfo
->LCDInfo
& SetLCDDualLink
) ) /* shampoo0129 */
4527 /* --------------------------------------------------------------------- */
4528 /* Function : XGI_GetCRT2Data */
4532 /* --------------------------------------------------------------------- */
4533 void XGI_GetCRT2Data( USHORT ModeNo
, USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
)
4540 XGI_LCDDataStruct
*LCDPtr
= NULL
;
4541 XGI_TVDataStruct
*TVPtr
= NULL
;
4543 if ( ModeNo
<= 0x13 )
4545 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
; /* si+St_ResInfo */
4546 resinfo
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ResInfo
;
4550 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
; /* si+Ext_ResInfo */
4551 resinfo
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_RESINFO
;
4554 pVBInfo
->NewFlickerMode
= 0 ;
4555 pVBInfo
->RVBHRS
= 50 ;
4557 if ( pVBInfo
->VBInfo
& SetCRT2ToRAMDAC
)
4559 XGI_GetRAMDAC2DATA( ModeNo
, ModeIdIndex
, RefreshRateTableIndex
,pVBInfo
) ;
4565 if ( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToLCDA
) )
4567 LCDPtr
= (XGI_LCDDataStruct
* )XGI_GetLcdPtr( tempbx
, ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
) ;
4569 pVBInfo
->RVBHCMAX
= LCDPtr
->RVBHCMAX
;
4570 pVBInfo
->RVBHCFACT
= LCDPtr
->RVBHCFACT
;
4571 pVBInfo
->VGAHT
= LCDPtr
->VGAHT
;
4572 pVBInfo
->VGAVT
= LCDPtr
->VGAVT
;
4573 pVBInfo
->HT
= LCDPtr
->LCDHT
;
4574 pVBInfo
->VT
= LCDPtr
->LCDVT
;
4576 if ( pVBInfo
->LCDResInfo
== Panel1024x768
)
4581 if ( !( pVBInfo
->LCDInfo
& LCDVESATiming
) )
4583 if ( pVBInfo
->VGAVDE
== 357 )
4585 else if ( pVBInfo
->VGAVDE
== 420 )
4587 else if ( pVBInfo
->VGAVDE
== 525 )
4589 else if ( pVBInfo
->VGAVDE
== 600 )
4591 /* else if(pVBInfo->VGAVDE==350) tempbx=560; */
4592 /* else if(pVBInfo->VGAVDE==400) tempbx=640; */
4599 else if ( pVBInfo
->LCDResInfo
== Panel1024x768x75
)
4604 else if ( pVBInfo
->LCDResInfo
== Panel1280x1024
)
4607 if ( pVBInfo
->VGAVDE
== 360 )
4609 else if ( pVBInfo
->VGAVDE
== 375 )
4611 else if ( pVBInfo
->VGAVDE
== 405 )
4616 else if ( pVBInfo
->LCDResInfo
== Panel1280x1024x75
)
4621 else if ( pVBInfo
->LCDResInfo
== Panel1280x960
)
4624 if ( pVBInfo
->VGAVDE
== 350 )
4626 else if ( pVBInfo
->VGAVDE
== 400 )
4628 else if ( pVBInfo
->VGAVDE
== 1024 )
4633 else if ( pVBInfo
->LCDResInfo
== Panel1400x1050
)
4638 if ( pVBInfo
->VGAVDE
== 1024 )
4644 else if ( pVBInfo
->LCDResInfo
== Panel1600x1200
)
4647 tempbx
= 1200 ; /* alan 10/14/2003 */
4648 if ( !( pVBInfo
->LCDInfo
& LCDVESATiming
) )
4650 if ( pVBInfo
->VGAVDE
== 350 )
4652 else if ( pVBInfo
->VGAVDE
== 400 )
4657 if ( pVBInfo
->LCDInfo
& LCDNonExpanding
)
4659 tempax
= pVBInfo
->VGAHDE
;
4660 tempbx
= pVBInfo
->VGAVDE
;
4663 pVBInfo
->HDE
= tempax
;
4664 pVBInfo
->VDE
= tempbx
;
4668 if ( pVBInfo
->VBInfo
& ( SetCRT2ToTV
) )
4671 TVPtr
= ( XGI_TVDataStruct
* )XGI_GetTVPtr( tempbx
, ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
) ;
4673 pVBInfo
->RVBHCMAX
= TVPtr
->RVBHCMAX
;
4674 pVBInfo
->RVBHCFACT
= TVPtr
->RVBHCFACT
;
4675 pVBInfo
->VGAHT
= TVPtr
->VGAHT
;
4676 pVBInfo
->VGAVT
= TVPtr
->VGAVT
;
4677 pVBInfo
->HDE
= TVPtr
->TVHDE
;
4678 pVBInfo
->VDE
= TVPtr
->TVVDE
;
4679 pVBInfo
->RVBHRS
= TVPtr
->RVBHRS
;
4680 pVBInfo
->NewFlickerMode
= TVPtr
->FlickerMode
;
4682 if ( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
)
4684 if ( resinfo
== 0x08 )
4685 pVBInfo
->NewFlickerMode
= 0x40 ;
4686 else if ( resinfo
== 0x09 )
4687 pVBInfo
->NewFlickerMode
= 0x40 ;
4688 else if ( resinfo
== 0x12 )
4689 pVBInfo
->NewFlickerMode
= 0x40 ;
4691 if ( pVBInfo
->VGAVDE
== 350 )
4692 pVBInfo
->TVInfo
|= TVSimuMode
;
4694 tempax
= ExtHiTVHT
;
4695 tempbx
= ExtHiTVVT
;
4697 if ( pVBInfo
->VBInfo
& SetInSlaveMode
)
4699 if ( pVBInfo
->TVInfo
& TVSimuMode
)
4704 if ( !( modeflag
& Charx8Dot
) )
4706 tempax
= StHiTextTVHT
;
4707 tempbx
= StHiTextTVVT
;
4712 else if ( pVBInfo
->VBInfo
& SetCRT2ToYPbPr
)
4714 if ( pVBInfo
->TVInfo
& SetYPbPrMode750p
)
4716 tempax
= YPbPrTV750pHT
; /* Ext750pTVHT */
4717 tempbx
= YPbPrTV750pVT
; /* Ext750pTVVT */
4720 if ( pVBInfo
->TVInfo
& SetYPbPrMode525p
)
4722 tempax
= YPbPrTV525pHT
; /* Ext525pTVHT */
4723 tempbx
= YPbPrTV525pVT
; /* Ext525pTVVT */
4725 else if ( pVBInfo
->TVInfo
& SetYPbPrMode525i
)
4727 tempax
= YPbPrTV525iHT
; /* Ext525iTVHT */
4728 tempbx
= YPbPrTV525iVT
; /* Ext525iTVVT */
4729 if ( pVBInfo
->TVInfo
& NTSC1024x768
)
4730 tempax
= NTSC1024x768HT
;
4737 if ( !( pVBInfo
->TVInfo
& SetPALTV
) )
4741 if ( pVBInfo
->TVInfo
& NTSC1024x768
)
4742 tempax
= NTSC1024x768HT
;
4746 pVBInfo
->HT
= tempax
;
4747 pVBInfo
->VT
= tempbx
;
4753 /* --------------------------------------------------------------------- */
4754 /* Function : XGI_SetCRT2VCLK */
4758 /* --------------------------------------------------------------------- */
4759 void XGI_SetCRT2VCLK( USHORT ModeNo
, USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
)
4765 tempal
= XGI_GetVCLKPtr( RefreshRateTableIndex
, ModeNo
, ModeIdIndex
, pVBInfo
) ;
4766 XGI_GetVCLKLen( tempal
, &di_0
, &di_1
, pVBInfo
) ;
4767 XGI_GetLCDVCLKPtr( &di_0
, &di_1
, pVBInfo
) ;
4769 if ( pVBInfo
->VBType
& VB_XGI301
) /* shampoo 0129 */
4771 XGINew_SetReg1(pVBInfo
->Part4Port
, 0x0A , 0x10 ) ;
4772 XGINew_SetReg1(pVBInfo
->Part4Port
, 0x0B , di_1
) ;
4773 XGINew_SetReg1(pVBInfo
->Part4Port
, 0x0A , di_0
) ;
4776 { /* 301b/302b/301lv/302lv */
4777 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x0A , di_0
) ;
4778 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x0B , di_1
) ;
4781 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x00 , 0x12 ) ;
4783 if ( pVBInfo
->VBInfo
& SetCRT2ToRAMDAC
)
4784 XGINew_SetRegOR( pVBInfo
->Part4Port
, 0x12 , 0x28 ) ;
4786 XGINew_SetRegOR( pVBInfo
->Part4Port
, 0x12 , 0x08 ) ;
4790 /* --------------------------------------------------------------------- */
4791 /* Function : XGI_GETLCDVCLKPtr */
4793 /* Output : al -> VCLK Index */
4795 /* --------------------------------------------------------------------- */
4796 void XGI_GetLCDVCLKPtr( UCHAR
* di_0
, UCHAR
*di_1
, PVB_DEVICE_INFO pVBInfo
)
4800 if ( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToLCDA
) )
4802 if ( pVBInfo
->IF_DEF_ScaleLCD
== 1 )
4804 if ( pVBInfo
->LCDInfo
& EnableScalingLCD
)
4808 /* index = XGI_GetLCDCapPtr(pVBInfo) ; */
4809 index
= XGI_GetLCDCapPtr1( pVBInfo
) ;
4811 if ( pVBInfo
->VBInfo
& SetCRT2ToLCD
)
4813 *di_0
= pVBInfo
->LCDCapList
[ index
].LCUCHAR_VCLKData1
;
4814 *di_1
= pVBInfo
->LCDCapList
[ index
].LCUCHAR_VCLKData2
;
4818 *di_0
= pVBInfo
->LCDCapList
[ index
].LCDA_VCLKData1
;
4819 *di_1
= pVBInfo
->LCDCapList
[ index
].LCDA_VCLKData2
;
4826 /* --------------------------------------------------------------------- */
4827 /* Function : XGI_GetVCLKPtr */
4831 /* --------------------------------------------------------------------- */
4832 UCHAR
XGI_GetVCLKPtr(USHORT RefreshRateTableIndex
,USHORT ModeNo
,USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
)
4839 UCHAR
*CHTVVCLKPtr
= NULL
;
4841 if ( ModeNo
<= 0x13 )
4842 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
; /* si+St_ResInfo */
4844 modeflag
= pVBInfo
->EModeIDTable
[ModeIdIndex
].Ext_ModeFlag
; /* si+Ext_ResInfo */
4847 if ( ( pVBInfo
->SetFlag
& ProgrammingCRT2
) && ( !( pVBInfo
->LCDInfo
& EnableScalingLCD
) ) )
4849 index
= XGI_GetLCDCapPtr(pVBInfo
) ;
4850 tempal
= pVBInfo
->LCDCapList
[ index
].LCD_VCLK
;
4852 if ( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToLCDA
) )
4856 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
4858 if(pVBInfo
->VBInfo
&SetCRT2ToHiVisionTV
)
4860 tempal
= HiTVVCLKDIV2
;
4861 if(!(pVBInfo
->TVInfo
& RPLLDIV2XO
))
4863 if(pVBInfo
->TVInfo
& TVSimuMode
)
4865 tempal
= HiTVSimuVCLK
;
4866 if(!(modeflag
& Charx8Dot
))
4867 tempal
= HiTVTextVCLK
;
4873 if ( pVBInfo
->TVInfo
& SetYPbPrMode750p
)
4875 tempal
= YPbPr750pVCLK
;
4879 if ( pVBInfo
->TVInfo
& SetYPbPrMode525p
)
4881 tempal
= YPbPr525pVCLK
;
4885 tempal
= NTSC1024VCLK
;
4887 if ( !( pVBInfo
->TVInfo
& NTSC1024x768
) )
4889 tempal
= TVVCLKDIV2
;
4890 if ( !( pVBInfo
->TVInfo
& RPLLDIV2XO
) )
4894 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
4898 if((pVBInfo->IF_DEF_CH7017==1)&&(pVBInfo->VBType&VB_CH7017))
4901 *tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
4903 *tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
4904 *tempal = *tempal & 0x1F;
4907 if(pVBInfo->TVInfo & SetPALTV)
4908 tempbx = tempbx + 2;
4909 if(pVBInfo->TVInfo & SetCHTVOverScan)
4911 tempbx = tempbx << 1;
4915 if((pVBInfo
->IF_DEF_CH7007
==1)&&(pVBInfo
->VBType
&VB_CH7007
)) /* [Billy] 07/05/08 CH7007 */
4917 /* VideoDebugPrint((0, "XGI_GetVCLKPtr: pVBInfo->IF_DEF_CH7007==1\n")); */
4918 if ( (pVBInfo
->VBInfo
& SetCRT2ToTV
) )
4920 if( ModeNo
<= 0x13 )
4922 tempal
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_CRT2CRTC
;
4926 tempal
= pVBInfo
->RefIndex
[RefreshRateTableIndex
].Ext_CRT2CRTC
;
4929 tempal
= tempal
& 0x0F;
4932 if(pVBInfo
->TVInfo
& SetPALTV
)
4934 tempbx
= tempbx
+ 2;
4936 if(pVBInfo
->TVInfo
& SetCHTVOverScan
)
4940 /** tempbx = tempbx << 1; CH7007 ? **/
4942 /*[Billy]07/05/29 CH7007*/
4943 if ( pVBInfo
->IF_DEF_CH7007
== 1 )
4948 CHTVVCLKPtr
= XGI7007_CHTVVCLKUNTSC
;
4951 CHTVVCLKPtr
= XGI7007_CHTVVCLKONTSC
;
4954 CHTVVCLKPtr
= XGI7007_CHTVVCLKUPAL
;
4957 CHTVVCLKPtr
= XGI7007_CHTVVCLKOPAL
;
4969 CHTVVCLKPtr = pVBInfo->CHTVVCLKUNTSC ;
4972 CHTVVCLKPtr = pVBInfo->CHTVVCLKONTSC ;
4975 CHTVVCLKPtr = pVBInfo->CHTVVCLKUPAL ;
4978 CHTVVCLKPtr = pVBInfo->CHTVVCLKOPAL ;
4985 tempal
= CHTVVCLKPtr
[ tempal
] ;
4991 tempal
= ( UCHAR
)XGINew_GetReg2( ( pVBInfo
->P3ca
+ 0x02 ) ) ;
4992 tempal
= tempal
>> 2 ;
4995 if ( ( pVBInfo
->LCDInfo
& EnableScalingLCD
) && ( modeflag
& Charx8Dot
) ) /* for Dot8 Scaling LCD */
4996 tempal
= tempal
^ tempal
; /* ; set to VCLK25MHz always */
4998 if ( ModeNo
<= 0x13 )
5001 tempal
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRTVCLK
;
5006 /* --------------------------------------------------------------------- */
5007 /* Function : XGI_GetVCLKLen */
5011 /* --------------------------------------------------------------------- */
5012 void XGI_GetVCLKLen(UCHAR tempal
,UCHAR
* di_0
,UCHAR
* di_1
, PVB_DEVICE_INFO pVBInfo
)
5014 if ( pVBInfo
->IF_DEF_CH7007
== 1 ) /* [Billy] 2007/05/16 */
5016 /* VideoDebugPrint((0, "XGI_GetVCLKLen: pVBInfo->IF_DEF_CH7007==1\n")); */
5017 *di_0
= ( UCHAR
)XGI_CH7007VCLKData
[ tempal
].SR2B
;
5018 *di_1
= ( UCHAR
)XGI_CH7007VCLKData
[ tempal
].SR2C
;
5020 else if ( pVBInfo
->VBType
& ( VB_XGI301
| VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
5022 if ( ( !( pVBInfo
->VBInfo
& SetCRT2ToLCDA
) ) && ( pVBInfo
->SetFlag
& ProgrammingCRT2
) )
5024 *di_0
= ( UCHAR
)XGI_VBVCLKData
[ tempal
].SR2B
;
5025 *di_1
= XGI_VBVCLKData
[ tempal
].SR2C
;
5030 *di_0
= XGI_VCLKData
[ tempal
].SR2B
;
5031 *di_1
= XGI_VCLKData
[ tempal
].SR2C
;
5036 /* --------------------------------------------------------------------- */
5037 /* Function : XGI_SetCRT2Offset */
5041 /* --------------------------------------------------------------------- */
5042 void XGI_SetCRT2Offset( USHORT ModeNo
,
5043 USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
, PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
)
5048 if ( pVBInfo
->VBInfo
& SetInSlaveMode
)
5053 offset
= XGI_GetOffset( ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, HwDeviceExtension
, pVBInfo
) ;
5054 temp
= ( UCHAR
)( offset
& 0xFF ) ;
5055 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x07 , temp
) ;
5056 temp
=( UCHAR
)( ( offset
& 0xFF00 ) >> 8 ) ;
5057 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x09 , temp
) ;
5058 temp
=( UCHAR
)( ( ( offset
>> 3 ) & 0xFF ) + 1 ) ;
5059 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x03 , temp
) ;
5063 /* --------------------------------------------------------------------- */
5064 /* Function : XGI_GetOffset */
5068 /* --------------------------------------------------------------------- */
5069 USHORT
XGI_GetOffset(USHORT ModeNo
,USHORT ModeIdIndex
,USHORT RefreshRateTableIndex
,PXGI_HW_DEVICE_INFO HwDeviceExtension
,PVB_DEVICE_INFO pVBInfo
)
5076 ColorDepth
[] = { 0x01 , 0x02 , 0x04 } ;
5078 modeinfo
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeInfo
;
5079 if ( ModeNo
<= 0x14 )
5082 infoflag
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_InfoFlag
;
5085 index
= ( modeinfo
>> 8 ) & 0xFF ;
5087 temp
= pVBInfo
->ScreenOffset
[ index
] ;
5089 if ( infoflag
& InterlaceMode
)
5094 colordepth
= XGI_GetColorDepth( ModeNo
, ModeIdIndex
, pVBInfo
) ;
5096 if ( ( ModeNo
>= 0x7C ) && ( ModeNo
<= 0x7E ) )
5098 temp
= ModeNo
- 0x7C ;
5099 colordepth
= ColorDepth
[ temp
] ;
5101 if ( infoflag
& InterlaceMode
)
5105 return( temp
* colordepth
) ;
5108 return( temp
* colordepth
) ;
5112 /* --------------------------------------------------------------------- */
5113 /* Function : XGI_SetCRT2FIFO */
5117 /* --------------------------------------------------------------------- */
5118 void XGI_SetCRT2FIFO( PVB_DEVICE_INFO pVBInfo
)
5120 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x01 , 0x3B ) ; /* threshold high ,disable auto threshold */
5121 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x02 , ~( 0x3F ) , 0x04 ) ; /* threshold low default 04h */
5125 /* --------------------------------------------------------------------- */
5126 /* Function : XGI_PreSetGroup1 */
5130 /* --------------------------------------------------------------------- */
5131 void XGI_PreSetGroup1(USHORT ModeNo
, USHORT ModeIdIndex
,PXGI_HW_DEVICE_INFO HwDeviceExtension
,
5132 USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
)
5138 if ( ModeNo
> 0x13 )
5140 CRT1Index
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRT1CRTC
;
5141 CRT1Index
&= IndexMask
;
5142 resinfo
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_RESINFO
;
5145 XGI_SetCRT2Offset( ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, HwDeviceExtension
, pVBInfo
) ;
5146 XGI_SetCRT2FIFO(pVBInfo
) ;
5147 /* XGI_SetCRT2Sync(ModeNo,RefreshRateTableIndex); */
5149 for( tempcx
= 4 ; tempcx
< 7 ; tempcx
++ )
5151 XGINew_SetReg1( pVBInfo
->Part1Port
, tempcx
, 0x0 ) ;
5154 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x50 , 0x00 ) ;
5155 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x02 , 0x44 ) ; /* temp 0206 */
5159 /* --------------------------------------------------------------------- */
5160 /* Function : XGI_SetGroup1 */
5164 /* --------------------------------------------------------------------- */
5165 void XGI_SetGroup1( USHORT ModeNo
, USHORT ModeIdIndex
,
5166 PXGI_HW_DEVICE_INFO HwDeviceExtension
, USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
)
5177 if ( ModeNo
> 0x13 )
5179 CRT1Index
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRT1CRTC
;
5180 CRT1Index
&= IndexMask
;
5181 resinfo
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_RESINFO
;
5184 if ( ModeNo
<= 0x13 )
5186 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
;
5190 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
;
5193 /* bainy change table name */
5194 if ( modeflag
& HalfDCLK
)
5196 temp
= ( pVBInfo
->VGAHT
/ 2 - 1 ) & 0x0FF ; /* BTVGA2HT 0x08,0x09 */
5197 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x08 , temp
) ;
5198 temp
= ( ( ( pVBInfo
->VGAHT
/ 2 - 1 ) & 0xFF00 ) >> 8 ) << 4 ;
5199 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x09 , ~0x0F0 , temp
) ;
5200 temp
= ( pVBInfo
->VGAHDE
/ 2 + 16 ) & 0x0FF ; /* BTVGA2HDEE 0x0A,0x0C */
5201 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x0A , temp
) ;
5202 tempcx
= ( ( pVBInfo
->VGAHT
- pVBInfo
->VGAHDE
) / 2 ) >> 2 ;
5203 pushbx
= pVBInfo
->VGAHDE
/ 2 + 16 ;
5204 tempcx
= tempcx
>> 1 ;
5205 tempbx
= pushbx
+ tempcx
; /* bx BTVGA@HRS 0x0B,0x0C */
5208 if ( pVBInfo
->VBInfo
& SetCRT2ToRAMDAC
)
5210 tempbx
= pVBInfo
->XGINEWUB_CRT1Table
[ CRT1Index
].CR
[ 4 ] ;
5211 tempbx
|= ( ( pVBInfo
->XGINEWUB_CRT1Table
[ CRT1Index
].CR
[ 14 ] & 0xC0 ) << 2 ) ;
5212 tempbx
= ( tempbx
- 3 ) << 3 ; /* (VGAHRS-3)*8 */
5213 tempcx
= pVBInfo
->XGINEWUB_CRT1Table
[CRT1Index
].CR
[ 5 ] ;
5215 temp
= pVBInfo
->XGINEWUB_CRT1Table
[ CRT1Index
].CR
[ 15 ] ;
5216 temp
= ( temp
& 0x04 ) << ( 5 - 2 ) ; /* VGAHRE D[5] */
5217 tempcx
= ( ( tempcx
| temp
) - 3 ) << 3 ; /* (VGAHRE-3)*8 */
5223 if ( tempcx
> ( pVBInfo
->VGAHT
/ 2 ) )
5224 tempcx
= pVBInfo
->VGAHT
/ 2 ;
5226 temp
= tempbx
& 0x00FF ;
5228 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x0B , temp
) ;
5232 temp
= ( pVBInfo
->VGAHT
- 1 ) & 0x0FF ; /* BTVGA2HT 0x08,0x09 */
5233 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x08 , temp
) ;
5234 temp
= ( ( ( pVBInfo
->VGAHT
- 1 ) & 0xFF00 ) >> 8 ) << 4 ;
5235 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x09 , ~0x0F0 , temp
) ;
5236 temp
= ( pVBInfo
->VGAHDE
+ 16 ) & 0x0FF ; /* BTVGA2HDEE 0x0A,0x0C */
5237 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x0A , temp
) ;
5238 tempcx
= ( pVBInfo
->VGAHT
- pVBInfo
->VGAHDE
) >> 2 ; /* cx */
5239 pushbx
= pVBInfo
->VGAHDE
+ 16 ;
5240 tempcx
= tempcx
>> 1 ;
5241 tempbx
= pushbx
+ tempcx
; /* bx BTVGA@HRS 0x0B,0x0C */
5244 if ( pVBInfo
->VBInfo
& SetCRT2ToRAMDAC
)
5246 tempbx
= pVBInfo
->XGINEWUB_CRT1Table
[ CRT1Index
].CR
[ 3 ] ;
5247 tempbx
|= ( ( pVBInfo
->XGINEWUB_CRT1Table
[ CRT1Index
].CR
[ 5 ] & 0xC0 ) << 2 ) ;
5248 tempbx
= ( tempbx
- 3 ) << 3 ; /* (VGAHRS-3)*8 */
5249 tempcx
= pVBInfo
->XGINEWUB_CRT1Table
[ CRT1Index
].CR
[ 4 ] ;
5251 temp
= pVBInfo
->XGINEWUB_CRT1Table
[ CRT1Index
].CR
[ 6 ] ;
5252 temp
= ( temp
& 0x04 ) << ( 5 - 2 ) ; /* VGAHRE D[5] */
5253 tempcx
= ( ( tempcx
| temp
) - 3 ) << 3 ; /* (VGAHRE-3)*8 */
5258 if ( tempcx
> pVBInfo
->VGAHT
)
5259 tempcx
= pVBInfo
->VGAHT
;
5261 temp
= tempbx
& 0x00FF ;
5262 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x0B , temp
) ;
5265 tempax
= ( tempax
& 0x00FF ) | ( tempbx
& 0xFF00 ) ;
5267 tempbx
= ( tempbx
& 0x00FF ) | ( ( tempbx
& 0xFF00 ) << 4 ) ;
5268 tempax
|= ( tempbx
& 0xFF00 ) ;
5269 temp
= ( tempax
& 0xFF00 ) >> 8 ;
5270 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x0C , temp
) ;
5271 temp
= tempcx
& 0x00FF ;
5272 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x0D , temp
) ;
5273 tempcx
= ( pVBInfo
->VGAVT
- 1 ) ;
5274 temp
= tempcx
& 0x00FF ;
5276 if ( pVBInfo
->IF_DEF_CH7005
== 1 )
5278 if ( pVBInfo
->VBInfo
& 0x0C )
5284 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x0E , temp
) ;
5285 tempbx
= pVBInfo
->VGAVDE
- 1 ;
5286 temp
= tempbx
& 0x00FF ;
5287 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x0F , temp
) ;
5288 temp
= ( ( tempbx
& 0xFF00 ) << 3 ) >> 8 ;
5289 temp
|= ( ( tempcx
& 0xFF00 ) >> 8 ) ;
5290 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x12 , temp
) ;
5292 tempax
= pVBInfo
->VGAVDE
;
5293 tempbx
= pVBInfo
->VGAVDE
;
5294 tempcx
= pVBInfo
->VGAVT
;
5295 tempbx
= ( pVBInfo
->VGAVT
+ pVBInfo
->VGAVDE
) >> 1 ; /* BTVGA2VRS 0x10,0x11 */
5296 tempcx
= ( ( pVBInfo
->VGAVT
- pVBInfo
->VGAVDE
) >> 4 ) + tempbx
+ 1 ; /* BTVGA2VRE 0x11 */
5298 if ( pVBInfo
->VBInfo
& SetCRT2ToRAMDAC
)
5300 tempbx
= pVBInfo
->XGINEWUB_CRT1Table
[ CRT1Index
].CR
[ 10 ] ;
5301 temp
= pVBInfo
->XGINEWUB_CRT1Table
[ CRT1Index
].CR
[ 9 ] ;
5309 temp
= pVBInfo
->XGINEWUB_CRT1Table
[ CRT1Index
].CR
[ 14 ] ;
5314 temp
= pVBInfo
->XGINEWUB_CRT1Table
[ CRT1Index
].CR
[ 11 ] ;
5315 tempcx
= ( tempcx
& 0xFF00 ) | ( temp
& 0x00FF ) ;
5318 temp
= tempbx
& 0x00FF ;
5319 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x10 , temp
) ;
5320 temp
= ( ( tempbx
& 0xFF00 ) >> 8 ) << 4 ;
5321 temp
= ( ( tempcx
& 0x000F ) | ( temp
) ) ;
5322 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x11 , temp
) ;
5325 if ( modeflag
& DoubleScanMode
)
5328 if ( modeflag
& HalfDCLK
)
5331 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x2C , ~0x0C0 , tempax
) ;
5335 /* --------------------------------------------------------------------- */
5336 /* Function : XGI_SetLockRegs */
5340 /* --------------------------------------------------------------------- */
5341 void XGI_SetLockRegs( USHORT ModeNo
, USHORT ModeIdIndex
,
5342 PXGI_HW_DEVICE_INFO HwDeviceExtension
, USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
)
5354 if ( ModeNo
<= 0x13 )
5356 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
; /* si+St_ResInfo */
5357 resinfo
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ResInfo
;
5361 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
; /* si+Ext_ResInfo */
5362 resinfo
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_RESINFO
;
5363 CRT1Index
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRT1CRTC
;
5364 CRT1Index
&= IndexMask
;
5367 if ( !( pVBInfo
->VBInfo
& SetInSlaveMode
) )
5372 temp
= 0xFF ; /* set MAX HT */
5373 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x03 , temp
) ;
5374 /* if ( modeflag & Charx8Dot ) tempcx = 0x08 ; */
5378 if ( pVBInfo
->VBType
& ( VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
5379 modeflag
|= Charx8Dot
;
5381 tempax
= pVBInfo
->VGAHDE
; /* 0x04 Horizontal Display End */
5383 if ( modeflag
& HalfDCLK
)
5384 tempax
= tempax
>> 1 ;
5386 tempax
= ( tempax
/ tempcx
) - 1 ;
5387 tempbx
|= ( ( tempax
& 0x00FF ) << 8 ) ;
5388 temp
= tempax
& 0x00FF ;
5389 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x04 , temp
) ;
5391 temp
= ( tempbx
& 0xFF00 ) >> 8 ;
5393 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
5395 if ( !( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) ) )
5398 if ( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
)
5400 if ( pVBInfo
->VBType
& VB_XGI301LV
)
5402 if ( pVBInfo
->VBExtInfo
== VB_YPbPr1080i
)
5414 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x05 , temp
) ; /* 0x05 Horizontal Display Start */
5415 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x06 , 0x03 ) ; /* 0x06 Horizontal Blank end */
5417 if ( !( pVBInfo
->VBInfo
& DisableCRT2Display
) )
5418 { /* 030226 bainy */
5419 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
5420 tempax
= pVBInfo
->VGAHT
;
5422 tempax
= XGI_GetVGAHT2( pVBInfo
) ;
5425 if ( tempax
>= pVBInfo
->VGAHT
)
5427 tempax
= pVBInfo
->VGAHT
;
5430 if ( modeflag
& HalfDCLK
)
5432 tempax
= tempax
>> 1 ;
5435 tempax
= ( tempax
/ tempcx
) - 5 ;
5436 tempcx
= tempax
; /* 20030401 0x07 horizontal Retrace Start */
5437 if ( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
)
5439 temp
= ( tempbx
& 0x00FF ) - 1 ;
5440 if ( !( modeflag
& HalfDCLK
) )
5443 if ( pVBInfo
->TVInfo
& TVSimuMode
)
5446 if ( ModeNo
> 0x13 )
5453 /* tempcx = tempbx & 0x00FF ; */
5454 tempbx
= ( tempbx
& 0xFF00 ) >> 8 ;
5455 tempcx
= ( tempcx
+ tempbx
) >> 1 ;
5456 temp
= ( tempcx
& 0x00FF ) + 2 ;
5458 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
5461 if ( !( modeflag
& HalfDCLK
) )
5463 if ( ( modeflag
& Charx8Dot
) )
5466 if ( pVBInfo
->VGAHDE
>= 800 )
5475 if ( !( modeflag
& HalfDCLK
) )
5478 if ( pVBInfo
->LCDResInfo
!= Panel1280x960
)
5480 if( pVBInfo
->VGAHDE
>= 800 )
5483 if ( pVBInfo
->ModeType
== ModeEGA
)
5485 if ( pVBInfo
->VGAVDE
== 1024 )
5488 if ( pVBInfo
->LCDResInfo
!= Panel1280x1024
)
5495 if ( pVBInfo
->VGAHDE
>= 1280 )
5497 if ( pVBInfo
->LCDResInfo
!= Panel1280x960
)
5499 if ( pVBInfo
->LCDInfo
& LCDNonExpanding
)
5511 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x07 , temp
) ; /* 0x07 Horizontal Retrace Start */
5512 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x08 , 0 ) ; /* 0x08 Horizontal Retrace End */
5514 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
5516 if ( pVBInfo
->TVInfo
& TVSimuMode
)
5518 if ( ( ModeNo
== 0x06 ) || ( ModeNo
== 0x10 ) || ( ModeNo
== 0x11 ) || ( ModeNo
== 0x13 ) || ( ModeNo
== 0x0F ) )
5520 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x07 , 0x5b ) ;
5521 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x08 , 0x03 ) ;
5524 if ( ( ModeNo
== 0x00 ) || ( ModeNo
== 0x01 ) )
5526 if ( pVBInfo
->TVInfo
& SetNTSCTV
)
5528 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x07 , 0x2A ) ;
5529 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x08 , 0x61 ) ;
5533 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x07 , 0x2A ) ;
5534 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x08 , 0x41 ) ;
5535 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x0C , 0xF0 ) ;
5539 if ( ( ModeNo
== 0x02 ) || ( ModeNo
== 0x03 ) || ( ModeNo
== 0x07 ) )
5541 if ( pVBInfo
->TVInfo
& SetNTSCTV
)
5543 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x07 , 0x54 ) ;
5544 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x08 , 0x00 ) ;
5548 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x07 , 0x55 ) ;
5549 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x08 , 0x00 ) ;
5550 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x0C , 0xF0 ) ;
5554 if ( ( ModeNo
== 0x04 ) || ( ModeNo
== 0x05 ) || ( ModeNo
== 0x0D ) || ( ModeNo
== 0x50 ) )
5556 if ( pVBInfo
->TVInfo
& SetNTSCTV
)
5558 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x07 , 0x30 ) ;
5559 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x08 , 0x03 ) ;
5563 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x07 , 0x2f ) ;
5564 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x08 , 0x02 ) ;
5570 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x18 , 0x03 ) ; /* 0x18 SR0B */
5571 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x19 , 0xF0 , 0x00 ) ;
5572 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x09 , 0xFF ) ; /* 0x09 Set Max VT */
5574 tempbx
= pVBInfo
->VGAVT
;
5577 tempbx
= pVBInfo
->VGAVDE
; /* 0x0E Virtical Display End */
5579 if ( tempbx
== 357 )
5581 if ( tempbx
== 360 )
5583 if ( tempbx
== 375 )
5585 if ( tempbx
== 405 )
5587 if ( tempbx
== 525 )
5592 if ( pVBInfo
->VBInfo
& SetCRT2ToLCD
)
5594 if ( pVBInfo
->LCDResInfo
== Panel1024x768
)
5596 if ( !( pVBInfo
->LCDInfo
& LCDVESATiming
) )
5598 if ( tempbx
== 350 )
5600 if ( tempbx
== 480 )
5606 temp
= tempbx
& 0x00FF ;
5608 temp
= tempbx
& 0x00FF ;
5609 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x10 ,temp
) ; /* 0x10 vertical Blank Start */
5612 temp
= tempbx
& 0x00FF ;
5613 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x0E , temp
) ;
5615 if ( tempbx
& 0x0100 )
5622 if ( modeflag
& DoubleScanMode
)
5627 if ( tempbx
& 0x0200 )
5632 temp
= ( tempax
& 0xFF00 ) >> 8 ;
5633 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x0B , temp
) ;
5635 if ( tempbx
& 0x0400 )
5640 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x11 , 0x00 ) ; /* 0x11 Vertival Blank End */
5643 tempax
-= tempbx
; /* 0x0C Vertical Retrace Start */
5644 tempax
= tempax
>> 2 ;
5645 push1
= tempax
; /* push ax */
5647 if ( resinfo
!= 0x09 )
5649 tempax
= tempax
<< 1 ;
5653 if ( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
)
5655 if ( pVBInfo
->VBType
& VB_XGI301LV
)
5657 if ( pVBInfo
->TVInfo
& SetYPbPrMode1080i
)
5661 if ( pVBInfo
->TVInfo
& TVSimuMode
)
5663 if ( pVBInfo
->TVInfo
& SetPALTV
)
5665 if ( pVBInfo
->VBType
& VB_XGI301LV
)
5667 if ( !( pVBInfo
->TVInfo
& ( SetYPbPrMode525p
| SetYPbPrMode750p
| SetYPbPrMode1080i
) ) )
5681 if ( pVBInfo
->TVInfo
& TVSimuMode
)
5683 if ( pVBInfo
->TVInfo
& SetPALTV
)
5685 if ( pVBInfo
->VBType
& VB_XGI301LV
)
5687 if ( !( pVBInfo
->TVInfo
& ( SetYPbPrMode525p
| SetYPbPrMode750p
| SetYPbPrMode1080i
) ) )
5696 tempax
= tempax
>> 2 ;
5699 push1
= tempax
; /* push ax */
5701 if ( ( pVBInfo
->TVInfo
& SetPALTV
) )
5703 if ( tempbx
<= 513 )
5705 if ( tempax
>= 513 )
5712 temp
= tempbx
& 0x00FF ;
5713 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x0C , temp
) ;
5715 temp
= tempbx
& 0x00FF ;
5716 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x10 , temp
) ;
5718 if ( tempbx
& 0x0100 )
5723 if ( tempbx
& 0x0200 )
5725 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x0B , 0x0FF , 0x20 ) ;
5730 if ( tempbx
& 0x0100 )
5735 if ( tempbx
& 0x0200 )
5740 if ( tempbx
& 0x0400 )
5745 tempbx
= push1
; /* pop ax */
5746 temp
= tempbx
& 0x00FF ;
5748 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x0D , temp
) ; /* 0x0D vertical Retrace End */
5750 if ( tempbx
& 0x0010 )
5755 temp
= tempcx
& 0x00FF ;
5756 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x0A , temp
) ; /* 0x0A CR07 */
5757 temp
= ( tempcx
& 0x0FF00 ) >> 8 ;
5758 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x17 , temp
) ; /* 0x17 SR0A */
5760 temp
= ( tempax
& 0xFF00 ) >> 8 ;
5762 temp
= ( temp
>> 1 ) & 0x09 ;
5764 if ( pVBInfo
->VBType
& ( VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
5767 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x16 , temp
) ; /* 0x16 SR01 */
5768 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x0F , 0 ) ; /* 0x0F CR14 */
5769 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x12 , 0 ) ; /* 0x12 CR17 */
5771 if ( pVBInfo
->LCDInfo
& LCDRGB18Bit
)
5776 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x1A , temp
) ; /* 0x1A SR0E */
5782 /* --------------------------------------------------------------------- */
5783 /* Function : XGI_SetGroup2 */
5787 /* --------------------------------------------------------------------- */
5788 void XGI_SetGroup2( USHORT ModeNo
, USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
,
5789 PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
)
5802 UCHAR
*TimingPoint
;
5810 if ( ModeNo
<= 0x13 )
5812 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
; /* si+St_ResInfo */
5813 resinfo
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ResInfo
;
5814 crt2crtc
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_CRT2CRTC
;
5818 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
; /* si+Ext_ResInfo */
5819 resinfo
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_RESINFO
;
5820 crt2crtc
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRT2CRTC
;
5825 if ( !( pVBInfo
->VBInfo
& SetCRT2ToAVIDEO
) )
5828 if ( !( pVBInfo
->VBInfo
& SetCRT2ToSVIDEO
) )
5831 if ( pVBInfo
->VBInfo
& SetCRT2ToSCART
)
5834 if ( !( pVBInfo
->TVInfo
& SetPALTV
) )
5837 if ( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
)
5840 if ( pVBInfo
->TVInfo
& ( SetYPbPrMode525p
| SetYPbPrMode750p
) )
5843 tempax
= ( tempax
& 0xff00 ) >> 8 ;
5845 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x0 , tempax
) ;
5846 TimingPoint
= pVBInfo
->NTSCTiming
;
5848 if ( pVBInfo
->TVInfo
& SetPALTV
)
5850 TimingPoint
= pVBInfo
->PALTiming
;
5853 if ( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
)
5855 TimingPoint
= pVBInfo
->HiTVExtTiming
;
5857 if ( pVBInfo
->VBInfo
& SetInSlaveMode
)
5858 TimingPoint
= pVBInfo
->HiTVSt2Timing
;
5860 if ( pVBInfo
->SetFlag
& TVSimuMode
)
5861 TimingPoint
= pVBInfo
->HiTVSt1Timing
;
5863 if ( !(modeflag
& Charx8Dot
) )
5864 TimingPoint
= pVBInfo
->HiTVTextTiming
;
5867 if ( pVBInfo
->VBInfo
& SetCRT2ToYPbPr
)
5869 if ( pVBInfo
->TVInfo
& SetYPbPrMode525i
)
5870 TimingPoint
= pVBInfo
->YPbPr525iTiming
;
5872 if ( pVBInfo
->TVInfo
& SetYPbPrMode525p
)
5873 TimingPoint
= pVBInfo
->YPbPr525pTiming
;
5875 if ( pVBInfo
->TVInfo
& SetYPbPrMode750p
)
5876 TimingPoint
= pVBInfo
->YPbPr750pTiming
;
5879 for( i
= 0x01 , j
= 0 ; i
<= 0x2D ; i
++ , j
++ )
5881 XGINew_SetReg1( pVBInfo
->Part2Port
, i
, TimingPoint
[ j
] ) ;
5884 for( i
= 0x39 ; i
<= 0x45 ; i
++ , j
++ )
5886 XGINew_SetReg1( pVBInfo
->Part2Port
, i
, TimingPoint
[ j
] ) ; /* di->temp2[j] */
5889 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
5891 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x3A , 0x1F , 0x00 ) ;
5894 temp
= pVBInfo
->NewFlickerMode
;
5896 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x0A , 0xFF , temp
) ;
5898 if ( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
)
5901 if ( pVBInfo
->TVInfo
& SetPALTV
)
5906 if ( pVBInfo
->VDE
<= tempax
)
5908 tempax
-= pVBInfo
->VDE
;
5909 tempax
= tempax
>> 2 ;
5910 tempax
= ( tempax
& 0x00FF ) | ( ( tempax
& 0x00FF ) << 8 ) ;
5912 temp
= ( tempax
& 0xFF00 ) >> 8 ;
5913 temp
+= ( USHORT
)TimingPoint
[ 0 ] ;
5915 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
5917 if ( pVBInfo
->VBInfo
& ( SetCRT2ToAVIDEO
| SetCRT2ToSVIDEO
| SetCRT2ToSCART
| SetCRT2ToYPbPr
) )
5919 tempcx
=pVBInfo
->VGAHDE
;
5920 if ( tempcx
>= 1024 )
5922 temp
= 0x17 ; /* NTSC */
5923 if ( pVBInfo
->TVInfo
& SetPALTV
)
5924 temp
= 0x19 ; /* PAL */
5929 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x01 , temp
) ;
5931 temp
= ( tempax
& 0xFF00 ) >> 8 ;
5932 temp
+= TimingPoint
[ 1 ] ;
5934 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
5936 if ( ( pVBInfo
->VBInfo
& ( SetCRT2ToAVIDEO
| SetCRT2ToSVIDEO
| SetCRT2ToSCART
| SetCRT2ToYPbPr
) ) )
5938 tempcx
= pVBInfo
->VGAHDE
;
5939 if ( tempcx
>= 1024 )
5941 temp
= 0x1D ; /* NTSC */
5942 if ( pVBInfo
->TVInfo
& SetPALTV
)
5943 temp
= 0x52 ; /* PAL */
5947 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x02 , temp
) ;
5951 tempcx
= pVBInfo
->HT
;
5953 if ( XGI_IsLCDDualLink( pVBInfo
) )
5954 tempcx
= tempcx
>> 1 ;
5957 temp
= tempcx
& 0x00FF ;
5958 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x1B , temp
) ;
5960 temp
= ( tempcx
& 0xFF00 ) >> 8 ;
5961 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x1D , ~0x0F , temp
) ;
5963 tempcx
= pVBInfo
->HT
>> 1 ;
5964 push1
= tempcx
; /* push cx */
5967 if ( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
)
5972 temp
= tempcx
& 0x00FF ;
5974 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x22 , 0x0F , temp
) ;
5976 tempbx
= TimingPoint
[ j
] | ( ( TimingPoint
[ j
+ 1 ] ) << 8 ) ;
5979 temp
= tempbx
& 0x00FF ;
5980 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x24 , temp
) ;
5981 temp
= ( tempbx
& 0xFF00 ) >> 8 ;
5983 XGINew_SetRegANDOR(pVBInfo
->Part2Port
,0x25,0x0F,temp
);
5987 if ( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
)
5993 temp
= ( tempbx
& 0x00FF ) << 4 ;
5994 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x29 , 0x0F , temp
) ;
5997 tempcx
+= ( TimingPoint
[ j
] | ( ( TimingPoint
[ j
+ 1 ] ) << 8 ) ) ;
5998 temp
= tempcx
& 0x00FF ;
5999 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x27 , temp
) ;
6000 temp
= ( ( tempcx
& 0xFF00 ) >> 8 ) << 4 ;
6001 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x28 , 0x0F , temp
) ;
6004 if ( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
)
6009 temp
= tempcx
& 0xFF ;
6011 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x2A , 0x0F , temp
) ;
6013 tempcx
= push1
; /* pop cx */
6015 temp
= TimingPoint
[ j
] | ( ( TimingPoint
[ j
+ 1 ] ) << 8 ) ;
6017 temp
= tempcx
& 0x00FF ;
6019 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x2D , 0x0F ,temp
) ;
6023 if ( !( pVBInfo
->VBInfo
& SetCRT2ToTV
) )
6025 tempax
= XGI_GetVGAHT2( pVBInfo
) ;
6026 tempcx
= tempax
- 1 ;
6028 temp
= tempcx
& 0x00FF ;
6029 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x2E , temp
) ;
6031 tempbx
= pVBInfo
->VDE
;
6033 if ( pVBInfo
->VGAVDE
== 360 )
6035 if ( pVBInfo
->VGAVDE
== 375 )
6037 if ( pVBInfo
->VGAVDE
== 405 )
6040 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
6042 if ( pVBInfo
->VBType
& ( VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
6044 if ( !( pVBInfo
->TVInfo
& ( SetYPbPrMode525p
| SetYPbPrMode750p
) ) )
6045 tempbx
= tempbx
>> 1 ;
6048 tempbx
= tempbx
>> 1 ;
6052 temp
= tempbx
& 0x00FF ;
6054 if ( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
)
6056 if ( pVBInfo
->VBType
& VB_XGI301LV
)
6058 if ( pVBInfo
->TVInfo
& SetYPbPrMode1080i
)
6060 if ( pVBInfo
->VBInfo
& SetInSlaveMode
)
6062 if ( ModeNo
== 0x2f )
6069 if ( pVBInfo
->VBInfo
& SetInSlaveMode
)
6071 if ( ModeNo
== 0x2f )
6077 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x2F , temp
) ;
6079 temp
= ( tempcx
& 0xFF00 ) >> 8 ;
6080 temp
|= ( ( tempbx
& 0xFF00 ) >> 8 ) << 6 ;
6082 if ( !( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
) )
6084 if ( pVBInfo
->VBType
& VB_XGI301LV
)
6086 if ( pVBInfo
->TVInfo
& SetYPbPrMode1080i
)
6090 if ( !( pVBInfo
->VBInfo
& SetCRT2ToSVIDEO
) )
6097 if ( !( pVBInfo
->VBInfo
& SetCRT2ToSVIDEO
) )
6102 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x30 , temp
) ;
6104 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) ) /* TV gatingno */
6106 tempbx
= pVBInfo
->VDE
;
6107 tempcx
= tempbx
- 2 ;
6109 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
6111 if ( !( pVBInfo
->TVInfo
& ( SetYPbPrMode525p
| SetYPbPrMode750p
) ) )
6112 tempbx
= tempbx
>> 1 ;
6115 if ( pVBInfo
->VBType
& ( VB_XGI302LV
| VB_XGI301C
) )
6118 if( tempcx
& 0x0400 )
6121 if ( tempbx
& 0x0400 )
6124 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x10 , temp
) ;
6127 temp
= ( ( ( tempbx
- 3 ) & 0x0300 ) >> 8 ) << 5 ;
6128 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x46 , temp
) ;
6129 temp
= ( tempbx
- 3 ) & 0x00FF ;
6130 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x47 , temp
) ;
6133 tempbx
= tempbx
& 0x00FF ;
6135 if ( !( modeflag
& HalfDCLK
) )
6137 tempcx
= pVBInfo
->VGAHDE
;
6138 if ( tempcx
>= pVBInfo
->HDE
)
6147 if( pVBInfo
->VBInfo
& SetCRT2ToTV
) { /*301b*/
6148 if(pVBInfo
->VGAHDE
>=1024)
6151 if(pVBInfo
->VGAHDE
>=1280)
6154 tempbx
=tempbx
&0xDFFF;
6159 if ( !( tempbx
& 0x2000 ) )
6161 if ( modeflag
& HalfDCLK
)
6163 tempcx
= ( tempcx
& 0xFF00 ) | ( ( tempcx
& 0x00FF ) << 1 ) ;
6167 tempeax
= pVBInfo
->VGAHDE
;
6168 tempebx
= ( tempcx
& 0xFF00 ) >> 8 ;
6169 longtemp
= tempeax
* tempebx
;
6170 tempecx
= tempcx
& 0x00FF ;
6171 longtemp
= longtemp
/ tempecx
;
6174 tempecx
= 8 * 1024 ;
6176 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
6178 tempecx
= tempecx
* 8 ;
6181 longtemp
= longtemp
* tempecx
;
6182 tempecx
= pVBInfo
->HDE
;
6183 temp2
= longtemp
% tempecx
;
6184 tempeax
= longtemp
/ tempecx
;
6190 tempax
= ( USHORT
)tempeax
;
6193 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
6195 tempcx
= ( ( tempax
& 0xFF00 ) >> 5 ) >> 8 ;
6200 tempbx
=( USHORT
)( ( ( tempeax
& 0x0000FF00 ) & 0x1F00 ) | ( tempbx
& 0x00FF ) ) ;
6201 tempax
=( USHORT
)( ( ( tempeax
& 0x000000FF ) << 8 ) | ( tempax
& 0x00FF ) ) ;
6202 temp
= ( tempax
& 0xFF00 ) >> 8 ;
6206 temp
= ( tempax
& 0x00FF ) >> 8 ;
6209 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x44 , temp
) ;
6210 temp
= ( tempbx
& 0xFF00 ) >> 8 ;
6211 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x45 , ~0x03F , temp
) ;
6212 temp
= tempcx
& 0x00FF ;
6214 if ( tempbx
& 0x2000 )
6217 if ( !( pVBInfo
->VBInfo
& SetCRT2ToLCD
) )
6220 XGINew_SetRegANDOR(pVBInfo
->Part2Port
,0x46,~0x1F,temp
);
6221 if ( pVBInfo
->TVInfo
& SetPALTV
)
6232 temp
= tempbx
& 0x00FF ;
6233 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x4b , temp
) ;
6234 temp
= tempcx
& 0x00FF ;
6235 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x4c , temp
) ;
6237 temp
= ( ( tempcx
& 0xFF00 ) >> 8 ) & 0x03 ;
6239 temp
|= ( ( tempbx
& 0xFF00 ) >> 8 ) & 0x03 ;
6241 if ( pVBInfo
->VBInfo
& SetCRT2ToYPbPr
)
6245 if ( pVBInfo
->TVInfo
& SetYPbPrMode525p
)
6248 if ( pVBInfo
->TVInfo
& SetYPbPrMode750p
)
6252 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x4d , temp
) ;
6253 temp
=XGINew_GetReg1( pVBInfo
->Part2Port
, 0x43 ) ; /* 301b change */
6254 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x43 , ( USHORT
)( temp
- 3 ) ) ;
6256 if ( !( pVBInfo
->TVInfo
& ( SetYPbPrMode525p
| SetYPbPrMode750p
) ) )
6258 if ( pVBInfo
->TVInfo
& NTSC1024x768
)
6260 TimingPoint
= XGI_NTSC1024AdjTime
;
6261 for( i
= 0x1c , j
= 0 ; i
<= 0x30 ; i
++ , j
++ )
6263 XGINew_SetReg1( pVBInfo
->Part2Port
, i
, TimingPoint
[ j
] ) ;
6265 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x43 , 0x72 ) ;
6269 /* [ycchen] 01/14/03 Modify for 301C PALM Support */
6270 if ( pVBInfo
->VBType
& VB_XGI301C
)
6272 if ( pVBInfo
->TVInfo
& SetPALMTV
)
6273 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x4E , ~0x08 , 0x08 ) ; /* PALM Mode */
6276 if ( pVBInfo
->TVInfo
& SetPALMTV
)
6278 tempax
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->Part2Port
, 0x01 ) ;
6280 XGINew_SetRegAND( pVBInfo
->Part2Port
, 0x01 , tempax
) ;
6282 /* if ( !( pVBInfo->VBType & VB_XGI301C ) ) */
6283 XGINew_SetRegAND( pVBInfo
->Part2Port
, 0x00 , 0xEF ) ;
6286 if ( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
)
6288 if ( !( pVBInfo
->VBInfo
& SetInSlaveMode
) )
6290 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x0B , 0x00 ) ;
6294 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
6301 /* --------------------------------------------------------------------- */
6302 /* Function : XGI_SetLCDRegs */
6306 /* --------------------------------------------------------------------- */
6307 void XGI_SetLCDRegs(USHORT ModeNo
,USHORT ModeIdIndex
, PXGI_HW_DEVICE_INFO HwDeviceExtension
,USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
)
6323 XGI_LCDDesStruct
*LCDBDesPtr
= NULL
;
6326 if ( ModeNo
<= 0x13 )
6328 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
; /* si+St_ResInfo */
6329 resinfo
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ResInfo
;
6333 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
; /* si+Ext_ResInfo */
6334 resinfo
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_RESINFO
;
6335 CRT1Index
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRT1CRTC
;
6336 CRT1Index
&= IndexMask
;
6339 if ( !( pVBInfo
->VBInfo
& SetCRT2ToLCD
) )
6344 tempbx
= pVBInfo
->HDE
; /* RHACTE=HDE-1 */
6346 if ( XGI_IsLCDDualLink( pVBInfo
) )
6347 tempbx
= tempbx
>> 1 ;
6350 temp
= tempbx
& 0x00FF ;
6351 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x2C , temp
) ;
6352 temp
= ( tempbx
& 0xFF00 ) >> 8 ;
6354 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x2B , 0x0F , temp
) ;
6357 if ( pVBInfo
->LCDResInfo
== Panel1280x1024
)
6359 if ( pVBInfo
->ModeType
== ModeEGA
)
6361 if ( pVBInfo
->VGAHDE
>= 1024 )
6364 if ( pVBInfo
->LCDInfo
& LCDVESATiming
)
6370 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x0B , temp
) ;
6371 tempbx
= pVBInfo
->VDE
; /* RTVACTEO=(VDE-1)&0xFF */
6374 temp
= tempbx
& 0x00FF ;
6375 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x03 , temp
) ;
6376 temp
= ( ( tempbx
& 0xFF00 ) >> 8 ) & 0x07 ;
6377 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x0C , ~0x07 , temp
) ;
6379 tempcx
= pVBInfo
->VT
- 1 ;
6380 push2
= tempcx
+ 1 ;
6381 temp
= tempcx
& 0x00FF ; /* RVTVT=VT-1 */
6382 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x19 , temp
) ;
6383 temp
= ( tempcx
& 0xFF00 ) >> 8 ;
6385 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x1A , temp
) ;
6386 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x09 , 0xF0 , 0x00 ) ;
6387 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x0A , 0xF0 , 0x00 ) ;
6388 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x17 , 0xFB , 0x00 ) ;
6389 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x18 , 0xDF , 0x00 ) ;
6391 /* Customized LCDB Des no add */
6393 LCDBDesPtr
= ( XGI_LCDDesStruct
* )XGI_GetLcdPtr( tempbx
, ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
) ;
6394 tempah
= pVBInfo
->LCDResInfo
;
6395 tempah
&= PanelResInfo
;
6397 if ( ( tempah
== Panel1024x768
) || ( tempah
== Panel1024x768x75
) )
6402 else if ( ( tempah
== Panel1280x1024
) || ( tempah
== Panel1280x1024x75
) )
6407 else if ( tempah
== Panel1400x1050
)
6418 if ( pVBInfo
->LCDInfo
& EnableScalingLCD
)
6420 tempbx
= pVBInfo
->HDE
;
6421 tempcx
= pVBInfo
->VDE
;
6425 tempax
= pVBInfo
->VT
;
6426 pVBInfo
->LCDHDES
= LCDBDesPtr
->LCDHDES
;
6427 pVBInfo
->LCDHRS
= LCDBDesPtr
->LCDHRS
;
6428 pVBInfo
->LCDVDES
= LCDBDesPtr
->LCDVDES
;
6429 pVBInfo
->LCDVRS
= LCDBDesPtr
->LCDVRS
;
6430 tempbx
= pVBInfo
->LCDVDES
;
6433 if ( tempcx
>= tempax
)
6434 tempcx
-= tempax
; /* lcdvdes */
6436 temp
= tempbx
& 0x00FF ; /* RVEQ1EQ=lcdvdes */
6437 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x05 , temp
) ;
6438 temp
= tempcx
& 0x00FF ;
6439 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x06 , temp
) ;
6440 tempch
= ( ( tempcx
& 0xFF00 ) >> 8 ) & 0x07 ;
6441 tempbh
= ( ( tempbx
& 0xFF00 ) >> 8 ) & 0x07 ;
6443 tempah
= tempah
<< 3 ;
6445 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x02 , tempah
) ;
6448 XGI_GetLCDSync( &tempax
, &tempbx
,pVBInfo
) ;
6450 tempax
= pVBInfo
->VT
;
6451 tempbx
= pVBInfo
->LCDVRS
;
6453 /* if ( SetLCD_Info & EnableScalingLCD ) */
6455 if ( tempcx
>= tempax
)
6458 temp
= tempbx
& 0x00FF ; /* RTVACTEE=lcdvrs */
6459 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x04 , temp
) ;
6460 temp
= ( tempbx
& 0xFF00 ) >> 8 ;
6462 temp
|= ( tempcx
& 0x000F ) ;
6463 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x01 , temp
) ;
6465 tempax
= pVBInfo
->HT
;
6466 tempbx
= pVBInfo
->LCDHDES
;
6469 if ( XGI_IsLCDDualLink( pVBInfo
) )
6471 tempax
= tempax
>> 1 ;
6472 tempbx
= tempbx
>> 1 ;
6473 tempcx
= tempcx
>> 1 ;
6476 if ( pVBInfo
->VBType
& VB_XGI302LV
)
6479 if ( pVBInfo
->VBType
& VB_XGI301C
) /* tap4 */
6484 if ( tempcx
>= tempax
)
6487 temp
= tempbx
& 0x00FF ;
6488 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x1F , temp
) ; /* RHBLKE=lcdhdes */
6489 temp
= ( ( tempbx
& 0xFF00 ) >> 8 ) << 4 ;
6490 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x20 , temp
) ;
6491 temp
= tempcx
& 0x00FF ;
6492 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x23 , temp
) ; /* RHEQPLE=lcdhdee */
6493 temp
= ( tempcx
& 0xFF00 ) >> 8 ;
6494 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x25 , temp
) ;
6497 XGI_GetLCDSync( &tempax
, &tempbx
,pVBInfo
) ;
6499 tempax
= pVBInfo
->HT
;
6500 tempbx
= pVBInfo
->LCDHRS
;
6501 /* if ( SetLCD_Info & EnableScalingLCD) */
6502 if ( XGI_IsLCDDualLink( pVBInfo
) )
6504 tempax
= tempax
>> 1 ;
6505 tempbx
= tempbx
>> 1 ;
6506 tempcx
= tempcx
>> 1 ;
6509 if ( pVBInfo
->VBType
& VB_XGI302LV
)
6514 if ( tempcx
>= tempax
)
6517 temp
= tempbx
& 0x00FF ; /* RHBURSTS=lcdhrs */
6518 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x1C , temp
) ;
6520 temp
= ( tempbx
& 0xFF00 ) >> 8 ;
6522 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x1D , ~0x0F0 , temp
) ;
6523 temp
= tempcx
& 0x00FF ; /* RHSYEXP2S=lcdhre */
6524 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x21 , temp
) ;
6526 if ( !( pVBInfo
->LCDInfo
& LCDVESATiming
) )
6528 if ( pVBInfo
->VGAVDE
== 525 )
6530 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
6537 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x2f , temp
) ;
6538 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x30 , 0xB3 ) ;
6541 if ( pVBInfo
->VGAVDE
== 420 )
6543 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
6549 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x2f , temp
) ;
6555 /* --------------------------------------------------------------------- */
6556 /* Function : XGI_GetTap4Ptr */
6558 /* Output : di -> Tap4 Reg. Setting Pointer */
6560 /* --------------------------------------------------------------------- */
6561 XGI301C_Tap4TimingStruct
* XGI_GetTap4Ptr(USHORT tempcx
, PVB_DEVICE_INFO pVBInfo
)
6567 XGI301C_Tap4TimingStruct
*Tap4TimingPtr
;
6571 tempax
= pVBInfo
->VGAHDE
;
6572 tempbx
= pVBInfo
->HDE
;
6576 tempax
= pVBInfo
->VGAVDE
;
6577 tempbx
= pVBInfo
->VDE
;
6580 if ( tempax
< tempbx
)
6581 return &EnlargeTap4Timing
[ 0 ] ;
6582 else if( tempax
== tempbx
)
6583 return &NoScaleTap4Timing
[ 0 ] ; /* 1:1 */
6585 Tap4TimingPtr
= NTSCTap4Timing
; /* NTSC */
6587 if ( pVBInfo
->TVInfo
& SetPALTV
)
6588 Tap4TimingPtr
= PALTap4Timing
;
6591 if ( pVBInfo
->VBInfo
& SetCRT2ToYPbPr
)
6593 if ( pVBInfo
->TVInfo
& SetYPbPrMode525i
)
6594 Tap4TimingPtr
= YPbPr525iTap4Timing
;
6595 if ( pVBInfo
->TVInfo
& SetYPbPrMode525p
)
6596 Tap4TimingPtr
= YPbPr525pTap4Timing
;
6597 if ( pVBInfo
->TVInfo
& SetYPbPrMode750p
)
6598 Tap4TimingPtr
= YPbPr750pTap4Timing
;
6601 if ( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
)
6602 Tap4TimingPtr
= HiTVTap4Timing
;
6605 while( Tap4TimingPtr
[ i
].DE
!= 0xFFFF )
6607 if ( Tap4TimingPtr
[ i
].DE
== tempax
)
6611 return &Tap4TimingPtr
[ i
] ;
6615 /* --------------------------------------------------------------------- */
6616 /* Function : XGI_SetTap4Regs */
6620 /* --------------------------------------------------------------------- */
6621 void XGI_SetTap4Regs( PVB_DEVICE_INFO pVBInfo
)
6626 XGI301C_Tap4TimingStruct
*Tap4TimingPtr
;
6628 if ( !( pVBInfo
->VBType
& VB_XGI301C
) )
6632 XGINew_SetRegAND( pVBInfo
->Part2Port
, 0x4E , 0xEB ) ; /* Disable Tap4 */
6633 #else /* Tap4 Setting */
6635 Tap4TimingPtr
= XGI_GetTap4Ptr( 0 , pVBInfo
) ; /* Set Horizontal Scaling */
6636 for( i
= 0x80 , j
= 0 ; i
<= 0xBF ; i
++ , j
++ )
6637 XGINew_SetReg1( pVBInfo
->Part2Port
, i
, Tap4TimingPtr
->Reg
[ j
] ) ;
6639 if ( ( pVBInfo
->VBInfo
& SetCRT2ToTV
) && ( !( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
) ) )
6641 Tap4TimingPtr
= XGI_GetTap4Ptr( 1 , pVBInfo
); /* Set Vertical Scaling */
6642 for( i
= 0xC0 , j
= 0 ; i
< 0xFF ; i
++ , j
++ )
6643 XGINew_SetReg1( pVBInfo
->Part2Port
, i
, Tap4TimingPtr
->Reg
[ j
] ) ;
6646 if ( ( pVBInfo
->VBInfo
& SetCRT2ToTV
) && ( !( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
) ) )
6647 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x4E , ~0x14 , 0x04 ) ; /* Enable V.Scaling */
6649 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x4E , ~0x14 , 0x10 ) ; /* Enable H.Scaling */
6653 /* --------------------------------------------------------------------- */
6654 /* Function : XGI_SetGroup3 */
6658 /* --------------------------------------------------------------------- */
6659 void XGI_SetGroup3(USHORT ModeNo
,USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
)
6667 modeflag
= pVBInfo
->SModeIDTable
[ModeIdIndex
].St_ModeFlag
; /* si+St_ResInfo */
6671 modeflag
= pVBInfo
->EModeIDTable
[ModeIdIndex
].Ext_ModeFlag
; /* si+Ext_ResInfo */
6675 XGINew_SetReg1(pVBInfo
->Part3Port
,0x00,0x00);
6676 if(pVBInfo
->TVInfo
&SetPALTV
)
6678 XGINew_SetReg1(pVBInfo
->Part3Port
,0x13,0xFA);
6679 XGINew_SetReg1(pVBInfo
->Part3Port
,0x14,0xC8);
6683 XGINew_SetReg1(pVBInfo
->Part3Port
,0x13,0xF5);
6684 XGINew_SetReg1(pVBInfo
->Part3Port
,0x14,0xB7);
6687 if(!(pVBInfo
->VBInfo
&SetCRT2ToTV
))
6692 if(pVBInfo
->TVInfo
&SetPALMTV
)
6694 XGINew_SetReg1(pVBInfo
->Part3Port
,0x13,0xFA);
6695 XGINew_SetReg1(pVBInfo
->Part3Port
,0x14,0xC8);
6696 XGINew_SetReg1(pVBInfo
->Part3Port
,0x3D,0xA8);
6699 if((pVBInfo
->VBInfo
&SetCRT2ToHiVisionTV
)|| (pVBInfo
->VBInfo
&SetCRT2ToYPbPr
))
6701 if(pVBInfo
->TVInfo
& SetYPbPrMode525i
)
6705 tempdi
=pVBInfo
->HiTVGroup3Data
;
6706 if(pVBInfo
->SetFlag
&TVSimuMode
)
6708 tempdi
=pVBInfo
->HiTVGroup3Simu
;
6709 if(!(modeflag
&Charx8Dot
))
6711 tempdi
=pVBInfo
->HiTVGroup3Text
;
6715 if(pVBInfo
->TVInfo
& SetYPbPrMode525p
)
6717 tempdi
=pVBInfo
->Ren525pGroup3
;
6719 if(pVBInfo
->TVInfo
& SetYPbPrMode750p
)
6721 tempdi
=pVBInfo
->Ren750pGroup3
;
6724 for(i
=0;i
<=0x3E;i
++)
6726 XGINew_SetReg1(pVBInfo
->Part3Port
,i
,tempdi
[i
]);
6728 if(pVBInfo
->VBType
&VB_XGI301C
) /* Marcovision */
6730 if(pVBInfo
->TVInfo
& SetYPbPrMode525p
)
6732 XGINew_SetReg1(pVBInfo
->Part3Port
,0x28,0x3f);
6737 } /* {end of XGI_SetGroup3} */
6740 /* --------------------------------------------------------------------- */
6741 /* Function : XGI_SetGroup4 */
6745 /* --------------------------------------------------------------------- */
6746 void XGI_SetGroup4(USHORT ModeNo
,USHORT ModeIdIndex
,USHORT RefreshRateTableIndex
,PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
)
6760 if ( ModeNo
<= 0x13 )
6762 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
; /* si+St_ResInfo */
6766 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
; /* si+Ext_ResInfo */
6769 temp
= pVBInfo
->RVBHCFACT
;
6770 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x13 , temp
) ;
6772 tempbx
= pVBInfo
->RVBHCMAX
;
6773 temp
= tempbx
& 0x00FF ;
6774 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x14 , temp
) ;
6775 temp2
= ( ( tempbx
& 0xFF00 ) >> 8 ) << 7 ;
6776 tempcx
= pVBInfo
->VGAHT
- 1 ;
6777 temp
= tempcx
& 0x00FF ;
6778 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x16 , temp
) ;
6780 temp
=( ( tempcx
& 0xFF00 ) >> 8 ) << 3 ;
6783 tempcx
= pVBInfo
->VGAVT
- 1 ;
6784 if ( !( pVBInfo
->VBInfo
& SetCRT2ToTV
) )
6789 temp
= tempcx
& 0x00FF ;
6790 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x17 , temp
) ;
6791 temp
= temp2
| ( ( tempcx
& 0xFF00 ) >> 8 ) ;
6792 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x15 , temp
) ;
6793 XGINew_SetRegOR( pVBInfo
->Part4Port
, 0x0D , 0x08 ) ;
6794 tempcx
= pVBInfo
->VBInfo
;
6795 tempbx
= pVBInfo
->VGAHDE
;
6797 if ( modeflag
& HalfDCLK
)
6799 tempbx
= tempbx
>> 1 ;
6802 if ( XGI_IsLCDDualLink( pVBInfo
) )
6803 tempbx
= tempbx
>> 1 ;
6805 if(tempcx
&SetCRT2ToHiVisionTV
)
6813 else if(tempcx
&SetCRT2ToTV
)
6822 if(pVBInfo
->VBInfo
&SetCRT2ToLCD
)
6830 if ( pVBInfo
->TVInfo
& ( SetYPbPrMode525p
| SetYPbPrMode750p
) )
6833 if ( pVBInfo
->VGAHDE
== 1280 )
6835 if ( pVBInfo
->VGAHDE
== 1024 )
6838 XGINew_SetRegANDOR( pVBInfo
->Part4Port
, 0x0E , ~0xEF , temp
) ;
6840 tempebx
= pVBInfo
->VDE
;
6842 if ( tempcx
& SetCRT2ToHiVisionTV
)
6844 if ( !( temp
& 0xE000 ) )
6845 tempbx
= tempbx
>> 1 ;
6848 tempcx
= pVBInfo
->RVBHRS
;
6849 temp
= tempcx
& 0x00FF ;
6850 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x18 , temp
);
6852 tempeax
= pVBInfo
->VGAVDE
;
6856 if ( tempeax
<= tempebx
)
6858 tempcx
=(tempcx
&(~0x4000));
6859 tempeax
= pVBInfo
->VGAVDE
;
6863 tempeax
-= tempebx
;
6867 templong
= ( tempeax
* 256 * 1024 ) % tempebx
;
6868 tempeax
= ( tempeax
* 256 * 1024 ) / tempebx
;
6871 if ( templong
!= 0 )
6877 temp
= ( USHORT
)( tempebx
& 0x000000FF ) ;
6878 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x1B , temp
) ;
6880 temp
= ( USHORT
)( ( tempebx
& 0x0000FF00 ) >> 8 ) ;
6881 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x1A , temp
) ;
6882 tempbx
= ( USHORT
)( tempebx
>> 16 ) ;
6883 temp
= tempbx
& 0x00FF ;
6885 temp
|= ( ( tempcx
& 0xFF00 ) >> 8 ) ;
6886 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x19 , temp
) ;
6889 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
6892 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x1C , temp
) ;
6893 tempax
= pVBInfo
->VGAHDE
;
6894 if ( modeflag
& HalfDCLK
)
6896 tempax
= tempax
>> 1 ;
6899 if ( XGI_IsLCDDualLink( pVBInfo
) )
6900 tempax
= tempax
>> 1 ;
6902 /* if((pVBInfo->VBInfo&(SetCRT2ToLCD))||((pVBInfo->TVInfo&SetYPbPrMode525p)||(pVBInfo->TVInfo&SetYPbPrMode750p))) { */
6903 if ( pVBInfo
->VBInfo
& SetCRT2ToLCD
)
6910 if ( pVBInfo
->VGAHDE
> 800 )
6912 if ( pVBInfo
->VGAHDE
== 1024 )
6913 tempax
= ( tempax
* 25 / 32 ) - 1 ;
6915 tempax
= ( tempax
* 20 / 32 ) - 1 ;
6921 if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToHiVisionTV ) )
6923 if ( pVBInfo->VBType & VB_XGI301LV )
6925 if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) )
6927 if ( pVBInfo->VGAHDE > 800 )
6929 if ( pVBInfo->VGAHDE == 1024 )
6930 tempax = ( tempax * 25 / 32 ) - 1 ;
6932 tempax = ( tempax * 20 / 32 ) - 1 ;
6938 if ( pVBInfo->VGAHDE > 800 )
6940 if ( pVBInfo->VGAHDE == 1024 )
6941 tempax = ( tempax * 25 / 32 ) - 1 ;
6943 tempax = ( tempax * 20 / 32 ) - 1 ;
6949 temp
= ( tempax
& 0xFF00 ) >> 8 ;
6950 temp
= ( ( temp
& 0x0003 ) << 4 ) ;
6951 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x1E , temp
) ;
6952 temp
= ( tempax
& 0x00FF ) ;
6953 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x1D , temp
) ;
6955 if ( pVBInfo
->VBInfo
& ( SetCRT2ToTV
| SetCRT2ToHiVisionTV
) )
6957 if ( pVBInfo
->VGAHDE
> 800 )
6959 XGINew_SetRegOR( pVBInfo
->Part4Port
, 0x1E , 0x08 ) ;
6964 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
6966 if ( !( pVBInfo
->TVInfo
& ( NTSC1024x768
| SetYPbPrMode525p
| SetYPbPrMode750p
| SetYPbPrMode1080i
) ) )
6969 if ( ( pVBInfo
->VBInfo
& SetInSlaveMode
) && ( !( pVBInfo
->TVInfo
& TVSimuMode
) ) )
6970 temp
&= ( ~0x0001 ) ;
6974 XGINew_SetRegANDOR( pVBInfo
->Part4Port
, 0x1F , 0x00C0 , temp
) ;
6975 tempbx
= pVBInfo
->HT
;
6976 if ( XGI_IsLCDDualLink( pVBInfo
) )
6977 tempbx
= tempbx
>> 1 ;
6978 tempbx
= ( tempbx
>> 1 ) - 2 ;
6979 temp
= ( ( tempbx
& 0x0700 ) >> 8 ) << 3 ;
6980 XGINew_SetRegANDOR( pVBInfo
->Part4Port
, 0x21 , 0x00C0 , temp
) ;
6981 temp
= tempbx
& 0x00FF ;
6982 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x22 , temp
) ;
6986 if ( pVBInfo
->ISXPDOS
== 0 )
6987 XGI_SetCRT2VCLK( ModeNo
, ModeIdIndex
, RefreshRateTableIndex
, pVBInfo
) ;
6991 /* --------------------------------------------------------------------- */
6992 /* Function : XGI_SetGroup5 */
6996 /* --------------------------------------------------------------------- */
6997 void XGI_SetGroup5( USHORT ModeNo
, USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
)
7002 Pindex
= pVBInfo
->Part5Port
;
7003 Pdata
= pVBInfo
->Part5Port
+ 1 ;
7004 if ( pVBInfo
->ModeType
== ModeVGA
)
7006 if ( !( pVBInfo
->VBInfo
& ( SetInSlaveMode
| LoadDACFlag
| CRT2DisplayFlag
) ) )
7008 XGINew_EnableCRT2(pVBInfo
) ;
7009 /* LoadDAC2(pVBInfo->Part5Port,ModeNo,ModeIdIndex); */
7016 /* --------------------------------------------------------------------- */
7017 /* Function : XGI_GetLcdPtr */
7021 /* --------------------------------------------------------------------- */
7022 void* XGI_GetLcdPtr( USHORT BX
, USHORT ModeNo
, USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
)
7032 XGI330_LCDDataTablStruct
*tempdi
= 0 ;
7037 if ( ModeNo
<= 0x13 )
7039 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
;
7040 tempal
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_CRT2CRTC
;
7044 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
;
7045 tempal
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRT2CRTC
;
7048 tempal
= tempal
& 0x0f ;
7050 if ( tempbx
<= 1 ) /* ExpLink */
7052 if ( ModeNo
<= 0x13 )
7054 tempal
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_CRT2CRTC
; /* find no Ext_CRT2CRTC2 */
7058 tempal
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRT2CRTC
;
7061 if ( pVBInfo
->VBInfo
& SetCRT2ToLCDA
)
7063 if ( ModeNo
<= 0x13 )
7064 tempal
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_CRT2CRTC2
;
7066 tempal
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRT2CRTC2
;
7069 if ( tempbx
& 0x01 )
7070 tempal
= ( tempal
>> 4 ) ;
7072 tempal
= ( tempal
& 0x0f ) ;
7075 tempcx
= LCDLenList
[ tempbx
] ; /* mov cl,byte ptr cs:LCDLenList[bx] */
7077 if ( pVBInfo
->LCDInfo
& EnableScalingLCD
) /* ScaleLCD */
7079 if ( ( tempbx
== 5 ) || ( tempbx
) == 7 )
7080 tempcx
= LCDDesDataLen2
;
7081 else if ( ( tempbx
== 3 ) || ( tempbx
== 8 ) )
7082 tempcx
= LVDSDesDataLen2
;
7084 /* mov di, word ptr cs:LCDDataList[bx] */
7085 /* tempdi=pVideoMemory[LCDDataList+tempbx*2]|(pVideoMemory[LCDDataList+tempbx*2+1]<<8); */
7090 tempdi
= XGI_EPLLCDCRT1Ptr_H
;
7093 tempdi
= XGI_EPLLCDCRT1Ptr_V
;
7096 tempdi
= XGI_EPLLCDDataPtr
;
7099 tempdi
= XGI_EPLLCDDesDataPtr
;
7102 tempdi
= XGI_LCDDataTable
;
7105 tempdi
= XGI_LCDDesDataTable
;
7108 tempdi
= XGI_EPLCHLCDRegPtr
;
7119 if ( tempdi
== 0x00 ) /* OEMUtil */
7125 while( tempdi
[ i
].PANELID
!= 0xff )
7127 tempdx
= pVBInfo
->LCDResInfo
;
7128 if ( tempbx
& 0x0080 ) /* OEMUtil */
7130 tempbx
&= ( ~0x0080 ) ;
7131 tempdx
= pVBInfo
->LCDTypeInfo
;
7134 if ( pVBInfo
->LCDInfo
& EnableScalingLCD
)
7135 tempdx
&= ( ~PanelResInfo
) ;
7137 if ( tempdi
[ i
].PANELID
== tempdx
)
7139 tempbx
= tempdi
[ i
].MASK
;
7140 tempdx
= pVBInfo
->LCDInfo
;
7142 if ( ModeNo
<= 0x13 ) /* alan 09/10/2003 */
7143 tempdx
|= SetLCDStdMode
;
7145 if ( modeflag
& HalfDCLK
)
7146 tempdx
|= SetLCDLowResolution
;
7149 if ( tempbx
== tempdi
[ i
].CAP
)
7157 switch( tempdi
[ i
].DATAPTR
)
7160 return &XGI_LVDSCRT11024x768_1_H
[ tempal
] ;
7163 return &XGI_LVDSCRT11024x768_2_H
[ tempal
] ;
7166 return &XGI_LVDSCRT11280x1024_1_H
[ tempal
] ;
7169 return &XGI_LVDSCRT11280x1024_2_H
[ tempal
] ;
7172 return &XGI_LVDSCRT11400x1050_1_H
[ tempal
] ;
7175 return &XGI_LVDSCRT11400x1050_2_H
[ tempal
] ;
7178 return &XGI_LVDSCRT11600x1200_1_H
[ tempal
] ;
7181 return &XGI_LVDSCRT11024x768_1_Hx75
[ tempal
] ;
7184 return &XGI_LVDSCRT11024x768_2_Hx75
[ tempal
] ;
7187 return &XGI_LVDSCRT11280x1024_1_Hx75
[ tempal
] ;
7190 return &XGI_LVDSCRT11280x1024_2_Hx75
[ tempal
] ;
7196 else if ( table
== 1 )
7198 switch( tempdi
[ i
].DATAPTR
)
7201 return &XGI_LVDSCRT11024x768_1_V
[ tempal
] ;
7204 return &XGI_LVDSCRT11024x768_2_V
[ tempal
] ;
7207 return &XGI_LVDSCRT11280x1024_1_V
[ tempal
] ;
7210 return &XGI_LVDSCRT11280x1024_2_V
[ tempal
] ;
7213 return &XGI_LVDSCRT11400x1050_1_V
[ tempal
] ;
7216 return &XGI_LVDSCRT11400x1050_2_V
[ tempal
] ;
7219 return &XGI_LVDSCRT11600x1200_1_V
[ tempal
] ;
7222 return &XGI_LVDSCRT11024x768_1_Vx75
[ tempal
] ;
7225 return &XGI_LVDSCRT11024x768_2_Vx75
[ tempal
] ;
7228 return &XGI_LVDSCRT11280x1024_1_Vx75
[ tempal
] ;
7231 return &XGI_LVDSCRT11280x1024_2_Vx75
[ tempal
] ;
7237 else if ( table
== 2 )
7239 switch( tempdi
[ i
].DATAPTR
)
7242 return &XGI_LVDS1024x768Data_1
[ tempal
] ;
7245 return &XGI_LVDS1024x768Data_2
[ tempal
] ;
7248 return &XGI_LVDS1280x1024Data_1
[ tempal
] ;
7251 return &XGI_LVDS1280x1024Data_2
[ tempal
] ;
7254 return &XGI_LVDS1400x1050Data_1
[ tempal
] ;
7257 return &XGI_LVDS1400x1050Data_2
[ tempal
] ;
7260 return &XGI_LVDS1600x1200Data_1
[ tempal
] ;
7263 return &XGI_LVDSNoScalingData
[ tempal
] ;
7266 return &XGI_LVDS1024x768Data_1x75
[ tempal
] ;
7269 return &XGI_LVDS1024x768Data_2x75
[ tempal
] ;
7272 return &XGI_LVDS1280x1024Data_1x75
[ tempal
] ;
7275 return &XGI_LVDS1280x1024Data_2x75
[ tempal
] ;
7278 return &XGI_LVDSNoScalingDatax75
[ tempal
] ;
7284 else if ( table
== 3 )
7286 switch( tempdi
[ i
].DATAPTR
)
7289 return &XGI_LVDS1024x768Des_1
[ tempal
] ;
7292 return &XGI_LVDS1024x768Des_3
[ tempal
] ;
7295 return &XGI_LVDS1024x768Des_2
[ tempal
] ;
7298 return &XGI_LVDS1280x1024Des_1
[ tempal
] ;
7301 return &XGI_LVDS1280x1024Des_2
[ tempal
] ;
7304 return &XGI_LVDS1400x1050Des_1
[ tempal
] ;
7307 return &XGI_LVDS1400x1050Des_2
[ tempal
] ;
7310 return &XGI_LVDS1600x1200Des_1
[ tempal
] ;
7313 return &XGI_LVDSNoScalingDesData
[ tempal
] ;
7316 return &XGI_LVDS1024x768Des_1x75
[ tempal
] ;
7319 return &XGI_LVDS1024x768Des_3x75
[ tempal
] ;
7322 return &XGI_LVDS1024x768Des_2x75
[ tempal
] ;
7325 return &XGI_LVDS1280x1024Des_1x75
[ tempal
] ;
7328 return &XGI_LVDS1280x1024Des_2x75
[ tempal
] ;
7331 return &XGI_LVDSNoScalingDesDatax75
[ tempal
] ;
7337 else if ( table
== 4 )
7339 switch( tempdi
[ i
].DATAPTR
)
7342 return &XGI_ExtLCD1024x768Data
[ tempal
] ;
7345 return &XGI_StLCD1024x768Data
[ tempal
] ;
7348 return &XGI_CetLCD1024x768Data
[ tempal
] ;
7351 return &XGI_ExtLCD1280x1024Data
[ tempal
] ;
7354 return &XGI_StLCD1280x1024Data
[ tempal
] ;
7357 return &XGI_CetLCD1280x1024Data
[ tempal
] ;
7360 return &XGI_ExtLCD1400x1050Data
[ tempal
] ;
7363 return &XGI_StLCD1400x1050Data
[ tempal
] ;
7366 return &XGI_CetLCD1400x1050Data
[ tempal
] ;
7369 return &XGI_ExtLCD1600x1200Data
[ tempal
] ;
7372 return &XGI_StLCD1600x1200Data
[ tempal
] ;
7375 return &XGI_NoScalingData
[ tempal
] ;
7378 return &XGI_ExtLCD1024x768x75Data
[ tempal
] ;
7381 return &XGI_ExtLCD1024x768x75Data
[ tempal
] ;
7384 return &XGI_CetLCD1024x768x75Data
[ tempal
] ;
7387 return &XGI_ExtLCD1280x1024x75Data
[ tempal
] ;
7390 return &XGI_StLCD1280x1024x75Data
[ tempal
] ;
7393 return &XGI_CetLCD1280x1024x75Data
[ tempal
] ;
7396 return &XGI_NoScalingDatax75
[ tempal
] ;
7402 else if ( table
== 5 )
7404 switch( tempdi
[ i
].DATAPTR
)
7407 return &XGI_ExtLCDDes1024x768Data
[ tempal
] ;
7410 return &XGI_StLCDDes1024x768Data
[ tempal
] ;
7413 return &XGI_CetLCDDes1024x768Data
[ tempal
] ;
7416 if ( ( pVBInfo
->VBType
& VB_XGI301LV
) || ( pVBInfo
->VBType
& VB_XGI302LV
) )
7417 return &XGI_ExtLCDDLDes1280x1024Data
[ tempal
] ;
7419 return &XGI_ExtLCDDes1280x1024Data
[ tempal
] ;
7422 if ( ( pVBInfo
->VBType
& VB_XGI301LV
) || ( pVBInfo
->VBType
& VB_XGI302LV
) )
7423 return &XGI_StLCDDLDes1280x1024Data
[ tempal
] ;
7425 return &XGI_StLCDDes1280x1024Data
[ tempal
] ;
7428 if ( ( pVBInfo
->VBType
& VB_XGI301LV
) || ( pVBInfo
->VBType
& VB_XGI302LV
) )
7429 return &XGI_CetLCDDLDes1280x1024Data
[ tempal
] ;
7431 return &XGI_CetLCDDes1280x1024Data
[ tempal
] ;
7434 if ( ( pVBInfo
->VBType
& VB_XGI301LV
) || ( pVBInfo
->VBType
& VB_XGI302LV
) )
7435 return &XGI_ExtLCDDLDes1400x1050Data
[ tempal
] ;
7437 return &XGI_ExtLCDDes1400x1050Data
[ tempal
] ;
7440 if ( ( pVBInfo
->VBType
& VB_XGI301LV
) || ( pVBInfo
->VBType
& VB_XGI302LV
) )
7441 return &XGI_StLCDDLDes1400x1050Data
[ tempal
] ;
7443 return &XGI_StLCDDes1400x1050Data
[ tempal
] ;
7446 return &XGI_CetLCDDes1400x1050Data
[ tempal
] ;
7449 return &XGI_CetLCDDes1400x1050Data2
[ tempal
] ;
7452 if ( ( pVBInfo
->VBType
& VB_XGI301LV
) || ( pVBInfo
->VBType
& VB_XGI302LV
) )
7453 return &XGI_ExtLCDDLDes1600x1200Data
[ tempal
] ;
7455 return &XGI_ExtLCDDes1600x1200Data
[ tempal
] ;
7458 if ( ( pVBInfo
->VBType
& VB_XGI301LV
) || ( pVBInfo
->VBType
& VB_XGI302LV
) )
7459 return &XGI_StLCDDLDes1600x1200Data
[ tempal
] ;
7461 return &XGI_StLCDDes1600x1200Data
[ tempal
] ;
7464 return &XGI_NoScalingDesData
[ tempal
] ;
7467 return &XGI_ExtLCDDes1024x768x75Data
[ tempal
] ;
7470 return &XGI_StLCDDes1024x768x75Data
[ tempal
] ;
7473 return &XGI_CetLCDDes1024x768x75Data
[ tempal
] ;
7476 if ( ( pVBInfo
->VBType
& VB_XGI301LV
) || ( pVBInfo
->VBType
& VB_XGI302LV
) )
7477 return &XGI_ExtLCDDLDes1280x1024x75Data
[ tempal
] ;
7479 return &XGI_ExtLCDDes1280x1024x75Data
[ tempal
] ;
7482 if ( ( pVBInfo
->VBType
& VB_XGI301LV
) || ( pVBInfo
->VBType
& VB_XGI302LV
) )
7483 return &XGI_StLCDDLDes1280x1024x75Data
[ tempal
] ;
7485 return &XGI_StLCDDes1280x1024x75Data
[ tempal
] ;
7488 if ( ( pVBInfo
->VBType
& VB_XGI301LV
) || ( pVBInfo
->VBType
& VB_XGI302LV
) )
7489 return &XGI_CetLCDDLDes1280x1024x75Data
[ tempal
] ;
7491 return &XGI_CetLCDDes1280x1024x75Data
[ tempal
] ;
7494 return &XGI_NoScalingDesDatax75
[ tempal
] ;
7500 else if ( table
== 6 )
7502 switch( tempdi
[ i
].DATAPTR
)
7505 return &XGI_CH7017LV1024x768
[ tempal
] ;
7508 return &XGI_CH7017LV1400x1050
[ tempal
] ;
7518 /* --------------------------------------------------------------------- */
7519 /* Function : XGI_GetTVPtr */
7523 /* --------------------------------------------------------------------- */
7524 void* XGI_GetTVPtr (USHORT BX
,USHORT ModeNo
,USHORT ModeIdIndex
,USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
)
7526 USHORT i
, tempdx
, tempbx
, tempal
, modeflag
, table
;
7527 XGI330_TVDataTablStruct
*tempdi
= 0 ;
7531 if ( ModeNo
<= 0x13 )
7533 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
;
7534 tempal
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_CRT2CRTC
;
7538 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
;
7539 tempal
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRT2CRTC
;
7542 tempal
= tempal
& 0x3f ;
7548 tempdi
= 0 ; /*EPLCHTVCRT1Ptr_H;*/
7549 if ( pVBInfo
->IF_DEF_CH7007
== 1 )
7551 tempdi
= XGI_EPLCHTVCRT1Ptr
;
7555 tempdi
= 0 ; /*EPLCHTVCRT1Ptr_V;*/
7556 if ( pVBInfo
->IF_DEF_CH7007
== 1 )
7558 tempdi
= XGI_EPLCHTVCRT1Ptr
;
7562 tempdi
= XGI_EPLCHTVDataPtr
;
7568 tempdi
= XGI_TVDataTable
;
7574 tempdi
= XGI_EPLCHTVRegPtr
;
7580 if ( tempdi
== 0x00 ) /* OEMUtil */
7583 tempdx
= pVBInfo
->TVInfo
;
7585 if ( pVBInfo
->VBInfo
& SetInSlaveMode
)
7586 tempdx
= tempdx
| SetTVLockMode
;
7588 if ( modeflag
& HalfDCLK
)
7589 tempdx
= tempdx
| SetTVLowResolution
;
7593 while( tempdi
[ i
].MASK
!= 0xffff )
7595 if ( ( tempdx
& tempdi
[ i
].MASK
) == tempdi
[ i
].CAP
)
7600 if ( table
== 0x00 ) /* 07/05/22 */
7603 else if ( table
== 0x01 )
7606 else if ( table
== 0x04 )
7608 switch( tempdi
[ i
].DATAPTR
)
7611 return &XGI_ExtPALData
[ tempal
] ;
7614 return &XGI_ExtNTSCData
[ tempal
] ;
7617 return &XGI_StPALData
[ tempal
] ;
7620 return &XGI_StNTSCData
[ tempal
] ;
7623 return &XGI_ExtHiTVData
[ tempal
] ;
7626 return &XGI_St2HiTVData
[ tempal
] ;
7629 return &XGI_ExtYPbPr525iData
[ tempal
] ;
7632 return &XGI_ExtYPbPr525pData
[ tempal
] ;
7635 return &XGI_ExtYPbPr750pData
[ tempal
] ;
7638 return &XGI_StYPbPr525iData
[ tempal
] ;
7641 return &XGI_StYPbPr525pData
[ tempal
] ;
7644 return &XGI_StYPbPr750pData
[ tempal
] ;
7646 case 12: /* avoid system hang */
7647 return &XGI_ExtNTSCData
[ tempal
] ;
7650 return &XGI_St1HiTVData
[ tempal
] ;
7656 else if( table
== 0x02 )
7658 switch( tempdi
[ i
].DATAPTR
)
7661 return &XGI_CHTVUNTSCData
[ tempal
] ;
7664 return &XGI_CHTVONTSCData
[ tempal
] ;
7667 return &XGI_CHTVUPALData
[ tempal
] ;
7670 return &XGI_CHTVOPALData
[ tempal
] ;
7676 else if( table
== 0x06 )
7683 /* --------------------------------------------------------------------- */
7684 /* Function : XGI_BacklightByDrv */
7686 /* Output : 1 -> Skip backlight control */
7688 /* --------------------------------------------------------------------- */
7689 BOOLEAN
XGI_BacklightByDrv( PVB_DEVICE_INFO pVBInfo
)
7693 tempah
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3d4
, 0x3A ) ;
7694 if (tempah
& BacklightControlBit
)
7701 /* --------------------------------------------------------------------- */
7702 /* Function : XGI_FirePWDDisable */
7705 /* Description : Turn off VDD & Backlight : Fire disable procedure */
7706 /* --------------------------------------------------------------------- */
7708 void XGI_FirePWDDisable( PVB_DEVICE_INFO pVBInfo )
7710 XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x26 , 0x00 , 0xFC ) ;
7714 /* --------------------------------------------------------------------- */
7715 /* Function : XGI_FirePWDEnable */
7718 /* Description : Turn on VDD & Backlight : Fire enable procedure */
7719 /* --------------------------------------------------------------------- */
7720 void XGI_FirePWDEnable(PVB_DEVICE_INFO pVBInfo
)
7722 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x26 , 0x03 , 0xFC ) ;
7726 /* --------------------------------------------------------------------- */
7727 /* Function : XGI_EnableGatingCRT */
7731 /* --------------------------------------------------------------------- */
7732 void XGI_EnableGatingCRT(PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
)
7734 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x63 , 0xBF , 0x40 ) ;
7738 /* --------------------------------------------------------------------- */
7739 /* Function : XGI_DisableGatingCRT */
7743 /* --------------------------------------------------------------------- */
7744 void XGI_DisableGatingCRT(PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
)
7747 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x63 , 0xBF , 0x00 ) ;
7751 /* --------------------------------------------------------------------- */
7752 /* Function : XGI_SetPanelDelay */
7756 /* I/P : bl : 1 ; T1 : the duration between CPL on and signal on */
7757 /* : bl : 2 ; T2 : the duration signal on and Vdd on */
7758 /* : bl : 3 ; T3 : the duration between CPL off and signal off */
7759 /* : bl : 4 ; T4 : the duration signal off and Vdd off */
7760 /* --------------------------------------------------------------------- */
7761 void XGI_SetPanelDelay(USHORT tempbl
, PVB_DEVICE_INFO pVBInfo
)
7765 index
= XGI_GetLCDCapPtr(pVBInfo
) ;
7768 XGINew_LCD_Wait_Time( pVBInfo
->LCDCapList
[ index
].PSC_S1
, pVBInfo
) ;
7771 XGINew_LCD_Wait_Time( pVBInfo
->LCDCapList
[ index
].PSC_S2
, pVBInfo
) ;
7774 XGINew_LCD_Wait_Time( pVBInfo
->LCDCapList
[ index
].PSC_S3
, pVBInfo
) ;
7777 XGINew_LCD_Wait_Time( pVBInfo
->LCDCapList
[ index
].PSC_S4
, pVBInfo
) ;
7781 /* --------------------------------------------------------------------- */
7782 /* Function : XGI_SetPanelPower */
7786 /* I/O : ah = 0011b = 03h ; Backlight on, Power on */
7787 /* = 0111b = 07h ; Backlight on, Power off */
7788 /* = 1011b = 0Bh ; Backlight off, Power on */
7789 /* = 1111b = 0Fh ; Backlight off, Power off */
7790 /* --------------------------------------------------------------------- */
7791 void XGI_SetPanelPower(USHORT tempah
,USHORT tempbl
, PVB_DEVICE_INFO pVBInfo
)
7793 if ( pVBInfo
->VBType
& ( VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
7794 XGINew_SetRegANDOR( pVBInfo
->Part4Port
, 0x26 , tempbl
, tempah
) ;
7796 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x11 , tempbl
, tempah
) ;
7799 UCHAR
XG21GPIODataTransfer(UCHAR ujDate
)
7807 /* ujRet |= GETBITS(ujDate >> i, 0:0); */
7808 ujRet
|= (ujDate
>> i
) & 1;
7814 /*----------------------------------------------------------------------------*/
7816 /* bl[5] : LVDS signal */
7817 /* bl[1] : LVDS backlight */
7818 /* bl[0] : LVDS VDD */
7819 /*----------------------------------------------------------------------------*/
7820 UCHAR
XGI_XG21GetPSCValue(PVB_DEVICE_INFO pVBInfo
)
7824 CR4A
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x4A ) ;
7825 XGINew_SetRegAND( pVBInfo
->P3d4
, 0x4A , ~0x23 ) ; /* enable GPIO write */
7827 temp
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x48 ) ;
7829 temp
= XG21GPIODataTransfer(temp
);
7831 XGINew_SetReg1( pVBInfo
->P3d4
, 0x4A , CR4A
) ;
7835 /*----------------------------------------------------------------------------*/
7837 /* bl[5] : LVDS signal */
7838 /* bl[1] : LVDS backlight */
7839 /* bl[0] : LVDS VDD */
7840 /*----------------------------------------------------------------------------*/
7841 UCHAR
XGI_XG27GetPSCValue(PVB_DEVICE_INFO pVBInfo
)
7843 UCHAR CR4A
,CRB4
,temp
;
7845 CR4A
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x4A ) ;
7846 XGINew_SetRegAND( pVBInfo
->P3d4
, 0x4A , ~0x0C ) ; /* enable GPIO write */
7848 temp
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x48 ) ;
7852 XGINew_SetReg1( pVBInfo
->P3d4
, 0x4A , CR4A
) ;
7853 CRB4
= XGINew_GetReg1( pVBInfo
->P3d4
, 0xB4 ) ;
7854 temp
|= ((CRB4
&0x04)<<3);
7857 /*----------------------------------------------------------------------------*/
7859 /* bl[5] : 1;LVDS signal on */
7860 /* bl[1] : 1;LVDS backlight on */
7861 /* bl[0] : 1:LVDS VDD on */
7862 /* bh: 100000b : clear bit 5, to set bit5 */
7863 /* 000010b : clear bit 1, to set bit1 */
7864 /* 000001b : clear bit 0, to set bit0 */
7865 /*----------------------------------------------------------------------------*/
7866 void XGI_XG21BLSignalVDD(USHORT tempbh
,USHORT tempbl
, PVB_DEVICE_INFO pVBInfo
)
7870 CR4A
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x4A ) ;
7873 XGINew_SetRegAND( pVBInfo
->P3d4
, 0x4A , ~tempbh
) ; /* enable GPIO write */
7877 temp
= (tempbl
>>4)&0x02;
7879 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0xB4 , ~0x02 , temp
) ; /* CR B4[1] */
7883 temp
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x48 ) ;
7885 temp
= XG21GPIODataTransfer(temp
);
7888 XGINew_SetReg1( pVBInfo
->P3d4
, 0x48 , temp
) ;
7891 void XGI_XG27BLSignalVDD(USHORT tempbh
,USHORT tempbl
, PVB_DEVICE_INFO pVBInfo
)
7894 USHORT tempbh0
,tempbl0
;
7905 temp
= (tempbl
>>4)&0x02;
7907 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0xB4 , ~0x02 , temp
) ; /* CR B4[1] */
7910 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0xB4 , ~tempbh0
, tempbl0
) ;
7912 CR4A
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x4A ) ;
7916 tempbl
<<= 2; /* GPIOC,GPIOD */
7917 XGINew_SetRegAND( pVBInfo
->P3d4
, 0x4A , ~tempbh
) ; /* enable GPIO write */
7918 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x48 , ~tempbh
, tempbl
) ;
7921 /* --------------------------------------------------------------------- */
7922 USHORT
XGI_GetLVDSOEMTableIndex(PVB_DEVICE_INFO pVBInfo
)
7926 index
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x36 ) ;
7927 if (index
<sizeof(XGI21_LCDCapList
)/sizeof(XGI21_LVDSCapStruct
))
7934 /* --------------------------------------------------------------------- */
7935 /* Function : XGI_XG21SetPanelDelay */
7939 /* I/P : bl : 1 ; T1 : the duration between CPL on and signal on */
7940 /* : bl : 2 ; T2 : the duration signal on and Vdd on */
7941 /* : bl : 3 ; T3 : the duration between CPL off and signal off */
7942 /* : bl : 4 ; T4 : the duration signal off and Vdd off */
7943 /* --------------------------------------------------------------------- */
7944 void XGI_XG21SetPanelDelay(USHORT tempbl
, PVB_DEVICE_INFO pVBInfo
)
7948 index
= XGI_GetLVDSOEMTableIndex( pVBInfo
);
7950 XGINew_LCD_Wait_Time( pVBInfo
->XG21_LVDSCapList
[ index
].PSC_S1
, pVBInfo
) ;
7953 XGINew_LCD_Wait_Time( pVBInfo
->XG21_LVDSCapList
[ index
].PSC_S2
, pVBInfo
) ;
7956 XGINew_LCD_Wait_Time( pVBInfo
->XG21_LVDSCapList
[ index
].PSC_S3
, pVBInfo
) ;
7959 XGINew_LCD_Wait_Time( pVBInfo
->XG21_LVDSCapList
[ index
].PSC_S4
, pVBInfo
) ;
7962 BOOLEAN
XGI_XG21CheckLVDSMode(USHORT ModeNo
,USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
)
7971 resindex
= XGI_GetResInfo( ModeNo
, ModeIdIndex
, pVBInfo
) ;
7972 if ( ModeNo
<= 0x13 )
7974 xres
= pVBInfo
->StResInfo
[ resindex
].HTotal
;
7975 yres
= pVBInfo
->StResInfo
[ resindex
].VTotal
;
7976 modeflag
= pVBInfo
->SModeIDTable
[ModeIdIndex
].St_ModeFlag
; /* si+St_ResInfo */
7980 xres
= pVBInfo
->ModeResInfo
[ resindex
].HTotal
; /* xres->ax */
7981 yres
= pVBInfo
->ModeResInfo
[ resindex
].VTotal
; /* yres->bx */
7982 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
; /* si+St_ModeFlag */
7985 if ( !( modeflag
& Charx8Dot
) )
7991 if ( ModeNo
> 0x13 )
7993 if ( ( ModeNo
>0x13 ) && ( modeflag
& HalfDCLK
) )
7997 if ( ( ModeNo
>0x13 ) && ( modeflag
& DoubleScanMode
) )
8003 lvdstableindex
= XGI_GetLVDSOEMTableIndex( pVBInfo
);
8004 if ( xres
> (pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSHDE
) )
8007 if ( yres
> (pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSVDE
) )
8010 if ( ModeNo
> 0x13 )
8012 if ( ( xres
!= (pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSHDE
) ) ||
8013 ( yres
!= (pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSVDE
)) )
8015 colordepth
= XGI_GetColorDepth( ModeNo
, ModeIdIndex
, pVBInfo
) ;
8024 void XGI_SetXG21FPBits(PVB_DEVICE_INFO pVBInfo
)
8028 temp
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x37 ) ; /* D[0] 1: 18bit */
8029 temp
= ( temp
& 1 ) << 6;
8030 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x06 , ~0x40 , temp
) ; /* SR06[6] 18bit Dither */
8031 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x09 , ~0xc0 , temp
| 0x80 ) ; /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: dual 12bits */
8035 void XGI_SetXG27FPBits(PVB_DEVICE_INFO pVBInfo
)
8039 temp
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x37 ) ; /* D[1:0] 01: 18bit, 00: dual 12, 10: single 24 */
8040 temp
= ( temp
& 3 ) << 6;
8041 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x06 , ~0xc0 , temp
& 0x80 ) ; /* SR06[7]0: dual 12/1: single 24 [6] 18bit Dither <= 0 h/w recommend */
8042 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x09 , ~0xc0 , temp
| 0x80 ) ; /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: 24bits */
8046 void XGI_SetXG21LVDSPara(USHORT ModeNo
,USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
)
8048 UCHAR temp
,Miscdata
;
8054 USHORT LVDSHT
,LVDSHBS
,LVDSHRS
,LVDSHRE
,LVDSHBE
;
8055 USHORT LVDSVT
,LVDSVBS
,LVDSVRS
,LVDSVRE
,LVDSVBE
;
8058 lvdstableindex
= XGI_GetLVDSOEMTableIndex( pVBInfo
);
8060 temp
= (UCHAR
) ( ( pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDS_Capability
& (LCDPolarity
<< 8 ) ) >> 8 );
8061 temp
&= LCDPolarity
;
8062 Miscdata
=(UCHAR
) XGINew_GetReg2(pVBInfo
->P3cc
) ;
8064 XGINew_SetReg3( pVBInfo
->P3c2
, (Miscdata
& 0x3F) | temp
) ;
8066 temp
= (UCHAR
) ( pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDS_Capability
& LCDPolarity
) ;
8067 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x35 , ~0x80 , temp
&0x80 ) ; /* SR35[7] FP VSync polarity */
8068 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x30 , ~0x20 , (temp
&0x40)>>1 ) ; /* SR30[5] FP HSync polarity */
8070 XGI_SetXG21FPBits(pVBInfo
);
8071 resindex
= XGI_GetResInfo( ModeNo
, ModeIdIndex
, pVBInfo
) ;
8072 if ( ModeNo
<= 0x13 )
8074 xres
= pVBInfo
->StResInfo
[ resindex
].HTotal
;
8075 yres
= pVBInfo
->StResInfo
[ resindex
].VTotal
;
8076 modeflag
= pVBInfo
->SModeIDTable
[ModeIdIndex
].St_ModeFlag
; /* si+St_ResInfo */
8080 xres
= pVBInfo
->ModeResInfo
[ resindex
].HTotal
; /* xres->ax */
8081 yres
= pVBInfo
->ModeResInfo
[ resindex
].VTotal
; /* yres->bx */
8082 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
; /* si+St_ModeFlag */
8085 if (!( modeflag
& Charx8Dot
))
8086 xres
= xres
* 8 / 9;
8088 LVDSHT
= pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSHT
;
8090 LVDSHBS
= xres
+ ( pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSHDE
- xres
) / 2 ;
8091 if ( ( ModeNo
<=0x13 ) && ( modeflag
& HalfDCLK
) )
8095 if (LVDSHBS
> LVDSHT
) LVDSHBS
-= LVDSHT
;
8097 LVDSHRS
= LVDSHBS
+ pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSHFP
;
8098 if (LVDSHRS
> LVDSHT
) LVDSHRS
-= LVDSHT
;
8100 LVDSHRE
= LVDSHRS
+ pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSHSYNC
;
8101 if (LVDSHRE
> LVDSHT
) LVDSHRE
-= LVDSHT
;
8103 LVDSHBE
= LVDSHBS
+ LVDSHT
- pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSHDE
;
8105 LVDSVT
= pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSVT
;
8107 LVDSVBS
= yres
+ ( pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSVDE
- yres
) / 2 ;
8108 if ( ( ModeNo
>0x13 ) && ( modeflag
& DoubleScanMode
) )
8112 if (LVDSVBS
> LVDSVT
) LVDSVBS
-= LVDSVT
;
8114 LVDSVRS
= LVDSVBS
+ pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSVFP
;
8115 if (LVDSVRS
> LVDSVT
) LVDSVRS
-= LVDSVT
;
8117 LVDSVRE
= LVDSVRS
+ pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSVSYNC
;
8118 if (LVDSVRE
> LVDSVT
) LVDSVRE
-= LVDSVT
;
8120 LVDSVBE
= LVDSVBS
+ LVDSVT
- pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSVDE
;
8122 temp
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3d4
, 0x11 ) ;
8123 XGINew_SetReg1( pVBInfo
->P3d4
, 0x11 , temp
& 0x7f ) ; /* Unlock CRTC */
8125 if (!( modeflag
& Charx8Dot
))
8127 XGINew_SetRegOR( pVBInfo
->P3c4
, 0x1 , 0x1 ) ;
8130 /* HT SR0B[1:0] CR00 */
8131 value
= ( LVDSHT
>> 3 ) - 5;
8132 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0B , ~0x03 , ( value
& 0x300 ) >> 8 ) ;
8133 XGINew_SetReg1( pVBInfo
->P3d4
, 0x0 , (value
& 0xFF) ) ;
8135 /* HBS SR0B[5:4] CR02 */
8136 value
= ( LVDSHBS
>> 3 ) - 1;
8137 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0B , ~0x30 , ( value
& 0x300 ) >> 4 ) ;
8138 XGINew_SetReg1( pVBInfo
->P3d4
, 0x2 , (value
& 0xFF) ) ;
8140 /* HBE SR0C[1:0] CR05[7] CR03[4:0] */
8141 value
= ( LVDSHBE
>> 3 ) - 1;
8142 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0C , ~0x03 , ( value
& 0xC0 ) >> 6 ) ;
8143 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x05 , ~0x80 , ( value
& 0x20 ) << 2 ) ;
8144 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x03 , ~0x1F , value
& 0x1F ) ;
8146 /* HRS SR0B[7:6] CR04 */
8147 value
= ( LVDSHRS
>> 3 ) + 2;
8148 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0B , ~0xC0 , ( value
& 0x300 ) >> 2 ) ;
8149 XGINew_SetReg1( pVBInfo
->P3d4
, 0x4 , (value
& 0xFF) ) ;
8151 /* Panel HRS SR2F[1:0] SR2E[7:0] */
8153 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x2F , ~0x03 , ( value
& 0x300 ) >> 8 ) ;
8154 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2E , (value
& 0xFF) ) ;
8156 /* HRE SR0C[2] CR05[4:0] */
8157 value
= ( LVDSHRE
>> 3 ) + 2;
8158 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0C , ~0x04 , ( value
& 0x20 ) >> 3 ) ;
8159 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x05 , ~0x1F , value
& 0x1F ) ;
8161 /* Panel HRE SR2F[7:2] */
8163 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x2F , ~0xFC , value
<< 2 ) ;
8165 /* VT SR0A[0] CR07[5][0] CR06 */
8166 value
= LVDSVT
- 2 ;
8167 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0A , ~0x01 , ( value
& 0x400 ) >> 10 ) ;
8168 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x07 , ~0x20 , ( value
& 0x200 ) >> 4 ) ;
8169 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x07 , ~0x01 , ( value
& 0x100 ) >> 8 ) ;
8170 XGINew_SetReg1( pVBInfo
->P3d4
, 0x06 , (value
& 0xFF) ) ;
8172 /* VBS SR0A[2] CR09[5] CR07[3] CR15 */
8173 value
= LVDSVBS
- 1 ;
8174 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0A , ~0x04 , ( value
& 0x400 ) >> 8 ) ;
8175 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x09 , ~0x20 , ( value
& 0x200 ) >> 4 ) ;
8176 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x07 , ~0x08 , ( value
& 0x100 ) >> 5 ) ;
8177 XGINew_SetReg1( pVBInfo
->P3d4
, 0x15 , (value
& 0xFF) ) ;
8179 /* VBE SR0A[4] CR16 */
8180 value
= LVDSVBE
- 1;
8181 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0A , ~0x10 , ( value
& 0x100 ) >> 4 ) ;
8182 XGINew_SetReg1( pVBInfo
->P3d4
, 0x16 , (value
& 0xFF) ) ;
8184 /* VRS SR0A[3] CR7[7][2] CR10 */
8185 value
= LVDSVRS
- 1 ;
8186 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0A , ~0x08 , ( value
& 0x400 ) >> 7 ) ;
8187 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x07 , ~0x80 , ( value
& 0x200 ) >> 2 ) ;
8188 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x07 , ~0x04 , ( value
& 0x100 ) >> 6 ) ;
8189 XGINew_SetReg1( pVBInfo
->P3d4
, 0x10 , (value
& 0xFF) ) ;
8191 /* Panel VRS SR3F[1:0] SR34[7:0] SR33[0] */
8192 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x3F , ~0x03 , ( value
& 0x600 ) >> 9 ) ;
8193 XGINew_SetReg1( pVBInfo
->P3c4
, 0x34 , (value
>> 1) & 0xFF ) ;
8194 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x33 , ~0x01 , value
& 0x01 ) ;
8196 /* VRE SR0A[5] CR11[3:0] */
8197 value
= LVDSVRE
- 1;
8198 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0A , ~0x20 , ( value
& 0x10 ) << 1 ) ;
8199 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x11 , ~0x0F , value
& 0x0F ) ;
8201 /* Panel VRE SR3F[7:2] */ /* SR3F[7] has to be 0, h/w bug */
8202 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x3F , ~0xFC , ( value
<< 2 ) & 0x7C ) ;
8204 for ( temp
=0, value
= 0; temp
< 3; temp
++)
8207 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x31 , ~0x30 , value
) ;
8208 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2B , pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].VCLKData1
) ;
8209 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2C , pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].VCLKData2
) ;
8213 if (!( modeflag
& Charx8Dot
))
8215 XGINew_GetReg2( pVBInfo
->P3da
) ; /* reset 3da */
8216 XGINew_SetReg3( pVBInfo
->P3c0
, 0x13 ) ; /* set index */
8217 XGINew_SetReg3( pVBInfo
->P3c0
, 0x00 ) ; /* set data, panning = 0, shift left 1 dot*/
8219 XGINew_GetReg2( pVBInfo
->P3da
) ; /* Enable Attribute */
8220 XGINew_SetReg3( pVBInfo
->P3c0
, 0x20 ) ;
8222 XGINew_GetReg2( pVBInfo
->P3da
) ; /* reset 3da */
8228 /* no shadow case */
8229 void XGI_SetXG27LVDSPara(USHORT ModeNo
,USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
)
8231 UCHAR temp
,Miscdata
;
8237 USHORT LVDSHT
,LVDSHBS
,LVDSHRS
,LVDSHRE
,LVDSHBE
;
8238 USHORT LVDSVT
,LVDSVBS
,LVDSVRS
,LVDSVRE
,LVDSVBE
;
8241 lvdstableindex
= XGI_GetLVDSOEMTableIndex( pVBInfo
);
8242 temp
= (UCHAR
) ( ( pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDS_Capability
& (LCDPolarity
<< 8 ) ) >> 8 );
8243 temp
&= LCDPolarity
;
8244 Miscdata
=(UCHAR
) XGINew_GetReg2(pVBInfo
->P3cc
) ;
8246 XGINew_SetReg3( pVBInfo
->P3c2
, (Miscdata
& 0x3F) | temp
) ;
8248 temp
= (UCHAR
) ( pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDS_Capability
& LCDPolarity
) ;
8249 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x35 , ~0x80 , temp
&0x80 ) ; /* SR35[7] FP VSync polarity */
8250 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x30 , ~0x20 , (temp
&0x40)>>1 ) ; /* SR30[5] FP HSync polarity */
8252 XGI_SetXG27FPBits(pVBInfo
);
8253 resindex
= XGI_GetResInfo( ModeNo
, ModeIdIndex
, pVBInfo
) ;
8254 if ( ModeNo
<= 0x13 )
8256 xres
= pVBInfo
->StResInfo
[ resindex
].HTotal
;
8257 yres
= pVBInfo
->StResInfo
[ resindex
].VTotal
;
8258 modeflag
= pVBInfo
->SModeIDTable
[ModeIdIndex
].St_ModeFlag
; /* si+St_ResInfo */
8262 xres
= pVBInfo
->ModeResInfo
[ resindex
].HTotal
; /* xres->ax */
8263 yres
= pVBInfo
->ModeResInfo
[ resindex
].VTotal
; /* yres->bx */
8264 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
; /* si+St_ModeFlag */
8267 if (!( modeflag
& Charx8Dot
))
8268 xres
= xres
* 8 / 9;
8270 LVDSHT
= pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSHT
;
8272 LVDSHBS
= xres
+ ( pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSHDE
- xres
) / 2 ;
8273 if ( ( ModeNo
<=0x13 ) && ( modeflag
& HalfDCLK
) )
8277 if (LVDSHBS
> LVDSHT
) LVDSHBS
-= LVDSHT
;
8279 LVDSHRS
= LVDSHBS
+ pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSHFP
;
8280 if (LVDSHRS
> LVDSHT
) LVDSHRS
-= LVDSHT
;
8282 LVDSHRE
= LVDSHRS
+ pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSHSYNC
;
8283 if (LVDSHRE
> LVDSHT
) LVDSHRE
-= LVDSHT
;
8285 LVDSHBE
= LVDSHBS
+ LVDSHT
- pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSHDE
;
8287 LVDSVT
= pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSVT
;
8289 LVDSVBS
= yres
+ ( pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSVDE
- yres
) / 2 ;
8290 if ( ( ModeNo
>0x13 ) && ( modeflag
& DoubleScanMode
) )
8294 if (LVDSVBS
> LVDSVT
) LVDSVBS
-= LVDSVT
;
8296 LVDSVRS
= LVDSVBS
+ pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSVFP
;
8297 if (LVDSVRS
> LVDSVT
) LVDSVRS
-= LVDSVT
;
8299 LVDSVRE
= LVDSVRS
+ pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSVSYNC
;
8300 if (LVDSVRE
> LVDSVT
) LVDSVRE
-= LVDSVT
;
8302 LVDSVBE
= LVDSVBS
+ LVDSVT
- pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].LVDSVDE
;
8304 temp
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3d4
, 0x11 ) ;
8305 XGINew_SetReg1( pVBInfo
->P3d4
, 0x11 , temp
& 0x7f ) ; /* Unlock CRTC */
8307 if (!( modeflag
& Charx8Dot
))
8309 XGINew_SetRegOR( pVBInfo
->P3c4
, 0x1 , 0x1 ) ;
8312 /* HT SR0B[1:0] CR00 */
8313 value
= ( LVDSHT
>> 3 ) - 5;
8314 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0B , ~0x03 , ( value
& 0x300 ) >> 8 ) ;
8315 XGINew_SetReg1( pVBInfo
->P3d4
, 0x0 , (value
& 0xFF) ) ;
8317 /* HBS SR0B[5:4] CR02 */
8318 value
= ( LVDSHBS
>> 3 ) - 1;
8319 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0B , ~0x30 , ( value
& 0x300 ) >> 4 ) ;
8320 XGINew_SetReg1( pVBInfo
->P3d4
, 0x2 , (value
& 0xFF) ) ;
8322 /* HBE SR0C[1:0] CR05[7] CR03[4:0] */
8323 value
= ( LVDSHBE
>> 3 ) - 1;
8324 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0C , ~0x03 , ( value
& 0xC0 ) >> 6 ) ;
8325 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x05 , ~0x80 , ( value
& 0x20 ) << 2 ) ;
8326 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x03 , ~0x1F , value
& 0x1F ) ;
8328 /* HRS SR0B[7:6] CR04 */
8329 value
= ( LVDSHRS
>> 3 ) + 2;
8330 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0B , ~0xC0 , ( value
& 0x300 ) >> 2 ) ;
8331 XGINew_SetReg1( pVBInfo
->P3d4
, 0x4 , (value
& 0xFF) ) ;
8333 /* Panel HRS SR2F[1:0] SR2E[7:0] */
8335 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x2F , ~0x03 , ( value
& 0x300 ) >> 8 ) ;
8336 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2E , (value
& 0xFF) ) ;
8338 /* HRE SR0C[2] CR05[4:0] */
8339 value
= ( LVDSHRE
>> 3 ) + 2;
8340 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0C , ~0x04 , ( value
& 0x20 ) >> 3 ) ;
8341 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x05 , ~0x1F , value
& 0x1F ) ;
8343 /* Panel HRE SR2F[7:2] */
8345 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x2F , ~0xFC , value
<< 2 ) ;
8347 /* VT SR0A[0] CR07[5][0] CR06 */
8348 value
= LVDSVT
- 2 ;
8349 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0A , ~0x01 , ( value
& 0x400 ) >> 10 ) ;
8350 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x07 , ~0x20 , ( value
& 0x200 ) >> 4 ) ;
8351 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x07 , ~0x01 , ( value
& 0x100 ) >> 8 ) ;
8352 XGINew_SetReg1( pVBInfo
->P3d4
, 0x06 , (value
& 0xFF) ) ;
8354 /* VBS SR0A[2] CR09[5] CR07[3] CR15 */
8355 value
= LVDSVBS
- 1 ;
8356 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0A , ~0x04 , ( value
& 0x400 ) >> 8 ) ;
8357 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x09 , ~0x20 , ( value
& 0x200 ) >> 4 ) ;
8358 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x07 , ~0x08 , ( value
& 0x100 ) >> 5 ) ;
8359 XGINew_SetReg1( pVBInfo
->P3d4
, 0x15 , (value
& 0xFF) ) ;
8361 /* VBE SR0A[4] CR16 */
8362 value
= LVDSVBE
- 1;
8363 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0A , ~0x10 , ( value
& 0x100 ) >> 4 ) ;
8364 XGINew_SetReg1( pVBInfo
->P3d4
, 0x16 , (value
& 0xFF) ) ;
8366 /* VRS SR0A[3] CR7[7][2] CR10 */
8367 value
= LVDSVRS
- 1 ;
8368 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0A , ~0x08 , ( value
& 0x400 ) >> 7 ) ;
8369 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x07 , ~0x80 , ( value
& 0x200 ) >> 2 ) ;
8370 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x07 , ~0x04 , ( value
& 0x100 ) >> 6 ) ;
8371 XGINew_SetReg1( pVBInfo
->P3d4
, 0x10 , (value
& 0xFF) ) ;
8373 /* Panel VRS SR35[2:0] SR34[7:0] */
8374 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x35 , ~0x07 , ( value
& 0x700 ) >> 8 ) ;
8375 XGINew_SetReg1( pVBInfo
->P3c4
, 0x34 , value
& 0xFF ) ;
8377 /* VRE SR0A[5] CR11[3:0] */
8378 value
= LVDSVRE
- 1;
8379 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x0A , ~0x20 , ( value
& 0x10 ) << 1 ) ;
8380 XGINew_SetRegANDOR( pVBInfo
->P3d4
, 0x11 , ~0x0F , value
& 0x0F ) ;
8382 /* Panel VRE SR3F[7:2] */
8383 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x3F , ~0xFC , ( value
<< 2 ) & 0xFC ) ;
8385 for ( temp
=0, value
= 0; temp
< 3; temp
++)
8388 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x31 , ~0x30 , value
) ;
8389 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2B , pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].VCLKData1
) ;
8390 XGINew_SetReg1( pVBInfo
->P3c4
, 0x2C , pVBInfo
->XG21_LVDSCapList
[lvdstableindex
].VCLKData2
) ;
8394 if (!( modeflag
& Charx8Dot
))
8396 XGINew_GetReg2( pVBInfo
->P3da
) ; /* reset 3da */
8397 XGINew_SetReg3( pVBInfo
->P3c0
, 0x13 ) ; /* set index */
8398 XGINew_SetReg3( pVBInfo
->P3c0
, 0x00 ) ; /* set data, panning = 0, shift left 1 dot*/
8400 XGINew_GetReg2( pVBInfo
->P3da
) ; /* Enable Attribute */
8401 XGINew_SetReg3( pVBInfo
->P3c0
, 0x20 ) ;
8403 XGINew_GetReg2( pVBInfo
->P3da
) ; /* reset 3da */
8409 /* --------------------------------------------------------------------- */
8410 /* Function : XGI_IsLCDON */
8412 /* Output : 0 : Skip PSC Control */
8413 /* 1: Disable PSC */
8415 /* --------------------------------------------------------------------- */
8416 BOOLEAN
XGI_IsLCDON(PVB_DEVICE_INFO pVBInfo
)
8420 tempax
= pVBInfo
->VBInfo
;
8421 if ( tempax
& SetCRT2ToDualEdge
)
8423 else if ( tempax
& ( DisableCRT2Display
| SwitchToCRT2
| SetSimuScanMode
) )
8430 /* --------------------------------------------------------------------- */
8431 /* Function : XGI_EnablePWD */
8435 /* --------------------------------------------------------------------- */
8436 void XGI_EnablePWD( PVB_DEVICE_INFO pVBInfo
)
8441 index
= XGI_GetLCDCapPtr(pVBInfo
) ;
8442 temp
= pVBInfo
->LCDCapList
[ index
].PWD_2B
;
8443 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x2B , temp
) ;
8444 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x2C , pVBInfo
->LCDCapList
[ index
].PWD_2C
) ;
8445 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x2D , pVBInfo
->LCDCapList
[ index
].PWD_2D
) ;
8446 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x2E , pVBInfo
->LCDCapList
[ index
].PWD_2E
) ;
8447 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x2F , pVBInfo
->LCDCapList
[ index
].PWD_2F
) ;
8448 XGINew_SetRegOR( pVBInfo
->Part4Port
, 0x27 , 0x80 ) ; /* enable PWD */
8452 /* --------------------------------------------------------------------- */
8453 /* Function : XGI_DisablePWD */
8457 /* --------------------------------------------------------------------- */
8458 void XGI_DisablePWD( PVB_DEVICE_INFO pVBInfo
)
8460 XGINew_SetRegAND( pVBInfo
->Part4Port
, 0x27 , 0x7F ) ; /* disable PWD */
8464 /* --------------------------------------------------------------------- */
8465 /* Function : XGI_DisableChISLCD */
8467 /* Output : 0 -> Not LCD Mode */
8469 /* --------------------------------------------------------------------- */
8470 BOOLEAN
XGI_DisableChISLCD(PVB_DEVICE_INFO pVBInfo
)
8475 tempbx
= pVBInfo
->SetFlag
& ( DisableChA
| DisableChB
) ;
8476 tempah
= ~( ( USHORT
)XGINew_GetReg1( pVBInfo
->Part1Port
, 0x2E ) ) ;
8478 if ( tempbx
& ( EnableChA
| DisableChA
) )
8480 if ( !( tempah
& 0x08 ) ) /* Chk LCDA Mode */
8484 if ( !( tempbx
& ( EnableChB
| DisableChB
) ) )
8487 if ( tempah
& 0x01 ) /* Chk LCDB Mode */
8494 /* --------------------------------------------------------------------- */
8495 /* Function : XGI_EnableChISLCD */
8497 /* Output : 0 -> Not LCD mode */
8499 /* --------------------------------------------------------------------- */
8500 BOOLEAN
XGI_EnableChISLCD(PVB_DEVICE_INFO pVBInfo
)
8506 tempbx
= pVBInfo
->SetFlag
& ( EnableChA
| EnableChB
) ;
8507 tempah
= ~( ( USHORT
)XGINew_GetReg1( pVBInfo
->Part1Port
, 0x2E ) ) ;
8509 if ( tempbx
& ( EnableChA
| DisableChA
) )
8511 if ( !( tempah
& 0x08 ) ) /* Chk LCDA Mode */
8515 if ( !( tempbx
& ( EnableChB
| DisableChB
) ) )
8518 if ( tempah
& 0x01 ) /* Chk LCDB Mode */
8525 /* --------------------------------------------------------------------- */
8526 /* Function : XGI_GetLCDCapPtr */
8530 /* --------------------------------------------------------------------- */
8531 USHORT
XGI_GetLCDCapPtr( PVB_DEVICE_INFO pVBInfo
)
8538 tempah
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x36 ) ;
8539 tempal
= tempah
& 0x0F ;
8540 tempah
= tempah
& 0xF0 ;
8542 tempbl
= pVBInfo
->LCDCapList
[ i
].LCD_ID
;
8544 while( tempbl
!= 0xFF )
8546 if ( tempbl
& 0x80 ) /* OEMUtil */
8549 tempbl
= tempbl
& ~( 0x80 ) ;
8552 if ( tempal
== tempbl
)
8557 tempbl
= pVBInfo
->LCDCapList
[ i
].LCD_ID
;
8564 /* --------------------------------------------------------------------- */
8565 /* Function : XGI_GetLCDCapPtr1 */
8569 /* --------------------------------------------------------------------- */
8570 USHORT
XGI_GetLCDCapPtr1( PVB_DEVICE_INFO pVBInfo
)
8577 tempal
= pVBInfo
->LCDResInfo
;
8578 tempah
= pVBInfo
->LCDTypeInfo
;
8581 tempbl
= pVBInfo
->LCDCapList
[ i
].LCD_ID
;
8583 while( tempbl
!= 0xFF )
8585 if ( ( tempbl
& 0x80 ) && ( tempbl
!= 0x80 ) )
8591 if ( tempal
== tempbl
)
8595 tempbl
= pVBInfo
->LCDCapList
[ i
].LCD_ID
;
8598 if ( tempbl
== 0xFF )
8600 pVBInfo
->LCDResInfo
= Panel1024x768
;
8601 pVBInfo
->LCDTypeInfo
= 0 ;
8609 /* --------------------------------------------------------------------- */
8610 /* Function : XGI_GetLCDSync */
8614 /* --------------------------------------------------------------------- */
8615 void XGI_GetLCDSync( USHORT
* HSyncWidth
, USHORT
* VSyncWidth
, PVB_DEVICE_INFO pVBInfo
)
8619 Index
= XGI_GetLCDCapPtr(pVBInfo
) ;
8620 *HSyncWidth
= pVBInfo
->LCDCapList
[ Index
].LCD_HSyncWidth
;
8621 *VSyncWidth
= pVBInfo
->LCDCapList
[ Index
].LCD_VSyncWidth
;
8628 /* --------------------------------------------------------------------- */
8629 /* Function : XGI_EnableBridge */
8633 /* --------------------------------------------------------------------- */
8634 void XGI_EnableBridge( PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
)
8639 if ( pVBInfo
->SetFlag
== Win9xDOSMode
)
8641 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
8643 XGI_DisplayOn( HwDeviceExtension
, pVBInfo
) ;
8646 else /* LVDS or CH7017 */
8651 if ( HwDeviceExtension
->jChipType
< XG40
)
8653 if ( !XGI_DisableChISLCD(pVBInfo
) )
8655 if ( ( XGI_EnableChISLCD(pVBInfo
) ) || ( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToLCDA
) ) )
8657 if ( pVBInfo
->LCDInfo
& SetPWDEnable
)
8659 XGI_EnablePWD( pVBInfo
);
8663 pVBInfo
->LCDInfo
&= ( ~SetPWDEnable
) ;
8664 if ( pVBInfo
->VBType
& ( VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
8675 XGI_SetPanelPower( tempah
, tempbl
, pVBInfo
) ;
8676 XGI_SetPanelDelay( 1,pVBInfo
) ;
8684 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
8686 if ( !( pVBInfo
->SetFlag
& DisableChA
) )
8688 if ( pVBInfo
->SetFlag
& EnableChA
)
8690 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x1E , 0x20 ) ; /* Power on */
8694 if ( pVBInfo
->VBInfo
& SetCRT2ToDualEdge
) /* SetCRT2ToLCDA ) */
8696 XGINew_SetReg1(pVBInfo
->Part1Port
,0x1E,0x20); /* Power on */
8701 if ( !( pVBInfo
->SetFlag
& DisableChB
) )
8703 if ( ( pVBInfo
->SetFlag
& EnableChB
) || ( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToTV
| SetCRT2ToRAMDAC
) ) )
8705 tempah
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->P3c4
, 0x32 ) ;
8707 if ( pVBInfo
->VBInfo
& SetInSlaveMode
)
8709 if ( !( pVBInfo
->VBInfo
& SetCRT2ToRAMDAC
) )
8712 XGINew_SetReg1( pVBInfo
->P3c4
, 0x32 , tempah
) ;
8713 XGINew_SetRegOR( pVBInfo
->P3c4
, 0x1E , 0x20 ) ;
8716 tempah
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->Part1Port
, 0x2E ) ;
8718 if ( !( tempah
& 0x80 ) )
8719 XGINew_SetRegOR( pVBInfo
->Part1Port
, 0x2E , 0x80 ) ; /* BVBDOENABLE = 1 */
8721 XGINew_SetRegAND( pVBInfo
->Part1Port
, 0x00 , 0x7F ) ; /* BScreenOFF = 0 */
8725 if ( ( pVBInfo
->SetFlag
& ( EnableChA
| EnableChB
) ) || ( !( pVBInfo
->VBInfo
& DisableCRT2Display
) ) )
8727 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x00 , ~0xE0 , 0x20 ) ; /* shampoo 0129 */
8728 if ( pVBInfo
->VBType
& ( VB_XGI302LV
| VB_XGI301C
) )
8730 if ( !XGI_DisableChISLCD(pVBInfo
) )
8732 if ( XGI_EnableChISLCD( pVBInfo
) || ( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToLCDA
) ) )
8733 XGINew_SetRegAND( pVBInfo
->Part4Port
,0x2A , 0x7F ) ; /* LVDS PLL power on */
8735 XGINew_SetRegAND( pVBInfo
->Part4Port
, 0x30 , 0x7F ) ; /* LVDS Driver power on */
8741 if ( !( pVBInfo
->VBInfo
& DisableCRT2Display
) )
8745 if ( !( pVBInfo
->VBInfo
& SetSimuScanMode
) )
8747 if ( pVBInfo
->VBInfo
& SetCRT2ToLCDA
)
8749 if ( pVBInfo
->VBInfo
& SetCRT2ToDualEdge
)
8751 tempah
= tempah
& 0x40;
8752 if ( pVBInfo
->VBInfo
& SetCRT2ToLCDA
)
8753 tempah
= tempah
^ 0xC0 ;
8755 if ( pVBInfo
->SetFlag
& DisableChB
)
8758 if ( pVBInfo
->SetFlag
& DisableChA
)
8761 if ( pVBInfo
->SetFlag
& EnableChB
)
8764 if ( pVBInfo
->SetFlag
& EnableChA
)
8771 XGINew_SetRegOR( pVBInfo
->Part4Port
, 0x1F , tempah
) ; /* EnablePart4_1F */
8773 if ( pVBInfo
->SetFlag
& Win9xDOSMode
)
8775 XGI_DisplayOn( HwDeviceExtension
, pVBInfo
) ;
8779 if ( !( pVBInfo
->SetFlag
& DisableChA
) )
8781 XGI_VBLongWait( pVBInfo
) ;
8782 if ( !( pVBInfo
->SetFlag
& GatingCRT
) )
8784 XGI_DisableGatingCRT( HwDeviceExtension
, pVBInfo
) ;
8785 XGI_DisplayOn( HwDeviceExtension
, pVBInfo
) ;
8786 XGI_VBLongWait( pVBInfo
) ;
8792 if ( pVBInfo
->VBInfo
& ( SetCRT2ToTV
| SetCRT2ToLCD
| SetCRT2ToLCDA
) )
8793 XGINew_SetRegOR( pVBInfo
->Part1Port
, 0x1E , 0x20 ) ; /* enable CRT2 */
8797 tempah
= ( UCHAR
)XGINew_GetReg1( pVBInfo
->Part1Port
, 0x2E ) ;
8798 if ( !( tempah
& 0x80 ) )
8799 XGINew_SetRegOR( pVBInfo
->Part1Port
, 0x2E , 0x80 ) ; /* BVBDOENABLE = 1 */
8801 XGINew_SetRegAND(pVBInfo
->Part1Port
,0x00,0x7F);
8802 XGI_DisplayOn( HwDeviceExtension
, pVBInfo
);
8806 if ( HwDeviceExtension
->jChipType
< XG40
)
8808 if ( !XGI_EnableChISLCD(pVBInfo
) )
8810 if ( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToLCDA
) )
8812 if ( XGI_BacklightByDrv(pVBInfo
) )
8819 if ( pVBInfo
->LCDInfo
& SetPWDEnable
)
8821 XGI_FirePWDEnable(pVBInfo
) ;
8825 XGI_SetPanelDelay( 2,pVBInfo
) ;
8827 if ( pVBInfo
->VBType
& ( VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
8830 tempbl
= 0xFE ; /* turn on backlght */
8837 XGI_SetPanelPower( tempah
, tempbl
, pVBInfo
) ;
8842 /* --------------------------------------------------------------------- */
8843 /* Function : XGI_DisableBridge */
8847 /* --------------------------------------------------------------------- */
8848 void XGI_DisableBridge(PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
)
8855 if ( pVBInfo
->SetFlag
== Win9xDOSMode
)
8859 if ( HwDeviceExtension
->jChipType
< XG40
)
8861 if ( ( !( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToLCDA
) ) ) || ( XGI_DisableChISLCD(pVBInfo
) ) )
8863 if ( !XGI_IsLCDON(pVBInfo
) )
8865 if ( pVBInfo
->LCDInfo
& SetPWDEnable
)
8866 XGI_EnablePWD( pVBInfo
) ;
8869 pVBInfo
->LCDInfo
&= ~SetPWDEnable
;
8870 XGI_DisablePWD(pVBInfo
) ;
8871 if ( pVBInfo
->VBType
& ( VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
8873 tempbx
= 0xFE ; /* not 01h */
8878 tempbx
= 0xF7 ; /* not 08h */
8881 XGI_SetPanelPower( tempax
, tempbx
, pVBInfo
) ;
8882 XGI_SetPanelDelay( 3,pVBInfo
) ;
8884 } /* end if(!XGI_IsLCDON(pVBInfo)) */
8890 if ( !( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2toLCDA ) ) || ( XGI_DisableChISLCD(pVBInfo) ) )
8892 if ( !XGI_IsLCDON(pVBInfo) )
8896 tempbx = XGINew_GetCH7005( 0x61 ) ;
8897 if ( tempbx < 0x01 ) //first time we power up
8898 XGINew_SetCH7005( 0x0066 ) ; //and disable power sequence
8900 XGINew_SetCH7005( 0x5f66 ) ; //leave VDD on - disable power
8906 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
8909 if ( !( pVBInfo
->VBInfo
& ( DisableCRT2Display
| SetSimuScanMode
) ) )
8911 if ( pVBInfo
->VBInfo
& SetCRT2ToLCDA
)
8913 if ( pVBInfo
->VBInfo
& SetCRT2ToDualEdge
)
8915 tempah
= 0x7F; /* Disable Channel A */
8916 if ( !( pVBInfo
->VBInfo
& SetCRT2ToLCDA
) )
8917 tempah
= 0xBF ; /* Disable Channel B */
8919 if ( pVBInfo
->SetFlag
& DisableChB
)
8920 tempah
&= 0xBF ; /* force to disable Cahnnel */
8922 if ( pVBInfo
->SetFlag
& DisableChA
)
8923 tempah
&= 0x7F ; /* Force to disable Channel B */
8928 XGINew_SetRegAND( pVBInfo
->Part4Port
, 0x1F , tempah
) ; /* disable part4_1f */
8930 if ( pVBInfo
->VBType
& ( VB_XGI302LV
| VB_XGI301C
) )
8932 if ( ( ( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToLCDA
) ) ) || ( XGI_DisableChISLCD(pVBInfo
) ) || ( XGI_IsLCDON(pVBInfo
) ) )
8933 XGINew_SetRegOR( pVBInfo
->Part4Port
, 0x30 , 0x80 ) ; /* LVDS Driver power down */
8936 if ( ( pVBInfo
->SetFlag
& DisableChA
) || ( pVBInfo
->VBInfo
& ( DisableCRT2Display
| SetCRT2ToLCDA
| SetSimuScanMode
) ) )
8938 if ( pVBInfo
->SetFlag
& GatingCRT
)
8939 XGI_EnableGatingCRT( HwDeviceExtension
, pVBInfo
) ;
8940 XGI_DisplayOff( HwDeviceExtension
, pVBInfo
) ;
8943 if ( pVBInfo
->VBInfo
& SetCRT2ToLCDA
)
8945 if ( ( pVBInfo
->SetFlag
& DisableChA
) || ( pVBInfo
->VBInfo
& SetCRT2ToLCDA
) )
8946 XGINew_SetRegAND( pVBInfo
->Part1Port
, 0x1e , 0xdf ) ; /* Power down */
8949 XGINew_SetRegAND( pVBInfo
->P3c4
, 0x32 , 0xdf ) ; /* disable TV as primary VGA swap */
8951 if ( ( pVBInfo
->VBInfo
& ( SetSimuScanMode
| SetCRT2ToDualEdge
) ) )
8952 XGINew_SetRegAND(pVBInfo
->Part2Port
,0x00,0xdf);
8954 if ( ( pVBInfo
->SetFlag
& DisableChB
) || ( pVBInfo
->VBInfo
& ( DisableCRT2Display
| SetSimuScanMode
) )
8955 || ( ( !( pVBInfo
->VBInfo
& SetCRT2ToLCDA
) ) && ( pVBInfo
->VBInfo
& ( SetCRT2ToRAMDAC
| SetCRT2ToLCD
| SetCRT2ToTV
) ) ) )
8956 XGINew_SetRegOR( pVBInfo
->Part1Port
, 0x00 , 0x80 ) ; /* BScreenOff=1 */
8958 if ( ( pVBInfo
->SetFlag
& DisableChB
) || ( pVBInfo
->VBInfo
& ( DisableCRT2Display
| SetSimuScanMode
) )
8959 || ( !( pVBInfo
->VBInfo
& SetCRT2ToLCDA
) ) || ( pVBInfo
->VBInfo
& ( SetCRT2ToRAMDAC
| SetCRT2ToLCD
| SetCRT2ToTV
) ) )
8961 tempah
= XGINew_GetReg1( pVBInfo
->Part1Port
, 0x00 ) ; /* save Part1 index 0 */
8962 XGINew_SetRegOR( pVBInfo
->Part1Port
, 0x00 , 0x10 ) ; /* BTDAC = 1, avoid VB reset */
8963 XGINew_SetRegAND( pVBInfo
->Part1Port
, 0x1E , 0xDF ) ; /* disable CRT2 */
8964 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x00 , tempah
) ; /* restore Part1 index 0 */
8969 if ( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToTV
) )
8971 XGINew_SetRegOR( pVBInfo
->Part1Port
, 0x00 , 0x80 ) ; /* BScreenOff=1 */
8972 XGINew_SetRegAND( pVBInfo
->Part1Port
, 0x1E , 0xDF ) ; /* Disable CRT2 */
8973 XGINew_SetRegAND( pVBInfo
->P3c4
, 0x32 , 0xDF ) ; /* Disable TV asPrimary VGA swap */
8976 if ( pVBInfo
->VBInfo
& ( DisableCRT2Display
| SetCRT2ToLCDA
| SetSimuScanMode
) )
8977 XGI_DisplayOff( HwDeviceExtension
, pVBInfo
) ;
8983 if ( HwDeviceExtension
->jChipType
< XG40
)
8985 if ( !( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToLCDA
) ) || ( XGI_DisableChISLCD(pVBInfo
) ) || ( XGI_IsLCDON(pVBInfo
) ) )
8987 if ( pVBInfo
->LCDInfo
& SetPWDEnable
)
8989 if ( pVBInfo
->LCDInfo
& SetPWDEnable
)
8990 XGI_BacklightByDrv(pVBInfo
) ;
8993 XGI_SetPanelDelay( 4 ,pVBInfo
) ;
8994 if ( pVBInfo
->VBType
& VB_XGI301LV
)
9006 XGI_SetPanelPower( tempah
, tempbl
, pVBInfo
) ;
9012 /* --------------------------------------------------------------------- */
9013 /* Function : XGI_GetTVPtrIndex */
9016 /* Description : bx 0 : ExtNTSC */
9028 /* --------------------------------------------------------------------- */
9029 USHORT
XGI_GetTVPtrIndex( PVB_DEVICE_INFO pVBInfo
)
9033 if ( pVBInfo
->TVInfo
& SetPALTV
)
9035 if ( pVBInfo
->TVInfo
& SetYPbPrMode1080i
)
9037 if ( pVBInfo
->TVInfo
& SetYPbPrMode525i
)
9039 if ( pVBInfo
->TVInfo
& SetYPbPrMode525p
)
9041 if ( pVBInfo
->TVInfo
& SetYPbPrMode750p
)
9043 if ( pVBInfo
->TVInfo
& TVSimuMode
)
9050 /* --------------------------------------------------------------------- */
9051 /* Function : XGI_OEM310Setting */
9054 /* Description : Customized Param. for 301 */
9055 /* --------------------------------------------------------------------- */
9056 void XGI_OEM310Setting( USHORT ModeNo
, USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
)
9058 if ( pVBInfo
->SetFlag
& Win9xDOSMode
)
9062 XGI_SetDelayComp(pVBInfo
) ;
9064 if ( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToLCDA
) )
9065 XGI_SetLCDCap(pVBInfo
) ;
9067 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
9070 XGI_SetPhaseIncr(pVBInfo
) ;
9071 XGI_SetYFilter( ModeNo
, ModeIdIndex
,pVBInfo
) ;
9072 XGI_SetAntiFlicker( ModeNo
, ModeIdIndex
,pVBInfo
) ;
9074 if ( pVBInfo
->VBType
&VB_XGI301
)
9075 XGI_SetEdgeEnhance( ModeNo
, ModeIdIndex
,pVBInfo
) ;
9080 /* --------------------------------------------------------------------- */
9081 /* Function : XGI_SetDelayComp */
9085 /* --------------------------------------------------------------------- */
9086 void XGI_SetDelayComp( PVB_DEVICE_INFO pVBInfo
)
9094 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
9096 if ( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToLCDA
| SetCRT2ToTV
| SetCRT2ToRAMDAC
) )
9101 index
= XGI_GetTVPtrIndex(pVBInfo
) ; /* Get TV Delay */
9102 tempbl
= pVBInfo
->XGI_TVDelayList
[ index
] ;
9104 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
9105 tempbl
= pVBInfo
->XGI_TVDelayList2
[ index
] ;
9107 if ( pVBInfo
->VBInfo
& SetCRT2ToDualEdge
)
9108 tempbl
= tempbl
>> 4 ;
9110 if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC )
9111 tempbl = CRT2Delay1 ; // Get CRT2 Delay
9113 if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) )
9114 tempbl = CRT2Delay2 ;
9116 if ( pVBInfo
->VBInfo
& ( SetCRT2ToLCD
| SetCRT2ToLCDA
) )
9118 index
= XGI_GetLCDCapPtr(pVBInfo
) ; /* Get LCD Delay */
9119 tempbh
=pVBInfo
->LCDCapList
[ index
].LCD_DelayCompensation
;
9121 if ( !( pVBInfo
->VBInfo
& SetCRT2ToLCDA
) )
9127 tempah
= XGINew_GetReg1( pVBInfo
->Part1Port
, 0x2D ) ;
9129 if ( pVBInfo
->VBInfo
& ( SetCRT2ToRAMDAC
| SetCRT2ToLCD
| SetCRT2ToTV
) ) /* Channel B */
9135 if ( pVBInfo
->VBInfo
& SetCRT2ToLCDA
) /* Channel A */
9140 XGINew_SetReg1(pVBInfo
->Part1Port
,0x2D,tempah
);
9143 else if ( pVBInfo
->IF_DEF_LVDS
== 1 )
9147 if ( pVBInfo
->VBInfo
& SetCRT2ToLCD
)
9149 tempah
= pVBInfo
->LCDCapList
[ XGI_GetLCDCapPtr(pVBInfo
) ].LCD_DelayCompensation
; /* / Get LCD Delay */
9151 tempah
= tempah
<< 4 ;
9152 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x2D , 0x0f , tempah
) ;
9158 /* --------------------------------------------------------------------- */
9159 /* Function : XGI_SetLCDCap */
9163 /* --------------------------------------------------------------------- */
9164 void XGI_SetLCDCap( PVB_DEVICE_INFO pVBInfo
)
9168 tempcx
= pVBInfo
->LCDCapList
[ XGI_GetLCDCapPtr(pVBInfo
) ].LCD_Capability
;
9170 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
9172 if ( pVBInfo
->VBType
& ( VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
9173 { /* 301LV/302LV only */
9174 /* Set 301LV Capability */
9175 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x24 , ( UCHAR
)( tempcx
& 0x1F ) ) ;
9178 XGINew_SetRegANDOR( pVBInfo
->Part4Port
, 0x0D , ~( ( EnableVBCLKDRVLOW
| EnablePLLSPLOW
) >> 8 ) , ( USHORT
)( ( tempcx
& ( EnableVBCLKDRVLOW
| EnablePLLSPLOW
) ) >> 8 ) ) ;
9181 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
9183 if ( pVBInfo
->VBInfo
& SetCRT2ToLCD
)
9184 XGI_SetLCDCap_B( tempcx
,pVBInfo
) ;
9185 else if ( pVBInfo
->VBInfo
& SetCRT2ToLCDA
)
9186 XGI_SetLCDCap_A( tempcx
,pVBInfo
) ;
9188 if ( pVBInfo
->VBType
& ( VB_XGI302LV
| VB_XGI301C
) )
9190 if ( tempcx
& EnableSpectrum
)
9191 SetSpectrum( pVBInfo
) ;
9194 else /* LVDS,CH7017 */
9195 XGI_SetLCDCap_A( tempcx
, pVBInfo
) ;
9199 /* --------------------------------------------------------------------- */
9200 /* Function : XGI_SetLCDCap_A */
9204 /* --------------------------------------------------------------------- */
9205 void XGI_SetLCDCap_A(USHORT tempcx
,PVB_DEVICE_INFO pVBInfo
)
9209 temp
= XGINew_GetReg1( pVBInfo
->P3d4
, 0x37 ) ;
9211 if ( temp
& LCDRGB18Bit
)
9213 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x19 , 0x0F , ( USHORT
)( 0x20 | ( tempcx
& 0x00C0 ) ) ) ; /* Enable Dither */
9214 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x1A , 0x7F , 0x80 ) ;
9218 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x19 , 0x0F , ( USHORT
)( 0x30 | ( tempcx
& 0x00C0 ) ) ) ;
9219 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x1A , 0x7F , 0x00 ) ;
9223 if ( tempcx & EnableLCD24bpp ) // 24bits
9225 XGINew_SetRegANDOR(pVBInfo->Part1Port,0x19, 0x0F,(USHORT)(0x30|(tempcx&0x00C0)) );
9226 XGINew_SetRegANDOR(pVBInfo->Part1Port,0x1A,0x7F,0x00);
9230 XGINew_SetRegANDOR(pVBInfo->Part1Port,0x19, 0x0F,(USHORT)(0x20|(tempcx&0x00C0)) );//Enable Dither
9231 XGINew_SetRegANDOR(pVBInfo->Part1Port,0x1A,0x7F,0x80);
9237 /* --------------------------------------------------------------------- */
9238 /* Function : XGI_SetLCDCap_B */
9239 /* Input : cx -> LCD Capability */
9242 /* --------------------------------------------------------------------- */
9243 void XGI_SetLCDCap_B(USHORT tempcx
,PVB_DEVICE_INFO pVBInfo
)
9245 if ( tempcx
& EnableLCD24bpp
) /* 24bits */
9246 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x1A , 0xE0 , ( USHORT
)( ( ( tempcx
& 0x00ff ) >> 6 ) | 0x0c ) ) ;
9248 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x1A , 0xE0 , ( USHORT
)( ( ( tempcx
& 0x00ff ) >> 6 ) | 0x18 ) ) ; /* Enable Dither */
9252 /* --------------------------------------------------------------------- */
9253 /* Function : SetSpectrum */
9257 /* --------------------------------------------------------------------- */
9258 void SetSpectrum( PVB_DEVICE_INFO pVBInfo
)
9262 index
= XGI_GetLCDCapPtr(pVBInfo
) ;
9264 XGINew_SetRegAND( pVBInfo
->Part4Port
, 0x30 , 0x8F ) ; /* disable down spectrum D[4] */
9265 XGI_LongWait(pVBInfo
) ;
9266 XGINew_SetRegOR( pVBInfo
->Part4Port
, 0x30 , 0x20 ) ; /* reset spectrum */
9267 XGI_LongWait(pVBInfo
) ;
9269 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x31 , pVBInfo
->LCDCapList
[ index
].Spectrum_31
) ;
9270 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x32 , pVBInfo
->LCDCapList
[ index
].Spectrum_32
) ;
9271 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x33 , pVBInfo
->LCDCapList
[ index
].Spectrum_33
) ;
9272 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x34 , pVBInfo
->LCDCapList
[ index
].Spectrum_34
) ;
9273 XGI_LongWait(pVBInfo
) ;
9274 XGINew_SetRegOR( pVBInfo
->Part4Port
, 0x30 , 0x40 ) ; /* enable spectrum */
9278 /* --------------------------------------------------------------------- */
9279 /* Function : XGI_SetAntiFlicker */
9282 /* Description : Set TV Customized Param. */
9283 /* --------------------------------------------------------------------- */
9284 void XGI_SetAntiFlicker( USHORT ModeNo
, USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
)
9291 if (pVBInfo
->TVInfo
& ( SetYPbPrMode525p
| SetYPbPrMode750p
) )
9294 tempbx
= XGI_GetTVPtrIndex(pVBInfo
) ;
9297 if ( ModeNo
<= 0x13 )
9299 index
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].VB_StTVFlickerIndex
;
9303 index
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].VB_ExtTVFlickerIndex
;
9307 tempah
= TVAntiFlickList
[ tempbx
] ;
9308 tempah
= tempah
<< 4 ;
9310 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x0A , 0x8F , tempah
) ;
9314 /* --------------------------------------------------------------------- */
9315 /* Function : XGI_SetEdgeEnhance */
9319 /* --------------------------------------------------------------------- */
9320 void XGI_SetEdgeEnhance( USHORT ModeNo
, USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
)
9328 tempbx
= XGI_GetTVPtrIndex(pVBInfo
) ;
9331 if ( ModeNo
<= 0x13 )
9333 index
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].VB_StTVEdgeIndex
;
9337 index
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].VB_ExtTVEdgeIndex
;
9341 tempah
= TVEdgeList
[ tempbx
] ;
9342 tempah
= tempah
<< 5 ;
9344 XGINew_SetRegANDOR( pVBInfo
->Part2Port
, 0x3A , 0x1F , tempah
) ;
9348 /* --------------------------------------------------------------------- */
9349 /* Function : XGI_SetPhaseIncr */
9353 /* --------------------------------------------------------------------- */
9354 void XGI_SetPhaseIncr( PVB_DEVICE_INFO pVBInfo
)
9363 XGI_GetTVPtrIndex2( &tempbx
, &tempcl
, &tempch
, pVBInfo
) ; /* bx, cl, ch */
9364 tempData
= TVPhaseList
[ tempbx
] ;
9366 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x31 , ( USHORT
)( tempData
& 0x000000FF ) ) ;
9367 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x32 , ( USHORT
)( ( tempData
& 0x0000FF00 ) >> 8 ) ) ;
9368 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x33 , ( USHORT
)( ( tempData
& 0x00FF0000 ) >> 16 ) ) ;
9369 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x34 , ( USHORT
)( ( tempData
& 0xFF000000 ) >> 24 ) ) ;
9373 /* --------------------------------------------------------------------- */
9374 /* Function : XGI_SetYFilter */
9378 /* --------------------------------------------------------------------- */
9379 void XGI_SetYFilter( USHORT ModeNo
, USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
)
9389 XGI_GetTVPtrIndex2( &tempbx
, &tempcl
, &tempch
, pVBInfo
) ; /* bx, cl, ch */
9395 filterPtr
= NTSCYFilter1
;
9399 filterPtr
= PALYFilter1
;
9405 filterPtr
= PALMYFilter1
;
9409 filterPtr
= PALNYFilter1
;
9414 filterPtr
= NTSCYFilter2
;
9418 filterPtr
= PALMYFilter2
;
9422 filterPtr
= PALNYFilter2
;
9426 filterPtr
= PALYFilter2
;
9433 if ( ModeNo
<= 0x13 )
9434 tempal
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].VB_StTVYFilterIndex
;
9436 tempal
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].VB_ExtTVYFilterIndex
;
9443 if ( ( tempcl
== 0 ) && ( tempch
== 1 ) )
9445 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x35 , 0 ) ;
9446 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x36 , 0 ) ;
9447 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x37 , 0 ) ;
9448 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x38 , filterPtr
[ index
++ ] ) ;
9452 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x35 , filterPtr
[ index
++ ] ) ;
9453 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x36 , filterPtr
[ index
++ ] ) ;
9454 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x37 , filterPtr
[ index
++ ] ) ;
9455 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x38 , filterPtr
[ index
++ ] ) ;
9458 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
9460 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x48 , filterPtr
[ index
++ ] ) ;
9461 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x49 , filterPtr
[ index
++ ] ) ;
9462 XGINew_SetReg1( pVBInfo
->Part2Port
, 0x4A , filterPtr
[ index
++ ] ) ;
9467 /* --------------------------------------------------------------------- */
9468 /* Function : XGI_GetTVPtrIndex2 */
9470 /* Output : bx 0 : NTSC */
9474 /* 4 : NTSC1024x768 */
9475 /* 5 : PAL-M 1024x768 */
9477 /* cl 0 : YFilter1 */
9480 /* 1 : 301B/302B/301LV/302LV */
9482 /* --------------------------------------------------------------------- */
9483 void XGI_GetTVPtrIndex2(USHORT
* tempbx
,UCHAR
* tempcl
,UCHAR
* tempch
, PVB_DEVICE_INFO pVBInfo
)
9489 if ( pVBInfo
->TVInfo
& SetPALTV
)
9492 if ( pVBInfo
->TVInfo
& SetPALMTV
)
9495 if ( pVBInfo
->TVInfo
& SetPALNTV
)
9498 if ( pVBInfo
->TVInfo
& NTSC1024x768
)
9501 if ( pVBInfo
->TVInfo
& SetPALMTV
)
9505 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
9507 if ( ( !( pVBInfo
->VBInfo
& SetInSlaveMode
) ) || ( pVBInfo
->TVInfo
& TVSimuMode
) )
9514 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
9519 /* --------------------------------------------------------------------- */
9520 /* Function : XGI_SetCRT2ModeRegs */
9523 /* Description : Origin code for crt2group */
9524 /* --------------------------------------------------------------------- */
9525 void XGI_SetCRT2ModeRegs(USHORT ModeNo
,PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
)
9532 /* XGINew_SetReg1( pVBInfo->Part1Port , 0x03 , 0x00 ) ; // fix write part1 index 0 BTDRAM bit Bug */
9534 if ( !( pVBInfo
->VBInfo
& DisableCRT2Display
) )
9536 tempah
=XGINew_GetReg1( pVBInfo
->Part1Port
, 0x00 ) ;
9537 tempah
&= ~0x10 ; /* BTRAMDAC */
9538 tempah
|= 0x40 ; /* BTRAM */
9540 if ( pVBInfo
->VBInfo
& ( SetCRT2ToRAMDAC
| SetCRT2ToTV
| SetCRT2ToLCD
) )
9542 tempah
=0x40; /* BTDRAM */
9543 if ( ModeNo
> 0x13 )
9545 tempcl
= pVBInfo
->ModeType
;
9549 tempah
= ( 0x008 >> tempcl
) ; /* BT Color */
9555 if ( pVBInfo
->VBInfo
& SetInSlaveMode
)
9556 tempah
^= 0x50 ; /* BTDAC */
9561 if ( pVBInfo->VBInfo & DisableCRT2Display )
9566 XGINew_SetReg1( pVBInfo->Part1Port , 0x00 , tempah ) ;
9567 if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD ) )
9569 tempcl = pVBInfo->ModeType ;
9570 if ( ModeNo > 0x13 )
9573 if ( ( tempcl > 0 ) || ( tempcl == 0 ) )
9575 tempah=(0x008>>tempcl) ;
9586 if ( pVBInfo->VBInfo & SetInSlaveMode )
9588 tempah = ( tempah ^ 0x050 ) ;
9593 XGINew_SetReg1( pVBInfo
->Part1Port
, 0x00 , tempah
) ;
9597 if ( pVBInfo
->VBInfo
& DisableCRT2Display
)
9598 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x2e , tempbl
, tempah
) ;
9604 if ( pVBInfo
->VBInfo
& ( SetCRT2ToRAMDAC
| SetCRT2ToTV
| SetCRT2ToLCD
| SetCRT2ToLCDA
) )
9606 if ( ( pVBInfo
->VBInfo
& SetCRT2ToLCDA
) && ( !( pVBInfo
->VBInfo
& SetSimuScanMode
) ) )
9610 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x2e , tempbl
, tempah
) ;
9614 if ( pVBInfo
->VBInfo
& SetCRT2ToLCDA
)
9620 if ( pVBInfo
->VBInfo
& ( SetCRT2ToRAMDAC
| SetCRT2ToTV
| SetCRT2ToLCD
) )
9625 if ( !( pVBInfo
->VBInfo
& SetInSlaveMode
) )
9628 if ( !( pVBInfo
->VBInfo
& SetCRT2ToRAMDAC
) )
9630 tempah
= tempah
^ 0x05 ;
9631 if ( !( pVBInfo
->VBInfo
& SetCRT2ToLCD
) )
9632 tempah
= tempah
^ 0x01 ;
9635 if ( !( pVBInfo
->VBInfo
& SetCRT2ToDualEdge
) )
9637 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x2e , tempbl
, tempah
) ;
9640 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x2e , tempbl
, tempah
) ;
9644 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x2e , tempbl
, tempah
) ;
9647 if ( pVBInfo
->VBInfo
& ( SetCRT2ToRAMDAC
| SetCRT2ToTV
| SetCRT2ToLCD
| SetCRT2ToLCDA
) )
9649 tempah
&= ( ~0x08 ) ;
9650 if ( ( pVBInfo
->ModeType
== ModeVGA
) && ( !( pVBInfo
->VBInfo
& SetInSlaveMode
) ) )
9656 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
9658 /* if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) */
9661 if ( ModeNo
> 0x13 )
9663 if ( pVBInfo
->VBInfo
& DriverMode
)
9664 tempah
= tempah
^ 0x20 ;
9669 XGINew_SetRegANDOR( pVBInfo
->Part4Port
, 0x0D , ~0x0BF , tempah
) ;
9672 if ( pVBInfo
->LCDInfo
& SetLCDDualLink
)
9675 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
9677 /* if ( ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) ) && ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) ) */
9679 if ( pVBInfo
->TVInfo
& RPLLDIV2XO
)
9684 if ( ( pVBInfo
->LCDResInfo
== Panel1280x1024
) || ( pVBInfo
->LCDResInfo
== Panel1280x1024x75
) )
9687 if ( pVBInfo
->LCDResInfo
== Panel1280x960
)
9690 XGINew_SetReg1( pVBInfo
->Part4Port
, 0x0C , tempah
) ;
9693 if ( pVBInfo
->VBType
& ( VB_XGI301B
| VB_XGI302B
| VB_XGI301LV
| VB_XGI302LV
| VB_XGI301C
) )
9698 if ( pVBInfo
->VBInfo
& SetCRT2ToDualEdge
)
9701 if ( pVBInfo
->VBInfo
& SetCRT2ToLCDA
)
9702 tempah
|= 0x04 ; /* shampoo 0129 */
9705 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x13 , tempbl
, tempah
) ;
9708 if ( !( pVBInfo
->VBInfo
& DisableCRT2Display
) )
9710 if ( pVBInfo
->VBInfo
& SetCRT2ToDualEdge
)
9714 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x2c , tempbl
, tempah
) ;
9718 if ( !( pVBInfo
->VBInfo
& DisableCRT2Display
) )
9720 if ( pVBInfo
->VBInfo
& SetCRT2ToDualEdge
)
9723 XGINew_SetRegANDOR( pVBInfo
->Part4Port
, 0x21 , tempbl
, tempah
) ;
9728 if ( !( pVBInfo
->VBInfo
& SetCRT2ToLCDA
) )
9731 if ( !( pVBInfo
->VBInfo
& SetCRT2ToDualEdge
) )
9735 XGINew_SetRegANDOR( pVBInfo
->Part4Port
, 0x23 , tempbl
, tempah
) ;
9737 if ( pVBInfo
->VBType
& ( VB_XGI302LV
| VB_XGI301C
) )
9739 if ( pVBInfo
->LCDInfo
& SetLCDDualLink
)
9741 XGINew_SetRegOR( pVBInfo
->Part4Port
, 0x27 , 0x20 ) ;
9742 XGINew_SetRegOR( pVBInfo
->Part4Port
, 0x34 , 0x10 ) ;
9748 /* --------------------------------------------------------------------- */
9749 /* Function : XGI_CloseCRTC */
9753 /* --------------------------------------------------------------------- */
9754 void XGI_CloseCRTC( PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
)
9760 if ( pVBInfo
->VBInfo
& SetCRT2ToLCDA
)
9767 /* --------------------------------------------------------------------- */
9768 /* Function : XGI_OpenCRTC */
9772 /* --------------------------------------------------------------------- */
9773 void XGI_OpenCRTC( PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
)
9783 /* --------------------------------------------------------------------- */
9784 /* Function : XGI_GetRAMDAC2DATA */
9788 /* --------------------------------------------------------------------- */
9789 void XGI_GetRAMDAC2DATA(USHORT ModeNo
, USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
, PVB_DEVICE_INFO pVBInfo
)
9800 pVBInfo
->RVBHCMAX
= 1 ;
9801 pVBInfo
->RVBHCFACT
= 1 ;
9803 if ( ModeNo
<= 0x13 )
9805 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
;
9806 StandTableIndex
= XGI_GetModePtr( ModeNo
, ModeIdIndex
, pVBInfo
) ;
9807 tempax
= pVBInfo
->StandTable
[ StandTableIndex
].CRTC
[ 0 ] ;
9808 tempbx
= pVBInfo
->StandTable
[StandTableIndex
].CRTC
[ 6 ] ;
9809 temp1
= pVBInfo
->StandTable
[ StandTableIndex
].CRTC
[ 7 ] ;
9813 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
;
9814 CRT1Index
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRT1CRTC
;
9815 CRT1Index
&= IndexMask
;
9816 temp1
= ( USHORT
)pVBInfo
->XGINEWUB_CRT1Table
[ CRT1Index
].CR
[ 0 ] ;
9817 temp2
= ( USHORT
)pVBInfo
->XGINEWUB_CRT1Table
[ CRT1Index
].CR
[ 5 ] ;
9818 tempax
= ( temp1
& 0xFF ) | ( ( temp2
& 0x03 ) << 8 ) ;
9819 tempbx
= ( USHORT
)pVBInfo
->XGINEWUB_CRT1Table
[ CRT1Index
].CR
[ 8 ] ;
9820 tempcx
= ( USHORT
)pVBInfo
->XGINEWUB_CRT1Table
[ CRT1Index
].CR
[ 14 ] << 8 ;
9822 tempcx
= tempcx
<< 2 ;
9824 temp1
= ( USHORT
)pVBInfo
->XGINEWUB_CRT1Table
[ CRT1Index
].CR
[ 9 ] ;
9834 if ( modeflag
& Charx8Dot
)
9839 pVBInfo
->VGAHT
= tempax
;
9840 pVBInfo
->HT
= tempax
;
9842 pVBInfo
->VGAVT
= tempbx
;
9843 pVBInfo
->VT
= tempbx
;
9848 /* --------------------------------------------------------------------- */
9849 /* Function : XGI_GetColorDepth */
9853 /* --------------------------------------------------------------------- */
9854 USHORT
XGI_GetColorDepth(USHORT ModeNo
, USHORT ModeIdIndex
, PVB_DEVICE_INFO pVBInfo
)
9856 USHORT ColorDepth
[ 6 ] = { 1 , 2 , 4 , 4 , 6 , 8 } ;
9860 if ( ModeNo
<= 0x13 )
9862 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
;
9866 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
;
9869 index
=(modeflag
&ModeInfoFlag
)-ModeEGA
;
9874 return( ColorDepth
[ index
] ) ;
9879 /* --------------------------------------------------------------------- */
9880 /* Function : XGI_UnLockCRT2 */
9884 /* --------------------------------------------------------------------- */
9885 void XGI_UnLockCRT2( PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
)
9888 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x2f , 0xFF , 0x01 ) ;
9893 /* --------------------------------------------------------------------- */
9894 /* Function : XGI_LockCRT2 */
9898 /* --------------------------------------------------------------------- */
9899 void XGI_LockCRT2( PXGI_HW_DEVICE_INFO HwDeviceExtension
, PVB_DEVICE_INFO pVBInfo
)
9902 XGINew_SetRegANDOR( pVBInfo
->Part1Port
, 0x2F , 0xFE , 0x00 ) ;
9908 /* --------------------------------------------------------------------- */
9909 /* Function : XGINew_EnableCRT2 */
9913 /* --------------------------------------------------------------------- */
9914 void XGINew_EnableCRT2( PVB_DEVICE_INFO pVBInfo
)
9916 XGINew_SetRegANDOR( pVBInfo
->P3c4
, 0x1E , 0xFF , 0x20 ) ;
9921 /* --------------------------------------------------------------------- */
9926 /* --------------------------------------------------------------------- */
9927 void XGINew_LCD_Wait_Time(UCHAR DelayTime
, PVB_DEVICE_INFO pVBInfo
)
9936 //printk("XGINew_LCD_Wait_Time");
9938 for( i
= 0 ; i
< DelayTime
; i
++ )
9940 for( j
= 0 ; j
< 66 ; j
++ )
9943 temp
= XGINew_GetReg3( 0x61 ) ;
9945 //temp &= 0x10000000;
9958 /* --------------------------------------------------------------------- */
9959 /* Function : XGI_BridgeIsOn */
9963 /* --------------------------------------------------------------------- */
9964 BOOLEAN
XGI_BridgeIsOn( PVB_DEVICE_INFO pVBInfo
)
9968 if ( pVBInfo
->IF_DEF_LVDS
== 1 )
9974 flag
= XGINew_GetReg1( pVBInfo
->Part4Port
, 0x00 ) ;
9975 if ( ( flag
== 1 ) || ( flag
== 2 ) )
9976 return( 1 ) ; /* 301b */
9984 /* --------------------------------------------------------------------- */
9985 /* Function : XGI_LongWait */
9989 /* --------------------------------------------------------------------- */
9990 void XGI_LongWait(PVB_DEVICE_INFO pVBInfo
)
9994 i
= XGINew_GetReg1( pVBInfo
->P3c4
, 0x1F ) ;
9996 if ( !( i
& 0xC0 ) )
9998 for( i
= 0 ; i
< 0xFFFF ; i
++ )
10000 if ( !( XGINew_GetReg2( pVBInfo
->P3da
) & 0x08 ) )
10004 for( i
= 0 ; i
< 0xFFFF ; i
++ )
10006 if ( ( XGINew_GetReg2( pVBInfo
->P3da
) & 0x08 ) )
10013 /* --------------------------------------------------------------------- */
10014 /* Function : XGI_VBLongWait */
10017 /* Description : */
10018 /* --------------------------------------------------------------------- */
10019 void XGI_VBLongWait( PVB_DEVICE_INFO pVBInfo
)
10026 if ( !( pVBInfo
->VBInfo
& SetCRT2ToTV
) )
10029 for( i
= 0 ; i
< 3 ; i
++ )
10031 for( j
= 0 ; j
< 100 ; j
++ )
10033 tempal
= XGINew_GetReg2( pVBInfo
->P3da
) ;
10035 { /* VBWaitMode2 */
10036 if ( ( tempal
& 0x08 ) )
10041 if ( !( tempal
& 0x08 ) )
10047 { /* VBWaitMode1 */
10048 if ( !( tempal
& 0x08 ) )
10053 if ( ( tempal
& 0x08 ) )
10059 temp
= temp
^ 0x01 ;
10064 XGI_LongWait(pVBInfo
) ;
10072 /* --------------------------------------------------------------------- */
10073 /* Function : XGI_GetVGAHT2 */
10076 /* Description : */
10077 /* --------------------------------------------------------------------- */
10078 USHORT
XGI_GetVGAHT2( PVB_DEVICE_INFO pVBInfo
)
10083 tempbx
= ( ( pVBInfo
->VGAVT
- pVBInfo
->VGAVDE
) * pVBInfo
->RVBHCMAX
) & 0xFFFF ;
10084 tempax
= ( pVBInfo
->VT
- pVBInfo
->VDE
) * pVBInfo
->RVBHCFACT
;
10085 tempax
= ( tempax
* pVBInfo
->HT
) /tempbx
;
10087 return( ( USHORT
)tempax
) ;
10091 /* --------------------------------------------------------------------- */
10092 /* Function : XGI_GetVCLK2Ptr */
10095 /* Description : */
10096 /* --------------------------------------------------------------------- */
10097 USHORT
XGI_GetVCLK2Ptr( USHORT ModeNo
, USHORT ModeIdIndex
, USHORT RefreshRateTableIndex
, PXGI_HW_DEVICE_INFO HwDeviceExtension
,PVB_DEVICE_INFO pVBInfo
)
10101 USHORT LCDXlat1VCLK
[ 4 ] = { VCLK65
+ 2 , VCLK65
+ 2 , VCLK65
+ 2 , VCLK65
+ 2 } ;
10102 USHORT LCDXlat2VCLK
[ 4 ] = { VCLK108_2
+ 5 , VCLK108_2
+ 5 , VCLK108_2
+ 5 , VCLK108_2
+ 5 } ;
10103 USHORT LVDSXlat1VCLK
[ 4 ] = { VCLK40
, VCLK40
, VCLK40
, VCLK40
} ;
10104 USHORT LVDSXlat2VCLK
[ 4 ] = { VCLK65
+ 2 , VCLK65
+ 2 , VCLK65
+ 2 , VCLK65
+ 2 } ;
10105 USHORT LVDSXlat3VCLK
[ 4 ] = { VCLK65
+ 2 , VCLK65
+ 2 , VCLK65
+ 2 , VCLK65
+ 2 } ;
10107 USHORT CRT2Index
, VCLKIndex
;
10108 USHORT modeflag
, resinfo
;
10109 UCHAR
*CHTVVCLKPtr
= NULL
;
10111 if ( ModeNo
<= 0x13 )
10113 modeflag
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ModeFlag
; /* si+St_ResInfo */
10114 resinfo
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_ResInfo
;
10115 CRT2Index
= pVBInfo
->SModeIDTable
[ ModeIdIndex
].St_CRT2CRTC
;
10119 modeflag
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_ModeFlag
; /* si+Ext_ResInfo */
10120 resinfo
= pVBInfo
->EModeIDTable
[ ModeIdIndex
].Ext_RESINFO
;
10121 CRT2Index
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRT2CRTC
;
10124 if ( pVBInfo
->IF_DEF_LVDS
== 0 )
10126 CRT2Index
= CRT2Index
>> 6 ; /* for LCD */
10127 if ( ( ( pVBInfo
->VBInfo
& SetCRT2ToLCD
) | SetCRT2ToLCDA
) ) /*301b*/
10129 if ( pVBInfo
->LCDResInfo
!= Panel1024x768
)
10131 VCLKIndex
= LCDXlat2VCLK
[ CRT2Index
] ;
10135 VCLKIndex
= LCDXlat1VCLK
[ CRT2Index
] ;
10140 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
10142 if ( pVBInfo
->VBInfo
& SetCRT2ToHiVisionTV
)
10144 if ( pVBInfo
->SetFlag
& RPLLDIV2XO
)
10146 VCLKIndex
= HiTVVCLKDIV2
;
10154 VCLKIndex
= HiTVVCLK
;
10161 if ( pVBInfo
->SetFlag
& TVSimuMode
)
10163 if( modeflag
& Charx8Dot
)
10165 VCLKIndex
= HiTVSimuVCLK
;
10173 VCLKIndex
= HiTVTextVCLK
;
10181 if ( pVBInfo
->VBType
& VB_XGI301LV
) /* 301lv */
10183 if ( !( pVBInfo
->VBExtInfo
== VB_YPbPr1080i
) )
10185 VCLKIndex
= YPbPr750pVCLK
;
10186 if ( !( pVBInfo
->VBExtInfo
== VB_YPbPr750p
) )
10188 VCLKIndex
= YPbPr525pVCLK
;
10189 if ( !( pVBInfo
->VBExtInfo
== VB_YPbPr525p
) )
10191 VCLKIndex
= YPbPr525iVCLK_2
;
10192 if ( !( pVBInfo
->SetFlag
& RPLLDIV2XO
) )
10193 VCLKIndex
= YPbPr525iVCLK
;
10201 if ( pVBInfo
->VBInfo
& SetCRT2ToTV
)
10203 if ( pVBInfo
->SetFlag
& RPLLDIV2XO
)
10205 VCLKIndex
= TVVCLKDIV2
;
10213 VCLKIndex
= TVVCLK
;
10224 VCLKIndex
= ( UCHAR
)XGINew_GetReg2( ( pVBInfo
->P3ca
+ 0x02 ) ) ; /* Port 3cch */
10225 VCLKIndex
= ( ( VCLKIndex
>> 2 ) & 0x03 ) ;
10226 if ( ModeNo
> 0x13 )
10228 VCLKIndex
= pVBInfo
->RefIndex
[ RefreshRateTableIndex
].Ext_CRTVCLK
; /* di+Ext_CRTVCLK */
10229 VCLKIndex
&= IndexMask
;
10236 if ( ModeNo
<= 0x13 )
10237 VCLKIndex
= CRT2Index
;
10239 VCLKIndex
= CRT2Index
;
10241 if ( pVBInfo
->IF_DEF_CH7005
== 1 )
10243 if ( !( pVBInfo
->VBInfo
& SetCRT2ToLCD
) )
10245 VCLKIndex
&= 0x1f ;
10248 if ( pVBInfo
->VBInfo
& SetPALTV
)
10251 if ( pVBInfo
->VBInfo
& SetCHTVOverScan
)
10257 CHTVVCLKPtr
= pVBInfo
->CHTVVCLKUNTSC
;
10260 CHTVVCLKPtr
= pVBInfo
->CHTVVCLKONTSC
;
10263 CHTVVCLKPtr
= pVBInfo
->CHTVVCLKUPAL
;
10266 CHTVVCLKPtr
= pVBInfo
->CHTVVCLKOPAL
;
10272 VCLKIndex
= CHTVVCLKPtr
[ VCLKIndex
] ;
10277 VCLKIndex
= VCLKIndex
>> 6 ;
10278 if ( ( pVBInfo
->LCDResInfo
== Panel800x600
) || ( pVBInfo
->LCDResInfo
== Panel320x480
) )
10279 VCLKIndex
= LVDSXlat1VCLK
[ VCLKIndex
] ;
10280 else if ( ( pVBInfo
->LCDResInfo
== Panel1024x768
) || ( pVBInfo
->LCDResInfo
== Panel1024x768x75
) )
10281 VCLKIndex
= LVDSXlat2VCLK
[ VCLKIndex
] ;
10283 VCLKIndex
= LVDSXlat3VCLK
[ VCLKIndex
] ;
10286 /* VCLKIndex = VCLKIndex&IndexMask ; */
10290 return( VCLKIndex
) ;