From: Alan Cox Date: Fri, 3 Nov 2017 23:32:48 +0000 (+0000) Subject: z80pack: add the outgoing port as another tty X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=f3df37409c3311c2f940f9ac293c8825f60b9ac2;p=FUZIX.git z80pack: add the outgoing port as another tty --- diff --git a/Kernel/dev/z80pack/devtty.c b/Kernel/dev/z80pack/devtty.c index eac9dbca..ec66a44c 100644 --- a/Kernel/dev/z80pack/devtty.c +++ b/Kernel/dev/z80pack/devtty.c @@ -11,16 +11,20 @@ __sfr __at 40 tty2stat; __sfr __at 41 tty2data; __sfr __at 42 tty3stat; __sfr __at 43 tty3data; +__sfr __at 50 tty4stat; +__sfr __at 51 tty4data; char tbuf1[TTYSIZ]; char tbuf2[TTYSIZ]; char tbuf3[TTYSIZ]; +char tbuf4[TTYSIZ]; struct s_queue ttyinq[NUM_DEV_TTY+1] = { /* ttyinq[0] is never used */ { NULL, NULL, NULL, 0, 0, 0 }, { tbuf1, tbuf1, tbuf1, TTYSIZ, 0, TTYSIZ/2 }, { tbuf2, tbuf2, tbuf2, TTYSIZ, 0, TTYSIZ/2 }, - { tbuf3, tbuf3, tbuf3, TTYSIZ, 0, TTYSIZ/2 } + { tbuf3, tbuf3, tbuf3, TTYSIZ, 0, TTYSIZ/2 }, + { tbuf4, tbuf4, tbuf4, TTYSIZ, 0, TTYSIZ/2 } }; static uint8_t ttypoll; @@ -53,8 +57,10 @@ void tty_putc(uint8_t minor, unsigned char c) tty1data = c; else if (minor == 2) tty2data = c; - else + else if (minor == 3) tty3data = c; + else + tty4data = c; } void tty_sleeping(uint8_t minor) @@ -78,6 +84,10 @@ void tty_pollirq(void) c = tty3data; tty_inproc(3, c); } + while(tty4stat & 1) { + c = tty4data; + tty_inproc(3, c); + } if ((ttypoll & 4) && (tty2stat & 2)) { ttypoll &= ~4; wakeup(&ttydata[2]); @@ -86,6 +96,10 @@ void tty_pollirq(void) ttypoll &= ~8; wakeup(&ttydata[3]); } + if ((ttypoll & 8) && (tty4stat & 2)) { + ttypoll &= ~8; + wakeup(&ttydata[4]); + } } void tty_setup(uint8_t minor)