From 2198825989ac3eaf22d4ad4bbbbb75fa7e6edf32 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 1 Mar 2019 22:19:52 +0000 Subject: [PATCH] v85: add 6850 ACIA speed/setting controls They don't do anything but they are better example for real devices --- Kernel/platform-v85/devtty.c | 44 ++++++++++++++++++++++++++++++------ Kernel/platform-v85/devtty.h | 3 +-- Kernel/platform-v85/v85.s | 10 ++++++++ 3 files changed, 48 insertions(+), 9 deletions(-) diff --git a/Kernel/platform-v85/devtty.c b/Kernel/platform-v85/devtty.c index 3863368b..7af0885c 100644 --- a/Kernel/platform-v85/devtty.c +++ b/Kernel/platform-v85/devtty.c @@ -15,7 +15,7 @@ struct s_queue ttyinq[NUM_DEV_TTY+1] = { /* ttyinq[0] is never used */ static tcflag_t console_mask[4] = { _ISYS, _OSYS, - _CSYS, + CSIZE|CSTOPB|PARENB|PARODD|_CSYS, _LSYS }; @@ -27,7 +27,42 @@ tcflag_t *termios_mask[NUM_DEV_TTY + 1] = { void tty_setup(uint8_t minor, uint8_t flags) { - minor; + struct termios *t = &ttydata[1].termios; + uint8_t r = t->c_cflag & CSIZE; + /* No CS5/CS6 CS7 must have parity enabled */ + if (r <= CS7) { + t->c_cflag &= ~CSIZE; + t->c_cflag |= CS7|PARENB; + } + /* No CS8 parity and 2 stop bits */ + if (r == CS8 && (t->c_cflag & PARENB)) + t->c_cflag &= ~CSTOPB; + /* There is no obvious logic to this */ + switch(t->c_cflag & (CSIZE|PARENB|PARODD|CSTOPB)) { + case CS7|PARENB: + r = 0xEB; + break; + case CS7|PARENB|PARODD: + r = 0xEF; + break; + case CS7|PARENB|CSTOPB: + r = 0xE3; + case CS7|PARENB|PARODD|CSTOPB: + r = 0xE7; + case CS8|CSTOPB: + r = 0xF3; + break; + case CS8: + r = 0xF7; + break; + case CS8|PARENB: + r = 0xFB; + break; + case CS8|PARENB|PARODD: + r = 0xFF; + break; + } + acia_setup(r); } /* For the moment */ @@ -58,16 +93,11 @@ void tty_data_consumed(uint8_t minor) ttyready_t tty_writeready(uint8_t minor) { uint8_t r; -#if 0 if (minor == 1) r = ttyready(); - else - r = ttyready2(); if (r) return TTY_READY_NOW; return TTY_READY_SOON; -#endif - return TTY_READY_NOW; } void tty_poll(void) diff --git a/Kernel/platform-v85/devtty.h b/Kernel/platform-v85/devtty.h index 44a10067..0716f1d1 100644 --- a/Kernel/platform-v85/devtty.h +++ b/Kernel/platform-v85/devtty.h @@ -2,5 +2,4 @@ extern void tty_poll(void); extern void ttyout(uint8_t c); extern uint16_t acia_poll(void); - - +extern void acia_setup(uint8_t r); diff --git a/Kernel/platform-v85/v85.s b/Kernel/platform-v85/v85.s index 9cb5edee..f5cc60b9 100644 --- a/Kernel/platform-v85/v85.s +++ b/Kernel/platform-v85/v85.s @@ -275,6 +275,16 @@ _ttyready: mov e,a ret + +.define _acia_setup + +_acia_setup: + ldsi 2 + lhlx + mov a,l + out 0 + ret + .define _acia_poll ! -- 2.34.1