⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 init301.c

📁 linux-2.6.15.6
💻 C
📖 第 1 页 / 共 5 页
字号:
static BOOLEANSiS_CR36BIOSWord23d(struct SiS_Private *SiS_Pr){   unsigned char  *ROMAddr = SiS_Pr->VirtualRomBase;   unsigned short temp,temp1;   if(SiS_Pr->SiS_UseROM) {      if((ROMAddr[0x233] == 0x12) && (ROMAddr[0x234] == 0x34)) {	 temp = 1 << ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) >> 4) & 0x0f);	 temp1 = SISGETROMW(0x23d);	 if(temp1 & temp) return TRUE;      }   }   return FALSE;}#endif/*********************************************//*          HELPER: DELAY FUNCTIONS          *//*********************************************/voidSiS_DDC2Delay(struct SiS_Private *SiS_Pr, unsigned int delaytime){   unsigned int i, j;   for(i = 0; i < delaytime; i++) {      j += SiS_GetReg(SiS_Pr->SiS_P3c4,0x05);   }}#if defined(SIS300) || defined(SIS315H)static voidSiS_GenericDelay(struct SiS_Private *SiS_Pr, unsigned short delay){   SiS_DDC2Delay(SiS_Pr, delay * 36);}#endif#ifdef SIS315Hstatic voidSiS_LongDelay(struct SiS_Private *SiS_Pr, unsigned short delay){   while(delay--) {      SiS_GenericDelay(SiS_Pr, 6623);   }}#endif#if defined(SIS300) || defined(SIS315H)static voidSiS_ShortDelay(struct SiS_Private *SiS_Pr, unsigned short delay){   while(delay--) {      SiS_GenericDelay(SiS_Pr, 66);   }}#endifstatic voidSiS_PanelDelay(struct SiS_Private *SiS_Pr, unsigned short DelayTime){#if defined(SIS300) || defined(SIS315H)   unsigned char  *ROMAddr = SiS_Pr->VirtualRomBase;   unsigned short PanelID, DelayIndex, Delay=0;#endif   if(SiS_Pr->ChipType < SIS_315H) {#ifdef SIS300      PanelID = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36);      if(SiS_Pr->SiS_VBType & VB_SISVB) {	 if(SiS_Pr->SiS_VBType & VB_SIS301) PanelID &= 0xf7;	 if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x18) & 0x10)) PanelID = 0x12;      }      DelayIndex = PanelID >> 4;      if((DelayTime >= 2) && ((PanelID & 0x0f) == 1))  {	 Delay = 3;      } else {	 if(DelayTime >= 2) DelayTime -= 2;	 if(!(DelayTime & 0x01)) {	    Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[0];	 } else {	    Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[1];	 }	 if(SiS_Pr->SiS_UseROM) {	    if(ROMAddr[0x220] & 0x40) {	       if(!(DelayTime & 0x01)) Delay = (unsigned short)ROMAddr[0x225];	       else 	    	       Delay = (unsigned short)ROMAddr[0x226];	    }	 }      }      SiS_ShortDelay(SiS_Pr, Delay);#endif  /* SIS300 */   } else {#ifdef SIS315H      if((SiS_Pr->ChipType >= SIS_661)    ||	 (SiS_Pr->ChipType <= SIS_315PRO) ||	 (SiS_Pr->ChipType == SIS_330)    ||	 (SiS_Pr->SiS_ROMNew)) {	 if(!(DelayTime & 0x01)) {	    SiS_DDC2Delay(SiS_Pr, 0x1000);	 } else {	    SiS_DDC2Delay(SiS_Pr, 0x4000);	 }      } else if((SiS_Pr->SiS_IF_DEF_LVDS == 1) /* ||	 (SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||	 (SiS_Pr->SiS_CustomT == CUT_CLEVO1400) */ ) {			/* 315 series, LVDS; Special */	 if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) {	    PanelID = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36);	    if(SiS_Pr->SiS_CustomT == CUT_CLEVO1400) {	       if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x1b) & 0x10)) PanelID = 0x12;	    }	    if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) {	       DelayIndex = PanelID & 0x0f;	    } else {	       DelayIndex = PanelID >> 4;	    }	    if((DelayTime >= 2) && ((PanelID & 0x0f) == 1))  {	       Delay = 3;	    } else {	       if(DelayTime >= 2) DelayTime -= 2;	       if(!(DelayTime & 0x01)) {		  Delay = SiS_Pr->SiS_PanelDelayTblLVDS[DelayIndex].timer[0];		} else {		  Delay = SiS_Pr->SiS_PanelDelayTblLVDS[DelayIndex].timer[1];	       }	       if((SiS_Pr->SiS_UseROM) && (!(SiS_Pr->SiS_ROMNew))) {		  if(ROMAddr[0x13c] & 0x40) {		     if(!(DelayTime & 0x01)) {			Delay = (unsigned short)ROMAddr[0x17e];		     } else {			Delay = (unsigned short)ROMAddr[0x17f];		     }		  }	       }	    }	    SiS_ShortDelay(SiS_Pr, Delay);	 }      } else if(SiS_Pr->SiS_VBType & VB_SISVB) {			/* 315 series, all bridges */	 DelayIndex = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) >> 4;	 if(!(DelayTime & 0x01)) {	    Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[0];	 } else {	    Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[1];	 }	 Delay <<= 8;	 SiS_DDC2Delay(SiS_Pr, Delay);      }#endif /* SIS315H */   }}#ifdef SIS315Hstatic voidSiS_PanelDelayLoop(struct SiS_Private *SiS_Pr, unsigned short DelayTime, unsigned short DelayLoop){   int i;   for(i = 0; i < DelayLoop; i++) {      SiS_PanelDelay(SiS_Pr, DelayTime);   }}#endif/*********************************************//*    HELPER: WAIT-FOR-RETRACE FUNCTIONS     *//*********************************************/voidSiS_WaitRetrace1(struct SiS_Private *SiS_Pr){   unsigned short watchdog;   if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x1f) & 0xc0) return;   if(!(SiS_GetReg(SiS_Pr->SiS_P3d4,0x17) & 0x80)) return;   watchdog = 65535;   while((SiS_GetRegByte(SiS_Pr->SiS_P3da) & 0x08) && --watchdog);   watchdog = 65535;   while((!(SiS_GetRegByte(SiS_Pr->SiS_P3da) & 0x08)) && --watchdog);}#if defined(SIS300) || defined(SIS315H)static voidSiS_WaitRetrace2(struct SiS_Private *SiS_Pr, unsigned short reg){   unsigned short watchdog;   watchdog = 65535;   while((SiS_GetReg(SiS_Pr->SiS_Part1Port,reg) & 0x02) && --watchdog);   watchdog = 65535;   while((!(SiS_GetReg(SiS_Pr->SiS_Part1Port,reg) & 0x02)) && --watchdog);}#endifstatic voidSiS_WaitVBRetrace(struct SiS_Private *SiS_Pr){   if(SiS_Pr->ChipType < SIS_315H) {#ifdef SIS300      if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) {	 if(!(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0x20)) return;      }      if(!(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0x80)) {	 SiS_WaitRetrace1(SiS_Pr);      } else {	 SiS_WaitRetrace2(SiS_Pr, 0x25);      }#endif   } else {#ifdef SIS315H      if(!(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0x40)) {	 SiS_WaitRetrace1(SiS_Pr);      } else {	 SiS_WaitRetrace2(SiS_Pr, 0x30);      }#endif   }}static voidSiS_VBWait(struct SiS_Private *SiS_Pr){   unsigned short tempal,temp,i,j;   temp = 0;   for(i = 0; i < 3; i++) {     for(j = 0; j < 100; j++) {        tempal = SiS_GetRegByte(SiS_Pr->SiS_P3da);        if(temp & 0x01) {	   if((tempal & 0x08))  continue;	   else break;        } else {	   if(!(tempal & 0x08)) continue;	   else break;        }     }     temp ^= 0x01;   }}static voidSiS_VBLongWait(struct SiS_Private *SiS_Pr){   if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {      SiS_VBWait(SiS_Pr);   } else {      SiS_WaitRetrace1(SiS_Pr);   }}/*********************************************//*               HELPER: MISC                *//*********************************************/#ifdef SIS300static BOOLEANSiS_Is301B(struct SiS_Private *SiS_Pr){   if(SiS_GetReg(SiS_Pr->SiS_Part4Port,0x01) >= 0xb0) return TRUE;   return FALSE;}#endifstatic BOOLEANSiS_CRT2IsLCD(struct SiS_Private *SiS_Pr){   if(SiS_Pr->ChipType == SIS_730) {      if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x20) return TRUE;   }   if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x30) & 0x20) return TRUE;   return FALSE;}BOOLEANSiS_IsDualEdge(struct SiS_Private *SiS_Pr){#ifdef SIS315H   if(SiS_Pr->ChipType >= SIS_315H) {      if((SiS_Pr->ChipType != SIS_650) || (SiS_GetReg(SiS_Pr->SiS_P3d4,0x5f) & 0xf0)) {	 if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x38) & EnableDualEdge) return TRUE;      }   }#endif   return FALSE;}BOOLEANSiS_IsVAMode(struct SiS_Private *SiS_Pr){#ifdef SIS315H   unsigned short flag;   if(SiS_Pr->ChipType >= SIS_315H) {      flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);      if((flag & EnableDualEdge) && (flag & SetToLCDA)) return TRUE;   }#endif   return FALSE;}#ifdef SIS315Hstatic BOOLEANSiS_IsVAorLCD(struct SiS_Private *SiS_Pr){   if(SiS_IsVAMode(SiS_Pr))  return TRUE;   if(SiS_CRT2IsLCD(SiS_Pr)) return TRUE;   return FALSE;}#endifstatic BOOLEANSiS_IsDualLink(struct SiS_Private *SiS_Pr){#ifdef SIS315H   if(SiS_Pr->ChipType >= SIS_315H) {      if((SiS_CRT2IsLCD(SiS_Pr)) ||         (SiS_IsVAMode(SiS_Pr))) {	 if(SiS_Pr->SiS_LCDInfo & LCDDualLink) return TRUE;      }   }#endif   return FALSE;}#ifdef SIS315Hstatic BOOLEANSiS_TVEnabled(struct SiS_Private *SiS_Pr){   if((SiS_GetReg(SiS_Pr->SiS_Part2Port,0x00) & 0x0f) != 0x0c) return TRUE;   if(SiS_Pr->SiS_VBType & VB_SISYPBPR) {      if(SiS_GetReg(SiS_Pr->SiS_Part2Port,0x4d) & 0x10) return TRUE;   }   return FALSE;}#endif#ifdef SIS315Hstatic BOOLEANSiS_LCDAEnabled(struct SiS_Private *SiS_Pr){   if(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x13) & 0x04) return TRUE;   return FALSE;}#endif#ifdef SIS315Hstatic BOOLEANSiS_WeHaveBacklightCtrl(struct SiS_Private *SiS_Pr){   if((SiS_Pr->ChipType >= SIS_315H) && (SiS_Pr->ChipType < SIS_661)) {      if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x79) & 0x10) return TRUE;   }   return FALSE;}#endif#ifdef SIS315Hstatic BOOLEANSiS_IsNotM650orLater(struct SiS_Private *SiS_Pr){   unsigned short flag;   if(SiS_Pr->ChipType == SIS_650) {      flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x5f) & 0xf0;      /* Check for revision != A0 only */      if((flag == 0xe0) || (flag == 0xc0) ||         (flag == 0xb0) || (flag == 0x90)) return FALSE;   } else if(SiS_Pr->ChipType >= SIS_661) return FALSE;   return TRUE;}#endif#ifdef SIS315Hstatic BOOLEANSiS_IsYPbPr(struct SiS_Private *SiS_Pr){   if(SiS_Pr->ChipType >= SIS_315H) {      /* YPrPb = 0x08 */      if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x38) & EnableCHYPbPr) return TRUE;   }   return FALSE;}#endif#ifdef SIS315Hstatic BOOLEANSiS_IsChScart(struct SiS_Private *SiS_Pr){   if(SiS_Pr->ChipType >= SIS_315H) {      /* Scart = 0x04 */      if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x38) & EnableCHScart) return TRUE;   }   return FALSE;}#endif#ifdef SIS315Hstatic BOOLEANSiS_IsTVOrYPbPrOrScart(struct SiS_Private *SiS_Pr){   unsigned short flag;   if(SiS_Pr->ChipType >= SIS_315H) {      flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);      if(flag & SetCRT2ToTV)        return TRUE;      flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);      if(flag & EnableCHYPbPr)      return TRUE;  /* = YPrPb = 0x08 */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -