wsmuxvar.h revision 1.2
1/*	$NetBSD: wsmuxvar.h,v 1.2 2001/10/13 13:36:02 augustss Exp $	*/
2
3/*
4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * Author: Lennart Augustsson <augustss@carlstedt.se>
8 *         Carlstedt Research & Technology
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 *    notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 *    must display the following acknowledgement:
20 *        This product includes software developed by the NetBSD
21 *        Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 *    contributors may be used to endorse or promote products derived
24 *    from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39struct wsdisplay_softc;
40struct wsplink;
41
42struct wsmux_softc {
43	struct device sc_dv;
44	struct wseventvar sc_events;	/* event queue state */
45	int sc_flags, sc_mode;		/* open flags */
46	struct proc *sc_p;		/* open proc */
47	LIST_HEAD(, wsplink) sc_reals;  /* list of real devices */
48	struct wsmux_softc *sc_mux;     /* if part of another mux */
49	struct device *sc_displaydv;    /* our display if part of one */
50#ifdef WSDISPLAY_COMPAT_RAWKBD
51	int sc_rawkbd;		        /* A hack to remember the kbd mode */
52#endif
53};
54
55struct wsmuxops {
56	int (*dopen) __P((dev_t, int, int, struct proc *));
57	int (*dclose) __P((struct device *, int, int, struct proc *));
58	int (*dioctl) __P((struct device *, u_long, caddr_t, int,
59			   struct proc *));
60	int (*ddispioctl) __P((struct device *, u_long, caddr_t, int,
61			       struct proc *));
62	int (*dsetdisplay) __P((struct device *, struct wsmux_softc *));
63};
64
65struct wsmux_softc *wsmux_getmux __P((int));
66struct wsmux_softc *wsmux_create __P((const char *, int));
67int	wsmux_attach_sc __P((
68	  struct wsmux_softc *,
69	  int, struct device *, struct wseventvar *,
70	  struct wsmux_softc **,
71	  struct wsmuxops *));
72int	wsmux_detach_sc __P((struct wsmux_softc *, struct device *));
73void	wsmux_attach __P((
74	  int, int, struct device *, struct wseventvar *,
75	  struct wsmux_softc **,
76	  struct wsmuxops *));
77void	wsmux_detach __P((int, struct device *));
78
79int	wsmux_displayioctl __P((struct device *dev, u_long cmd,
80	    caddr_t data, int flag, struct proc *p));
81
82int	wsmuxdoioctl __P((struct device *, u_long, caddr_t,int,struct proc *));
83
84int	wsmux_add_mux __P((int, struct wsmux_softc *));
85int	wsmux_rem_mux __P((int, struct wsmux_softc *));
86int	wskbd_add_mux __P((int, struct wsmux_softc *));
87int	wskbd_rem_mux __P((int, struct wsmux_softc *));
88int	wsmouse_add_mux __P((int, struct wsmux_softc *));
89int	wsmouse_rem_mux __P((int, struct wsmux_softc *));
90