Devtab entries, Restrictions, Optional hardware workarounds – Comtrol eCos User Manual

Page 798

Advertising
background image

NEC uPD985xx USB Device Driver

The uPD985xx 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.

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. The device driver also assumes a control packet size of eight
bytes, and again this should be reflected in the enumeration data. If endpoint 5 is configured for interrupt rather
than bulk transfers then the maximum packet size is limited to 64 bytes by the USB standard.

Devtab Entries

In

addition

to

the

endpoint

data

structures

the

uPD985xx

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_UPD985XX_EP0_DEVTAB_ENTRY

,

CYGVAR_DEVS_USB_UPD985XX_EP3_DEVTAB_ENTRY

,

CYGVAR_DEVS_USB_UPD985XX_EP4_DEVTAB_ENTRY

, and

CYGVAR_DEVS_USB_UPD985XX_EP5_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 4 if

CYGPKG_DEVS_USB_UPD985XX_EP4

is disabled.

The names for the devtab entries are determined by using a configurable base name and appending

0c

,

3w

,

4r

or

5w

. The base name is determined by the configuration option

CYGDAT_DEVS_USB_UPD985XX_DEVTAB_BASENAME

and has a default value of

/dev/usbs

, so the devtab entry for endpoint 4 would default to

/dev/usbs4r

. If the

target hardware involves multiple USB devices then application developers may have to change the base name to
prevent a name clash with other USB device drivers.

Restrictions

The current device driver imposes a restriction on certain bulk receives on endpoint 4. If the protocol being used
involves variable-length transfers, in other words if the host is allowed to send less data than a maximum-sized
transfer, then the buffer passed to the device driver for receives must be aligned to a 16-byte cacheline boundary
and it must be a multiple of this 16-byte cacheline size. This restriction does not apply if the protocol only involves
fixed-size transfers.

Optional Hardware Workarounds

The NEC errata list a number of other problems that affect the USB device driver. The device driver contains
workarounds for these, which are enabled by default but can be disabled if the application developer knows that
the errata are not relevant to the system being developed.

Erratum S1 lists a possible problem if the device driver attempts multiple writes to the USB hardware. This is
circumvented by a dummy read operation after every write. If the workaround is not required then the configuration
option

CYGIMP_DEVS_USB_UPD985XX_IBUS_WRITE_LIMIT

can be disabled.

Errata U3 and U4 describe various problems related to concurrent transmissions on different endpoints. By de-
fault the device driver works around this by serializing all transmit operations. For example if the device driver
needs to send a response to a control message on endpoint 0 while there is an ongoing bulk transfer on end-

694

Advertising