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