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

📄 init301.c

📁 一个2.4.21版本的嵌入式linux内核
💻 C
📖 第 1 页 / 共 5 页
字号:
  temp = ((tempbx & 0x0700) >> 8) << 3;  temp |= ((tempcx & 0x0700) >> 8);  SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1D,temp);     	/* Part1_1Dh; TW: Vertical Display Overflow; Control Signal */  temp = tempbx & 0x00FF;  if(SiS_Pr->SiS_IF_DEF_FSTN) temp++;  SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1C,temp);      	/* Part1_1Ch; TW: Panel Link Vertical Display Enable End  */  temp = tempcx & 0x00FF;  SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1B,temp);      	/* Part1_1Bh; TW: Panel Link Vertical Display Enable Start  */  /* 3. Additional horizontal setup (scaling, etc) */  tempecx = SiS_Pr->SiS_VGAHDE;  if(HwDeviceExtension->jChipType >= SIS_315H) {     if(modeflag & HalfDCLK)        tempecx >>= 1;  }  tempebx = SiS_Pr->SiS_HDE;  if(tempecx == tempebx) tempeax = 0xFFFF;  else {     tempeax = tempecx;     tempeax <<= 16;     temp = (USHORT)(tempeax % tempebx);     tempeax = tempeax / tempebx;     if(HwDeviceExtension->jChipType >= SIS_315H) {         if(temp) tempeax++;     }  }  tempecx = tempeax;  if(HwDeviceExtension->jChipType >= SIS_315H) {      tempeax = SiS_Pr->SiS_VGAHDE;      if(modeflag & HalfDCLK) tempeax >>= 1;      tempeax <<= 16;      tempeax = (tempeax / tempecx) - 1;  } else {      tempeax = ((SiS_Pr->SiS_VGAHT << 16) / tempecx) - 1;  }  tempecx <<= 16;  tempecx |= (tempeax & 0xFFFF);  temp = (USHORT)(tempecx & 0x00FF);  SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1F,temp);  	 /* Part1_1Fh; TW: Panel Link DDA Operational Number in each horiz. line */  tempbx = SiS_Pr->SiS_VDE;  if(HwDeviceExtension->jChipType >= SIS_315H) {      tempeax = (SiS_Pr->SiS_VGAVDE << 18) / tempvcfact;      tempbx = (USHORT)(tempeax & 0x0FFFF);  } else {      tempax = SiS_Pr->SiS_VGAVDE << 6;      tempbx = push1;      tempbx &= 0x3f;      if(tempbx == 0) tempbx = 64;      tempax = tempax / tempbx;      tempbx = tempax;  }  if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempbx--;  if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA)                 tempbx = 1;  temp = ((tempbx & 0xFF00) >> 8) << 3;  temp |= (USHORT)((tempecx & 0x0700) >> 8);  SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x20,temp);  	/* Part1_20h; TW: Overflow register */  temp = tempbx & 0x00FF;  SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x21,temp);  	/* Part1_21h; TW: Panel Link Vertical Accumulator Register */  tempecx >>= 16;                               /* BPLHCFACT  */  if(HwDeviceExtension->jChipType < SIS_315H) {      if(modeflag & HalfDCLK) tempecx >>= 1;  }  temp = (USHORT)((tempecx & 0xFF00) >> 8);  SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x22,temp);     	/* Part1_22h; TW: Panel Link Horizontal Scaling Factor High */  temp = (USHORT)(tempecx & 0x00FF);  SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x23,temp);         /* Part1_22h; TW: Panel Link Horizontal Scaling Factor Low */  /* 630/301B and 630/LVDS do something for 640x480 panels here */#ifdef SIS315H  /* TW: DSTN/FSTN initialisation - hardcoded for 320x480 panel */  if(SiS_Pr->SiS_IF_DEF_DSTN) {     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1E,0x01);     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x25,0x00);     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x26,0x00);     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x27,0x00);     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x28,0x87);     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x29,0x5A);     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2A,0x4B);     	SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x44,~0x007,0x03);     	tempbx = SiS_Pr->SiS_HDE + 64;                       	/*Blps = lcdhdee(lcdhdes+HDE) + 64*/     	temp = tempbx & 0x00FF;     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x38,temp);     	temp=((tempbx & 0xFF00) >> 8) << 3;     	SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x35,~0x078,temp);     	tempbx += 32;		                     		/*Blpe=lBlps+32*/     	temp = tempbx & 0x00FF;     	if(SiS_Pr->SiS_IF_DEF_FSTN)  temp=0;     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x39,temp);     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x3A,0x00);        	/*Bflml=0*/     	SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x3C,~0x007,0x00);     	tempbx = SiS_Pr->SiS_VDE / 2;     	temp = tempbx & 0x00FF;     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x3B,temp);     	temp = ((tempbx & 0xFF00) >> 8) << 3;     	SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x3C,~0x038,temp);     	tempeax = SiS_Pr->SiS_HDE << 2;                       	/* BDxFIFOSTOP = (HDE*4)/128 */     	tempebx = 128;     	temp = (USHORT)(tempeax % tempebx);     	tempeax = tempeax / tempebx;     	if(temp != 0)  tempeax++;     	temp = (USHORT)(tempeax & 0x003F);     	SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x45,~0x0FF,temp);     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x3F,0x00);         	/* BDxWadrst0 */     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x3E,0x00);     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x3D,0x10);     	SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x3C,~0x040,0x00);     	tempax = SiS_Pr->SiS_HDE >> 4;                        	/* BDxWadroff = HDE*4/8/8 */     	pushcx = tempax;     	temp = tempax & 0x00FF;     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x43,temp);     	temp = ((tempax & 0xFF00) >> 8) << 3;     	SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x44,~0x0F8,temp);     	tempax = SiS_Pr->SiS_VDE;                             /*BDxWadrst1 = BDxWadrst0 + BDxWadroff * VDE */     	tempeax = (tempax * pushcx);     	tempebx = 0x00100000 + tempeax;     	temp = (USHORT)tempebx & 0x000000FF;     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x42,temp);     	temp = (USHORT)((tempebx & 0x0000FF00)>>8);     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x41,temp);     	temp = (USHORT)((tempebx & 0x00FF0000)>>16);     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x40,temp);     	temp = (USHORT)(((tempebx & 0x01000000)>>24) << 7);     	SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x3C,~0x080,temp);     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2F,0x03);     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x03,0x50);     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x04,0x00);     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2F,0x01);     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x13,0x00);     	SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86);        /* Unlock */     	SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1e,0x62);     	if(SiS_Pr->SiS_IF_DEF_FSTN){         	SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2b,0x1b);         	SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2c,0xe3);         	SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1e,0x62);         	SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2e,0x04);         	SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2f,0x42);         	SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,0x01);         	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2b,0x02);         	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2c,0x00);         	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2d,0x00);     	}     	SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0f,0x30);     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1e,0x7d);     	SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2e,0xe0);  }#endif  /* SIS315H */  return;}#ifdef SIS315HvoidSiS_CRT2AutoThreshold(SiS_Private *SiS_Pr, USHORT BaseAddr){  SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x01,0x40);}#endif#ifdef SIS315H/* TW: For LVDS / 302B/30xLV - LCDA (this must only be called on 310/325 series!) */voidSiS_SetGroup1_LCDA(SiS_Private *SiS_Pr, USHORT  BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,                   PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex){  USHORT modeflag,resinfo;  USHORT push1,push2,tempax,tempbx,tempcx,temp;  ULONG tempeax=0,tempebx,tempecx,tempvcfact;  if(IS_SIS330) {     SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x10);			/* Xabre 1.01.03 */  } else if(IS_SIS740) {     if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {					/* 740/LVDS */        SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,0xfb,0x04);      	/* 740/LVDS */	SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x03);     } else {        SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x10);			/* 740/301LV 1.10.1i */     }  } else {     if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {					/* 650/LVDS */        SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,0xfb,0x04);      	/* 650/LVDS */	SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x00);			/* 650/LVDS 1.10.07 */     } else {        SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2D,0x0f);			/* 650/30xLv 1.10.6s */     }  }  if(ModeNo <= 0x13) {    modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;    resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo;  } else {    modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;    resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;  }  tempax = SiS_Pr->SiS_LCDHDES;  tempbx = SiS_Pr->SiS_HDE;  tempcx = SiS_Pr->SiS_HT;  if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {        if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768)       tempbx = 1024;	else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempbx = 1400;	else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempbx = 1600;	else 							      tempbx = 1280;  }  tempcx -= tempbx;                        	            	/* HT-HDE  */  push1 = tempax;  tempax += tempbx;	                                    	/* lcdhdee  */  tempbx = SiS_Pr->SiS_HT;  if(tempax >= tempbx)	tempax -= tempbx;  push2 = tempax;						/* push ax   lcdhdee  */  tempcx >>= 2;  /* TW: 650/30xLV 1.10.6s, 740/LVDS */  if( ((SiS_Pr->SiS_IF_DEF_LVDS == 0) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) ||      ((SiS_Pr->SiS_IF_DEF_LVDS == 1) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) ) {     if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) {        if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600)        tempcx = 0x28; 	else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768)  tempcx = 0x18;	else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 0x30;	else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempcx = 0x40;	else                                                          tempcx = 0x30;     }  }  tempcx += tempax;  	                                  	/* lcdhrs  */  if(tempcx >= tempbx) tempcx -= tempbx;                                                           	/* v ah,cl  */  tempax = tempcx;  tempax >>= 3;   	                                     	/* BPLHRS */  temp = tempax & 0x00FF;  SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x14,temp);                 	/* Part1_14h  */  temp += 10;  if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {     if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {        if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) {	   temp += 6;	   if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel800x600) {	      temp++;	      if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1024x768) {	         temp += 7;		 if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1600x1200) {		    temp -= 10;		 }	      }	   }	}     }  }  temp &= 0x1F;  temp |= ((tempcx & 0x07) << 5);  SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x15,temp);                         /* Part1_15h  */  tempbx = push2;                                          	/* lcdhdee  */  tempcx = push1;                                          	/* lcdhdes  */  temp = (tempcx & 0x00FF);  temp &= 0x07;                                  		/* BPLHDESKEW  */  SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1A,temp);                         /* Part1_1Ah  */  tempcx >>= 3;   	                                     	/* BPLHDES */  temp = tempcx & 0x00FF;  SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x16,temp);                         /* Part1_16h  */  if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {     if(tempbx & 0x07) tempbx += 8;  }  tempbx >>= 3;                                        		/* BPLHDEE  */  temp = tempbx & 0x00FF;  SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x17,temp);                        	/* Part1_17h  */  tempcx = SiS_Pr->SiS_VGAVT;  tempbx = SiS_Pr->SiS_VGAVDE;  tempcx -= tempbx; 	                                   	/* GAVT-VGAVDE  */  tempbx = SiS_Pr->SiS_LCDVDES;                                	/* VGAVDES  */  push1 = tempbx;                                      		  if(SiS_Pr->SiS_IF_DEF_TRUMPION == 0) {    if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768)        tempax = 768;    else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768)   tempax = 768;    else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024)  tempax = 1024;    else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050)  tempax = 1050;    else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200)  tempax = 1200;    else                                                           tempax = 960;  } else tempax = SiS_Pr->SiS_VGAVDE;  /* Trumpion */  tempbx += tempax;  tempax = SiS_Pr->SiS_VT;                                    	/* VT  */  if(tempbx >= tempax)  tempbx -= tempax;  push2 = tempbx;                                      		   tempcx >>= 2;	  /* TW: 650/30xLV 1.10.6s, 740/LVDS */  if( ((SiS_Pr->SiS_IF_DEF_LVDS == 0) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) ||      ((SiS_Pr->SiS_IF_DEF_LVDS == 1) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) ) {     if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) {        if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600)         tempcx = 1;   	else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768)   tempcx = 3;	else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768)   tempcx = 3;	else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024)  tempcx = 1;	else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050)  tempcx = 1;	else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200)  tempcx = 1;	else                                                           tempcx = 0x0057;     }  }  tempbx += tempcx;  if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {     tempbx++;                                                	/* BPLVRS  */  }  if(tempbx >= tempax)   tempbx -= tempax;  temp = tempbx & 0x00FF;  SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,temp);                             /* Part1_18h  */  tempcx >>= 3;  if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {     if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {        if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) {	   if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600)         tempcx = 3;   	   else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768)   tempcx = 5;	   else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768)   tempcx = 5;	   else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024)  tempcx = 5;	   else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050)  tempcx = 2;	   else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200)  tempcx = 2;	}     }  }  tempcx += tempbx;  tempcx++;                                                	/* BPLVRE  */  temp = tempcx & 0x00FF;  temp &= 0x0F;  if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {     SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0xF0,temp);  } else {     /* TW: 650/30xLV 1.10.6s, Xabre */     temp |= 0xC0;     SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0xF0,temp);             /* Part1_19h  */  }  temp = (tempbx & 0xFF00) >> 8;  temp &= 0x07;  temp <<= 3;  		                               		/* BPLDESKEW =0 */  tempbx = SiS_Pr->SiS_VGAVDE;  if(tempbx != SiS_Pr->SiS_VDE)              temp |= 0x40;  if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA)    temp |= 0x40;  if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {     if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) {        if(SiS_GetReg1(Si

⌨️ 快捷键说明

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