📄 main.lst
字号:
C51 COMPILER V7.50 MAIN 10/03/2008 17:53:14 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN ..\hex\main.obj
COMPILER INVOKED BY: D:\Program Files\KEIL_UV3\C51\BIN\C51.EXE main.c LARGE OPTIMIZE(SIZE) BROWSE DEBUG OBJECTEXTEND COD
-E OBJECT(..\hex\main.obj)
line level source
1 // *******************************************
2
3 // *******************************************
4
5 #include <stdio.h>
6 #include <string.h>
7 #include "i2c_intf.h"
8 #include "uart_int.h"
9 #include "mcu.h"
10 #include "timer.h"
11 #include "DP_RX_DRV.h"
12 #include "DP_RX_API.h"
13
14
15
16 #define DEF_DEBUG_MODE 0
17
18 char argc;
19 char *argv[3];
20 bit debug_mode;
21 bit enable_information;
22 bit port_sel;
23
24
25 void decode_term_str(void);
26 int hex_to_int(char *s);
27 void proc_term_cmd();
28 extern uchar CommandProcess ();
29 uchar debug_comm_tx();
30
31 void serial_isr(void) interrupt 4
32 {
33 1 UART_ISR(); _NOP_;
34 1 }
35
36 void timer1_isr(void) interrupt 1
37 {
38 1 timer_isr(); _NOP_;
39 1 }
40
41
42 uchar debug_comm_init()
43 {
44 1 DP_RX_WriteI2C_RX0(0,0xff);
45 1 DP_RX_WriteI2C_RX0(1,0xff);
46 1 DP_RX_WriteI2C_RX0(2,0xff);
47 1 DP_RX_WriteI2C_RX0(3,0xff);
48 1 DP_RX_WriteI2C_RX0(4,0xff);
49 1 DP_RX_WriteI2C_RX0(5,0xff);
50 1 }
*** WARNING C173 IN LINE 50 OF MAIN.C: missing return-expression
51 uchar debug_comm_tx()
52 {
53 1 command_buf[0]=0x2a;
C51 COMPILER V7.50 MAIN 10/03/2008 17:53:14 PAGE 2
54 1 command_buf[1]=0x52;
55 1 command_buf[2]=0x50;
56 1 command_buf[3]=0x00;
57 1 command_buf[4]=0x08;
58 1 command_buf[5]=0x0d;
59 1 sendRQ=1;
60 1 }
*** WARNING C173 IN LINE 60 OF MAIN.C: missing return-expression
61
62
63
64 void main ()
65 {
66 1 uchar temp[16]="DPRX_BOCOM_V1_0";
67 1 enable_debug_output = 1; // 1 enable debug information
68 1 debug_mode = DEF_DEBUG_MODE; // 1 debug on , 0 debug off
69 1 enable_information = 1;
70 1 InitMCU ();
71 1
72 1
73 1 SendToPCSomeByte(temp,15,1);
74 1 // debug_printf("DP_RX MCU FirmWare version: %.2f \n",DP_Rx_FW_VER);
75 1 DP_RX_API_Chip_Located();
76 1
77 1 DP_RX_API_InitSys();
78 1 //debug_comm_init();
79 1 while(0)
80 1 {
81 2 LED = 0;
82 2 delay_ms(500);
83 2 LED = 1;
84 2 delay_ms(500);
85 2 }
86 1 //set 2 lane, bandwidth 2.7G, single LVDS output, 8Bit output
87 1 DP_RX_API_Set_LaneCount(2);
88 1 B_puts("2 lanes selected");
89 1
90 1 DP_RX_API_Set_BandWidth(0x0a);
91 1 B_puts("2.7G selected");
92 1
93 1 DP_RX_API_Set_LVDS_Dual_Single(SINGLE_LVDS);
94 1 B_puts("Single LVDS selected");
95 1
96 1 DP_RX_API_Set_LVDS_Format(VESA_8bit);
97 1 B_puts("VESA 8 bit selected");
98 1
99 1 DP_RX_API_LVDS_Output_Mapping(5, 0);
100 1 DP_RX_API_LVDS_Output_Mapping(4, 1);
101 1 DP_RX_API_LVDS_Output_Mapping(3, 3);
102 1 DP_RX_API_LVDS_Output_Mapping(2, 2);
103 1 DP_RX_API_LVDS_Output_Mapping(1, 4);
104 1 DP_RX_API_LVDS_Output_Mapping(0, 5);
105 1 B_puts("Single LVDS output mapping");
106 1
107 1 // test = 'a';
108 1 while (1)
109 1 {
110 2 if(!debug_mode)
111 2 DP_RX_API_MainTask();
112 2 // debug_comm_tx();
113 2 CommandProcess ();
114 2 //
C51 COMPILER V7.50 MAIN 10/03/2008 17:53:14 PAGE 3
115 2 // BP_DIR = 1;
116 2 // putchar(test);
117 2 // BP_DIR = 0;
118 2 //lllll,
119 2 LED=~LED;
120 2 #if !Disable_interrupt
EX1 = 1;
#endif
123 2 delay_ms(3000);
124 2 }
125 1
126 1 }
127
128
129
130
131
132 void decode_term_str(void)
133 {
134 1 char *s, *s1;
135 1 char space;
136 1
137 1 s = command_buf;
138 1 s1 = s;
139 1 argc = 0;
140 1 if (*s) {
141 2 space = 0;
142 2 argv[argc++] = s;
143 2 while (*s) {
144 3 if (*s == ' ') {
145 4 *s = 0;
146 4 if (!space) {
147 5 space = 1;
148 5 }
149 4 } else {
150 4 if (space)
151 4 argv[argc++] = s;
152 4 space = 0;
153 4 }
154 3 s++;
155 3 }
156 2 }
157 1
158 1 }
159
160 int hex_to_int(char *s)
161 {
162 1 int r;
163 1
164 1 r = 0;
165 1 while (*s) {
166 2 if (*s >= '0' && *s <= '9')
167 2 r = (r << 4) + *s - '0';
168 2 if (*s >= 'a' && *s <= 'f')
169 2 r = (r << 4) + *s - 'a' + 10;
170 2 if (*s >= 'A' && *s <= 'F')
171 2 r = (r << 4) + *s - 'A' + 10;
172 2 s++;
173 2 }
174 1 return r;
175 1 }
176
C51 COMPILER V7.50 MAIN 10/03/2008 17:53:14 PAGE 4
177
178
179
180
181 uchar CommandProcess()
182 {
183 1 uchar temp;
184 1 uchar i;
185 1 uchar sendbuf[20];
186 1 if (sendRQ)
187 1 {
188 2 sendRQ=0;
189 2 if(command_buf[1]==0x52)
190 2 {
191 3 for(i=0;i<20;i++)
192 3 {
193 4 sendbuf[i] =0x0d;
194 4 }
195 3 for(i=0;i<5;i++)
196 3 {
197 4 sendbuf[i] = command_buf[i];
198 4 }
199 3 if(command_buf[2]==0x50)
200 3 {
201 4 for(i=0;i<command_buf[4];i++)
202 4 {
203 5
204 5 DP_RX_ReadI2C_RX0(command_buf[3]+i,&sendbuf[i+5]);
205 5 }
206 4 }
207 3 else if(command_buf[2]==0x8c)
208 3 {
209 4 for(i=0;i<command_buf[4];i++)
210 4 {
211 5
212 5 DP_RX_ReadI2C_RX1(command_buf[3]+i,&sendbuf[i+5]);
213 5 }
214 4 }
215 3
216 3 else
217 3 {
218 4 return 0;
219 4 }
220 3 SendToPCSomeByte(sendbuf,command_buf[4]+6,0); //不需要回车
221 3 }
222 2 else if(command_buf[1]==0x57)
223 2 {
224 3 if(command_buf[2]==0x50)
225 3 {
226 4 DP_RX_WriteI2C_RX0(command_buf[3],command_buf[4]);
227 4 }
228 3 else if(command_buf[2]==0x8c)
229 3 {
230 4 DP_RX_WriteI2C_RX1(command_buf[3],command_buf[4]);
231 4 }
232 3
233 3 }
234 2 }
235 1 }
*** WARNING C280 IN LINE 183 OF MAIN.C: 'temp': unreferenced local variable
236 /* process terminal command */
237 /*
C51 COMPILER V7.50 MAIN 10/03/2008 17:53:14 PAGE 5
238 void proc_term_cmd()
239 {
240 unsigned char c, c1;
241 unsigned char i;
242
243 if (argc == 0)
244 return;
245
246 if ((!strcmp(argv[0], "rp0") == 1) ||(!strcmp(argv[0], "RP0") == 1)) {
247 c = DP_RX_ReadI2C_RX0(hex_to_int(argv[1]), &c1);
248 debug_printf("rp0: %.2x, [%s]=%.2x\n", (unsigned int)c, argv[1], (unsigned int)c1);
249 }
250 else if(!strcmp(argv[0],"show") )
251 DP_RX_Show_Vid_Info();
252 else if ((!strcmp(argv[0], "rp1") == 1) ||(!strcmp(argv[0], "RP1") == 1)) {
253 c = DP_RX_ReadI2C_RX1(hex_to_int(argv[1]), &c1);
254 debug_printf("rp1: %.2x, [%s]=%.2x\n", (unsigned int)c, argv[1], (unsigned int)c1);
255 }
256
257 else if ((!strcmp(argv[0], "wp0") == 1) ||(!strcmp(argv[0], "WP0") == 1)) {
258 c = DP_RX_WriteI2C_RX0(hex_to_int(argv[1]), hex_to_int(argv[2]));
259 debug_printf("wp0: %.2x, [%s]=%s\n", (unsigned int)c, argv[1], argv[2]);
260 }
261
262 else if ((!strcmp(argv[0], "wp1") == 1) ||(!strcmp(argv[0], "WP1") == 1)) {
263 c = DP_RX_WriteI2C_RX1(hex_to_int(argv[1]), hex_to_int(argv[2]));
264 debug_printf("wp1: %.2x, [%s]=%s\n", (unsigned int)c, argv[1], argv[2]);
265 }
266 else if ((!strcmp(argv[0], "HPD")==1)||(!strcmp(argv[0], "hpd")==1)) {
267 DP_RX_HPD(0);
268 delay_ms(hex_to_int(argv[1]));
269 DP_RX_HPD(1);
270 }
271 else if ((!strcmp(argv[0], "IRQ")==1)||(!strcmp(argv[0], "irq")==1)) {
272 DP_RX_HPD(0);
273 delay_half_ms();
274 DP_RX_HPD(1);
275 }
276
277 else if (!strcmp(argv[0],"rp0all") ){
278 debug_printf(" 0 1 2 3 4 5 6 7 8 9 A B C D E F");
279 for(i=0;i<128;i++)
280 {
281 DP_RX_ReadI2C_RX0(i,&c1);
282 if((i&0x0f)==0)
283 debug_printf("\n rp0: [%.2x] %.2x ", (unsigned int)i, (unsigned int)c1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -