📄 theatre200.c
字号:
* Outputs: NONE * ****************************************************************************/void RT_SetBrightness (TheatrePtr t, int Brightness){ /* VALIDATE BRIGHTNESS LEVEL */ if (Brightness < -1000) { Brightness = -1000; } else if (Brightness > 1000) { Brightness = 1000; } /* Save value */ t->iBrightness = Brightness; t->dbBrightnessRatio = (double) (Brightness+1000.0) / 10.0; /* RT200 is having brightness level from 0 to 255 with 128 nominal value */ dsp_set_brightness(t, (CARD8)((Brightness*255)/2000 + 128)); return;} /* RT_SetBrightness ()... *//**************************************************************************** * RT_SetSharpness (CARD16 wSharpness) * * Function: sets the sharpness level for the Rage Theatre video in * * Inputs: CARD16 wSharpness - the sharpness value to be set. * * Outputs: NONE * ****************************************************************************/void RT_SetSharpness (TheatrePtr t, CARD16 wSharpness){ switch (wSharpness) { case DEC_SMOOTH : WriteRT_fld (fld_H_SHARPNESS, RT_NORM_SHARPNESS); t->wSharpness = RT_NORM_SHARPNESS; break; case DEC_SHARP : WriteRT_fld (fld_H_SHARPNESS, RT_HIGH_SHARPNESS); t->wSharpness = RT_HIGH_SHARPNESS; break; default: break; } return;} /* RT_SetSharpness ()... *//**************************************************************************** * RT_SetContrast (int Contrast) * * Function: sets the contrast level for the Rage Theatre video in * * Inputs: int Contrast - the contrast value to be set. * * Outputs: NONE * ****************************************************************************/void RT_SetContrast (TheatrePtr t, int Contrast){ /* VALIDATE CONTRAST LEVEL */ if (Contrast < -1000) { Contrast = -1000; } else if (Contrast > 1000) { Contrast = 1000; } /* Save contrast value */ t->iContrast = Contrast; t->dbContrast = (double) (Contrast+1000.0) / 1000.0; /* RT200 has contrast values between 0 to 255 with nominal value at 128 */ dsp_set_contrast(t, (CARD8)((Contrast*255)/2000 + 128)); return;} /* RT_SetContrast ()... *//**************************************************************************** * RT_SetInterlace (CARD8 bInterlace) * * Function: to set the interlacing pattern for the Rage Theatre video in * * Inputs: CARD8 bInterlace * * Outputs: NONE * ****************************************************************************/void RT_SetInterlace (TheatrePtr t, CARD8 bInterlace){ switch(bInterlace) { case (TRUE): /*DEC_INTERLACE */ WriteRT_fld (fld_V_DEINTERLACE_ON, 0x1); t->wInterlaced = (CARD16) RT_DECINTERLACED; break; case (FALSE): /*DEC_NONINTERLACE */ WriteRT_fld (fld_V_DEINTERLACE_ON, RT_DECNONINTERLACED); t->wInterlaced = (CARD16) RT_DECNONINTERLACED; break; default: break; } return;} /* RT_SetInterlace ()... *//**************************************************************************** * RT_SetStandard (CARD16 wStandard) * * Function: to set the input standard for the Rage Theatre video in * * Inputs: CARD16 wStandard - input standard (NTSC, PAL, SECAM) * * Outputs: NONE * ****************************************************************************/void RT_SetStandard (TheatrePtr t, CARD16 wStandard){ xf86DrvMsg(t->VIP->scrnIndex,X_INFO,"Rage Theatre setting standard 0x%04x\n", wStandard); t->wStandard = wStandard; /* Program the new standards: */ switch (wStandard & 0x00FF) { case (DEC_NTSC): /*NTSC GROUP - 480 lines */ switch (wStandard & 0xFF00) { case (extNONE): case (extNTSC): dsp_set_video_standard(t, 2); break; case (extNTSC_J): dsp_set_video_standard(t, RT200_NTSC_J); break; case (extNTSC_443): dsp_set_video_standard(t, RT200_NTSC_433); break; default: dsp_video_standard_detection(t); break; } break; case (DEC_PAL): /*PAL GROUP - 625 lines */ switch (wStandard & 0xFF00) { case (extNONE): case (extPAL): case (extPAL_B): case (extPAL_BGHI): dsp_set_video_standard(t, RT200_PAL_B); break; case (extPAL_D): dsp_set_video_standard(t, RT200_PAL_D); break; case (extPAL_G): dsp_set_video_standard(t, RT200_PAL_G); break; case (extPAL_H): dsp_set_video_standard(t, RT200_PAL_H); break; case (extPAL_I): dsp_set_video_standard(t, RT200_PAL_D); break; case (extPAL_N): dsp_set_video_standard(t, RT200_PAL_N); break; case (extPAL_NCOMB): dsp_set_video_standard(t, RT200_PAL_Ncomb); break; case (extPAL_M): dsp_set_video_standard(t, RT200_PAL_M); break; case (extPAL_60): dsp_set_video_standard(t, RT200_PAL_60); break; default: dsp_video_standard_detection(t); break; } break; case (DEC_SECAM): /*SECAM GROUP*/ switch (wStandard & 0xFF00) { case (extNONE): case (extSECAM): dsp_set_video_standard(t, RT200_SECAM); break; case (extSECAM_B): dsp_set_video_standard(t, RT200_SECAM_B); break; case (extSECAM_D): dsp_set_video_standard(t, RT200_SECAM_D); break; case (extSECAM_G): dsp_set_video_standard(t, RT200_SECAM_G); break; case (extSECAM_H): dsp_set_video_standard(t, RT200_SECAM_H); break; case (extSECAM_K): dsp_set_video_standard(t, RT200_SECAM_K); break; case (extSECAM_K1): dsp_set_video_standard(t, RT200_SECAM_K1); break; case (extSECAM_L): dsp_set_video_standard(t, RT200_SECAM_L); break; case (extSECAM_L1): dsp_set_video_standard(t, RT200_SECAM_L1); break; default: dsp_video_standard_detection(t); break; } break; default: dsp_video_standard_detection(t); } } /* RT_SetStandard ()... *//**************************************************************************** * RT_SetOutputVideoSize (CARD16 wHorzSize, CARD16 wVertSize, * * CARD8 fCC_On, CARD8 fVBICap_On) * * Function: sets the output video size for the Rage Theatre video in * * Inputs: CARD16 wHorzSize - width of output in pixels * * CARD16 wVertSize - height of output in pixels (lines) * * CARD8 fCC_On - enable CC output * * CARD8 fVBI_Cap_On - enable VBI capture * * Outputs: NONE * ****************************************************************************/void RT_SetOutputVideoSize (TheatrePtr t, CARD16 wHorzSize, CARD16 wVertSize, CARD8 fCC_On, CARD8 fVBICap_On){ /* VBI is ignored now */ /* * If I pass the (wHorzSize, 0, 0) (wVertSize, 0, 0) the image does not synchronize */ dsp_set_video_scaler_horizontal(t, 0, 0, 0); dsp_set_video_scaler_vertical(t, 0, 0, 0);} /* RT_SetOutputVideoSize ()...*//**************************************************************************** * RT_SetConnector (CARD16 wStandard, int tunerFlag) * * Function: * Inputs: CARD16 wStandard - input standard (NTSC, PAL, SECAM) * * int tunerFlag * Outputs: NONE * ****************************************************************************/void RT_SetConnector (TheatrePtr t, CARD16 wConnector, int tunerFlag){ CARD32 data; t->wConnector = wConnector; theatre_read(t, VIP_GPIO_CNTL, &data); xf86DrvMsg(t->VIP->scrnIndex,X_INFO,"VIP_GPIO_CNTL: %lx\n", data); theatre_read(t, VIP_GPIO_INOUT, &data); xf86DrvMsg(t->VIP->scrnIndex,X_INFO,"VIP_GPIO_INOUT: %lx\n", data); switch (wConnector) { case (DEC_TUNER): /* Tuner*/ /* RT200 does not have any input connector 0 */ dsp_set_video_input_connector(t, t->wTunerConnector + 1); /* this is to set the analog mux used for sond */ theatre_read(t, VIP_GPIO_CNTL, &data); data &= ~0x10; theatre_write(t, VIP_GPIO_CNTL, data); theatre_read(t, VIP_GPIO_INOUT, &data); data &= ~0x10; theatre_write(t, VIP_GPIO_INOUT, data); break; case (DEC_COMPOSITE): /* Comp*/ dsp_set_video_input_connector(t, t->wComp0Connector); /* this is to set the analog mux used for sond */ theatre_read(t, VIP_GPIO_CNTL, &data); data |= 0x10; theatre_write(t, VIP_GPIO_CNTL, data); theatre_read(t, VIP_GPIO_INOUT, &data); data |= 0x10; theatre_write(t, VIP_GPIO_INOUT, data); break; case (DEC_SVIDEO): /* Svideo*/ dsp_set_video_input_connector(t, t->wSVideo0Connector); /* this is to set the analog mux used for sond */ theatre_read(t, VIP_GPIO_CNTL, &data); data |= 0x10; theatre_write(t, VIP_GPIO_CNTL, data); theatre_read(t, VIP_GPIO_INOUT, &data); data |= 0x10; theatre_write(t, VIP_GPIO_INOUT, data); break; default: dsp_set_video_input_connector(t, t->wComp0Connector); } theatre_read(t, VIP_GPIO_CNTL, &data); xf86DrvMsg(t->VIP->scrnIndex,X_INFO,"VIP_GPIO_CNTL: %lx\n", data); theatre_read(t, VIP_GPIO_INOUT, &data); xf86DrvMsg(t->VIP->scrnIndex,X_INFO,"VIP_GPIO_INOUT: %lx\n", data); dsp_configure_i2s_port(t, 0, 0, 0); dsp_configure_spdif_port(t, 0); /*dsp_audio_detection(t, 0);*/ dsp_audio_mute(t, 1, 1); dsp_set_audio_volume(t, 128, 128, 0);} /* RT_SetConnector ()...*/void InitTheatre(TheatrePtr t){ CARD32 data; CARD32 M, N, P; /* this will give 108Mhz at 27Mhz reference */ M = 28; N = 224; P = 1; ShutdownTheatre(t); usleep(100000); t->mode=MODE_INITIALIZATION_IN_PROGRESS; data = M | (N << 11) | (P <<24); RT_regw(VIP_DSP_PLL_CNTL, data); RT_regr(VIP_PLL_CNTL0, &data); data |= 0x2000; RT_regw(VIP_PLL_CNTL0, data); /* RT_regw(VIP_I2C_SLVCNTL, 0x249); */ RT_regr(VIP_PLL_CNTL1, &data); data |= 0x00030003; RT_regw(VIP_PLL_CNTL1, data); RT_regr(VIP_PLL_CNTL0, &data); data &= 0xfffffffc; RT_regw(VIP_PLL_CNTL0, data); usleep(15000); RT_regr(VIP_CLOCK_SEL_CNTL, &data); data |= 0x1b; RT_regw(VIP_CLOCK_SEL_CNTL, data); RT_regr(VIP_MASTER_CNTL, &data); data &= 0xffffff07; RT_regw(VIP_MASTER_CNTL, data); data &= 0xffffff03; RT_regw(VIP_MASTER_CNTL, data); usleep(1000); if (t->microc_path == NULL) { t->microc_path = DEFAULT_MICROC_PATH; xf86DrvMsg(t->VIP->scrnIndex, X_INFO, "Microcode: Use default microcode path: %s\n", DEFAULT_MICROC_PATH); } else xf86DrvMsg(t->VIP->scrnIndex, X_INFO, "Microcode: Use microcode path: %s\n", t->microc_path); if (t->microc_type == NULL) { t->microc_type = DEFAULT_MICROC_TYPE; xf86DrvMsg(t->VIP->scrnIndex, X_IN
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -