From 709148a4252c6d608808d9ed1380b02e94173d1b Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Sat, 4 Dec 2021 17:28:16 -0700 Subject: Moved timer to separate file --- src/sys/core.c | 15 ++------------- src/sys/core.h | 1 - src/sys/timer.c | 17 +++++++++++++++++ src/sys/timer.h | 6 ++++++ 4 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 src/sys/timer.c create mode 100644 src/sys/timer.h (limited to 'src/sys') diff --git a/src/sys/core.c b/src/sys/core.c index 0420df0..dd7a5e7 100644 --- a/src/sys/core.c +++ b/src/sys/core.c @@ -2,10 +2,11 @@ #include "../drivers/uart.h" #include "../util/time.h" #include "../sys/core.h" +#include "../sys/timer.h" #include "../sys/power.h" static char* os_info_h = "\033[93mInitialized the Real Time Operating System\033[0m\n\033[96mName\033[0m: \033[94mDendritOS\033[0m\n\033[96mVersion\033[0m: \033[95m"; -static char* os_info_t = "\033[0m\n\nQEMU\n====\n Exit : Ctrl-A x\n Monitor : Ctrl-A c\n\n"; +static char* os_info_t = "\033[0m\n\nQEMU\n====\n Monitor : Ctrl-A c\n Timer : Ctrl-t\n Exit : Ctrl-A x\n\n"; #ifndef VERSION static char* os_info_v = "?"; #else @@ -42,18 +43,6 @@ void sysinit() { enable_cntv(); } -void c_timer() { - // Reset the counter - write_cntv_tval(cntfrq); - - // Output the value - uart_string((char*)"Timer Value: "); - unsigned long v = read_cntv_tval(); - uart_10(v); - uart_char(0x20); - uart_hexn(v); -} - // Checks IRQ status void chk_irq_stat() { uart_string((char*)"Checking Enabled Services...\n"); diff --git a/src/sys/core.h b/src/sys/core.h index d2b4c1b..517b090 100644 --- a/src/sys/core.h +++ b/src/sys/core.h @@ -114,7 +114,6 @@ enum }; void sysinit(); -void c_timer(); void chk_irq_stat(); void postinit(); diff --git a/src/sys/timer.c b/src/sys/timer.c new file mode 100644 index 0000000..6996983 --- /dev/null +++ b/src/sys/timer.c @@ -0,0 +1,17 @@ +#include "../sys/core.h" +#include "../sys/timer.h" +#include "../util/time.h" +#include "../drivers/uart.a.h" +#include "../drivers/uart.h" + +void c_timer() { + // Reset the counter + write_cntv_tval(cntfrq); + + // Output the value + uart_string((char*)"Timer Value: "); + unsigned long v = read_cntv_tval(); + uart_10(v); + uart_char(0x20); + uart_hexn(v); +} diff --git a/src/sys/timer.h b/src/sys/timer.h new file mode 100644 index 0000000..641a581 --- /dev/null +++ b/src/sys/timer.h @@ -0,0 +1,6 @@ +#ifndef SYS_TIMER_H +#define SYS_TIMER_H + +void c_timer(); + +#endif -- cgit v1.2.1