Difference between revisions of "Unit USBCDCETHERNET"

From Ultibo.org
Jump to: navigation, search
 
Line 452: Line 452:
 
----
 
----
  
''To be documented''
 
  
 +
'''Initialization functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure CDCEthernetInit;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the CDC Ethernet unit, create and register the driver</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| Called only during system startup
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''CDCEthernet network functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function CDCEthernetNetworkOpen(Network:PNetworkDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of NetworkDeviceOpen for the CDC Ethernet device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| Not intended to be called directly by applications, use NetworkDeviceOpen instead.
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function CDCEthernetNetworkClose(Network:PNetworkDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of NetworkDeviceClose for the CDC Ethernet device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| Not intended to be called directly by applications, use NetworkDeviceClose instead.
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function CDCEthernetNetworkControl(Network:PNetworkDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of NetworkDeviceControl for the CDC Ethernet device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| Not intended to be called directly by applications, use NetworkDeviceControl instead.
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function CDCEthernetBufferAllocate(Network:PNetworkDevice; var Entry:PNetworkEntry):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of NetworkBufferAllocate for the CDC Ethernet device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| Not intended to be called directly by applications, use NetworkBufferAllocate instead.
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function CDCEthernetBufferRelease(Network:PNetworkDevice; Entry:PNetworkEntry):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of NetworkBufferRelease for the CDC Ethernet device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| Not intended to be called directly by applications, use NetworkBufferRelease instead.
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function CDCEthernetBufferReceive(Network:PNetworkDevice; var Entry:PNetworkEntry):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of NetworkBufferReceive for the CDC Ethernet device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| Not intended to be called directly by applications, use NetworkBufferReceive instead.
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function CDCEthernetBufferTransmit(Network:PNetworkDevice; Entry:PNetworkEntry):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of NetworkBufferTransmit for the CDC Ethernet device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| Not intended to be called directly by applications, use NetworkBufferTransmit instead.
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''CDC Ethernet USB functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function CDCEthernetDriverBind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Bind the CDC Ethernet driver to a USB device if it is suitable</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The USB device to attempt to bind to
 +
|-
 +
! Interrface
 +
| The USB interface to attempt to bind to (or nil for whole device)
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed, USB_STATUS_DEVICE_UNSUPPORTED if unsupported or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function CDCEthernetDriverUnbind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Unbind the CDC Ethernet driver from a USB device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The USB device to unbind from
 +
|-
 +
! Interrface
 +
| The USB interface to unbind from (or nil for whole device)
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure CDCEthernetReceiveWorker(Request:PUSBRequest);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called (by a Worker thread) to process a completed USB request from the CDC Ethernet bulk IN endpoint</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Request
 +
| The USB request which has completed
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure CDCEthernetReceiveComplete(Request:PUSBRequest);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called when a USB request from the CDC Ethernet bulk IN endpoint completes</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Request
 +
| The USB request which has completed
 +
|-
 +
! Note
 +
| Request is passed to worker thread for processing to prevent blocking the USB completion
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure CDCEthernetTransmitWorker(Request:PUSBRequest);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called (by a Worker thread) to process a completed USB request to the CDC Ethernet bulk OUT endpoint</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Request
 +
| The USB request which has completed
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure CDCEthernetTransmitComplete(Request:PUSBRequest);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called when a USB request to the CDC Ethernet bulk OUT endpoint completes</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Request
 +
| The USB request which has completed
 +
|-
 +
! Note
 +
| Request is passed to worker thread for processing to prevent blocking the USB completion
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure CDCEthernetInterruptWorker(Request:PUSBRequest);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called (by a Worker thread) to process a completed USB request from the CDC Ethernet interrupt IN endpoint</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Request
 +
| The USB request which has completed
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure CDCEthernetInterruptComplete(Request:PUSBRequest);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called when a USB request from the CDC Ethernet interrupt IN endpoint completes</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Request
 +
| The USB request which has completed
 +
|-
 +
! Note
 +
| Request is passed to worker thread for processing to prevent blocking the USB completion
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''CDC ethernet helper functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function CDCEthernetCheckDeviceAndInterface(Device:PUSBDevice; Interrface:PUSBInterface; out DriverInfo:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check the Device and Interface against the supported and blacklisted devices</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| USB device to check
 +
|-
 +
! Interrface
 +
| USB interface to check
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function CDCEthernetGetMacAddress(Device:PUSBDevice; Index:LongWord; Address:PHardwareAddress):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the MAC address of a CDC Ethernet device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| USB device to read from
 +
|-
 +
! Index
 +
| The string descriptor index containing the MAC address
 +
|-
 +
! Address
 +
| Value to read the MAC address into
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function CDCEthernetUpdateFilter(Network:PCDCEthernetNetwork):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Update the packet filter of the CDC Ethernet device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Network
 +
| The network device to update the packet filter for
 +
|-
 +
! Return
 +
| USB_STATUS_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
Return to [[Unit_Reference|Unit Reference]]
 
Return to [[Unit_Reference|Unit Reference]]

Latest revision as of 06:27, 9 September 2021

Return to Unit Reference


Description


USB CDC Ethernet Driver unit

The Ethernet model is part of the USB Communications Device Class (CDC) standard which allows ethernet based networking devices to be supported by USB with a standardized protocol for data transfer and link status.

A CDC Ethernet device is defined by information in the interface descriptors and is not specific to any product and vendor ID. There are numerous devices that support the CDC Ethernet protocol including a number of external adapters and combination hubs.

This driver presents any device recognized as a CDC Ethernet as a standard network device that can be accessed using the API in the Network, Winsock, Winsock2 and Sockets units. It should not be necessary to directly call any of the functions in this unit from application code.

Note: The QEMU emulations of the Raspberry Pi Zero/A+/2B/3A+/3B use a USB CDC Ethernet device.

Constants



CDC ethernet specific CDCETHERNET_*
CDCETHERNET_DRIVER_NAME = 'USB CDC Ethernet Driver'; Name of CDC Ethernet driver
 
CDCETHERNET_NETWORK_DESCRIPTION = 'USB CDC Ethernet Adapter'; Description of CDC Ethernet device
 
CDCETHERNET_MAX_QUEUE_MEMORY = 60 * ETHERNET_MAX_PACKET_SIZE;  
 
CDCETHERNET_RX_REQUEST_SIZE = SIZE_2K;  
CDCETHERNET_TX_REQUEST_SIZE = ETHERNET_MAX_PACKET_SIZE;  


Driver info constants DRIVER_INFO_*
DRIVER_INFO_NONE = 0; Blacklisted Device
DRIVER_INFO_CDC = 1; CDC Ethernet Device
DRIVER_INFO_ZTE_CDC = 2; ZTE CDC Ethernet Device
DRIVER_INFO_WWAN = 3; Mobile Broadband Network Device


Vendor id *_VENDOR_ID
HUAWEI_VENDOR_ID = $12D1;  
NOVATEL_VENDOR_ID = $1410;  
ZTE_VENDOR_ID = $19D2;  
DELL_VENDOR_ID = $413C;  
REALTEK_VENDOR_ID = $0bda;  
SAMSUNG_VENDOR_ID = $04e8;  
LENOVO_VENDOR_ID = $17ef;  
LINKSYS_VENDOR_ID = $13b1;  
NVIDIA_VENDOR_ID = $0955;  
HP_VENDOR_ID = $03f0;  
MICROSOFT_VENDOR_ID = $045e;  
UBLOX_VENDOR_ID = $1546;  
TPLINK_VENDOR_ID = $2357;  
AQUANTIA_VENDOR_ID = $2eca;  
ASIX_VENDOR_ID = $0b95;  
 
GUID for Ericsson MBM devices
MBM_GUID:array[0..15] of Byte = ($a3, $17, $a8, $8b, $04, $5e, $4f, $01, $a6, $07, $c0, $ff, $cb, $7e, $39, $2a);


CDC ethernet device and interface id CDCETHERNET_DEVICE_ID_*
CDCETHERNET_DEVICE_ID_COUNT = 57; Number of supported Device and Interface Ids
 
CDCETHERNET_DEVICE_ID:array[0..CDCETHERNET_DEVICE_ID_COUNT - 1] of TCDCEthernetDeviceId = (  
Blacklisted devices
(idVendor:$04DD; idProduct:$8004; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), SA-1100 based Sharp Zaurus
 
(idVendor:$04DD; idProduct:$8005; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), PXA-25x based Sharp Zaurii (A-300)
(idVendor:$04DD; idProduct:$8006; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), (B-500/SL-5600)
(idVendor:$04DD; idProduct:$8007; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), (C-700)
(idVendor:$04DD;idProduct:$9031; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), (C-750 C-760)
(idVendor:$04DD; idProduct:$9032; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), (SL-6000)
(idVendor:$04DD; idProduct:$9050; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), (C-860)
(idVendor:$07B4; idProduct:$0F02; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), (R-1000)
 
(idVendor:$1004; idProduct:$61aa; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), LG Electronics VL600
(idVendor:$046d; idProduct:$c11f; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_MDLM; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), Logitech Harmony 900
(idVendor:NOVATEL_VENDOR_ID; idProduct:$B001; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), Novatel USB551L and MC551
(idVendor:NOVATEL_VENDOR_ID; idProduct:$9010; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), Novatel E362
(idVendor:DELL_VENDOR_ID; idProduct:$8195; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), Dell Wireless 5800 (Novatel E362)
(idVendor:DELL_VENDOR_ID; idProduct:$8196; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), Dell Wireless 5800 (Novatel E362)
(idVendor:DELL_VENDOR_ID; idProduct:$819b; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), Dell Wireless 5804 (Novatel E371)
(idVendor:NOVATEL_VENDOR_ID; idProduct:$9011; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), Novatel Expedite E371
(idVendor:HP_VENDOR_ID; idProduct:$421d; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), HP lt2523 (Novatel E371)
(idVendor:$16d5; idProduct:$650a; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), AnyDATA ADU960S
(idVendor:HUAWEI_VENDOR_ID; idProduct:$14ac; bInterfaceClass:0; bInterfaceSubClass:0; bInterfaceProtocol:0; DriverInfo:DRIVER_INFO_NONE), Huawei E1820 (Interface Number 1)
(idVendor:REALTEK_VENDOR_ID; idProduct:$8152; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), Realtek RTL8152 Based USB 2.0 Ethernet Adapters
(idVendor:REALTEK_VENDOR_ID; idProduct:$8153; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), Realtek RTL8153 Based USB 3.0 Ethernet Adapters
(idVendor:SAMSUNG_VENDOR_ID; idProduct:$a101; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), Samsung USB Ethernet Adapters
(idVendor:LINKSYS_VENDOR_ID; idProduct:$0041; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), Linksys USB3GIGV1 Ethernet Adapter
(idVendor:LENOVO_VENDOR_ID; idProduct:$3062; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), ThinkPad USB-C Dock (Realtek RTL8153)
(idVendor:LENOVO_VENDOR_ID; idProduct:$3069; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), ThinkPad Thunderbolt 3 Dock (Realtek RTL8153)
(idVendor:LENOVO_VENDOR_ID; idProduct:$3082; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), ThinkPad Thunderbolt 3 Dock Gen 2 (Realtek RTL8153)
(idVendor:LENOVO_VENDOR_ID; idProduct:$7205; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), Lenovo Thinkpad USB 3.0 Ethernet Adapters (Realtek RTL8153)
(idVendor:LENOVO_VENDOR_ID; idProduct:$720c; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), Lenovo USB C to Ethernet Adapter (Realtek RTL8153)
(idVendor:LENOVO_VENDOR_ID; idProduct:$7214; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), Lenovo USB-C Travel Hub (Realtek RTL8153)
(idVendor:LENOVO_VENDOR_ID; idProduct:$721e; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), Lenovo Powered USB-C Travel Hub (Realtek RTL8153)
(idVendor:LENOVO_VENDOR_ID; idProduct:$a387; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), ThinkPad USB-C Dock Gen 2 (Realtek RTL8153)
(idVendor:NVIDIA_VENDOR_ID; idProduct:$09ff; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), NVIDIA Tegra USB 3.0 Ethernet Adapters (Realtek RTL8153)
(idVendor:MICROSOFT_VENDOR_ID; idProduct:$07ab; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), Microsoft Surface 2 dock (Realtek RTL8152)
(idVendor:MICROSOFT_VENDOR_ID; idProduct:$07c6; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), Microsoft Surface Ethernet Adapter (Realtek RTL8153)
(idVendor:MICROSOFT_VENDOR_ID; idProduct:$0927; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), Microsoft Surface Ethernet Adapter (Realtek RTL8153B)
 
(idVendor:TPLINK_VENDOR_ID; idProduct:$0601; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), TP-LINK UE300 USB 3.0 Ethernet Adapters (Realtek RTL8153)
(idVendor:AQUANTIA_VENDOR_ID; idProduct:$c101; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), Aquantia AQtion USB to 5GbE Controller (AQC111U)
(idVendor:ASIX_VENDOR_ID; idProduct:$2790; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), ASIX USB 3.1 Gen1 to 5G Multi-Gigabit Ethernet Adapter (AQC111U)
(idVendor:ASIX_VENDOR_ID; idProduct:$2791; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), ASIX USB 3.1 Gen1 to 2.5G Multi-Gigabit Ethernet Adapter (AQC112U)
(idVendor:$20f4; idProduct:$e05a; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), USB-C 3.1 to 5GBASE-T Ethernet Adapter (AQC111U)
(idVendor:$1c04; idProduct:$0015; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_NONE), QNAP QNA-UC5G1T USB to 5GbE Adapter (AQC111U)
 
Supported devices
(idVendor:ZTE_VENDOR_ID; idProduct:$1003; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_WWAN), ZTE (Vodafone) K3805-Z
(idVendor:ZTE_VENDOR_ID; idProduct:$1015; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_WWAN), ZTE (Vodafone) K3806-Z
(idVendor:ZTE_VENDOR_ID; idProduct:$1173; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_WWAN), ZTE (Vodafone) K4510-Z
(idVendor:ZTE_VENDOR_ID; idProduct:$1177; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_WWAN), ZTE (Vodafone) K3770-Z
(idVendor:ZTE_VENDOR_ID; idProduct:$1181; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_WWAN), ZTE (Vodafone) K3772-Z
(idVendor:$1bc7; idProduct:$0000; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_WWAN), Telit modules
(idVendor:DELL_VENDOR_ID; idProduct:$81ba; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_WWAN), Dell DW5580 modules
(idVendor:HUAWEI_VENDOR_ID; idProduct:$15c1; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_WWAN), Huawei ME906 and ME909
(idVendor:ZTE_VENDOR_ID; idProduct:$0000; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_ZTE_CDC), ZTE modules
(idVendor:UBLOX_VENDOR_ID; idProduct:$1143; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_WWAN), U-blox TOBY-L2
(idVendor:UBLOX_VENDOR_ID; idProduct:$1104; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_WWAN), U-blox SARA-U2
(idVendor:$1e2d; idProduct:$0061; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_WWAN), Cinterion PLS8 modem by GEMALTO
(idVendor:$1e2d; idProduct:$0055; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_WWAN), Cinterion AHS3 modem by GEMALTO
 
(idVendor:HUAWEI_VENDOR_ID; idProduct:$0000; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:$FF; DriverInfo:DRIVER_INFO_WWAN), Various Huawei modems with a network port like the UMG1831
 
(idVendor:$0000; idProduct:$0000; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_ETHERNET; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_CDC), Generic CDC Ethernet
(idVendor:$0000; idProduct:$0000; bInterfaceClass:USB_CLASS_CODE_COMMS; bInterfaceSubClass:USB_SUBCLASS_CDC_MDLM; bInterfaceProtocol:USB_PROTOCOL_CDC_ACM_NONE; DriverInfo:DRIVER_INFO_WWAN) Generic CDC MDLM
);  


Type definitions



CDC ethernet device and interface id

PCDCEthernetDeviceId = ^TCDCEthernetDeviceId;

TCDCEthernetDeviceId = record

idVendor:Word;  
idProduct:Word;  
bInterfaceClass:Byte;  
bInterfaceSubClass:Byte;  
bInterfaceProtocol:Byte;  
DriverInfo:LongWord;  

CDC ethernet network

PCDCEthernetNetwork = ^TCDCEthernetNetwork;

TCDCEthernetNetwork = record

Network Properties
Network:TNetworkDevice;  
Driver Properties
HardMTU:LongWord; Hard MTU (Maximum Transmission Unit) value for the CDC Ethernet device
DriverInfo:LongWord; Driver Info for the CDC Ethernet device (eg DRIVER_INFO_CDC)
LinkStatus:LongWord; Last reported link status
HardwareAddress:THardwareAddress; Current Ethernet MAC Address
ReceiveRequestSize:LongWord; Size of each USB receive request buffer
TransmitRequestSize:LongWord; Size of each USB transmit request buffer
ReceiveEntryCount:LongWord; Number of entries in the receive queue
TransmitEntryCount:LongWord; Number of entries in the transmit queue
USB Properties
DataInterface:PUSBInterface; USB interface for data requests
ControlInterface:PUSBInterface; USB interface for control requests
ReceiveRequest:PUSBRequest; USB request Bulk IN Endpoint
ReceiveEndpoint:PUSBEndpointDescriptor; CDC Ethernet Bulk IN Endpoint
TransmitRequest:PUSBRequest; USB request for Bulk OUT Endpoint
TransmitEndpoint:PUSBEndpointDescriptor; CDC Ethernet Bulk OUT Endpoint
InterruptRequest:PUSBRequest; USB request for Interrupt IN Endpoint
InterruptEndpoint:PUSBEndpointDescriptor; CDC Ethernet Interrupt IN Endpoint
PendingCount:LongWord; Number of USB requests pending for this device
WaiterThread:TThreadId; Thread waiting for pending requests to complete (for device detachment)


Public variables


None defined

Function declarations



Initialization functions

procedure CDCEthernetInit;
Description: Initialize the CDC Ethernet unit, create and register the driver
Note Called only during system startup


CDCEthernet network functions

function CDCEthernetNetworkOpen(Network:PNetworkDevice):LongWord;
Description: Implementation of NetworkDeviceOpen for the CDC Ethernet device
Note Not intended to be called directly by applications, use NetworkDeviceOpen instead.


function CDCEthernetNetworkClose(Network:PNetworkDevice):LongWord;
Description: Implementation of NetworkDeviceClose for the CDC Ethernet device
Note Not intended to be called directly by applications, use NetworkDeviceClose instead.


function CDCEthernetNetworkControl(Network:PNetworkDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;
Description: Implementation of NetworkDeviceControl for the CDC Ethernet device
Note Not intended to be called directly by applications, use NetworkDeviceControl instead.


function CDCEthernetBufferAllocate(Network:PNetworkDevice; var Entry:PNetworkEntry):LongWord;
Description: Implementation of NetworkBufferAllocate for the CDC Ethernet device
Note Not intended to be called directly by applications, use NetworkBufferAllocate instead.


function CDCEthernetBufferRelease(Network:PNetworkDevice; Entry:PNetworkEntry):LongWord;
Description: Implementation of NetworkBufferRelease for the CDC Ethernet device
Note Not intended to be called directly by applications, use NetworkBufferRelease instead.


function CDCEthernetBufferReceive(Network:PNetworkDevice; var Entry:PNetworkEntry):LongWord;
Description: Implementation of NetworkBufferReceive for the CDC Ethernet device
Note Not intended to be called directly by applications, use NetworkBufferReceive instead.


function CDCEthernetBufferTransmit(Network:PNetworkDevice; Entry:PNetworkEntry):LongWord;
Description: Implementation of NetworkBufferTransmit for the CDC Ethernet device
Note Not intended to be called directly by applications, use NetworkBufferTransmit instead.


CDC Ethernet USB functions

function CDCEthernetDriverBind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Description: Bind the CDC Ethernet driver to a USB device if it is suitable
Device The USB device to attempt to bind to
Interrface The USB interface to attempt to bind to (or nil for whole device)
Return USB_STATUS_SUCCESS if completed, USB_STATUS_DEVICE_UNSUPPORTED if unsupported or another error code on failure


function CDCEthernetDriverUnbind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Description: Unbind the CDC Ethernet driver from a USB device
Device The USB device to unbind from
Interrface The USB interface to unbind from (or nil for whole device)
Return USB_STATUS_SUCCESS if completed or another error code on failure


procedure CDCEthernetReceiveWorker(Request:PUSBRequest);
Description: Called (by a Worker thread) to process a completed USB request from the CDC Ethernet bulk IN endpoint
Request The USB request which has completed


procedure CDCEthernetReceiveComplete(Request:PUSBRequest);
Description: Called when a USB request from the CDC Ethernet bulk IN endpoint completes
Request The USB request which has completed
Note Request is passed to worker thread for processing to prevent blocking the USB completion


procedure CDCEthernetTransmitWorker(Request:PUSBRequest);
Description: Called (by a Worker thread) to process a completed USB request to the CDC Ethernet bulk OUT endpoint
Request The USB request which has completed


procedure CDCEthernetTransmitComplete(Request:PUSBRequest);
Description: Called when a USB request to the CDC Ethernet bulk OUT endpoint completes
Request The USB request which has completed
Note Request is passed to worker thread for processing to prevent blocking the USB completion


procedure CDCEthernetInterruptWorker(Request:PUSBRequest);
Description: Called (by a Worker thread) to process a completed USB request from the CDC Ethernet interrupt IN endpoint
Request The USB request which has completed


procedure CDCEthernetInterruptComplete(Request:PUSBRequest);
Description: Called when a USB request from the CDC Ethernet interrupt IN endpoint completes
Request The USB request which has completed
Note Request is passed to worker thread for processing to prevent blocking the USB completion


CDC ethernet helper functions

function CDCEthernetCheckDeviceAndInterface(Device:PUSBDevice; Interrface:PUSBInterface; out DriverInfo:LongWord):LongWord;
Description: Check the Device and Interface against the supported and blacklisted devices
Device USB device to check
Interrface USB interface to check
Return USB_STATUS_SUCCESS if completed or another error code on failure


function CDCEthernetGetMacAddress(Device:PUSBDevice; Index:LongWord; Address:PHardwareAddress):LongWord;
Description: Get the MAC address of a CDC Ethernet device
Device USB device to read from
Index The string descriptor index containing the MAC address
Address Value to read the MAC address into
Return USB_STATUS_SUCCESS if completed or another error code on failure


function CDCEthernetUpdateFilter(Network:PCDCEthernetNetwork):LongWord;
Description: Update the packet filter of the CDC Ethernet device
Network The network device to update the packet filter for
Return USB_STATUS_SUCCESS if completed or another error code on failure


Return to Unit Reference