Communication protocol, Name, Description – Comtrol eCos User Manual
Page 743: Protocol

Communication Protocol
Name
Communication Protocol
— Protocol used between the host-side device driver and the eCos USB-ethernet
package
Description
There is a USB standard for the protocol to be used between the host and a class of communication devices,
including ethernet. However, the eCos USB-ethernet package does not implement this protocol: the target hardware
for which the package was first developed had certain limitations, and could not implement the standard. Instead,
the package implements a simple new protocol.
A USB-ethernet peripheral involves bulk transfers on two endpoints: one endpoint will be used for packets from
host to peripheral and the other will be used for the opposite direction. Transfers in both directions are variable
length, with a lower limit of 16 bytes and an upper limit of 1516 bytes. The first two bytes of each transfer
constitute a header specific to USB-ethernet. The next 14 bytes form the normal header for an ethernet frame:
destination MAC address, source MAC address, and a protocol field. The remaining data, up to 1500 bytes, are the
payload. The first two bytes give the size of the ethernet frame, least significant byte first, with a value between 14
and 1514.
For example an ARP request from host to peripheral involves an ethernet frame of 42 bytes (0x002A), with the
usual 14-byte header and a 28-byte payload. The destination is the broadcast address 0xFFFFFFFFFFFF. The
source depends on the MAC address specified for the host in the call to
, e.g. 0x405D90A9BC02.
The remaining data is as specified by the appropriate IETF RFC’s (http://www.ietf.org). The actual bulk USB
transfer involves the following sequence of 44 bytes:
2a 00 ff ff ff ff ff ff 40 5d 90 a9 bc 02 08 06
00 01 08 00 06 04 00 01 40 5d 90 a9 bc 02 0a 00
00 01 00 00 00 00 00 00 0a 00 00 02
In addition there are two control messages. These will be sent by the host to endpoint 0, the control endpoint,
and by default they will be handled by
usbs_eth_class_control_handler
. If class-specific control messages
are intercepted by other code then it is the responsibility of that code to invoke the USB-ethernet handler when
appropriate.
The first control message can be used by the host to obtain a MAC address:
#define ECOS_USBETH_CONTROL_GET_MAC_ADDRESS
0x01
The control message’s type field should specify IN as the direction. The request field should be
0x01
. The
length fields should specify a size of 6 bytes. The remaining fields of the control message will be ignored by
the USB-ethernet package. The response consists of the 6-byte MAC address supplied by the initialization call
The second control message can be used by the host to enable or disable promiscuous mode.
#define ECOS_USBETH_CONTROL_SET_PROMISCUOUS_MODE
0x02
639