📄 measure.lst
字号:
if( php <= sum ) {
ePuts("--not enough");
#ifdef DEBUG_PC
return FALSE;
#endif
}
//=================================
#ifdef SXGA
switch( PcMode ) {
C51 COMPILER V7.50 MEASURE 04/01/2008 15:02:17 PAGE 18
case EE_RGB_576I: case EE_YPbPr_576I: php = 0x70f; break;
case EE_RGB_720P: case EE_YPbPr_720P: php = 0x623; break;
case EE_RGB_1080I: case EE_YPbPr_1080I: php = 0x618; break;
case EE_RGB_1080I50A: case EE_YPbPr_1080I50A: php -= 6; break;
}
#endif
//=================================
//------ Set PHP ----------
SetPHP(php);
return TRUE;
}
#else
1058 BYTE SetHValueForPanel(void)
1059 {
1060 1 return TRUE;
1061 1 }
1062 #endif
1063 //-----------------------------------------------------------------------------
1064 // VAN = V Active Number
1065 // HAN = H active Number
1066 //-----------------------------------------------------------------------------
1067 BYTE GetActiveRegion(void)
1068 {
1069 1 WORD vstart;
1070 1 DWORD pres, scale;
1071 1 DWORD ppf;
1072 1
1073 1 WORD period, sync;
1074 1
1075 1 //----- Set Measurement Wondow Size -----
1076 1
1077 1 SetMeasureWindowV(1, 0x400);
1078 1 MeasureAndWait(3);
1079 1
1080 1 // Set H window
1081 1 if( (PCMDATA[PcMode].VAN != GetPVR()) || !Flag4Bypass ) { // --- Change hpulse & hpn ---
1082 2 period = ConvertBasedOnInput( GetHPN() );
1083 2 sync = ConvertBasedOnInput( GetHSYNCPulse() );
1084 2 }
1085 1 else {
1086 2 period = GetCoarse();
1087 2 sync = GetHSYNCPulse();
1088 2 }
1089 1 SetMeasureWindowH(sync, period);
1090 1
1091 1 // Set V window
1092 1 period = GetVPN();
1093 1 sync = GetVSYNCPulse();
1094 1 SetMeasureWindowV(1, period);
1095 1
1096 1 //----- Do Measurement ---------------------------
1097 1 MeasureAndWait(3);
1098 1
1099 1 //----- Get VAN = Vertical Active Area -----------
1100 1
1101 1 vstart = GetVerticalActiveArea(); // Measure Input Vstart, Vactive
1102 1
1103 1 SetMeasureWindowV(1, period); // HHY 1.61 for stable h sync region
1104 1
C51 COMPILER V7.50 MEASURE 04/01/2008 15:02:17 PAGE 19
1105 1 //----- Calculate Y-scale Factor, and save -------
1106 1
1107 1 #if (defined WIDE_SCREEN)
1108 1 Set4WideScreen(GetWideModeEE());
1109 1 #else
{ //NORNAL SCREEN
pres = (DWORD)PVR_;
scale = (PCMDATA[PcMode].VAN * 0x10000L) / pres;
#ifdef DEBUG_PC
dPrintf("\r\n VAN=%04x PVR=%04x", PCMDATA[PcMode].VAN, pres);
dPrintf("\r\nYscaleFactor:%04x(%d)", scale, scale);
#endif
#ifndef WXGA
if( scale==0x10000 && Flag4Bypass ) { // Bypass
BypassZoom();
}
else
#endif
{
Clear_bypass();
YScale2(scale); // save V Scale Up Factor
}
} // WIDE
#endif
1131 1 vstart = GetVactiveStart();
1132 1 SetVValueForPanel(vstart); // with VAN, Vstart
1133 1
1134 1 //----- Calcurate Panel H. Cycle(A9,AD) ----------
1135 1
1136 1 ppf = GetPPF();
1137 1
1138 1 /****/
1139 1 #if 0 // Hans
#ifdef DEBUG_PC
while( !SetHValueForPanel() ) { // we need to use higher PPF
ppf += 2700000;
if( ppf > MAX_PPF ) {
ePuts("\r\n\n--------------Too big IPF\r\n");
return FALSE;
}
ChangeInternPLL(ppf); // internal PLL
#ifdef DEBUG_PC
dPrintf("--> Increased PPF:%8ld", ppf);
#endif
delay(10);
}
#endif
#endif
1156 1 /****/
1157 1
1158 1 //----- Get HAN = Horizontal Active Area ---------
1159 1
1160 1 GetHorizontalActiveArea();
1161 1
1162 1 if( (PCMDATA[PcMode].VAN != GetPVR()) || !Flag4Bypass) { // non-bypass
1163 2 pres = (DWORD)GetPHR();
1164 2 scale = (PCMDATA[PcMode].HAN * 0x10000L ) / pres; // 256*han/phr
1165 2
1166 2 #ifdef DEBUG_PC
C51 COMPILER V7.50 MEASURE 04/01/2008 15:02:17 PAGE 20
1167 2 dPrintf("\r\nXscaleFactor:%04x(%d)", scale, scale);
1168 2 #endif
1169 2
1170 2 //#if (defined SXGA) || (defined WXGA) || (defined WSGA)
1171 2 if( PCMDATA[PcMode].HAN > 1024 ) {//1100
1172 3 scale = (PCMDATA[PcMode].HAN * 0x80L ) / 1024 + 1; // (HAN/1024)*256
1173 3 XscaleD(scale);
1174 3 #ifdef DEBUG_PC
1175 3 dPrintf("\r\nXscaleFactorD:%04x(%d)", scale, scale);
1176 3 #endif
1177 3 scale = (1024 * 0x10000L ) / 1280; // (1024/PHR)*256
1178 3 XscaleU(scale);
1179 3 #ifdef DEBUG_PC
1180 3 dPrintf("\r\nXscaleFactorU:%04x(%d)", scale, scale);
1181 3 #endif
1182 3 }
1183 2 else
1184 2 //#endif
1185 2 {
1186 3 #ifdef WIDE_SCREEN
1187 3 if(WideScreenMode == WIDESCREEN_WIDE)
1188 3 #endif // WIDE_SCREEN
1189 3 XScale2(scale);
1190 3 }
1191 2 }
1192 1
1193 1 SavePCDataEE(PcMode);
1194 1
1195 1 return TRUE;
1196 1 }
1197 /*===========================================================================*/
1198 /* Display The Result for Debugging */
1199 /*===========================================================================*/
1200 void DisplayResultAndSetActiveRange(void)
1201 {
1202 1
1203 1 BYTE cRang;
1204 1
1205 1 //------- Display the Result ---------------------
1206 1 #ifdef DEBUG_PC
1207 1 dPuts ("\r\n-------------------------------------------");
1208 1 dPrintf("\r\n Resolution = %d x %d (%s)", PCMDATA[PcMode].HAN, PCMDATA[PcMode].VAN, PcModeStr[PcMode
-]);
1209 1 dPrintf("\r\n IVF(Refresh) = (%d)", IVF);
1210 1 dPrintf("\r\n IHF = %08lx (%ld)", IHF, IHF);
1211 1 dPuts ("\r\n-------------------------------------------");
1212 1 #endif
1213 1
1214 1 //----- calculate H Pos Range
1215 1 HPosCurr = GetHactiveStart();
1216 1 cRang = PCMDATA[PcMode].HAN / 20;
1217 1 HPosMax = PCMDATA[PcMode].Hstart + cRang;
1218 1 #ifdef DEBUG_PC
1219 1 dPrintf("\r\n HPosCurr = %d, HPosMax = %d, HRang = %d ", (WORD)HPosCurr, (WORD)HPosMax, (WORD)cRang);
1220 1 #endif
1221 1
1222 1 //----- calculate V Pos Range
1223 1 VPosCurr = GetVactiveStart();
1224 1 cRang = PCMDATA[PcMode].VAN / 40;
1225 1 VPosMax = PCMDATA[PcMode].Vstart + cRang;
1226 1 #ifdef DEBUG_PC
1227 1 dPrintf("\r\n VPosCurr = %d, VPosMax = %d, VRang = %d ", (WORD)VPosCurr, (WORD)VPosMax, (WORD)cRang);
C51 COMPILER V7.50 MEASURE 04/01/2008 15:02:17 PAGE 21
1228 1 #endif
1229 1
1230 1 }
1231 /*===========================================================================*/
1232 /* Real Measurement routine */
1233 /*===========================================================================*/
1234 BYTE DoMeasurement(void)
1235 {
1236 1 /* WORD coarse;
1237 1
1238 1 //------------------------ Clock Tuning -------------------------------
1239 1 #ifdef DEBUG_PAUSE
1240 1 Pause("coarse = AutoTuneClock()");
1241 1 #endif
1242 1
1243 1 coarse = AutoTuneClock(); // plldiv
1244 1 if( coarse == 0 ) {
1245 1 ePuts("\r\nToo big IPF");
1246 1 MeasureAndWait(3);
1247 1 return FALSE;
1248 1 }
1249 1 */
1250 1 //-------------------------- Fine Tuning ------------------------------
1251 1
1252 1 #ifdef AUTOTUNEPHASE
1253 1 AutoTunePhase();
1254 1 #endif
1255 1
1256 1 //-------------------------- Get Active Region ------------------------
1257 1 if( !GetActiveRegion() ) {
1258 2
1259 2 GetPCDataEE(PcMode);
1260 2
1261 2 MeasureAndWait(3);
1262 2 return FALSE;
1263 2 }
1264 1
1265 1 //-------------------------- Display Result ---------------------------
1266 1 DisplayResultAndSetActiveRange();
1267 1
1268 1 return TRUE;
1269 1 }
1270
1271 //#ifdef SUPPORT_DTV
1272 void RGBModeFieldDetect(BYTE flag)
1273 {
1274 1 BYTE val;
1275 1
1276 1 val = ReadTW88(0x42);
1277 1 if( flag ) val = val | 0x80;
1278 1 else val = val & 0x7f;
1279 1 WriteTW88( 0x42, val);
1280 1 }
1281 //#endif
1282
1283 /*===========================================================================*/
1284 /* */
1285 /*===========================================================================*/
1286 BYTE SetADCandInputRegisterByMode(BYTE mode)
1287 {
1288 1
1289 1 BYTE fielddetect=0, r
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -