From: Alan Cox Date: Sat, 9 Jan 2016 20:41:24 +0000 (+0000) Subject: z80pack: bring the tty layer into compliance with current code X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=4ca4a733239319da5bcf0d5b2ee34c99adbc5f14;p=FUZIX.git z80pack: bring the tty layer into compliance with current code --- diff --git a/Kernel/dev/z80pack/devtty.c b/Kernel/dev/z80pack/devtty.c index f0842898..10b71693 100644 --- a/Kernel/dev/z80pack/devtty.c +++ b/Kernel/dev/z80pack/devtty.c @@ -23,6 +23,8 @@ struct s_queue ttyinq[NUM_DEV_TTY+1] = { /* ttyinq[0] is never used */ { tbuf3, tbuf3, tbuf3, TTYSIZ, 0, TTYSIZ/2 } }; +static uint8_t ttypoll; + /* Write to system console */ void kputchar(char c) { @@ -37,12 +39,12 @@ char tty_writeready(uint8_t minor) uint8_t s; if (minor == 1) - return 1; + return TTY_READY_NOW; if (minor == 2) s = tty2stat; else s = tty3stat; - return s & 2; + return s & 2 ? TTY_READY_NOW: TTY_READY_LATER; } void tty_putc(uint8_t minor, unsigned char c) @@ -57,7 +59,7 @@ void tty_putc(uint8_t minor, unsigned char c) void tty_sleeping(uint8_t minor) { - used(minor); + ttypoll |= 1 << minor; } /* Called every timer tick */ @@ -76,10 +78,14 @@ void tty_pollirq(void) c = tty3data; tty_inproc(3, c); } - if (tty2stat & 2) + if ((ttypoll & 2) && (tty2stat & 2)) { + ttypoll &= ~2; wakeup(&ttydata[2]); - if (tty3stat & 2) + } + if ((ttypoll & 4) && (tty3stat & 2)) { + ttypoll &= ~4; wakeup(&ttydata[3]); + } } void tty_setup(uint8_t minor)