1 <!-- Copyright (C) 2003 Red Hat, Inc. -->
2 <!-- This material may be distributed only subject to the terms -->
3 <!-- and conditions set forth in the Open Publication License, v1.0 -->
4 <!-- or later (the latest version is presently available at -->
5 <!-- http://www.opencontent.org/openpub/). -->
6 <!-- Distribution of the work or derivative of the work in any -->
7 <!-- standard (paper) book form is prohibited unless prior -->
8 <!-- permission is obtained from the copyright holder. -->
12 >Communication Protocol</TITLE
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
22 TITLE="eCos Support for Developing USB-ethernet Peripherals"
23 HREF="io-usb-slave-eth.html"><LINK
25 TITLE="Example Host-side Device Driver"
26 HREF="usbseth-host.html"><LINK
28 TITLE="eCos Synthetic Target"
29 HREF="hal-synth-arch.html"></HEAD
40 SUMMARY="Header navigation table"
49 >eCos Reference Manual</TH
57 HREF="usbseth-host.html"
71 HREF="hal-synth-arch.html"
82 NAME="USBSETH-PROTOCOL">Communication Protocol</H1
90 >Communication Protocol -- Protocol used between the host-side device driver and the eCos
91 USB-ethernet package </DIV
100 >There is a USB standard for the protocol to be used between the host
101 and a class of communication devices, including ethernet. However, the
102 eCos USB-ethernet package does not implement this protocol: the target
103 hardware for which the package was first developed had certain
104 limitations, and could not implement the standard. Instead, the package
105 implements a simple new protocol.</P
107 >A USB-ethernet peripheral involves bulk transfers on two endpoints:
108 one endpoint will be used for packets from host to peripheral and the
109 other will be used for the opposite direction. Transfers in both
110 directions are variable length, with a lower limit of 16 bytes and an
111 upper limit of 1516 bytes. The first two bytes of each transfer
112 constitute a header specific to USB-ethernet. The next 14 bytes form
113 the normal header for an ethernet frame: destination MAC address,
114 source MAC address, and a protocol field. The remaining data, up to
115 1500 bytes, are the payload. The first two bytes give the size of the
116 ethernet frame, least significant byte first, with a value between 14
119 >For example an ARP request from host to peripheral involves an
120 ethernet frame of 42 bytes (0x002A), with the usual 14-byte header and
121 a 28-byte payload. The destination is the broadcast address
122 0xFFFFFFFFFFFF. The source depends on the MAC address specified for
123 the host in the call to <A
124 HREF="usbseth-init.html"
130 0x405D90A9BC02. The remaining data is as specified by the appropriate
132 HREF="http://www.ietf.org"
136 USB transfer involves the following sequence of 44 bytes:</P
145 >2a 00 ff ff ff ff ff ff 40 5d 90 a9 bc 02 08 06
146 00 01 08 00 06 04 00 01 40 5d 90 a9 bc 02 0a 00
147 00 01 00 00 00 00 00 00 0a 00 00 02</PRE
152 >In addition there are two control messages. These will be sent by the
153 host to endpoint 0, the control endpoint, and by default they will
155 HREF="usbseth-control.html"
158 >usbs_eth_class_control_handler</TT
161 control messages are intercepted by other code then it is the
162 responsibility of that code to invoke the USB-ethernet handler when
165 >The first control message can be used by the host to obtain a MAC
174 CLASS="PROGRAMLISTING"
175 >#define ECOS_USBETH_CONTROL_GET_MAC_ADDRESS 0x01</PRE
180 >The control message's type field should specify IN as the direction.
181 The request field should be <TT
185 should specify a size of 6 bytes. The remaining fields of the control
186 message will be ignored by the USB-ethernet package. The response
187 consists of the 6-byte MAC address supplied by the initialization call
189 HREF="usbseth-init.html"
196 >The second control message can be used by the host to enable or
197 disable promiscuous mode.</P
205 CLASS="PROGRAMLISTING"
206 >#define ECOS_USBETH_CONTROL_SET_PROMISCUOUS_MODE 0x02</PRE
211 >This control message involves no further data so the length field
212 should be set to 0. The value field should be non-zero to enable
213 promiscuous mode, zero to disable it. The request field should be
217 >. The remaining fields in the control message
218 will be ignored. It is the responsibility of the host-side device
219 driver to keep track of whether or not promiscuous mode is currently
220 enabled. It will be disabled when the peripheral changes to
221 Configured state, typically at the point where the host-side device
222 driver has been activated.</P
229 SUMMARY="Footer navigation table"
240 HREF="usbseth-host.html"
258 HREF="hal-synth-arch.html"
268 >Example Host-side Device Driver</TD
274 HREF="io-usb-slave-eth.html"
282 >eCos Synthetic Target</TD