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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_USB_UHCITGT_H
28 #define	_SYS_USB_UHCITGT_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Universal Host Controller Driver (UHCI)
38  *
39  * Declarations, prototypes for talking to HCDI
40  *
41  *   Function prototypes
42  */
43 int		uhci_hcdi_pipe_open(usba_pipe_handle_data_t *, usb_flags_t);
44 int		uhci_hcdi_pipe_close(usba_pipe_handle_data_t *, usb_flags_t);
45 int		uhci_hcdi_pipe_reset(usba_pipe_handle_data_t *, usb_flags_t);
46 int		uhci_hcdi_pipe_ctrl_xfer(usba_pipe_handle_data_t *,
47 			usb_ctrl_req_t *, usb_flags_t);
48 int		uhci_hcdi_pipe_bulk_xfer(usba_pipe_handle_data_t *,
49 			usb_bulk_req_t *, usb_flags_t);
50 int		uhci_hcdi_pipe_isoc_xfer(usba_pipe_handle_data_t *,
51 			usb_isoc_req_t *, usb_flags_t);
52 int		uhci_hcdi_pipe_intr_xfer(usba_pipe_handle_data_t *,
53 			usb_intr_req_t *, usb_flags_t);
54 int		uhci_hcdi_pipe_stop_intr_polling(usba_pipe_handle_data_t *,
55 			usb_flags_t);
56 int		uhci_hcdi_pipe_stop_isoc_polling(usba_pipe_handle_data_t *,
57 			usb_flags_t);
58 int		uhci_hcdi_bulk_transfer_size(usba_device_t *, size_t *);
59 usb_frame_number_t uhci_hcdi_get_current_frame_number(usba_device_t *);
60 uint_t		uhci_hcdi_get_max_isoc_pkts(usba_device_t *);
61 
62 /*
63  *  Shared function declarations
64  */
65 queue_head_t	*uhci_alloc_queue_head(uhci_state_t *uhcip);
66 uhci_state_t	*uhci_obtain_state(dev_info_t *dip);
67 
68 int		uhci_insert_ctrl_td(uhci_state_t *uhcip,
69 			usba_pipe_handle_data_t	*pipe_handle,
70 			usb_ctrl_req_t	*req,
71 			usb_flags_t		flags);
72 int		uhci_insert_bulk_td(uhci_state_t *uhcip,
73 			usba_pipe_handle_data_t	*pipe_handle,
74 			usb_bulk_req_t		*req,
75 			usb_flags_t		flags);
76 int		uhci_insert_intr_td(uhci_state_t *uhcip,
77 			usba_pipe_handle_data_t	*pipe_handle,
78 			usb_intr_req_t		*req,
79 			usb_flags_t		flags);
80 int		uhci_insert_isoc_td(
81 			uhci_state_t		*uhcip,
82 			usba_pipe_handle_data_t	*ph,
83 			usb_isoc_req_t		*isoc_req,
84 			size_t			length,
85 			usb_flags_t		usb_flags);
86 
87 void		uhci_remove_qh(uhci_state_t *uhcip, uhci_pipe_private_t *pp);
88 void		uhci_insert_qh(uhci_state_t *uhcip,
89 			usba_pipe_handle_data_t	*pipe_handle);
90 void		uhci_modify_td_active_bits(
91 			uhci_state_t		*uhcip,
92 			uhci_pipe_private_t	*pp);
93 
94 int		uhci_allocate_bandwidth(uhci_state_t *uhcip,
95 		    usba_pipe_handle_data_t *pipe_handle, uint_t *node);
96 void		uhci_deallocate_bandwidth(uhci_state_t *uhcip,
97 		    usba_pipe_handle_data_t *pipe_handle);
98 void		uhci_remove_tds_tws(uhci_state_t *uhcip,
99 		    usba_pipe_handle_data_t *ph);
100 void		uhci_remove_isoc_tds_tws(uhci_state_t *uhcip,
101 		    uhci_pipe_private_t *ph);
102 int		uhci_start_isoc_receive_polling(
103 			uhci_state_t		*uhcip,
104 			usba_pipe_handle_data_t	*ph,
105 			usb_isoc_req_t		*req,
106 			usb_flags_t		usb_flags);
107 
108 
109 void		uhci_save_data_toggle(uhci_pipe_private_t *pp);
110 int		uhci_handle_root_hub_request(
111 			uhci_state_t		*uhcip,
112 			usba_pipe_handle_data_t  *pipe_handle,
113 			usb_ctrl_req_t	*req);
114 
115 void		uhci_remove_bulk_tds_tws(uhci_state_t *uhcip,
116 			uhci_pipe_private_t *pp,
117 			int what);
118 void		uhci_root_hub_reset_occurred(uhci_state_t *uhcip,
119 			usb_port_t port);
120 int		uhci_root_hub_allocate_intr_pipe_resource(
121 			uhci_state_t *uhcip,
122 			usb_flags_t flags);
123 void		uhci_root_hub_intr_pipe_cleanup(uhci_state_t *uhcip,
124 						usb_cr_t cr);
125 void		uhci_hcdi_callback(uhci_state_t *uhcip,
126 			uhci_pipe_private_t *pp,
127 			usba_pipe_handle_data_t *ph,
128 			uhci_trans_wrapper_t *tw,
129 			usb_cr_t cr);
130 int		uhci_allocate_periodic_in_resource(uhci_state_t *uhcip,
131 			uhci_pipe_private_t *pp,
132 			uhci_trans_wrapper_t *tw, usb_flags_t flags);
133 
134 #ifdef __cplusplus
135 }
136 #endif
137 
138 #endif /* _SYS_USB_UHCITGT_H */
139