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_USBSKEL_H
28 #define	_SYS_USB_USBSKEL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 
37 /*
38  * Power Management support
39  */
40 typedef struct usbskel_power  {
41 
42 	void		*usbskel_state;	/* points back to usbskel_state */
43 	uint8_t		usbskel_pwr_states; /* bit mask of device pwr states */
44 	int		usbskel_pm_busy;
45 
46 	/* wakeup and power transistion capabilites of an interface */
47 	uint8_t		usbskel_pm_capabilities;
48 
49 	/* flag to indicate if driver is about to raise power level */
50 	boolean_t	usbskel_raise_power;
51 
52 	uint8_t		usbskel_current_power;
53 } usbskel_power_t;
54 
55 
56 /*
57  * State structure
58  */
59 typedef struct usbskel_state {
60 	dev_info_t		*usbskel_dip;	/* per-device info handle */
61 	usb_client_dev_data_t	*usbskel_reg;	/* registration data */
62 	usb_ep_descr_t		usbskel_intr_ep_descr;	/* Intr ep descr */
63 	usb_pipe_handle_t	usbskel_intr_ph;	/* Intr pipe handle.  */
64 	char			*usbskel_devinst;	/* Dev and instance */
65 	int			usbskel_dev_state; /* USB device states. */
66 	int			usbskel_drv_state; /* driver states. */
67 	kmutex_t		usbskel_mutex;
68 	kcondvar_t		usbskel_serial_cv;
69 	boolean_t		usbskel_serial_inuse;
70 	boolean_t		usbskel_locks_initialized;
71 	usbskel_power_t		*usbskel_pm;
72 } usbskel_state_t;
73 
74 
75 /* Macros */
76 #define	USBSKEL_OPEN		0x00000001
77 
78 #define	USBSKEL_REQUEST_SIZE	65535	/* Read request size maximum */
79 #define	USB_DEV_DESCR_SIZE	18	/* device descr size */
80 
81 /* Other */
82 #define	USBSKEL_DRAIN_TMO	15
83 
84 /* For serialization. */
85 #define	USBSKEL_SER_NOSIG	B_FALSE
86 #define	USBSKEL_SER_SIG		B_TRUE
87 
88 /* For logging. */
89 #define	USBSKEL_LOG_LOG		1
90 #define	USBSKEL_LOG_CONSOLE	0
91 
92 #ifdef __cplusplus
93 }
94 #endif
95 
96 #endif	/* _SYS_USB_USBSKEL_H */
97