📄 osdbasic.lst
字号:
C51 COMPILER V7.50 OSDBASIC 08/20/2007 10:23:32 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE OSDBASIC
OBJECT MODULE PLACED IN Osdbasic.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE Osdbasic.c COMPACT OPTIMIZE(9,SIZE)
line level source
1 //osd_basic.c
2 // ver0.11 2/1x/2001 Change display format from hex to decimal
3 // 1.32 LJY11262001 .Add border features to OSD window
4 // 1.70 LJY05302003 .Support a menu with external OSD.
5
6 #include "Config.h"
7
8 #include "typedefs.h"
9 #include "i2c.h"
10 #include "main.h"
11 #include "tw88.h"
12
13 #include "osdbasic.h"
14 #include "dispinfo.h"
15 #include "measure.h"
16 #include "debug.h"
17 #include "printf.h"
18 #include "udfont.h"
19 #include "regmap.h"
20
21 extern CODE struct RegisterInfo UserRange;
22
23 ///#ifdef TW8803
24 CODE BYTE ZoomAttr[]={ 0, 0, 0x40, 0x80, 0xc0 };
25 ///#else
26 ///CODE BYTE ZoomAttr[]={ 0, 0, 0x04, 0x08, 0x0c };
27 ///#endif
28
29 //IDATA struct BarInfo BarInfo;
30 IDATA struct OSDStrInfo OSDStrInfo;
31 extern bit I2CAutoIncFlagOn ;
32
33 //extern IDATA BYTE I2CAddr, I2CIdx, I2CData;
34
35
36
37
38 //********************************************************************
39 //
40 // Font
41 //
42 //********************************************************************
43 //----------------------------------------------------------------
44 // Data2FontRAM
45 //----------------------------------------------------------------
46 //
47 // The followings are structure of FONT RAM
48 // ........... 1 byte .....................................
49 // -------------------------------------------------------- .
50 // | First 32 byte data for every characters in FONT RAM | .
51 // | That is, first 1 byte data for first font char, | .
52 // | first 1 byte data for second font char, | 32 bytes
53 // | first 1 byte data for third font char. | .
54 // | .. | .
55 // | .. | .
C51 COMPILER V7.50 OSDBASIC 08/20/2007 10:23:32 PAGE 2
56 // -------------------------------------------------------- .
57 // | Second 32 byte data for every characters in FONT RAM | .
58 // | That is, second 1 byte data for first font char, | .
59 // | second 1 byte data for second font char, | 32 bytes
60 // | second 1 byte data for third font char. | .
61 // | .. | .
62 // | .. | .
63 // -------------------------------------------------------- .
64 // | | .
65 // | | .
66 // | | .
67 // | | .
68 // | | .
69 // | | .
70 // | | .
71 // | | .
72 // | | .
73 // | | .
74 // | | .
75 // | | .
76 // | | .
77 // | | .
78 // | | .
79 // -------------------------------------------------------- 1024 bytes
80 //
81
82
83
84 /*
85 void ClearOSDRAM(BYTE attr)
86 {
87 WriteTW88(TW88_OSDRAMDATALO, attr);
88 WriteTW88(TW88_ENABLERAM, 0x02); // OSD RAM Auto Clear with attr.
89
90 while( ReadTW88(TW88_ENABLERAM) & 0x02 );
91 }
92 */
93 void WaitEndofDisplayArea(void)
94 {
95 1 #ifdef TW8804D
96 1 BYTE ret,i;
97 1
98 1 ret = ReadTW88(OSDWINSTATUS) & 0x40;
99 1
100 1 for(i=0;i<10;i++){
101 2 if( ret^ (ReadTW88(OSDWINSTATUS)&0x40)) break;
102 2 }
103 1 #endif
104 1
105 1 }
106
107 //=============================================================================
108 // Download OSD Color Look up
109 //=============================================================================
110 void Change_OSDColorLookup(void)
111 {
112 1 BYTE i,j,dt;
113 1 #ifdef DEBUG_CCEDS
Printf("\r\n --- Change_OSDColorLookup to Table ");
#endif
116 1 for(j=0; j<2; j++) {
117 2 for(i=0; i<8; i++) {
C51 COMPILER V7.50 OSDBASIC 08/20/2007 10:23:32 PAGE 3
118 3 dt = ReadTW88(0x9c);
119 3 dt &= 0xf0;
120 3 WriteTW88(0x9c, i+j*8);
121 3 WriteTW88(0x9d, OSD_Color_LookUp_Data_Table[j][i]);
122 3 }
123 2 }
124 1 }
125
126 #ifdef SUPPORT_TW88_CC_DECODER
void Reset_OSDColorLookup(void)
{
BYTE i,dt;
CODE BYTE tt[] = {0x00,0x03,0x1C,0x1F,0xE0,0xE3,0xFC,0xFF};
#ifdef DEBUG_CCEDS
Printf("\r\n --- Reset_OSDColorLookup");
#endif
for(i=0; i<8; i++) {
dt = ReadTW88(0x9c);
dt &= 0xf0;
WriteTW88(0x9c, i);
WriteTW88(0x9d, tt[i]);
}
}
#endif
143 //=============================================================================
144 // Download RAM Font Data
145 //=============================================================================
146 void DownloadFont(BYTE cod, CODE_P BYTE *fontdata)
147 {
148 1 WriteTW88(TW88_ENABLERAM, ReadTW88(TW88_ENABLERAM) | 0x01); // Font RAM access mode
149 1 WriteTW88(TW88_FONTRAMADDR, cod);
150 1
151 1 WriteTW88(0xff, ReadTW88(0xff) | 0x10); // Disable I2C index auto increment during multi-write
152 1 WriteI2Cn( TW88I2CAddress, TW88_FONTRAMDATA, fontdata, 27 );
153 1
154 1 WriteTW88(TW88_ENABLERAM, ReadTW88(TW88_ENABLERAM) & 0xfe); // OSD RAM access mode
155 1 }
156
157 void DownloadUDFont(void)
158 {
159 1 BYTE i;
160 1
161 1 WriteTW88(TW88_MULTISTART, COLORFONT_START); // Set Color Font Start Address.
162 1
163 1 for(i=0; i< NO_UDFONT && i<= MAX_FONT_RAM_CHARS ; i++) {
164 2 DownloadFont(i, RAMFONTDATA[i]);
165 2 }
166 1 }
167
168 //*****************************************************************************
169 // OSD Window internal subfunction for TW88xx
170 //*****************************************************************************
171 #ifdef SUPPORT_TW88_CC_DECODER
void EnableOSDRAMAndChangeFont(BYTE type)
{
BYTE dt;
dt = ReadTW88(TW88_ENABLERAM);
if( type==FONT_ROM ) dt &= 0x7f;
else dt |= 0x80;
WriteTW88(TW88_ENABLERAM, dt);
C51 COMPILER V7.50 OSDBASIC 08/20/2007 10:23:32 PAGE 4
}
#endif
183 //*****************************************************************************
184 // Functions for TW88xx internal OSD
185 //*****************************************************************************
186 #ifdef SUPPORT_CCD_VCHIP
void ClearOSD_TW88()
{
BYTE i;
for(i=1; i<=MAX_OSDWINDOW_TW88; i++) {
ShowOSDWindow_TW88(i,FALSE);
}
}
#endif
196 //-----------------------------------------------------------------------------
197 // CreateOSDWindow_TW88
198 // winno: 1,2,3,4
199 // x: based on pixel not char.(8 pixels per 1 step).
200 // y: based on lines not char.(4 lines per 1 step).
201 // w: based on char.(1 character width per 1 step)
202 // h:
203 // sa: start address
204 // attr: BG_COLOR | ZOOM | SHOW
205 //-----------------------------------------------------------------------------
206 /*#ifdef SUPPORT_CCD_VCHIP
207 void CreateOSDWindow_TW88(BYTE winno, BYTE x, BYTE y, BYTE w, BYTE h, WORD sa, BYTE attr)
208 {
209 BYTE zoom_attr, new_attr;
210
211 if( winno<1 || winno>8 ) return;
212 SetOSDWindowNum(winno); // * set winno
213
214 SetOSDWindowX_TW88(winno, x); // * set x
215 SetOSDWindowY_TW88(winno, y); // * set y
216
217 WriteTW88(TW88_WINWIDTH, w); // * set w width(1 character width per 1 step)
218 WriteTW88(TW88_WINHEIGHT, h); // * set h height(1 character height per 1 step)
219
220 zoom_attr = (attr & 0x07)-1;
221 zoom_attr = zoom_attr*0x40 + zoom_attr*0x10 + (sa>>8);
222 WriteTW88(TW88_WINZOOM, zoom_attr);
223
224 WriteTW88(TW88_WINSADDRLO, sa); // * set sa start address of OSD RAM
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -