📄 webpages.lst
字号:
C51 COMPILER V7.50 WEBPAGES 10/12/2006 15:31:42 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE WEBPAGES
OBJECT MODULE PLACED IN .\Release\Webpages.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE Webpages.c LARGE OPTIMIZE(9,SIZE) BROWSE ORDER MODDP2 INCDIR(.\WEBPAGE\;..\
-..\inc\) DEBUG OBJECTEXTEND PRINT(.\Release\Webpages.lst) OBJECT(.\Release\Webpages.obj)
line level source
1 /*
2 *
3 * webpages.c
4 *
5 * Part of the Myson Century CS620X demo program.
6 *
7 * Authors: LY Lin, WM Wang, IJ Chen, WH Lee
8 *
9 * webpages.c contains contains entries for all the web pages for the embedded
10 * web server.
11 *
12 * This program was developed using the Keil 8051 C uVision 2 system.
13 * The Keil compiler MUST be used if working with Myson Century supplied
14 * firmware.
15 *
16 *
17 * This program must be linked with the 620xlib.LIB library
18 * supplied by Myson Century in object module form.
19 *
20 */
21
22 #include <stdio.h>
23 #include <string.h>
24
25 #include "hpserver.h"
26 #include "timer.h"
27 #include "ether.h"
28 #include "netutil.h"
29 #include "net.h"
30 #include "ip.h"
31 #include "tcp.h"
32 #include "config.h"
33 #include "http.h"
34
35 /*Web pages(store in code memory) head files*/
36 #include "index.h"
37 #include "bgm.h"
38 #include "century.h"
39 #include "cs00.h"
40 #include "tm00.h"
41 #include "cs6209.h"
42 #include "demokit.h"
43 #include "desc.h"
44 #include "grem.h"
45 #include "ioset.h"
46 #include "purm.h"
47 #include "redm.h"
48 #include "status.h"
49 #include "yello.h"
50 #include "ioset.h"
51 #include "time.h"
52 /*Buffer for system FAT*/
53 RAM_WEB_PAGE web_page_table [MAX_HTTP_FILES];
54
C51 COMPILER V7.50 WEBPAGES 10/12/2006 15:31:42 PAGE 2
55 /*Buffer for file name in EEPROM */
56 unsigned char http_name_buff[MAX_HTTP_FILES*MAX_HTTP_FILE_NAME_L];
57
58 /*
59 RAM_WEB_PAGE web_page_table_incode []
60
61 This table is the place to store the web page information.
62 For each web page, you need to specify an entry in this table.
63 The first field is the name of the web page. The second field
64 is the name of the data arry to store the web page data.
65 The third field is the size of the web page array you specified
66 in the second field.
67
68 The first field, the name of the web page, is used to search
69 for this table when an HTTP GET request comes in from the browser.
70 The HTTP GET request will specify the name of the web page. When
71 the CS620X web server parses this request, the server uses the name
72 of the web page to search this table. If an entry matching the web
73 page name is found, the web page data and length will be read from the
74 second and third fields in the entry.
75
76 The second field is the name of the data array to store the web page
77 data. You can hand code this data array, or a better way is to use the
78 utility ewsh2c.exe to convert a web page file into the C data array
79 for you.
80
81 The third field for each entry is the size of the web page data array.
82 You can also use the ewsh2c.exe to generate this number for you.
83
84 For an example, if you have a web page in the html format called
85 index.htm. After you use the ewsh2c.exe utility with index.htm,
86 two files are generated: index.c and index.h. In index.c, the web
87 page data is converted to a data array with the name index_htm[] in
88 index.c, and the size of the array, INDEX_SIZE, is specified in
89 index.h.
90
91 You then include index.h at the start of this file. Also you make
92 an entry of the web page in the web page table as shown in the
93 following.
94
95 If your web page includes any graphics file, you carry out the
96 same procedure. For an example, if one of the graphics file is
97 called cs00.jpg, which is a jpeg graphics file. You run the
98 ewsh2c.exe utility through this file. The cs00.c and cs00.h files
99 are generated. The cs00.c file contains the data array cs00_jpg, and
100 the cs00.h file has the data array size CS00_SIZE.
101
102 For each web page file, you have to go through the following steps:
103
104 1) Use the ewsh2c.exe utility to generate the .c and .h file.
105
106 2) In this file, you include the .h file at the beginning.
107
108 3) Make an entry in the web_page_table below.
109
110 4) In your firmware build environment, you have to include the
111 .c file as part of the total project source files.
112
113 5) If the web page needs processing after it is requested by the
114 browser, you write a CGI program to do it. You specify the
115 web page and CGI function association by modifying the
116 register_cgi_functions () in HTTP.C.
C51 COMPILER V7.50 WEBPAGES 10/12/2006 15:31:42 PAGE 3
117
118 After the above is done for each web page file, you build
119 the firmware load the firmware into the board for execution.
120 */
121 RAM_WEB_PAGE web_page_table_incode [] =
122 {
123 // index.htm has to be the first one.
124 {"index.htm", index_htm, INDEX_SIZE},
125 {"ioset.cgi", ioset_cgi, IOSET_SIZE},
126 {"bgm.jpg", bgm_jpg, BGM_SIZE},
127 {"century.htm", century_htm, CENTURY_SIZE},
128 {"cs00.jpg", cs00_jpg, CS00_SIZE},
129 {"tm00.jpg", tm00_jpg, TM00_SIZE},
130 {"cs6209.htm", cs6209_htm, CS6209_SIZE},
131 {"demokit.htm", demokit_htm, DEMOKIT_SIZE},
132 {"desc.htm", desc_htm, DESC_SIZE},
133 {"grem.jpg", grem_jpg, GREM_SIZE},
134 {"purm.jpg", purm_jpg, PURM_SIZE},
135 {"redm.jpg", redm_jpg, REDM_SIZE},
136 {"status.cgi", status_cgi, STATUS_SIZE},
137 {"yello.htm", yello_jpg, YELLO_SIZE},
138 {"time.cgi",time_cgi,TIME_SIZE},
139 {NULL, NULL, NULL}
140 };
141
142 /* EGI function definitions */
143 extern void ioset_resp(TSOCK xdata *ts, char xdata *str);
144 extern void status_resp(TSOCK xdata *ts, char xdata *str);
145 extern void time_resp(TSOCK xdata *ts,char xdata *str);
146
147 code EGI_FUNC egifuncs[] = {
148 {ioset_resp, "ioset"},
149 {status_resp, "status"},
150 {time_resp,"time"},
151 {0}
152 };
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = ---- ----
CONSTANT SIZE = 283 ----
XDATA SIZE = 1328 ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
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 + -