1
10
13
14
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
121
122
123
124
125
126
127
133
134
135
145
146
147
148
149
150
151
152
158
159
160
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
202
214
215
216
217
218
219
229
230
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
271
283
284
285
286
287
288
290
294
295
296
297
298
299
300
304
308
309
310
311
312
318
319
320
321
322
323
324
325
326
327
333
339
340
...
...
...
#define NX_SOURCE_CODE
#include "nx_api.h"
#include "nx_ip.h"
...
...
UINT _nx_ip_interface_status_check(NX_IP *ip_ptr, UINT interface_index, ULONG needed_status,
ULONG *actual_status, ULONG wait_option)
{
ULONG current_status;
NX_IP_DRIVER driver_request;
ULONG return_value;
#ifdef TX_ENABLE_EVENT_TRACE
TX_TRACE_BUFFER_ENTRY *trace_event;
ULONG trace_timestamp;/* ... */
#endif
NX_TRACE_IN_LINE_INSERT(NX_TRACE_IP_STATUS_CHECK, ip_ptr, needed_status, 0, wait_option, NX_TRACE_IP_EVENTS, &trace_event, &trace_timestamp);
for (;;)
{
current_status = 0;
if (needed_status & NX_IP_INITIALIZE_DONE)
{
if (ip_ptr -> nx_ip_initialize_done)
{
current_status = current_status | NX_IP_INITIALIZE_DONE;
}if (ip_ptr -> nx_ip_initialize_done) { ... }
}if (needed_status & NX_IP_INITIALIZE_DONE) { ... }
#ifndef NX_DISABLE_IPV4
if (needed_status & NX_IP_ADDRESS_RESOLVED)
{
if (ip_ptr -> nx_ip_interface[interface_index].nx_interface_ip_address)
{
current_status = current_status | NX_IP_ADDRESS_RESOLVED;
}if (ip_ptr -> nx_ip_interface[interface_index].nx_interface_ip_address) { ... }
}if (needed_status & NX_IP_ADDRESS_RESOLVED) { ... }
if (needed_status & NX_IP_ARP_ENABLED)
{
if (ip_ptr -> nx_ip_arp_periodic_update)
{
current_status = current_status | NX_IP_ARP_ENABLED;
}if (ip_ptr -> nx_ip_arp_periodic_update) { ... }
}if (needed_status & NX_IP_ARP_ENABLED) { ... }
if (needed_status & NX_IP_RARP_COMPLETE)
{
if (ip_ptr -> nx_ip_interface[interface_index].nx_interface_ip_address)
{
current_status = current_status | NX_IP_RARP_COMPLETE;
}if (ip_ptr -> nx_ip_interface[interface_index].nx_interface_ip_address) { ... }
}if (needed_status & NX_IP_RARP_COMPLETE) { ... }
if (needed_status & NX_IP_IGMP_ENABLED)
{
if (ip_ptr -> nx_ip_igmp_packet_receive)
{
current_status = current_status | NX_IP_IGMP_ENABLED;
}if (ip_ptr -> nx_ip_igmp_packet_receive) { ... }
}if (needed_status & NX_IP_IGMP_ENABLED) { ... }
/* ... */#endif
if (needed_status & NX_IP_LINK_ENABLED)
{
tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER);
driver_request.nx_ip_driver_ptr = ip_ptr;
driver_request.nx_ip_driver_command = NX_LINK_GET_STATUS;
driver_request.nx_ip_driver_return_ptr = &return_value;
driver_request.nx_ip_driver_interface = &(ip_ptr -> nx_ip_interface[interface_index]);
NX_TRACE_IN_LINE_INSERT(NX_TRACE_INTERNAL_IO_DRIVER_GET_STATUS, ip_ptr, 0, 0, 0, NX_TRACE_INTERNAL_EVENTS, 0, 0);
(ip_ptr -> nx_ip_interface[interface_index].nx_interface_link_driver_entry)(&driver_request);
if (driver_request.nx_ip_driver_status != NX_SUCCESS)
{
if (driver_request.nx_ip_driver_status == NX_UNHANDLED_COMMAND)
{
if (ip_ptr -> nx_ip_interface[interface_index].nx_interface_link_up)
{
current_status = current_status | NX_IP_LINK_ENABLED;
}if (ip_ptr -> nx_ip_interface[interface_index].nx_interface_link_up) { ... }
}if (driver_request.nx_ip_driver_status == NX_UNHANDLED_COMMAND) { ... }
}if (driver_request.nx_ip_driver_status != NX_SUCCESS) { ... }
else
{
if (return_value == NX_TRUE)
{
current_status = current_status | NX_IP_LINK_ENABLED;
}if (return_value == NX_TRUE) { ... }
}else { ... }
tx_mutex_put(&(ip_ptr -> nx_ip_protection));
}if (needed_status & NX_IP_LINK_ENABLED) { ... }
if (needed_status & NX_IP_UDP_ENABLED)
{
if (ip_ptr -> nx_ip_udp_packet_receive)
{
current_status = current_status | NX_IP_UDP_ENABLED;
}if (ip_ptr -> nx_ip_udp_packet_receive) { ... }
}if (needed_status & NX_IP_UDP_ENABLED) { ... }
if (needed_status & NX_IP_TCP_ENABLED)
{
if (ip_ptr -> nx_ip_tcp_packet_receive)
{
current_status = current_status | NX_IP_TCP_ENABLED;
}if (ip_ptr -> nx_ip_tcp_packet_receive) { ... }
}if (needed_status & NX_IP_TCP_ENABLED) { ... }
if (needed_status & NX_IP_INTERFACE_LINK_ENABLED)
{
tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER);
driver_request.nx_ip_driver_ptr = ip_ptr;
driver_request.nx_ip_driver_command = NX_LINK_GET_STATUS;
driver_request.nx_ip_driver_return_ptr = &return_value;
driver_request.nx_ip_driver_interface = &(ip_ptr -> nx_ip_interface[interface_index]);
NX_TRACE_IN_LINE_INSERT(NX_TRACE_INTERNAL_IO_DRIVER_GET_STATUS, ip_ptr, 0, 0, 0, NX_TRACE_INTERNAL_EVENTS, 0, 0);
(ip_ptr -> nx_ip_interface[interface_index].nx_interface_link_driver_entry)(&driver_request);
if (driver_request.nx_ip_driver_status != NX_SUCCESS)
{
if (driver_request.nx_ip_driver_status == NX_UNHANDLED_COMMAND)
{
if (ip_ptr -> nx_ip_interface[interface_index].nx_interface_link_up)
{
current_status = current_status | NX_IP_INTERFACE_LINK_ENABLED;
}if (ip_ptr -> nx_ip_interface[interface_index].nx_interface_link_up) { ... }
}if (driver_request.nx_ip_driver_status == NX_UNHANDLED_COMMAND) { ... }
}if (driver_request.nx_ip_driver_status != NX_SUCCESS) { ... }
else
{
if (return_value == NX_TRUE)
{
current_status = current_status | NX_IP_INTERFACE_LINK_ENABLED;
}if (return_value == NX_TRUE) { ... }
}else { ... }
tx_mutex_put(&(ip_ptr -> nx_ip_protection));
}if (needed_status & NX_IP_INTERFACE_LINK_ENABLED) { ... }
/* ... */
if (current_status == needed_status)
{
break;
}if (current_status == needed_status) { ... }
if (wait_option)
{
if (wait_option > NX_IP_STATUS_CHECK_WAIT_TIME)
{
wait_option -= NX_IP_STATUS_CHECK_WAIT_TIME;
}if (wait_option > NX_IP_STATUS_CHECK_WAIT_TIME) { ... }
else
{
wait_option = 0;
}else { ... }
tx_thread_sleep(NX_IP_STATUS_CHECK_WAIT_TIME);
}if (wait_option) { ... }
else
{
break;
}else { ... }
}for (;;) { ... }
*actual_status = current_status;
NX_TRACE_EVENT_UPDATE(trace_event, trace_timestamp, NX_TRACE_IP_STATUS_CHECK, 0, 0, current_status, 0);
if (needed_status == current_status)
{
return(NX_SUCCESS);
}if (needed_status == current_status) { ... }
else
{
return(NX_NOT_SUCCESSFUL);
}else { ... }
}{ ... }