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

📄 init301.c

📁 linux-2.4.29操作系统的源码
💻 C
📖 第 1 页 / 共 5 页
字号:
     }  }  return FALSE;}#endif/*********************************************//*          HELPER: DELAY FUNCTIONS          *//*********************************************/voidSiS_DDC2Delay(SiS_Private *SiS_Pr, USHORT delaytime){  USHORT i, j;  for(i=0; i<delaytime; i++) {     j += SiS_GetReg(SiS_Pr->SiS_P3c4,0x05);  }}static voidSiS_GenericDelay(SiS_Private *SiS_Pr, USHORT delay){  USHORT temp,flag;  flag = SiS_GetRegByte(0x61) & 0x10;  while(delay) {     temp = SiS_GetRegByte(0x61) & 0x10;     if(temp == flag) continue;     flag = temp;     delay--;  }}#ifdef SIS315Hstatic voidSiS_LongDelay(SiS_Private *SiS_Pr, USHORT delay){  while(delay--) {     SiS_GenericDelay(SiS_Pr,0x19df);  }}#endifstatic voidSiS_ShortDelay(SiS_Private *SiS_Pr, USHORT delay){  while(delay--) {     SiS_GenericDelay(SiS_Pr,0x42);  }}static voidSiS_PanelDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DelayTime){  UCHAR  *ROMAddr = HwInfo->pjVirtualRomBase;  USHORT PanelID, DelayIndex, Delay=0;  if(HwInfo->jChipType < SIS_315H) {#ifdef SIS300      PanelID = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36);      if(SiS_Pr->SiS_VBType & VB_SISVB) {         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 = (USHORT)ROMAddr[0x225];               else 	    	       Delay = (USHORT)ROMAddr[0x226];            }         }      }      SiS_ShortDelay(SiS_Pr, Delay);#endif  /* SIS300 */   } else {#ifdef SIS315H      if((HwInfo->jChipType >= SIS_661)    ||         (HwInfo->jChipType <= SIS_315PRO) ||	 (HwInfo->jChipType == SIS_330)) {         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 = (USHORT)ROMAddr[0x17e];                     } else {	    	        Delay = (USHORT)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(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,                      USHORT DelayTime, USHORT DelayLoop){   int i;   for(i=0; i<DelayLoop; i++) {      SiS_PanelDelay(SiS_Pr, HwInfo, DelayTime);   }}#endif/*********************************************//*    HELPER: WAIT-FOR-RETRACE FUNCTIONS     *//*********************************************/voidSiS_WaitRetrace1(SiS_Private *SiS_Pr){  USHORT 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);}static voidSiS_WaitRetrace2(SiS_Private *SiS_Pr, USHORT reg){  USHORT 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);}static voidSiS_WaitVBRetrace(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo){  if(HwInfo->jChipType < SIS_315H) {#ifdef SIS300     if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {        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(SiS_Private *SiS_Pr){  USHORT 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(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(SiS_Private *SiS_Pr){  if(SiS_GetReg(SiS_Pr->SiS_Part4Port,0x01) >= 0xb0) return TRUE;  return FALSE;}#endifstatic BOOLEANSiS_CRT2IsLCD(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo){  USHORT flag;  if(HwInfo->jChipType == SIS_730) {     flag = SiS_GetReg(SiS_Pr->SiS_P3c4,0x13);     if(flag & 0x20) return TRUE;  }  flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);  if(flag & 0x20) return TRUE;  return FALSE;}BOOLEANSiS_IsDualEdge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo){#ifdef SIS315H  USHORT flag;  if(HwInfo->jChipType >= SIS_315H) {     if((HwInfo->jChipType != SIS_650) || (SiS_GetReg(SiS_Pr->SiS_P3d4,0x5f) & 0xf0)) {        flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);        if(flag & EnableDualEdge) return TRUE;     }  }#endif  return FALSE;}BOOLEANSiS_IsVAMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo){#ifdef SIS315H  USHORT flag;  if(HwInfo->jChipType >= SIS_315H) {     flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);     if((flag & EnableDualEdge) && (flag & SetToLCDA)) return TRUE;  }#endif  return FALSE;}#ifdef SIS315Hstatic BOOLEANSiS_IsVAorLCD(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo){  if(SiS_IsVAMode(SiS_Pr,HwInfo))   return TRUE;  if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) return TRUE;  return FALSE;  }#endifstatic BOOLEANSiS_IsDualLink(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo){#ifdef SIS315H  if(HwInfo->jChipType >= SIS_315H) {     if((SiS_CRT2IsLCD(SiS_Pr, HwInfo)) ||        (SiS_IsVAMode(SiS_Pr, HwInfo))) {        if(SiS_Pr->SiS_LCDInfo & LCDDualLink) return TRUE;     }  }#endif  return FALSE;}#ifdef SIS315Hstatic BOOLEANSiS_TVEnabled(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo){  if((SiS_GetReg(SiS_Pr->SiS_Part2Port,0x00) & 0x0f) != 0x0c) return TRUE;  if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS301LV302LV)) {     if(SiS_GetReg(SiS_Pr->SiS_Part2Port,0x4d) & 0x10) return TRUE;  }  return FALSE;}#endif#ifdef SIS315Hstatic BOOLEANSiS_LCDAEnabled(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo){  if(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x13) & 0x04) return TRUE;  return FALSE;}#endif#ifdef SIS315Hstatic BOOLEANSiS_WeHaveBacklightCtrl(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo){  if((HwInfo->jChipType >= SIS_315H) && (HwInfo->jChipType < SIS_661)) {     if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x79) & 0x10) return TRUE;  }  return FALSE;}#endif#ifdef SIS315Hstatic BOOLEANSiS_IsNotM650orLater(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo){  USHORT flag;  if(HwInfo->jChipType == SIS_650) {     flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x5f);     flag &= 0xF0;     /* Check for revision != A0 only */     if((flag == 0xe0) || (flag == 0xc0) ||        (flag == 0xb0) || (flag == 0x90)) return FALSE;  } else if(HwInfo->jChipType >= SIS_661) return FALSE;  return TRUE;}#endif#ifdef SIS315Hstatic BOOLEANSiS_IsYPbPr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo){  USHORT flag;  if(HwInfo->jChipType >= SIS_315H) {     flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);     if(flag & EnableCHYPbPr) return TRUE;  /* = YPrPb = 0x08 */  }  return FALSE;}#endif#ifdef SIS315Hstatic BOOLEANSiS_IsChScart(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo){  USHORT flag;  if(HwInfo->jChipType >= SIS_315H) {     flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);     if(flag & EnableCHScart) return TRUE;  /* = Scart = 0x04 */  }  return FALSE;}

⌨️ 快捷键说明

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