pcw8256: static tty buffers and basis for nice tty wakeups later
authorAlan Cox <alan@linux.intel.com>
Sat, 19 Jan 2019 21:38:29 +0000 (21:38 +0000)
committerAlan Cox <alan@linux.intel.com>
Sat, 19 Jan 2019 21:38:29 +0000 (21:38 +0000)
Kernel/platform-pcw8256/devtty.c

index f7dca18..caa0c53 100644 (file)
@@ -22,9 +22,11 @@ __sfr __at 0xE4      ctc0;
 __sfr __at 0xE5 ctc1;
 __sfr __at 0xE7 ctcmode;
 
-char tbuf1[TTYSIZ];
-char tbuf2[TTYSIZ];
-char tbuf3[TTYSIZ];
+static char tbuf1[TTYSIZ];
+static char tbuf2[TTYSIZ];
+static char tbuf3[TTYSIZ];
+
+static uint8_t sleeping;
 
 struct  s_queue  ttyinq[NUM_DEV_TTY+1] = {       /* ttyinq[0] is never used */
     {   NULL,    NULL,    NULL,    0,        0,       0    },
@@ -106,11 +108,19 @@ void tty_irq(void)
         c = dart0d;
         tty_inproc(2, c);
     }
+    if ((s & 4) && (sleeping & 4)) {
+       tty_outproc(2);
+       sleeping &= ~4;
+    }
     s = dartrr(3, 0);
     if (s & 1) {
         c = dart0d;
         tty_inproc(2, c);
     }
+    if ((s & 4) && (sleeping & 8)) {
+       tty_outproc(3);
+       sleeping &= ~8;
+    }
 }
 
 /* Called to set baud rate etc */
@@ -128,7 +138,7 @@ int tty_carrier(uint8_t minor)
 
 void tty_sleeping(uint8_t minor)
 {
-    minor;
+       sleeping |= (1 << minor);
 }
 
 void tty_data_consumed(uint8_t minor)