?? tw88.lst
字號:
925 1 WriteDecoder(0x40, val);
926 1 }
927
928 void InvertVSYNCPolarity(void)
929 {
930 1 BYTE val;
931 1
932 1 val = ReadDecoder(0x40);
933 1 if( val & 0x02 ) {
934 2 val &= 0xfd;
935 2
936 2 #ifdef DEBUG_PC
dPuts("\r\nInvert V Pol: N->P ");
#endif
939 2
940 2 }
941 1 else {
942 2 val |= 0x02;
943 2
944 2 #ifdef DEBUG_PC
dPuts("\r\nInvert V Pol: P->N ");
#endif
947 2
948 2 }
949 1 WriteDecoder(0x40, val);
950 1 }
951 //=============================================================================
952 //
953 //=============================================================================
954 WORD GetVSYNCPulse(void)
955 {
956 1 WORD buf;
957 1
958 1 WriteDecoder(0x5b, 0x70); // VSYNC
959 1
960 1 buf = (WORD)ReadDecoder(0x58) << 8;
961 1 buf |= ReadDecoder(0x57);
962 1
963 1 return buf;
964 1 }
965
966 /* Not used right now!!
967 WORD GetRelativePosition(void)
968 {
969 WORD buf;
970
971 WriteDecoder(0x5b, 0x70); // VSYNC
972
973 buf = (WORD)ReadDecoder(0x5a) << 8;
974 buf |= ReadDecoder(0x59);
975
976 return buf;
977 }
978 //*/
979
980 WORD GetHSYNCPulse(void)
981 {
982 1 WORD buf;
983 1
984 1 WriteDecoder(0x5b, 0x60); // HSYNC
985 1 buf = (WORD)ReadDecoder(0x58) << 8; // from MSB
C51 COMPILER V7.50 TW88 08/20/2007 10:23:35 PAGE 17
986 1 buf |= ReadDecoder(0x57);
987 1
988 1 return buf;
989 1 }
990
991 #endif // SUPPORT_PC
992
993 //=============================================================================
994 // Internal PLL
995 //=============================================================================
996 #if defined SUPPORT_PC || defined SUPPORT_DTV
997
998 BYTE GetPOST(void)
999 {
1000 1 BYTE post;
1001 1
1002 1 post = ReadDecoder(TW88_PLL4);
1003 1 return post & 0x03;
1004 1 }
1005
1006 DWORD GetFBDN(void)
1007 {
1008 1 DWORD Freq;
1009 1
1010 1 Freq = ReadDecoder(TW88_PLL0);
1011 1 Freq &= 0x1f;
1012 1 Freq <<= 8;
1013 1 Freq |= ReadDecoder(TW88_PLL1);
1014 1 Freq <<= 8;
1015 1 Freq |= ReadDecoder(TW88_PLL2);
1016 1
1017 1 #ifdef DEBUG_TW88
dPrintf("\r\n(GetFBDN) :%ld", Freq);
#endif
1020 1 return Freq;
1021 1 }
1022
1023 DWORD GetPPF(void)
1024 {
1025 1 DWORD ppf;
1026 1 BYTE i;
1027 1
1028 1 // 27000000 * FREQ / 2^21 / 2^POST
1029 1 ppf = 412L * ( GetFBDN() );
1030 1
1031 1 i= GetPOST();
1032 1 for(; i>0; i-- )
1033 1 ppf /= 2;
1034 1
1035 1 #ifdef DEBUG_TW88
dPrintf("\r\n(GetPPF) :%ld", ppf);
#endif
1038 1 return ppf;
1039 1 }
1040 #endif
1041
1042 #if defined SUPPORT_PC || defined SUPPORT_DTV
1043
1044 void ChangeInternPLL(DWORD _PPF)
1045 {
1046 1 BYTE ppf, CURR, VCO, POST, i;
1047 1 DWORD FREQ;
C51 COMPILER V7.50 TW88 08/20/2007 10:23:35 PAGE 18
1048 1
1049 1 #ifdef DEBUG_TW88
dPrintf("\r\n++ ChangeInternPLL ++_PPF:%08lx(%ld) ", _PPF, _PPF);
#endif
1052 1
1053 1 ppf = _PPF/1000000;
1054 1
1055 1 //----- Frequency Range --------------------
1056 1 if ( ppf < 27 ) { VCO=0; CURR=0; POST=0; } // step = 0.5MHz
1057 1 else if( ppf < 54 ) { VCO=1; CURR=0; POST=0; } // step = 1.0MHz
1058 1 else if( ppf < 108 ) { VCO=2; CURR=0; POST=0; } // step = 1.0MHz
1059 1 else { VCO=3; CURR=0; POST=0; } // step = 1.0MHz
1060 1
1061 1 //----- Get FBDN
1062 1 FREQ = (_PPF/100000L)*2427L;
1063 1
1064 1 i = POST;
1065 1 for(; i>0; i-- )
1066 1 FREQ *= 2;
1067 1
1068 1 FREQ = FREQ / 10L;
1069 1
1070 1 //----- Setting Registers
1071 1 WriteDecoder( 0xf9, (CURR<<5) | (FREQ>>16));
1072 1 WriteDecoder( 0xfa, (BYTE)(FREQ>>8));
1073 1 WriteDecoder( 0xfb, (BYTE)FREQ );
1074 1
1075 1 WriteDecoder( 0xfd, (VCO<<2) | POST );
1076 1 }
1077 //=============================================================================
1078 // Set Measurement Window Functions
1079 //=============================================================================
1080 void SetMeasureWindowH(WORD start, WORD stop)
1081 {
1082 1 BYTE val;
1083 1
1084 1 #ifdef DEBUG_PC
dPrintf("\r\nSetWindow H. Range(%04x, %04x)", start, stop);
#endif
1087 1
1088 1 // TW8804 write LSByte first
1089 1 val = (BYTE)((stop >> 4) & 0xf0);
1090 1 val |= (BYTE)((start>>8) & 0x07);
1091 1 WriteDecoder(0x53, val); // H-start and H-stop
1092 1
1093 1 WriteDecoder(0x51, (BYTE)start); // H-start
1094 1 WriteDecoder(0x52, (BYTE)stop); // H-stop
1095 1 }
1096
1097 void SetMeasureWindowV(WORD start, WORD stop)
1098 {
1099 1 BYTE val;
1100 1
1101 1 #ifdef DEBUG_PC
dPrintf("\r\nSetWindow V. Range(%04x, %04x)", start, stop);
#endif
1104 1
1105 1 // TW8804 write LSByte first
1106 1 val = (BYTE)((stop>>4) & 0x70);
1107 1 val |= (BYTE)((start>>8) & 0x07);
1108 1 WriteDecoder(0x56, val); // V-start & V-stop
1109 1
C51 COMPILER V7.50 TW88 08/20/2007 10:23:35 PAGE 19
1110 1 WriteDecoder(0x54, (BYTE)start); // V-start
1111 1 WriteDecoder(0x55, (BYTE)stop); // V-stop
1112 1 }
1113 #endif // SUPPORT_PC || defined SUPPORT_DTV
1114
1115 //=============================================================================
1116 // ZoomControl
1117 //=============================================================================
1118 #if defined(SUPPORT_PC) || defined(SUPPORT_DTV)
1119 void BypassZoom()
1120 {
1121 1 #ifdef WXGA
WriteDecoder(TW88_XUSCALELO, 0xcd);
WriteDecoder(TW88_YUSCALELO, 0x80);
WriteDecoder(TW88_XDSCALELO, 0x00);
WriteDecoder(TW88_XYSCALEHI, 0x06);
#else
1127 1 //SetBypassmode=1;
1128 1 WriteDecoder(TW88_XUSCALELO, 0x00);
1129 1 WriteDecoder(TW88_XDSCALELO, 0x80);
1130 1 WriteDecoder(TW88_YUSCALELO, 0x00);
1131 1 WriteDecoder(TW88_XYSCALEHI, 0x15); //Set bit 4 to 1
1132 1 #endif
1133 1 }
1134 #endif
1135
1136 #if defined(SUPPORT_PC) || defined(SUPPORT_DTV) // || defined(WIDE_SCREEN)
1137 void XscaleU(DWORD scale)
1138 {
1139 1 BYTE val;
1140 1
1141 1 WriteDecoder( TW88_XUSCALEFINE, (BYTE)scale);
1142 1
1143 1 scale >>= 8;
1144 1 WriteDecoder( TW88_XUSCALELO, (BYTE)scale);
1145 1
1146 1 scale >>= 8;
1147 1 val = ReadDecoder(TW88_XYSCALEHI);
1148 1 val &= 0xfe;
1149 1 val |= (BYTE)scale;
1150 1 WriteDecoder( TW88_XYSCALEHI, val );
1151 1 }
1152
1153 void XscaleD(DWORD scale)
1154 {
1155 1 BYTE val;
1156 1
1157 1 WriteDecoder( TW88_XDSCALELO, (BYTE)scale);
1158 1
1159 1 scale >>= 8;
1160 1 scale <<= 1;
1161 1 val = ReadDecoder(TW88_XYSCALEHI);
1162 1 val &= 0xfd;
1163 1 val |= (BYTE)scale;
1164 1 WriteDecoder( TW88_XYSCALEHI, val );
1165 1 }
1166
1167 void XScale2(DWORD scale)
1168 {
1169 1 if( scale==0x10000 ) { // No Scale
1170 2 XscaleU(0x10000);
1171 2 XscaleD(0x80);
C51 COMPILER V7.50 TW88 08/20/2007 10:23:35 PAGE 20
1172 2 }
1173 1 else if( scale<0x10000 ) { // Up Scale
1174 2 XscaleU(scale);
1175 2 XscaleD(0x80);
1176 2 }
1177 1 else { // Down Scale
1178 2 XscaleU(0x10000);
1179 2 XscaleD(scale/2/256);
1180 2 }
1181 1 }
1182
1183 void YScale2(DWORD scale)
1184 {
1185 1 BYTE val;
1186 1
1187 1 WriteDecoder( TW88_YUSCALEFINE, (BYTE)(scale));
1188 1
1189 1 scale >>= 8;
1190 1 WriteDecoder( TW88_YUSCALELO, (BYTE)(scale));
1191 1
1192 1 scale >>= 8;
1193 1 scale <<= 2;
1194 1 val = ReadDecoder(TW88_XYSCALEHI) & 0xf3;
1195 1 val |= (BYTE)scale;
1196 1 WriteDecoder( TW88_XYSCALEHI, val );
1197 1 }
1198 #endif // SUPPORT_PC || SUPPORT_DTV || WIDE_SCREEN
1199
1200 /**
1201 #if defined(SUPPORT_PC) || defined(SUPPORT_DTV)
1202 WORD GetYScale(void)
1203 {
1204 WORD scale;
1205 BYTE val;
1206
1207 scale = ReadDecoder(TW88_YUSCALELO);
1208 val = ReadDecoder(TW88_XYSCALEHI);
1209 val = (val >> 2) & 0x03;
1210 scale = scale + val*0x100;
1211
1212 return scale;
1213 }
1214 #endif // SUPPORT_PC || SUPPORT_DTV
1215 **/
1216
1217 //=============================================================================
1218 // Panel related..
1219 //=============================================================================
1220 /***
1221 #if (defined SERIAL) || (defined WIDE_SCREEN)
1222 void SetPVR(WORD pvr)
1223 {
1224 BYTE buf;
1225
1226 // TW8804 write LSByte first
1227 buf = ReadDecoder(0xbb) & 0x0f;
1228 buf = buf | ( (pvr>>4) & 0xf0 );
1229 WriteDecoder( 0xbb, buf );
1230
1231 WriteDecoder( 0xba, (BYTE)pvr );
1232 }
1233
C51 COMPILER V7.50 TW88 08/20/2007 10:23:35 PAGE 21
1234 void SetPHR(WORD phr)
1235 {
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -