SiS_SetVCLKState(SiS_Pr, HwInfo, ModeNo, RefreshRateTableIndex, ModeIdIndex); 
SiS_SetVCLKState(SiS_Pr, ModeNo, RRTI, ModeIdIndex); 
SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,                    USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex){  USHORT data,infoflag=0,modeflag;  USHORT resindex,xres;#ifdef SIS315H  USHORT data2,data3;  ULONG  longdata;  UCHAR  *ROMAddr  = HwInfo->pjVirtualRomBase;#endif  if(SiS_Pr->UseCustomMode) {     modeflag = SiS_Pr->CModeFlag;     infoflag = SiS_Pr->CInfoFlag;     xres = SiS_Pr->CHDisplay;  } else {     resindex = SiS_GetResInfo(SiS_Pr,ModeNo,ModeIdIndex);     if(ModeNo > 0x13) {    	modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;    	infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag;	xres = SiS_Pr->SiS_ModeResInfo[resindex].HTotal;     } else {    	modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;	xres = SiS_Pr->SiS_StResInfo[resindex].HTotal;     }  }  /* Disable DPMS */  SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1F,0x3F);  data = 0;  if(ModeNo > 0x13) {     if(SiS_Pr->SiS_ModeType > ModeEGA) {        data |= 0x02;        data |= ((SiS_Pr->SiS_ModeType - ModeVGA) << 2);     }     if(infoflag & InterlaceMode) data |= 0x20;  }  SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x06,0xC0,data);  if(HwInfo->jChipType != SIS_300) {     data = 0;     if(infoflag & InterlaceMode) {        if(xres <= 800)       data = 0x0020;        else if(xres <= 1024) data = 0x0035;        else                  data = 0x0048;     }     SiS_SetReg(SiS_Pr->SiS_P3d4,0x19,(data & 0xFF));     SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x1a,0xFC,(data >> 8));  }  if(modeflag & HalfDCLK) {     SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x08);  }  data = 0;  if(modeflag & LineCompareOff) data = 0x08;  if(HwInfo->jChipType == SIS_300) {     SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xF7,data);  } else {     SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xB7,data);     if(SiS_Pr->SiS_ModeType == ModeEGA) {        if(ModeNo > 0x13) {  	   SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x0F,0x40);        }     }  }  if(HwInfo->jChipType >= SIS_661) {     SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x31,0xfb);  }#ifdef SIS315H  if(HwInfo->jChipType == SIS_315PRO) {     data = SiS_Get310DRAMType(SiS_Pr, HwInfo);     data = SiS_Pr->SiS_SR15[2][data];     if(SiS_Pr->SiS_ModeType == ModeText) {        data &= 0xc7;     } else {        data2 = SiS_GetOffset(SiS_Pr,ModeNo,ModeIdIndex,                              RefreshRateTableIndex,HwInfo);	data2 >>= 1;	if(infoflag & InterlaceMode) data2 >>= 1;	data3 = SiS_GetColorDepth(SiS_Pr,ModeNo,ModeIdIndex) >> 1;	if(!data3) data3++;	data2 /= data3;	if(data2 >= 0x50) {	   data &= 0x0f;	   data |= 0x50;	}     }     SiS_SetReg(SiS_Pr->SiS_P3c4,0x17,data);  } else if( (HwInfo->jChipType == SIS_330) ||             ((HwInfo->jChipType == SIS_760) && (SiS_Pr->SiS_SysFlags & SF_760LFB))) {     data = SiS_Get310DRAMType(SiS_Pr, HwInfo);     if(HwInfo->jChipType == SIS_330) {        data = SiS_Pr->SiS_SR15[2][data];     } else {        if(SiS_Pr->SiS_ROMNew) 	    data = ROMAddr[0xf6];        else if(SiS_Pr->SiS_UseROM) data = ROMAddr[0x100 + data];	else                        data = 0xba;     }     if(SiS_Pr->SiS_ModeType <= ModeEGA) {        data &= 0xc7;     } else {        if(SiS_Pr->UseCustomMode) {	   data2 = SiS_Pr->CSRClock;	} else {           data2 = SiS_GetVCLK2Ptr(SiS_Pr,ModeNo,ModeIdIndex,                                   RefreshRateTableIndex,HwInfo);           data2 = SiS_Pr->SiS_VCLKData[data2].CLOCK;	}	data3 = SiS_GetColorDepth(SiS_Pr,ModeNo,ModeIdIndex) >> 1;	if(data3) data2 *= data3;	longdata = SiS_GetMCLK(SiS_Pr, HwInfo) * 1024;	data2 = longdata / data2;	if(HwInfo->jChipType == SIS_330) {	   if(SiS_Pr->SiS_ModeType != Mode16Bpp) {              if     (data2 >= 0x19c) data = 0xba;	      else if(data2 >= 0x140) data = 0x7a;	      else if(data2 >= 0x101) data = 0x3a;	      else if(data2 >= 0xf5)  data = 0x32;	      else if(data2 >= 0xe2)  data = 0x2a;	      else if(data2 >= 0xc4)  data = 0x22;	      else if(data2 >= 0xac)  data = 0x1a;	      else if(data2 >= 0x9e)  data = 0x12;	      else if(data2 >= 0x8e)  data = 0x0a;	      else                    data = 0x02;	   } else {	      if(data2 >= 0x127)      data = 0xba;	      else                    data = 0x7a;	   }	} else {  /* 760+LFB */	   if     (data2 >= 0x190) data = 0xba;	   else if(data2 >= 0xff)  data = 0x7a;	   else if(data2 >= 0xd3)  data = 0x3a;	   else if(data2 >= 0xa9)  data = 0x1a;	   else if(data2 >= 0x93)  data = 0x0a;	   else                    data = 0x02;	}     }     SiS_SetReg(SiS_Pr->SiS_P3c4,0x17,data);  } else if(HwInfo->jChipType == SIS_340) {     /* TODO */  }#endif  data = 0x60;  if(SiS_Pr->SiS_ModeType != ModeText) {     data ^= 0x60;     if(SiS_Pr->SiS_ModeType != ModeEGA) {        data ^= 0xA0;     }  }  SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x21,0x1F,data);  SiS_SetVCLKState(SiS_Pr, HwInfo, ModeNo, RefreshRateTableIndex, ModeIdIndex);#ifdef SIS315H  if(HwInfo->jChipType >= SIS_315H) {     if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & 0x40) {        SiS_SetReg(SiS_Pr->SiS_P3d4,0x52,0x2c);     } else {        SiS_SetReg(SiS_Pr->SiS_P3d4,0x52,0x6c);     }  }#endif}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/544393fe584d333480659a4bed30f5295355df11/init.c/clean/drivers/video/sis/init.c