11/***************************************************************************
2- * Copyright (c) 2024 Microsoft Corporation
3- *
2+ * Copyright (c) 2024 Microsoft Corporation
3+ *
44 * This program and the accompanying materials are made available under the
55 * terms of the MIT License which is available at
66 * https://opensource.org/licenses/MIT.
7- *
7+ *
88 * SPDX-License-Identifier: MIT
99 **************************************************************************/
1010
1111
1212/**************************************************************************/
1313/**************************************************************************/
14- /** */
15- /** USBX Component */
14+ /** */
15+ /** USBX Component */
1616/** */
1717/** CDC_ECM Class */
1818/** */
3030
3131
3232#if !defined(UX_HOST_STANDALONE )
33- /**************************************************************************/
34- /* */
35- /* FUNCTION RELEASE */
36- /* */
37- /* _ux_host_class_cdc_ecm_thread PORTABLE C */
33+ /**************************************************************************/
34+ /* */
35+ /* FUNCTION RELEASE */
36+ /* */
37+ /* _ux_host_class_cdc_ecm_thread PORTABLE C */
3838/* 6.2.0 */
3939/* AUTHOR */
4040/* */
4141/* Chaoqiong Xiao, Microsoft Corporation */
4242/* */
4343/* DESCRIPTION */
44- /* */
44+ /* */
4545/* This is the CDC ECM thread that monitors the link change flag, */
4646/* receives data from the device, and passes the data to the NetX-USB */
47- /* broker. */
48- /* */
49- /* INPUT */
50- /* */
51- /* cdc_ecm CDC ECM instance */
52- /* */
53- /* OUTPUT */
54- /* */
55- /* Completion Status */
56- /* */
57- /* CALLS */
58- /* */
47+ /* broker. */
48+ /* */
49+ /* INPUT */
50+ /* */
51+ /* cdc_ecm CDC ECM instance */
52+ /* */
53+ /* OUTPUT */
54+ /* */
55+ /* Completion Status */
56+ /* */
57+ /* CALLS */
58+ /* */
5959/* _ux_host_class_cdc_ecm_transmit_queue_clean */
6060/* Clean transmit queue */
6161/* _ux_host_stack_transfer_request Transfer request */
6767/* _ux_network_driver_packet_received Process received packet */
6868/* nx_packet_allocate Allocate NetX packet */
6969/* nx_packet_release Free NetX packet */
70- /* */
71- /* CALLED BY */
72- /* */
73- /* CDC ECM class initialization */
74- /* */
75- /* RELEASE HISTORY */
76- /* */
77- /* DATE NAME DESCRIPTION */
78- /* */
70+ /* */
71+ /* CALLED BY */
72+ /* */
73+ /* CDC ECM class initialization */
74+ /* */
75+ /* RELEASE HISTORY */
76+ /* */
77+ /* DATE NAME DESCRIPTION */
78+ /* */
7979/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
8080/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
8181/* prefixed UX to MS_TO_TICK, */
@@ -114,9 +114,9 @@ ULONG packet_buffer_size;
114114 /* Cast the parameter passed in the thread into the cdc_ecm pointer. */
115115 UX_THREAD_EXTENSION_PTR_GET (cdc_ecm , UX_HOST_CLASS_CDC_ECM , parameter )
116116
117- /* Loop forever waiting for changes signaled through the semaphore. */
117+ /* Loop forever waiting for changes signaled through the semaphore. */
118118 while (1 )
119- {
119+ {
120120
121121 /* Wait for the semaphore to be put by the cdc_ecm interrupt event. */
122122 _ux_host_semaphore_get_norc (& cdc_ecm -> ux_host_class_cdc_ecm_interrupt_notification_semaphore , UX_WAIT_FOREVER );
@@ -130,10 +130,10 @@ ULONG packet_buffer_size;
130130
131131 /* Communicate the state with the network driver. */
132132 _ux_network_driver_link_up (cdc_ecm -> ux_host_class_cdc_ecm_network_handle );
133-
133+
134134 /* As long as we are connected, configured and link up ... do some work.... */
135135 while ((cdc_ecm -> ux_host_class_cdc_ecm_link_state == UX_HOST_CLASS_CDC_ECM_LINK_STATE_UP ) &&
136- (cdc_ecm -> ux_host_class_cdc_ecm_device -> ux_device_state == UX_DEVICE_CONFIGURED ))
136+ (cdc_ecm -> ux_host_class_cdc_ecm_device -> ux_device_state == UX_DEVICE_CONFIGURED ))
137137 {
138138
139139 /* Check if we have packet pool available. */
@@ -154,7 +154,7 @@ ULONG packet_buffer_size;
154154 {
155155
156156 /* IP instance is not available, wait for application to attach the interface. */
157- _ux_utility_delay_ms (UX_MS_TO_TICK ( UX_HOST_CLASS_CDC_ECM_PACKET_POOL_INSTANCE_WAIT ) );
157+ _ux_utility_delay_ms (UX_HOST_CLASS_CDC_ECM_PACKET_POOL_INSTANCE_WAIT );
158158 }
159159 continue ;
160160 }
@@ -168,7 +168,7 @@ ULONG packet_buffer_size;
168168
169169 /* Adjust the prepend pointer to take into account the non 3 bit alignment of the ethernet header. */
170170 packet -> nx_packet_prepend_ptr += sizeof (USHORT );
171-
171+
172172 /* We have a packet. Link this packet to the reception transfer request on the bulk in endpoint. */
173173 transfer_request = & cdc_ecm -> ux_host_class_cdc_ecm_bulk_in_endpoint -> ux_endpoint_transfer_request ;
174174
@@ -206,18 +206,18 @@ ULONG packet_buffer_size;
206206#endif
207207 {
208208
209- /* Set the data pointer. */
209+ /* Set the data pointer. */
210210 transfer_request -> ux_transfer_request_data_pointer = packet -> nx_packet_prepend_ptr ;
211-
211+
212212 }
213213
214214 /* And length. */
215215 transfer_request -> ux_transfer_request_requested_length = UX_HOST_CLASS_CDC_ECM_NX_PAYLOAD_SIZE ;
216216 transfer_request -> ux_transfer_request_actual_length = 0 ;
217-
217+
218218 /* Store the packet that owns this transaction. */
219219 transfer_request -> ux_transfer_request_user_specific = packet ;
220-
220+
221221 /* Reset the queue pointer of this packet. */
222222 packet -> nx_packet_queue_next = UX_NULL ;
223223
@@ -235,7 +235,7 @@ ULONG packet_buffer_size;
235235 cdc_ecm -> ux_host_class_cdc_ecm_bulk_in_transfer_check_and_arm_in_process = UX_FALSE ;
236236 if (cdc_ecm -> ux_host_class_cdc_ecm_bulk_in_transfer_waiting_for_check_and_arm_to_finish == UX_TRUE )
237237 _ux_host_semaphore_put (& cdc_ecm -> ux_host_class_cdc_ecm_bulk_in_transfer_waiting_for_check_and_arm_to_finish_semaphore );
238-
238+
239239 /* Check if the transaction was armed successfully. */
240240 if (status == UX_SUCCESS )
241241 {
@@ -280,13 +280,13 @@ ULONG packet_buffer_size;
280280 {
281281
282282 /* Get the packet length. */
283- packet -> nx_packet_length = transfer_request -> ux_transfer_request_actual_length ;
284-
285- /* Adjust the prepend, length, and append fields. */
283+ packet -> nx_packet_length = transfer_request -> ux_transfer_request_actual_length ;
284+
285+ /* Adjust the prepend, length, and append fields. */
286286 packet -> nx_packet_append_ptr =
287287 packet -> nx_packet_prepend_ptr + transfer_request -> ux_transfer_request_actual_length ;
288288 }
289-
289+
290290 /* Send that packet to the NetX USB broker. */
291291 _ux_network_driver_packet_received (cdc_ecm -> ux_host_class_cdc_ecm_network_handle , packet );
292292 }
@@ -345,6 +345,6 @@ ULONG packet_buffer_size;
345345 /* Set the link state. */
346346 cdc_ecm -> ux_host_class_cdc_ecm_link_state = UX_HOST_CLASS_CDC_ECM_LINK_STATE_DOWN ;
347347 }
348- }
348+ }
349349}
350350#endif
0 commit comments