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 2008 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
30#ifdef	__cplusplus
31extern "C" {
32#endif
33
34/*
35 * Isochronous pool functions
36 */
37extern int ehci_allocate_isoc_pools(
38	ehci_state_t		*ehcip);
39extern int ehci_get_itd_pool_size();
40
41/*
42 * Isochronous Transfer Wrapper Functions
43 */
44extern ehci_isoc_xwrapper_t *ehci_allocate_itw_resources(
45	ehci_state_t 		*ehcip,
46	ehci_pipe_private_t	*pp,
47	size_t			itw_length,
48	usb_flags_t		usb_flags,
49	size_t 			pkt_count);
50extern void ehci_deallocate_itw(
51	ehci_state_t		*ehcip,
52	ehci_pipe_private_t	*pp,
53	ehci_isoc_xwrapper_t	*itw);
54
55/*
56 * Isochronous transfer descripter functions
57 */
58extern ehci_itd_t *ehci_allocate_itd(
59	ehci_state_t		*ehcip);
60
61extern void ehci_deallocate_itd(
62	ehci_state_t		*ehcip,
63	ehci_isoc_xwrapper_t	*itw,
64	ehci_itd_t		*old_itd);
65extern uint_t ehci_calc_num_itds(
66	ehci_isoc_xwrapper_t	*itw,
67	size_t 			pkt_count);
68extern int ehci_allocate_itds_for_itw(
69	ehci_state_t		*ehcip,
70	ehci_isoc_xwrapper_t	*itw,
71	uint_t			itd_count);
72extern void ehci_insert_itd_on_itw(
73	ehci_state_t		*ehcip,
74	ehci_isoc_xwrapper_t	*itw,
75	ehci_itd_t		*itd);
76extern void ehci_insert_itd_into_active_list(
77	ehci_state_t		*ehcip,
78	ehci_itd_t		*itd);
79extern void ehci_remove_itd_from_active_list(
80	ehci_state_t		*ehcip,
81	ehci_itd_t		*itd);
82extern ehci_itd_t *ehci_create_done_itd_list(
83	ehci_state_t		*ehcip);
84extern int ehci_insert_isoc_to_pfl(
85	ehci_state_t		*ehcip,
86	ehci_pipe_private_t	*pp,
87	ehci_isoc_xwrapper_t	*itw);
88extern void ehci_remove_isoc_from_pfl(
89	ehci_state_t		*ehcip,
90	ehci_itd_t		*curr_itd);
91
92/*
93 * Isochronous in resource functions
94 */
95extern int ehci_allocate_isoc_in_resource(
96	ehci_state_t		*ehcip,
97	ehci_pipe_private_t	*pp,
98	ehci_isoc_xwrapper_t	*tw,
99	usb_flags_t		flags);
100extern void ehci_deallocate_isoc_in_resource(
101	ehci_state_t		*ehcip,
102	ehci_pipe_private_t	*pp,
103	ehci_isoc_xwrapper_t	*itw);
104
105/*
106 * Isochronous memory addr functions
107 */
108extern uint32_t ehci_itd_cpu_to_iommu(
109	ehci_state_t		*ehcip,
110	ehci_itd_t		*addr);
111
112extern ehci_itd_t *ehci_itd_iommu_to_cpu(
113	ehci_state_t		*ehcip,
114	uintptr_t		addr);
115
116/*
117 * Error parsing functions
118 */
119extern void ehci_parse_isoc_error(
120	ehci_state_t		*ehcip,
121	ehci_isoc_xwrapper_t	*itw,
122	ehci_itd_t		*itd);
123
124/*
125 * print functions
126 */
127extern void ehci_print_itd(
128	ehci_state_t		*ehcip,
129	ehci_itd_t		*itd);
130extern void ehci_print_sitd(
131	ehci_state_t		*ehcip,
132	ehci_itd_t		*itd);
133
134#ifdef __cplusplus
135}
136#endif
137
138#endif /* _SYS_USB_EHCI_ISOCH_UTIL_H */
139