diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_thread.c b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_thread.c index 8c24bc1c..88d0a4c4 100644 --- a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_thread.c +++ b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_thread.c @@ -1,18 +1,18 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ -/** */ -/** USBX Component */ +/** */ +/** USBX Component */ /** */ /** CDC_ECM Class */ /** */ @@ -30,32 +30,32 @@ #if !defined(UX_HOST_STANDALONE) -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _ux_host_class_cdc_ecm_thread PORTABLE C */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _ux_host_class_cdc_ecm_thread PORTABLE C */ /* 6.2.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ +/* */ /* This is the CDC ECM thread that monitors the link change flag, */ /* receives data from the device, and passes the data to the NetX-USB */ -/* broker. */ -/* */ -/* INPUT */ -/* */ -/* cdc_ecm CDC ECM instance */ -/* */ -/* OUTPUT */ -/* */ -/* Completion Status */ -/* */ -/* CALLS */ -/* */ +/* broker. */ +/* */ +/* INPUT */ +/* */ +/* cdc_ecm CDC ECM instance */ +/* */ +/* OUTPUT */ +/* */ +/* Completion Status */ +/* */ +/* CALLS */ +/* */ /* _ux_host_class_cdc_ecm_transmit_queue_clean */ /* Clean transmit queue */ /* _ux_host_stack_transfer_request Transfer request */ @@ -67,15 +67,15 @@ /* _ux_network_driver_packet_received Process received packet */ /* nx_packet_allocate Allocate NetX packet */ /* nx_packet_release Free NetX packet */ -/* */ -/* CALLED BY */ -/* */ -/* CDC ECM class initialization */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ +/* */ +/* CALLED BY */ +/* */ +/* CDC ECM class initialization */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ /* prefixed UX to MS_TO_TICK, */ @@ -114,9 +114,9 @@ ULONG packet_buffer_size; /* Cast the parameter passed in the thread into the cdc_ecm pointer. */ UX_THREAD_EXTENSION_PTR_GET(cdc_ecm, UX_HOST_CLASS_CDC_ECM, parameter) - /* Loop forever waiting for changes signaled through the semaphore. */ + /* Loop forever waiting for changes signaled through the semaphore. */ while (1) - { + { /* Wait for the semaphore to be put by the cdc_ecm interrupt event. */ _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; /* Communicate the state with the network driver. */ _ux_network_driver_link_up(cdc_ecm -> ux_host_class_cdc_ecm_network_handle); - + /* As long as we are connected, configured and link up ... do some work.... */ while ((cdc_ecm -> ux_host_class_cdc_ecm_link_state == UX_HOST_CLASS_CDC_ECM_LINK_STATE_UP) && - (cdc_ecm -> ux_host_class_cdc_ecm_device -> ux_device_state == UX_DEVICE_CONFIGURED)) + (cdc_ecm -> ux_host_class_cdc_ecm_device -> ux_device_state == UX_DEVICE_CONFIGURED)) { /* Check if we have packet pool available. */ @@ -154,7 +154,7 @@ ULONG packet_buffer_size; { /* IP instance is not available, wait for application to attach the interface. */ - _ux_utility_delay_ms(UX_MS_TO_TICK(UX_HOST_CLASS_CDC_ECM_PACKET_POOL_INSTANCE_WAIT)); + _ux_utility_delay_ms(UX_HOST_CLASS_CDC_ECM_PACKET_POOL_INSTANCE_WAIT); } continue; } @@ -168,7 +168,7 @@ ULONG packet_buffer_size; /* Adjust the prepend pointer to take into account the non 3 bit alignment of the ethernet header. */ packet -> nx_packet_prepend_ptr += sizeof(USHORT); - + /* We have a packet. Link this packet to the reception transfer request on the bulk in endpoint. */ transfer_request = &cdc_ecm -> ux_host_class_cdc_ecm_bulk_in_endpoint -> ux_endpoint_transfer_request; @@ -206,18 +206,18 @@ ULONG packet_buffer_size; #endif { - /* Set the data pointer. */ + /* Set the data pointer. */ transfer_request -> ux_transfer_request_data_pointer = packet -> nx_packet_prepend_ptr; - + } /* And length. */ transfer_request -> ux_transfer_request_requested_length = UX_HOST_CLASS_CDC_ECM_NX_PAYLOAD_SIZE; transfer_request -> ux_transfer_request_actual_length = 0; - + /* Store the packet that owns this transaction. */ transfer_request -> ux_transfer_request_user_specific = packet; - + /* Reset the queue pointer of this packet. */ packet -> nx_packet_queue_next = UX_NULL; @@ -235,7 +235,7 @@ ULONG packet_buffer_size; cdc_ecm -> ux_host_class_cdc_ecm_bulk_in_transfer_check_and_arm_in_process = UX_FALSE; if (cdc_ecm -> ux_host_class_cdc_ecm_bulk_in_transfer_waiting_for_check_and_arm_to_finish == UX_TRUE) _ux_host_semaphore_put(&cdc_ecm -> ux_host_class_cdc_ecm_bulk_in_transfer_waiting_for_check_and_arm_to_finish_semaphore); - + /* Check if the transaction was armed successfully. */ if (status == UX_SUCCESS) { @@ -280,13 +280,13 @@ ULONG packet_buffer_size; { /* Get the packet length. */ - packet -> nx_packet_length = transfer_request -> ux_transfer_request_actual_length; - - /* Adjust the prepend, length, and append fields. */ + packet -> nx_packet_length = transfer_request -> ux_transfer_request_actual_length; + + /* Adjust the prepend, length, and append fields. */ packet -> nx_packet_append_ptr = packet->nx_packet_prepend_ptr + transfer_request -> ux_transfer_request_actual_length; } - + /* Send that packet to the NetX USB broker. */ _ux_network_driver_packet_received(cdc_ecm -> ux_host_class_cdc_ecm_network_handle, packet); } @@ -345,6 +345,6 @@ ULONG packet_buffer_size; /* Set the link state. */ cdc_ecm -> ux_host_class_cdc_ecm_link_state = UX_HOST_CLASS_CDC_ECM_LINK_STATE_DOWN; } - } + } } #endif