📄 nvram.lst
字号:
C51 COMPILER V7.06 NVRAM 12/28/2004 10:14:02 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE NVRAM
OBJECT MODULE PLACED IN .\obj\NVRAM.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE source\NVRAM.C BROWSE INCDIR(.\include\;.\source\) DEBUG OBJECTEXTEND PRINT
-(.\NVRAM.lst) OBJECT(.\obj\NVRAM.obj)
stmt level source
1 #include <reg51.h>
2 #include "common.h"
3 #include "Struct.h"
4 #include "system.h"
5 #include "NVRam.h"
6 #include "TW101Reg.h"
7 #include "TwoWire.h"
8 //#include "OSDCtrl.h"
9 #include "KeyPad.h"
10 //#include "ModeCtrl.h"
11 //#include "ModeTbl.h"
12 #include "Video.h"
13
14 EEPVIDEO idata EepVideo;
15 #ifdef NVRAM
16 extern uWORD IDATA m_wBuff[3];
17 extern uCHAR IDATA m_cBuff[4];
18 #ifdef TV
19 extern bit m_bAir_Cable;
20 #endif
21 void EEPLoadPubData(void)
22 {
23 1 if(!(ReadPort()&kyMENU))
24 1 {
25 2 InitEEPRom();
26 2 OSDResetVideoData();
27 2 while(!(ReadPort()&kyMENU)) {};
28 2 }
29 1 else
30 1 {
31 2 if(I2CReadByte(0xA0, 0x00) != '1' || I2CReadByte(0xA0, 0x01)!= '0' || I2CReadByte(0xA0, 0x02)!= '1' )
32 2 {
33 3 InitEEPRom();
34 3 OSDResetVideoData();
35 3 }
36 2 else
37 2 I2CReadBytes(EEPVIDEOBLOCK, 0x04, (uCHAR *)&EepVideo, EEPVIDEOSIZE);
38 2 }
39 1 #ifdef TV
40 1 if(I2CReadByte(EEPVIDEOBLOCK, idVIDEO_FLAG_INDEX)&0x01)
41 1 {
42 2 m_bAir_Cable=1;
43 2 }
44 1 else
45 1 {
46 2 m_bAir_Cable=0;
47 2 }
48 1 #endif
49 1 OSDSetVideoValues();
50 1 EEPSaveVideoData();
51 1 }
52
53 void InitEEPRom(void)
54 {
C51 COMPILER V7.06 NVRAM 12/28/2004 10:14:02 PAGE 2
55 1 I2CWriteByte(EEPBLOCK0, 0x00, '1');
56 1 twdDelay(NVRDELAY);
57 1 I2CWriteByte(EEPBLOCK0, 0x01, '0');
58 1 twdDelay(NVRDELAY);
59 1 I2CWriteByte(EEPBLOCK0, 0x02, '1');
60 1
61 1 }
62
63 void OSDResetVideoData(void)
64 {
65 1 EepVideo.cBright = V_BRIGHT_DEF;
66 1 EepVideo.cContrast = V_CONTRAST_DEF ;
67 1 EepVideo.cSharp = V_SHARP_DEF;
68 1 EepVideo.cHue = V_HUE_DEF;
69 1 EepVideo.cSat = V_SAT_DEF;
70 1 EepVideo.cVolume = 0x80;
71 1 }
72
73 void OSDSetVideoValues(void)
74 {
75 1 // I2CWriteByte(VIDEO_ADDR,VSHARP,(I2CReadByte(VIDEO_ADDR,VSHARP)&0xF0)|EepVideo.cSharp);
76 1 #ifdef T100
// LoadFilter(EepVideo.cSharp);
#else
79 1 I2CWriteByte(TW101+4,0x80,V_SHARP_MSK|(EepVideo.cSharp<<1));
80 1 #endif
81 1 // I2CWriteByte(VIDEO_ADDR,VBRIGHT,EepVideo.cBright);
82 1 // I2CWriteByte(VIDEO_ADDR,VCONTRAST,EepVideo.cContrast);
83 1 I2CWriteByte(TW101,VBRIGHT,EepVideo.cBright);
84 1 I2CWriteByte(TW101,VCONTRAST,EepVideo.cContrast);
85 1 I2CWriteByte(VIDEO_ADDR,VSAT,EepVideo.cSat);
86 1 I2CWriteByte(VIDEO_ADDR,VHUE,EepVideo.cHue-0x80);
87 1 }
88
89 void EEPSaveVideoData(void)
90 {
91 1 I2CWriteByte(EEPVIDEOBLOCK, idVIDEO_CONTRAST_INDEX,EepVideo.cContrast );
92 1 twdDelay(NVRDELAY);
93 1 I2CWriteByte(EEPVIDEOBLOCK, idVIDEO_BRIGHT_INDEX, EepVideo.cBright);
94 1 twdDelay(NVRDELAY);
95 1 I2CWriteByte(EEPVIDEOBLOCK, idVIDEO_SHARP_INDEX, EepVideo.cSharp);
96 1 twdDelay(NVRDELAY);
97 1 I2CWriteByte(EEPVIDEOBLOCK, idVIDEO_HUE_INDEX, EepVideo.cHue);
98 1 twdDelay(NVRDELAY);
99 1 I2CWriteByte(EEPVIDEOBLOCK, idVIDEO_SAT_INDEX, EepVideo.cSat);
100 1 twdDelay(NVRDELAY);
101 1 I2CWriteByte(EEPVIDEOBLOCK, idVIDEO_VOLUME_INDEX, EepVideo.cVolume);
102 1 }
103 #ifdef TV
104
105 void EEPSaveTVChannel(uCHAR cTVNum, uWORD wTVFreq)
106 {
107 1 if(m_bAir_Cable)
108 1 {
109 2 I2CWriteByte(EEPVIDEOBLOCK+4, idTVCHANNEL_STAT+cTVNum*2, (uCHAR)(wTVFreq>>8));
110 2 twdDelay(NVRDELAY);
111 2 I2CWriteByte(EEPVIDEOBLOCK+4, idTVCHANNEL_STAT+cTVNum*2+1, (uCHAR)(wTVFreq&0x00FF));
112 2 twdDelay(NVRDELAY);
113 2 }
114 1 else
115 1 {
116 2 I2CWriteByte(EEPVIDEOBLOCK+2, idTVCHANNEL_STAT+cTVNum*2, (uCHAR)(wTVFreq>>8));
C51 COMPILER V7.06 NVRAM 12/28/2004 10:14:02 PAGE 3
117 2 twdDelay(NVRDELAY);
118 2 I2CWriteByte(EEPVIDEOBLOCK+2, idTVCHANNEL_STAT+cTVNum*2+1, (uCHAR)(wTVFreq&0x00FF));
119 2 twdDelay(NVRDELAY);
120 2 }
121 1 }
122
123
124
125 #endif
126 #endif
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 406 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 3
IDATA SIZE = 12 ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -