📄 utility.lst
字号:
C51 COMPILER V7.50 UTILITY 10/12/2006 15:31:40 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE UTILITY
OBJECT MODULE PLACED IN .\Release\Utility.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\..\lib\Utility.c LARGE OPTIMIZE(9,SIZE) BROWSE ORDER MODDP2 INCDIR(..\..
-\inc\) DEBUG OBJECTEXTEND PRINT(.\Release\Utility.lst) OBJECT(.\Release\Utility.obj)
line level source
1 /*
2 *
3 * Utility.c
4 *
5 * Part of the Myson Century CS620X demo program.
6 *
7 * Authors: LY Lin, WM Wang, IJ Chen, WH Lee
8 *
9 * Utility.c contains show current setting and edit setting from RS232 routines.
10 *
11 * This program was developed using the Keil 8051 C uVision 2 system.
12 * The Keil compiler MUST be used if working with Myson Century supplied
13 * firmware.
14 *
15 * This program must be linked with the RS232.c if you want to use
16 * RS232 I2C EEPROM in system programing function.
17 *
18 *
19 * Note: To use this file without RS232.c you must remove the include of rs232.h .
20 */
21
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
25 #include "hpserver.h"
26 #include "ether.h"
27 #include "netutil.h"
28 #include "net.h"
29 #include "ip.h"
30 #include "utility.h"
31 #include "hwi2c.h"
32 #ifndef mon51
33 #include "rs232.h"
34 #endif
35
36 /*
37 Variable for numbers getting form RS232 to set IP,Gateway,Net Mask or MAC address .
38 */
39 unsigned char nums[8];
40 /*
41 Buffer for character getting form RS232.
42 */
43 char linebuf[30] ;
44 unsigned char linebuf_i=0;
45 /*
46 Temp variables.
47 */
48 char g_di=0 ;
49 char g_dc=0 ;
50
51 /*
52 MAC address store location .
53 */
54 extern byte my_mac_addr[];
C51 COMPILER V7.50 UTILITY 10/12/2006 15:31:40 PAGE 2
55
56 /*
57 Strings for menu
58 */
59 code unsigned char menudata1[]="\n\nCS6209C0 Embedded Network Microcontroller evaluation kit.\n";
60 code unsigned char menudata2[]="\nYour IP address is : ";
61 code unsigned char menudata3[]="\nYour Gateway IP address is : ";
62 code unsigned char menudata4[]="\nYour MAC address is : ";
63 code unsigned char menudata5[]="\nYour Net Mask is : ";
64 code unsigned char menudata6[]="\nType i to set your IP address.\n";
65 code unsigned char menudata7[]="For example, type: i 172.20.1.200 .\n";
66 code unsigned char menudata8[]="\nType g to set your Gateway IP address.\n";
67 code unsigned char menudata9[]="For example, type: g 172.20.1.200 .\n";
68 code unsigned char menudata10[]="\nType n to set your IP Netmask.\n";
69 code unsigned char menudata11[]="For example, type: n 255.255.0.0 .\n";
70 code char error_str[] = "Error!!! Please press the reset key and set your ip address again.\r\n\n";
71
72
73 #ifdef I2C_EERROM_WRITER
74 void EEPROM_writer(char gdc);
75 /*
76 I2C EEPROM writer ID for remote program.
77 */
78 code char EEPROM_writer_id[]={0xa1,0xa2,0xa3,0xa4};
79 /*
80 Reserve char for transmitting 0x11(XON),0x13(XOFF).
81 */
82 #define REV_WORD 0xa1
83 code char REV[]={0x11,0x13,0xa1};
84 #endif
85
86 /************************************************************************
87 /* Function Name : show_gateway *
88 /* *
89 /* Arguments : *
90 /* NODE *n: point to NODE to display gateway of it. *
91 /* *
92 /* Return : None. *
93 /* *
94 /* *
95 /* Comment : *
96 /* This function show Gateway IP address of a NODE. *
97 /* *
98 /************************************************************************/
99 void show_gateway(NODE *n)
100 {
101 1 printf ("%1bu.%1bu.%1bu.%1bu",
102 1 *(&n->gate),
103 1 *(&n->gate+1),
104 1 *(&n->gate+2),
105 1 *(&n->gate+3));
106 1 }
107
108 /************************************************************************
109 /* Function Name : show_mask *
110 /* *
111 /* Arguments : *
112 /* NODE *n: point to NODE to display Net Mask of it. *
113 /* *
114 /* Return : *
115 /* None. *
116 /* *
C51 COMPILER V7.50 UTILITY 10/12/2006 15:31:40 PAGE 3
117 /* Comment : *
118 /* This function show Net Mask of a NODE. *
119 /* *
120 /************************************************************************/
121 void show_mask(NODE *n)
122 {
123 1 printf ("%1bu.%1bu.%1bu.%1bu",
124 1 *(&n->mask),
125 1 *(&n->mask+1),
126 1 *(&n->mask+2),
127 1 *(&n->mask+3));
128 1 }
129
130 /************************************************************************
131 /* Function Name : show_ip *
132 /* *
133 /* Arguments : *
134 /* NODE *n: point to NODE to display IP address of it. *
135 /* *
136 /* Return : *
137 /* None. *
138 /* *
139 /* Comment : *
140 /* This function show IP address of a NODE. *
141 /* *
142 /************************************************************************/
143 void show_ip(NODE *n)//unsigned char *CS620X_IP_ADDRESS)
144 {
145 1 printf ("%1bu.%1bu.%1bu.%1bu",
146 1 *(&n->ip),
147 1 *(&n->ip+1),
148 1 *(&n->ip+2),
149 1 *(&n->ip+3));
150 1 }
151
152 /************************************************************************
153 /* Function Name : show_mac *
154 /* *
155 /* Arguments : *
156 /* None *
157 /* *
158 /* Return : *
159 /* None. *
160 /* *
161 /* Comment : *
162 /* This function show MAC address of current setting . *
163 /* *
164 /************************************************************************/
165 void show_mac()
166 {
167 1 printf ("%1bx-%1bx-%1bx-%1bx-%1bx-%1bx",
168 1 my_mac_addr[0],
169 1 my_mac_addr[1],
170 1 my_mac_addr[2],
171 1 my_mac_addr[3],
172 1 my_mac_addr[4],
173 1 my_mac_addr[5]);
174 1 }
175
176 /************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -