From a4a15ad39d8231c11f74f4e5c4b74b9e5547f22e Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Sun, 2 Jan 2022 17:35:52 -0800 Subject: Don't lock mutex if only written by one interrupt --- src/sys/core.c | 2 ++ src/sys/timer.c | 9 ++++++++- src/util/status.c | 5 +++-- 3 files changed, 13 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/sys/core.c b/src/sys/core.c index 636dd64..fbe0536 100644 --- a/src/sys/core.c +++ b/src/sys/core.c @@ -49,4 +49,6 @@ void sysinit(void) // Enable IRQ & FIQ enableirq(); enablefiq(); + + // Start Scheduler } diff --git a/src/sys/timer.c b/src/sys/timer.c index 9419f80..d9c2f6b 100644 --- a/src/sys/timer.c +++ b/src/sys/timer.c @@ -24,11 +24,18 @@ void increase_counter(void) } } +inline void hard_increase_counter(void) +{ + unsigned long* counter = (unsigned long*)exe_cnt_m.addr; + *counter += 1; +} + void c_timer(void) { // Reset the counter write_cntv_tval(cntfrq/CPS); - increase_counter(); + hard_increase_counter(); + //increase_counter(); status(); } diff --git a/src/util/status.c b/src/util/status.c index 95ea0ff..c4a7c80 100644 --- a/src/util/status.c +++ b/src/util/status.c @@ -63,10 +63,11 @@ void status(void) write_cstring(&g_Drawer, " v", 0x00FFFF); write_cstring(&g_Drawer, os_info_v, 0x00FFFF); write_string(&g_Drawer, " #"); - if (lock_mutex(&exe_cnt_m, SYS_PID) == 0) { + write_10(&g_Drawer, *((unsigned long*)exe_cnt_m.addr)); + /* if (lock_mutex(&exe_cnt_m, SYS_PID) == 0) { write_10(&g_Drawer, *((unsigned long*)exe_cnt_m.addr)); release_mutex(&exe_cnt_m, SYS_PID); - } + } */ // Commands write_string(&g_Drawer, "\nMonitor: Ctrl-A m Exit: Ctrl-A x Timer: Ctrl-T"); -- cgit v1.2.1