Merge commit '9276b3991ba20d5a5660887ba81b0bc7bed25a0c'
[unleashed.git] / share / man / man9f / usb_get_max_pkts_per_isoc_request.9f
blobce423b652f7818396022ea09b91ca609378f8752
1 '\" te
2 .\" Copyright (c) 2004, Sun Microsystems, Inc., All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH USB_GET_MAX_PKTS_PER_ISOC_REQUEST 9F "Nov 10, 2016"
7 .SH NAME
8 usb_get_max_pkts_per_isoc_request \- Get maximum number of packets allowed per
9 isochronous request
10 .SH SYNOPSIS
11 .LP
12 .nf
13 #include <sys/usb/usba.h>
17 \fB\fR\fBuint_t\fR usb_get_max_pkts_per_isoc_request(\fBdev_info_t *\fR\fIdip\fR);
18 .fi
20 .SH INTERFACE LEVEL
21 .LP
22 Solaris DDI specific (Solaris DDI)
23 .SH PARAMETERS
24 .ne 2
25 .na
26 \fB\fIdip\fR\fR
27 .ad
28 .RS 7n
29 Pointer to the device's \fBdev_info\fR structure.
30 .RE
32 .SH DESCRIPTION
33 .LP
34 The \fBusb_get_max_pkts_per_isoc_request()\fR function returns the maximum
35 number of isochronous packets per request that the host control driver can
36 support. This number can be used to determine the maximum amount of data which
37 can be handled by a single isochronous request. That length is found by:
38 .sp
39 .in +2
40 .nf
41 max = usb_get_max_pkts_per_isoc_request(dip) * endpoint_max_packet_size;
42 .fi
43 .in -2
45 .sp
46 .LP
47 where endpoint_max_packet_size is the wMaxPacketSize field of the isochronous
48 endpoint over which the transfer will take place.
49 .SH RETURN VALUES
50 .LP
51 On success, the \fBusb_get_max_pkts_per_isoc_request()\fR function returns the
52 maximum number of isochronous pkts per request. On failure it returns \fB0\fR.
53 The function fails if \fIdip\fR is NULL.
54 .SH CONTEXT
55 .LP
56 May be called from user, kernel or interrupt context.
57 .SH EXAMPLES
58 .in +2
59 .nf
61  * Set up to receive periodic isochronous data, requesting
62  * the maximum amount for each transfer.
63  */
65 int pkt;
66 /* Get max packet size from endpoint descriptor. */
67 uint_t ep_max_pkt_size = ep_descr.wMaxPacketSize;
68 uint_t isoc_pkts_count = usb_get_max_pkts_per_isoc_request(dip);
71  * Allocate an isoc request, specifying the max number of packets
72  * and the greatest size transfer possible.
73  */
74 usb_isoc_req_t *isoc_req = usb_alloc_isoc_req(dip,
75     isoc_pkts_count,
76     isoc_pkts_count * ep_max_pkt_size,
77     USB_FLAGS_SLEEP);
79 /* Init each packet descriptor for maximum size. */
80 for (pkt = 0; pkt < isoc_pkts_count; pkt++) {
81     isoc_req->isoc_pkt_descr[pkt].isoc_pkt_length = ep_max_pkt_size;
86 /* Set the length of a packet in the request too. */
87 isoc_req->isoc_pkts_length = ep_max_pkt_size;
89 /* Other isoc request initialization. */
90 \&...
91 \&...
93 if (usb_pipe_isoc_xfer(pipe, isoc_req, USB_FLAGS_NOSLEEP) != USB_SUCCESS) {
94     ...
96 .fi
97 .in -2
99 .SH ATTRIBUTES
101 See \fBattributes\fR(5) for descriptions of the following attributes:
106 box;
107 c | c
108 l | l .
109 ATTRIBUTE TYPE  ATTRIBUTE VALUE
111 Architecture    PCI-based systems
113 Interface stability     Committed
116 .SH SEE ALSO
118 \fBattributes\fR(5), \fBusb_pipe_isoc_xfer\fR(9F), \fBusb_alloc_request\fR(9F),
119 \fBusb_get_current_frame_number\fR(9F), \fBusb_ep_descr\fR(9S),
120 \fBusb_isoc_request\fR(9S)