📄 init301.c
字号:
if (SiS_VBInfo & SetCRT2ToTV) { if (SiS_SetFlag & TVSimuMode) { if ((ModeNo == 0x06) || (ModeNo == 0x10) || (ModeNo == 0x11) || (ModeNo == 0x13) || (ModeNo == 0x0F)) { SiS_SetReg1 (SiS_Part1Port, 0x07, 0x5b); SiS_SetReg1 (SiS_Part1Port, 0x08, 0x03); } if ((ModeNo == 0x00) || (ModeNo == 0x01)) { if (SiS_VBInfo & SetNTSCTV) { SiS_SetReg1 (SiS_Part1Port, 0x07, 0x2A); SiS_SetReg1 (SiS_Part1Port, 0x08, 0x61); } else { SiS_SetReg1 (SiS_Part1Port, 0x07, 0x2A); SiS_SetReg1 (SiS_Part1Port, 0x08, 0x41); SiS_SetReg1 (SiS_Part1Port, 0x0C, 0xF0); } } if ((ModeNo == 0x02) || (ModeNo == 0x03) || (ModeNo == 0x07)) { if (SiS_VBInfo & SetNTSCTV) { SiS_SetReg1 (SiS_Part1Port, 0x07, 0x54); SiS_SetReg1 (SiS_Part1Port, 0x08, 0x00); } else { SiS_SetReg1 (SiS_Part1Port, 0x07, 0x55); SiS_SetReg1 (SiS_Part1Port, 0x08, 0x00); SiS_SetReg1 (SiS_Part1Port, 0x0C, 0xF0); } } if ((ModeNo == 0x04) || (ModeNo == 0x05) || (ModeNo == 0x0D) || (ModeNo == 0x50)) { if (SiS_VBInfo & SetNTSCTV) { SiS_SetReg1 (SiS_Part1Port, 0x07, 0x30); SiS_SetReg1 (SiS_Part1Port, 0x08, 0x03); } else { SiS_SetReg1 (SiS_Part1Port, 0x07, 0x2f); SiS_SetReg1 (SiS_Part1Port, 0x08, 0x02); } } } } SiS_SetReg1 (SiS_Part1Port, 0x18, 0x03); /* 0x18 SR08 */ SiS_SetRegANDOR (SiS_Part1Port, 0x19, 0xF0, 0x00); SiS_SetReg1 (SiS_Part1Port, 0x09, 0xFF); /* 0x09 Set Max VT */ tempbx = SiS_VGAVT; push1 = tempbx; tempcx = 0x121; tempbx = SiS_VGAVDE; /* 0x0E Virtical Display End */ if (tempbx == 357) tempbx = 350; if (tempbx == 360) tempbx = 350; if (tempbx == 375) tempbx = 350; if (tempbx == 405) tempbx = 400; if (tempbx == 420) tempbx = 400; if (tempbx == 525) tempbx = 480; push2 = tempbx; if (SiS_VBInfo & SetCRT2ToLCD) { if (SiS_LCDResInfo == Panel1024x768) { if (!(SiS_SetFlag & LCDVESATiming)) { if (tempbx == 350) tempbx = tempbx + 5; if (tempbx == 480) tempbx = tempbx + 5; } } } tempbx--; temp = tempbx & 0x00FF; tempbx--; temp = tempbx & 0x00FF; SiS_SetReg1 (SiS_Part1Port, 0x10, temp); /* 0x10 vertical Blank Start */ tempbx = push2; tempbx--; temp = tempbx & 0x00FF; SiS_SetReg1 (SiS_Part1Port, 0x0E, temp); if (tempbx & 0x0100) { tempcx = tempcx | 0x0002; } tempax = 0x000B; if (modeflag & DoubleScanMode) { tempax = tempax | 0x08000; } if (tempbx & 0x0200) { tempcx = tempcx | 0x0040; } temp = (tempax & 0xFF00) >> 8; SiS_SetReg1 (SiS_Part1Port, 0x0B, temp); if (tempbx & 0x0400) { tempcx = tempcx | 0x0600; } SiS_SetReg1 (SiS_Part1Port, 0x11, 0x00); /* 0x11 Vertival Blank End */ tempax = push1; tempax = tempax - tempbx; /* 0x0C Vertical Retrace Start */ tempax = tempax >> 2; push1 = tempax; /* push ax */ if (resinfo != 0x09) { tempax = tempax << 1; tempbx = tempax + tempbx; } if (SiS_VBInfo & SetCRT2ToHiVisionTV) { tempbx = tempbx - 10; } else { if (SiS_SetFlag & TVSimuMode) { if (SiS_VBInfo & SetPALTV) { tempbx = tempbx + 40; } } } tempax = push1; tempax = tempax >> 2; tempax++; tempax = tempax + tempbx; push1 = tempax; /* push ax */ if ((SiS_VBInfo & SetPALTV)) { if (tempbx <= 513) { if (tempax >= 513) { tempbx = 513; } } } temp = (tempbx & 0x00FF); SiS_SetReg1 (SiS_Part1Port, 0x0C, temp); tempbx--; temp = tempbx & 0x00FF; SiS_SetReg1 (SiS_Part1Port, 0x10, temp); if (tempbx & 0x0100) { tempcx = tempcx | 0x0008; } if (tempbx & 0x0200) { SiS_SetRegANDOR (SiS_Part1Port, 0x0B, 0x0FF, 0x20); } tempbx++; if (tempbx & 0x0100) { tempcx = tempcx | 0x0004; } if (tempbx & 0x0200) { tempcx = tempcx | 0x0080; } if (tempbx & 0x0400) { tempcx = tempcx | 0x0C00; } tempbx = push1; /* pop ax */ temp = tempbx & 0x00FF; temp = temp & 0x0F; SiS_SetReg1 (SiS_Part1Port, 0x0D, temp); /* 0x0D vertical Retrace End */ if (tempbx & 0x0010) { tempcx = tempcx | 0x2000; } temp = tempcx & 0x00FF; SiS_SetReg1 (SiS_Part1Port, 0x0A, temp); /* 0x0A CR07 */ temp = (tempcx & 0x0FF00) >> 8; SiS_SetReg1 (SiS_Part1Port, 0x17, temp); /* 0x17 SR0A */ tempax = modeflag; temp = (tempax & 0xFF00) >> 8; temp = (temp >> 1) & 0x09; SiS_SetReg1 (SiS_Part1Port, 0x16, temp); /* 0x16 SR01 */ SiS_SetReg1 (SiS_Part1Port, 0x0F, 0); /* 0x0F CR14 */ SiS_SetReg1 (SiS_Part1Port, 0x12, 0); /* 0x12 CR17 */ if (SiS_LCDInfo & LCDRGB18Bit) temp = 0x80; else temp = 0x00; SiS_SetReg1 (SiS_Part1Port, 0x1A, temp); /* 0x1A SR0E */ return;}voidSiS_SetGroup1_LVDS (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, pushcx; ULONG tempeax = 0, tempebx, tempecx, tempvcfact = 0; 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; tempcx = tempcx - tempbx; /* HT-HDE */ if (SiS_LCDInfo & LCDNonExpanding) { if (SiS_LCDResInfo == Panel800x600) tempbx = 800; if (SiS_LCDResInfo == Panel1024x768) tempbx = 1024; } 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_VBInfo & SetCRT2ToLCD) { if (SiS_LCDResInfo == Panel800x600) tempax = 600; if (SiS_LCDResInfo == Panel1024x768) tempax = 768; } } 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 */ 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 */ if (SiS_SetFlag & EnableLVDSDDA) { tempebx = tempebx & 0x003F; } temp = (USHORT) (tempebx & 0x00FF); SiS_SetReg1 (SiS_Part1Port, 0x1E, temp); /* Part1_1Eh */ /*add for 301b different 301 */ if ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) { 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_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_VGAHDE; tempebx = SiS_HDE; tempeax = tempecx; tempeax = tempeax << 6; tempeax = tempeax << 10; tempeax = tempeax / tempebx; if (tempebx == tempecx) { tempeax = 65535; } tempecx = tempeax; tempeax = SiS_VGAHDE; /*change VGAHT->VGAHDE */ 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 */ 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; 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); SiS_SetReg1 (SiS_Part1Port, 0x19, 0x38); SiS_SetReg1 (SiS_Part1Port, 0x1e, 0x7d); } /*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);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -