[BACK]Return to akbd_machdep.c CVS log [TXT][DIR] Up to [local] / sys / arch / macppc / dev

Annotation of sys/arch/macppc/dev/akbd_machdep.c, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: akbd_machdep.c,v 1.1 2006/01/18 23:21:17 miod Exp $   */
                      2: /*     $NetBSD: akbd.c,v 1.13 2001/01/25 14:08:55 tsubai Exp $ */
                      3:
                      4: /*
                      5:  * Copyright (C) 1998  Colin Wood
                      6:  * All rights reserved.
                      7:  *
                      8:  * Redistribution and use in source and binary forms, with or without
                      9:  * modification, are permitted provided that the following conditions
                     10:  * are met:
                     11:  * 1. Redistributions of source code must retain the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer.
                     13:  * 2. Redistributions in binary form must reproduce the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer in the
                     15:  *    documentation and/or other materials provided with the distribution.
                     16:  * 3. All advertising materials mentioning features or use of this software
                     17:  *    must display the following acknowledgement:
                     18:  *     This product includes software developed by Colin Wood.
                     19:  * 4. The name of the author may not be used to endorse or promote products
                     20:  *    derived from this software without specific prior written permission.
                     21:  *
                     22:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
                     23:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
                     24:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
                     25:  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
                     26:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
                     27:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
                     28:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
                     29:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
                     30:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
                     31:  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
                     32:  */
                     33:
                     34: #include <sys/param.h>
                     35: #include <sys/timeout.h>
                     36: #include <sys/kernel.h>
                     37: #include <sys/device.h>
                     38: #include <sys/fcntl.h>
                     39: #include <sys/poll.h>
                     40: #include <sys/selinfo.h>
                     41: #include <sys/proc.h>
                     42: #include <sys/signalvar.h>
                     43: #include <sys/systm.h>
                     44:
                     45: #include <dev/wscons/wsconsio.h>
                     46: #include <dev/wscons/wskbdvar.h>
                     47:
                     48: #include <dev/adb/adb.h>
                     49: #include <dev/adb/akbdvar.h>
                     50: #include <dev/adb/keyboard.h>
                     51:
                     52: void   akbd_cngetc(void *, u_int *, int *);
                     53: void   akbd_cnpollc(void *, int);
                     54:
                     55: struct wskbd_consops akbd_consops = {
                     56:        akbd_cngetc,
                     57:        akbd_cnpollc,
                     58: };
                     59:
                     60: static int _akbd_is_console;
                     61:
                     62: int
                     63: akbd_is_console()
                     64: {
                     65:        return (_akbd_is_console);
                     66: }
                     67:
                     68: int
                     69: akbd_cnattach()
                     70: {
                     71:        _akbd_is_console = 1;
                     72:        wskbd_cnattach(&akbd_consops, NULL, &akbd_keymapdata);
                     73:        return 0;
                     74: }
                     75:
                     76: void
                     77: akbd_cngetc(void *v, u_int *type, int *data)
                     78: {
                     79:        int key, press, val;
                     80:        int s;
                     81:        extern int adb_intr(void *);
                     82:
                     83:        s = splhigh();
                     84:
                     85:        adb_polledkey = -1;
                     86:        adb_polling = 1;
                     87:
                     88:        while (adb_polledkey == -1) {
                     89:                adb_intr(NULL); /* adb does not use the argument */
                     90:                DELAY(10000);                           /* XXX */
                     91:        }
                     92:
                     93:        adb_polling = 0;
                     94:        splx(s);
                     95:
                     96:        key = adb_polledkey;
                     97:        press = ADBK_PRESS(key);
                     98:        val = ADBK_KEYVAL(key);
                     99:
                    100:        *data = val;
                    101:        *type = press ? WSCONS_EVENT_KEY_DOWN : WSCONS_EVENT_KEY_UP;
                    102: }
                    103:
                    104: void
                    105: akbd_cnpollc(void *v, int on)
                    106: {
                    107: }

CVSweb