📄 measure.lst
字号:
787 2 MeasureAndWait(3);
788 2 sync = GetVSYNCPulse();
789 2 #ifdef DEBUG_PC
dPrintf(" --->New VSYNC:%04x(%d)", sync, sync);
#endif
792 2 }
793 1
794 1 //----- Get HPN ---------------------
795 1 hpn = GetHPN(); // HPN = H Period Num
796 1 IHF = (GetPPF()+hpn/2) / hpn; // IHF = PPF / HPN
797 1 sync = GetHSYNCPulse(); // H sync Pulse Width = HSYNC interval
798 1
799 1 #ifdef DEBUG_PC
C51 COMPILER V7.50 MEASURE 08/20/2007 10:23:31 PAGE 14
dPrintf("\r\nIHF:%08lx(%ld)", IHF, IHF);
dPrintf("\r\nHPN:%04x(%d) HSYNC:%04x(%d)", hpn, hpn, sync, sync);
#endif
803 1
804 1 //#ifdef SUPPORT_DTV
805 1 //if( IsDTVInput() ) { // Don't check h polarity.
806 1 // if(vpn<250) { vpn = IHF/
807 1 //#endif
808 1
809 1 if( sync >= (hpn/3) ) {
810 2 InvertHSYNCPolarity();
811 2 MeasureAndWait(3);
812 2 }
813 1
814 1 //----- Get New HPN -------------
815 1 sync = GetHSYNCPulse(); // H sync Pulse Width = HSYNC interval
816 1 hpn = GetHPN(); // HPN = H Period Num
817 1 IHF = (GetPPF()+hpn/2) / hpn; // IHF = PPF / HPN
818 1
819 1 #ifdef DEBUG_PC
dPrintf("\r\nIHF(New):%08lx(%ld)", IHF, IHF);
dPrintf("\r\nHPN(New):%04x(%d) HSYNC(New):%04x(%d)", hpn, hpn, sync, sync);
#endif
823 1
824 1 //----- Get New VPN -------------
825 1 vpn = GetVPN();
826 1 IVF = (WORD)((IHF+vpn/2)/vpn); // IVF = IHF / VPN
827 1
828 1 #ifdef DEBUG_PC
dPrintf("\r\nVPN(New):%04x(%d)", vpn, vpn);
dPrintf("\r\nIVF(New):%04x(%d)", IVF, IVF);
dPuts("\r\n-------");
#endif
833 1
834 1 DebugLevel = en;
835 1 return vpn;
836 1 }
837
838 //=============================================================================
839 // Return V active Start
840 //=============================================================================
841 WORD GetVerticalActiveArea(void)
842 {
843 1 WORD vstart, vstart1, vend;
844 1 char off=0;
845 1
846 1 dPuts("\r\n----- Get V Active Area");
847 1
848 1 //----- if current mode is DTV, use default value----------------
849 1
850 1 //#ifdef SUPPORT_DTV
851 1 if( IsDTVInput() ) {
852 2
853 2 #ifdef DEBUG_DTV
dPrintf(" ---> Use fixed data Vstart=%d VAN=%d", PCMDATA[PcMode].Vstart, PCMDATA[PcMode].VAN);
#endif
856 2
857 2 SetVactiveStart( PCMDATA[PcMode].Vstart );
858 2
859 2 switch (PcMode) {
860 3 case EE_YPbPr_480I: off = 4; break;
861 3 case EE_YPbPr_1080I: off = 2; break;
C51 COMPILER V7.50 MEASURE 08/20/2007 10:23:31 PAGE 15
862 3 case EE_RGB_1080I: off = 4; break;
863 3 default: off = 0; break;
864 3 }
865 2 SetVactiveLen( PCMDATA[PcMode].VAN+off+20 );
866 2
867 2 return PCMDATA[PcMode].Vstart;
868 2 }
869 1 //#endif
870 1
871 1 //======================== Get the Bottom End ========================
872 1
873 1 vend = GetVend();
874 1 if( vend >= GetVPN() ) {
875 2 #ifdef DEBUG_PC
Printf("\r\nToo big vend [%04x]", vend);
#endif
878 2 vend = GetVPN()-1;
879 2 }
880 1 vstart = vend - PCMDATA[PcMode].VAN + 1;
881 1 vstart1 = GetVstart();
882 1 // vstart = GetVstart();
883 1
884 1 #ifdef DEBUG_PC
dPrintf("\r\nFind Vend --- %04x %04x", vstart, vend);
#endif
887 1
888 1 //================================================= HHY 2.00
889 1 if( PcMode >= EE_1152_60 && PcMode <=EE_1152_75 ) {
890 2 if( vstart1 > vstart && vstart1 <= vstart+3 ) {
891 3 vstart = vstart1;
892 3 vend = vstart + PCMDATA[PcMode].VAN - 1;
893 3 #ifdef DEBUG_PC
dPuts(" -------> Use Vstart");
#endif
896 3 }
897 2 }
898 1 //=================================================
899 1
900 1 #ifdef DEBUG_PC
dPrintf("\r\nAuto Measure Vstart=%04x(%d) Vend=%04x(%d)", vstart, vstart, vend, vend);
#endif
903 1
904 1 if( ( vend < GetVSYNCPulse() + PCMDATA[PcMode].VAN + 1 ) || // HHY 1.63
905 1
906 1 (vstart > PCMDATA[PcMode].Vstart + 30) || ((int)vstart < ((int)PCMDATA[PcMode].Vstart - 30) ) ) {
907 2
908 2 #ifdef DEBUG_PC
ePrintf(" ==> Out Of Range V Active");
#endif
911 2
912 2 vstart = GetVactiveStartEE(PcMode);
913 2 vend = vstart + PCMDATA[PcMode].VAN - 1;
914 2 }
915 1
916 1 //----- Compensation mode by mode -------------------------------
917 1
918 1 #ifdef VGA
if( PcMode>=EE_VGA_60 || PcMode<=EE_VGA_85 ) {
vstart -= 5;
Printf("\r\n ----------- VGA Bypass !!!");
}
#endif
C51 COMPILER V7.50 MEASURE 08/20/2007 10:23:31 PAGE 16
924 1
925 1 if( PcMode==EE_SP2 ) vstart = PCMDATA[EE_SP2].Vstart; // HHY 1.62 640x350
926 1
927 1 //----- set the register values ( Vstart, VAN ) -----------------
928 1
929 1 SetVactiveStart(vstart);
930 1
931 1 /* //Vtest
932 1 if( PCMDATA[PcMode].VAN== GetPVR() || Flag4Bypass ) {
933 1 SetVactiveStart(vstart); // bypass mode
934 1 }
935 1 else {
936 1 SetVactiveStart( GetVSYNCPulse() ); // non-bypass mode
937 1 }
938 1 */
939 1 SetVactiveLen(PCMDATA[PcMode].VAN); // with VAN
940 1
941 1 #ifdef DEBUG_PC
ePrintf("\r\n@@@@@ Vstart=%04x[%d] Vend=%04x[%d]", vstart, vstart, vend, vend);
#endif
944 1
945 1 return vstart;
946 1 }
947 //=============================================================================
948 //
949 //=============================================================================
950 BYTE GetHorizontalActiveArea(void)
951 {
952 1 WORD hstart, hend;
953 1
954 1 dPuts("\r\n----- Get H Active Area ");
955 1
956 1 //#ifdef SUPPORT_DTV
957 1 if( IsDTVInput() ) {
958 2 hstart = PCMDATA[PcMode].Hstart;
959 2 hend = hstart + PCMDATA[PcMode].HAN + 1;
960 2
961 2 #ifdef DEBUG_PC
dPrintf(" ---> Use fixed data Hstart=%d HAN=%d Hend=%d", hstart, PCMDATA[PcMode].HAN, hend);
#endif
964 2
965 2 SetHactiveStart( hstart );
966 2 SetHactiveEnd( hend+3 ); // with HAN, Hstart
967 2 return TRUE;
968 2 }
969 1 //#endif
970 1
971 1 //======================== Get the Right End ========================
972 1
973 1 hstart = GetHstart();
974 1
975 1 hend = hstart + PCMDATA[PcMode].HAN + 1;
976 1
977 1 #ifdef DEBUG_PC
dPrintf("\r\nAuto Measure Hstart=%04x(%d) Hend=%04x(%d)", hstart, hstart, hend, hend);
#endif
980 1
981 1 if( (hstart > PCMDATA[PcMode].Hstart + 100) || ((int)hstart < (int)PCMDATA[PcMode].Hstart - 100) ) {
982 2
983 2 #ifdef DEBUG_PC
ePuts(" ==> Out Of Range H Active");
#endif
C51 COMPILER V7.50 MEASURE 08/20/2007 10:23:31 PAGE 17
986 2
987 2 hstart = GetHactiveStartEE(PcMode);
988 2 hend = hstart + PCMDATA[PcMode].HAN + 1;
989 2
990 2 SetHactiveStart(hstart); // with Hstart
991 2 SetHactiveEnd( hend ); // with HAN, Hstart
992 2
993 2 return TRUE;
994 2 }
995 1
996 1 //----- Compensation mode by mode -------------------------------
997 1
998 1 if( PcMode < EE_XGA_60 ) hend++;
999 1
1000 1 if( !IsBypassmode() ) {
1001 2 hstart--;
1002 2 hend--;
1003 2 }
1004 1
1005 1
1006 1 #ifdef XGA
if( PcMode>=EE_1152_60 ) {
hstart+=3;
hend+=3;
}
#endif
1012 1
1013 1 #ifdef SXGA
if( PcMode>=EE_1152_60 && PcMode<=EE_1152_75 ) {
hstart+=2;
hend+=2;
}
#endif
1019 1
1020 1 //----- set the register values ( Hstart, Hend ) ----------------
1021 1
1022 1 SetHactiveStart(hstart); // with Hstart
1023 1 SetHactiveEnd( hend ); // with HAN, Hstart
1024 1
1025 1 #ifdef DEBUG_PC
ePrintf("\r\n@@@@@ Hstart=%04x[%d] Hend=%04x[%d]", hstart, hstart, hend, hend);
#endif
1028 1
1029 1 return TRUE;
1030 1 }
1031
1032 //-----------------------------------------------------------------------------
1033 // Calcurate and Save VOback(0xb9) & PVP(0xb7,0xbb)
1034 // - Refer to additional document
1035 //-----------------------------------------------------------------------------
1036 void SetVValueForPanel(WORD VIstart)
1037 {
1038 1 DWORD dtmp;
1039 1 WORD PVR, VAN;
1040 1 BYTE VIsync, VOsync, VOback;
1041 1
1042 1 VIstart = VIstart;
1043 1 VIsync = GetVSYNCPulse();
1044 1 PVR = GetPVR();
1045 1 VAN = PCMDATA[PcMode].VAN;
1046 1 VOsync = ReadTW88(0xb8);
1047 1
C51 COMPILER V7.50 MEASURE 08/20/2007 10:23:31 PAGE 18
1048 1 dtmp = VIstart + 3 - VIsync - 1;
1049 1 dtmp = (dtmp * PVR * 10) / VAN; // +5 means round-up.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -