📄 osdtune.lst
字号:
C51 COMPILER V6.23a OSDTUNE 09/10/2004 16:09:05 PAGE 1
C51 COMPILER V6.23a, COMPILATION OF MODULE OSDTUNE
OBJECT MODULE PLACED IN OSDTUNE.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE OSDTUNE.C OPTIMIZE(6,SIZE) ORDER DEFINE(DEBUGMSG=0,DEBUGTOOL=0) DEBUG OBJEC
-TEXTEND CODE SYMBOLS
stmt level source
1 /************************************************
2 * *
3 * OSDTUNE.C: Auto tuning From David *
4 * *
5 *************************************************/
6
7 #include <reg51.h>
8 #include <math.h>
9 #include "mascot.h"
10 #include "OSD.h"
11 #include "global.h"
12
13
14
15 /******************************************
16 * Auto Tuning Adjustment *
17 *******************************************/
18 void autoTune(unsigned char options)
19 {
20 1
21 1 #if DEBUGMSG
printf("AutoTune\n");
#endif
24 1
25 1 RegByteOut(0xB0, 0x00); // Disable calibration
26 1 CalibSuccess = 1;
27 1 disableDigitalFilter();
28 1
29 1
30 1 // tune HV
31 1 if (options & OPTIONCENTER)
32 1 {
33 2 initCalibration();
34 2 hvCalibration(options);
35 2 }
36 1
37 1 // checkPowerOffButton(); // auto powerkey disable by seven 030619
38 1 // if (!(eepData.MascotFlag & FLAG_POWERSTATUS)) return;
39 1
40 1
41 1 // tune pitch and phaseHW
42 1 if (options & OPTIONPITCH)
43 1 {
44 2 pitchCalibration(); // tune pitch
45 2 if (!(eepData.MascotFlag & FLAG_POWERSTATUS))
46 2 return;
47 2
48 2 phaseHWCalibration(); // tune phase
49 2 if (!(eepData.MascotFlag & FLAG_POWERSTATUS))
50 2 return;
51 2
52 2 if(pitchCalibration()) // tune pitch
53 2 {
54 3 if (!(eepData.MascotFlag & FLAG_POWERSTATUS))
C51 COMPILER V6.23a OSDTUNE 09/10/2004 16:09:05 PAGE 2
55 3 return;
56 3 phaseHWCalibration(); // tune phase
57 3
58 3 if(pitchCalibration()) // tune pitch
59 3 {
60 4 if (!(eepData.MascotFlag & FLAG_POWERSTATUS))
61 4 return;
62 4 phaseHWCalibration(); // tune phase
63 4 }
64 3 }
65 2 }
66 1
67 1 // checkPowerOffButton(); // auto powerkey disable by seven 030619
68 1 // if (!(eepData.MascotFlag & FLAG_POWERSTATUS)) return;
69 1
70 1
71 1 tunePhaseFlag = 0;
72 1
73 1 #if TUNE_PITCH_WITH_PHASE
if ((options & OPTIONPITCH)&&(eepModeData.pitch % 8))
{
tunePhaseFlag = 1;
pitchCalibwithPhase();
}
#endif
80 1
81 1
82 1 // tune phase
83 1 if (options & OPTIONPHASE)
84 1 {
85 2 if (CurrentWidth >= 1024) // by seven 030424
86 2 phaseCalibration(0x07); // by seven 030718
87 2 else if (tunePhaseFlag)
88 2 phaseHWCalibration();
89 2 }
90 1
91 1 // checkPowerOffButton(); // auto powerkey disable by seven 030619
92 1 // if (!(eepData.MascotFlag & FLAG_POWERSTATUS)) return;
93 1
94 1 enableDigitalFilter();
95 1
96 1
97 1 // tune HV
98 1 if (options & OPTIONCENTER)
99 1 {
100 2 initCalibration();
101 2 hvCalibration(options);
102 2 }
103 1
104 1 // checkPowerOffButton(); // auto powerkey disable by seven 030619
105 1 // if (!(eepData.MascotFlag & FLAG_POWERSTATUS)) return;
106 1
107 1
108 1
109 1 #if DEBUGMSG
printf("AutoTune %s\n", CalibSuccess?"DONE":"FAIL");
#endif
112 1 }
113
114 /************************************************
115 * initial Calibration setting *
116 *************************************************/
C51 COMPILER V6.23a OSDTUNE 09/10/2004 16:09:05 PAGE 3
117 void initCalibration(void)
118 {
119 1 unsigned int vTotal;
120 1
121 1 #if (DEBUGMSG>=2)
printf("\n ### Total Calib,\n");
#endif
124 1
125 1 RegByteOut(0xB1, 0x80); // use threshold
126 1 RegByteOut(0xB9, 0x30); // threshold value
127 1 RegByteOut(0xB2, COLORCMPMASK); // Set color compare mask
128 1
129 1 RegByteOut(0xB0, 0x01); // Enable total calibration
130 1 RegByteOut(0x00, 0x00); // Clear the calibration status reg
131 1
132 1 if ( waitCalibReady(0x01) )
133 1 {
134 2 RegDataIn(0xD0, buff+8, 3);
135 2 hTotal = ((unsigned int)(buff[10]&0x70)<<4) +buff[9];
136 2 vTotal = ((unsigned int)(buff[10]&0x07)<<8) +buff[8];
137 2 }
138 1
139 1
140 1 #if (DEBUGMSG>=2)
printf("hTotal=%04X/%d vTotal=%04X/%d\n", hTotal,hTotal,vTotal,vTotal);
#endif
143 1
144 1
145 1 // Set cal area
146 1 buff[8] = HCALSTART; // Cal H Start [7:0]
147 1 buff[9] = hTotal; // Cal H End [7:0]
148 1 buff[10] = ((hTotal>>4)&0xF0)+((HCALSTART>>8)&0x0F);//Cal H Start/End [10:8]
149 1 buff[11] = VCALSTART; // Cal V Start [7:0]
150 1 buff[12] = vTotal; // Cal V End [7:0]
151 1 buff[13] = ((vTotal>>4)&0xF0)+((VCALSTART>>8)&0x0F);//Cal V Start/End [10:8]
152 1 RegDataOut(0xB3, buff+8, 6);
153 1 RegByteOut(0xB0, 0x00); // Disable total calibration
154 1 RegByteOut(0x00, 0x00); // Clear the calibration status reg
155 1 }
156
157
158
159
160
161 /************************************************
162 * Vertical Calibration *
163 *************************************************/
164
165 #define hStart ival1
166 #define hWidth ival2
167
168
169 void hvCalibration(unsigned char options)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -