From: Alan Cox Date: Sat, 25 Aug 2018 20:57:07 +0000 (+0100) Subject: sbcv2: Add support for timer hack mode (DSR wired to a 10Hz clock) X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=d0eeca199c9af19358b92332aec977107f0129ca;p=FUZIX.git sbcv2: Add support for timer hack mode (DSR wired to a 10Hz clock) Specify timermsr on the command line for this and the kernel will instead of polling the timers look for DSR signal events on the UART, effectively using the UART as an interrupt controller. Still need to support routing ECB interrupts this way. --- diff --git a/Kernel/platform-sbcv2/discard.c b/Kernel/platform-sbcv2/discard.c index 784017aa..3703edc0 100644 --- a/Kernel/platform-sbcv2/discard.c +++ b/Kernel/platform-sbcv2/discard.c @@ -9,6 +9,15 @@ extern int strcmp(const char *, const char *); +/* Could move to discard */ +uint8_t platform_param(unsigned char *p) +{ + used(p); + if (strcmp(p, "msr") == 0) + timermsr = 1; + return 0; +} + void map_init(void) { } @@ -21,14 +30,6 @@ void pagemap_init(void) pagemap_add(i); } -uint8_t platform_param(char *p) -{ - if (strcmp(p, "compumuse") == 0) { - return 1; - } - return 0; -} - void platform_swap_found(uint8_t letter, uint8_t m) { blkdev_t *blk = blk_op.blkdev; diff --git a/Kernel/platform-sbcv2/main.c b/Kernel/platform-sbcv2/main.c index f01f9cc4..4de9430c 100644 --- a/Kernel/platform-sbcv2/main.c +++ b/Kernel/platform-sbcv2/main.c @@ -8,6 +8,7 @@ uint16_t ramtop = PROGTOP; uint16_t swap_dev = 0xFFFF; +uint8_t timermsr = 0; /* On idle we spin checking for the terminals. Gives us more responsiveness for the polled ports */ @@ -21,7 +22,6 @@ void platform_idle(void) void platform_interrupt(void) { - /* TODO */ tty_poll(); } @@ -73,23 +73,25 @@ void sync_clock_read(void) void sync_clock(void) { - irqflags_t irq = di(); - int16_t tmp; - if (!re_enter++) { - sync_clock_read(); - if (oldticks != 0xFF) { - tmp = newticks - oldticks; - if (tmp < 0) - tmp += 60; - tmp *= 10; - while(tmp--) { - timer_interrupt(); + if (!timermsr) { + irqflags_t irq = di(); + int16_t tmp; + if (!re_enter++) { + sync_clock_read(); + if (oldticks != 0xFF) { + tmp = newticks - oldticks; + if (tmp < 0) + tmp += 60; + tmp *= 10; + while(tmp--) { + timer_interrupt(); + } + platform_interrupt(); } - platform_interrupt(); - } - re_enter--; - } - irqrestore(irq); + re_enter--; + } + irqrestore(irq); + } } void update_sync_clock(void)