From: Alan Cox Date: Sat, 19 Jan 2019 21:37:59 +0000 (+0000) Subject: mtx: static tty buffers and set basis for nice wakeups and flow control X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=a5676b4cc59cd89ec3f375eff6fafee0df92f713;p=FUZIX.git mtx: static tty buffers and set basis for nice wakeups and flow control --- diff --git a/Kernel/platform-mtx/devtty.c b/Kernel/platform-mtx/devtty.c index 109dcd47..7aee4fc5 100644 --- a/Kernel/platform-mtx/devtty.c +++ b/Kernel/platform-mtx/devtty.c @@ -29,10 +29,12 @@ uint8_t vtattr_cap; struct vt_repeat keyrepeat; static uint8_t kbd_timer; -char tbuf1[TTYSIZ]; -char tbuf2[TTYSIZ]; -char tbuf3[TTYSIZ]; -char tbuf4[TTYSIZ]; +static char tbuf1[TTYSIZ]; +static char tbuf2[TTYSIZ]; +static char tbuf3[TTYSIZ]; +static char tbuf4[TTYSIZ]; + +static uint8_t sleeping; struct s_queue ttyinq[NUM_DEV_TTY + 1] = { /* ttyinq[0] is never used */ {NULL, NULL, NULL, 0, 0, 0}, @@ -125,7 +127,7 @@ int tty_carrier(uint8_t minor) void tty_sleeping(uint8_t minor) { - used(minor); + sleeping |= (1 << minor); } void tty_data_consumed(uint8_t minor) @@ -351,6 +353,10 @@ void tty_interrupt(void) tty_inproc(3, r); r = serialAc; } + if ((sleeping & 8) && (r & 0x04)) { + sleeping &= ~8; + tty_outproc(3); + } if (!(r & 0x08)) tty_carrier_drop(3); r = serialBc; @@ -359,6 +365,10 @@ void tty_interrupt(void) tty_inproc(4, r); r = serialBc; } + if ((sleeping & 16) && (r & 0x04)) { + sleeping &= ~16; + tty_outproc(4); + } serialAc = 0x07 << 3; /* Return from interrupt */ if (!(r & 0x08)) tty_carrier_drop(4);