wsmuxvar.h revision 1.3 1 /* $NetBSD: wsmuxvar.h,v 1.3 2001/10/13 15:56:16 augustss Exp $ */
2
3 /*
4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * Author: Lennart Augustsson <augustss (at) 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)(dev_t, int, int, struct proc *);
57 int (*dclose)(struct device *, int, int, struct proc *);
58 int (*dioctl)(struct device *, u_long, caddr_t, int, struct proc *);
59 int (*ddispioctl)(struct device *, u_long, caddr_t, int, struct proc *);
60 int (*dsetdisplay)(struct device *, struct wsmux_softc *);
61 };
62
63 struct wsmux_softc *wsmux_getmux(int);
64 struct wsmux_softc *wsmux_create(const char *, int);
65 int wsmux_attach_sc(
66 struct wsmux_softc *,
67 int, struct device *, struct wseventvar *,
68 struct wsmux_softc **,
69 struct wsmuxops *);
70 int wsmux_detach_sc(struct wsmux_softc *, struct device *);
71 void wsmux_attach(
72 int, int, struct device *, struct wseventvar *,
73 struct wsmux_softc **,
74 struct wsmuxops *);
75 void wsmux_detach(int, struct device *);
76
77 int wsmux_displayioctl(struct device *dev, u_long cmd,
78 caddr_t data, int flag, struct proc *p);
79
80 int wsmuxdoioctl(struct device *, u_long, caddr_t,int,struct proc *);
81
82 int wsmux_add_mux(int, struct wsmux_softc *);
83 int wsmux_rem_mux(int, struct wsmux_softc *);
84 int wskbd_add_mux(int, struct wsmux_softc *);
85 int wskbd_rem_mux(int, struct wsmux_softc *);
86 int wsmouse_add_mux(int, struct wsmux_softc *);
87 int wsmouse_rem_mux(int, struct wsmux_softc *);
88