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

📄 init301.c

📁 linux-2.4.29操作系统的源码
💻 C
📖 第 1 页 / 共 5 页
字号:
#endif#ifdef SIS315Hstatic BOOLEANSiS_IsTVOrYPbPrOrScart(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo){  USHORT flag;  if(HwInfo->jChipType >= 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 */     if(flag & EnableCHScart)      return TRUE;  /* = Scart = 0x04 - TW */  } else {     flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);     if(flag & SetCRT2ToTV)        return TRUE;  }  return FALSE;}#endif#ifdef SIS315Hstatic BOOLEANSiS_IsLCDOrLCDA(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo){  USHORT flag;  if(HwInfo->jChipType >= SIS_315H) {     flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);     if(flag & SetCRT2ToLCD) return TRUE;     flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);     if(flag & SetToLCDA)    return TRUE;  } else {     flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);     if(flag & SetCRT2ToLCD) return TRUE;  }  return FALSE;}#endifstatic BOOLEANSiS_BridgeIsOn(SiS_Private *SiS_Pr){  USHORT flag;  if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {     return TRUE;  } else if(SiS_Pr->SiS_VBType & VB_SISVB) {     flag = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x00);     if((flag == 1) || (flag == 2)) return TRUE;  }  return FALSE;}static BOOLEANSiS_BridgeIsEnabled(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo){  USHORT flag;  if(SiS_BridgeIsOn(SiS_Pr)) {     flag = SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00);     if(HwInfo->jChipType < SIS_315H) {       flag &= 0xa0;       if((flag == 0x80) || (flag == 0x20)) return TRUE;     } else {       flag &= 0x50;       if((flag == 0x40) || (flag == 0x10)) return TRUE;     }  }  return FALSE;}static BOOLEANSiS_BridgeInSlavemode(SiS_Private *SiS_Pr){  USHORT flag1;  flag1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x31);  if(flag1 & (SetInSlaveMode >> 8)) return TRUE;  return FALSE;}/*********************************************//*       GET VIDEO BRIDGE CONFIG INFO        *//*********************************************//* Setup general purpose IO for Chrontel communication */voidSiS_SetChrontelGPIO(SiS_Private *SiS_Pr, USHORT myvbinfo){   unsigned long  acpibase;   unsigned short temp;   if(!(SiS_Pr->SiS_ChSW)) return;#ifndef LINUX_XF86   SiS_SetRegLong(0xcf8,0x80000874);		       /* get ACPI base */   acpibase = SiS_GetRegLong(0xcfc);#else   acpibase = pciReadLong(0x00000800, 0x74);#endif   acpibase &= 0xFFFF;   temp = SiS_GetRegShort((USHORT)(acpibase + 0x3c));  /* ACPI register 0x3c: GP Event 1 I/O mode select */   temp &= 0xFEFF;   SiS_SetRegShort((USHORT)(acpibase + 0x3c), temp);   temp = SiS_GetRegShort((USHORT)(acpibase + 0x3c));   temp = SiS_GetRegShort((USHORT)(acpibase + 0x3a));  /* ACPI register 0x3a: GP Pin Level (low/high) */   temp &= 0xFEFF;   if(!(myvbinfo & SetCRT2ToTV)) temp |= 0x0100;   SiS_SetRegShort((USHORT)(acpibase + 0x3a), temp);   temp = SiS_GetRegShort((USHORT)(acpibase + 0x3a));}voidSiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,              PSIS_HW_INFO HwInfo, int checkcrt2mode){  USHORT tempax,tempbx,temp;  USHORT modeflag, resinfo=0;  if(ModeNo <= 0x13) {     modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;  } else if(SiS_Pr->UseCustomMode) {     modeflag = SiS_Pr->CModeFlag;  } else {     modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;     resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;  }  SiS_Pr->SiS_SetFlag = 0;  SiS_Pr->SiS_ModeType = modeflag & ModeInfoFlag;  tempbx = 0;  if(SiS_BridgeIsOn(SiS_Pr)) {    	temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);#if 0   	if(HwInfo->jChipType < SIS_661) {	   /* NO - YPbPr not set yet ! */	   if(SiS_Pr->SiS_YPbPr & <all ypbpr except 525i>) {	      temp &= (SetCRT2ToHiVision | SwitchCRT2 | SetSimuScanMode); 	/* 0x83 */	      temp |= SetCRT2ToHiVision;   					/* 0x80 */   	   }	   if(SiS_Pr->SiS_YPbPr & <ypbpr525i>) {	      temp &= (SetCRT2ToHiVision | SwitchCRT2 | SetSimuScanMode); 	/* 0x83 */	      temp |= SetCRT2ToSVIDEO;  					/* 0x08 */	   }	}#endif    	tempbx |= temp;    	tempax = SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) << 8;        tempax &= (DriverMode | LoadDACFlag | SetNotSimuMode | SetPALTV);    	tempbx |= tempax;#ifdef SIS315H	if(HwInfo->jChipType >= SIS_315H) {    	   if(SiS_Pr->SiS_VBType & (VB_SIS301C|VB_SIS302B|VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV)) {	      if(ModeNo == 0x03) {	         /* Mode 0x03 is never in driver mode */		 SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x31,0xbf);	      }	      if(!(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & (DriverMode >> 8))) {	         /* Reset LCDA setting if not driver mode */		 SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc);	      }	      if(IS_SIS650) {	         if(SiS_Pr->SiS_UseLCDA) {		    if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x5f) & 0xF0) {		       if((ModeNo <= 0x13) || (!(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & (DriverMode >> 8)))) {		          SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x38,(EnableDualEdge | SetToLCDA));		       }		    }		 }	      }	      temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);       	      if((temp & (EnableDualEdge | SetToLCDA)) == (EnableDualEdge | SetToLCDA)) {          	 tempbx |= SetCRT2ToLCDA;	      }	   }	   if(SiS_Pr->SiS_VBType & (VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV)) {	      tempbx &= ~(SetCRT2ToRAMDAC);	   }	   if(HwInfo->jChipType >= SIS_661) {	      tempbx &= ~(SetCRT2ToYPbPr525750 | SetCRT2ToHiVision);	      temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);	      if(SiS_Pr->SiS_VBType & (VB_SIS301C|VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV)) {	         if(temp & 0x04) {		    temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35) & 0xe0;		    if(temp == 0x60) tempbx |= SetCRT2ToHiVision;		    else             tempbx |= SetCRT2ToYPbPr525750;		 }	      } else if(SiS_Pr->SiS_VBType & (VB_SIS301 | VB_SIS301B | VB_SIS302B)) {	         if(temp & 0x04) {		    temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35) & 0xe0;		    if(temp == 0x60) tempbx |= SetCRT2ToHiVision;		 }	      }  	   }	   if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {	      temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);	      if(temp & SetToLCDA) {		 tempbx |= SetCRT2ToLCDA;	      }	      if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {	         if(temp & EnableCHYPbPr) {		    tempbx |= SetCRT2ToCHYPbPr;		 }	      }	   }	}#endif  /* SIS315H */    	if(SiS_Pr->SiS_VBType & VB_SISVB) {	   temp = SetCRT2ToSVIDEO   |	          SetCRT2ToAVIDEO   |	          SetCRT2ToSCART    |	          SetCRT2ToLCDA     |	          SetCRT2ToLCD      |	          SetCRT2ToRAMDAC   |                  SetCRT2ToHiVision |		  SetCRT2ToYPbPr525750;    	} else {           if(HwInfo->jChipType >= SIS_315H) {              if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {        	 temp = SetCRT2ToAVIDEO |		        SetCRT2ToSVIDEO |		        SetCRT2ToSCART  |		        SetCRT2ToLCDA   |		        SetCRT2ToLCD    |		        SetCRT2ToCHYPbPr;      	      } else {        	 temp = SetCRT2ToLCDA   |		        SetCRT2ToLCD;	      }	   } else {      	      if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {          	 temp = SetCRT2ToTV | SetCRT2ToLCD;              } else {        	 temp = SetCRT2ToLCD;	      }	   }    	}    	if(!(tempbx & temp)) {      	   tempax = DisableCRT2Display;      	   tempbx = 0;    	}   	if(SiS_Pr->SiS_VBType & VB_SISVB) {	   USHORT clearmask = ( DriverMode 	   |				DisableCRT2Display |				LoadDACFlag 	   |				SetNotSimuMode 	   |				SetInSlaveMode 	   |				SetPALTV 	   |				SwitchCRT2	   |				SetSimuScanMode );      	   if(tempbx & SetCRT2ToLCDA)        tempbx &= (clearmask | SetCRT2ToLCDA);	   if(tempbx & SetCRT2ToRAMDAC)      tempbx &= (clearmask | SetCRT2ToRAMDAC);	   if(tempbx & SetCRT2ToLCD)         tempbx &= (clearmask | SetCRT2ToLCD);	   if(tempbx & SetCRT2ToSCART)       tempbx &= (clearmask | SetCRT2ToSCART);	   if(tempbx & SetCRT2ToHiVision)    tempbx &= (clearmask | SetCRT2ToHiVision);	   if(tempbx & SetCRT2ToYPbPr525750) tempbx &= (clearmask | SetCRT2ToYPbPr525750);   	} else {	   if(HwInfo->jChipType >= SIS_315H) {	      if(tempbx & SetCRT2ToLCDA) {	         tempbx &= (0xFF00|SwitchCRT2|SetSimuScanMode);	      }	   }      	   if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {              if(tempbx & SetCRT2ToTV) {          	 tempbx &= (0xFF00|SetCRT2ToTV|SwitchCRT2|SetSimuScanMode);	      }      	   }      	   if(tempbx & SetCRT2ToLCD) {              tempbx &= (0xFF00|SetCRT2ToLCD|SwitchCRT2|SetSimuScanMode);	   }	   if(HwInfo->jChipType >= SIS_315H) {	      if(tempbx & SetCRT2ToLCDA) {	         tempbx |= SetCRT2ToLCD;	      }	   }	}    	if(tempax & DisableCRT2Display) {      	   if(!(tempbx & (SwitchCRT2 | SetSimuScanMode))) {              tempbx = SetSimuScanMode | DisableCRT2Display;      	   }    	}    	if(!(tempbx & DriverMode)) tempbx |= SetSimuScanMode;	/* LVDS/CHRONTEL (LCD/TV) and 301BDH (LCD) can only be slave in 8bpp modes */	if(SiS_Pr->SiS_ModeType <= ModeVGA) {	   if( (SiS_Pr->SiS_IF_DEF_LVDS == 1) ||	       ((SiS_Pr->SiS_VBType & VB_NoLCD) && (tempbx & SetCRT2ToLCD)) ) {	       modeflag &= (~CRT2Mode);	   }	}    	if(!(tempbx & SetSimuScanMode)) {      	   if(tempbx & SwitchCRT2) {              if((!(modeflag & CRT2Mode)) && (checkcrt2mode)) {		 if( (HwInfo->jChipType >= SIS_315H) &&		     (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) ) {		    if(resinfo != SIS_RI_1600x1200) {                       tempbx |= SetSimuScanMode;		    }		 } else {            	    tempbx |= SetSimuScanMode;	         }              }      	   } else {              if(SiS_BridgeIsEnabled(SiS_Pr,HwInfo)) {          	 if(!(tempbx & DriverMode)) {            	    if(SiS_BridgeInSlavemode(SiS_Pr)) {		       tempbx |= SetSimuScanMode;            	    }                 }              }      	   }    	}    	if(!(tempbx & DisableCRT2Display)) {           if(tempbx & DriverMode) {              if(tempbx & SetSimuScanMode) {          	 if((!(modeflag & CRT2Mode)) && (checkcrt2mode)) {	            if( (HwInfo->jChipType >= SIS_315H) &&		        (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) ) {		       if(resinfo != SIS_RI_1600x1200) {		          tempbx |= SetInSlaveMode;		       }		    } else {            	       tempbx |= SetInSlaveMode;                    }	         }              }           } else {              tempbx |= SetInSlaveMode;      	   }    	}  }  SiS_Pr->SiS_VBInfo = tempbx;  if(HwInfo->jChipType == SIS_630) {     SiS_SetChrontelGPIO(SiS_Pr, SiS_Pr->SiS_VBInfo);  }#ifdef TWDEBUG#ifdef LINUX_KERNEL  printk(KERN_DEBUG "sisfb: (VBInfo= 0x%04x, SetFlag=0x%04x)\n",      SiS_Pr->SiS_VBInfo, SiS_Pr->SiS_SetFlag);#endif#ifdef LINUX_XF86  xf86DrvMsgVerb(0, X_PROBED, 3, "(init301: VBInfo=0x%04x, SetFlag=0x%04x)\n",      SiS_Pr->SiS_VBInfo, SiS_Pr->SiS_SetFlag);#endif#endif}/*********************************************//*           DETERMINE YPbPr MODE            *//*********************************************/voidSiS_SetYPbPr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo){  UCHAR temp;  /* Note: This variable is only used on 30xLV systems.   * CR38 has a different meaning on LVDS/CH7019 systems.   * On 661 and later, these bits moved to CR35.   *   * On 301, 301B, only HiVision 1080i is supported.   * On 30xLV, 301C, only YPbPr 1080i is supported.   */  SiS_Pr->SiS_YPbPr = 0;  if(HwInfo->jChipType >= SIS_661) return;  if(SiS_Pr->SiS_VBType) {     if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {	SiS_Pr->SiS_YPbPr = YPbPrHiVision;     }  }  if(HwInfo->jChipType >= SIS_315H) {     if(SiS_Pr->SiS_VBType & (VB_SIS301LV302LV | VB_SIS301C)) {        temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);	if(temp & 0x08) {	   switch((temp >> 4)) {	   case 0x00: SiS_Pr->SiS_YPbPr = YPbPr525i;     break;	   case 0x01: SiS_Pr->SiS_YPbPr = YPbPr525p;     break;	   case 0x02: SiS_Pr->SiS_YPbPr = YPbPr750p;     break;	   case 0x03: SiS_Pr->SiS_YPbPr = YPbPrHiVision; break;	   }	}     }  }}

⌨️ 快捷键说明

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