📄 init301.c
字号:
temp=tempbx&0x00FF; SiS_SetReg1(SiS_Part1Port,0x18,temp); /* <------------------- */ /* Part1_18h */ tempcx=tempcx>>3; tempcx=tempcx+tempbx; tempcx++; /* BPLVRE */ temp=tempcx&0x00FF; temp=temp&0x0F; SiS_SetRegANDOR(SiS_Part1Port,0x19,~0x00F,temp); /* <-------------- */ /* Part1_19h */ temp=(tempbx&0xFF00)>>8; temp=temp&0x07; temp=temp<<3; /* BPLDESKEW =0 */ tempbx=SiS_VGAVDE; if(tempbx!=SiS_VDE){ temp=temp|0x40; } if(SiS_SetFlag&EnableLVDSDDA) { temp=temp|0x40; } if(SiS_LCDInfo&LCDRGB18Bit) { temp=temp|0x80; } SiS_SetRegANDOR(SiS_Part1Port,0x1A,0x07,temp); /* <----------------- */ /* Part1_1Ah */ tempecx=SiS_VGAVT; tempebx=SiS_VDE; tempeax=SiS_VGAVDE; tempecx=tempecx-tempeax; /* VGAVT-VGAVDE */ tempeax=tempeax<<6; temp=(USHORT)(tempeax%tempebx); tempeax=tempeax/tempebx; if(temp!=0){ tempeax++; } tempebx=tempeax; /* BPLVCFACT */ /* TW: Modified according to info from SiS - might be wrong */ /* if (!(SiS_VBType&(VB_SIS301B|VB_SIS302B|VB_SIS301LV|VB_SIS302LV))) { */ if ((HwDeviceExtension->jChipType == SIS_540)|| (HwDeviceExtension->jChipType == SIS_630)|| (HwDeviceExtension->jChipType == SIS_730)|| (HwDeviceExtension->jChipType == SIS_300)) { if(SiS_SetFlag&EnableLVDSDDA) { tempebx=tempebx&0x003F; } temp=(USHORT)(tempebx&0x00FF); SiS_SetReg1(SiS_Part1Port,0x1E,temp); /* Part1_1Eh */ } /*add for 301b different 301*/ else if(SiS_VBType&(VB_SIS301B|VB_SIS302B|VB_SIS301LV|VB_SIS302LV)) { tempecx=SiS_VGAVT; tempebx=SiS_VDE; tempeax=SiS_VGAVDE; tempecx=tempecx-tempeax; /* VGAVT-VGAVDE */ tempeax=tempeax<<18; temp=(USHORT)(tempeax%tempebx); tempeax=tempeax/tempebx; if(temp!=0) tempeax++; tempebx=tempeax; /* BPLVCFACT */ tempvcfact=tempeax; /*301b*/ temp=(USHORT)(tempebx&0x00FF); SiS_SetReg1(SiS_Part1Port,0x37,temp); temp=(USHORT)((tempebx&0x00FF00)>>8); SiS_SetReg1(SiS_Part1Port,0x36,temp); temp=(USHORT)((tempebx&0x00030000)>>16); if(SiS_VDE==SiS_VGAVDE) temp=temp|0x04; SiS_SetReg1(SiS_Part1Port,0x35,temp); } /*end for 301b*/ tempbx=push2; /* p bx temppush2 BPLVDEE */ tempcx=push1; /* pop cx temppush1 NPLVDES */ push1=(USHORT)(tempeax&0xFFFF); if(!(SiS_VBInfo&SetInSlaveMode)) { if(!SiS_IF_DEF_DSTN){ if(SiS_LCDResInfo==Panel800x600) { if(resinfo==7) tempcx++; } else { if(SiS_LCDResInfo==Panel1024x768) { if(resinfo==8) tempcx++; } } } } temp=(tempbx&0xFF00)>>8; temp=temp&0x07; temp=temp<<3; temp=temp|(((tempcx&0xFF00)>>8)&0x07); SiS_SetReg1(SiS_Part1Port,0x1D,temp); /* <------------------- */ /* Part1_1Dh */ temp=tempbx&0x00FF; /*fstn*/ if(SiS_IF_DEF_FSTN){ temp=temp+1; } SiS_SetReg1(SiS_Part1Port,0x1C,temp); /* <------------------- */ /* Part1_1Ch */ temp=tempcx&0x00FF; SiS_SetReg1(SiS_Part1Port,0x1B,temp); /* <------------------- */ /* Part1_1Bh */ tempecx=SiS_VGAHDE; tempebx=SiS_HDE; tempeax=tempecx; tempeax=tempeax<<16; tempeax=tempeax/tempebx; if(tempebx==tempecx){ tempeax=0xFFFF; } tempecx=tempeax; tempeax=SiS_VGAHT; /* TW: Was SiS_VGAHDE; - WRONG! - old (wrong) comment: "change VGAHT->VGAHDE"*/ tempeax=tempeax<<16; 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 */ tempbx = SiS_VDE; /* TW: added this and if statement */ if (SiS_VBType&(VB_SIS301B|VB_SIS302B|VB_SIS301LV|VB_SIS302LV)) { 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 */ if(modeflag&HalfDCLK) { tempecx=tempecx>>1; } temp=(USHORT)((tempecx&0x0000FF00)>>8); SiS_SetReg1(SiS_Part1Port,0x22,temp); /* <------------------- */ /* Part1_22h */ temp=(USHORT)(tempecx&0x000000FF); SiS_SetReg1(SiS_Part1Port,0x23,temp); /* <------------------- */ /*add dstn new register*/ if(SiS_IF_DEF_DSTN){ SiS_SetReg1(SiS_Part1Port,0x1E,0x01); SiS_SetReg1(SiS_Part1Port,0x25,0x00); SiS_SetReg1(SiS_Part1Port,0x26,0x00); SiS_SetReg1(SiS_Part1Port,0x27,0x00); SiS_SetReg1(SiS_Part1Port,0x28,0x87); SiS_SetReg1(SiS_Part1Port,0x29,0x5A); SiS_SetReg1(SiS_Part1Port,0x2A,0x4B); SiS_SetRegANDOR(SiS_Part1Port,0x44,~0x007,0x03); tempbx=SiS_HDE; /*Blps=lcdhdee(lcdhdes+HDE) +64*/ tempbx=tempbx+64; temp=tempbx&0x00FF; SiS_SetReg1(SiS_Part1Port,0x38,temp); temp=((tempbx&0xFF00)>>8)<<3; SiS_SetRegANDOR(SiS_Part1Port,0x35,~0x078,temp); tempbx=tempbx+32; /*Blpe=lBlps+32*/ temp=tempbx&0x00FF; /*fstn*/ if(SiS_IF_DEF_FSTN){ temp=0; } SiS_SetReg1(SiS_Part1Port,0x39,temp); SiS_SetReg1(SiS_Part1Port,0x3A,0x00); /*Bflml=0*/ SiS_SetRegANDOR(SiS_Part1Port,0x3C,~0x007,0x00); tempbx=SiS_VDE; tempbx=tempbx/2; temp=tempbx&0x00FF; SiS_SetReg1(SiS_Part1Port,0x3B,temp); temp=((tempbx&0xFF00)>>8)<<3; SiS_SetRegANDOR(SiS_Part1Port,0x3C,~0x038,temp); tempeax=SiS_HDE; /* BDxFIFOSTOP= (HDE*4)/128 */ tempeax=tempeax*4; tempebx=128; temp=(USHORT)(tempeax%tempebx); tempeax=tempeax/tempebx; if(temp!=0){ tempeax++; } temp=(USHORT)(tempeax&0x0000003F); SiS_SetRegANDOR(SiS_Part1Port,0x45,~0x0FF,temp); SiS_SetReg1(SiS_Part1Port,0x3F,0x00); /*BDxWadrst0*/ SiS_SetReg1(SiS_Part1Port,0x3E,0x00); SiS_SetReg1(SiS_Part1Port,0x3D,0x10); SiS_SetRegANDOR(SiS_Part1Port,0x3C,~0x040,0x00); tempax=SiS_HDE; tempax=tempax>>4; /*BDxWadroff = HDE*4/8/8 */ pushcx=tempax; temp=tempax&0x00FF; SiS_SetReg1(SiS_Part1Port,0x43,temp); temp=((tempax&0xFF00)>>8)<<3; SiS_SetRegANDOR(SiS_Part1Port,0x44,~0x0F8,temp); tempax=SiS_VDE; /*BDxWadrst1 = BDxWadrst0+BDxWadroff*VDE*/ tempeax=(tempax*pushcx); tempebx=0x00100000+tempeax; temp=(USHORT)tempebx&0x000000FF; SiS_SetReg1(SiS_Part1Port,0x42,temp); temp=(USHORT)((tempebx&0x0000FF00)>>8); SiS_SetReg1(SiS_Part1Port,0x41,temp); temp=(USHORT)((tempebx&0x00FF0000)>>16); SiS_SetReg1(SiS_Part1Port,0x40,temp); temp=(USHORT)((tempebx&0x01000000)>>24); temp=temp<<7; SiS_SetRegANDOR(SiS_Part1Port,0x3C,~0x080,temp); SiS_SetReg1(SiS_Part1Port,0x2F,0x03); SiS_SetReg1(SiS_Part1Port,0x03,0x50); SiS_SetReg1(SiS_Part1Port,0x04,0x00); SiS_SetReg1(SiS_Part1Port,0x2F,0x01); SiS_SetReg1(SiS_Part1Port,0x13,0x00); SiS_SetReg1(SiS_P3c4,0x05,0x86); SiS_SetReg1(SiS_P3c4,0x1e,0x62); /*fstn*/ if(SiS_IF_DEF_FSTN){ SiS_SetReg1(SiS_P3c4,0x2b,0x1b); SiS_SetReg1(SiS_P3c4,0x2c,0xe3); SiS_SetReg1(SiS_P3c4,0x1e,0x62); SiS_SetReg1(SiS_P3c4,0x2e,0x04); SiS_SetReg1(SiS_P3c4,0x2f,0x42); SiS_SetReg1(SiS_P3c4,0x32,0x01); SiS_SetReg1(SiS_Part1Port,0x2b,0x02); SiS_SetReg1(SiS_Part1Port,0x2c,0x00); SiS_SetReg1(SiS_Part1Port,0x2d,0x00); } /*end add fstn*/ SiS_SetRegANDOR(SiS_Part1Port,0x19,0x00f,0x30); SiS_SetReg1(SiS_Part1Port,0x1e,0x7d); SiS_SetReg1(SiS_Part1Port,0x2e,0xe0); } /*end add dstn*/ return;}/*301b*/voidSiS_SetGroup1_LCDA(USHORT BaseAddr,ULONG 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;/*301b*/ SiS_SetRegOR(SiS_Part1Port,0x2D,0x20); if(ModeNo<=0x13) { modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ resinfo = SiS_SModeIDTable[ModeIdIndex].St_ResInfo; } else { modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; } tempax=SiS_LCDHDES; tempbx=SiS_HDE; tempcx=SiS_HT; if(SiS_LCDInfo&LCDNonExpanding) { if(SiS_LCDResInfo==Panel1280x1024) tempbx=1280; if(SiS_LCDResInfo==Panel1024x768) tempbx=1024; } tempcx=tempcx-tempbx; /* HT-HDE */ push1=tempax; tempax=tempax+tempbx; /* lcdhdee */ tempbx=SiS_HT; if(tempax>=tempbx){ tempax=tempax-tempbx; } push2=tempax; /* push ax lcdhdee */ tempcx=tempcx>>2; /* temp */ tempcx=tempcx+tempax; /* lcdhrs */ if(tempcx>=tempbx){ tempcx=tempcx-tempbx; } /* v ah,cl */ tempax=tempcx; tempax=tempax>>3; /* BPLHRS */ temp=tempax&0x00FF; SiS_SetReg1(SiS_Part1Port,0x14,temp); /* Part1_14h */ temp=(tempax&0x00FF)+10; temp=temp&0x01F; temp=temp|(((tempcx&0x00ff)&0x07)<<5); SiS_SetReg1(SiS_Part1Port,0x15,temp); /* Part1_15h */ tempbx=push2; /* lcdhdee */ tempcx=push1; /* lcdhdes */ temp=(tempcx&0x00FF); temp=temp&0x07; /* BPLHDESKEW */ SiS_SetReg1(SiS_Part1Port,0x1A,temp); /* Part1_1Ah */ tempcx=tempcx>>3; /* BPLHDES */ temp=(tempcx&0x00FF); SiS_SetReg1(SiS_Part1Port,0x16,temp); /* Part1_16h */ if(tempbx&0x07) tempbx=tempbx+8; tempbx=tempbx>>3; /* BPLHDEE */ temp=tempbx&0x00FF; SiS_SetReg1(SiS_Part1Port,0x17,temp); /* Part1_17h */ tempcx=SiS_VGAVT; tempbx=SiS_VGAVDE; tempcx=tempcx-tempbx; /* GAVT-VGAVDE */ tempbx=SiS_LCDVDES; /* VGAVDES */ push1=tempbx; /* push bx temppush1 */ if(SiS_IF_DEF_TRUMPION==0){ if(SiS_IF_DEF_CH7005==1) { if(SiS_VBInfo&SetCRT2ToTV) { tempax=SiS_VGAVDE; } } if(SiS_LCDResInfo==Panel1024x768) tempax=768; if(SiS_LCDResInfo==Panel1280x1024) tempax=1024; } else tempax=SiS_VGAVDE; tempbx=tempbx+tempax; tempax=SiS_VT; /* VT */ if(tempbx>=SiS_VT){ tempbx=tempbx-tempax; } push2=tempbx; /* push bx temppush2 */ tempcx=tempcx>>1; tempbx=tempbx+tempcx; tempbx++; /* BPLVRS */ if(tempbx>=tempax){ tempbx=tempbx-tempax; } temp=tempbx&0x00FF; SiS_SetReg1(SiS_Part1Port,0x18,temp); /* Part1_18h */ tempcx=tempcx>>3; tempcx=tempcx+tempbx; tempcx++; /* BPLVRE */ temp=tempcx&0x00FF; temp=temp&0x0F; SiS_SetRegANDOR(SiS_Part1Port,0x19,~0x00F,temp); /* Part1_19h */ temp=(tempbx&0xFF00)>>8; temp=temp&0x07; temp=temp<<3; /* BPLDESKEW =0 */ tempbx=SiS_VGAVDE; if(tempbx!=SiS_VDE){ temp=temp|0x40; } if(SiS_SetFlag&EnableLVDSDDA) { temp=temp|0x40; } if(SiS_LCDInfo&LCDRGB18Bit) { temp=temp|0x80; } SiS_SetRegANDOR(SiS_Part1Port,0x1A,0x07,temp); /* Part1_1Ah */ tempbx=push2; /* p bx temppush2 BPLVDEE */ tempcx=push1; /* pop cx temppush1 NPLVDES */ push1=(USHORT)(tempeax&0xFFFF); if(!(SiS_VBInfo&SetInSlaveMode)) { if(SiS_LCDResInfo==Panel800x600) { if(resinfo==7) tempcx++; } else { if(SiS_LCDResInfo==Panel1024x768) { if(resinfo==8) tempcx++; } } } temp=(tempbx&0xFF00)>>8; temp=temp&0x07; temp=temp<<3; temp=temp|(((tempcx&0xFF00)>>8)&0x07); SiS_SetReg1(SiS_Part1Port,0x1D,temp); /* Part1_1Dh */ temp=tempbx&0x00FF; SiS_SetReg1(SiS_Part1Port,0x1C,temp); /* Part1_1Ch */ temp=tempcx&0x00FF; SiS_SetReg1(SiS_Part1Port,0x1B,temp); /* Part1_1Bh */ tempecx=SiS_VGAVT; tempebx=SiS_VDE; tempeax=SiS_VGAVDE; tempecx=tempecx-tempeax; /* VGAVT-VGAVDE */ tempeax=tempeax<<18; temp=(USHORT)(tempeax%tempebx); tempeax=tempeax/tempebx; if(temp!=0){ tempeax++; } tempebx=tempeax; /* BPLVCFACT */ tempvcfact=tempeax; /*301b*/ temp=(USHORT)(tempebx&0x00FF); SiS_SetReg1(SiS_Part1Port,0x37,temp); temp=(USHORT)((tempebx&0x00FF00)>>8); SiS_SetReg1(SiS_Part1Port,0x36,temp); temp=(USHORT)((tempebx&0x00030000)>>16); if(SiS_VDE==SiS_VGAVDE) { temp=temp|0x04;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -