xref: /illumos-gate/usr/src/uts/common/sys/usb/clients/ugen/ugend.h (revision 8d483882aa3390058094b043f3d62187b5d1de03)
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_USB_UGEND_H
27 #define	_SYS_USB_UGEND_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * UGEN - USB Generic Driver Support
33  * This file contains the UGEN specific data structure definitions
34  * and UGEN specific macros.
35  */
36 #include <sys/usb/usba/usbai_private.h>
37 
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 /* UGEN specific macros */
43 #define	UGEN_INSTANCES		4	/* for softstate init */
44 
45 typedef struct {
46 	dev_info_t		*ugen_skel_dip;
47 	int			ugen_skel_instance;
48 	usb_ugen_hdl_t		ugen_skel_hdl;
49 } ugen_skel_state_t;
50 
51 _NOTE(DATA_READABLE_WITHOUT_LOCK(ugen_skel_state_t))
52 
53 #define	UGEN_MINOR_UGEN_BITS_MASK	0x1ff
54 #define	UGEN_MINOR_INSTANCE_SHIFT	9
55 #define	UGEN_MINOR_INSTANCE_MASK	~UGEN_MINOR_UGEN_BITS_MASK
56 #define	UGEN_MINOR_TO_INSTANCE(minor) \
57 		(((minor) & UGEN_MINOR_INSTANCE_MASK) >> \
58 		UGEN_MINOR_INSTANCE_SHIFT)
59 
60 #ifdef	__cplusplus
61 }
62 #endif
63 
64 #endif	/* _SYS_USB_UGEND_H */
65