OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [io/] [usb/] [eth/] [slave/] [v2_0/] [doc/] [usbseth-protocol.html] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
<!-- Copyright (C) 2001 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 substantively modified versions of this         -->
7
<!-- document is prohibited without the explicit permission of the   -->
8
<!-- copyright holder.                                               -->
9
<!-- Distribution of the work or derivative of the work in any       -->
10
<!-- standard (paper) book form is prohibited unless prior           -->
11
<!-- permission is obtained from the copyright holder.               -->
12
<HTML
13
><HEAD
14
><TITLE
15
>Communication Protocol</TITLE
16
><META
17
NAME="GENERATOR"
18
CONTENT="Modular DocBook HTML Stylesheet Version 1.64
19
"><LINK
20
REL="HOME"
21
TITLE="eCos Support for Developing USB-ethernet Peripherals"
22
HREF="io-usb-slave-eth.html"><LINK
23
REL="PREVIOUS"
24
TITLE="Example Host-side Device Driver"
25
HREF="usbseth-host.html"></HEAD
26
><BODY
27
CLASS="REFENTRY"
28
BGCOLOR="#FFFFFF"
29
TEXT="#000000"
30
LINK="#0000FF"
31
VLINK="#840084"
32
ALINK="#0000FF"
33
><DIV
34
CLASS="NAVHEADER"
35
><TABLE
36
WIDTH="100%"
37
BORDER="0"
38
CELLPADDING="0"
39
CELLSPACING="0"
40
><TR
41
><TH
42
COLSPAN="3"
43
ALIGN="center"
44
>eCos Support for Developing USB-ethernet Peripherals</TH
45
></TR
46
><TR
47
><TD
48
WIDTH="10%"
49
ALIGN="left"
50
VALIGN="bottom"
51
><A
52
HREF="usbseth-host.html"
53
>Prev</A
54
></TD
55
><TD
56
WIDTH="80%"
57
ALIGN="center"
58
VALIGN="bottom"
59
></TD
60
><TD
61
WIDTH="10%"
62
ALIGN="right"
63
VALIGN="bottom"
64
>&nbsp;</TD
65
></TR
66
></TABLE
67
><HR
68
ALIGN="LEFT"
69
WIDTH="100%"></DIV
70
><H1
71
><A
72
NAME="USBSETH-PROTOCOL"
73
>Communication Protocol</A
74
></H1
75
><DIV
76
CLASS="REFNAMEDIV"
77
><A
78
NAME="AEN281"
79
></A
80
><H2
81
>Name</H2
82
>Communication Protocol&nbsp;--&nbsp;Protocol used between the host-side device driver and the eCos
83
USB-ethernet package </DIV
84
><DIV
85
CLASS="REFSECT1"
86
><A
87
NAME="AEN284"
88
></A
89
><H2
90
>Description</H2
91
><P
92
>There is a USB standard for the protocol to be used between the host
93
and a class of communication devices, including ethernet. However, the
94
eCos USB-ethernet package does not implement this protocol: the target
95
hardware for which the package was first developed had certain
96
limitations, and could not implement the standard. Instead, the package
97
implements a simple new protocol.</P
98
><P
99
>A USB-ethernet peripheral involves bulk transfers on two endpoints:
100
one endpoint will be used for packets from host to peripheral and the
101
other will be used for the opposite direction. Transfers in both
102
directions are variable length, with a lower limit of 16 bytes and an
103
upper limit of 1516 bytes. The first two bytes of each transfer
104
constitute a header specific to USB-ethernet. The next 14 bytes form
105
the normal header for an ethernet frame: destination MAC address,
106
source MAC address, and a protocol field. The remaining data, up to
107
1500 bytes, are the payload. The first two bytes give the size of the
108
ethernet frame, least significant byte first, with a value between 14
109
and 1514.</P
110
><P
111
>For example an ARP request from host to peripheral involves an
112
ethernet frame of 42 bytes (0x002A), with the usual 14-byte header and
113
a 28-byte payload. The destination is the broadcast address
114
0xFFFFFFFFFFFF. The source depends on the MAC address specified for
115
the host in the call to <A
116
HREF="usbseth-init.html"
117
><TT
118
CLASS="FUNCTION"
119
>usbs_eth_init</TT
120
></A
121
>, e.g.
122
0x405D90A9BC02. The remaining data is as specified by the appropriate
123
<A
124
HREF="http://www.ietf.org"
125
TARGET="_top"
126
>IETF RFC's</A
127
>. The actual bulk
128
USB transfer involves the following sequence of 44 bytes:</P
129
><TABLE
130
BORDER="0"
131
BGCOLOR="#E0E0E0"
132
WIDTH="100%"
133
><TR
134
><TD
135
><PRE
136
CLASS="SCREEN"
137
>2a 00 ff ff ff ff ff ff 40 5d 90 a9 bc 02 08 06
138
00 01 08 00 06 04 00 01 40 5d 90 a9 bc 02 0a 00
139
00 01 00 00 00 00 00 00 0a 00 00 02</PRE
140
></TD
141
></TR
142
></TABLE
143
><P
144
>In addition there are two control messages. These will be sent by the
145
host to endpoint 0, the control endpoint, and by default they will
146
be handled by <A
147
HREF="usbseth-control.html"
148
><TT
149
CLASS="FUNCTION"
150
>usbs_eth_class_control_handler</TT
151
></A
152
>. If class-specific
153
control messages are intercepted by other code then it is the
154
responsibility of that code to invoke the USB-ethernet handler when
155
appropriate.</P
156
><P
157
>The first control message can be used by the host to obtain a MAC
158
address:</P
159
><TABLE
160
BORDER="0"
161
BGCOLOR="#E0E0E0"
162
WIDTH="100%"
163
><TR
164
><TD
165
><PRE
166
CLASS="PROGRAMLISTING"
167
>#define ECOS_USBETH_CONTROL_GET_MAC_ADDRESS         0x01</PRE
168
></TD
169
></TR
170
></TABLE
171
><P
172
>The control message's type field should specify IN as the direction.
173
The request field should be <TT
174
CLASS="LITERAL"
175
>0x01</TT
176
>. The length fields
177
should specify a size of 6 bytes. The remaining fields of the control
178
message will be ignored by the USB-ethernet package. The response
179
consists of the 6-byte MAC address supplied by the initialization call
180
<A
181
HREF="usbseth-init.html"
182
><TT
183
CLASS="FUNCTION"
184
>usbs_eth_init</TT
185
></A
186
>.</P
187
><P
188
>The second control message can be used by the host to enable or
189
disable promiscuous mode.</P
190
><TABLE
191
BORDER="0"
192
BGCOLOR="#E0E0E0"
193
WIDTH="100%"
194
><TR
195
><TD
196
><PRE
197
CLASS="PROGRAMLISTING"
198
>#define ECOS_USBETH_CONTROL_SET_PROMISCUOUS_MODE    0x02</PRE
199
></TD
200
></TR
201
></TABLE
202
><P
203
>This control message involves no further data so the length field
204
should be set to 0. The value field should be non-zero to enable
205
promiscuous mode, zero to disable it. The request field should be
206
<TT
207
CLASS="LITERAL"
208
>0x02</TT
209
>. The remaining fields in the control message
210
will be ignored. It is the responsibility of the host-side device
211
driver to keep track of whether or not promiscuous mode is currently
212
enabled. It will be disabled when the peripheral changes to
213
Configured state, typically at the point where the host-side device
214
driver has been activated.</P
215
></DIV
216
><DIV
217
CLASS="NAVFOOTER"
218
><HR
219
ALIGN="LEFT"
220
WIDTH="100%"><TABLE
221
WIDTH="100%"
222
BORDER="0"
223
CELLPADDING="0"
224
CELLSPACING="0"
225
><TR
226
><TD
227
WIDTH="33%"
228
ALIGN="left"
229
VALIGN="top"
230
><A
231
HREF="usbseth-host.html"
232
>Prev</A
233
></TD
234
><TD
235
WIDTH="34%"
236
ALIGN="center"
237
VALIGN="top"
238
><A
239
HREF="io-usb-slave-eth.html"
240
>Home</A
241
></TD
242
><TD
243
WIDTH="33%"
244
ALIGN="right"
245
VALIGN="top"
246
>&nbsp;</TD
247
></TR
248
><TR
249
><TD
250
WIDTH="33%"
251
ALIGN="left"
252
VALIGN="top"
253
>Example Host-side Device Driver</TD
254
><TD
255
WIDTH="34%"
256
ALIGN="center"
257
VALIGN="top"
258
>&nbsp;</TD
259
><TD
260
WIDTH="33%"
261
ALIGN="right"
262
VALIGN="top"
263
>&nbsp;</TD
264
></TR
265
></TABLE
266
></DIV
267
></BODY
268
></HTML
269
>

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.