📄 mn_callback.lst
字号:
C51 COMPILER V8.08 MN_CALLBACK 04/01/2008 13:01:13 PAGE 1
C51 COMPILER V8.08, COMPILATION OF MODULE MN_CALLBACK
OBJECT MODULE PLACED IN mn_callback.OBJ
COMPILER INVOKED BY: C:\SiLabs\MCU\IDEfiles\C51\Bin\C51.exe mn_callback.c DB OE LARGE
line level source
1 //-----------------------------------------------------------------------------
2 // mn_callback.c
3 //-----------------------------------------------------------------------------
4 // Copyright 2006 Silicon Laboratories, Inc.
5 //
6 // Description:
7 // This file callback functions from the TCP/IP stack.
8 // These functions may be edited by the user.
9 //
10 // Callback functions include:
11 // 1. callback_app_process_packet
12 // 2. callback_app_server_idle
13 // 3. callback_app_recv_idle
14 // 4. callback_app_server_process_packet
15 // 5. callback_socket_closed (only when TCP is included in the stack)
16 // 6. callback_socket_empty (only when TCP is included in the stack)
17 //
18 // Generated by TCP/IP Configuration Wizard Version 3.1.
19 //
20
21 #include "mn_userconst.h" // TCP/IP Library Constants
22 #include "mn_stackconst.h" // TCP/IP Library Constants
23 #include "mn_errs.h" // Library Error Codes
24 #include "mn_defs.h" // Library Type definitions
25 #include "mn_funcs.h" // Library Function Prototypes
26 #include "VFILE_DIR\index.h"
27 #include <c8051F340.h> // Device-specific SFR Definitions
28
29
30 //------------------------------------------------------------------------------
31 // Callback Functions
32 //------------------------------------------------------------------------------
33
34 //------------------------------------------------------------------------------
35 // callback_app_process_packet
36 //------------------------------------------------------------------------------
37 //
38 // This function is called after any TCP or UDP packet is received.
39 //
40 // Parameters:
41 // socket_ptr - pointer to the socket that contains the data.
42 //// Return Values:
43 // NEED_IGNORE_PACKET <-94> - The library will not ACK the TCP packet.
44 //
45 // Any other value - The library will ACK the TCP packet.
46 //
47 // Note: The return value is ignored if a UDP packet was received.
48 //
49 SCHAR callback_app_process_packet(PSOCKET_INFO socket_ptr)
50 {
51 1 socket_ptr = socket_ptr; // This statment prevents compiler warning.
52 1 return (1);
53 1 }
54
55 //------------------------------------------------------------------------------
C51 COMPILER V8.08 MN_CALLBACK 04/01/2008 13:01:13 PAGE 2
56 // callback_app_server_idle
57 //------------------------------------------------------------------------------
58 //
59 // This function is called periodically and when both the receive and transmit
60 // buffers are empty. This function should only be used for low priority tasks.
61 // Any high priority tasks should be placed in an interrupt service routine.
62 //
63 // Parameters:
64 // psocket_ptr - pointer to a socket that can be filled with data.
65 //
66 // Return Values:
67 // NEED_TO_SEND <-114> - The library will immediately send the data stored in
68 // the socket.
69 //
70 // NEED_TO_EXIT <-102> - The mn_server() routine will exit immediately, returning
71 // control to the main() routine.
72 //
73 // FALSE <0> - The mn_server() routine will continue to function normally.
74 //
75 // Note: The socket pointer may be re-assigned to a different socket.
76 // (e.g. *psocket_ptr = new_socket_ptr; )
77 //
78 SCHAR callback_app_server_idle(PSOCKET_INFO *psocket_ptr)
79 {
80 1
81 1 // Put your code here.
82 1
83 1 // If the link goes invalid, exit mn_server().
84 1 if(link_lost)
85 1 return (NEED_TO_EXIT);
86 1
87 1 psocket_ptr = psocket_ptr; // This statment prevents compiler warning.
88 1 return (0);
89 1 }
90
91 //------------------------------------------------------------------------------
92 // callback_app_recv_idle
93 //------------------------------------------------------------------------------
94 //
95 // This function is called repeatedly while the server is waiting for data.
96 // This function should only be used for low priority tasks. Any high priority
97 // tasks should be placed in an interrupt service routine.
98 //
99 // Parameters:
100 // none
101 //
102 // Return Values:
103 // NEED_TO_EXIT <-102> - The server will immedialtely stop waiting for data and
104 // will advance to the next state.
105 //
106 // Any other value - The server will continue to wait for data.
107 //
108 SCHAR callback_app_recv_idle(void)
109 {
110 1 // Put your code here.
111 1 return (0);
112 1 }
113
114 //------------------------------------------------------------------------------
115 // callback_app_server_process_packet
116 //------------------------------------------------------------------------------
117 //
C51 COMPILER V8.08 MN_CALLBACK 04/01/2008 13:01:13 PAGE 3
118 // This function is called after any TCP or UDP packet that is not HTTP or FTP
119 // received. HTTP and FTP packets are automatically handled by the server.
120 //
121 // Parameters:
122 // socket_ptr - pointer to the socket that contains the data.
123 //
124 // Return Values:
125 // NEED_TO_EXIT <-102> - The mn_server() routine will exit immediately, returning
126 // control to the main() routine.
127 //
128 // Any other value - The server will discard the packet.
129 //
130 SCHAR callback_app_server_process_packet(PSOCKET_INFO socket_ptr)
131 {
132 1 socket_ptr = socket_ptr; // This statment prevents compiler warning.
133 1
134 1 return (0);
135 1 }
136
137
138 //------------------------------------------------------------------------------
139 // callback_socket_closed
140 //------------------------------------------------------------------------------
141 //
142 // This function is called after a TCP socket is closed.
143 //
144 // Parameters:
145 // socket_no - number of the socket that was closed.
146 //
147 // Return Values:
148 //
149 // N/A
150 //
151 void callback_socket_closed(SCHAR socket_no)
152 {
153 1 socket_no = socket_no;
154 1 }
155
156 //------------------------------------------------------------------------------
157 // callback_socket_empty
158 //------------------------------------------------------------------------------
159 //
160 // This function is called after all data in a TCP socket is sent.
161 //
162 // Parameters:
163 // socket_ptr - pointer to the socket that is empty.
164 //
165 // Return Values:
166 //
167 // N/A
168 //
169 void callback_socket_empty(PSOCKET_INFO socket_ptr)
170 {
171 1 socket_ptr = socket_ptr;
172 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 20 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
C51 COMPILER V8.08 MN_CALLBACK 04/01/2008 13:01:13 PAGE 4
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 + -