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-host.html] - Blame information for rev 307

Go to most recent revision | 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
>Example Host-side Device Driver</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="Network Device for the eCos TCP/IP Stack"
25
HREF="usbseth-netdev.html"><LINK
26
REL="NEXT"
27
TITLE="Communication Protocol"
28
HREF="usbseth-protocol.html"></HEAD
29
><BODY
30
CLASS="REFENTRY"
31
BGCOLOR="#FFFFFF"
32
TEXT="#000000"
33
LINK="#0000FF"
34
VLINK="#840084"
35
ALINK="#0000FF"
36
><DIV
37
CLASS="NAVHEADER"
38
><TABLE
39
WIDTH="100%"
40
BORDER="0"
41
CELLPADDING="0"
42
CELLSPACING="0"
43
><TR
44
><TH
45
COLSPAN="3"
46
ALIGN="center"
47
>eCos Support for Developing USB-ethernet Peripherals</TH
48
></TR
49
><TR
50
><TD
51
WIDTH="10%"
52
ALIGN="left"
53
VALIGN="bottom"
54
><A
55
HREF="usbseth-netdev.html"
56
>Prev</A
57
></TD
58
><TD
59
WIDTH="80%"
60
ALIGN="center"
61
VALIGN="bottom"
62
></TD
63
><TD
64
WIDTH="10%"
65
ALIGN="right"
66
VALIGN="bottom"
67
><A
68
HREF="usbseth-protocol.html"
69
>Next</A
70
></TD
71
></TR
72
></TABLE
73
><HR
74
ALIGN="LEFT"
75
WIDTH="100%"></DIV
76
><H1
77
><A
78
NAME="USBSETH-HOST"
79
>Example Host-side Device Driver</A
80
></H1
81
><DIV
82
CLASS="REFNAMEDIV"
83
><A
84
NAME="AEN242"
85
></A
86
><H2
87
>Name</H2
88
>Example Host-side Device Driver&nbsp;--&nbsp;Provide host-side support for the eCos USB-ethernet package</DIV
89
><DIV
90
CLASS="REFSECT1"
91
><A
92
NAME="AEN245"
93
></A
94
><H2
95
>Description</H2
96
><P
97
>The USB-ethernet package is supplied with a single host-side device
98
driver. This driver has been developed against the Linux kernel
99
2.2.16-22, as shipped with Red Hat 7. The driver is provided as is and
100
should not be considered production quality: for example it only
101
checks for a bogus vendor id <TT
102
CLASS="LITERAL"
103
>0x4242</TT
104
> rather than an
105
official vendor id supplied by the <A
106
HREF="http://www.usb.org/"
107
TARGET="_top"
108
>USB Implementers Forum</A
109
>. Also, if the
110
peripheral involves multiple configurations or multiple interfaces, it
111
will fail to detect this. However, the driver can be used for simple
112
testing and as the basis of a full device driver. Details of the
113
protocol used between host and peripheral can be found in the <A
114
HREF="usbseth-protocol.html"
115
>Communication Protocol</A
116
> section.</P
117
><P
118
>The host-side device driver can be found in the <TT
119
CLASS="FILENAME"
120
>host</TT
121
> subdirectory of the USB-ethernet
122
package, specifically the file <TT
123
CLASS="FILENAME"
124
>ecos_usbeth.c</TT
125
>, and
126
comes with a <TT
127
CLASS="FILENAME"
128
>Makefile</TT
129
>. Both files may need
130
to be modified for specific applications. For example, the vendor id
131
table <TT
132
CLASS="LITERAL"
133
>ecos_usbeth_implementations</TT
134
> may need to be
135
updated for the specific USB peripheral being built. The
136
<TT
137
CLASS="FILENAME"
138
>Makefile</TT
139
> assumes that the Linux kernel sources
140
reside in <TT
141
CLASS="FILENAME"
142
>/usr/src/linux</TT
143
>, and
144
that the kernel has already been configured and built. Assuming this
145
is the case, the device driver can be built simply by invoking
146
<B
147
CLASS="COMMAND"
148
>make</B
149
> with no additional arguments. This will result
150
in a dynamically loadable kernel module,
151
<TT
152
CLASS="FILENAME"
153
>ecos_usbeth.o</TT
154
>, in the current directory.</P
155
><DIV
156
CLASS="NOTE"
157
><BLOCKQUOTE
158
CLASS="NOTE"
159
><P
160
><B
161
>Note: </B
162
>As normal for Linux kernel builds, the generated files such as
163
<TT
164
CLASS="FILENAME"
165
>ecos_usbeth.o</TT
166
> live in the same directory as the
167
source tree. This is very different from eCos where the source tree
168
(or component repository) is kept separate from any builds. There may
169
be problems if the component repository is kept read-only or if it is
170
put under source code control. Any such problems can be avoided by
171
making a copy of the <TT
172
CLASS="FILENAME"
173
>host</TT
174
>
175
subdirectory and building that copy.</P
176
></BLOCKQUOTE
177
></DIV
178
><P
179
>Loading the kernel module into the current system requires root
180
privileges. If the generic USB support is also a loadable module and
181
has not been loaded already, this must happen first:</P
182
><TABLE
183
BORDER="0"
184
BGCOLOR="#E0E0E0"
185
WIDTH="100%"
186
><TR
187
><TD
188
><PRE
189
CLASS="SCREEN"
190
># insmod usb-uhci
191
Using /lib/modules/2.2.16-22/usb/usb-uhci.o</PRE
192
></TD
193
></TR
194
></TABLE
195
><P
196
>Depending on the host hardware, the <TT
197
CLASS="LITERAL"
198
>uhci</TT
199
> or
200
<TT
201
CLASS="LITERAL"
202
>usb-ohci</TT
203
> modules may be more appropriate. Loading
204
the generic USB module will typically result in a number of messages
205
to the logfile <TT
206
CLASS="FILENAME"
207
>/var/log/messages</TT
208
>, giving details
209
of the specific host-side hardware that has been detected plus any
210
hubs. The next step is to load the USB-ethernet module:</P
211
><TABLE
212
BORDER="0"
213
BGCOLOR="#E0E0E0"
214
WIDTH="100%"
215
><TR
216
><TD
217
><PRE
218
CLASS="SCREEN"
219
># insmod ecos_usbeth.o</PRE
220
></TD
221
></TR
222
></TABLE
223
><P
224
>This should result in a number of additional diagnostics in the
225
logfile:</P
226
><TABLE
227
BORDER="0"
228
BGCOLOR="#E0E0E0"
229
WIDTH="100%"
230
><TR
231
><TD
232
><PRE
233
CLASS="SCREEN"
234
>Apr 1 18:01:08 grumpy kernel: eCos USB-ethernet device driver
235
Apr 1 18:01:08 grumpy kernel: usb.c: registered new driver ecos_usbeth</PRE
236
></TD
237
></TR
238
></TABLE
239
><P
240
>If a suitable USB peripheral is now connected the host will detect
241
this, assign an address in the local USB network, obtain enumeration
242
data, and find a suitable device driver. Assuming the peripheral and
243
device driver agree on the supported vendor ids, the
244
<TT
245
CLASS="FILENAME"
246
>ecos_usbeth.o</TT
247
> module will be selected and this
248
will be reported in the system log:</P
249
><TABLE
250
BORDER="0"
251
BGCOLOR="#E0E0E0"
252
WIDTH="100%"
253
><TR
254
><TD
255
><PRE
256
CLASS="SCREEN"
257
>Apr 1 18:04:12 grumpy kernel: usb.c: USB new device connect, assigned device number 3
258
Apr 1 18:04:12 grumpy kernel: eCos-based USB ethernet peripheral active at eth1</PRE
259
></TD
260
></TR
261
></TABLE
262
><P
263
>What can happen next depends very much on the software that is running
264
on top of the USB-ethernet package inside the peripheral. For example,
265
if there is a TCP/IP stack then it should be possible to bring up a
266
network connection between host and peripheral using
267
<B
268
CLASS="COMMAND"
269
>ifconfig</B
270
>.</P
271
></DIV
272
><DIV
273
CLASS="NAVFOOTER"
274
><HR
275
ALIGN="LEFT"
276
WIDTH="100%"><TABLE
277
WIDTH="100%"
278
BORDER="0"
279
CELLPADDING="0"
280
CELLSPACING="0"
281
><TR
282
><TD
283
WIDTH="33%"
284
ALIGN="left"
285
VALIGN="top"
286
><A
287
HREF="usbseth-netdev.html"
288
>Prev</A
289
></TD
290
><TD
291
WIDTH="34%"
292
ALIGN="center"
293
VALIGN="top"
294
><A
295
HREF="io-usb-slave-eth.html"
296
>Home</A
297
></TD
298
><TD
299
WIDTH="33%"
300
ALIGN="right"
301
VALIGN="top"
302
><A
303
HREF="usbseth-protocol.html"
304
>Next</A
305
></TD
306
></TR
307
><TR
308
><TD
309
WIDTH="33%"
310
ALIGN="left"
311
VALIGN="top"
312
>Network Device for the eCos TCP/IP Stack</TD
313
><TD
314
WIDTH="34%"
315
ALIGN="center"
316
VALIGN="top"
317
>&nbsp;</TD
318
><TD
319
WIDTH="33%"
320
ALIGN="right"
321
VALIGN="top"
322
>Communication Protocol</TD
323
></TR
324
></TABLE
325
></DIV
326
></BODY
327
></HTML
328
>

powered by: WebSVN 2.1.0

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