xref: /onnv-gate/usr/src/uts/common/sys/usb/clients/usbskel/usbskel.h (revision 7492:2387323b838f)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7492SZhigang.Lu@Sun.COM  * Common Development and Distribution License (the "License").
6*7492SZhigang.Lu@Sun.COM  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*7492SZhigang.Lu@Sun.COM  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef _SYS_USB_USBSKEL_H
270Sstevel@tonic-gate #define	_SYS_USB_USBSKEL_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #ifdef	__cplusplus
310Sstevel@tonic-gate extern "C" {
320Sstevel@tonic-gate #endif
330Sstevel@tonic-gate 
340Sstevel@tonic-gate 
350Sstevel@tonic-gate /*
360Sstevel@tonic-gate  * Power Management support
370Sstevel@tonic-gate  */
380Sstevel@tonic-gate typedef struct usbskel_power  {
390Sstevel@tonic-gate 
400Sstevel@tonic-gate 	void		*usbskel_state;	/* points back to usbskel_state */
410Sstevel@tonic-gate 	uint8_t		usbskel_pwr_states; /* bit mask of device pwr states */
420Sstevel@tonic-gate 	int		usbskel_pm_busy;
430Sstevel@tonic-gate 
440Sstevel@tonic-gate 	/* wakeup and power transistion capabilites of an interface */
450Sstevel@tonic-gate 	uint8_t		usbskel_pm_capabilities;
460Sstevel@tonic-gate 
470Sstevel@tonic-gate 	/* flag to indicate if driver is about to raise power level */
480Sstevel@tonic-gate 	boolean_t	usbskel_raise_power;
490Sstevel@tonic-gate 
500Sstevel@tonic-gate 	uint8_t		usbskel_current_power;
510Sstevel@tonic-gate } usbskel_power_t;
520Sstevel@tonic-gate 
530Sstevel@tonic-gate 
540Sstevel@tonic-gate /*
550Sstevel@tonic-gate  * State structure
560Sstevel@tonic-gate  */
570Sstevel@tonic-gate typedef struct usbskel_state {
580Sstevel@tonic-gate 	dev_info_t		*usbskel_dip;	/* per-device info handle */
590Sstevel@tonic-gate 	usb_client_dev_data_t	*usbskel_reg;	/* registration data */
600Sstevel@tonic-gate 	usb_ep_descr_t		usbskel_intr_ep_descr;	/* Intr ep descr */
610Sstevel@tonic-gate 	usb_pipe_handle_t	usbskel_intr_ph;	/* Intr pipe handle.  */
620Sstevel@tonic-gate 	char			*usbskel_devinst;	/* Dev and instance */
630Sstevel@tonic-gate 	int			usbskel_dev_state; /* USB device states. */
640Sstevel@tonic-gate 	int			usbskel_drv_state; /* driver states. */
650Sstevel@tonic-gate 	kmutex_t		usbskel_mutex;
660Sstevel@tonic-gate 	kcondvar_t		usbskel_serial_cv;
670Sstevel@tonic-gate 	boolean_t		usbskel_serial_inuse;
680Sstevel@tonic-gate 	boolean_t		usbskel_locks_initialized;
690Sstevel@tonic-gate 	usbskel_power_t		*usbskel_pm;
700Sstevel@tonic-gate } usbskel_state_t;
710Sstevel@tonic-gate 
720Sstevel@tonic-gate 
730Sstevel@tonic-gate /* Macros */
740Sstevel@tonic-gate #define	USBSKEL_OPEN		0x00000001
750Sstevel@tonic-gate 
760Sstevel@tonic-gate #define	USBSKEL_REQUEST_SIZE	65535	/* Read request size maximum */
770Sstevel@tonic-gate #define	USB_DEV_DESCR_SIZE	18	/* device descr size */
780Sstevel@tonic-gate 
790Sstevel@tonic-gate /* Other */
800Sstevel@tonic-gate #define	USBSKEL_DRAIN_TMO	15
810Sstevel@tonic-gate 
820Sstevel@tonic-gate /* For serialization. */
830Sstevel@tonic-gate #define	USBSKEL_SER_NOSIG	B_FALSE
840Sstevel@tonic-gate #define	USBSKEL_SER_SIG		B_TRUE
850Sstevel@tonic-gate 
860Sstevel@tonic-gate /* For logging. */
870Sstevel@tonic-gate #define	USBSKEL_LOG_LOG		1
880Sstevel@tonic-gate #define	USBSKEL_LOG_CONSOLE	0
890Sstevel@tonic-gate 
900Sstevel@tonic-gate #ifdef __cplusplus
910Sstevel@tonic-gate }
920Sstevel@tonic-gate #endif
930Sstevel@tonic-gate 
940Sstevel@tonic-gate #endif	/* _SYS_USB_USBSKEL_H */
95