1*7d7b0e49Santon /* $OpenBSD: wskbdvar.h,v 1.4 2022/02/16 06:23:42 anton Exp $ */ 277b1f4eeSmickey /* $NetBSD: wskbdvar.h,v 1.8 1999/12/01 23:22:59 augustss Exp $ */ 377b1f4eeSmickey 477b1f4eeSmickey /* 577b1f4eeSmickey * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. 677b1f4eeSmickey * 777b1f4eeSmickey * Redistribution and use in source and binary forms, with or without 877b1f4eeSmickey * modification, are permitted provided that the following conditions 977b1f4eeSmickey * are met: 1077b1f4eeSmickey * 1. Redistributions of source code must retain the above copyright 1177b1f4eeSmickey * notice, this list of conditions and the following disclaimer. 1277b1f4eeSmickey * 2. Redistributions in binary form must reproduce the above copyright 1377b1f4eeSmickey * notice, this list of conditions and the following disclaimer in the 1477b1f4eeSmickey * documentation and/or other materials provided with the distribution. 1577b1f4eeSmickey * 3. All advertising materials mentioning features or use of this software 1677b1f4eeSmickey * must display the following acknowledgement: 1777b1f4eeSmickey * This product includes software developed by Christopher G. Demetriou 1877b1f4eeSmickey * for the NetBSD Project. 1977b1f4eeSmickey * 4. The name of the author may not be used to endorse or promote products 2077b1f4eeSmickey * derived from this software without specific prior written permission 2177b1f4eeSmickey * 2277b1f4eeSmickey * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 2377b1f4eeSmickey * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2477b1f4eeSmickey * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2577b1f4eeSmickey * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2677b1f4eeSmickey * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2777b1f4eeSmickey * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2877b1f4eeSmickey * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2977b1f4eeSmickey * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3077b1f4eeSmickey * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 3177b1f4eeSmickey * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3277b1f4eeSmickey */ 3377b1f4eeSmickey 3477b1f4eeSmickey /* 3577b1f4eeSmickey * WSKBD interfaces. 3677b1f4eeSmickey */ 3777b1f4eeSmickey 3877b1f4eeSmickey /* 3977b1f4eeSmickey * Keyboard access functions (must be provided by all keyboards). 4077b1f4eeSmickey * 4177b1f4eeSmickey * There is a "void *" cookie provided by the keyboard driver associated 4277b1f4eeSmickey * with these functions, which is passed to them when they are invoked. 4377b1f4eeSmickey */ 4477b1f4eeSmickey struct wskbd_accessops { 45c4071fd1Smillert int (*enable)(void *, int); 46c4071fd1Smillert void (*set_leds)(void *, int); 47c4071fd1Smillert int (*ioctl)(void *v, u_long cmd, caddr_t data, int flag, 48c4071fd1Smillert struct proc *p); 4977b1f4eeSmickey }; 5077b1f4eeSmickey 5177b1f4eeSmickey /* 5277b1f4eeSmickey * Keyboard console functions (must be provided by console input keyboards). 5377b1f4eeSmickey * 5477b1f4eeSmickey * There is a "void *" cookie provided by the keyboard driver associated 5577b1f4eeSmickey * with these functions, which is passed to them when they are invoked. 5677b1f4eeSmickey */ 5777b1f4eeSmickey struct wskbd_consops { 58c4071fd1Smillert void (*getc)(void *, u_int *, int *); 59c4071fd1Smillert void (*pollc)(void *, int); 60c4071fd1Smillert void (*bell)(void *, u_int, u_int, u_int); 61caf8c712Smpi void (*debugger)(void *); 6277b1f4eeSmickey }; 6377b1f4eeSmickey 6477b1f4eeSmickey /* 6577b1f4eeSmickey * Attachment information provided by wskbddev devices when attaching 6677b1f4eeSmickey * wskbd units. 6777b1f4eeSmickey */ 6877b1f4eeSmickey struct wskbddev_attach_args { 6977b1f4eeSmickey int console; /* is it console? */ 7077b1f4eeSmickey const struct wskbd_mapdata *keymap; 7177b1f4eeSmickey 7277b1f4eeSmickey const struct wskbd_accessops *accessops; /* access ops */ 7377b1f4eeSmickey void *accesscookie; /* access cookie */ 74*7d7b0e49Santon 75*7d7b0e49Santon void *audiocookie; 7677b1f4eeSmickey }; 7777b1f4eeSmickey 7877b1f4eeSmickey #define WSKBDDEVCF_CONSOLE 0 7977b1f4eeSmickey #define wskbddevcf_console cf_loc[WSKBDDEVCF_CONSOLE] /* spec'd as console? */ 8077b1f4eeSmickey #define WSKBDDEVCF_CONSOLE_UNK -1 8177b1f4eeSmickey 8277b1f4eeSmickey #define WSKBDDEVCF_MUX 1 8377b1f4eeSmickey #define wskbddevcf_mux cf_loc[WSKBDDEVCF_MUX] 8477b1f4eeSmickey 8577b1f4eeSmickey /* 8677b1f4eeSmickey * Autoconfiguration helper functions. 8777b1f4eeSmickey */ 88c4071fd1Smillert void wskbd_cnattach(const struct wskbd_consops *, void *, 89c4071fd1Smillert const struct wskbd_mapdata *); 90c4071fd1Smillert void wskbd_cndetach(void); 91c4071fd1Smillert int wskbddevprint(void *, const char *); 9277b1f4eeSmickey 9377b1f4eeSmickey /* 9477b1f4eeSmickey * Callbacks from the keyboard driver to the wskbd interface driver. 9577b1f4eeSmickey */ 96c4071fd1Smillert void wskbd_input(struct device *kbddev, u_int type, int value); 9777b1f4eeSmickey /* for WSDISPLAY_COMPAT_RAWKBD */ 98c4071fd1Smillert void wskbd_rawinput(struct device *, u_char *, int); 9977b1f4eeSmickey 10077b1f4eeSmickey /* 10177b1f4eeSmickey * Console interface. 10277b1f4eeSmickey */ 103c4071fd1Smillert int wskbd_cngetc(dev_t dev); 104c4071fd1Smillert void wskbd_cnpollc(dev_t dev, int poll); 105c4071fd1Smillert void wskbd_cnbell(dev_t, u_int, u_int, u_int); 106