Device Descriptor
A CopperLan Device declares itself at interface level and not at device level. That's the reason why Class, Subclass and protocol are all 0 in the USB Device Descriptor.
Example:
USB_DEVICE_DESCRIPTOR device_dsc =
{
0x12,
USB_DESCRIPTOR_DEVICE,
0x0200,
0x00,
0x00,
0x00,
USB_EP0_BUFF_SIZE,
0xvvvv,
0xpppp,
0x0001,
0x01,
0x02,
0x03,
0x01
};
We will see what can be used for VenderID (0xvvvv) and Product ID (0xpppp) in USB CopperLan Driver mapping..
- Warning
- USB VendorID and ProducID are totaly independent from CopperLan BrandID and ProductID.
Interface Descriptor
A CopperLan Device can have several interfaces (standard and custom) but must have only one CopperLan Interface. It is composed of an interface descriptor followed by a custom descriptor for unequivocal validation.
Example of Interface Desriptor:
0x09,
USB_DESCRIPTOR_INTERFACE,
0,
0,
2,
0xFF,
0x43,
0x50,
0,
Specificities of this descriptor:
- Custom class must be specified (0xFF)
- Subclass must be set to 0x43
- Protocol must be set to 0x50
- The number of endpoints for this interface must be 2.
This interface descriptor must be directly followed by a custom descriptor defined as follow:
- It is 5 bytes long, so first byte is 0x05.
- Second byte (the descriptor type) must be set to 0x43. This is a Vendor specific descriptor type. For references see "3.11 Identifying Class and Vendor-Specific Requests and Descriptors" in "Universal Serial Bus Common Class Specification" (usbccs10.pdf) and "Table 9-2. Format of Setup Data" in "USB Specification" (usb_20.pdf).
- Third byte corresponds to the index of the corresponding custom interface descriptor.
- Fourth byte corresponds to the interface version. Actually it is 0x10 for 1.0
- Fifth and last byte is the protocol. It must be 0x01 for CHAILink
0x05,
0x43,
0,
0x10,
0x01,
Endpoints Descriptor
The CopperLan USB Interface must implement two bulk endpoints, one in and one out. The order of these endpoints do not care (In or Out pipe can be the first one). The default size of the two bulk endpoints is 64 but can be placed at a different value depending on the version of the USB standard used, USB speed ...
Endpoint descriptors sample:
0x07,
USB_DESCRIPTOR_ENDPOINT,
0x01,
_BULK,
64,
1,
0x07,
USB_DESCRIPTOR_ENDPOINT,
0x81,
_BULK,
64,
1,
Based on this definition, once the USB device is declared on the host, the CHAILink Client Transport must send data through Out Endpoint and process received data through In endpoint.
- For Out Endpoint : If the CHAILink Client Transport wants to send (see CHAILink Client Transport) a frame larger than the Max Packet Size of the bulk endpoint, the transport must simply splits the packet into multiple USB frames. (e.g. for a MaxPaket size of 64 and a packet of 135 bytes, the transport should send 3 packets : 64 + 64 + 7 bytes)
- For In endpoint : Each packet must be transmitted to the CHAI Link transport protocol (see CHAILink Client Transport) which will do the reassembly of the complete CHALink packet.