aboutsummaryrefslogtreecommitdiff
path: root/src/sys/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys/timer.c')
-rw-r--r--src/sys/timer.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/sys/timer.c b/src/sys/timer.c
index b82ac2c..aa50bd3 100644
--- a/src/sys/timer.c
+++ b/src/sys/timer.c
@@ -13,7 +13,7 @@ struct Mutex exe_cnt_m = {.addr = &exe_cnt, .pid = NULL_PID};
void c_timer() {
// Reset the counter
- write_cntv_tval(cntfrq);
+ write_cntv_tval(cntfrq/100);
unsigned int x = g_Drawer.x;
unsigned int y = g_Drawer.y;
@@ -31,15 +31,28 @@ void c_timer() {
release_mutex(&exe_cnt_m, SCHED_PID);
}
- g_Drawer.x = 0;
- g_Drawer.y = 10;
+ g_Drawer.x = 29;
+ g_Drawer.y = 5;
// Output the value
- write_string(&g_Drawer, "Timer Value: ");
unsigned long v = read_cntv_tval();
write_10(&g_Drawer, v);
write_string(&g_Drawer, " | ");
write_hex32(&g_Drawer, v);
+ g_Drawer.x = 0;
+ g_Drawer.y = 9;
+ for(int i = 0; i < 128; i++)
+ write_char(&g_Drawer, ' ');
+ g_Drawer.x = 0;
+ g_Drawer.y = 9;
+ write_string(&g_Drawer, "Timer Counter: ");
+ if (exe_cnt_m.pid == 0) {
+ write_cstring(&g_Drawer, "Free!", 0xFF00FF);
+ } else {
+ write_cstring(&g_Drawer, "Locked by ", 0xFF00FF);
+ write_c10(&g_Drawer, exe_cnt_m.pid, 0xFF00FF);
+ }
+
g_Drawer.x = x;
g_Drawer.y = y;
}