📄 main.lst
字号:
C51 COMPILER V7.50 MAIN 04/01/2008 15:02:15 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\Output\Main.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE Main.c COMPACT OPTIMIZE(9,SIZE) BROWSE MODDP2 INCDIR(.\Include\) DEFINE(INT
-ERNAL_MCU) DEBUG OBJECTEXTEND PRINT(.\Source\Main.lst) OBJECT(.\Output\Main.obj)
line level source
1 /*****************************************************************************/
2 /* */
3 /* TW880x Demo Board Techwell,Inc */
4 /* */
5 /* CPU : Winbond 78E62BP-40 */
6 /* LANGUAGE : Tasking C / Keil C */
7 /* PROGRAMMER : Jooyeon Lee / Harry Han */
8 /* */
9 /*****************************************************************************/
10 /* See 'Release.txt' for firmware revision history */
11
12 #include "Config.h"
13
14 #include "reg.h"
15 #include "typedefs.h"
16 #include "main.h"
17 #include "tw88.h"
18 #include "i2c.h"
19 #include "adc.h"
20 #include "osdbasic.h"
21 #include "dispinfo.h"
22 #include "etc_eep.h"
23 #include "measure.h"
24 #include "Printf.h"
25 #include "audio.h"
26 #include "osdmenu.h"
27 #include "pc_eep.h"
28 #include "KeyRemo.h"
29 #include "Monitor.h"
30 #include "CPU.h"
31
32 #include "rgbmix.h"
33 #include "panel.h"
34 #ifdef SUPPORT_TV
35 #include "Tuner.h"
36 #endif
37 #include "measure.h" // Hans
38
39
40 void Loader(BYTE);
41
42 #ifdef SUPPORT_GAMMA
extern CODE BYTE GammaRed[];
extern CODE BYTE GammaBlue[];
extern CODE BYTE GammaGreen[];
#endif
47
48 extern DATA WORD tic_pc;
49
50 extern IDATA BYTE cSourceState; // Hans
51
52 extern IDATA BYTE PcMode;
53
54 IDATA BYTE InputSelection;
C51 COMPILER V7.50 MAIN 04/01/2008 15:02:15 PAGE 2
55 // IDATA BYTE InputSelectionInx = 0;
56 /// bit PcDetectFlag = 1;
57 // bit PowerMode = ON;
58 IDATA WORD IVF;
59 IDATA DWORD IHF;
60 IDATA BYTE VInputStd;
61
62 bit Range4Coarse=0, AutoDetect=1;
63 BYTE VInputStdDetectMode;
64 BYTE CheckBuf;
65
66 CODE struct struct_IdName struct_InputSelection[]={
67 { UNKNOWN , "" }, //don't remove or change this.
68 { COMPOSITE , "CVBS" }, //don't remove or change this.
69
70 // you can change the order of the followings
71 #ifdef SUPPORT_SVIDEO
72 { SVIDEO , "S-Video" },
73 #endif
74
75 #ifdef SUPPORT_COMPONENT
76 { COMPONENT , "Component" },
77 #endif
78
79 #ifdef SUPPORT_DTV
{ DTV , "DTV-SOG" },
#endif
82
83 #ifdef SUPPORT_TV
84 { TV , "TV " },
85 #endif
86
87 #ifdef SUPPORT_PC
88 { PC , "PC-HV"},
89 #endif
90
91 #ifdef SUPPORT_DIGITALVGA
{ DIGITALVGA , "DVI" },
#endif
94
95 {0 , ""}, //don't remove or change this.
96 };
97
98
99 CODE struct struct_IdName struct_VInputStd[]={
100 { UNKNOWN , "" }, //don't remove or change this.
101 { NTSC, "NTSC"}, //don't remove or change this.
102
103 #ifdef SUPPORT_PAL
104 { PAL, "PAL"},
105 #endif
106
107 #ifdef SUPPORT_SECAM
108 { SECAM, "SECAM"},
109 #endif
110
111 #ifdef SUPPORT_PALM
112 { PALM, "PALM"},
113 #endif
114
115 #ifdef SUPPORT_PALN
116 { PALN, "PALN"},
C51 COMPILER V7.50 MAIN 04/01/2008 15:02:15 PAGE 3
117 #endif
118
119 #ifdef SUPPORT_PAL60
120 { PAL60, "PAL60"},
121 #endif
122
123 #ifdef SUPPORT_NTSC4
124 { NTSC4, "NTSC4.43"},
125 #endif
126
127 {0 , ""}, //don't remove or change this.
128 };
129
130
131
132 //===================== OSD ===================================================
133 WORD OSDLastKeyInTime; // in ms
134 //===================== Button Key ============================================
135
136 //================= Etc. ======================================================
137 #ifdef WIDE_SCREEN
138 BYTE WideScreenMode;
139 #endif
140 BYTE DebugLevel;
141
142 bit Flag4AutoPanelRegs = 0;
143 bit I2CAutoIncFlagOn = 0;
144 #ifdef SUPPORT_COMPONENT
145 IDATA BYTE ComponentMode;
146 #endif
147 extern BYTE TVInputSel;
148
149 #ifdef NO_INITIALIZE
150 bit NoInitAccess=0;
151 #endif
152 #ifdef INTERNAL_MCU
153 extern WORD TW88IRQ;
154 #endif
155
156 bit DisplayInputHold = 0;
157
158
159 //////////////////////////////////////////////////////////////////////////////
160
161 //=============================================================================
162 // Prompt
163 //=============================================================================
164 #ifdef SUPPORT_GAMMA
#include "Gamma.c"
void DownLoadGamma(void)
{
// Red
WriteI2C(TW88I2CAddress, 0xf0, 0xe8|1 );
WriteI2C(TW88I2CAddress, 0xf1, 0x00); // Start Address
WriteI2C(TW88I2CAddress, 0xf2, GammaRed[0]); //
WriteI2Cn(TW88I2CAddress, 0xf2, &GammaRed[1], 255);
// Blue
WriteI2C(TW88I2CAddress, 0xf0, 0xe8|2 );
WriteI2C(TW88I2CAddress, 0xf1, 0x00); // Start Address
WriteI2C(TW88I2CAddress, 0xf2, GammaGreen[0]); //
C51 COMPILER V7.50 MAIN 04/01/2008 15:02:15 PAGE 4
WriteI2Cn(TW88I2CAddress, 0xf2, &GammaGreen[1], 255);
// Red
WriteI2C(TW88I2CAddress, 0xf0, 0xe8|3 );
WriteI2C(TW88I2CAddress, 0xf1, 0x00); // Start Address
WriteI2C(TW88I2CAddress, 0xf2, GammaBlue[0]); //
WriteI2Cn(TW88I2CAddress, 0xf2, &GammaBlue[1], 255);
}
#endif
188
189 void I2CDeviceInitialize( CODE_P BYTE *RegSet)
190 {
191 1 int cnt=0;
192 1 BYTE addr, index, val;
193 1
194 1 addr = *RegSet;
195 1 #ifdef DEBUG_TW88
dPrintf("\r\nI2C address : %02x", (WORD)addr);
#endif
198 1 cnt = *(RegSet+1);
199 1 RegSet+=2;
200 1
201 1 while (( RegSet[0] != 0xFF ) || ( RegSet[1]!= 0xFF )) { // 0xff, 0xff is end of data
202 2 index = *RegSet;
203 2 val = *(RegSet+1);
204 2 WriteI2C(addr, index, val);
205 2
206 2 #ifdef DEBUG_TW88
dPrintf("\r\n addr=%02x index=%02x val=%02x", (WORD)addr, (WORD)index, (WORD)val );
#endif
209 2
210 2 RegSet+=2;
211 2 }
212 1 WriteTW88(0xff, 0x00); // set page 0
213 1 }
214
215 extern CODE struct RegisterInfo UserRange;
216 extern CODE struct RegisterInfo VideoContrastRange;
217 extern CODE struct RegisterInfo VideoBrightnessRange;
218 extern CODE struct RegisterInfo VideoSaturationRange;
219 extern CODE struct RegisterInfo VideoHueRange;
220 extern CODE struct RegisterInfo VideoSharpnessRange;
221 extern CODE struct RegisterInfo DigitalVideoSaturationRange;
222
223 #ifdef ADD_ANALOGPANEL
BYTE IsAnalogOn(void)
{
if(DIP_PANEL_SWITCH==0) return 1;
else return 0;
}
#endif
230
231 /*********************************/
232 BYTE IsNoInput(void)
233 {
234 1 if( ReadDecoder(CSTATUS) & 0x80 ) return 1;
235 1 return 0;
236 1 }
237
238 #ifdef ID_CHECK_BY_FW
BYTE Is50Hz(void)
{
C51 COMPILER V7.50 MAIN 04/01/2008 15:02:15 PAGE 5
if( ReadDecoder(CSTATUS) & 0x01 ) return 1;
return 0;
}
BYTE Slock(void)
{
if( ReadDecoder(CSTATUS) & 0x20 ) return 1;
return 0;
}
#endif // ID_CHECK_BY_FW
251
252 BYTE ReadVInputSTD(void)
253 {
254 1 BYTE std;
255 1
256 1 if( IsNoInput() ) return 1; // Noinput!!
257 1
258 1 std = ReadDecoder(0x1c) & 0xf0;
259 1 if( std & 0x80 ) return 1; // Detection in progress..
260 1 else
261 1 return ((( std & 0x70 ) >> 4 ) + 1 );
262 1 }
263
264 BYTE GetVInputStdInx(void)
265 {
266 1 BYTE i, std;
267 1
268 1 std = ReadVInputSTD();
269 1
270 1 switch( std ) {
271 2
272 2 case NTSC4:
273 2 case PALM:
274 2 case PAL60:
275 2 case NTSC: IVF = 60; IHF = 15723; break; // 15734
276 2
277 2 case SECAM:
278 2 case PALN:
279 2 case PAL: IVF = 50; IHF = 15723; break; // 15625
280 2 default: IVF = 0; IHF = 0; break;
281 2 }
282 1
283 1 for(i=0; ; i++) {
284 2 if( struct_VInputStd[i].Id ==std )
285 2 return i;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -