/* We have an RTC */
#define CONFIG_RTC
+#define CONFIG_RTC_FULL
/* Enable to make ^Z dump the inode table for debug */
#undef CONFIG_IDUMP
/* Enable to make ^A drop back into the monitor */
/* Device parameters */
#define NUM_DEV_TTY 2
#define TTYDEV BOOT_TTY /* Device used by kernel for messages, panics */
-#define NBUFS 10 /* Number of block buffers */
+#define NBUFS 9 /* Number of block buffers */
#ifdef CONFIG_NC200
#define NMOUNTS 2 /* Floppy can also be mounted */
#define BOOTDEVICENAMES "hd#,fd#"
--- /dev/null
+/*
+ * This is intended for the NC200. It assumes 24 hour clock mode and
+ * decimal. The year is 1990 based. This is all fine for the NC200
+ * as that is how the firmware/OS leave it.
+ */
+
+#include <kernel.h>
+#include <kdata.h>
+#include <stdbool.h>
+#include <printf.h>
+#include <rtc.h>
+
+__sfr __at 0xD0 rtc_second;
+__sfr __at 0xD2 rtc_minute;
+__sfr __at 0xD4 rtc_hour;
+__sfr __at 0xD7 rtc_day;
+__sfr __at 0xD8 rtc_month;
+__sfr __at 0xD9 rtc_year;
+__sfr __at 0xDA rtc_rega;
+
+uint8_t platform_rtc_secs(void) __naked
+{
+ static uint8_t last;
+ if (rtc_rega & 0x80)
+ return last;
+ return rtc_second;
+}
+
+/* Full RTC support (for read - no write yet) */
+int platform_rtc_read(void)
+{
+ uint16_t len = sizeof(struct cmos_rtc);
+ uint16_t y;
+ irqflags_t flags;
+ struct cmos_rtc cmos;
+ uint8_t *p = cmos.data.bytes;
+
+ if (udata.u_count < len)
+ len = udata.u_count;
+
+sync:
+ while(rtc_rega & 0x80); /* Wait for UIP to clear */
+
+ flags = di();
+ if (rtc_rega & 0x80)
+ goto sync;
+
+ /* We are now safe for 244uS */
+ y = rtc_year + 1990;
+ *p++ = y;
+ *p++ = y >> 8;
+ *p++ = rtc_month;
+ *p++ = rtc_day;
+ *p++ = rtc_hour;
+ *p++ = rtc_minute;
+ *p++ = rtc_second;
+ irqrestore(flags);
+
+ cmos.type = CMOS_RTC_DEC;
+ if (uput(&cmos, udata.u_base, len) == -1)
+ return -1;
+ return len;
+}
+
+int platform_rtc_write(void)
+{
+ udata.u_error = -EOPNOTSUPP;
+ return -1;
+}
{
}
-__sfr __at 0xD0 rtc_secl;
-__sfr __at 0xD1 rtc_sech;
-__sfr __at 0xDD rtc_page;
-
-uint8_t platform_rtc_secs(void)
-{
- uint8_t sl, rv;
- /* Make sure we are seeing the seconds not NVRAM */
- rtc_page = 0;
- /* BCD encoded */
- do {
- sl = rtc_secl;
- rv = sl + rtc_sech * 10;
- } while (sl != rtc_secl);
- return rv;
-}
CSRCS = ../devlpr.c ../devtty.c ../devrd.c ../devaudio.c ../devgfx.c
-CSRCS += ../devices.c ../main.c
+CSRCS += ../devices.c ../main.c ../tc8521.c
ASRCS = ../nc100.s ../crt0.s
ASRCS += ../tricks.s ../commonmem.s