📄 userpref.lst
字号:
C51 COMPILER V8.01 USERPREF 11/28/2006 08:08:10 PAGE 1
C51 COMPILER V8.01, COMPILATION OF MODULE USERPREF
OBJECT MODULE PLACED IN ..\..\1out\UserPref.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\..\msFunc\UserPref.c BROWSE INCDIR(..\..\inc;..\..\mslib;..\..\Device;..
-\..\kernal;..\..\msFunc;..\..\pc;..\..\tv) DEBUG OBJECTEXTEND PRINT(..\..\1out\UserPref.lst) OBJECT(..\..\1out\UserPref.
-obj)
line level source
1
2 #define _USERPREF_C_
3
4 #include <math.h>
5 #include "types.h"
6 #include "board.h"
7 #include "global.h"
8 #include "nvram.h"
9 #include "DEBUG.h"
10 #include "menudef.h"
11 #include "menufunc.h"
12 #include "i2c.h"
13 #include "tv.h"
14 #include "panel.h"
15 #include "mstar.h"
*** WARNING C322 IN LINE 93 OF ..\..\INC\MSTAR.H: unknown identifier
16 #include "msAce.h"
17 #include "adjust.h"
18 #include "userpref.h"
19 #include "ms_rwreg.h"
20 #define HFreq_Tol 16 // 1.6 KHz
21 #define VFreq_Tol 8 // 0.8 Hz
22
23
24 BYTE usrCalCheckSum(BYTE *pBuf, BYTE ucBufLen)
25 {
26 1 BYTE CheckSum;
27 1 CheckSum = 0;
28 1 do
29 1 {
30 2 CheckSum += pBuf[ucBufLen-1];
31 2 ucBufLen--;
32 2 }
33 1 while(ucBufLen);
34 1
35 1 return CheckSum;
36 1 }
37
38 #if VGA_ENABLE
39 void InitPCSetting(void)
40 {
41 1 g_PcSetting.Brightness=DefBrightness;
42 1 g_PcSetting.Contrast=DefContrast;
43 1
44 1 g_PcSetting.AdcRedGain=0x80;
45 1 g_PcSetting.AdcGreenGain=0x80;
46 1 g_PcSetting.AdcBlueGain=0x80;
47 1 g_PcSetting.AdcRedOffset=0x80;
48 1 g_PcSetting.AdcGreenOffset=0x80;
49 1 g_PcSetting.AdcBlueOffset=0x80;
50 1
51 1 g_PcSetting.SavedModeIndex=UserModeNumber;
52 1 }
C51 COMPILER V8.01 USERPREF 11/28/2006 08:08:10 PAGE 2
53 #endif
54
55 void InitVideoSetting(void)
56 {
57 1 //putstr("\r\nInit Video Setting!");
58 1 g_VideoSetting.ucVersion=VideoVersion;
59 1
60 1 g_VideoSetting.Language=0;
61 1 g_VideoSetting.OsdHStart=50;
62 1 g_VideoSetting.OsdVStart=50;
63 1 g_VideoSetting.InputType=Input_CVBS1;
64 1
65 1 g_VideoSetting.volume=50;
66 1 g_VideoSetting.MuteStatus=0;
67 1
68 1 g_VideoSetting.MonitorFlag=bPowerOnBit;
69 1
70 1 g_VideoSetting.VideoBrightness = DefVideoBrightness;
71 1 g_VideoSetting.VideoContrast = DefVideoContrast;
72 1 g_VideoSetting.VideoSaturation = DefVideoSaturation;
73 1 g_VideoSetting.VideoHue = DefVideoHue;
74 1 g_VideoSetting.VideoSharpness= 2;
75 1
76 1 g_VideoSetting.DOWN=0;
77 1 g_VideoSetting.Scaling=Scaling_Full;
78 1 g_VideoSetting.TunerAGC=0x10;
79 1
80 1 g_VideoSetting.OsdTime=2;
81 1 g_VideoSetting.VideoColorSys=0;
82 1 g_VideoSetting.videoAGC=8;
83 1
84 1 #if TV_ENABLE
85 1 g_TVChSetting.ucCurChannelNO =0;
86 1 g_TVChSetting.ucPreChannelNO =0;
87 1 g_TVChSetting.ucMaxValidChNum =0;
88 1 #endif
89 1 }
90
91 void SaveVideoSetting(void)
92 {
93 1 //putstr("\r\nSave Video Setting!");
94 1 g_VideoSetting.Checksum= usrCalCheckSum((BYTE *)&g_VideoSetting, (VideoSettingSize - CheckSumSize));
95 1 NVRam_WriteTbl(VideoSettingAddr, (BYTE*)&g_VideoSetting, VideoSettingSize);
96 1 }
97
98 #if VGA_ENABLE
99 void SavePCSetting(void)
100 {
101 1 g_PcSetting.Checksum= usrCalCheckSum((BYTE *)&g_PcSetting, PCSettingSize - CheckSumSize);
102 1 NVRam_WriteTbl(PCSettingAddr, (BYTE*)&g_PcSetting, PCSettingSize);
103 1 }
104
105 void LoadPCSetting(void)
106 {
107 1 BYTE ucCheckSum;
108 1
109 1 #ifndef TempMask
110 1 NVRam_ReadTbl(PCSettingAddr, (BYTE*)&g_PcSetting, PCSettingSize);
111 1 #endif
112 1 ucCheckSum=usrCalCheckSum((BYTE *)&g_PcSetting, PCSettingSize - CheckSumSize);
113 1
114 1 if(g_PcSetting.Checksum!=ucCheckSum)
C51 COMPILER V8.01 USERPREF 11/28/2006 08:08:10 PAGE 3
115 1 {
116 2 InitPCSetting();
117 2 SavePCSetting();
118 2 }
119 1 }
120 #endif
121
122 void msChipVersionRead(void)
123 {
124 1 BYTE ucBank,i=5;
125 1 BYTE ucChip_D_Version=0;
126 1 ucBank=msReadByte(BK0_00_REGBK);
*** ERROR C202 IN LINE 126 OF ..\..\MSFUNC\USERPREF.C: 'BK0_00_REGBK': undefined identifier
127 1 msWriteByte(BK0_00_REGBK, REG_BANK_SCALER);
*** ERROR C202 IN LINE 127 OF ..\..\MSFUNC\USERPREF.C: 'BK0_00_REGBK': undefined identifier
128 1
129 1 while(i--)
130 1 {
131 2 if (msReadByte(BK0_F1_CHIP_VERSION)==0x03)
*** ERROR C202 IN LINE 131 OF ..\..\MSFUNC\USERPREF.C: 'BK0_F1_CHIP_VERSION': undefined identifier
132 2 {
133 3 WatchDogClear();
134 3
135 3 ucChip_D_Version++;
136 3 }
137 2 }
138 1
139 1 if(ucChip_D_Version>3)
140 1 VD_Type=MARIA2_D;
141 1 else
142 1 VD_Type=MARIA2_B;
143 1
144 1 msWriteByte(BK0_00_REGBK, ucBank);
*** ERROR C202 IN LINE 144 OF ..\..\MSFUNC\USERPREF.C: 'BK0_00_REGBK': undefined identifier
145 1 }
146
147 #if RM_EEPROM_TYPE<RM_TYPE_SST512
148 void LoadVideoSetting(void)
149 {
150 1 BYTE ucCheckSum;
151 1
152 1 //putstr("\r\nLoad Video Setting!");
153 1 NVRam_ReadTbl(VideoSettingAddr, (BYTE*)&g_VideoSetting, VideoSettingSize);
154 1 ucCheckSum=usrCalCheckSum((BYTE *)&g_VideoSetting, VideoSettingSize - CheckSumSize);
155 1
156 1 if(g_VideoSetting.Checksum!=ucCheckSum)
157 1 {
158 2 InitVideoSetting();
159 2 SaveVideoSetting();
160 2 }
161 1 }
162
163 BOOL CheckBoard(void)
164 {
165 1 BYTE i=5,j=5, temp;
166 1 BOOL VideoSumOk, BoardSumOK;
167 1
168 1 while(i--)
169 1 {
170 2 NVRam_ReadByte(nvrVideoAddr(ucVersion), &(g_VideoSetting.ucVersion));
171 2
172 2 if (g_VideoSetting.ucVersion==VideoVersion)
C51 COMPILER V8.01 USERPREF 11/28/2006 08:08:10 PAGE 4
173 2 {
174 3 VideoSumOk=TRUE;
175 3 break;
176 3 }
177 2 else
178 2 VideoSumOk=FALSE;
179 2 }
180 1
181 1 #if RM_EEPROM_TYPE<RM_TYPE_SST512
182 1 while(j--)
183 1 {
184 2 NVRam_ReadByte(BoardChkSumAddr, &temp);
185 2
186 2 if (temp==BoardVersion)
187 2 {
188 3 BoardSumOK=TRUE;
189 3 break;
190 3 }
191 2 else
192 2 BoardSumOK=FALSE;
193 2 }
194 1 #endif
195 1
196 1 printf("\r\nBoardVer<%x>", temp);
197 1
198 1 if(BoardSumOK&&VideoSumOk)
199 1 return TRUE;
200 1 else
201 1 return FALSE;
202 1 }
203
204
205 void ReadSetting(void)
206 {
207 1 BOOL tempValue;
208 1 tempValue=CheckBoard();
209 1
210 1 if (tempValue)
211 1 {
212 2 #if VGA_ENABLE
213 2 LoadPCSetting();
214 2 #endif
215 2 LoadVideoSetting();
216 2 }
217 1 else
218 1 {
219 2 putstr("\r\nUpdate!");
220 2 #if VGA_ENABLE
221 2 InitPCSetting();
222 2 SavePCSetting();
223 2 InitSaveModeFlag();
224 2 #endif
225 2
226 2 InitVideoSetting();
227 2 SaveVideoSetting();
228 2
229 2 #if TV_ENABLE
230 2 SaveChannelNumberSetting();
231 2 EraseEepromTvFlag(0);
232 2 #endif
233 2
234 2 #if RM_EEPROM_TYPE<RM_TYPE_SST512
C51 COMPILER V8.01 USERPREF 11/28/2006 08:08:10 PAGE 5
235 2 NVRam_WriteByte(BoardChkSumAddr, BoardVersion);
236 2 #endif
237 2 }
238 1
239 1 #if TV_ENABLE
240 1 ReadChannelNumberSetting();
241 1 #endif
242 1 }
243 #else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -