[BACK]Return to wsmuxvar.h CVS log [TXT][DIR] Up to [local] / sys / dev / wscons

Annotation of sys/dev/wscons/wsmuxvar.h, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: wsmuxvar.h,v 1.7 2006/08/05 16:59:57 miod Exp $       */
                      2: /*      $NetBSD: wsmuxvar.h,v 1.10 2005/04/30 03:47:12 augustss Exp $   */
                      3:
                      4: /*
                      5:  * Copyright (c) 1998 The NetBSD Foundation, Inc.
                      6:  * All rights reserved.
                      7:  *
                      8:  * Author: Lennart Augustsson <augustss@carlstedt.se>
                      9:  *         Carlstedt Research & Technology
                     10:  *
                     11:  * Redistribution and use in source and binary forms, with or without
                     12:  * modification, are permitted provided that the following conditions
                     13:  * are met:
                     14:  * 1. Redistributions of source code must retain the above copyright
                     15:  *    notice, this list of conditions and the following disclaimer.
                     16:  * 2. Redistributions in binary form must reproduce the above copyright
                     17:  *    notice, this list of conditions and the following disclaimer in the
                     18:  *    documentation and/or other materials provided with the distribution.
                     19:  * 3. All advertising materials mentioning features or use of this software
                     20:  *    must display the following acknowledgement:
                     21:  *        This product includes software developed by the NetBSD
                     22:  *        Foundation, Inc. and its contributors.
                     23:  * 4. Neither the name of The NetBSD Foundation nor the names of its
                     24:  *    contributors may be used to endorse or promote products derived
                     25:  *    from this software without specific prior written permission.
                     26:  *
                     27:  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
                     28:  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
                     29:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     30:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
                     31:  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     32:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     33:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     34:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     35:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     36:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     37:  * POSSIBILITY OF SUCH DAMAGE.
                     38:  */
                     39:
                     40: /*
                     41:  * A ws event source, i.e., wskbd, wsmouse, or wsmux.
                     42:  */
                     43: struct wsevsrc {
                     44:        struct device me_dv;
                     45:        const struct wssrcops *me_ops;  /* method pointers */
                     46:        struct wseventvar me_evar;      /* wseventvar opened directly */
                     47:        struct wseventvar *me_evp;      /* our wseventvar when open */
                     48: #if NWSDISPLAY > 0
                     49:        struct device *me_dispdv;       /* our display if part of one */
                     50: #define        sc_displaydv    sc_base.me_dispdv
                     51: #endif
                     52: #if NWSMUX > 0
                     53:        struct wsmux_softc *me_parent;  /* parent mux device */
                     54:        CIRCLEQ_ENTRY(wsevsrc) me_next; /* sibling pointers */
                     55: #endif
                     56: };
                     57:
                     58: /*
                     59:  * Methods that can be performed on an events source.  Usually called
                     60:  * from a wsmux.
                     61:  */
                     62: struct wssrcops {
                     63:        int type;                       /* device type: WSMUX_{MOUSE,KBD,MUX} */
                     64:        int (*dopen)(struct wsevsrc *, struct wseventvar *);
                     65:        int (*dclose)(struct wsevsrc *);
                     66:        int (*dioctl)(struct device *, u_long, caddr_t, int, struct proc *);
                     67:        int (*ddispioctl)(struct device *, u_long, caddr_t, int, struct proc *);
                     68:        int (*dsetdisplay)(struct device *, struct device *);
                     69: };
                     70:
                     71: #define wsevsrc_open(me, evp) \
                     72:        ((me)->me_ops->dopen((me), evp))
                     73: #define wsevsrc_close(me) \
                     74:        ((me)->me_ops->dclose((me)))
                     75: #define wsevsrc_ioctl(me, cmd, data, flag, p) \
                     76:        ((me)->me_ops->dioctl(&(me)->me_dv, cmd, (caddr_t)data, flag, p))
                     77: #define wsevsrc_display_ioctl(me, cmd, data, flag, p) \
                     78:        ((me)->me_ops->ddispioctl(&(me)->me_dv, cmd, (caddr_t)data, flag, p))
                     79: #define wsevsrc_set_display(me, arg) \
                     80:        ((me)->me_ops->dsetdisplay(&(me)->me_dv, arg))
                     81:
                     82: #if NWSMUX > 0
                     83: struct wsmux_softc {
                     84:        struct wsevsrc sc_base;
                     85:        struct proc *sc_p;              /* open proc */
                     86:        CIRCLEQ_HEAD(, wsevsrc) sc_cld; /* list of children */
                     87:        u_int32_t sc_kbd_layout;        /* current layout of keyboard */
                     88: #ifdef WSDISPLAY_COMPAT_RAWKBD
                     89:        int sc_rawkbd;                  /* A hack to remember the kbd mode */
                     90: #endif
                     91: };
                     92:
                     93: /*
                     94:  * configure defines
                     95:  */
                     96: #define WSMOUSEDEVCF_MUX               0
                     97:
                     98: struct wsmux_softc *wsmux_getmux(int);
                     99: struct wsmux_softc *wsmux_create(const char *, int);
                    100: int    wsmux_attach_sc(struct wsmux_softc *, struct wsevsrc *);
                    101: void   wsmux_detach_sc(struct wsevsrc *);
                    102: int    wsmux_set_display(struct wsmux_softc *, struct device *);
                    103:
                    104: int    wskbd_add_mux(int, struct wsmux_softc *);
                    105: int    wsmouse_add_mux(int, struct wsmux_softc *);
                    106:
                    107: #endif /* NWSMUX > 0 */

CVSweb