1209ff23fSmrg#ifdef HAVE_CONFIG_H 2209ff23fSmrg#include "config.h" 3209ff23fSmrg#endif 4209ff23fSmrg 5209ff23fSmrg#include <unistd.h> 6209ff23fSmrg#include "xf86.h" 7209ff23fSmrg#include "generic_bus.h" 8209ff23fSmrg#include "theatre.h" 9209ff23fSmrg#include "theatre_reg.h" 10209ff23fSmrg 11209ff23fSmrg#undef read 12209ff23fSmrg#undef write 13209ff23fSmrg#undef ioctl 14209ff23fSmrg 15209ff23fSmrgstatic Bool theatre_read(TheatrePtr t,uint32_t reg, uint32_t *data) 16209ff23fSmrg{ 17209ff23fSmrg if(t->theatre_num<0)return FALSE; 18209ff23fSmrg return t->VIP->read(t->VIP, ((t->theatre_num & 0x3)<<14) | reg,4, (uint8_t *) data); 19209ff23fSmrg} 20209ff23fSmrg 21209ff23fSmrgstatic Bool theatre_write(TheatrePtr t,uint32_t reg, uint32_t data) 22209ff23fSmrg{ 23209ff23fSmrg if(t->theatre_num<0)return FALSE; 24209ff23fSmrg return t->VIP->write(t->VIP,((t->theatre_num & 0x03)<<14) | reg,4, (uint8_t *) &data); 25209ff23fSmrg} 26209ff23fSmrg 27209ff23fSmrg#define RT_regr(reg,data) theatre_read(t,(reg),(data)) 28209ff23fSmrg#define RT_regw(reg,data) theatre_write(t,(reg),(data)) 29209ff23fSmrg#define VIP_TYPE "ATI VIP BUS" 30209ff23fSmrg 31209ff23fSmrgstatic void CalculateCrCbGain (TheatrePtr t, double *CrGain, double *CbGain, uint16_t wStandard); 32209ff23fSmrgstatic void RT_SetCombFilter (TheatrePtr t, uint16_t wStandard, uint16_t wConnector); 33209ff23fSmrg 34209ff23fSmrg#if 0 35209ff23fSmrgTheatrePtr DetectTheatre(GENERIC_BUS_Ptr b) 36209ff23fSmrg{ 37209ff23fSmrg TheatrePtr t; 38209ff23fSmrg uint32_t i; 39209ff23fSmrg uint32_t val; 40209ff23fSmrg char s[20]; 41209ff23fSmrg 42209ff23fSmrg b->ioctl(b,GB_IOCTL_GET_TYPE,20,s); 43209ff23fSmrg if(strcmp(VIP_TYPE, s)){ 44209ff23fSmrg xf86DrvMsg(b->scrnIndex, X_ERROR, "DetectTheatre must be called with bus of type \"%s\", not \"%s\"\n", 45209ff23fSmrg VIP_TYPE, s); 46209ff23fSmrg return NULL; 47209ff23fSmrg } 48209ff23fSmrg 4940732134Srjs t = calloc(1,sizeof(TheatreRec)); 50209ff23fSmrg t->VIP = b; 51209ff23fSmrg t->theatre_num = -1; 52209ff23fSmrg t->mode=MODE_UNINITIALIZED; 53209ff23fSmrg 54209ff23fSmrg b->read(b, VIP_VIP_VENDOR_DEVICE_ID, 4, (uint8_t *)&val); 55209ff23fSmrg for(i=0;i<4;i++) 56209ff23fSmrg { 57209ff23fSmrg if(b->read(b, ((i & 0x03)<<14) | VIP_VIP_VENDOR_DEVICE_ID, 4, (uint8_t *)&val)) 58209ff23fSmrg { 59209ff23fSmrg if(val)xf86DrvMsg(b->scrnIndex, X_INFO, "Device %d on VIP bus ids as 0x%08x\n",i,val); 60209ff23fSmrg if(t->theatre_num>=0)continue; /* already found one instance */ 61209ff23fSmrg switch(val){ 62209ff23fSmrg case RT100_ATI_ID: 63209ff23fSmrg t->theatre_num=i; 64209ff23fSmrg t->theatre_id=RT100_ATI_ID; 65209ff23fSmrg break; 66209ff23fSmrg case RT200_ATI_ID: 67209ff23fSmrg t->theatre_num=i; 68209ff23fSmrg t->theatre_id=RT200_ATI_ID; 69209ff23fSmrg break; 70209ff23fSmrg } 71209ff23fSmrg } else { 72209ff23fSmrg xf86DrvMsg(b->scrnIndex, X_INFO, "No response from device %d on VIP bus\n",i); 73209ff23fSmrg } 74209ff23fSmrg } 75209ff23fSmrg if(t->theatre_num>=0)xf86DrvMsg(b->scrnIndex, X_INFO, "Detected Rage Theatre as device %d on VIP bus with id 0x%08x\n",t->theatre_num,t->theatre_id); 76209ff23fSmrg 77209ff23fSmrg if(t->theatre_id==RT200_ATI_ID){ 78209ff23fSmrg xf86DrvMsg(b->scrnIndex, X_INFO, "Rage Theatre 200 is not supported yet\n"); 79209ff23fSmrg t->theatre_num=-1; 80209ff23fSmrg } 81209ff23fSmrg 82209ff23fSmrg if(t->theatre_num < 0) 83209ff23fSmrg { 8440732134Srjs free(t); 85209ff23fSmrg return NULL; 86209ff23fSmrg } 87209ff23fSmrg 88209ff23fSmrg RT_regr(VIP_VIP_REVISION_ID, &val); 89209ff23fSmrg xf86DrvMsg(b->scrnIndex, X_INFO, "Detected Rage Theatre revision %8.8X\n", val); 90209ff23fSmrg 91209ff23fSmrg#if 0 92209ff23fSmrgDumpRageTheatreRegsByName(t); 93209ff23fSmrg#endif 94209ff23fSmrg return t; 95209ff23fSmrg} 96209ff23fSmrg#endif 97209ff23fSmrg 98209ff23fSmrgenum 99209ff23fSmrg{ 100209ff23fSmrgfld_tmpReg1=0, 101209ff23fSmrgfld_tmpReg2, 102209ff23fSmrgfld_tmpReg3, 103209ff23fSmrgfld_LP_CONTRAST, 104209ff23fSmrgfld_LP_BRIGHTNESS, 105209ff23fSmrgfld_CP_HUE_CNTL, 106209ff23fSmrgfld_LUMA_FILTER, 107209ff23fSmrgfld_H_SCALE_RATIO, 108209ff23fSmrgfld_H_SHARPNESS, 109209ff23fSmrgfld_V_SCALE_RATIO, 110209ff23fSmrgfld_V_DEINTERLACE_ON, 111209ff23fSmrgfld_V_BYPSS, 112209ff23fSmrgfld_V_DITHER_ON, 113209ff23fSmrgfld_EVENF_OFFSET, 114209ff23fSmrgfld_ODDF_OFFSET, 115209ff23fSmrgfld_INTERLACE_DETECTED, 116209ff23fSmrgfld_VS_LINE_COUNT, 117209ff23fSmrgfld_VS_DETECTED_LINES, 118209ff23fSmrgfld_VS_ITU656_VB, 119209ff23fSmrgfld_VBI_CC_DATA, 120209ff23fSmrgfld_VBI_CC_WT, 121209ff23fSmrgfld_VBI_CC_WT_ACK, 122209ff23fSmrgfld_VBI_CC_HOLD, 123209ff23fSmrgfld_VBI_DECODE_EN, 124209ff23fSmrgfld_VBI_CC_DTO_P, 125209ff23fSmrgfld_VBI_20BIT_DTO_P, 126209ff23fSmrgfld_VBI_CC_LEVEL, 127209ff23fSmrgfld_VBI_20BIT_LEVEL, 128209ff23fSmrgfld_VBI_CLK_RUNIN_GAIN, 129209ff23fSmrgfld_H_VBI_WIND_START, 130209ff23fSmrgfld_H_VBI_WIND_END, 131209ff23fSmrgfld_V_VBI_WIND_START, 132209ff23fSmrgfld_V_VBI_WIND_END, 133209ff23fSmrgfld_VBI_20BIT_DATA0, 134209ff23fSmrgfld_VBI_20BIT_DATA1, 135209ff23fSmrgfld_VBI_20BIT_WT, 136209ff23fSmrgfld_VBI_20BIT_WT_ACK, 137209ff23fSmrgfld_VBI_20BIT_HOLD, 138209ff23fSmrgfld_VBI_CAPTURE_ENABLE, 139209ff23fSmrgfld_VBI_EDS_DATA, 140209ff23fSmrgfld_VBI_EDS_WT, 141209ff23fSmrgfld_VBI_EDS_WT_ACK, 142209ff23fSmrgfld_VBI_EDS_HOLD, 143209ff23fSmrgfld_VBI_SCALING_RATIO, 144209ff23fSmrgfld_VBI_ALIGNER_ENABLE, 145209ff23fSmrgfld_H_ACTIVE_START, 146209ff23fSmrgfld_H_ACTIVE_END, 147209ff23fSmrgfld_V_ACTIVE_START, 148209ff23fSmrgfld_V_ACTIVE_END, 149209ff23fSmrgfld_CH_HEIGHT, 150209ff23fSmrgfld_CH_KILL_LEVEL, 151209ff23fSmrgfld_CH_AGC_ERROR_LIM, 152209ff23fSmrgfld_CH_AGC_FILTER_EN, 153209ff23fSmrgfld_CH_AGC_LOOP_SPEED, 154209ff23fSmrgfld_HUE_ADJ, 155209ff23fSmrgfld_STANDARD_SEL, 156209ff23fSmrgfld_STANDARD_YC, 157209ff23fSmrgfld_ADC_PDWN, 158209ff23fSmrgfld_INPUT_SELECT, 159209ff23fSmrgfld_ADC_PREFLO, 160209ff23fSmrgfld_H_SYNC_PULSE_WIDTH, 161209ff23fSmrgfld_HS_GENLOCKED, 162209ff23fSmrgfld_HS_SYNC_IN_WIN, 163209ff23fSmrgfld_VIN_ASYNC_RST, 164209ff23fSmrgfld_DVS_ASYNC_RST, 165209ff23fSmrgfld_VIP_VENDOR_ID, 166209ff23fSmrgfld_VIP_DEVICE_ID, 167209ff23fSmrgfld_VIP_REVISION_ID, 168209ff23fSmrgfld_BLACK_INT_START, 169209ff23fSmrgfld_BLACK_INT_LENGTH, 170209ff23fSmrgfld_UV_INT_START, 171209ff23fSmrgfld_U_INT_LENGTH, 172209ff23fSmrgfld_V_INT_LENGTH, 173209ff23fSmrgfld_CRDR_ACTIVE_GAIN, 174209ff23fSmrgfld_CBDB_ACTIVE_GAIN, 175209ff23fSmrgfld_DVS_DIRECTION, 176209ff23fSmrgfld_DVS_VBI_UINT8_SWAP, 177209ff23fSmrgfld_DVS_CLK_SELECT, 178209ff23fSmrgfld_CONTINUOUS_STREAM, 179209ff23fSmrgfld_DVSOUT_CLK_DRV, 180209ff23fSmrgfld_DVSOUT_DATA_DRV, 181209ff23fSmrgfld_COMB_CNTL0, 182209ff23fSmrgfld_COMB_CNTL1, 183209ff23fSmrgfld_COMB_CNTL2, 184209ff23fSmrgfld_COMB_LENGTH, 185209ff23fSmrgfld_SYNCTIP_REF0, 186209ff23fSmrgfld_SYNCTIP_REF1, 187209ff23fSmrgfld_CLAMP_REF, 188209ff23fSmrgfld_AGC_PEAKWHITE, 189209ff23fSmrgfld_VBI_PEAKWHITE, 190209ff23fSmrgfld_WPA_THRESHOLD, 191209ff23fSmrgfld_WPA_TRIGGER_LO, 192209ff23fSmrgfld_WPA_TRIGGER_HIGH, 193209ff23fSmrgfld_LOCKOUT_START, 194209ff23fSmrgfld_LOCKOUT_END, 195209ff23fSmrgfld_CH_DTO_INC, 196209ff23fSmrgfld_PLL_SGAIN, 197209ff23fSmrgfld_PLL_FGAIN, 198209ff23fSmrgfld_CR_BURST_GAIN, 199209ff23fSmrgfld_CB_BURST_GAIN, 200209ff23fSmrgfld_VERT_LOCKOUT_START, 201209ff23fSmrgfld_VERT_LOCKOUT_END, 202209ff23fSmrgfld_H_IN_WIND_START, 203209ff23fSmrgfld_V_IN_WIND_START, 204209ff23fSmrgfld_H_OUT_WIND_WIDTH, 205209ff23fSmrgfld_V_OUT_WIND_WIDTH, 206209ff23fSmrgfld_HS_LINE_TOTAL, 207209ff23fSmrgfld_MIN_PULSE_WIDTH, 208209ff23fSmrgfld_MAX_PULSE_WIDTH, 209209ff23fSmrgfld_WIN_CLOSE_LIMIT, 210209ff23fSmrgfld_WIN_OPEN_LIMIT, 211209ff23fSmrgfld_VSYNC_INT_TRIGGER, 212209ff23fSmrgfld_VSYNC_INT_HOLD, 213209ff23fSmrgfld_VIN_M0, 214209ff23fSmrgfld_VIN_N0, 215209ff23fSmrgfld_MNFLIP_EN, 216209ff23fSmrgfld_VIN_P, 217209ff23fSmrgfld_REG_CLK_SEL, 218209ff23fSmrgfld_VIN_M1, 219209ff23fSmrgfld_VIN_N1, 220209ff23fSmrgfld_VIN_DRIVER_SEL, 221209ff23fSmrgfld_VIN_MNFLIP_REQ, 222209ff23fSmrgfld_VIN_MNFLIP_DONE, 223209ff23fSmrgfld_TV_LOCK_TO_VIN, 224209ff23fSmrgfld_TV_P_FOR_WINCLK, 225209ff23fSmrgfld_VINRST, 226209ff23fSmrgfld_VIN_CLK_SEL, 227209ff23fSmrgfld_VS_FIELD_BLANK_START, 228209ff23fSmrgfld_VS_FIELD_BLANK_END, 229209ff23fSmrgfld_VS_FIELD_IDLOCATION, 230209ff23fSmrgfld_VS_FRAME_TOTAL, 231209ff23fSmrgfld_SYNC_TIP_START, 232209ff23fSmrgfld_SYNC_TIP_LENGTH, 233209ff23fSmrgfld_GAIN_FORCE_DATA, 234209ff23fSmrgfld_GAIN_FORCE_EN, 235209ff23fSmrgfld_I_CLAMP_SEL, 236209ff23fSmrgfld_I_AGC_SEL, 237209ff23fSmrgfld_EXT_CLAMP_CAP, 238209ff23fSmrgfld_EXT_AGC_CAP, 239209ff23fSmrgfld_DECI_DITHER_EN, 240209ff23fSmrgfld_ADC_PREFHI, 241209ff23fSmrgfld_ADC_CH_GAIN_SEL, 242209ff23fSmrgfld_HS_PLL_SGAIN, 243209ff23fSmrgfld_NREn, 244209ff23fSmrgfld_NRGainCntl, 245209ff23fSmrgfld_NRBWTresh, 246209ff23fSmrgfld_NRGCTresh, 247209ff23fSmrgfld_NRCoefDespeclMode, 248209ff23fSmrgfld_GPIO_5_OE, 249209ff23fSmrgfld_GPIO_6_OE, 250209ff23fSmrgfld_GPIO_5_OUT, 251209ff23fSmrgfld_GPIO_6_OUT, 252209ff23fSmrg 253209ff23fSmrgregRT_MAX_REGS 254209ff23fSmrg} a; 255209ff23fSmrg 256209ff23fSmrg 257209ff23fSmrgtypedef struct { 258209ff23fSmrg uint8_t size; 259209ff23fSmrg uint32_t fld_id; 260209ff23fSmrg uint32_t dwRegAddrLSBs; 261209ff23fSmrg uint32_t dwFldOffsetLSBs; 262209ff23fSmrg uint32_t dwMaskLSBs; 263209ff23fSmrg uint32_t addr2; 264209ff23fSmrg uint32_t offs2; 265209ff23fSmrg uint32_t mask2; 266209ff23fSmrg uint32_t dwCurrValue; 267209ff23fSmrg uint32_t rw; 268209ff23fSmrg} RTREGMAP; 269209ff23fSmrg 270209ff23fSmrg#define READONLY 1 271209ff23fSmrg#define WRITEONLY 2 272209ff23fSmrg#define READWRITE 3 273209ff23fSmrg 274209ff23fSmrg/* Rage Theatre's Register Mappings, including the default values: */ 275209ff23fSmrgRTREGMAP RT_RegMap[regRT_MAX_REGS]={ 276209ff23fSmrg/* 277209ff23fSmrg{size, fidname, AddrOfst, Ofst, Mask, Addr, Ofst, Mask, Cur, R/W 278209ff23fSmrg*/ 279209ff23fSmrg{32 , fld_tmpReg1 ,0x151 , 0, 0x0, 0, 0,0, 0,READWRITE }, 280209ff23fSmrg{1 , fld_tmpReg2 ,VIP_VIP_SUB_VENDOR_DEVICE_ID , 3, 0xFFFFFFFF, 0, 0,0, 0,READWRITE }, 281209ff23fSmrg{1 , fld_tmpReg3 ,VIP_VIP_COMMAND_STATUS , 3, 0xFFFFFFFF, 0, 0,0, 0,READWRITE }, 282209ff23fSmrg{8 , fld_LP_CONTRAST ,VIP_LP_CONTRAST , 0, 0xFFFFFF00, 0, 0,0, fld_LP_CONTRAST_def ,READWRITE }, 283209ff23fSmrg{14 , fld_LP_BRIGHTNESS ,VIP_LP_BRIGHTNESS , 0, 0xFFFFC000, 0, 0,0, fld_LP_BRIGHTNESS_def ,READWRITE }, 284209ff23fSmrg{8 , fld_CP_HUE_CNTL ,VIP_CP_HUE_CNTL , 0, 0xFFFFFF00, 0, 0,0, fld_CP_HUE_CNTL_def ,READWRITE }, 285209ff23fSmrg{1 , fld_LUMA_FILTER ,VIP_LP_BRIGHTNESS , 15, 0xFFFF7FFF, 0, 0,0, fld_LUMA_FILTER_def ,READWRITE }, 286209ff23fSmrg{21 , fld_H_SCALE_RATIO ,VIP_H_SCALER_CONTROL , 0, 0xFFE00000, 0, 0,0, fld_H_SCALE_RATIO_def ,READWRITE }, 287209ff23fSmrg{4 , fld_H_SHARPNESS ,VIP_H_SCALER_CONTROL , 25, 0xE1FFFFFF, 0, 0,0, fld_H_SHARPNESS_def ,READWRITE }, 288209ff23fSmrg{12 , fld_V_SCALE_RATIO ,VIP_V_SCALER_CONTROL , 0, 0xFFFFF000, 0, 0,0, fld_V_SCALE_RATIO_def ,READWRITE }, 289209ff23fSmrg{1 , fld_V_DEINTERLACE_ON,VIP_V_SCALER_CONTROL , 12, 0xFFFFEFFF, 0, 0,0, fld_V_DEINTERLACE_ON_def ,READWRITE }, 290209ff23fSmrg{1 , fld_V_BYPSS ,VIP_V_SCALER_CONTROL , 14, 0xFFFFBFFF, 0, 0,0, fld_V_BYPSS_def ,READWRITE }, 291209ff23fSmrg{1 , fld_V_DITHER_ON ,VIP_V_SCALER_CONTROL , 15, 0xFFFF7FFF, 0, 0,0, fld_V_DITHER_ON_def ,READWRITE }, 292209ff23fSmrg{11 , fld_EVENF_OFFSET ,VIP_V_DEINTERLACE_CONTROL , 0, 0xFFFFF800, 0, 0,0, fld_EVENF_OFFSET_def ,READWRITE }, 293209ff23fSmrg{11 , fld_ODDF_OFFSET ,VIP_V_DEINTERLACE_CONTROL , 11, 0xFFC007FF, 0, 0,0, fld_ODDF_OFFSET_def ,READWRITE }, 294209ff23fSmrg{1 , fld_INTERLACE_DETECTED ,VIP_VS_LINE_COUNT , 15, 0xFFFF7FFF, 0, 0,0, fld_INTERLACE_DETECTED_def,READONLY }, 295209ff23fSmrg{10 , fld_VS_LINE_COUNT ,VIP_VS_LINE_COUNT , 0, 0xFFFFFC00, 0, 0,0, fld_VS_LINE_COUNT_def ,READONLY }, 296209ff23fSmrg{10 , fld_VS_DETECTED_LINES ,VIP_VS_LINE_COUNT , 16, 0xFC00FFFF, 0, 0,0, fld_VS_DETECTED_LINES_def ,READONLY }, 297209ff23fSmrg{1 , fld_VS_ITU656_VB ,VIP_VS_LINE_COUNT , 13, 0xFFFFDFFF, 0, 0,0, fld_VS_ITU656_VB_def ,READONLY }, 298209ff23fSmrg{16 , fld_VBI_CC_DATA ,VIP_VBI_CC_CNTL , 0, 0xFFFF0000, 0, 0,0, fld_VBI_CC_DATA_def ,READWRITE }, 299209ff23fSmrg{1 , fld_VBI_CC_WT ,VIP_VBI_CC_CNTL , 24, 0xFEFFFFFF, 0, 0,0, fld_VBI_CC_WT_def ,READWRITE }, 300209ff23fSmrg{1 , fld_VBI_CC_WT_ACK ,VIP_VBI_CC_CNTL , 25, 0xFDFFFFFF, 0, 0,0, fld_VBI_CC_WT_ACK_def ,READONLY }, 301209ff23fSmrg{1 , fld_VBI_CC_HOLD ,VIP_VBI_CC_CNTL , 26, 0xFBFFFFFF, 0, 0,0, fld_VBI_CC_HOLD_def ,READWRITE }, 302209ff23fSmrg{1 , fld_VBI_DECODE_EN ,VIP_VBI_CC_CNTL , 31, 0x7FFFFFFF, 0, 0,0, fld_VBI_DECODE_EN_def ,READWRITE }, 303209ff23fSmrg{16 , fld_VBI_CC_DTO_P ,VIP_VBI_DTO_CNTL , 0, 0xFFFF0000, 0, 0,0, fld_VBI_CC_DTO_P_def ,READWRITE }, 304209ff23fSmrg{16 ,fld_VBI_20BIT_DTO_P,VIP_VBI_DTO_CNTL , 16, 0x0000FFFF, 0, 0,0, fld_VBI_20BIT_DTO_P_def ,READWRITE }, 305209ff23fSmrg{7 ,fld_VBI_CC_LEVEL ,VIP_VBI_LEVEL_CNTL , 0, 0xFFFFFF80, 0, 0,0, fld_VBI_CC_LEVEL_def ,READWRITE }, 306209ff23fSmrg{7 ,fld_VBI_20BIT_LEVEL,VIP_VBI_LEVEL_CNTL , 8, 0xFFFF80FF, 0, 0,0, fld_VBI_20BIT_LEVEL_def ,READWRITE }, 307209ff23fSmrg{9 ,fld_VBI_CLK_RUNIN_GAIN,VIP_VBI_LEVEL_CNTL , 16, 0xFE00FFFF, 0, 0,0, fld_VBI_CLK_RUNIN_GAIN_def,READWRITE }, 308209ff23fSmrg{11 ,fld_H_VBI_WIND_START,VIP_H_VBI_WINDOW , 0, 0xFFFFF800, 0, 0,0, fld_H_VBI_WIND_START_def ,READWRITE }, 309209ff23fSmrg{11 ,fld_H_VBI_WIND_END,VIP_H_VBI_WINDOW , 16, 0xF800FFFF, 0, 0,0, fld_H_VBI_WIND_END_def ,READWRITE }, 310209ff23fSmrg{10 ,fld_V_VBI_WIND_START,VIP_V_VBI_WINDOW , 0, 0xFFFFFC00, 0, 0,0, fld_V_VBI_WIND_START_def ,READWRITE }, 311209ff23fSmrg{10 ,fld_V_VBI_WIND_END,VIP_V_VBI_WINDOW , 16, 0xFC00FFFF, 0, 0,0, fld_V_VBI_WIND_END_def ,READWRITE }, /* CHK */ 312209ff23fSmrg{16 ,fld_VBI_20BIT_DATA0,VIP_VBI_20BIT_CNTL , 0, 0xFFFF0000, 0, 0,0, fld_VBI_20BIT_DATA0_def ,READWRITE }, 313209ff23fSmrg{4 ,fld_VBI_20BIT_DATA1,VIP_VBI_20BIT_CNTL , 16, 0xFFF0FFFF, 0, 0,0, fld_VBI_20BIT_DATA1_def ,READWRITE }, 314209ff23fSmrg{1 ,fld_VBI_20BIT_WT ,VIP_VBI_20BIT_CNTL , 24, 0xFEFFFFFF, 0, 0,0, fld_VBI_20BIT_WT_def ,READWRITE }, 315209ff23fSmrg{1 ,fld_VBI_20BIT_WT_ACK ,VIP_VBI_20BIT_CNTL , 25, 0xFDFFFFFF, 0, 0,0, fld_VBI_20BIT_WT_ACK_def ,READONLY }, 316209ff23fSmrg{1 ,fld_VBI_20BIT_HOLD ,VIP_VBI_20BIT_CNTL , 26, 0xFBFFFFFF, 0, 0,0, fld_VBI_20BIT_HOLD_def ,READWRITE }, 317209ff23fSmrg{2 ,fld_VBI_CAPTURE_ENABLE ,VIP_VBI_CONTROL , 0, 0xFFFFFFFC, 0, 0,0, fld_VBI_CAPTURE_ENABLE_def,READWRITE }, 318209ff23fSmrg{16 ,fld_VBI_EDS_DATA ,VIP_VBI_EDS_CNTL , 0, 0xFFFF0000, 0, 0,0, fld_VBI_EDS_DATA_def ,READWRITE }, 319209ff23fSmrg{1 ,fld_VBI_EDS_WT ,VIP_VBI_EDS_CNTL , 24, 0xFEFFFFFF, 0, 0,0, fld_VBI_EDS_WT_def ,READWRITE }, 320209ff23fSmrg{1 ,fld_VBI_EDS_WT_ACK ,VIP_VBI_EDS_CNTL , 25, 0xFDFFFFFF, 0, 0,0, fld_VBI_EDS_WT_ACK_def ,READONLY }, 321209ff23fSmrg{1 ,fld_VBI_EDS_HOLD ,VIP_VBI_EDS_CNTL , 26, 0xFBFFFFFF, 0, 0,0, fld_VBI_EDS_HOLD_def ,READWRITE }, 322209ff23fSmrg{17 ,fld_VBI_SCALING_RATIO ,VIP_VBI_SCALER_CONTROL , 0, 0xFFFE0000, 0, 0,0, fld_VBI_SCALING_RATIO_def ,READWRITE }, 323209ff23fSmrg{1 ,fld_VBI_ALIGNER_ENABLE ,VIP_VBI_SCALER_CONTROL , 17, 0xFFFDFFFF, 0, 0,0, fld_VBI_ALIGNER_ENABLE_def,READWRITE }, 324209ff23fSmrg{11 ,fld_H_ACTIVE_START ,VIP_H_ACTIVE_WINDOW , 0, 0xFFFFF800, 0, 0,0, fld_H_ACTIVE_START_def ,READWRITE }, 325209ff23fSmrg{11 ,fld_H_ACTIVE_END ,VIP_H_ACTIVE_WINDOW , 16, 0xF800FFFF, 0, 0,0, fld_H_ACTIVE_END_def ,READWRITE }, 326209ff23fSmrg{10 ,fld_V_ACTIVE_START ,VIP_V_ACTIVE_WINDOW , 0, 0xFFFFFC00, 0, 0,0, fld_V_ACTIVE_START_def ,READWRITE }, 327209ff23fSmrg{10 ,fld_V_ACTIVE_END ,VIP_V_ACTIVE_WINDOW , 16, 0xFC00FFFF, 0, 0,0, fld_V_ACTIVE_END_def ,READWRITE }, 328209ff23fSmrg{8 ,fld_CH_HEIGHT ,VIP_CP_AGC_CNTL , 0, 0xFFFFFF00, 0, 0,0, fld_CH_HEIGHT_def ,READWRITE }, 329209ff23fSmrg{8 ,fld_CH_KILL_LEVEL ,VIP_CP_AGC_CNTL , 8, 0xFFFF00FF, 0, 0,0, fld_CH_KILL_LEVEL_def ,READWRITE }, 330209ff23fSmrg{2 ,fld_CH_AGC_ERROR_LIM ,VIP_CP_AGC_CNTL , 16, 0xFFFCFFFF, 0, 0,0, fld_CH_AGC_ERROR_LIM_def ,READWRITE }, 331209ff23fSmrg{1 ,fld_CH_AGC_FILTER_EN ,VIP_CP_AGC_CNTL , 18, 0xFFFBFFFF, 0, 0,0, fld_CH_AGC_FILTER_EN_def ,READWRITE }, 332209ff23fSmrg{1 ,fld_CH_AGC_LOOP_SPEED ,VIP_CP_AGC_CNTL , 19, 0xFFF7FFFF, 0, 0,0, fld_CH_AGC_LOOP_SPEED_def ,READWRITE }, 333209ff23fSmrg{8 ,fld_HUE_ADJ ,VIP_CP_HUE_CNTL , 0, 0xFFFFFF00, 0, 0,0, fld_HUE_ADJ_def ,READWRITE }, 334209ff23fSmrg{2 ,fld_STANDARD_SEL ,VIP_STANDARD_SELECT , 0, 0xFFFFFFFC, 0, 0,0, fld_STANDARD_SEL_def ,READWRITE }, 335209ff23fSmrg{1 ,fld_STANDARD_YC ,VIP_STANDARD_SELECT , 2, 0xFFFFFFFB, 0, 0,0, fld_STANDARD_YC_def ,READWRITE }, 336209ff23fSmrg{1 ,fld_ADC_PDWN ,VIP_ADC_CNTL , 7, 0xFFFFFF7F, 0, 0,0, fld_ADC_PDWN_def ,READWRITE }, 337209ff23fSmrg{3 ,fld_INPUT_SELECT ,VIP_ADC_CNTL , 0, 0xFFFFFFF8, 0, 0,0, fld_INPUT_SELECT_def ,READWRITE }, 338209ff23fSmrg{2 ,fld_ADC_PREFLO ,VIP_ADC_CNTL , 24, 0xFCFFFFFF, 0, 0,0, fld_ADC_PREFLO_def ,READWRITE }, 339209ff23fSmrg{8 ,fld_H_SYNC_PULSE_WIDTH ,VIP_HS_PULSE_WIDTH , 0, 0xFFFFFF00, 0, 0,0, fld_H_SYNC_PULSE_WIDTH_def,READONLY }, 340209ff23fSmrg{1 ,fld_HS_GENLOCKED ,VIP_HS_PULSE_WIDTH , 8, 0xFFFFFEFF, 0, 0,0, fld_HS_GENLOCKED_def ,READONLY }, 341209ff23fSmrg{1 ,fld_HS_SYNC_IN_WIN ,VIP_HS_PULSE_WIDTH , 9, 0xFFFFFDFF, 0, 0,0, fld_HS_SYNC_IN_WIN_def ,READONLY }, 342209ff23fSmrg{1 ,fld_VIN_ASYNC_RST ,VIP_MASTER_CNTL , 5, 0xFFFFFFDF, 0, 0,0, fld_VIN_ASYNC_RST_def ,READWRITE }, 343209ff23fSmrg{1 ,fld_DVS_ASYNC_RST ,VIP_MASTER_CNTL , 7, 0xFFFFFF7F, 0, 0,0, fld_DVS_ASYNC_RST_def ,READWRITE }, 344209ff23fSmrg{16 ,fld_VIP_VENDOR_ID ,VIP_VIP_VENDOR_DEVICE_ID, 0, 0xFFFF0000, 0, 0,0, fld_VIP_VENDOR_ID_def ,READONLY }, 345209ff23fSmrg{16 ,fld_VIP_DEVICE_ID ,VIP_VIP_VENDOR_DEVICE_ID,16, 0x0000FFFF, 0, 0,0, fld_VIP_DEVICE_ID_def ,READONLY }, 346209ff23fSmrg{16 ,fld_VIP_REVISION_ID ,VIP_VIP_REVISION_ID , 0, 0xFFFF0000, 0, 0,0, fld_VIP_REVISION_ID_def ,READONLY }, 347209ff23fSmrg{8 ,fld_BLACK_INT_START ,VIP_SG_BLACK_GATE , 0, 0xFFFFFF00, 0, 0,0, fld_BLACK_INT_START_def ,READWRITE }, 348209ff23fSmrg{4 ,fld_BLACK_INT_LENGTH ,VIP_SG_BLACK_GATE , 8, 0xFFFFF0FF, 0, 0,0, fld_BLACK_INT_LENGTH_def ,READWRITE }, 349209ff23fSmrg{8 ,fld_UV_INT_START ,VIP_SG_UVGATE_GATE , 0, 0xFFFFFF00, 0, 0,0, fld_UV_INT_START_def ,READWRITE }, 350209ff23fSmrg{4 ,fld_U_INT_LENGTH ,VIP_SG_UVGATE_GATE , 8, 0xFFFFF0FF, 0, 0,0, fld_U_INT_LENGTH_def ,READWRITE }, 351209ff23fSmrg{4 ,fld_V_INT_LENGTH ,VIP_SG_UVGATE_GATE , 12, 0xFFFF0FFF, 0, 0,0, fld_V_INT_LENGTH_def ,READWRITE }, 352209ff23fSmrg{10 ,fld_CRDR_ACTIVE_GAIN ,VIP_CP_ACTIVE_GAIN , 0, 0xFFFFFC00, 0, 0,0, fld_CRDR_ACTIVE_GAIN_def ,READWRITE }, 353209ff23fSmrg{10 ,fld_CBDB_ACTIVE_GAIN ,VIP_CP_ACTIVE_GAIN , 16, 0xFC00FFFF, 0, 0,0, fld_CBDB_ACTIVE_GAIN_def ,READWRITE }, 354209ff23fSmrg{1 ,fld_DVS_DIRECTION ,VIP_DVS_PORT_CTRL , 0, 0xFFFFFFFE, 0, 0,0, fld_DVS_DIRECTION_def ,READWRITE }, 355209ff23fSmrg{1 ,fld_DVS_VBI_UINT8_SWAP ,VIP_DVS_PORT_CTRL , 1, 0xFFFFFFFD, 0, 0,0, fld_DVS_VBI_UINT8_SWAP_def ,READWRITE }, 356209ff23fSmrg{1 ,fld_DVS_CLK_SELECT ,VIP_DVS_PORT_CTRL , 2, 0xFFFFFFFB, 0, 0,0, fld_DVS_CLK_SELECT_def ,READWRITE }, 357209ff23fSmrg{1 ,fld_CONTINUOUS_STREAM ,VIP_DVS_PORT_CTRL , 3, 0xFFFFFFF7, 0, 0,0, fld_CONTINUOUS_STREAM_def ,READWRITE }, 358209ff23fSmrg{1 ,fld_DVSOUT_CLK_DRV ,VIP_DVS_PORT_CTRL , 4, 0xFFFFFFEF, 0, 0,0, fld_DVSOUT_CLK_DRV_def ,READWRITE }, 359209ff23fSmrg{1 ,fld_DVSOUT_DATA_DRV ,VIP_DVS_PORT_CTRL , 5, 0xFFFFFFDF, 0, 0,0, fld_DVSOUT_DATA_DRV_def ,READWRITE }, 360209ff23fSmrg{32 ,fld_COMB_CNTL0 ,VIP_COMB_CNTL0 , 0, 0x00000000, 0, 0,0, fld_COMB_CNTL0_def ,READWRITE }, 361209ff23fSmrg{32 ,fld_COMB_CNTL1 ,VIP_COMB_CNTL1 , 0, 0x00000000, 0, 0,0, fld_COMB_CNTL1_def ,READWRITE }, 362209ff23fSmrg{32 ,fld_COMB_CNTL2 ,VIP_COMB_CNTL2 , 0, 0x00000000, 0, 0,0, fld_COMB_CNTL2_def ,READWRITE }, 363209ff23fSmrg{32 ,fld_COMB_LENGTH ,VIP_COMB_LINE_LENGTH , 0, 0x00000000, 0, 0,0, fld_COMB_LENGTH_def ,READWRITE }, 364209ff23fSmrg{8 ,fld_SYNCTIP_REF0 ,VIP_LP_AGC_CLAMP_CNTL0 , 0, 0xFFFFFF00, 0, 0,0, fld_SYNCTIP_REF0_def ,READWRITE }, 365209ff23fSmrg{8 ,fld_SYNCTIP_REF1 ,VIP_LP_AGC_CLAMP_CNTL0 , 8, 0xFFFF00FF, 0, 0,0, fld_SYNCTIP_REF1_def ,READWRITE }, 366209ff23fSmrg{8 ,fld_CLAMP_REF ,VIP_LP_AGC_CLAMP_CNTL0 , 16, 0xFF00FFFF, 0, 0,0, fld_CLAMP_REF_def ,READWRITE }, 367209ff23fSmrg{8 ,fld_AGC_PEAKWHITE ,VIP_LP_AGC_CLAMP_CNTL0 , 24, 0x00FFFFFF, 0, 0,0, fld_AGC_PEAKWHITE_def ,READWRITE }, 368209ff23fSmrg{8 ,fld_VBI_PEAKWHITE ,VIP_LP_AGC_CLAMP_CNTL1 , 0, 0xFFFFFF00, 0, 0,0, fld_VBI_PEAKWHITE_def ,READWRITE }, 369209ff23fSmrg{11 ,fld_WPA_THRESHOLD ,VIP_LP_WPA_CNTL0 , 0, 0xFFFFF800, 0, 0,0, fld_WPA_THRESHOLD_def ,READWRITE }, 370209ff23fSmrg{10 ,fld_WPA_TRIGGER_LO ,VIP_LP_WPA_CNTL1 , 0, 0xFFFFFC00, 0, 0,0, fld_WPA_TRIGGER_LO_def ,READWRITE }, 371209ff23fSmrg{10 ,fld_WPA_TRIGGER_HIGH ,VIP_LP_WPA_CNTL1 , 16, 0xFC00FFFF, 0, 0,0, fld_WPA_TRIGGER_HIGH_def ,READWRITE }, 372209ff23fSmrg{10 ,fld_LOCKOUT_START ,VIP_LP_VERT_LOCKOUT , 0, 0xFFFFFC00, 0, 0,0, fld_LOCKOUT_START_def ,READWRITE }, 373209ff23fSmrg{10 ,fld_LOCKOUT_END ,VIP_LP_VERT_LOCKOUT , 16, 0xFC00FFFF, 0, 0,0, fld_LOCKOUT_END_def ,READWRITE }, 374209ff23fSmrg{24 ,fld_CH_DTO_INC ,VIP_CP_PLL_CNTL0 , 0, 0xFF000000, 0, 0,0, fld_CH_DTO_INC_def ,READWRITE }, 375209ff23fSmrg{4 ,fld_PLL_SGAIN ,VIP_CP_PLL_CNTL0 , 24, 0xF0FFFFFF, 0, 0,0, fld_PLL_SGAIN_def ,READWRITE }, 376209ff23fSmrg{4 ,fld_PLL_FGAIN ,VIP_CP_PLL_CNTL0 , 28, 0x0FFFFFFF, 0, 0,0, fld_PLL_FGAIN_def ,READWRITE }, 377209ff23fSmrg{9 ,fld_CR_BURST_GAIN ,VIP_CP_BURST_GAIN , 0, 0xFFFFFE00, 0, 0,0, fld_CR_BURST_GAIN_def ,READWRITE }, 378209ff23fSmrg{9 ,fld_CB_BURST_GAIN ,VIP_CP_BURST_GAIN , 16, 0xFE00FFFF, 0, 0,0, fld_CB_BURST_GAIN_def ,READWRITE }, 379209ff23fSmrg{10 ,fld_VERT_LOCKOUT_START ,VIP_CP_VERT_LOCKOUT , 0, 0xFFFFFC00, 0, 0,0, fld_VERT_LOCKOUT_START_def,READWRITE }, 380209ff23fSmrg{10 ,fld_VERT_LOCKOUT_END ,VIP_CP_VERT_LOCKOUT , 16, 0xFC00FFFF, 0, 0,0, fld_VERT_LOCKOUT_END_def ,READWRITE }, 381209ff23fSmrg{11 ,fld_H_IN_WIND_START ,VIP_SCALER_IN_WINDOW , 0, 0xFFFFF800, 0, 0,0, fld_H_IN_WIND_START_def ,READWRITE }, 382209ff23fSmrg{10 ,fld_V_IN_WIND_START ,VIP_SCALER_IN_WINDOW , 16, 0xFC00FFFF, 0, 0,0, fld_V_IN_WIND_START_def ,READWRITE }, 383209ff23fSmrg{10 ,fld_H_OUT_WIND_WIDTH ,VIP_SCALER_OUT_WINDOW , 0, 0xFFFFFC00, 0, 0,0, fld_H_OUT_WIND_WIDTH_def ,READWRITE }, 384209ff23fSmrg{9 ,fld_V_OUT_WIND_WIDTH ,VIP_SCALER_OUT_WINDOW , 16, 0xFE00FFFF, 0, 0,0, fld_V_OUT_WIND_WIDTH_def ,READWRITE }, 385209ff23fSmrg{11 ,fld_HS_LINE_TOTAL ,VIP_HS_PLINE , 0, 0xFFFFF800, 0, 0,0, fld_HS_LINE_TOTAL_def ,READWRITE }, 386209ff23fSmrg{8 ,fld_MIN_PULSE_WIDTH ,VIP_HS_MINMAXWIDTH , 0, 0xFFFFFF00, 0, 0,0, fld_MIN_PULSE_WIDTH_def ,READWRITE }, 387209ff23fSmrg{8 ,fld_MAX_PULSE_WIDTH ,VIP_HS_MINMAXWIDTH , 8, 0xFFFF00FF, 0, 0,0, fld_MAX_PULSE_WIDTH_def ,READWRITE }, 388209ff23fSmrg{11 ,fld_WIN_CLOSE_LIMIT ,VIP_HS_WINDOW_LIMIT , 0, 0xFFFFF800, 0, 0,0, fld_WIN_CLOSE_LIMIT_def ,READWRITE }, 389209ff23fSmrg{11 ,fld_WIN_OPEN_LIMIT ,VIP_HS_WINDOW_LIMIT , 16, 0xF800FFFF, 0, 0,0, fld_WIN_OPEN_LIMIT_def ,READWRITE }, 390209ff23fSmrg{11 ,fld_VSYNC_INT_TRIGGER ,VIP_VS_DETECTOR_CNTL , 0, 0xFFFFF800, 0, 0,0, fld_VSYNC_INT_TRIGGER_def ,READWRITE }, 391209ff23fSmrg{11 ,fld_VSYNC_INT_HOLD ,VIP_VS_DETECTOR_CNTL , 16, 0xF800FFFF, 0, 0,0, fld_VSYNC_INT_HOLD_def ,READWRITE }, 392209ff23fSmrg{11 ,fld_VIN_M0 ,VIP_VIN_PLL_CNTL , 0, 0xFFFFF800, 0, 0,0, fld_VIN_M0_def ,READWRITE }, 393209ff23fSmrg{11 ,fld_VIN_N0 ,VIP_VIN_PLL_CNTL , 11, 0xFFC007FF, 0, 0,0, fld_VIN_N0_def ,READWRITE }, 394209ff23fSmrg{1 ,fld_MNFLIP_EN ,VIP_VIN_PLL_CNTL , 22, 0xFFBFFFFF, 0, 0,0, fld_MNFLIP_EN_def ,READWRITE }, 395209ff23fSmrg{4 ,fld_VIN_P ,VIP_VIN_PLL_CNTL , 24, 0xF0FFFFFF, 0, 0,0, fld_VIN_P_def ,READWRITE }, 396209ff23fSmrg{2 ,fld_REG_CLK_SEL ,VIP_VIN_PLL_CNTL , 30, 0x3FFFFFFF, 0, 0,0, fld_REG_CLK_SEL_def ,READWRITE }, 397209ff23fSmrg{11 ,fld_VIN_M1 ,VIP_VIN_PLL_FINE_CNTL , 0, 0xFFFFF800, 0, 0,0, fld_VIN_M1_def ,READWRITE }, 398209ff23fSmrg{11 ,fld_VIN_N1 ,VIP_VIN_PLL_FINE_CNTL , 11, 0xFFC007FF, 0, 0,0, fld_VIN_N1_def ,READWRITE }, 399209ff23fSmrg{1 ,fld_VIN_DRIVER_SEL ,VIP_VIN_PLL_FINE_CNTL , 22, 0xFFBFFFFF, 0, 0,0, fld_VIN_DRIVER_SEL_def ,READWRITE }, 400209ff23fSmrg{1 ,fld_VIN_MNFLIP_REQ ,VIP_VIN_PLL_FINE_CNTL , 23, 0xFF7FFFFF, 0, 0,0, fld_VIN_MNFLIP_REQ_def ,READWRITE }, 401209ff23fSmrg{1 ,fld_VIN_MNFLIP_DONE ,VIP_VIN_PLL_FINE_CNTL , 24, 0xFEFFFFFF, 0, 0,0, fld_VIN_MNFLIP_DONE_def ,READONLY }, 402209ff23fSmrg{1 ,fld_TV_LOCK_TO_VIN ,VIP_VIN_PLL_FINE_CNTL , 27, 0xF7FFFFFF, 0, 0,0, fld_TV_LOCK_TO_VIN_def ,READWRITE }, 403209ff23fSmrg{4 ,fld_TV_P_FOR_WINCLK ,VIP_VIN_PLL_FINE_CNTL , 28, 0x0FFFFFFF, 0, 0,0, fld_TV_P_FOR_WINCLK_def ,READWRITE }, 404209ff23fSmrg{1 ,fld_VINRST ,VIP_PLL_CNTL1 , 1, 0xFFFFFFFD, 0, 0,0, fld_VINRST_def ,READWRITE }, 405209ff23fSmrg{1 ,fld_VIN_CLK_SEL ,VIP_CLOCK_SEL_CNTL , 7, 0xFFFFFF7F, 0, 0,0, fld_VIN_CLK_SEL_def ,READWRITE }, 406209ff23fSmrg{10 ,fld_VS_FIELD_BLANK_START,VIP_VS_BLANKING_CNTL , 0, 0xFFFFFC00, 0, 0,0, fld_VS_FIELD_BLANK_START_def ,READWRITE }, 407209ff23fSmrg{10 ,fld_VS_FIELD_BLANK_END,VIP_VS_BLANKING_CNTL , 16, 0xFC00FFFF, 0, 0,0, fld_VS_FIELD_BLANK_END_def ,READWRITE }, 408209ff23fSmrg{9 ,fld_VS_FIELD_IDLOCATION,VIP_VS_FIELD_ID_CNTL , 0, 0xFFFFFE00, 0, 0,0, fld_VS_FIELD_IDLOCATION_def ,READWRITE }, 409209ff23fSmrg{10 ,fld_VS_FRAME_TOTAL ,VIP_VS_FRAME_TOTAL , 0, 0xFFFFFC00, 0, 0,0, fld_VS_FRAME_TOTAL_def ,READWRITE }, 410209ff23fSmrg{11 ,fld_SYNC_TIP_START ,VIP_SG_SYNCTIP_GATE , 0, 0xFFFFF800, 0, 0,0, fld_SYNC_TIP_START_def ,READWRITE }, 411209ff23fSmrg{4 ,fld_SYNC_TIP_LENGTH ,VIP_SG_SYNCTIP_GATE , 12, 0xFFFF0FFF, 0, 0,0, fld_SYNC_TIP_LENGTH_def ,READWRITE }, 412209ff23fSmrg{12 ,fld_GAIN_FORCE_DATA ,VIP_CP_DEBUG_FORCE , 0, 0xFFFFF000, 0, 0,0, fld_GAIN_FORCE_DATA_def ,READWRITE }, 413209ff23fSmrg{1 ,fld_GAIN_FORCE_EN ,VIP_CP_DEBUG_FORCE , 12, 0xFFFFEFFF, 0, 0,0, fld_GAIN_FORCE_EN_def ,READWRITE }, 414209ff23fSmrg{2 ,fld_I_CLAMP_SEL ,VIP_ADC_CNTL , 3, 0xFFFFFFE7, 0, 0,0, fld_I_CLAMP_SEL_def ,READWRITE }, 415209ff23fSmrg{2 ,fld_I_AGC_SEL ,VIP_ADC_CNTL , 5, 0xFFFFFF9F, 0, 0,0, fld_I_AGC_SEL_def ,READWRITE }, 416209ff23fSmrg{1 ,fld_EXT_CLAMP_CAP ,VIP_ADC_CNTL , 8, 0xFFFFFEFF, 0, 0,0, fld_EXT_CLAMP_CAP_def ,READWRITE }, 417209ff23fSmrg{1 ,fld_EXT_AGC_CAP ,VIP_ADC_CNTL , 9, 0xFFFFFDFF, 0, 0,0, fld_EXT_AGC_CAP_def ,READWRITE }, 418209ff23fSmrg{1 ,fld_DECI_DITHER_EN ,VIP_ADC_CNTL , 12, 0xFFFFEFFF, 0, 0,0, fld_DECI_DITHER_EN_def ,READWRITE }, 419209ff23fSmrg{2 ,fld_ADC_PREFHI ,VIP_ADC_CNTL , 22, 0xFF3FFFFF, 0, 0,0, fld_ADC_PREFHI_def ,READWRITE }, 420209ff23fSmrg{2 ,fld_ADC_CH_GAIN_SEL ,VIP_ADC_CNTL , 16, 0xFFFCFFFF, 0, 0,0, fld_ADC_CH_GAIN_SEL_def ,READWRITE }, 421209ff23fSmrg{4 ,fld_HS_PLL_SGAIN ,VIP_HS_PLLGAIN , 0, 0xFFFFFFF0, 0, 0,0, fld_HS_PLL_SGAIN_def ,READWRITE }, 422209ff23fSmrg{1 ,fld_NREn ,VIP_NOISE_CNTL0 , 0, 0xFFFFFFFE, 0, 0,0, fld_NREn_def ,READWRITE }, 423209ff23fSmrg{3 ,fld_NRGainCntl ,VIP_NOISE_CNTL0 , 1, 0xFFFFFFF1, 0, 0,0, fld_NRGainCntl_def ,READWRITE }, 424209ff23fSmrg{6 ,fld_NRBWTresh ,VIP_NOISE_CNTL0 , 4, 0xFFFFFC0F, 0, 0,0, fld_NRBWTresh_def ,READWRITE }, 425209ff23fSmrg{5 ,fld_NRGCTresh ,VIP_NOISE_CNTL0 , 10, 0xFFFF83FF, 0, 0,0, fld_NRGCTresh_def ,READWRITE }, 426209ff23fSmrg{1 ,fld_NRCoefDespeclMode ,VIP_NOISE_CNTL0 , 15, 0xFFFF7FFF, 0, 0,0, fld_NRCoefDespeclMode_def ,READWRITE }, 427209ff23fSmrg{1 ,fld_GPIO_5_OE ,VIP_GPIO_CNTL , 5, 0xFFFFFFDF, 0, 0,0, fld_GPIO_5_OE_def ,READWRITE }, 428209ff23fSmrg{1 ,fld_GPIO_6_OE ,VIP_GPIO_CNTL , 6, 0xFFFFFFBF, 0, 0,0, fld_GPIO_6_OE_def ,READWRITE }, 429209ff23fSmrg{1 ,fld_GPIO_5_OUT ,VIP_GPIO_INOUT , 5, 0xFFFFFFDF, 0, 0,0, fld_GPIO_5_OUT_def ,READWRITE }, 430209ff23fSmrg{1 ,fld_GPIO_6_OUT ,VIP_GPIO_INOUT , 6, 0xFFFFFFBF, 0, 0,0, fld_GPIO_6_OUT_def ,READWRITE }, 431209ff23fSmrg}; 432209ff23fSmrg 433209ff23fSmrg/* Rage Theatre's register fields default values: */ 434209ff23fSmrguint32_t RT_RegDef[regRT_MAX_REGS]= 435209ff23fSmrg{ 436209ff23fSmrgfld_tmpReg1_def, 437209ff23fSmrgfld_tmpReg2_def, 438209ff23fSmrgfld_tmpReg3_def, 439209ff23fSmrgfld_LP_CONTRAST_def, 440209ff23fSmrgfld_LP_BRIGHTNESS_def, 441209ff23fSmrgfld_CP_HUE_CNTL_def, 442209ff23fSmrgfld_LUMA_FILTER_def, 443209ff23fSmrgfld_H_SCALE_RATIO_def, 444209ff23fSmrgfld_H_SHARPNESS_def, 445209ff23fSmrgfld_V_SCALE_RATIO_def, 446209ff23fSmrgfld_V_DEINTERLACE_ON_def, 447209ff23fSmrgfld_V_BYPSS_def, 448209ff23fSmrgfld_V_DITHER_ON_def, 449209ff23fSmrgfld_EVENF_OFFSET_def, 450209ff23fSmrgfld_ODDF_OFFSET_def, 451209ff23fSmrgfld_INTERLACE_DETECTED_def, 452209ff23fSmrgfld_VS_LINE_COUNT_def, 453209ff23fSmrgfld_VS_DETECTED_LINES_def, 454209ff23fSmrgfld_VS_ITU656_VB_def, 455209ff23fSmrgfld_VBI_CC_DATA_def, 456209ff23fSmrgfld_VBI_CC_WT_def, 457209ff23fSmrgfld_VBI_CC_WT_ACK_def, 458209ff23fSmrgfld_VBI_CC_HOLD_def, 459209ff23fSmrgfld_VBI_DECODE_EN_def, 460209ff23fSmrgfld_VBI_CC_DTO_P_def, 461209ff23fSmrgfld_VBI_20BIT_DTO_P_def, 462209ff23fSmrgfld_VBI_CC_LEVEL_def, 463209ff23fSmrgfld_VBI_20BIT_LEVEL_def, 464209ff23fSmrgfld_VBI_CLK_RUNIN_GAIN_def, 465209ff23fSmrgfld_H_VBI_WIND_START_def, 466209ff23fSmrgfld_H_VBI_WIND_END_def, 467209ff23fSmrgfld_V_VBI_WIND_START_def, 468209ff23fSmrgfld_V_VBI_WIND_END_def, 469209ff23fSmrgfld_VBI_20BIT_DATA0_def, 470209ff23fSmrgfld_VBI_20BIT_DATA1_def, 471209ff23fSmrgfld_VBI_20BIT_WT_def, 472209ff23fSmrgfld_VBI_20BIT_WT_ACK_def, 473209ff23fSmrgfld_VBI_20BIT_HOLD_def, 474209ff23fSmrgfld_VBI_CAPTURE_ENABLE_def, 475209ff23fSmrgfld_VBI_EDS_DATA_def, 476209ff23fSmrgfld_VBI_EDS_WT_def, 477209ff23fSmrgfld_VBI_EDS_WT_ACK_def, 478209ff23fSmrgfld_VBI_EDS_HOLD_def, 479209ff23fSmrgfld_VBI_SCALING_RATIO_def, 480209ff23fSmrgfld_VBI_ALIGNER_ENABLE_def, 481209ff23fSmrgfld_H_ACTIVE_START_def, 482209ff23fSmrgfld_H_ACTIVE_END_def, 483209ff23fSmrgfld_V_ACTIVE_START_def, 484209ff23fSmrgfld_V_ACTIVE_END_def, 485209ff23fSmrgfld_CH_HEIGHT_def, 486209ff23fSmrgfld_CH_KILL_LEVEL_def, 487209ff23fSmrgfld_CH_AGC_ERROR_LIM_def, 488209ff23fSmrgfld_CH_AGC_FILTER_EN_def, 489209ff23fSmrgfld_CH_AGC_LOOP_SPEED_def, 490209ff23fSmrgfld_HUE_ADJ_def, 491209ff23fSmrgfld_STANDARD_SEL_def, 492209ff23fSmrgfld_STANDARD_YC_def, 493209ff23fSmrgfld_ADC_PDWN_def, 494209ff23fSmrgfld_INPUT_SELECT_def, 495209ff23fSmrgfld_ADC_PREFLO_def, 496209ff23fSmrgfld_H_SYNC_PULSE_WIDTH_def, 497209ff23fSmrgfld_HS_GENLOCKED_def, 498209ff23fSmrgfld_HS_SYNC_IN_WIN_def, 499209ff23fSmrgfld_VIN_ASYNC_RST_def, 500209ff23fSmrgfld_DVS_ASYNC_RST_def, 501209ff23fSmrgfld_VIP_VENDOR_ID_def, 502209ff23fSmrgfld_VIP_DEVICE_ID_def, 503209ff23fSmrgfld_VIP_REVISION_ID_def, 504209ff23fSmrgfld_BLACK_INT_START_def, 505209ff23fSmrgfld_BLACK_INT_LENGTH_def, 506209ff23fSmrgfld_UV_INT_START_def, 507209ff23fSmrgfld_U_INT_LENGTH_def, 508209ff23fSmrgfld_V_INT_LENGTH_def, 509209ff23fSmrgfld_CRDR_ACTIVE_GAIN_def, 510209ff23fSmrgfld_CBDB_ACTIVE_GAIN_def, 511209ff23fSmrgfld_DVS_DIRECTION_def, 512209ff23fSmrgfld_DVS_VBI_UINT8_SWAP_def, 513209ff23fSmrgfld_DVS_CLK_SELECT_def, 514209ff23fSmrgfld_CONTINUOUS_STREAM_def, 515209ff23fSmrgfld_DVSOUT_CLK_DRV_def, 516209ff23fSmrgfld_DVSOUT_DATA_DRV_def, 517209ff23fSmrgfld_COMB_CNTL0_def, 518209ff23fSmrgfld_COMB_CNTL1_def, 519209ff23fSmrgfld_COMB_CNTL2_def, 520209ff23fSmrgfld_COMB_LENGTH_def, 521209ff23fSmrgfld_SYNCTIP_REF0_def, 522209ff23fSmrgfld_SYNCTIP_REF1_def, 523209ff23fSmrgfld_CLAMP_REF_def, 524209ff23fSmrgfld_AGC_PEAKWHITE_def, 525209ff23fSmrgfld_VBI_PEAKWHITE_def, 526209ff23fSmrgfld_WPA_THRESHOLD_def, 527209ff23fSmrgfld_WPA_TRIGGER_LO_def, 528209ff23fSmrgfld_WPA_TRIGGER_HIGH_def, 529209ff23fSmrgfld_LOCKOUT_START_def, 530209ff23fSmrgfld_LOCKOUT_END_def, 531209ff23fSmrgfld_CH_DTO_INC_def, 532209ff23fSmrgfld_PLL_SGAIN_def, 533209ff23fSmrgfld_PLL_FGAIN_def, 534209ff23fSmrgfld_CR_BURST_GAIN_def, 535209ff23fSmrgfld_CB_BURST_GAIN_def, 536209ff23fSmrgfld_VERT_LOCKOUT_START_def, 537209ff23fSmrgfld_VERT_LOCKOUT_END_def, 538209ff23fSmrgfld_H_IN_WIND_START_def, 539209ff23fSmrgfld_V_IN_WIND_START_def, 540209ff23fSmrgfld_H_OUT_WIND_WIDTH_def, 541209ff23fSmrgfld_V_OUT_WIND_WIDTH_def, 542209ff23fSmrgfld_HS_LINE_TOTAL_def, 543209ff23fSmrgfld_MIN_PULSE_WIDTH_def, 544209ff23fSmrgfld_MAX_PULSE_WIDTH_def, 545209ff23fSmrgfld_WIN_CLOSE_LIMIT_def, 546209ff23fSmrgfld_WIN_OPEN_LIMIT_def, 547209ff23fSmrgfld_VSYNC_INT_TRIGGER_def, 548209ff23fSmrgfld_VSYNC_INT_HOLD_def, 549209ff23fSmrgfld_VIN_M0_def, 550209ff23fSmrgfld_VIN_N0_def, 551209ff23fSmrgfld_MNFLIP_EN_def, 552209ff23fSmrgfld_VIN_P_def, 553209ff23fSmrgfld_REG_CLK_SEL_def, 554209ff23fSmrgfld_VIN_M1_def, 555209ff23fSmrgfld_VIN_N1_def, 556209ff23fSmrgfld_VIN_DRIVER_SEL_def, 557209ff23fSmrgfld_VIN_MNFLIP_REQ_def, 558209ff23fSmrgfld_VIN_MNFLIP_DONE_def, 559209ff23fSmrgfld_TV_LOCK_TO_VIN_def, 560209ff23fSmrgfld_TV_P_FOR_WINCLK_def, 561209ff23fSmrgfld_VINRST_def, 562209ff23fSmrgfld_VIN_CLK_SEL_def, 563209ff23fSmrgfld_VS_FIELD_BLANK_START_def, 564209ff23fSmrgfld_VS_FIELD_BLANK_END_def, 565209ff23fSmrgfld_VS_FIELD_IDLOCATION_def, 566209ff23fSmrgfld_VS_FRAME_TOTAL_def, 567209ff23fSmrgfld_SYNC_TIP_START_def, 568209ff23fSmrgfld_SYNC_TIP_LENGTH_def, 569209ff23fSmrgfld_GAIN_FORCE_DATA_def, 570209ff23fSmrgfld_GAIN_FORCE_EN_def, 571209ff23fSmrgfld_I_CLAMP_SEL_def, 572209ff23fSmrgfld_I_AGC_SEL_def, 573209ff23fSmrgfld_EXT_CLAMP_CAP_def, 574209ff23fSmrgfld_EXT_AGC_CAP_def, 575209ff23fSmrgfld_DECI_DITHER_EN_def, 576209ff23fSmrgfld_ADC_PREFHI_def, 577209ff23fSmrgfld_ADC_CH_GAIN_SEL_def, 578209ff23fSmrgfld_HS_PLL_SGAIN_def, 579209ff23fSmrgfld_NREn_def, 580209ff23fSmrgfld_NRGainCntl_def, 581209ff23fSmrgfld_NRBWTresh_def, 582209ff23fSmrgfld_NRGCTresh_def, 583209ff23fSmrgfld_NRCoefDespeclMode_def, 584209ff23fSmrgfld_GPIO_5_OE_def, 585209ff23fSmrgfld_GPIO_6_OE_def, 586209ff23fSmrgfld_GPIO_5_OUT_def, 587209ff23fSmrgfld_GPIO_6_OUT_def, 588209ff23fSmrg}; 589209ff23fSmrg 590209ff23fSmrg/**************************************************************************** 591209ff23fSmrg * WriteRT_fld (uint32_t dwReg, uint32_t dwData) * 592209ff23fSmrg * Function: Writes a register field within Rage Theatre * 593209ff23fSmrg * Inputs: uint32_t dwReg = register field to be written * 594209ff23fSmrg * uint32_t dwData = data that will be written to the reg field * 595209ff23fSmrg * Outputs: NONE * 596209ff23fSmrg ****************************************************************************/ 597209ff23fSmrgstatic void WriteRT_fld1 (TheatrePtr t, uint32_t dwReg, uint32_t dwData) 598209ff23fSmrg{ 599209ff23fSmrg uint32_t dwResult=0; 600209ff23fSmrg uint32_t dwValue=0; 601209ff23fSmrg 602209ff23fSmrg if (RT_regr (RT_RegMap[dwReg].dwRegAddrLSBs, &dwResult) == TRUE) 603209ff23fSmrg { 604209ff23fSmrg dwValue = (dwResult & RT_RegMap[dwReg].dwMaskLSBs) | 605209ff23fSmrg (dwData << RT_RegMap[dwReg].dwFldOffsetLSBs); 606209ff23fSmrg 607209ff23fSmrg if (RT_regw (RT_RegMap[dwReg].dwRegAddrLSBs, dwValue) == TRUE) 608209ff23fSmrg { 609209ff23fSmrg /* update the memory mapped registers */ 610209ff23fSmrg RT_RegMap[dwReg].dwCurrValue = dwData; 611209ff23fSmrg } 612209ff23fSmrg 613209ff23fSmrg } 614209ff23fSmrg 615209ff23fSmrg return; 616209ff23fSmrg 617209ff23fSmrg} /* WriteRT_fld ()... */ 618209ff23fSmrg 619209ff23fSmrg/**************************************************************************** 620209ff23fSmrg * ReadRT_fld (uint32_t dwReg) * 621209ff23fSmrg * Function: Reads a register field within Rage Theatre * 622209ff23fSmrg * Inputs: uint32_t dwReg = register field to be read * 623209ff23fSmrg * Outputs: uint32_t - value read from register field * 624209ff23fSmrg ****************************************************************************/ 625209ff23fSmrgstatic uint32_t ReadRT_fld1 (TheatrePtr t,uint32_t dwReg) 626209ff23fSmrg{ 627209ff23fSmrg uint32_t dwResult=0; 628209ff23fSmrg 629209ff23fSmrg if (RT_regr (RT_RegMap[dwReg].dwRegAddrLSBs, &dwResult) == TRUE) 630209ff23fSmrg { 631209ff23fSmrg RT_RegMap[dwReg].dwCurrValue = ((dwResult & ~RT_RegMap[dwReg].dwMaskLSBs) >> 632209ff23fSmrg RT_RegMap[dwReg].dwFldOffsetLSBs); 633209ff23fSmrg return (RT_RegMap[dwReg].dwCurrValue); 634209ff23fSmrg } 635209ff23fSmrg else 636209ff23fSmrg { 637209ff23fSmrg return (0xFFFFFFFF); 638209ff23fSmrg } 639209ff23fSmrg 640209ff23fSmrg} /* ReadRT_fld ()... */ 641209ff23fSmrg 642209ff23fSmrg#define WriteRT_fld(a,b) WriteRT_fld1(t, (a), (b)) 643209ff23fSmrg#define ReadRT_fld(a) ReadRT_fld1(t,(a)) 644209ff23fSmrg 645209ff23fSmrg/**************************************************************************** 646209ff23fSmrg * RT_SetVINClock (uint16_t wStandard) * 647209ff23fSmrg * Function: to set the VIN clock for the selected standard * 648209ff23fSmrg * Inputs: uint16_t wStandard - input standard (NTSC, PAL, SECAM) * 649209ff23fSmrg * Outputs: NONE * 650209ff23fSmrg ****************************************************************************/ 651209ff23fSmrgstatic void RT_SetVINClock(TheatrePtr t, uint16_t wStandard) 652209ff23fSmrg{ 653209ff23fSmrg uint32_t dwM0=0, dwN0=0, dwP=0; 654209ff23fSmrg uint8_t ref_freq; 655209ff23fSmrg 656209ff23fSmrg /* Determine the reference frequency first. This can be obtained 657209ff23fSmrg from the MMTABLE.video_decoder_type field (bits 4:7) 658209ff23fSmrg The Rage Theatre currently only supports reference frequencies of 659209ff23fSmrg 27 or 29.49 MHz. */ 660209ff23fSmrg /* 661209ff23fSmrg R128ReadBIOS(0x48, 662209ff23fSmrg (uint8_t *)&bios_header, sizeof(bios_header)); 663209ff23fSmrg R128ReadBIOS(bios_header + 0x30, 664209ff23fSmrg (uint8_t *)&pll_info_block, sizeof(pll_info_block)); 665209ff23fSmrg 666209ff23fSmrg R128ReadBIOS(pll_info_block+0x07, &video_decoder_type, sizeof(video_decoder_type)); 667209ff23fSmrg */ 668209ff23fSmrg ref_freq = (t->video_decoder_type & 0xF0) >> 4; 669209ff23fSmrg 670209ff23fSmrg 671209ff23fSmrg switch (wStandard & 0x00FF) 672209ff23fSmrg { 673209ff23fSmrg case (DEC_NTSC): /* NTSC GROUP - 480 lines */ 674209ff23fSmrg switch (wStandard & 0xFF00) 675209ff23fSmrg { 676209ff23fSmrg case (extNONE): 677209ff23fSmrg case (extNTSC): 678209ff23fSmrg case (extNTSC_J): 679209ff23fSmrg if (ref_freq == RT_FREF_2950) 680209ff23fSmrg { 681209ff23fSmrg dwM0 = 0x39; 682209ff23fSmrg dwN0 = 0x14C; 683209ff23fSmrg dwP = 0x6; 684209ff23fSmrg } 685209ff23fSmrg else 686209ff23fSmrg { 687209ff23fSmrg dwM0 = 0x0B; 688209ff23fSmrg dwN0 = 0x46; 689209ff23fSmrg dwP = 0x6; 690209ff23fSmrg } 691209ff23fSmrg break; 692209ff23fSmrg 693209ff23fSmrg case (extNTSC_443): 694209ff23fSmrg if (ref_freq == RT_FREF_2950) 695209ff23fSmrg { 696209ff23fSmrg dwM0 = 0x23; 697209ff23fSmrg dwN0 = 0x88; 698209ff23fSmrg dwP = 0x7; 699209ff23fSmrg } 700209ff23fSmrg else 701209ff23fSmrg { 702209ff23fSmrg dwM0 = 0x2C; 703209ff23fSmrg dwN0 = 0x121; 704209ff23fSmrg dwP = 0x5; 705209ff23fSmrg } 706209ff23fSmrg break; 707209ff23fSmrg 708209ff23fSmrg case (extPAL_M): 709209ff23fSmrg if (ref_freq == RT_FREF_2950) 710209ff23fSmrg { 711209ff23fSmrg dwM0 = 0x2C; 712209ff23fSmrg dwN0 = 0x12B; 713209ff23fSmrg dwP = 0x7; 714209ff23fSmrg } 715209ff23fSmrg else 716209ff23fSmrg { 717209ff23fSmrg dwM0 = 0x0B; 718209ff23fSmrg dwN0 = 0x46; 719209ff23fSmrg dwP = 0x6; 720209ff23fSmrg } 721209ff23fSmrg break; 722209ff23fSmrg 723209ff23fSmrg default: 724209ff23fSmrg return; 725209ff23fSmrg } 726209ff23fSmrg break; 727209ff23fSmrg case (DEC_PAL): 728209ff23fSmrg switch (wStandard & 0xFF00) 729209ff23fSmrg { 730209ff23fSmrg case (extPAL): 731209ff23fSmrg case (extPAL_N): 732209ff23fSmrg case (extPAL_BGHI): 733209ff23fSmrg case (extPAL_60): 734209ff23fSmrg if (ref_freq == RT_FREF_2950) 735209ff23fSmrg { 736209ff23fSmrg dwM0 = 0x0E; 737209ff23fSmrg dwN0 = 0x65; 738209ff23fSmrg dwP = 0x6; 739209ff23fSmrg } 740209ff23fSmrg else 741209ff23fSmrg { 742209ff23fSmrg dwM0 = 0x2C; 743209ff23fSmrg dwN0 = 0x0121; 744209ff23fSmrg dwP = 0x5; 745209ff23fSmrg } 746209ff23fSmrg break; 747209ff23fSmrg 748209ff23fSmrg case (extPAL_NCOMB): 749209ff23fSmrg if (ref_freq == RT_FREF_2950) 750209ff23fSmrg { 751209ff23fSmrg dwM0 = 0x23; 752209ff23fSmrg dwN0 = 0x88; 753209ff23fSmrg dwP = 0x7; 754209ff23fSmrg } 755209ff23fSmrg else 756209ff23fSmrg { 757209ff23fSmrg dwM0 = 0x37; 758209ff23fSmrg dwN0 = 0x1D3; 759209ff23fSmrg dwP = 0x8; 760209ff23fSmrg } 761209ff23fSmrg break; 762209ff23fSmrg 763209ff23fSmrg default: 764209ff23fSmrg return; 765209ff23fSmrg } 766209ff23fSmrg break; 767209ff23fSmrg 768209ff23fSmrg case (DEC_SECAM): 769209ff23fSmrg if (ref_freq == RT_FREF_2950) 770209ff23fSmrg { 771209ff23fSmrg dwM0 = 0xE; 772209ff23fSmrg dwN0 = 0x65; 773209ff23fSmrg dwP = 0x6; 774209ff23fSmrg } 775209ff23fSmrg else 776209ff23fSmrg { 777209ff23fSmrg dwM0 = 0x2C; 778209ff23fSmrg dwN0 = 0x121; 779209ff23fSmrg dwP = 0x5; 780209ff23fSmrg } 781209ff23fSmrg break; 782209ff23fSmrg } 783209ff23fSmrg 784209ff23fSmrg /* VIN_PLL_CNTL */ 785209ff23fSmrg WriteRT_fld (fld_VIN_M0, dwM0); 786209ff23fSmrg WriteRT_fld (fld_VIN_N0, dwN0); 787209ff23fSmrg WriteRT_fld (fld_VIN_P, dwP); 788209ff23fSmrg 789209ff23fSmrg return; 790209ff23fSmrg} /* RT_SetVINClock ()... */ 791209ff23fSmrg 792209ff23fSmrg/**************************************************************************** 793209ff23fSmrg * RT_SetTint (int hue) * 794209ff23fSmrg * Function: sets the tint (hue) for the Rage Theatre video in * 795209ff23fSmrg * Inputs: int hue - the hue value to be set. * 796209ff23fSmrg * Outputs: NONE * 797209ff23fSmrg ****************************************************************************/ 798209ff23fSmrg_X_EXPORT void RT_SetTint (TheatrePtr t, int hue) 799209ff23fSmrg{ 800209ff23fSmrg uint32_t nhue = 0; 801209ff23fSmrg 802209ff23fSmrg t->iHue=hue; 803209ff23fSmrg /* Scale hue value from -1000<->1000 to -180<->180 */ 804209ff23fSmrg hue = (double)(hue+1000) * 0.18 - 180; 805209ff23fSmrg 806209ff23fSmrg /* Validate Hue level */ 807209ff23fSmrg if (hue < -180) 808209ff23fSmrg { 809209ff23fSmrg hue = -180; 810209ff23fSmrg } 811209ff23fSmrg else if (hue > 180) 812209ff23fSmrg { 813209ff23fSmrg hue = 180; 814209ff23fSmrg } 815209ff23fSmrg 816209ff23fSmrg /* save the "validated" hue, but scale it back up to -1000<->1000 */ 817209ff23fSmrg t->iHue = (double)hue/0.18; 818209ff23fSmrg 819209ff23fSmrg switch (t->wStandard & 0x00FF) 820209ff23fSmrg { 821209ff23fSmrg case (DEC_NTSC): /* original ATI code had _empty_ section for PAL/SECAM... which did not work, 822209ff23fSmrg obviously */ 823209ff23fSmrg case (DEC_PAL): 824209ff23fSmrg case (DEC_SECAM): 825209ff23fSmrg if (hue >= 0) 826209ff23fSmrg { 827209ff23fSmrg nhue = (uint32_t) (256 * hue)/360; 828209ff23fSmrg } 829209ff23fSmrg else 830209ff23fSmrg { 831209ff23fSmrg nhue = (uint32_t) (256 * (hue + 360))/360; 832209ff23fSmrg } 833209ff23fSmrg break; 834209ff23fSmrg 835209ff23fSmrg default: break; 836209ff23fSmrg } 837209ff23fSmrg 838209ff23fSmrg WriteRT_fld(fld_CP_HUE_CNTL, nhue); 839209ff23fSmrg 840209ff23fSmrg return; 841209ff23fSmrg 842209ff23fSmrg} /* RT_SetTint ()... */ 843209ff23fSmrg 844209ff23fSmrg 845209ff23fSmrg/**************************************************************************** 846209ff23fSmrg * RT_SetSaturation (int Saturation) * 847209ff23fSmrg * Function: sets the saturation level for the Rage Theatre video in * 848209ff23fSmrg * Inputs: int Saturation - the saturation value to be set. * 849209ff23fSmrg * Outputs: NONE * 850209ff23fSmrg ****************************************************************************/ 851209ff23fSmrg_X_EXPORT void RT_SetSaturation (TheatrePtr t, int Saturation) 852209ff23fSmrg{ 853209ff23fSmrg uint16_t wSaturation_V, wSaturation_U; 854209ff23fSmrg double dbSaturation = 0, dbCrGain = 0, dbCbGain = 0; 855209ff23fSmrg 856209ff23fSmrg /* VALIDATE SATURATION LEVEL */ 857209ff23fSmrg if (Saturation < -1000L) 858209ff23fSmrg { 859209ff23fSmrg Saturation = -1000; 860209ff23fSmrg } 861209ff23fSmrg else if (Saturation > 1000L) 862209ff23fSmrg { 863209ff23fSmrg Saturation = 1000; 864209ff23fSmrg } 865209ff23fSmrg 866209ff23fSmrg t->iSaturation = Saturation; 867209ff23fSmrg 868209ff23fSmrg if (Saturation > 0) 869209ff23fSmrg { 870209ff23fSmrg /* Scale saturation up, to use full allowable register width */ 871209ff23fSmrg Saturation = (double)(Saturation) * 4.9; 872209ff23fSmrg } 873209ff23fSmrg 874209ff23fSmrg dbSaturation = (double) (Saturation+1000.0) / 1000.0; 875209ff23fSmrg 876209ff23fSmrg CalculateCrCbGain (t, &dbCrGain, &dbCbGain, t->wStandard); 877209ff23fSmrg 878209ff23fSmrg wSaturation_U = (uint16_t) ((dbCrGain * dbSaturation * 128.0) + 0.5); 879209ff23fSmrg wSaturation_V = (uint16_t) ((dbCbGain * dbSaturation * 128.0) + 0.5); 880209ff23fSmrg 881209ff23fSmrg /* SET SATURATION LEVEL */ 882209ff23fSmrg WriteRT_fld (fld_CRDR_ACTIVE_GAIN, wSaturation_U); 883209ff23fSmrg WriteRT_fld (fld_CBDB_ACTIVE_GAIN, wSaturation_V); 884209ff23fSmrg 885209ff23fSmrg t->wSaturation_U = wSaturation_U; 886209ff23fSmrg t->wSaturation_V = wSaturation_V; 887209ff23fSmrg 888209ff23fSmrg return; 889209ff23fSmrg 890209ff23fSmrg} /* RT_SetSaturation ()...*/ 891209ff23fSmrg 892209ff23fSmrg/**************************************************************************** 893209ff23fSmrg * RT_SetBrightness (int Brightness) * 894209ff23fSmrg * Function: sets the brightness level for the Rage Theatre video in * 895209ff23fSmrg * Inputs: int Brightness - the brightness value to be set. * 896209ff23fSmrg * Outputs: NONE * 897209ff23fSmrg ****************************************************************************/ 898209ff23fSmrg_X_EXPORT void RT_SetBrightness (TheatrePtr t, int Brightness) 899209ff23fSmrg{ 900209ff23fSmrg double dbSynctipRef0=0, dbContrast=1; 901209ff23fSmrg 902209ff23fSmrg double dbYgain=0; 903209ff23fSmrg double dbBrightness=0; 904209ff23fSmrg double dbSetup=0; 905209ff23fSmrg uint16_t wBrightness=0; 906209ff23fSmrg 907209ff23fSmrg /* VALIDATE BRIGHTNESS LEVEL */ 908209ff23fSmrg if (Brightness < -1000) 909209ff23fSmrg { 910209ff23fSmrg Brightness = -1000; 911209ff23fSmrg } 912209ff23fSmrg else if (Brightness > 1000) 913209ff23fSmrg { 914209ff23fSmrg Brightness = 1000; 915209ff23fSmrg } 916209ff23fSmrg 917209ff23fSmrg /* Save value */ 918209ff23fSmrg t->iBrightness = Brightness; 919209ff23fSmrg 920209ff23fSmrg t->dbBrightnessRatio = (double) (Brightness+1000.0) / 10.0; 921209ff23fSmrg 922209ff23fSmrg dbBrightness = (double) (Brightness)/10.0; 923209ff23fSmrg 924209ff23fSmrg dbSynctipRef0 = ReadRT_fld (fld_SYNCTIP_REF0); 925209ff23fSmrg 926209ff23fSmrg if(t->dbContrast == 0) 927209ff23fSmrg { 928209ff23fSmrg t->dbContrast = 1.0; /*NTSC default; */ 929209ff23fSmrg } 930209ff23fSmrg 931209ff23fSmrg dbContrast = (double) t->dbContrast; 932209ff23fSmrg 933209ff23fSmrg /* Use the following formula to determine the brightness level */ 934209ff23fSmrg switch (t->wStandard & 0x00FF) 935209ff23fSmrg { 936209ff23fSmrg case (DEC_NTSC): 937209ff23fSmrg if ((t->wStandard & 0xFF00) == extNTSC_J) 938209ff23fSmrg { 939209ff23fSmrg dbYgain = 219.0 / ( 100.0 * (double)(dbSynctipRef0) /40.0); 940209ff23fSmrg } 941209ff23fSmrg else 942209ff23fSmrg { 943209ff23fSmrg dbSetup = 7.5 * (double)(dbSynctipRef0) / 40.0; 944209ff23fSmrg dbYgain = 219.0 / (92.5 * (double)(dbSynctipRef0) / 40.0); 945209ff23fSmrg } 946209ff23fSmrg break; 947209ff23fSmrg case (DEC_PAL): 948209ff23fSmrg case (DEC_SECAM): 949209ff23fSmrg dbYgain = 219.0 / ( 100.0 * (double)(dbSynctipRef0) /43.0); 950209ff23fSmrg break; 951209ff23fSmrg default: 952209ff23fSmrg break; 953209ff23fSmrg } 954209ff23fSmrg 955209ff23fSmrg wBrightness = (uint16_t) (16.0 * ((dbBrightness-dbSetup) + (16.0 / (dbContrast * dbYgain)))); 956209ff23fSmrg 957209ff23fSmrg WriteRT_fld (fld_LP_BRIGHTNESS, wBrightness); 958209ff23fSmrg 959209ff23fSmrg /*RT_SetSaturation (t->iSaturation); */ 960209ff23fSmrg 961209ff23fSmrg return; 962209ff23fSmrg 963209ff23fSmrg} /* RT_SetBrightness ()... */ 964209ff23fSmrg 965209ff23fSmrg 966209ff23fSmrg/**************************************************************************** 967209ff23fSmrg * RT_SetSharpness (uint16_t wSharpness) * 968209ff23fSmrg * Function: sets the sharpness level for the Rage Theatre video in * 969209ff23fSmrg * Inputs: uint16_t wSharpness - the sharpness value to be set. * 970209ff23fSmrg * Outputs: NONE * 971209ff23fSmrg ****************************************************************************/ 972209ff23fSmrg_X_EXPORT void RT_SetSharpness (TheatrePtr t, uint16_t wSharpness) 973209ff23fSmrg{ 974209ff23fSmrg switch (wSharpness) 975209ff23fSmrg { 976209ff23fSmrg case DEC_SMOOTH : 977209ff23fSmrg WriteRT_fld (fld_H_SHARPNESS, RT_NORM_SHARPNESS); 978209ff23fSmrg t->wSharpness = RT_NORM_SHARPNESS; 979209ff23fSmrg break; 980209ff23fSmrg case DEC_SHARP : 981209ff23fSmrg WriteRT_fld (fld_H_SHARPNESS, RT_HIGH_SHARPNESS); 982209ff23fSmrg t->wSharpness = RT_HIGH_SHARPNESS; 983209ff23fSmrg break; 984209ff23fSmrg default: 985209ff23fSmrg break; 986209ff23fSmrg } 987209ff23fSmrg return; 988209ff23fSmrg 989209ff23fSmrg} /* RT_SetSharpness ()... */ 990209ff23fSmrg 991209ff23fSmrg 992209ff23fSmrg/**************************************************************************** 993209ff23fSmrg * RT_SetContrast (int Contrast) * 994209ff23fSmrg * Function: sets the contrast level for the Rage Theatre video in * 995209ff23fSmrg * Inputs: int Contrast - the contrast value to be set. * 996209ff23fSmrg * Outputs: NONE * 997209ff23fSmrg ****************************************************************************/ 998209ff23fSmrg_X_EXPORT void RT_SetContrast (TheatrePtr t, int Contrast) 999209ff23fSmrg{ 1000209ff23fSmrg double dbSynctipRef0=0, dbContrast=0; 1001209ff23fSmrg double dbYgain=0; 1002209ff23fSmrg uint8_t bTempContrast=0; 1003209ff23fSmrg 1004209ff23fSmrg /* VALIDATE CONTRAST LEVEL */ 1005209ff23fSmrg if (Contrast < -1000) 1006209ff23fSmrg { 1007209ff23fSmrg Contrast = -1000; 1008209ff23fSmrg } 1009209ff23fSmrg else if (Contrast > 1000) 1010209ff23fSmrg { 1011209ff23fSmrg Contrast = 1000; 1012209ff23fSmrg } 1013209ff23fSmrg 1014209ff23fSmrg /* Save contrast value */ 1015209ff23fSmrg t->iContrast = Contrast; 1016209ff23fSmrg 1017209ff23fSmrg dbSynctipRef0 = ReadRT_fld (fld_SYNCTIP_REF0); 1018209ff23fSmrg dbContrast = (double) (Contrast+1000.0) / 1000.0; 1019209ff23fSmrg 1020209ff23fSmrg switch (t->wStandard & 0x00FF) 1021209ff23fSmrg { 1022209ff23fSmrg case (DEC_NTSC): 1023209ff23fSmrg if ((t->wStandard & 0xFF00) == (extNTSC_J)) 1024209ff23fSmrg { 1025209ff23fSmrg dbYgain = 219.0 / ( 100.0 * (double)(dbSynctipRef0) /40.0); 1026209ff23fSmrg } 1027209ff23fSmrg else 1028209ff23fSmrg { 1029209ff23fSmrg dbYgain = 219.0 / ( 92.5 * (double)(dbSynctipRef0) /40.0); 1030209ff23fSmrg } 1031209ff23fSmrg break; 1032209ff23fSmrg case (DEC_PAL): 1033209ff23fSmrg case (DEC_SECAM): 1034209ff23fSmrg dbYgain = 219.0 / ( 100.0 * (double)(dbSynctipRef0) /43.0); 1035209ff23fSmrg break; 1036209ff23fSmrg default: 1037209ff23fSmrg break; 1038209ff23fSmrg } 1039209ff23fSmrg 1040209ff23fSmrg bTempContrast = (uint8_t) ((dbContrast * dbYgain * 64) + 0.5); 1041209ff23fSmrg 1042209ff23fSmrg WriteRT_fld (fld_LP_CONTRAST, (uint32_t)bTempContrast); 1043209ff23fSmrg 1044209ff23fSmrg /* Save value for future modification */ 1045209ff23fSmrg t->dbContrast = dbContrast; 1046209ff23fSmrg 1047209ff23fSmrg return; 1048209ff23fSmrg 1049209ff23fSmrg} /* RT_SetContrast ()... */ 1050209ff23fSmrg 1051209ff23fSmrg/**************************************************************************** 1052209ff23fSmrg * RT_SetInterlace (uint8_t bInterlace) * 1053209ff23fSmrg * Function: to set the interlacing pattern for the Rage Theatre video in * 1054209ff23fSmrg * Inputs: uint8_t bInterlace * 1055209ff23fSmrg * Outputs: NONE * 1056209ff23fSmrg ****************************************************************************/ 1057209ff23fSmrg_X_EXPORT void RT_SetInterlace (TheatrePtr t, uint8_t bInterlace) 1058209ff23fSmrg{ 1059209ff23fSmrg 1060209ff23fSmrg switch(bInterlace) 1061209ff23fSmrg { 1062209ff23fSmrg case (TRUE): /*DEC_INTERLACE */ 1063209ff23fSmrg WriteRT_fld (fld_V_DEINTERLACE_ON, 0x1); 1064209ff23fSmrg t->wInterlaced = (uint16_t) RT_DECINTERLACED; 1065209ff23fSmrg break; 1066209ff23fSmrg case (FALSE): /*DEC_NONINTERLACE */ 1067209ff23fSmrg WriteRT_fld (fld_V_DEINTERLACE_ON, RT_DECNONINTERLACED); 1068209ff23fSmrg t->wInterlaced = (uint16_t) RT_DECNONINTERLACED; 1069209ff23fSmrg break; 1070209ff23fSmrg default: 1071209ff23fSmrg break; 1072209ff23fSmrg } 1073209ff23fSmrg 1074209ff23fSmrg return; 1075209ff23fSmrg 1076209ff23fSmrg} /* RT_SetInterlace ()... */ 1077209ff23fSmrg 1078209ff23fSmrg/**************************************************************************** 1079209ff23fSmrg * GetStandardConstants (double *LPeriod, double *FPeriod, * 1080209ff23fSmrg * double *Fsamp, uint16_t wStandard) * 1081209ff23fSmrg * Function: return timing values for a given standard * 1082209ff23fSmrg * Inputs: double *LPeriod - 1083209ff23fSmrg * double *FPeriod - 1084209ff23fSmrg * double *Fsamp - sampling frequency used for a given standard * 1085209ff23fSmrg * uint16_t wStandard - input standard (NTSC, PAL, SECAM) * 1086209ff23fSmrg * Outputs: NONE * 1087209ff23fSmrg ****************************************************************************/ 1088209ff23fSmrgstatic void GetStandardConstants (double *LPeriod, double *FPeriod, 1089209ff23fSmrg double *Fsamp, uint16_t wStandard) 1090209ff23fSmrg{ 1091209ff23fSmrg *LPeriod = 0.0; 1092209ff23fSmrg *FPeriod = 0.0; 1093209ff23fSmrg *Fsamp = 0.0; 1094209ff23fSmrg 1095209ff23fSmrg switch (wStandard & 0x00FF) 1096209ff23fSmrg { 1097209ff23fSmrg case (DEC_NTSC): /*NTSC GROUP - 480 lines*/ 1098209ff23fSmrg switch (wStandard & 0xFF00) 1099209ff23fSmrg { 1100209ff23fSmrg case (extNONE): 1101209ff23fSmrg case (extNTSC): 1102209ff23fSmrg case (extNTSC_J): 1103209ff23fSmrg *LPeriod = (double) 63.5555; 1104209ff23fSmrg *FPeriod = (double) 16.6833; 1105209ff23fSmrg *Fsamp = (double) 28.63636; 1106209ff23fSmrg break; 1107209ff23fSmrg case (extPAL_M): 1108209ff23fSmrg *LPeriod = (double) 63.492; 1109209ff23fSmrg *FPeriod = (double) 16.667; 1110209ff23fSmrg *Fsamp = (double) 28.63689192; 1111209ff23fSmrg break; 1112209ff23fSmrg default: 1113209ff23fSmrg return; 1114209ff23fSmrg } 1115209ff23fSmrg break; 1116209ff23fSmrg case (DEC_PAL): 1117209ff23fSmrg if( (wStandard & 0xFF00) == extPAL_N ) 1118209ff23fSmrg { 1119209ff23fSmrg *LPeriod = (double) 64.0; 1120209ff23fSmrg *FPeriod = (double) 20.0; 1121209ff23fSmrg *Fsamp = (double) 28.65645; 1122209ff23fSmrg } 1123209ff23fSmrg else 1124209ff23fSmrg { 1125209ff23fSmrg *LPeriod = (double) 64.0; 1126209ff23fSmrg *FPeriod = (double) 20.0; 1127209ff23fSmrg *Fsamp = (double) 35.46895; 1128209ff23fSmrg } 1129209ff23fSmrg break; 1130209ff23fSmrg case (DEC_SECAM): 1131209ff23fSmrg *LPeriod = (double) 64.0; 1132209ff23fSmrg *FPeriod = (double) 20.0; 1133209ff23fSmrg *Fsamp = (double) 35.46895; 1134209ff23fSmrg break; 1135209ff23fSmrg } 1136209ff23fSmrg return; 1137209ff23fSmrg 1138209ff23fSmrg} /* GetStandardConstants ()...*/ 1139209ff23fSmrg 1140209ff23fSmrg 1141209ff23fSmrg/**************************************************************************** 1142209ff23fSmrg * RT_SetStandard (uint16_t wStandard) * 1143209ff23fSmrg * Function: to set the input standard for the Rage Theatre video in * 1144209ff23fSmrg * Inputs: uint16_t wStandard - input standard (NTSC, PAL, SECAM) * 1145209ff23fSmrg * Outputs: NONE * 1146209ff23fSmrg ****************************************************************************/ 1147209ff23fSmrg_X_EXPORT void RT_SetStandard (TheatrePtr t, uint16_t wStandard) 1148209ff23fSmrg{ 1149209ff23fSmrg double dbFsamp=0, dbLPeriod=0, dbFPeriod=0; 1150209ff23fSmrg uint16_t wFrameTotal = 0; 1151209ff23fSmrg double dbSPPeriod = 4.70; 1152209ff23fSmrg 115368105dcbSveego xf86DrvMsg(t->VIP->pScrn->scrnIndex,X_INFO,"Rage Theatre setting standard 0x%04x\n", 1154209ff23fSmrg wStandard); 1155209ff23fSmrg t->wStandard = wStandard; 1156209ff23fSmrg 1157209ff23fSmrg /* Get the constants for the given standard. */ 1158209ff23fSmrg GetStandardConstants (&dbLPeriod, &dbFPeriod, &dbFsamp, wStandard); 1159209ff23fSmrg 1160209ff23fSmrg wFrameTotal = (uint16_t) (((2.0 * dbFPeriod) * 1000 / dbLPeriod) + 0.5); 1161209ff23fSmrg 1162209ff23fSmrg /* Procedures before setting the standards: */ 1163209ff23fSmrg WriteRT_fld (fld_VIN_CLK_SEL, RT_REF_CLK); 1164209ff23fSmrg WriteRT_fld (fld_VINRST, RT_VINRST_RESET); 1165209ff23fSmrg 1166209ff23fSmrg RT_SetVINClock (t, wStandard); 1167209ff23fSmrg 1168209ff23fSmrg WriteRT_fld (fld_VINRST, RT_VINRST_ACTIVE); 1169209ff23fSmrg WriteRT_fld (fld_VIN_CLK_SEL, RT_PLL_VIN_CLK); 1170209ff23fSmrg 1171209ff23fSmrg /* Program the new standards: */ 1172209ff23fSmrg switch (wStandard & 0x00FF) 1173209ff23fSmrg { 1174209ff23fSmrg case (DEC_NTSC): /*NTSC GROUP - 480 lines */ 1175209ff23fSmrg WriteRT_fld (fld_STANDARD_SEL, RT_NTSC); 1176209ff23fSmrg WriteRT_fld (fld_SYNCTIP_REF0, RT_NTSCM_SYNCTIP_REF0); 1177209ff23fSmrg WriteRT_fld (fld_SYNCTIP_REF1, RT_NTSCM_SYNCTIP_REF1); 1178209ff23fSmrg WriteRT_fld (fld_CLAMP_REF, RT_NTSCM_CLAMP_REF); 1179209ff23fSmrg WriteRT_fld (fld_AGC_PEAKWHITE, RT_NTSCM_PEAKWHITE); 1180209ff23fSmrg WriteRT_fld (fld_VBI_PEAKWHITE, RT_NTSCM_VBI_PEAKWHITE); 1181209ff23fSmrg WriteRT_fld (fld_WPA_THRESHOLD, RT_NTSCM_WPA_THRESHOLD); 1182209ff23fSmrg WriteRT_fld (fld_WPA_TRIGGER_LO, RT_NTSCM_WPA_TRIGGER_LO); 1183209ff23fSmrg WriteRT_fld (fld_WPA_TRIGGER_HIGH, RT_NTSCM_WPA_TRIGGER_HIGH); 1184209ff23fSmrg WriteRT_fld (fld_LOCKOUT_START, RT_NTSCM_LP_LOCKOUT_START); 1185209ff23fSmrg WriteRT_fld (fld_LOCKOUT_END, RT_NTSCM_LP_LOCKOUT_END); 1186209ff23fSmrg WriteRT_fld (fld_CH_DTO_INC, RT_NTSCM_CH_DTO_INC); 1187209ff23fSmrg WriteRT_fld (fld_PLL_SGAIN, RT_NTSCM_CH_PLL_SGAIN); 1188209ff23fSmrg WriteRT_fld (fld_PLL_FGAIN, RT_NTSCM_CH_PLL_FGAIN); 1189209ff23fSmrg 1190209ff23fSmrg WriteRT_fld (fld_CH_HEIGHT, RT_NTSCM_CH_HEIGHT); 1191209ff23fSmrg WriteRT_fld (fld_CH_KILL_LEVEL, RT_NTSCM_CH_KILL_LEVEL); 1192209ff23fSmrg 1193209ff23fSmrg WriteRT_fld (fld_CH_AGC_ERROR_LIM, RT_NTSCM_CH_AGC_ERROR_LIM); 1194209ff23fSmrg WriteRT_fld (fld_CH_AGC_FILTER_EN, RT_NTSCM_CH_AGC_FILTER_EN); 1195209ff23fSmrg WriteRT_fld (fld_CH_AGC_LOOP_SPEED,RT_NTSCM_CH_AGC_LOOP_SPEED); 1196209ff23fSmrg 1197209ff23fSmrg WriteRT_fld (fld_VS_FIELD_BLANK_START, RT_NTSCM_VS_FIELD_BLANK_START); 1198209ff23fSmrg WriteRT_fld (fld_VS_FIELD_BLANK_END, RT_NTSCM_VS_FIELD_BLANK_END); 1199209ff23fSmrg 1200209ff23fSmrg WriteRT_fld (fld_H_ACTIVE_START, RT_NTSCM_H_ACTIVE_START); 1201209ff23fSmrg WriteRT_fld (fld_H_ACTIVE_END, RT_NTSCM_H_ACTIVE_END); 1202209ff23fSmrg 1203209ff23fSmrg WriteRT_fld (fld_V_ACTIVE_START, RT_NTSCM_V_ACTIVE_START); 1204209ff23fSmrg WriteRT_fld (fld_V_ACTIVE_END, RT_NTSCM_V_ACTIVE_END); 1205209ff23fSmrg 1206209ff23fSmrg WriteRT_fld (fld_H_VBI_WIND_START, RT_NTSCM_H_VBI_WIND_START); 1207209ff23fSmrg WriteRT_fld (fld_H_VBI_WIND_END, RT_NTSCM_H_VBI_WIND_END); 1208209ff23fSmrg 1209209ff23fSmrg WriteRT_fld (fld_V_VBI_WIND_START, RT_NTSCM_V_VBI_WIND_START); 1210209ff23fSmrg WriteRT_fld (fld_V_VBI_WIND_END, RT_NTSCM_V_VBI_WIND_END); 1211209ff23fSmrg 1212209ff23fSmrg WriteRT_fld (fld_UV_INT_START, (uint8_t)((0.10 * dbLPeriod * dbFsamp / 2.0) + 0.5 - 32)); 1213209ff23fSmrg 1214209ff23fSmrg WriteRT_fld (fld_VSYNC_INT_TRIGGER , (uint16_t) RT_NTSCM_VSYNC_INT_TRIGGER); 1215209ff23fSmrg WriteRT_fld (fld_VSYNC_INT_HOLD, (uint16_t) RT_NTSCM_VSYNC_INT_HOLD); 1216209ff23fSmrg 1217209ff23fSmrg switch (wStandard & 0xFF00) 1218209ff23fSmrg { 1219209ff23fSmrg case (extPAL_M): 1220209ff23fSmrg case (extNONE): 1221209ff23fSmrg case (extNTSC): 1222209ff23fSmrg WriteRT_fld (fld_CR_BURST_GAIN, RT_NTSCM_CR_BURST_GAIN); 1223209ff23fSmrg WriteRT_fld (fld_CB_BURST_GAIN, RT_NTSCM_CB_BURST_GAIN); 1224209ff23fSmrg 1225209ff23fSmrg WriteRT_fld (fld_CRDR_ACTIVE_GAIN, RT_NTSCM_CRDR_ACTIVE_GAIN); 1226209ff23fSmrg WriteRT_fld (fld_CBDB_ACTIVE_GAIN, RT_NTSCM_CBDB_ACTIVE_GAIN); 1227209ff23fSmrg 1228209ff23fSmrg WriteRT_fld (fld_VERT_LOCKOUT_START, RT_NTSCM_VERT_LOCKOUT_START); 1229209ff23fSmrg WriteRT_fld (fld_VERT_LOCKOUT_END, RT_NTSCM_VERT_LOCKOUT_END); 1230209ff23fSmrg 1231209ff23fSmrg break; 1232209ff23fSmrg case (extNTSC_J): 1233209ff23fSmrg WriteRT_fld (fld_CR_BURST_GAIN, RT_NTSCJ_CR_BURST_GAIN); 1234209ff23fSmrg WriteRT_fld (fld_CB_BURST_GAIN, RT_NTSCJ_CB_BURST_GAIN); 1235209ff23fSmrg 1236209ff23fSmrg WriteRT_fld (fld_CRDR_ACTIVE_GAIN, RT_NTSCJ_CRDR_ACTIVE_GAIN); 1237209ff23fSmrg WriteRT_fld (fld_CBDB_ACTIVE_GAIN, RT_NTSCJ_CBDB_ACTIVE_GAIN); 1238209ff23fSmrg 1239209ff23fSmrg WriteRT_fld (fld_CH_HEIGHT, RT_NTSCJ_CH_HEIGHT); 1240209ff23fSmrg WriteRT_fld (fld_CH_KILL_LEVEL, RT_NTSCJ_CH_KILL_LEVEL); 1241209ff23fSmrg 1242209ff23fSmrg WriteRT_fld (fld_CH_AGC_ERROR_LIM, RT_NTSCJ_CH_AGC_ERROR_LIM); 1243209ff23fSmrg WriteRT_fld (fld_CH_AGC_FILTER_EN, RT_NTSCJ_CH_AGC_FILTER_EN); 1244209ff23fSmrg WriteRT_fld (fld_CH_AGC_LOOP_SPEED, RT_NTSCJ_CH_AGC_LOOP_SPEED); 1245209ff23fSmrg 1246209ff23fSmrg WriteRT_fld (fld_VERT_LOCKOUT_START, RT_NTSCJ_VERT_LOCKOUT_START); 1247209ff23fSmrg WriteRT_fld (fld_VERT_LOCKOUT_END, RT_NTSCJ_VERT_LOCKOUT_END); 1248209ff23fSmrg 1249209ff23fSmrg break; 1250209ff23fSmrg default: 1251209ff23fSmrg break; 1252209ff23fSmrg } 1253209ff23fSmrg break; 1254209ff23fSmrg case (DEC_PAL): /*PAL GROUP - 525 lines */ 1255209ff23fSmrg WriteRT_fld (fld_STANDARD_SEL, RT_PAL); 1256209ff23fSmrg WriteRT_fld (fld_SYNCTIP_REF0, RT_PAL_SYNCTIP_REF0); 1257209ff23fSmrg WriteRT_fld (fld_SYNCTIP_REF1, RT_PAL_SYNCTIP_REF1); 1258209ff23fSmrg 1259209ff23fSmrg WriteRT_fld (fld_CLAMP_REF, RT_PAL_CLAMP_REF); 1260209ff23fSmrg WriteRT_fld (fld_AGC_PEAKWHITE, RT_PAL_PEAKWHITE); 1261209ff23fSmrg WriteRT_fld (fld_VBI_PEAKWHITE, RT_PAL_VBI_PEAKWHITE); 1262209ff23fSmrg 1263209ff23fSmrg WriteRT_fld (fld_WPA_THRESHOLD, RT_PAL_WPA_THRESHOLD); 1264209ff23fSmrg WriteRT_fld (fld_WPA_TRIGGER_LO, RT_PAL_WPA_TRIGGER_LO); 1265209ff23fSmrg WriteRT_fld (fld_WPA_TRIGGER_HIGH, RT_PAL_WPA_TRIGGER_HIGH); 1266209ff23fSmrg 1267209ff23fSmrg WriteRT_fld (fld_LOCKOUT_START,RT_PAL_LP_LOCKOUT_START); 1268209ff23fSmrg WriteRT_fld (fld_LOCKOUT_END, RT_PAL_LP_LOCKOUT_END); 1269209ff23fSmrg WriteRT_fld (fld_CH_DTO_INC, RT_PAL_CH_DTO_INC); 1270209ff23fSmrg WriteRT_fld (fld_PLL_SGAIN, RT_PAL_CH_PLL_SGAIN); 1271209ff23fSmrg WriteRT_fld (fld_PLL_FGAIN, RT_PAL_CH_PLL_FGAIN); 1272209ff23fSmrg 1273209ff23fSmrg WriteRT_fld (fld_CR_BURST_GAIN, RT_PAL_CR_BURST_GAIN); 1274209ff23fSmrg WriteRT_fld (fld_CB_BURST_GAIN, RT_PAL_CB_BURST_GAIN); 1275209ff23fSmrg 1276209ff23fSmrg WriteRT_fld (fld_CRDR_ACTIVE_GAIN, RT_PAL_CRDR_ACTIVE_GAIN); 1277209ff23fSmrg WriteRT_fld (fld_CBDB_ACTIVE_GAIN, RT_PAL_CBDB_ACTIVE_GAIN); 1278209ff23fSmrg 1279209ff23fSmrg WriteRT_fld (fld_CH_HEIGHT, RT_PAL_CH_HEIGHT); 1280209ff23fSmrg WriteRT_fld (fld_CH_KILL_LEVEL, RT_PAL_CH_KILL_LEVEL); 1281209ff23fSmrg 1282209ff23fSmrg WriteRT_fld (fld_CH_AGC_ERROR_LIM, RT_PAL_CH_AGC_ERROR_LIM); 1283209ff23fSmrg WriteRT_fld (fld_CH_AGC_FILTER_EN, RT_PAL_CH_AGC_FILTER_EN); 1284209ff23fSmrg WriteRT_fld (fld_CH_AGC_LOOP_SPEED,RT_PAL_CH_AGC_LOOP_SPEED); 1285209ff23fSmrg 1286209ff23fSmrg WriteRT_fld (fld_VERT_LOCKOUT_START, RT_PAL_VERT_LOCKOUT_START); 1287209ff23fSmrg WriteRT_fld (fld_VERT_LOCKOUT_END, RT_PAL_VERT_LOCKOUT_END); 1288209ff23fSmrg WriteRT_fld (fld_VS_FIELD_BLANK_START, (uint16_t)RT_PALSEM_VS_FIELD_BLANK_START); 1289209ff23fSmrg 1290209ff23fSmrg WriteRT_fld (fld_VS_FIELD_BLANK_END, RT_PAL_VS_FIELD_BLANK_END); 1291209ff23fSmrg 1292209ff23fSmrg WriteRT_fld (fld_H_ACTIVE_START, RT_PAL_H_ACTIVE_START); 1293209ff23fSmrg WriteRT_fld (fld_H_ACTIVE_END, RT_PAL_H_ACTIVE_END); 1294209ff23fSmrg 1295209ff23fSmrg WriteRT_fld (fld_V_ACTIVE_START, RT_PAL_V_ACTIVE_START); 1296209ff23fSmrg WriteRT_fld (fld_V_ACTIVE_END, RT_PAL_V_ACTIVE_END); 1297209ff23fSmrg 1298209ff23fSmrg WriteRT_fld (fld_H_VBI_WIND_START, RT_PAL_H_VBI_WIND_START); 1299209ff23fSmrg WriteRT_fld (fld_H_VBI_WIND_END, RT_PAL_H_VBI_WIND_END); 1300209ff23fSmrg 1301209ff23fSmrg WriteRT_fld (fld_V_VBI_WIND_START, RT_PAL_V_VBI_WIND_START); 1302209ff23fSmrg WriteRT_fld (fld_V_VBI_WIND_END, RT_PAL_V_VBI_WIND_END); 1303209ff23fSmrg 1304209ff23fSmrg /* Magic 0.10 is correct - according to Ivo. Also see SECAM code below */ 1305209ff23fSmrg/* WriteRT_fld (fld_UV_INT_START, (uint8_t)( (0.12 * dbLPeriod * dbFsamp / 2.0) + 0.5 - 32 )); */ 1306209ff23fSmrg WriteRT_fld (fld_UV_INT_START, (uint8_t)( (0.10 * dbLPeriod * dbFsamp / 2.0) + 0.5 - 32 )); 1307209ff23fSmrg 1308209ff23fSmrg WriteRT_fld (fld_VSYNC_INT_TRIGGER , (uint16_t) RT_PALSEM_VSYNC_INT_TRIGGER); 1309209ff23fSmrg WriteRT_fld (fld_VSYNC_INT_HOLD, (uint16_t) RT_PALSEM_VSYNC_INT_HOLD); 1310209ff23fSmrg 1311209ff23fSmrg break; 1312209ff23fSmrg case (DEC_SECAM): /*PAL GROUP*/ 1313209ff23fSmrg WriteRT_fld (fld_STANDARD_SEL, RT_SECAM); 1314209ff23fSmrg WriteRT_fld (fld_SYNCTIP_REF0, RT_SECAM_SYNCTIP_REF0); 1315209ff23fSmrg WriteRT_fld (fld_SYNCTIP_REF1, RT_SECAM_SYNCTIP_REF1); 1316209ff23fSmrg WriteRT_fld (fld_CLAMP_REF, RT_SECAM_CLAMP_REF); 1317209ff23fSmrg WriteRT_fld (fld_AGC_PEAKWHITE, RT_SECAM_PEAKWHITE); 1318209ff23fSmrg WriteRT_fld (fld_VBI_PEAKWHITE, RT_SECAM_VBI_PEAKWHITE); 1319209ff23fSmrg 1320209ff23fSmrg WriteRT_fld (fld_WPA_THRESHOLD, RT_SECAM_WPA_THRESHOLD); 1321209ff23fSmrg 1322209ff23fSmrg WriteRT_fld (fld_WPA_TRIGGER_LO, RT_SECAM_WPA_TRIGGER_LO); 1323209ff23fSmrg WriteRT_fld (fld_WPA_TRIGGER_HIGH, RT_SECAM_WPA_TRIGGER_HIGH); 1324209ff23fSmrg 1325209ff23fSmrg WriteRT_fld (fld_LOCKOUT_START,RT_SECAM_LP_LOCKOUT_START); 1326209ff23fSmrg WriteRT_fld (fld_LOCKOUT_END, RT_SECAM_LP_LOCKOUT_END); 1327209ff23fSmrg 1328209ff23fSmrg WriteRT_fld (fld_CH_DTO_INC, RT_SECAM_CH_DTO_INC); 1329209ff23fSmrg WriteRT_fld (fld_PLL_SGAIN, RT_SECAM_CH_PLL_SGAIN); 1330209ff23fSmrg WriteRT_fld (fld_PLL_FGAIN, RT_SECAM_CH_PLL_FGAIN); 1331209ff23fSmrg 1332209ff23fSmrg WriteRT_fld (fld_CR_BURST_GAIN, RT_SECAM_CR_BURST_GAIN); 1333209ff23fSmrg WriteRT_fld (fld_CB_BURST_GAIN, RT_SECAM_CB_BURST_GAIN); 1334209ff23fSmrg 1335209ff23fSmrg WriteRT_fld (fld_CRDR_ACTIVE_GAIN, RT_SECAM_CRDR_ACTIVE_GAIN); 1336209ff23fSmrg WriteRT_fld (fld_CBDB_ACTIVE_GAIN, RT_SECAM_CBDB_ACTIVE_GAIN); 1337209ff23fSmrg 1338209ff23fSmrg WriteRT_fld (fld_CH_HEIGHT, RT_SECAM_CH_HEIGHT); 1339209ff23fSmrg WriteRT_fld (fld_CH_KILL_LEVEL, RT_SECAM_CH_KILL_LEVEL); 1340209ff23fSmrg 1341209ff23fSmrg WriteRT_fld (fld_CH_AGC_ERROR_LIM, RT_SECAM_CH_AGC_ERROR_LIM); 1342209ff23fSmrg WriteRT_fld (fld_CH_AGC_FILTER_EN, RT_SECAM_CH_AGC_FILTER_EN); 1343209ff23fSmrg WriteRT_fld (fld_CH_AGC_LOOP_SPEED,RT_SECAM_CH_AGC_LOOP_SPEED); 1344209ff23fSmrg 1345209ff23fSmrg WriteRT_fld (fld_VERT_LOCKOUT_START, RT_SECAM_VERT_LOCKOUT_START); /*Might not need */ 1346209ff23fSmrg WriteRT_fld (fld_VERT_LOCKOUT_END, RT_SECAM_VERT_LOCKOUT_END); /* Might not need */ 1347209ff23fSmrg 1348209ff23fSmrg WriteRT_fld (fld_VS_FIELD_BLANK_START, (uint16_t)RT_PALSEM_VS_FIELD_BLANK_START); 1349209ff23fSmrg WriteRT_fld (fld_VS_FIELD_BLANK_END, RT_PAL_VS_FIELD_BLANK_END); 1350209ff23fSmrg 1351209ff23fSmrg WriteRT_fld (fld_H_ACTIVE_START, RT_PAL_H_ACTIVE_START); 1352209ff23fSmrg WriteRT_fld (fld_H_ACTIVE_END, RT_PAL_H_ACTIVE_END); 1353209ff23fSmrg 1354209ff23fSmrg WriteRT_fld (fld_V_ACTIVE_START, RT_PAL_V_ACTIVE_START); 1355209ff23fSmrg WriteRT_fld (fld_V_ACTIVE_END, RT_PAL_V_ACTIVE_END); 1356209ff23fSmrg 1357209ff23fSmrg WriteRT_fld (fld_H_VBI_WIND_START, RT_PAL_H_VBI_WIND_START); 1358209ff23fSmrg WriteRT_fld (fld_H_VBI_WIND_END, RT_PAL_H_VBI_WIND_END); 1359209ff23fSmrg 1360209ff23fSmrg WriteRT_fld (fld_V_VBI_WIND_START, RT_PAL_V_VBI_WIND_START); 1361209ff23fSmrg WriteRT_fld (fld_V_VBI_WIND_END, RT_PAL_V_VBI_WIND_END); 1362209ff23fSmrg 1363209ff23fSmrg WriteRT_fld (fld_VSYNC_INT_TRIGGER , (uint16_t) RT_PALSEM_VSYNC_INT_TRIGGER); 1364209ff23fSmrg WriteRT_fld (fld_VSYNC_INT_HOLD, (uint16_t) RT_PALSEM_VSYNC_INT_HOLD); 1365209ff23fSmrg 1366209ff23fSmrg/* WriteRT_fld (fld_UV_INT_START, (uint8_t)( (0.12 * dbLPeriod * dbFsamp / 2.0) + 0.5 - 32 )); */ 1367209ff23fSmrg WriteRT_fld (fld_UV_INT_START, (uint8_t)( (0.10 * dbLPeriod * dbFsamp / 2.0) + 0.5 - 32 )); 1368209ff23fSmrg 1369209ff23fSmrg break; 1370209ff23fSmrg default: 1371209ff23fSmrg break; 1372209ff23fSmrg } 1373209ff23fSmrg 1374209ff23fSmrg if (t->wConnector == DEC_SVIDEO) 1375209ff23fSmrg { 1376209ff23fSmrg 1377209ff23fSmrg RT_SetCombFilter (t, wStandard, RT_SVIDEO); 1378209ff23fSmrg } 1379209ff23fSmrg else 1380209ff23fSmrg { 1381209ff23fSmrg /* Set up extra (connector and std) registers. */ 1382209ff23fSmrg RT_SetCombFilter (t, wStandard, RT_COMPOSITE); 1383209ff23fSmrg } 1384209ff23fSmrg 1385209ff23fSmrg /* Set the following values according to the formulas */ 1386209ff23fSmrg WriteRT_fld (fld_HS_LINE_TOTAL, (uint16_t)((dbLPeriod * dbFsamp / 2.0) +0.5)); 1387209ff23fSmrg /* According to Ivo PAL/SECAM needs different treatment */ 1388209ff23fSmrg switch(wStandard & 0x00FF) 1389209ff23fSmrg { 1390209ff23fSmrg case DEC_PAL: 1391209ff23fSmrg case DEC_SECAM: 1392209ff23fSmrg WriteRT_fld (fld_MIN_PULSE_WIDTH, (uint8_t)(0.5 * dbSPPeriod * dbFsamp/2.0)); 1393209ff23fSmrg WriteRT_fld (fld_MAX_PULSE_WIDTH, (uint8_t)(1.5 * dbSPPeriod * dbFsamp/2.0)); 1394209ff23fSmrg WriteRT_fld (fld_WIN_OPEN_LIMIT, (uint16_t)(((dbLPeriod * dbFsamp / 4.0) + 0.5) - 16)); 1395209ff23fSmrg WriteRT_fld (fld_WIN_CLOSE_LIMIT, (uint16_t)(2.39 * dbSPPeriod * dbFsamp / 2.0)); 1396209ff23fSmrg /* WriteRT_fld (fld_VS_FIELD_IDLOCATION, (uint16_t)RT_PAL_FIELD_IDLOCATION); */ 1397209ff23fSmrg /* According to docs the following value will work right, though the resulting stream deviates 1398209ff23fSmrg slightly from CCIR..., in particular the value that was before will do nuts to VCRs in 1399209ff23fSmrg pause/rewind state. */ 1400209ff23fSmrg WriteRT_fld (fld_VS_FIELD_IDLOCATION, (uint16_t)0x01); 1401209ff23fSmrg WriteRT_fld (fld_HS_PLL_SGAIN, 2); 1402209ff23fSmrg break; 1403209ff23fSmrg case DEC_NTSC: 1404209ff23fSmrg WriteRT_fld (fld_MIN_PULSE_WIDTH, (uint8_t)(0.75 * dbSPPeriod * dbFsamp/2.0)); 1405209ff23fSmrg WriteRT_fld (fld_MAX_PULSE_WIDTH, (uint8_t)(1.25 * dbSPPeriod * dbFsamp/2.0)); 1406209ff23fSmrg WriteRT_fld (fld_WIN_OPEN_LIMIT, (uint16_t)(((dbLPeriod * dbFsamp / 4.0) + 0.5) - 16)); 1407209ff23fSmrg WriteRT_fld (fld_WIN_CLOSE_LIMIT, (uint16_t)(1.15 * dbSPPeriod * dbFsamp / 2.0)); 1408209ff23fSmrg /* WriteRT_fld (fld_VS_FIELD_IDLOCATION, (uint16_t)fld_VS_FIELD_IDLOCATION_def);*/ 1409209ff23fSmrg /* I think the default value was the same as the one here.. does not hurt to hardcode it */ 1410209ff23fSmrg WriteRT_fld (fld_VS_FIELD_IDLOCATION, (uint16_t)0x01); 1411209ff23fSmrg 1412209ff23fSmrg } 1413209ff23fSmrg 1414209ff23fSmrg WriteRT_fld (fld_VS_FRAME_TOTAL, (uint16_t)(wFrameTotal) + 10); 1415209ff23fSmrg WriteRT_fld (fld_BLACK_INT_START, (uint8_t)((0.09 * dbLPeriod * dbFsamp / 2.0) - 32 )); 1416209ff23fSmrg WriteRT_fld (fld_SYNC_TIP_START, (uint16_t)((dbLPeriod * dbFsamp / 2.0 + 0.5) - 28 )); 1417209ff23fSmrg 1418209ff23fSmrg return; 1419209ff23fSmrg 1420209ff23fSmrg} /* RT_SetStandard ()... */ 1421209ff23fSmrg 1422209ff23fSmrg 1423209ff23fSmrg 1424209ff23fSmrg/**************************************************************************** 1425209ff23fSmrg * RT_SetCombFilter (uint16_t wStandard, uint16_t wConnector) * 1426209ff23fSmrg * Function: sets the input comb filter based on the standard and * 1427209ff23fSmrg * connector being used (composite vs. svideo) * 1428209ff23fSmrg * Inputs: uint16_t wStandard - input standard (NTSC, PAL, SECAM) * 1429209ff23fSmrg * uint16_t wConnector - COMPOSITE, SVIDEO * 1430209ff23fSmrg * Outputs: NONE * 1431209ff23fSmrg ****************************************************************************/ 1432209ff23fSmrgstatic void RT_SetCombFilter (TheatrePtr t, uint16_t wStandard, uint16_t wConnector) 1433209ff23fSmrg{ 1434209ff23fSmrg uint32_t dwComb_Cntl0=0; 1435209ff23fSmrg uint32_t dwComb_Cntl1=0; 1436209ff23fSmrg uint32_t dwComb_Cntl2=0; 1437209ff23fSmrg uint32_t dwComb_Line_Length=0; 1438209ff23fSmrg 1439209ff23fSmrg switch (wConnector) 1440209ff23fSmrg { 1441209ff23fSmrg case RT_COMPOSITE: 1442209ff23fSmrg switch (wStandard & 0x00FF) 1443209ff23fSmrg { 1444209ff23fSmrg case (DEC_NTSC): 1445209ff23fSmrg switch (wStandard & 0xFF00) 1446209ff23fSmrg { 1447209ff23fSmrg case (extNONE): 1448209ff23fSmrg case (extNTSC): 1449209ff23fSmrg case (extNTSC_J): 1450209ff23fSmrg dwComb_Cntl0= RT_NTSCM_COMB_CNTL0_COMPOSITE; 1451209ff23fSmrg dwComb_Cntl1= RT_NTSCM_COMB_CNTL1_COMPOSITE; 1452209ff23fSmrg dwComb_Cntl2= RT_NTSCM_COMB_CNTL2_COMPOSITE; 1453209ff23fSmrg dwComb_Line_Length= RT_NTSCM_COMB_LENGTH_COMPOSITE; 1454209ff23fSmrg break; 1455209ff23fSmrg case (extPAL_M): 1456209ff23fSmrg dwComb_Cntl0= RT_PALM_COMB_CNTL0_COMPOSITE; 1457209ff23fSmrg dwComb_Cntl1= RT_PALM_COMB_CNTL1_COMPOSITE; 1458209ff23fSmrg dwComb_Cntl2= RT_PALM_COMB_CNTL2_COMPOSITE; 1459209ff23fSmrg dwComb_Line_Length= RT_PALM_COMB_LENGTH_COMPOSITE; 1460209ff23fSmrg break; 1461209ff23fSmrg default: 1462209ff23fSmrg return; 1463209ff23fSmrg } 1464209ff23fSmrg break; 1465209ff23fSmrg case (DEC_PAL): 1466209ff23fSmrg switch (wStandard & 0xFF00) 1467209ff23fSmrg { 1468209ff23fSmrg case (extNONE): 1469209ff23fSmrg case (extPAL): 1470209ff23fSmrg dwComb_Cntl0= RT_PAL_COMB_CNTL0_COMPOSITE; 1471209ff23fSmrg dwComb_Cntl1= RT_PAL_COMB_CNTL1_COMPOSITE; 1472209ff23fSmrg dwComb_Cntl2= RT_PAL_COMB_CNTL2_COMPOSITE; 1473209ff23fSmrg dwComb_Line_Length= RT_PAL_COMB_LENGTH_COMPOSITE; 1474209ff23fSmrg break; 1475209ff23fSmrg case (extPAL_N): 1476209ff23fSmrg dwComb_Cntl0= RT_PALN_COMB_CNTL0_COMPOSITE; 1477209ff23fSmrg dwComb_Cntl1= RT_PALN_COMB_CNTL1_COMPOSITE; 1478209ff23fSmrg dwComb_Cntl2= RT_PALN_COMB_CNTL2_COMPOSITE; 1479209ff23fSmrg dwComb_Line_Length= RT_PALN_COMB_LENGTH_COMPOSITE; 1480209ff23fSmrg break; 1481209ff23fSmrg default: 1482209ff23fSmrg return; 1483209ff23fSmrg } 1484209ff23fSmrg break; 1485209ff23fSmrg case (DEC_SECAM): 1486209ff23fSmrg dwComb_Cntl0= RT_SECAM_COMB_CNTL0_COMPOSITE; 1487209ff23fSmrg dwComb_Cntl1= RT_SECAM_COMB_CNTL1_COMPOSITE; 1488209ff23fSmrg dwComb_Cntl2= RT_SECAM_COMB_CNTL2_COMPOSITE; 1489209ff23fSmrg dwComb_Line_Length= RT_SECAM_COMB_LENGTH_COMPOSITE; 1490209ff23fSmrg break; 1491209ff23fSmrg default: 1492209ff23fSmrg return; 1493209ff23fSmrg } 1494209ff23fSmrg break; 1495209ff23fSmrg case RT_SVIDEO: 1496209ff23fSmrg switch (wStandard & 0x00FF) 1497209ff23fSmrg { 1498209ff23fSmrg case (DEC_NTSC): 1499209ff23fSmrg switch (wStandard & 0xFF00) 1500209ff23fSmrg { 1501209ff23fSmrg case (extNONE): 1502209ff23fSmrg case (extNTSC): 1503209ff23fSmrg dwComb_Cntl0= RT_NTSCM_COMB_CNTL0_SVIDEO; 1504209ff23fSmrg dwComb_Cntl1= RT_NTSCM_COMB_CNTL1_SVIDEO; 1505209ff23fSmrg dwComb_Cntl2= RT_NTSCM_COMB_CNTL2_SVIDEO; 1506209ff23fSmrg dwComb_Line_Length= RT_NTSCM_COMB_LENGTH_SVIDEO; 1507209ff23fSmrg break; 1508209ff23fSmrg case (extPAL_M): 1509209ff23fSmrg dwComb_Cntl0= RT_PALM_COMB_CNTL0_SVIDEO; 1510209ff23fSmrg dwComb_Cntl1= RT_PALM_COMB_CNTL1_SVIDEO; 1511209ff23fSmrg dwComb_Cntl2= RT_PALM_COMB_CNTL2_SVIDEO; 1512209ff23fSmrg dwComb_Line_Length= RT_PALM_COMB_LENGTH_SVIDEO; 1513209ff23fSmrg break; 1514209ff23fSmrg default: 1515209ff23fSmrg return; 1516209ff23fSmrg } 1517209ff23fSmrg break; 1518209ff23fSmrg case (DEC_PAL): 1519209ff23fSmrg switch (wStandard & 0xFF00) 1520209ff23fSmrg { 1521209ff23fSmrg case (extNONE): 1522209ff23fSmrg case (extPAL): 1523209ff23fSmrg dwComb_Cntl0= RT_PAL_COMB_CNTL0_SVIDEO; 1524209ff23fSmrg dwComb_Cntl1= RT_PAL_COMB_CNTL1_SVIDEO; 1525209ff23fSmrg dwComb_Cntl2= RT_PAL_COMB_CNTL2_SVIDEO; 1526209ff23fSmrg dwComb_Line_Length= RT_PAL_COMB_LENGTH_SVIDEO; 1527209ff23fSmrg break; 1528209ff23fSmrg case (extPAL_N): 1529209ff23fSmrg dwComb_Cntl0= RT_PALN_COMB_CNTL0_SVIDEO; 1530209ff23fSmrg dwComb_Cntl1= RT_PALN_COMB_CNTL1_SVIDEO; 1531209ff23fSmrg dwComb_Cntl2= RT_PALN_COMB_CNTL2_SVIDEO; 1532209ff23fSmrg dwComb_Line_Length= RT_PALN_COMB_LENGTH_SVIDEO; 1533209ff23fSmrg break; 1534209ff23fSmrg default: 1535209ff23fSmrg return; 1536209ff23fSmrg } 1537209ff23fSmrg break; 1538209ff23fSmrg case (DEC_SECAM): 1539209ff23fSmrg dwComb_Cntl0= RT_SECAM_COMB_CNTL0_SVIDEO; 1540209ff23fSmrg dwComb_Cntl1= RT_SECAM_COMB_CNTL1_SVIDEO; 1541209ff23fSmrg dwComb_Cntl2= RT_SECAM_COMB_CNTL2_SVIDEO; 1542209ff23fSmrg dwComb_Line_Length= RT_SECAM_COMB_LENGTH_SVIDEO; 1543209ff23fSmrg break; 1544209ff23fSmrg default: 1545209ff23fSmrg return; 1546209ff23fSmrg } 1547209ff23fSmrg break; 1548209ff23fSmrg default: 1549209ff23fSmrg return; 1550209ff23fSmrg } 1551209ff23fSmrg 1552209ff23fSmrg WriteRT_fld (fld_COMB_CNTL0, dwComb_Cntl0); 1553209ff23fSmrg WriteRT_fld (fld_COMB_CNTL1, dwComb_Cntl1); 1554209ff23fSmrg WriteRT_fld (fld_COMB_CNTL2, dwComb_Cntl2); 1555209ff23fSmrg WriteRT_fld (fld_COMB_LENGTH, dwComb_Line_Length); 1556209ff23fSmrg 1557209ff23fSmrg return; 1558209ff23fSmrg 1559209ff23fSmrg} /* RT_SetCombFilter ()... */ 1560209ff23fSmrg 1561209ff23fSmrg 1562209ff23fSmrg/**************************************************************************** 1563209ff23fSmrg * RT_SetOutputVideoSize (uint16_t wHorzSize, uint16_t wVertSize, * 1564209ff23fSmrg * uint8_t fCC_On, uint8_t fVBICap_On) * 1565209ff23fSmrg * Function: sets the output video size for the Rage Theatre video in * 1566209ff23fSmrg * Inputs: uint16_t wHorzSize - width of output in pixels * 1567209ff23fSmrg * uint16_t wVertSize - height of output in pixels (lines) * 1568209ff23fSmrg * uint8_t fCC_On - enable CC output * 1569209ff23fSmrg * uint8_t fVBI_Cap_On - enable VBI capture * 1570209ff23fSmrg * Outputs: NONE * 1571209ff23fSmrg ****************************************************************************/ 1572209ff23fSmrg_X_EXPORT void RT_SetOutputVideoSize (TheatrePtr t, uint16_t wHorzSize, uint16_t wVertSize, uint8_t fCC_On, uint8_t fVBICap_On) 1573209ff23fSmrg{ 1574209ff23fSmrg uint32_t dwHwinStart=0; 1575209ff23fSmrg uint32_t dwHScaleRatio=0; 1576209ff23fSmrg uint32_t dwHActiveLength=0; 1577209ff23fSmrg uint32_t dwVwinStart=0; 1578209ff23fSmrg uint32_t dwVScaleRatio=0; 1579209ff23fSmrg uint32_t dwVActiveLength=0; 1580209ff23fSmrg uint32_t dwTempRatio=0; 1581209ff23fSmrg uint32_t dwEvenFieldOffset=0; 1582209ff23fSmrg uint32_t dwOddFieldOffset=0; 1583209ff23fSmrg uint32_t dwXin=0; 1584209ff23fSmrg uint32_t dwYin=0; 1585209ff23fSmrg 1586209ff23fSmrg if (fVBICap_On) 1587209ff23fSmrg { 1588209ff23fSmrg WriteRT_fld (fld_VBI_CAPTURE_ENABLE, 1); 1589209ff23fSmrg WriteRT_fld (fld_VBI_SCALING_RATIO, fld_VBI_SCALING_RATIO_def); 1590209ff23fSmrg switch (t->wStandard & 0x00FF) 1591209ff23fSmrg { 1592209ff23fSmrg case (DEC_NTSC): 1593209ff23fSmrg WriteRT_fld (fld_H_VBI_WIND_START, RT_NTSCM_H_VBI_WIND_START); 1594209ff23fSmrg WriteRT_fld (fld_H_VBI_WIND_END, RT_NTSCM_H_VBI_WIND_END); 1595209ff23fSmrg WriteRT_fld (fld_V_VBI_WIND_START, RT_NTSCM_V_VBI_WIND_START); 1596209ff23fSmrg WriteRT_fld (fld_V_VBI_WIND_END, RT_NTSCM_V_VBI_WIND_END); 1597209ff23fSmrg break; 1598209ff23fSmrg case (DEC_PAL): 1599209ff23fSmrg WriteRT_fld (fld_H_VBI_WIND_START, RT_PAL_H_VBI_WIND_START); 1600209ff23fSmrg WriteRT_fld (fld_H_VBI_WIND_END, RT_PAL_H_VBI_WIND_END); 1601209ff23fSmrg WriteRT_fld (fld_V_VBI_WIND_START, RT_PAL_V_VBI_WIND_START); 1602209ff23fSmrg WriteRT_fld (fld_V_VBI_WIND_END, RT_PAL_V_VBI_WIND_END); 1603209ff23fSmrg break; 1604209ff23fSmrg case (DEC_SECAM): 1605209ff23fSmrg WriteRT_fld (fld_H_VBI_WIND_START, RT_PAL_H_VBI_WIND_START); 1606209ff23fSmrg WriteRT_fld (fld_H_VBI_WIND_END, RT_PAL_H_VBI_WIND_END); 1607209ff23fSmrg WriteRT_fld (fld_V_VBI_WIND_START, RT_PAL_V_VBI_WIND_START); 1608209ff23fSmrg WriteRT_fld (fld_V_VBI_WIND_END, RT_PAL_V_VBI_WIND_END); 1609209ff23fSmrg break; 1610209ff23fSmrg default: 1611209ff23fSmrg break; 1612209ff23fSmrg } 1613209ff23fSmrg } 1614209ff23fSmrg else 1615209ff23fSmrg { 1616209ff23fSmrg WriteRT_fld (fld_VBI_CAPTURE_ENABLE, 0); 1617209ff23fSmrg } 1618209ff23fSmrg 1619209ff23fSmrg if (t->wInterlaced != RT_DECINTERLACED) 1620209ff23fSmrg { 1621209ff23fSmrg wVertSize *= 2; 1622209ff23fSmrg } 1623209ff23fSmrg 1624209ff23fSmrg /*1. Calculate Horizontal Scaling ratio:*/ 1625209ff23fSmrg switch (t->wStandard & 0x00FF) 1626209ff23fSmrg { 1627209ff23fSmrg case (DEC_NTSC): 1628209ff23fSmrg dwHwinStart = RT_NTSCM_H_IN_START; 1629209ff23fSmrg dwXin = (ReadRT_fld (fld_H_ACTIVE_END) - ReadRT_fld (fld_H_ACTIVE_START)); /*tempscaler*/ 1630209ff23fSmrg dwXin = RT_NTSC_H_ACTIVE_SIZE; 1631209ff23fSmrg dwHScaleRatio = (uint32_t) ((long) dwXin * 65536L / wHorzSize); 1632209ff23fSmrg dwHScaleRatio = dwHScaleRatio & 0x001FFFFF; /*21 bit number;*/ 1633209ff23fSmrg dwHActiveLength = wHorzSize; 1634209ff23fSmrg break; 1635209ff23fSmrg case (DEC_PAL): 1636209ff23fSmrg dwHwinStart = RT_PAL_H_IN_START; 1637209ff23fSmrg dwXin = RT_PAL_H_ACTIVE_SIZE; 1638209ff23fSmrg dwHScaleRatio = (uint32_t) ((long) dwXin * 65536L / wHorzSize); 1639209ff23fSmrg dwHScaleRatio = dwHScaleRatio & 0x001FFFFF; /*21 bit number;*/ 1640209ff23fSmrg dwHActiveLength = wHorzSize; 1641209ff23fSmrg break; 1642209ff23fSmrg case (DEC_SECAM): 1643209ff23fSmrg dwHwinStart = RT_SECAM_H_IN_START; 1644209ff23fSmrg dwXin = RT_SECAM_H_ACTIVE_SIZE; 1645209ff23fSmrg dwHScaleRatio = (uint32_t) ((long) dwXin * 65536L / wHorzSize); 1646209ff23fSmrg dwHScaleRatio = dwHScaleRatio & 0x001FFFFF; /*21 bit number;*/ 1647209ff23fSmrg dwHActiveLength = wHorzSize; 1648209ff23fSmrg break; 1649209ff23fSmrg default: 1650209ff23fSmrg break; 1651209ff23fSmrg } 1652209ff23fSmrg 1653209ff23fSmrg /*2. Calculate Vertical Scaling ratio:*/ 1654209ff23fSmrg switch (t->wStandard & 0x00FF) 1655209ff23fSmrg { 1656209ff23fSmrg case (DEC_NTSC): 1657209ff23fSmrg dwVwinStart = RT_NTSCM_V_IN_START; 1658209ff23fSmrg /* dwYin = (ReadRT_fld (fld_V_ACTIVE_END) - ReadRT_fld (fld_V_ACTIVE_START)); */ /*tempscaler*/ 1659209ff23fSmrg dwYin = RT_NTSCM_V_ACTIVE_SIZE; 1660209ff23fSmrg dwTempRatio = (uint32_t)((long) wVertSize / dwYin); 1661209ff23fSmrg dwVScaleRatio = (uint32_t)((long)wVertSize * 2048L / dwYin); 1662209ff23fSmrg dwVScaleRatio = dwVScaleRatio & 0x00000FFF; 1663209ff23fSmrg dwVActiveLength = wVertSize/2; 1664209ff23fSmrg break; 1665209ff23fSmrg case (DEC_PAL): 1666209ff23fSmrg dwVwinStart = RT_PAL_V_IN_START; 1667209ff23fSmrg dwYin = RT_PAL_V_ACTIVE_SIZE; 1668209ff23fSmrg dwTempRatio = (uint32_t)(wVertSize/dwYin); 1669209ff23fSmrg dwVScaleRatio = (uint32_t)((long)wVertSize * 2048L / dwYin); 1670209ff23fSmrg dwVScaleRatio = dwVScaleRatio & 0x00000FFF; 1671209ff23fSmrg dwVActiveLength = wVertSize/2; 1672209ff23fSmrg break; 1673209ff23fSmrg case (DEC_SECAM): 1674209ff23fSmrg dwVwinStart = RT_SECAM_V_IN_START; 1675209ff23fSmrg dwYin = RT_SECAM_V_ACTIVE_SIZE; 1676209ff23fSmrg dwTempRatio = (uint32_t) (wVertSize / dwYin); 1677209ff23fSmrg dwVScaleRatio = (uint32_t) ((long) wVertSize * 2048L / dwYin); 1678209ff23fSmrg dwVScaleRatio = dwVScaleRatio & 0x00000FFF; 1679209ff23fSmrg dwVActiveLength = wVertSize/2; 1680209ff23fSmrg break; 1681209ff23fSmrg default: 1682209ff23fSmrg break; 1683209ff23fSmrg } 1684209ff23fSmrg 1685209ff23fSmrg /*4. Set up offset based on if interlaced or not:*/ 1686209ff23fSmrg if (t->wInterlaced == RT_DECINTERLACED) 1687209ff23fSmrg { 1688209ff23fSmrg dwEvenFieldOffset = (uint32_t) ((1.0 - ((double) wVertSize / (double) dwYin)) * 512.0); 1689209ff23fSmrg dwOddFieldOffset = dwEvenFieldOffset; 1690209ff23fSmrg WriteRT_fld (fld_V_DEINTERLACE_ON, 0x1); 1691209ff23fSmrg } 1692209ff23fSmrg else 1693209ff23fSmrg { 1694209ff23fSmrg dwEvenFieldOffset = (uint32_t)(dwTempRatio * 512.0); 1695209ff23fSmrg dwOddFieldOffset = (uint32_t)(2048 - dwEvenFieldOffset); 1696209ff23fSmrg WriteRT_fld (fld_V_DEINTERLACE_ON, 0x0); 1697209ff23fSmrg } 1698209ff23fSmrg 1699209ff23fSmrg /* Set the registers:*/ 1700209ff23fSmrg WriteRT_fld (fld_H_IN_WIND_START, dwHwinStart); 1701209ff23fSmrg WriteRT_fld (fld_H_SCALE_RATIO, dwHScaleRatio); 1702209ff23fSmrg WriteRT_fld (fld_H_OUT_WIND_WIDTH, dwHActiveLength); 1703209ff23fSmrg 1704209ff23fSmrg WriteRT_fld (fld_V_IN_WIND_START, dwVwinStart); 1705209ff23fSmrg WriteRT_fld (fld_V_SCALE_RATIO, dwVScaleRatio); 1706209ff23fSmrg WriteRT_fld (fld_V_OUT_WIND_WIDTH, dwVActiveLength); 1707209ff23fSmrg 1708209ff23fSmrg WriteRT_fld (fld_EVENF_OFFSET, dwEvenFieldOffset); 1709209ff23fSmrg WriteRT_fld (fld_ODDF_OFFSET, dwOddFieldOffset); 1710209ff23fSmrg 1711209ff23fSmrg t->dwHorzScalingRatio = dwHScaleRatio; 1712209ff23fSmrg t->dwVertScalingRatio = dwVScaleRatio; 1713209ff23fSmrg 1714209ff23fSmrg return; 1715209ff23fSmrg 1716209ff23fSmrg} /* RT_SetOutputVideoSize ()...*/ 1717209ff23fSmrg 1718209ff23fSmrg 1719209ff23fSmrg 1720209ff23fSmrg/**************************************************************************** 1721209ff23fSmrg * CalculateCrCbGain (double *CrGain, double *CbGain, uint16_t wStandard) * 1722209ff23fSmrg * Function: * 1723209ff23fSmrg * Inputs: double *CrGain - 1724209ff23fSmrg * double *CbGain - 1725209ff23fSmrg * uint16_t wStandard - input standard (NTSC, PAL, SECAM) * 1726209ff23fSmrg * Outputs: NONE * 1727209ff23fSmrg ****************************************************************************/ 1728209ff23fSmrgstatic void CalculateCrCbGain (TheatrePtr t, double *CrGain, double *CbGain, uint16_t wStandard) 1729209ff23fSmrg{ 1730209ff23fSmrg #define UVFLTGAIN 1.5 1731209ff23fSmrg #define FRMAX 280000.0 1732209ff23fSmrg #define FBMAX 230000.0 1733209ff23fSmrg 1734209ff23fSmrg double dbSynctipRef0=0, dbFsamp=0, dbLPeriod=0, dbFPeriod=0; 1735209ff23fSmrg 1736209ff23fSmrg dbSynctipRef0 = ReadRT_fld (fld_SYNCTIP_REF0); 1737209ff23fSmrg 1738209ff23fSmrg GetStandardConstants (&dbLPeriod, &dbFPeriod, &dbFsamp, wStandard); 1739209ff23fSmrg 1740209ff23fSmrg *CrGain=0.0; 1741209ff23fSmrg *CbGain=0.0; 1742209ff23fSmrg 1743209ff23fSmrg switch (wStandard & 0x00FF) 1744209ff23fSmrg { 1745209ff23fSmrg case (DEC_NTSC): /*NTSC GROUP - 480 lines*/ 1746209ff23fSmrg switch (wStandard & 0xFF00) 1747209ff23fSmrg { 1748209ff23fSmrg case (extNONE): 1749209ff23fSmrg case (extNTSC): 1750209ff23fSmrg case (extPAL_M): 1751209ff23fSmrg *CrGain = (double)(40.0 / (dbSynctipRef0)) * (100.0/92.5) * (1.0/0.877) * ((112.0/70.1)/UVFLTGAIN); 1752209ff23fSmrg *CbGain = (double)(40.0 / (dbSynctipRef0)) * (100.0/92.5) * (1.0/0.492) * ((112.0/88.6)/UVFLTGAIN); 1753209ff23fSmrg break; 1754209ff23fSmrg case (extNTSC_J): 1755209ff23fSmrg *CrGain = (double)(40.0 / (dbSynctipRef0)) * (100.0/100.0) * (1.0/0.877) * ((112.0/70.1)/UVFLTGAIN); 1756209ff23fSmrg *CbGain = (double)(40.0 / (dbSynctipRef0)) * (100.0/100.0) * (1.0/0.492) * ((112.0/88.6)/UVFLTGAIN); 1757209ff23fSmrg break; 1758209ff23fSmrg default: 1759209ff23fSmrg return; 1760209ff23fSmrg } 1761209ff23fSmrg break; 1762209ff23fSmrg case (DEC_PAL): 1763209ff23fSmrg *CrGain = (double)(43.0 / (dbSynctipRef0)) * (100.0/92.5) * (1.0/0.877) * ((112.0/70.1)/UVFLTGAIN); 1764209ff23fSmrg *CbGain = (double)(43.0 / (dbSynctipRef0)) * (100.0/92.5) * (1.0/0.492) * ((112.0/88.6)/UVFLTGAIN); 1765209ff23fSmrg break; 1766209ff23fSmrg case (DEC_SECAM): 1767209ff23fSmrg *CrGain = (double) 32.0 * 32768.0 / FRMAX / (33554432.0 / dbFsamp) * (1.597 / 1.902) / UVFLTGAIN; 1768209ff23fSmrg *CbGain = (double) 32.0 * 32768.0 / FBMAX / (33554432.0 / dbFsamp) * (1.267 / 1.505) / UVFLTGAIN; 1769209ff23fSmrg break; 1770209ff23fSmrg } 1771209ff23fSmrg 1772209ff23fSmrg return; 1773209ff23fSmrg 1774209ff23fSmrg} /* CalculateCrCbGain ()...*/ 1775209ff23fSmrg 1776209ff23fSmrg 1777209ff23fSmrg/**************************************************************************** 1778209ff23fSmrg * RT_SetConnector (uint16_t wStandard, int tunerFlag) * 1779209ff23fSmrg * Function: 1780209ff23fSmrg * Inputs: uint16_t wStandard - input standard (NTSC, PAL, SECAM) * 1781209ff23fSmrg * int tunerFlag 1782209ff23fSmrg * Outputs: NONE * 1783209ff23fSmrg ****************************************************************************/ 1784209ff23fSmrgvoid RT_SetConnector (TheatrePtr t, uint16_t wConnector, int tunerFlag) 1785209ff23fSmrg{ 1786209ff23fSmrg uint32_t dwTempContrast=0; 1787209ff23fSmrg int i; 1788209ff23fSmrg long counter; 1789209ff23fSmrg 1790209ff23fSmrg t->wConnector = wConnector; 1791209ff23fSmrg 1792209ff23fSmrg /* Get the contrast value - make sure we are viewing a visible line*/ 1793209ff23fSmrg counter=0; 1794209ff23fSmrg #if 0 1795209ff23fSmrg while (!((ReadRT_fld (fld_VS_LINE_COUNT)> 1) && (ReadRT_fld (fld_VS_LINE_COUNT)<20)) && (counter < 100000)){ 1796209ff23fSmrg #endif 1797209ff23fSmrg while ((ReadRT_fld (fld_VS_LINE_COUNT)<20) && (counter < 10000)){ 1798209ff23fSmrg counter++; 1799209ff23fSmrg } 1800209ff23fSmrg dwTempContrast = ReadRT_fld (fld_LP_CONTRAST); 180168105dcbSveego if(counter>=10000)xf86DrvMsg(t->VIP->pScrn->scrnIndex, X_INFO, 1802209ff23fSmrg "Rage Theatre: timeout waiting for line count (%u)\n", 1803209ff23fSmrg (unsigned)ReadRT_fld (fld_VS_LINE_COUNT)); 1804209ff23fSmrg 1805209ff23fSmrg 1806209ff23fSmrg WriteRT_fld (fld_LP_CONTRAST, 0x0); 1807209ff23fSmrg 1808209ff23fSmrg switch (wConnector) 1809209ff23fSmrg { 1810209ff23fSmrg case (DEC_TUNER): /* Tuner*/ 1811209ff23fSmrg WriteRT_fld (fld_INPUT_SELECT, t->wTunerConnector ); 1812209ff23fSmrg WriteRT_fld (fld_STANDARD_YC, RT_COMPOSITE); 1813209ff23fSmrg RT_SetCombFilter (t, t->wStandard, RT_COMPOSITE); 1814209ff23fSmrg break; 1815209ff23fSmrg case (DEC_COMPOSITE): /* Comp*/ 1816209ff23fSmrg WriteRT_fld (fld_INPUT_SELECT, t->wComp0Connector); 1817209ff23fSmrg WriteRT_fld (fld_STANDARD_YC, RT_COMPOSITE); 1818209ff23fSmrg RT_SetCombFilter (t, t->wStandard, RT_COMPOSITE); 1819209ff23fSmrg break; 1820209ff23fSmrg case (DEC_SVIDEO): /* Svideo*/ 1821209ff23fSmrg WriteRT_fld (fld_INPUT_SELECT, t->wSVideo0Connector); 1822209ff23fSmrg WriteRT_fld (fld_STANDARD_YC, RT_SVIDEO); 1823209ff23fSmrg RT_SetCombFilter (t, t->wStandard, RT_SVIDEO); 1824209ff23fSmrg break; 1825209ff23fSmrg default: 1826209ff23fSmrg WriteRT_fld (fld_INPUT_SELECT, t->wComp0Connector); 1827209ff23fSmrg WriteRT_fld (fld_STANDARD_YC, RT_COMPOSITE); 1828209ff23fSmrg RT_SetCombFilter (t, t->wStandard, RT_COMPOSITE); 1829209ff23fSmrg break; 1830209ff23fSmrg } 1831209ff23fSmrg 1832209ff23fSmrg t->wConnector = wConnector; 1833209ff23fSmrg 1834209ff23fSmrg WriteRT_fld (fld_COMB_CNTL1, ReadRT_fld (fld_COMB_CNTL1) ^ 0x100); 1835209ff23fSmrg WriteRT_fld (fld_COMB_CNTL1, ReadRT_fld (fld_COMB_CNTL1) ^ 0x100); 1836209ff23fSmrg 1837209ff23fSmrg /* wait at most 1 sec here 1838209ff23fSmrg VIP bus has a bandwidth of 27MB and it is 8bit. 1839209ff23fSmrg A single Rage Theatre read should take at least 6 bytes (2 for address one way and 4 for data the other way) 1840209ff23fSmrg However there are also latencies associated with such reads, plus latencies for PCI accesses. 1841209ff23fSmrg 1842209ff23fSmrg I guess we should not be doing more than 100000 per second.. At some point 1843209ff23fSmrg I should really write a program to time this. 1844209ff23fSmrg */ 1845209ff23fSmrg i = 100000; 1846209ff23fSmrg 1847209ff23fSmrg while ((i>=0) && (! ReadRT_fld (fld_HS_GENLOCKED))) 1848209ff23fSmrg { 1849209ff23fSmrg i--; 1850209ff23fSmrg } 185168105dcbSveego if(i<0) xf86DrvMsg(t->VIP->pScrn->scrnIndex, X_INFO, "Rage Theatre: waiting for fld_HS_GENLOCKED failed\n"); 1852209ff23fSmrg /* now we are waiting for a non-visible line.. and there is absolutely no point to wait too long */ 1853209ff23fSmrg counter = 0; 1854209ff23fSmrg while (!((ReadRT_fld (fld_VS_LINE_COUNT)> 1) && (ReadRT_fld (fld_VS_LINE_COUNT)<20)) && (counter < 10000)){ 1855209ff23fSmrg counter++; 1856209ff23fSmrg } 1857209ff23fSmrg WriteRT_fld (fld_LP_CONTRAST, dwTempContrast); 185868105dcbSveego if(counter>=10000)xf86DrvMsg(t->VIP->pScrn->scrnIndex, X_INFO, 1859209ff23fSmrg "Rage Theatre: timeout waiting for line count (%u)\n", 1860209ff23fSmrg (unsigned)ReadRT_fld (fld_VS_LINE_COUNT)); 1861209ff23fSmrg 1862209ff23fSmrg 1863209ff23fSmrg 1864209ff23fSmrg return; 1865209ff23fSmrg 1866209ff23fSmrg} /* RT_SetConnector ()...*/ 1867209ff23fSmrg 1868209ff23fSmrg 1869209ff23fSmrg_X_EXPORT void InitTheatre(TheatrePtr t) 1870209ff23fSmrg{ 1871209ff23fSmrg uint32_t data; 1872209ff23fSmrg 1873209ff23fSmrg 1874209ff23fSmrg /* 0 reset Rage Theatre */ 1875209ff23fSmrg ShutdownTheatre(t); 1876209ff23fSmrg usleep(100000); 1877209ff23fSmrg 1878209ff23fSmrg t->mode=MODE_INITIALIZATION_IN_PROGRESS; 1879209ff23fSmrg /* 1. 1880209ff23fSmrg Set the VIN_PLL to NTSC value */ 1881209ff23fSmrg RT_SetVINClock(t, RT_NTSC); 1882209ff23fSmrg 1883209ff23fSmrg /* Take VINRST and L54RST out of reset */ 1884209ff23fSmrg RT_regr (VIP_PLL_CNTL1, &data); 1885209ff23fSmrg RT_regw (VIP_PLL_CNTL1, data & ~((RT_VINRST_RESET << 1) | (RT_L54RST_RESET << 3))); 1886209ff23fSmrg RT_regr (VIP_PLL_CNTL1, &data); 1887209ff23fSmrg 1888209ff23fSmrg /* Set VIN_CLK_SEL to PLL_VIN_CLK */ 1889209ff23fSmrg RT_regr (VIP_CLOCK_SEL_CNTL, &data); 1890209ff23fSmrg RT_regw (VIP_CLOCK_SEL_CNTL, data | (RT_PLL_VIN_CLK << 7)); 1891209ff23fSmrg RT_regr (VIP_CLOCK_SEL_CNTL, &data); 1892209ff23fSmrg 1893209ff23fSmrg /* 2. 1894209ff23fSmrg Set HW_DEBUG to 0xF000 before setting the standards registers */ 1895209ff23fSmrg RT_regw (VIP_HW_DEBUG, 0x0000F000); 1896209ff23fSmrg 1897209ff23fSmrg /* wait for things to settle */ 1898209ff23fSmrg usleep(100000); 1899209ff23fSmrg 1900209ff23fSmrg RT_SetStandard(t, t->wStandard); 1901209ff23fSmrg 1902209ff23fSmrg /* 3. 1903209ff23fSmrg Set DVS port to OUTPUT */ 1904209ff23fSmrg RT_regr (VIP_DVS_PORT_CTRL, &data); 1905209ff23fSmrg RT_regw (VIP_DVS_PORT_CTRL, data | RT_DVSDIR_OUT); 1906209ff23fSmrg RT_regr (VIP_DVS_PORT_CTRL, &data); 1907209ff23fSmrg 1908209ff23fSmrg /* 4. 1909209ff23fSmrg Set default values for ADC_CNTL */ 1910209ff23fSmrg RT_regw (VIP_ADC_CNTL, RT_ADC_CNTL_DEFAULT); 1911209ff23fSmrg 1912209ff23fSmrg /* 5. 1913209ff23fSmrg Clear the VIN_ASYNC_RST bit */ 1914209ff23fSmrg RT_regr (VIP_MASTER_CNTL, &data); 1915209ff23fSmrg RT_regw (VIP_MASTER_CNTL, data & ~0x20); 1916209ff23fSmrg RT_regr (VIP_MASTER_CNTL, &data); 1917209ff23fSmrg 1918209ff23fSmrg /* Clear the DVS_ASYNC_RST bit */ 1919209ff23fSmrg RT_regr (VIP_MASTER_CNTL, &data); 1920209ff23fSmrg RT_regw (VIP_MASTER_CNTL, data & ~(RT_DVS_ASYNC_RST)); 1921209ff23fSmrg RT_regr (VIP_MASTER_CNTL, &data); 1922209ff23fSmrg 1923209ff23fSmrg /* Set the GENLOCK delay */ 1924209ff23fSmrg RT_regw (VIP_HS_GENLOCKDELAY, 0x10); 1925209ff23fSmrg 1926209ff23fSmrg RT_regr (fld_DVS_DIRECTION, &data); 1927209ff23fSmrg RT_regw (fld_DVS_DIRECTION, data & RT_DVSDIR_OUT); 1928209ff23fSmrg/* WriteRT_fld (fld_DVS_DIRECTION, RT_DVSDIR_IN); */ 1929209ff23fSmrg 1930209ff23fSmrg t->mode=MODE_INITIALIZED_FOR_TV_IN; 1931209ff23fSmrg} 1932209ff23fSmrg 1933209ff23fSmrg 1934209ff23fSmrg_X_EXPORT void ShutdownTheatre(TheatrePtr t) 1935209ff23fSmrg{ 1936209ff23fSmrg WriteRT_fld (fld_VIN_ASYNC_RST, RT_ASYNC_DISABLE); 1937209ff23fSmrg WriteRT_fld (fld_VINRST , RT_VINRST_RESET); 1938209ff23fSmrg WriteRT_fld (fld_ADC_PDWN , RT_ADC_DISABLE); 1939209ff23fSmrg WriteRT_fld (fld_DVS_DIRECTION, RT_DVSDIR_IN); 1940209ff23fSmrg t->mode=MODE_UNINITIALIZED; 1941209ff23fSmrg} 1942209ff23fSmrg 1943209ff23fSmrg_X_EXPORT void DumpRageTheatreRegs(TheatrePtr t) 1944209ff23fSmrg{ 1945209ff23fSmrg int i; 1946209ff23fSmrg uint32_t data; 1947209ff23fSmrg 1948209ff23fSmrg for(i=0;i<0x900;i+=4) 1949209ff23fSmrg { 1950209ff23fSmrg RT_regr(i, &data); 195168105dcbSveego xf86DrvMsg(t->VIP->pScrn->scrnIndex, X_INFO, 1952209ff23fSmrg "register 0x%04x is equal to 0x%08x\n", i, (unsigned)data); 1953209ff23fSmrg } 1954209ff23fSmrg 1955209ff23fSmrg} 1956209ff23fSmrg 1957209ff23fSmrgvoid DumpRageTheatreRegsByName(TheatrePtr t) 1958209ff23fSmrg{ 1959209ff23fSmrg int i; 1960209ff23fSmrg uint32_t data; 1961209ff23fSmrg struct { char *name; long addr; } rt_reg_list[]={ 1962209ff23fSmrg { "ADC_CNTL ", 0x0400 }, 1963209ff23fSmrg { "ADC_DEBUG ", 0x0404 }, 1964209ff23fSmrg { "AUD_CLK_DIVIDERS ", 0x00e8 }, 1965209ff23fSmrg { "AUD_DTO_INCREMENTS ", 0x00ec }, 1966209ff23fSmrg { "AUD_PLL_CNTL ", 0x00e0 }, 1967209ff23fSmrg { "AUD_PLL_FINE_CNTL ", 0x00e4 }, 1968209ff23fSmrg { "CLKOUT_CNTL ", 0x004c }, 1969209ff23fSmrg { "CLKOUT_GPIO_CNTL ", 0x0038 }, 1970209ff23fSmrg { "CLOCK_SEL_CNTL ", 0x00d0 }, 1971209ff23fSmrg { "COMB_CNTL0 ", 0x0440 }, 1972209ff23fSmrg { "COMB_CNTL1 ", 0x0444 }, 1973209ff23fSmrg { "COMB_CNTL2 ", 0x0448 }, 1974209ff23fSmrg { "COMB_LINE_LENGTH ", 0x044c }, 1975209ff23fSmrg { "CP_ACTIVE_GAIN ", 0x0594 }, 1976209ff23fSmrg { "CP_AGC_CNTL ", 0x0590 }, 1977209ff23fSmrg { "CP_BURST_GAIN ", 0x058c }, 1978209ff23fSmrg { "CP_DEBUG_FORCE ", 0x05b8 }, 1979209ff23fSmrg { "CP_HUE_CNTL ", 0x0588 }, 1980209ff23fSmrg { "CP_PLL_CNTL0 ", 0x0580 }, 1981209ff23fSmrg { "CP_PLL_CNTL1 ", 0x0584 }, 1982209ff23fSmrg { "CP_PLL_STATUS0 ", 0x0598 }, 1983209ff23fSmrg { "CP_PLL_STATUS1 ", 0x059c }, 1984209ff23fSmrg { "CP_PLL_STATUS2 ", 0x05a0 }, 1985209ff23fSmrg { "CP_PLL_STATUS3 ", 0x05a4 }, 1986209ff23fSmrg { "CP_PLL_STATUS4 ", 0x05a8 }, 1987209ff23fSmrg { "CP_PLL_STATUS5 ", 0x05ac }, 1988209ff23fSmrg { "CP_PLL_STATUS6 ", 0x05b0 }, 1989209ff23fSmrg { "CP_PLL_STATUS7 ", 0x05b4 }, 1990209ff23fSmrg { "CP_VERT_LOCKOUT ", 0x05bc }, 1991209ff23fSmrg { "CRC_CNTL ", 0x02c0 }, 1992209ff23fSmrg { "CRT_DTO_INCREMENTS ", 0x0394 }, 1993209ff23fSmrg { "CRT_PLL_CNTL ", 0x00c4 }, 1994209ff23fSmrg { "CRT_PLL_FINE_CNTL ", 0x00bc }, 1995209ff23fSmrg { "DECODER_DEBUG_CNTL ", 0x05d4 }, 1996209ff23fSmrg { "DELAY_ONE_MAP_A ", 0x0114 }, 1997209ff23fSmrg { "DELAY_ONE_MAP_B ", 0x0118 }, 1998209ff23fSmrg { "DELAY_ZERO_MAP_A ", 0x011c }, 1999209ff23fSmrg { "DELAY_ZERO_MAP_B ", 0x0120 }, 2000209ff23fSmrg { "DFCOUNT ", 0x00a4 }, 2001209ff23fSmrg { "DFRESTART ", 0x00a8 }, 2002209ff23fSmrg { "DHRESTART ", 0x00ac }, 2003209ff23fSmrg { "DVRESTART ", 0x00b0 }, 2004209ff23fSmrg { "DVS_PORT_CTRL ", 0x0610 }, 2005209ff23fSmrg { "DVS_PORT_READBACK ", 0x0614 }, 2006209ff23fSmrg { "FIFOA_CONFIG ", 0x0800 }, 2007209ff23fSmrg { "FIFOB_CONFIG ", 0x0804 }, 2008209ff23fSmrg { "FIFOC_CONFIG ", 0x0808 }, 2009209ff23fSmrg { "FRAME_LOCK_CNTL ", 0x0100 }, 2010209ff23fSmrg { "GAIN_LIMIT_SETTINGS ", 0x01e4 }, 2011209ff23fSmrg { "GPIO_CNTL ", 0x0034 }, 2012209ff23fSmrg { "GPIO_INOUT ", 0x0030 }, 2013209ff23fSmrg { "HCOUNT ", 0x0090 }, 2014209ff23fSmrg { "HDISP ", 0x0084 }, 2015209ff23fSmrg { "HOST_RD_WT_CNTL ", 0x0188 }, 2016209ff23fSmrg { "HOST_READ_DATA ", 0x0180 }, 2017209ff23fSmrg { "HOST_WRITE_DATA ", 0x0184 }, 2018209ff23fSmrg { "HSIZE ", 0x0088 }, 2019209ff23fSmrg { "HSTART ", 0x008c }, 2020209ff23fSmrg { "HS_DTOINC ", 0x0484 }, 2021209ff23fSmrg { "HS_GENLOCKDELAY ", 0x0490 }, 2022209ff23fSmrg { "HS_MINMAXWIDTH ", 0x048c }, 2023209ff23fSmrg { "HS_PLINE ", 0x0480 }, 2024209ff23fSmrg { "HS_PLLGAIN ", 0x0488 }, 2025209ff23fSmrg { "HS_PLL_ERROR ", 0x04a0 }, 2026209ff23fSmrg { "HS_PLL_FS_PATH ", 0x04a4 }, 2027209ff23fSmrg { "HS_PULSE_WIDTH ", 0x049c }, 2028209ff23fSmrg { "HS_WINDOW_LIMIT ", 0x0494 }, 2029209ff23fSmrg { "HS_WINDOW_OC_SPEED ", 0x0498 }, 2030209ff23fSmrg { "HTOTAL ", 0x0080 }, 2031209ff23fSmrg { "HW_DEBUG ", 0x0010 }, 2032209ff23fSmrg { "H_ACTIVE_WINDOW ", 0x05c0 }, 2033209ff23fSmrg { "H_SCALER_CONTROL ", 0x0600 }, 2034209ff23fSmrg { "H_VBI_WINDOW ", 0x05c8 }, 2035209ff23fSmrg { "I2C_CNTL ", 0x0054 }, 2036209ff23fSmrg { "I2C_CNTL_0 ", 0x0020 }, 2037209ff23fSmrg { "I2C_CNTL_1 ", 0x0024 }, 2038209ff23fSmrg { "I2C_DATA ", 0x0028 }, 2039209ff23fSmrg { "I2S_RECEIVE_CNTL ", 0x081c }, 2040209ff23fSmrg { "I2S_TRANSMIT_CNTL ", 0x0818 }, 2041209ff23fSmrg { "IIS_TX_CNT_REG ", 0x0824 }, 2042209ff23fSmrg { "INT_CNTL ", 0x002c }, 2043209ff23fSmrg { "L54_DTO_INCREMENTS ", 0x00f8 }, 2044209ff23fSmrg { "L54_PLL_CNTL ", 0x00f0 }, 2045209ff23fSmrg { "L54_PLL_FINE_CNTL ", 0x00f4 }, 2046209ff23fSmrg { "LINEAR_GAIN_SETTINGS ", 0x01e8 }, 2047209ff23fSmrg { "LP_AGC_CLAMP_CNTL0 ", 0x0500 }, 2048209ff23fSmrg { "LP_AGC_CLAMP_CNTL1 ", 0x0504 }, 2049209ff23fSmrg { "LP_BLACK_LEVEL ", 0x051c }, 2050209ff23fSmrg { "LP_BRIGHTNESS ", 0x0508 }, 2051209ff23fSmrg { "LP_CONTRAST ", 0x050c }, 2052209ff23fSmrg { "LP_SLICE_LEVEL ", 0x0520 }, 2053209ff23fSmrg { "LP_SLICE_LIMIT ", 0x0510 }, 2054209ff23fSmrg { "LP_SYNCTIP_LEVEL ", 0x0524 }, 2055209ff23fSmrg { "LP_VERT_LOCKOUT ", 0x0528 }, 2056209ff23fSmrg { "LP_WPA_CNTL0 ", 0x0514 }, 2057209ff23fSmrg { "LP_WPA_CNTL1 ", 0x0518 }, 2058209ff23fSmrg { "MASTER_CNTL ", 0x0040 }, 2059209ff23fSmrg { "MODULATOR_CNTL1 ", 0x0200 }, 2060209ff23fSmrg { "MODULATOR_CNTL2 ", 0x0204 }, 2061209ff23fSmrg { "MV_LEVEL_CNTL1 ", 0x0210 }, 2062209ff23fSmrg { "MV_LEVEL_CNTL2 ", 0x0214 }, 2063209ff23fSmrg { "MV_MODE_CNTL ", 0x0208 }, 2064209ff23fSmrg { "MV_STATUS ", 0x0330 }, 2065209ff23fSmrg { "MV_STRIPE_CNTL ", 0x020c }, 2066209ff23fSmrg { "NOISE_CNTL0 ", 0x0450 }, 2067209ff23fSmrg { "PLL_CNTL0 ", 0x00c8 }, 2068209ff23fSmrg { "PLL_CNTL1 ", 0x00fc }, 2069209ff23fSmrg { "PLL_TEST_CNTL ", 0x00cc }, 2070209ff23fSmrg { "PRE_DAC_MUX_CNTL ", 0x0240 }, 2071209ff23fSmrg { "RGB_CNTL ", 0x0048 }, 2072209ff23fSmrg { "RIPINTF_PORT_CNTL ", 0x003c }, 2073209ff23fSmrg { "SCALER_IN_WINDOW ", 0x0618 }, 2074209ff23fSmrg { "SCALER_OUT_WINDOW ", 0x061c }, 2075209ff23fSmrg { "SG_BLACK_GATE ", 0x04c0 }, 2076209ff23fSmrg { "SG_SYNCTIP_GATE ", 0x04c4 }, 2077209ff23fSmrg { "SG_UVGATE_GATE ", 0x04c8 }, 2078209ff23fSmrg { "SINGLE_STEP_DATA ", 0x05d8 }, 2079209ff23fSmrg { "SPDIF_AC3_PREAMBLE ", 0x0814 }, 2080209ff23fSmrg { "SPDIF_CHANNEL_STAT ", 0x0810 }, 2081209ff23fSmrg { "SPDIF_PORT_CNTL ", 0x080c }, 2082209ff23fSmrg { "SPDIF_TX_CNT_REG ", 0x0820 }, 2083209ff23fSmrg { "STANDARD_SELECT ", 0x0408 }, 2084209ff23fSmrg { "SW_SCRATCH ", 0x0014 }, 2085209ff23fSmrg { "SYNC_CNTL ", 0x0050 }, 2086209ff23fSmrg { "SYNC_LOCK_CNTL ", 0x0104 }, 2087209ff23fSmrg { "SYNC_SIZE ", 0x00b4 }, 2088209ff23fSmrg { "THERMO2BIN_STATUS ", 0x040c }, 2089209ff23fSmrg { "TIMING_CNTL ", 0x01c4 }, 2090209ff23fSmrg { "TVO_DATA_DELAY_A ", 0x0140 }, 2091209ff23fSmrg { "TVO_DATA_DELAY_B ", 0x0144 }, 2092209ff23fSmrg { "TVO_SYNC_PAT_ACCUM ", 0x0108 }, 2093209ff23fSmrg { "TVO_SYNC_PAT_EXPECT ", 0x0110 }, 2094209ff23fSmrg { "TVO_SYNC_THRESHOLD ", 0x010c }, 2095209ff23fSmrg { "TV_DAC_CNTL ", 0x0280 }, 2096209ff23fSmrg { "TV_DTO_INCREMENTS ", 0x0390 }, 2097209ff23fSmrg { "TV_PLL_CNTL ", 0x00c0 }, 2098209ff23fSmrg { "TV_PLL_FINE_CNTL ", 0x00b8 }, 2099209ff23fSmrg { "UPSAMP_AND_GAIN_CNTL ", 0x01e0 }, 2100209ff23fSmrg { "UPSAMP_COEFF0_0 ", 0x0340 }, 2101209ff23fSmrg { "UPSAMP_COEFF0_1 ", 0x0344 }, 2102209ff23fSmrg { "UPSAMP_COEFF0_2 ", 0x0348 }, 2103209ff23fSmrg { "UPSAMP_COEFF1_0 ", 0x034c }, 2104209ff23fSmrg { "UPSAMP_COEFF1_1 ", 0x0350 }, 2105209ff23fSmrg { "UPSAMP_COEFF1_2 ", 0x0354 }, 2106209ff23fSmrg { "UPSAMP_COEFF2_0 ", 0x0358 }, 2107209ff23fSmrg { "UPSAMP_COEFF2_1 ", 0x035c }, 2108209ff23fSmrg { "UPSAMP_COEFF2_2 ", 0x0360 }, 2109209ff23fSmrg { "UPSAMP_COEFF3_0 ", 0x0364 }, 2110209ff23fSmrg { "UPSAMP_COEFF3_1 ", 0x0368 }, 2111209ff23fSmrg { "UPSAMP_COEFF3_2 ", 0x036c }, 2112209ff23fSmrg { "UPSAMP_COEFF4_0 ", 0x0370 }, 2113209ff23fSmrg { "UPSAMP_COEFF4_1 ", 0x0374 }, 2114209ff23fSmrg { "UPSAMP_COEFF4_2 ", 0x0378 }, 2115209ff23fSmrg { "UV_ADR ", 0x0300 }, 2116209ff23fSmrg { "VBI_20BIT_CNTL ", 0x02d0 }, 2117209ff23fSmrg { "VBI_CC_CNTL ", 0x02c8 }, 2118209ff23fSmrg { "VBI_CONTROL ", 0x05d0 }, 2119209ff23fSmrg { "VBI_DTO_CNTL ", 0x02d4 }, 2120209ff23fSmrg { "VBI_EDS_CNTL ", 0x02cc }, 2121209ff23fSmrg { "VBI_LEVEL_CNTL ", 0x02d8 }, 2122209ff23fSmrg { "VBI_SCALER_CONTROL ", 0x060c }, 2123209ff23fSmrg { "VCOUNT ", 0x009c }, 2124209ff23fSmrg { "VDISP ", 0x0098 }, 2125209ff23fSmrg { "VFTOTAL ", 0x00a0 }, 2126209ff23fSmrg { "VIDEO_PORT_SIG ", 0x02c4 }, 2127209ff23fSmrg { "VIN_PLL_CNTL ", 0x00d4 }, 2128209ff23fSmrg { "VIN_PLL_FINE_CNTL ", 0x00d8 }, 2129209ff23fSmrg { "VIP_COMMAND_STATUS ", 0x0008 }, 2130209ff23fSmrg { "VIP_REVISION_ID ", 0x000c }, 2131209ff23fSmrg { "VIP_SUB_VENDOR_DEVICE_ID", 0x0004 }, 2132209ff23fSmrg { "VIP_VENDOR_DEVICE_ID ", 0x0000 }, 2133209ff23fSmrg { "VSCALER_CNTL1 ", 0x01c0 }, 2134209ff23fSmrg { "VSCALER_CNTL2 ", 0x01c8 }, 2135209ff23fSmrg { "VSYNC_DIFF_CNTL ", 0x03a0 }, 2136209ff23fSmrg { "VSYNC_DIFF_LIMITS ", 0x03a4 }, 2137209ff23fSmrg { "VSYNC_DIFF_RD_DATA ", 0x03a8 }, 2138209ff23fSmrg { "VS_BLANKING_CNTL ", 0x0544 }, 2139209ff23fSmrg { "VS_COUNTER_CNTL ", 0x054c }, 2140209ff23fSmrg { "VS_DETECTOR_CNTL ", 0x0540 }, 2141209ff23fSmrg { "VS_FIELD_ID_CNTL ", 0x0548 }, 2142209ff23fSmrg { "VS_FRAME_TOTAL ", 0x0550 }, 2143209ff23fSmrg { "VS_LINE_COUNT ", 0x0554 }, 2144209ff23fSmrg { "VTOTAL ", 0x0094 }, 2145209ff23fSmrg { "V_ACTIVE_WINDOW ", 0x05c4 }, 2146209ff23fSmrg { "V_DEINTERLACE_CONTROL ", 0x0608 }, 2147209ff23fSmrg { "V_SCALER_CONTROL ", 0x0604 }, 2148209ff23fSmrg { "V_VBI_WINDOW ", 0x05cc }, 2149209ff23fSmrg { "Y_FALL_CNTL ", 0x01cc }, 2150209ff23fSmrg { "Y_RISE_CNTL ", 0x01d0 }, 2151209ff23fSmrg { "Y_SAW_TOOTH_CNTL ", 0x01d4 }, 2152209ff23fSmrg {NULL, 0} 2153209ff23fSmrg }; 2154209ff23fSmrg 2155209ff23fSmrg for(i=0; rt_reg_list[i].name!=NULL;i++){ 2156209ff23fSmrg RT_regr(rt_reg_list[i].addr, &data); 215768105dcbSveego xf86DrvMsg(t->VIP->pScrn->scrnIndex, X_INFO, 2158209ff23fSmrg "register (0x%04lx) %s is equal to 0x%08x\n", 2159209ff23fSmrg rt_reg_list[i].addr, rt_reg_list[i].name, (unsigned)data); 2160209ff23fSmrg } 2161209ff23fSmrg 2162209ff23fSmrg} 2163209ff23fSmrg 2164209ff23fSmrg_X_EXPORT void ResetTheatreRegsForNoTVout(TheatrePtr t) 2165209ff23fSmrg{ 2166209ff23fSmrg RT_regw(VIP_CLKOUT_CNTL, 0x0); 2167209ff23fSmrg RT_regw(VIP_HCOUNT, 0x0); 2168209ff23fSmrg RT_regw(VIP_VCOUNT, 0x0); 2169209ff23fSmrg RT_regw(VIP_DFCOUNT, 0x0); 2170209ff23fSmrg #if 0 2171209ff23fSmrg RT_regw(VIP_CLOCK_SEL_CNTL, 0x2b7); /* versus 0x237 <-> 0x2b7 */ 2172209ff23fSmrg RT_regw(VIP_VIN_PLL_CNTL, 0x60a6039); 2173209ff23fSmrg #endif 2174209ff23fSmrg RT_regw(VIP_FRAME_LOCK_CNTL, 0x0); 2175209ff23fSmrg} 2176209ff23fSmrg 2177209ff23fSmrg 2178209ff23fSmrg_X_EXPORT void ResetTheatreRegsForTVout(TheatrePtr t) 2179209ff23fSmrg{ 2180209ff23fSmrg/* RT_regw(VIP_HW_DEBUG, 0x200); */ 2181209ff23fSmrg/* RT_regw(VIP_INT_CNTL, 0x0); 2182209ff23fSmrg RT_regw(VIP_GPIO_INOUT, 0x10090000); 2183209ff23fSmrg RT_regw(VIP_GPIO_INOUT, 0x340b0000); */ 2184209ff23fSmrg/* RT_regw(VIP_MASTER_CNTL, 0x6e8); */ 2185209ff23fSmrg RT_regw(VIP_CLKOUT_CNTL, 0x29); 2186209ff23fSmrg#if 1 2187209ff23fSmrg RT_regw(VIP_HCOUNT, 0x1d1); 2188209ff23fSmrg RT_regw(VIP_VCOUNT, 0x1e3); 2189209ff23fSmrg#else 2190209ff23fSmrg RT_regw(VIP_HCOUNT, 0x322); 2191209ff23fSmrg RT_regw(VIP_VCOUNT, 0x151); 2192209ff23fSmrg#endif 2193209ff23fSmrg RT_regw(VIP_DFCOUNT, 0x01); 2194209ff23fSmrg/* RT_regw(VIP_CLOCK_SEL_CNTL, 0xb7); versus 0x237 <-> 0x2b7 */ 2195209ff23fSmrg RT_regw(VIP_CLOCK_SEL_CNTL, 0x2b7); /* versus 0x237 <-> 0x2b7 */ 2196209ff23fSmrg RT_regw(VIP_VIN_PLL_CNTL, 0x60a6039); 2197209ff23fSmrg/* RT_regw(VIP_PLL_CNTL1, 0xacacac74); */ 2198209ff23fSmrg RT_regw(VIP_FRAME_LOCK_CNTL, 0x0f); 2199209ff23fSmrg/* RT_regw(VIP_ADC_CNTL, 0x02a420a8); 2200209ff23fSmrg RT_regw(VIP_COMB_CNTL_0, 0x0d438083); 2201209ff23fSmrg RT_regw(VIP_COMB_CNTL_2, 0x06080102); 2202209ff23fSmrg RT_regw(VIP_HS_MINMAXWIDTH, 0x462f); 2203209ff23fSmrg ... 2204209ff23fSmrg */ 2205209ff23fSmrg/* 2206209ff23fSmrg RT_regw(VIP_HS_PULSE_WIDTH, 0x359); 2207209ff23fSmrg RT_regw(VIP_HS_PLL_ERROR, 0xab6); 2208209ff23fSmrg RT_regw(VIP_HS_PLL_FS_PATH, 0x7fff08f8); 2209209ff23fSmrg RT_regw(VIP_VS_LINE_COUNT, 0x49b5e005); 2210209ff23fSmrg */ 2211209ff23fSmrg} 2212