From 20c6a7abafbb2c7571929f0c05c04acee1558098 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 22 Dec 2014 12:42:14 +0000 Subject: [PATCH] ubee: 64 ticks/second and turn on the RTC We'll need the RTC in fact as 64 doesn't divide by 10 --- Kernel/platform-ubee/config.h | 4 +++- Kernel/platform-ubee/devices.c | 2 ++ Kernel/platform-ubee/main.c | 9 +++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Kernel/platform-ubee/config.h b/Kernel/platform-ubee/config.h index 63d39624..8263e2e5 100644 --- a/Kernel/platform-ubee/config.h +++ b/Kernel/platform-ubee/config.h @@ -1,3 +1,5 @@ +/* We have an RTC */ +#define CONFIG_RTC /* Enable to make ^Z dump the inode table for debug */ #undef CONFIG_IDUMP /* Enable to make ^A drop back into the monitor */ @@ -26,7 +28,7 @@ #define VT_RIGHT 79 #define VT_BOTTOM 23 -#define TICKSPERSEC 60 /* Ticks per second */ +#define TICKSPERSEC 64 /* Ticks per second */ #define PROGBASE 0x0000 /* Base of user */ #define PROGLOAD 0x0100 /* Load and run here */ #define PROGTOP 0x7D00 /* Top of program, base of U_DATA stash */ diff --git a/Kernel/platform-ubee/devices.c b/Kernel/platform-ubee/devices.c index fdb13ac7..7d4f7ca8 100644 --- a/Kernel/platform-ubee/devices.c +++ b/Kernel/platform-ubee/devices.c @@ -36,6 +36,8 @@ bool validdev(uint16_t dev) void device_init(void) { int i; + /* Time of day clock */ + inittod(); /* Add 64 swaps (2MB) */ for (i = MAX_SWAPS - 1 ; i >= 0; i--) swapmap_add(i); diff --git a/Kernel/platform-ubee/main.c b/Kernel/platform-ubee/main.c index 08dae68d..8248ba3d 100644 --- a/Kernel/platform-ubee/main.c +++ b/Kernel/platform-ubee/main.c @@ -57,3 +57,12 @@ void pagemap_init(void) #endif /* and if we ever poke at the 1024 stuff its bit 7-5/1-0 */ } + +__sfr __at 0x04 rtc_c; +__sfr __at 0x06 rtc_d; + +uint8_t rtc_secs(void) +{ + rtc_c = 0x00; + return rtc_d; +} -- 2.34.1