From: Alan Cox Date: Mon, 15 Jun 2015 22:13:32 +0000 (+0100) Subject: micropack: experimenting with some smallness ideas X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=2b360cf8573e36eb1256392876d59e067c0dddc0;p=FUZIX.git micropack: experimenting with some smallness ideas --- diff --git a/Kernel/platform-micropack/Makefile b/Kernel/platform-micropack/Makefile index e6d3d877..e4100b58 100644 --- a/Kernel/platform-micropack/Makefile +++ b/Kernel/platform-micropack/Makefile @@ -1,6 +1,6 @@ -DSRCS = ../dev/z80pack/devlpr.c ../dev/z80pack/devtty.c ../dev/z80pack/devfd.c -CSRCS = devices.c main.c +DSRCS = ../dev/z80pack/devlpr.c ../dev/z80pack/devfd.c +CSRCS = devices.c main.c devtty.c ASRCS = crt0.s z80pack.s ASRCS += tricks.s commonmem.s diff --git a/Kernel/platform-micropack/config.h b/Kernel/platform-micropack/config.h index 41584d88..9141e6d1 100644 --- a/Kernel/platform-micropack/config.h +++ b/Kernel/platform-micropack/config.h @@ -41,9 +41,9 @@ #define CMDLINE NULL /* Location of root dev name */ /* Device parameters */ -#define NUM_DEV_TTY 3 +#define NUM_DEV_TTY 1 #define TTYDEV BOOT_TTY /* Device used by kernel for messages, panics */ #define SWAPDEV (256 + 1) /* Device for swapping. (z80pack drive J) */ -#define NBUFS 6 /* Number of block buffers */ +#define NBUFS 5 /* Number of block buffers */ #define NMOUNTS 2 /* Number of mounts at a time */ diff --git a/Kernel/platform-micropack/devtty.c b/Kernel/platform-micropack/devtty.c new file mode 100644 index 00000000..cf62e54c --- /dev/null +++ b/Kernel/platform-micropack/devtty.c @@ -0,0 +1,64 @@ +#include +#include +#include +#include +#include +#include + +__sfr __at 0 tty1stat; +__sfr __at 1 tty1data; + +char tbuf1[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 }, +}; + +/* Write to system console */ +void kputchar(char c) +{ + /* handle CRLF */ + if(c=='\n') + tty_putc(1, '\r'); + tty_putc(1, c); +} + +char tty_writeready(uint8_t minor) +{ + used(minor); + return 1; +} + +void tty_putc(uint8_t minor, unsigned char c) +{ + used(minor); + tty1data = c; +} + +void tty_sleeping(uint8_t minor) +{ + used(minor); +} + +/* Called every timer tick */ +void tty_pollirq(void) +{ + unsigned char c; /* sdcc bug workaround */ + while(tty1stat) { + c = tty1data; + tty_inproc(1, c); + } +} + +void tty_setup(uint8_t minor) +{ + used(minor); +} + +/* For the moment */ +int tty_carrier(uint8_t minor) +{ + used(minor); + return 1; +}