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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [devs/] [usb/] [sa11x0/] [current/] [doc/] [usbs_sa11x0.sgml] - Blame information for rev 810

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
2
 
3
4
 
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 
35
36
 
37
38
39
  SA11X0 USB Device Driver
40
 
41
42
43
SA11X0 USB Device Driver
44
45
46
SA11X0 USB Support
47
Device driver for the on-chip SA11X0 USB device
48
49
 
50
SA11X0 USB Hardware
51
52
The Intel StrongARM SA11x0 family of processors is supplied with an
53
on-chip USB slave device, the UDC (USB Device Controller). This
54
supports three endpoints. Endpoint 0 can only be used for control
55
messages. Endpoint 1 can only be used for bulk transfers from host to
56
peripheral. Endpoint 2 can only be used for bulk transfers from
57
peripheral to host. Isochronous and interrupt transfers are not
58
supported.
59
60
61
62
Different revisions of the SA11x0 silicon have had various problems
63
with the USB support. The device driver has been tested primarily
64
against stepping B4 of the SA1110 processor, and may not function as
65
expected with other revisions. Application developers should obtain
66
the manufacturer's current errata sheets and specification updates.
67
The B4 stepping still has a number of problems, but the device driver
68
can work around these. However there is a penalty in terms of extra
69
code, extra cpu cycles, and increased dispatch latency because extra
70
processing is needed at DSR level. Interrupt latency should not be
71
affected.
72
73
74
There is one specific problem inherent in the UDC design of which
75
application developers should be aware: the hardware cannot fully
76
implement the USB standard for bulk transfers. A bulk transfer
77
typically consists of some number of full-size 64-byte packets and is
78
terminated by a packet less than the full size. If the amount of data
79
transferred is an exact multiple of 64 bytes then this requires a
80
terminating packet of 0 bytes of data (plus header and checksum). The
81
SA11x0 USB hardware does not allow a 0-byte packet to be transmitted,
82
so the device driver is forced to substitute a 1-byte packet and the
83
host receives more data than expected. Protocol support is needed so
84
that the appropriate host-side device driver can allow buffer space
85
for the extra byte, detect when it gets sent, and discard it.
86
Consequently certain standard USB class protocols cannot be
87
implemented using the SA11x0, and therefore custom host-side device
88
drivers will generally have to be provided, rather than re-using
89
existing ones that understand the standard protocol.
90
91
92
93
 
94
Endpoint Data Structures
95
96
The SA11x0 USB device driver can provide up to three data structures
97
corresponding to the three endpoints: a
98
usbs_control_endpoint structure
99
usbs_sa11x0_ep0; a
100
usbs_rx_endpoint
101
usbs_sa11x0_ep1; and a
102
usbs_tx_endpoint
103
usbs_sa11x0_ep2. The header file
104
cyg/io/usb/usbs_sa11x0.h
105
provides declarations for these.
106
107
108
Not all applications will require support for all the endpoints. For
109
example, if the intended use of the UDC only involves peripheral to
110
host transfers then usbs_sa11x0_ep1 is redundant.
111
The device driver provides configuration options to control the
112
presence of each endpoint:
113
114
115
116
117
Endpoint 0 is controlled by
118
CYGFUN_DEVS_USB_SA11X0_EP0. This defaults to
119
enabled if there are any higher-level packages that require USB
120
hardware or if the global preference
121
CYGGLO_IO_USB_SLAVE_APPLICATION is enabled,
122
otherwise it is disabled. Usually this has the desired effect. It may
123
be necessary to override this in special circumstances, for example if
124
the target board uses an external USB chip in preference to the UDC
125
and it is that external chip's device driver that should be used
126
rather than the on-chip UDC. It is not possible to disable endpoint 0
127
and at the same time enable one or both of the other endpoints, since
128
a USB device is only usable if it can process the standard control
129
messages.
130
131
132
133
134
Endpoint 1 is controlled by
135
CYGPKG_DEVS_USB_SA11X0_EP1. By default it is
136
enabled whenever endpoint 0 is enabled, but it can be disabled
137
manually when not required.
138
139
140
141
142
Similarly endpoint 2 is controlled by
143
CYGPKG_DEVS_USB_SA11X0_EP2. This is also enabled by
144
default whenever endpoint 0 is enabled, but it can be disabled manually.
145
146
147
148
149
The SA11X0 USB device driver implements the interface specified by the
150
common eCos USB Slave Support package. The documentation for that
151
package should be consulted for further details. There is only one
152
major deviation: when there is a peripheral to host transfer on
153
endpoint 2 which is an exact multiple of the bulk transfer packet size
154
(usually 64 bytes) the device driver has to pad the transfer with one
155
extra byte. This is because of a hardware limitation: the UDC is
156
incapable of transmitting 0-byte packets as required by the USB
157
specification. Higher-level code, including the host-side device
158
driver, needs to be aware of this and adapt accordingly.
159
160
161
The device driver assumes a bulk packet size of 64 bytes, so this
162
value should be used in the endpoint descriptors in the enumeration
163
data provided by application code. There is experimental code
164
for running with DMA disabled,
165
in which case the packet size will be 16 bytes rather than 64.
166
167
168
 
169
Devtab Entries
170
171
In addition to the endpoint data structures the SA11X0 USB device
172
driver can also provide devtab entries for each endpoint. This allows
173
higher-level code to use traditional I/O operations such as
174
open/read/write
175
rather than the USB-specific non-blocking functions like
176
usbs_start_rx_buffer. These devtab entries are
177
optional since they are not always required. The relevant
178
configuration options are
179
CYGVAR_DEVS_USB_SA11X0_EP0_DEVTAB_ENTRY,
180
CYGVAR_DEVS_USB_SA11X0_EP1_DEVTAB_ENTRY and
181
CYGVAR_DEVS_USB_SA11X0_EP2_DEVTAB_ENTRY. By default
182
these devtab entries are provided if the global preference
183
CYGGLO_USB_SLAVE_PROVIDE_DEVTAB_ENTRIES is enabled,
184
which is usually the case. Obviously a devtab entry for a given
185
endpoint will only be provided if the underlying endpoint is enabled.
186
For example, there will not be a devtab entry for endpoint 1 if
187
CYGPKG_DEVS_USB_SA11X0_EP1 is disabled.
188
189
190
The names for the three devtab entries are determined by using a
191
configurable base name and appending 0c,
192
1r or 2w. The base name is
193
determined by the configuration option
194
CYGDAT_DEVS_USB_SA11X0_DEVTAB_BASENAME and has a
195
default value of /dev/usbs, so the devtab entry for
196
endpoint 1 would default to /dev/usbs1r. If the
197
target hardware involves multiple USB devices then application
198
developers may have to change the base name to prevent a name clash.
199
200
201
 
202
DMA Engines
203
204
The SA11X0 UDC provides only limited fifos for bulk transfers on
205
endpoints 1 and 2; smaller than the normal 64-byte bulk packet size.
206
Therefore a typical transfer requires the use of DMA engines. The
207
SA11x0 provides six DMA engines that can be used for this, and the
208
endpoints require one each (assuming both endpoints are enabled). At
209
the time of writing there is no arbitration mechanism to control
210
access to the DMA engines. By default the device driver will use
211
DMA engine 4 for endpoint 1 and DMA engine 5 for endpoint 2, and it
212
assumes that no other code uses these particular engines.
213
214
215
The exact DMA engines that will be used are determined by the
216
configuration options
217
CYGNUM_DEVS_USB_SA11X0_EP1_DMA_CHANNEL and
218
CYGNUM_DEVS_USB_SA11X0_EP2_DMA_CHANNEL. These
219
options have the booldata flavor, allowing the use of DMA to be
220
disabled completely in addition to controlling which DMA engines are
221
used. If DMA is disabled then the device driver will attempt to
222
work purely using the fifos, and the packet size will be limited to
223
only 16 bytes. This limit should be reflected in the appropriate
224
endpoint descriptors in the enumeration data. The code for driving the
225
endpoints without DMA should be considered experimental. At best it
226
will be suitable only for applications where the amount of data
227
transferred is relatively small, because four times as many interrupts
228
will be raised and performance will suffer accordingly.
229
230
231
 
232
233
234

powered by: WebSVN 2.1.0

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