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