Devtab entries, Dma engines – Comtrol eCos User Manual
Page 792

SA11X0 USB Device Driver
is enabled, otherwise it is disabled. Usually this has the desired effect. It may be necessary to override this in
special circumstances, for example if the target board uses an external USB chip in preference to the UDC and
it is that external chip’s device driver that should be used rather than the on-chip UDC. It is not possible to
disable endpoint 0 and at the same time enable one or both of the other endpoints, since a USB device is only
usable if it can process the standard control messages.
2. Endpoint 1 is controlled by
CYGPKG_DEVS_USB_SA11X0_EP1
. By default it is enabled whenever endpoint 0 is
enabled, but it can be disabled manually when not required.
3. Similarly endpoint 2 is controlled by
CYGPKG_DEVS_USB_SA11X0_EP2
. This is also enabled by default when-
ever endpoint 0 is enabled, but it can be disabled manually.
The SA11X0 USB device driver implements the interface specified by the common eCos USB Slave Support
package. The documentation for that package should be consulted for further details. There is only one major
deviation: when there is a peripheral to host transfer on endpoint 2 which is an exact multiple of the bulk transfer
packet size (usually 64 bytes) the device driver has to pad the transfer with one extra byte. This is because of a
hardware limitation: the UDC is incapable of transmitting 0-byte packets as required by the USB specification.
Higher-level code, including the host-side device driver, needs to be aware of this and adapt accordingly.
The device driver assumes a bulk packet size of 64 bytes, so this value should be used in the endpoint descriptors
in the enumeration data provided by application code. There is experimental code for running with
in which case the packet size will be 16 bytes rather than 64.
Devtab Entries
In addition to the endpoint data structures the SA11X0 USB device driver can also provide devtab
entries for each endpoint. This allows higher-level code to use traditional I/O operations such as
open
/
read
/
write
rather than the USB-specific non-blocking functions like
usbs_start_rx_buffer
.
These devtab entries are optional since they are not always required. The relevant configuration options are
CYGVAR_DEVS_USB_SA11X0_EP0_DEVTAB_ENTRY
,
CYGVAR_DEVS_USB_SA11X0_EP1_DEVTAB_ENTRY
and
CYGVAR_DEVS_USB_SA11X0_EP2_DEVTAB_ENTRY
. By default these devtab entries are provided if the global
preference
CYGGLO_USB_SLAVE_PROVIDE_DEVTAB_ENTRIES
is enabled, which is usually the case. Obviously a
devtab entry for a given endpoint will only be provided if the underlying endpoint is enabled. For example, there
will not be a devtab entry for endpoint 1 if
CYGPKG_DEVS_USB_SA11X0_EP1
is disabled.
The names for the three devtab entries are determined by using a configurable base name and appending
0c
,
1r
or
2w
. The base name is determined by the configuration option
CYGDAT_DEVS_USB_SA11X0_DEVTAB_BASENAME
and has a default value of
/dev/usbs
, so the devtab entry for endpoint 1 would default to
/dev/usbs1r
. If the
target hardware involves multiple USB devices then application developers may have to change the base name to
prevent a name clash.
DMA Engines
The SA11X0 UDC provides only limited fifos for bulk transfers on endpoints 1 and 2; smaller than the normal
64-byte bulk packet size. Therefore a typical transfer requires the use of DMA engines. The SA11x0 provides six
DMA engines that can be used for this, and the endpoints require one each (assuming both endpoints are enabled).
At the time of writing there is no arbitration mechanism to control access to the DMA engines. By default the
device driver will use DMA engine 4 for endpoint 1 and DMA engine 5 for endpoint 2, and it assumes that no other
code uses these particular engines.
688