sis_bridge.c

来自「君正早期ucos系统(只有早期的才不没有打包成库),MPLAYER,文件系统,图」· C语言 代码 · 共 694 行 · 第 1/2 页

C
694
字号
    else if (CR32 & 0x02)	sis_vbflags |= TV_SVIDEO;    else if (CR32 & 0x01)	sis_vbflags |= TV_AVIDEO;    else if (CR32 & 0x40)	sis_vbflags |= (TV_SVIDEO | TV_HIVISION);    else if ((CR38 & 0x04) && (sis_vbflags & (VB_301LV | VB_302LV)))	sis_vbflags |= TV_HIVISION_LV;    else if ((CR38 & 0x04) && (sis_vbflags & VB_CHRONTEL))	sis_vbflags |= (TV_CHSCART | TV_PAL);    else if ((CR38 & 0x08) && (sis_vbflags & VB_CHRONTEL))	sis_vbflags |= (TV_CHHDTV | TV_NTSC);    if (sis_vbflags & (TV_SCART | TV_SVIDEO | TV_AVIDEO | TV_HIVISION)) {	if (sis_vga_engine == SIS_300_VGA) {	    /* TW: Should be SR38 here as well, but this	     *     does not work. Looks like a BIOS bug (2.04.5c).	     */	    if (SR16 & 0x20)		sis_vbflags |= TV_PAL;	    else		sis_vbflags |= TV_NTSC;	} else if ((sis_device_id == DEVICE_SIS_550_VGA)) {	    inSISIDXREG(SISCR, 0x79, CR79);	    if (CR79 & 0x08) {		inSISIDXREG(SISCR, 0x79, CR79);		CR79 >>= 5;	    }	    if (CR79 & 0x01) {		sis_vbflags |= TV_PAL;		if (CR38 & 0x40)		    sis_vbflags |= TV_PALM;		else if (CR38 & 0x80)		    sis_vbflags |= TV_PALN;	    } else		sis_vbflags |= TV_NTSC;	} else if ((sis_device_id == DEVICE_SIS_650_VGA)) {	    inSISIDXREG(SISCR, 0x79, CR79);	    if (CR79 & 0x20) {		sis_vbflags |= TV_PAL;		if (CR38 & 0x40)		    sis_vbflags |= TV_PALM;		else if (CR38 & 0x80)		    sis_vbflags |= TV_PALN;	    } else		sis_vbflags |= TV_NTSC;	} else {		/* 315, 330 */	    if (SR38 & 0x01) {		sis_vbflags |= TV_PAL;		if (CR38 & 0x40)		    sis_vbflags |= TV_PALM;		else if (CR38 & 0x80)		    sis_vbflags |= TV_PALN;	    } else		sis_vbflags |= TV_NTSC;	}    }    if (sis_vbflags &	(TV_SCART | TV_SVIDEO | TV_AVIDEO | TV_HIVISION | TV_CHSCART |	 TV_CHHDTV)) {	if (sis_verbose > 0) {	    printf("[SiS] %sTV standard %s\n",		   (sis_vbflags & (TV_CHSCART | TV_CHHDTV)) ? "Using " :		   "Detected default ",		   (sis_vbflags & TV_NTSC) ? ((sis_vbflags & TV_CHHDTV) ?					      "480i HDTV" : "NTSC")		   : ((sis_vbflags & TV_PALM) ? "PALM"		      : ((sis_vbflags & TV_PALN) ? "PALN" : "PAL")));	}    }}static void sis_detect_crt2(void){    unsigned char CR32;    if (!(sis_vbflags & VB_VIDEOBRIDGE))	return;    /* CRT2-VGA not supported on LVDS and 30xLV */    if (sis_vbflags & (VB_LVDS | VB_301LV | VB_302LV))	return;    inSISIDXREG(SISCR, 0x32, CR32);    if (CR32 & 0x10)	sis_vbflags |= CRT2_VGA;}/* Preinit: detect video bridge and sense connected devs */static void sis_detect_video_bridge(void){    int temp, temp1, temp2;    sis_vbflags = 0;    if (sis_vga_engine != SIS_300_VGA && sis_vga_engine != SIS_315_VGA)	return;    inSISIDXREG(SISPART4, 0x00, temp);    temp &= 0x0F;    if (temp == 1) {	inSISIDXREG(SISPART4, 0x01, temp1);	temp1 &= 0xff;	if (temp1 >= 0xE0) {	    sis_vbflags |= VB_302LV;	    //pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV;	    if (sis_verbose > 1) {		printf		    ("[SiS] Detected SiS302LV video bridge (ID 1; Revision 0x%x)\n",		     temp1);	    }	} else if (temp1 >= 0xD0) {	    sis_vbflags |= VB_301LV;	    //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV;	    if (sis_verbose > 1) {		printf		    ("[SiS] Detected SiS301LV video bridge (ID 1; Revision 0x%x)\n",		     temp1);	    }	} else if (temp1 >= 0xB0) {	    sis_vbflags |= VB_301B;	    //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301B;	    inSISIDXREG(SISPART4, 0x23, temp2);	    if (!(temp2 & 0x02))		sis_vbflags |= VB_30xBDH;	    if (sis_verbose > 1) {		printf		    ("[SiS] Detected SiS301B%s video bridge (Revision 0x%x)\n",		     (temp2 & 0x02) ? "" : " (DH)", temp1);	    }	} else {	    sis_vbflags |= VB_301;	    //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301;	    if (sis_verbose > 1) {		printf		    ("[SiS] Detected SiS301 video bridge (Revision 0x%x)\n",		     temp1);	    }	}	sis_sense_30x();    } else if (temp == 2) {	inSISIDXREG(SISPART4, 0x01, temp1);	temp1 &= 0xff;	if (temp1 >= 0xE0) {	    sis_vbflags |= VB_302LV;	    //pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV;	    if (sis_verbose > 1) {		printf		    ("[SiS] Detected SiS302LV video bridge (ID 2; Revision 0x%x)\n",		     temp1);	    }	} else if (temp1 >= 0xD0) {	    sis_vbflags |= VB_301LV;	    //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV;	    if (sis_verbose > 1) {		printf		    ("[SiS] Detected SiS301LV video bridge (ID 2; Revision 0x%x)\n",		     temp1);	    }	} else {	    sis_vbflags |= VB_302B;	    //pSiS->sishw_ext.ujVBChipID = VB_CHIP_302B;	    inSISIDXREG(SISPART4, 0x23, temp2);	    if (!(temp & 0x02))		sis_vbflags |= VB_30xBDH;	    if (sis_verbose > 1) {		printf		    ("[SiS] Detected SiS302B%s video bridge (Revision 0x%x)\n",		     (temp2 & 0x02) ? "" : " (DH)", temp1);	    }	}	sis_sense_30x();    } else if (temp == 3) {	if (sis_verbose > 1) {	    printf("[SiS] Detected SiS303 video bridge - not supported\n");	}    } else {	/* big scary mess of code to handle unknown or Chrontel LVDS */	/* skipping it for now */	if (sis_verbose > 1) {	    printf		("[SiS] Detected Chrontel video bridge - not supported\n");	}    }    /* this is probably not relevant to video overlay driver... */    /* detects if brdige uses LCDA for low res text modes */    if (sis_vga_engine == SIS_315_VGA) {	if (sis_vbflags & (VB_302B | VB_301LV | VB_302LV)) {		inSISIDXREG(SISCR, 0x34, temp);		if (temp <= 0x13) {		    inSISIDXREG(SISCR, 0x38, temp);		    if ((temp & 0x03) == 0x03) {			//pSiS->SiS_Pr->SiS_UseLCDA = TRUE;			sis_vbflags |= VB_USELCDA;		    } else {			inSISIDXREG(SISCR, 0x30, temp);			if (temp & 0x20) {			    inSISIDXREG(SISPART1, 0x13, temp);			    if (temp & 0x40) {				//pSiS->SiS_Pr->SiS_UseLCDA = TRUE;				sis_vbflags |= VB_USELCDA;			    }			}		    }		}	    if (sis_vbflags & VB_USELCDA) {		/* printf("Bridge uses LCDA for low resolution and text modes\n"); */	    }	}    }}/* detect video bridge type and sense connected devices */void sis_init_video_bridge(void){    sis_detect_video_bridge();    sis_detect_crt1();    //sis_detect_lcd();    sis_detect_tv();    sis_detect_crt2();    sis_detected_crt2_devices =	sis_vbflags & (CRT2_LCD | CRT2_TV | CRT2_VGA);    // force crt2 type    if (sis_force_crt2_type == CRT2_DEFAULT) {	if (sis_vbflags & CRT2_VGA)	    sis_force_crt2_type = CRT2_VGA;	else if (sis_vbflags & CRT2_LCD)	    sis_force_crt2_type = CRT2_LCD;	else if (sis_vbflags & CRT2_TV)	    sis_force_crt2_type = CRT2_TV;    }    switch (sis_force_crt2_type) {    case CRT2_TV:	sis_vbflags = sis_vbflags & ~(CRT2_LCD | CRT2_VGA);	if (sis_vbflags & VB_VIDEOBRIDGE)	    sis_vbflags = sis_vbflags | CRT2_TV;	else	    sis_vbflags = sis_vbflags & ~(CRT2_TV);	break;    case CRT2_LCD:	sis_vbflags = sis_vbflags & ~(CRT2_TV | CRT2_VGA);	if ((sis_vbflags & VB_VIDEOBRIDGE) /* XXX: && (pSiS->VBLCDFlags) */	    )	    sis_vbflags = sis_vbflags | CRT2_LCD;	else {	    sis_vbflags = sis_vbflags & ~(CRT2_LCD);	    if (sis_verbose > 0) {		printf		    ("[SiS] Can't force CRT2 to LCD, no panel detected\n");	    }	}	break;    case CRT2_VGA:	if (sis_vbflags & VB_LVDS) {	    if (sis_verbose > 0) {		printf("[SiS] LVDS does not support secondary VGA\n");	    }	    break;	}	if (sis_vbflags & (VB_301LV | VB_302LV)) {	    if (sis_verbose > 0) {		printf		    ("[SiS] SiS30xLV bridge does not support secondary VGA\n");	    }	    break;	}	sis_vbflags = sis_vbflags & ~(CRT2_TV | CRT2_LCD);	if (sis_vbflags & VB_VIDEOBRIDGE)	    sis_vbflags = sis_vbflags | CRT2_VGA;	else	    sis_vbflags = sis_vbflags & ~(CRT2_VGA);	break;    default:	sis_vbflags &= ~(CRT2_TV | CRT2_LCD | CRT2_VGA);    }    /* CRT2 gamma correction?? */    /* other force modes: */    /*  have a 'force tv type' (svideo, composite, scart) option? */    /*  have a 'force crt1 type' (to turn it off, etc??) */    /* TW: Check if CRT1 used (or needed; this eg. if no CRT2 detected) */    if (sis_vbflags & VB_VIDEOBRIDGE) {	/* TW: No CRT2 output? Then we NEED CRT1!	 *     We also need CRT1 if depth = 8 and bridge=LVDS|630+301B	 */	if ((!(sis_vbflags & (CRT2_VGA | CRT2_LCD | CRT2_TV))) || (	/*(pScrn->bitsPerPixel == 8) && */								      ((sis_vbflags & (VB_LVDS | VB_CHRONTEL)) || ((sis_vga_engine == SIS_300_VGA) && (sis_vbflags & VB_301B))))) {	    sis_crt1_off = 0;	}	/* TW: No CRT2 output? Then we can't use hw overlay on CRT2 */	if (!(sis_vbflags & (CRT2_VGA | CRT2_LCD | CRT2_TV)))	    sis_overlay_on_crt1 = 1;    } else {			/* TW: no video bridge? */	/* Then we NEED CRT1... */	sis_crt1_off = 0;	/* ... and can't use CRT2 for overlay output */	sis_overlay_on_crt1 = 1;    }    /* tvstandard options ? */    // determine using CRT1 or CRT2?    /* -> NO dualhead right now... */    if (sis_vbflags & DISPTYPE_DISP2) {	if (sis_crt1_off) {	    sis_vbflags |= VB_DISPMODE_SINGLE;	    /* TW: No CRT1? Then we use the video overlay on CRT2 */	    sis_overlay_on_crt1 = 0;	} else			/* TW: CRT1 and CRT2 - mirror or dual head ----- */	    sis_vbflags |= (VB_DISPMODE_MIRROR | DISPTYPE_CRT1);    } else {			/* TW: CRT1 only ------------------------------- */	sis_vbflags |= (VB_DISPMODE_SINGLE | DISPTYPE_CRT1);    }    if (sis_verbose > 0) {	printf("[SiS] Using hardware overlay on CRT%d\n",	       sis_overlay_on_crt1 ? 1 : 2);    }}

⌨️ 快捷键说明

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