⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 measure.lst

📁 此程序为twell8806驱动程序
💻 LST
📖 第 1 页 / 共 5 页
字号:
1050   1              VOback = (dtmp+5-5)/10 - VOsync;
1051   1      
1052   1              #ifdef DEBUG_PC
                      Printf("\r\n************************");
                      Printf("\r\nVIstart=%d VIsync=%d PVR=%d VAN=%d ", (WORD)VIstart, (WORD)VIsync, (WORD)PVR, (WORD)VAN);
                      Printf("VOsync=%d", (WORD)VOsync);
                      Printf("==> VOback=%02bx(%bd)", VOback, VOback);
                      Printf("\r\n************************");
                      #endif // DEBUG_PC
1059   1      
1060   1              //----- Compensation mode by mode -------------------------------
1061   1              #ifdef XGA
                      if     ( PcMode==EE_DOS ) VOback -= 2;  // HHY 3.00 
                      else if( PcMode==EE_SP1 ) VOback -= 2;  // HHY 3.00 
                      #endif
1065   1      
1066   1              #if defined VGA || defined WVGA
                      if     ( PcMode==EE_DOS ) VOback += 1;
                      else if( (PcMode>=EE_SVGA_56) && (PcMode<=EE_SVGA_85) ) VOback += 1;
                      #endif
1070   1      
1071   1              //-----------------------------------------------------------
1072   1      
1073   1              SetVBackPorch( (BYTE)VOback );
1074   1              SetPVP(VOsync + VOback + PVR + 10);
1075   1      }
1076          //-----------------------------------------------------------------------------
1077          //                      Calcurate [Panel H. Cycle] = PHP(Panel H Period)
1078          //-----------------------------------------------------------------------------
1079          #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 ) {
C51 COMPILER V7.50   MEASURE                                                               08/20/2007 10:23:31 PAGE 19  

                      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
1125          BYTE SetHValueForPanel(void)
1126          {
1127   1              return TRUE;
1128   1      }
1129          #endif
1130          //-----------------------------------------------------------------------------
1131          //              VAN = V Active Number
1132          //              HAN = H active Number
1133          //-----------------------------------------------------------------------------
1134          BYTE GetActiveRegion(void)
1135          {
1136   1              WORD    vstart;
1137   1              DWORD   pres, scale;
1138   1              DWORD   ppf;
1139   1      
1140   1              WORD    period, sync;
1141   1      
1142   1              //----- Set Measurement Wondow Size -----
1143   1      
1144   1              SetMeasureWindowV(1, 0x400);
1145   1              MeasureAndWait(3);
1146   1      
1147   1              // Set H window
1148   1              if( (PCMDATA[PcMode].VAN != GetPVR()) || !Flag4Bypass ) {       // --- Change hpulse & hpn ---
1149   2                      period = ConvertBasedOnInput( GetHPN() );
1150   2                      sync   = ConvertBasedOnInput( GetHSYNCPulse() );
1151   2              }
1152   1              else {
1153   2                      period = GetCoarse();
1154   2                      sync   = GetHSYNCPulse();
1155   2              }
1156   1              SetMeasureWindowH(sync, period);
1157   1      
1158   1              // Set V window
1159   1              period = GetVPN();
1160   1              sync   = GetVSYNCPulse();
1161   1              SetMeasureWindowV(1, period);
1162   1      
1163   1              //----- Do Measurement ---------------------------
1164   1              MeasureAndWait(3);
1165   1      
1166   1              //----- Get VAN = Vertical Active Area -----------
1167   1      
1168   1              vstart = GetVerticalActiveArea();  // Measure Input Vstart, Vactive
1169   1      
1170   1              SetMeasureWindowV(1, period);           // HHY 1.61 for stable h sync region
1171   1      
C51 COMPILER V7.50   MEASURE                                                               08/20/2007 10:23:31 PAGE 20  

1172   1              //----- Calculate Y-scale Factor, and save -------
1173   1      
1174   1              #if (defined WIDE_SCREEN)
1175   1              Set4WideScreen(GetWideModeEE());
1176   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
1198   1      //      vstart = GetVactiveStart();
1199   1              SetVValueForPanel(vstart);              // with VAN, Vstart
1200   1      
1201   1              //----- Calcurate Panel H. Cycle(A9,AD) ----------
1202   1      
1203   1              ppf = GetPPF();
1204   1      
1205   1      /****/
1206   1              #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
1221   1      /****/
1222   1      
1223   1              //----- Get HAN = Horizontal Active Area ---------
1224   1      
1225   1              GetHorizontalActiveArea();  
1226   1      
1227   1              if( (PCMDATA[PcMode].VAN != GetPVR()) || !Flag4Bypass) {        // non-bypass
1228   2                      pres = (DWORD)GetPHR();
1229   2                      scale = (PCMDATA[PcMode].HAN * 0x10000L ) / pres;       // 256*han/phr
1230   2      
1231   2                      #ifdef DEBUG_PC
                              dPrintf("\r\nXscaleFactor:%04x(%d)", scale, scale);
                              #endif
C51 COMPILER V7.50   MEASURE                                                               08/20/2007 10:23:31 PAGE 21  

1234   2      
1235   2                      //#if (defined SXGA) || (defined WXGA) || (defined WSGA)
1236   2                      if( PCMDATA[PcMode].HAN > 1024 ) {//1100
1237   3                              scale = (PCMDATA[PcMode].HAN * 0x80L ) / 1024 + 1;              // (HAN/1024)*256
1238   3                              XscaleD(scale);
1239   3                              #ifdef DEBUG_PC
                                      Printf("\r\nXscaleFactorD:%04x(%d)", scale, scale);
                                      #endif
1242   3                              scale = (1024 * 0x10000L ) / 1280;                                              // (1024/PHR)*256
1243   3                              XscaleU(scale);
1244   3                              #ifdef DEBUG_PC
                                      Printf("\r\nXscaleFactorU:%04x(%d)", scale, scale);
                                      #endif
1247   3                      }
1248   2                      else
1249   2                      //#endif
1250   2                      {
1251   3              #ifdef WIDE_SCREEN
1252   3                      if(WideScreenMode == WIDESCREEN_WIDE)
1253   3              #endif // WIDE_SCREEN
1254   3                              XScale2(scale);
1255   3                      }
1256   2              }
1257   1      
1258   1              return TRUE;
1259   1      }
1260          /*===========================================================================*/
1261          /*                                        Display The Result for Debugging                                   */
1262          /*===========================================================================*/
1263          void DisplayResultAndSetActiveRange(void)
1264          {
1265   1      
1266   1              WORD    Back, Front;
1267   1      
1268   1              //------- Display the Result ---------------------
1269   1      
1270   1              #ifdef DEBUG_PC0
                      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);
                      dPrintf("\r\n   IHPN(PLLdiv)  = %04x(%d) %02x", GetCoarse(), GetCoarse(), (WORD)GetPhaseCurrent() );
                      dPrintf("\r\n   VPN           = %04x(%d)", GetVPN(), GetVPN() );
                      dPrintf("\r\n   PPF           = %ld / 2 = %ld", GetPPF(), GetPPF()/2 );
                      dPrintf("\r\n   IPF           = %ld", IHF * GetCoarse() );
                      #endif
1280   1      
1281   1              //----- calculate H Pos Range
1282   1              Back  = GetHactiveStart() - GetHSYNCPulse();
1283   1              Front = GetCoarse() - PCMDATA[PcMode].HAN - GetHactiveStart();
1284   1      
1285   1              #ifdef DEBUG_PC0
                      dPrintf("\r\nH  ~~~|_%d_|~%d~", (WORD)GetHSYNCPulse(), (WORD)Back );
                      dPrintf(":+++ %d +++:~%d~|_%d_|~~~ ",  (WORD)PCMDATA[PcMode].HAN, (WORD)Front, (WORD)GetHSYNCPulse() );
                      #endif
1289   1      
1290   1              if( (Back>50) && (Front>50) ) {
1291   2                      Back = 50;
1292   2                      Front = 50;
1293   2              }
1294   1              else if( Back+Front>=100 ) {
C51 COMPILER V7.50   MEASURE                                                               08/20/2007 10:23:31 PAGE 22  

1295   2                      if( Back>Front )
1296   2                              Back = 100 - Front;
1297   2                      else if( Front>Back ) 
1298   2                              Front = 100 - Back;
1299   2              }
1300   1      
1301   1              HPosCurr = (BYTE)Back;
1302   1              HPosMax  = (BYTE)(Back + Front);
1303   1      
1304   1              //----- calculate V Pos Range
1305   1              Back  = GetVactiveStart() - GetVSYNCPulse();
1306   1              Front = GetVPN() - PCMDATA[PcMode].VAN - GetVactiveStart();
1307   1      
1308   1              #ifdef DEBUG_PC0
                      dPrintf("\r\nV  ~~~|_%d_|~%d~", (WORD)GetVSYNCPulse(), Back );
                      dPrintf(":+++ %d +++:~%d~|_%d_|~~~ ",  PCMDATA[PcMode].VAN, Front, (WORD)GetVSYNCPulse() );
                      dPuts  ("\r\n-------------------------------------------");
                      #endif
1313   1      

⌨️ 快捷键说明

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