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  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SYS_USBA_UGEN_H
27 #define	_SYS_USBA_UGEN_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * UGEN - USB Generic Driver code exported for sharing by USBA
33  */
34 #include <sys/usb/usba/usbai_private.h>
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 typedef struct usb_ugen_info {
41 	uint_t		usb_ugen_flags;
42 	dev_t		usb_ugen_minor_node_ugen_bits_mask;
43 	dev_t		usb_ugen_minor_node_instance_mask;
44 } usb_ugen_info_t;
45 
46 typedef struct usb_ugen_hdl *usb_ugen_hdl_t;
47 
48 #define	USB_UGEN_ENABLE_PM		0x0001
49 #define	USB_UGEN_REMOVE_CHILDREN	0x0002
50 
51 usb_ugen_hdl_t usb_ugen_get_hdl(dev_info_t *, usb_ugen_info_t *);
52 void	usb_ugen_release_hdl(usb_ugen_hdl_t);
53 int	usb_ugen_attach(usb_ugen_hdl_t, ddi_attach_cmd_t);
54 int	usb_ugen_detach(usb_ugen_hdl_t, ddi_detach_cmd_t);
55 int	usb_ugen_open(usb_ugen_hdl_t, dev_t *, int, int, cred_t *);
56 int	usb_ugen_close(usb_ugen_hdl_t, dev_t, int, int, cred_t *);
57 int	usb_ugen_power(usb_ugen_hdl_t, int, int);
58 int	usb_ugen_read(usb_ugen_hdl_t, dev_t, struct uio *, cred_t *);
59 int	usb_ugen_write(usb_ugen_hdl_t, dev_t, struct uio *, cred_t *);
60 int	usb_ugen_poll(usb_ugen_hdl_t, dev_t, short, int,
61 					short *, struct pollhead **);
62 
63 int	usb_ugen_disconnect_ev_cb(usb_ugen_hdl_t);
64 int	usb_ugen_reconnect_ev_cb(usb_ugen_hdl_t);
65 
66 #ifdef	__cplusplus
67 }
68 #endif
69 
70 #endif	/* _SYS_USBA_UGEN_H */
71