Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x68k G/c amiga's key repeat handler.



details:   https://anonhg.NetBSD.org/src/rev/6b7662ef3c1a
branches:  trunk
changeset: 467420:6b7662ef3c1a
user:      minoura <minoura%NetBSD.org@localhost>
date:      Wed Mar 24 14:11:47 1999 +0000

description:
G/c amiga's key repeat handler.

diffstat:

 sys/arch/x68k/dev/ite.c      |  90 +++++++------------------------------------
 sys/arch/x68k/dev/itevar.h   |  12 ++---
 sys/arch/x68k/x68k/machdep.c |  88 ++----------------------------------------
 3 files changed, 26 insertions(+), 164 deletions(-)

diffs (truncated from 372 to 300 lines):

diff -r c1d439ba1410 -r 6b7662ef3c1a sys/arch/x68k/dev/ite.c
--- a/sys/arch/x68k/dev/ite.c   Wed Mar 24 14:07:38 1999 +0000
+++ b/sys/arch/x68k/dev/ite.c   Wed Mar 24 14:11:47 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ite.c,v 1.15 1999/03/22 03:20:51 minoura Exp $ */
+/*     $NetBSD: ite.c,v 1.16 1999/03/24 14:11:47 minoura Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -63,6 +63,7 @@
 #include <sys/device.h>
 #include <sys/malloc.h>
 
+#include <machine/cpu.h>
 #include <machine/kbio.h>
 #include <machine/bus.h>
 #include <machine/grfioctl.h>
@@ -72,6 +73,9 @@
 #include <arch/x68k/dev/itevar.h>
 #include <arch/x68k/dev/kbdmap.h>
 #include <arch/x68k/dev/mfp.h>
+#if NBELL > 0
+void opm_bell __P((void));
+#endif
 
 #define SUBR_CNPROBE(min)      itesw[min].ite_cnprobe(min)
 #define SUBR_INIT(ip)          ip->isw->ite_init(ip)
@@ -116,8 +120,8 @@
 void iteoff __P((dev_t, int));
 
 struct itesw itesw[] = {
-       0,      tv_init,        tv_deinit,      0,
-       0,      0,              0,
+       {0,     tv_init,        tv_deinit,      0,
+        0,     0,              0}
 };
 int    nitesw = sizeof(itesw) / sizeof(itesw[0]);
 
@@ -164,7 +168,9 @@
        void *auxp;
 {
        struct grf_softc *gp;
+#if 0
        int maj;
+#endif
        
        gp = auxp;
 
@@ -523,7 +529,7 @@
        struct clist *rbp;
        struct ite_softc *ip;
        u_char buf[ITEBURST];
-       int s, len, n;
+       int s, len;
 
        ip = getitesp(tp->t_dev);
        /*
@@ -622,15 +628,13 @@
 
 /* Used in console at startup only */
 int
-ite_cnfilter(c, caller)
+ite_cnfilter(c)
        u_char c;
-       enum caller caller;
 {
-       struct tty *kbd_tty;
        static u_char mod = 0;
        struct key key;
        u_char code, up, mask;
-       int s, i;
+       int s;
 
        up = c & 0x80 ? 1 : 0;
        c &= 0x7f;
@@ -736,21 +740,6 @@
 }
 
 /* And now the old stuff. */
-
-/* these are used to implement repeating keys.. */
-static u_char last_char = 0;
-static u_char tout_pending = 0;
-
-/*ARGSUSED*/
-static void
-repeat_handler (arg)
-       void *arg;
-{
-       tout_pending = 0;
-       if (last_char)
-               add_sicallback(ite_filter, last_char, ITEFILT_REPEATER);
-}
-
 __inline static void
 itesendch (ch)
        int ch;
@@ -760,9 +749,8 @@
 
 
 void
-ite_filter(c, caller)
+ite_filter(c)
        u_char c;
-       enum caller caller;
 {
        static u_short mod = 0;
        register unsigned char code, *str;
@@ -777,15 +765,6 @@
        /* have to make sure we're at spltty in here */
        s = spltty ();
 
-#if 0 /* XXX? x68k */
-       /* keyboard interrupts come at priority 2, while softint-
-          generated keyboard-repeat interrupts come at level 1.
-          So, to not allow a key-up event to get thru before
-          a repeat for the key-down, we remove any outstanding
-          callout requests.. */
-       rem_sicallback (ite_filter);
-#endif
-
        up = c & 0x80 ? 1 : 0;
        c &= 0x7f;
        code = 0;
@@ -852,11 +831,6 @@
                } else mod |= mask;
 
                /*
-                * these keys should not repeat, so it's the Right Thing
-                * dealing with repeaters only after this block.
-                */
-
-               /*
                 * return even if it wasn't a modifier key, the other
                 * codes up here are either special (like reset warning),
                 * or not yet defined
@@ -865,33 +839,16 @@
                return;
        }
 
-       /*
-        * no matter which character we're repeating, stop it if we
-        * get a key-up event. I think this is the same thing amigados does.
-        */
        if (up) {
-               if (tout_pending) {
-                       untimeout (repeat_handler, 0);
-                       tout_pending = 0;
-                       last_char = 0;
-               }
                splx (s);
                return;
-       } else if (tout_pending && last_char != c) {
-               /*
-                * not the same character remove the repeater and continue
-                * to process this key. -ch
-                */
-               untimeout (repeat_handler, 0);
-               tout_pending = 0;
-               last_char = 0;
        }
 
        /*
         * intercept LAlt-LMeta-F1 here to switch back to original ascii-keymap.
         * this should probably be configurable..
         */
-       if (mod == (KBD_MOD_LALT|KBD_MOD_LMETA) && c == 0x50) {
+       if (mod == (KBD_MOD_LALT|KBD_MOD_LMETA) && c == 0x63) {
                bcopy (&ascii_kbdmap, &kbdmap, sizeof (struct kbdmap));
                splx (s);
                return;
@@ -914,23 +871,6 @@
                        key = kbdmap.shift_keys[c];
        }
        code = key.code;
-
-       /*
-        * arrange to repeat the keystroke. By doing this at the level of scan-codes,
-        * we can have function keys, and keys that send strings, repeat too. This
-        * also entitles an additional overhead, since we have to do the conversion
-        * each time, but I guess that's ok.
-        */
-       if (!tout_pending && caller == ITEFILT_TTY && kbd_ite->key_repeat) {
-               tout_pending = 1;
-               last_char = c;
-               timeout (repeat_handler, 0, start_repeat_timeo);
-       } else if (!tout_pending && caller == ITEFILT_REPEATER &&
-                  kbd_ite->key_repeat) {
-               tout_pending = 1;
-               last_char = c;
-               timeout (repeat_handler, 0, next_repeat_timeo);
-       }
  
        /* handle dead keys */
        if (key.mode & KBD_MODE_DEAD) {
@@ -2530,7 +2470,7 @@
 
        do {
                c = kbdcngetc();
-               c = ite_cnfilter(c, ITEFILT_CONSOLE);
+               c = ite_cnfilter(c);
        } while (c == -1);
        return (c);
 }
diff -r c1d439ba1410 -r 6b7662ef3c1a sys/arch/x68k/dev/itevar.h
--- a/sys/arch/x68k/dev/itevar.h        Wed Mar 24 14:07:38 1999 +0000
+++ b/sys/arch/x68k/dev/itevar.h        Wed Mar 24 14:11:47 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: itevar.h,v 1.4 1998/09/03 14:22:06 minoura Exp $       */
+/*     $NetBSD: itevar.h,v 1.5 1999/03/24 14:11:47 minoura Exp $       */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -208,8 +208,6 @@
    driver doesn't support key-repeat for console-mode, since it can't use
    timeout() for polled I/O. */
    
-enum caller { ITEFILT_TTY, ITEFILT_CONSOLE, ITEFILT_REPEATER };
-
 enum tab_size { TABSIZE = 8 };
 #define TABEND(u) (ite_tty[u]->t_windsize.ws_col - TABSIZE) /* XXX */
 
@@ -249,12 +247,12 @@
 void   itestart __P((struct tty *));
 
 /* ite functions */
-int    ite_on __P((dev_t, int));
-int    ite_off __P((dev_t, int));
+int    iteon __P((dev_t, int));
+void   iteoff __P((dev_t, int));
 void   ite_reinit __P((dev_t));
 void   ite_reset __P((struct ite_softc *));
-int    ite_cnfilter __P((u_char, enum caller));
-void   ite_filter __P((u_char ,enum caller));
+int    ite_cnfilter __P((u_char));
+void   ite_filter __P((u_char));
 
 /* lower layer functions */
 void   tv_init __P((struct ite_softc *));
diff -r c1d439ba1410 -r 6b7662ef3c1a sys/arch/x68k/x68k/machdep.c
--- a/sys/arch/x68k/x68k/machdep.c      Wed Mar 24 14:07:38 1999 +0000
+++ b/sys/arch/x68k/x68k/machdep.c      Wed Mar 24 14:11:47 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.55 1999/03/24 05:51:18 mrg Exp $ */
+/*     $NetBSD: machdep.c,v 1.56 1999/03/24 14:11:47 minoura Exp $     */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -1083,7 +1083,7 @@
 void   atintr __P((void));
 void   ipintr __P((void));
 void   nsintr __P((void));
-void   clnintr __P((void));
+void   clnlintr __P((void));
 void   ccittintr __P((void));
 void   pppintr __P((void));
 
@@ -1136,78 +1136,6 @@
 #endif
 }
 
-/* this is a handy package to have asynchronously executed
-   function calls executed at very low interrupt priority.
-   Example for use is keyboard repeat, where the repeat 
-   handler running at splclock() triggers such a (hardware
-   aided) software interrupt.
-
-   Note: the installed functions are currently called in a
-         LIFO fashion, might want to change this to FIFO
-        later. */
-
-struct si_callback {
-       struct si_callback *next;
-       void (*function) __P((void *rock1, void *rock2));
-       void *rock1, *rock2;
-};
-
-static struct si_callback *si_callbacks = 0;
-
-void add_sicallback __P((void (*)(void *, void *), void *, void *));
-void rem_sicallback __P((void (*)(void *, void *)));
-
-void
-add_sicallback (function, rock1, rock2)
-       void (*function) __P((void *rock1, void *rock2));
-       void *rock1, *rock2;
-{
-       struct si_callback *si;
-       int s;
-
-       /* Note: this function may be called from high-priority
-        * interrupt handlers. We may NOT block for 
-        * memory-allocation in here!.
-        */
-       si = (struct si_callback *)malloc(sizeof(*si), M_TEMP, M_NOWAIT);
-
-       /* bad luck really.. */
-       if (! si)
-               return;
-       si->function = function;



Home | Main Index | Thread Index | Old Index