uart_kbd_sun.c revision 122470
1122470Sjake/*- 2122470Sjake * Copyright (c) 2003 Jake Burkholder. 3122470Sjake * All rights reserved. 4122470Sjake * 5122470Sjake * Redistribution and use in source and binary forms, with or without 6122470Sjake * modification, are permitted provided that the following conditions 7122470Sjake * are met: 8122470Sjake * 1. Redistributions of source code must retain the above copyright 9122470Sjake * notice, this list of conditions and the following disclaimer. 10122470Sjake * 2. Redistributions in binary form must reproduce the above copyright 11122470Sjake * notice, this list of conditions and the following disclaimer in the 12122470Sjake * documentation and/or other materials provided with the distribution. 13122470Sjake * 14122470Sjake * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15122470Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16122470Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17122470Sjake * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18122470Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19122470Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20122470Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21122470Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22122470Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23122470Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24122470Sjake * SUCH DAMAGE. 25122470Sjake * 26122470Sjake * $FreeBSD: head/sys/dev/uart/uart_kbd_sun.c 122470 2003-11-11 07:33:24Z jake $ 27122470Sjake */ 28122470Sjake 29122470Sjake#include "opt_kbd.h" 30122470Sjake 31122470Sjake#include <sys/param.h> 32122470Sjake#include <sys/systm.h> 33122470Sjake#include <sys/bus.h> 34122470Sjake#include <sys/interrupt.h> 35122470Sjake#include <sys/kbio.h> 36122470Sjake#include <sys/kernel.h> 37122470Sjake#include <sys/malloc.h> 38122470Sjake#include <sys/ktr.h> 39122470Sjake 40122470Sjake#include <machine/bus.h> 41122470Sjake#include <machine/resource.h> 42122470Sjake 43122470Sjake#include <sys/rman.h> 44122470Sjake 45122470Sjake#include <dev/kbd/kbdreg.h> 46122470Sjake 47122470Sjake#include <dev/uart/uart.h> 48122470Sjake#include <dev/uart/uart_bus.h> 49122470Sjake#include <dev/uart/uart_cpu.h> 50122470Sjake 51122470Sjake#include <dev/uart/uart_kbd_sun.h> 52122470Sjake#include <dev/uart/uart_kbd_sun_tables.h> 53122470Sjake 54122470Sjake#include "uart_if.h" 55122470Sjake 56122470Sjake#define SUNKBD_BUF_SIZE 128 57122470Sjake 58122470Sjake#define TODO printf("%s: unimplemented", __func__) 59122470Sjake 60122470Sjakestruct sunkbd_softc { 61122470Sjake keyboard_t sc_kbd; 62122470Sjake struct uart_softc *sc_uart; 63122470Sjake struct uart_devinfo *sc_sysdev; 64122470Sjake 65122470Sjake struct callout sc_repeat_callout; 66122470Sjake int sc_repeat_key; 67122470Sjake 68122470Sjake int sc_accents; 69122470Sjake int sc_mode; 70122470Sjake int sc_polling; 71122470Sjake int sc_repeating; 72122470Sjake int sc_state; 73122470Sjake}; 74122470Sjake 75122470Sjakestatic int sunkbd_configure(int flags); 76122470Sjakestatic int sunkbd_probe_keyboard(struct uart_devinfo *di); 77122470Sjake 78122470Sjakestatic int sunkbd_probe(int unit, void *arg, int flags); 79122470Sjakestatic int sunkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags); 80122470Sjakestatic int sunkbd_term(keyboard_t *kbd); 81122470Sjakestatic int sunkbd_intr(keyboard_t *kbd, void *arg); 82122470Sjakestatic int sunkbd_test_if(keyboard_t *kbd); 83122470Sjakestatic int sunkbd_enable(keyboard_t *kbd); 84122470Sjakestatic int sunkbd_disable(keyboard_t *kbd); 85122470Sjakestatic int sunkbd_read(keyboard_t *kbd, int wait); 86122470Sjakestatic int sunkbd_check(keyboard_t *kbd); 87122470Sjakestatic u_int sunkbd_read_char(keyboard_t *kbd, int wait); 88122470Sjakestatic int sunkbd_check_char(keyboard_t *kbd); 89122470Sjakestatic int sunkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t data); 90122470Sjakestatic int sunkbd_lock(keyboard_t *kbd, int lock); 91122470Sjakestatic void sunkbd_clear_state(keyboard_t *kbd); 92122470Sjakestatic int sunkbd_get_state(keyboard_t *kbd, void *buf, size_t len); 93122470Sjakestatic int sunkbd_set_state(keyboard_t *kbd, void *buf, size_t len); 94122470Sjakestatic int sunkbd_poll_mode(keyboard_t *kbd, int on); 95122470Sjakestatic void sunkbd_diag(keyboard_t *kbd, int level); 96122470Sjake 97122470Sjakestatic void sunkbd_repeat(void *v); 98122470Sjake 99122470Sjakestatic keyboard_switch_t sunkbdsw = { 100122470Sjake sunkbd_probe, 101122470Sjake sunkbd_init, 102122470Sjake sunkbd_term, 103122470Sjake sunkbd_intr, 104122470Sjake sunkbd_test_if, 105122470Sjake sunkbd_enable, 106122470Sjake sunkbd_disable, 107122470Sjake sunkbd_read, 108122470Sjake sunkbd_check, 109122470Sjake sunkbd_read_char, 110122470Sjake sunkbd_check_char, 111122470Sjake sunkbd_ioctl, 112122470Sjake sunkbd_lock, 113122470Sjake sunkbd_clear_state, 114122470Sjake sunkbd_get_state, 115122470Sjake sunkbd_set_state, 116122470Sjake genkbd_get_fkeystr, 117122470Sjake sunkbd_poll_mode, 118122470Sjake sunkbd_diag 119122470Sjake}; 120122470Sjake 121122470SjakeKEYBOARD_DRIVER(sunkbd, sunkbdsw, sunkbd_configure); 122122470Sjake 123122470Sjakestatic struct sunkbd_softc sunkbd_softc; 124122470Sjakestatic struct uart_devinfo uart_keyboard; 125122470Sjake 126122470Sjakestatic fkeytab_t fkey_tab[96] = { 127122470Sjake/* 01-04 */ {"\033[M", 3}, {"\033[N", 3}, {"\033[O", 3}, {"\033[P", 3}, 128122470Sjake/* 05-08 */ {"\033[Q", 3}, {"\033[R", 3}, {"\033[S", 3}, {"\033[T", 3}, 129122470Sjake/* 09-12 */ {"\033[U", 3}, {"\033[V", 3}, {"\033[W", 3}, {"\033[X", 3}, 130122470Sjake/* 13-16 */ {"\033[Y", 3}, {"\033[Z", 3}, {"\033[a", 3}, {"\033[b", 3}, 131122470Sjake/* 17-20 */ {"\033[c", 3}, {"\033[d", 3}, {"\033[e", 3}, {"\033[f", 3}, 132122470Sjake/* 21-24 */ {"\033[g", 3}, {"\033[h", 3}, {"\033[i", 3}, {"\033[j", 3}, 133122470Sjake/* 25-28 */ {"\033[k", 3}, {"\033[l", 3}, {"\033[m", 3}, {"\033[n", 3}, 134122470Sjake/* 29-32 */ {"\033[o", 3}, {"\033[p", 3}, {"\033[q", 3}, {"\033[r", 3}, 135122470Sjake/* 33-36 */ {"\033[s", 3}, {"\033[t", 3}, {"\033[u", 3}, {"\033[v", 3}, 136122470Sjake/* 37-40 */ {"\033[w", 3}, {"\033[x", 3}, {"\033[y", 3}, {"\033[z", 3}, 137122470Sjake/* 41-44 */ {"\033[@", 3}, {"\033[[", 3}, {"\033[\\",3}, {"\033[]", 3}, 138122470Sjake/* 45-48 */ {"\033[^", 3}, {"\033[_", 3}, {"\033[`", 3}, {"\033[{", 3}, 139122470Sjake/* 49-52 */ {"\033[H", 3}, {"\033[A", 3}, {"\033[I", 3}, {"-" , 1}, 140122470Sjake/* 53-56 */ {"\033[D", 3}, {"\033[E", 3}, {"\033[C", 3}, {"+" , 1}, 141122470Sjake/* 57-60 */ {"\033[F", 3}, {"\033[B", 3}, {"\033[G", 3}, {"\033[L", 3}, 142122470Sjake/* 61-64 */ {"\177", 1}, {"\033[J", 3}, {"\033[~", 3}, {"\033[}", 3}, 143122470Sjake/* 65-68 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , 144122470Sjake/* 69-72 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , 145122470Sjake/* 73-76 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , 146122470Sjake/* 77-80 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , 147122470Sjake/* 81-84 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , 148122470Sjake/* 85-88 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , 149122470Sjake/* 89-92 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , 150122470Sjake/* 93-96 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} 151122470Sjake}; 152122470Sjake 153122470Sjakestatic int 154122470Sjakesunkbd_probe_keyboard(struct uart_devinfo *di) 155122470Sjake{ 156122470Sjake int tries; 157122470Sjake 158122470Sjake for (tries = 5; tries != 0; tries--) { 159122470Sjake int ltries; 160122470Sjake 161122470Sjake uart_putc(di, SKBD_CMD_RESET); 162122470Sjake for (ltries = 1000; ltries != 0; ltries--) { 163122470Sjake if (uart_poll(di) == SKBD_RSP_RESET) 164122470Sjake break; 165122470Sjake DELAY(1000); 166122470Sjake } 167122470Sjake if (ltries == 0) 168122470Sjake continue; 169122470Sjake for (ltries = 1000; ltries != 0; ltries--) { 170122470Sjake if (uart_poll(di) == SKBD_RSP_IDLE) 171122470Sjake break; 172122470Sjake DELAY(1000); 173122470Sjake } 174122470Sjake if (ltries == 0) 175122470Sjake continue; 176122470Sjake uart_putc(di, SKBD_CMD_LAYOUT); 177122470Sjake if (uart_getc(di) != SKBD_RSP_LAYOUT) 178122470Sjake break; 179122470Sjake return (uart_getc(di)); 180122470Sjake } 181122470Sjake return (-1); 182122470Sjake} 183122470Sjake 184122470Sjakestatic int sunkbd_attach(struct uart_softc *sc); 185122470Sjakestatic void sunkbd_uart_intr(void *arg); 186122470Sjake 187122470Sjakestatic int 188122470Sjakesunkbd_configure(int flags) 189122470Sjake{ 190122470Sjake struct sunkbd_softc *sc; 191122470Sjake 192122470Sjake if (uart_cpu_getdev(UART_DEV_KEYBOARD, &uart_keyboard)) 193122470Sjake return (0); 194122470Sjake if (uart_probe(&uart_keyboard)) 195122470Sjake return (0); 196122470Sjake uart_init(&uart_keyboard); 197122470Sjake if (sunkbd_probe_keyboard(&uart_keyboard) == -1) 198122470Sjake return (0); 199122470Sjake uart_keyboard.type = UART_DEV_KEYBOARD; 200122470Sjake uart_keyboard.attach = sunkbd_attach; 201122470Sjake uart_add_sysdev(&uart_keyboard); 202122470Sjake 203122470Sjake sc = &sunkbd_softc; 204122470Sjake callout_init(&sc->sc_repeat_callout, 0); 205122470Sjake sc->sc_repeat_key = -1; 206122470Sjake sc->sc_repeating = 0; 207122470Sjake 208122470Sjake kbd_init_struct(&sc->sc_kbd, "sunkbd", KB_OTHER, 0, 0, 0, 0); 209122470Sjake kbd_set_maps(&sc->sc_kbd, &keymap_sun_us_unix_kbd, 210122470Sjake &accentmap_sun_us_unix_kbd, fkey_tab, 211122470Sjake sizeof(fkey_tab) / sizeof(fkey_tab[0])); 212122470Sjake sc->sc_mode = K_XLATE; 213122470Sjake kbd_register(&sc->sc_kbd); 214122470Sjake 215122470Sjake sc->sc_sysdev = &uart_keyboard; 216122470Sjake 217122470Sjake return (0); 218122470Sjake} 219122470Sjake 220122470Sjakestatic int 221122470Sjakesunkbd_attach(struct uart_softc *sc) 222122470Sjake{ 223122470Sjake 224122470Sjake if (sc->sc_sysdev != NULL) { 225122470Sjake sunkbd_softc.sc_uart = sc; 226122470Sjake 227122470Sjake kbd_attach(&sunkbd_softc.sc_kbd); 228122470Sjake sunkbd_enable(&sunkbd_softc.sc_kbd); 229122470Sjake 230122470Sjake swi_add(&tty_ithd, uart_driver_name, sunkbd_uart_intr, 231122470Sjake &sunkbd_softc, SWI_TTY, INTR_TYPE_TTY, &sc->sc_softih); 232122470Sjake 233122470Sjake sc->sc_opened = 1; 234122470Sjake } 235122470Sjake 236122470Sjake return (0); 237122470Sjake} 238122470Sjake 239122470Sjakestatic void 240122470Sjakesunkbd_uart_intr(void *arg) 241122470Sjake{ 242122470Sjake struct sunkbd_softc *sc = arg; 243122470Sjake int pend; 244122470Sjake 245122470Sjake if (sc->sc_uart->sc_leaving) 246122470Sjake return; 247122470Sjake 248122470Sjake pend = atomic_readandclear_32(&sc->sc_uart->sc_ttypend); 249122470Sjake if (!(pend & UART_IPEND_MASK)) 250122470Sjake return; 251122470Sjake 252122470Sjake if (pend & UART_IPEND_RXREADY) { 253122470Sjake if (KBD_IS_ACTIVE(&sc->sc_kbd) && KBD_IS_BUSY(&sc->sc_kbd)) { 254122470Sjake sc->sc_kbd.kb_callback.kc_func(&sc->sc_kbd, 255122470Sjake KBDIO_KEYINPUT, sc->sc_kbd.kb_callback.kc_arg); 256122470Sjake } 257122470Sjake } 258122470Sjake 259122470Sjake} 260122470Sjake 261122470Sjakestatic int 262122470Sjakesunkbd_probe(int unit, void *arg, int flags) 263122470Sjake{ 264122470Sjake TODO; 265122470Sjake return (0); 266122470Sjake} 267122470Sjake 268122470Sjakestatic int 269122470Sjakesunkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags) 270122470Sjake{ 271122470Sjake TODO; 272122470Sjake return (0); 273122470Sjake} 274122470Sjake 275122470Sjakestatic int 276122470Sjakesunkbd_term(keyboard_t *kbd) 277122470Sjake{ 278122470Sjake TODO; 279122470Sjake return (0); 280122470Sjake} 281122470Sjake 282122470Sjakestatic int 283122470Sjakesunkbd_intr(keyboard_t *kbd, void *arg) 284122470Sjake{ 285122470Sjake TODO; 286122470Sjake return (0); 287122470Sjake} 288122470Sjake 289122470Sjakestatic int 290122470Sjakesunkbd_test_if(keyboard_t *kbd) 291122470Sjake{ 292122470Sjake TODO; 293122470Sjake return (0); 294122470Sjake} 295122470Sjake 296122470Sjakestatic int 297122470Sjakesunkbd_enable(keyboard_t *kbd) 298122470Sjake{ 299122470Sjake KBD_ACTIVATE(kbd); 300122470Sjake return (0); 301122470Sjake} 302122470Sjake 303122470Sjakestatic int 304122470Sjakesunkbd_disable(keyboard_t *kbd) 305122470Sjake{ 306122470Sjake KBD_DEACTIVATE(kbd); 307122470Sjake return (0); 308122470Sjake} 309122470Sjake 310122470Sjakestatic int 311122470Sjakesunkbd_read(keyboard_t *kbd, int wait) 312122470Sjake{ 313122470Sjake TODO; 314122470Sjake return (0); 315122470Sjake} 316122470Sjake 317122470Sjakestatic int 318122470Sjakesunkbd_check(keyboard_t *kbd) 319122470Sjake{ 320122470Sjake TODO; 321122470Sjake return (0); 322122470Sjake} 323122470Sjake 324122470Sjakestatic u_int 325122470Sjakesunkbd_read_char(keyboard_t *kbd, int wait) 326122470Sjake{ 327122470Sjake struct sunkbd_softc *sc; 328122470Sjake int action; 329122470Sjake int key; 330122470Sjake 331122470Sjake sc = (struct sunkbd_softc *)kbd; 332122470Sjake if (sc->sc_repeating) { 333122470Sjake sc->sc_repeating = 0; 334122470Sjake callout_reset(&sc->sc_repeat_callout, hz / 10, 335122470Sjake sunkbd_repeat, sc); 336122470Sjake key = sc->sc_repeat_key; 337122470Sjake if (sc->sc_mode == K_RAW) 338122470Sjake return (key); 339122470Sjake else 340122470Sjake return genkbd_keyaction(kbd, key & 0x7f, key & 0x80, 341122470Sjake &sc->sc_state, &sc->sc_accents); 342122470Sjake } 343122470Sjake 344122470Sjake for (;;) { 345122470Sjake /* XXX compose */ 346122470Sjake 347122470Sjake if (sc->sc_uart != NULL && !uart_rx_empty(sc->sc_uart)) { 348122470Sjake key = uart_rx_get(sc->sc_uart); 349122470Sjake } else if (sc->sc_polling != 0 && sc->sc_sysdev != NULL) { 350122470Sjake if (wait) 351122470Sjake key = uart_getc(sc->sc_sysdev); 352122470Sjake else if ((key = uart_poll(sc->sc_sysdev)) == -1) 353122470Sjake return (NOKEY); 354122470Sjake } else { 355122470Sjake return (NOKEY); 356122470Sjake } 357122470Sjake 358122470Sjake switch (key) { 359122470Sjake case SKBD_RSP_IDLE: 360122470Sjake break; 361122470Sjake default: 362122470Sjake ++kbd->kb_count; 363122470Sjake 364122470Sjake if ((key & 0x80) == 0) { 365122470Sjake callout_reset(&sc->sc_repeat_callout, hz / 2, 366122470Sjake sunkbd_repeat, sc); 367122470Sjake sc->sc_repeat_key = key; 368122470Sjake } else { 369122470Sjake if (sc->sc_repeat_key == (key & 0x7f)) { 370122470Sjake callout_stop(&sc->sc_repeat_callout); 371122470Sjake sc->sc_repeat_key = -1; 372122470Sjake } 373122470Sjake } 374122470Sjake 375122470Sjake if (sc->sc_mode == K_RAW) 376122470Sjake return (key); 377122470Sjake 378122470Sjake action = genkbd_keyaction(kbd, key & 0x7f, key & 0x80, 379122470Sjake &sc->sc_state, &sc->sc_accents); 380122470Sjake if (action != NOKEY) 381122470Sjake return (action); 382122470Sjake break; 383122470Sjake } 384122470Sjake } 385122470Sjake return (0); 386122470Sjake} 387122470Sjake 388122470Sjakestatic int 389122470Sjakesunkbd_check_char(keyboard_t *kbd) 390122470Sjake{ 391122470Sjake TODO; 392122470Sjake return (0); 393122470Sjake} 394122470Sjake 395122470Sjakestatic int 396122470Sjakesunkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t data) 397122470Sjake{ 398122470Sjake struct sunkbd_softc *sc; 399122470Sjake int error; 400122470Sjake 401122470Sjake sc = (struct sunkbd_softc *)kbd; 402122470Sjake error = 0; 403122470Sjake switch (cmd) { 404122470Sjake case KDGKBMODE: 405122470Sjake *(int *)data = sc->sc_mode; 406122470Sjake break; 407122470Sjake case KDSKBMODE: 408122470Sjake switch (*(int *)data) { 409122470Sjake case K_XLATE: 410122470Sjake if (sc->sc_mode != K_XLATE) { 411122470Sjake /* make lock key state and LED state match */ 412122470Sjake sc->sc_state &= ~LOCK_MASK; 413122470Sjake sc->sc_state |= KBD_LED_VAL(kbd); 414122470Sjake } 415122470Sjake /* FALLTHROUGH */ 416122470Sjake case K_RAW: 417122470Sjake case K_CODE: 418122470Sjake if (sc->sc_mode != *(int *)data) { 419122470Sjake sunkbd_clear_state(kbd); 420122470Sjake sc->sc_mode = *(int *)data; 421122470Sjake } 422122470Sjake break; 423122470Sjake default: 424122470Sjake error = EINVAL; 425122470Sjake break; 426122470Sjake } 427122470Sjake break; 428122470Sjake case KDGETLED: 429122470Sjake *(int *)data = KBD_LED_VAL(kbd); 430122470Sjake break; 431122470Sjake case KDSETLED: 432122470Sjake if (*(int *)data & ~LOCK_MASK) { 433122470Sjake error = EINVAL; 434122470Sjake break; 435122470Sjake } 436122470Sjake if (sc->sc_uart == NULL) 437122470Sjake break; 438122470Sjake sc->sc_uart->sc_txdatasz = 2; 439122470Sjake sc->sc_uart->sc_txbuf[0] = SKBD_CMD_SETLED; 440122470Sjake sc->sc_uart->sc_txbuf[1] = 0; 441122470Sjake if (*(int *)data & CLKED) 442122470Sjake sc->sc_uart->sc_txbuf[1] |= SKBD_LED_CAPSLOCK; 443122470Sjake if (*(int *)data & NLKED) 444122470Sjake sc->sc_uart->sc_txbuf[1] |= SKBD_LED_NUMLOCK; 445122470Sjake if (*(int *)data & SLKED) 446122470Sjake sc->sc_uart->sc_txbuf[1] |= SKBD_LED_SCROLLLOCK; 447122470Sjake UART_TRANSMIT(sc->sc_uart); 448122470Sjake KBD_LED_VAL(kbd) = *(int *)data; 449122470Sjake break; 450122470Sjake case KDGKBSTATE: 451122470Sjake *(int *)data = sc->sc_state & LOCK_MASK; 452122470Sjake break; 453122470Sjake case KDSKBSTATE: 454122470Sjake if (*(int *)data & ~LOCK_MASK) { 455122470Sjake error = EINVAL; 456122470Sjake break; 457122470Sjake } 458122470Sjake sc->sc_state &= ~LOCK_MASK; 459122470Sjake sc->sc_state |= *(int *)data; 460122470Sjake break; 461122470Sjake case KDSETREPEAT: 462122470Sjake case KDSETRAD: 463122470Sjake break; 464122470Sjake case PIO_KEYMAP: 465122470Sjake case PIO_KEYMAPENT: 466122470Sjake case PIO_DEADKEYMAP: 467122470Sjake default: 468122470Sjake return (genkbd_commonioctl(kbd, cmd, data)); 469122470Sjake } 470122470Sjake return (error); 471122470Sjake} 472122470Sjake 473122470Sjakestatic int 474122470Sjakesunkbd_lock(keyboard_t *kbd, int lock) 475122470Sjake{ 476122470Sjake TODO; 477122470Sjake return (0); 478122470Sjake} 479122470Sjake 480122470Sjakestatic void 481122470Sjakesunkbd_clear_state(keyboard_t *kbd) 482122470Sjake{ 483122470Sjake /* TODO; */ 484122470Sjake} 485122470Sjake 486122470Sjakestatic int 487122470Sjakesunkbd_get_state(keyboard_t *kbd, void *buf, size_t len) 488122470Sjake{ 489122470Sjake TODO; 490122470Sjake return (0); 491122470Sjake} 492122470Sjake 493122470Sjakestatic int 494122470Sjakesunkbd_set_state(keyboard_t *kbd, void *buf, size_t len) 495122470Sjake{ 496122470Sjake TODO; 497122470Sjake return (0); 498122470Sjake} 499122470Sjake 500122470Sjakestatic int 501122470Sjakesunkbd_poll_mode(keyboard_t *kbd, int on) 502122470Sjake{ 503122470Sjake struct sunkbd_softc *sc; 504122470Sjake 505122470Sjake sc = (struct sunkbd_softc *)kbd; 506122470Sjake if (on) 507122470Sjake sc->sc_polling++; 508122470Sjake else 509122470Sjake sc->sc_polling--; 510122470Sjake return (0); 511122470Sjake} 512122470Sjake 513122470Sjakestatic void 514122470Sjakesunkbd_diag(keyboard_t *kbd, int level) 515122470Sjake{ 516122470Sjake TODO; 517122470Sjake} 518122470Sjake 519122470Sjakestatic void 520122470Sjakesunkbd_repeat(void *v) 521122470Sjake{ 522122470Sjake struct sunkbd_softc *sc = v; 523122470Sjake 524122470Sjake if (sc->sc_repeat_key != -1) { 525122470Sjake sc->sc_repeating = 1; 526122470Sjake sc->sc_kbd.kb_callback.kc_func(&sc->sc_kbd, 527122470Sjake KBDIO_KEYINPUT, sc->sc_kbd.kb_callback.kc_arg); 528122470Sjake } 529122470Sjake} 530