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

📄 init301.c

📁 一个2.4.21版本的嵌入式linux内核
💻 C
📖 第 1 页 / 共 5 页
字号:
#ifdef SIS300   /* ------------- 300 series --------------*/    		temp = (SiS_Pr->SiS_VGAHT - 1) & 0x0FF;   			/* BTVGA2HT 0x08,0x09 */    		SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,temp);                   /* TW: CRT2 Horizontal Total */    		temp = (((SiS_Pr->SiS_VGAHT - 1) & 0xFF00) >> 8) << 4;    		SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0x0f,temp);          /* TW: CRT2 Horizontal Total Overflow [7:4] */    		temp = (SiS_Pr->SiS_VGAHDE + 12) & 0x0FF;                       /* BTVGA2HDEE 0x0A,0x0C */    		SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0A,temp);                   /* TW: CRT2 Horizontal Display Enable End */    		pushbx = SiS_Pr->SiS_VGAHDE + 12;                               /* bx  BTVGA@HRS 0x0B,0x0C */    		tempcx = (SiS_Pr->SiS_VGAHT - SiS_Pr->SiS_VGAHDE) >> 2;    		tempbx = pushbx + tempcx;    		tempcx <<= 1;    		tempcx += tempbx;    		if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {      			if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC){			        /* CRT1Index &= 0x3F; - Not any longer */        			tempbx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[4];        			tempbx |= ((SiS_Pr->SiS_CRT1Table[CRT1Index].CR[14] & 0xC0) << 2);        			tempbx = (tempbx - 1) << 3;        			tempcx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[5];        			tempcx &= 0x1F;        			temp = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[15];        			temp = (temp & 0x04) << (6-2);        			tempcx = (tempcx | temp);				tempcx--;				tempcx <<= 3;      			}    			if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (resinfo == 0x08)){        			if(!(SiS_Pr->SiS_VBInfo & SetPALTV)){      					tempbx = 1040;      					tempcx = 1042;      				}    			}	        }    		temp = tempbx & 0x00FF;    		SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0B,temp);                   /* TW: CRT2 Horizontal Retrace Start */#endif /* SIS300 */ 	} else {#ifdef SIS315H  /* ----------------- 310/325/330 series ------------- */	        tempcx = SiS_Pr->SiS_VGAHT;				       /* BTVGA2HT 0x08,0x09 */		pushcx = tempcx;		if(modeflag & HalfDCLK) {#ifndef NEWCH701x				    if((SiS_Pr->SiS_IF_DEF_LVDS == 1) && (SiS_Pr->SiS_IF_DEF_CH70xx == 0)) {#endif		    		          tempax = SiS_Pr->SiS_VGAHDE >> 1;			  tempcx = SiS_Pr->SiS_HT - SiS_Pr->SiS_HDE + tempax;			  if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {			      tempcx = SiS_Pr->SiS_HT - tempax;			  }#ifndef NEWCH701x					  		    } else {			  tempcx >>= 1;		    }#endif		    		}		tempcx--;		temp = tempcx & 0xff;		SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,temp);                  /* TW: CRT2 Horizontal Total */		temp = ((tempcx & 0xff00) >> 8) << 4;		SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0x0F,temp);         /* TW: CRT2 Horizontal Total Overflow [7:4] */		tempcx = pushcx;					       /* BTVGA2HDEE 0x0A,0x0C */		tempbx = SiS_Pr->SiS_VGAHDE;		tempcx -= tempbx;		tempcx >>= 2;		if(modeflag & HalfDCLK) {		    tempbx >>= 1;		    tempcx >>= 1;		}		tempbx += 16;		temp = tempbx & 0xff;		SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0A,temp);                  /* TW: CRT2 Horizontal Display Enable End */		pushbx = tempbx;		tempcx >>= 1;		tempbx += tempcx;		tempcx += tempbx;		if(SiS_Pr->SiS_IF_DEF_LVDS==0) {             	   if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) {                	tempbx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[4];                	tempbx |= ((SiS_Pr->SiS_CRT1Table[CRT1Index].CR[14] & 0xC0) << 2);                	tempbx = (tempbx - 3) << 3;         		/*(VGAHRS-3)*8 */                	tempcx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[5];               		tempcx &= 0x1F;                	temp = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[15];                	temp = (temp & 0x04) << (5-2);      		/* VGAHRE D[5] */                	tempcx = (tempcx | temp);	  	  	/* (VGAHRE-3)*8 */			tempcx -= 3;			tempcx <<= 3;			tempcx &= 0x00FF;			tempcx |= (tempbx & 0xFF00);                	tempbx += 16;                	tempcx += 16;			tempax = SiS_Pr->SiS_VGAHT;			if(modeflag & HalfDCLK)  tempax >>= 1;			tempax--;			if(tempcx > tempax)  tempcx = tempax;             	   }         	   if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (resinfo == 0x08)){             	      if(!(SiS_Pr->SiS_VBInfo & SetPALTV)){      		 	 tempbx = 1040;      		 	 tempcx = 1042;      	     	      }         	   }		   /* TW: Makes no sense, but is in 650/302LV 1.10.6s */         	   if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (resinfo == 0x08)){		      if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV)) {             	         if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) {      		 	    tempbx = 1040;      		 	    tempcx = 1042;      	     	         }		      }         	   }                }		temp = tempbx & 0xff;	 	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0B,temp);                 /* TW: CRT2 Horizontal Retrace Start */#endif  /* SIS315H */     	}  /* 310/325/330 series */  	/* TW: The following is done for all bridge/chip types/series */  	tempax = tempbx & 0xFF00;  	tempbx = pushbx;  	tempbx = (tempbx & 0x00FF) | ((tempbx & 0xFF00) << 4);  	tempax |= (tempbx & 0xFF00);  	temp = (tempax & 0xFF00) >> 8;  	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0C,temp);                        /* TW: Overflow */  	temp = tempcx & 0x00FF;  	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0D,temp);                        /* TW: CRT2 Horizontal Retrace End */  	/* 2. Vertical setup */  	tempcx = SiS_Pr->SiS_VGAVT - 1;  	temp = tempcx & 0x00FF;        if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {	     if(HwDeviceExtension->jChipType < SIS_315H) {	          if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {		       if(SiS_Pr->SiS_VBInfo & (SetCRT2ToSVIDEO | SetCRT2ToAVIDEO)) {		           temp--;		       }                  }	     } else { 		      temp--;             }        } else if(HwDeviceExtension->jChipType >= SIS_315H) {	    /* TW: 650/30xLV 1.10.6s */	    temp--;	}  	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0E,temp);                        /* TW: CRT2 Vertical Total */  	tempbx = SiS_Pr->SiS_VGAVDE - 1;  	temp = tempbx & 0x00FF;  	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0F,temp);                        /* TW: CRT2 Vertical Display Enable End */  	temp = ((tempbx & 0xFF00) << 3) >> 8;  	temp |= ((tempcx & 0xFF00) >> 8);  	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x12,temp);                        /* TW: Overflow (and HWCursor Test Mode) */	/* TW: 650/LVDS (1.10.07), 650/30xLV (1.10.6s) */	if(HwDeviceExtension->jChipType >= SIS_315H) {           tempbx++;   	   tempax = tempbx;	   tempcx++;	   tempcx -= tempax;	   tempcx >>= 2;	   tempbx += tempcx;	   if(tempcx < 4) tempcx = 4;	   tempcx >>= 2;	   tempcx += tempbx;	   tempcx++;	} else {	   /* TW: 300 series, LVDS/301B: */  	   tempbx = (SiS_Pr->SiS_VGAVT + SiS_Pr->SiS_VGAVDE) >> 1;                 /*  BTVGA2VRS     0x10,0x11   */  	   tempcx = ((SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE) >> 4) + tempbx + 1;  /*  BTVGA2VRE     0x11        */	}  	if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {    	   if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC){      		tempbx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[8];      		temp = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[7];      		if(temp & 0x04) tempbx |= 0x0100;      		if(temp & 0x80) tempbx |= 0x0200;      		temp = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[13];      		if(temp & 0x08) tempbx |= 0x0400;      		temp = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[9];      		tempcx = (tempcx & 0xFF00) | (temp & 0x00FF);    	   }  	}  	temp = tempbx & 0x00FF;  	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x10,temp);           /* TW: CRT2 Vertical Retrace Start */  	temp = ((tempbx & 0xFF00) >> 8) << 4;  	temp |= (tempcx & 0x000F);  	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x11,temp);           /* TW: CRT2 Vert. Retrace End; Overflow; "Enable CRTC Check" */  	/* 3. Panel compensation delay */  	if(HwDeviceExtension->jChipType < SIS_315H) {#ifdef SIS300  /* ---------- 300 series -------------- */	   if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {	        temp = 0x20;		if(HwDeviceExtension->jChipType == SIS_300) {		   temp = 0x10;		   if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768)  temp = 0x2c;		   if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) temp = 0x20;		   if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960)  temp = 0x24;		}		if(SiS_Pr->SiS_VBType & VB_SIS301) {		   if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) temp = 0x20;		}		if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960)     temp = 0x24;		if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) 		temp = 0x08;		if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) {      		   if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) 	temp = 0x2c;      		   else 					temp = 0x20;    	        }		if((ROMAddr) && (SiS_Pr->SiS_UseROM) && (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) {		    if(ROMAddr[0x220] & 0x80) {		        if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV-SetCRT2ToHiVisionTV))				temp = ROMAddr[0x221];			else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV)				temp = ROMAddr[0x222];		        else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024)				temp = ROMAddr[0x223];			else				temp = ROMAddr[0x224];			temp &= 0x3c;		    }		}		if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {		   if(HwDeviceExtension->pdc) {			temp = HwDeviceExtension->pdc & 0x3c;		   }		}	   } else {	        temp = 0x20;		if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) {		   if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) temp = 0x04;		}		if((ROMAddr) && SiS_Pr->SiS_UseROM) {		    if(ROMAddr[0x220] & 0x80) {		        temp = ROMAddr[0x220] & 0x3c;		    }		}		if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {		   if(HwDeviceExtension->pdc) {			temp = HwDeviceExtension->pdc & 0x3c;		   }		}	   }    	   SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,~0x03C,temp);         /* TW: Panel Link Delay Compensation; (Software Command Reset; Power Saving) */#endif  /* SIS300 */  	} else {#ifdef SIS315H   /* ----------- 310/325/330 series ---------------*/	   if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {                temp = 0x10;                if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768)  temp = 0x2c;    	        if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) temp = 0x20;    	        if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960)  temp = 0x24;		if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {		   temp = 0x08;		   if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) {		      switch(SiS_Pr->SiS_HiVision) {		      case 2:		      case 1:		      case 0:		         temp = 0x08;			 break;		      default:      		         if(SiS_Pr->SiS_VBInfo & SetInSlaveMode)  temp = 0x2c;      		         else 					  temp = 0x20;		      }    	           }		}		if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {		   tempbl = 0x00;		   if((ROMAddr) && (SiS_Pr->SiS_UseROM)) {		      if(HwDeviceExtension->jChipType < SIS_330) {		         if(ROMAddr[0x13c] & 0x80) tempbl = 0xf0;		      } else {		         if(ROMAddr[0x1bc] & 0x80) tempbl = 0xf0;		      }		   }		} else {  /* LV (550/301LV checks ROM byte, other LV BIOSes do not) */		   tempbl = 0xF0;		}	   } else {	        if(HwDeviceExtension->jChipType == SIS_740) {		   temp = 0x03;	        } else {		   temp = 0x00;		}		if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) temp = 0x0a;		tempbl = 0xF0;		if(HwDeviceExtension->jChipType == SIS_650) {		   if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {		      if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) tempbl = 0x0F;		   }		}	   }	   SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2D,tempbl,temp);	    /* TW: Panel Link Delay Compensation */    	   tempax = 0;    	   if (modeflag & DoubleScanMode) tempax |= 0x80;    	   if (modeflag & HalfDCLK)       tempax |= 0x40;    	   SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2C,0x3f,tempax);#endif  /* SIS315H */  	}     }  /* Slavemode */     if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {        /* TW: For 301BDH, we set up the Panel Link */        if( (SiS_Pr->SiS_VBType & VB_NoLCD) &&	    (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) ) {	    SiS_SetGroup1_LVDS(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex,	                       HwDeviceExtension,RefreshRateTableIndex);        } else if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {                                 	    SiS_SetGroup1_301(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex,	                      HwDeviceExtension,RefreshRateTableIndex);        }     } else {        if(HwDeviceExtension->jChipType < SIS_315H) {		   SiS_SetGroup1_LVDS(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex,	                        HwDeviceExtension,RefreshRateTableIndex);	} else {		   if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {              if((!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) || (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {

⌨️ 快捷键说明

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