]>
Commit | Line | Data |
---|---|---|
d7636e0b | 1 | |
d7636e0b | 2 | #include <asm/io.h> |
3 | #include <linux/types.h> | |
4 | #include <linux/version.h> | |
5 | #include "XGIfb.h" | |
d7636e0b | 6 | |
d7636e0b | 7 | |
8 | #include "vb_def.h" | |
9 | #include "vgatypes.h" | |
10 | #include "vb_struct.h" | |
11 | #include "vb_util.h" | |
12 | #include "vb_table.h" | |
13 | ||
14 | ||
15 | ||
16 | #define IndexMask 0xff | |
17 | #ifndef XGI_MASK_DUAL_CHIP | |
18 | #define XGI_MASK_DUAL_CHIP 0x04 /* SR3A */ | |
19 | #endif | |
20 | ||
21 | ||
22 | ||
80adad85 | 23 | unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo); |
82d6eb5b | 24 | unsigned char XGI_SetCRT2Group301(unsigned short ModeNo, |
e4147abe | 25 | struct xgi_hw_device_info *HwDeviceExtension, |
80adad85 BP |
26 | struct vb_device_info *pVBInfo); |
27 | unsigned char XGI_BacklightByDrv(struct vb_device_info *pVBInfo); | |
82d6eb5b | 28 | |
80adad85 BP |
29 | unsigned char XGI_IsLCDON(struct vb_device_info *pVBInfo); |
30 | unsigned char XGI_DisableChISLCD(struct vb_device_info *pVBInfo); | |
31 | unsigned char XGI_EnableChISLCD(struct vb_device_info *pVBInfo); | |
82d6eb5b BP |
32 | unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo, |
33 | unsigned short ModeIdIndex, | |
34 | unsigned short RefreshRateTableIndex, | |
80adad85 | 35 | unsigned short *i, struct vb_device_info *pVBInfo); |
82d6eb5b BP |
36 | unsigned char XGI_SearchModeID(unsigned short ModeNo, |
37 | unsigned short *ModeIdIndex, | |
80adad85 | 38 | struct vb_device_info *pVBInfo); |
82d6eb5b BP |
39 | unsigned char XGI_GetLCDInfo(unsigned short ModeNo, |
40 | unsigned short ModeIdIndex, | |
80adad85 | 41 | struct vb_device_info *pVBInfo); |
e4147abe | 42 | unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension, |
82d6eb5b | 43 | unsigned short ModeNo); |
80adad85 | 44 | unsigned char XGI_BridgeIsOn(struct vb_device_info *pVBInfo); |
108afbf8 | 45 | unsigned char XGI_GetModePtr(unsigned short ModeNo, |
82d6eb5b | 46 | unsigned short ModeIdIndex, |
80adad85 | 47 | struct vb_device_info *pVBInfo); |
82d6eb5b BP |
48 | unsigned short XGI_GetOffset(unsigned short ModeNo, |
49 | unsigned short ModeIdIndex, | |
50 | unsigned short RefreshRateTableIndex, | |
e4147abe | 51 | struct xgi_hw_device_info *HwDeviceExtension, |
80adad85 | 52 | struct vb_device_info *pVBInfo); |
e4147abe | 53 | unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE, |
82d6eb5b BP |
54 | unsigned short ModeNo, |
55 | unsigned short ModeIdIndex, | |
80adad85 | 56 | struct vb_device_info *pVBInfo); |
82d6eb5b BP |
57 | unsigned short XGI_GetResInfo(unsigned short ModeNo, |
58 | unsigned short ModeIdIndex, | |
80adad85 | 59 | struct vb_device_info *pVBInfo); |
82d6eb5b BP |
60 | unsigned short XGI_GetColorDepth(unsigned short ModeNo, |
61 | unsigned short ModeIdIndex, | |
80adad85 BP |
62 | struct vb_device_info *pVBInfo); |
63 | unsigned short XGI_GetVGAHT2(struct vb_device_info *pVBInfo); | |
82d6eb5b BP |
64 | unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, |
65 | unsigned short ModeIdIndex, | |
66 | unsigned short RefreshRateTableIndex, | |
e4147abe | 67 | struct xgi_hw_device_info *HwDeviceExtension, |
80adad85 BP |
68 | struct vb_device_info *pVBInfo); |
69 | void XGI_VBLongWait(struct vb_device_info *pVBInfo); | |
70 | void XGI_SaveCRT2Info(unsigned short ModeNo, struct vb_device_info *pVBInfo); | |
71 | void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); | |
72 | void XGI_GetCRT2ResInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); | |
73 | void XGI_PreSetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); | |
74 | void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); | |
75 | void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); | |
76 | void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); | |
77 | void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); | |
78 | void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); | |
79 | void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); | |
80 | void XGI_SetGroup5(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); | |
81 | void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); | |
82 | void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); | |
83 | void XGI_FirePWDEnable(struct vb_device_info *pVBInfo); | |
84 | void XGI_EnableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); | |
85 | void XGI_DisableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); | |
86 | void XGI_SetPanelDelay(unsigned short tempbl, struct vb_device_info *pVBInfo); | |
87 | void XGI_SetPanelPower(unsigned short tempah, unsigned short tempbl, struct vb_device_info *pVBInfo); | |
88 | void XGI_EnablePWD(struct vb_device_info *pVBInfo); | |
89 | void XGI_DisablePWD(struct vb_device_info *pVBInfo); | |
90 | void XGI_AutoThreshold(struct vb_device_info *pVBInfo); | |
91 | void XGI_SetTap4Regs(struct vb_device_info *pVBInfo); | |
92 | ||
93 | void XGI_DisplayOn(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo); | |
94 | void XGI_DisplayOff(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo); | |
95 | void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); | |
96 | void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); | |
97 | void XGI_SetXG21LCD(struct vb_device_info *pVBInfo, unsigned short RefreshRateTableIndex, unsigned short ModeNo); | |
98 | void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); | |
99 | void XGI_SetXG27LCD(struct vb_device_info *pVBInfo, unsigned short RefreshRateTableIndex, unsigned short ModeNo); | |
100 | void XGI_UpdateXG21CRTC(unsigned short ModeNo, struct vb_device_info *pVBInfo, unsigned short RefreshRateTableIndex); | |
101 | void XGI_WaitDisply(struct vb_device_info *pVBInfo); | |
102 | void XGI_SenseCRT1(struct vb_device_info *pVBInfo); | |
103 | void XGI_SetSeqRegs(unsigned short ModeNo, unsigned short StandTableIndex, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); | |
104 | void XGI_SetMiscRegs(unsigned short StandTableIndex, struct vb_device_info *pVBInfo); | |
105 | void XGI_SetCRTCRegs(struct xgi_hw_device_info *HwDeviceExtension, unsigned short StandTableIndex, struct vb_device_info *pVBInfo); | |
106 | void XGI_SetATTRegs(unsigned short ModeNo, unsigned short StandTableIndex, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); | |
107 | void XGI_SetGRCRegs(unsigned short StandTableIndex, struct vb_device_info *pVBInfo); | |
108 | void XGI_ClearExt1Regs(struct vb_device_info *pVBInfo); | |
109 | ||
110 | void XGI_SetSync(unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); | |
111 | void XGI_SetCRT1CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo, struct xgi_hw_device_info *HwDeviceExtension); | |
112 | void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo, struct xgi_hw_device_info *HwDeviceExtension); | |
113 | void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex, unsigned short ModeNo, struct vb_device_info *pVBInfo); | |
114 | void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); | |
115 | void XGI_SetCRT1VCLK(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); | |
116 | void XGI_SetCRT1FIFO(unsigned short ModeNo, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); | |
117 | void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); | |
118 | void XGI_SetVCLKState(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); | |
119 | ||
120 | void XGI_LoadDAC(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); | |
121 | void XGI_WriteDAC(unsigned short dl, unsigned short ah, unsigned short al, unsigned short dh, struct vb_device_info *pVBInfo); | |
122 | /*void XGI_ClearBuffer(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, struct vb_device_info *pVBInfo);*/ | |
123 | void XGI_SetLCDAGroup(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); | |
124 | void XGI_GetLVDSResInfo(unsigned short ModeNo, unsigned short ModeIdIndex, | |
125 | struct vb_device_info *pVBInfo); | |
126 | void XGI_GetLVDSData(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); | |
8922967e | 127 | unsigned short XGI_GetLVDSOEMTableIndex(struct vb_device_info *pVBInfo); |
80adad85 BP |
128 | void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex, |
129 | unsigned short RefreshRateTableIndex, | |
130 | struct xgi_hw_device_info *HwDeviceExtension, | |
131 | struct vb_device_info *pVBInfo); | |
132 | void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); | |
133 | void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); | |
134 | void XGI_GetVGAType(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); | |
135 | void XGI_GetVBType(struct vb_device_info *pVBInfo); | |
136 | void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); | |
137 | void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); | |
138 | void XGI_SetCRT2ECLK(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); | |
139 | void InitTo330Pointer(unsigned char, struct vb_device_info *pVBInfo); | |
140 | void XGI_GetLCDSync(unsigned short *HSyncWidth, unsigned short *VSyncWidth, struct vb_device_info *pVBInfo); | |
141 | void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); | |
142 | void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); | |
143 | void XGI_SetCRT2VCLK(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); | |
144 | void XGI_OEM310Setting(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); | |
145 | void XGI_SetDelayComp(struct vb_device_info *pVBInfo); | |
146 | void XGI_SetLCDCap(struct vb_device_info *pVBInfo); | |
147 | void XGI_SetLCDCap_A(unsigned short tempcx, struct vb_device_info *pVBInfo); | |
148 | void XGI_SetLCDCap_B(unsigned short tempcx, struct vb_device_info *pVBInfo); | |
149 | void SetSpectrum(struct vb_device_info *pVBInfo); | |
150 | void XGI_SetAntiFlicker(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); | |
151 | void XGI_SetEdgeEnhance(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); | |
152 | void XGI_SetPhaseIncr(struct vb_device_info *pVBInfo); | |
153 | void XGI_SetYFilter(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); | |
108afbf8 | 154 | void XGI_GetTVPtrIndex2(unsigned short *tempbx, unsigned char* tempcl, |
80adad85 BP |
155 | unsigned char *tempch, struct vb_device_info *pVBInfo); |
156 | unsigned short XGI_GetTVPtrIndex(struct vb_device_info *pVBInfo); | |
157 | void XGI_SetCRT2ModeRegs(unsigned short ModeNo, struct xgi_hw_device_info *, struct vb_device_info *pVBInfo); | |
158 | void XGI_CloseCRTC(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo); | |
159 | void XGI_OpenCRTC(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo); | |
160 | void XGI_GetRAMDAC2DATA(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); | |
161 | void XGI_UnLockCRT2(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo); | |
162 | void XGI_LockCRT2(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo); | |
163 | void XGINew_EnableCRT2(struct vb_device_info *pVBInfo); | |
164 | void XGINew_LCD_Wait_Time(unsigned char DelayTime, struct vb_device_info *pVBInfo); | |
165 | void XGI_LongWait(struct vb_device_info *pVBInfo); | |
166 | void XGI_SetCRT1Offset(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); | |
108afbf8 | 167 | void XGI_GetLCDVCLKPtr(unsigned char *di_0, unsigned char *di_1, |
80adad85 | 168 | struct vb_device_info *pVBInfo); |
108afbf8 BP |
169 | unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex, |
170 | unsigned short ModeNo, | |
171 | unsigned short ModeIdIndex, | |
80adad85 | 172 | struct vb_device_info *pVBInfo); |
108afbf8 | 173 | void XGI_GetVCLKLen(unsigned char tempal, unsigned char *di_0, |
80adad85 BP |
174 | unsigned char *di_1, struct vb_device_info *pVBInfo); |
175 | unsigned short XGI_GetLCDCapPtr(struct vb_device_info *pVBInfo); | |
176 | unsigned short XGI_GetLCDCapPtr1(struct vb_device_info *pVBInfo); | |
177 | struct XGI301C_Tap4TimingStruct *XGI_GetTap4Ptr(unsigned short tempcx, struct vb_device_info *pVBInfo); | |
178 | void XGI_SetXG21FPBits(struct vb_device_info *pVBInfo); | |
179 | void XGI_SetXG27FPBits(struct vb_device_info *pVBInfo); | |
180 | unsigned char XGI_XG21GetPSCValue(struct vb_device_info *pVBInfo); | |
181 | unsigned char XGI_XG27GetPSCValue(struct vb_device_info *pVBInfo); | |
182 | void XGI_XG21BLSignalVDD(unsigned short tempbh, unsigned short tempbl, struct vb_device_info *pVBInfo); | |
183 | void XGI_XG27BLSignalVDD(unsigned short tempbh, unsigned short tempbl, struct vb_device_info *pVBInfo); | |
184 | void XGI_XG21SetPanelDelay(unsigned short tempbl, struct vb_device_info *pVBInfo); | |
185 | unsigned char XGI_XG21CheckLVDSMode(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); | |
186 | void XGI_SetXG21LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); | |
187 | void XGI_SetXG27LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); | |
188 | unsigned char XGI_SetDefaultVCLK(struct vb_device_info *pVBInfo); | |
189 | ||
190 | extern void ReadVBIOSTablData(unsigned char ChipType, struct vb_device_info *pVBInfo); | |
d7636e0b | 191 | |
82d6eb5b BP |
192 | /* unsigned short XGINew_flag_clearbuffer; 0: no clear frame buffer 1:clear frame buffer */ |
193 | ||
194 | ||
8922967e | 195 | static unsigned short XGINew_MDA_DAC[] = { |
82d6eb5b BP |
196 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
197 | 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, | |
198 | 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, | |
199 | 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, | |
200 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
201 | 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, | |
202 | 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, | |
203 | 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F}; | |
204 | ||
8922967e | 205 | static unsigned short XGINew_CGA_DAC[] = { |
82d6eb5b BP |
206 | 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, |
207 | 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, | |
208 | 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F, | |
209 | 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F, | |
210 | 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, | |
211 | 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, | |
212 | 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F, | |
213 | 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F}; | |
214 | ||
8922967e | 215 | static unsigned short XGINew_EGA_DAC[] = { |
82d6eb5b BP |
216 | 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x05, 0x15, |
217 | 0x20, 0x30, 0x24, 0x34, 0x21, 0x31, 0x25, 0x35, | |
218 | 0x08, 0x18, 0x0C, 0x1C, 0x09, 0x19, 0x0D, 0x1D, | |
219 | 0x28, 0x38, 0x2C, 0x3C, 0x29, 0x39, 0x2D, 0x3D, | |
220 | 0x02, 0x12, 0x06, 0x16, 0x03, 0x13, 0x07, 0x17, | |
221 | 0x22, 0x32, 0x26, 0x36, 0x23, 0x33, 0x27, 0x37, | |
222 | 0x0A, 0x1A, 0x0E, 0x1E, 0x0B, 0x1B, 0x0F, 0x1F, | |
223 | 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F}; | |
224 | ||
8922967e | 225 | static unsigned short XGINew_VGA_DAC[] = { |
82d6eb5b BP |
226 | 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, |
227 | 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F, | |
228 | 0x00, 0x05, 0x08, 0x0B, 0x0E, 0x11, 0x14, 0x18, | |
229 | 0x1C, 0x20, 0x24, 0x28, 0x2D, 0x32, 0x38, 0x3F, | |
230 | 0x00, 0x10, 0x1F, 0x2F, 0x3F, 0x1F, 0x27, 0x2F, | |
231 | 0x37, 0x3F, 0x2D, 0x31, 0x36, 0x3A, 0x3F, 0x00, | |
232 | 0x07, 0x0E, 0x15, 0x1C, 0x0E, 0x11, 0x15, 0x18, | |
233 | 0x1C, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x00, 0x04, | |
234 | 0x08, 0x0C, 0x10, 0x08, 0x0A, 0x0C, 0x0E, 0x10, | |
235 | 0x0B, 0x0C, 0x0D, 0x0F, 0x10}; | |
d7636e0b | 236 | |
237 | ||
238 | /* --------------------------------------------------------------------- */ | |
239 | /* Function : InitTo330Pointer */ | |
240 | /* Input : */ | |
241 | /* Output : */ | |
242 | /* Description : */ | |
243 | /* --------------------------------------------------------------------- */ | |
80adad85 | 244 | void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo) |
d7636e0b | 245 | { |
80adad85 BP |
246 | pVBInfo->SModeIDTable = (struct XGI_StStruct *) XGI330_SModeIDTable ; |
247 | pVBInfo->StandTable = (struct XGI_StandTableStruct *) XGI330_StandTable ; | |
248 | pVBInfo->EModeIDTable = (struct XGI_ExtStruct *) XGI330_EModeIDTable ; | |
249 | pVBInfo->RefIndex = (struct XGI_Ext2Struct *) XGI330_RefIndex ; | |
250 | pVBInfo->XGINEWUB_CRT1Table = (struct XGI_CRT1TableStruct *) XGI_CRT1Table ; | |
d7636e0b | 251 | |
252 | /* add for new UNIVGABIOS */ | |
80adad85 | 253 | /* XGINew_UBLCDDataTable = (struct XGI_LCDDataTablStruct *) XGI_LCDDataTable ; */ |
d7636e0b | 254 | /* XGINew_UBTVDataTable = (XGI_TVDataTablStruct *) XGI_TVDataTable ; */ |
255 | ||
256 | ||
257 | if ( ChipType >= XG40 ) | |
258 | { | |
80adad85 BP |
259 | pVBInfo->MCLKData = (struct XGI_MCLKDataStruct *) XGI340New_MCLKData; |
260 | pVBInfo->ECLKData = (struct XGI_ECLKDataStruct *) XGI340_ECLKData; | |
d7636e0b | 261 | } |
262 | else | |
263 | { | |
80adad85 BP |
264 | pVBInfo->MCLKData = (struct XGI_MCLKDataStruct *) XGI330New_MCLKData; |
265 | pVBInfo->ECLKData = (struct XGI_ECLKDataStruct *) XGI330_ECLKData; | |
d7636e0b | 266 | } |
267 | ||
80adad85 BP |
268 | pVBInfo->VCLKData = (struct XGI_VCLKDataStruct *) XGI_VCLKData ; |
269 | pVBInfo->VBVCLKData = (struct XGI_VBVCLKDataStruct *) XGI_VBVCLKData ; | |
d7636e0b | 270 | pVBInfo->ScreenOffset = XGI330_ScreenOffset ; |
80adad85 BP |
271 | pVBInfo->StResInfo = (struct XGI_StResInfoStruct *) XGI330_StResInfo ; |
272 | pVBInfo->ModeResInfo = (struct XGI_ModeResInfoStruct *) XGI330_ModeResInfo ; | |
d7636e0b | 273 | |
274 | pVBInfo->pOutputSelect = &XGI330_OutputSelect ; | |
275 | pVBInfo->pSoftSetting = &XGI330_SoftSetting ; | |
276 | pVBInfo->pSR07 = &XGI330_SR07 ; | |
277 | pVBInfo->LCDResInfo = 0 ; | |
278 | pVBInfo->LCDTypeInfo = 0 ; | |
279 | pVBInfo->LCDInfo = 0 ; | |
280 | pVBInfo->VBInfo = 0 ; | |
281 | pVBInfo->TVInfo = 0; | |
282 | ||
283 | ||
284 | pVBInfo->SR15 = XGI340_SR13 ; | |
285 | pVBInfo->CR40 = XGI340_cr41 ; | |
286 | pVBInfo->SR25 = XGI330_sr25 ; | |
287 | pVBInfo->pSR31 = &XGI330_sr31 ; | |
288 | pVBInfo->pSR32 = &XGI330_sr32 ; | |
289 | pVBInfo->CR6B = XGI340_CR6B ; | |
290 | pVBInfo->CR6E = XGI340_CR6E ; | |
291 | pVBInfo->CR6F = XGI340_CR6F ; | |
292 | pVBInfo->CR89 = XGI340_CR89 ; | |
293 | pVBInfo->AGPReg = XGI340_AGPReg ; | |
294 | pVBInfo->SR16 = XGI340_SR16 ; | |
295 | pVBInfo->pCRCF = &XG40_CRCF ; | |
296 | pVBInfo->pXGINew_DRAMTypeDefinition = &XG40_DRAMTypeDefinition ; | |
297 | ||
298 | ||
299 | pVBInfo->CR49 = XGI330_CR49 ; | |
300 | pVBInfo->pSR1F = &XGI330_SR1F ; | |
301 | pVBInfo->pSR21 = &XGI330_SR21 ; | |
302 | pVBInfo->pSR22 = &XGI330_SR22 ; | |
303 | pVBInfo->pSR23 = &XGI330_SR23 ; | |
304 | pVBInfo->pSR24 = &XGI330_SR24 ; | |
305 | pVBInfo->pSR33 = &XGI330_SR33 ; | |
306 | ||
307 | ||
308 | ||
309 | pVBInfo->pCRT2Data_1_2 = &XGI330_CRT2Data_1_2 ; | |
310 | pVBInfo->pCRT2Data_4_D = &XGI330_CRT2Data_4_D ; | |
311 | pVBInfo->pCRT2Data_4_E = &XGI330_CRT2Data_4_E ; | |
312 | pVBInfo->pCRT2Data_4_10 = &XGI330_CRT2Data_4_10 ; | |
313 | pVBInfo->pRGBSenseData = &XGI330_RGBSenseData ; | |
314 | pVBInfo->pVideoSenseData = &XGI330_VideoSenseData ; | |
315 | pVBInfo->pYCSenseData = &XGI330_YCSenseData ; | |
316 | pVBInfo->pRGBSenseData2 = &XGI330_RGBSenseData2 ; | |
317 | pVBInfo->pVideoSenseData2 = &XGI330_VideoSenseData2 ; | |
318 | pVBInfo->pYCSenseData2 = &XGI330_YCSenseData2 ; | |
319 | ||
320 | pVBInfo->NTSCTiming = XGI330_NTSCTiming ; | |
321 | pVBInfo->PALTiming = XGI330_PALTiming ; | |
322 | pVBInfo->HiTVExtTiming = XGI330_HiTVExtTiming ; | |
323 | pVBInfo->HiTVSt1Timing = XGI330_HiTVSt1Timing ; | |
324 | pVBInfo->HiTVSt2Timing = XGI330_HiTVSt2Timing ; | |
325 | pVBInfo->HiTVTextTiming = XGI330_HiTVTextTiming ; | |
326 | pVBInfo->YPbPr750pTiming = XGI330_YPbPr750pTiming ; | |
327 | pVBInfo->YPbPr525pTiming = XGI330_YPbPr525pTiming ; | |
328 | pVBInfo->YPbPr525iTiming = XGI330_YPbPr525iTiming ; | |
329 | pVBInfo->HiTVGroup3Data = XGI330_HiTVGroup3Data ; | |
330 | pVBInfo->HiTVGroup3Simu = XGI330_HiTVGroup3Simu ; | |
331 | pVBInfo->HiTVGroup3Text = XGI330_HiTVGroup3Text ; | |
332 | pVBInfo->Ren525pGroup3 = XGI330_Ren525pGroup3 ; | |
333 | pVBInfo->Ren750pGroup3 = XGI330_Ren750pGroup3 ; | |
334 | ||
335 | ||
80adad85 BP |
336 | pVBInfo->TimingH = (struct XGI_TimingHStruct *) XGI_TimingH ; |
337 | pVBInfo->TimingV = (struct XGI_TimingVStruct *) XGI_TimingV ; | |
338 | pVBInfo->UpdateCRT1 = (struct XGI_XG21CRT1Struct *) XGI_UpdateCRT1Table ; | |
d7636e0b | 339 | |
340 | pVBInfo->CHTVVCLKUNTSC = XGI330_CHTVVCLKUNTSC ; | |
341 | pVBInfo->CHTVVCLKONTSC = XGI330_CHTVVCLKONTSC ; | |
342 | pVBInfo->CHTVVCLKUPAL = XGI330_CHTVVCLKUPAL ; | |
343 | pVBInfo->CHTVVCLKOPAL = XGI330_CHTVVCLKOPAL ; | |
344 | ||
345 | /* 310 customization related */ | |
346 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) | |
347 | pVBInfo->LCDCapList = XGI_LCDDLCapList ; | |
348 | else | |
349 | pVBInfo->LCDCapList = XGI_LCDCapList ; | |
350 | ||
351 | if ( ( ChipType == XG21 ) || ( ChipType == XG27 ) ) | |
352 | pVBInfo->XG21_LVDSCapList = XGI21_LCDCapList ; | |
353 | ||
354 | pVBInfo->XGI_TVDelayList = XGI301TVDelayList ; | |
355 | pVBInfo->XGI_TVDelayList2 = XGI301TVDelayList2 ; | |
356 | ||
357 | ||
358 | pVBInfo->pXGINew_I2CDefinition = &XG40_I2CDefinition ; | |
359 | ||
360 | if ( ChipType >= XG20 ) | |
361 | pVBInfo->pXGINew_CR97 = &XG20_CR97 ; | |
362 | ||
363 | if ( ChipType == XG27 ) | |
364 | { | |
80adad85 | 365 | pVBInfo->MCLKData = (struct XGI_MCLKDataStruct *) XGI27New_MCLKData; |
d7636e0b | 366 | pVBInfo->CR40 = XGI27_cr41 ; |
367 | pVBInfo->pXGINew_CR97 = &XG27_CR97 ; | |
368 | pVBInfo->pSR36 = &XG27_SR36 ; | |
369 | pVBInfo->pCR8F = &XG27_CR8F ; | |
370 | pVBInfo->pCRD0 = XG27_CRD0 ; | |
371 | pVBInfo->pCRDE = XG27_CRDE ; | |
372 | pVBInfo->pSR40 = &XG27_SR40 ; | |
373 | pVBInfo->pSR41 = &XG27_SR41 ; | |
374 | ||
375 | } | |
376 | ||
377 | if ( ChipType >= XG20 ) | |
378 | { | |
379 | pVBInfo->pDVOSetting = &XG21_DVOSetting ; | |
380 | pVBInfo->pCR2E = &XG21_CR2E ; | |
381 | pVBInfo->pCR2F = &XG21_CR2F ; | |
382 | pVBInfo->pCR46 = &XG21_CR46 ; | |
383 | pVBInfo->pCR47 = &XG21_CR47 ; | |
384 | } | |
385 | ||
386 | } | |
387 | ||
388 | ||
389 | ||
390 | ||
391 | ||
392 | ||
393 | /* --------------------------------------------------------------------- */ | |
394 | /* Function : XGISetModeNew */ | |
395 | /* Input : */ | |
396 | /* Output : */ | |
397 | /* Description : */ | |
398 | /* --------------------------------------------------------------------- */ | |
e4147abe | 399 | unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension, |
108afbf8 | 400 | unsigned short ModeNo) |
d7636e0b | 401 | { |
82d6eb5b | 402 | unsigned short ModeIdIndex ; |
108afbf8 | 403 | /* unsigned char *pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress ; */ |
80adad85 BP |
404 | struct vb_device_info VBINF; |
405 | struct vb_device_info *pVBInfo = &VBINF; | |
d7636e0b | 406 | pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase ; |
82d6eb5b | 407 | pVBInfo->BaseAddr = (unsigned long)HwDeviceExtension->pjIOAddress ; |
d7636e0b | 408 | pVBInfo->IF_DEF_LVDS = 0 ; |
409 | pVBInfo->IF_DEF_CH7005 = 0 ; | |
410 | pVBInfo->IF_DEF_LCDA = 1 ; | |
411 | pVBInfo->IF_DEF_CH7017 = 0 ; | |
412 | pVBInfo->IF_DEF_CH7007 = 0 ; /* [Billy] 2007/05/14 */ | |
413 | pVBInfo->IF_DEF_VideoCapture = 0 ; | |
414 | pVBInfo->IF_DEF_ScaleLCD = 0 ; | |
415 | pVBInfo->IF_DEF_OEMUtil = 0 ; | |
416 | pVBInfo->IF_DEF_PWD = 0 ; | |
417 | ||
418 | ||
419 | if ( HwDeviceExtension->jChipType >= XG20 ) /* kuku 2004/06/25 */ | |
420 | { | |
421 | pVBInfo->IF_DEF_YPbPr = 0 ; | |
422 | pVBInfo->IF_DEF_HiVision = 0 ; | |
423 | pVBInfo->IF_DEF_CRT2Monitor = 0 ; | |
424 | pVBInfo->VBType = 0 ; /*set VBType default 0*/ | |
425 | } | |
426 | else if ( HwDeviceExtension->jChipType >= XG40 ) | |
427 | { | |
428 | pVBInfo->IF_DEF_YPbPr = 1 ; | |
429 | pVBInfo->IF_DEF_HiVision = 1 ; | |
430 | pVBInfo->IF_DEF_CRT2Monitor = 1 ; | |
431 | } | |
432 | else | |
433 | { | |
434 | pVBInfo->IF_DEF_YPbPr = 1 ; | |
435 | pVBInfo->IF_DEF_HiVision = 1 ; | |
436 | pVBInfo->IF_DEF_CRT2Monitor = 0 ; | |
437 | } | |
438 | ||
439 | pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14 ; | |
440 | pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24 ; | |
441 | pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10 ; | |
442 | pVBInfo->P3ce = pVBInfo->BaseAddr + 0x1e ; | |
443 | pVBInfo->P3c2 = pVBInfo->BaseAddr + 0x12 ; | |
444 | pVBInfo->P3cc = pVBInfo->BaseAddr + 0x1C ; | |
445 | pVBInfo->P3ca = pVBInfo->BaseAddr + 0x1a ; | |
446 | pVBInfo->P3c6 = pVBInfo->BaseAddr + 0x16 ; | |
447 | pVBInfo->P3c7 = pVBInfo->BaseAddr + 0x17 ; | |
448 | pVBInfo->P3c8 = pVBInfo->BaseAddr + 0x18 ; | |
449 | pVBInfo->P3c9 = pVBInfo->BaseAddr + 0x19 ; | |
450 | pVBInfo->P3da = pVBInfo->BaseAddr + 0x2A ; | |
451 | pVBInfo->Part0Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_00 ; | |
452 | pVBInfo->Part1Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_04 ; | |
453 | pVBInfo->Part2Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_10 ; | |
454 | pVBInfo->Part3Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_12 ; | |
455 | pVBInfo->Part4Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 ; | |
456 | pVBInfo->Part5Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 + 2 ; | |
457 | ||
458 | if ( HwDeviceExtension->jChipType == XG21 ) /* for x86 Linux, XG21 LVDS */ | |
459 | { | |
460 | if ( ( XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) & 0xE0 ) == 0xC0 ) | |
461 | { | |
462 | pVBInfo->IF_DEF_LVDS = 1 ; | |
463 | } | |
464 | } | |
465 | if ( HwDeviceExtension->jChipType == XG27 ) | |
466 | { | |
467 | if ( ( XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) & 0xE0 ) == 0xC0 ) | |
468 | { | |
469 | if ( XGINew_GetReg1( pVBInfo->P3d4 , 0x30 ) & 0x20 ) | |
470 | { | |
471 | pVBInfo->IF_DEF_LVDS = 1 ; | |
472 | } | |
473 | } | |
474 | } | |
475 | ||
476 | if ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 */ | |
477 | XGI_GetVBType( pVBInfo ) ; | |
478 | ||
479 | InitTo330Pointer( HwDeviceExtension->jChipType, pVBInfo ) ; | |
d7636e0b | 480 | if ( ModeNo & 0x80 ) |
481 | { | |
482 | ModeNo = ModeNo & 0x7F ; | |
483 | /* XGINew_flag_clearbuffer = 0 ; */ | |
484 | } | |
485 | /* else | |
486 | { | |
487 | XGINew_flag_clearbuffer = 1 ; | |
488 | } | |
489 | */ | |
490 | XGINew_SetReg1( pVBInfo->P3c4 , 0x05 , 0x86 ) ; | |
491 | ||
492 | if ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 1.Openkey */ | |
493 | XGI_UnLockCRT2( HwDeviceExtension , pVBInfo ) ; | |
494 | ||
495 | XGI_SearchModeID( ModeNo , &ModeIdIndex, pVBInfo ) ; | |
496 | ||
497 | XGI_GetVGAType(HwDeviceExtension, pVBInfo) ; | |
498 | ||
499 | if ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 */ | |
500 | { | |
501 | XGI_GetVBInfo(ModeNo , ModeIdIndex , HwDeviceExtension, pVBInfo ) ; | |
502 | XGI_GetTVInfo(ModeNo , ModeIdIndex, pVBInfo ) ; | |
503 | XGI_GetLCDInfo(ModeNo , ModeIdIndex, pVBInfo ) ; | |
504 | XGI_DisableBridge( HwDeviceExtension,pVBInfo ) ; | |
505 | /* XGI_OpenCRTC( HwDeviceExtension, pVBInfo ) ; */ | |
506 | ||
507 | if ( pVBInfo->VBInfo & ( SetSimuScanMode | SetCRT2ToLCDA ) ) | |
508 | { | |
509 | XGI_SetCRT1Group(HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; | |
510 | ||
511 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) | |
512 | { | |
513 | XGI_SetLCDAGroup(ModeNo , ModeIdIndex , HwDeviceExtension, pVBInfo ) ; | |
514 | } | |
515 | } | |
516 | else | |
517 | { | |
518 | if ( !( pVBInfo->VBInfo & SwitchToCRT2) ) | |
519 | { | |
520 | XGI_SetCRT1Group( HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; | |
521 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) | |
522 | { | |
523 | XGI_SetLCDAGroup( ModeNo , ModeIdIndex , HwDeviceExtension, pVBInfo ) ; | |
524 | } | |
525 | } | |
526 | } | |
527 | ||
528 | if ( pVBInfo->VBInfo & ( SetSimuScanMode | SwitchToCRT2 ) ) | |
529 | { | |
530 | switch( HwDeviceExtension->ujVBChipID ) | |
531 | { | |
532 | case VB_CHIP_301: | |
533 | XGI_SetCRT2Group301( ModeNo , HwDeviceExtension, pVBInfo ) ; /*add for CRT2 */ | |
534 | break ; | |
535 | ||
536 | case VB_CHIP_302: | |
537 | XGI_SetCRT2Group301(ModeNo , HwDeviceExtension, pVBInfo ) ; /*add for CRT2 */ | |
538 | break ; | |
539 | ||
540 | default: | |
541 | break ; | |
542 | } | |
543 | } | |
544 | ||
545 | XGI_SetCRT2ModeRegs( ModeNo, HwDeviceExtension,pVBInfo ) ; | |
546 | XGI_OEM310Setting( ModeNo, ModeIdIndex,pVBInfo ) ; /*0212*/ | |
547 | XGI_CloseCRTC( HwDeviceExtension, pVBInfo ) ; | |
548 | XGI_EnableBridge( HwDeviceExtension ,pVBInfo) ; | |
549 | } /* !XG20 */ | |
550 | else | |
551 | { | |
dda08c59 BP |
552 | if (pVBInfo->IF_DEF_LVDS == 1) |
553 | if (!XGI_XG21CheckLVDSMode(ModeNo , ModeIdIndex, pVBInfo)) | |
554 | return 0; | |
d7636e0b | 555 | |
556 | if ( ModeNo <= 0x13 ) | |
557 | { | |
558 | pVBInfo->ModeType = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag & ModeInfoFlag; | |
559 | } | |
560 | else | |
561 | { | |
562 | pVBInfo->ModeType = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag & ModeInfoFlag; | |
563 | } | |
564 | ||
565 | pVBInfo->SetFlag = 0 ; | |
566 | if ( pVBInfo->IF_DEF_CH7007 != 1 ) | |
567 | { | |
568 | pVBInfo->VBInfo = DisableCRT2Display ; | |
569 | } | |
570 | ||
571 | ||
572 | XGI_DisplayOff(HwDeviceExtension, pVBInfo) ; | |
573 | ||
574 | XGI_SetCRT1Group(HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; | |
575 | ||
576 | XGI_DisplayOn( HwDeviceExtension, pVBInfo ) ; | |
577 | /* | |
578 | if( HwDeviceExtension->jChipType == XG21 ) | |
579 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x09 , ~0x80 , 0x80 ) ; | |
580 | */ | |
581 | } | |
582 | ||
583 | ||
584 | /* | |
585 | if ( ModeNo <= 0x13 ) | |
586 | { | |
587 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; | |
588 | } | |
589 | else | |
590 | { | |
591 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
592 | } | |
593 | pVBInfo->ModeType = modeflag&ModeInfoFlag ; | |
594 | pVBInfo->SetFlag = 0x00 ; | |
595 | pVBInfo->VBInfo = DisableCRT2Display ; | |
596 | temp = XGINew_CheckMemorySize( HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; | |
597 | ||
598 | if ( temp == 0 ) | |
599 | return( 0 ) ; | |
600 | ||
601 | XGI_DisplayOff( HwDeviceExtension, pVBInfo) ; | |
602 | XGI_SetCRT1Group( HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; | |
603 | XGI_DisplayOn( HwDeviceExtension, pVBInfo) ; | |
604 | */ | |
605 | ||
606 | XGI_UpdateModeInfo( HwDeviceExtension, pVBInfo ) ; | |
607 | ||
608 | if ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 */ | |
609 | { | |
610 | XGI_LockCRT2( HwDeviceExtension, pVBInfo ) ; | |
611 | } | |
612 | ||
dda08c59 | 613 | return 1; |
d7636e0b | 614 | } |
615 | ||
616 | ||
617 | /* --------------------------------------------------------------------- */ | |
618 | /* Function : XGI_SetCRT1Group */ | |
619 | /* Input : */ | |
620 | /* Output : */ | |
621 | /* Description : */ | |
622 | /* --------------------------------------------------------------------- */ | |
e4147abe | 623 | void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension, |
82d6eb5b | 624 | unsigned short ModeNo, |
80adad85 | 625 | unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
d7636e0b | 626 | { |
82d6eb5b | 627 | unsigned short StandTableIndex , |
d7636e0b | 628 | RefreshRateTableIndex , |
629 | b3CC , | |
630 | temp ; | |
631 | ||
82d6eb5b | 632 | unsigned short XGINew_P3cc = pVBInfo->P3cc; |
d7636e0b | 633 | |
634 | /* XGINew_CRT1Mode = ModeNo ; // SaveModeID */ | |
635 | StandTableIndex = XGI_GetModePtr( ModeNo , ModeIdIndex, pVBInfo ) ; | |
636 | /* XGI_SetBIOSData(ModeNo , ModeIdIndex ) ; */ | |
637 | /* XGI_ClearBankRegs( ModeNo , ModeIdIndex ) ; */ | |
638 | XGI_SetSeqRegs( ModeNo , StandTableIndex , ModeIdIndex, pVBInfo ) ; | |
639 | XGI_SetMiscRegs( StandTableIndex, pVBInfo ) ; | |
640 | XGI_SetCRTCRegs( HwDeviceExtension , StandTableIndex, pVBInfo) ; | |
641 | XGI_SetATTRegs( ModeNo , StandTableIndex , ModeIdIndex, pVBInfo ) ; | |
642 | XGI_SetGRCRegs( StandTableIndex, pVBInfo ) ; | |
643 | XGI_ClearExt1Regs(pVBInfo) ; | |
644 | ||
645 | /* if ( pVBInfo->IF_DEF_ExpLink ) */ | |
646 | if ( HwDeviceExtension->jChipType == XG27 ) | |
647 | { | |
648 | if ( pVBInfo->IF_DEF_LVDS == 0 ) | |
649 | { | |
650 | XGI_SetDefaultVCLK( pVBInfo ) ; | |
651 | } | |
652 | } | |
653 | ||
654 | temp = ~ProgrammingCRT2 ; | |
655 | pVBInfo->SetFlag &= temp ; | |
656 | pVBInfo->SelectCRT2Rate = 0 ; | |
657 | ||
658 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
659 | { | |
660 | if ( pVBInfo->VBInfo & ( SetSimuScanMode | SetCRT2ToLCDA | SetInSlaveMode ) ) | |
661 | { | |
662 | pVBInfo->SetFlag |= ProgrammingCRT2 ; | |
663 | } | |
664 | } | |
665 | ||
666 | RefreshRateTableIndex = XGI_GetRatePtrCRT2( HwDeviceExtension, ModeNo , ModeIdIndex, pVBInfo ) ; | |
667 | if ( RefreshRateTableIndex != 0xFFFF ) | |
668 | { | |
669 | XGI_SetSync( RefreshRateTableIndex, pVBInfo ) ; | |
670 | XGI_SetCRT1CRTC( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo, HwDeviceExtension ) ; | |
671 | XGI_SetCRT1DE( HwDeviceExtension , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; | |
672 | XGI_SetCRT1Offset( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; | |
673 | XGI_SetCRT1VCLK( ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ; | |
674 | } | |
675 | ||
676 | if ( ( HwDeviceExtension->jChipType >= XG20 )&& | |
677 | ( HwDeviceExtension->jChipType < XG27 ) ) /* fix H/W DCLK/2 bug */ | |
678 | { | |
679 | if ( ( ModeNo == 0x00 ) | (ModeNo == 0x01) ) | |
680 | { | |
681 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , 0x4E) ; | |
682 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , 0xE9) ; | |
108afbf8 | 683 | b3CC = (unsigned char) XGINew_GetReg2(XGINew_P3cc) ; |
d7636e0b | 684 | XGINew_SetReg3(XGINew_P3cc , (b3CC |= 0x0C) ) ; |
685 | } | |
686 | else if ( ( ModeNo == 0x04) | ( ModeNo == 0x05) | ( ModeNo == 0x0D) ) | |
687 | { | |
688 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , 0x1B) ; | |
689 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , 0xE3) ; | |
108afbf8 | 690 | b3CC = (unsigned char)XGINew_GetReg2(XGINew_P3cc) ; |
d7636e0b | 691 | XGINew_SetReg3(XGINew_P3cc , (b3CC |= 0x0C) ) ; |
692 | } | |
693 | } | |
694 | ||
695 | if ( HwDeviceExtension->jChipType >= XG21 ) | |
696 | { | |
697 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) ; | |
698 | if ( temp & 0xA0 ) | |
699 | { | |
700 | ||
701 | /*XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~0x20 ) ;*/ /* Enable write GPIOF */ | |
702 | /*XGINew_SetRegAND( pVBInfo->P3d4 , 0x48 , ~0x20 ) ;*/ /* P. DWN */ | |
703 | /* XG21 CRT1 Timing */ | |
704 | if ( HwDeviceExtension->jChipType == XG27 ) | |
705 | XGI_SetXG27CRTC( ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo ); | |
706 | else | |
707 | XGI_SetXG21CRTC( ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo ); | |
708 | ||
709 | XGI_UpdateXG21CRTC( ModeNo , pVBInfo , RefreshRateTableIndex) ; | |
710 | ||
711 | if ( HwDeviceExtension->jChipType == XG27 ) | |
712 | XGI_SetXG27LCD( pVBInfo , RefreshRateTableIndex , ModeNo ); | |
713 | else | |
714 | XGI_SetXG21LCD( pVBInfo , RefreshRateTableIndex , ModeNo ); | |
715 | ||
716 | if ( pVBInfo->IF_DEF_LVDS == 1 ) | |
717 | { | |
718 | if ( HwDeviceExtension->jChipType == XG27 ) | |
719 | XGI_SetXG27LVDSPara(ModeNo,ModeIdIndex, pVBInfo ); | |
720 | else | |
721 | XGI_SetXG21LVDSPara(ModeNo,ModeIdIndex, pVBInfo ); | |
722 | } | |
723 | /*XGINew_SetRegOR( pVBInfo->P3d4 , 0x48 , 0x20 ) ;*/ /* P. ON */ | |
724 | } | |
725 | } | |
726 | ||
727 | pVBInfo->SetFlag &= ( ~ProgrammingCRT2 ) ; | |
728 | XGI_SetCRT1FIFO( ModeNo , HwDeviceExtension, pVBInfo ) ; | |
729 | XGI_SetCRT1ModeRegs( HwDeviceExtension , ModeNo , ModeIdIndex , RefreshRateTableIndex , pVBInfo) ; | |
730 | ||
731 | ||
732 | /* XGI_LoadCharacter(); //dif ifdef TVFont */ | |
733 | ||
734 | XGI_LoadDAC( ModeNo , ModeIdIndex, pVBInfo ) ; | |
735 | /* XGI_ClearBuffer( HwDeviceExtension , ModeNo, pVBInfo ) ; */ | |
d7636e0b | 736 | } |
737 | ||
738 | ||
739 | /* --------------------------------------------------------------------- */ | |
740 | /* Function : XGI_GetModePtr */ | |
741 | /* Input : */ | |
742 | /* Output : */ | |
743 | /* Description : */ | |
744 | /* --------------------------------------------------------------------- */ | |
108afbf8 | 745 | unsigned char XGI_GetModePtr(unsigned short ModeNo, unsigned short ModeIdIndex, |
80adad85 | 746 | struct vb_device_info *pVBInfo) |
d7636e0b | 747 | { |
108afbf8 | 748 | unsigned char index ; |
d7636e0b | 749 | |
750 | if ( ModeNo <= 0x13 ) | |
751 | index = pVBInfo->SModeIDTable[ ModeIdIndex ].St_StTableIndex ; | |
752 | else | |
753 | { | |
754 | if ( pVBInfo->ModeType <= 0x02 ) | |
755 | index = 0x1B ; /* 02 -> ModeEGA */ | |
756 | else | |
757 | index = 0x0F ; | |
758 | } | |
759 | return( index ) ; /* Get pVBInfo->StandTable index */ | |
760 | } | |
761 | ||
762 | ||
763 | /* --------------------------------------------------------------------- */ | |
764 | /* Function : XGI_SetBIOSData */ | |
765 | /* Input : */ | |
766 | /* Output : */ | |
767 | /* Description : */ | |
768 | /* --------------------------------------------------------------------- */ | |
108afbf8 | 769 | /*unsigned char XGI_SetBIOSData(unsigned short ModeNo, unsigned short ModeIdIndex) |
d7636e0b | 770 | { |
771 | return( 0 ) ; | |
772 | } | |
773 | */ | |
774 | ||
775 | /* --------------------------------------------------------------------- */ | |
776 | /* Function : XGI_ClearBankRegs */ | |
777 | /* Input : */ | |
778 | /* Output : */ | |
779 | /* Description : */ | |
780 | /* --------------------------------------------------------------------- */ | |
108afbf8 | 781 | /*unsigned char XGI_ClearBankRegs(unsigned short ModeNo, unsigned short ModeIdIndex) |
d7636e0b | 782 | { |
783 | return( 0 ) ; | |
784 | } | |
785 | */ | |
786 | ||
787 | /* --------------------------------------------------------------------- */ | |
788 | /* Function : XGI_SetSeqRegs */ | |
789 | /* Input : */ | |
790 | /* Output : */ | |
791 | /* Description : */ | |
792 | /* --------------------------------------------------------------------- */ | |
82d6eb5b | 793 | void XGI_SetSeqRegs(unsigned short ModeNo, unsigned short StandTableIndex, |
80adad85 | 794 | unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
d7636e0b | 795 | { |
108afbf8 | 796 | unsigned char tempah , |
d7636e0b | 797 | SRdata ; |
798 | ||
82d6eb5b | 799 | unsigned short i , |
d7636e0b | 800 | modeflag ; |
801 | ||
802 | if ( ModeNo <= 0x13 ) | |
803 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; | |
804 | else | |
805 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
806 | ||
807 | XGINew_SetReg1( pVBInfo->P3c4 , 0x00 , 0x03 ) ; /* Set SR0 */ | |
808 | tempah=pVBInfo->StandTable[ StandTableIndex ].SR[ 0 ] ; | |
809 | ||
810 | i = SetCRT2ToLCDA ; | |
811 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) | |
812 | { | |
813 | tempah |= 0x01 ; | |
814 | } | |
815 | else | |
816 | { | |
817 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToLCD ) ) | |
818 | { | |
819 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
820 | tempah |= 0x01 ; | |
821 | } | |
822 | } | |
823 | ||
824 | tempah |= 0x20 ; /* screen off */ | |
825 | XGINew_SetReg1( pVBInfo->P3c4 , 0x01 , tempah ) ; /* Set SR1 */ | |
826 | ||
827 | for( i = 02 ; i <= 04 ; i++ ) | |
828 | { | |
829 | SRdata = pVBInfo->StandTable[ StandTableIndex ].SR[ i - 1 ] ; /* Get SR2,3,4 from file */ | |
830 | XGINew_SetReg1( pVBInfo->P3c4 , i , SRdata ) ; /* Set SR2 3 4 */ | |
831 | } | |
832 | } | |
833 | ||
834 | ||
835 | /* --------------------------------------------------------------------- */ | |
836 | /* Function : XGI_SetMiscRegs */ | |
837 | /* Input : */ | |
838 | /* Output : */ | |
839 | /* Description : */ | |
840 | /* --------------------------------------------------------------------- */ | |
80adad85 | 841 | void XGI_SetMiscRegs(unsigned short StandTableIndex, struct vb_device_info *pVBInfo) |
d7636e0b | 842 | { |
108afbf8 | 843 | unsigned char Miscdata ; |
d7636e0b | 844 | |
845 | Miscdata = pVBInfo->StandTable[ StandTableIndex ].MISC ; /* Get Misc from file */ | |
846 | /* | |
847 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
848 | { | |
849 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) | |
850 | { | |
851 | Miscdata |= 0x0C ; | |
852 | } | |
853 | } | |
854 | */ | |
855 | ||
856 | XGINew_SetReg3( pVBInfo->P3c2 , Miscdata ) ; /* Set Misc(3c2) */ | |
857 | } | |
858 | ||
859 | ||
860 | /* --------------------------------------------------------------------- */ | |
861 | /* Function : XGI_SetCRTCRegs */ | |
862 | /* Input : */ | |
863 | /* Output : */ | |
864 | /* Description : */ | |
865 | /* --------------------------------------------------------------------- */ | |
e4147abe | 866 | void XGI_SetCRTCRegs(struct xgi_hw_device_info *HwDeviceExtension, |
80adad85 | 867 | unsigned short StandTableIndex, struct vb_device_info *pVBInfo) |
d7636e0b | 868 | { |
108afbf8 | 869 | unsigned char CRTCdata ; |
82d6eb5b | 870 | unsigned short i ; |
d7636e0b | 871 | |
108afbf8 | 872 | CRTCdata = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x11); |
d7636e0b | 873 | CRTCdata &= 0x7f ; |
874 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , CRTCdata ) ; /* Unlock CRTC */ | |
875 | ||
876 | for( i = 0 ; i <= 0x18 ; i++ ) | |
877 | { | |
878 | CRTCdata = pVBInfo->StandTable[ StandTableIndex ].CRTC[ i ] ; /* Get CRTC from file */ | |
879 | XGINew_SetReg1( pVBInfo->P3d4 , i , CRTCdata ) ; /* Set CRTC( 3d4 ) */ | |
880 | } | |
881 | /* | |
882 | if ( ( HwDeviceExtension->jChipType == XGI_630 )&& ( HwDeviceExtension->jChipRevision == 0x30 ) ) | |
883 | { | |
884 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
885 | { | |
886 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToTV ) ) | |
887 | { | |
888 | XGINew_SetReg1( pVBInfo->P3d4 , 0x18 , 0xFE ) ; | |
889 | } | |
890 | } | |
891 | } | |
892 | */ | |
893 | } | |
894 | ||
895 | ||
896 | /* --------------------------------------------------------------------- */ | |
897 | /* Function : */ | |
898 | /* Input : */ | |
899 | /* Output : */ | |
900 | /* Description : */ | |
901 | /* --------------------------------------------------------------------- */ | |
82d6eb5b | 902 | void XGI_SetATTRegs(unsigned short ModeNo, unsigned short StandTableIndex, |
80adad85 | 903 | unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
d7636e0b | 904 | { |
108afbf8 | 905 | unsigned char ARdata ; |
82d6eb5b | 906 | unsigned short i, modeflag; |
d7636e0b | 907 | |
908 | if ( ModeNo <= 0x13 ) | |
909 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; | |
910 | else | |
911 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
912 | ||
913 | for( i = 0 ; i <= 0x13 ; i++ ) | |
914 | { | |
915 | ARdata = pVBInfo->StandTable[ StandTableIndex ].ATTR[ i ] ; | |
916 | if ( modeflag & Charx8Dot ) /* ifndef Dot9 */ | |
917 | { | |
918 | if ( i == 0x13 ) | |
919 | { | |
920 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) | |
921 | ARdata = 0 ; | |
922 | else | |
923 | { | |
924 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToLCD ) ) | |
925 | { | |
926 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
927 | ARdata = 0 ; | |
928 | } | |
929 | } | |
930 | } | |
931 | } | |
932 | ||
933 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ | |
934 | XGINew_SetReg3( pVBInfo->P3c0 , i ) ; /* set index */ | |
935 | XGINew_SetReg3( pVBInfo->P3c0 , ARdata ) ; /* set data */ | |
936 | } | |
937 | ||
938 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ | |
939 | XGINew_SetReg3( pVBInfo->P3c0 , 0x14 ) ; /* set index */ | |
940 | XGINew_SetReg3( pVBInfo->P3c0 , 0x00 ) ; /* set data */ | |
941 | XGINew_GetReg2( pVBInfo->P3da ) ; /* Enable Attribute */ | |
942 | XGINew_SetReg3( pVBInfo->P3c0 , 0x20 ) ; | |
943 | } | |
944 | ||
945 | ||
946 | /* --------------------------------------------------------------------- */ | |
947 | /* Function : XGI_SetGRCRegs */ | |
948 | /* Input : */ | |
949 | /* Output : */ | |
950 | /* Description : */ | |
951 | /* --------------------------------------------------------------------- */ | |
80adad85 | 952 | void XGI_SetGRCRegs(unsigned short StandTableIndex, struct vb_device_info *pVBInfo) |
d7636e0b | 953 | { |
108afbf8 | 954 | unsigned char GRdata ; |
82d6eb5b | 955 | unsigned short i ; |
d7636e0b | 956 | |
957 | for( i = 0 ; i <= 0x08 ; i++ ) | |
958 | { | |
959 | GRdata = pVBInfo->StandTable[ StandTableIndex ].GRC[ i ] ; /* Get GR from file */ | |
960 | XGINew_SetReg1( pVBInfo->P3ce , i , GRdata ) ; /* Set GR(3ce) */ | |
961 | } | |
962 | ||
963 | if ( pVBInfo->ModeType > ModeVGA ) | |
964 | { | |
108afbf8 | 965 | GRdata = (unsigned char)XGINew_GetReg1(pVBInfo->P3ce, 0x05); |
d7636e0b | 966 | GRdata &= 0xBF ; /* 256 color disable */ |
967 | XGINew_SetReg1( pVBInfo->P3ce , 0x05 , GRdata ) ; | |
968 | } | |
969 | } | |
970 | ||
971 | ||
972 | /* --------------------------------------------------------------------- */ | |
973 | /* Function : XGI_ClearExt1Regs */ | |
974 | /* Input : */ | |
975 | /* Output : */ | |
976 | /* Description : */ | |
977 | /* --------------------------------------------------------------------- */ | |
80adad85 | 978 | void XGI_ClearExt1Regs(struct vb_device_info *pVBInfo) |
d7636e0b | 979 | { |
82d6eb5b | 980 | unsigned short i ; |
d7636e0b | 981 | |
982 | for( i = 0x0A ; i <= 0x0E ; i++ ) | |
983 | XGINew_SetReg1( pVBInfo->P3c4 , i , 0x00 ) ; /* Clear SR0A-SR0E */ | |
984 | } | |
985 | ||
986 | ||
987 | /* --------------------------------------------------------------------- */ | |
988 | /* Function : XGI_SetDefaultVCLK */ | |
989 | /* Input : */ | |
990 | /* Output : */ | |
991 | /* Description : */ | |
992 | /* --------------------------------------------------------------------- */ | |
80adad85 | 993 | unsigned char XGI_SetDefaultVCLK(struct vb_device_info *pVBInfo) |
d7636e0b | 994 | { |
995 | ||
996 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x31 , ~0x30 , 0x20 ) ; | |
997 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ 0 ].SR2B ) ; | |
998 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ 0 ].SR2C ) ; | |
999 | ||
1000 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x31 , ~0x30 , 0x10 ) ; | |
1001 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ 1 ].SR2B ) ; | |
1002 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ 1 ].SR2C ) ; | |
1003 | ||
1004 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x31 , ~0x30 ) ; | |
1005 | return( 0 ) ; | |
1006 | } | |
1007 | ||
1008 | ||
1009 | /* --------------------------------------------------------------------- */ | |
1010 | /* Function : XGI_GetRatePtrCRT2 */ | |
1011 | /* Input : */ | |
1012 | /* Output : */ | |
1013 | /* Description : */ | |
1014 | /* --------------------------------------------------------------------- */ | |
e4147abe | 1015 | unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE, |
82d6eb5b BP |
1016 | unsigned short ModeNo, |
1017 | unsigned short ModeIdIndex, | |
80adad85 | 1018 | struct vb_device_info *pVBInfo) |
d7636e0b | 1019 | { |
108afbf8 | 1020 | short LCDRefreshIndex[] = { 0x00 , 0x00 , 0x03 , 0x01 } , |
d7636e0b | 1021 | LCDARefreshIndex[] = { 0x00 , 0x00 , 0x03 , 0x01 , 0x01 , 0x01 , 0x01 } ; |
1022 | ||
82d6eb5b | 1023 | unsigned short RefreshRateTableIndex, i, modeflag, index, temp; |
d7636e0b | 1024 | |
1025 | if ( ModeNo <= 0x13 ) | |
1026 | { | |
1027 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; | |
1028 | } | |
1029 | else | |
1030 | { | |
1031 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
1032 | } | |
1033 | ||
1034 | if ( pVBInfo->IF_DEF_CH7005 == 1 ) | |
1035 | { | |
1036 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
1037 | { | |
1038 | if ( modeflag & HalfDCLK ) | |
1039 | return( 0 ) ; | |
1040 | } | |
1041 | } | |
1042 | ||
1043 | if ( ModeNo < 0x14 ) | |
1044 | return( 0xFFFF ) ; | |
1045 | ||
1046 | index = XGINew_GetReg1( pVBInfo->P3d4 , 0x33 ) ; | |
1047 | index = index >> pVBInfo->SelectCRT2Rate ; | |
1048 | index &= 0x0F ; | |
1049 | ||
1050 | if ( pVBInfo->LCDInfo & LCDNonExpanding ) | |
1051 | index = 0 ; | |
1052 | ||
1053 | if ( index > 0 ) | |
1054 | index-- ; | |
1055 | ||
1056 | if ( pVBInfo->SetFlag & ProgrammingCRT2 ) | |
1057 | { | |
1058 | if ( pVBInfo->IF_DEF_CH7005 == 1 ) | |
1059 | { | |
1060 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
1061 | { | |
1062 | index = 0 ; | |
1063 | } | |
1064 | } | |
1065 | ||
1066 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) | |
1067 | { | |
1068 | if( pVBInfo->IF_DEF_LVDS == 0 ) | |
1069 | { | |
1070 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
1071 | temp = LCDARefreshIndex[ pVBInfo->LCDResInfo & 0x0F ] ; /* 301b */ | |
1072 | else | |
1073 | temp = LCDRefreshIndex[ pVBInfo->LCDResInfo & 0x0F ] ; | |
1074 | ||
1075 | if ( index > temp ) | |
1076 | { | |
1077 | index = temp ; | |
1078 | } | |
1079 | } | |
1080 | else | |
1081 | { | |
1082 | index = 0 ; | |
1083 | } | |
1084 | } | |
1085 | } | |
1086 | ||
1087 | RefreshRateTableIndex = pVBInfo->EModeIDTable[ ModeIdIndex ].REFindex ; | |
1088 | ModeNo = pVBInfo->RefIndex[ RefreshRateTableIndex ].ModeID ; | |
1089 | if ( pXGIHWDE->jChipType >= XG20 ) /* for XG20, XG21, XG27 */ | |
1090 | { | |
1091 | /* | |
1092 | if ( pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag & XG2xNotSupport ) | |
1093 | { | |
1094 | index++; | |
1095 | } | |
1096 | */ | |
1097 | if ( ( pVBInfo->RefIndex[ RefreshRateTableIndex ].XRes == 800 ) && | |
1098 | ( pVBInfo->RefIndex[ RefreshRateTableIndex ].YRes == 600 ) ) | |
1099 | { | |
1100 | index++; | |
1101 | } | |
1102 | /* Alan 10/19/2007; do the similiar adjustment like XGISearchCRT1Rate() */ | |
1103 | if ( ( pVBInfo->RefIndex[ RefreshRateTableIndex ].XRes == 1024 ) && | |
1104 | ( pVBInfo->RefIndex[ RefreshRateTableIndex ].YRes == 768 ) ) | |
1105 | { | |
1106 | index++; | |
1107 | } | |
1108 | if ( ( pVBInfo->RefIndex[ RefreshRateTableIndex ].XRes == 1280 ) && | |
1109 | ( pVBInfo->RefIndex[ RefreshRateTableIndex ].YRes == 1024 ) ) | |
1110 | { | |
1111 | index++; | |
1112 | } | |
1113 | } | |
1114 | ||
1115 | i = 0 ; | |
1116 | do | |
1117 | { | |
1118 | if ( pVBInfo->RefIndex[ RefreshRateTableIndex + i ].ModeID != ModeNo ) | |
1119 | break ; | |
1120 | temp = pVBInfo->RefIndex[ RefreshRateTableIndex + i ].Ext_InfoFlag ; | |
1121 | temp &= ModeInfoFlag ; | |
1122 | if ( temp < pVBInfo->ModeType ) | |
1123 | break ; | |
1124 | i++ ; | |
1125 | index-- ; | |
1126 | ||
1127 | } while( index != 0xFFFF ) ; | |
1128 | if ( !( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) ) | |
1129 | { | |
1130 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
1131 | { | |
1132 | temp = pVBInfo->RefIndex[ RefreshRateTableIndex + i - 1 ].Ext_InfoFlag ; | |
1133 | if ( temp & InterlaceMode ) | |
1134 | { | |
1135 | i++ ; | |
1136 | } | |
1137 | } | |
1138 | } | |
1139 | i-- ; | |
1140 | if ( ( pVBInfo->SetFlag & ProgrammingCRT2 ) ) | |
1141 | { | |
1142 | temp = XGI_AjustCRT2Rate( ModeNo , ModeIdIndex , RefreshRateTableIndex , &i, pVBInfo) ; | |
1143 | } | |
1144 | return( RefreshRateTableIndex + i ) ; /*return(0x01|(temp1<<1)); */ | |
1145 | } | |
1146 | ||
1147 | ||
1148 | /* --------------------------------------------------------------------- */ | |
1149 | /* Function : XGI_AjustCRT2Rate */ | |
1150 | /* Input : */ | |
1151 | /* Output : */ | |
1152 | /* Description : */ | |
1153 | /* --------------------------------------------------------------------- */ | |
82d6eb5b | 1154 | unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo, unsigned short ModeIdIndex, |
108afbf8 | 1155 | unsigned short RefreshRateTableIndex, |
80adad85 | 1156 | unsigned short *i, struct vb_device_info *pVBInfo) |
d7636e0b | 1157 | { |
82d6eb5b | 1158 | unsigned short tempax, tempbx, resinfo, modeflag, infoflag; |
d7636e0b | 1159 | |
1160 | if ( ModeNo <= 0x13 ) | |
1161 | { | |
1162 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag */ | |
1163 | } | |
1164 | else | |
1165 | { | |
1166 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
1167 | } | |
1168 | ||
1169 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; | |
1170 | tempbx = pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].ModeID ; | |
1171 | tempax = 0 ; | |
1172 | ||
1173 | if ( pVBInfo->IF_DEF_LVDS == 0 ) | |
1174 | { | |
1175 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) | |
1176 | { | |
1177 | tempax |= SupportRAMDAC2 ; | |
1178 | ||
1179 | if ( pVBInfo->VBType & VB_XGI301C ) | |
1180 | tempax |= SupportCRT2in301C ; | |
1181 | } | |
1182 | ||
1183 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) /* 301b */ | |
1184 | { | |
1185 | tempax |= SupportLCD ; | |
1186 | ||
1187 | if ( pVBInfo->LCDResInfo != Panel1280x1024 ) | |
1188 | { | |
1189 | if ( pVBInfo->LCDResInfo != Panel1280x960 ) | |
1190 | { | |
1191 | if ( pVBInfo->LCDInfo & LCDNonExpanding ) | |
1192 | { | |
1193 | if ( resinfo >= 9 ) | |
1194 | { | |
1195 | tempax = 0 ; | |
1196 | return( 0 ) ; | |
1197 | } | |
1198 | } | |
1199 | } | |
1200 | } | |
1201 | } | |
1202 | ||
1203 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) /* for HiTV */ | |
1204 | { | |
1205 | if ( ( pVBInfo->VBType & VB_XGI301LV ) && ( pVBInfo->VBExtInfo == VB_YPbPr1080i ) ) | |
1206 | { | |
1207 | tempax |= SupportYPbPr ; | |
1208 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
1209 | { | |
1210 | if ( resinfo == 4 ) | |
1211 | return( 0 ) ; | |
1212 | ||
1213 | if ( resinfo == 3 ) | |
1214 | return( 0 ) ; | |
1215 | ||
1216 | if ( resinfo > 7 ) | |
1217 | return( 0 ) ; | |
1218 | } | |
1219 | } | |
1220 | else | |
1221 | { | |
1222 | tempax |= SupportHiVisionTV ; | |
1223 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
1224 | { | |
1225 | if ( resinfo == 4 ) | |
1226 | return( 0 ) ; | |
1227 | ||
1228 | if ( resinfo == 3 ) | |
1229 | { | |
1230 | if ( pVBInfo->SetFlag & TVSimuMode ) | |
1231 | return( 0 ) ; | |
1232 | } | |
1233 | ||
1234 | if ( resinfo > 7 ) | |
1235 | return( 0 ) ; | |
1236 | } | |
1237 | } | |
1238 | } | |
1239 | else | |
1240 | { | |
1241 | if ( pVBInfo->VBInfo & ( SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | SetCRT2ToSCART | SetCRT2ToYPbPr | SetCRT2ToHiVisionTV ) ) | |
1242 | { | |
1243 | tempax |= SupportTV ; | |
1244 | ||
1245 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
1246 | { | |
1247 | tempax |= SupportTV1024 ; | |
1248 | } | |
1249 | ||
1250 | if ( !( pVBInfo->VBInfo & SetPALTV ) ) | |
1251 | { | |
1252 | if ( modeflag & NoSupportSimuTV ) | |
1253 | { | |
1254 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
1255 | { | |
1256 | if ( !( pVBInfo->VBInfo & SetNotSimuMode ) ) | |
1257 | { | |
1258 | return( 0 ) ; | |
1259 | } | |
1260 | } | |
1261 | } | |
1262 | } | |
1263 | } | |
1264 | } | |
1265 | } | |
1266 | else /* for LVDS */ | |
1267 | { | |
1268 | if ( pVBInfo->IF_DEF_CH7005 == 1 ) | |
1269 | { | |
1270 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
1271 | { | |
1272 | tempax |= SupportCHTV ; | |
1273 | } | |
1274 | } | |
1275 | ||
1276 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) | |
1277 | { | |
1278 | tempax |= SupportLCD ; | |
1279 | ||
1280 | if ( resinfo > 0x08 ) | |
1281 | return( 0 ) ; /* 1024x768 */ | |
1282 | ||
1283 | if ( pVBInfo->LCDResInfo < Panel1024x768 ) | |
1284 | { | |
1285 | if ( resinfo > 0x07 ) | |
1286 | return( 0 ) ; /* 800x600 */ | |
1287 | ||
1288 | if ( resinfo == 0x04 ) | |
1289 | return( 0 ) ; /* 512x384 */ | |
1290 | } | |
1291 | } | |
1292 | } | |
1293 | ||
1294 | for( ; pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].ModeID == tempbx ; ( *i )-- ) | |
1295 | { | |
1296 | infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].Ext_InfoFlag ; | |
1297 | if ( infoflag & tempax ) | |
1298 | { | |
1299 | return( 1 ) ; | |
1300 | } | |
1301 | if ( ( *i ) == 0 ) | |
1302 | break ; | |
1303 | } | |
1304 | ||
1305 | for( ( *i ) = 0 ; ; ( *i )++ ) | |
1306 | { | |
1307 | infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].Ext_InfoFlag ; | |
1308 | if ( pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].ModeID != tempbx ) | |
1309 | { | |
1310 | return( 0 ) ; | |
1311 | } | |
1312 | ||
1313 | if ( infoflag & tempax ) | |
1314 | { | |
1315 | return( 1 ) ; | |
1316 | } | |
1317 | } | |
1318 | return( 1 ) ; | |
1319 | } | |
1320 | ||
1321 | ||
1322 | /* --------------------------------------------------------------------- */ | |
1323 | /* Function : XGI_SetSync */ | |
1324 | /* Input : */ | |
1325 | /* Output : */ | |
1326 | /* Description : */ | |
1327 | /* --------------------------------------------------------------------- */ | |
80adad85 | 1328 | void XGI_SetSync(unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo) |
d7636e0b | 1329 | { |
82d6eb5b | 1330 | unsigned short sync , |
d7636e0b | 1331 | temp ; |
1332 | ||
1333 | sync = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag >> 8 ; /* di+0x00 */ | |
1334 | sync &= 0xC0 ; | |
1335 | temp = 0x2F ; | |
1336 | temp |= sync ; | |
1337 | XGINew_SetReg3( pVBInfo->P3c2 , temp ) ; /* Set Misc(3c2) */ | |
1338 | } | |
1339 | ||
1340 | ||
1341 | /* --------------------------------------------------------------------- */ | |
1342 | /* Function : XGI_SetCRT1CRTC */ | |
1343 | /* Input : */ | |
1344 | /* Output : */ | |
1345 | /* Description : */ | |
1346 | /* --------------------------------------------------------------------- */ | |
82d6eb5b BP |
1347 | void XGI_SetCRT1CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, |
1348 | unsigned short RefreshRateTableIndex, | |
80adad85 | 1349 | struct vb_device_info *pVBInfo, |
e4147abe | 1350 | struct xgi_hw_device_info *HwDeviceExtension) |
d7636e0b | 1351 | { |
108afbf8 | 1352 | unsigned char index, data; |
82d6eb5b | 1353 | unsigned short i; |
d7636e0b | 1354 | |
1355 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; /* Get index */ | |
1356 | index = index&IndexMask ; | |
1357 | ||
108afbf8 | 1358 | data = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x11); |
d7636e0b | 1359 | data &= 0x7F ; |
1360 | XGINew_SetReg1(pVBInfo->P3d4,0x11,data); /* Unlock CRTC */ | |
1361 | ||
1362 | for( i = 0 ; i < 8 ; i++ ) | |
1363 | pVBInfo->TimingH[ 0 ].data[ i ] = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ i ] ; | |
1364 | ||
1365 | for( i = 0 ; i < 7 ; i++ ) | |
1366 | pVBInfo->TimingV[ 0 ].data[ i ] = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ i + 8 ] ; | |
1367 | ||
1368 | XGI_SetCRT1Timing_H( pVBInfo, HwDeviceExtension ) ; | |
1369 | ||
1370 | ||
1371 | ||
1372 | XGI_SetCRT1Timing_V( ModeIdIndex , ModeNo, pVBInfo ) ; | |
1373 | ||
1374 | ||
1375 | if( pVBInfo->ModeType > 0x03 ) | |
1376 | XGINew_SetReg1( pVBInfo->P3d4 , 0x14 , 0x4F ) ; | |
1377 | } | |
1378 | ||
1379 | ||
1380 | /* --------------------------------------------------------------------- */ | |
1381 | /* Function : XGI_SetCRT1Timing_H */ | |
1382 | /* Input : */ | |
1383 | /* Output : */ | |
1384 | /* Description : */ | |
1385 | /* --------------------------------------------------------------------- */ | |
80adad85 | 1386 | void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo, struct xgi_hw_device_info *HwDeviceExtension) |
d7636e0b | 1387 | { |
108afbf8 | 1388 | unsigned char data, data1, pushax; |
82d6eb5b | 1389 | unsigned short i, j; |
d7636e0b | 1390 | |
1391 | /* XGINew_SetReg1( pVBInfo->P3d4 , 0x51 , 0 ) ; */ | |
1392 | /* XGINew_SetReg1( pVBInfo->P3d4 , 0x56 , 0 ) ; */ | |
1393 | /* XGINew_SetRegANDOR( pVBInfo->P3d4 ,0x11 , 0x7f , 0x00 ) ; */ | |
1394 | ||
108afbf8 | 1395 | data = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x11); /* unlock cr0-7 */ |
d7636e0b | 1396 | data &= 0x7F ; |
1397 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , data ) ; | |
1398 | ||
1399 | data = pVBInfo->TimingH[ 0 ].data[ 0 ] ; | |
1400 | XGINew_SetReg1( pVBInfo->P3d4 , 0 , data ) ; | |
1401 | ||
1402 | for( i = 0x01 ; i <= 0x04 ; i++ ) | |
1403 | { | |
1404 | data = pVBInfo->TimingH[ 0 ].data[ i ] ; | |
82d6eb5b | 1405 | XGINew_SetReg1( pVBInfo->P3d4, (unsigned short)(i + 1), data); |
d7636e0b | 1406 | } |
1407 | ||
1408 | for( i = 0x05 ; i <= 0x06 ; i++ ) | |
1409 | { | |
1410 | data = pVBInfo->TimingH[ 0 ].data[ i ]; | |
82d6eb5b | 1411 | XGINew_SetReg1(pVBInfo->P3c4, (unsigned short)(i + 6), data); |
d7636e0b | 1412 | } |
1413 | ||
108afbf8 | 1414 | j = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x0e); |
d7636e0b | 1415 | j &= 0x1F ; |
1416 | data = pVBInfo->TimingH[ 0 ].data[ 7 ] ; | |
1417 | data &= 0xE0 ; | |
1418 | data |= j ; | |
1419 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0e , data ) ; | |
1420 | ||
1421 | if ( HwDeviceExtension->jChipType >= XG20 ) | |
1422 | { | |
108afbf8 | 1423 | data = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x04); |
d7636e0b | 1424 | data = data - 1 ; |
1425 | XGINew_SetReg1( pVBInfo->P3d4 , 0x04 , data ) ; | |
108afbf8 | 1426 | data = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x05); |
d7636e0b | 1427 | data1 = data ; |
1428 | data1 &= 0xE0 ; | |
1429 | data &= 0x1F ; | |
1430 | if ( data == 0 ) | |
1431 | { | |
1432 | pushax = data ; | |
108afbf8 | 1433 | data = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x0c); |
d7636e0b | 1434 | data &= 0xFB ; |
1435 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0c , data ) ; | |
1436 | data = pushax ; | |
1437 | } | |
1438 | data = data - 1 ; | |
1439 | data |= data1 ; | |
1440 | XGINew_SetReg1( pVBInfo->P3d4 , 0x05 , data ) ; | |
108afbf8 | 1441 | data = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x0e); |
d7636e0b | 1442 | data = data >> 5 ; |
1443 | data = data + 3 ; | |
1444 | if ( data > 7 ) | |
1445 | data = data - 7 ; | |
1446 | data = data << 5 ; | |
1447 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0e , ~0xE0 , data ) ; | |
1448 | } | |
1449 | } | |
1450 | ||
1451 | ||
1452 | /* --------------------------------------------------------------------- */ | |
1453 | /* Function : XGI_SetCRT1Timing_V */ | |
1454 | /* Input : */ | |
1455 | /* Output : */ | |
1456 | /* Description : */ | |
1457 | /* --------------------------------------------------------------------- */ | |
82d6eb5b BP |
1458 | void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex, |
1459 | unsigned short ModeNo, | |
80adad85 | 1460 | struct vb_device_info *pVBInfo) |
d7636e0b | 1461 | { |
108afbf8 | 1462 | unsigned char data; |
82d6eb5b | 1463 | unsigned short i, j; |
d7636e0b | 1464 | |
1465 | /* XGINew_SetReg1( pVBInfo->P3d4 , 0x51 , 0 ) ; */ | |
1466 | /* XGINew_SetReg1( pVBInfo->P3d4 , 0x56 , 0 ) ; */ | |
1467 | /* XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x11 , 0x7f , 0x00 ) ; */ | |
1468 | ||
1469 | for( i = 0x00 ; i <= 0x01 ; i++ ) | |
1470 | { | |
1471 | data = pVBInfo->TimingV[ 0 ].data[ i ] ; | |
82d6eb5b | 1472 | XGINew_SetReg1(pVBInfo->P3d4, (unsigned short)(i + 6), data); |
d7636e0b | 1473 | } |
1474 | ||
1475 | for( i = 0x02 ; i <= 0x03 ; i++ ) | |
1476 | { | |
1477 | data = pVBInfo->TimingV[ 0 ].data[ i ] ; | |
82d6eb5b | 1478 | XGINew_SetReg1(pVBInfo->P3d4, (unsigned short)(i + 0x0e), data); |
d7636e0b | 1479 | } |
1480 | ||
1481 | for( i = 0x04 ; i <= 0x05 ; i++ ) | |
1482 | { | |
1483 | data = pVBInfo->TimingV[ 0 ].data[ i ] ; | |
82d6eb5b | 1484 | XGINew_SetReg1(pVBInfo->P3d4, (unsigned short)(i + 0x11), data); |
d7636e0b | 1485 | } |
1486 | ||
108afbf8 | 1487 | j = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x0a); |
d7636e0b | 1488 | j &= 0xC0 ; |
1489 | data = pVBInfo->TimingV[ 0 ].data[ 6 ] ; | |
1490 | data &= 0x3F ; | |
1491 | data |= j ; | |
1492 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0a , data ) ; | |
1493 | ||
1494 | data = pVBInfo->TimingV[ 0 ].data[ 6 ] ; | |
1495 | data &= 0x80 ; | |
1496 | data = data >> 2 ; | |
1497 | ||
1498 | if ( ModeNo <= 0x13 ) | |
1499 | i = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; | |
1500 | else | |
1501 | i = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
1502 | ||
1503 | i &= DoubleScanMode ; | |
1504 | if ( i ) | |
1505 | data |= 0x80 ; | |
1506 | ||
108afbf8 | 1507 | j = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x09); |
d7636e0b | 1508 | j &= 0x5F ; |
1509 | data |= j ; | |
1510 | XGINew_SetReg1( pVBInfo->P3d4 , 0x09 , data ) ; | |
1511 | } | |
1512 | ||
1513 | ||
1514 | /* --------------------------------------------------------------------- */ | |
1515 | /* Function : XGI_SetXG21CRTC */ | |
1516 | /* Input : Stand or enhance CRTC table */ | |
1517 | /* Output : Fill CRT Hsync/Vsync to SR2E/SR2F/SR30/SR33/SR34/SR3F */ | |
1518 | /* Description : Set LCD timing */ | |
1519 | /* --------------------------------------------------------------------- */ | |
82d6eb5b BP |
1520 | void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, |
1521 | unsigned short RefreshRateTableIndex, | |
80adad85 | 1522 | struct vb_device_info *pVBInfo) |
d7636e0b | 1523 | { |
108afbf8 | 1524 | unsigned char StandTableIndex, index, Tempax, Tempbx, Tempcx, Tempdx; |
82d6eb5b | 1525 | unsigned short Temp1, Temp2, Temp3; |
d7636e0b | 1526 | |
1527 | if ( ModeNo <= 0x13 ) | |
1528 | { | |
1529 | StandTableIndex = XGI_GetModePtr( ModeNo , ModeIdIndex, pVBInfo ) ; | |
1530 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 4 ] ; /* CR04 HRS */ | |
1531 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , Tempax ) ; /* SR2E [7:0]->HRS */ | |
1532 | Tempbx = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 5 ] ; /* Tempbx: CR05 HRE */ | |
1533 | Tempbx &= 0x1F ; /* Tempbx: HRE[4:0] */ | |
1534 | Tempcx = Tempax ; | |
1535 | Tempcx &= 0xE0 ; /* Tempcx: HRS[7:5] */ | |
1536 | Tempdx = Tempcx | Tempbx ; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */ | |
1537 | if ( Tempbx < ( Tempax & 0x1F ) ) /* IF HRE < HRS */ | |
1538 | Tempdx |= 0x20 ; /* Tempdx: HRE = HRE + 0x20 */ | |
1539 | Tempdx <<= 2 ; /* Tempdx << 2 */ | |
1540 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , Tempdx ) ; /* SR2F [7:2]->HRE */ | |
1541 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , 0xE3 , 00 ) ; | |
1542 | ||
1543 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 16 ] ; /* Tempax: CR16 VRS */ | |
1544 | Tempbx = Tempax ; /* Tempbx=Tempax */ | |
1545 | Tempax &= 0x01 ; /* Tempax: VRS[0] */ | |
1546 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x33 , Tempax ) ; /* SR33[0]->VRS */ | |
1547 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 7 ] ; /* Tempax: CR7 VRS */ | |
1548 | Tempdx = Tempbx >> 1 ; /* Tempdx: VRS[7:1] */ | |
1549 | Tempcx = Tempax & 0x04 ; /* Tempcx: CR7[2] */ | |
1550 | Tempcx <<= 5 ; /* Tempcx[7]: VRS[8] */ | |
1551 | Tempdx |= Tempcx ; /* Tempdx: VRS[8:1] */ | |
1552 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , Tempdx ) ; /* SR34[7:0]: VRS[8:1] */ | |
1553 | ||
108afbf8 | 1554 | Temp1 = Tempcx << 1 ; /* Temp1[8]: VRS[8] unsigned char -> unsigned short */ |
d7636e0b | 1555 | Temp1 |= Tempbx ; /* Temp1[8:0]: VRS[8:0] */ |
1556 | Tempax &= 0x80 ; /* Tempax[7]: CR7[7] */ | |
1557 | Temp2 = Tempax << 2 ; /* Temp2[9]: VRS[9] */ | |
1558 | Temp1 |= Temp2 ; /* Temp1[9:0]: VRS[9:0] */ | |
1559 | ||
1560 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 17 ] ; /* CR16 VRE */ | |
1561 | Tempax &= 0x0F ; /* Tempax[3:0]: VRE[3:0] */ | |
1562 | Temp2 = Temp1 & 0x3F0 ; /* Temp2[9:4]: VRS[9:4] */ | |
1563 | Temp2 |= Tempax ; /* Temp2[9:0]: VRE[9:0] */ | |
1564 | Temp3 = Temp1 & 0x0F ; /* Temp3[3:0]: VRS[3:0] */ | |
1565 | if ( Tempax < Temp3 ) /* VRE[3:0]<VRS[3:0] */ | |
1566 | Temp2 |= 0x10 ; /* Temp2: VRE + 0x10 */ | |
1567 | Temp2 &= 0xFF ; /* Temp2[7:0]: VRE[7:0] */ | |
108afbf8 | 1568 | Tempax = (unsigned char)Temp2; /* Tempax[7:0]: VRE[7:0] */ |
d7636e0b | 1569 | Tempax <<= 2 ; /* Tempax << 2: VRE[5:0] */ |
1570 | Temp1 &= 0x600 ; /* Temp1[10:9]: VRS[10:9] */ | |
1571 | Temp1 >>= 9 ; /* [10:9]->[1:0] */ | |
108afbf8 | 1572 | Tempbx = (unsigned char)Temp1; /* Tempbx[1:0]: VRS[10:9] */ |
d7636e0b | 1573 | Tempax |= Tempbx ; /* VRE[5:0]VRS[10:9] */ |
1574 | Tempax &= 0x7F ; | |
1575 | XGINew_SetReg1( pVBInfo->P3c4 , 0x3F , Tempax ) ; /* SR3F D[7:2]->VRE D[1:0]->VRS */ | |
1576 | } | |
1577 | else | |
1578 | { | |
1579 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; | |
1580 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 3 ] ; /* Tempax: CR4 HRS */ | |
1581 | Tempcx = Tempax ; /* Tempcx: HRS */ | |
1582 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , Tempax ) ; /* SR2E[7:0]->HRS */ | |
1583 | ||
1584 | Tempdx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 5 ] ; /* SRB */ | |
1585 | Tempdx &= 0xC0 ; /* Tempdx[7:6]: SRB[7:6] */ | |
1586 | Temp1 = Tempdx ; /* Temp1[7:6]: HRS[9:8] */ | |
1587 | Temp1 <<= 2 ; /* Temp1[9:8]: HRS[9:8] */ | |
1588 | Temp1 |= Tempax ; /* Temp1[9:0]: HRS[9:0] */ | |
1589 | ||
1590 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 4 ] ; /* CR5 HRE */ | |
1591 | Tempax &= 0x1F ; /* Tempax[4:0]: HRE[4:0] */ | |
1592 | ||
1593 | Tempbx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 6 ] ; /* SRC */ | |
1594 | Tempbx &= 0x04 ; /* Tempbx[2]: HRE[5] */ | |
1595 | Tempbx <<= 3 ; /* Tempbx[5]: HRE[5] */ | |
1596 | Tempax |= Tempbx ; /* Tempax[5:0]: HRE[5:0] */ | |
1597 | ||
1598 | Temp2 = Temp1 & 0x3C0 ; /* Temp2[9:6]: HRS[9:6] */ | |
1599 | Temp2 |= Tempax ; /* Temp2[9:0]: HRE[9:0] */ | |
1600 | ||
1601 | Tempcx &= 0x3F ; /* Tempcx[5:0]: HRS[5:0] */ | |
1602 | if( Tempax < Tempcx ) /* HRE < HRS */ | |
1603 | Temp2 |= 0x40 ; /* Temp2 + 0x40 */ | |
1604 | ||
1605 | Temp2 &= 0xFF ; | |
108afbf8 | 1606 | Tempax = (unsigned char)Temp2; /* Tempax: HRE[7:0] */ |
d7636e0b | 1607 | Tempax <<= 2 ; /* Tempax[7:2]: HRE[5:0] */ |
1608 | Tempdx >>= 6 ; /* Tempdx[7:6]->[1:0] HRS[9:8] */ | |
1609 | Tempax |= Tempdx ; /* HRE[5:0]HRS[9:8] */ | |
1610 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , Tempax ) ; /* SR2F D[7:2]->HRE, D[1:0]->HRS */ | |
1611 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , 0xE3 , 00 ) ; | |
1612 | ||
1613 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 10 ] ; /* CR10 VRS */ | |
1614 | Tempbx = Tempax ; /* Tempbx: VRS */ | |
1615 | Tempax &= 0x01 ; /* Tempax[0]: VRS[0] */ | |
1616 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x33 , Tempax ) ; /* SR33[0]->VRS[0] */ | |
1617 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 9 ] ; /* CR7[2][7] VRE */ | |
1618 | Tempcx = Tempbx >> 1 ; /* Tempcx[6:0]: VRS[7:1] */ | |
1619 | Tempdx = Tempax & 0x04 ; /* Tempdx[2]: CR7[2] */ | |
1620 | Tempdx <<= 5 ; /* Tempdx[7]: VRS[8] */ | |
1621 | Tempcx |= Tempdx ; /* Tempcx[7:0]: VRS[8:1] */ | |
1622 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , Tempcx ) ; /* SR34[8:1]->VRS */ | |
1623 | ||
1624 | Temp1 = Tempdx ; /* Temp1[7]: Tempdx[7] */ | |
1625 | Temp1 <<= 1 ; /* Temp1[8]: VRS[8] */ | |
1626 | Temp1 |= Tempbx ; /* Temp1[8:0]: VRS[8:0] */ | |
1627 | Tempax &= 0x80 ; | |
1628 | Temp2 = Tempax << 2 ; /* Temp2[9]: VRS[9] */ | |
1629 | Temp1 |= Temp2 ; /* Temp1[9:0]: VRS[9:0] */ | |
1630 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempax: SRA */ | |
1631 | Tempax &= 0x08 ; /* Tempax[3]: VRS[3] */ | |
1632 | Temp2 = Tempax ; | |
1633 | Temp2 <<= 7 ; /* Temp2[10]: VRS[10] */ | |
1634 | Temp1 |= Temp2 ; /* Temp1[10:0]: VRS[10:0] */ | |
1635 | ||
1636 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 11 ] ; /* Tempax: CR11 VRE */ | |
1637 | Tempax &= 0x0F ; /* Tempax[3:0]: VRE[3:0] */ | |
1638 | Tempbx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempbx: SRA */ | |
1639 | Tempbx &= 0x20 ; /* Tempbx[5]: VRE[5] */ | |
1640 | Tempbx >>= 1 ; /* Tempbx[4]: VRE[4] */ | |
1641 | Tempax |= Tempbx ; /* Tempax[4:0]: VRE[4:0] */ | |
1642 | Temp2 = Temp1 & 0x7E0 ; /* Temp2[10:5]: VRS[10:5] */ | |
1643 | Temp2 |= Tempax ; /* Temp2[10:5]: VRE[10:5] */ | |
1644 | ||
1645 | Temp3 = Temp1 & 0x1F ; /* Temp3[4:0]: VRS[4:0] */ | |
1646 | if ( Tempax < Temp3 ) /* VRE < VRS */ | |
1647 | Temp2 |= 0x20 ; /* VRE + 0x20 */ | |
1648 | ||
1649 | Temp2 &= 0xFF ; | |
108afbf8 | 1650 | Tempax = (unsigned char)Temp2; /* Tempax: VRE[7:0] */ |
d7636e0b | 1651 | Tempax <<= 2 ; /* Tempax[7:0]; VRE[5:0]00 */ |
1652 | Temp1 &= 0x600 ; /* Temp1[10:9]: VRS[10:9] */ | |
1653 | Temp1 >>= 9 ; /* Temp1[1:0]: VRS[10:9] */ | |
108afbf8 | 1654 | Tempbx = (unsigned char)Temp1; |
d7636e0b | 1655 | Tempax |= Tempbx ; /* Tempax[7:0]: VRE[5:0]VRS[10:9] */ |
1656 | Tempax &= 0x7F ; | |
1657 | XGINew_SetReg1( pVBInfo->P3c4 , 0x3F , Tempax ) ; /* SR3F D[7:2]->VRE D[1:0]->VRS */ | |
1658 | } | |
1659 | } | |
1660 | ||
82d6eb5b BP |
1661 | void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, |
1662 | unsigned short RefreshRateTableIndex, | |
80adad85 | 1663 | struct vb_device_info *pVBInfo) |
d7636e0b | 1664 | { |
82d6eb5b | 1665 | unsigned short StandTableIndex, index, Tempax, Tempbx, Tempcx, Tempdx; |
d7636e0b | 1666 | |
1667 | if ( ModeNo <= 0x13 ) | |
1668 | { | |
1669 | StandTableIndex = XGI_GetModePtr( ModeNo , ModeIdIndex, pVBInfo ) ; | |
1670 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 4 ] ; /* CR04 HRS */ | |
1671 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , Tempax ) ; /* SR2E [7:0]->HRS */ | |
1672 | Tempbx = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 5 ] ; /* Tempbx: CR05 HRE */ | |
1673 | Tempbx &= 0x1F ; /* Tempbx: HRE[4:0] */ | |
1674 | Tempcx = Tempax ; | |
1675 | Tempcx &= 0xE0 ; /* Tempcx: HRS[7:5] */ | |
1676 | Tempdx = Tempcx | Tempbx ; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */ | |
1677 | if ( Tempbx < ( Tempax & 0x1F ) ) /* IF HRE < HRS */ | |
1678 | Tempdx |= 0x20 ; /* Tempdx: HRE = HRE + 0x20 */ | |
1679 | Tempdx <<= 2 ; /* Tempdx << 2 */ | |
1680 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , Tempdx ) ; /* SR2F [7:2]->HRE */ | |
1681 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , 0xE3 , 00 ) ; | |
1682 | ||
1683 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 16 ] ; /* Tempax: CR10 VRS */ | |
1684 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , Tempax ) ; /* SR34[7:0]->VRS */ | |
1685 | Tempcx = Tempax ; /* Tempcx=Tempax=VRS[7:0] */ | |
1686 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 7 ] ; /* Tempax[7][2]: CR7[7][2] VRS[9][8] */ | |
1687 | Tempbx = Tempax ; /* Tempbx=CR07 */ | |
1688 | Tempax &= 0x04 ; /* Tempax[2]: CR07[2] VRS[8] */ | |
1689 | Tempax >>= 2; | |
1690 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x01, Tempax ) ; /* SR35 D[0]->VRS D[8] */ | |
1691 | Tempcx |= (Tempax << 8) ; /* Tempcx[8] |= VRS[8] */ | |
1692 | Tempcx |= (Tempbx & 0x80)<<2; /* Tempcx[9] |= VRS[9] */ | |
1693 | ||
1694 | ||
1695 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 17 ] ; /* CR11 VRE */ | |
1696 | Tempax &= 0x0F ; /* Tempax: VRE[3:0] */ | |
1697 | Tempbx = Tempcx ; /* Tempbx=Tempcx=VRS[9:0] */ | |
1698 | Tempbx &= 0x3F0 ; /* Tempbx[9:4]: VRS[9:4] */ | |
1699 | Tempbx |= Tempax ; /* Tempbx[9:0]: VRE[9:0] */ | |
1700 | if ( Tempax <= (Tempcx & 0x0F) ) /* VRE[3:0]<=VRS[3:0] */ | |
1701 | Tempbx |= 0x10 ; /* Tempbx: VRE + 0x10 */ | |
108afbf8 | 1702 | Tempax = (unsigned char)Tempbx & 0xFF; /* Tempax[7:0]: VRE[7:0] */ |
d7636e0b | 1703 | Tempax <<= 2 ; /* Tempax << 2: VRE[5:0] */ |
1704 | Tempcx = (Tempcx&0x600)>>8; /* Tempcx VRS[10:9] */ | |
1705 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0xFC, Tempax ) ; /* SR3F D[7:2]->VRE D[5:0] */ | |
1706 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x06, Tempcx ) ; /* SR35 D[2:1]->VRS[10:9] */ | |
1707 | } | |
1708 | else | |
1709 | { | |
1710 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; | |
1711 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 3 ] ; /* Tempax: CR4 HRS */ | |
1712 | Tempbx = Tempax ; /* Tempbx: HRS[7:0] */ | |
1713 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , Tempax ) ; /* SR2E[7:0]->HRS */ | |
1714 | ||
1715 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 5 ] ; /* SR0B */ | |
1716 | Tempax &= 0xC0 ; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/ | |
1717 | Tempbx |= (Tempax << 2); /* Tempbx: HRS[9:0] */ | |
1718 | ||
1719 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 4 ] ; /* CR5 HRE */ | |
1720 | Tempax &= 0x1F ; /* Tempax[4:0]: HRE[4:0] */ | |
1721 | Tempcx = Tempax ; /* Tempcx: HRE[4:0] */ | |
1722 | ||
1723 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 6 ] ; /* SRC */ | |
1724 | Tempax &= 0x04 ; /* Tempax[2]: HRE[5] */ | |
1725 | Tempax <<= 3 ; /* Tempax[5]: HRE[5] */ | |
1726 | Tempcx |= Tempax ; /* Tempcx[5:0]: HRE[5:0] */ | |
1727 | ||
1728 | Tempbx = Tempbx & 0x3C0 ; /* Tempbx[9:6]: HRS[9:6] */ | |
1729 | Tempbx |= Tempcx ; /* Tempbx: HRS[9:6]HRE[5:0] */ | |
1730 | ||
1731 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 3 ] ; /* Tempax: CR4 HRS */ | |
1732 | Tempax &= 0x3F ; /* Tempax: HRS[5:0] */ | |
1733 | if( Tempcx <= Tempax ) /* HRE[5:0] < HRS[5:0] */ | |
1734 | Tempbx += 0x40 ; /* Tempbx= Tempbx + 0x40 : HRE[9:0]*/ | |
1735 | ||
1736 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 5 ] ; /* SR0B */ | |
1737 | Tempax &= 0xC0 ; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/ | |
1738 | Tempax >>= 6; /* Tempax[1:0]: HRS[9:8]*/ | |
1739 | Tempax |= ((Tempbx << 2) & 0xFF); /* Tempax[7:2]: HRE[5:0] */ | |
1740 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , Tempax ) ; /* SR2F [7:2][1:0]: HRE[5:0]HRS[9:8] */ | |
1741 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , 0xE3 , 00 ) ; | |
1742 | ||
1743 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 10 ] ; /* CR10 VRS */ | |
1744 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , Tempax ) ; /* SR34[7:0]->VRS[7:0] */ | |
1745 | ||
1746 | Tempcx = Tempax ; /* Tempcx <= VRS[7:0] */ | |
1747 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 9 ] ; /* CR7[7][2] VRS[9][8] */ | |
1748 | Tempbx = Tempax ; /* Tempbx <= CR07[7:0] */ | |
1749 | Tempax = Tempax & 0x04 ; /* Tempax[2]: CR7[2]: VRS[8] */ | |
1750 | Tempax >>= 2 ; /* Tempax[0]: VRS[8] */ | |
1751 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x01 , Tempax ) ; /* SR35[0]: VRS[8] */ | |
1752 | Tempcx |= (Tempax<<8) ; /* Tempcx <= VRS[8:0] */ | |
1753 | Tempcx |= ((Tempbx&0x80)<<2) ; /* Tempcx <= VRS[9:0] */ | |
1754 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempax: SR0A */ | |
1755 | Tempax &= 0x08; /* SR0A[3] VRS[10] */ | |
1756 | Tempcx |= (Tempax<<7) ; /* Tempcx <= VRS[10:0] */ | |
1757 | ||
1758 | ||
1759 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 11 ] ; /* Tempax: CR11 VRE */ | |
1760 | Tempax &= 0x0F ; /* Tempax[3:0]: VRE[3:0] */ | |
1761 | Tempbx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempbx: SR0A */ | |
1762 | Tempbx &= 0x20 ; /* Tempbx[5]: SR0A[5]: VRE[4] */ | |
1763 | Tempbx >>= 1 ; /* Tempbx[4]: VRE[4] */ | |
1764 | Tempax |= Tempbx ; /* Tempax[4:0]: VRE[4:0] */ | |
1765 | Tempbx = Tempcx ; /* Tempbx: VRS[10:0] */ | |
1766 | Tempbx &= 0x7E0 ; /* Tempbx[10:5]: VRS[10:5] */ | |
1767 | Tempbx |= Tempax ; /* Tempbx: VRS[10:5]VRE[4:0] */ | |
1768 | ||
1769 | if ( Tempbx <= Tempcx ) /* VRE <= VRS */ | |
1770 | Tempbx |= 0x20 ; /* VRE + 0x20 */ | |
1771 | ||
1772 | Tempax = (Tempbx<<2) & 0xFF ; /* Tempax: Tempax[7:0]; VRE[5:0]00 */ | |
1773 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0xFC , Tempax ) ; /* SR3F[7:2]:VRE[5:0] */ | |
1774 | Tempax = Tempcx >> 8; | |
1775 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x07 , Tempax ) ; /* SR35[2:0]:VRS[10:8] */ | |
1776 | } | |
1777 | } | |
1778 | ||
1779 | ||
1780 | /* --------------------------------------------------------------------- */ | |
1781 | /* Function : XGI_SetXG21LCD */ | |
1782 | /* Input : */ | |
1783 | /* Output : FCLK duty cycle, FCLK delay compensation */ | |
1784 | /* Description : All values set zero */ | |
1785 | /* --------------------------------------------------------------------- */ | |
80adad85 | 1786 | void XGI_SetXG21LCD(struct vb_device_info *pVBInfo, |
82d6eb5b BP |
1787 | unsigned short RefreshRateTableIndex, |
1788 | unsigned short ModeNo) | |
d7636e0b | 1789 | { |
82d6eb5b BP |
1790 | unsigned short Data, Temp, b3CC; |
1791 | unsigned short XGI_P3cc; | |
d7636e0b | 1792 | |
1793 | XGI_P3cc = pVBInfo->P3cc ; | |
1794 | ||
1795 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2E , 0x00 ) ; | |
1796 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2F , 0x00 ) ; | |
1797 | XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , 0x00 ) ; | |
1798 | XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , 0x00 ) ; | |
1799 | if ( ((*pVBInfo->pDVOSetting)&0xC0) == 0xC0 ) | |
1800 | { | |
1801 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2E , *pVBInfo->pCR2E ) ; | |
1802 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2F , *pVBInfo->pCR2F ) ; | |
1803 | XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , *pVBInfo->pCR46 ) ; | |
1804 | XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , *pVBInfo->pCR47 ) ; | |
1805 | } | |
1806 | ||
1807 | Temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; | |
1808 | ||
1809 | if ( Temp & 0x01 ) | |
1810 | { | |
1811 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x06 , 0x40 ) ; /* 18 bits FP */ | |
1812 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x09 , 0x40 ) ; | |
1813 | } | |
1814 | ||
1815 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x1E , 0x01 ) ; /* Negative blank polarity */ | |
1816 | ||
1817 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x30 , ~0x20 ) ; | |
1818 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x35 , ~0x80 ) ; | |
1819 | ||
1820 | if ( ModeNo <= 0x13 ) | |
1821 | { | |
108afbf8 | 1822 | b3CC = (unsigned char) XGINew_GetReg2(XGI_P3cc); |
d7636e0b | 1823 | if ( b3CC & 0x40 ) |
1824 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */ | |
1825 | if ( b3CC & 0x80 ) | |
1826 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */ | |
1827 | } | |
1828 | else | |
1829 | { | |
1830 | Data = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; | |
1831 | if ( Data & 0x4000 ) | |
1832 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */ | |
1833 | if ( Data & 0x8000 ) | |
1834 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */ | |
1835 | } | |
1836 | } | |
1837 | ||
80adad85 | 1838 | void XGI_SetXG27LCD(struct vb_device_info *pVBInfo, |
82d6eb5b BP |
1839 | unsigned short RefreshRateTableIndex, |
1840 | unsigned short ModeNo) | |
d7636e0b | 1841 | { |
82d6eb5b BP |
1842 | unsigned short Data , Temp , b3CC ; |
1843 | unsigned short XGI_P3cc ; | |
d7636e0b | 1844 | |
1845 | XGI_P3cc = pVBInfo->P3cc ; | |
1846 | ||
1847 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2E , 0x00 ) ; | |
1848 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2F , 0x00 ) ; | |
1849 | XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , 0x00 ) ; | |
1850 | XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , 0x00 ) ; | |
1851 | ||
1852 | Temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; | |
1853 | if ( ( Temp & 0x03 ) == 0 ) /* dual 12 */ | |
1854 | { | |
1855 | XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , 0x13 ) ; | |
1856 | XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , 0x13 ) ; | |
1857 | } | |
1858 | ||
1859 | if ( ((*pVBInfo->pDVOSetting)&0xC0) == 0xC0 ) | |
1860 | { | |
1861 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2E , *pVBInfo->pCR2E ) ; | |
1862 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2F , *pVBInfo->pCR2F ) ; | |
1863 | XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , *pVBInfo->pCR46 ) ; | |
1864 | XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , *pVBInfo->pCR47 ) ; | |
1865 | } | |
1866 | ||
1867 | XGI_SetXG27FPBits(pVBInfo); | |
1868 | ||
1869 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x1E , 0x01 ) ; /* Negative blank polarity */ | |
1870 | ||
1871 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x30 , ~0x20 ) ; /* Hsync polarity */ | |
1872 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x35 , ~0x80 ) ; /* Vsync polarity */ | |
1873 | ||
1874 | if ( ModeNo <= 0x13 ) | |
1875 | { | |
108afbf8 | 1876 | b3CC = (unsigned char) XGINew_GetReg2(XGI_P3cc); |
d7636e0b | 1877 | if ( b3CC & 0x40 ) |
1878 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */ | |
1879 | if ( b3CC & 0x80 ) | |
1880 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */ | |
1881 | } | |
1882 | else | |
1883 | { | |
1884 | Data = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; | |
1885 | if ( Data & 0x4000 ) | |
1886 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */ | |
1887 | if ( Data & 0x8000 ) | |
1888 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */ | |
1889 | } | |
1890 | } | |
1891 | ||
1892 | /* --------------------------------------------------------------------- */ | |
1893 | /* Function : XGI_UpdateXG21CRTC */ | |
1894 | /* Input : */ | |
1895 | /* Output : CRT1 CRTC */ | |
1896 | /* Description : Modify CRT1 Hsync/Vsync to fix LCD mode timing */ | |
1897 | /* --------------------------------------------------------------------- */ | |
82d6eb5b | 1898 | void XGI_UpdateXG21CRTC(unsigned short ModeNo, |
80adad85 | 1899 | struct vb_device_info *pVBInfo, |
82d6eb5b | 1900 | unsigned short RefreshRateTableIndex) |
d7636e0b | 1901 | { |
1902 | int i , index = -1; | |
1903 | ||
1904 | XGINew_SetRegAND( pVBInfo->P3d4 , 0x11 , 0x7F ) ; /* Unlock CR0~7 */ | |
1905 | if ( ModeNo <= 0x13 ) | |
1906 | { | |
1907 | for( i = 0 ; i < 12 ; i++ ) | |
1908 | { | |
1909 | if ( ModeNo == pVBInfo->UpdateCRT1[ i ].ModeID ) | |
1910 | index = i ; | |
1911 | } | |
1912 | } | |
1913 | else | |
1914 | { | |
1915 | if ( ModeNo == 0x2E && ( pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC == RES640x480x60 ) ) | |
1916 | index = 12 ; | |
1917 | else if ( ModeNo == 0x2E && ( pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC == RES640x480x72 ) ) | |
1918 | index = 13 ; | |
1919 | else if ( ModeNo == 0x2F ) | |
1920 | index = 14 ; | |
1921 | else if ( ModeNo == 0x50 ) | |
1922 | index = 15 ; | |
1923 | else if ( ModeNo == 0x59 ) | |
1924 | index = 16 ; | |
1925 | } | |
1926 | ||
1927 | if( index != -1 ) | |
1928 | { | |
1929 | XGINew_SetReg1( pVBInfo->P3d4 , 0x02 , pVBInfo->UpdateCRT1[ index ].CR02 ) ; | |
1930 | XGINew_SetReg1( pVBInfo->P3d4 , 0x03 , pVBInfo->UpdateCRT1[ index ].CR03 ) ; | |
1931 | XGINew_SetReg1( pVBInfo->P3d4 , 0x15 , pVBInfo->UpdateCRT1[ index ].CR15 ) ; | |
1932 | XGINew_SetReg1( pVBInfo->P3d4 , 0x16 , pVBInfo->UpdateCRT1[ index ].CR16 ) ; | |
1933 | } | |
1934 | } | |
1935 | ||
1936 | ||
1937 | /* --------------------------------------------------------------------- */ | |
1938 | /* Function : XGI_SetCRT1DE */ | |
1939 | /* Input : */ | |
1940 | /* Output : */ | |
1941 | /* Description : */ | |
1942 | /* --------------------------------------------------------------------- */ | |
e4147abe | 1943 | void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension, |
82d6eb5b BP |
1944 | unsigned short ModeNo, |
1945 | unsigned short ModeIdIndex, | |
1946 | unsigned short RefreshRateTableIndex, | |
80adad85 | 1947 | struct vb_device_info *pVBInfo) |
d7636e0b | 1948 | { |
82d6eb5b | 1949 | unsigned short resindex, tempax, tempbx, tempcx, temp, modeflag; |
d7636e0b | 1950 | |
108afbf8 | 1951 | unsigned char data; |
d7636e0b | 1952 | |
1953 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; | |
1954 | ||
1955 | if ( ModeNo <= 0x13 ) | |
1956 | { | |
1957 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; | |
1958 | tempax = pVBInfo->StResInfo[ resindex ].HTotal ; | |
1959 | tempbx = pVBInfo->StResInfo[ resindex ].VTotal ; | |
1960 | } | |
1961 | else | |
1962 | { | |
1963 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
1964 | tempax = pVBInfo->ModeResInfo[ resindex ].HTotal ; | |
1965 | tempbx = pVBInfo->ModeResInfo[ resindex ].VTotal ; | |
1966 | } | |
1967 | ||
1968 | if ( modeflag & HalfDCLK ) | |
1969 | tempax = tempax >> 1 ; | |
1970 | ||
1971 | if ( ModeNo > 0x13 ) | |
1972 | { | |
1973 | if ( modeflag & HalfDCLK ) | |
1974 | tempax = tempax << 1 ; | |
1975 | ||
1976 | temp = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; | |
1977 | ||
1978 | if ( temp & InterlaceMode ) | |
1979 | tempbx = tempbx >> 1 ; | |
1980 | ||
1981 | if ( modeflag & DoubleScanMode ) | |
1982 | tempbx = tempbx << 1 ; | |
1983 | } | |
1984 | ||
1985 | tempcx = 8 ; | |
1986 | ||
1987 | /* if ( !( modeflag & Charx8Dot ) ) */ | |
1988 | /* tempcx = 9 ; */ | |
1989 | ||
1990 | tempax /= tempcx ; | |
1991 | tempax -= 1 ; | |
1992 | tempbx -= 1 ; | |
1993 | tempcx = tempax ; | |
108afbf8 BP |
1994 | temp = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x11); |
1995 | data = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x11); | |
d7636e0b | 1996 | data &= 0x7F ; |
1997 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , data ) ; /* Unlock CRTC */ | |
82d6eb5b BP |
1998 | XGINew_SetReg1(pVBInfo->P3d4, 0x01, (unsigned short)(tempcx & 0xff)); |
1999 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x0b, ~0x0c, (unsigned short)((tempcx & 0x0ff00) >> 10)); | |
2000 | XGINew_SetReg1(pVBInfo->P3d4, 0x12, (unsigned short)(tempbx & 0xff)); | |
d7636e0b | 2001 | tempax = 0 ; |
2002 | tempbx = tempbx >> 8 ; | |
2003 | ||
2004 | if ( tempbx & 0x01 ) | |
2005 | tempax |= 0x02 ; | |
2006 | ||
2007 | if ( tempbx & 0x02 ) | |
2008 | tempax |= 0x40 ; | |
2009 | ||
2010 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x42 , tempax ) ; | |
108afbf8 | 2011 | data = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x07); |
d7636e0b | 2012 | data &= 0xFF ; |
2013 | tempax = 0 ; | |
2014 | ||
2015 | if ( tempbx & 0x04 ) | |
2016 | tempax |= 0x02 ; | |
2017 | ||
2018 | XGINew_SetRegANDOR( pVBInfo->P3d4 ,0x0a , ~0x02 , tempax ) ; | |
2019 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , temp ) ; | |
2020 | } | |
2021 | ||
2022 | ||
2023 | /* --------------------------------------------------------------------- */ | |
2024 | /* Function : XGI_GetResInfo */ | |
2025 | /* Input : */ | |
2026 | /* Output : */ | |
2027 | /* Description : */ | |
2028 | /* --------------------------------------------------------------------- */ | |
82d6eb5b BP |
2029 | unsigned short XGI_GetResInfo(unsigned short ModeNo, |
2030 | unsigned short ModeIdIndex, | |
80adad85 | 2031 | struct vb_device_info *pVBInfo) |
d7636e0b | 2032 | { |
82d6eb5b | 2033 | unsigned short resindex; |
d7636e0b | 2034 | |
2035 | if ( ModeNo <= 0x13 ) | |
2036 | { | |
2037 | resindex = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */ | |
2038 | } | |
2039 | else | |
2040 | { | |
2041 | resindex = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */ | |
2042 | } | |
2043 | return( resindex ) ; | |
2044 | } | |
2045 | ||
2046 | ||
2047 | /* --------------------------------------------------------------------- */ | |
2048 | /* Function : XGI_SetCRT1Offset */ | |
2049 | /* Input : */ | |
2050 | /* Output : */ | |
2051 | /* Description : */ | |
2052 | /* --------------------------------------------------------------------- */ | |
82d6eb5b BP |
2053 | void XGI_SetCRT1Offset(unsigned short ModeNo, |
2054 | unsigned short ModeIdIndex, | |
2055 | unsigned short RefreshRateTableIndex, | |
e4147abe | 2056 | struct xgi_hw_device_info *HwDeviceExtension, |
80adad85 | 2057 | struct vb_device_info *pVBInfo) |
d7636e0b | 2058 | { |
82d6eb5b | 2059 | unsigned short temp , |
d7636e0b | 2060 | ah , |
2061 | al , | |
2062 | temp2 , | |
2063 | i , | |
2064 | DisplayUnit ; | |
2065 | ||
2066 | /* GetOffset */ | |
2067 | temp = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeInfo ; | |
2068 | temp = temp >> 8 ; | |
2069 | temp = pVBInfo->ScreenOffset[ temp ] ; | |
2070 | ||
2071 | temp2 = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; | |
2072 | temp2 &= InterlaceMode ; | |
2073 | ||
2074 | if ( temp2 ) | |
2075 | temp = temp << 1; | |
2076 | ||
2077 | temp2 = pVBInfo->ModeType - ModeEGA ; | |
2078 | ||
2079 | switch( temp2 ) | |
2080 | { | |
2081 | case 0: | |
2082 | temp2 = 1 ; | |
2083 | break ; | |
2084 | case 1: | |
2085 | temp2 = 2 ; | |
2086 | break ; | |
2087 | case 2: | |
2088 | temp2 = 4 ; | |
2089 | break ; | |
2090 | case 3: | |
2091 | temp2 = 4 ; | |
2092 | break ; | |
2093 | case 4: | |
2094 | temp2 = 6 ; | |
2095 | break; | |
2096 | case 5: | |
2097 | temp2 = 8 ; | |
2098 | break ; | |
2099 | default: | |
2100 | break ; | |
2101 | } | |
2102 | ||
2103 | if ( ( ModeNo >= 0x26 ) && ( ModeNo <= 0x28 ) ) | |
2104 | temp = temp * temp2 + temp2 / 2 ; | |
2105 | else | |
2106 | temp *= temp2 ; | |
2107 | ||
2108 | /* SetOffset */ | |
2109 | DisplayUnit = temp ; | |
2110 | temp2 = temp ; | |
2111 | temp = temp >> 8 ; /* ah */ | |
2112 | temp &= 0x0F ; | |
2113 | i = XGINew_GetReg1( pVBInfo->P3c4 , 0x0E ) ; | |
2114 | i &= 0xF0 ; | |
2115 | i |= temp ; | |
2116 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0E , i ) ; | |
2117 | ||
108afbf8 | 2118 | temp = (unsigned char)temp2; |
d7636e0b | 2119 | temp &= 0xFF ; /* al */ |
2120 | XGINew_SetReg1( pVBInfo->P3d4 , 0x13 , temp ) ; | |
2121 | ||
2122 | /* SetDisplayUnit */ | |
2123 | temp2 = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; | |
2124 | temp2 &= InterlaceMode ; | |
2125 | if ( temp2 ) | |
2126 | DisplayUnit >>= 1 ; | |
2127 | ||
2128 | DisplayUnit = DisplayUnit << 5 ; | |
2129 | ah = ( DisplayUnit & 0xff00 ) >> 8 ; | |
2130 | al = DisplayUnit & 0x00ff ; | |
2131 | if ( al == 0 ) | |
2132 | ah += 1 ; | |
2133 | else | |
2134 | ah += 2 ; | |
2135 | ||
2136 | if ( HwDeviceExtension->jChipType >= XG20 ) | |
2137 | if ( ( ModeNo == 0x4A ) | (ModeNo == 0x49 ) ) | |
2138 | ah -= 1 ; | |
2139 | ||
2140 | XGINew_SetReg1( pVBInfo->P3c4 , 0x10 , ah ) ; | |
2141 | } | |
2142 | ||
2143 | ||
2144 | /* --------------------------------------------------------------------- */ | |
2145 | /* Function : XGI_SetCRT1VCLK */ | |
2146 | /* Input : */ | |
2147 | /* Output : */ | |
2148 | /* Description : */ | |
2149 | /* --------------------------------------------------------------------- */ | |
82d6eb5b | 2150 | void XGI_SetCRT1VCLK(unsigned short ModeNo, unsigned short ModeIdIndex, |
e4147abe | 2151 | struct xgi_hw_device_info *HwDeviceExtension, |
82d6eb5b | 2152 | unsigned short RefreshRateTableIndex, |
80adad85 | 2153 | struct vb_device_info *pVBInfo) |
d7636e0b | 2154 | { |
108afbf8 | 2155 | unsigned char index, data; |
82d6eb5b | 2156 | unsigned short vclkindex ; |
d7636e0b | 2157 | |
2158 | if ( pVBInfo->IF_DEF_LVDS == 1 ) | |
2159 | { | |
2160 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ; | |
2161 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x31 ) & 0xCF ; | |
2162 | XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , data ) ; | |
2163 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ index ].SR2B ) ; | |
2164 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ index ].SR2C ) ; | |
2165 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2D , 0x01 ) ; | |
2166 | } | |
2167 | else if ( ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) && ( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) | |
2168 | { | |
2169 | vclkindex = XGI_GetVCLK2Ptr( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; | |
2170 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x31 ) & 0xCF ; | |
2171 | XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , data ) ; | |
2172 | data = pVBInfo->VBVCLKData[ vclkindex ].Part4_A ; | |
2173 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , data ) ; | |
2174 | data = pVBInfo->VBVCLKData[ vclkindex ].Part4_B ; | |
2175 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , data ) ; | |
2176 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2D , 0x01 ) ; | |
2177 | } | |
2178 | else | |
2179 | { | |
2180 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ; | |
2181 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x31 ) & 0xCF ; | |
2182 | XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , data ) ; | |
2183 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ index ].SR2B ) ; | |
2184 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ index ].SR2C ) ; | |
2185 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2D , 0x01 ) ; | |
2186 | } | |
2187 | ||
2188 | if ( HwDeviceExtension->jChipType >= XG20 ) | |
2189 | { | |
2190 | if ( pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag & HalfDCLK ) | |
2191 | { | |
2192 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x2B ) ; | |
2193 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , data ) ; | |
2194 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x2C ) ; | |
2195 | index = data ; | |
2196 | index &= 0xE0 ; | |
2197 | data &= 0x1F ; | |
2198 | data = data << 1 ; | |
2199 | data += 1 ; | |
2200 | data |= index ; | |
2201 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , data ) ; | |
2202 | } | |
2203 | } | |
2204 | } | |
2205 | ||
2206 | ||
2207 | /* --------------------------------------------------------------------- */ | |
2208 | /* Function : XGI_SetCRT1FIFO */ | |
2209 | /* Input : */ | |
2210 | /* Output : */ | |
2211 | /* Description : */ | |
2212 | /* --------------------------------------------------------------------- */ | |
82d6eb5b | 2213 | void XGI_SetCRT1FIFO(unsigned short ModeNo, |
e4147abe | 2214 | struct xgi_hw_device_info *HwDeviceExtension, |
80adad85 | 2215 | struct vb_device_info *pVBInfo) |
d7636e0b | 2216 | { |
82d6eb5b | 2217 | unsigned short data ; |
d7636e0b | 2218 | |
2219 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x3D ) ; | |
2220 | data &= 0xfe ; | |
2221 | XGINew_SetReg1( pVBInfo->P3c4 , 0x3D , data ) ; /* diable auto-threshold */ | |
2222 | ||
2223 | if ( ModeNo > 0x13 ) | |
2224 | { | |
2225 | XGINew_SetReg1( pVBInfo->P3c4 , 0x08 , 0x34 ) ; | |
2226 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x09 ) ; | |
2227 | data &= 0xC0 ; | |
2228 | XGINew_SetReg1( pVBInfo->P3c4 , 0x09 , data | 0x30) ; | |
2229 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x3D ) ; | |
2230 | data |= 0x01 ; | |
2231 | XGINew_SetReg1( pVBInfo->P3c4 , 0x3D , data ) ; | |
2232 | } | |
2233 | else | |
2234 | { | |
2235 | if (HwDeviceExtension->jChipType == XG27) | |
2236 | { | |
2237 | XGINew_SetReg1( pVBInfo->P3c4 , 0x08 , 0x0E ) ; | |
2238 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x09 ) ; | |
2239 | data &= 0xC0 ; | |
2240 | XGINew_SetReg1( pVBInfo->P3c4 , 0x09 , data | 0x20 ) ; | |
2241 | } | |
2242 | else | |
2243 | { | |
2244 | XGINew_SetReg1( pVBInfo->P3c4 , 0x08 , 0xAE ) ; | |
2245 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x09 ) ; | |
2246 | data &= 0xF0 ; | |
2247 | XGINew_SetReg1( pVBInfo->P3c4 , 0x09 , data ) ; | |
2248 | } | |
2249 | } | |
2250 | ||
2251 | if (HwDeviceExtension->jChipType == XG21) | |
2252 | { | |
2253 | XGI_SetXG21FPBits(pVBInfo); /* Fix SR9[7:6] can't read back */ | |
2254 | } | |
2255 | } | |
2256 | ||
2257 | ||
2258 | /* --------------------------------------------------------------------- */ | |
2259 | /* Function : XGI_SetCRT1ModeRegs */ | |
2260 | /* Input : */ | |
2261 | /* Output : */ | |
2262 | /* Description : */ | |
2263 | /* --------------------------------------------------------------------- */ | |
e4147abe | 2264 | void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension, |
82d6eb5b BP |
2265 | unsigned short ModeNo, unsigned short ModeIdIndex, |
2266 | unsigned short RefreshRateTableIndex, | |
80adad85 | 2267 | struct vb_device_info *pVBInfo) |
d7636e0b | 2268 | { |
82d6eb5b | 2269 | unsigned short data , |
d7636e0b | 2270 | data2 , |
2271 | data3 , | |
2272 | infoflag = 0 , | |
2273 | modeflag , | |
2274 | resindex , | |
2275 | xres ; | |
2276 | ||
2277 | if ( ModeNo > 0x13 ) | |
2278 | { | |
2279 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
2280 | infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; | |
2281 | } | |
2282 | else | |
2283 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag */ | |
2284 | ||
2285 | if ( XGINew_GetReg1( pVBInfo->P3d4 , 0x31 ) & 0x01 ) | |
2286 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x1F , 0x3F , 0x00 ) ; | |
2287 | ||
2288 | if ( ModeNo > 0x13 ) | |
2289 | data = infoflag ; | |
2290 | else | |
2291 | data = 0 ; | |
2292 | ||
2293 | data2 = 0 ; | |
2294 | ||
2295 | if ( ModeNo > 0x13 ) | |
2296 | { | |
2297 | if ( pVBInfo->ModeType > 0x02 ) | |
2298 | { | |
2299 | data2 |= 0x02 ; | |
2300 | data3 = pVBInfo->ModeType - ModeVGA ; | |
2301 | data3 = data3 << 2 ; | |
2302 | data2 |= data3 ; | |
2303 | } | |
2304 | } | |
2305 | ||
2306 | data &= InterlaceMode ; | |
2307 | ||
2308 | if ( data ) | |
2309 | data2 |= 0x20 ; | |
2310 | ||
2311 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x06 , ~0x3F , data2 ) ; | |
2312 | /* XGINew_SetReg1(pVBInfo->P3c4,0x06,data2); */ | |
2313 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; | |
2314 | if ( ModeNo <= 0x13 ) | |
2315 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; | |
2316 | else | |
2317 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */ | |
2318 | ||
2319 | data = 0x0000 ; | |
2320 | if ( infoflag & InterlaceMode ) | |
2321 | { | |
2322 | if ( xres == 1024 ) | |
2323 | data = 0x0035 ; | |
2324 | else if ( xres == 1280 ) | |
2325 | data = 0x0048 ; | |
2326 | } | |
2327 | ||
2328 | data2 = data & 0x00FF ; | |
2329 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x19 , 0xFF , data2 ) ; | |
2330 | data2 = ( data & 0xFF00 ) >> 8 ; | |
2331 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x19 , 0xFC , data2 ) ; | |
2332 | ||
2333 | if( modeflag & HalfDCLK ) | |
2334 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xF7 , 0x08 ) ; | |
2335 | ||
2336 | data2 = 0 ; | |
2337 | ||
2338 | if ( modeflag & LineCompareOff ) | |
2339 | data2 |= 0x08 ; | |
2340 | ||
2341 | if ( ModeNo > 0x13 ) | |
2342 | { | |
2343 | if ( pVBInfo->ModeType == ModeEGA ) | |
2344 | data2 |= 0x40 ; | |
2345 | } | |
2346 | ||
2347 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0F , ~0x48 , data2 ) ; | |
2348 | data = 0x60 ; | |
2349 | if ( pVBInfo->ModeType != ModeText ) | |
2350 | { | |
2351 | data = data ^ 0x60 ; | |
2352 | if ( pVBInfo->ModeType != ModeEGA ) | |
2353 | { | |
2354 | data = data ^ 0xA0 ; | |
2355 | } | |
2356 | } | |
2357 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x21 , 0x1F , data ) ; | |
2358 | ||
2359 | XGI_SetVCLKState( HwDeviceExtension , ModeNo , RefreshRateTableIndex, pVBInfo) ; | |
2360 | ||
2361 | /* if(modeflag&HalfDCLK)//030305 fix lowresolution bug */ | |
2362 | /* if(XGINew_IF_DEF_NEW_LOWRES) */ | |
2363 | /* XGI_VesaLowResolution(ModeNo,ModeIdIndex);//030305 fix lowresolution bug */ | |
2364 | ||
2365 | data=XGINew_GetReg1( pVBInfo->P3d4 , 0x31 ) ; | |
2366 | ||
2367 | if (HwDeviceExtension->jChipType == XG27 ) | |
2368 | { | |
2369 | if ( data & 0x40 ) | |
2370 | data = 0x2c ; | |
2371 | else | |
2372 | data = 0x6c ; | |
2373 | XGINew_SetReg1( pVBInfo->P3d4 , 0x52 , data ) ; | |
2374 | XGINew_SetRegOR( pVBInfo->P3d4 , 0x51 , 0x10 ) ; | |
2375 | } | |
2376 | else | |
2377 | if (HwDeviceExtension->jChipType >= XG20 ) | |
2378 | { | |
2379 | if ( data & 0x40 ) | |
2380 | data = 0x33 ; | |
2381 | else | |
2382 | data = 0x73 ; | |
2383 | XGINew_SetReg1( pVBInfo->P3d4 , 0x52 , data ) ; | |
2384 | XGINew_SetReg1( pVBInfo->P3d4 , 0x51 , 0x02 ) ; | |
2385 | } | |
2386 | else | |
2387 | { | |
2388 | if ( data & 0x40 ) | |
2389 | data = 0x2c ; | |
2390 | else | |
2391 | data = 0x6c ; | |
2392 | XGINew_SetReg1( pVBInfo->P3d4 , 0x52 , data ) ; | |
2393 | } | |
2394 | ||
2395 | } | |
2396 | ||
2397 | ||
2398 | /* --------------------------------------------------------------------- */ | |
2399 | /* Function : XGI_SetVCLKState */ | |
2400 | /* Input : */ | |
2401 | /* Output : */ | |
2402 | /* Description : */ | |
2403 | /* --------------------------------------------------------------------- */ | |
e4147abe | 2404 | void XGI_SetVCLKState(struct xgi_hw_device_info *HwDeviceExtension, |
82d6eb5b BP |
2405 | unsigned short ModeNo, |
2406 | unsigned short RefreshRateTableIndex, | |
80adad85 | 2407 | struct vb_device_info *pVBInfo) |
d7636e0b | 2408 | { |
82d6eb5b | 2409 | unsigned short data , |
d7636e0b | 2410 | data2 = 0 ; |
108afbf8 | 2411 | short VCLK ; |
d7636e0b | 2412 | |
108afbf8 | 2413 | unsigned char index; |
d7636e0b | 2414 | |
2415 | if ( ModeNo <= 0x13 ) | |
2416 | VCLK = 0 ; | |
2417 | else | |
2418 | { | |
2419 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ; | |
2420 | index &= IndexMask ; | |
2421 | VCLK = pVBInfo->VCLKData[ index ].CLOCK ; | |
2422 | } | |
2423 | ||
2424 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x32 ) ; | |
2425 | data &= 0xf3 ; | |
2426 | if ( VCLK >= 200 ) | |
2427 | data |= 0x0c ; /* VCLK > 200 */ | |
2428 | ||
2429 | if ( HwDeviceExtension->jChipType >= XG20 ) | |
2430 | data &= ~0x04 ; /* 2 pixel mode */ | |
2431 | ||
2432 | XGINew_SetReg1( pVBInfo->P3c4 , 0x32 , data ) ; | |
2433 | ||
2434 | if ( HwDeviceExtension->jChipType < XG20 ) | |
2435 | { | |
2436 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x1F ) ; | |
2437 | data &= 0xE7 ; | |
2438 | if ( VCLK < 200 ) | |
2439 | data |= 0x10 ; | |
2440 | XGINew_SetReg1( pVBInfo->P3c4 , 0x1F , data ) ; | |
2441 | } | |
2442 | ||
2443 | /* Jong for Adavantech LCD ripple issue | |
2444 | if ( ( VCLK >= 0 ) && ( VCLK < 135 ) ) | |
2445 | data2 = 0x03 ; | |
2446 | else if ( ( VCLK >= 135 ) && ( VCLK < 160 ) ) | |
2447 | data2 = 0x02 ; | |
2448 | else if ( ( VCLK >= 160 ) && ( VCLK < 260 ) ) | |
2449 | data2 = 0x01 ; | |
2450 | else if ( VCLK > 260 ) | |
2451 | data2 = 0x00 ; | |
2452 | */ | |
2453 | data2 = 0x00 ; | |
2454 | ||
2455 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x07 , 0xFC , data2 ) ; | |
2456 | if (HwDeviceExtension->jChipType >= XG27 ) | |
2457 | { | |
2458 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x40 , 0xFC , data2&0x03 ) ; | |
2459 | } | |
2460 | ||
2461 | ||
2462 | } | |
2463 | ||
2464 | ||
2465 | /* --------------------------------------------------------------------- */ | |
2466 | /* Function : XGI_VesaLowResolution */ | |
2467 | /* Input : */ | |
2468 | /* Output : */ | |
2469 | /* Description : */ | |
2470 | /* --------------------------------------------------------------------- */ | |
80adad85 | 2471 | /*void XGI_VesaLowResolution(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
d7636e0b | 2472 | { |
82d6eb5b | 2473 | unsigned short modeflag; |
d7636e0b | 2474 | |
2475 | if ( ModeNo > 0x13 ) | |
2476 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
2477 | else | |
2478 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; | |
2479 | ||
2480 | if ( ModeNo > 0x13 ) | |
2481 | { | |
2482 | if ( modeflag & DoubleScanMode ) | |
2483 | { | |
2484 | if ( modeflag & HalfDCLK ) | |
2485 | { | |
2486 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
2487 | { | |
2488 | if ( !( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) ) | |
2489 | { | |
2490 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
2491 | { | |
2492 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xf7 , 0x00 ) ; | |
2493 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0f , 0x7f , 0x00 ) ; | |
2494 | return ; | |
2495 | } | |
2496 | } | |
2497 | } | |
2498 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0f , 0xff , 0x80 ) ; | |
2499 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xf7 , 0x00 ) ; | |
2500 | return ; | |
2501 | } | |
2502 | } | |
2503 | } | |
2504 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0f , 0x7f , 0x00 ) ; | |
2505 | } | |
2506 | */ | |
2507 | ||
2508 | /* --------------------------------------------------------------------- */ | |
2509 | /* Function : XGI_LoadDAC */ | |
2510 | /* Input : */ | |
2511 | /* Output : */ | |
2512 | /* Description : */ | |
2513 | /* --------------------------------------------------------------------- */ | |
82d6eb5b BP |
2514 | void XGI_LoadDAC(unsigned short ModeNo, |
2515 | unsigned short ModeIdIndex, | |
80adad85 | 2516 | struct vb_device_info *pVBInfo) |
d7636e0b | 2517 | { |
82d6eb5b | 2518 | unsigned short data , data2 , time , |
d7636e0b | 2519 | i , j , k , m , n , o , |
2520 | si , di , bx , dl , al , ah , dh , | |
2521 | *table = NULL ; | |
2522 | ||
2523 | if ( ModeNo <= 0x13 ) | |
2524 | data = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; | |
2525 | else | |
2526 | data = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
2527 | ||
2528 | data &= DACInfoFlag ; | |
2529 | time = 64 ; | |
2530 | ||
2531 | if ( data == 0x00 ) | |
2532 | table = XGINew_MDA_DAC ; | |
2533 | else if ( data == 0x08 ) | |
2534 | table = XGINew_CGA_DAC ; | |
2535 | else if ( data == 0x10 ) | |
2536 | table = XGINew_EGA_DAC ; | |
2537 | else if ( data == 0x18 ) | |
2538 | { | |
2539 | time = 256 ; | |
2540 | table = XGINew_VGA_DAC ; | |
2541 | } | |
2542 | ||
2543 | if ( time == 256 ) | |
2544 | j = 16 ; | |
2545 | else | |
2546 | j = time ; | |
2547 | ||
2548 | XGINew_SetReg3( pVBInfo->P3c6 , 0xFF ) ; | |
2549 | XGINew_SetReg3( pVBInfo->P3c8 , 0x00 ) ; | |
2550 | ||
2551 | for( i = 0 ; i < j ; i++ ) | |
2552 | { | |
2553 | data = table[ i ] ; | |
2554 | ||
2555 | for( k = 0 ; k < 3 ; k++ ) | |
2556 | { | |
2557 | data2 = 0 ; | |
2558 | ||
2559 | if ( data & 0x01 ) | |
2560 | data2 = 0x2A ; | |
2561 | ||
2562 | if ( data & 0x02 ) | |
2563 | data2 += 0x15 ; | |
2564 | ||
2565 | XGINew_SetReg3( pVBInfo->P3c9 , data2 ) ; | |
2566 | data = data >> 2 ; | |
2567 | } | |
2568 | } | |
2569 | ||
2570 | if ( time == 256 ) | |
2571 | { | |
2572 | for( i = 16 ; i < 32 ; i++ ) | |
2573 | { | |
2574 | data = table[ i ] ; | |
2575 | ||
2576 | for( k = 0 ; k < 3 ; k++ ) | |
2577 | XGINew_SetReg3( pVBInfo->P3c9 , data ) ; | |
2578 | } | |
2579 | ||
2580 | si = 32 ; | |
2581 | ||
2582 | for( m = 0 ; m < 9 ; m++ ) | |
2583 | { | |
2584 | di = si ; | |
2585 | bx = si + 0x04 ; | |
2586 | dl = 0 ; | |
2587 | ||
2588 | for( n = 0 ; n < 3 ; n++ ) | |
2589 | { | |
2590 | for( o = 0 ; o < 5 ; o++ ) | |
2591 | { | |
2592 | dh = table[ si ] ; | |
2593 | ah = table[ di ] ; | |
2594 | al = table[ bx ] ; | |
2595 | si++ ; | |
2596 | XGI_WriteDAC( dl , ah , al , dh, pVBInfo ) ; | |
2597 | } | |
2598 | ||
2599 | si -= 2 ; | |
2600 | ||
2601 | for( o = 0 ; o < 3 ; o++ ) | |
2602 | { | |
2603 | dh = table[ bx ] ; | |
2604 | ah = table[ di ] ; | |
2605 | al = table[ si ] ; | |
2606 | si-- ; | |
2607 | XGI_WriteDAC( dl , ah , al , dh, pVBInfo ) ; | |
2608 | } | |
2609 | ||
2610 | dl++ ; | |
2611 | } | |
2612 | ||
2613 | si += 5 ; | |
2614 | } | |
2615 | } | |
2616 | } | |
2617 | ||
2618 | ||
2619 | /* --------------------------------------------------------------------- */ | |
2620 | /* Function : XGI_WriteDAC */ | |
2621 | /* Input : */ | |
2622 | /* Output : */ | |
2623 | /* Description : */ | |
2624 | /* --------------------------------------------------------------------- */ | |
82d6eb5b BP |
2625 | void XGI_WriteDAC(unsigned short dl, unsigned short ah, |
2626 | unsigned short al, unsigned short dh, | |
80adad85 | 2627 | struct vb_device_info *pVBInfo) |
d7636e0b | 2628 | { |
82d6eb5b | 2629 | unsigned short temp , bh , bl ; |
d7636e0b | 2630 | |
2631 | bh = ah ; | |
2632 | bl = al ; | |
2633 | ||
2634 | if ( dl != 0 ) | |
2635 | { | |
2636 | temp = bh ; | |
2637 | bh = dh ; | |
2638 | dh = temp ; | |
2639 | if ( dl == 1 ) | |
2640 | { | |
2641 | temp = bl ; | |
2642 | bl = dh ; | |
2643 | dh = temp ; | |
2644 | } | |
2645 | else | |
2646 | { | |
2647 | temp = bl ; | |
2648 | bl = bh ; | |
2649 | bh = temp ; | |
2650 | } | |
2651 | } | |
82d6eb5b BP |
2652 | XGINew_SetReg3(pVBInfo->P3c9, (unsigned short)dh); |
2653 | XGINew_SetReg3(pVBInfo->P3c9, (unsigned short)bh); | |
2654 | XGINew_SetReg3(pVBInfo->P3c9, (unsigned short)bl); | |
d7636e0b | 2655 | } |
2656 | ||
d7636e0b | 2657 | /* --------------------------------------------------------------------- */ |
2658 | /* Function : XGI_SetLCDAGroup */ | |
2659 | /* Input : */ | |
2660 | /* Output : */ | |
2661 | /* Description : */ | |
2662 | /* --------------------------------------------------------------------- */ | |
82d6eb5b BP |
2663 | void XGI_SetLCDAGroup(unsigned short ModeNo, |
2664 | unsigned short ModeIdIndex, | |
e4147abe | 2665 | struct xgi_hw_device_info *HwDeviceExtension, |
80adad85 | 2666 | struct vb_device_info *pVBInfo) |
d7636e0b | 2667 | { |
82d6eb5b BP |
2668 | unsigned short RefreshRateTableIndex ; |
2669 | /* unsigned short temp ; */ | |
d7636e0b | 2670 | |
2671 | /* pVBInfo->SelectCRT2Rate = 0 ; */ | |
2672 | ||
2673 | pVBInfo->SetFlag |= ProgrammingCRT2 ; | |
2674 | RefreshRateTableIndex = XGI_GetRatePtrCRT2( HwDeviceExtension, ModeNo , ModeIdIndex, pVBInfo ) ; | |
2675 | XGI_GetLVDSResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; | |
2676 | XGI_GetLVDSData( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo); | |
2677 | XGI_ModCRT1Regs( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; | |
2678 | XGI_SetLVDSRegs( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; | |
2679 | XGI_SetCRT2ECLK( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; | |
2680 | } | |
2681 | ||
2682 | ||
2683 | /* --------------------------------------------------------------------- */ | |
2684 | /* Function : XGI_GetLVDSResInfo */ | |
2685 | /* Input : */ | |
2686 | /* Output : */ | |
2687 | /* Description : */ | |
2688 | /* --------------------------------------------------------------------- */ | |
82d6eb5b BP |
2689 | void XGI_GetLVDSResInfo(unsigned short ModeNo, |
2690 | unsigned short ModeIdIndex, | |
80adad85 | 2691 | struct vb_device_info *pVBInfo) |
d7636e0b | 2692 | { |
82d6eb5b | 2693 | unsigned short resindex , xres , yres , modeflag ; |
d7636e0b | 2694 | |
2695 | if ( ModeNo <= 0x13 ) | |
2696 | { | |
2697 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */ | |
2698 | } | |
2699 | else | |
2700 | { | |
2701 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */ | |
2702 | } | |
2703 | ||
2704 | ||
2705 | /* if ( ModeNo > 0x13 ) */ | |
2706 | /* modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; */ | |
2707 | /* else */ | |
2708 | /* modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; */ | |
2709 | ||
2710 | if ( ModeNo <= 0x13 ) | |
2711 | { | |
2712 | resindex = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */ | |
2713 | } | |
2714 | else | |
2715 | { | |
2716 | resindex = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */ | |
2717 | } | |
2718 | ||
2719 | /* resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; */ | |
2720 | ||
2721 | if ( ModeNo <= 0x13 ) | |
2722 | { | |
2723 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; | |
2724 | yres = pVBInfo->StResInfo[ resindex ].VTotal ; | |
2725 | } | |
2726 | else | |
2727 | { | |
2728 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; | |
2729 | yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; | |
2730 | } | |
2731 | if ( ModeNo > 0x13 ) | |
2732 | { | |
2733 | if ( modeflag & HalfDCLK ) | |
2734 | xres = xres << 1 ; | |
2735 | ||
2736 | if ( modeflag & DoubleScanMode ) | |
2737 | yres = yres << 1 ; | |
2738 | } | |
2739 | /* if ( modeflag & Charx8Dot ) */ | |
2740 | /* { */ | |
2741 | ||
2742 | if ( xres == 720 ) | |
2743 | xres = 640 ; | |
2744 | ||
2745 | /* } */ | |
2746 | pVBInfo->VGAHDE = xres ; | |
2747 | pVBInfo->HDE = xres ; | |
2748 | pVBInfo->VGAVDE = yres ; | |
2749 | pVBInfo->VDE = yres ; | |
2750 | } | |
2751 | ||
2752 | ||
2753 | /* --------------------------------------------------------------------- */ | |
2754 | /* Function : XGI_GetLVDSData */ | |
2755 | /* Input : */ | |
2756 | /* Output : */ | |
2757 | /* Description : */ | |
2758 | /* --------------------------------------------------------------------- */ | |
82d6eb5b BP |
2759 | void XGI_GetLVDSData(unsigned short ModeNo, |
2760 | unsigned short ModeIdIndex, | |
2761 | unsigned short RefreshRateTableIndex, | |
80adad85 | 2762 | struct vb_device_info *pVBInfo) |
d7636e0b | 2763 | { |
82d6eb5b | 2764 | unsigned short tempbx ; |
80adad85 BP |
2765 | struct XGI330_LVDSDataStruct *LCDPtr = NULL ; |
2766 | struct XGI330_CHTVDataStruct *TVPtr = NULL ; | |
d7636e0b | 2767 | |
2768 | tempbx = 2 ; | |
2769 | ||
2770 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) | |
2771 | { | |
80adad85 | 2772 | LCDPtr = (struct XGI330_LVDSDataStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
d7636e0b | 2773 | pVBInfo->VGAHT = LCDPtr->VGAHT ; |
2774 | pVBInfo->VGAVT = LCDPtr->VGAVT ; | |
2775 | pVBInfo->HT = LCDPtr->LCDHT ; | |
2776 | pVBInfo->VT = LCDPtr->LCDVT ; | |
2777 | } | |
2778 | if ( pVBInfo->IF_DEF_CH7017 == 1 ) | |
2779 | { | |
2780 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
2781 | { | |
80adad85 | 2782 | TVPtr = (struct XGI330_CHTVDataStruct *)XGI_GetTVPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
d7636e0b | 2783 | pVBInfo->VGAHT = TVPtr->VGAHT ; |
2784 | pVBInfo->VGAVT = TVPtr->VGAVT ; | |
2785 | pVBInfo->HT = TVPtr->LCDHT ; | |
2786 | pVBInfo->VT = TVPtr->LCDVT ; | |
2787 | } | |
2788 | } | |
2789 | ||
2790 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) | |
2791 | { | |
2792 | if ( !( pVBInfo->LCDInfo & ( SetLCDtoNonExpanding | EnableScalingLCD ) ) ) | |
2793 | { | |
2794 | if ( ( pVBInfo->LCDResInfo == Panel1024x768 ) || ( pVBInfo->LCDResInfo == Panel1024x768x75 ) ) | |
2795 | { | |
2796 | pVBInfo->HDE = 1024 ; | |
2797 | pVBInfo->VDE = 768 ; | |
2798 | } | |
2799 | else if ( ( pVBInfo->LCDResInfo == Panel1280x1024 ) || ( pVBInfo->LCDResInfo == Panel1280x1024x75 ) ) | |
2800 | { | |
2801 | pVBInfo->HDE = 1280 ; | |
2802 | pVBInfo->VDE = 1024 ; | |
2803 | } | |
2804 | else if ( pVBInfo->LCDResInfo == Panel1400x1050 ) | |
2805 | { | |
2806 | pVBInfo->HDE = 1400 ; | |
2807 | pVBInfo->VDE = 1050 ; | |
2808 | } | |
2809 | else | |
2810 | { | |
2811 | pVBInfo->HDE = 1600 ; | |
2812 | pVBInfo->VDE = 1200 ; | |
2813 | } | |
2814 | } | |
2815 | } | |
2816 | } | |
2817 | ||
2818 | ||
2819 | /* --------------------------------------------------------------------- */ | |
2820 | /* Function : XGI_ModCRT1Regs */ | |
2821 | /* Input : */ | |
2822 | /* Output : */ | |
2823 | /* Description : */ | |
2824 | /* --------------------------------------------------------------------- */ | |
82d6eb5b BP |
2825 | void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex, |
2826 | unsigned short RefreshRateTableIndex, | |
e4147abe | 2827 | struct xgi_hw_device_info *HwDeviceExtension, |
80adad85 | 2828 | struct vb_device_info *pVBInfo) |
d7636e0b | 2829 | { |
108afbf8 | 2830 | unsigned char index; |
82d6eb5b | 2831 | unsigned short tempbx , i ; |
80adad85 BP |
2832 | struct XGI_LVDSCRT1HDataStruct *LCDPtr = NULL; |
2833 | struct XGI_LVDSCRT1VDataStruct *LCDPtr1 = NULL; | |
2834 | /* struct XGI330_CHTVDataStruct *TVPtr = NULL ; */ | |
2835 | struct XGI_CH7007TV_TimingHStruct *CH7007TV_TimingHPtr = NULL; | |
2836 | struct XGI_CH7007TV_TimingVStruct *CH7007TV_TimingVPtr = NULL; | |
d7636e0b | 2837 | |
2838 | if( ModeNo <= 0x13 ) | |
2839 | index = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; | |
2840 | else | |
2841 | index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; | |
2842 | ||
2843 | index= index & IndexMask ; | |
2844 | ||
2845 | if ( ( pVBInfo->IF_DEF_ScaleLCD == 0 ) || ( ( pVBInfo->IF_DEF_ScaleLCD == 1 ) && ( !( pVBInfo->LCDInfo & EnableScalingLCD ) ) ) ) | |
2846 | { | |
2847 | tempbx = 0 ; | |
2848 | ||
2849 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) | |
2850 | { | |
80adad85 | 2851 | LCDPtr = (struct XGI_LVDSCRT1HDataStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
d7636e0b | 2852 | |
2853 | for( i = 0 ; i < 8 ; i++ ) | |
2854 | pVBInfo->TimingH[ 0 ].data[ i ] = LCDPtr[ 0 ].Reg[ i ] ; | |
2855 | } | |
2856 | ||
2857 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) | |
2858 | { | |
2859 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
2860 | { | |
80adad85 | 2861 | CH7007TV_TimingHPtr = (struct XGI_CH7007TV_TimingHStruct *)XGI_GetTVPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
d7636e0b | 2862 | |
2863 | for( i = 0 ; i < 8 ; i++ ) | |
2864 | pVBInfo->TimingH[ 0 ].data[ i ] = CH7007TV_TimingHPtr[ 0 ].data[ i ] ; | |
2865 | } | |
2866 | } | |
2867 | ||
2868 | /* if ( pVBInfo->IF_DEF_CH7017 == 1 ) | |
2869 | { | |
2870 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
80adad85 | 2871 | TVPtr = ( struct XGI330_CHTVDataStruct *)XGI_GetTVPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
d7636e0b | 2872 | } */ |
2873 | ||
2874 | XGI_SetCRT1Timing_H(pVBInfo,HwDeviceExtension) ; | |
2875 | ||
2876 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) | |
2877 | { | |
2878 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , CH7007TV_TimingHPtr[ 0 ].data[ 8 ] ) ; | |
2879 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , CH7007TV_TimingHPtr[ 0 ].data[ 9 ] ) ; | |
2880 | } | |
2881 | ||
2882 | tempbx = 1 ; | |
2883 | ||
2884 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) | |
2885 | { | |
80adad85 | 2886 | LCDPtr1 = (struct XGI_LVDSCRT1VDataStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
d7636e0b | 2887 | for( i = 0 ; i < 7 ; i++ ) |
2888 | pVBInfo->TimingV[ 0 ].data[ i ] = LCDPtr1[ 0 ].Reg[ i ] ; | |
2889 | } | |
2890 | ||
2891 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) | |
2892 | { | |
2893 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
2894 | { | |
80adad85 | 2895 | CH7007TV_TimingVPtr = (struct XGI_CH7007TV_TimingVStruct *)XGI_GetTVPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
d7636e0b | 2896 | |
2897 | for( i = 0 ; i < 7 ; i++ ) | |
2898 | pVBInfo->TimingV[ 0 ].data[ i ] = CH7007TV_TimingVPtr[ 0 ].data[ i ] ; | |
2899 | } | |
2900 | } | |
2901 | /* if ( pVBInfo->IF_DEF_CH7017 == 1 ) | |
2902 | { | |
2903 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
80adad85 | 2904 | TVPtr = ( struct XGI330_CHTVDataStruct *)XGI_GetTVPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
d7636e0b | 2905 | } */ |
2906 | ||
2907 | XGI_SetCRT1Timing_V( ModeIdIndex , ModeNo , pVBInfo) ; | |
2908 | ||
2909 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) | |
2910 | { | |
2911 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x33 , ~0x01 , CH7007TV_TimingVPtr[ 0 ].data[ 7 ]&0x01 ) ; | |
2912 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , CH7007TV_TimingVPtr[ 0 ].data[8 ] ) ; | |
2913 | XGINew_SetReg1( pVBInfo->P3c4 , 0x3F , CH7007TV_TimingVPtr[ 0 ].data[9 ] ) ; | |
2914 | ||
2915 | } | |
2916 | } | |
2917 | } | |
2918 | ||
2919 | ||
2920 | ||
2921 | /* --------------------------------------------------------------------- */ | |
2922 | /* Function : XGI_SetLVDSRegs */ | |
2923 | /* Input : */ | |
2924 | /* Output : */ | |
2925 | /* Description : */ | |
2926 | /* --------------------------------------------------------------------- */ | |
82d6eb5b BP |
2927 | void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex, |
2928 | unsigned short RefreshRateTableIndex, | |
80adad85 | 2929 | struct vb_device_info *pVBInfo) |
d7636e0b | 2930 | { |
82d6eb5b | 2931 | unsigned short tempbx , tempax , tempcx , tempdx , push1 , push2 , modeflag ; |
d7636e0b | 2932 | unsigned long temp , temp1 , temp2 , temp3 , push3 ; |
80adad85 BP |
2933 | struct XGI330_LCDDataDesStruct *LCDPtr = NULL ; |
2934 | struct XGI330_LCDDataDesStruct2 *LCDPtr1 = NULL ; | |
d7636e0b | 2935 | |
2936 | if ( ModeNo > 0x13 ) | |
2937 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
2938 | else | |
2939 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; | |
2940 | ||
2941 | if ( !( pVBInfo->SetFlag & Win9xDOSMode ) ) | |
2942 | { | |
2943 | if ( ( pVBInfo->IF_DEF_CH7017 == 0 ) || ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) | |
2944 | { | |
2945 | if ( pVBInfo->IF_DEF_OEMUtil == 1 ) | |
2946 | { | |
2947 | tempbx = 8 ; | |
80adad85 | 2948 | LCDPtr = (struct XGI330_LCDDataDesStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
d7636e0b | 2949 | } |
2950 | ||
8922967e | 2951 | if ( ( pVBInfo->IF_DEF_OEMUtil == 0 ) || ( LCDPtr == NULL ) ) |
d7636e0b | 2952 | { |
2953 | tempbx = 3 ; | |
2954 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) | |
80adad85 | 2955 | LCDPtr1 = (struct XGI330_LCDDataDesStruct2 *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
d7636e0b | 2956 | else |
80adad85 | 2957 | LCDPtr = (struct XGI330_LCDDataDesStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
d7636e0b | 2958 | } |
2959 | ||
2960 | XGI_GetLCDSync( &tempax , &tempbx ,pVBInfo) ; | |
2961 | push1 = tempbx ; | |
2962 | push2 = tempax ; | |
2963 | ||
2964 | /* GetLCDResInfo */ | |
2965 | if ( ( pVBInfo->LCDResInfo == Panel1024x768 ) || ( pVBInfo->LCDResInfo == Panel1024x768x75 ) ) | |
2966 | { | |
2967 | tempax = 1024 ; | |
2968 | tempbx = 768 ; | |
2969 | } | |
2970 | else if ( ( pVBInfo->LCDResInfo == Panel1280x1024 ) || ( pVBInfo->LCDResInfo == Panel1280x1024x75 ) ) | |
2971 | { | |
2972 | tempax = 1280 ; | |
2973 | tempbx = 1024 ; | |
2974 | } | |
2975 | else if ( pVBInfo->LCDResInfo == Panel1400x1050 ) | |
2976 | { | |
2977 | tempax = 1400 ; | |
2978 | tempbx = 1050 ; | |
2979 | } | |
2980 | else | |
2981 | { | |
2982 | tempax = 1600 ; | |
2983 | tempbx = 1200 ; | |
2984 | } | |
2985 | ||
2986 | if ( pVBInfo->LCDInfo & SetLCDtoNonExpanding ) | |
2987 | { | |
2988 | pVBInfo->HDE=tempax; | |
2989 | pVBInfo->VDE=tempbx; | |
2990 | pVBInfo->VGAHDE=tempax; | |
2991 | pVBInfo->VGAVDE=tempbx; | |
2992 | } | |
2993 | ||
2994 | if ( ( pVBInfo->IF_DEF_ScaleLCD == 1 ) && ( pVBInfo->LCDInfo & EnableScalingLCD ) ) | |
2995 | { | |
2996 | tempax=pVBInfo->HDE; | |
2997 | tempbx=pVBInfo->VDE; | |
2998 | } | |
2999 | ||
3000 | tempax = pVBInfo->HT ; | |
3001 | ||
3002 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) | |
3003 | tempbx = LCDPtr1->LCDHDES ; | |
3004 | else | |
3005 | tempbx = LCDPtr->LCDHDES ; | |
3006 | ||
3007 | tempcx = pVBInfo->HDE ; | |
3008 | tempbx = tempbx & 0x0fff ; | |
3009 | tempcx += tempbx ; | |
3010 | ||
3011 | if ( tempcx >= tempax ) | |
3012 | tempcx -= tempax ; | |
3013 | ||
3014 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1A , tempbx & 0x07 ) ; | |
3015 | ||
3016 | tempcx = tempcx >> 3 ; | |
3017 | tempbx = tempbx >> 3 ; | |
3018 | ||
82d6eb5b BP |
3019 | XGINew_SetReg1(pVBInfo->Part1Port, 0x16, (unsigned short)(tempbx & 0xff)); |
3020 | XGINew_SetReg1(pVBInfo->Part1Port, 0x17, (unsigned short)(tempcx & 0xff)); | |
d7636e0b | 3021 | |
3022 | tempax = pVBInfo->HT ; | |
3023 | ||
3024 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) | |
3025 | tempbx = LCDPtr1->LCDHRS ; | |
3026 | else | |
3027 | tempbx = LCDPtr->LCDHRS ; | |
3028 | ||
3029 | tempcx = push2 ; | |
3030 | ||
3031 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) | |
3032 | tempcx = LCDPtr1->LCDHSync ; | |
3033 | ||
3034 | tempcx += tempbx ; | |
3035 | ||
3036 | if ( tempcx >= tempax ) | |
3037 | tempcx -= tempax ; | |
3038 | ||
3039 | tempax = tempbx & 0x07 ; | |
3040 | tempax = tempax >> 5 ; | |
3041 | tempcx = tempcx >> 3 ; | |
3042 | tempbx = tempbx >> 3 ; | |
3043 | ||
3044 | tempcx &= 0x1f ; | |
3045 | tempax |= tempcx ; | |
3046 | ||
3047 | XGINew_SetReg1( pVBInfo->Part1Port , 0x15 , tempax ) ; | |
82d6eb5b | 3048 | XGINew_SetReg1(pVBInfo->Part1Port, 0x14, (unsigned short)(tempbx & 0xff)); |
d7636e0b | 3049 | |
3050 | tempax = pVBInfo->VT ; | |
3051 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) | |
3052 | tempbx = LCDPtr1->LCDVDES ; | |
3053 | else | |
3054 | tempbx = LCDPtr->LCDVDES ; | |
3055 | tempcx = pVBInfo->VDE ; | |
3056 | ||
3057 | tempbx = tempbx & 0x0fff ; | |
3058 | tempcx += tempbx ; | |
3059 | if ( tempcx >= tempax ) | |
3060 | tempcx -= tempax ; | |
3061 | ||
82d6eb5b BP |
3062 | XGINew_SetReg1(pVBInfo->Part1Port, 0x1b, (unsigned short)(tempbx & 0xff)); |
3063 | XGINew_SetReg1(pVBInfo->Part1Port, 0x1c, (unsigned short)(tempcx & 0xff)); | |
d7636e0b | 3064 | |
3065 | tempbx = ( tempbx >> 8 ) & 0x07 ; | |
3066 | tempcx = ( tempcx >> 8 ) & 0x07 ; | |
3067 | ||
82d6eb5b | 3068 | XGINew_SetReg1(pVBInfo->Part1Port, 0x1d, (unsigned short)((tempcx << 3) | tempbx)); |
d7636e0b | 3069 | |
3070 | tempax = pVBInfo->VT ; | |
3071 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) | |
3072 | tempbx = LCDPtr1->LCDVRS ; | |
3073 | else | |
3074 | tempbx = LCDPtr->LCDVRS ; | |
3075 | ||
3076 | /* tempbx = tempbx >> 4 ; */ | |
3077 | tempcx = push1 ; | |
3078 | ||
3079 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) | |
3080 | tempcx = LCDPtr1->LCDVSync ; | |
3081 | ||
3082 | tempcx += tempbx ; | |
3083 | if ( tempcx >= tempax ) | |
3084 | tempcx -= tempax ; | |
3085 | ||
82d6eb5b BP |
3086 | XGINew_SetReg1(pVBInfo->Part1Port, 0x18, (unsigned short)(tempbx & 0xff)); |
3087 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, ~0x0f, (unsigned short)(tempcx & 0x0f)); | |
d7636e0b | 3088 | |
3089 | tempax = ( ( tempbx >> 8 ) & 0x07 ) << 3 ; | |
3090 | ||
3091 | tempbx = pVBInfo->VGAVDE ; | |
3092 | if ( tempbx != pVBInfo->VDE ) | |
3093 | tempax |= 0x40 ; | |
3094 | ||
3095 | if ( pVBInfo->LCDInfo & EnableLVDSDDA ) | |
3096 | tempax |= 0x40 ; | |
3097 | ||
3098 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x1a , 0x07 , tempax ) ; | |
3099 | ||
3100 | tempcx = pVBInfo->VGAVT ; | |
3101 | tempbx = pVBInfo->VDE ; | |
3102 | tempax = pVBInfo->VGAVDE ; | |
3103 | tempcx -= tempax ; | |
3104 | ||
3105 | temp = tempax ; /* 0430 ylshieh */ | |
3106 | temp1 = ( temp << 18 ) / tempbx ; | |
3107 | ||
82d6eb5b | 3108 | tempdx = (unsigned short)((temp << 18) % tempbx); |
d7636e0b | 3109 | |
3110 | if ( tempdx != 0 ) | |
3111 | temp1 += 1 ; | |
3112 | ||
3113 | temp2 = temp1 ; | |
3114 | push3 = temp2 ; | |
3115 | ||
82d6eb5b BP |
3116 | XGINew_SetReg1(pVBInfo->Part1Port, 0x37, (unsigned short)(temp2 & 0xff)); |
3117 | XGINew_SetReg1(pVBInfo->Part1Port, 0x36, (unsigned short)((temp2 >> 8) & 0xff)); | |
d7636e0b | 3118 | |
82d6eb5b | 3119 | tempbx = (unsigned short)(temp2 >> 16); |
d7636e0b | 3120 | tempax = tempbx & 0x03 ; |
3121 | ||
3122 | tempbx = pVBInfo->VGAVDE ; | |
3123 | if ( tempbx == pVBInfo->VDE ) | |
3124 | tempax |= 0x04 ; | |
3125 | ||
3126 | XGINew_SetReg1( pVBInfo->Part1Port , 0x35 , tempax ) ; | |
3127 | ||
3128 | if ( pVBInfo->VBType & VB_XGI301C ) | |
3129 | { | |
3130 | temp2 = push3 ; | |
82d6eb5b BP |
3131 | XGINew_SetReg1(pVBInfo->Part4Port, 0x3c, (unsigned short)(temp2 & 0xff)); |
3132 | XGINew_SetReg1(pVBInfo->Part4Port, 0x3b, (unsigned short)((temp2 >> 8) & 0xff)); | |
3133 | tempbx = (unsigned short)(temp2 >> 16); | |
3134 | XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x3a, ~0xc0, (unsigned short)((tempbx & 0xff) << 6)); | |
d7636e0b | 3135 | |
3136 | tempcx = pVBInfo->VGAVDE ; | |
3137 | if ( tempcx == pVBInfo->VDE ) | |
3138 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x30 , ~0x0c , 0x00 ) ; | |
3139 | else | |
3140 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x30 , ~0x0c , 0x08 ) ; | |
3141 | } | |
3142 | ||
3143 | tempcx = pVBInfo->VGAHDE ; | |
3144 | tempbx = pVBInfo->HDE ; | |
3145 | ||
3146 | temp1 = tempcx << 16 ; | |
3147 | ||
82d6eb5b | 3148 | tempax = (unsigned short)(temp1 / tempbx); |
d7636e0b | 3149 | |
3150 | if ( ( tempbx & 0xffff ) == ( tempcx & 0xffff ) ) | |
3151 | tempax = 65535 ; | |
3152 | ||
3153 | temp3 = tempax ; | |
3154 | temp1 = pVBInfo->VGAHDE << 16 ; | |
3155 | ||
3156 | temp1 /= temp3 ; | |
3157 | temp3 = temp3 << 16 ; | |
3158 | temp1 -= 1 ; | |
3159 | ||
3160 | temp3 = ( temp3 & 0xffff0000 ) + ( temp1 & 0xffff ) ; | |
3161 | ||
82d6eb5b | 3162 | tempax = (unsigned short)(temp3 & 0xff); |
d7636e0b | 3163 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1f , tempax ) ; |
3164 | ||
3165 | temp1 = pVBInfo->VGAVDE << 18 ; | |
3166 | temp1 = temp1 / push3 ; | |
82d6eb5b | 3167 | tempbx = (unsigned short)(temp1 & 0xffff); |
d7636e0b | 3168 | |
3169 | if ( pVBInfo->LCDResInfo == Panel1024x768 ) | |
3170 | tempbx -= 1 ; | |
3171 | ||
3172 | tempax = ( ( tempbx >> 8 ) & 0xff ) << 3 ; | |
82d6eb5b BP |
3173 | tempax |= (unsigned short)((temp3 >> 8) & 0x07); |
3174 | XGINew_SetReg1(pVBInfo->Part1Port, 0x20, (unsigned short)(tempax & 0xff)); | |
3175 | XGINew_SetReg1(pVBInfo->Part1Port, 0x21, (unsigned short)(tempbx & 0xff)); | |
d7636e0b | 3176 | |
3177 | temp3 = temp3 >> 16 ; | |
3178 | ||
3179 | if ( modeflag & HalfDCLK ) | |
3180 | temp3 = temp3 >> 1 ; | |
3181 | ||
82d6eb5b BP |
3182 | XGINew_SetReg1(pVBInfo->Part1Port , 0x22, (unsigned short)((temp3 >> 8) & 0xff)); |
3183 | XGINew_SetReg1(pVBInfo->Part1Port , 0x23, (unsigned short)(temp3 & 0xff)); | |
d7636e0b | 3184 | } |
3185 | } | |
3186 | } | |
3187 | ||
3188 | ||
3189 | /* --------------------------------------------------------------------- */ | |
3190 | /* Function : XGI_SetCRT2ECLK */ | |
3191 | /* Input : */ | |
3192 | /* Output : */ | |
3193 | /* Description : */ | |
3194 | /* --------------------------------------------------------------------- */ | |
80adad85 | 3195 | void XGI_SetCRT2ECLK(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo) |
d7636e0b | 3196 | { |
108afbf8 | 3197 | unsigned char di_0, di_1, tempal; |
d7636e0b | 3198 | int i ; |
3199 | ||
3200 | tempal = XGI_GetVCLKPtr( RefreshRateTableIndex , ModeNo , ModeIdIndex, pVBInfo ) ; | |
3201 | XGI_GetVCLKLen( tempal , &di_0 , &di_1, pVBInfo ) ; | |
3202 | XGI_GetLCDVCLKPtr( &di_0 , &di_1, pVBInfo ) ; | |
3203 | ||
3204 | for( i = 0 ; i < 4 ; i++ ) | |
3205 | { | |
82d6eb5b | 3206 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x31, ~0x30, (unsigned short)(0x10 * i)); |
d7636e0b | 3207 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
3208 | { | |
3209 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2b , di_0 ) ; | |
3210 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2c , di_1 ) ; | |
3211 | } | |
3212 | else if ( ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) && ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) ) | |
3213 | { | |
3214 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2e , di_0 ) ; | |
3215 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2f , di_1 ) ; | |
3216 | } | |
3217 | else | |
3218 | { | |
3219 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2b , di_0 ) ; | |
3220 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2c , di_1 ) ; | |
3221 | } | |
3222 | } | |
3223 | } | |
3224 | ||
3225 | ||
3226 | /* --------------------------------------------------------------------- */ | |
3227 | /* Function : XGI_UpdateModeInfo */ | |
3228 | /* Input : */ | |
3229 | /* Output : */ | |
3230 | /* Description : */ | |
3231 | /* --------------------------------------------------------------------- */ | |
80adad85 | 3232 | void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
d7636e0b | 3233 | { |
82d6eb5b | 3234 | unsigned short tempcl , |
d7636e0b | 3235 | tempch , |
3236 | temp , | |
3237 | tempbl , | |
3238 | tempax ; | |
3239 | ||
3240 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
3241 | { | |
3242 | tempcl = 0 ; | |
3243 | tempch = 0 ; | |
3244 | temp = XGINew_GetReg1( pVBInfo->P3c4 , 0x01 ) ; | |
3245 | ||
3246 | if ( !( temp & 0x20 ) ) | |
3247 | { | |
3248 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x17 ) ; | |
3249 | if ( temp & 0x80 ) | |
3250 | { | |
3251 | if ( ( HwDeviceExtension->jChipType >= XG20 ) || ( HwDeviceExtension->jChipType >= XG40 ) ) | |
3252 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x53 ) ; | |
3253 | else | |
3254 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x63 ) ; | |
3255 | ||
3256 | if ( !( temp & 0x40 ) ) | |
3257 | tempcl |= ActiveCRT1 ; | |
3258 | } | |
3259 | } | |
3260 | ||
3261 | temp = XGINew_GetReg1( pVBInfo->Part1Port , 0x2e ) ; | |
3262 | temp &= 0x0f ; | |
3263 | ||
3264 | if ( !( temp == 0x08 ) ) | |
3265 | { | |
3266 | tempax = XGINew_GetReg1( pVBInfo->Part1Port , 0x13 ) ; /* Check ChannelA by Part1_13 [2003/10/03] */ | |
3267 | if ( tempax & 0x04 ) | |
3268 | tempcl = tempcl | ActiveLCD ; | |
3269 | ||
3270 | temp &= 0x05 ; | |
3271 | ||
3272 | if ( !( tempcl & ActiveLCD ) ) | |
3273 | if ( temp == 0x01 ) | |
3274 | tempcl |= ActiveCRT2 ; | |
3275 | ||
3276 | if ( temp == 0x04 ) | |
3277 | tempcl |= ActiveLCD ; | |
3278 | ||
3279 | if ( temp == 0x05 ) | |
3280 | { | |
3281 | temp = XGINew_GetReg1( pVBInfo->Part2Port , 0x00 ) ; | |
3282 | ||
3283 | if( !( temp & 0x08 ) ) | |
3284 | tempch |= ActiveAVideo ; | |
3285 | ||
3286 | if ( !( temp & 0x04 ) ) | |
3287 | tempch |= ActiveSVideo ; | |
3288 | ||
3289 | if ( temp & 0x02 ) | |
3290 | tempch |= ActiveSCART ; | |
3291 | ||
3292 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) | |
3293 | { | |
3294 | if ( temp & 0x01 ) | |
3295 | tempch |= ActiveHiTV ; | |
3296 | } | |
3297 | ||
3298 | if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) | |
3299 | { | |
3300 | temp = XGINew_GetReg1( pVBInfo->Part2Port , 0x4d ) ; | |
3301 | ||
3302 | if ( temp & 0x10 ) | |
3303 | tempch |= ActiveYPbPr ; | |
3304 | } | |
3305 | ||
3306 | if ( tempch != 0 ) | |
3307 | tempcl |= ActiveTV ; | |
3308 | } | |
3309 | } | |
3310 | ||
3311 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x3d ) ; | |
3312 | if ( tempcl & ActiveLCD ) | |
3313 | { | |
3314 | if ( ( pVBInfo->SetFlag & ReserveTVOption ) ) | |
3315 | { | |
3316 | if ( temp & ActiveTV ) | |
3317 | tempcl |= ActiveTV ; | |
3318 | } | |
3319 | } | |
3320 | temp = tempcl ; | |
3321 | tempbl = ~ModeSwitchStatus ; | |
3322 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x3d , tempbl , temp ) ; | |
3323 | ||
3324 | if ( !( pVBInfo->SetFlag & ReserveTVOption ) ) | |
3325 | XGINew_SetReg1( pVBInfo->P3d4 , 0x3e , tempch ) ; | |
3326 | } | |
3327 | else | |
3328 | { | |
3329 | return ; | |
3330 | } | |
3331 | } | |
3332 | ||
3333 | ||
3334 | /* --------------------------------------------------------------------- */ | |
3335 | /* Function : XGI_GetVGAType */ | |
3336 | /* Input : */ | |
3337 | /* Output : */ | |
3338 | /* Description : */ | |
3339 | /* --------------------------------------------------------------------- */ | |
80adad85 | 3340 | void XGI_GetVGAType(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
d7636e0b | 3341 | { |
3342 | /* | |
3343 | if ( HwDeviceExtension->jChipType >= XG20 ) | |
3344 | { | |
3345 | pVBInfo->Set_VGAType = XG20; | |
3346 | } | |
3347 | else if ( HwDeviceExtension->jChipType >= XG40 ) | |
3348 | { | |
3349 | pVBInfo->Set_VGAType = VGA_XGI340 ; | |
3350 | } | |
3351 | */ | |
3352 | pVBInfo->Set_VGAType = HwDeviceExtension->jChipType; | |
3353 | } | |
3354 | ||
3355 | ||
3356 | /* --------------------------------------------------------------------- */ | |
3357 | /* Function : XGI_GetVBType */ | |
3358 | /* Input : */ | |
3359 | /* Output : */ | |
3360 | /* Description : */ | |
3361 | /* --------------------------------------------------------------------- */ | |
80adad85 | 3362 | void XGI_GetVBType(struct vb_device_info *pVBInfo) |
d7636e0b | 3363 | { |
82d6eb5b | 3364 | unsigned short flag , tempbx , tempah ; |
d7636e0b | 3365 | |
3366 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) | |
3367 | { | |
3368 | pVBInfo->VBType = VB_CH7007 ; | |
3369 | return; | |
3370 | } | |
3371 | if ( pVBInfo->IF_DEF_LVDS == 0 ) | |
3372 | { | |
3373 | tempbx = VB_XGI302B ; | |
3374 | flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x00 ) ; | |
3375 | if ( flag != 0x02 ) | |
3376 | { | |
3377 | tempbx = VB_XGI301 ; | |
3378 | flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x01 ) ; | |
3379 | if ( flag >= 0xB0 ) | |
3380 | { | |
3381 | tempbx = VB_XGI301B ; | |
3382 | if ( flag >= 0xC0 ) | |
3383 | { | |
3384 | tempbx = VB_XGI301C ; | |
3385 | if ( flag >= 0xD0 ) | |
3386 | { | |
3387 | tempbx = VB_XGI301LV ; | |
3388 | if ( flag >= 0xE0 ) | |
3389 | { | |
3390 | tempbx = VB_XGI302LV ; | |
3391 | tempah = XGINew_GetReg1( pVBInfo->Part4Port , 0x39 ) ; | |
3392 | if ( tempah != 0xFF ) | |
3393 | tempbx = VB_XGI301C ; | |
3394 | } | |
3395 | } | |
3396 | } | |
3397 | ||
3398 | if ( tempbx & ( VB_XGI301B | VB_XGI302B ) ) | |
3399 | { | |
3400 | flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x23 ) ; | |
3401 | ||
3402 | if ( !( flag & 0x02 ) ) | |
3403 | tempbx = tempbx | VB_NoLCD ; | |
3404 | } | |
3405 | } | |
3406 | } | |
3407 | pVBInfo->VBType = tempbx ; | |
3408 | } | |
3409 | /* | |
3410 | else if ( pVBInfo->IF_DEF_CH7017 == 1 ) | |
3411 | pVBInfo->VBType = VB_CH7017 ; | |
3412 | else //LVDS | |
3413 | pVBInfo->VBType = VB_LVDS_NS ; | |
3414 | */ | |
3415 | ||
3416 | } | |
3417 | ||
3418 | ||
3419 | /* --------------------------------------------------------------------- */ | |
3420 | /* Function : XGI_GetVBInfo */ | |
3421 | /* Input : */ | |
3422 | /* Output : */ | |
3423 | /* Description : */ | |
3424 | /* --------------------------------------------------------------------- */ | |
80adad85 | 3425 | void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
d7636e0b | 3426 | { |
82d6eb5b | 3427 | unsigned short tempax , |
d7636e0b | 3428 | push , |
3429 | tempbx , | |
3430 | temp , | |
3431 | modeflag ; | |
3432 | ||
3433 | if ( ModeNo <= 0x13 ) | |
3434 | { | |
3435 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; | |
3436 | } | |
3437 | else | |
3438 | { | |
3439 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
3440 | } | |
3441 | ||
3442 | pVBInfo->SetFlag = 0 ; | |
3443 | pVBInfo->ModeType = modeflag & ModeInfoFlag ; | |
3444 | tempbx = 0 ; | |
3445 | ||
3446 | if ( pVBInfo->VBType & 0xFFFF ) | |
3447 | { | |
3448 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x30 ) ; /* Check Display Device */ | |
3449 | tempbx = tempbx | temp ; | |
3450 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x31 ) ; | |
3451 | push = temp ; | |
3452 | push = push << 8 ; | |
3453 | tempax = temp << 8 ; | |
3454 | tempbx = tempbx | tempax ; | |
3455 | temp = ( SetCRT2ToDualEdge | SetCRT2ToYPbPr | SetCRT2ToLCDA | SetInSlaveMode | DisableCRT2Display ) ; | |
3456 | temp = 0xFFFF ^ temp ; | |
3457 | tempbx &= temp ; | |
3458 | ||
3459 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) ; | |
3460 | ||
3461 | if ( pVBInfo->IF_DEF_LCDA == 1 ) | |
3462 | { | |
3463 | ||
3464 | if ( ( pVBInfo->Set_VGAType >= XG20 ) || ( pVBInfo->Set_VGAType >= XG40 )) | |
3465 | { | |
3466 | if ( pVBInfo->IF_DEF_LVDS == 0 ) | |
3467 | { | |
3468 | /* if ( ( pVBInfo->VBType & VB_XGI302B ) || ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) ) */ | |
3469 | if ( pVBInfo->VBType & ( VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
3470 | { | |
3471 | if ( temp & EnableDualEdge ) | |
3472 | { | |
3473 | tempbx |= SetCRT2ToDualEdge ; | |
3474 | ||
3475 | if ( temp & SetToLCDA ) | |
3476 | tempbx |= SetCRT2ToLCDA ; | |
3477 | } | |
3478 | } | |
3479 | } | |
3480 | else if ( pVBInfo->IF_DEF_CH7017 == 1 ) | |
3481 | { | |
3482 | if ( pVBInfo->VBType & VB_CH7017 ) | |
3483 | { | |
3484 | if ( temp & EnableDualEdge ) | |
3485 | { | |
3486 | tempbx |= SetCRT2ToDualEdge ; | |
3487 | ||
3488 | if ( temp & SetToLCDA ) | |
3489 | tempbx |= SetCRT2ToLCDA ; | |
3490 | } | |
3491 | } | |
3492 | } | |
3493 | } | |
3494 | } | |
3495 | ||
3496 | if ( pVBInfo->IF_DEF_YPbPr == 1 ) | |
3497 | { | |
3498 | if ( ( ( pVBInfo->IF_DEF_LVDS == 0 ) && ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) ) ) | |
3499 | || ( ( pVBInfo->IF_DEF_CH7017 == 1 ) && ( pVBInfo->VBType&VB_CH7017 ) ) || ( (pVBInfo->IF_DEF_CH7007 == 1) && (pVBInfo->VBType&VB_CH7007) ) ) /* [Billy] 07/05/04 */ | |
3500 | { | |
3501 | if ( temp & SetYPbPr ) /* temp = CR38 */ | |
3502 | { | |
3503 | if ( pVBInfo->IF_DEF_HiVision == 1 ) | |
3504 | { | |
3505 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; /* shampoo add for new scratch */ | |
3506 | temp &= YPbPrMode ; | |
3507 | tempbx |= SetCRT2ToHiVisionTV ; | |
3508 | ||
3509 | if ( temp != YPbPrMode1080i ) { | |
3510 | tempbx &= ( ~SetCRT2ToHiVisionTV ) ; | |
3511 | tempbx |= SetCRT2ToYPbPr ; } | |
3512 | } | |
3513 | ||
3514 | /* tempbx |= SetCRT2ToYPbPr ; */ | |
3515 | } | |
3516 | } | |
3517 | } | |
3518 | ||
3519 | tempax = push ; /* restore CR31 */ | |
3520 | ||
3521 | if ( pVBInfo->IF_DEF_LVDS == 0 ) | |
3522 | { | |
3523 | if ( pVBInfo->IF_DEF_YPbPr == 1 ) | |
3524 | { | |
3525 | if ( pVBInfo->IF_DEF_HiVision == 1 ) | |
3526 | temp = 0x09FC ; | |
3527 | else | |
3528 | temp = 0x097C ; | |
3529 | } | |
3530 | else | |
3531 | { | |
3532 | if ( pVBInfo->IF_DEF_HiVision == 1 ) | |
3533 | temp = 0x01FC ; | |
3534 | else | |
3535 | temp = 0x017C ; | |
3536 | } | |
3537 | } | |
3538 | else /* 3nd party chip */ | |
3539 | { | |
3540 | if ( pVBInfo->IF_DEF_CH7017 == 1 ) | |
3541 | temp = ( SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA ) ; | |
3542 | else if ( pVBInfo->IF_DEF_CH7007 == 1 ) /* [Billy] 07/05/03 */ | |
3543 | { | |
3544 | temp = SetCRT2ToTV ; | |
3545 | } | |
3546 | else | |
3547 | temp = SetCRT2ToLCD ; | |
3548 | } | |
3549 | ||
3550 | if ( !( tempbx & temp ) ) | |
3551 | { | |
3552 | tempax |= DisableCRT2Display ; | |
3553 | tempbx = 0 ; | |
3554 | } | |
3555 | ||
3556 | if ( pVBInfo->IF_DEF_LCDA == 1 ) /* Select Display Device */ | |
3557 | { | |
3558 | if ( !( pVBInfo->VBType & VB_NoLCD ) ) | |
3559 | { | |
3560 | if ( tempbx & SetCRT2ToLCDA ) | |
3561 | { | |
3562 | if ( tempbx & SetSimuScanMode ) | |
3563 | tempbx &= ( ~( SetCRT2ToLCD | SetCRT2ToRAMDAC | SwitchToCRT2 ) ) ; | |
3564 | else | |
3565 | tempbx &= ( ~( SetCRT2ToLCD | SetCRT2ToRAMDAC | SetCRT2ToTV | SwitchToCRT2 ) ) ; | |
3566 | } | |
3567 | } | |
3568 | } | |
3569 | ||
3570 | /* shampoo add */ | |
3571 | if ( !( tempbx & ( SwitchToCRT2 | SetSimuScanMode ) ) ) /* for driver abnormal */ | |
3572 | { | |
3573 | if ( pVBInfo->IF_DEF_CRT2Monitor == 1 ) | |
3574 | { | |
3575 | if ( tempbx & SetCRT2ToRAMDAC ) | |
3576 | { | |
3577 | tempbx &= ( 0xFF00 | SetCRT2ToRAMDAC | SwitchToCRT2 | SetSimuScanMode ) ; | |
3578 | tempbx &= ( 0x00FF | ( ~SetCRT2ToYPbPr ) ) ; | |
3579 | } | |
3580 | } | |
3581 | else | |
3582 | tempbx &= ( ~( SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV ) ) ; | |
3583 | } | |
3584 | ||
3585 | if ( !( pVBInfo->VBType & VB_NoLCD ) ) | |
3586 | { | |
3587 | if ( tempbx & SetCRT2ToLCD ) | |
3588 | { | |
3589 | tempbx &= ( 0xFF00 | SetCRT2ToLCD | SwitchToCRT2 | SetSimuScanMode ) ; | |
3590 | tempbx &= ( 0x00FF | ( ~SetCRT2ToYPbPr ) ) ; | |
3591 | } | |
3592 | } | |
3593 | ||
3594 | if ( tempbx & SetCRT2ToSCART ) | |
3595 | { | |
3596 | tempbx &= ( 0xFF00 | SetCRT2ToSCART | SwitchToCRT2 | SetSimuScanMode ) ; | |
3597 | tempbx &= ( 0x00FF | ( ~SetCRT2ToYPbPr ) ) ; | |
3598 | } | |
3599 | ||
3600 | if ( pVBInfo->IF_DEF_YPbPr == 1 ) | |
3601 | { | |
3602 | if ( tempbx & SetCRT2ToYPbPr ) | |
3603 | tempbx &= ( 0xFF00 | SwitchToCRT2 | SetSimuScanMode ) ; | |
3604 | } | |
3605 | ||
3606 | if ( pVBInfo->IF_DEF_HiVision == 1 ) | |
3607 | { | |
3608 | if ( tempbx & SetCRT2ToHiVisionTV ) | |
3609 | tempbx &= ( 0xFF00 | SetCRT2ToHiVisionTV | SwitchToCRT2 | SetSimuScanMode ) ; | |
3610 | } | |
3611 | ||
3612 | if ( tempax & DisableCRT2Display ) /* Set Display Device Info */ | |
3613 | { | |
3614 | if ( !( tempbx & ( SwitchToCRT2 | SetSimuScanMode ) ) ) | |
3615 | tempbx = DisableCRT2Display ; | |
3616 | } | |
3617 | ||
3618 | if ( !( tempbx & DisableCRT2Display ) ) | |
3619 | { | |
3620 | if ( ( !( tempbx & DriverMode ) ) || ( !( modeflag & CRT2Mode ) ) ) | |
3621 | { | |
3622 | if ( pVBInfo->IF_DEF_LCDA == 1 ) | |
3623 | { | |
3624 | if ( !( tempbx & SetCRT2ToLCDA ) ) | |
3625 | tempbx |= ( SetInSlaveMode | SetSimuScanMode ) ; | |
3626 | } | |
3627 | ||
3628 | if ( pVBInfo->IF_DEF_VideoCapture == 1 ) | |
3629 | { | |
3630 | if ( ( ( HwDeviceExtension->jChipType == XG40 ) && ( pVBInfo->Set_VGAType == XG40 ) ) | |
3631 | || ( ( HwDeviceExtension->jChipType == XG41 ) && ( pVBInfo->Set_VGAType == XG41 ) ) | |
3632 | || ( ( HwDeviceExtension->jChipType == XG42 ) && ( pVBInfo->Set_VGAType == XG42 ) ) | |
3633 | || ( ( HwDeviceExtension->jChipType == XG45 ) && ( pVBInfo->Set_VGAType == XG45 ) ) ) | |
3634 | { | |
3635 | if ( ModeNo <= 13 ) | |
3636 | { | |
3637 | if ( !( tempbx & SetCRT2ToRAMDAC ) ) /*CRT2 not need to support*/ | |
3638 | { | |
3639 | tempbx &= ( 0x00FF | ( ~SetInSlaveMode ) ) ; | |
3640 | pVBInfo->SetFlag |= EnableVCMode ; | |
3641 | } | |
3642 | } | |
3643 | } | |
3644 | } | |
3645 | } | |
3646 | ||
3647 | /*LCD+TV can't support in slave mode (Force LCDA+TV->LCDB)*/ | |
3648 | if ( ( tempbx & SetInSlaveMode ) && ( tempbx & SetCRT2ToLCDA ) ) | |
3649 | { | |
3650 | tempbx ^= ( SetCRT2ToLCD | SetCRT2ToLCDA | SetCRT2ToDualEdge ) ; | |
3651 | pVBInfo->SetFlag |= ReserveTVOption ; | |
3652 | } | |
3653 | } | |
3654 | } | |
3655 | ||
3656 | pVBInfo->VBInfo = tempbx ; | |
3657 | } | |
3658 | ||
3659 | ||
3660 | /* --------------------------------------------------------------------- */ | |
3661 | /* Function : XGI_GetTVInfo */ | |
3662 | /* Input : */ | |
3663 | /* Output : */ | |
3664 | /* Description : */ | |
3665 | /* --------------------------------------------------------------------- */ | |
80adad85 | 3666 | void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
d7636e0b | 3667 | { |
82d6eb5b | 3668 | unsigned short temp , |
d7636e0b | 3669 | tempbx = 0 , |
3670 | resinfo = 0 , | |
3671 | modeflag , | |
3672 | index1 ; | |
3673 | ||
3674 | tempbx = 0 ; | |
3675 | resinfo = 0 ; | |
3676 | ||
3677 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
3678 | { | |
3679 | if ( ModeNo <= 0x13 ) | |
3680 | { | |
3681 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag */ | |
3682 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */ | |
3683 | } | |
3684 | else | |
3685 | { | |
3686 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
3687 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */ | |
3688 | } | |
3689 | ||
3690 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
3691 | { | |
3692 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; | |
3693 | tempbx = temp; | |
3694 | if ( tempbx & SetPALTV ) | |
3695 | { | |
3696 | tempbx &= ( SetCHTVOverScan | SetPALMTV | SetPALNTV | SetPALTV ) ; | |
3697 | if ( tempbx & SetPALMTV ) | |
3698 | tempbx &= ~SetPALTV ; /* set to NTSC if PAL-M */ | |
3699 | } | |
3700 | else | |
3701 | tempbx &= ( SetCHTVOverScan | SetNTSCJ | SetPALTV ) ; | |
3702 | /* | |
3703 | if ( pVBInfo->IF_DEF_LVDS == 0 ) | |
3704 | { | |
3705 | index1 = XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) ; //PAL-M/PAL-N Info | |
3706 | temp2 = ( index1 & 0xC0 ) >> 5 ; //00:PAL, 01:PAL-M, 10:PAL-N | |
3707 | tempbx |= temp2 ; | |
3708 | if ( temp2 & 0x02 ) //PAL-M | |
3709 | tempbx &= ( ~SetPALTV ) ; | |
3710 | } | |
3711 | */ | |
3712 | } | |
3713 | ||
3714 | if ( pVBInfo->IF_DEF_CH7017 == 1 ) | |
3715 | { | |
3716 | tempbx = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; | |
3717 | ||
3718 | if ( tempbx & TVOverScan ) | |
3719 | tempbx |= SetCHTVOverScan ; | |
3720 | } | |
3721 | ||
3722 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) /* [Billy] 07/05/04 */ | |
3723 | { | |
3724 | tempbx = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; | |
3725 | ||
3726 | if ( tempbx & TVOverScan ) | |
3727 | { | |
3728 | tempbx |= SetCHTVOverScan ; | |
3729 | } | |
3730 | } | |
3731 | ||
3732 | ||
3733 | if ( pVBInfo->IF_DEF_LVDS == 0 ) | |
3734 | { | |
3735 | if ( pVBInfo->VBInfo & SetCRT2ToSCART ) | |
3736 | tempbx |= SetPALTV ; | |
3737 | } | |
3738 | ||
3739 | if ( pVBInfo->IF_DEF_YPbPr == 1 ) | |
3740 | { | |
3741 | if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) | |
3742 | { | |
3743 | index1 = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; | |
3744 | index1 &= YPbPrMode ; | |
3745 | ||
3746 | if ( index1 == YPbPrMode525i ) | |
3747 | tempbx |= SetYPbPrMode525i ; | |
3748 | ||
3749 | if ( index1 == YPbPrMode525p ) | |
3750 | tempbx = tempbx | SetYPbPrMode525p; | |
3751 | if ( index1 == YPbPrMode750p) | |
3752 | tempbx = tempbx | SetYPbPrMode750p; | |
3753 | } | |
3754 | } | |
3755 | ||
3756 | if ( pVBInfo->IF_DEF_HiVision == 1 ) | |
3757 | { | |
3758 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) | |
3759 | { | |
3760 | tempbx = tempbx | SetYPbPrMode1080i | SetPALTV ; | |
3761 | } | |
3762 | } | |
3763 | ||
3764 | if ( pVBInfo->IF_DEF_LVDS == 0 ) | |
3765 | { /* shampoo */ | |
3766 | if ( ( pVBInfo->VBInfo & SetInSlaveMode ) && ( !( pVBInfo->VBInfo & SetNotSimuMode ) ) ) | |
3767 | tempbx |= TVSimuMode ; | |
3768 | ||
3769 | if ( !( tempbx & SetPALTV ) && ( modeflag > 13 ) && ( resinfo == 8 ) ) /* NTSC 1024x768, */ | |
3770 | tempbx |= NTSC1024x768 ; | |
3771 | ||
3772 | tempbx |= RPLLDIV2XO ; | |
3773 | ||
3774 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) | |
3775 | { | |
3776 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
3777 | tempbx &=( ~RPLLDIV2XO ) ; | |
3778 | } | |
3779 | else | |
3780 | { | |
3781 | if ( tempbx & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) | |
3782 | tempbx &= ( ~RPLLDIV2XO ) ; | |
3783 | else if ( !( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) ) | |
3784 | { | |
3785 | if ( tempbx & TVSimuMode ) | |
3786 | tempbx &= ( ~RPLLDIV2XO ) ; | |
3787 | } | |
3788 | } | |
3789 | } | |
3790 | } | |
3791 | pVBInfo->TVInfo = tempbx ; | |
3792 | } | |
3793 | ||
3794 | ||
3795 | /* --------------------------------------------------------------------- */ | |
3796 | /* Function : XGI_GetLCDInfo */ | |
3797 | /* Input : */ | |
3798 | /* Output : */ | |
3799 | /* Description : */ | |
3800 | /* --------------------------------------------------------------------- */ | |
108afbf8 | 3801 | unsigned char XGI_GetLCDInfo(unsigned short ModeNo, unsigned short ModeIdIndex, |
80adad85 | 3802 | struct vb_device_info *pVBInfo) |
d7636e0b | 3803 | { |
82d6eb5b | 3804 | unsigned short temp , |
d7636e0b | 3805 | tempax , |
3806 | tempbx , | |
3807 | modeflag , | |
3808 | resinfo = 0 , | |
3809 | LCDIdIndex ; | |
3810 | ||
3811 | pVBInfo->LCDResInfo = 0 ; | |
3812 | pVBInfo->LCDTypeInfo = 0 ; | |
3813 | pVBInfo->LCDInfo = 0 ; | |
3814 | ||
3815 | if ( ModeNo <= 0x13 ) | |
3816 | { | |
3817 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag // */ | |
3818 | } | |
3819 | else | |
3820 | { | |
3821 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
3822 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo// */ | |
3823 | } | |
3824 | ||
3825 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x36 ) ; /* Get LCD Res.Info */ | |
3826 | tempbx = temp & 0x0F ; | |
3827 | ||
3828 | if ( tempbx == 0 ) | |
3829 | tempbx = Panel1024x768 ; /* default */ | |
3830 | ||
3831 | /* LCD75 [2003/8/22] Vicent */ | |
3832 | if ( ( tempbx == Panel1024x768 ) || ( tempbx == Panel1280x1024 ) ) | |
3833 | { | |
3834 | if ( pVBInfo->VBInfo & DriverMode ) | |
3835 | { | |
3836 | tempax = XGINew_GetReg1( pVBInfo->P3d4 , 0x33 ) ; | |
3837 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) | |
3838 | tempax &= 0x0F ; | |
3839 | else | |
3840 | tempax = tempax >> 4 ; | |
3841 | ||
3842 | if ( ( resinfo == 6 ) || ( resinfo == 9 ) ) | |
3843 | { | |
3844 | if ( tempax >= 3 ) | |
3845 | tempbx |= PanelRef75Hz ; | |
3846 | } | |
3847 | else if ( ( resinfo == 7 ) || ( resinfo == 8 ) ) | |
3848 | { | |
3849 | if ( tempax >= 4 ) | |
3850 | tempbx |= PanelRef75Hz ; | |
3851 | } | |
3852 | } | |
3853 | } | |
3854 | ||
3855 | pVBInfo->LCDResInfo = tempbx ; | |
3856 | ||
3857 | /* End of LCD75 */ | |
3858 | ||
3859 | if( pVBInfo->IF_DEF_OEMUtil == 1 ) | |
3860 | { | |
3861 | pVBInfo->LCDTypeInfo = ( temp & 0xf0 ) >> 4 ; | |
3862 | } | |
3863 | ||
3864 | if ( !( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) | |
3865 | { | |
3866 | return 0; | |
3867 | } | |
3868 | ||
3869 | tempbx = 0 ; | |
3870 | ||
3871 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; | |
3872 | ||
3873 | temp &= ( ScalingLCD | LCDNonExpanding | LCDSyncBit | SetPWDEnable ) ; | |
3874 | ||
3875 | if ( ( pVBInfo->IF_DEF_ScaleLCD == 1 ) && ( temp & LCDNonExpanding ) ) | |
3876 | temp &= ~EnableScalingLCD ; | |
3877 | ||
3878 | tempbx |= temp ; | |
3879 | ||
3880 | LCDIdIndex = XGI_GetLCDCapPtr1(pVBInfo) ; | |
3881 | ||
3882 | tempax = pVBInfo->LCDCapList[ LCDIdIndex ].LCD_Capability ; | |
3883 | ||
3884 | if ( pVBInfo->IF_DEF_LVDS == 0 ) /* shampoo */ | |
3885 | { | |
3886 | if ( ( ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) ) && ( tempax & LCDDualLink ) ) | |
3887 | { | |
3888 | tempbx |= SetLCDDualLink ; | |
3889 | } | |
3890 | } | |
3891 | ||
3892 | if ( pVBInfo->IF_DEF_CH7017 == 1 ) | |
3893 | { | |
3894 | if ( tempax & LCDDualLink ) | |
3895 | { | |
3896 | tempbx |= SetLCDDualLink ; | |
3897 | } | |
3898 | } | |
3899 | ||
3900 | if ( pVBInfo->IF_DEF_LVDS == 0 ) | |
3901 | { | |
3902 | if ( ( pVBInfo->LCDResInfo == Panel1400x1050 ) && ( pVBInfo->VBInfo & SetCRT2ToLCD ) && ( ModeNo > 0x13 ) && ( resinfo == 9 ) && ( !( tempbx & EnableScalingLCD ) ) ) | |
3903 | tempbx |= SetLCDtoNonExpanding ; /* set to center in 1280x1024 LCDB for Panel1400x1050 */ | |
3904 | } | |
3905 | ||
3906 | /* | |
3907 | if ( tempax & LCDBToA ) | |
3908 | { | |
3909 | tempbx |= SetLCDBToA ; | |
3910 | } | |
3911 | */ | |
3912 | ||
3913 | if ( pVBInfo->IF_DEF_ExpLink == 1 ) | |
3914 | { | |
3915 | if ( modeflag & HalfDCLK ) | |
3916 | { | |
3917 | /* if ( !( pVBInfo->LCDInfo&LCDNonExpanding ) ) */ | |
3918 | if ( !( tempbx & SetLCDtoNonExpanding ) ) | |
3919 | { | |
3920 | tempbx |= EnableLVDSDDA ; | |
3921 | } | |
3922 | else | |
3923 | { | |
3924 | if ( ModeNo > 0x13 ) | |
3925 | { | |
3926 | if ( pVBInfo->LCDResInfo == Panel1024x768 ) | |
3927 | { | |
3928 | if ( resinfo == 4 ) | |
3929 | { /* 512x384 */ | |
3930 | tempbx |= EnableLVDSDDA ; | |
3931 | } | |
3932 | } | |
3933 | } | |
3934 | } | |
3935 | } | |
3936 | } | |
3937 | ||
3938 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
3939 | { | |
3940 | if ( pVBInfo->VBInfo & SetNotSimuMode ) | |
3941 | { | |
3942 | tempbx |= LCDVESATiming ; | |
3943 | } | |
3944 | } | |
3945 | else | |
3946 | { | |
3947 | tempbx |= LCDVESATiming ; | |
3948 | } | |
3949 | ||
3950 | pVBInfo->LCDInfo = tempbx ; | |
3951 | ||
3952 | if ( pVBInfo->IF_DEF_PWD == 1 ) | |
3953 | { | |
3954 | if ( pVBInfo->LCDInfo & SetPWDEnable ) | |
3955 | { | |
3956 | if ( ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) ) | |
3957 | { | |
3958 | if ( !( tempax & PWDEnable ) ) | |
3959 | { | |
3960 | pVBInfo->LCDInfo &= ~SetPWDEnable ; | |
3961 | } | |
3962 | } | |
3963 | } | |
3964 | } | |
3965 | ||
3966 | if ( pVBInfo->IF_DEF_LVDS == 0 ) | |
3967 | { | |
3968 | if ( tempax & ( LockLCDBToA | StLCDBToA ) ) | |
3969 | { | |
3970 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
3971 | { | |
3972 | if ( !( tempax & LockLCDBToA ) ) | |
3973 | { | |
3974 | if ( ModeNo <= 0x13 ) | |
3975 | { | |
3976 | pVBInfo->VBInfo &= ~( SetSimuScanMode | SetInSlaveMode | SetCRT2ToLCD ) ; | |
3977 | pVBInfo->VBInfo |= SetCRT2ToLCDA | SetCRT2ToDualEdge ; | |
3978 | } | |
3979 | } | |
3980 | } | |
3981 | } | |
3982 | } | |
3983 | ||
3984 | /* | |
3985 | if ( pVBInfo->IF_DEF_LVDS == 0 ) | |
3986 | { | |
3987 | if ( tempax & ( LockLCDBToA | StLCDBToA ) ) | |
3988 | { | |
3989 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
3990 | { | |
3991 | if ( !( ( !( tempax & LockLCDBToA ) ) && ( ModeNo > 0x13 ) ) ) | |
3992 | { | |
3993 | pVBInfo->VBInfo&=~(SetSimuScanMode|SetInSlaveMode|SetCRT2ToLCD); | |
3994 | pVBInfo->VBInfo|=SetCRT2ToLCDA|SetCRT2ToDualEdge; | |
3995 | } | |
3996 | } | |
3997 | } | |
3998 | } | |
3999 | */ | |
4000 | ||
4001 | return( 1 ) ; | |
4002 | } | |
4003 | ||
4004 | ||
4005 | /* --------------------------------------------------------------------- */ | |
4006 | /* Function : XGI_SearchModeID */ | |
4007 | /* Input : */ | |
4008 | /* Output : */ | |
4009 | /* Description : */ | |
4010 | /* --------------------------------------------------------------------- */ | |
108afbf8 BP |
4011 | unsigned char XGI_SearchModeID(unsigned short ModeNo, |
4012 | unsigned short *ModeIdIndex, | |
80adad85 | 4013 | struct vb_device_info *pVBInfo) |
d7636e0b | 4014 | { |
4015 | ||
d7636e0b | 4016 | |
d7636e0b | 4017 | |
4018 | #ifdef LINUX /* chiawen for linux solution */ | |
4019 | ||
4020 | if ( ModeNo <= 5 ) | |
4021 | ModeNo |= 1 ; | |
4022 | if ( ModeNo <= 0x13 ) | |
4023 | { | |
80adad85 | 4024 | /* for (*ModeIdIndex=0;*ModeIdIndex<sizeof(pVBInfo->SModeIDTable)/sizeof(struct XGI_StStruct);(*ModeIdIndex)++) */ |
d7636e0b | 4025 | for( *ModeIdIndex = 0 ; ; ( *ModeIdIndex )++ ) |
4026 | { | |
dda08c59 BP |
4027 | if (pVBInfo->SModeIDTable[*ModeIdIndex].St_ModeID == ModeNo) |
4028 | break; | |
4029 | if (pVBInfo->SModeIDTable[*ModeIdIndex].St_ModeID == 0xFF) | |
4030 | return 0; | |
d7636e0b | 4031 | } |
4032 | ||
4033 | if ( ModeNo == 0x07 ) | |
4034 | ( *ModeIdIndex )++ ; /* 400 lines */ | |
4035 | ||
4036 | if ( ModeNo <= 3 ) | |
4037 | ( *ModeIdIndex ) += 2 ; /* 400 lines */ | |
4038 | /* else 350 lines */ | |
4039 | } | |
4040 | else | |
4041 | { | |
80adad85 | 4042 | /* for (*ModeIdIndex=0;*ModeIdIndex<sizeof(pVBInfo->EModeIDTable)/sizeof(struct XGI_ExtStruct);(*ModeIdIndex)++) */ |
d7636e0b | 4043 | for( *ModeIdIndex = 0 ; ; ( *ModeIdIndex )++ ) |
4044 | { | |
dda08c59 BP |
4045 | if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID == ModeNo) |
4046 | break; | |
4047 | if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID == 0xFF) | |
4048 | return 0; | |
d7636e0b | 4049 | } |
4050 | } | |
4051 | ||
4052 | #endif | |
4053 | ||
dda08c59 | 4054 | return 1; |
d7636e0b | 4055 | } |
4056 | ||
4057 | ||
4058 | ||
4059 | ||
4060 | /* win2000 MM adapter not support standard mode! */ | |
4061 | ||
8922967e | 4062 | #if 0 |
d7636e0b | 4063 | /* --------------------------------------------------------------------- */ |
4064 | /* Function : */ | |
4065 | /* Input : */ | |
4066 | /* Output : */ | |
4067 | /* Description : */ | |
4068 | /* --------------------------------------------------------------------- */ | |
8922967e RD |
4069 | static unsigned char XGINew_CheckMemorySize( |
4070 | struct xgi_hw_device_info *HwDeviceExtension, | |
108afbf8 BP |
4071 | unsigned short ModeNo, |
4072 | unsigned short ModeIdIndex, | |
80adad85 | 4073 | struct vb_device_info *pVBInfo) |
d7636e0b | 4074 | { |
82d6eb5b | 4075 | unsigned short memorysize , |
d7636e0b | 4076 | modeflag , |
4077 | temp , | |
4078 | temp1 , | |
4079 | tmp ; | |
4080 | ||
4081 | /* if ( ( HwDeviceExtension->jChipType == XGI_650 ) || | |
4082 | ( HwDeviceExtension->jChipType == XGI_650M ) ) | |
4083 | { | |
dda08c59 | 4084 | return 1; |
d7636e0b | 4085 | } */ |
4086 | ||
4087 | if ( ModeNo <= 0x13 ) | |
4088 | { | |
4089 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; | |
4090 | } | |
4091 | else { | |
4092 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
4093 | } | |
4094 | ||
4095 | /* ModeType = modeflag&ModeInfoFlag ; // Get mode type */ | |
4096 | ||
4097 | memorysize = modeflag & MemoryInfoFlag ; | |
4098 | memorysize = memorysize > MemorySizeShift ; | |
4099 | memorysize++ ; /* Get memory size */ | |
4100 | ||
4101 | temp = XGINew_GetReg1( pVBInfo->P3c4 , 0x14 ) ; /* Get DRAM Size */ | |
4102 | tmp = temp ; | |
4103 | ||
4104 | if ( HwDeviceExtension->jChipType == XG40 ) | |
4105 | { | |
4106 | temp = 1 << ( ( temp & 0x0F0 ) >> 4 ) ; /* memory size per channel SR14[7:4] */ | |
4107 | if ( ( tmp & 0x0c ) == 0x0C ) /* Qual channels */ | |
4108 | { | |
4109 | temp <<= 2 ; | |
4110 | } | |
4111 | else if ( ( tmp & 0x0c ) == 0x08 ) /* Dual channels */ | |
4112 | { | |
4113 | temp <<= 1 ; | |
4114 | } | |
4115 | } | |
4116 | else if ( HwDeviceExtension->jChipType == XG42 ) | |
4117 | { | |
4118 | temp = 1 << ( ( temp & 0x0F0 ) >> 4 ) ; /* memory size per channel SR14[7:4] */ | |
4119 | if ( ( tmp & 0x04 ) == 0x04 ) /* Dual channels */ | |
4120 | { | |
4121 | temp <<= 1 ; | |
4122 | } | |
4123 | } | |
4124 | else if ( HwDeviceExtension->jChipType == XG45 ) | |
4125 | { | |
4126 | temp = 1 << ( ( temp & 0x0F0 ) >> 4 ) ; /* memory size per channel SR14[7:4] */ | |
4127 | if ( ( tmp & 0x0c ) == 0x0C ) /* Qual channels */ | |
4128 | { | |
4129 | temp <<= 2 ; | |
4130 | } | |
4131 | else if ( ( tmp & 0x0c ) == 0x08 ) /* triple channels */ | |
4132 | { | |
4133 | temp1 = temp ; | |
4134 | temp <<= 1 ; | |
4135 | temp += temp1 ; | |
4136 | } | |
4137 | else if ( ( tmp & 0x0c ) == 0x04 ) /* Dual channels */ | |
4138 | { | |
4139 | temp <<= 1 ; | |
4140 | } | |
4141 | } | |
dda08c59 BP |
4142 | if (temp < memorysize) |
4143 | return 0; | |
d7636e0b | 4144 | else |
dda08c59 | 4145 | return 1; |
d7636e0b | 4146 | } |
8922967e | 4147 | #endif |
d7636e0b | 4148 | |
4149 | /* --------------------------------------------------------------------- */ | |
4150 | /* Function : XGINew_IsLowResolution */ | |
4151 | /* Input : */ | |
4152 | /* Output : */ | |
4153 | /* Description : */ | |
4154 | /* --------------------------------------------------------------------- */ | |
80adad85 | 4155 | /*void XGINew_IsLowResolution(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned char XGINew_CheckMemorySize(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
d7636e0b | 4156 | { |
82d6eb5b BP |
4157 | unsigned short data ; |
4158 | unsigned short ModeFlag ; | |
d7636e0b | 4159 | |
4160 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x0F ) ; | |
4161 | data &= 0x7F ; | |
4162 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0F , data ) ; | |
4163 | ||
4164 | if ( ModeNo > 0x13 ) | |
4165 | { | |
4166 | ModeFlag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
4167 | if ( ( ModeFlag & HalfDCLK ) && ( ModeFlag & DoubleScanMode ) ) | |
4168 | { | |
4169 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x0F ) ; | |
4170 | data |= 0x80 ; | |
4171 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0F , data ) ; | |
4172 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x01 ) ; | |
4173 | data &= 0xF7 ; | |
4174 | XGINew_SetReg1( pVBInfo->P3c4 , 0x01 , data ) ; | |
4175 | } | |
4176 | } | |
4177 | } | |
4178 | ||
4179 | */ | |
4180 | ||
4181 | /* --------------------------------------------------------------------- */ | |
4182 | /* Function : XGI_DisplayOn */ | |
4183 | /* Input : */ | |
4184 | /* Output : */ | |
4185 | /* Description : */ | |
4186 | /* --------------------------------------------------------------------- */ | |
80adad85 | 4187 | void XGI_DisplayOn(struct xgi_hw_device_info *pXGIHWDE, struct vb_device_info *pVBInfo) |
d7636e0b | 4188 | { |
4189 | ||
4190 | XGINew_SetRegANDOR(pVBInfo->P3c4,0x01,0xDF,0x00); | |
4191 | if ( pXGIHWDE->jChipType == XG21 ) | |
4192 | { | |
4193 | if ( pVBInfo->IF_DEF_LVDS == 1 ) | |
4194 | { | |
4195 | if (!(XGI_XG21GetPSCValue( pVBInfo )&0x1)) | |
4196 | { | |
4197 | XGI_XG21BLSignalVDD( 0x01 , 0x01, pVBInfo ) ; /* LVDS VDD on */ | |
4198 | XGI_XG21SetPanelDelay( 2,pVBInfo ) ; | |
4199 | } | |
4200 | if (!(XGI_XG21GetPSCValue( pVBInfo )&0x20)) | |
4201 | { | |
4202 | XGI_XG21BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* LVDS signal on */ | |
4203 | } | |
4204 | XGI_XG21SetPanelDelay( 3,pVBInfo ) ; | |
4205 | XGI_XG21BLSignalVDD( 0x02 , 0x02, pVBInfo ) ; /* LVDS backlight on */ | |
4206 | } | |
4207 | else | |
4208 | { | |
4209 | XGI_XG21BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* DVO/DVI signal on */ | |
4210 | } | |
4211 | ||
4212 | } | |
4213 | ||
4214 | if (pVBInfo->IF_DEF_CH7007 == 1) /* [Billy] 07/05/23 For CH7007 */ | |
4215 | { | |
d7636e0b | 4216 | |
4217 | } | |
4218 | ||
4219 | ||
4220 | if ( pXGIHWDE->jChipType == XG27 ) | |
4221 | { | |
4222 | if ( pVBInfo->IF_DEF_LVDS == 1 ) | |
4223 | { | |
4224 | if (!(XGI_XG27GetPSCValue( pVBInfo )&0x1)) | |
4225 | { | |
4226 | XGI_XG27BLSignalVDD( 0x01 , 0x01, pVBInfo ) ; /* LVDS VDD on */ | |
4227 | XGI_XG21SetPanelDelay( 2,pVBInfo ) ; | |
4228 | } | |
4229 | if (!(XGI_XG27GetPSCValue( pVBInfo )&0x20)) | |
4230 | { | |
4231 | XGI_XG27BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* LVDS signal on */ | |
4232 | } | |
4233 | XGI_XG21SetPanelDelay( 3,pVBInfo ) ; | |
4234 | XGI_XG27BLSignalVDD( 0x02 , 0x02, pVBInfo ) ; /* LVDS backlight on */ | |
4235 | } | |
4236 | else | |
4237 | { | |
4238 | XGI_XG27BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* DVO/DVI signal on */ | |
4239 | } | |
4240 | ||
4241 | } | |
4242 | } | |
4243 | ||
4244 | ||
4245 | /* --------------------------------------------------------------------- */ | |
4246 | /* Function : XGI_DisplayOff */ | |
4247 | /* Input : */ | |
4248 | /* Output : */ | |
4249 | /* Description : */ | |
4250 | /* --------------------------------------------------------------------- */ | |
80adad85 | 4251 | void XGI_DisplayOff(struct xgi_hw_device_info *pXGIHWDE, struct vb_device_info *pVBInfo) |
d7636e0b | 4252 | { |
4253 | ||
4254 | if ( pXGIHWDE->jChipType == XG21 ) | |
4255 | { | |
4256 | if ( pVBInfo->IF_DEF_LVDS == 1 ) | |
4257 | { | |
4258 | XGI_XG21BLSignalVDD( 0x02 , 0x00, pVBInfo ) ; /* LVDS backlight off */ | |
4259 | XGI_XG21SetPanelDelay( 3,pVBInfo ) ; | |
4260 | } | |
4261 | else | |
4262 | { | |
4263 | XGI_XG21BLSignalVDD( 0x20 , 0x00, pVBInfo ) ; /* DVO/DVI signal off */ | |
4264 | } | |
4265 | } | |
4266 | ||
4267 | if (pVBInfo->IF_DEF_CH7007 == 1) /*[Billy] 07/05/23 For CH7007 */ | |
4268 | { | |
4269 | /* if( IsCH7007TVMode( pVBInfo ) == 0 ) */ | |
4270 | { | |
d7636e0b | 4271 | } |
4272 | } | |
4273 | ||
4274 | ||
4275 | if ( pXGIHWDE->jChipType == XG27 ) | |
4276 | { | |
4277 | if ((XGI_XG27GetPSCValue( pVBInfo )&0x2)) | |
4278 | { | |
4279 | XGI_XG27BLSignalVDD( 0x02 , 0x00, pVBInfo ) ; /* LVDS backlight off */ | |
4280 | XGI_XG21SetPanelDelay( 3,pVBInfo ) ; | |
4281 | } | |
4282 | ||
4283 | if ( pVBInfo->IF_DEF_LVDS == 0 ) | |
4284 | { | |
4285 | XGI_XG27BLSignalVDD( 0x20 , 0x00, pVBInfo ) ; /* DVO/DVI signal off */ | |
4286 | } | |
4287 | } | |
4288 | ||
4289 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xDF , 0x20 ) ; | |
4290 | } | |
4291 | ||
4292 | ||
4293 | /* --------------------------------------------------------------------- */ | |
4294 | /* Function : XGI_WaitDisply */ | |
4295 | /* Input : */ | |
4296 | /* Output : */ | |
4297 | /* Description : chiawen for sensecrt1 */ | |
4298 | /* --------------------------------------------------------------------- */ | |
80adad85 | 4299 | void XGI_WaitDisply(struct vb_device_info *pVBInfo) |
d7636e0b | 4300 | { |
4301 | while( ( XGINew_GetReg2( pVBInfo->P3da ) & 0x01 ) ) | |
4302 | break ; | |
4303 | ||
4304 | while( !( XGINew_GetReg2( pVBInfo->P3da ) & 0x01 ) ) | |
4305 | break ; | |
4306 | } | |
4307 | ||
4308 | /* --------------------------------------------------------------------- */ | |
4309 | /* Function : XGI_SenseCRT1 */ | |
4310 | /* Input : */ | |
4311 | /* Output : */ | |
4312 | /* Description : */ | |
4313 | /* --------------------------------------------------------------------- */ | |
4314 | ||
80adad85 | 4315 | void XGI_SenseCRT1(struct vb_device_info *pVBInfo) |
d7636e0b | 4316 | { |
108afbf8 BP |
4317 | unsigned char CRTCData[17] = { |
4318 | 0x5F , 0x4F , 0x50 , 0x82 , 0x55 , 0x81 , | |
4319 | 0x0B , 0x3E , 0xE9 , 0x0B , 0xDF , 0xE7 , | |
4320 | 0x04 , 0x00 , 0x00 , 0x05 , 0x00 }; | |
d7636e0b | 4321 | |
108afbf8 | 4322 | unsigned char SR01 = 0, SR1F = 0, SR07 = 0, SR06 = 0; |
d7636e0b | 4323 | |
108afbf8 BP |
4324 | unsigned char CR17, CR63, SR31; |
4325 | unsigned short temp ; | |
4326 | unsigned char DAC_TEST_PARMS[3] = { 0x0F, 0x0F, 0x0F } ; | |
d7636e0b | 4327 | |
4328 | int i ; | |
4329 | XGINew_SetReg1( pVBInfo->P3c4 , 0x05 , 0x86 ) ; | |
4330 | ||
4331 | /* [2004/05/06] Vicent to fix XG42 single LCD sense to CRT+LCD */ | |
4332 | XGINew_SetReg1( pVBInfo->P3d4 , 0x57 , 0x4A ) ; | |
108afbf8 | 4333 | XGINew_SetReg1(pVBInfo->P3d4, 0x53, (unsigned char)(XGINew_GetReg1(pVBInfo->P3d4, 0x53) | 0x02)); |
d7636e0b | 4334 | |
108afbf8 BP |
4335 | SR31 = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x31); |
4336 | CR63 = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x63); | |
4337 | SR01 = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x01); | |
d7636e0b | 4338 | |
108afbf8 BP |
4339 | XGINew_SetReg1(pVBInfo->P3c4, 0x01, (unsigned char)(SR01 & 0xDF)); |
4340 | XGINew_SetReg1(pVBInfo->P3d4, 0x63, (unsigned char)(CR63 & 0xBF)); | |
d7636e0b | 4341 | |
108afbf8 BP |
4342 | CR17 = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x17); |
4343 | XGINew_SetReg1(pVBInfo->P3d4, 0x17, (unsigned char)(CR17 | 0x80)) ; | |
d7636e0b | 4344 | |
108afbf8 BP |
4345 | SR1F = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x1F); |
4346 | XGINew_SetReg1(pVBInfo->P3c4, 0x1F, (unsigned char)(SR1F | 0x04)); | |
d7636e0b | 4347 | |
108afbf8 BP |
4348 | SR07 = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x07); |
4349 | XGINew_SetReg1(pVBInfo->P3c4, 0x07, (unsigned char)(SR07 & 0xFB)); | |
4350 | SR06 = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x06); | |
4351 | XGINew_SetReg1(pVBInfo->P3c4, 0x06, (unsigned char)(SR06 & 0xC3)); | |
d7636e0b | 4352 | |
4353 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , 0x00 ) ; | |
4354 | ||
4355 | for( i = 0 ; i < 8 ; i++ ) | |
82d6eb5b | 4356 | XGINew_SetReg1(pVBInfo->P3d4, (unsigned short)i, CRTCData[i]); |
d7636e0b | 4357 | |
4358 | for( i = 8 ; i < 11 ; i++ ) | |
82d6eb5b | 4359 | XGINew_SetReg1(pVBInfo->P3d4, (unsigned short)(i + 8), CRTCData[i]); |
d7636e0b | 4360 | |
4361 | for( i = 11 ; i < 13 ; i++ ) | |
82d6eb5b | 4362 | XGINew_SetReg1(pVBInfo->P3d4, (unsigned short)(i + 4), CRTCData[i]); |
d7636e0b | 4363 | |
4364 | for( i = 13 ; i < 16 ; i++ ) | |
82d6eb5b | 4365 | XGINew_SetReg1(pVBInfo->P3c4, (unsigned short)(i - 3), CRTCData[i]); |
d7636e0b | 4366 | |
108afbf8 | 4367 | XGINew_SetReg1(pVBInfo->P3c4, 0x0E, (unsigned char)(CRTCData[16] & 0xE0)); |
d7636e0b | 4368 | |
4369 | XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , 0x00 ) ; | |
4370 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , 0x1B ) ; | |
4371 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , 0xE1 ) ; | |
4372 | ||
4373 | XGINew_SetReg3( pVBInfo->P3c8 , 0x00 ) ; | |
4374 | ||
4375 | for( i = 0 ; i < 256 ; i++ ) | |
4376 | { | |
108afbf8 BP |
4377 | XGINew_SetReg3((pVBInfo->P3c8 + 1), (unsigned char)DAC_TEST_PARMS[0]); |
4378 | XGINew_SetReg3((pVBInfo->P3c8 + 1), (unsigned char)DAC_TEST_PARMS[1]); | |
4379 | XGINew_SetReg3((pVBInfo->P3c8 + 1), (unsigned char)DAC_TEST_PARMS[2]); | |
d7636e0b | 4380 | } |
4381 | ||
4382 | XGI_VBLongWait( pVBInfo ) ; | |
4383 | XGI_VBLongWait( pVBInfo ) ; | |
4384 | XGI_VBLongWait( pVBInfo ) ; | |
4385 | ||
4386 | XGINew_LCD_Wait_Time( 0x01 , pVBInfo ) ; | |
4387 | ||
4388 | XGI_WaitDisply( pVBInfo ) ; | |
4389 | temp = XGINew_GetReg2( pVBInfo->P3c2 ) ; | |
4390 | ||
4391 | if( temp & 0x10 ) | |
4392 | { | |
4393 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x32 , 0xDF , 0x20 ) ; | |
4394 | } | |
4395 | else | |
4396 | { | |
4397 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x32 , 0xDF , 0x00 ) ; | |
4398 | } | |
4399 | ||
4400 | /* alan, avoid display something, set BLACK DAC if not restore DAC */ | |
4401 | XGINew_SetReg3( pVBInfo->P3c8 , 0x00 ) ; | |
4402 | ||
4403 | for( i = 0 ; i < 256 ; i++ ) | |
4404 | { | |
4405 | XGINew_SetReg3( ( pVBInfo->P3c8 + 1 ) , 0 ) ; | |
4406 | XGINew_SetReg3( ( pVBInfo->P3c8 + 1 ) , 0 ) ; | |
4407 | XGINew_SetReg3( ( pVBInfo->P3c8 + 1 ) , 0 ) ; | |
4408 | } | |
4409 | ||
4410 | XGINew_SetReg1( pVBInfo->P3c4 , 0x01 , SR01 ) ; | |
4411 | XGINew_SetReg1( pVBInfo->P3d4 , 0x63 , CR63 ) ; | |
4412 | XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , SR31 ) ; | |
4413 | ||
4414 | /* [2004/05/11] Vicent */ | |
108afbf8 BP |
4415 | XGINew_SetReg1(pVBInfo->P3d4, 0x53, |
4416 | (unsigned char)(XGINew_GetReg1(pVBInfo->P3d4, 0x53) & 0xFD)); | |
4417 | XGINew_SetReg1(pVBInfo->P3c4, 0x1F, (unsigned char)SR1F); | |
d7636e0b | 4418 | } |
4419 | ||
4420 | ||
8922967e | 4421 | #if 0 |
d7636e0b | 4422 | /* --------------------------------------------------------------------- */ |
4423 | /* Function : XGI_WaitDisplay */ | |
4424 | /* Input : */ | |
4425 | /* Output : */ | |
4426 | /* Description : */ | |
4427 | /* --------------------------------------------------------------------- */ | |
8922967e | 4428 | static void XGI_WaitDisplay(struct vb_device_info *pVBInfo) |
d7636e0b | 4429 | { |
4430 | while( !( XGINew_GetReg2( pVBInfo->P3da ) & 0x01 ) ) ; | |
4431 | ||
4432 | while( XGINew_GetReg2( pVBInfo->P3da ) & 0x01 ) ; | |
4433 | } | |
8922967e | 4434 | #endif |
d7636e0b | 4435 | |
4436 | ||
4437 | /* --------------------------------------------------------------------- */ | |
4438 | /* Function : XGI_SetCRT2Group301 */ | |
4439 | /* Input : */ | |
4440 | /* Output : */ | |
4441 | /* Description : */ | |
4442 | /* --------------------------------------------------------------------- */ | |
108afbf8 | 4443 | unsigned char XGI_SetCRT2Group301(unsigned short ModeNo, |
e4147abe | 4444 | struct xgi_hw_device_info *HwDeviceExtension, |
80adad85 | 4445 | struct vb_device_info *pVBInfo) |
d7636e0b | 4446 | { |
82d6eb5b | 4447 | unsigned short tempbx , |
d7636e0b | 4448 | ModeIdIndex , |
4449 | RefreshRateTableIndex ; | |
4450 | ||
4451 | tempbx=pVBInfo->VBInfo ; | |
4452 | pVBInfo->SetFlag |= ProgrammingCRT2 ; | |
4453 | XGI_SearchModeID( ModeNo , &ModeIdIndex, pVBInfo ) ; | |
4454 | pVBInfo->SelectCRT2Rate = 4 ; | |
4455 | RefreshRateTableIndex = XGI_GetRatePtrCRT2( HwDeviceExtension, ModeNo , ModeIdIndex, pVBInfo ) ; | |
4456 | XGI_SaveCRT2Info( ModeNo, pVBInfo ) ; | |
4457 | XGI_GetCRT2ResInfo( ModeNo , ModeIdIndex, pVBInfo) ; | |
4458 | XGI_GetCRT2Data( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; | |
4459 | XGI_PreSetGroup1( ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ; | |
4460 | XGI_SetGroup1( ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ; | |
4461 | XGI_SetLockRegs( ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ; | |
4462 | XGI_SetGroup2( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; | |
4463 | XGI_SetLCDRegs(ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ; | |
4464 | XGI_SetTap4Regs(pVBInfo) ; | |
4465 | XGI_SetGroup3(ModeNo, ModeIdIndex, pVBInfo); | |
4466 | XGI_SetGroup4( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; | |
4467 | XGI_SetCRT2VCLK( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; | |
4468 | XGI_SetGroup5( ModeNo , ModeIdIndex, pVBInfo) ; | |
4469 | XGI_AutoThreshold( pVBInfo) ; | |
4470 | return 1 ; | |
4471 | } | |
4472 | ||
4473 | ||
4474 | /* --------------------------------------------------------------------- */ | |
4475 | /* Function : XGI_AutoThreshold */ | |
4476 | /* Input : */ | |
4477 | /* Output : */ | |
4478 | /* Description : */ | |
4479 | /* --------------------------------------------------------------------- */ | |
80adad85 | 4480 | void XGI_AutoThreshold(struct vb_device_info *pVBInfo) |
d7636e0b | 4481 | { |
4482 | if ( !( pVBInfo->SetFlag & Win9xDOSMode ) ) | |
4483 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x01 , 0x40 ) ; | |
4484 | } | |
4485 | ||
4486 | ||
4487 | /* --------------------------------------------------------------------- */ | |
4488 | /* Function : XGI_SaveCRT2Info */ | |
4489 | /* Input : */ | |
4490 | /* Output : */ | |
4491 | /* Description : */ | |
4492 | /* --------------------------------------------------------------------- */ | |
80adad85 | 4493 | void XGI_SaveCRT2Info(unsigned short ModeNo, struct vb_device_info *pVBInfo) |
d7636e0b | 4494 | { |
82d6eb5b | 4495 | unsigned short temp1 , |
d7636e0b | 4496 | temp2 ; |
4497 | ||
4498 | XGINew_SetReg1( pVBInfo->P3d4 , 0x34 , ModeNo ) ; /* reserve CR34 for CRT1 Mode No */ | |
4499 | temp1 = ( pVBInfo->VBInfo&SetInSlaveMode ) >> 8 ; | |
4500 | temp2 = ~( SetInSlaveMode >> 8 ) ; | |
4501 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x31 , temp2 , temp1 ) ; | |
4502 | } | |
4503 | ||
4504 | ||
4505 | /* --------------------------------------------------------------------- */ | |
4506 | /* Function : XGI_GetCRT2ResInfo */ | |
4507 | /* Input : */ | |
4508 | /* Output : */ | |
4509 | /* Description : */ | |
4510 | /* --------------------------------------------------------------------- */ | |
82d6eb5b BP |
4511 | void XGI_GetCRT2ResInfo(unsigned short ModeNo, |
4512 | unsigned short ModeIdIndex, | |
80adad85 | 4513 | struct vb_device_info *pVBInfo) |
d7636e0b | 4514 | { |
82d6eb5b | 4515 | unsigned short xres , |
d7636e0b | 4516 | yres , |
4517 | modeflag , | |
4518 | resindex ; | |
4519 | ||
4520 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo) ; | |
4521 | if ( ModeNo <= 0x13 ) | |
4522 | { | |
4523 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; | |
4524 | yres = pVBInfo->StResInfo[ resindex ].VTotal ; | |
4525 | /* modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; si+St_ResInfo */ | |
4526 | } | |
4527 | else | |
4528 | { | |
4529 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */ | |
4530 | yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; /* yres->bx */ | |
4531 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex].Ext_ModeFlag ; /* si+St_ModeFlag */ | |
4532 | ||
4533 | /* if ( pVBInfo->IF_DEF_FSTN ) | |
4534 | { | |
4535 | xres *= 2 ; | |
4536 | yres *= 2 ; | |
4537 | } | |
4538 | else | |
4539 | { | |
4540 | */ | |
4541 | if ( modeflag & HalfDCLK ) | |
4542 | xres *= 2; | |
4543 | ||
4544 | if ( modeflag & DoubleScanMode ) | |
4545 | yres *= 2 ; | |
4546 | /* } */ | |
4547 | } | |
4548 | ||
4549 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) | |
4550 | { | |
4551 | if ( pVBInfo->IF_DEF_LVDS == 0 ) | |
4552 | { | |
4553 | if ( pVBInfo->LCDResInfo == Panel1600x1200 ) | |
4554 | { | |
4555 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) | |
4556 | { | |
4557 | if ( yres == 1024 ) | |
4558 | yres = 1056 ; | |
4559 | } | |
4560 | } | |
4561 | ||
4562 | if ( pVBInfo->LCDResInfo == Panel1280x1024 ) | |
4563 | { | |
4564 | if ( yres == 400 ) | |
4565 | yres = 405 ; | |
4566 | else if ( yres == 350 ) | |
4567 | yres = 360 ; | |
4568 | ||
4569 | if ( pVBInfo->LCDInfo & LCDVESATiming ) | |
4570 | { | |
4571 | if ( yres == 360 ) | |
4572 | yres = 375 ; | |
4573 | } | |
4574 | } | |
4575 | ||
4576 | if ( pVBInfo->LCDResInfo == Panel1024x768 ) | |
4577 | { | |
4578 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) | |
4579 | { | |
4580 | if ( !( pVBInfo->LCDInfo & LCDNonExpanding ) ) | |
4581 | { | |
4582 | if ( yres == 350 ) | |
4583 | yres = 357 ; | |
4584 | else if ( yres == 400 ) | |
4585 | yres = 420 ; | |
4586 | else if ( yres == 480 ) | |
4587 | yres = 525 ; | |
4588 | } | |
4589 | } | |
4590 | } | |
4591 | } | |
4592 | ||
4593 | if ( xres == 720 ) | |
4594 | xres = 640 ; | |
4595 | } | |
4596 | ||
4597 | pVBInfo->VGAHDE = xres ; | |
4598 | pVBInfo->HDE = xres ; | |
4599 | pVBInfo->VGAVDE = yres ; | |
4600 | pVBInfo->VDE = yres ; | |
4601 | } | |
4602 | ||
4603 | ||
4604 | /* --------------------------------------------------------------------- */ | |
4605 | /* Function : XGI_IsLCDDualLink */ | |
4606 | /* Input : */ | |
4607 | /* Output : */ | |
4608 | /* Description : */ | |
4609 | /* --------------------------------------------------------------------- */ | |
80adad85 | 4610 | unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo) |
d7636e0b | 4611 | { |
4612 | ||
4613 | if ( ( ( ( pVBInfo->VBInfo & SetCRT2ToLCD ) | SetCRT2ToLCDA ) ) && ( pVBInfo->LCDInfo & SetLCDDualLink ) ) /* shampoo0129 */ | |
4614 | return ( 1 ) ; | |
4615 | ||
4616 | return( 0 ) ; | |
4617 | } | |
4618 | ||
4619 | ||
4620 | /* --------------------------------------------------------------------- */ | |
4621 | /* Function : XGI_GetCRT2Data */ | |
4622 | /* Input : */ | |
4623 | /* Output : */ | |
4624 | /* Description : */ | |
4625 | /* --------------------------------------------------------------------- */ | |
80adad85 | 4626 | void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo) |
d7636e0b | 4627 | { |
82d6eb5b | 4628 | unsigned short tempax = 0, |
d7636e0b | 4629 | tempbx , |
4630 | modeflag , | |
4631 | resinfo ; | |
4632 | ||
80adad85 BP |
4633 | struct XGI_LCDDataStruct *LCDPtr = NULL ; |
4634 | struct XGI_TVDataStruct *TVPtr = NULL ; | |
d7636e0b | 4635 | |
4636 | if ( ModeNo <= 0x13 ) | |
4637 | { | |
4638 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ | |
4639 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; | |
4640 | } | |
4641 | else | |
4642 | { | |
4643 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ | |
4644 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; | |
4645 | } | |
4646 | ||
4647 | pVBInfo->NewFlickerMode = 0 ; | |
4648 | pVBInfo->RVBHRS = 50 ; | |
4649 | ||
4650 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) | |
4651 | { | |
4652 | XGI_GetRAMDAC2DATA( ModeNo , ModeIdIndex , RefreshRateTableIndex,pVBInfo ) ; | |
4653 | return ; | |
4654 | } | |
4655 | ||
4656 | tempbx = 4 ; | |
4657 | ||
4658 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) | |
4659 | { | |
80adad85 | 4660 | LCDPtr = (struct XGI_LCDDataStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
d7636e0b | 4661 | |
4662 | pVBInfo->RVBHCMAX = LCDPtr->RVBHCMAX ; | |
4663 | pVBInfo->RVBHCFACT = LCDPtr->RVBHCFACT ; | |
4664 | pVBInfo->VGAHT = LCDPtr->VGAHT ; | |
4665 | pVBInfo->VGAVT = LCDPtr->VGAVT ; | |
4666 | pVBInfo->HT = LCDPtr->LCDHT ; | |
4667 | pVBInfo->VT = LCDPtr->LCDVT ; | |
4668 | ||
4669 | if ( pVBInfo->LCDResInfo == Panel1024x768 ) | |
4670 | { | |
4671 | tempax = 1024 ; | |
4672 | tempbx = 768 ; | |
4673 | ||
4674 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) | |
4675 | { | |
4676 | if ( pVBInfo->VGAVDE == 357 ) | |
4677 | tempbx = 527 ; | |
4678 | else if ( pVBInfo->VGAVDE == 420 ) | |
4679 | tempbx = 620 ; | |
4680 | else if ( pVBInfo->VGAVDE == 525 ) | |
4681 | tempbx = 775 ; | |
4682 | else if ( pVBInfo->VGAVDE == 600 ) | |
4683 | tempbx = 775 ; | |
4684 | /* else if(pVBInfo->VGAVDE==350) tempbx=560; */ | |
4685 | /* else if(pVBInfo->VGAVDE==400) tempbx=640; */ | |
4686 | else | |
4687 | tempbx = 768 ; | |
4688 | } | |
4689 | else | |
4690 | tempbx = 768 ; | |
4691 | } | |
4692 | else if ( pVBInfo->LCDResInfo == Panel1024x768x75 ) | |
4693 | { | |
4694 | tempax = 1024 ; | |
4695 | tempbx = 768 ; | |
4696 | } | |
4697 | else if ( pVBInfo->LCDResInfo == Panel1280x1024 ) | |
4698 | { | |
4699 | tempax = 1280 ; | |
4700 | if ( pVBInfo->VGAVDE == 360 ) | |
4701 | tempbx = 768 ; | |
4702 | else if ( pVBInfo->VGAVDE == 375 ) | |
4703 | tempbx = 800 ; | |
4704 | else if ( pVBInfo->VGAVDE == 405 ) | |
4705 | tempbx = 864 ; | |
4706 | else | |
4707 | tempbx = 1024 ; | |
4708 | } | |
4709 | else if ( pVBInfo->LCDResInfo == Panel1280x1024x75 ) | |
4710 | { | |
4711 | tempax = 1280 ; | |
4712 | tempbx = 1024 ; | |
4713 | } | |
4714 | else if ( pVBInfo->LCDResInfo == Panel1280x960 ) | |
4715 | { | |
4716 | tempax = 1280 ; | |
4717 | if ( pVBInfo->VGAVDE == 350 ) | |
4718 | tempbx = 700 ; | |
4719 | else if ( pVBInfo->VGAVDE == 400 ) | |
4720 | tempbx = 800 ; | |
4721 | else if ( pVBInfo->VGAVDE == 1024 ) | |
4722 | tempbx = 960 ; | |
4723 | else | |
4724 | tempbx = 960 ; | |
4725 | } | |
4726 | else if ( pVBInfo->LCDResInfo == Panel1400x1050 ) | |
4727 | { | |
4728 | tempax = 1400 ; | |
4729 | tempbx = 1050 ; | |
4730 | ||
4731 | if ( pVBInfo->VGAVDE == 1024 ) | |
4732 | { | |
4733 | tempax = 1280 ; | |
4734 | tempbx = 1024 ; | |
4735 | } | |
4736 | } | |
4737 | else if ( pVBInfo->LCDResInfo == Panel1600x1200 ) | |
4738 | { | |
4739 | tempax = 1600 ; | |
4740 | tempbx = 1200 ; /* alan 10/14/2003 */ | |
4741 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) | |
4742 | { | |
4743 | if ( pVBInfo->VGAVDE == 350 ) | |
4744 | tempbx = 875 ; | |
4745 | else if ( pVBInfo->VGAVDE == 400 ) | |
4746 | tempbx = 1000 ; | |
4747 | } | |
4748 | } | |
4749 | ||
4750 | if ( pVBInfo->LCDInfo & LCDNonExpanding ) | |
4751 | { | |
4752 | tempax = pVBInfo->VGAHDE ; | |
4753 | tempbx = pVBInfo->VGAVDE ; | |
4754 | } | |
4755 | ||
4756 | pVBInfo->HDE = tempax ; | |
4757 | pVBInfo->VDE = tempbx ; | |
4758 | return ; | |
4759 | } | |
4760 | ||
4761 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV ) ) | |
4762 | { | |
4763 | tempbx = 4 ; | |
80adad85 | 4764 | TVPtr = (struct XGI_TVDataStruct *)XGI_GetTVPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
d7636e0b | 4765 | |
4766 | pVBInfo->RVBHCMAX = TVPtr->RVBHCMAX ; | |
4767 | pVBInfo->RVBHCFACT = TVPtr->RVBHCFACT ; | |
4768 | pVBInfo->VGAHT = TVPtr->VGAHT ; | |
4769 | pVBInfo->VGAVT = TVPtr->VGAVT ; | |
4770 | pVBInfo->HDE = TVPtr->TVHDE ; | |
4771 | pVBInfo->VDE = TVPtr->TVVDE ; | |
4772 | pVBInfo->RVBHRS = TVPtr->RVBHRS ; | |
4773 | pVBInfo->NewFlickerMode = TVPtr->FlickerMode ; | |
4774 | ||
4775 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) | |
4776 | { | |
4777 | if ( resinfo == 0x08 ) | |
4778 | pVBInfo->NewFlickerMode = 0x40 ; | |
4779 | else if ( resinfo == 0x09 ) | |
4780 | pVBInfo->NewFlickerMode = 0x40 ; | |
4781 | else if ( resinfo == 0x12 ) | |
4782 | pVBInfo->NewFlickerMode = 0x40 ; | |
4783 | ||
4784 | if ( pVBInfo->VGAVDE == 350 ) | |
4785 | pVBInfo->TVInfo |= TVSimuMode ; | |
4786 | ||
4787 | tempax = ExtHiTVHT ; | |
4788 | tempbx = ExtHiTVVT ; | |
4789 | ||
4790 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
4791 | { | |
4792 | if ( pVBInfo->TVInfo & TVSimuMode ) | |
4793 | { | |
4794 | tempax = StHiTVHT ; | |
4795 | tempbx = StHiTVVT ; | |
4796 | ||
4797 | if ( !( modeflag & Charx8Dot ) ) | |
4798 | { | |
4799 | tempax = StHiTextTVHT ; | |
4800 | tempbx = StHiTextTVVT ; | |
4801 | } | |
4802 | } | |
4803 | } | |
4804 | } | |
4805 | else if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) | |
4806 | { | |
4807 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) | |
4808 | { | |
4809 | tempax = YPbPrTV750pHT ; /* Ext750pTVHT */ | |
4810 | tempbx = YPbPrTV750pVT ; /* Ext750pTVVT */ | |
4811 | } | |
4812 | ||
4813 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) | |
4814 | { | |
4815 | tempax = YPbPrTV525pHT ; /* Ext525pTVHT */ | |
4816 | tempbx = YPbPrTV525pVT ; /* Ext525pTVVT */ | |
4817 | } | |
4818 | else if ( pVBInfo->TVInfo & SetYPbPrMode525i ) | |
4819 | { | |
4820 | tempax = YPbPrTV525iHT ; /* Ext525iTVHT */ | |
4821 | tempbx = YPbPrTV525iVT ; /* Ext525iTVVT */ | |
4822 | if ( pVBInfo->TVInfo & NTSC1024x768 ) | |
4823 | tempax = NTSC1024x768HT ; | |
4824 | } | |
4825 | } | |
4826 | else | |
4827 | { | |
4828 | tempax = PALHT ; | |
4829 | tempbx = PALVT ; | |
4830 | if ( !( pVBInfo->TVInfo & SetPALTV ) ) | |
4831 | { | |
4832 | tempax = NTSCHT ; | |
4833 | tempbx = NTSCVT ; | |
4834 | if ( pVBInfo->TVInfo & NTSC1024x768 ) | |
4835 | tempax = NTSC1024x768HT ; | |
4836 | } | |
4837 | } | |
4838 | ||
4839 | pVBInfo->HT = tempax ; | |
4840 | pVBInfo->VT = tempbx ; | |
4841 | return ; | |
4842 | } | |
4843 | } | |
4844 | ||
4845 | ||
4846 | /* --------------------------------------------------------------------- */ | |
4847 | /* Function : XGI_SetCRT2VCLK */ | |
4848 | /* Input : */ | |
4849 | /* Output : */ | |
4850 | /* Description : */ | |
4851 | /* --------------------------------------------------------------------- */ | |
80adad85 | 4852 | void XGI_SetCRT2VCLK(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo) |
d7636e0b | 4853 | { |
108afbf8 | 4854 | unsigned char di_0, di_1, tempal; |
d7636e0b | 4855 | |
4856 | tempal = XGI_GetVCLKPtr( RefreshRateTableIndex , ModeNo , ModeIdIndex, pVBInfo ) ; | |
4857 | XGI_GetVCLKLen( tempal, &di_0 , &di_1, pVBInfo ) ; | |
4858 | XGI_GetLCDVCLKPtr( &di_0 , &di_1, pVBInfo ) ; | |
4859 | ||
4860 | if ( pVBInfo->VBType & VB_XGI301 ) /* shampoo 0129 */ | |
4861 | { /* 301 */ | |
4862 | XGINew_SetReg1(pVBInfo->Part4Port , 0x0A , 0x10 ) ; | |
4863 | XGINew_SetReg1(pVBInfo->Part4Port , 0x0B , di_1 ) ; | |
4864 | XGINew_SetReg1(pVBInfo->Part4Port , 0x0A , di_0 ) ; | |
4865 | } | |
4866 | else | |
4867 | { /* 301b/302b/301lv/302lv */ | |
4868 | XGINew_SetReg1( pVBInfo->Part4Port , 0x0A , di_0 ) ; | |
4869 | XGINew_SetReg1( pVBInfo->Part4Port , 0x0B , di_1 ) ; | |
4870 | } | |
4871 | ||
4872 | XGINew_SetReg1( pVBInfo->Part4Port , 0x00 , 0x12 ) ; | |
4873 | ||
4874 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) | |
4875 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x12 , 0x28 ) ; | |
4876 | else | |
4877 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x12 , 0x08 ) ; | |
4878 | } | |
4879 | ||
4880 | ||
4881 | /* --------------------------------------------------------------------- */ | |
4882 | /* Function : XGI_GETLCDVCLKPtr */ | |
4883 | /* Input : */ | |
4884 | /* Output : al -> VCLK Index */ | |
4885 | /* Description : */ | |
4886 | /* --------------------------------------------------------------------- */ | |
108afbf8 | 4887 | void XGI_GetLCDVCLKPtr(unsigned char *di_0, unsigned char *di_1, |
80adad85 | 4888 | struct vb_device_info *pVBInfo) |
d7636e0b | 4889 | { |
82d6eb5b | 4890 | unsigned short index ; |
d7636e0b | 4891 | |
4892 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) | |
4893 | { | |
4894 | if ( pVBInfo->IF_DEF_ScaleLCD == 1 ) | |
4895 | { | |
4896 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) | |
4897 | return ; | |
4898 | } | |
4899 | ||
4900 | /* index = XGI_GetLCDCapPtr(pVBInfo) ; */ | |
4901 | index = XGI_GetLCDCapPtr1( pVBInfo) ; | |
4902 | ||
4903 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) | |
4904 | { /* LCDB */ | |
4905 | *di_0 = pVBInfo->LCDCapList[ index ].LCUCHAR_VCLKData1 ; | |
4906 | *di_1 = pVBInfo->LCDCapList[ index ].LCUCHAR_VCLKData2 ; | |
4907 | } | |
4908 | else | |
4909 | { /* LCDA */ | |
4910 | *di_0 = pVBInfo->LCDCapList[ index ].LCDA_VCLKData1 ; | |
4911 | *di_1 = pVBInfo->LCDCapList[ index ].LCDA_VCLKData2 ; | |
4912 | } | |
4913 | } | |
4914 | return ; | |
4915 | } | |
4916 | ||
4917 | ||
4918 | /* --------------------------------------------------------------------- */ | |
4919 | /* Function : XGI_GetVCLKPtr */ | |
4920 | /* Input : */ | |
4921 | /* Output : */ | |
4922 | /* Description : */ | |
4923 | /* --------------------------------------------------------------------- */ | |
108afbf8 BP |
4924 | unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex, |
4925 | unsigned short ModeNo, unsigned short ModeIdIndex, | |
80adad85 | 4926 | struct vb_device_info *pVBInfo) |
d7636e0b | 4927 | { |
4928 | ||
82d6eb5b | 4929 | unsigned short index , |
d7636e0b | 4930 | modeflag ; |
82d6eb5b | 4931 | unsigned short tempbx ; |
108afbf8 BP |
4932 | unsigned char tempal; |
4933 | unsigned char *CHTVVCLKPtr = NULL; | |
d7636e0b | 4934 | |
4935 | if ( ModeNo <= 0x13 ) | |
4936 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ | |
4937 | else | |
4938 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ | |
4939 | ||
4940 | ||
4941 | if ( ( pVBInfo->SetFlag & ProgrammingCRT2 ) && ( !( pVBInfo->LCDInfo & EnableScalingLCD ) ) ) | |
4942 | { /* {LCDA/LCDB} */ | |
4943 | index = XGI_GetLCDCapPtr(pVBInfo) ; | |
4944 | tempal = pVBInfo->LCDCapList[ index ].LCD_VCLK ; | |
4945 | ||
4946 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) | |
4947 | return tempal ; | |
4948 | ||
4949 | /* {TV} */ | |
4950 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV| VB_XGI302LV| VB_XGI301C ) ) | |
4951 | { | |
4952 | if(pVBInfo->VBInfo&SetCRT2ToHiVisionTV) | |
4953 | { | |
4954 | tempal = HiTVVCLKDIV2; | |
4955 | if(!(pVBInfo->TVInfo & RPLLDIV2XO)) | |
4956 | tempal = HiTVVCLK; | |
4957 | if(pVBInfo->TVInfo & TVSimuMode) | |
4958 | { | |
4959 | tempal = HiTVSimuVCLK; | |
4960 | if(!(modeflag & Charx8Dot)) | |
4961 | tempal = HiTVTextVCLK; | |
4962 | ||
4963 | } | |
4964 | return tempal; | |
4965 | } | |
4966 | ||
4967 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) | |
4968 | { | |
4969 | tempal = YPbPr750pVCLK ; | |
4970 | return tempal ; | |
4971 | } | |
4972 | ||
4973 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) | |
4974 | { | |
4975 | tempal = YPbPr525pVCLK ; | |
4976 | return tempal ; | |
4977 | } | |
4978 | ||
4979 | tempal = NTSC1024VCLK ; | |
4980 | ||
4981 | if ( !( pVBInfo->TVInfo & NTSC1024x768 ) ) | |
4982 | { | |
4983 | tempal = TVVCLKDIV2 ; | |
4984 | if ( !( pVBInfo->TVInfo & RPLLDIV2XO ) ) | |
4985 | tempal = TVVCLK ; | |
4986 | } | |
4987 | ||
4988 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
4989 | return tempal ; | |
4990 | } | |
4991 | /*else | |
4992 | if((pVBInfo->IF_DEF_CH7017==1)&&(pVBInfo->VBType&VB_CH7017)) | |
4993 | { | |
4994 | if(ModeNo<=0x13) | |
4995 | *tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC; | |
4996 | else | |
4997 | *tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; | |
4998 | *tempal = *tempal & 0x1F; | |
4999 | ||
5000 | tempbx = 0; | |
5001 | if(pVBInfo->TVInfo & SetPALTV) | |
5002 | tempbx = tempbx + 2; | |
5003 | if(pVBInfo->TVInfo & SetCHTVOverScan) | |
5004 | tempbx++; | |
5005 | tempbx = tempbx << 1; | |
5006 | } */ | |
5007 | } /* {End of VB} */ | |
5008 | ||
5009 | if((pVBInfo->IF_DEF_CH7007==1)&&(pVBInfo->VBType&VB_CH7007)) /* [Billy] 07/05/08 CH7007 */ | |
5010 | { | |
5011 | /* VideoDebugPrint((0, "XGI_GetVCLKPtr: pVBInfo->IF_DEF_CH7007==1\n")); */ | |
5012 | if ( (pVBInfo->VBInfo & SetCRT2ToTV) ) | |
5013 | { | |
5014 | if( ModeNo <= 0x13 ) | |
5015 | { | |
5016 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; | |
5017 | } | |
5018 | else | |
5019 | { | |
5020 | tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; | |
5021 | } | |
5022 | ||
5023 | tempal = tempal & 0x0F; | |
5024 | tempbx = 0; | |
5025 | ||
5026 | if(pVBInfo->TVInfo & SetPALTV) | |
5027 | { | |
5028 | tempbx = tempbx + 2; | |
5029 | } | |
5030 | if(pVBInfo->TVInfo & SetCHTVOverScan) | |
5031 | { | |
5032 | tempbx++; | |
5033 | } | |
5034 | /** tempbx = tempbx << 1; CH7007 ? **/ | |
5035 | ||
5036 | /*[Billy]07/05/29 CH7007*/ | |
5037 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) | |
5038 | { | |
5039 | switch( tempbx ) | |
5040 | { | |
5041 | case 0: | |
5042 | CHTVVCLKPtr = XGI7007_CHTVVCLKUNTSC ; | |
5043 | break ; | |
5044 | case 1: | |
5045 | CHTVVCLKPtr = XGI7007_CHTVVCLKONTSC ; | |
5046 | break ; | |
5047 | case 2: | |
5048 | CHTVVCLKPtr = XGI7007_CHTVVCLKUPAL ; | |
5049 | break ; | |
5050 | case 3: | |
5051 | CHTVVCLKPtr = XGI7007_CHTVVCLKOPAL ; | |
5052 | break ; | |
5053 | default: | |
5054 | break ; | |
5055 | ||
5056 | } | |
5057 | } | |
5058 | /*else | |
5059 | { | |
5060 | switch( tempbx ) | |
5061 | { | |
5062 | case 0: | |
5063 | CHTVVCLKPtr = pVBInfo->CHTVVCLKUNTSC ; | |
5064 | break ; | |
5065 | case 1: | |
5066 | CHTVVCLKPtr = pVBInfo->CHTVVCLKONTSC ; | |
5067 | break ; | |
5068 | case 2: | |
5069 | CHTVVCLKPtr = pVBInfo->CHTVVCLKUPAL ; | |
5070 | break ; | |
5071 | case 3: | |
5072 | CHTVVCLKPtr = pVBInfo->CHTVVCLKOPAL ; | |
5073 | break ; | |
5074 | default: | |
5075 | break ; | |
5076 | } | |
5077 | }*/ | |
5078 | ||
5079 | tempal = CHTVVCLKPtr[ tempal ] ; | |
5080 | return tempal ; | |
5081 | } | |
5082 | ||
5083 | } | |
5084 | ||
108afbf8 | 5085 | tempal = (unsigned char)XGINew_GetReg2((pVBInfo->P3ca + 0x02)); |
d7636e0b | 5086 | tempal = tempal >> 2 ; |
5087 | tempal &= 0x03 ; | |
5088 | ||
5089 | if ( ( pVBInfo->LCDInfo & EnableScalingLCD ) && ( modeflag & Charx8Dot ) ) /* for Dot8 Scaling LCD */ | |
5090 | tempal = tempal ^ tempal ; /* ; set to VCLK25MHz always */ | |
5091 | ||
5092 | if ( ModeNo <= 0x13 ) | |
5093 | return tempal ; | |
5094 | ||
5095 | tempal = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ; | |
5096 | return tempal ; | |
5097 | } | |
5098 | ||
5099 | ||
5100 | /* --------------------------------------------------------------------- */ | |
5101 | /* Function : XGI_GetVCLKLen */ | |
5102 | /* Input : */ | |
5103 | /* Output : */ | |
5104 | /* Description : */ | |
5105 | /* --------------------------------------------------------------------- */ | |
108afbf8 | 5106 | void XGI_GetVCLKLen(unsigned char tempal, unsigned char *di_0, |
80adad85 | 5107 | unsigned char *di_1, struct vb_device_info *pVBInfo) |
d7636e0b | 5108 | { |
5109 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) /* [Billy] 2007/05/16 */ | |
5110 | { | |
5111 | /* VideoDebugPrint((0, "XGI_GetVCLKLen: pVBInfo->IF_DEF_CH7007==1\n")); */ | |
108afbf8 BP |
5112 | *di_0 = (unsigned char)XGI_CH7007VCLKData[tempal].SR2B; |
5113 | *di_1 = (unsigned char)XGI_CH7007VCLKData[tempal].SR2C; | |
d7636e0b | 5114 | } |
5115 | else if ( pVBInfo->VBType & ( VB_XGI301 | VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
5116 | { | |
5117 | if ( ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) && ( pVBInfo->SetFlag & ProgrammingCRT2 ) ) | |
5118 | { | |
108afbf8 | 5119 | *di_0 = (unsigned char)XGI_VBVCLKData[tempal].SR2B; |
d7636e0b | 5120 | *di_1 = XGI_VBVCLKData[ tempal ].SR2C ; |
5121 | } | |
5122 | } | |
5123 | else | |
5124 | { | |
5125 | *di_0 = XGI_VCLKData[ tempal ].SR2B ; | |
5126 | *di_1 = XGI_VCLKData[ tempal ].SR2C ; | |
5127 | } | |
5128 | } | |
5129 | ||
5130 | ||
5131 | /* --------------------------------------------------------------------- */ | |
5132 | /* Function : XGI_SetCRT2Offset */ | |
5133 | /* Input : */ | |
5134 | /* Output : */ | |
5135 | /* Description : */ | |
5136 | /* --------------------------------------------------------------------- */ | |
8922967e | 5137 | static void XGI_SetCRT2Offset(unsigned short ModeNo, |
108afbf8 BP |
5138 | unsigned short ModeIdIndex, |
5139 | unsigned short RefreshRateTableIndex, | |
e4147abe | 5140 | struct xgi_hw_device_info *HwDeviceExtension, |
80adad85 | 5141 | struct vb_device_info *pVBInfo) |
d7636e0b | 5142 | { |
82d6eb5b | 5143 | unsigned short offset ; |
108afbf8 | 5144 | unsigned char temp; |
d7636e0b | 5145 | |
5146 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
5147 | { | |
5148 | return ; | |
5149 | } | |
5150 | ||
5151 | offset = XGI_GetOffset( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; | |
108afbf8 | 5152 | temp = (unsigned char)(offset & 0xFF); |
d7636e0b | 5153 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , temp ) ; |
108afbf8 BP |
5154 | temp = (unsigned char)((offset & 0xFF00) >> 8); |
5155 | XGINew_SetReg1(pVBInfo->Part1Port , 0x09 , temp); | |
5156 | temp = (unsigned char)(((offset >> 3) & 0xFF) + 1) ; | |
5157 | XGINew_SetReg1(pVBInfo->Part1Port, 0x03, temp); | |
d7636e0b | 5158 | } |
5159 | ||
5160 | ||
5161 | /* --------------------------------------------------------------------- */ | |
5162 | /* Function : XGI_GetOffset */ | |
5163 | /* Input : */ | |
5164 | /* Output : */ | |
5165 | /* Description : */ | |
5166 | /* --------------------------------------------------------------------- */ | |
80adad85 | 5167 | unsigned short XGI_GetOffset(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
d7636e0b | 5168 | { |
82d6eb5b | 5169 | unsigned short temp , |
d7636e0b | 5170 | colordepth , |
5171 | modeinfo , | |
5172 | index , | |
5173 | infoflag , | |
5174 | ColorDepth[] = { 0x01 , 0x02 , 0x04 } ; | |
5175 | ||
5176 | modeinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeInfo ; | |
5177 | if ( ModeNo <= 0x14 ) | |
5178 | infoflag = 0 ; | |
5179 | else | |
5180 | infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; | |
5181 | ||
5182 | ||
5183 | index = ( modeinfo >> 8 ) & 0xFF ; | |
5184 | ||
5185 | temp = pVBInfo->ScreenOffset[ index ] ; | |
5186 | ||
5187 | if ( infoflag & InterlaceMode ) | |
5188 | { | |
5189 | temp = temp << 1 ; | |
5190 | } | |
5191 | ||
5192 | colordepth = XGI_GetColorDepth( ModeNo , ModeIdIndex, pVBInfo ) ; | |
5193 | ||
5194 | if ( ( ModeNo >= 0x7C ) && ( ModeNo <= 0x7E ) ) | |
5195 | { | |
5196 | temp = ModeNo - 0x7C ; | |
5197 | colordepth = ColorDepth[ temp ] ; | |
5198 | temp = 0x6B ; | |
5199 | if ( infoflag & InterlaceMode ) | |
5200 | { | |
5201 | temp = temp << 1 ; | |
5202 | } | |
5203 | return( temp * colordepth ) ; | |
5204 | } | |
5205 | else | |
5206 | return( temp * colordepth ) ; | |
5207 | } | |
5208 | ||
5209 | ||
5210 | /* --------------------------------------------------------------------- */ | |
5211 | /* Function : XGI_SetCRT2FIFO */ | |
5212 | /* Input : */ | |
5213 | /* Output : */ | |
5214 | /* Description : */ | |
5215 | /* --------------------------------------------------------------------- */ | |
8922967e | 5216 | static void XGI_SetCRT2FIFO(struct vb_device_info *pVBInfo) |
d7636e0b | 5217 | { |
5218 | XGINew_SetReg1( pVBInfo->Part1Port , 0x01 , 0x3B ) ; /* threshold high ,disable auto threshold */ | |
5219 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x02 , ~( 0x3F ) , 0x04 ) ; /* threshold low default 04h */ | |
5220 | } | |
5221 | ||
5222 | ||
5223 | /* --------------------------------------------------------------------- */ | |
5224 | /* Function : XGI_PreSetGroup1 */ | |
5225 | /* Input : */ | |
5226 | /* Output : */ | |
5227 | /* Description : */ | |
5228 | /* --------------------------------------------------------------------- */ | |
82d6eb5b | 5229 | void XGI_PreSetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex, |
e4147abe | 5230 | struct xgi_hw_device_info *HwDeviceExtension, |
82d6eb5b | 5231 | unsigned short RefreshRateTableIndex, |
80adad85 | 5232 | struct vb_device_info *pVBInfo) |
d7636e0b | 5233 | { |
82d6eb5b | 5234 | unsigned short tempcx = 0 , |
d7636e0b | 5235 | CRT1Index = 0 , |
5236 | resinfo = 0 ; | |
5237 | ||
5238 | if ( ModeNo > 0x13 ) | |
5239 | { | |
5240 | CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; | |
5241 | CRT1Index &= IndexMask ; | |
5242 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; | |
5243 | } | |
5244 | ||
5245 | XGI_SetCRT2Offset( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; | |
5246 | XGI_SetCRT2FIFO(pVBInfo) ; | |
5247 | /* XGI_SetCRT2Sync(ModeNo,RefreshRateTableIndex); */ | |
5248 | ||
5249 | for( tempcx = 4 ; tempcx < 7 ; tempcx++ ) | |
5250 | { | |
5251 | XGINew_SetReg1( pVBInfo->Part1Port , tempcx , 0x0 ) ; | |
5252 | } | |
5253 | ||
5254 | XGINew_SetReg1( pVBInfo->Part1Port , 0x50 , 0x00 ) ; | |
5255 | XGINew_SetReg1( pVBInfo->Part1Port , 0x02 , 0x44 ) ; /* temp 0206 */ | |
5256 | } | |
5257 | ||
5258 | ||
5259 | /* --------------------------------------------------------------------- */ | |
5260 | /* Function : XGI_SetGroup1 */ | |
5261 | /* Input : */ | |
5262 | /* Output : */ | |
5263 | /* Description : */ | |
5264 | /* --------------------------------------------------------------------- */ | |
82d6eb5b | 5265 | void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex, |
e4147abe | 5266 | struct xgi_hw_device_info *HwDeviceExtension, |
82d6eb5b | 5267 | unsigned short RefreshRateTableIndex, |
80adad85 | 5268 | struct vb_device_info *pVBInfo) |
d7636e0b | 5269 | { |
82d6eb5b | 5270 | unsigned short temp = 0 , |
d7636e0b | 5271 | tempax = 0 , |
5272 | tempbx = 0 , | |
5273 | tempcx = 0 , | |
5274 | pushbx = 0 , | |
5275 | CRT1Index = 0 , | |
5276 | modeflag , | |
5277 | resinfo = 0 ; | |
5278 | ||
5279 | if ( ModeNo > 0x13 ) | |
5280 | { | |
5281 | CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; | |
5282 | CRT1Index &= IndexMask ; | |
5283 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; | |
5284 | } | |
5285 | ||
5286 | if ( ModeNo <= 0x13 ) | |
5287 | { | |
5288 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; | |
5289 | } | |
5290 | else | |
5291 | { | |
5292 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
5293 | } | |
5294 | ||
5295 | /* bainy change table name */ | |
5296 | if ( modeflag & HalfDCLK ) | |
5297 | { | |
5298 | temp = ( pVBInfo->VGAHT / 2 - 1 ) & 0x0FF ; /* BTVGA2HT 0x08,0x09 */ | |
5299 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , temp ) ; | |
5300 | temp = ( ( ( pVBInfo->VGAHT / 2 - 1 ) & 0xFF00 ) >> 8 ) << 4 ; | |
5301 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x09 , ~0x0F0 , temp ) ; | |
5302 | temp = ( pVBInfo->VGAHDE / 2 + 16 ) & 0x0FF ; /* BTVGA2HDEE 0x0A,0x0C */ | |
5303 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0A , temp ) ; | |
5304 | tempcx = ( ( pVBInfo->VGAHT - pVBInfo->VGAHDE ) / 2 ) >> 2 ; | |
5305 | pushbx = pVBInfo->VGAHDE / 2 + 16 ; | |
5306 | tempcx = tempcx >> 1 ; | |
5307 | tempbx = pushbx + tempcx ; /* bx BTVGA@HRS 0x0B,0x0C */ | |
5308 | tempcx += tempbx ; | |
5309 | ||
5310 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) | |
5311 | { | |
5312 | tempbx = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 4 ] ; | |
5313 | tempbx |= ( ( pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 14 ] & 0xC0 ) << 2 ) ; | |
5314 | tempbx = ( tempbx - 3 ) << 3 ; /* (VGAHRS-3)*8 */ | |
5315 | tempcx = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[ 5 ] ; | |
5316 | tempcx &= 0x1F ; | |
5317 | temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 15 ] ; | |
5318 | temp = ( temp & 0x04 ) << ( 5 - 2 ) ; /* VGAHRE D[5] */ | |
5319 | tempcx = ( ( tempcx | temp ) - 3 ) << 3 ; /* (VGAHRE-3)*8 */ | |
5320 | } | |
5321 | ||
5322 | tempbx += 4 ; | |
5323 | tempcx += 4 ; | |
5324 | ||
5325 | if ( tempcx > ( pVBInfo->VGAHT / 2 ) ) | |
5326 | tempcx = pVBInfo->VGAHT / 2 ; | |
5327 | ||
5328 | temp = tempbx & 0x00FF ; | |
5329 | ||
5330 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0B , temp ) ; | |
5331 | } | |
5332 | else | |
5333 | { | |
5334 | temp = ( pVBInfo->VGAHT - 1 ) & 0x0FF ; /* BTVGA2HT 0x08,0x09 */ | |
5335 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , temp ) ; | |
5336 | temp = ( ( ( pVBInfo->VGAHT - 1 ) & 0xFF00 ) >> 8 ) << 4 ; | |
5337 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x09 , ~0x0F0 , temp ) ; | |
5338 | temp = ( pVBInfo->VGAHDE + 16 ) & 0x0FF ; /* BTVGA2HDEE 0x0A,0x0C */ | |
5339 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0A , temp ) ; | |
5340 | tempcx = ( pVBInfo->VGAHT - pVBInfo->VGAHDE ) >> 2 ; /* cx */ | |
5341 | pushbx = pVBInfo->VGAHDE + 16 ; | |
5342 | tempcx = tempcx >> 1 ; | |
5343 | tempbx = pushbx + tempcx ; /* bx BTVGA@HRS 0x0B,0x0C */ | |
5344 | tempcx += tempbx ; | |
5345 | ||
5346 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) | |
5347 | { | |
5348 | tempbx = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 3 ] ; | |
5349 | tempbx |= ( ( pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 5 ] & 0xC0 ) << 2 ) ; | |
5350 | tempbx = ( tempbx - 3 ) << 3 ; /* (VGAHRS-3)*8 */ | |
5351 | tempcx = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 4 ] ; | |
5352 | tempcx &= 0x1F ; | |
5353 | temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 6 ] ; | |
5354 | temp = ( temp & 0x04 ) << ( 5 - 2 ) ; /* VGAHRE D[5] */ | |
5355 | tempcx = ( ( tempcx | temp ) - 3 ) << 3 ; /* (VGAHRE-3)*8 */ | |
5356 | tempbx += 16 ; | |
5357 | tempcx += 16 ; | |
5358 | } | |
5359 | ||
5360 | if ( tempcx > pVBInfo->VGAHT ) | |
5361 | tempcx = pVBInfo->VGAHT ; | |
5362 | ||
5363 | temp = tempbx & 0x00FF ; | |
5364 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0B , temp ) ; | |
5365 | } | |
5366 | ||
5367 | tempax = ( tempax & 0x00FF ) | ( tempbx & 0xFF00 ) ; | |
5368 | tempbx = pushbx ; | |
5369 | tempbx = ( tempbx & 0x00FF ) | ( ( tempbx & 0xFF00 ) << 4 ) ; | |
5370 | tempax |= ( tempbx & 0xFF00 ) ; | |
5371 | temp = ( tempax & 0xFF00 ) >> 8 ; | |
5372 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0C , temp ) ; | |
5373 | temp = tempcx & 0x00FF ; | |
5374 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0D , temp ) ; | |
5375 | tempcx = ( pVBInfo->VGAVT - 1 ) ; | |
5376 | temp = tempcx & 0x00FF ; | |
5377 | ||
5378 | if ( pVBInfo->IF_DEF_CH7005 == 1 ) | |
5379 | { | |
5380 | if ( pVBInfo->VBInfo & 0x0C ) | |
5381 | { | |
5382 | temp-- ; | |
5383 | } | |
5384 | } | |
5385 | ||
5386 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0E , temp ) ; | |
5387 | tempbx = pVBInfo->VGAVDE - 1 ; | |
5388 | temp = tempbx & 0x00FF ; | |
5389 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0F , temp ) ; | |
5390 | temp = ( ( tempbx & 0xFF00 ) << 3 ) >> 8 ; | |
5391 | temp |= ( ( tempcx & 0xFF00 ) >> 8 ) ; | |
5392 | XGINew_SetReg1( pVBInfo->Part1Port , 0x12 , temp ) ; | |
5393 | ||
5394 | tempax = pVBInfo->VGAVDE ; | |
5395 | tempbx = pVBInfo->VGAVDE ; | |
5396 | tempcx = pVBInfo->VGAVT ; | |
5397 | tempbx = ( pVBInfo->VGAVT + pVBInfo->VGAVDE ) >> 1 ; /* BTVGA2VRS 0x10,0x11 */ | |
5398 | tempcx = ( ( pVBInfo->VGAVT - pVBInfo->VGAVDE ) >> 4 ) + tempbx + 1 ; /* BTVGA2VRE 0x11 */ | |
5399 | ||
5400 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) | |
5401 | { | |
5402 | tempbx = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 10 ] ; | |
5403 | temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 9 ] ; | |
5404 | ||
5405 | if ( temp & 0x04 ) | |
5406 | tempbx |= 0x0100 ; | |
5407 | ||
5408 | if ( temp & 0x080 ) | |
5409 | tempbx |= 0x0200 ; | |
5410 | ||
5411 | temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 14 ] ; | |
5412 | ||
5413 | if ( temp & 0x08 ) | |
5414 | tempbx |= 0x0400 ; | |
5415 | ||
5416 | temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 11 ] ; | |
5417 | tempcx = ( tempcx & 0xFF00 ) | ( temp & 0x00FF ) ; | |
5418 | } | |
5419 | ||
5420 | temp = tempbx & 0x00FF ; | |
5421 | XGINew_SetReg1( pVBInfo->Part1Port , 0x10 , temp ) ; | |
5422 | temp = ( ( tempbx & 0xFF00 ) >> 8 ) << 4 ; | |
5423 | temp = ( ( tempcx & 0x000F ) | ( temp ) ) ; | |
5424 | XGINew_SetReg1( pVBInfo->Part1Port , 0x11 , temp ) ; | |
5425 | tempax = 0 ; | |
5426 | ||
5427 | if ( modeflag & DoubleScanMode ) | |
5428 | tempax |= 0x80 ; | |
5429 | ||
5430 | if ( modeflag & HalfDCLK ) | |
5431 | tempax |= 0x40 ; | |
5432 | ||
5433 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2C , ~0x0C0 , tempax ) ; | |
5434 | } | |
5435 | ||
5436 | ||
5437 | /* --------------------------------------------------------------------- */ | |
5438 | /* Function : XGI_SetLockRegs */ | |
5439 | /* Input : */ | |
5440 | /* Output : */ | |
5441 | /* Description : */ | |
5442 | /* --------------------------------------------------------------------- */ | |
82d6eb5b | 5443 | void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, |
e4147abe | 5444 | struct xgi_hw_device_info *HwDeviceExtension, |
82d6eb5b | 5445 | unsigned short RefreshRateTableIndex, |
80adad85 | 5446 | struct vb_device_info *pVBInfo) |
d7636e0b | 5447 | { |
82d6eb5b | 5448 | unsigned short push1 , |
d7636e0b | 5449 | push2 , |
5450 | tempax , | |
5451 | tempbx = 0 , | |
5452 | tempcx , | |
5453 | temp , | |
5454 | resinfo , | |
5455 | modeflag , | |
5456 | CRT1Index ; | |
5457 | ||
5458 | if ( ModeNo <= 0x13 ) | |
5459 | { | |
5460 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ | |
5461 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; | |
5462 | } | |
5463 | else | |
5464 | { | |
5465 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ | |
5466 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; | |
5467 | CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; | |
5468 | CRT1Index &= IndexMask; | |
5469 | } | |
5470 | ||
5471 | if ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) | |
5472 | { | |
5473 | return ; | |
5474 | } | |
5475 | ||
5476 | temp = 0xFF ; /* set MAX HT */ | |
5477 | XGINew_SetReg1( pVBInfo->Part1Port , 0x03 , temp ) ; | |
5478 | /* if ( modeflag & Charx8Dot ) tempcx = 0x08 ; */ | |
5479 | /* else */ | |
5480 | tempcx=0x08; | |
5481 | ||
5482 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
5483 | modeflag |= Charx8Dot ; | |
5484 | ||
5485 | tempax = pVBInfo->VGAHDE ; /* 0x04 Horizontal Display End */ | |
5486 | ||
5487 | if ( modeflag & HalfDCLK ) | |
5488 | tempax = tempax >> 1 ; | |
5489 | ||
5490 | tempax = ( tempax / tempcx ) - 1 ; | |
5491 | tempbx |= ( ( tempax & 0x00FF ) << 8 ) ; | |
5492 | temp = tempax & 0x00FF ; | |
5493 | XGINew_SetReg1( pVBInfo->Part1Port , 0x04 , temp ) ; | |
5494 | ||
5495 | temp = ( tempbx & 0xFF00 ) >> 8 ; | |
5496 | ||
5497 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
5498 | { | |
5499 | if ( !( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) ) | |
5500 | temp += 2 ; | |
5501 | ||
5502 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) | |
5503 | { | |
5504 | if ( pVBInfo->VBType & VB_XGI301LV ) | |
5505 | { | |
5506 | if ( pVBInfo->VBExtInfo == VB_YPbPr1080i ) | |
5507 | { | |
5508 | if ( resinfo == 7 ) | |
5509 | temp -= 2 ; | |
5510 | } | |
5511 | } | |
5512 | else | |
5513 | if ( resinfo == 7 ) | |
5514 | temp -= 2 ; | |
5515 | } | |
5516 | } | |
5517 | ||
5518 | XGINew_SetReg1( pVBInfo->Part1Port , 0x05 , temp ) ; /* 0x05 Horizontal Display Start */ | |
5519 | XGINew_SetReg1( pVBInfo->Part1Port , 0x06 , 0x03 ) ; /* 0x06 Horizontal Blank end */ | |
5520 | ||
5521 | if ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) | |
5522 | { /* 030226 bainy */ | |
5523 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
5524 | tempax = pVBInfo->VGAHT ; | |
5525 | else | |
5526 | tempax = XGI_GetVGAHT2( pVBInfo) ; | |
5527 | } | |
5528 | ||
5529 | if ( tempax >= pVBInfo->VGAHT ) | |
5530 | { | |
5531 | tempax = pVBInfo->VGAHT ; | |
5532 | } | |
5533 | ||
5534 | if ( modeflag & HalfDCLK ) | |
5535 | { | |
5536 | tempax = tempax >> 1 ; | |
5537 | } | |
5538 | ||
5539 | tempax = ( tempax / tempcx ) - 5 ; | |
5540 | tempcx = tempax ; /* 20030401 0x07 horizontal Retrace Start */ | |
5541 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) | |
5542 | { | |
5543 | temp = ( tempbx & 0x00FF ) - 1 ; | |
5544 | if ( !( modeflag & HalfDCLK ) ) | |
5545 | { | |
5546 | temp -= 6 ; | |
5547 | if ( pVBInfo->TVInfo & TVSimuMode ) | |
5548 | { | |
5549 | temp -= 4 ; | |
5550 | if ( ModeNo > 0x13 ) | |
5551 | temp -= 10 ; | |
5552 | } | |
5553 | } | |
5554 | } | |
5555 | else | |
5556 | { | |
5557 | /* tempcx = tempbx & 0x00FF ; */ | |
5558 | tempbx = ( tempbx & 0xFF00 ) >> 8 ; | |
5559 | tempcx = ( tempcx + tempbx ) >> 1 ; | |
5560 | temp = ( tempcx & 0x00FF ) + 2 ; | |
5561 | ||
5562 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
5563 | { | |
5564 | temp -= 1 ; | |
5565 | if ( !( modeflag & HalfDCLK ) ) | |
5566 | { | |
5567 | if ( ( modeflag & Charx8Dot ) ) | |
5568 | { | |
5569 | temp += 4 ; | |
5570 | if ( pVBInfo->VGAHDE >= 800 ) | |
5571 | { | |
5572 | temp -= 6 ; | |
5573 | } | |
5574 | } | |
5575 | } | |
5576 | } | |
5577 | else | |
5578 | { | |
5579 | if ( !( modeflag & HalfDCLK ) ) | |
5580 | { | |
5581 | temp -= 4 ; | |
5582 | if ( pVBInfo->LCDResInfo != Panel1280x960 ) | |
5583 | { | |
5584 | if( pVBInfo->VGAHDE >= 800 ) | |
5585 | { | |
5586 | temp -= 7 ; | |
5587 | if ( pVBInfo->ModeType == ModeEGA ) | |
5588 | { | |
5589 | if ( pVBInfo->VGAVDE == 1024 ) | |
5590 | { | |
5591 | temp += 15 ; | |
5592 | if ( pVBInfo->LCDResInfo != Panel1280x1024 ) | |
5593 | { | |
5594 | temp += 7 ; | |
5595 | } | |
5596 | } | |
5597 | } | |
5598 | ||
5599 | if ( pVBInfo->VGAHDE >= 1280 ) | |
5600 | { | |
5601 | if ( pVBInfo->LCDResInfo != Panel1280x960 ) | |
5602 | { | |
5603 | if ( pVBInfo->LCDInfo & LCDNonExpanding ) | |
5604 | { | |
5605 | temp += 28 ; | |
5606 | } | |
5607 | } | |
5608 | } | |
5609 | } | |
5610 | } | |
5611 | } | |
5612 | } | |
5613 | } | |
5614 | ||
5615 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , temp ) ; /* 0x07 Horizontal Retrace Start */ | |
5616 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0 ) ; /* 0x08 Horizontal Retrace End */ | |
5617 | ||
5618 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
5619 | { | |
5620 | if ( pVBInfo->TVInfo & TVSimuMode ) | |
5621 | { | |
5622 | if ( ( ModeNo == 0x06 ) || ( ModeNo == 0x10 ) || ( ModeNo == 0x11 ) || ( ModeNo == 0x13 ) || ( ModeNo == 0x0F ) ) | |
5623 | { | |
5624 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x5b ) ; | |
5625 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x03 ) ; | |
5626 | } | |
5627 | ||
5628 | if ( ( ModeNo == 0x00 ) || ( ModeNo == 0x01 ) ) | |
5629 | { | |
5630 | if ( pVBInfo->TVInfo & SetNTSCTV ) | |
5631 | { | |
5632 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x2A ) ; | |
5633 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x61 ) ; | |
5634 | } | |
5635 | else | |
5636 | { | |
5637 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x2A ) ; | |
5638 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x41 ) ; | |
5639 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0C , 0xF0 ) ; | |
5640 | } | |
5641 | } | |
5642 | ||
5643 | if ( ( ModeNo == 0x02 ) || ( ModeNo == 0x03 ) || ( ModeNo == 0x07 ) ) | |
5644 | { | |
5645 | if ( pVBInfo->TVInfo & SetNTSCTV ) | |
5646 | { | |
5647 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x54 ) ; | |
5648 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x00 ) ; | |
5649 | } | |
5650 | else | |
5651 | { | |
5652 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x55 ) ; | |
5653 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x00 ) ; | |
5654 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0C , 0xF0 ) ; | |
5655 | } | |
5656 | } | |
5657 | ||
5658 | if ( ( ModeNo == 0x04 ) || ( ModeNo == 0x05 ) || ( ModeNo == 0x0D ) || ( ModeNo == 0x50 ) ) | |
5659 | { | |
5660 | if ( pVBInfo->TVInfo & SetNTSCTV ) | |
5661 | { | |
5662 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x30 ) ; | |
5663 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x03 ) ; | |
5664 | } | |
5665 | else | |
5666 | { | |
5667 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x2f ) ; | |
5668 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x02 ) ; | |
5669 | } | |
5670 | } | |
5671 | } | |
5672 | } | |
5673 | ||
5674 | XGINew_SetReg1( pVBInfo->Part1Port , 0x18 , 0x03 ) ; /* 0x18 SR0B */ | |
5675 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x19 , 0xF0 , 0x00 ) ; | |
5676 | XGINew_SetReg1( pVBInfo->Part1Port , 0x09 , 0xFF ) ; /* 0x09 Set Max VT */ | |
5677 | ||
5678 | tempbx = pVBInfo->VGAVT ; | |
5679 | push1 = tempbx ; | |
5680 | tempcx = 0x121 ; | |
5681 | tempbx = pVBInfo->VGAVDE ; /* 0x0E Virtical Display End */ | |
5682 | ||
5683 | if ( tempbx == 357 ) | |
5684 | tempbx = 350 ; | |
5685 | if ( tempbx == 360 ) | |
5686 | tempbx =350 ; | |
5687 | if ( tempbx == 375 ) | |
5688 | tempbx = 350 ; | |
5689 | if ( tempbx == 405 ) | |
5690 | tempbx = 400 ; | |
5691 | if ( tempbx == 525 ) | |
5692 | tempbx = 480 ; | |
5693 | ||
5694 | push2 = tempbx ; | |
5695 | ||
5696 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) | |
5697 | { | |
5698 | if ( pVBInfo->LCDResInfo == Panel1024x768 ) | |
5699 | { | |
5700 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) | |
5701 | { | |
5702 | if ( tempbx == 350 ) | |
5703 | tempbx += 5 ; | |
5704 | if ( tempbx == 480 ) | |
5705 | tempbx += 5 ; | |
5706 | } | |
5707 | } | |
5708 | } | |
5709 | tempbx-- ; | |
5710 | temp = tempbx & 0x00FF ; | |
5711 | tempbx-- ; | |
5712 | temp = tempbx & 0x00FF ; | |
5713 | XGINew_SetReg1( pVBInfo->Part1Port , 0x10 ,temp ) ; /* 0x10 vertical Blank Start */ | |
5714 | tempbx = push2 ; | |
5715 | tempbx-- ; | |
5716 | temp = tempbx & 0x00FF ; | |
5717 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0E , temp ) ; | |
5718 | ||
5719 | if ( tempbx & 0x0100 ) | |
5720 | { | |
5721 | tempcx |= 0x0002 ; | |
5722 | } | |
5723 | ||
5724 | tempax = 0x000B ; | |
5725 | ||
5726 | if ( modeflag & DoubleScanMode ) | |
5727 | { | |
5728 | tempax |= 0x08000 ; | |
5729 | } | |
5730 | ||
5731 | if ( tempbx & 0x0200 ) | |
5732 | { | |
5733 | tempcx |= 0x0040 ; | |
5734 | } | |
5735 | ||
5736 | temp = ( tempax & 0xFF00 ) >> 8 ; | |
5737 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0B , temp ) ; | |
5738 | ||
5739 | if ( tempbx & 0x0400 ) | |
5740 | { | |
5741 | tempcx |= 0x0600 ; | |
5742 | } | |
5743 | ||
5744 | XGINew_SetReg1( pVBInfo->Part1Port , 0x11 , 0x00 ) ; /* 0x11 Vertival Blank End */ | |
5745 | ||
5746 | tempax = push1 ; | |
5747 | tempax -= tempbx ; /* 0x0C Vertical Retrace Start */ | |
5748 | tempax = tempax >> 2 ; | |
5749 | push1 = tempax ; /* push ax */ | |
5750 | ||
5751 | if ( resinfo != 0x09 ) | |
5752 | { | |
5753 | tempax = tempax << 1 ; | |
5754 | tempbx += tempax ; | |
5755 | } | |
5756 | ||
5757 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) | |
5758 | { | |
5759 | if ( pVBInfo->VBType & VB_XGI301LV ) | |
5760 | { | |
5761 | if ( pVBInfo->TVInfo & SetYPbPrMode1080i ) | |
5762 | tempbx -= 10 ; | |
5763 | else | |
5764 | { | |
5765 | if ( pVBInfo->TVInfo & TVSimuMode ) | |
5766 | { | |
5767 | if ( pVBInfo->TVInfo & SetPALTV ) | |
5768 | { | |
5769 | if ( pVBInfo->VBType & VB_XGI301LV ) | |
5770 | { | |
5771 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) ) | |
5772 | tempbx += 40 ; | |
5773 | } | |
5774 | else | |
5775 | tempbx += 40 ; | |
5776 | } | |
5777 | } | |
5778 | } | |
5779 | } | |
5780 | else | |
5781 | tempbx -= 10 ; | |
5782 | } | |
5783 | else | |
5784 | { | |
5785 | if ( pVBInfo->TVInfo & TVSimuMode ) | |
5786 | { | |
5787 | if ( pVBInfo->TVInfo & SetPALTV ) | |
5788 | { | |
5789 | if ( pVBInfo->VBType & VB_XGI301LV ) | |
5790 | { | |
5791 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) ) | |
5792 | tempbx += 40 ; | |
5793 | } | |
5794 | else | |
5795 | tempbx += 40 ; | |
5796 | } | |
5797 | } | |
5798 | } | |
5799 | tempax = push1 ; | |
5800 | tempax = tempax >> 2 ; | |
5801 | tempax++ ; | |
5802 | tempax += tempbx ; | |
5803 | push1 = tempax ; /* push ax */ | |
5804 | ||
5805 | if ( ( pVBInfo->TVInfo & SetPALTV ) ) | |
5806 | { | |
5807 | if ( tempbx <= 513 ) | |
5808 | { | |
5809 | if ( tempax >= 513 ) | |
5810 | { | |
5811 | tempbx = 513 ; | |
5812 | } | |
5813 | } | |
5814 | } | |
5815 | ||
5816 | temp = tempbx & 0x00FF ; | |
5817 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0C , temp ) ; | |
5818 | tempbx-- ; | |
5819 | temp = tempbx & 0x00FF ; | |
5820 | XGINew_SetReg1( pVBInfo->Part1Port , 0x10 , temp ) ; | |
5821 | ||
5822 | if ( tempbx & 0x0100 ) | |
5823 | { | |
5824 | tempcx |= 0x0008 ; | |
5825 | } | |
5826 | ||
5827 | if ( tempbx & 0x0200 ) | |
5828 | { | |
5829 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x0B , 0x0FF , 0x20 ) ; | |
5830 | } | |
5831 | ||
5832 | tempbx++ ; | |
5833 | ||
5834 | if ( tempbx & 0x0100 ) | |
5835 | { | |
5836 | tempcx |= 0x0004 ; | |
5837 | } | |
5838 | ||
5839 | if ( tempbx & 0x0200 ) | |
5840 | { | |
5841 | tempcx |= 0x0080 ; | |
5842 | } | |
5843 | ||
5844 | if ( tempbx & 0x0400 ) | |
5845 | { | |
5846 | tempcx |= 0x0C00 ; | |
5847 | } | |
5848 | ||
5849 | tempbx = push1 ; /* pop ax */ | |
5850 | temp = tempbx & 0x00FF ; | |
5851 | temp &= 0x0F ; | |
5852 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0D , temp ) ; /* 0x0D vertical Retrace End */ | |
5853 | ||
5854 | if ( tempbx & 0x0010 ) | |
5855 | { | |
5856 | tempcx |= 0x2000 ; | |
5857 | } | |
5858 | ||
5859 | temp = tempcx & 0x00FF ; | |
5860 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0A , temp ) ; /* 0x0A CR07 */ | |
5861 | temp = ( tempcx & 0x0FF00 ) >> 8 ; | |
5862 | XGINew_SetReg1( pVBInfo->Part1Port , 0x17 , temp ) ; /* 0x17 SR0A */ | |
5863 | tempax = modeflag ; | |
5864 | temp = ( tempax & 0xFF00 ) >> 8 ; | |
5865 | ||
5866 | temp = ( temp >> 1 ) & 0x09 ; | |
5867 | ||
5868 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
5869 | temp |= 0x01 ; | |
5870 | ||
5871 | XGINew_SetReg1( pVBInfo->Part1Port , 0x16 , temp ) ; /* 0x16 SR01 */ | |
5872 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0F , 0 ) ; /* 0x0F CR14 */ | |
5873 | XGINew_SetReg1( pVBInfo->Part1Port , 0x12 , 0 ) ; /* 0x12 CR17 */ | |
5874 | ||
5875 | if ( pVBInfo->LCDInfo & LCDRGB18Bit ) | |
5876 | temp = 0x80 ; | |
5877 | else | |
5878 | temp = 0x00 ; | |
5879 | ||
5880 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1A , temp ) ; /* 0x1A SR0E */ | |
5881 | ||
5882 | return ; | |
5883 | } | |
5884 | ||
5885 | ||
5886 | /* --------------------------------------------------------------------- */ | |
5887 | /* Function : XGI_SetGroup2 */ | |
5888 | /* Input : */ | |
5889 | /* Output : */ | |
5890 | /* Description : */ | |
5891 | /* --------------------------------------------------------------------- */ | |
82d6eb5b | 5892 | void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, |
80adad85 | 5893 | struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
d7636e0b | 5894 | { |
82d6eb5b | 5895 | unsigned short i , |
d7636e0b | 5896 | j , |
5897 | tempax , | |
5898 | tempbx , | |
5899 | tempcx , | |
5900 | temp , | |
5901 | push1 , | |
5902 | push2 , | |
5903 | modeflag , | |
5904 | resinfo , | |
5905 | crt2crtc ; | |
108afbf8 | 5906 | unsigned char *TimingPoint ; |
d7636e0b | 5907 | |
82d6eb5b | 5908 | unsigned long longtemp , |
d7636e0b | 5909 | tempeax , |
5910 | tempebx , | |
5911 | temp2 , | |
5912 | tempecx ; | |
5913 | ||
5914 | if ( ModeNo <= 0x13 ) | |
5915 | { | |
5916 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ | |
5917 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; | |
5918 | crt2crtc = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; | |
5919 | } | |
5920 | else | |
5921 | { | |
5922 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ | |
5923 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; | |
5924 | crt2crtc = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ; | |
5925 | } | |
5926 | ||
5927 | tempax = 0 ; | |
5928 | ||
5929 | if ( !( pVBInfo->VBInfo & SetCRT2ToAVIDEO ) ) | |
5930 | tempax |= 0x0800 ; | |
5931 | ||
5932 | if ( !( pVBInfo->VBInfo & SetCRT2ToSVIDEO ) ) | |
5933 | tempax |= 0x0400 ; | |
5934 | ||
5935 | if ( pVBInfo->VBInfo & SetCRT2ToSCART ) | |
5936 | tempax |= 0x0200 ; | |
5937 | ||
5938 | if ( !( pVBInfo->TVInfo & SetPALTV ) ) | |
5939 | tempax |= 0x1000 ; | |
5940 | ||
5941 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) | |
5942 | tempax |= 0x0100 ; | |
5943 | ||
5944 | if ( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) | |
5945 | tempax &= 0xfe00 ; | |
5946 | ||
5947 | tempax = ( tempax & 0xff00 ) >> 8 ; | |
5948 | ||
5949 | XGINew_SetReg1( pVBInfo->Part2Port , 0x0 , tempax ) ; | |
5950 | TimingPoint = pVBInfo->NTSCTiming ; | |
5951 | ||
5952 | if ( pVBInfo->TVInfo & SetPALTV ) | |
5953 | { | |
5954 | TimingPoint = pVBInfo->PALTiming ; | |
5955 | } | |
5956 | ||
5957 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) | |
5958 | { | |
5959 | TimingPoint = pVBInfo->HiTVExtTiming ; | |
5960 | ||
5961 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
5962 | TimingPoint = pVBInfo->HiTVSt2Timing ; | |
5963 | ||
5964 | if ( pVBInfo->SetFlag & TVSimuMode ) | |
5965 | TimingPoint = pVBInfo->HiTVSt1Timing ; | |
5966 | ||
5967 | if ( !(modeflag & Charx8Dot) ) | |
5968 | TimingPoint = pVBInfo->HiTVTextTiming ; | |
5969 | } | |
5970 | ||
5971 | if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) | |
5972 | { | |
5973 | if ( pVBInfo->TVInfo & SetYPbPrMode525i ) | |
5974 | TimingPoint = pVBInfo->YPbPr525iTiming ; | |
5975 | ||
5976 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) | |
5977 | TimingPoint = pVBInfo->YPbPr525pTiming ; | |
5978 | ||
5979 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) | |
5980 | TimingPoint = pVBInfo->YPbPr750pTiming ; | |
5981 | } | |
5982 | ||
5983 | for( i = 0x01 , j = 0 ; i <= 0x2D ; i++ , j++ ) | |
5984 | { | |
5985 | XGINew_SetReg1( pVBInfo->Part2Port , i , TimingPoint[ j ] ) ; | |
5986 | } | |
5987 | ||
5988 | for( i = 0x39 ; i <= 0x45 ; i++ , j++ ) | |
5989 | { | |
5990 | XGINew_SetReg1( pVBInfo->Part2Port , i , TimingPoint[ j ] ) ; /* di->temp2[j] */ | |
5991 | } | |
5992 | ||
5993 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
5994 | { | |
5995 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x3A , 0x1F , 0x00 ) ; | |
5996 | } | |
5997 | ||
5998 | temp = pVBInfo->NewFlickerMode ; | |
5999 | temp &= 0x80 ; | |
6000 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x0A , 0xFF , temp ) ; | |
6001 | ||
6002 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) | |
6003 | tempax = 950 ; | |
6004 | ||
6005 | if ( pVBInfo->TVInfo & SetPALTV ) | |
6006 | tempax = 520 ; | |
6007 | else | |
6008 | tempax = 440 ; | |
6009 | ||
6010 | if ( pVBInfo->VDE <= tempax ) | |
6011 | { | |
6012 | tempax -= pVBInfo->VDE ; | |
6013 | tempax = tempax >> 2 ; | |
6014 | tempax = ( tempax & 0x00FF ) | ( ( tempax & 0x00FF ) << 8 ) ; | |
6015 | push1 = tempax ; | |
6016 | temp = ( tempax & 0xFF00 ) >> 8 ; | |
82d6eb5b | 6017 | temp += (unsigned short)TimingPoint[0]; |
d7636e0b | 6018 | |
6019 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
6020 | { | |
6021 | if ( pVBInfo->VBInfo & ( SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | SetCRT2ToSCART | SetCRT2ToYPbPr ) ) | |
6022 | { | |
6023 | tempcx=pVBInfo->VGAHDE; | |
6024 | if ( tempcx >= 1024 ) | |
6025 | { | |
6026 | temp = 0x17 ; /* NTSC */ | |
6027 | if ( pVBInfo->TVInfo & SetPALTV ) | |
6028 | temp = 0x19 ; /* PAL */ | |
6029 | } | |
6030 | } | |
6031 | } | |
6032 | ||
6033 | XGINew_SetReg1( pVBInfo->Part2Port , 0x01 , temp ) ; | |
6034 | tempax = push1 ; | |
6035 | temp = ( tempax & 0xFF00 ) >> 8 ; | |
6036 | temp += TimingPoint[ 1 ] ; | |
6037 | ||
6038 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
6039 | { | |
6040 | if ( ( pVBInfo->VBInfo & ( SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | SetCRT2ToSCART | SetCRT2ToYPbPr ) ) ) | |
6041 | { | |
6042 | tempcx = pVBInfo->VGAHDE ; | |
6043 | if ( tempcx >= 1024 ) | |
6044 | { | |
6045 | temp = 0x1D ; /* NTSC */ | |
6046 | if ( pVBInfo->TVInfo & SetPALTV ) | |
6047 | temp = 0x52 ; /* PAL */ | |
6048 | } | |
6049 | } | |
6050 | } | |
6051 | XGINew_SetReg1( pVBInfo->Part2Port , 0x02 , temp ) ; | |
6052 | } | |
6053 | ||
6054 | /* 301b */ | |
6055 | tempcx = pVBInfo->HT ; | |
6056 | ||
6057 | if ( XGI_IsLCDDualLink( pVBInfo ) ) | |
6058 | tempcx = tempcx >> 1 ; | |
6059 | ||
6060 | tempcx -= 2 ; | |
6061 | temp = tempcx & 0x00FF ; | |
6062 | XGINew_SetReg1( pVBInfo->Part2Port , 0x1B , temp ) ; | |
6063 | ||
6064 | temp = ( tempcx & 0xFF00 ) >> 8 ; | |
6065 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x1D , ~0x0F , temp ) ; | |
6066 | ||
6067 | tempcx = pVBInfo->HT >> 1 ; | |
6068 | push1 = tempcx ; /* push cx */ | |
6069 | tempcx += 7 ; | |
6070 | ||
6071 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) | |
6072 | { | |
6073 | tempcx -= 4 ; | |
6074 | } | |
6075 | ||
6076 | temp = tempcx & 0x00FF ; | |
6077 | temp = temp << 4 ; | |
6078 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x22 , 0x0F , temp ) ; | |
6079 | ||
6080 | tempbx = TimingPoint[ j ] | ( ( TimingPoint[ j + 1 ] ) << 8 ) ; | |
6081 | tempbx += tempcx ; | |
6082 | push2 = tempbx ; | |
6083 | temp = tempbx & 0x00FF ; | |
6084 | XGINew_SetReg1( pVBInfo->Part2Port , 0x24 , temp ) ; | |
6085 | temp = ( tempbx & 0xFF00 ) >> 8 ; | |
6086 | temp = temp << 4 ; | |
6087 | XGINew_SetRegANDOR(pVBInfo->Part2Port,0x25,0x0F,temp); | |
6088 | ||
6089 | tempbx=push2; | |
6090 | tempbx=tempbx+8; | |
6091 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) | |
6092 | { | |
6093 | tempbx=tempbx-4; | |
6094 | tempcx=tempbx; | |
6095 | } | |
6096 | ||
6097 | temp = ( tempbx & 0x00FF ) << 4 ; | |
6098 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x29 , 0x0F , temp ) ; | |
6099 | ||
6100 | j += 2 ; | |
6101 | tempcx += ( TimingPoint[ j ] | ( ( TimingPoint[ j + 1 ] ) << 8 ) ) ; | |
6102 | temp = tempcx & 0x00FF ; | |
6103 | XGINew_SetReg1( pVBInfo->Part2Port , 0x27 , temp ) ; | |
6104 | temp = ( ( tempcx & 0xFF00 ) >> 8 ) << 4 ; | |
6105 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x28 , 0x0F , temp ) ; | |
6106 | ||
6107 | tempcx += 8 ; | |
6108 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) | |
6109 | { | |
6110 | tempcx -= 4 ; | |
6111 | } | |
6112 | ||
6113 | temp = tempcx & 0xFF ; | |
6114 | temp = temp << 4 ; | |
6115 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x2A , 0x0F , temp ) ; | |
6116 | ||
6117 | tempcx = push1 ; /* pop cx */ | |
6118 | j += 2 ; | |
6119 | temp = TimingPoint[ j ] | ( ( TimingPoint[ j + 1 ] ) << 8 ) ; | |
6120 | tempcx -= temp ; | |
6121 | temp = tempcx & 0x00FF ; | |
6122 | temp = temp << 4 ; | |
6123 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x2D , 0x0F ,temp ) ; | |
6124 | ||
6125 | tempcx -= 11 ; | |
6126 | ||
6127 | if ( !( pVBInfo->VBInfo & SetCRT2ToTV ) ) | |
6128 | { | |
6129 | tempax = XGI_GetVGAHT2( pVBInfo) ; | |
6130 | tempcx = tempax - 1 ; | |
6131 | } | |
6132 | temp = tempcx & 0x00FF ; | |
6133 | XGINew_SetReg1( pVBInfo->Part2Port , 0x2E , temp ) ; | |
6134 | ||
6135 | tempbx = pVBInfo->VDE ; | |
6136 | ||
6137 | if ( pVBInfo->VGAVDE == 360 ) | |
6138 | tempbx = 746 ; | |
6139 | if ( pVBInfo->VGAVDE == 375 ) | |
6140 | tempbx = 746 ; | |
6141 | if ( pVBInfo->VGAVDE == 405 ) | |
6142 | tempbx = 853 ; | |
6143 | ||
6144 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
6145 | { | |
6146 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
6147 | { | |
6148 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) | |
6149 | tempbx = tempbx >> 1 ; | |
6150 | } | |
6151 | else | |
6152 | tempbx = tempbx >> 1 ; | |
6153 | } | |
6154 | ||
6155 | tempbx -= 2 ; | |
6156 | temp = tempbx & 0x00FF ; | |
6157 | ||
6158 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) | |
6159 | { | |
6160 | if ( pVBInfo->VBType & VB_XGI301LV ) | |
6161 | { | |
6162 | if ( pVBInfo->TVInfo & SetYPbPrMode1080i ) | |
6163 | { | |
6164 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
6165 | { | |
6166 | if ( ModeNo == 0x2f ) | |
6167 | temp += 1 ; | |
6168 | } | |
6169 | } | |
6170 | } | |
6171 | else | |
6172 | { | |
6173 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
6174 | { | |
6175 | if ( ModeNo == 0x2f ) | |
6176 | temp += 1 ; | |
6177 | } | |
6178 | } | |
6179 | } | |
6180 | ||
6181 | XGINew_SetReg1( pVBInfo->Part2Port , 0x2F , temp ) ; | |
6182 | ||
6183 | temp = ( tempcx & 0xFF00 ) >> 8 ; | |
6184 | temp |= ( ( tempbx & 0xFF00 ) >> 8 ) << 6 ; | |
6185 | ||
6186 | if ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) ) | |
6187 | { | |
6188 | if ( pVBInfo->VBType & VB_XGI301LV ) | |
6189 | { | |
6190 | if ( pVBInfo->TVInfo & SetYPbPrMode1080i ) | |
6191 | { | |
6192 | temp |= 0x10 ; | |
6193 | ||
6194 | if ( !( pVBInfo->VBInfo & SetCRT2ToSVIDEO ) ) | |
6195 | temp |= 0x20 ; | |
6196 | } | |
6197 | } | |
6198 | else | |
6199 | { | |
6200 | temp |= 0x10 ; | |
6201 | if ( !( pVBInfo->VBInfo & SetCRT2ToSVIDEO ) ) | |
6202 | temp |= 0x20 ; | |
6203 | } | |
6204 | } | |
6205 | ||
6206 | XGINew_SetReg1( pVBInfo->Part2Port , 0x30 , temp ) ; | |
6207 | ||
6208 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) /* TV gatingno */ | |
6209 | { | |
6210 | tempbx = pVBInfo->VDE ; | |
6211 | tempcx = tempbx - 2 ; | |
6212 | ||
6213 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
6214 | { | |
6215 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) | |
6216 | tempbx = tempbx >> 1 ; | |
6217 | } | |
6218 | ||
6219 | if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) ) | |
6220 | { | |
6221 | temp=0; | |
6222 | if( tempcx & 0x0400 ) | |
6223 | temp |= 0x20 ; | |
6224 | ||
6225 | if ( tempbx & 0x0400 ) | |
6226 | temp |= 0x40 ; | |
6227 | ||
6228 | XGINew_SetReg1( pVBInfo->Part4Port , 0x10 , temp ) ; | |
6229 | } | |
6230 | ||
6231 | temp = ( ( ( tempbx - 3 ) & 0x0300 ) >> 8 ) << 5 ; | |
6232 | XGINew_SetReg1( pVBInfo->Part2Port , 0x46 , temp ) ; | |
6233 | temp = ( tempbx - 3 ) & 0x00FF ; | |
6234 | XGINew_SetReg1( pVBInfo->Part2Port , 0x47 , temp ) ; | |
6235 | } | |
6236 | ||
6237 | tempbx = tempbx & 0x00FF ; | |
6238 | ||
6239 | if ( !( modeflag & HalfDCLK ) ) | |
6240 | { | |
6241 | tempcx = pVBInfo->VGAHDE ; | |
6242 | if ( tempcx >= pVBInfo->HDE ) | |
6243 | { | |
6244 | tempbx |= 0x2000 ; | |
6245 | tempax &= 0x00FF ; | |
6246 | } | |
6247 | } | |
6248 | ||
6249 | tempcx = 0x0101 ; | |
6250 | ||
6251 | if( pVBInfo->VBInfo & SetCRT2ToTV ) { /*301b*/ | |
6252 | if(pVBInfo->VGAHDE>=1024) | |
6253 | { | |
6254 | tempcx=0x1920; | |
6255 | if(pVBInfo->VGAHDE>=1280) | |
6256 | { | |
6257 | tempcx=0x1420; | |
6258 | tempbx=tempbx&0xDFFF; | |
6259 | } | |
6260 | } | |
6261 | } | |
6262 | ||
6263 | if ( !( tempbx & 0x2000 ) ) | |
6264 | { | |
6265 | if ( modeflag & HalfDCLK ) | |
6266 | { | |
6267 | tempcx = ( tempcx & 0xFF00 ) | ( ( tempcx & 0x00FF ) << 1 ) ; | |
6268 | } | |
6269 | ||
6270 | push1 = tempbx ; | |
6271 | tempeax = pVBInfo->VGAHDE ; | |
6272 | tempebx = ( tempcx & 0xFF00 ) >> 8 ; | |
6273 | longtemp = tempeax * tempebx ; | |
6274 | tempecx = tempcx & 0x00FF ; | |
6275 | longtemp = longtemp / tempecx ; | |
6276 | ||
6277 | /* 301b */ | |
6278 | tempecx = 8 * 1024 ; | |
6279 | ||
6280 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
6281 | { | |
6282 | tempecx = tempecx * 8 ; | |
6283 | } | |
6284 | ||
6285 | longtemp = longtemp * tempecx ; | |
6286 | tempecx = pVBInfo->HDE ; | |
6287 | temp2 = longtemp % tempecx ; | |
6288 | tempeax = longtemp / tempecx ; | |
6289 | if ( temp2 != 0 ) | |
6290 | { | |
6291 | tempeax += 1 ; | |
6292 | } | |
6293 | ||
82d6eb5b | 6294 | tempax = (unsigned short)tempeax; |
d7636e0b | 6295 | |
6296 | /* 301b */ | |
6297 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
6298 | { | |
6299 | tempcx = ( ( tempax & 0xFF00 ) >> 5 ) >> 8 ; | |
6300 | } | |
6301 | /* end 301b */ | |
6302 | ||
6303 | tempbx = push1 ; | |
82d6eb5b BP |
6304 | tempbx = (unsigned short)(((tempeax & 0x0000FF00) & 0x1F00) | (tempbx & 0x00FF)); |
6305 | tempax = (unsigned short)(((tempeax & 0x000000FF) << 8) | (tempax & 0x00FF)); | |
d7636e0b | 6306 | temp = ( tempax & 0xFF00 ) >> 8 ; |
6307 | } | |
6308 | else | |
6309 | { | |
6310 | temp = ( tempax & 0x00FF ) >> 8 ; | |
6311 | } | |
6312 | ||
6313 | XGINew_SetReg1( pVBInfo->Part2Port , 0x44 , temp ) ; | |
6314 | temp = ( tempbx & 0xFF00 ) >> 8 ; | |
6315 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x45 , ~0x03F , temp ) ; | |
6316 | temp = tempcx & 0x00FF ; | |
6317 | ||
6318 | if ( tempbx & 0x2000 ) | |
6319 | temp = 0 ; | |
6320 | ||
6321 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCD ) ) | |
6322 | temp |= 0x18 ; | |
6323 | ||
6324 | XGINew_SetRegANDOR(pVBInfo->Part2Port,0x46,~0x1F,temp); | |
6325 | if ( pVBInfo->TVInfo & SetPALTV ) | |
6326 | { | |
6327 | tempbx = 0x0382 ; | |
6328 | tempcx = 0x007e ; | |
6329 | } | |
6330 | else | |
6331 | { | |
6332 | tempbx = 0x0369 ; | |
6333 | tempcx = 0x0061 ; | |
6334 | } | |
6335 | ||
6336 | temp = tempbx & 0x00FF ; | |
6337 | XGINew_SetReg1( pVBInfo->Part2Port , 0x4b , temp ) ; | |
6338 | temp = tempcx & 0x00FF ; | |
6339 | XGINew_SetReg1( pVBInfo->Part2Port , 0x4c , temp ) ; | |
6340 | ||
6341 | temp = ( ( tempcx & 0xFF00 ) >> 8 ) & 0x03 ; | |
6342 | temp = temp << 2 ; | |
6343 | temp |= ( ( tempbx & 0xFF00 ) >> 8 ) & 0x03 ; | |
6344 | ||
6345 | if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) | |
6346 | { | |
6347 | temp |= 0x10 ; | |
6348 | ||
6349 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) | |
6350 | temp |= 0x20 ; | |
6351 | ||
6352 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) | |
6353 | temp |= 0x60 ; | |
6354 | } | |
6355 | ||
6356 | XGINew_SetReg1( pVBInfo->Part2Port , 0x4d , temp ) ; | |
6357 | temp=XGINew_GetReg1( pVBInfo->Part2Port , 0x43 ) ; /* 301b change */ | |
82d6eb5b | 6358 | XGINew_SetReg1( pVBInfo->Part2Port , 0x43, (unsigned short)( temp - 3 ) ) ; |
d7636e0b | 6359 | |
6360 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) | |
6361 | { | |
6362 | if ( pVBInfo->TVInfo & NTSC1024x768 ) | |
6363 | { | |
6364 | TimingPoint = XGI_NTSC1024AdjTime ; | |
6365 | for( i = 0x1c , j = 0 ; i <= 0x30 ; i++ , j++ ) | |
6366 | { | |
6367 | XGINew_SetReg1( pVBInfo->Part2Port , i , TimingPoint[ j ] ) ; | |
6368 | } | |
6369 | XGINew_SetReg1( pVBInfo->Part2Port , 0x43 , 0x72 ) ; | |
6370 | } | |
6371 | } | |
6372 | ||
6373 | /* [ycchen] 01/14/03 Modify for 301C PALM Support */ | |
6374 | if ( pVBInfo->VBType & VB_XGI301C ) | |
6375 | { | |
6376 | if ( pVBInfo->TVInfo & SetPALMTV ) | |
6377 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x4E , ~0x08 , 0x08 ) ; /* PALM Mode */ | |
6378 | } | |
6379 | ||
6380 | if ( pVBInfo->TVInfo & SetPALMTV ) | |
6381 | { | |
108afbf8 | 6382 | tempax = (unsigned char)XGINew_GetReg1(pVBInfo->Part2Port, 0x01); |
d7636e0b | 6383 | tempax-- ; |
6384 | XGINew_SetRegAND( pVBInfo->Part2Port , 0x01 , tempax ) ; | |
6385 | ||
6386 | /* if ( !( pVBInfo->VBType & VB_XGI301C ) ) */ | |
6387 | XGINew_SetRegAND( pVBInfo->Part2Port , 0x00 , 0xEF ) ; | |
6388 | } | |
6389 | ||
6390 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) | |
6391 | { | |
6392 | if ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) | |
6393 | { | |
6394 | XGINew_SetReg1( pVBInfo->Part2Port , 0x0B , 0x00 ) ; | |
6395 | } | |
6396 | } | |
6397 | ||
6398 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
6399 | { | |
6400 | return ; | |
6401 | } | |
6402 | } | |
6403 | ||
6404 | ||
6405 | /* --------------------------------------------------------------------- */ | |
6406 | /* Function : XGI_SetLCDRegs */ | |
6407 | /* Input : */ | |
6408 | /* Output : */ | |
6409 | /* Description : */ | |
6410 | /* --------------------------------------------------------------------- */ | |
80adad85 | 6411 | void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo) |
d7636e0b | 6412 | { |
82d6eb5b | 6413 | unsigned short push1 , |
d7636e0b | 6414 | push2 , |
6415 | pushbx , | |
6416 | tempax , | |
6417 | tempbx , | |
6418 | tempcx , | |
6419 | temp , | |
6420 | tempah , | |
6421 | tempbh , | |
6422 | tempch , | |
6423 | resinfo , | |
6424 | modeflag , | |
6425 | CRT1Index ; | |
6426 | ||
80adad85 | 6427 | struct XGI_LCDDesStruct *LCDBDesPtr = NULL ; |
d7636e0b | 6428 | |
6429 | ||
6430 | if ( ModeNo <= 0x13 ) | |
6431 | { | |
6432 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ | |
6433 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; | |
6434 | } | |
6435 | else | |
6436 | { | |
6437 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ | |
6438 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; | |
6439 | CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; | |
6440 | CRT1Index &= IndexMask ; | |
6441 | } | |
6442 | ||
6443 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCD ) ) | |
6444 | { | |
6445 | return ; | |
6446 | } | |
6447 | ||
6448 | tempbx = pVBInfo->HDE ; /* RHACTE=HDE-1 */ | |
6449 | ||
6450 | if ( XGI_IsLCDDualLink( pVBInfo ) ) | |
6451 | tempbx = tempbx >> 1 ; | |
6452 | ||
6453 | tempbx -= 1 ; | |
6454 | temp = tempbx & 0x00FF ; | |
6455 | XGINew_SetReg1( pVBInfo->Part2Port , 0x2C , temp ) ; | |
6456 | temp = ( tempbx & 0xFF00 ) >> 8 ; | |
6457 | temp = temp << 4 ; | |
6458 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x2B , 0x0F , temp ) ; | |
6459 | temp = 0x01 ; | |
6460 | ||
6461 | if ( pVBInfo->LCDResInfo == Panel1280x1024 ) | |
6462 | { | |
6463 | if ( pVBInfo->ModeType == ModeEGA ) | |
6464 | { | |
6465 | if ( pVBInfo->VGAHDE >= 1024 ) | |
6466 | { | |
6467 | temp = 0x02 ; | |
6468 | if ( pVBInfo->LCDInfo & LCDVESATiming ) | |
6469 | temp = 0x01 ; | |
6470 | } | |
6471 | } | |
6472 | } | |
6473 | ||
6474 | XGINew_SetReg1( pVBInfo->Part2Port , 0x0B , temp ) ; | |
6475 | tempbx = pVBInfo->VDE ; /* RTVACTEO=(VDE-1)&0xFF */ | |
6476 | push1 = tempbx ; | |
6477 | tempbx-- ; | |
6478 | temp = tempbx & 0x00FF ; | |
6479 | XGINew_SetReg1( pVBInfo->Part2Port , 0x03 , temp ) ; | |
6480 | temp = ( ( tempbx & 0xFF00 ) >> 8 ) & 0x07 ; | |
6481 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x0C , ~0x07 , temp ) ; | |
6482 | ||
6483 | tempcx = pVBInfo->VT - 1 ; | |
6484 | push2 = tempcx + 1 ; | |
6485 | temp = tempcx & 0x00FF ; /* RVTVT=VT-1 */ | |
6486 | XGINew_SetReg1( pVBInfo->Part2Port , 0x19 , temp ) ; | |
6487 | temp = ( tempcx & 0xFF00 ) >> 8 ; | |
6488 | temp = temp << 5 ; | |
6489 | XGINew_SetReg1( pVBInfo->Part2Port , 0x1A , temp ) ; | |
6490 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x09 , 0xF0 , 0x00 ) ; | |
6491 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x0A , 0xF0 , 0x00 ) ; | |
6492 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x17 , 0xFB , 0x00 ) ; | |
6493 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x18 , 0xDF , 0x00 ) ; | |
6494 | ||
6495 | /* Customized LCDB Des no add */ | |
6496 | tempbx = 5 ; | |
80adad85 | 6497 | LCDBDesPtr = (struct XGI_LCDDesStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
d7636e0b | 6498 | tempah = pVBInfo->LCDResInfo ; |
6499 | tempah &= PanelResInfo ; | |
6500 | ||
6501 | if ( ( tempah == Panel1024x768 ) || ( tempah == Panel1024x768x75 ) ) | |
6502 | { | |
6503 | tempbx = 1024 ; | |
6504 | tempcx = 768 ; | |
6505 | } | |
6506 | else if ( ( tempah == Panel1280x1024 ) || ( tempah == Panel1280x1024x75 ) ) | |
6507 | { | |
6508 | tempbx = 1280 ; | |
6509 | tempcx = 1024 ; | |
6510 | } | |
6511 | else if ( tempah == Panel1400x1050 ) | |
6512 | { | |
6513 | tempbx = 1400 ; | |
6514 | tempcx = 1050 ; | |
6515 | } | |
6516 | else | |
6517 | { | |
6518 | tempbx = 1600 ; | |
6519 | tempcx = 1200 ; | |
6520 | } | |
6521 | ||
6522 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) | |
6523 | { | |
6524 | tempbx = pVBInfo->HDE ; | |
6525 | tempcx = pVBInfo->VDE ; | |
6526 | } | |
6527 | ||
6528 | pushbx = tempbx ; | |
6529 | tempax = pVBInfo->VT ; | |
6530 | pVBInfo->LCDHDES = LCDBDesPtr->LCDHDES ; | |
6531 | pVBInfo->LCDHRS = LCDBDesPtr->LCDHRS ; | |
6532 | pVBInfo->LCDVDES = LCDBDesPtr->LCDVDES ; | |
6533 | pVBInfo->LCDVRS = LCDBDesPtr->LCDVRS ; | |
6534 | tempbx = pVBInfo->LCDVDES ; | |
6535 | tempcx += tempbx ; | |
6536 | ||
6537 | if ( tempcx >= tempax ) | |
6538 | tempcx -= tempax ; /* lcdvdes */ | |
6539 | ||
6540 | temp = tempbx & 0x00FF ; /* RVEQ1EQ=lcdvdes */ | |
6541 | XGINew_SetReg1( pVBInfo->Part2Port , 0x05 , temp ) ; | |
6542 | temp = tempcx & 0x00FF ; | |
6543 | XGINew_SetReg1( pVBInfo->Part2Port , 0x06 , temp ) ; | |
6544 | tempch = ( ( tempcx & 0xFF00 ) >> 8 ) & 0x07 ; | |
6545 | tempbh = ( ( tempbx & 0xFF00 ) >> 8 ) & 0x07 ; | |
6546 | tempah = tempch ; | |
6547 | tempah = tempah << 3 ; | |
6548 | tempah |= tempbh ; | |
6549 | XGINew_SetReg1( pVBInfo->Part2Port , 0x02 , tempah ) ; | |
6550 | ||
6551 | /* getlcdsync() */ | |
6552 | XGI_GetLCDSync( &tempax , &tempbx,pVBInfo ) ; | |
6553 | tempcx = tempbx ; | |
6554 | tempax = pVBInfo->VT ; | |
6555 | tempbx = pVBInfo->LCDVRS ; | |
6556 | ||
6557 | /* if ( SetLCD_Info & EnableScalingLCD ) */ | |
6558 | tempcx += tempbx ; | |
6559 | if ( tempcx >= tempax ) | |
6560 | tempcx -= tempax ; | |
6561 | ||
6562 | temp = tempbx & 0x00FF ; /* RTVACTEE=lcdvrs */ | |
6563 | XGINew_SetReg1( pVBInfo->Part2Port , 0x04 , temp ) ; | |
6564 | temp = ( tempbx & 0xFF00 ) >> 8 ; | |
6565 | temp = temp << 4 ; | |
6566 | temp |= ( tempcx & 0x000F ) ; | |
6567 | XGINew_SetReg1( pVBInfo->Part2Port , 0x01 , temp ) ; | |
6568 | tempcx = pushbx ; | |
6569 | tempax = pVBInfo->HT ; | |
6570 | tempbx = pVBInfo->LCDHDES ; | |
6571 | tempbx &= 0x0FFF ; | |
6572 | ||
6573 | if ( XGI_IsLCDDualLink( pVBInfo ) ) | |
6574 | { | |
6575 | tempax = tempax >> 1 ; | |
6576 | tempbx = tempbx >> 1 ; | |
6577 | tempcx = tempcx >> 1 ; | |
6578 | } | |
6579 | ||
6580 | if ( pVBInfo->VBType & VB_XGI302LV ) | |
6581 | tempbx += 1 ; | |
6582 | ||
6583 | if ( pVBInfo->VBType & VB_XGI301C ) /* tap4 */ | |
6584 | tempbx += 1 ; | |
6585 | ||
6586 | tempcx += tempbx ; | |
6587 | ||
6588 | if ( tempcx >= tempax ) | |
6589 | tempcx -= tempax ; | |
6590 | ||
6591 | temp = tempbx & 0x00FF ; | |
6592 | XGINew_SetReg1( pVBInfo->Part2Port , 0x1F , temp ) ; /* RHBLKE=lcdhdes */ | |
6593 | temp = ( ( tempbx & 0xFF00 ) >> 8 ) << 4 ; | |
6594 | XGINew_SetReg1( pVBInfo->Part2Port , 0x20 , temp ) ; | |
6595 | temp = tempcx & 0x00FF ; | |
6596 | XGINew_SetReg1( pVBInfo->Part2Port , 0x23 , temp ) ; /* RHEQPLE=lcdhdee */ | |
6597 | temp = ( tempcx & 0xFF00 ) >> 8 ; | |
6598 | XGINew_SetReg1( pVBInfo->Part2Port , 0x25 , temp ) ; | |
6599 | ||
6600 | /* getlcdsync() */ | |
6601 | XGI_GetLCDSync( &tempax , &tempbx ,pVBInfo) ; | |
6602 | tempcx = tempax ; | |
6603 | tempax = pVBInfo->HT ; | |
6604 | tempbx = pVBInfo->LCDHRS ; | |
6605 | /* if ( SetLCD_Info & EnableScalingLCD) */ | |
6606 | if ( XGI_IsLCDDualLink( pVBInfo) ) | |
6607 | { | |
6608 | tempax = tempax >> 1 ; | |
6609 | tempbx = tempbx >> 1 ; | |
6610 | tempcx = tempcx >> 1 ; | |
6611 | } | |
6612 | ||
6613 | if ( pVBInfo->VBType & VB_XGI302LV ) | |
6614 | tempbx += 1 ; | |
6615 | ||
6616 | tempcx += tempbx ; | |
6617 | ||
6618 | if ( tempcx >= tempax ) | |
6619 | tempcx -= tempax ; | |
6620 | ||
6621 | temp = tempbx & 0x00FF ; /* RHBURSTS=lcdhrs */ | |
6622 | XGINew_SetReg1( pVBInfo->Part2Port , 0x1C , temp ) ; | |
6623 | ||
6624 | temp = ( tempbx & 0xFF00 ) >> 8 ; | |
6625 | temp = temp << 4 ; | |
6626 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x1D , ~0x0F0 , temp ) ; | |
6627 | temp = tempcx & 0x00FF ; /* RHSYEXP2S=lcdhre */ | |
6628 | XGINew_SetReg1( pVBInfo->Part2Port , 0x21 , temp ) ; | |
6629 | ||
6630 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) | |
6631 | { | |
6632 | if ( pVBInfo->VGAVDE == 525 ) | |
6633 | { | |
6634 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
6635 | { | |
6636 | temp = 0xC6 ; | |
6637 | } | |
6638 | else | |
6639 | temp = 0xC4 ; | |
6640 | ||
6641 | XGINew_SetReg1( pVBInfo->Part2Port , 0x2f , temp ) ; | |
6642 | XGINew_SetReg1( pVBInfo->Part2Port , 0x30 , 0xB3 ) ; | |
6643 | } | |
6644 | ||
6645 | if ( pVBInfo->VGAVDE == 420 ) | |
6646 | { | |
6647 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
6648 | { | |
6649 | temp = 0x4F ; | |
6650 | } | |
6651 | else | |
6652 | temp = 0x4E ; | |
6653 | XGINew_SetReg1( pVBInfo->Part2Port , 0x2f , temp ) ; | |
6654 | } | |
6655 | } | |
6656 | } | |
6657 | ||
6658 | ||
6659 | /* --------------------------------------------------------------------- */ | |
6660 | /* Function : XGI_GetTap4Ptr */ | |
6661 | /* Input : */ | |
6662 | /* Output : di -> Tap4 Reg. Setting Pointer */ | |
6663 | /* Description : */ | |
6664 | /* --------------------------------------------------------------------- */ | |
80adad85 BP |
6665 | struct XGI301C_Tap4TimingStruct *XGI_GetTap4Ptr(unsigned short tempcx, |
6666 | struct vb_device_info *pVBInfo) | |
d7636e0b | 6667 | { |
82d6eb5b | 6668 | unsigned short tempax , |
d7636e0b | 6669 | tempbx , |
6670 | i ; | |
6671 | ||
80adad85 | 6672 | struct XGI301C_Tap4TimingStruct *Tap4TimingPtr ; |
d7636e0b | 6673 | |
6674 | if ( tempcx == 0 ) | |
6675 | { | |
6676 | tempax = pVBInfo->VGAHDE ; | |
6677 | tempbx = pVBInfo->HDE ; | |
6678 | } | |
6679 | else | |
6680 | { | |
6681 | tempax = pVBInfo->VGAVDE ; | |
6682 | tempbx = pVBInfo->VDE ; | |
6683 | } | |
6684 | ||
6685 | if ( tempax < tempbx ) | |
6686 | return &EnlargeTap4Timing[ 0 ] ; | |
6687 | else if( tempax == tempbx ) | |
6688 | return &NoScaleTap4Timing[ 0 ] ; /* 1:1 */ | |
6689 | else | |
6690 | Tap4TimingPtr = NTSCTap4Timing ; /* NTSC */ | |
6691 | ||
6692 | if ( pVBInfo->TVInfo & SetPALTV ) | |
6693 | Tap4TimingPtr = PALTap4Timing ; | |
6694 | ||
6695 | ||
6696 | if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) | |
6697 | { | |
6698 | if ( pVBInfo->TVInfo & SetYPbPrMode525i ) | |
6699 | Tap4TimingPtr = YPbPr525iTap4Timing ; | |
6700 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) | |
6701 | Tap4TimingPtr = YPbPr525pTap4Timing ; | |
6702 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) | |
6703 | Tap4TimingPtr = YPbPr750pTap4Timing ; | |
6704 | } | |
6705 | ||
6706 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) | |
6707 | Tap4TimingPtr = HiTVTap4Timing ; | |
6708 | ||
6709 | i = 0 ; | |
6710 | while( Tap4TimingPtr[ i ].DE != 0xFFFF ) | |
6711 | { | |
6712 | if ( Tap4TimingPtr[ i ].DE == tempax ) | |
6713 | break ; | |
6714 | i++ ; | |
6715 | } | |
6716 | return &Tap4TimingPtr[ i ] ; | |
6717 | } | |
6718 | ||
6719 | ||
6720 | /* --------------------------------------------------------------------- */ | |
6721 | /* Function : XGI_SetTap4Regs */ | |
6722 | /* Input : */ | |
6723 | /* Output : */ | |
6724 | /* Description : */ | |
6725 | /* --------------------------------------------------------------------- */ | |
80adad85 | 6726 | void XGI_SetTap4Regs(struct vb_device_info *pVBInfo) |
d7636e0b | 6727 | { |
82d6eb5b | 6728 | unsigned short i , |
d7636e0b | 6729 | j ; |
6730 | ||
80adad85 | 6731 | struct XGI301C_Tap4TimingStruct *Tap4TimingPtr ; |
d7636e0b | 6732 | |
6733 | if ( !( pVBInfo->VBType & VB_XGI301C ) ) | |
6734 | return ; | |
6735 | ||
6736 | #ifndef Tap4 | |
6737 | XGINew_SetRegAND( pVBInfo->Part2Port , 0x4E , 0xEB ) ; /* Disable Tap4 */ | |
6738 | #else /* Tap4 Setting */ | |
6739 | ||
6740 | Tap4TimingPtr = XGI_GetTap4Ptr( 0 , pVBInfo) ; /* Set Horizontal Scaling */ | |
6741 | for( i = 0x80 , j = 0 ; i <= 0xBF ; i++ , j++ ) | |
6742 | XGINew_SetReg1( pVBInfo->Part2Port , i , Tap4TimingPtr->Reg[ j ] ) ; | |
6743 | ||
6744 | if ( ( pVBInfo->VBInfo & SetCRT2ToTV ) && ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) ) ) | |
6745 | { | |
6746 | Tap4TimingPtr = XGI_GetTap4Ptr( 1 , pVBInfo); /* Set Vertical Scaling */ | |
6747 | for( i = 0xC0 , j = 0 ; i < 0xFF ; i++ , j++ ) | |
6748 | XGINew_SetReg1( pVBInfo->Part2Port , i , Tap4TimingPtr->Reg[ j ] ) ; | |
6749 | } | |
6750 | ||
6751 | if ( ( pVBInfo->VBInfo & SetCRT2ToTV ) && ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) ) ) | |
6752 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x4E , ~0x14 , 0x04 ) ; /* Enable V.Scaling */ | |
6753 | else | |
6754 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x4E , ~0x14 , 0x10 ) ; /* Enable H.Scaling */ | |
6755 | #endif | |
6756 | } | |
6757 | ||
6758 | /* --------------------------------------------------------------------- */ | |
6759 | /* Function : XGI_SetGroup3 */ | |
6760 | /* Input : */ | |
6761 | /* Output : */ | |
6762 | /* Description : */ | |
6763 | /* --------------------------------------------------------------------- */ | |
80adad85 | 6764 | void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
d7636e0b | 6765 | { |
82d6eb5b | 6766 | unsigned short i; |
108afbf8 | 6767 | unsigned char *tempdi; |
82d6eb5b | 6768 | unsigned short modeflag; |
d7636e0b | 6769 | |
6770 | if(ModeNo<=0x13) | |
6771 | { | |
6772 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ | |
6773 | } | |
6774 | else | |
6775 | { | |
6776 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ | |
6777 | } | |
6778 | ||
6779 | ||
6780 | XGINew_SetReg1(pVBInfo->Part3Port,0x00,0x00); | |
6781 | if(pVBInfo->TVInfo&SetPALTV) | |
6782 | { | |
6783 | XGINew_SetReg1(pVBInfo->Part3Port,0x13,0xFA); | |
6784 | XGINew_SetReg1(pVBInfo->Part3Port,0x14,0xC8); | |
6785 | } | |
6786 | else | |
6787 | { | |
6788 | XGINew_SetReg1(pVBInfo->Part3Port,0x13,0xF5); | |
6789 | XGINew_SetReg1(pVBInfo->Part3Port,0x14,0xB7); | |
6790 | } | |
6791 | ||
6792 | if(!(pVBInfo->VBInfo&SetCRT2ToTV)) | |
6793 | { | |
6794 | return; | |
6795 | } | |
6796 | ||
6797 | if(pVBInfo->TVInfo&SetPALMTV) | |
6798 | { | |
6799 | XGINew_SetReg1(pVBInfo->Part3Port,0x13,0xFA); | |
6800 | XGINew_SetReg1(pVBInfo->Part3Port,0x14,0xC8); | |
6801 | XGINew_SetReg1(pVBInfo->Part3Port,0x3D,0xA8); | |
6802 | } | |
6803 | ||
6804 | if((pVBInfo->VBInfo&SetCRT2ToHiVisionTV)|| (pVBInfo->VBInfo&SetCRT2ToYPbPr)) | |
6805 | { | |
6806 | if(pVBInfo->TVInfo & SetYPbPrMode525i) | |
6807 | { | |
6808 | return; | |
6809 | } | |
6810 | tempdi=pVBInfo->HiTVGroup3Data; | |
6811 | if(pVBInfo->SetFlag&TVSimuMode) | |
6812 | { | |
6813 | tempdi=pVBInfo->HiTVGroup3Simu; | |
6814 | if(!(modeflag&Charx8Dot)) | |
6815 | { | |
6816 | tempdi=pVBInfo->HiTVGroup3Text; | |
6817 | } | |
6818 | } | |
6819 | ||
6820 | if(pVBInfo->TVInfo & SetYPbPrMode525p) | |
6821 | { | |
6822 | tempdi=pVBInfo->Ren525pGroup3; | |
6823 | } | |
6824 | if(pVBInfo->TVInfo & SetYPbPrMode750p) | |
6825 | { | |
6826 | tempdi=pVBInfo->Ren750pGroup3; | |
6827 | } | |
6828 | ||
6829 | for(i=0;i<=0x3E;i++) | |
6830 | { | |
6831 | XGINew_SetReg1(pVBInfo->Part3Port,i,tempdi[i]); | |
6832 | } | |
6833 | if(pVBInfo->VBType&VB_XGI301C) /* Marcovision */ | |
6834 | { | |
6835 | if(pVBInfo->TVInfo & SetYPbPrMode525p) | |
6836 | { | |
6837 | XGINew_SetReg1(pVBInfo->Part3Port,0x28,0x3f); | |
6838 | } | |
6839 | } | |
6840 | } | |
6841 | return; | |
6842 | } /* {end of XGI_SetGroup3} */ | |
6843 | ||
6844 | ||
6845 | /* --------------------------------------------------------------------- */ | |
6846 | /* Function : XGI_SetGroup4 */ | |
6847 | /* Input : */ | |
6848 | /* Output : */ | |
6849 | /* Description : */ | |
6850 | /* --------------------------------------------------------------------- */ | |
80adad85 | 6851 | void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
d7636e0b | 6852 | { |
82d6eb5b | 6853 | unsigned short tempax , |
d7636e0b | 6854 | tempcx , |
6855 | tempbx , | |
6856 | modeflag , | |
6857 | temp , | |
6858 | temp2 ; | |
6859 | ||
82d6eb5b | 6860 | unsigned long tempebx , |
d7636e0b | 6861 | tempeax , |
6862 | templong ; | |
6863 | ||
6864 | ||
6865 | if ( ModeNo <= 0x13 ) | |
6866 | { | |
6867 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ | |
6868 | } | |
6869 | else | |
6870 | { | |
6871 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ | |
6872 | } | |
6873 | ||
6874 | temp = pVBInfo->RVBHCFACT ; | |
6875 | XGINew_SetReg1( pVBInfo->Part4Port , 0x13 , temp ) ; | |
6876 | ||
6877 | tempbx = pVBInfo->RVBHCMAX ; | |
6878 | temp = tempbx & 0x00FF ; | |
6879 | XGINew_SetReg1( pVBInfo->Part4Port , 0x14 , temp ) ; | |
6880 | temp2 = ( ( tempbx & 0xFF00 ) >> 8 ) << 7 ; | |
6881 | tempcx = pVBInfo->VGAHT - 1 ; | |
6882 | temp = tempcx & 0x00FF ; | |
6883 | XGINew_SetReg1( pVBInfo->Part4Port , 0x16 , temp ) ; | |
6884 | ||
6885 | temp =( ( tempcx & 0xFF00 ) >> 8 ) << 3 ; | |
6886 | temp2 |= temp ; | |
6887 | ||
6888 | tempcx = pVBInfo->VGAVT - 1 ; | |
6889 | if ( !( pVBInfo->VBInfo & SetCRT2ToTV ) ) | |
6890 | { | |
6891 | tempcx -= 5 ; | |
6892 | } | |
6893 | ||
6894 | temp = tempcx & 0x00FF ; | |
6895 | XGINew_SetReg1( pVBInfo->Part4Port , 0x17 , temp ) ; | |
6896 | temp = temp2 | ( ( tempcx & 0xFF00 ) >> 8 ) ; | |
6897 | XGINew_SetReg1( pVBInfo->Part4Port , 0x15 , temp ) ; | |
6898 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x0D , 0x08 ) ; | |
6899 | tempcx = pVBInfo->VBInfo ; | |
6900 | tempbx = pVBInfo->VGAHDE ; | |
6901 | ||
6902 | if ( modeflag & HalfDCLK ) | |
6903 | { | |
6904 | tempbx = tempbx >> 1 ; | |
6905 | } | |
6906 | ||
6907 | if ( XGI_IsLCDDualLink( pVBInfo ) ) | |
6908 | tempbx = tempbx >> 1 ; | |
6909 | ||
6910 | if(tempcx&SetCRT2ToHiVisionTV) | |
6911 | { | |
6912 | temp=0; | |
6913 | if(tempbx<=1024) | |
6914 | temp=0xA0; | |
6915 | if(tempbx == 1280) | |
6916 | temp = 0xC0; | |
6917 | } | |
6918 | else if(tempcx&SetCRT2ToTV) | |
6919 | { | |
6920 | temp=0xA0; | |
6921 | if(tempbx <= 800) | |
6922 | temp=0x80; | |
6923 | } | |
6924 | else | |
6925 | { | |
6926 | temp=0x80; | |
6927 | if(pVBInfo->VBInfo&SetCRT2ToLCD) | |
6928 | { | |
6929 | temp=0; | |
6930 | if(tempbx>800) | |
6931 | temp=0x60; | |
6932 | } | |
6933 | } | |
6934 | ||
6935 | if ( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) | |
6936 | { | |
6937 | temp = 0x00 ; | |
6938 | if ( pVBInfo->VGAHDE == 1280 ) | |
6939 | temp = 0x40 ; | |
6940 | if ( pVBInfo->VGAHDE == 1024 ) | |
6941 | temp = 0x20 ; | |
6942 | } | |
6943 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x0E , ~0xEF , temp ) ; | |
6944 | ||
6945 | tempebx = pVBInfo->VDE ; | |
6946 | ||
6947 | if ( tempcx & SetCRT2ToHiVisionTV ) | |
6948 | { | |
6949 | if ( !( temp & 0xE000 ) ) | |
6950 | tempbx = tempbx >> 1 ; | |
6951 | } | |
6952 | ||
6953 | tempcx = pVBInfo->RVBHRS ; | |
6954 | temp = tempcx & 0x00FF ; | |
6955 | XGINew_SetReg1( pVBInfo->Part4Port , 0x18 , temp ); | |
6956 | ||
6957 | tempeax = pVBInfo->VGAVDE ; | |
6958 | tempcx |= 0x04000 ; | |
6959 | ||
6960 | ||
6961 | if ( tempeax <= tempebx ) | |
6962 | { | |
6963 | tempcx=(tempcx&(~0x4000)); | |
6964 | tempeax = pVBInfo->VGAVDE ; | |
6965 | } | |
6966 | else | |
6967 | { | |
6968 | tempeax -= tempebx ; | |
6969 | } | |
6970 | ||
6971 | ||
6972 | templong = ( tempeax * 256 * 1024 ) % tempebx ; | |
6973 | tempeax = ( tempeax * 256 * 1024 ) / tempebx ; | |
6974 | tempebx = tempeax ; | |
6975 | ||
6976 | if ( templong != 0 ) | |
6977 | { | |
6978 | tempebx++ ; | |
6979 | } | |
6980 | ||
6981 | ||
82d6eb5b | 6982 | temp = (unsigned short)(tempebx & 0x000000FF); |
d7636e0b | 6983 | XGINew_SetReg1( pVBInfo->Part4Port , 0x1B , temp ) ; |
6984 | ||
82d6eb5b | 6985 | temp = (unsigned short)((tempebx & 0x0000FF00) >> 8); |
d7636e0b | 6986 | XGINew_SetReg1( pVBInfo->Part4Port , 0x1A , temp ) ; |
82d6eb5b | 6987 | tempbx = (unsigned short)(tempebx >> 16); |
d7636e0b | 6988 | temp = tempbx & 0x00FF ; |
6989 | temp = temp << 4 ; | |
6990 | temp |= ( ( tempcx & 0xFF00 ) >> 8 ) ; | |
6991 | XGINew_SetReg1( pVBInfo->Part4Port , 0x19 , temp ) ; | |
6992 | ||
6993 | /* 301b */ | |
6994 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
6995 | { | |
6996 | temp = 0x0028 ; | |
6997 | XGINew_SetReg1( pVBInfo->Part4Port , 0x1C , temp ) ; | |
6998 | tempax = pVBInfo->VGAHDE ; | |
6999 | if ( modeflag & HalfDCLK ) | |
7000 | { | |
7001 | tempax = tempax >> 1 ; | |
7002 | } | |
7003 | ||
7004 | if ( XGI_IsLCDDualLink( pVBInfo ) ) | |
7005 | tempax = tempax >> 1 ; | |
7006 | ||
7007 | /* if((pVBInfo->VBInfo&(SetCRT2ToLCD))||((pVBInfo->TVInfo&SetYPbPrMode525p)||(pVBInfo->TVInfo&SetYPbPrMode750p))) { */ | |
7008 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) | |
7009 | { | |
7010 | if ( tempax > 800 ) | |
7011 | tempax -= 800 ; | |
7012 | } | |
7013 | else | |
7014 | { | |
7015 | if ( pVBInfo->VGAHDE > 800 ) | |
7016 | { | |
7017 | if ( pVBInfo->VGAHDE == 1024 ) | |
7018 | tempax = ( tempax * 25 / 32 ) - 1 ; | |
7019 | else | |
7020 | tempax = ( tempax * 20 / 32 ) - 1 ; | |
7021 | } | |
7022 | } | |
7023 | tempax -= 1 ; | |
7024 | ||
7025 | /* | |
7026 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToHiVisionTV ) ) | |
7027 | { | |
7028 | if ( pVBInfo->VBType & VB_XGI301LV ) | |
7029 | { | |
7030 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) ) | |
7031 | { | |
7032 | if ( pVBInfo->VGAHDE > 800 ) | |
7033 | { | |
7034 | if ( pVBInfo->VGAHDE == 1024 ) | |
7035 | tempax = ( tempax * 25 / 32 ) - 1 ; | |
7036 | else | |
7037 | tempax = ( tempax * 20 / 32 ) - 1 ; | |
7038 | } | |
7039 | } | |
7040 | } | |
7041 | else | |
7042 | { | |
7043 | if ( pVBInfo->VGAHDE > 800 ) | |
7044 | { | |
7045 | if ( pVBInfo->VGAHDE == 1024 ) | |
7046 | tempax = ( tempax * 25 / 32 ) - 1 ; | |
7047 | else | |
7048 | tempax = ( tempax * 20 / 32 ) - 1 ; | |
7049 | } | |
7050 | } | |
7051 | } | |
7052 | */ | |
7053 | ||
7054 | temp = ( tempax & 0xFF00 ) >> 8 ; | |
7055 | temp = ( ( temp & 0x0003 ) << 4 ) ; | |
7056 | XGINew_SetReg1( pVBInfo->Part4Port , 0x1E , temp ) ; | |
7057 | temp = ( tempax & 0x00FF ) ; | |
7058 | XGINew_SetReg1( pVBInfo->Part4Port , 0x1D , temp ) ; | |
7059 | ||
7060 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToHiVisionTV ) ) | |
7061 | { | |
7062 | if ( pVBInfo->VGAHDE > 800 ) | |
7063 | { | |
7064 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x1E , 0x08 ) ; | |
7065 | } | |
7066 | } | |
7067 | temp = 0x0036 ; | |
7068 | ||
7069 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
7070 | { | |
7071 | if ( !( pVBInfo->TVInfo & ( NTSC1024x768 | SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) ) | |
7072 | { | |
7073 | temp |= 0x0001 ; | |
7074 | if ( ( pVBInfo->VBInfo & SetInSlaveMode ) && ( !( pVBInfo->TVInfo & TVSimuMode ) ) ) | |
7075 | temp &= ( ~0x0001 ) ; | |
7076 | } | |
7077 | } | |
7078 | ||
7079 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x1F , 0x00C0 , temp ) ; | |
7080 | tempbx = pVBInfo->HT ; | |
7081 | if ( XGI_IsLCDDualLink( pVBInfo ) ) | |
7082 | tempbx = tempbx >> 1 ; | |
7083 | tempbx = ( tempbx >> 1 ) - 2 ; | |
7084 | temp = ( ( tempbx & 0x0700 ) >> 8 ) << 3 ; | |
7085 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x21 , 0x00C0 , temp ) ; | |
7086 | temp = tempbx & 0x00FF ; | |
7087 | XGINew_SetReg1( pVBInfo->Part4Port , 0x22 , temp ) ; | |
7088 | } | |
7089 | /* end 301b */ | |
7090 | ||
7091 | if ( pVBInfo->ISXPDOS == 0 ) | |
7092 | XGI_SetCRT2VCLK( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; | |
7093 | } | |
7094 | ||
7095 | ||
7096 | /* --------------------------------------------------------------------- */ | |
7097 | /* Function : XGI_SetGroup5 */ | |
7098 | /* Input : */ | |
7099 | /* Output : */ | |
7100 | /* Description : */ | |
7101 | /* --------------------------------------------------------------------- */ | |
80adad85 | 7102 | void XGI_SetGroup5(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
d7636e0b | 7103 | { |
82d6eb5b | 7104 | unsigned short Pindex , |
d7636e0b | 7105 | Pdata ; |
7106 | ||
7107 | Pindex = pVBInfo->Part5Port ; | |
7108 | Pdata = pVBInfo->Part5Port + 1 ; | |
7109 | if ( pVBInfo->ModeType == ModeVGA ) | |
7110 | { | |
7111 | if ( !( pVBInfo->VBInfo & ( SetInSlaveMode | LoadDACFlag | CRT2DisplayFlag ) ) ) | |
7112 | { | |
7113 | XGINew_EnableCRT2(pVBInfo) ; | |
7114 | /* LoadDAC2(pVBInfo->Part5Port,ModeNo,ModeIdIndex); */ | |
7115 | } | |
7116 | } | |
7117 | return ; | |
7118 | } | |
7119 | ||
7120 | ||
7121 | /* --------------------------------------------------------------------- */ | |
7122 | /* Function : XGI_GetLcdPtr */ | |
7123 | /* Input : */ | |
7124 | /* Output : */ | |
7125 | /* Description : */ | |
7126 | /* --------------------------------------------------------------------- */ | |
82d6eb5b BP |
7127 | void *XGI_GetLcdPtr(unsigned short BX, |
7128 | unsigned short ModeNo, | |
7129 | unsigned short ModeIdIndex, | |
7130 | unsigned short RefreshRateTableIndex, | |
80adad85 | 7131 | struct vb_device_info *pVBInfo) |
d7636e0b | 7132 | { |
82d6eb5b | 7133 | unsigned short i , |
d7636e0b | 7134 | tempdx , |
7135 | tempcx , | |
7136 | tempbx , | |
7137 | tempal , | |
7138 | modeflag , | |
7139 | table ; | |
7140 | ||
8922967e | 7141 | struct XGI330_LCDDataTablStruct *tempdi = NULL; |
d7636e0b | 7142 | |
7143 | ||
7144 | tempbx = BX; | |
7145 | ||
7146 | if ( ModeNo <= 0x13 ) | |
7147 | { | |
7148 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; | |
7149 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; | |
7150 | } | |
7151 | else | |
7152 | { | |
7153 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
7154 | tempal = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ; | |
7155 | } | |
7156 | ||
7157 | tempal = tempal & 0x0f ; | |
7158 | ||
7159 | if ( tempbx <= 1 ) /* ExpLink */ | |
7160 | { | |
7161 | if ( ModeNo <= 0x13 ) | |
7162 | { | |
7163 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; /* find no Ext_CRT2CRTC2 */ | |
7164 | } | |
7165 | else | |
7166 | { | |
7167 | tempal= pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ; | |
7168 | } | |
7169 | ||
7170 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) | |
7171 | { | |
7172 | if ( ModeNo <= 0x13 ) | |
7173 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC2 ; | |
7174 | else | |
7175 | tempal= pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC2 ; | |
7176 | } | |
7177 | ||
7178 | if ( tempbx & 0x01 ) | |
7179 | tempal = ( tempal >> 4 ) ; | |
7180 | ||
7181 | tempal = ( tempal & 0x0f ) ; | |
7182 | } | |
7183 | ||
7184 | tempcx = LCDLenList[ tempbx ] ; /* mov cl,byte ptr cs:LCDLenList[bx] */ | |
7185 | ||
7186 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) /* ScaleLCD */ | |
7187 | { | |
7188 | if ( ( tempbx == 5 ) || ( tempbx ) == 7 ) | |
7189 | tempcx = LCDDesDataLen2 ; | |
7190 | else if ( ( tempbx == 3 ) || ( tempbx == 8 ) ) | |
7191 | tempcx = LVDSDesDataLen2 ; | |
7192 | } | |
7193 | /* mov di, word ptr cs:LCDDataList[bx] */ | |
7194 | /* tempdi=pVideoMemory[LCDDataList+tempbx*2]|(pVideoMemory[LCDDataList+tempbx*2+1]<<8); */ | |
7195 | ||
7196 | switch( tempbx ) | |
7197 | { | |
7198 | case 0: | |
7199 | tempdi = XGI_EPLLCDCRT1Ptr_H ; | |
7200 | break ; | |
7201 | case 1: | |
7202 | tempdi = XGI_EPLLCDCRT1Ptr_V ; | |
7203 | break ; | |
7204 | case 2: | |
7205 | tempdi = XGI_EPLLCDDataPtr ; | |
7206 | break ; | |
7207 | case 3: | |
7208 | tempdi = XGI_EPLLCDDesDataPtr ; | |
7209 | break ; | |
7210 | case 4: | |
7211 | tempdi = XGI_LCDDataTable ; | |
7212 | break ; | |
7213 | case 5: | |
7214 | tempdi = XGI_LCDDesDataTable ; | |
7215 | break ; | |
7216 | case 6: | |
7217 | tempdi = XGI_EPLCHLCDRegPtr ; | |
7218 | break ; | |
7219 | case 7: | |
7220 | case 8: | |
7221 | case 9: | |
8922967e | 7222 | tempdi = NULL; |
d7636e0b | 7223 | break ; |
7224 | default: | |
7225 | break ; | |
7226 | } | |
7227 | ||
8922967e RD |
7228 | if ( tempdi == NULL ) /* OEMUtil */ |
7229 | return NULL; | |
d7636e0b | 7230 | |
7231 | table = tempbx ; | |
7232 | i = 0 ; | |
7233 | ||
7234 | while( tempdi[ i ].PANELID != 0xff ) | |
7235 | { | |
7236 | tempdx = pVBInfo->LCDResInfo ; | |
7237 | if ( tempbx & 0x0080 ) /* OEMUtil */ | |
7238 | { | |
7239 | tempbx &= ( ~0x0080 ) ; | |
7240 | tempdx = pVBInfo->LCDTypeInfo ; | |
7241 | } | |
7242 | ||
7243 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) | |
7244 | tempdx &= ( ~PanelResInfo ) ; | |
7245 | ||
7246 | if ( tempdi[ i ].PANELID == tempdx ) | |
7247 | { | |
7248 | tempbx = tempdi[ i ].MASK ; | |
7249 | tempdx = pVBInfo->LCDInfo ; | |
7250 | ||
7251 | if ( ModeNo <= 0x13 ) /* alan 09/10/2003 */ | |
7252 | tempdx |= SetLCDStdMode ; | |
7253 | ||
7254 | if ( modeflag & HalfDCLK ) | |
7255 | tempdx |= SetLCDLowResolution ; | |
7256 | ||
7257 | tempbx &= tempdx; | |
7258 | if ( tempbx == tempdi[ i ].CAP ) | |
7259 | break ; | |
7260 | } | |
7261 | i++ ; | |
7262 | } | |
7263 | ||
7264 | if ( table == 0 ) | |
7265 | { | |
7266 | switch( tempdi[ i ].DATAPTR ) | |
7267 | { | |
7268 | case 0: | |
7269 | return &XGI_LVDSCRT11024x768_1_H[ tempal ] ; | |
7270 | break ; | |
7271 | case 1: | |
7272 | return &XGI_LVDSCRT11024x768_2_H[ tempal ] ; | |
7273 | break ; | |
7274 | case 2: | |
7275 | return &XGI_LVDSCRT11280x1024_1_H[ tempal ] ; | |
7276 | break ; | |
7277 | case 3: | |
7278 | return &XGI_LVDSCRT11280x1024_2_H[ tempal ] ; | |
7279 | break ; | |
7280 | case 4: | |
7281 | return &XGI_LVDSCRT11400x1050_1_H[ tempal ] ; | |
7282 | break ; | |
7283 | case 5: | |
7284 | return &XGI_LVDSCRT11400x1050_2_H[ tempal ] ; | |
7285 | break ; | |
7286 | case 6: | |
7287 | return &XGI_LVDSCRT11600x1200_1_H[ tempal ] ; | |
7288 | break ; | |
7289 | case 7: | |
7290 | return &XGI_LVDSCRT11024x768_1_Hx75[ tempal ] ; | |
7291 | break ; | |
7292 | case 8: | |
7293 | return &XGI_LVDSCRT11024x768_2_Hx75[ tempal ] ; | |
7294 | break ; | |
7295 | case 9: | |
7296 | return &XGI_LVDSCRT11280x1024_1_Hx75[ tempal ] ; | |
7297 | break ; | |
7298 | case 10: | |
7299 | return &XGI_LVDSCRT11280x1024_2_Hx75[ tempal ] ; | |
7300 | break ; | |
7301 | default: | |
7302 | break ; | |
7303 | } | |
7304 | } | |
7305 | else if ( table == 1 ) | |
7306 | { | |
7307 | switch( tempdi[ i ].DATAPTR ) | |
7308 | { | |
7309 | case 0: | |
7310 | return &XGI_LVDSCRT11024x768_1_V[ tempal ] ; | |
7311 | break ; | |
7312 | case 1: | |
7313 | return &XGI_LVDSCRT11024x768_2_V[ tempal ] ; | |
7314 | break ; | |
7315 | case 2: | |
7316 | return &XGI_LVDSCRT11280x1024_1_V[ tempal ] ; | |
7317 | break ; | |
7318 | case 3: | |
7319 | return &XGI_LVDSCRT11280x1024_2_V[ tempal ] ; | |
7320 | break ; | |
7321 | case 4: | |
7322 | return &XGI_LVDSCRT11400x1050_1_V[ tempal ] ; | |
7323 | break ; | |
7324 | case 5: | |
7325 | return &XGI_LVDSCRT11400x1050_2_V[ tempal ] ; | |
7326 | break ; | |
7327 | case 6: | |
7328 | return &XGI_LVDSCRT11600x1200_1_V[ tempal ] ; | |
7329 | break ; | |
7330 | case 7: | |
7331 | return &XGI_LVDSCRT11024x768_1_Vx75[ tempal ] ; | |
7332 | break ; | |
7333 | case 8: | |
7334 | return &XGI_LVDSCRT11024x768_2_Vx75[ tempal ] ; | |
7335 | break ; | |
7336 | case 9: | |
7337 | return &XGI_LVDSCRT11280x1024_1_Vx75[ tempal ] ; | |
7338 | break ; | |
7339 | case 10: | |
7340 | return &XGI_LVDSCRT11280x1024_2_Vx75[ tempal ] ; | |
7341 | break ; | |
7342 | default: | |
7343 | break ; | |
7344 | } | |
7345 | } | |
7346 | else if ( table == 2 ) | |
7347 | { | |
7348 | switch( tempdi[ i ].DATAPTR ) | |
7349 | { | |
7350 | case 0: | |
7351 | return &XGI_LVDS1024x768Data_1[ tempal ] ; | |
7352 | break ; | |
7353 | case 1: | |
7354 | return &XGI_LVDS1024x768Data_2[ tempal ] ; | |
7355 | break ; | |
7356 | case 2: | |
7357 | return &XGI_LVDS1280x1024Data_1[ tempal ] ; | |
7358 | break ; | |
7359 | case 3: | |
7360 | return &XGI_LVDS1280x1024Data_2[ tempal ] ; | |
7361 | break ; | |
7362 | case 4: | |
7363 | return &XGI_LVDS1400x1050Data_1[ tempal ] ; | |
7364 | break ; | |
7365 | case 5: | |
7366 | return &XGI_LVDS1400x1050Data_2[ tempal ] ; | |
7367 | break ; | |
7368 | case 6: | |
7369 | return &XGI_LVDS1600x1200Data_1[ tempal ] ; | |
7370 | break ; | |
7371 | case 7: | |
7372 | return &XGI_LVDSNoScalingData[ tempal ] ; | |
7373 | break ; | |
7374 | case 8: | |
7375 | return &XGI_LVDS1024x768Data_1x75[ tempal ] ; | |
7376 | break ; | |
7377 | case 9: | |
7378 | return &XGI_LVDS1024x768Data_2x75[ tempal ] ; | |
7379 | break ; | |
7380 | case 10: | |
7381 | return &XGI_LVDS1280x1024Data_1x75[ tempal ] ; | |
7382 | break ; | |
7383 | case 11: | |
7384 | return &XGI_LVDS1280x1024Data_2x75[ tempal ] ; | |
7385 | break ; | |
7386 | case 12: | |
7387 | return &XGI_LVDSNoScalingDatax75[ tempal ] ; | |
7388 | break ; | |
7389 | default: | |
7390 | break ; | |
7391 | } | |
7392 | } | |
7393 | else if ( table == 3 ) | |
7394 | { | |
7395 | switch( tempdi[ i ].DATAPTR ) | |
7396 | { | |
7397 | case 0: | |
7398 | return &XGI_LVDS1024x768Des_1[ tempal ] ; | |
7399 | break ; | |
7400 | case 1: | |
7401 | return &XGI_LVDS1024x768Des_3[ tempal ] ; | |
7402 | break ; | |
7403 | case 2: | |
7404 | return &XGI_LVDS1024x768Des_2[ tempal ] ; | |
7405 | break ; | |
7406 | case 3: | |
7407 | return &XGI_LVDS1280x1024Des_1[ tempal ] ; | |
7408 | break ; | |
7409 | case 4: | |
7410 | return &XGI_LVDS1280x1024Des_2[ tempal ] ; | |
7411 | break ; | |
7412 | case 5: | |
7413 | return &XGI_LVDS1400x1050Des_1[ tempal ] ; | |
7414 | break ; | |
7415 | case 6: | |
7416 | return &XGI_LVDS1400x1050Des_2[ tempal ] ; | |
7417 | break ; | |
7418 | case 7: | |
7419 | return &XGI_LVDS1600x1200Des_1[ tempal ] ; | |
7420 | break ; | |
7421 | case 8: | |
7422 | return &XGI_LVDSNoScalingDesData[ tempal ] ; | |
7423 | break ; | |
7424 | case 9: | |
7425 | return &XGI_LVDS1024x768Des_1x75[ tempal ] ; | |
7426 | break ; | |
7427 | case 10: | |
7428 | return &XGI_LVDS1024x768Des_3x75[ tempal ] ; | |
7429 | break ; | |
7430 | case 11: | |
7431 | return &XGI_LVDS1024x768Des_2x75[ tempal ] ; | |
7432 | break; | |
7433 | case 12: | |
7434 | return &XGI_LVDS1280x1024Des_1x75[ tempal ] ; | |
7435 | break ; | |
7436 | case 13: | |
7437 | return &XGI_LVDS1280x1024Des_2x75[ tempal ] ; | |
7438 | break ; | |
7439 | case 14: | |
7440 | return &XGI_LVDSNoScalingDesDatax75[ tempal ] ; | |
7441 | break ; | |
7442 | default: | |
7443 | break ; | |
7444 | } | |
7445 | } | |
7446 | else if ( table == 4 ) | |
7447 | { | |
7448 | switch( tempdi[ i ].DATAPTR ) | |
7449 | { | |
7450 | case 0: | |
7451 | return &XGI_ExtLCD1024x768Data[ tempal ] ; | |
7452 | break ; | |
7453 | case 1: | |
7454 | return &XGI_StLCD1024x768Data[ tempal ] ; | |
7455 | break ; | |
7456 | case 2: | |
7457 | return &XGI_CetLCD1024x768Data[ tempal ] ; | |
7458 | break ; | |
7459 | case 3: | |
7460 | return &XGI_ExtLCD1280x1024Data[ tempal ] ; | |
7461 | break ; | |
7462 | case 4: | |
7463 | return &XGI_StLCD1280x1024Data[ tempal ] ; | |
7464 | break ; | |
7465 | case 5: | |
7466 | return &XGI_CetLCD1280x1024Data[ tempal ] ; | |
7467 | break ; | |
7468 | case 6: | |
7469 | return &XGI_ExtLCD1400x1050Data[ tempal ] ; | |
7470 | break ; | |
7471 | case 7: | |
7472 | return &XGI_StLCD1400x1050Data[ tempal ] ; | |
7473 | break ; | |
7474 | case 8: | |
7475 | return &XGI_CetLCD1400x1050Data[ tempal ] ; | |
7476 | break ; | |
7477 | case 9: | |
7478 | return &XGI_ExtLCD1600x1200Data[ tempal ] ; | |
7479 | break ; | |
7480 | case 10: | |
7481 | return &XGI_StLCD1600x1200Data[ tempal ] ; | |
7482 | break ; | |
7483 | case 11: | |
7484 | return &XGI_NoScalingData[ tempal ] ; | |
7485 | break ; | |
7486 | case 12: | |
7487 | return &XGI_ExtLCD1024x768x75Data[ tempal ] ; | |
7488 | break ; | |
7489 | case 13: | |
7490 | return &XGI_ExtLCD1024x768x75Data[ tempal ] ; | |
7491 | break ; | |
7492 | case 14: | |
7493 | return &XGI_CetLCD1024x768x75Data[ tempal ] ; | |
7494 | break ; | |
7495 | case 15: | |
7496 | return &XGI_ExtLCD1280x1024x75Data[ tempal ] ; | |
7497 | break ; | |
7498 | case 16: | |
7499 | return &XGI_StLCD1280x1024x75Data[ tempal ] ; | |
7500 | break; | |
7501 | case 17: | |
7502 | return &XGI_CetLCD1280x1024x75Data[ tempal ] ; | |
7503 | break; | |
7504 | case 18: | |
7505 | return &XGI_NoScalingDatax75[ tempal ] ; | |
7506 | break ; | |
7507 | default: | |
7508 | break ; | |
7509 | } | |
7510 | } | |
7511 | else if ( table == 5 ) | |
7512 | { | |
7513 | switch( tempdi[ i ].DATAPTR ) | |
7514 | { | |
7515 | case 0: | |
7516 | return &XGI_ExtLCDDes1024x768Data[ tempal ] ; | |
7517 | break ; | |
7518 | case 1: | |
7519 | return &XGI_StLCDDes1024x768Data[ tempal ] ; | |
7520 | break ; | |
7521 | case 2: | |
7522 | return &XGI_CetLCDDes1024x768Data[ tempal ] ; | |
7523 | break ; | |
7524 | case 3: | |
7525 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) | |
7526 | return &XGI_ExtLCDDLDes1280x1024Data[ tempal ] ; | |
7527 | else | |
7528 | return &XGI_ExtLCDDes1280x1024Data[ tempal ] ; | |
7529 | break ; | |
7530 | case 4: | |
7531 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) | |
7532 | return &XGI_StLCDDLDes1280x1024Data[ tempal ] ; | |
7533 | else | |
7534 | return &XGI_StLCDDes1280x1024Data[ tempal ] ; | |
7535 | break ; | |
7536 | case 5: | |
7537 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) | |
7538 | return &XGI_CetLCDDLDes1280x1024Data[ tempal ] ; | |
7539 | else | |
7540 | return &XGI_CetLCDDes1280x1024Data[ tempal ] ; | |
7541 | break ; | |
7542 | case 6: | |
7543 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) | |
7544 | return &XGI_ExtLCDDLDes1400x1050Data[ tempal ] ; | |
7545 | else | |
7546 | return &XGI_ExtLCDDes1400x1050Data[ tempal ] ; | |
7547 | break ; | |
7548 | case 7: | |
7549 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) | |
7550 | return &XGI_StLCDDLDes1400x1050Data[ tempal ] ; | |
7551 | else | |
7552 | return &XGI_StLCDDes1400x1050Data[ tempal ] ; | |
7553 | break ; | |
7554 | case 8: | |
7555 | return &XGI_CetLCDDes1400x1050Data[ tempal ] ; | |
7556 | break ; | |
7557 | case 9: | |
7558 | return &XGI_CetLCDDes1400x1050Data2[ tempal ] ; | |
7559 | break ; | |
7560 | case 10: | |
7561 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) | |
7562 | return &XGI_ExtLCDDLDes1600x1200Data[ tempal ] ; | |
7563 | else | |
7564 | return &XGI_ExtLCDDes1600x1200Data[ tempal ] ; | |
7565 | break ; | |
7566 | case 11: | |
7567 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) | |
7568 | return &XGI_StLCDDLDes1600x1200Data[ tempal ] ; | |
7569 | else | |
7570 | return &XGI_StLCDDes1600x1200Data[ tempal ] ; | |
7571 | break ; | |
7572 | case 12: | |
7573 | return &XGI_NoScalingDesData[ tempal ] ; | |
7574 | break; | |
7575 | case 13: | |
7576 | return &XGI_ExtLCDDes1024x768x75Data[ tempal ] ; | |
7577 | break ; | |
7578 | case 14: | |
7579 | return &XGI_StLCDDes1024x768x75Data[ tempal ] ; | |
7580 | break ; | |
7581 | case 15: | |
7582 | return &XGI_CetLCDDes1024x768x75Data[ tempal ] ; | |
7583 | break ; | |
7584 | case 16: | |
7585 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) | |
7586 | return &XGI_ExtLCDDLDes1280x1024x75Data[ tempal ] ; | |
7587 | else | |
7588 | return &XGI_ExtLCDDes1280x1024x75Data[ tempal ] ; | |
7589 | break ; | |
7590 | case 17: | |
7591 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) | |
7592 | return &XGI_StLCDDLDes1280x1024x75Data[ tempal ] ; | |
7593 | else | |
7594 | return &XGI_StLCDDes1280x1024x75Data[ tempal ] ; | |
7595 | break ; | |
7596 | case 18: | |
7597 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) | |
7598 | return &XGI_CetLCDDLDes1280x1024x75Data[ tempal ] ; | |
7599 | else | |
7600 | return &XGI_CetLCDDes1280x1024x75Data[ tempal ] ; | |
7601 | break ; | |
7602 | case 19: | |
7603 | return &XGI_NoScalingDesDatax75[ tempal ] ; | |
7604 | break ; | |
7605 | default: | |
7606 | break ; | |
7607 | } | |
7608 | } | |
7609 | else if ( table == 6 ) | |
7610 | { | |
7611 | switch( tempdi[ i ].DATAPTR ) | |
7612 | { | |
7613 | case 0: | |
7614 | return &XGI_CH7017LV1024x768[ tempal ] ; | |
7615 | break ; | |
7616 | case 1: | |
7617 | return &XGI_CH7017LV1400x1050[ tempal ] ; | |
7618 | break ; | |
7619 | default: | |
7620 | break ; | |
7621 | } | |
7622 | } | |
8922967e | 7623 | return NULL; |
d7636e0b | 7624 | } |
7625 | ||
7626 | ||
7627 | /* --------------------------------------------------------------------- */ | |
7628 | /* Function : XGI_GetTVPtr */ | |
7629 | /* Input : */ | |
7630 | /* Output : */ | |
7631 | /* Description : */ | |
7632 | /* --------------------------------------------------------------------- */ | |
82d6eb5b BP |
7633 | void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo, |
7634 | unsigned short ModeIdIndex, | |
7635 | unsigned short RefreshRateTableIndex, | |
80adad85 | 7636 | struct vb_device_info *pVBInfo) |
d7636e0b | 7637 | { |
82d6eb5b | 7638 | unsigned short i , tempdx , tempbx , tempal , modeflag , table ; |
8922967e | 7639 | struct XGI330_TVDataTablStruct *tempdi = NULL; |
d7636e0b | 7640 | |
7641 | tempbx = BX ; | |
7642 | ||
7643 | if ( ModeNo <= 0x13 ) | |
7644 | { | |
7645 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; | |
7646 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; | |
7647 | } | |
7648 | else | |
7649 | { | |
7650 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
7651 | tempal = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ; | |
7652 | } | |
7653 | ||
7654 | tempal = tempal & 0x3f ; | |
7655 | table = tempbx ; | |
7656 | ||
7657 | switch( tempbx ) | |
7658 | { | |
7659 | case 0: | |
8922967e | 7660 | tempdi = NULL; /*EPLCHTVCRT1Ptr_H;*/ |
d7636e0b | 7661 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
7662 | { | |
7663 | tempdi = XGI_EPLCHTVCRT1Ptr; | |
7664 | } | |
7665 | break ; | |
7666 | case 1: | |
8922967e | 7667 | tempdi = NULL; /*EPLCHTVCRT1Ptr_V;*/ |
d7636e0b | 7668 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
7669 | { | |
7670 | tempdi = XGI_EPLCHTVCRT1Ptr; | |
7671 | } | |
7672 | break ; | |
7673 | case 2: | |
7674 | tempdi = XGI_EPLCHTVDataPtr ; | |
7675 | break ; | |
7676 | case 3: | |
8922967e | 7677 | tempdi = NULL; |
d7636e0b | 7678 | break ; |
7679 | case 4: | |
7680 | tempdi = XGI_TVDataTable ; | |
7681 | break ; | |
7682 | case 5: | |
8922967e | 7683 | tempdi = NULL; |
d7636e0b | 7684 | break ; |
7685 | case 6: | |
7686 | tempdi = XGI_EPLCHTVRegPtr ; | |
7687 | break ; | |
7688 | default: | |
7689 | break ; | |
7690 | } | |
7691 | ||
8922967e RD |
7692 | if ( tempdi == NULL ) /* OEMUtil */ |
7693 | return NULL; | |
d7636e0b | 7694 | |
7695 | tempdx = pVBInfo->TVInfo ; | |
7696 | ||
7697 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
7698 | tempdx = tempdx | SetTVLockMode ; | |
7699 | ||
7700 | if ( modeflag & HalfDCLK ) | |
7701 | tempdx = tempdx | SetTVLowResolution ; | |
7702 | ||
7703 | i = 0 ; | |
7704 | ||
7705 | while( tempdi[ i ].MASK != 0xffff ) | |
7706 | { | |
7707 | if ( ( tempdx & tempdi[ i ].MASK ) == tempdi[ i ].CAP ) | |
7708 | break ; | |
7709 | i++ ; | |
7710 | } | |
7711 | ||
7712 | if ( table == 0x00 ) /* 07/05/22 */ | |
7713 | { | |
d7636e0b | 7714 | } |
7715 | else if ( table == 0x01 ) | |
7716 | { | |
d7636e0b | 7717 | } |
7718 | else if ( table == 0x04 ) | |
7719 | { | |
7720 | switch( tempdi[ i ].DATAPTR ) | |
7721 | { | |
7722 | case 0: | |
7723 | return &XGI_ExtPALData[ tempal ] ; | |
7724 | break ; | |
7725 | case 1: | |
7726 | return &XGI_ExtNTSCData[ tempal ] ; | |
7727 | break ; | |
7728 | case 2: | |
7729 | return &XGI_StPALData[ tempal ] ; | |
7730 | break ; | |
7731 | case 3: | |
7732 | return &XGI_StNTSCData[ tempal ] ; | |
7733 | break ; | |
7734 | case 4: | |
7735 | return &XGI_ExtHiTVData[ tempal ] ; | |
7736 | break ; | |
7737 | case 5: | |
7738 | return &XGI_St2HiTVData[ tempal ] ; | |
7739 | break ; | |
7740 | case 6: | |
7741 | return &XGI_ExtYPbPr525iData[ tempal ] ; | |
7742 | break ; | |
7743 | case 7: | |
7744 | return &XGI_ExtYPbPr525pData[ tempal ] ; | |
7745 | break ; | |
7746 | case 8: | |
7747 | return &XGI_ExtYPbPr750pData[ tempal ] ; | |
7748 | break ; | |
7749 | case 9: | |
7750 | return &XGI_StYPbPr525iData[ tempal ] ; | |
7751 | break ; | |
7752 | case 10: | |
7753 | return &XGI_StYPbPr525pData[ tempal ] ; | |
7754 | break ; | |
7755 | case 11: | |
7756 | return &XGI_StYPbPr750pData[ tempal ] ; | |
7757 | break; | |
7758 | case 12: /* avoid system hang */ | |
7759 | return &XGI_ExtNTSCData[ tempal ] ; | |
7760 | break ; | |
7761 | case 13: | |
7762 | return &XGI_St1HiTVData[ tempal ] ; | |
7763 | break ; | |
7764 | default: | |
7765 | break ; | |
7766 | } | |
7767 | } | |
7768 | else if( table == 0x02 ) | |
7769 | { | |
7770 | switch( tempdi[ i ].DATAPTR ) | |
7771 | { | |
7772 | case 0: | |
7773 | return &XGI_CHTVUNTSCData[ tempal ] ; | |
7774 | break ; | |
7775 | case 1: | |
7776 | return &XGI_CHTVONTSCData[ tempal ] ; | |
7777 | break ; | |
7778 | case 2: | |
7779 | return &XGI_CHTVUPALData[ tempal ] ; | |
7780 | break ; | |
7781 | case 3: | |
7782 | return &XGI_CHTVOPALData[ tempal ] ; | |
7783 | break ; | |
7784 | default: | |
7785 | break ; | |
7786 | } | |
7787 | } | |
7788 | else if( table == 0x06 ) | |
7789 | { | |
d7636e0b | 7790 | } |
8922967e | 7791 | return NULL; |
d7636e0b | 7792 | } |
7793 | ||
7794 | ||
7795 | /* --------------------------------------------------------------------- */ | |
7796 | /* Function : XGI_BacklightByDrv */ | |
7797 | /* Input : */ | |
dda08c59 | 7798 | /* Output : 1 -> Skip backlight control */ |
d7636e0b | 7799 | /* Description : */ |
7800 | /* --------------------------------------------------------------------- */ | |
80adad85 | 7801 | unsigned char XGI_BacklightByDrv(struct vb_device_info *pVBInfo) |
d7636e0b | 7802 | { |
108afbf8 | 7803 | unsigned char tempah ; |
d7636e0b | 7804 | |
108afbf8 | 7805 | tempah = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x3A) ; |
dda08c59 BP |
7806 | if (tempah & BacklightControlBit) |
7807 | return 1; | |
d7636e0b | 7808 | else |
dda08c59 | 7809 | return 0; |
d7636e0b | 7810 | } |
7811 | ||
7812 | ||
7813 | /* --------------------------------------------------------------------- */ | |
7814 | /* Function : XGI_FirePWDDisable */ | |
7815 | /* Input : */ | |
7816 | /* Output : */ | |
7817 | /* Description : Turn off VDD & Backlight : Fire disable procedure */ | |
7818 | /* --------------------------------------------------------------------- */ | |
7819 | /* | |
80adad85 | 7820 | void XGI_FirePWDDisable(struct vb_device_info *pVBInfo) |
d7636e0b | 7821 | { |
7822 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x26 , 0x00 , 0xFC ) ; | |
7823 | } | |
7824 | */ | |
7825 | ||
7826 | /* --------------------------------------------------------------------- */ | |
7827 | /* Function : XGI_FirePWDEnable */ | |
7828 | /* Input : */ | |
7829 | /* Output : */ | |
7830 | /* Description : Turn on VDD & Backlight : Fire enable procedure */ | |
7831 | /* --------------------------------------------------------------------- */ | |
80adad85 | 7832 | void XGI_FirePWDEnable(struct vb_device_info *pVBInfo) |
d7636e0b | 7833 | { |
7834 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x26 , 0x03 , 0xFC ) ; | |
7835 | } | |
7836 | ||
7837 | ||
7838 | /* --------------------------------------------------------------------- */ | |
7839 | /* Function : XGI_EnableGatingCRT */ | |
7840 | /* Input : */ | |
7841 | /* Output : */ | |
7842 | /* Description : */ | |
7843 | /* --------------------------------------------------------------------- */ | |
80adad85 | 7844 | void XGI_EnableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
d7636e0b | 7845 | { |
7846 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x63 , 0xBF , 0x40 ) ; | |
7847 | } | |
7848 | ||
7849 | ||
7850 | /* --------------------------------------------------------------------- */ | |
7851 | /* Function : XGI_DisableGatingCRT */ | |
7852 | /* Input : */ | |
7853 | /* Output : */ | |
7854 | /* Description : */ | |
7855 | /* --------------------------------------------------------------------- */ | |
80adad85 | 7856 | void XGI_DisableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
d7636e0b | 7857 | { |
7858 | ||
7859 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x63 , 0xBF , 0x00 ) ; | |
7860 | } | |
7861 | ||
7862 | ||
7863 | /* --------------------------------------------------------------------- */ | |
7864 | /* Function : XGI_SetPanelDelay */ | |
7865 | /* Input : */ | |
7866 | /* Output : */ | |
7867 | /* Description : */ | |
7868 | /* I/P : bl : 1 ; T1 : the duration between CPL on and signal on */ | |
7869 | /* : bl : 2 ; T2 : the duration signal on and Vdd on */ | |
7870 | /* : bl : 3 ; T3 : the duration between CPL off and signal off */ | |
7871 | /* : bl : 4 ; T4 : the duration signal off and Vdd off */ | |
7872 | /* --------------------------------------------------------------------- */ | |
80adad85 | 7873 | void XGI_SetPanelDelay(unsigned short tempbl, struct vb_device_info *pVBInfo) |
d7636e0b | 7874 | { |
82d6eb5b | 7875 | unsigned short index ; |
d7636e0b | 7876 | |
7877 | index = XGI_GetLCDCapPtr(pVBInfo) ; | |
7878 | ||
7879 | if ( tempbl == 1 ) | |
7880 | XGINew_LCD_Wait_Time( pVBInfo->LCDCapList[ index ].PSC_S1, pVBInfo ) ; | |
7881 | ||
7882 | if ( tempbl == 2 ) | |
7883 | XGINew_LCD_Wait_Time( pVBInfo->LCDCapList[ index ].PSC_S2, pVBInfo ) ; | |
7884 | ||
7885 | if ( tempbl == 3 ) | |
7886 | XGINew_LCD_Wait_Time( pVBInfo->LCDCapList[ index ].PSC_S3, pVBInfo ) ; | |
7887 | ||
7888 | if ( tempbl == 4 ) | |
7889 | XGINew_LCD_Wait_Time( pVBInfo->LCDCapList[ index ].PSC_S4, pVBInfo ) ; | |
7890 | } | |
7891 | ||
7892 | ||
7893 | /* --------------------------------------------------------------------- */ | |
7894 | /* Function : XGI_SetPanelPower */ | |
7895 | /* Input : */ | |
7896 | /* Output : */ | |
7897 | /* Description : */ | |
7898 | /* I/O : ah = 0011b = 03h ; Backlight on, Power on */ | |
7899 | /* = 0111b = 07h ; Backlight on, Power off */ | |
7900 | /* = 1011b = 0Bh ; Backlight off, Power on */ | |
7901 | /* = 1111b = 0Fh ; Backlight off, Power off */ | |
7902 | /* --------------------------------------------------------------------- */ | |
80adad85 | 7903 | void XGI_SetPanelPower(unsigned short tempah, unsigned short tempbl, struct vb_device_info *pVBInfo) |
d7636e0b | 7904 | { |
7905 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
7906 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x26 , tempbl , tempah ) ; | |
7907 | else | |
7908 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x11 , tempbl , tempah ) ; | |
7909 | } | |
7910 | ||
8922967e | 7911 | static unsigned char XG21GPIODataTransfer(unsigned char ujDate) |
d7636e0b | 7912 | { |
108afbf8 BP |
7913 | unsigned char ujRet = 0; |
7914 | unsigned char i = 0; | |
d7636e0b | 7915 | |
7916 | for (i=0; i<8; i++) | |
7917 | { | |
7918 | ujRet = ujRet << 1; | |
7919 | /* ujRet |= GETBITS(ujDate >> i, 0:0); */ | |
7920 | ujRet |= (ujDate >> i) & 1; | |
7921 | } | |
7922 | ||
7923 | return ujRet; | |
7924 | } | |
7925 | ||
7926 | /*----------------------------------------------------------------------------*/ | |
7927 | /* output */ | |
7928 | /* bl[5] : LVDS signal */ | |
7929 | /* bl[1] : LVDS backlight */ | |
7930 | /* bl[0] : LVDS VDD */ | |
7931 | /*----------------------------------------------------------------------------*/ | |
80adad85 | 7932 | unsigned char XGI_XG21GetPSCValue(struct vb_device_info *pVBInfo) |
d7636e0b | 7933 | { |
108afbf8 | 7934 | unsigned char CR4A, temp; |
d7636e0b | 7935 | |
7936 | CR4A = XGINew_GetReg1( pVBInfo->P3d4 , 0x4A ) ; | |
7937 | XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~0x23 ) ; /* enable GPIO write */ | |
7938 | ||
7939 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x48 ) ; | |
7940 | ||
7941 | temp = XG21GPIODataTransfer(temp); | |
7942 | temp &= 0x23; | |
7943 | XGINew_SetReg1( pVBInfo->P3d4 , 0x4A , CR4A ) ; | |
7944 | return temp; | |
7945 | } | |
7946 | ||
7947 | /*----------------------------------------------------------------------------*/ | |
7948 | /* output */ | |
7949 | /* bl[5] : LVDS signal */ | |
7950 | /* bl[1] : LVDS backlight */ | |
7951 | /* bl[0] : LVDS VDD */ | |
7952 | /*----------------------------------------------------------------------------*/ | |
80adad85 | 7953 | unsigned char XGI_XG27GetPSCValue(struct vb_device_info *pVBInfo) |
d7636e0b | 7954 | { |
108afbf8 | 7955 | unsigned char CR4A, CRB4, temp; |
d7636e0b | 7956 | |
7957 | CR4A = XGINew_GetReg1( pVBInfo->P3d4 , 0x4A ) ; | |
7958 | XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~0x0C ) ; /* enable GPIO write */ | |
7959 | ||
7960 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x48 ) ; | |
7961 | ||
7962 | temp &= 0x0C; | |
7963 | temp >>= 2; | |
7964 | XGINew_SetReg1( pVBInfo->P3d4 , 0x4A , CR4A ) ; | |
7965 | CRB4 = XGINew_GetReg1( pVBInfo->P3d4 , 0xB4 ) ; | |
7966 | temp |= ((CRB4&0x04)<<3); | |
7967 | return temp; | |
7968 | } | |
7969 | /*----------------------------------------------------------------------------*/ | |
7970 | /* input */ | |
7971 | /* bl[5] : 1;LVDS signal on */ | |
7972 | /* bl[1] : 1;LVDS backlight on */ | |
7973 | /* bl[0] : 1:LVDS VDD on */ | |
7974 | /* bh: 100000b : clear bit 5, to set bit5 */ | |
7975 | /* 000010b : clear bit 1, to set bit1 */ | |
7976 | /* 000001b : clear bit 0, to set bit0 */ | |
7977 | /*----------------------------------------------------------------------------*/ | |
80adad85 | 7978 | void XGI_XG21BLSignalVDD(unsigned short tempbh, unsigned short tempbl, struct vb_device_info *pVBInfo) |
d7636e0b | 7979 | { |
108afbf8 | 7980 | unsigned char CR4A, temp; |
d7636e0b | 7981 | |
7982 | CR4A = XGINew_GetReg1( pVBInfo->P3d4 , 0x4A ) ; | |
7983 | tempbh &= 0x23; | |
7984 | tempbl &= 0x23; | |
7985 | XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~tempbh ) ; /* enable GPIO write */ | |
7986 | ||
7987 | if (tempbh&0x20) | |
7988 | { | |
7989 | temp = (tempbl>>4)&0x02; | |
7990 | ||
7991 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0xB4 , ~0x02 , temp) ; /* CR B4[1] */ | |
7992 | ||
7993 | } | |
7994 | ||
7995 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x48 ) ; | |
7996 | ||
7997 | temp = XG21GPIODataTransfer(temp); | |
7998 | temp &= ~tempbh; | |
7999 | temp |= tempbl; | |
8000 | XGINew_SetReg1( pVBInfo->P3d4 , 0x48 , temp ) ; | |
8001 | } | |
8002 | ||
80adad85 | 8003 | void XGI_XG27BLSignalVDD(unsigned short tempbh, unsigned short tempbl, struct vb_device_info *pVBInfo) |
d7636e0b | 8004 | { |
108afbf8 | 8005 | unsigned char CR4A, temp; |
82d6eb5b | 8006 | unsigned short tempbh0, tempbl0; |
d7636e0b | 8007 | |
8008 | tempbh0 = tempbh; | |
8009 | tempbl0 = tempbl; | |
8010 | tempbh0 &= 0x20; | |
8011 | tempbl0 &= 0x20; | |
8012 | tempbh0 >>= 3; | |
8013 | tempbl0 >>= 3; | |
8014 | ||
8015 | if (tempbh&0x20) | |
8016 | { | |
8017 | temp = (tempbl>>4)&0x02; | |
8018 | ||
8019 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0xB4 , ~0x02 , temp) ; /* CR B4[1] */ | |
8020 | ||
8021 | } | |
8022 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0xB4 , ~tempbh0 , tempbl0 ) ; | |
8023 | ||
8024 | CR4A = XGINew_GetReg1( pVBInfo->P3d4 , 0x4A ) ; | |
8025 | tempbh &= 0x03; | |
8026 | tempbl &= 0x03; | |
8027 | tempbh <<= 2; | |
8028 | tempbl <<= 2; /* GPIOC,GPIOD */ | |
8029 | XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~tempbh ) ; /* enable GPIO write */ | |
8030 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x48 , ~tempbh , tempbl ) ; | |
8031 | } | |
8032 | ||
8033 | /* --------------------------------------------------------------------- */ | |
80adad85 | 8034 | unsigned short XGI_GetLVDSOEMTableIndex(struct vb_device_info *pVBInfo) |
d7636e0b | 8035 | { |
82d6eb5b | 8036 | unsigned short index ; |
d7636e0b | 8037 | |
8038 | index = XGINew_GetReg1( pVBInfo->P3d4 , 0x36 ) ; | |
80adad85 BP |
8039 | if (index < sizeof(XGI21_LCDCapList)/sizeof(struct XGI21_LVDSCapStruct)) |
8040 | return index; | |
d7636e0b | 8041 | return 0; |
8042 | } | |
8043 | ||
8044 | /* --------------------------------------------------------------------- */ | |
8045 | /* Function : XGI_XG21SetPanelDelay */ | |
8046 | /* Input : */ | |
8047 | /* Output : */ | |
8048 | /* Description : */ | |
8049 | /* I/P : bl : 1 ; T1 : the duration between CPL on and signal on */ | |
8050 | /* : bl : 2 ; T2 : the duration signal on and Vdd on */ | |
8051 | /* : bl : 3 ; T3 : the duration between CPL off and signal off */ | |
8052 | /* : bl : 4 ; T4 : the duration signal off and Vdd off */ | |
8053 | /* --------------------------------------------------------------------- */ | |
80adad85 | 8054 | void XGI_XG21SetPanelDelay(unsigned short tempbl, struct vb_device_info *pVBInfo) |
d7636e0b | 8055 | { |
82d6eb5b | 8056 | unsigned short index ; |
d7636e0b | 8057 | |
8058 | index = XGI_GetLVDSOEMTableIndex( pVBInfo ); | |
8059 | if ( tempbl == 1 ) | |
8060 | XGINew_LCD_Wait_Time( pVBInfo->XG21_LVDSCapList[ index ].PSC_S1, pVBInfo ) ; | |
8061 | ||
8062 | if ( tempbl == 2 ) | |
8063 | XGINew_LCD_Wait_Time( pVBInfo->XG21_LVDSCapList[ index ].PSC_S2, pVBInfo ) ; | |
8064 | ||
8065 | if ( tempbl == 3 ) | |
8066 | XGINew_LCD_Wait_Time( pVBInfo->XG21_LVDSCapList[ index ].PSC_S3, pVBInfo ) ; | |
8067 | ||
8068 | if ( tempbl == 4 ) | |
8069 | XGINew_LCD_Wait_Time( pVBInfo->XG21_LVDSCapList[ index ].PSC_S4, pVBInfo ) ; | |
8070 | } | |
8071 | ||
82d6eb5b BP |
8072 | unsigned char XGI_XG21CheckLVDSMode(unsigned short ModeNo, |
8073 | unsigned short ModeIdIndex, | |
80adad85 | 8074 | struct vb_device_info *pVBInfo) |
d7636e0b | 8075 | { |
82d6eb5b | 8076 | unsigned short xres , |
d7636e0b | 8077 | yres , |
8078 | colordepth , | |
8079 | modeflag , | |
8080 | resindex , | |
8081 | lvdstableindex; | |
8082 | ||
8083 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; | |
8084 | if ( ModeNo <= 0x13 ) | |
8085 | { | |
8086 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; | |
8087 | yres = pVBInfo->StResInfo[ resindex ].VTotal ; | |
8088 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ | |
8089 | } | |
8090 | else | |
8091 | { | |
8092 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */ | |
8093 | yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; /* yres->bx */ | |
8094 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex].Ext_ModeFlag ; /* si+St_ModeFlag */ | |
8095 | } | |
8096 | ||
8097 | if ( !( modeflag & Charx8Dot ) ) | |
8098 | { | |
8099 | xres /= 9; | |
8100 | xres *= 8; | |
8101 | } | |
8102 | ||
8103 | if ( ModeNo > 0x13 ) | |
8104 | { | |
8105 | if ( ( ModeNo>0x13 ) && ( modeflag & HalfDCLK ) ) | |
8106 | { | |
8107 | xres *= 2 ; | |
8108 | } | |
8109 | if ( ( ModeNo>0x13 ) && ( modeflag & DoubleScanMode ) ) | |
8110 | { | |
8111 | yres *= 2 ; | |
8112 | } | |
8113 | } | |
8114 | ||
8115 | lvdstableindex = XGI_GetLVDSOEMTableIndex( pVBInfo ); | |
8116 | if ( xres > (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE) ) | |
dda08c59 | 8117 | return 0; |
d7636e0b | 8118 | |
8119 | if ( yres > (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE) ) | |
dda08c59 | 8120 | return 0; |
d7636e0b | 8121 | |
8122 | if ( ModeNo > 0x13 ) | |
8123 | { | |
8124 | if ( ( xres != (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE) ) || | |
8125 | ( yres != (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE)) ) | |
8126 | { | |
8127 | colordepth = XGI_GetColorDepth( ModeNo , ModeIdIndex, pVBInfo ) ; | |
dda08c59 BP |
8128 | if (colordepth > 2) |
8129 | return 0; | |
8130 | ||
d7636e0b | 8131 | } |
8132 | } | |
dda08c59 | 8133 | return 1; |
d7636e0b | 8134 | } |
8135 | ||
80adad85 | 8136 | void XGI_SetXG21FPBits(struct vb_device_info *pVBInfo) |
d7636e0b | 8137 | { |
108afbf8 | 8138 | unsigned char temp; |
d7636e0b | 8139 | |
8140 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; /* D[0] 1: 18bit */ | |
8141 | temp = ( temp & 1 ) << 6; | |
8142 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x06 , ~0x40 , temp ) ; /* SR06[6] 18bit Dither */ | |
8143 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x09 , ~0xc0 , temp | 0x80 ) ; /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: dual 12bits */ | |
8144 | ||
8145 | } | |
8146 | ||
80adad85 | 8147 | void XGI_SetXG27FPBits(struct vb_device_info *pVBInfo) |
d7636e0b | 8148 | { |
108afbf8 | 8149 | unsigned char temp; |
d7636e0b | 8150 | |
8151 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; /* D[1:0] 01: 18bit, 00: dual 12, 10: single 24 */ | |
8152 | temp = ( temp & 3 ) << 6; | |
8153 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x06 , ~0xc0 , temp & 0x80 ) ; /* SR06[7]0: dual 12/1: single 24 [6] 18bit Dither <= 0 h/w recommend */ | |
8154 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x09 , ~0xc0 , temp | 0x80 ) ; /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: 24bits */ | |
8155 | ||
8156 | } | |
8157 | ||
82d6eb5b | 8158 | void XGI_SetXG21LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex, |
80adad85 | 8159 | struct vb_device_info *pVBInfo) |
d7636e0b | 8160 | { |
108afbf8 | 8161 | unsigned char temp, Miscdata; |
82d6eb5b | 8162 | unsigned short xres , |
d7636e0b | 8163 | yres , |
8164 | modeflag , | |
8165 | resindex , | |
8166 | lvdstableindex ; | |
82d6eb5b BP |
8167 | unsigned short LVDSHT,LVDSHBS,LVDSHRS,LVDSHRE,LVDSHBE; |
8168 | unsigned short LVDSVT,LVDSVBS,LVDSVRS,LVDSVRE,LVDSVBE; | |
8169 | unsigned short value; | |
d7636e0b | 8170 | |
8171 | lvdstableindex = XGI_GetLVDSOEMTableIndex( pVBInfo ); | |
8172 | ||
108afbf8 | 8173 | temp = (unsigned char) ((pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability & (LCDPolarity << 8)) >> 8); |
d7636e0b | 8174 | temp &= LCDPolarity; |
108afbf8 | 8175 | Miscdata = (unsigned char) XGINew_GetReg2(pVBInfo->P3cc) ; |
d7636e0b | 8176 | |
8177 | XGINew_SetReg3( pVBInfo->P3c2 , (Miscdata & 0x3F) | temp ) ; | |
8178 | ||
108afbf8 | 8179 | temp = (unsigned char) (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability & LCDPolarity) ; |
d7636e0b | 8180 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x80 , temp&0x80 ) ; /* SR35[7] FP VSync polarity */ |
8181 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , ~0x20 , (temp&0x40)>>1 ) ; /* SR30[5] FP HSync polarity */ | |
8182 | ||
8183 | XGI_SetXG21FPBits(pVBInfo); | |
8184 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; | |
8185 | if ( ModeNo <= 0x13 ) | |
8186 | { | |
8187 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; | |
8188 | yres = pVBInfo->StResInfo[ resindex ].VTotal ; | |
8189 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ | |
8190 | } | |
8191 | else | |
8192 | { | |
8193 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */ | |
8194 | yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; /* yres->bx */ | |
8195 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex].Ext_ModeFlag ; /* si+St_ModeFlag */ | |
8196 | } | |
8197 | ||
8198 | if (!( modeflag & Charx8Dot )) | |
8199 | xres = xres * 8 / 9; | |
8200 | ||
8201 | LVDSHT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHT; | |
8202 | ||
8203 | LVDSHBS = xres + ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE - xres ) / 2 ; | |
8204 | if ( ( ModeNo<=0x13 ) && ( modeflag & HalfDCLK ) ) | |
8205 | { | |
8206 | LVDSHBS -= xres/4 ; | |
8207 | } | |
8208 | if (LVDSHBS > LVDSHT) LVDSHBS -= LVDSHT ; | |
8209 | ||
8210 | LVDSHRS = LVDSHBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHFP ; | |
8211 | if (LVDSHRS > LVDSHT) LVDSHRS -= LVDSHT ; | |
8212 | ||
8213 | LVDSHRE = LVDSHRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHSYNC ; | |
8214 | if (LVDSHRE > LVDSHT) LVDSHRE -= LVDSHT ; | |
8215 | ||
8216 | LVDSHBE = LVDSHBS + LVDSHT - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE ; | |
8217 | ||
8218 | LVDSVT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVT; | |
8219 | ||
8220 | LVDSVBS = yres + ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE - yres ) / 2 ; | |
8221 | if ( ( ModeNo>0x13 ) && ( modeflag & DoubleScanMode ) ) | |
8222 | { | |
8223 | LVDSVBS += yres/2 ; | |
8224 | } | |
8225 | if (LVDSVBS > LVDSVT) LVDSVBS -= LVDSVT ; | |
8226 | ||
8227 | LVDSVRS = LVDSVBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVFP ; | |
8228 | if (LVDSVRS > LVDSVT) LVDSVRS -= LVDSVT ; | |
8229 | ||
8230 | LVDSVRE = LVDSVRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVSYNC ; | |
8231 | if (LVDSVRE > LVDSVT) LVDSVRE -= LVDSVT ; | |
8232 | ||
8233 | LVDSVBE = LVDSVBS + LVDSVT - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE ; | |
8234 | ||
108afbf8 | 8235 | temp = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x11) ; |
d7636e0b | 8236 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , temp & 0x7f ) ; /* Unlock CRTC */ |
8237 | ||
8238 | if (!( modeflag & Charx8Dot )) | |
8239 | { | |
8240 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x1 , 0x1 ) ; | |
8241 | } | |
8242 | ||
8243 | /* HT SR0B[1:0] CR00 */ | |
8244 | value = ( LVDSHT >> 3 ) - 5; | |
8245 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0x03 , ( value & 0x300 ) >> 8 ) ; | |
8246 | XGINew_SetReg1( pVBInfo->P3d4 , 0x0 , (value & 0xFF) ) ; | |
8247 | ||
8248 | /* HBS SR0B[5:4] CR02 */ | |
8249 | value = ( LVDSHBS >> 3 ) - 1; | |
8250 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0x30 , ( value & 0x300 ) >> 4 ) ; | |
8251 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2 , (value & 0xFF) ) ; | |
8252 | ||
8253 | /* HBE SR0C[1:0] CR05[7] CR03[4:0] */ | |
8254 | value = ( LVDSHBE >> 3 ) - 1; | |
8255 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0C , ~0x03 , ( value & 0xC0 ) >> 6 ) ; | |
8256 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x05 , ~0x80 , ( value & 0x20 ) << 2 ) ; | |
8257 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x03 , ~0x1F , value & 0x1F ) ; | |
8258 | ||
8259 | /* HRS SR0B[7:6] CR04 */ | |
8260 | value = ( LVDSHRS >> 3 ) + 2; | |
8261 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0xC0 , ( value & 0x300 ) >> 2 ) ; | |
8262 | XGINew_SetReg1( pVBInfo->P3d4 , 0x4 , (value & 0xFF) ) ; | |
8263 | ||
8264 | /* Panel HRS SR2F[1:0] SR2E[7:0] */ | |
8265 | value--; | |
8266 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x2F , ~0x03 , ( value & 0x300 ) >> 8 ) ; | |
8267 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , (value & 0xFF) ) ; | |
8268 | ||
8269 | /* HRE SR0C[2] CR05[4:0] */ | |
8270 | value = ( LVDSHRE >> 3 ) + 2; | |
8271 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0C , ~0x04 , ( value & 0x20 ) >> 3 ) ; | |
8272 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x05 , ~0x1F , value & 0x1F ) ; | |
8273 | ||
8274 | /* Panel HRE SR2F[7:2] */ | |
8275 | value--; | |
8276 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x2F , ~0xFC , value << 2 ) ; | |
8277 | ||
8278 | /* VT SR0A[0] CR07[5][0] CR06 */ | |
8279 | value = LVDSVT - 2 ; | |
8280 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x01 , ( value & 0x400 ) >> 10 ) ; | |
8281 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x20 , ( value & 0x200 ) >> 4 ) ; | |
8282 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x01 , ( value & 0x100 ) >> 8 ) ; | |
8283 | XGINew_SetReg1( pVBInfo->P3d4 , 0x06 , (value & 0xFF) ) ; | |
8284 | ||
8285 | /* VBS SR0A[2] CR09[5] CR07[3] CR15 */ | |
8286 | value = LVDSVBS - 1 ; | |
8287 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x04 , ( value & 0x400 ) >> 8 ) ; | |
8288 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x09 , ~0x20 , ( value & 0x200 ) >> 4 ) ; | |
8289 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x08 , ( value & 0x100 ) >> 5 ) ; | |
8290 | XGINew_SetReg1( pVBInfo->P3d4 , 0x15 , (value & 0xFF) ) ; | |
8291 | ||
8292 | /* VBE SR0A[4] CR16 */ | |
8293 | value = LVDSVBE - 1; | |
8294 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x10 , ( value & 0x100 ) >> 4 ) ; | |
8295 | XGINew_SetReg1( pVBInfo->P3d4 , 0x16 , (value & 0xFF) ) ; | |
8296 | ||
8297 | /* VRS SR0A[3] CR7[7][2] CR10 */ | |
8298 | value = LVDSVRS - 1 ; | |
8299 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x08 , ( value & 0x400 ) >> 7 ) ; | |
8300 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x80 , ( value & 0x200 ) >> 2 ) ; | |
8301 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x04 , ( value & 0x100 ) >> 6 ) ; | |
8302 | XGINew_SetReg1( pVBInfo->P3d4 , 0x10 , (value & 0xFF) ) ; | |
8303 | ||
8304 | /* Panel VRS SR3F[1:0] SR34[7:0] SR33[0] */ | |
8305 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0x03 , ( value & 0x600 ) >> 9 ) ; | |
8306 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , (value >> 1) & 0xFF ) ; | |
8307 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x33 , ~0x01 , value & 0x01 ) ; | |
8308 | ||
8309 | /* VRE SR0A[5] CR11[3:0] */ | |
8310 | value = LVDSVRE - 1; | |
8311 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x20 , ( value & 0x10 ) << 1 ) ; | |
8312 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x11 , ~0x0F , value & 0x0F ) ; | |
8313 | ||
8314 | /* Panel VRE SR3F[7:2] */ /* SR3F[7] has to be 0, h/w bug */ | |
8315 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0xFC , ( value << 2 ) & 0x7C ) ; | |
8316 | ||
8317 | for ( temp=0, value = 0; temp < 3; temp++) | |
8318 | { | |
8319 | ||
8320 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x31 , ~0x30 , value ) ; | |
8321 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData1) ; | |
8322 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData2) ; | |
8323 | value += 0x10; | |
8324 | } | |
8325 | ||
8326 | if (!( modeflag & Charx8Dot )) | |
8327 | { | |
8328 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ | |
8329 | XGINew_SetReg3( pVBInfo->P3c0 , 0x13 ) ; /* set index */ | |
8330 | XGINew_SetReg3( pVBInfo->P3c0 , 0x00 ) ; /* set data, panning = 0, shift left 1 dot*/ | |
8331 | ||
8332 | XGINew_GetReg2( pVBInfo->P3da ) ; /* Enable Attribute */ | |
8333 | XGINew_SetReg3( pVBInfo->P3c0 , 0x20 ) ; | |
8334 | ||
8335 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ | |
8336 | } | |
8337 | ||
8338 | ||
8339 | } | |
8340 | ||
8341 | /* no shadow case */ | |
82d6eb5b | 8342 | void XGI_SetXG27LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex, |
80adad85 | 8343 | struct vb_device_info *pVBInfo) |
d7636e0b | 8344 | { |
108afbf8 | 8345 | unsigned char temp, Miscdata; |
82d6eb5b | 8346 | unsigned short xres , |
d7636e0b | 8347 | yres , |
8348 | modeflag , | |
8349 | resindex , | |
8350 | lvdstableindex ; | |
82d6eb5b BP |
8351 | unsigned short LVDSHT,LVDSHBS,LVDSHRS,LVDSHRE,LVDSHBE; |
8352 | unsigned short LVDSVT,LVDSVBS,LVDSVRS,LVDSVRE,LVDSVBE; | |
8353 | unsigned short value; | |
d7636e0b | 8354 | |
8355 | lvdstableindex = XGI_GetLVDSOEMTableIndex( pVBInfo ); | |
108afbf8 | 8356 | temp = (unsigned char) ((pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability & (LCDPolarity << 8)) >> 8); |
d7636e0b | 8357 | temp &= LCDPolarity; |
108afbf8 | 8358 | Miscdata = (unsigned char) XGINew_GetReg2(pVBInfo->P3cc); |
d7636e0b | 8359 | |
8360 | XGINew_SetReg3( pVBInfo->P3c2 , (Miscdata & 0x3F) | temp ) ; | |
8361 | ||
108afbf8 | 8362 | temp = (unsigned char) (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability & LCDPolarity) ; |
d7636e0b | 8363 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x80 , temp&0x80 ) ; /* SR35[7] FP VSync polarity */ |
8364 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , ~0x20 , (temp&0x40)>>1 ) ; /* SR30[5] FP HSync polarity */ | |
8365 | ||
8366 | XGI_SetXG27FPBits(pVBInfo); | |
8367 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; | |
8368 | if ( ModeNo <= 0x13 ) | |
8369 | { | |
8370 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; | |
8371 | yres = pVBInfo->StResInfo[ resindex ].VTotal ; | |
8372 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ | |
8373 | } | |
8374 | else | |
8375 | { | |
8376 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */ | |
8377 | yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; /* yres->bx */ | |
8378 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex].Ext_ModeFlag ; /* si+St_ModeFlag */ | |
8379 | } | |
8380 | ||
8381 | if (!( modeflag & Charx8Dot )) | |
8382 | xres = xres * 8 / 9; | |
8383 | ||
8384 | LVDSHT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHT; | |
8385 | ||
8386 | LVDSHBS = xres + ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE - xres ) / 2 ; | |
8387 | if ( ( ModeNo<=0x13 ) && ( modeflag & HalfDCLK ) ) | |
8388 | { | |
8389 | LVDSHBS -= xres/4 ; | |
8390 | } | |
8391 | if (LVDSHBS > LVDSHT) LVDSHBS -= LVDSHT ; | |
8392 | ||
8393 | LVDSHRS = LVDSHBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHFP ; | |
8394 | if (LVDSHRS > LVDSHT) LVDSHRS -= LVDSHT ; | |
8395 | ||
8396 | LVDSHRE = LVDSHRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHSYNC ; | |
8397 | if (LVDSHRE > LVDSHT) LVDSHRE -= LVDSHT ; | |
8398 | ||
8399 | LVDSHBE = LVDSHBS + LVDSHT - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE ; | |
8400 | ||
8401 | LVDSVT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVT; | |
8402 | ||
8403 | LVDSVBS = yres + ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE - yres ) / 2 ; | |
8404 | if ( ( ModeNo>0x13 ) && ( modeflag & DoubleScanMode ) ) | |
8405 | { | |
8406 | LVDSVBS += yres/2 ; | |
8407 | } | |
8408 | if (LVDSVBS > LVDSVT) LVDSVBS -= LVDSVT ; | |
8409 | ||
8410 | LVDSVRS = LVDSVBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVFP ; | |
8411 | if (LVDSVRS > LVDSVT) LVDSVRS -= LVDSVT ; | |
8412 | ||
8413 | LVDSVRE = LVDSVRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVSYNC ; | |
8414 | if (LVDSVRE > LVDSVT) LVDSVRE -= LVDSVT ; | |
8415 | ||
8416 | LVDSVBE = LVDSVBS + LVDSVT - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE ; | |
8417 | ||
108afbf8 | 8418 | temp = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x11) ; |
d7636e0b | 8419 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , temp & 0x7f ) ; /* Unlock CRTC */ |
8420 | ||
8421 | if (!( modeflag & Charx8Dot )) | |
8422 | { | |
8423 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x1 , 0x1 ) ; | |
8424 | } | |
8425 | ||
8426 | /* HT SR0B[1:0] CR00 */ | |
8427 | value = ( LVDSHT >> 3 ) - 5; | |
8428 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0x03 , ( value & 0x300 ) >> 8 ) ; | |
8429 | XGINew_SetReg1( pVBInfo->P3d4 , 0x0 , (value & 0xFF) ) ; | |
8430 | ||
8431 | /* HBS SR0B[5:4] CR02 */ | |
8432 | value = ( LVDSHBS >> 3 ) - 1; | |
8433 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0x30 , ( value & 0x300 ) >> 4 ) ; | |
8434 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2 , (value & 0xFF) ) ; | |
8435 | ||
8436 | /* HBE SR0C[1:0] CR05[7] CR03[4:0] */ | |
8437 | value = ( LVDSHBE >> 3 ) - 1; | |
8438 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0C , ~0x03 , ( value & 0xC0 ) >> 6 ) ; | |
8439 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x05 , ~0x80 , ( value & 0x20 ) << 2 ) ; | |
8440 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x03 , ~0x1F , value & 0x1F ) ; | |
8441 | ||
8442 | /* HRS SR0B[7:6] CR04 */ | |
8443 | value = ( LVDSHRS >> 3 ) + 2; | |
8444 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0xC0 , ( value & 0x300 ) >> 2 ) ; | |
8445 | XGINew_SetReg1( pVBInfo->P3d4 , 0x4 , (value & 0xFF) ) ; | |
8446 | ||
8447 | /* Panel HRS SR2F[1:0] SR2E[7:0] */ | |
8448 | value--; | |
8449 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x2F , ~0x03 , ( value & 0x300 ) >> 8 ) ; | |
8450 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , (value & 0xFF) ) ; | |
8451 | ||
8452 | /* HRE SR0C[2] CR05[4:0] */ | |
8453 | value = ( LVDSHRE >> 3 ) + 2; | |
8454 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0C , ~0x04 , ( value & 0x20 ) >> 3 ) ; | |
8455 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x05 , ~0x1F , value & 0x1F ) ; | |
8456 | ||
8457 | /* Panel HRE SR2F[7:2] */ | |
8458 | value--; | |
8459 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x2F , ~0xFC , value << 2 ) ; | |
8460 | ||
8461 | /* VT SR0A[0] CR07[5][0] CR06 */ | |
8462 | value = LVDSVT - 2 ; | |
8463 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x01 , ( value & 0x400 ) >> 10 ) ; | |
8464 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x20 , ( value & 0x200 ) >> 4 ) ; | |
8465 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x01 , ( value & 0x100 ) >> 8 ) ; | |
8466 | XGINew_SetReg1( pVBInfo->P3d4 , 0x06 , (value & 0xFF) ) ; | |
8467 | ||
8468 | /* VBS SR0A[2] CR09[5] CR07[3] CR15 */ | |
8469 | value = LVDSVBS - 1 ; | |
8470 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x04 , ( value & 0x400 ) >> 8 ) ; | |
8471 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x09 , ~0x20 , ( value & 0x200 ) >> 4 ) ; | |
8472 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x08 , ( value & 0x100 ) >> 5 ) ; | |
8473 | XGINew_SetReg1( pVBInfo->P3d4 , 0x15 , (value & 0xFF) ) ; | |
8474 | ||
8475 | /* VBE SR0A[4] CR16 */ | |
8476 | value = LVDSVBE - 1; | |
8477 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x10 , ( value & 0x100 ) >> 4 ) ; | |
8478 | XGINew_SetReg1( pVBInfo->P3d4 , 0x16 , (value & 0xFF) ) ; | |
8479 | ||
8480 | /* VRS SR0A[3] CR7[7][2] CR10 */ | |
8481 | value = LVDSVRS - 1 ; | |
8482 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x08 , ( value & 0x400 ) >> 7 ) ; | |
8483 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x80 , ( value & 0x200 ) >> 2 ) ; | |
8484 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x04 , ( value & 0x100 ) >> 6 ) ; | |
8485 | XGINew_SetReg1( pVBInfo->P3d4 , 0x10 , (value & 0xFF) ) ; | |
8486 | ||
8487 | /* Panel VRS SR35[2:0] SR34[7:0] */ | |
8488 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x07 , ( value & 0x700 ) >> 8 ) ; | |
8489 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , value & 0xFF ) ; | |
8490 | ||
8491 | /* VRE SR0A[5] CR11[3:0] */ | |
8492 | value = LVDSVRE - 1; | |
8493 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x20 , ( value & 0x10 ) << 1 ) ; | |
8494 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x11 , ~0x0F , value & 0x0F ) ; | |
8495 | ||
8496 | /* Panel VRE SR3F[7:2] */ | |
8497 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0xFC , ( value << 2 ) & 0xFC ) ; | |
8498 | ||
8499 | for ( temp=0, value = 0; temp < 3; temp++) | |
8500 | { | |
8501 | ||
8502 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x31 , ~0x30 , value ) ; | |
8503 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData1) ; | |
8504 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData2) ; | |
8505 | value += 0x10; | |
8506 | } | |
8507 | ||
8508 | if (!( modeflag & Charx8Dot )) | |
8509 | { | |
8510 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ | |
8511 | XGINew_SetReg3( pVBInfo->P3c0 , 0x13 ) ; /* set index */ | |
8512 | XGINew_SetReg3( pVBInfo->P3c0 , 0x00 ) ; /* set data, panning = 0, shift left 1 dot*/ | |
8513 | ||
8514 | XGINew_GetReg2( pVBInfo->P3da ) ; /* Enable Attribute */ | |
8515 | XGINew_SetReg3( pVBInfo->P3c0 , 0x20 ) ; | |
8516 | ||
8517 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ | |
8518 | } | |
8519 | ||
8520 | ||
8521 | } | |
8522 | ||
8523 | /* --------------------------------------------------------------------- */ | |
8524 | /* Function : XGI_IsLCDON */ | |
8525 | /* Input : */ | |
dda08c59 BP |
8526 | /* Output : 0 : Skip PSC Control */ |
8527 | /* 1: Disable PSC */ | |
d7636e0b | 8528 | /* Description : */ |
8529 | /* --------------------------------------------------------------------- */ | |
80adad85 | 8530 | unsigned char XGI_IsLCDON(struct vb_device_info *pVBInfo) |
d7636e0b | 8531 | { |
82d6eb5b | 8532 | unsigned short tempax ; |
d7636e0b | 8533 | |
8534 | tempax = pVBInfo->VBInfo ; | |
8535 | if ( tempax & SetCRT2ToDualEdge ) | |
dda08c59 | 8536 | return 0; |
d7636e0b | 8537 | else if ( tempax & ( DisableCRT2Display | SwitchToCRT2 | SetSimuScanMode ) ) |
dda08c59 | 8538 | return 1; |
d7636e0b | 8539 | |
dda08c59 | 8540 | return 0; |
d7636e0b | 8541 | } |
8542 | ||
8543 | ||
8544 | /* --------------------------------------------------------------------- */ | |
8545 | /* Function : XGI_EnablePWD */ | |
8546 | /* Input : */ | |
8547 | /* Output : */ | |
8548 | /* Description : */ | |
8549 | /* --------------------------------------------------------------------- */ | |
80adad85 | 8550 | void XGI_EnablePWD(struct vb_device_info *pVBInfo) |
d7636e0b | 8551 | { |
82d6eb5b | 8552 | unsigned short index , |
d7636e0b | 8553 | temp ; |
8554 | ||
8555 | index = XGI_GetLCDCapPtr(pVBInfo) ; | |
8556 | temp = pVBInfo->LCDCapList[ index ].PWD_2B ; | |
8557 | XGINew_SetReg1( pVBInfo->Part4Port , 0x2B , temp ) ; | |
8558 | XGINew_SetReg1( pVBInfo->Part4Port , 0x2C , pVBInfo->LCDCapList[ index ].PWD_2C ) ; | |
8559 | XGINew_SetReg1( pVBInfo->Part4Port , 0x2D , pVBInfo->LCDCapList[ index ].PWD_2D ) ; | |
8560 | XGINew_SetReg1( pVBInfo->Part4Port , 0x2E , pVBInfo->LCDCapList[ index ].PWD_2E ) ; | |
8561 | XGINew_SetReg1( pVBInfo->Part4Port , 0x2F , pVBInfo->LCDCapList[ index ].PWD_2F ) ; | |
8562 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x27 , 0x80 ) ; /* enable PWD */ | |
8563 | } | |
8564 | ||
8565 | ||
8566 | /* --------------------------------------------------------------------- */ | |
8567 | /* Function : XGI_DisablePWD */ | |
8568 | /* Input : */ | |
8569 | /* Output : */ | |
8570 | /* Description : */ | |
8571 | /* --------------------------------------------------------------------- */ | |
80adad85 | 8572 | void XGI_DisablePWD(struct vb_device_info *pVBInfo) |
d7636e0b | 8573 | { |
8574 | XGINew_SetRegAND( pVBInfo->Part4Port , 0x27 , 0x7F ) ; /* disable PWD */ | |
8575 | } | |
8576 | ||
8577 | ||
8578 | /* --------------------------------------------------------------------- */ | |
8579 | /* Function : XGI_DisableChISLCD */ | |
8580 | /* Input : */ | |
dda08c59 | 8581 | /* Output : 0 -> Not LCD Mode */ |
d7636e0b | 8582 | /* Description : */ |
8583 | /* --------------------------------------------------------------------- */ | |
80adad85 | 8584 | unsigned char XGI_DisableChISLCD(struct vb_device_info *pVBInfo) |
d7636e0b | 8585 | { |
82d6eb5b | 8586 | unsigned short tempbx , |
d7636e0b | 8587 | tempah ; |
8588 | ||
8589 | tempbx = pVBInfo->SetFlag & ( DisableChA | DisableChB ) ; | |
82d6eb5b | 8590 | tempah = ~((unsigned short) XGINew_GetReg1(pVBInfo->Part1Port, 0x2E)); |
d7636e0b | 8591 | |
8592 | if ( tempbx & ( EnableChA | DisableChA ) ) | |
8593 | { | |
8594 | if ( !( tempah & 0x08 ) ) /* Chk LCDA Mode */ | |
dda08c59 | 8595 | return 0 ; |
d7636e0b | 8596 | } |
8597 | ||
8598 | if ( !( tempbx & ( EnableChB | DisableChB ) ) ) | |
dda08c59 | 8599 | return 0; |
d7636e0b | 8600 | |
8601 | if ( tempah & 0x01 ) /* Chk LCDB Mode */ | |
dda08c59 | 8602 | return 1; |
d7636e0b | 8603 | |
dda08c59 | 8604 | return 0; |
d7636e0b | 8605 | } |
8606 | ||
8607 | ||
8608 | /* --------------------------------------------------------------------- */ | |
8609 | /* Function : XGI_EnableChISLCD */ | |
8610 | /* Input : */ | |
8611 | /* Output : 0 -> Not LCD mode */ | |
8612 | /* Description : */ | |
8613 | /* --------------------------------------------------------------------- */ | |
80adad85 | 8614 | unsigned char XGI_EnableChISLCD(struct vb_device_info *pVBInfo) |
d7636e0b | 8615 | { |
82d6eb5b | 8616 | unsigned short tempbx , |
d7636e0b | 8617 | tempah ; |
8618 | ||
8619 | ||
8620 | tempbx = pVBInfo->SetFlag & ( EnableChA | EnableChB ) ; | |
82d6eb5b | 8621 | tempah = ~( (unsigned short)XGINew_GetReg1( pVBInfo->Part1Port , 0x2E ) ) ; |
d7636e0b | 8622 | |
8623 | if ( tempbx & ( EnableChA | DisableChA ) ) | |
8624 | { | |
8625 | if ( !( tempah & 0x08 ) ) /* Chk LCDA Mode */ | |
dda08c59 | 8626 | return 0; |
d7636e0b | 8627 | } |
8628 | ||
8629 | if ( !( tempbx & ( EnableChB | DisableChB ) ) ) | |
dda08c59 | 8630 | return 0; |
d7636e0b | 8631 | |
8632 | if ( tempah & 0x01 ) /* Chk LCDB Mode */ | |
dda08c59 | 8633 | return 1; |
d7636e0b | 8634 | |
dda08c59 | 8635 | return 0; |
d7636e0b | 8636 | } |
8637 | ||
8638 | ||
8639 | /* --------------------------------------------------------------------- */ | |
8640 | /* Function : XGI_GetLCDCapPtr */ | |
8641 | /* Input : */ | |
8642 | /* Output : */ | |
8643 | /* Description : */ | |
8644 | /* --------------------------------------------------------------------- */ | |
80adad85 | 8645 | unsigned short XGI_GetLCDCapPtr(struct vb_device_info *pVBInfo) |
d7636e0b | 8646 | { |
108afbf8 | 8647 | unsigned char tempal , |
d7636e0b | 8648 | tempah , |
8649 | tempbl , | |
8650 | i ; | |
8651 | ||
8652 | tempah = XGINew_GetReg1( pVBInfo->P3d4 , 0x36 ) ; | |
8653 | tempal = tempah & 0x0F ; | |
8654 | tempah = tempah & 0xF0 ; | |
8655 | i = 0 ; | |
8656 | tempbl = pVBInfo->LCDCapList[ i ].LCD_ID ; | |
8657 | ||
8658 | while( tempbl != 0xFF ) | |
8659 | { | |
8660 | if ( tempbl & 0x80 ) /* OEMUtil */ | |
8661 | { | |
8662 | tempal = tempah ; | |
8663 | tempbl = tempbl & ~( 0x80 ) ; | |
8664 | } | |
8665 | ||
8666 | if ( tempal == tempbl ) | |
8667 | break ; | |
8668 | ||
8669 | i++ ; | |
8670 | ||
8671 | tempbl = pVBInfo->LCDCapList[ i ].LCD_ID ; | |
8672 | } | |
8673 | ||
8674 | return i ; | |
8675 | } | |
8676 | ||
8677 | ||
8678 | /* --------------------------------------------------------------------- */ | |
8679 | /* Function : XGI_GetLCDCapPtr1 */ | |
8680 | /* Input : */ | |
8681 | /* Output : */ | |
8682 | /* Description : */ | |
8683 | /* --------------------------------------------------------------------- */ | |
80adad85 | 8684 | unsigned short XGI_GetLCDCapPtr1(struct vb_device_info *pVBInfo) |
d7636e0b | 8685 | { |
82d6eb5b | 8686 | unsigned short tempah , |
d7636e0b | 8687 | tempal , |
8688 | tempbl , | |
8689 | i ; | |
8690 | ||
8691 | tempal = pVBInfo->LCDResInfo ; | |
8692 | tempah = pVBInfo->LCDTypeInfo ; | |
8693 | ||
8694 | i = 0 ; | |
8695 | tempbl = pVBInfo->LCDCapList[ i ].LCD_ID; | |
8696 | ||
8697 | while( tempbl != 0xFF ) | |
8698 | { | |
8699 | if ( ( tempbl & 0x80 ) && ( tempbl != 0x80 ) ) | |
8700 | { | |
8701 | tempal = tempah ; | |
8702 | tempbl &= ~0x80 ; | |
8703 | } | |
8704 | ||
8705 | if ( tempal == tempbl ) | |
8706 | break ; | |
8707 | ||
8708 | i++ ; | |
8709 | tempbl = pVBInfo->LCDCapList[ i ].LCD_ID ; | |
8710 | } | |
8711 | ||
8712 | if ( tempbl == 0xFF ) | |
8713 | { | |
8714 | pVBInfo->LCDResInfo = Panel1024x768 ; | |
8715 | pVBInfo->LCDTypeInfo = 0 ; | |
8716 | i = 0 ; | |
8717 | } | |
8718 | ||
8719 | return i ; | |
8720 | } | |
8721 | ||
8722 | ||
8723 | /* --------------------------------------------------------------------- */ | |
8724 | /* Function : XGI_GetLCDSync */ | |
8725 | /* Input : */ | |
8726 | /* Output : */ | |
8727 | /* Description : */ | |
8728 | /* --------------------------------------------------------------------- */ | |
82d6eb5b | 8729 | void XGI_GetLCDSync(unsigned short *HSyncWidth , unsigned short *VSyncWidth, |
80adad85 | 8730 | struct vb_device_info *pVBInfo) |
d7636e0b | 8731 | { |
82d6eb5b | 8732 | unsigned short Index ; |
d7636e0b | 8733 | |
8734 | Index = XGI_GetLCDCapPtr(pVBInfo) ; | |
8735 | *HSyncWidth = pVBInfo->LCDCapList[ Index ].LCD_HSyncWidth ; | |
8736 | *VSyncWidth = pVBInfo->LCDCapList[ Index ].LCD_VSyncWidth ; | |
8737 | ||
8738 | return ; | |
8739 | } | |
8740 | ||
8741 | ||
8742 | ||
8743 | /* --------------------------------------------------------------------- */ | |
8744 | /* Function : XGI_EnableBridge */ | |
8745 | /* Input : */ | |
8746 | /* Output : */ | |
8747 | /* Description : */ | |
8748 | /* --------------------------------------------------------------------- */ | |
80adad85 | 8749 | void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
d7636e0b | 8750 | { |
82d6eb5b | 8751 | unsigned short tempbl , |
d7636e0b | 8752 | tempah ; |
8753 | ||
8754 | if ( pVBInfo->SetFlag == Win9xDOSMode ) | |
8755 | { | |
8756 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
8757 | { | |
8758 | XGI_DisplayOn( HwDeviceExtension, pVBInfo) ; | |
8759 | return ; | |
8760 | } | |
8761 | else /* LVDS or CH7017 */ | |
8762 | return ; | |
8763 | } | |
8764 | ||
8765 | ||
8766 | if ( HwDeviceExtension->jChipType < XG40 ) | |
8767 | { | |
8768 | if ( !XGI_DisableChISLCD(pVBInfo) ) | |
8769 | { | |
8770 | if ( ( XGI_EnableChISLCD(pVBInfo) ) || ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) | |
8771 | { | |
8772 | if ( pVBInfo->LCDInfo & SetPWDEnable ) | |
8773 | { | |
8774 | XGI_EnablePWD( pVBInfo); | |
8775 | } | |
8776 | else | |
8777 | { | |
8778 | pVBInfo->LCDInfo &= ( ~SetPWDEnable ) ; | |
8779 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
8780 | { | |
8781 | tempbl = 0xFD ; | |
8782 | tempah = 0x02 ; | |
8783 | } | |
8784 | else | |
8785 | { | |
8786 | tempbl = 0xFB ; | |
8787 | tempah = 0x00 ; | |
8788 | } | |
8789 | ||
8790 | XGI_SetPanelPower( tempah , tempbl, pVBInfo ) ; | |
8791 | XGI_SetPanelDelay( 1,pVBInfo ) ; | |
8792 | } | |
8793 | } | |
8794 | } | |
8795 | } /* Not 340 */ | |
8796 | ||
8797 | ||
8798 | ||
8799 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
8800 | { | |
8801 | if ( !( pVBInfo->SetFlag & DisableChA ) ) | |
8802 | { | |
8803 | if ( pVBInfo->SetFlag & EnableChA ) | |
8804 | { | |
8805 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1E , 0x20 ) ; /* Power on */ | |
8806 | } | |
8807 | else | |
8808 | { | |
8809 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) /* SetCRT2ToLCDA ) */ | |
8810 | { | |
8811 | XGINew_SetReg1(pVBInfo->Part1Port,0x1E,0x20); /* Power on */ | |
8812 | } | |
8813 | } | |
8814 | } | |
8815 | ||
8816 | if ( !( pVBInfo->SetFlag & DisableChB ) ) | |
8817 | { | |
8818 | if ( ( pVBInfo->SetFlag & EnableChB ) || ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToTV | SetCRT2ToRAMDAC ) ) ) | |
8819 | { | |
108afbf8 | 8820 | tempah = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x32); |
d7636e0b | 8821 | tempah &= 0xDF; |
8822 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
8823 | { | |
8824 | if ( !( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) ) | |
8825 | tempah |= 0x20 ; | |
8826 | } | |
8827 | XGINew_SetReg1( pVBInfo->P3c4 , 0x32 , tempah ) ; | |
8828 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x1E , 0x20 ) ; | |
8829 | ||
108afbf8 | 8830 | tempah = (unsigned char)XGINew_GetReg1(pVBInfo->Part1Port, 0x2E); |
d7636e0b | 8831 | |
8832 | if ( !( tempah & 0x80 ) ) | |
8833 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x2E , 0x80 ) ; /* BVBDOENABLE = 1 */ | |
8834 | ||
8835 | XGINew_SetRegAND( pVBInfo->Part1Port , 0x00 , 0x7F ) ; /* BScreenOFF = 0 */ | |
8836 | } | |
8837 | } | |
8838 | ||
8839 | if ( ( pVBInfo->SetFlag & ( EnableChA | EnableChB ) ) || ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) ) | |
8840 | { | |
8841 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x00 , ~0xE0 , 0x20 ) ; /* shampoo 0129 */ | |
8842 | if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) ) | |
8843 | { | |
8844 | if ( !XGI_DisableChISLCD(pVBInfo) ) | |
8845 | { | |
8846 | if ( XGI_EnableChISLCD( pVBInfo) || ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) | |
8847 | XGINew_SetRegAND( pVBInfo->Part4Port ,0x2A , 0x7F ) ; /* LVDS PLL power on */ | |
8848 | } | |
8849 | XGINew_SetRegAND( pVBInfo->Part4Port , 0x30 , 0x7F ) ; /* LVDS Driver power on */ | |
8850 | } | |
8851 | } | |
8852 | ||
8853 | tempah = 0x00 ; | |
8854 | ||
8855 | if ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) | |
8856 | { | |
8857 | tempah = 0xc0 ; | |
8858 | ||
8859 | if ( !( pVBInfo->VBInfo & SetSimuScanMode ) ) | |
8860 | { | |
8861 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) | |
8862 | { | |
8863 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) | |
8864 | { | |
8865 | tempah = tempah & 0x40; | |
8866 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) | |
8867 | tempah = tempah ^ 0xC0 ; | |
8868 | ||
8869 | if ( pVBInfo->SetFlag & DisableChB ) | |
8870 | tempah &= 0xBF ; | |
8871 | ||
8872 | if ( pVBInfo->SetFlag & DisableChA ) | |
8873 | tempah &= 0x7F ; | |
8874 | ||
8875 | if ( pVBInfo->SetFlag & EnableChB ) | |
8876 | tempah |= 0x40 ; | |
8877 | ||
8878 | if ( pVBInfo->SetFlag & EnableChA ) | |
8879 | tempah |= 0x80 ; | |
8880 | } | |
8881 | } | |
8882 | } | |
8883 | } | |
8884 | ||
8885 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x1F , tempah ) ; /* EnablePart4_1F */ | |
8886 | ||
8887 | if ( pVBInfo->SetFlag & Win9xDOSMode ) | |
8888 | { | |
8889 | XGI_DisplayOn( HwDeviceExtension, pVBInfo) ; | |
8890 | return ; | |
8891 | } | |
8892 | ||
8893 | if ( !( pVBInfo->SetFlag & DisableChA ) ) | |
8894 | { | |
8895 | XGI_VBLongWait( pVBInfo) ; | |
8896 | if ( !( pVBInfo->SetFlag & GatingCRT ) ) | |
8897 | { | |
8898 | XGI_DisableGatingCRT( HwDeviceExtension, pVBInfo ) ; | |
8899 | XGI_DisplayOn( HwDeviceExtension, pVBInfo) ; | |
8900 | XGI_VBLongWait( pVBInfo) ; | |
8901 | } | |
8902 | } | |
8903 | } /* 301 */ | |
8904 | else /* LVDS */ | |
8905 | { | |
8906 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA ) ) | |
8907 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x1E , 0x20 ) ; /* enable CRT2 */ | |
8908 | ||
8909 | ||
8910 | ||
108afbf8 | 8911 | tempah = (unsigned char)XGINew_GetReg1(pVBInfo->Part1Port, 0x2E); |
d7636e0b | 8912 | if ( !( tempah & 0x80 ) ) |
8913 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x2E , 0x80 ) ; /* BVBDOENABLE = 1 */ | |
8914 | ||
8915 | XGINew_SetRegAND(pVBInfo->Part1Port,0x00,0x7F); | |
8916 | XGI_DisplayOn( HwDeviceExtension, pVBInfo); | |
8917 | } /* End of VB */ | |
8918 | ||
8919 | ||
8920 | if ( HwDeviceExtension->jChipType < XG40 ) | |
8921 | { | |
8922 | if ( !XGI_EnableChISLCD(pVBInfo) ) | |
8923 | { | |
8924 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) | |
8925 | { | |
8926 | if ( XGI_BacklightByDrv(pVBInfo) ) | |
8927 | return ; | |
8928 | } | |
8929 | else | |
8930 | return ; | |
8931 | } | |
8932 | ||
8933 | if ( pVBInfo->LCDInfo & SetPWDEnable ) | |
8934 | { | |
8935 | XGI_FirePWDEnable(pVBInfo) ; | |
8936 | return ; | |
8937 | } | |
8938 | ||
8939 | XGI_SetPanelDelay( 2,pVBInfo ) ; | |
8940 | ||
8941 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
8942 | { | |
8943 | tempah = 0x01 ; | |
8944 | tempbl = 0xFE ; /* turn on backlght */ | |
8945 | } | |
8946 | else | |
8947 | { | |
8948 | tempbl = 0xF7 ; | |
8949 | tempah = 0x00 ; | |
8950 | } | |
8951 | XGI_SetPanelPower( tempah , tempbl , pVBInfo) ; | |
8952 | } | |
8953 | } | |
8954 | ||
8955 | ||
8956 | /* --------------------------------------------------------------------- */ | |
8957 | /* Function : XGI_DisableBridge */ | |
8958 | /* Input : */ | |
8959 | /* Output : */ | |
8960 | /* Description : */ | |
8961 | /* --------------------------------------------------------------------- */ | |
80adad85 | 8962 | void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
d7636e0b | 8963 | { |
82d6eb5b | 8964 | unsigned short tempax , |
d7636e0b | 8965 | tempbx , |
8966 | tempah = 0 , | |
8967 | tempbl = 0 ; | |
8968 | ||
8969 | if ( pVBInfo->SetFlag == Win9xDOSMode ) | |
8970 | return ; | |
8971 | ||
8972 | ||
8973 | if ( HwDeviceExtension->jChipType < XG40 ) | |
8974 | { | |
8975 | if ( ( !( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) || ( XGI_DisableChISLCD(pVBInfo) ) ) | |
8976 | { | |
8977 | if ( !XGI_IsLCDON(pVBInfo) ) | |
8978 | { | |
8979 | if ( pVBInfo->LCDInfo & SetPWDEnable ) | |
8980 | XGI_EnablePWD( pVBInfo) ; | |
8981 | else | |
8982 | { | |
8983 | pVBInfo->LCDInfo &= ~SetPWDEnable ; | |
8984 | XGI_DisablePWD(pVBInfo) ; | |
8985 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
8986 | { | |
8987 | tempbx = 0xFE ; /* not 01h */ | |
8988 | tempax = 0 ; | |
8989 | } | |
8990 | else | |
8991 | { | |
8992 | tempbx = 0xF7 ; /* not 08h */ | |
8993 | tempax = 0x08 ; | |
8994 | } | |
8995 | XGI_SetPanelPower( tempax , tempbx , pVBInfo) ; | |
8996 | XGI_SetPanelDelay( 3,pVBInfo ) ; | |
8997 | } | |
8998 | } /* end if(!XGI_IsLCDON(pVBInfo)) */ | |
8999 | } | |
9000 | } | |
9001 | ||
9002 | /* if ( CH7017 ) | |
9003 | { | |
9004 | if ( !( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2toLCDA ) ) || ( XGI_DisableChISLCD(pVBInfo) ) ) | |
9005 | { | |
9006 | if ( !XGI_IsLCDON(pVBInfo) ) | |
9007 | { | |
9008 | if ( DISCHARGE ) | |
9009 | { | |
9010 | tempbx = XGINew_GetCH7005( 0x61 ) ; | |
9011 | if ( tempbx < 0x01 ) //first time we power up | |
9012 | XGINew_SetCH7005( 0x0066 ) ; //and disable power sequence | |
9013 | else | |
9014 | XGINew_SetCH7005( 0x5f66 ) ; //leave VDD on - disable power | |
9015 | } | |
9016 | } | |
9017 | } | |
9018 | } */ | |
9019 | ||
9020 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B| VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
9021 | { | |
9022 | tempah = 0x3F ; | |
9023 | if ( !( pVBInfo->VBInfo & ( DisableCRT2Display | SetSimuScanMode ) ) ) | |
9024 | { | |
9025 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) | |
9026 | { | |
9027 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) | |
9028 | { | |
9029 | tempah = 0x7F; /* Disable Channel A */ | |
9030 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) | |
9031 | tempah = 0xBF ; /* Disable Channel B */ | |
9032 | ||
9033 | if ( pVBInfo->SetFlag & DisableChB ) | |
9034 | tempah &= 0xBF ; /* force to disable Cahnnel */ | |
9035 | ||
9036 | if ( pVBInfo->SetFlag & DisableChA ) | |
9037 | tempah &= 0x7F ; /* Force to disable Channel B */ | |
9038 | } | |
9039 | } | |
9040 | } | |
9041 | ||
9042 | XGINew_SetRegAND( pVBInfo->Part4Port , 0x1F , tempah ) ; /* disable part4_1f */ | |
9043 | ||
9044 | if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) ) | |
9045 | { | |
9046 | if ( ( ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) || ( XGI_DisableChISLCD(pVBInfo) ) || ( XGI_IsLCDON(pVBInfo) ) ) | |
9047 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x30 , 0x80 ) ; /* LVDS Driver power down */ | |
9048 | } | |
9049 | ||
9050 | if ( ( pVBInfo->SetFlag & DisableChA ) || ( pVBInfo->VBInfo & ( DisableCRT2Display | SetCRT2ToLCDA | SetSimuScanMode ) ) ) | |
9051 | { | |
9052 | if ( pVBInfo->SetFlag & GatingCRT ) | |
9053 | XGI_EnableGatingCRT( HwDeviceExtension, pVBInfo ) ; | |
9054 | XGI_DisplayOff( HwDeviceExtension, pVBInfo) ; | |
9055 | } | |
9056 | ||
9057 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) | |
9058 | { | |
9059 | if ( ( pVBInfo->SetFlag & DisableChA ) || ( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) | |
9060 | XGINew_SetRegAND( pVBInfo->Part1Port , 0x1e , 0xdf ) ; /* Power down */ | |
9061 | } | |
9062 | ||
9063 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x32 , 0xdf ) ; /* disable TV as primary VGA swap */ | |
9064 | ||
9065 | if ( ( pVBInfo->VBInfo & ( SetSimuScanMode | SetCRT2ToDualEdge ) ) ) | |
9066 | XGINew_SetRegAND(pVBInfo->Part2Port,0x00,0xdf); | |
9067 | ||
9068 | if ( ( pVBInfo->SetFlag & DisableChB ) || ( pVBInfo->VBInfo & ( DisableCRT2Display | SetSimuScanMode ) ) | |
9069 | || ( ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) && ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV ) ) ) ) | |
9070 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x00 , 0x80 ) ; /* BScreenOff=1 */ | |
9071 | ||
9072 | if ( ( pVBInfo->SetFlag & DisableChB ) || ( pVBInfo->VBInfo & ( DisableCRT2Display | SetSimuScanMode ) ) | |
9073 | || ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) || ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV ) ) ) | |
9074 | { | |
9075 | tempah= XGINew_GetReg1( pVBInfo->Part1Port , 0x00 ) ; /* save Part1 index 0 */ | |
9076 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x00 , 0x10 ) ; /* BTDAC = 1, avoid VB reset */ | |
9077 | XGINew_SetRegAND( pVBInfo->Part1Port , 0x1E , 0xDF ) ; /* disable CRT2 */ | |
9078 | XGINew_SetReg1( pVBInfo->Part1Port , 0x00 , tempah ) ; /* restore Part1 index 0 */ | |
9079 | } | |
9080 | } | |
9081 | else /* {301} */ | |
9082 | { | |
9083 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToTV ) ) | |
9084 | { | |
9085 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x00 , 0x80 ) ; /* BScreenOff=1 */ | |
9086 | XGINew_SetRegAND( pVBInfo->Part1Port , 0x1E , 0xDF ) ; /* Disable CRT2 */ | |
9087 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x32 , 0xDF ) ; /* Disable TV asPrimary VGA swap */ | |
9088 | } | |
9089 | ||
9090 | if ( pVBInfo->VBInfo & ( DisableCRT2Display | SetCRT2ToLCDA | SetSimuScanMode ) ) | |
9091 | XGI_DisplayOff( HwDeviceExtension, pVBInfo) ; | |
9092 | } | |
9093 | ||
9094 | ||
9095 | ||
9096 | ||
9097 | if ( HwDeviceExtension->jChipType < XG40 ) | |
9098 | { | |
9099 | if ( !( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) || ( XGI_DisableChISLCD(pVBInfo) ) || ( XGI_IsLCDON(pVBInfo) ) ) | |
9100 | { | |
9101 | if ( pVBInfo->LCDInfo & SetPWDEnable ) | |
9102 | { | |
9103 | if ( pVBInfo->LCDInfo & SetPWDEnable ) | |
9104 | XGI_BacklightByDrv(pVBInfo) ; | |
9105 | else | |
9106 | { | |
9107 | XGI_SetPanelDelay( 4 ,pVBInfo) ; | |
9108 | if ( pVBInfo->VBType & VB_XGI301LV ) | |
9109 | { | |
9110 | tempbl = 0xFD ; | |
9111 | tempah = 0x00 ; | |
9112 | } | |
9113 | else | |
9114 | { | |
9115 | tempbl = 0xFB ; | |
9116 | tempah = 0x04 ; | |
9117 | } | |
9118 | } | |
9119 | } | |
9120 | XGI_SetPanelPower( tempah , tempbl , pVBInfo) ; | |
9121 | } | |
9122 | } | |
9123 | } | |
9124 | ||
9125 | ||
9126 | /* --------------------------------------------------------------------- */ | |
9127 | /* Function : XGI_GetTVPtrIndex */ | |
9128 | /* Input : */ | |
9129 | /* Output : */ | |
9130 | /* Description : bx 0 : ExtNTSC */ | |
9131 | /* 1 : StNTSC */ | |
9132 | /* 2 : ExtPAL */ | |
9133 | /* 3 : StPAL */ | |
9134 | /* 4 : ExtHiTV */ | |
9135 | /* 5 : StHiTV */ | |
9136 | /* 6 : Ext525i */ | |
9137 | /* 7 : St525i */ | |
9138 | /* 8 : Ext525p */ | |
9139 | /* 9 : St525p */ | |
9140 | /* A : Ext750p */ | |
9141 | /* B : St750p */ | |
9142 | /* --------------------------------------------------------------------- */ | |
80adad85 | 9143 | unsigned short XGI_GetTVPtrIndex(struct vb_device_info *pVBInfo) |
d7636e0b | 9144 | { |
82d6eb5b | 9145 | unsigned short tempbx = 0 ; |
d7636e0b | 9146 | |
9147 | if ( pVBInfo->TVInfo & SetPALTV ) | |
9148 | tempbx = 2 ; | |
9149 | if ( pVBInfo->TVInfo & SetYPbPrMode1080i ) | |
9150 | tempbx = 4 ; | |
9151 | if ( pVBInfo->TVInfo & SetYPbPrMode525i ) | |
9152 | tempbx = 6 ; | |
9153 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) | |
9154 | tempbx = 8 ; | |
9155 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) | |
9156 | tempbx = 10 ; | |
9157 | if ( pVBInfo->TVInfo & TVSimuMode ) | |
9158 | tempbx++ ; | |
9159 | ||
9160 | return tempbx ; | |
9161 | } | |
9162 | ||
9163 | ||
9164 | /* --------------------------------------------------------------------- */ | |
9165 | /* Function : XGI_OEM310Setting */ | |
9166 | /* Input : */ | |
9167 | /* Output : */ | |
9168 | /* Description : Customized Param. for 301 */ | |
9169 | /* --------------------------------------------------------------------- */ | |
80adad85 | 9170 | void XGI_OEM310Setting(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
d7636e0b | 9171 | { |
9172 | if ( pVBInfo->SetFlag & Win9xDOSMode ) | |
9173 | return ; | |
9174 | ||
9175 | /* GetPart1IO(); */ | |
9176 | XGI_SetDelayComp(pVBInfo) ; | |
9177 | ||
9178 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) | |
9179 | XGI_SetLCDCap(pVBInfo) ; | |
9180 | ||
9181 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
9182 | { | |
9183 | /* GetPart2IO() */ | |
9184 | XGI_SetPhaseIncr(pVBInfo) ; | |
9185 | XGI_SetYFilter( ModeNo , ModeIdIndex,pVBInfo ) ; | |
9186 | XGI_SetAntiFlicker( ModeNo , ModeIdIndex,pVBInfo ) ; | |
9187 | ||
9188 | if ( pVBInfo->VBType&VB_XGI301) | |
9189 | XGI_SetEdgeEnhance( ModeNo , ModeIdIndex ,pVBInfo) ; | |
9190 | } | |
9191 | } | |
9192 | ||
9193 | ||
9194 | /* --------------------------------------------------------------------- */ | |
9195 | /* Function : XGI_SetDelayComp */ | |
9196 | /* Input : */ | |
9197 | /* Output : */ | |
9198 | /* Description : */ | |
9199 | /* --------------------------------------------------------------------- */ | |
80adad85 | 9200 | void XGI_SetDelayComp(struct vb_device_info *pVBInfo) |
d7636e0b | 9201 | { |
82d6eb5b | 9202 | unsigned short index ; |
d7636e0b | 9203 | |
108afbf8 | 9204 | unsigned char tempah , |
d7636e0b | 9205 | tempbl , |
9206 | tempbh ; | |
9207 | ||
9208 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
9209 | { | |
9210 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA | SetCRT2ToTV | SetCRT2ToRAMDAC ) ) | |
9211 | { | |
9212 | tempbl = 0; | |
9213 | tempbh = 0; | |
9214 | ||
9215 | index = XGI_GetTVPtrIndex(pVBInfo ) ; /* Get TV Delay */ | |
9216 | tempbl = pVBInfo->XGI_TVDelayList[ index ] ; | |
9217 | ||
9218 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
9219 | tempbl = pVBInfo->XGI_TVDelayList2[ index ] ; | |
9220 | ||
9221 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) | |
9222 | tempbl = tempbl >> 4 ; | |
9223 | /* | |
9224 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) | |
9225 | tempbl = CRT2Delay1 ; // Get CRT2 Delay | |
9226 | ||
9227 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
9228 | tempbl = CRT2Delay2 ; | |
9229 | */ | |
9230 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) | |
9231 | { | |
9232 | index = XGI_GetLCDCapPtr(pVBInfo) ; /* Get LCD Delay */ | |
9233 | tempbh=pVBInfo->LCDCapList[ index ].LCD_DelayCompensation ; | |
9234 | ||
9235 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) | |
9236 | tempbl = tempbh ; | |
9237 | } | |
9238 | ||
9239 | tempbl &= 0x0F ; | |
9240 | tempbh &= 0xF0 ; | |
9241 | tempah = XGINew_GetReg1( pVBInfo->Part1Port , 0x2D ) ; | |
9242 | ||
9243 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV ) ) /* Channel B */ | |
9244 | { | |
9245 | tempah &= 0xF0 ; | |
9246 | tempah |= tempbl ; | |
9247 | } | |
9248 | ||
9249 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) /* Channel A */ | |
9250 | { | |
9251 | tempah &= 0x0F ; | |
9252 | tempah |= tempbh ; | |
9253 | } | |
9254 | XGINew_SetReg1(pVBInfo->Part1Port,0x2D,tempah); | |
9255 | } | |
9256 | } | |
9257 | else if ( pVBInfo->IF_DEF_LVDS == 1 ) | |
9258 | { | |
9259 | tempbl = 0; | |
9260 | tempbh = 0; | |
9261 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) | |
9262 | { | |
9263 | tempah = pVBInfo->LCDCapList[ XGI_GetLCDCapPtr(pVBInfo) ].LCD_DelayCompensation ; /* / Get LCD Delay */ | |
9264 | tempah &= 0x0f ; | |
9265 | tempah = tempah << 4 ; | |
9266 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2D , 0x0f , tempah ) ; | |
9267 | } | |
9268 | } | |
9269 | } | |
9270 | ||
9271 | ||
9272 | /* --------------------------------------------------------------------- */ | |
9273 | /* Function : XGI_SetLCDCap */ | |
9274 | /* Input : */ | |
9275 | /* Output : */ | |
9276 | /* Description : */ | |
9277 | /* --------------------------------------------------------------------- */ | |
80adad85 | 9278 | void XGI_SetLCDCap(struct vb_device_info *pVBInfo) |
d7636e0b | 9279 | { |
82d6eb5b | 9280 | unsigned short tempcx ; |
d7636e0b | 9281 | |
9282 | tempcx = pVBInfo->LCDCapList[ XGI_GetLCDCapPtr(pVBInfo) ].LCD_Capability ; | |
9283 | ||
9284 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
9285 | { | |
9286 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
9287 | { /* 301LV/302LV only */ | |
9288 | /* Set 301LV Capability */ | |
108afbf8 | 9289 | XGINew_SetReg1(pVBInfo->Part4Port, 0x24, (unsigned char)(tempcx & 0x1F)); |
d7636e0b | 9290 | } |
9291 | /* VB Driving */ | |
82d6eb5b BP |
9292 | XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x0D, |
9293 | ~((EnableVBCLKDRVLOW | EnablePLLSPLOW) >> 8), | |
9294 | (unsigned short)((tempcx & (EnableVBCLKDRVLOW | EnablePLLSPLOW)) >> 8)); | |
d7636e0b | 9295 | } |
9296 | ||
9297 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
9298 | { | |
9299 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) | |
9300 | XGI_SetLCDCap_B( tempcx,pVBInfo ) ; | |
9301 | else if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) | |
9302 | XGI_SetLCDCap_A( tempcx,pVBInfo ) ; | |
9303 | ||
9304 | if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) ) | |
9305 | { | |
9306 | if ( tempcx & EnableSpectrum ) | |
9307 | SetSpectrum( pVBInfo) ; | |
9308 | } | |
9309 | } | |
9310 | else /* LVDS,CH7017 */ | |
9311 | XGI_SetLCDCap_A( tempcx, pVBInfo ) ; | |
9312 | } | |
9313 | ||
9314 | ||
9315 | /* --------------------------------------------------------------------- */ | |
9316 | /* Function : XGI_SetLCDCap_A */ | |
9317 | /* Input : */ | |
9318 | /* Output : */ | |
9319 | /* Description : */ | |
9320 | /* --------------------------------------------------------------------- */ | |
80adad85 | 9321 | void XGI_SetLCDCap_A(unsigned short tempcx, struct vb_device_info *pVBInfo) |
d7636e0b | 9322 | { |
82d6eb5b | 9323 | unsigned short temp ; |
d7636e0b | 9324 | |
9325 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; | |
9326 | ||
9327 | if ( temp & LCDRGB18Bit ) | |
9328 | { | |
82d6eb5b BP |
9329 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F, |
9330 | (unsigned short)(0x20 | (tempcx & 0x00C0))); /* Enable Dither */ | |
d7636e0b | 9331 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x1A , 0x7F , 0x80 ) ; |
9332 | } | |
9333 | else | |
9334 | { | |
82d6eb5b BP |
9335 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F, |
9336 | (unsigned short)(0x30 | (tempcx & 0x00C0))); | |
d7636e0b | 9337 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x1A , 0x7F , 0x00 ) ; |
9338 | } | |
9339 | ||
9340 | /* | |
9341 | if ( tempcx & EnableLCD24bpp ) // 24bits | |
9342 | { | |
82d6eb5b | 9343 | XGINew_SetRegANDOR(pVBInfo->Part1Port,0x19, 0x0F,(unsigned short)(0x30|(tempcx&0x00C0)) ); |
d7636e0b | 9344 | XGINew_SetRegANDOR(pVBInfo->Part1Port,0x1A,0x7F,0x00); |
9345 | } | |
9346 | else | |
9347 | { | |
82d6eb5b | 9348 | XGINew_SetRegANDOR(pVBInfo->Part1Port,0x19, 0x0F,(unsigned short)(0x20|(tempcx&0x00C0)) ); // Enable Dither |
d7636e0b | 9349 | XGINew_SetRegANDOR(pVBInfo->Part1Port,0x1A,0x7F,0x80); |
9350 | } | |
9351 | */ | |
9352 | } | |
9353 | ||
9354 | ||
9355 | /* --------------------------------------------------------------------- */ | |
9356 | /* Function : XGI_SetLCDCap_B */ | |
9357 | /* Input : cx -> LCD Capability */ | |
9358 | /* Output : */ | |
9359 | /* Description : */ | |
9360 | /* --------------------------------------------------------------------- */ | |
80adad85 | 9361 | void XGI_SetLCDCap_B(unsigned short tempcx, struct vb_device_info *pVBInfo) |
d7636e0b | 9362 | { |
9363 | if ( tempcx & EnableLCD24bpp ) /* 24bits */ | |
82d6eb5b BP |
9364 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1A, 0xE0, |
9365 | (unsigned short)(((tempcx & 0x00ff) >> 6) | 0x0c)); | |
d7636e0b | 9366 | else |
82d6eb5b BP |
9367 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1A, 0xE0, |
9368 | (unsigned short)(((tempcx & 0x00ff) >> 6) | 0x18)); /* Enable Dither */ | |
d7636e0b | 9369 | } |
9370 | ||
9371 | ||
9372 | /* --------------------------------------------------------------------- */ | |
9373 | /* Function : SetSpectrum */ | |
9374 | /* Input : */ | |
9375 | /* Output : */ | |
9376 | /* Description : */ | |
9377 | /* --------------------------------------------------------------------- */ | |
80adad85 | 9378 | void SetSpectrum(struct vb_device_info *pVBInfo) |
d7636e0b | 9379 | { |
82d6eb5b | 9380 | unsigned short index ; |
d7636e0b | 9381 | |
9382 | index = XGI_GetLCDCapPtr(pVBInfo) ; | |
9383 | ||
9384 | XGINew_SetRegAND( pVBInfo->Part4Port , 0x30 , 0x8F ) ; /* disable down spectrum D[4] */ | |
9385 | XGI_LongWait(pVBInfo) ; | |
9386 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x30 , 0x20 ) ; /* reset spectrum */ | |
9387 | XGI_LongWait(pVBInfo) ; | |
9388 | ||
9389 | XGINew_SetReg1( pVBInfo->Part4Port , 0x31 , pVBInfo->LCDCapList[ index ].Spectrum_31 ) ; | |
9390 | XGINew_SetReg1( pVBInfo->Part4Port , 0x32 , pVBInfo->LCDCapList[ index ].Spectrum_32 ) ; | |
9391 | XGINew_SetReg1( pVBInfo->Part4Port , 0x33 , pVBInfo->LCDCapList[ index ].Spectrum_33 ) ; | |
9392 | XGINew_SetReg1( pVBInfo->Part4Port , 0x34 , pVBInfo->LCDCapList[ index ].Spectrum_34 ) ; | |
9393 | XGI_LongWait(pVBInfo) ; | |
9394 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x30 , 0x40 ) ; /* enable spectrum */ | |
9395 | } | |
9396 | ||
9397 | ||
9398 | /* --------------------------------------------------------------------- */ | |
9399 | /* Function : XGI_SetAntiFlicker */ | |
9400 | /* Input : */ | |
9401 | /* Output : */ | |
9402 | /* Description : Set TV Customized Param. */ | |
9403 | /* --------------------------------------------------------------------- */ | |
82d6eb5b | 9404 | void XGI_SetAntiFlicker(unsigned short ModeNo, unsigned short ModeIdIndex, |
80adad85 | 9405 | struct vb_device_info *pVBInfo) |
d7636e0b | 9406 | { |
82d6eb5b | 9407 | unsigned short tempbx , |
d7636e0b | 9408 | index ; |
9409 | ||
108afbf8 | 9410 | unsigned char tempah ; |
d7636e0b | 9411 | |
9412 | if (pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) | |
9413 | return ; | |
9414 | ||
9415 | tempbx = XGI_GetTVPtrIndex(pVBInfo ) ; | |
9416 | tempbx &= 0xFE ; | |
9417 | ||
9418 | if ( ModeNo <= 0x13 ) | |
9419 | { | |
9420 | index = pVBInfo->SModeIDTable[ ModeIdIndex ].VB_StTVFlickerIndex ; | |
9421 | } | |
9422 | else | |
9423 | { | |
9424 | index = pVBInfo->EModeIDTable[ ModeIdIndex ].VB_ExtTVFlickerIndex ; | |
9425 | } | |
9426 | ||
9427 | tempbx += index ; | |
9428 | tempah = TVAntiFlickList[ tempbx ] ; | |
9429 | tempah = tempah << 4 ; | |
9430 | ||
9431 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x0A , 0x8F , tempah ) ; | |
9432 | } | |
9433 | ||
9434 | ||
9435 | /* --------------------------------------------------------------------- */ | |
9436 | /* Function : XGI_SetEdgeEnhance */ | |
9437 | /* Input : */ | |
9438 | /* Output : */ | |
9439 | /* Description : */ | |
9440 | /* --------------------------------------------------------------------- */ | |
80adad85 | 9441 | void XGI_SetEdgeEnhance(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
d7636e0b | 9442 | { |
82d6eb5b | 9443 | unsigned short tempbx , |
d7636e0b | 9444 | index ; |
9445 | ||
108afbf8 | 9446 | unsigned char tempah ; |
d7636e0b | 9447 | |
9448 | ||
9449 | tempbx = XGI_GetTVPtrIndex(pVBInfo ) ; | |
9450 | tempbx &= 0xFE ; | |
9451 | ||
9452 | if ( ModeNo <= 0x13 ) | |
9453 | { | |
9454 | index = pVBInfo->SModeIDTable[ ModeIdIndex ].VB_StTVEdgeIndex ; | |
9455 | } | |
9456 | else | |
9457 | { | |
9458 | index = pVBInfo->EModeIDTable[ ModeIdIndex ].VB_ExtTVEdgeIndex ; | |
9459 | } | |
9460 | ||
9461 | tempbx += index ; | |
9462 | tempah = TVEdgeList[ tempbx ] ; | |
9463 | tempah = tempah << 5 ; | |
9464 | ||
9465 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x3A , 0x1F , tempah ) ; | |
9466 | } | |
9467 | ||
9468 | ||
9469 | /* --------------------------------------------------------------------- */ | |
9470 | /* Function : XGI_SetPhaseIncr */ | |
9471 | /* Input : */ | |
9472 | /* Output : */ | |
9473 | /* Description : */ | |
9474 | /* --------------------------------------------------------------------- */ | |
80adad85 | 9475 | void XGI_SetPhaseIncr(struct vb_device_info *pVBInfo) |
d7636e0b | 9476 | { |
82d6eb5b | 9477 | unsigned short tempbx ; |
d7636e0b | 9478 | |
108afbf8 | 9479 | unsigned char tempcl , |
d7636e0b | 9480 | tempch ; |
9481 | ||
82d6eb5b | 9482 | unsigned long tempData ; |
d7636e0b | 9483 | |
9484 | XGI_GetTVPtrIndex2( &tempbx , &tempcl , &tempch, pVBInfo ) ; /* bx, cl, ch */ | |
9485 | tempData = TVPhaseList[ tempbx ] ; | |
9486 | ||
82d6eb5b BP |
9487 | XGINew_SetReg1(pVBInfo->Part2Port, 0x31, |
9488 | (unsigned short)(tempData & 0x000000FF)); | |
9489 | XGINew_SetReg1(pVBInfo->Part2Port, 0x32, | |
9490 | (unsigned short)((tempData & 0x0000FF00) >> 8)); | |
9491 | XGINew_SetReg1(pVBInfo->Part2Port, 0x33, | |
9492 | (unsigned short)((tempData & 0x00FF0000) >> 16)); | |
9493 | XGINew_SetReg1(pVBInfo->Part2Port, 0x34, | |
9494 | (unsigned short)((tempData & 0xFF000000) >> 24)); | |
d7636e0b | 9495 | } |
9496 | ||
9497 | ||
9498 | /* --------------------------------------------------------------------- */ | |
9499 | /* Function : XGI_SetYFilter */ | |
9500 | /* Input : */ | |
9501 | /* Output : */ | |
9502 | /* Description : */ | |
9503 | /* --------------------------------------------------------------------- */ | |
82d6eb5b | 9504 | void XGI_SetYFilter(unsigned short ModeNo, unsigned short ModeIdIndex, |
80adad85 | 9505 | struct vb_device_info *pVBInfo) |
d7636e0b | 9506 | { |
82d6eb5b | 9507 | unsigned short tempbx , |
d7636e0b | 9508 | index ; |
9509 | ||
108afbf8 | 9510 | unsigned char tempcl , |
d7636e0b | 9511 | tempch , |
9512 | tempal , | |
9513 | *filterPtr ; | |
9514 | ||
9515 | XGI_GetTVPtrIndex2( &tempbx , &tempcl , &tempch, pVBInfo ) ; /* bx, cl, ch */ | |
9516 | ||
9517 | switch( tempbx ) | |
9518 | { | |
9519 | case 0x00: | |
9520 | case 0x04: | |
9521 | filterPtr = NTSCYFilter1 ; | |
9522 | break ; | |
9523 | ||
9524 | case 0x01: | |
9525 | filterPtr = PALYFilter1 ; | |
9526 | break ; | |
9527 | ||
9528 | case 0x02: | |
9529 | case 0x05: | |
9530 | case 0x0D: | |
9531 | filterPtr = PALMYFilter1 ; | |
9532 | break ; | |
9533 | ||
9534 | case 0x03: | |
9535 | filterPtr = PALNYFilter1 ; | |
9536 | break ; | |
9537 | ||
9538 | case 0x08: | |
9539 | case 0x0C: | |
9540 | filterPtr = NTSCYFilter2 ; | |
9541 | break ; | |
9542 | ||
9543 | case 0x0A: | |
9544 | filterPtr = PALMYFilter2 ; | |
9545 | break ; | |
9546 | ||
9547 | case 0x0B: | |
9548 | filterPtr = PALNYFilter2 ; | |
9549 | break ; | |
9550 | ||
9551 | case 0x09: | |
9552 | filterPtr = PALYFilter2 ; | |
9553 | break ; | |
9554 | ||
9555 | default: | |
9556 | return ; | |
9557 | } | |
9558 | ||
9559 | if ( ModeNo <= 0x13 ) | |
9560 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].VB_StTVYFilterIndex ; | |
9561 | else | |
9562 | tempal = pVBInfo->EModeIDTable[ ModeIdIndex ].VB_ExtTVYFilterIndex ; | |
9563 | ||
9564 | if ( tempcl == 0 ) | |
9565 | index = tempal * 4; | |
9566 | else | |
9567 | index = tempal * 7; | |
9568 | ||
9569 | if ( ( tempcl == 0 ) && ( tempch == 1 ) ) | |
9570 | { | |
9571 | XGINew_SetReg1( pVBInfo->Part2Port , 0x35 , 0 ) ; | |
9572 | XGINew_SetReg1( pVBInfo->Part2Port , 0x36 , 0 ) ; | |
9573 | XGINew_SetReg1( pVBInfo->Part2Port , 0x37 , 0 ) ; | |
9574 | XGINew_SetReg1( pVBInfo->Part2Port , 0x38 , filterPtr[ index++ ] ) ; | |
9575 | } | |
9576 | else | |
9577 | { | |
9578 | XGINew_SetReg1( pVBInfo->Part2Port , 0x35 , filterPtr[ index++ ] ) ; | |
9579 | XGINew_SetReg1( pVBInfo->Part2Port , 0x36 , filterPtr[ index++ ] ) ; | |
9580 | XGINew_SetReg1( pVBInfo->Part2Port , 0x37 , filterPtr[ index++ ] ) ; | |
9581 | XGINew_SetReg1( pVBInfo->Part2Port , 0x38 , filterPtr[ index++ ] ) ; | |
9582 | } | |
9583 | ||
9584 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
9585 | { | |
9586 | XGINew_SetReg1( pVBInfo->Part2Port , 0x48 , filterPtr[ index++ ] ) ; | |
9587 | XGINew_SetReg1( pVBInfo->Part2Port , 0x49 , filterPtr[ index++ ] ) ; | |
9588 | XGINew_SetReg1( pVBInfo->Part2Port , 0x4A , filterPtr[ index++ ] ) ; | |
9589 | } | |
9590 | } | |
9591 | ||
9592 | ||
9593 | /* --------------------------------------------------------------------- */ | |
9594 | /* Function : XGI_GetTVPtrIndex2 */ | |
9595 | /* Input : */ | |
9596 | /* Output : bx 0 : NTSC */ | |
9597 | /* 1 : PAL */ | |
9598 | /* 2 : PALM */ | |
9599 | /* 3 : PALN */ | |
9600 | /* 4 : NTSC1024x768 */ | |
9601 | /* 5 : PAL-M 1024x768 */ | |
9602 | /* 6-7: reserved */ | |
9603 | /* cl 0 : YFilter1 */ | |
9604 | /* 1 : YFilter2 */ | |
9605 | /* ch 0 : 301A */ | |
9606 | /* 1 : 301B/302B/301LV/302LV */ | |
9607 | /* Description : */ | |
9608 | /* --------------------------------------------------------------------- */ | |
108afbf8 | 9609 | void XGI_GetTVPtrIndex2(unsigned short *tempbx, unsigned char *tempcl, |
80adad85 | 9610 | unsigned char *tempch, struct vb_device_info *pVBInfo) |
d7636e0b | 9611 | { |
9612 | *tempbx = 0 ; | |
9613 | *tempcl = 0 ; | |
9614 | *tempch = 0 ; | |
9615 | ||
9616 | if ( pVBInfo->TVInfo & SetPALTV ) | |
9617 | *tempbx = 1 ; | |
9618 | ||
9619 | if ( pVBInfo->TVInfo & SetPALMTV ) | |
9620 | *tempbx = 2 ; | |
9621 | ||
9622 | if ( pVBInfo->TVInfo & SetPALNTV ) | |
9623 | *tempbx = 3 ; | |
9624 | ||
9625 | if ( pVBInfo->TVInfo & NTSC1024x768 ) | |
9626 | { | |
9627 | *tempbx = 4 ; | |
9628 | if ( pVBInfo->TVInfo & SetPALMTV ) | |
9629 | *tempbx = 5 ; | |
9630 | } | |
9631 | ||
9632 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
9633 | { | |
9634 | if ( ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) || ( pVBInfo->TVInfo & TVSimuMode ) ) | |
9635 | { | |
9636 | *tempbx += 8 ; | |
9637 | *tempcl += 1 ; | |
9638 | } | |
9639 | } | |
9640 | ||
9641 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
9642 | (*tempch)++ ; | |
9643 | } | |
9644 | ||
9645 | ||
9646 | /* --------------------------------------------------------------------- */ | |
9647 | /* Function : XGI_SetCRT2ModeRegs */ | |
9648 | /* Input : */ | |
9649 | /* Output : */ | |
9650 | /* Description : Origin code for crt2group */ | |
9651 | /* --------------------------------------------------------------------- */ | |
82d6eb5b | 9652 | void XGI_SetCRT2ModeRegs(unsigned short ModeNo, |
e4147abe | 9653 | struct xgi_hw_device_info *HwDeviceExtension, |
80adad85 | 9654 | struct vb_device_info *pVBInfo) |
d7636e0b | 9655 | { |
82d6eb5b | 9656 | unsigned short tempbl ; |
108afbf8 | 9657 | short tempcl ; |
d7636e0b | 9658 | |
108afbf8 | 9659 | unsigned char tempah ; |
d7636e0b | 9660 | |
9661 | /* XGINew_SetReg1( pVBInfo->Part1Port , 0x03 , 0x00 ) ; // fix write part1 index 0 BTDRAM bit Bug */ | |
9662 | tempah=0; | |
9663 | if ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) | |
9664 | { | |
9665 | tempah=XGINew_GetReg1( pVBInfo->Part1Port , 0x00 ) ; | |
9666 | tempah &= ~0x10 ; /* BTRAMDAC */ | |
9667 | tempah |= 0x40 ; /* BTRAM */ | |
9668 | ||
9669 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD ) ) | |
9670 | { | |
9671 | tempah=0x40; /* BTDRAM */ | |
9672 | if ( ModeNo > 0x13 ) | |
9673 | { | |
9674 | tempcl = pVBInfo->ModeType ; | |
9675 | tempcl -= ModeVGA ; | |
9676 | if ( tempcl >= 0 ) | |
9677 | { | |
9678 | tempah = ( 0x008 >> tempcl ) ; /* BT Color */ | |
9679 | if ( tempah == 0 ) | |
9680 | tempah = 1 ; | |
9681 | tempah |= 0x040 ; | |
9682 | } | |
9683 | } | |
9684 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
9685 | tempah ^= 0x50 ; /* BTDAC */ | |
9686 | } | |
9687 | } | |
9688 | ||
9689 | /* 0210 shampoo | |
9690 | if ( pVBInfo->VBInfo & DisableCRT2Display ) | |
9691 | { | |
9692 | tempah = 0 ; | |
9693 | } | |
9694 | ||
9695 | XGINew_SetReg1( pVBInfo->Part1Port , 0x00 , tempah ) ; | |
9696 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD ) ) | |
9697 | { | |
9698 | tempcl = pVBInfo->ModeType ; | |
9699 | if ( ModeNo > 0x13 ) | |
9700 | { | |
9701 | tempcl -= ModeVGA ; | |
9702 | if ( ( tempcl > 0 ) || ( tempcl == 0 ) ) | |
9703 | { | |
9704 | tempah=(0x008>>tempcl) ; | |
9705 | if ( tempah == 0 ) | |
9706 | tempah = 1 ; | |
9707 | tempah |= 0x040; | |
9708 | } | |
9709 | } | |
9710 | else | |
9711 | { | |
9712 | tempah = 0x040 ; | |
9713 | } | |
9714 | ||
9715 | if ( pVBInfo->VBInfo & SetInSlaveMode ) | |
9716 | { | |
9717 | tempah = ( tempah ^ 0x050 ) ; | |
9718 | } | |
9719 | } | |
9720 | */ | |
9721 | ||
9722 | XGINew_SetReg1( pVBInfo->Part1Port , 0x00 , tempah ) ; | |
9723 | tempah = 0x08 ; | |
9724 | tempbl = 0xf0 ; | |
9725 | ||
9726 | if ( pVBInfo->VBInfo & DisableCRT2Display ) | |
9727 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ; | |
9728 | else | |
9729 | { | |
9730 | tempah = 0x00 ; | |
9731 | tempbl = 0xff ; | |
9732 | ||
9733 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA ) ) | |
9734 | { | |
9735 | if ( ( pVBInfo->VBInfo & SetCRT2ToLCDA ) && ( !( pVBInfo->VBInfo & SetSimuScanMode ) ) ) | |
9736 | { | |
9737 | tempbl &= 0xf7 ; | |
9738 | tempah |= 0x01 ; | |
9739 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ; | |
9740 | } | |
9741 | else | |
9742 | { | |
9743 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) | |
9744 | { | |
9745 | tempbl &= 0xf7 ; | |
9746 | tempah |= 0x01 ; | |
9747 | } | |
9748 | ||
9749 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD ) ) | |
9750 | { | |
9751 | tempbl &= 0xf8 ; | |
9752 | tempah = 0x01 ; | |
9753 | ||
9754 | if ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) | |
9755 | tempah |= 0x02 ; | |
9756 | ||
9757 | if ( !( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) ) | |
9758 | { | |
9759 | tempah = tempah ^ 0x05 ; | |
9760 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCD ) ) | |
9761 | tempah = tempah ^ 0x01 ; | |
9762 | } | |
9763 | ||
9764 | if ( !( pVBInfo->VBInfo & SetCRT2ToDualEdge ) ) | |
9765 | tempah |= 0x08 ; | |
9766 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ; | |
9767 | } | |
9768 | else | |
9769 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ; | |
9770 | } | |
9771 | } | |
9772 | else | |
9773 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ; | |
9774 | } | |
9775 | ||
9776 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA ) ) | |
9777 | { | |
9778 | tempah &= ( ~0x08 ) ; | |
9779 | if ( ( pVBInfo->ModeType == ModeVGA ) && ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) ) | |
9780 | { | |
9781 | tempah |= 0x010 ; | |
9782 | } | |
9783 | tempah |= 0x080 ; | |
9784 | ||
9785 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
9786 | { | |
9787 | /* if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) */ | |
9788 | /* { */ | |
9789 | tempah |= 0x020 ; | |
9790 | if ( ModeNo > 0x13 ) | |
9791 | { | |
9792 | if ( pVBInfo->VBInfo & DriverMode ) | |
9793 | tempah = tempah ^ 0x20 ; | |
9794 | } | |
9795 | /* } */ | |
9796 | } | |
9797 | ||
9798 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x0D , ~0x0BF , tempah ) ; | |
9799 | tempah = 0 ; | |
9800 | ||
9801 | if ( pVBInfo->LCDInfo & SetLCDDualLink ) | |
9802 | tempah |= 0x40 ; | |
9803 | ||
9804 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
9805 | { | |
9806 | /* if ( ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) ) && ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) ) */ | |
9807 | /* { */ | |
9808 | if ( pVBInfo->TVInfo & RPLLDIV2XO ) | |
9809 | tempah |= 0x40 ; | |
9810 | /* } */ | |
9811 | } | |
9812 | ||
9813 | if ( ( pVBInfo->LCDResInfo == Panel1280x1024 ) || ( pVBInfo->LCDResInfo == Panel1280x1024x75 ) ) | |
9814 | tempah |= 0x80 ; | |
9815 | ||
9816 | if ( pVBInfo->LCDResInfo == Panel1280x960 ) | |
9817 | tempah |= 0x80 ; | |
9818 | ||
9819 | XGINew_SetReg1( pVBInfo->Part4Port , 0x0C , tempah ) ; | |
9820 | } | |
9821 | ||
9822 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) | |
9823 | { | |
9824 | tempah = 0 ; | |
9825 | tempbl = 0xfb ; | |
9826 | ||
9827 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) | |
9828 | { | |
9829 | tempbl=0xff; | |
9830 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) | |
9831 | tempah |= 0x04 ; /* shampoo 0129 */ | |
9832 | } | |
9833 | ||
9834 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x13 , tempbl , tempah ) ; | |
9835 | tempah = 0x00 ; | |
9836 | tempbl = 0xcf ; | |
9837 | if ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) | |
9838 | { | |
9839 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) | |
9840 | tempah |= 0x30 ; | |
9841 | } | |
9842 | ||
9843 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2c , tempbl , tempah ) ; | |
9844 | tempah = 0 ; | |
9845 | tempbl = 0x3f ; | |
9846 | ||
9847 | if ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) | |
9848 | { | |
9849 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) | |
9850 | tempah |= 0xc0 ; | |
9851 | } | |
9852 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x21 , tempbl , tempah ) ; | |
9853 | } | |
9854 | ||
9855 | tempah = 0 ; | |
9856 | tempbl = 0x7f ; | |
9857 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) | |
9858 | { | |
9859 | tempbl = 0xff ; | |
9860 | if ( !( pVBInfo->VBInfo & SetCRT2ToDualEdge ) ) | |
9861 | tempah |= 0x80 ; | |
9862 | } | |
9863 | ||
9864 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x23 , tempbl , tempah ) ; | |
9865 | ||
9866 | if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) ) | |
9867 | { | |
9868 | if ( pVBInfo->LCDInfo & SetLCDDualLink ) | |
9869 | { | |
9870 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x27 , 0x20 ) ; | |
9871 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x34 , 0x10 ) ; | |
9872 | } | |
9873 | } | |
9874 | } | |
9875 | ||
9876 | ||
9877 | /* --------------------------------------------------------------------- */ | |
9878 | /* Function : XGI_CloseCRTC */ | |
9879 | /* Input : */ | |
9880 | /* Output : */ | |
9881 | /* Description : */ | |
9882 | /* --------------------------------------------------------------------- */ | |
80adad85 | 9883 | void XGI_CloseCRTC(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
d7636e0b | 9884 | { |
82d6eb5b | 9885 | unsigned short tempbx ; |
d7636e0b | 9886 | |
9887 | tempbx = 0 ; | |
9888 | ||
9889 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) | |
9890 | tempbx = 0x08A0 ; | |
9891 | ||
9892 | ||
9893 | } | |
9894 | ||
9895 | ||
9896 | /* --------------------------------------------------------------------- */ | |
9897 | /* Function : XGI_OpenCRTC */ | |
9898 | /* Input : */ | |
9899 | /* Output : */ | |
9900 | /* Description : */ | |
9901 | /* --------------------------------------------------------------------- */ | |
80adad85 | 9902 | void XGI_OpenCRTC(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
d7636e0b | 9903 | { |
82d6eb5b | 9904 | unsigned short tempbx ; |
d7636e0b | 9905 | |
9906 | tempbx = 0 ; | |
9907 | ||
9908 | ||
9909 | } | |
9910 | ||
9911 | ||
9912 | /* --------------------------------------------------------------------- */ | |
9913 | /* Function : XGI_GetRAMDAC2DATA */ | |
9914 | /* Input : */ | |
9915 | /* Output : */ | |
9916 | /* Description : */ | |
9917 | /* --------------------------------------------------------------------- */ | |
80adad85 | 9918 | void XGI_GetRAMDAC2DATA(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo) |
d7636e0b | 9919 | { |
82d6eb5b | 9920 | unsigned short tempax , |
d7636e0b | 9921 | tempbx , |
9922 | temp1 , | |
9923 | temp2 , | |
9924 | modeflag = 0 , | |
9925 | tempcx , | |
9926 | StandTableIndex , | |
9927 | CRT1Index ; | |
9928 | ||
9929 | pVBInfo->RVBHCMAX = 1 ; | |
9930 | pVBInfo->RVBHCFACT = 1 ; | |
9931 | ||
9932 | if ( ModeNo <= 0x13 ) | |
9933 | { | |
9934 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; | |
9935 | StandTableIndex = XGI_GetModePtr( ModeNo , ModeIdIndex, pVBInfo ) ; | |
9936 | tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 0 ] ; | |
9937 | tempbx = pVBInfo->StandTable[StandTableIndex ].CRTC[ 6 ] ; | |
9938 | temp1 = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 7 ] ; | |
9939 | } | |
9940 | else | |
9941 | { | |
9942 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
9943 | CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; | |
9944 | CRT1Index &= IndexMask ; | |
82d6eb5b BP |
9945 | temp1 = (unsigned short)pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[0]; |
9946 | temp2 = (unsigned short)pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[5]; | |
d7636e0b | 9947 | tempax = ( temp1 & 0xFF ) | ( ( temp2 & 0x03 ) << 8 ) ; |
82d6eb5b BP |
9948 | tempbx = (unsigned short)pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[8]; |
9949 | tempcx = (unsigned short)pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[14] << 8; | |
d7636e0b | 9950 | tempcx &= 0x0100 ; |
9951 | tempcx = tempcx << 2 ; | |
9952 | tempbx |= tempcx; | |
82d6eb5b | 9953 | temp1 = (unsigned short)pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[9]; |
d7636e0b | 9954 | } |
9955 | ||
9956 | if ( temp1 & 0x01 ) | |
9957 | tempbx |= 0x0100 ; | |
9958 | ||
9959 | if ( temp1 & 0x20 ) | |
9960 | tempbx |= 0x0200 ; | |
9961 | tempax += 5 ; | |
9962 | ||
9963 | if ( modeflag & Charx8Dot ) | |
9964 | tempax *= 8 ; | |
9965 | else | |
9966 | tempax *= 9 ; | |
9967 | ||
9968 | pVBInfo->VGAHT = tempax ; | |
9969 | pVBInfo->HT = tempax ; | |
9970 | tempbx++ ; | |
9971 | pVBInfo->VGAVT = tempbx ; | |
9972 | pVBInfo->VT = tempbx ; | |
9973 | } | |
9974 | ||
9975 | ||
9976 | ||
9977 | /* --------------------------------------------------------------------- */ | |
9978 | /* Function : XGI_GetColorDepth */ | |
9979 | /* Input : */ | |
9980 | /* Output : */ | |
9981 | /* Description : */ | |
9982 | /* --------------------------------------------------------------------- */ | |
80adad85 | 9983 | unsigned short XGI_GetColorDepth(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
d7636e0b | 9984 | { |
82d6eb5b | 9985 | unsigned short ColorDepth[ 6 ] = { 1 , 2 , 4 , 4 , 6 , 8 } ; |
108afbf8 | 9986 | short index ; |
82d6eb5b | 9987 | unsigned short modeflag ; |
d7636e0b | 9988 | |
9989 | if ( ModeNo <= 0x13 ) | |
9990 | { | |
9991 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; | |
9992 | } | |
9993 | else | |
9994 | { | |
9995 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; | |
9996 | } | |
9997 | ||
9998 | index=(modeflag&ModeInfoFlag)-ModeEGA; | |
9999 | ||
10000 | if ( index < 0 ) | |
10001 | index = 0 ; | |
10002 | ||
10003 | return( ColorDepth[ index ] ) ; | |
10004 | } | |
10005 | ||
10006 | ||
10007 | ||
10008 | /* --------------------------------------------------------------------- */ | |
10009 | /* Function : XGI_UnLockCRT2 */ | |
10010 | /* Input : */ | |
10011 | /* Output : */ | |
10012 | /* Description : */ | |
10013 | /* --------------------------------------------------------------------- */ | |
80adad85 | 10014 | void XGI_UnLockCRT2(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
d7636e0b | 10015 | { |
10016 | ||
10017 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2f , 0xFF , 0x01 ) ; | |
10018 | ||
10019 | } | |
10020 | ||
10021 | ||
10022 | /* --------------------------------------------------------------------- */ | |
10023 | /* Function : XGI_LockCRT2 */ | |
10024 | /* Input : */ | |
10025 | /* Output : */ | |
10026 | /* Description : */ | |
10027 | /* --------------------------------------------------------------------- */ | |
80adad85 | 10028 | void XGI_LockCRT2(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
d7636e0b | 10029 | { |
10030 | ||
10031 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2F , 0xFE , 0x00 ) ; | |
10032 | ||
10033 | ||
10034 | } | |
10035 | ||
10036 | ||
10037 | /* --------------------------------------------------------------------- */ | |
10038 | /* Function : XGINew_EnableCRT2 */ | |
10039 | /* Input : */ | |
10040 | /* Output : */ | |
10041 | /* Description : */ | |
10042 | /* --------------------------------------------------------------------- */ | |
80adad85 | 10043 | void XGINew_EnableCRT2(struct vb_device_info *pVBInfo) |
d7636e0b | 10044 | { |
10045 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x1E , 0xFF , 0x20 ) ; | |
10046 | } | |
10047 | ||
10048 | ||
10049 | ||
10050 | /* --------------------------------------------------------------------- */ | |
10051 | /* Function : */ | |
10052 | /* Input : */ | |
10053 | /* Output : */ | |
10054 | /* Description : */ | |
10055 | /* --------------------------------------------------------------------- */ | |
80adad85 | 10056 | void XGINew_LCD_Wait_Time(unsigned char DelayTime, struct vb_device_info *pVBInfo) |
d7636e0b | 10057 | { |
82d6eb5b | 10058 | unsigned short i , |
d7636e0b | 10059 | j ; |
10060 | ||
82d6eb5b | 10061 | unsigned long temp , |
d7636e0b | 10062 | flag ; |
10063 | ||
10064 | flag = 0 ; | |
10065 | //printk("XGINew_LCD_Wait_Time"); | |
10066 | //return; | |
10067 | for( i = 0 ; i < DelayTime ; i++ ) | |
10068 | { | |
10069 | for( j = 0 ; j < 66 ; j++ ) | |
10070 | { | |
10071 | ||
10072 | temp = XGINew_GetReg3( 0x61 ) ; | |
10073 | ||
10074 | //temp &= 0x10000000; | |
10075 | temp &= 0x10; | |
10076 | if ( temp == flag ) | |
10077 | continue ; | |
10078 | ||
10079 | flag = temp ; | |
10080 | } | |
10081 | } | |
10082 | } | |
10083 | ||
10084 | ||
10085 | ||
10086 | ||
10087 | /* --------------------------------------------------------------------- */ | |
10088 | /* Function : XGI_BridgeIsOn */ | |
10089 | /* Input : */ | |
10090 | /* Output : */ | |
10091 | /* Description : */ | |
10092 | /* --------------------------------------------------------------------- */ | |
80adad85 | 10093 | unsigned char XGI_BridgeIsOn(struct vb_device_info *pVBInfo) |
d7636e0b | 10094 | { |
82d6eb5b | 10095 | unsigned short flag ; |
d7636e0b | 10096 | |
10097 | if ( pVBInfo->IF_DEF_LVDS == 1 ) | |
10098 | { | |
10099 | return( 1 ) ; | |
10100 | } | |
10101 | else | |
10102 | { | |
10103 | flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x00 ) ; | |
10104 | if ( ( flag == 1 ) || ( flag == 2 ) ) | |
10105 | return( 1 ) ; /* 301b */ | |
10106 | else | |
10107 | return( 0 ) ; | |
10108 | } | |
10109 | } | |
10110 | ||
10111 | ||
10112 | ||
10113 | /* --------------------------------------------------------------------- */ | |
10114 | /* Function : XGI_LongWait */ | |
10115 | /* Input : */ | |
10116 | /* Output : */ | |
10117 | /* Description : */ | |
10118 | /* --------------------------------------------------------------------- */ | |
80adad85 | 10119 | void XGI_LongWait(struct vb_device_info *pVBInfo) |
d7636e0b | 10120 | { |
82d6eb5b | 10121 | unsigned short i ; |
d7636e0b | 10122 | |
10123 | i = XGINew_GetReg1( pVBInfo->P3c4 , 0x1F ) ; | |
10124 | ||
10125 | if ( !( i & 0xC0 ) ) | |
10126 | { | |
10127 | for( i = 0 ; i < 0xFFFF ; i++ ) | |
10128 | { | |
10129 | if ( !( XGINew_GetReg2( pVBInfo->P3da ) & 0x08 ) ) | |
10130 | break ; | |
10131 | } | |
10132 | ||
10133 | for( i = 0 ; i < 0xFFFF ; i++ ) | |
10134 | { | |
10135 | if ( ( XGINew_GetReg2( pVBInfo->P3da ) & 0x08 ) ) | |
10136 | break ; | |
10137 | } | |
10138 | } | |
10139 | } | |
10140 | ||
10141 | ||
10142 | /* --------------------------------------------------------------------- */ | |
10143 | /* Function : XGI_VBLongWait */ | |
10144 | /* Input : */ | |
10145 | /* Output : */ | |
10146 | /* Description : */ | |
10147 | /* --------------------------------------------------------------------- */ | |
80adad85 | 10148 | void XGI_VBLongWait(struct vb_device_info *pVBInfo) |
d7636e0b | 10149 | { |
82d6eb5b | 10150 | unsigned short tempal , |
d7636e0b | 10151 | temp , |
10152 | i , | |
10153 | j ; | |
10154 | return ; | |
10155 | if ( !( pVBInfo->VBInfo & SetCRT2ToTV ) ) | |
10156 | { | |
10157 | temp = 0 ; | |
10158 | for( i = 0 ; i < 3 ; i++ ) | |
10159 | { | |
10160 | for( j = 0 ; j < 100 ; j++ ) | |
10161 | { | |
10162 | tempal = XGINew_GetReg2( pVBInfo->P3da ) ; | |
10163 | if ( temp & 0x01 ) | |
10164 | { /* VBWaitMode2 */ | |
10165 | if ( ( tempal & 0x08 ) ) | |
10166 | { | |
10167 | continue ; | |
10168 | } | |
10169 | ||
10170 | if ( !( tempal & 0x08 ) ) | |
10171 | { | |
10172 | break ; | |
10173 | } | |
10174 | } | |
10175 | else | |
10176 | { /* VBWaitMode1 */ | |
10177 | if ( !( tempal & 0x08 ) ) | |
10178 | { | |
10179 | continue ; | |
10180 | } | |
10181 | ||
10182 | if ( ( tempal & 0x08 ) ) | |
10183 | { | |
10184 | break ; | |
10185 | } | |
10186 | } | |
10187 | } | |
10188 | temp = temp ^ 0x01 ; | |
10189 | } | |
10190 | } | |
10191 | else | |
10192 | { | |
10193 | XGI_LongWait(pVBInfo) ; | |
10194 | } | |
10195 | return ; | |
10196 | } | |
10197 | ||
10198 | ||
10199 | ||
10200 | ||
10201 | /* --------------------------------------------------------------------- */ | |
10202 | /* Function : XGI_GetVGAHT2 */ | |
10203 | /* Input : */ | |
10204 | /* Output : */ | |
10205 | /* Description : */ | |
10206 | /* --------------------------------------------------------------------- */ | |
80adad85 | 10207 | unsigned short XGI_GetVGAHT2(struct vb_device_info *pVBInfo) |
d7636e0b | 10208 | { |
82d6eb5b | 10209 | unsigned long tempax , |
d7636e0b | 10210 | tempbx ; |
10211 | ||
10212 | tempbx = ( ( pVBInfo->VGAVT - pVBInfo->VGAVDE ) * pVBInfo->RVBHCMAX ) & 0xFFFF ; | |
10213 | tempax = ( pVBInfo->VT - pVBInfo->VDE ) * pVBInfo->RVBHCFACT ; | |
10214 | tempax = ( tempax * pVBInfo->HT ) /tempbx ; | |
10215 | ||
82d6eb5b | 10216 | return( (unsigned short)tempax ) ; |
d7636e0b | 10217 | } |
10218 | ||
10219 | ||
10220 | /* --------------------------------------------------------------------- */ | |
10221 | /* Function : XGI_GetVCLK2Ptr */ | |
10222 | /* Input : */ | |
10223 | /* Output : */ | |
10224 | /* Description : */ | |
10225 | /* --------------------------------------------------------------------- */ | |
e4147abe BP |
10226 | unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, |
10227 | unsigned short ModeIdIndex, | |
10228 | unsigned short RefreshRateTableIndex, | |
10229 | struct xgi_hw_device_info *HwDeviceExtension, | |
80adad85 | 10230 | struct vb_device_info *pVBInfo) |
d7636e0b | 10231 | { |
82d6eb5b | 10232 | unsigned short tempbx ; |
d7636e0b | 10233 | |
82d6eb5b BP |
10234 | unsigned short LCDXlat1VCLK[ 4 ] = { VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 } ; |
10235 | unsigned short LCDXlat2VCLK[ 4 ] = { VCLK108_2 + 5 , VCLK108_2 + 5 , VCLK108_2 + 5 , VCLK108_2 + 5 } ; | |
10236 | unsigned short LVDSXlat1VCLK[ 4 ] = { VCLK40 , VCLK40 , VCLK40 , VCLK40 } ; | |
10237 | unsigned short LVDSXlat2VCLK[ 4 ] = { VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 } ; | |
10238 | unsigned short LVDSXlat3VCLK[ 4 ] = { VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 } ; | |
d7636e0b | 10239 | |
82d6eb5b BP |
10240 | unsigned short CRT2Index , VCLKIndex ; |
10241 | unsigned short modeflag , resinfo ; | |
108afbf8 | 10242 | unsigned char *CHTVVCLKPtr = NULL ; |
d7636e0b | 10243 | |
10244 | if ( ModeNo <= 0x13 ) | |
10245 | { | |
10246 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ | |
10247 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; | |
10248 | CRT2Index = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; | |
10249 | } | |
10250 | else | |
10251 | { | |
10252 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ | |
10253 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; | |
10254 | CRT2Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ; | |
10255 | } | |
10256 | ||
10257 | if ( pVBInfo->IF_DEF_LVDS == 0 ) | |
10258 | { | |
10259 | CRT2Index = CRT2Index >> 6 ; /* for LCD */ | |
10260 | if ( ( ( pVBInfo->VBInfo & SetCRT2ToLCD ) | SetCRT2ToLCDA ) ) /*301b*/ | |
10261 | { | |
10262 | if ( pVBInfo->LCDResInfo != Panel1024x768 ) | |
10263 | { | |
10264 | VCLKIndex = LCDXlat2VCLK[ CRT2Index ] ; | |
10265 | } | |
10266 | else | |
10267 | { | |
10268 | VCLKIndex = LCDXlat1VCLK[ CRT2Index ] ; | |
10269 | } | |
10270 | } | |
10271 | else /* for TV */ | |
10272 | { | |
10273 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
10274 | { | |
10275 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) | |
10276 | { | |
10277 | if ( pVBInfo->SetFlag & RPLLDIV2XO ) | |
10278 | { | |
10279 | VCLKIndex = HiTVVCLKDIV2 ; | |
10280 | ||
10281 | ||
10282 | VCLKIndex += 25 ; | |
10283 | ||
10284 | } | |
10285 | else | |
10286 | { | |
10287 | VCLKIndex = HiTVVCLK ; | |
10288 | ||
10289 | ||
10290 | VCLKIndex += 25 ; | |
10291 | ||
10292 | } | |
10293 | ||
10294 | if ( pVBInfo->SetFlag & TVSimuMode ) | |
10295 | { | |
10296 | if( modeflag & Charx8Dot ) | |
10297 | { | |
10298 | VCLKIndex = HiTVSimuVCLK ; | |
10299 | ||
10300 | ||
10301 | VCLKIndex += 25 ; | |
10302 | ||
10303 | } | |
10304 | else | |
10305 | { | |
10306 | VCLKIndex = HiTVTextVCLK ; | |
10307 | ||
10308 | ||
10309 | VCLKIndex += 25 ; | |
10310 | ||
10311 | } | |
10312 | } | |
10313 | ||
10314 | if ( pVBInfo->VBType & VB_XGI301LV ) /* 301lv */ | |
10315 | { | |
10316 | if ( !( pVBInfo->VBExtInfo == VB_YPbPr1080i ) ) | |
10317 | { | |
10318 | VCLKIndex = YPbPr750pVCLK ; | |
10319 | if ( !( pVBInfo->VBExtInfo == VB_YPbPr750p ) ) | |
10320 | { | |
10321 | VCLKIndex = YPbPr525pVCLK ; | |
10322 | if ( !( pVBInfo->VBExtInfo == VB_YPbPr525p ) ) | |
10323 | { | |
10324 | VCLKIndex = YPbPr525iVCLK_2 ; | |
10325 | if ( !( pVBInfo->SetFlag & RPLLDIV2XO ) ) | |
10326 | VCLKIndex = YPbPr525iVCLK ; | |
10327 | } | |
10328 | } | |
10329 | } | |
10330 | } | |
10331 | } | |
10332 | else | |
10333 | { | |
10334 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) | |
10335 | { | |
10336 | if ( pVBInfo->SetFlag & RPLLDIV2XO ) | |
10337 | { | |
10338 | VCLKIndex = TVVCLKDIV2 ; | |
10339 | ||
10340 | ||
10341 | VCLKIndex += 25 ; | |
10342 | ||
10343 | } | |
10344 | else | |
10345 | { | |
10346 | VCLKIndex = TVVCLK ; | |
10347 | ||
10348 | ||
10349 | VCLKIndex += 25 ; | |
10350 | ||
10351 | } | |
10352 | } | |
10353 | } | |
10354 | } | |
10355 | else | |
10356 | { /* for CRT2 */ | |
108afbf8 | 10357 | VCLKIndex = (unsigned char)XGINew_GetReg2((pVBInfo->P3ca + 0x02)); /* Port 3cch */ |
d7636e0b | 10358 | VCLKIndex = ( ( VCLKIndex >> 2 ) & 0x03 ) ; |
10359 | if ( ModeNo > 0x13 ) | |
10360 | { | |
10361 | VCLKIndex = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ; /* di+Ext_CRTVCLK */ | |
10362 | VCLKIndex &= IndexMask ; | |
10363 | } | |
10364 | } | |
10365 | } | |
10366 | } | |
10367 | else | |
10368 | { /* LVDS */ | |
10369 | if ( ModeNo <= 0x13 ) | |
10370 | VCLKIndex = CRT2Index ; | |
10371 | else | |
10372 | VCLKIndex = CRT2Index ; | |
10373 | ||
10374 | if ( pVBInfo->IF_DEF_CH7005 == 1 ) | |
10375 | { | |
10376 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCD ) ) | |
10377 | { | |
10378 | VCLKIndex &= 0x1f ; | |
10379 | tempbx = 0 ; | |
10380 | ||
10381 | if ( pVBInfo->VBInfo & SetPALTV ) | |
10382 | tempbx += 2 ; | |
10383 | ||
10384 | if ( pVBInfo->VBInfo & SetCHTVOverScan ) | |
10385 | tempbx += 1 ; | |
10386 | ||
10387 | switch( tempbx ) | |
10388 | { | |
10389 | case 0: | |
10390 | CHTVVCLKPtr = pVBInfo->CHTVVCLKUNTSC ; | |
10391 | break ; | |
10392 | case 1: | |
10393 | CHTVVCLKPtr = pVBInfo->CHTVVCLKONTSC ; | |
10394 | break; | |
10395 | case 2: | |
10396 | CHTVVCLKPtr = pVBInfo->CHTVVCLKUPAL ; | |
10397 | break ; | |
10398 | case 3: | |
10399 | CHTVVCLKPtr = pVBInfo->CHTVVCLKOPAL ; | |
10400 | break ; | |
10401 | default: | |
10402 | break ; | |
10403 | } | |
10404 | ||
10405 | VCLKIndex = CHTVVCLKPtr[ VCLKIndex ] ; | |
10406 | } | |
10407 | } | |
10408 | else | |
10409 | { | |
10410 | VCLKIndex = VCLKIndex >> 6 ; | |
10411 | if ( ( pVBInfo->LCDResInfo == Panel800x600 ) || ( pVBInfo->LCDResInfo == Panel320x480 ) ) | |
10412 | VCLKIndex = LVDSXlat1VCLK[ VCLKIndex ] ; | |
10413 | else if ( ( pVBInfo->LCDResInfo == Panel1024x768 ) || ( pVBInfo->LCDResInfo == Panel1024x768x75 ) ) | |
10414 | VCLKIndex = LVDSXlat2VCLK[ VCLKIndex ] ; | |
10415 | else | |
10416 | VCLKIndex = LVDSXlat3VCLK[ VCLKIndex ] ; | |
10417 | } | |
10418 | } | |
10419 | /* VCLKIndex = VCLKIndex&IndexMask ; */ | |
10420 | ||
10421 | ||
10422 | ||
10423 | return( VCLKIndex ) ; | |
10424 | } | |
10425 |