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

📄 tw88.lst

📁 车载DVD osdIC TW8816原厂代码
💻 LST
📖 第 1 页 / 共 5 页
字号:
 860          void SetMeasureWindowV(WORD start, WORD stop)
 861          {
 862   1              BYTE val;
 863   1      
 864   1              #ifdef DEBUG_PC
 865   1              dPrintf("\r\nSetWindow V. Range(%04x, %04x)", start, stop);
 866   1              #endif
 867   1      
 868   1              // TW8804 write LSByte first
 869   1              val  = (BYTE)((stop>>4) & 0x70);
 870   1              val |= (BYTE)((start>>8) & 0x07);
 871   1              WriteDecoder(0x56, val);                                // V-start & V-stop
 872   1      
 873   1              WriteDecoder(0x54, (BYTE)start);                // V-start
 874   1              WriteDecoder(0x55, (BYTE)stop);                 // V-stop
 875   1      }
 876          #endif // SUPPORT_PC || defined SUPPORT_DTV
 877          
 878          //=============================================================================
 879          //                                    ZoomControl
 880          //=============================================================================
 881          #ifndef WIDE_SCREEN
              #if defined(SUPPORT_PC) || defined(SUPPORT_DTV)
              void BypassZoom()
              {
                      #ifdef WXGA
                      WriteDecoder(TW88_XUSCALELO, 0xcd);
                      WriteDecoder(TW88_YUSCALELO, 0x80);
                      WriteDecoder(TW88_XDSCALELO, 0x00);
                      WriteDecoder(TW88_XYSCALEHI, 0x06);     
                      #else
                      //SetBypassmode=1;
                      WriteDecoder(TW88_XUSCALELO, 0x00);
                      WriteDecoder(TW88_XDSCALELO, 0x80);
                      WriteDecoder(TW88_YUSCALELO, 0x00);
                      WriteDecoder(TW88_XYSCALEHI, 0x15);     //Set bit 4 to 1
                      #endif
              }
              #endif
              #endif
 900          
 901          void XscaleU(DWORD scale)
 902          {
 903   1              BYTE val;
 904   1      
 905   1              WriteDecoder( TW88_XUSCALEFINE, (BYTE)scale);
 906   1      
 907   1              scale >>= 8;
 908   1              WriteDecoder( TW88_XUSCALELO, (BYTE)scale);
 909   1      
 910   1              scale >>= 8;
 911   1              val = ReadDecoder(TW88_XYSCALEHI);
 912   1              val &= 0xfe;
 913   1              val |= (BYTE)scale;
C51 COMPILER V7.50   TW88                                                                  04/01/2008 15:02:37 PAGE 16  

 914   1              WriteDecoder( TW88_XYSCALEHI, val );
 915   1      }
 916          
 917          void XscaleD(DWORD scale)
 918          {
 919   1              BYTE val;
 920   1      
 921   1              WriteDecoder( TW88_XDSCALELO, (BYTE)scale);
 922   1      
 923   1              scale >>= 8;
 924   1              scale <<= 1;
 925   1              val = ReadDecoder(TW88_XYSCALEHI);
 926   1              val &= 0xfd;
 927   1              val |= (BYTE)scale;
 928   1              WriteDecoder( TW88_XYSCALEHI, val );
 929   1      }
 930          
 931          void XScale2(DWORD scale)
 932          {
 933   1              if( scale==0x10000 ) {          // No Scale
 934   2                      XscaleU(0x10000);
 935   2                      XscaleD(0x80);
 936   2              }
 937   1              else if( scale<0x10000 ) {      // Up Scale
 938   2                      XscaleU(scale);
 939   2                      XscaleD(0x80);
 940   2              }
 941   1              else {                                          // Down Scale
 942   2                      XscaleU(0x10000);
 943   2                      XscaleD(scale/2/256);
 944   2              }
 945   1      }
 946          
 947          void YScale2(DWORD scale)
 948          {
 949   1              BYTE val;
 950   1      
 951   1             // max down scale rate is 1/2. Hans
 952   1             if (scale > 0x1ff00) scale = 0x1ff00;
 953   1                 
 954   1              WriteDecoder( TW88_YUSCALEFINE, (BYTE)(scale));
 955   1      
 956   1              scale >>= 8;
 957   1              WriteDecoder( TW88_YUSCALELO, (BYTE)(scale));
 958   1      
 959   1              scale >>= 8;
 960   1              scale <<= 2;
 961   1              val = ReadDecoder(TW88_XYSCALEHI) & 0xf3;
 962   1              val |= (BYTE)scale;
 963   1              WriteDecoder( TW88_XYSCALEHI, val );
 964   1      }
 965          
 966          // PLL = 108MHz *FPLL / 2^17
 967          // FPLL = PLL * 2^17 / 108MHz
 968          void ChangeInternPLL(DWORD _PPF)
 969          {
 970   1              BYTE    ppf, CURR, VCO, POST, i;
 971   1              DWORD   FPLL;
 972   1      
 973   1              #ifdef DEBUG_PC
 974   1              dPrintf("\r\n++ ChangeInternPLL ++_PPF:%08lx(%ld) ", _PPF, _PPF);
 975   1              #endif
C51 COMPILER V7.50   TW88                                                                  04/01/2008 15:02:37 PAGE 17  

 976   1      
 977   1              ppf = _PPF/1000000;
 978   1      
 979   1              //----- Frequency Range --------------------
 980   1              if     ( ppf < 27 )  { VCO=0; CURR=0; POST=0; }         // step = 0.5MHz
 981   1              else if( ppf < 54 )  { VCO=1; CURR=0; POST=1; }         // step = 1.0MHz
 982   1              else if( ppf < 108 ) { VCO=2; CURR=0; POST=2; }         // step = 1.0MHz
 983   1              else                 { VCO=3; CURR=0; POST=2; }         // step = 1.0MHz
 984   1      
 985   1              //----- Get FBDN
 986   1              FPLL = (_PPF/100000L)*2427L;
 987   1      
 988   1              i = POST;
 989   1              for(; i>0; i-- )
 990   1                      FPLL *= 2;
 991   1      
 992   1              FPLL = FPLL / 20L;
 993   1      
 994   1              //----- Setting Registers : below is different with 8806
 995   1              WriteDecoder( TW88_FPLL0, (FPLL>>16));
 996   1              WriteDecoder( TW88_FPLL1, (BYTE)(FPLL>>8));
 997   1              WriteDecoder( TW88_FPLL2, (BYTE)FPLL );
 998   1      
 999   1              WriteDecoder( TW88_PLL_DIV, (VCO<<4) | (POST<<6) |CURR );
1000   1      }
1001          
1002          /**
1003          #if defined(SUPPORT_PC) || defined(SUPPORT_DTV)
1004          WORD GetYScale(void)
1005          {
1006                  WORD scale;
1007                  BYTE val;
1008          
1009                  scale = ReadDecoder(TW88_YUSCALELO);
1010                  val = ReadDecoder(TW88_XYSCALEHI);
1011                  val = (val >> 2) & 0x03;
1012                  scale = scale + val*0x100;
1013          
1014                  return scale;
1015          }
1016          #endif // SUPPORT_PC || SUPPORT_DTV
1017          **/
1018          
1019          //=============================================================================
1020          //                                   Panel related..
1021          //=============================================================================
1022          /***
1023          #if (defined SERIAL) || (defined WIDE_SCREEN)
1024          void SetPVR(WORD pvr)
1025          {
1026                  BYTE buf;
1027          
1028                  // TW8804 write LSByte first
1029                  buf = ReadDecoder(0xbb) & 0x0f;
1030                  buf = buf | ( (pvr>>4) & 0xf0 );
1031                  WriteDecoder( 0xbb, buf );
1032          
1033                  WriteDecoder( 0xba, (BYTE)pvr );
1034          }
1035          
1036          void SetPHR(WORD phr)
1037          {
C51 COMPILER V7.50   TW88                                                                  04/01/2008 15:02:37 PAGE 18  

1038                  BYTE buf;
1039          
1040                  // TW8804 write LSByte first
1041                  buf = ReadDecoder(0xb6) & 0x0f;
1042                  buf = buf | ( (phr>>4) & 0xf0 );
1043                  WriteDecoder( 0xb6, buf );
1044          
1045                  WriteDecoder( 0xb5, (BYTE)phr );
1046          }
1047          #endif // SERIAL || WIDE_SCREEN
1048          ***/
1049          
1050          #if defined( SUPPORT_PC ) || defined( SUPPORT_DTV ) || defined( DEBUG_SETPANEL)
1051          //----- Panel V Resolution
1052          WORD GetPVR(void)
1053          {
1054   1      /*      WORD    pvr;
1055   1              BYTE    val;
1056   1              
1057   1              val = ReadDecoder(0xbb);
1058   1              pvr = (val & 0x70) << 4;                // pppp xxxx -> pppp 0000 0000
1059   1              pvr |= ReadDecoder(0xba);
1060   1      
1061   1              return pvr;*/
1062   1              return PVR_;
1063   1      }
1064          
1065          //----- Panel H Resolution
1066          WORD GetPHR(void)
1067          {
1068   1      /*      WORD    phr;
1069   1              BYTE    val;
1070   1      
1071   1              val = ReadDecoder(0xb6);
1072   1              phr = (val & 0x70) << 4;                // pppp xxxx -> pppp 0000 0000
1073   1              phr |= ReadDecoder(0xb5);
1074   1      
1075   1              return phr;*/
1076   1              return PHR_;
1077   1      }
1078          
1079          WORD GetHPN(void)
1080          {
1081   1              WORD buf;
1082   1      
1083   1              ClearEnDet();                   // HHY 05.29.03 protect changing during read out
1084   1      
1085   1              WriteDecoder(0x5b, 0x50);       // HSYNC period and VSYNC period
1086   1      
1087   1              buf = ReadDecoder(0x58);        // from MSB
1088   1              buf = buf << 8;
1089   1              buf = buf | ReadDecoder(0x57);
1090   1      
1091   1              SetEnDet();                             // HHY 05.29.03 release protection
1092   1      
1093   1              return buf;
1094   1      
1095   1      
1096   1      }
1097          /*
1098          WORD GetHPN(void)
1099          {
C51 COMPILER V7.50   TW88                                                                  04/01/2008 15:02:37 PAGE 19  

1100                  WORD buf, sum;
1101                  BYTE i;
1102          
1103                  //Get HPN 
1104                  WriteDecoder(0x5b, 0x50);       // HSYNC period and VSYNC period
1105          
1106                  //HPN
1107          
1108                  for(i=0, sum=0; i<5; i++) {             // HHY 1.45 take average 
1109                          buf = (WORD)ReadDecoder(0x58) << 8;// from MSB
1110                          buf |= ReadDecoder(0x57);
1111                          sum += buf;
1112                  }
1113          
1114                  buf = (sum+5)/5;
1115          
1116                  return buf;
1117          }
1118          */
1119          WORD GetVPN(void)
1120          {
1121   1              WORD buf;
1122   1      
1123   1              WriteDecoder(0x5b, 0x50);       // HSYNC period and VSYNC period
1124   1      
1125   1              buf = (WORD)ReadDecoder(0x5a);
1126   1              buf = buf << 8;
1127   1              buf = buf | ReadDecoder(0x59);
1128   1              return buf;
1129   1      }
1130          
1131          /*
1132          WORD GetPVP(void)
1133          {
1134                  WORD pvp;
1135          
1136                  pvp = ReadDecoder(0xbb);                                        // pvp = Panel Vsync Period
1137                  pvp = (pvp & 0x0f) << 8;                                //
1138                  pvp |= ReadDecoder(0xb7);                                       //
1139          
1140                  return pvp;
1141          }
1142          */
1143          
1144          BYTE GetVBackPorch(void)
1145          {
1146   1              return ReadDecoder(0xb9);
1147   1      }
1148          
1149          #endif // SUPPORT_PC
1150          
1151          #if defined SUPPORT_PC || defined SUPPORT_DTV
1152          void SetVBackPorch(BYTE val)
1153          {

⌨️ 快捷键说明

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