1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** USBX Component                                                        */
16 /**                                                                       */
17 /**   CDC_ECM Class                                                       */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 /**************************************************************************/
23 /*                                                                        */
24 /*  COMPONENT DEFINITION                                   RELEASE        */
25 /*                                                                        */
26 /*    ux_device_class_cdc_ecm.h                           PORTABLE C      */
27 /*                                                           6.2.0        */
28 /*  AUTHOR                                                                */
29 /*                                                                        */
30 /*    Chaoqiong Xiao, Microsoft Corporation                               */
31 /*                                                                        */
32 /*  DESCRIPTION                                                           */
33 /*                                                                        */
34 /*    This file defines the equivalences for the USBX Device Class        */
35 /*    CDC_ECM component.                                                  */
36 /*                                                                        */
37 /*  RELEASE HISTORY                                                       */
38 /*                                                                        */
39 /*    DATE              NAME                      DESCRIPTION             */
40 /*                                                                        */
41 /*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
42 /*  09-30-2020     Chaoqiong Xiao           Modified comment(s),          */
43 /*                                            used UX prefix to refer to  */
44 /*                                            TX symbols instead of using */
45 /*                                            them directly,              */
46 /*                                            resulting in version 6.1    */
47 /*  08-02-2021     Wen Wang                 Modified comment(s),          */
48 /*                                            fixed spelling error,       */
49 /*                                            added extern "C" keyword    */
50 /*                                            for compatibility with C++, */
51 /*                                            resulting in version 6.1.8  */
52 /*  04-25-2022     Chaoqiong Xiao           Modified comment(s),          */
53 /*                                            fixed standalone compile,   */
54 /*                                            resulting in version 6.1.11 */
55 /*  10-31-2022     Chaoqiong Xiao           Modified comment(s),          */
56 /*                                            added wait definitions,     */
57 /*                                            resulting in version 6.2.0  */
58 /*                                                                        */
59 /**************************************************************************/
60 
61 #ifndef UX_DEVICE_CLASS_CDC_ECM_H
62 #define UX_DEVICE_CLASS_CDC_ECM_H
63 
64 /* Determine if a C++ compiler is being used.  If so, ensure that standard
65    C is used to process the API information.  */
66 
67 #ifdef   __cplusplus
68 
69 /* Yes, C++ compiler is present.  Use standard C.  */
70 extern   "C" {
71 
72 #endif
73 
74 #if !defined(UX_DEVICE_STANDALONE)
75 #include "nx_api.h"
76 #include "ux_network_driver.h"
77 #else
78 
79 /* Assume NX definitions for compiling.  */
80 #define NX_PACKET                                               VOID*
81 /*
82 UINT  _ux_network_driver_deactivate(VOID *ux_instance, VOID *ux_network_handle);
83 VOID  _ux_network_driver_link_up(VOID *ux_network_handle);
84 VOID  _ux_network_driver_link_down(VOID *ux_network_handle);
85 */
86 #ifndef _ux_network_driver_deactivate
87 #define _ux_network_driver_deactivate(a,b)                      do {} while(0)
88 #endif
89 #ifndef _ux_network_driver_link_up
90 #define _ux_network_driver_link_up(a)                           do {} while(0)
91 #endif
92 #ifndef _ux_network_driver_link_down
93 #define _ux_network_driver_link_down(a)                         do {} while(0)
94 #endif
95 #endif
96 
97 /* Define generic CDC_ECM equivalences.  */
98 #define UX_DEVICE_CLASS_CDC_ECM_CLASS_COMMUNICATION_CONTROL                 0x02
99 #define UX_DEVICE_CLASS_CDC_ECM_SUBCLASS_COMMUNICATION_CONTROL              0x06
100 #define UX_DEVICE_CLASS_CDC_ECM_CLASS_COMMUNICATION_DATA                    0x0A
101 #define UX_DEVICE_CLASS_CDC_ECM_NEW_INTERRUPT_EVENT                         0x01
102 #define UX_DEVICE_CLASS_CDC_ECM_NEW_BULKOUT_EVENT                           0x02
103 #define UX_DEVICE_CLASS_CDC_ECM_NEW_BULKIN_EVENT                            0x04
104 #define UX_DEVICE_CLASS_CDC_ECM_NEW_DEVICE_STATE_CHANGE_EVENT               0x08
105 #define UX_DEVICE_CLASS_CDC_ECM_NETWORK_NOTIFICATION_EVENT                  0x10
106 #define UX_DEVICE_CLASS_CDC_ECM_INTERRUPT_RESPONSE_LENGTH                   8
107 #define UX_DEVICE_CLASS_CDC_ECM_MAX_CONTROL_RESPONSE_LENGTH                 256
108 #define UX_DEVICE_CLASS_CDC_ECM_INTERRUPT_RESPONSE_AVAILABLE_FLAG           1
109 #define UX_DEVICE_CLASS_CDC_ECM_BASE_IP_ADDRESS                             0xC0A80001
110 #define UX_DEVICE_CLASS_CDC_ECM_BASE_IP_MASK                                0xFFFFFF00
111 #define UX_DEVICE_CLASS_CDC_ECM_MAX_MTU                                     1518
112 #define UX_DEVICE_CLASS_CDC_ECM_ETHERNET_IP                                 0x0800
113 #define UX_DEVICE_CLASS_CDC_ECM_ETHERNET_ARP                                0x0806
114 #define UX_DEVICE_CLASS_CDC_ECM_ETHERNET_RARP                               0x8035
115 #define UX_DEVICE_CLASS_CDC_ECM_ETHERNET_PACKET_SIZE                        1536
116 #define UX_DEVICE_CLASS_CDC_ECM_NX_ALIGN_PADDING                            2
117 #ifndef UX_DEVICE_CLASS_CDC_ECM_NX_PKPOOL_ENTRIES
118 #define UX_DEVICE_CLASS_CDC_ECM_NX_PKPOOL_ENTRIES                           16
119 #endif
120 
121 #define UX_DEVICE_CLASS_CDC_ECM_NX_PACKET_SIZE                              sizeof(NX_PACKET)
122 
123 #define UX_DEVICE_CLASS_CDC_ECM_NX_PAYLOAD_SIZE_ASSERT                      UX_COMPILE_TIME_ASSERT(!UX_OVERFLOW_CHECK_ADD_ULONG(UX_DEVICE_CLASS_CDC_ECM_ETHERNET_PACKET_SIZE, UX_DEVICE_CLASS_CDC_ECM_NX_ALIGN_PADDING), UX_DEVICE_CLASS_CDC_ECM_NX_PAYLOAD_SIZE_calc_ovf)
124 #define UX_DEVICE_CLASS_CDC_ECM_NX_PAYLOAD_SIZE                             (UX_DEVICE_CLASS_CDC_ECM_ETHERNET_PACKET_SIZE + UX_DEVICE_CLASS_CDC_ECM_NX_ALIGN_PADDING)
125 
126 #define UX_DEVICE_CLASS_CDC_ECM_NX_BUFF_SIZE_ASSERT                         \
127     UX_DEVICE_CLASS_CDC_ECM_NX_PAYLOAD_SIZE_ASSERT                          \
128     UX_COMPILE_TIME_ASSERT(!UX_OVERFLOW_CHECK_ADD_ULONG(                    \
129         UX_DEVICE_CLASS_CDC_ECM_NX_PAYLOAD_SIZE,                            \
130         UX_DEVICE_CLASS_CDC_ECM_NX_PACKET_SIZE),                            \
131         UX_DEVICE_CLASS_CDC_ECM_NX_BUFF_SIZE_calc_ovf)
132 #define UX_DEVICE_CLASS_CDC_ECM_NX_BUFF_SIZE                                (UX_DEVICE_CLASS_CDC_ECM_NX_PAYLOAD_SIZE + UX_DEVICE_CLASS_CDC_ECM_NX_PACKET_SIZE)
133 
134 #define UX_DEVICE_CLASS_CDC_ECM_NX_ETHERNET_POOL_ALLOCSIZE_ASSERT           \
135     UX_DEVICE_CLASS_CDC_ECM_NX_BUFF_SIZE_ASSERT                             \
136     UX_COMPILE_TIME_ASSERT(!UX_OVERFLOW_CHECK_MULC_ULONG(                   \
137         UX_DEVICE_CLASS_CDC_ECM_NX_PKPOOL_ENTRIES,                          \
138         UX_DEVICE_CLASS_CDC_ECM_NX_BUFF_SIZE),                              \
139         UX_DEVICE_CLASS_CDC_ECM_NX_ETHERNET_POOL_ALLOCSIZE_calc1_ovf)       \
140     UX_COMPILE_TIME_ASSERT(!UX_OVERFLOW_CHECK_ADD_ULONG(                    \
141         UX_DEVICE_CLASS_CDC_ECM_NX_PKPOOL_ENTRIES *                         \
142             UX_DEVICE_CLASS_CDC_ECM_NX_BUFF_SIZE,                           \
143         32), UX_DEVICE_CLASS_CDC_ECM_NX_ETHERNET_POOL_ALLOCSIZE_calc2_ovf)
144 #define UX_DEVICE_CLASS_CDC_ECM_NX_ETHERNET_POOL_ALLOCSIZE                  (UX_DEVICE_CLASS_CDC_ECM_NX_PKPOOL_ENTRIES * UX_DEVICE_CLASS_CDC_ECM_NX_BUFF_SIZE + 32)
145 
146 #define UX_DEVICE_CLASS_CDC_ECM_ETHERNET_SIZE                               14
147 #define UX_DEVICE_CLASS_CDC_ECM_NODE_ID_LENGTH                              6
148 #define UX_DEVICE_CLASS_CDC_ECM_VENDOR_DESCRIPTION_MAX_LENGTH               64
149 #define UX_DEVICE_CLASS_CDC_ECM_MAC_OPTIONS                                 8
150 #define UX_DEVICE_CLASS_CDC_ECM_PACKET_HEADER_MSG                           1
151 
152 /* Device CDC_ECM Requests */
153 #define UX_DEVICE_CLASS_CDC_ECM_SEND_ENCAPSULATED_COMMAND                   0x00
154 #define UX_DEVICE_CLASS_CDC_ECM_GET_ENCAPSULATED_RESPONSE                   0x01
155 #define UX_DEVICE_CLASS_CDC_ECM_SET_ETHERNET_MULTICAST_FILTER               0x40
156 #define UX_DEVICE_CLASS_CDC_ECM_SET_ETHERNET_POWER_MANAGEMENT_FILTER        0x41
157 #define UX_DEVICE_CLASS_CDC_ECM_GET_ETHERNET_POWER_MANAGEMENT_FILTER        0x42
158 #define UX_DEVICE_CLASS_CDC_ECM_SET_ETHERNET_PACKET_FILTER                  0x43
159 
160 /* Define CDC_ECM Versions.  Set to 1.0 here.  */
161 #define UX_DEVICE_CLASS_CDC_ECM_VERSION_MAJOR                               0x00000001
162 #define UX_DEVICE_CLASS_CDC_ECM_VERSION_MINOR                               0x00000000
163 
164 /* Define CDC_ECM Connection type supported. Set to conectionless.  */
165 #define UX_DEVICE_CLASS_CDC_ECM_DF_CONNECTIONLESS                           0x00000001
166 #define UX_DEVICE_CLASS_CDC_ECM_DF_CONNECTION_ORIENTED                      0x00000002
167 #define UX_DEVICE_CLASS_CDC_ECM_DF_CONNECTION_SUPPORTED                     UX_DEVICE_CLASS_CDC_ECM_DF_CONNECTIONLESS
168 
169 /* Define CDC_ECM Medium supported by the device. */
170 #define UX_DEVICE_CLASS_CDC_ECM_MEDIUM_SUPPORTED                            0x00000000
171 
172 /* Define CDC_ECM Packet size and types supported.  */
173 #define UX_DEVICE_CLASS_CDC_ECM_MAX_PACKET_PER_TRANSFER                     0x00000001
174 #define UX_DEVICE_CLASS_CDC_ECM_MAX_PACKET_TRANSFER_SIZE                    0x00000640
175 #define UX_DEVICE_CLASS_CDC_ECM_PACKET_ALIGNEMENT_FACTOR                    0x00000003
176 #define UX_DEVICE_CLASS_CDC_ECM_MAX_FRAME_SIZE                              0x000005DC
177 #define UX_DEVICE_CLASS_CDC_ECM_MAX_PACKET_LENGTH                           0x000005EA
178 
179 /* Define LINK speeds.  */
180 #define UX_DEVICE_CLASS_CDC_ECM_LINK_SPEED_FS                               0x0001D4C0
181 
182 /* Define LINK statess.  */
183 #define UX_DEVICE_CLASS_CDC_ECM_LINK_STATE_DOWN                             0
184 #define UX_DEVICE_CLASS_CDC_ECM_LINK_STATE_UP                               1
185 #define UX_DEVICE_CLASS_CDC_ECM_LINK_STATE_PENDING_UP                       2
186 #define UX_DEVICE_CLASS_CDC_ECM_LINK_STATE_PENDING_DOWN                     3
187 
188 /* Define media connection values.  */
189 #define UX_DEVICE_CLASS_CDC_ECM_MEDIA_CONNECTED                             0x00000000
190 #define UX_DEVICE_CLASS_CDC_ECM_MEDIA_DISCONNECTED                          0x00000001
191 
192 /* Define media supported values.  */
193 #define UX_DEVICE_CLASS_CDC_ECM_MEDIA_802_3                                 0x00000000
194 #define UX_DEVICE_CLASS_CDC_ECM_MEDIA_802_5                                 0x00000001
195 #define UX_DEVICE_CLASS_CDC_ECM_MEDIA_FDDI                                  0x00000002
196 #define UX_DEVICE_CLASS_CDC_ECM_MEDIA_WAN                                   0x00000003
197 #define UX_DEVICE_CLASS_CDC_ECM_MEDIA_LOCAL_TALK                            0x00000004
198 #define UX_DEVICE_CLASS_CDC_ECM_MEDIA_DIX                                   0x00000005
199 #define UX_DEVICE_CLASS_CDC_ECM_MEDIA_ARCNET_RAW                            0x00000006
200 #define UX_DEVICE_CLASS_CDC_ECM_MEDIA_ARCNET_878_2                          0x00000007
201 #define UX_DEVICE_CLASS_CDC_ECM_MEDIA_ATM                                   0x00000008
202 #define UX_DEVICE_CLASS_CDC_ECM_MEDIA_WIRELESS_WAN                          0x00000009
203 #define UX_DEVICE_CLASS_CDC_ECM_MEDIA_IRDA                                  0x0000000A
204 
205 /* Define CDC_ECM status values.  */
206 #define UX_DEVICE_CLASS_CDC_ECM_STATUS_SUCCESS                              0x00000000
207 #define UX_DEVICE_CLASS_CDC_ECM_STATUS_FAILURE                              0xC0000001
208 #define UX_DEVICE_CLASS_CDC_ECM_STATUS_INVALID_DATA                         0xC0010015
209 #define UX_DEVICE_CLASS_CDC_ECM_STATUS_NOT_SUPPORTED                        0xC00000BB
210 #define UX_DEVICE_CLASS_CDC_ECM_STATUS_MEDIA_CONNECTED                      0x4001000B
211 #define UX_DEVICE_CLASS_CDC_ECM_STATUS_MEDIA_DISCONNECT                     0x4001000C
212 
213 /* Define CDC_ECM Control Messages values.  */
214 
215 /* Define CDC_ECM State machine.  */
216 #define UX_DEVICE_CLASS_CDC_ECM_STATE_UNINITIALIZED                         0x00000000
217 #define UX_DEVICE_CLASS_CDC_ECM_STATE_INITIALIZED                           0x00000001
218 #define UX_DEVICE_CLASS_CDC_ECM_STATE_DATA_INITIALIZED                      0x00000002
219 
220 /* Define NetX errors inside the CDC_ECM class.  */
221 #define UX_DEVICE_CLASS_CDC_ECM_NX_SUCCESS                                  0x00
222 #define UX_DEVICE_CLASS_CDC_ECM_NX_NO_PACKET                                0x01
223 #define UX_DEVICE_CLASS_CDC_ECM_NX_UNDERFLOW                                0x02
224 #define UX_DEVICE_CLASS_CDC_ECM_NX_OVERFLOW                                 0x03
225 #define UX_DEVICE_CLASS_CDC_ECM_NX_NO_MAPPING                               0x04
226 #define UX_DEVICE_CLASS_CDC_ECM_NX_DELETED                                  0x05
227 #define UX_DEVICE_CLASS_CDC_ECM_NX_POOL_ERROR                               0x06
228 #define UX_DEVICE_CLASS_CDC_ECM_NX_PTR_ERROR                                0x07
229 #define UX_DEVICE_CLASS_CDC_ECM_NX_WAIT_ERROR                               0x08
230 #define UX_DEVICE_CLASS_CDC_ECM_NX_SIZE_ERROR                               0x09
231 #define UX_DEVICE_CLASS_CDC_ECM_NX_OPTION_ERROR                             0x0a
232 #define UX_DEVICE_CLASS_CDC_ECM_NX_DELETE_ERROR                             0x10
233 #define UX_DEVICE_CLASS_CDC_ECM_NX_CALLER_ERROR                             0x11
234 #define UX_DEVICE_CLASS_CDC_ECM_NX_INVALID_PACKET                           0x12
235 #define UX_DEVICE_CLASS_CDC_ECM_NX_INVALID_SOCKET                           0x13
236 #define UX_DEVICE_CLASS_CDC_ECM_NX_NOT_ENABLED                              0x14
237 #define UX_DEVICE_CLASS_CDC_ECM_NX_ALREADY_ENABLED                          0x15
238 #define UX_DEVICE_CLASS_CDC_ECM_NX_ENTRY_NOT_FOUND                          0x16
239 #define UX_DEVICE_CLASS_CDC_ECM_NX_NO_MORE_ENTRIES                          0x17
240 #define UX_DEVICE_CLASS_CDC_ECM_NX_ARP_TIMER_ERROR                          0x18
241 #define UX_DEVICE_CLASS_CDC_ECM_NX_RESERVED_CODE0                           0x19
242 #define UX_DEVICE_CLASS_CDC_ECM_NX_WAIT_ABORTED                             0x1A
243 #define UX_DEVICE_CLASS_CDC_ECM_NX_IP_INTERNAL_ERROR                        0x20
244 #define UX_DEVICE_CLASS_CDC_ECM_NX_IP_ADDRESS_ERROR                         0x21
245 #define UX_DEVICE_CLASS_CDC_ECM_NX_ALREADY_BOUND                            0x22
246 #define UX_DEVICE_CLASS_CDC_ECM_NX_PORT_UNAVAILABLE                         0x23
247 #define UX_DEVICE_CLASS_CDC_ECM_NX_NOT_BOUND                                0x24
248 #define UX_DEVICE_CLASS_CDC_ECM_NX_RESERVED_CODE1                           0x25
249 #define UX_DEVICE_CLASS_CDC_ECM_NX_SOCKET_UNBOUND                           0x26
250 #define UX_DEVICE_CLASS_CDC_ECM_NX_NOT_CREATED                              0x27
251 #define UX_DEVICE_CLASS_CDC_ECM_NX_SOCKETS_BOUND                            0x28
252 #define UX_DEVICE_CLASS_CDC_ECM_NX_NO_RESPONSE                              0x29
253 #define UX_DEVICE_CLASS_CDC_ECM_NX_POOL_DELETED                             0x30
254 #define UX_DEVICE_CLASS_CDC_ECM_NX_ALREADY_RELEASED                         0x31
255 #define UX_DEVICE_CLASS_CDC_ECM_NX_RESERVED_CODE2                           0x32
256 #define UX_DEVICE_CLASS_CDC_ECM_NX_MAX_LISTEN                               0x33
257 #define UX_DEVICE_CLASS_CDC_ECM_NX_DUPLICATE_LISTEN                         0x34
258 #define UX_DEVICE_CLASS_CDC_ECM_NX_NOT_CLOSED                               0x35
259 #define UX_DEVICE_CLASS_CDC_ECM_NX_NOT_LISTEN_STATE                         0x36
260 #define UX_DEVICE_CLASS_CDC_ECM_NX_IN_PROGRESS                              0x37
261 #define UX_DEVICE_CLASS_CDC_ECM_NX_NOT_CONNECTED                            0x38
262 #define UX_DEVICE_CLASS_CDC_ECM_NX_WINDOW_OVERFLOW                          0x39
263 #define UX_DEVICE_CLASS_CDC_ECM_NX_ALREADY_SUSPENDED                        0x40
264 #define UX_DEVICE_CLASS_CDC_ECM_NX_DISCONNECT_FAILED                        0x41
265 #define UX_DEVICE_CLASS_CDC_ECM_NX_STILL_BOUND                              0x42
266 #define UX_DEVICE_CLASS_CDC_ECM_NX_NOT_SUCCESSFUL                           0x43
267 #define UX_DEVICE_CLASS_CDC_ECM_NX_UNHANDLED_COMMAND                        0x44
268 #define UX_DEVICE_CLASS_CDC_ECM_NX_NO_FREE_PORTS                            0x45
269 #define UX_DEVICE_CLASS_CDC_ECM_NX_INVALID_PORT                             0x46
270 #define UX_DEVICE_CLASS_CDC_ECM_NX_INVALID_RELISTEN                         0x47
271 #define UX_DEVICE_CLASS_CDC_ECM_NX_CONNECTION_PENDING                       0x48
272 #define UX_DEVICE_CLASS_CDC_ECM_NX_TX_QUEUE_DEPTH                           0x49
273 #define UX_DEVICE_CLASS_CDC_ECM_NX_NOT_IMPLEMENTED                          0x80
274 
275 /* Define timeout packet allocation value.  */
276 #ifndef UX_DEVICE_CLASS_CDC_ECM_PACKET_POOL_WAIT
277 #define UX_DEVICE_CLASS_CDC_ECM_PACKET_POOL_WAIT                            1000
278 #endif
279 
280 #ifndef UX_DEVICE_CLASS_CDC_ECM_PACKET_POOL_INST_WAIT
281 #define UX_DEVICE_CLASS_CDC_ECM_PACKET_POOL_INST_WAIT                       1000
282 #endif
283 
284 #define UX_DEVICE_CLASS_CDC_ECM_LINK_CHECK_WAIT                             10
285 
286 /* Define Slave CDC_ECM Class Calling Parameter structure */
287 
288 typedef struct UX_SLAVE_CLASS_CDC_ECM_PARAMETER_STRUCT
289 {
290     VOID                    (*ux_slave_class_cdc_ecm_instance_activate)(VOID *);
291     VOID                    (*ux_slave_class_cdc_ecm_instance_deactivate)(VOID *);
292     ULONG                   ux_slave_class_cdc_ecm_parameter_media;
293     ULONG                   ux_slave_class_cdc_ecm_parameter_vendor_id;
294     ULONG                   ux_slave_class_cdc_ecm_parameter_driver_version;
295     UCHAR                   ux_slave_class_cdc_ecm_parameter_vendor_description[UX_DEVICE_CLASS_CDC_ECM_VENDOR_DESCRIPTION_MAX_LENGTH];
296     UCHAR                   ux_slave_class_cdc_ecm_parameter_local_node_id[UX_DEVICE_CLASS_CDC_ECM_NODE_ID_LENGTH];
297     UCHAR                   ux_slave_class_cdc_ecm_parameter_remote_node_id[UX_DEVICE_CLASS_CDC_ECM_NODE_ID_LENGTH];
298 } UX_SLAVE_CLASS_CDC_ECM_PARAMETER;
299 
300 /* Define CDC_ECM Class structure.  */
301 
302 typedef struct UX_SLAVE_CLASS_CDC_ECM_STRUCT
303 {
304     UX_SLAVE_INTERFACE                      *ux_slave_class_cdc_ecm_interface;
305     UX_SLAVE_CLASS_CDC_ECM_PARAMETER        ux_slave_class_cdc_ecm_parameter;
306     UX_SLAVE_ENDPOINT                       *ux_slave_class_cdc_ecm_bulkin_endpoint;
307     UX_SLAVE_ENDPOINT                       *ux_slave_class_cdc_ecm_bulkout_endpoint;
308     UX_SLAVE_ENDPOINT                       *ux_slave_class_cdc_ecm_interrupt_endpoint;
309     ULONG                                   ux_slave_class_cdc_ecm_state;
310     ULONG                                   ux_slave_class_cdc_ecm_current_alternate_setting;
311     ULONG                                   ux_slave_class_cdc_ecm_max_transfer_size;
312     ULONG                                   ux_slave_class_cdc_ecm_request_id;
313     ULONG                                   ux_slave_class_cdc_ecm_statistics_xmit_ok;
314     ULONG                                   ux_slave_class_cdc_ecm_statistics_rcv_ok;
315     ULONG                                   ux_slave_class_cdc_ecm_statistics_xmit_error;
316     ULONG                                   ux_slave_class_cdc_ecm_statistics_rcv_error;
317     ULONG                                   ux_slave_class_cdc_ecm_statistics_rcv_no_buffer;
318     ULONG                                   ux_slave_class_cdc_ecm_statistics_rcv_error_alignment;
319     ULONG                                   ux_slave_class_cdc_ecm_statistics_xmit_one_collision;
320     ULONG                                   ux_slave_class_cdc_ecm_statistics_xmit_more_collisions;
321     ULONG                                   ux_slave_class_cdc_ecm_ethernet_multicast_filter;
322     ULONG                                   ux_slave_class_cdc_ecm_ethernet_power_management_filter;
323     ULONG                                   ux_slave_class_cdc_ecm_ethernet_packet_filter;
324     UCHAR                                   ux_slave_class_cdc_ecm_local_node_id[UX_DEVICE_CLASS_CDC_ECM_NODE_ID_LENGTH];
325     UCHAR                                   ux_slave_class_cdc_ecm_remote_node_id[UX_DEVICE_CLASS_CDC_ECM_NODE_ID_LENGTH];
326     ULONG                                   ux_slave_class_cdc_ecm_nx_ip_address;
327     ULONG                                   ux_slave_class_cdc_ecm_nx_ip_network_mask;
328 
329 #if !defined(UX_DEVICE_STANDALONE)
330     NX_IP                                   *ux_slave_class_cdc_ecm_nx_ip;
331     NX_INTERFACE                            *ux_slave_class_cdc_ecm_nx_interface;
332     NX_PACKET                               *ux_slave_class_cdc_ecm_xmit_queue;
333     NX_PACKET                               *ux_slave_class_cdc_ecm_xmit_queue_tail;
334     NX_PACKET                               *ux_slave_class_cdc_ecm_receive_queue;
335     NX_PACKET_POOL                          *ux_slave_class_cdc_ecm_packet_pool;
336 #endif
337 
338 #if !defined(UX_DEVICE_STANDALONE)
339     UX_EVENT_FLAGS_GROUP                    ux_slave_class_cdc_ecm_event_flags_group;
340     UX_THREAD                               ux_slave_class_cdc_ecm_bulkin_thread;
341     UX_THREAD                               ux_slave_class_cdc_ecm_bulkout_thread;
342     UX_THREAD                               ux_slave_class_cdc_ecm_interrupt_thread;
343     UX_MUTEX                                ux_slave_class_cdc_ecm_mutex;
344     UCHAR                                   *ux_slave_class_cdc_ecm_bulkin_thread_stack;
345     UCHAR                                   *ux_slave_class_cdc_ecm_bulkout_thread_stack;
346     UCHAR                                   *ux_slave_class_cdc_ecm_interrupt_thread_stack;
347 #endif
348 
349     ULONG                                   ux_slave_class_cdc_ecm_link_state;
350     VOID                                    *ux_slave_class_cdc_ecm_network_handle;
351 
352 } UX_SLAVE_CLASS_CDC_ECM;
353 
354 
355 /* Requests - Ethernet Networking Control Model */
356 
357 #define UX_DEVICE_CLASS_CDC_ECM_SEND_ENCAPSULATED_COMMAND                        0x00
358                                         /* Issues a command in the format of the supported control
359                                            protocol. The intent of this mechanism is to support
360                                            networking devices (e.g., host-based cable modems)
361                                            that require an additional vendor-defined interface for
362                                            media specific hardware configuration and
363                                            management.  */
364 #define UX_DEVICE_CLASS_CDC_ECM_GET_ENCAPSULATED_RESPONSE                        0x01
365                                         /* Requests a response in the format of the supported
366                                            control protocol.  */
367 
368 
369 /* Define buffer length for IN/OUT pipes.  */
370 
371 #define UX_DEVICE_CLASS_CDC_ECM_BUFFER_SIZE                  4096
372 
373 
374 /* Define Device CDC_ECM Class prototypes.  */
375 
376 UINT  _ux_device_class_cdc_ecm_activate(UX_SLAVE_CLASS_COMMAND *command);
377 UINT  _ux_device_class_cdc_ecm_control_request(UX_SLAVE_CLASS_COMMAND *command);
378 UINT  _ux_device_class_cdc_ecm_deactivate(UX_SLAVE_CLASS_COMMAND *command);
379 UINT  _ux_device_class_cdc_ecm_change(UX_SLAVE_CLASS_COMMAND *command);
380 UINT  _ux_device_class_cdc_ecm_entry(UX_SLAVE_CLASS_COMMAND *command);
381 UINT  _ux_device_class_cdc_ecm_initialize(UX_SLAVE_CLASS_COMMAND *command);
382 UINT  _ux_device_class_cdc_ecm_uninitialize(UX_SLAVE_CLASS_COMMAND *command);
383 UINT  _ux_device_class_cdc_ecm_write(VOID *cdc_ecm_class, NX_PACKET *packet);
384 VOID  _ux_device_class_cdc_ecm_bulkin_thread(ULONG cdc_ecm_class);
385 VOID  _ux_device_class_cdc_ecm_bulkout_thread(ULONG cdc_ecm_class);
386 VOID  _ux_device_class_cdc_ecm_interrupt_thread(ULONG cdc_ecm_class);
387 
388 
389 /* Define Device CDC Class API prototypes.  */
390 
391 #define ux_device_class_cdc_ecm_entry    _ux_device_class_cdc_ecm_entry
392 #define ux_device_class_cdc_ecm_read     _ux_device_class_cdc_ecm_read
393 #define ux_device_class_cdc_ecm_write    _ux_device_class_cdc_ecm_write
394 
395 /* Determine if a C++ compiler is being used.  If so, complete the standard
396    C conditional started above.  */
397 #ifdef __cplusplus
398 }
399 #endif
400 
401 #endif /* UX_DEVICE_CLASS_CDC_ECM_H */
402