📄 measure.lst
字号:
770 //=============================================================================
771 WORD GetVerticalActiveArea(void)
772 {
773 1 WORD vstart, vstart1, vend;
774 1 char off=0;
775 1
776 1 dPuts("\r\n----- Get V Active Area");
777 1
778 1 //----- if current mode is DTV, use default value----------------
779 1
780 1 //#ifdef SUPPORT_DTV
781 1 if( IsDTVInput() ) {
782 2
783 2 #ifdef DEBUG_DTV
dPrintf(" ---> Use fixed data Vstart=%d VAN=%d", PCMDATA[PcMode].Vstart, PCMDATA[PcMode].VAN);
#endif
786 2
787 2 SetVactiveStart( PCMDATA[PcMode].Vstart );
788 2
789 2 switch (PcMode) {
790 3 case EE_YPbPr_480I: off = 4; break;
791 3 case EE_YPbPr_1080I: off = 2; break;
792 3 case EE_RGB_1080I: off = 4; break;
793 3 default: off = 0; break;
794 3 }
C51 COMPILER V7.50 MEASURE 04/01/2008 15:02:17 PAGE 14
795 2 SetVactiveLen( PCMDATA[PcMode].VAN+off+20 );
796 2
797 2 return PCMDATA[PcMode].Vstart;
798 2 }
799 1 //#endif
800 1
801 1 //======================== Get the Bottom End ========================
802 1
803 1 vend = GetVend();
804 1 if( vend >= GetVPN() ) {
805 2 #ifdef DEBUG_PC
806 2 dPrintf("\r\nToo big vend [%04x]", vend);
807 2 #endif
808 2 vend = GetVPN()-1;
809 2 }
810 1 vstart = vend - PCMDATA[PcMode].VAN + 1;
811 1 vstart1 = GetVstart();
812 1 // vstart = GetVstart();
813 1
814 1 #ifdef DEBUG_PC
815 1 dPrintf("\r\nFind Vend --- %04x %04x", vstart, vend);
816 1 #endif
817 1
818 1 //================================================= HHY 2.00
819 1 if( PcMode >= EE_1152_60 && PcMode <=EE_1152_75 ) {
820 2 if( vstart1 > vstart && vstart1 <= vstart+3 ) {
821 3 vstart = vstart1;
822 3 vend = vstart + PCMDATA[PcMode].VAN - 1;
823 3 #ifdef DEBUG_PC
824 3 dPuts(" -------> Use Vstart");
825 3 #endif
826 3 }
827 2 }
828 1 //=================================================
829 1
830 1 #ifdef DEBUG_PC
831 1 dPrintf("\r\nAuto Measure Vstart=%04x(%d) Vend=%04x(%d)", vstart, vstart, vend, vend);
832 1 #endif
833 1
834 1 if( (vstart > PCMDATA[PcMode].Vstart + 30) || ((int)vstart < ((int)PCMDATA[PcMode].Vstart - 30) ) ) {
835 2
836 2 #ifdef DEBUG_PC
837 2 ePrintf(" ==> Out Of Range V Active");
838 2 #endif
839 2
840 2 vstart = GetVactiveStartEE(PcMode);
841 2 vend = vstart + PCMDATA[PcMode].VAN - 1;
842 2 }
843 1
844 1 //----- Compensation mode by mode -------------------------------
845 1
846 1 #ifdef VGA
if( PcMode>=EE_VGA_60 || PcMode<=EE_VGA_85 ) {
vstart -= 5;
dPrintf("\r\n ----------- VGA Bypass !!!");
}
#endif
852 1
853 1 if( PcMode==EE_SP2 ) vstart = PCMDATA[EE_SP2].Vstart; // HHY 1.62 640x350
854 1
855 1 //----- set the register values ( Vstart, VAN ) -----------------
856 1
C51 COMPILER V7.50 MEASURE 04/01/2008 15:02:17 PAGE 15
857 1 SetVactiveStart(vstart);
858 1
859 1 SetVactiveLen(PCMDATA[PcMode].VAN); // with VAN
860 1
861 1 #ifdef DEBUG_PC
862 1 ePrintf("\r\n@@@@@ Vstart=%04x[%d] Vend=%04x[%d]", vstart, vstart, vend, vend);
863 1 #endif
864 1
865 1 return vstart;
866 1 }
867 //=============================================================================
868 //
869 //=============================================================================
870 BYTE GetHorizontalActiveArea(void)
871 {
872 1 WORD hstart, hend;
873 1
874 1 dPuts("\r\n----- Get H Active Area ");
875 1
876 1 #ifdef SUPPORT_DTV
if( IsDTVInput() ) {
hstart = PCMDATA[PcMode].Hstart;
hend = hstart + PCMDATA[PcMode].HAN + 1;
#ifdef DEBUG_PC
dPrintf(" ---> Use fixed data Hstart=%d HAN=%d Hend=%d", hstart, PCMDATA[PcMode].HAN, hend);
#endif
SetHactiveStart( hstart );
SetHactiveEnd( hend+3 ); // with HAN, Hstart
return TRUE;
}
#endif
890 1
891 1 //======================== Get the Right End ========================
892 1
893 1 hstart = GetHstart();
894 1
895 1 hend = hstart + PCMDATA[PcMode].HAN + hstart;
896 1
897 1 #ifdef DEBUG_PC
898 1 dPrintf("\r\nAuto Measure Hstart=%04x(%d) Hend=%04x(%d)", hstart, hstart, hend, hend);
899 1 #endif
900 1
901 1 if( (hstart > PCMDATA[PcMode].Hstart + 100) || ((int)hstart < (int)PCMDATA[PcMode].Hstart - 100) ) {
902 2
903 2 #ifdef DEBUG_PC
904 2 ePuts(" ==> Out Of Range H Active");
905 2 #endif
906 2
907 2 hstart = GetHactiveStartEE(PcMode);
908 2 hend = hstart + PCMDATA[PcMode].HAN + 1;
909 2
910 2 SetHactiveStart(hstart); // with Hstart
911 2 SetHactiveEnd( hend ); // with HAN, Hstart
912 2
913 2 return TRUE;
914 2 }
915 1
916 1 //----- Compensation mode by mode -------------------------------
917 1
918 1 if( PcMode < EE_XGA_60 ) hend++;
C51 COMPILER V7.50 MEASURE 04/01/2008 15:02:17 PAGE 16
919 1
920 1 if( !IsBypassmode() ) {
921 2 hstart -= 3;
922 2 hend -= 3;
923 2 }
924 1
925 1
926 1 #ifdef XGA
if( PcMode>=EE_1152_60 ) {
hstart+=3;
hend+=3;
}
#endif
932 1
933 1 #ifdef SXGA
if( PcMode>=EE_1152_60 && PcMode<=EE_1152_75 ) {
hstart+=2;
hend+=2;
}
#endif
939 1
940 1 //----- set the register values ( Hstart, Hend ) ----------------
941 1
942 1 SetHactiveStart(hstart); // with Hstart
943 1 SetHactiveEnd( hend ); // with HAN, Hstart
944 1
945 1 #ifdef DEBUG_PC
946 1 ePrintf("\r\n@@@@@ Hstart=%04x[%d] Hend=%04x[%d]", hstart, hstart, hend, hend);
947 1 #endif
948 1
949 1 return TRUE;
950 1 }
951
952 //-----------------------------------------------------------------------------
953 // Calcurate and Save VOback(0xb9) & PVP(0xb7,0xbb)
954 // - Refer to additional document
955 //-----------------------------------------------------------------------------
956 void SetVValueForPanel(WORD VIstart)
957 {
958 1 WORD PVR, VAN, VScale, VIsync;
959 1 BYTE VOsync, VOback;
960 1
961 1 VIstart = VIstart;
962 1 VIsync = VIstart; // active pulse width
963 1 PVR = GetPVR();
964 1 VAN = PCMDATA[PcMode].VAN;
965 1 VOsync = ReadTW88(0xb8);
966 1
967 1 // dtmp = VIstart + 3 - VIsync - 1;
968 1 // dtmp = VIstart + 3;
969 1 // dtmp = (dtmp * PVR * 10) / VAN; // +5 means round-up.
970 1 VScale = ReadTW88(0x63) & 0x0c;
971 1 VScale <<= 6;
972 1 VScale += ReadTW88(0x62); // read VScale
973 1 // VIsync--;
974 1 VIsync <<= 8; // multiply by 256
975 1 // VIsync += 128;
976 1 VIsync /= VScale; // divide by scale, calculate
977 1 VOback = VIsync - VOsync - 1;
978 1
979 1 #ifdef DEBUG_PC
980 1 dPrintf("\r\n************************");
C51 COMPILER V7.50 MEASURE 04/01/2008 15:02:17 PAGE 17
981 1 dPrintf("\r\nVScale=%d VIsync=%d PVR=%d VAN=%d ", (WORD)VScale, (WORD)VIsync, (WORD)PVR, (WORD)VAN);
982 1 dPrintf("\r\nVIstart=%d VIsync=%d PVR=%d VAN=%d ", (WORD)VIstart, (WORD)VIsync, (WORD)PVR, (WORD)VAN);
983 1 dPrintf("VOsync=%d", (WORD)VOsync);
984 1 dPrintf("==> VOback=%02bx(%bd)", VOback, VOback);
985 1 dPrintf("\r\n************************");
986 1 #endif // DEBUG_PC
987 1
988 1 /*
989 1 //----- Compensation mode by mode -------------------------------
990 1 #ifdef XGA
991 1 if ( PcMode==EE_DOS ) VOback -= 2; // HHY 3.00
992 1 else if( PcMode==EE_SP1 ) VOback -= 2; // HHY 3.00
993 1 #endif
994 1
995 1 #if defined VGA || defined WVGA
996 1 if ( PcMode==EE_DOS ) VOback += 1;
997 1 else if( (PcMode>=EE_SVGA_56) && (PcMode<=EE_SVGA_85) ) VOback += 1;
998 1 #endif
999 1 */
1000 1 //-----------------------------------------------------------
1001 1 #ifdef WQVGA
1002 1 SetVBackPorch(PanelData.VBackporch);
1003 1 SetPVP(PanelData.VPeriod);
1004 1 #else
SetVBackPorch( (BYTE)VOback );
SetPVP(VOsync + VOback + PVR + 10);
#endif
1008 1 }
1009 //-----------------------------------------------------------------------------
1010 // Calcurate [Panel H. Cycle] = PHP(Panel H Period)
1011 //-----------------------------------------------------------------------------
1012 #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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -