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

📄 init301.c

📁 microwindows移植到S3C44B0的源码
💻 C
📖 第 1 页 / 共 5 页
字号:
  }    SiS_SetReg1(SiS_Part1Port,0x35,temp);       tempecx=SiS_VGAHDE;  tempebx=SiS_HDE;  tempeax=tempecx;  tempeax=tempeax<<6;  tempeax=tempeax<<10;  tempeax=tempeax/tempebx;  if(tempebx==tempecx){    	tempeax=0xFFFF;  }  tempecx=tempeax;  tempeax=SiS_VGAHDE;  /*301b to change HT->HDE*/  tempeax=tempeax<<6;  tempeax=tempeax<<10;  tempeax=tempeax/tempecx;  tempecx=tempecx<<16;  tempeax=tempeax-1;  tempecx=tempecx|(tempeax&0x00FFFF);  temp=(USHORT)(tempecx&0x00FF);  SiS_SetReg1(SiS_Part1Port,0x1F,temp);                          /* Part1_1Fh  */  tempeax=SiS_VGAVDE;  tempeax=tempeax<<18;          /*301b*/  tempeax=tempeax/tempvcfact;  tempbx=(USHORT) (tempeax&0x0FFFF);  if(SiS_LCDResInfo==Panel1024x768) tempbx--;  if(SiS_SetFlag&EnableLVDSDDA){    	tempbx=1;  }  temp=((tempbx&0xFF00)>>8)<<3;  temp=temp|(USHORT)(((tempecx&0x0000FF00)>>8)&0x07);  SiS_SetReg1(SiS_Part1Port,0x20,temp);                         /* Part1_20h */  temp=tempbx&0x00FF;  SiS_SetReg1(SiS_Part1Port,0x21,temp);                         /* Part1_21h */  tempecx=tempecx>>16;                                     	/* BPLHCFACT  */   temp=(USHORT)((tempecx&0x0000FF00)>>8);  SiS_SetReg1(SiS_Part1Port,0x22,temp);                         /* Part1_22h */  temp=(USHORT)(tempecx&0x000000FF);  SiS_SetReg1(SiS_Part1Port,0x23,temp);    if(SiS_VBType&(VB_SIS301B|VB_SIS302B|VB_SIS301LV|VB_SIS302LV)) {  	SiS_SetReg1(SiS_Part1Port,0x1e,0x20);  /* for 650 & 550 lvds part */  }  return;}/*end 301b*/void SiS_SetTPData(){  return;}void SiS_SetCRT2Offset(USHORT SiS_Part1Port,ULONG ROMAddr,USHORT ModeNo,                       USHORT ModeIdIndex ,USHORT RefreshRateTableIndex,		       PSIS_HW_DEVICE_INFO HwDeviceExtension){  USHORT offset;  UCHAR temp;  if(SiS_VBInfo&SetInSlaveMode) return;  offset=SiS_GetOffset(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,                       HwDeviceExtension);  temp=(UCHAR)(offset&0xFF);  SiS_SetReg1(SiS_Part1Port,0x07,temp);  temp=(UCHAR)((offset&0xFF00)>>8);  SiS_SetReg1(SiS_Part1Port,0x09,temp);  temp=(UCHAR)(((offset>>3)&0xFF)+1);  SiS_SetReg1(SiS_Part1Port,0x03,temp);}USHORTSiS_GetOffset(ULONG ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,              USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension){  USHORT temp,colordepth;  USHORT modeinfo,index,infoflag;  USHORT ColorDepth[]={0x02,0x04,0x08};  /* TW: Was 1,2,4 */  modeinfo = SiS_EModeIDTable[ModeIdIndex].Ext_ModeInfo;  infoflag = SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag;  if (HwDeviceExtension->jChipType < SIS_315H ) {  	/* 300 series */    	index=(modeinfo>>4)&0xFF;  } else {  	/* 310 series */    	index=(modeinfo>>8)&0xFF;  }  temp=SiS_ScreenOffset[index];  if(infoflag&InterlaceMode){    	temp=temp<<1;  }  colordepth=SiS_GetColorDepth(ROMAddr,ModeNo,ModeIdIndex);  if((ModeNo>=0x7C)&&(ModeNo<=0x7E)) {  	/* TW: For 1280x960 */    	temp=ModeNo-0x7C;    	colordepth=ColorDepth[temp];    	temp=0x6B;    	if(infoflag&InterlaceMode){      		temp=temp<<1;    	}   	return(temp*colordepth);  }  else return(temp*colordepth);}USHORTSiS_GetColorDepth(ULONG ROMAddr,USHORT ModeNo,USHORT ModeIdIndex){  USHORT ColorDepth[6]={1,2,4,4,6,8};  SHORT  index;  USHORT modeflag;  if(ModeNo<=0x13) {    	modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;  } else {    	modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;  }  index=(modeflag&ModeInfoFlag)-ModeEGA;  if(index<0) index=0;  return(ColorDepth[index]);}voidSiS_SetCRT2Sync(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo,                USHORT RefreshRateTableIndex){  USHORT tempah=0,infoflag,flag;  flag=0;  infoflag = SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag;  if(SiS_IF_DEF_LVDS==1){    if(SiS_VBInfo&SetCRT2ToLCD){      tempah=SiS_LCDInfo;      if(tempah&LCDSync){        flag=1;      }    }  }  if(flag!=1) tempah=infoflag>>8;  tempah=tempah&0xC0;  tempah=tempah|0x20;  if(!(SiS_LCDInfo&LCDRGB18Bit)) tempah=tempah|0x10;  if(SiS_IF_DEF_CH7005==1) tempah=tempah|0xC0;  SiS_SetRegANDOR(SiS_Part1Port,0x19,0x3F,tempah);}voidSiS_SetCRT2FIFO(USHORT  SiS_Part1Port,ULONG ROMAddr,USHORT ModeNo,                PSIS_HW_DEVICE_INFO HwDeviceExtension){  USHORT temp,index;  USHORT modeidindex,refreshratetableindex;  USHORT VCLK,MCLK,colorth=0,data2;  ULONG  data,eax;  UCHAR  LatencyFactor[] ={  	97, 88, 86, 79, 77, 00,       /*; 64  bit    BQ=2   */        00, 87, 85, 78, 76, 54,       /*; 64  bit    BQ=1   */        97, 88, 86, 79, 77, 00,       /*; 128 bit    BQ=2   */        00, 79, 77, 70, 68, 48,       /*; 128 bit    BQ=1   */        80, 72, 69, 63, 61, 00,       /*; 64  bit    BQ=2   */        00, 70, 68, 61, 59, 37,       /*; 64  bit    BQ=1   */        86, 77, 75, 68, 66, 00,       /*; 128 bit    BQ=2   */        00, 68, 66, 59, 57, 37};      /*; 128 bit    BQ=1   */  SiS_SearchModeID(ROMAddr,ModeNo,&modeidindex);  SiS_SetFlag=SiS_SetFlag&(~ProgrammingCRT2);  SiS_SelectCRT2Rate=0;  refreshratetableindex=SiS_GetRatePtrCRT2(ROMAddr,ModeNo,modeidindex);   /* 11.GetRatePtr */  if(ModeNo>=0x13) {    index=SiS_RefIndex[refreshratetableindex].Ext_CRTVCLK;    index=index&0x3F;    VCLK=SiS_VCLKData[index].CLOCK;           /* Get VCLK  */    index=SiS_GetReg1(SiS_P3c4,0x1A);    index=index&07;    MCLK=SiS_MCLKData[index].CLOCK;           /* Get MCLK  */    data2=SiS_ModeType-0x02;    switch (data2) {      case 0 : 	colorth=1; break;      case 1 : 	colorth=1; break;      case 2 : 	colorth=2; break;      case 3 : 	colorth=2; break;      case 4 : 	colorth=3; break;      case 5 : 	colorth=4; break;    }    /* data2=(data2*VCLK)/MCLK;   */  /*  bx */    data2=(colorth*VCLK)/MCLK;  /* TW */    temp = SiS_GetReg1(SiS_P3c4,0x14);    temp = ((temp&0x00FF)>>6)<<1;    if(temp==0) temp=1;    temp=temp<<2;    data2=temp-data2;/*  if(data2%(28*16)) {		 TW: WRONG      	data2=data2/(28*16);      	data2++;    } else {      	data2=data2/(28*16);    } */    if((28*16)%data2) {		/* TW */      	data2=(28*16)/data2;      	data2++;    } else {      	data2=(28*16)/data2;    }    index=0;    temp = SiS_GetReg1(SiS_P3c4,0x14);    if(temp&0x0080) index=index+12;    SiS_SetReg4(0xcf8,0x800000A0);    eax=SiS_GetReg3(0xcfc);    temp=(USHORT)(eax>>24);    if(!(temp&0x01)) index=index+24;    SiS_SetReg4(0xcf8,0x80000050);    eax=SiS_GetReg3(0xcfc);    temp=(USHORT)(eax>>24);    if(temp&0x01) index=index+6;    temp=(temp&0x0F)>>1;    index=index+temp;    data=LatencyFactor[index];    data=data+15;    temp = SiS_GetReg1(SiS_P3c4,0x14);    if(!(temp&0x80)) data=data+5;    data=data+data2;    SiS_SetFlag=SiS_SetFlag|ProgrammingCRT2;    data=data*VCLK*colorth;    if(data%(MCLK<<4)) {      	data=data/(MCLK<<4);      	data++;    } else {      	data=data/(MCLK<<4);    }/* TW: The following made all the calculations above void... */#if 0    temp=0x16;/*  Revision ID  */    temp=0x13;/*  Revision ID  */    SiS_SetRegANDOR(SiS_Part1Port,0x01,~0x01F,temp);    SiS_SetRegANDOR(SiS_Part1Port,0x02,~0x01F,temp);#endif   /* TW: We do this instead: */   temp = SiS_GetReg1(SiS_Part1Port,0x01);   if( (HwDeviceExtension->jChipType == SIS_630 ) &&	    ((HwDeviceExtension->jChipRevision & 0xf0) == 0x30) ) /* 630s */   {	temp = (temp & (~0x1F)) | 0x1b;  	/* TW: VESA sets 1b, prev. 0x19 */   } else {	temp = (temp & (~0x1F)) | 0x16;   }   SiS_SetReg1(SiS_Part1Port,0x01,temp);  	/* FIFO HIGH? */   if(data <= 6) data = 6;   if(data > 0x14) data = 0x14;   if (SiS_IF_DEF_LVDS==1) {			/* TW: LVDS doesn't like 0x14 */	if(data > 0x13) data = 0x13;   }   SiS_SetRegANDOR(SiS_Part1Port,0x02,~0x01F,data);  /* FIFO LOW? */  /* TW end */  }}voidSiS_SetCRT2FIFO2(USHORT SiS_Part1Port,ULONG ROMAddr,USHORT ModeNo,                 PSIS_HW_DEVICE_INFO HwDeviceExtension){#ifdef SIS315H UCHAR CombCode[]={1,1,1,4,3,1,3,4,4,1,4,4,5,1,5,4}; UCHAR CRT2ThLow[]={39,63,55,79,78,102,90,114,55,87,84,116,103,135,119,151};#endif  USHORT temp,temp1,temp2,temp3;  USHORT index;  USHORT CRT1ModeNo,CRT2ModeNo;  USHORT ModeIdIndex;  USHORT RefreshRateTableIndex;  SiS_SetReg1(SiS_Part1Port,0x1,0x3B);  /* CRT1ModeNo=(UCHAR)SiS_GetReg1(SiS_P3d4,0x34); *//* get CRT1 ModeNo */  CRT1ModeNo = SiS_CRT1Mode;  /* CRT1ModeNo =ModeNo; */  SiS_SearchModeID(ROMAddr,CRT1ModeNo,&ModeIdIndex);    /* Get ModeID Table */  SiS_SetFlag=SiS_SetFlag& (~ProgrammingCRT2);  RefreshRateTableIndex=SiS_GetRatePtrCRT2(ROMAddr,CRT1ModeNo,                            ModeIdIndex); /* Set REFIndex-> for crt1 refreshrate */  index = SiS_GetVCLK2Ptr(ROMAddr,CRT1ModeNo,ModeIdIndex,                          RefreshRateTableIndex,HwDeviceExtension);  temp1=SiS_VCLKData[index].CLOCK;           /* Get VCLK  */  temp2= SiS_GetColorDepth(ROMAddr,CRT1ModeNo,ModeIdIndex);#ifdef SIS315H  index = SiS_Get310DRAMType(ROMAddr);#endif  temp3=SiS_MCLKData[index].CLOCK;           /* Get MCLK  */  temp=SiS_GetReg1(SiS_P3c4,0x14);  if (temp&0x02)   	temp=16;  else    	temp=8;  temp = temp - temp1*temp2/temp3; /* 16-DRamBus - DCLK*BytePerPixel/MCLK */  if ((52*16 % temp)==0)    	temp = 52*16/temp +40;  else    	temp = 52*16/temp +40 + 1;  /* get DRAM latency */  temp1=(SiS_GetReg1(SiS_P3c4,0x17)>>3)&0x7; /* SR17[5:3] DRAM Queue depth */  temp2=(SiS_GetReg1(SiS_P3c4,0x17)>>6)&0x3; /* SR17[7:6] DRAM Grant length */#ifdef SIS315H  if (SiS_Get310DRAMType(ROMAddr)<2)  {    for (temp3=0;temp3<16;temp3+=2)    {      if ((CombCode[temp3]==temp1) && (CombCode[temp3+1]==temp2))      {        temp3 = CRT2ThLow[temp3>>1];      }    }  }  else  {    for (temp3=0;temp3<16;temp3+=2)    {      if ((CombCode[temp3]==temp1) && (CombCode[temp3+1]==temp2))      {        temp3 = CRT2ThLow[8+(temp3>>1)];      }    }  }#endif  temp +=  temp3; /* CRT1 Request Period */  CRT2ModeNo = ModeNo; /* get CRT2 ModeNo */  SiS_SearchModeID(ROMAddr,CRT2ModeNo,&ModeIdIndex);    /* Get ModeID Table */  SiS_SetFlag=SiS_SetFlag|ProgrammingCRT2;  RefreshRateTableIndex=SiS_GetRatePtrCRT2(ROMAddr,CRT1ModeNo,                        ModeIdIndex);/* Set REFIndex-> for crt1 refreshrate */  index = SiS_GetVCLK2Ptr(ROMAddr,CRT2ModeNo,ModeIdIndex,                          RefreshRateTableIndex,HwDeviceExtension);  temp1=SiS_VCLKData[index].CLOCK;           /* Get VCLK  */  temp2= SiS_GetColorDepth(ROMAddr,CRT2ModeNo,ModeIdIndex);#ifdef SIS315H  index = SiS_Get310DRAMType(ROMAddr);#endif  temp3=SiS_MCLKData[index].CLOCK;           /* Get MCLK  */   if ((temp*temp1*temp2)%(16*temp3)==0)    temp = temp*temp1*temp2/(16*temp3);   /* CRT1 Request period * TCLK*BytePerPixel/(MCLK*16) */  else     temp = temp*temp1*temp2/(16*temp3)+1; /* CRT1 Request period * TCLK*BytePerPixel/(MCLK*16) */  if (temp>0x37)    temp = 0x37;  SiS_SetRegANDOR(SiS_Part1Port,0x02,~0x3F,temp);}voidSiS_GetLVDSDesData(ULONG ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,                   USHORT RefreshRateTableIndex){  USHORT modeflag;  USHORT PanelIndex,ResIndex;  SiS_LVDSDesStruct  *PanelDesPtr=NULL;  if((SiS_VBType&(VB_SIS301B|VB_SIS302B|VB_SIS301LV|VB_SIS302LV))       && (SiS_IF_DEF_LVDS == 0) ) {  /*301b*//*for test*/     SiS_GetLVDSDesPtrA(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,                        &PanelIndex,&ResIndex);

⌨️ 快捷键说明

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