xref: /netbsd-src/sys/dev/wscons/wsmuxvar.h (revision 5aefcfdc06931dd97e76246d2fe0302f7b3fe094)
1 /*	$NetBSD: wsmuxvar.h,v 1.1 1999/07/29 18:20:43 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 
39 struct wsdisplay_softc;
40 struct wsplink;
41 
42 struct 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 
55 struct 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 
65 struct wsmux_softc *wsmux_create __P((const char *name, int no));
66 int	wsmux_attach_sc __P((
67 	  struct wsmux_softc *,
68 	  int, struct device *, struct wseventvar *,
69 	  struct wsmux_softc **,
70 	  struct wsmuxops *));
71 int	wsmux_detach_sc __P((struct wsmux_softc *, struct device *));
72 void	wsmux_attach __P((
73 	  int, int, struct device *, struct wseventvar *,
74 	  struct wsmux_softc **,
75 	  struct wsmuxops *));
76 void	wsmux_detach __P((int, struct device *));
77 
78 int	wsmux_displayioctl __P((struct device *dev, u_long cmd,
79 	    caddr_t data, int flag, struct proc *p));
80 
81 int	wsmuxdoioctl __P((struct device *, u_long, caddr_t,int,struct proc *));
82 
83 int	wsmux_add_mux __P((int, struct wsmux_softc *));
84 int	wsmux_rem_mux __P((int, struct wsmux_softc *));
85 int	wskbd_add_mux __P((int, struct wsmux_softc *));
86 int	wskbd_rem_mux __P((int, struct wsmux_softc *));
87 int	wsmouse_add_mux __P((int, struct wsmux_softc *));
88 int	wsmouse_rem_mux __P((int, struct wsmux_softc *));
89