1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SYS_USB_EHCI_ISOCH_UTIL_H
27 #define	_SYS_USB_EHCI_ISOCH_UTIL_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 /*
36  * Isochronous pool functions
37  */
38 extern int ehci_allocate_isoc_pools(
39 	ehci_state_t		*ehcip);
40 extern int ehci_get_itd_pool_size();
41 
42 /*
43  * Isochronous Transfer Wrapper Functions
44  */
45 extern ehci_isoc_xwrapper_t *ehci_allocate_itw_resources(
46 	ehci_state_t 		*ehcip,
47 	ehci_pipe_private_t	*pp,
48 	size_t			itw_length,
49 	usb_flags_t		usb_flags,
50 	size_t 			pkt_count);
51 extern void ehci_deallocate_itw(
52 	ehci_state_t		*ehcip,
53 	ehci_pipe_private_t	*pp,
54 	ehci_isoc_xwrapper_t	*itw);
55 
56 /*
57  * Isochronous transfer descripter functions
58  */
59 extern ehci_itd_t *ehci_allocate_itd(
60 	ehci_state_t		*ehcip);
61 
62 extern void ehci_deallocate_itd(
63 	ehci_state_t		*ehcip,
64 	ehci_isoc_xwrapper_t	*itw,
65 	ehci_itd_t		*old_itd);
66 extern uint_t ehci_calc_num_itds(
67 	ehci_isoc_xwrapper_t	*itw,
68 	size_t 			pkt_count);
69 extern int ehci_allocate_itds_for_itw(
70 	ehci_state_t		*ehcip,
71 	ehci_isoc_xwrapper_t	*itw,
72 	uint_t			itd_count);
73 extern void ehci_insert_itd_on_itw(
74 	ehci_state_t		*ehcip,
75 	ehci_isoc_xwrapper_t	*itw,
76 	ehci_itd_t		*itd);
77 extern void ehci_insert_itd_into_active_list(
78 	ehci_state_t		*ehcip,
79 	ehci_itd_t		*itd);
80 extern void ehci_remove_itd_from_active_list(
81 	ehci_state_t		*ehcip,
82 	ehci_itd_t		*itd);
83 extern ehci_itd_t *ehci_create_done_itd_list(
84 	ehci_state_t		*ehcip);
85 extern int ehci_insert_isoc_to_pfl(
86 	ehci_state_t		*ehcip,
87 	ehci_pipe_private_t	*pp,
88 	ehci_isoc_xwrapper_t	*itw);
89 extern void ehci_remove_isoc_from_pfl(
90 	ehci_state_t		*ehcip,
91 	ehci_itd_t		*curr_itd);
92 
93 /*
94  * Isochronous in resource functions
95  */
96 extern int ehci_allocate_isoc_in_resource(
97 	ehci_state_t		*ehcip,
98 	ehci_pipe_private_t	*pp,
99 	ehci_isoc_xwrapper_t	*tw,
100 	usb_flags_t		flags);
101 extern void ehci_deallocate_isoc_in_resource(
102 	ehci_state_t		*ehcip,
103 	ehci_pipe_private_t	*pp,
104 	ehci_isoc_xwrapper_t	*itw);
105 
106 /*
107  * Isochronous memory addr functions
108  */
109 extern uint32_t ehci_itd_cpu_to_iommu(
110 	ehci_state_t		*ehcip,
111 	ehci_itd_t		*addr);
112 
113 extern ehci_itd_t *ehci_itd_iommu_to_cpu(
114 	ehci_state_t		*ehcip,
115 	uintptr_t		addr);
116 
117 /*
118  * Error parsing functions
119  */
120 extern void ehci_parse_isoc_error(
121 	ehci_state_t		*ehcip,
122 	ehci_isoc_xwrapper_t	*itw,
123 	ehci_itd_t		*itd);
124 
125 /*
126  * print functions
127  */
128 extern void ehci_print_itd(
129 	ehci_state_t		*ehcip,
130 	ehci_itd_t		*itd);
131 extern void ehci_print_sitd(
132 	ehci_state_t		*ehcip,
133 	ehci_itd_t		*itd);
134 
135 #ifdef __cplusplus
136 }
137 #endif
138 
139 #endif /* _SYS_USB_EHCI_ISOCH_UTIL_H */
140