Data Structures for Drivers usbrequestattributes(9S)
NAME
usbrequestattributes - Definition of USB request attri-
butes
SYNOPSIS
#include
INTERFACE LEVEL
Solaris DI specific (Solaris DI)
DESCRIPTION
Request attributes specify how the USBA framework handles
request execution. Request attributes are specified in the
request's *attributes field and belong to the enumerated
type usbreqattrst.
Supported request attributes are:
USBATRSHORTXFEROK Use this attribute when the
maximum transfer size is
known, but it is possible for
the request to receive a
smaller amount of data. This
attribute tells the USBA
framework to accept without
error transfers which are
shorter than expected.
USBATRSPIPERESET Have the USB framework reset
the pipe automatically if an
error occurs during the
transfer. Do not attempt to
clear any stall. The
USBCBRESETPIPE callback
flag is passed to the client
driver's exception handler to
show the pipe has been reset.
Pending requests on pipes
which are reset are flushed
unless the pipe is the default
pipe.
USBATRSAUTOCLEARING Have the USB framework reset
the pipe and clear functional
stalls automatically if an
error occurs during the
transfer. The callback flags
passed to the client driver's
SunOS 5.11 Last change: 5 Jan 2004 1
Data Structures for Drivers usbrequestattributes(9S)
exception handler show the
status after the attempt to
clear the stall.
USBCBFUNCTIONALSTAL is set
in the callback flags to indi-
cate that a functional stall
occurred. USBCBSTALCLEARED
is also set if the stall is
cleared. The default pipe
never shows a functional stall
if the USBATRSAUTOCLEARING
attribute is set. If
USBCBFUNCTIONALSTAL is
seen when autoclearing is
enabled, the device has a
fatal error.
USBCBPROTOCOLSTAL is set
without USBCBSTALCLEARED
in the callback flags to indi-
cate that a protocol stall was
seen but was not explicitly
cleared. Protocol stalls are
cleared automatically when a
subsequent command is issued.
Autoclearing a stalled default
pipe is not allowed. The
USBCBPROTOCOLSTAL callback
flag is set in the callback
flags to indicate the default
pipe is stalled.
Autoclearing is not allowed
when the request is
USBREQGETSTATUS on the
default pipe.
USBATRSONEXFER Applies only to interrupt-IN
requests. Without this flag,
interrupt-IN requests start
periodic polling of the inter-
rupt pipe. This flag specifies
to perform only a single
transfer. Do not start
periodic transfers with this
request.
SunOS 5.11 Last change: 5 Jan 2004 2
Data Structures for Drivers usbrequestattributes(9S)
USBATRSISOCSTARTFRAME Applies only to isochronous
requests and specifies that a
request be started at a given
frame number. The starting
frame number is provided in
the isocframeno field of the
usbisocreqt. Please see
usbisocrequest(9S) for more
information about isochronous
requests.
USBATRSISOCSTARTFRAME can
be used to delay a transfer by
a few frames, allowing
transfers to an endpoint to
sync up with another source.
(For example, synching up
audio endpoints to a video
source.) The number of a suit-
able starting frame in the
near future can be found by
adding an offset number of
frames (usually between four
and ten) to the current frame
number returned from
usbgetcurrentframenumber(9F).
Note that requests with start-
ing frames which have passed
are rejected.
USBATRSISOCXFERASAP Applies only to isochronous
requests and specifies that a
request start as soon as pos-
sible. The host controller
driver picks a starting frame
number which immediately fol-
lows the last frame of the
last queued request. The
isocframeno of the
usbisocreqt is ignored.
Please see
usbisocrequest(9S) for more
information about isochronous
requests.
EXAMPLES
/*
* Allocate, initialize and issue a synchronous bulk-IN request.
* Allow for short transfers.
*/
SunOS 5.11 Last change: 5 Jan 2004 3
Data Structures for Drivers usbrequestattributes(9S)
struct buf *bp;
usbbulkreqt bulkreq;
mblkt *mblk;
bulkreq = usballocbulkreq(dip, bp->bbcount, USBFLAGSLEP);
bulkreq->bulkattributes =
USBATRSAUTOCLEARING USBATRSHORTXFEROK;
if ((rval = usbpipebulkxfer(pipe, bulkreq, USBFLAGSLEP)) !=
USBSUCES) {
cmnerr (CEWARN, "%s%d: Error reading bulk data.",
ddidrivername(dip), ddigetinstance(dip));
}
mblk = bulkreq->bulkdata;
bcopy(mblk->rptr, buf->bun.baddr, mblk->wptr - mblk->rptr);
bp->bresid = bp->bcount - (mblk->wptr = mblk->rptr);
...
...
----
usbpipehandlet handle;
usbframenumbert offset = 10;
usbisocreqt *isocreq;
isocreq = usballocisocreq(...);
...
...
isocreq->isocframeno = usbgetcurrentframenumber(dip) ] offset;
isocreq->isocattributes = USBATRSISOCSTARTFRAME;
...
...
if (usbpipeisocxfer(handle, isocreq, 0) != USBSUCES) {
...
}
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
SunOS 5.11 Last change: 5 Jan 2004 4
Data Structures for Drivers usbrequestattributes(9S)
ATRIBUTE TYPE ATRIBUTE VALUE
Architecture PCI-based systems
Interface stability Committed
Availability SUNWusb, SUNWusbu
SEE ALSO
usballocrequest(9F), usbgetcurrentframenumber(9F),
usbpipebulkxfer(9F), usbpipectrlxfer(9F),
usbpipeintrxfer(9F), usbpipeisocxfer(9F),
usbbulkrequest(9S), usbcallbackflags(9S),
usbctrlrequest(9S), usbintrrequest(9S),
usbisocrequest(9S), usbcompletionreason(9S)
SunOS 5.11 Last change: 5 Jan 2004 5
|