measure.lst
来自「显示屏驱动源代码」· LST 代码 · 共 1,339 行 · 第 1/5 页
LST
1,339 行
#endif // DEBUG_PC
1028 1
1029 1 /*
1030 1 //----- Compensation mode by mode -------------------------------
1031 1 #ifdef XGA
1032 1 if ( PcMode==EE_DOS ) VOback -= 2; // HHY 3.00
1033 1 else if( PcMode==EE_SP1 ) VOback -= 2; // HHY 3.00
1034 1 #endif
1035 1
1036 1 #if defined VGA || defined WVGA
1037 1 if ( PcMode==EE_DOS ) VOback += 1;
1038 1 else if( (PcMode>=EE_SVGA_56) && (PcMode<=EE_SVGA_85) ) VOback += 1;
1039 1 #endif
1040 1 */
1041 1 //-----------------------------------------------------------
1042 1 #ifdef WQVGA
C51 COMPILER V7.06 MEASURE 02/21/2008 14:00:27 PAGE 18
SetVBackPorch(PanelData.VBackporch);
SetPVP(PanelData.VPeriod);
#else
1046 1 SetVBackPorch( (BYTE)VOback );
1047 1 SetPVP(VOsync + VOback + PVR + 10);
1048 1 #endif
1049 1 }
1050 //-----------------------------------------------------------------------------
1051 // Calcurate [Panel H. Cycle] = PHP(Panel H Period)
1052 //-----------------------------------------------------------------------------
1053 #ifndef AUTOCALC_PC
BYTE SetHValueForPanel(void)
{
WORD sum=0;
WORD php;
sum = ReadTW88(0xb3) + ReadTW88(0xb4) + GetPHR(); // sum = AA+AB+AC,AD = From Hsync to Active region
MeasureAndWait(3);
php = (DWORD)(GetHPN()) * PCMDATA[PcMode].VAN / GetPVR(); // PHP = HPN * (VAN/PVR)
#ifdef DEBUG_PC
dPrintf("\r\nHPN:%04x(%d)", GetHPN(), GetHPN());
dPrintf("\r\nVAN:%04x(%d)", PCMDATA[PcMode].VAN, PCMDATA[PcMode].VAN);
dPrintf("\r\nPVR:%04x(%d)", GetPVR(), GetPVR());
dPrintf("\r\nPanel H. Cycle:%04x(%d), aa+ab+ac:%04x(%d)", php, php, sum, sum);
#endif
if( php <= sum ) {
ePuts("--not enough");
#ifdef DEBUG_PC
return FALSE;
#endif
}
//=================================
#ifdef SXGA
switch( PcMode ) {
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
1099 BYTE SetHValueForPanel(void)
1100 {
1101 1 return TRUE;
1102 1 }
1103 #endif
1104 //-----------------------------------------------------------------------------
C51 COMPILER V7.06 MEASURE 02/21/2008 14:00:27 PAGE 19
1105 // VAN = V Active Number
1106 // HAN = H active Number
1107 //-----------------------------------------------------------------------------
1108 BYTE GetActiveRegion(void)
1109 {
1110 1 WORD vstart;
1111 1 DWORD pres, scale;
1112 1 DWORD ppf;
1113 1
1114 1 WORD period, sync;
1115 1
1116 1 //----- Set Measurement Wondow Size -----
1117 1
1118 1 SetMeasureWindowV(1, 0x400);
1119 1 MeasureAndWait(3);
1120 1
1121 1 // Set H window
1122 1 if( (PCMDATA[PcMode].VAN != GetPVR()) || !Flag4Bypass ) { // --- Change hpulse & hpn ---
1123 2 period = ConvertBasedOnInput( GetHPN() );
1124 2 sync = ConvertBasedOnInput( GetHSYNCPulse() );
1125 2 }
1126 1 else {
1127 2 period = GetCoarse();
1128 2 sync = GetHSYNCPulse();
1129 2 }
1130 1 SetMeasureWindowH(sync, period);
1131 1
1132 1 // Set V window
1133 1 period = GetVPN();
1134 1 sync = GetVSYNCPulse();
1135 1 SetMeasureWindowV(1, period);
1136 1
1137 1 //----- Do Measurement ---------------------------
1138 1 MeasureAndWait(3);
1139 1
1140 1 //----- Get VAN = Vertical Active Area -----------
1141 1
1142 1 vstart = GetVerticalActiveArea(); // Measure Input Vstart, Vactive
1143 1
1144 1 SetMeasureWindowV(1, period); // HHY 1.61 for stable h sync region
1145 1
1146 1 //----- Calculate Y-scale Factor, and save -------
1147 1
1148 1 #if (defined WIDE_SCREEN)
1149 1 Set4WideScreen(GetWideModeEE());
1150 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
{
C51 COMPILER V7.06 MEASURE 02/21/2008 14:00:27 PAGE 20
Clear_bypass();
YScale2(scale); // save V Scale Up Factor
}
} // WIDE
#endif
1172 1 vstart = GetVactiveStart();
1173 1 SetVValueForPanel(vstart); // with VAN, Vstart
1174 1
1175 1 //----- Calcurate Panel H. Cycle(A9,AD) ----------
1176 1
1177 1 ppf = GetPPF();
1178 1
1179 1 /****/
1180 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
1197 1 /****/
1198 1
1199 1 //----- Get HAN = Horizontal Active Area ---------
1200 1
1201 1 GetHorizontalActiveArea();
1202 1
1203 1 if( (PCMDATA[PcMode].VAN != GetPVR()) || !Flag4Bypass) { // non-bypass
1204 2 pres = (DWORD)GetPHR();
1205 2 scale = (PCMDATA[PcMode].HAN * 0x10000L ) / pres; // 256*han/phr
1206 2
1207 2 #ifdef DEBUG_PC
dPrintf("\r\nXscaleFactor:%04x(%d)", scale, scale);
#endif
1210 2
1211 2 //#if (defined SXGA) || (defined WXGA) || (defined WSGA)
1212 2 if( PCMDATA[PcMode].HAN > 1024 ) {//1100
1213 3 scale = (PCMDATA[PcMode].HAN * 0x80L ) / 1024 + 1; // (HAN/1024)*256
1214 3 XscaleD(scale);
1215 3 #ifdef DEBUG_PC
dPrintf("\r\nXscaleFactorD:%04x(%d)", scale, scale);
#endif
1218 3 scale = (1024 * 0x10000L ) / 1280; // (1024/PHR)*256
1219 3 XscaleU(scale);
1220 3 #ifdef DEBUG_PC
dPrintf("\r\nXscaleFactorU:%04x(%d)", scale, scale);
#endif
1223 3 }
1224 2 else
1225 2 //#endif
1226 2 {
1227 3 #ifdef WIDE_SCREEN
1228 3 if(WideScreenMode == WIDESCREEN_WIDE)
C51 COMPILER V7.06 MEASURE 02/21/2008 14:00:27 PAGE 21
1229 3 #endif // WIDE_SCREEN
1230 3 XScale2(scale);
1231 3 }
1232 2 }
1233 1
1234 1 SavePCDataEE(PcMode);
1235 1
1236 1 return TRUE;
1237 1 }
1238 /*===========================================================================*/
1239 /* Display The Result for Debugging */
1240 /*===========================================================================*/
1241 void DisplayResultAndSetActiveRange(void)
1242 {
1243 1
1244 1 BYTE cRang;
1245 1
1246 1 //------- Display the Result ---------------------
1247 1 #ifdef DEBUG_PC
dPuts ("\r\n-------------------------------------------");
dPrintf("\r\n Resolution = %d x %d (%s)", PCMDATA[PcMode].HAN, PCMDATA[PcMode].VAN, PcModeStr[PcMode
-]);
dPrintf("\r\n IVF(Refresh) = (%d)", IVF);
dPrintf("\r\n IHF = %08lx (%ld)", IHF, IHF);
dPuts ("\r\n-------------------------------------------");
#endif
1254 1
1255 1 //----- calculate H Pos Range
1256 1 HPosCurr = GetHactiveStart();
1257 1 cRang = PCMDATA[PcMode].HAN / 20;
1258 1 HPosMax = PCMDATA[PcMode].Hstart + cRang;
1259 1 #ifdef DEBUG_PC
dPrintf("\r\n HPosCurr = %d, HPosMax = %d, HRang = %d ", (WORD)HPosCurr, (WORD)HPosMax, (WORD)cRang);
#endif
1262 1
1263 1 //----- calculate V Pos Range
1264 1 VPosCurr = GetVactiveStart();
1265 1 cRang = PCMDATA[PcMode].VAN / 40;
1266 1 VPosMax = PCMDATA[PcMode].Vstart + cRang;
1267 1 #ifdef DEBUG_PC
dPrintf("\r\n VPosCurr = %d, VPosMax = %d, VRang = %d ", (WORD)VPosCurr, (WORD)VPosMax, (WORD)cRang);
#endif
1270 1
1271 1 }
1272 /*===========================================================================*/
1273 /* Real Measurement routine */
1274 /*===========================================================================*/
1275 BYTE DoMeasurement(void)
1276 {
1277 1 /* WORD coarse;
1278 1
1279 1 //------------------------ Clock Tuning -------------------------------
1280 1 #ifdef DEBUG_PAUSE
1281 1 Pause("coarse = AutoTuneClock()");
1282 1 #endif
1283 1
1284 1
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?