From 798e73e7142f02a2cf7261a37095a84db47d877b Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Tue, 22 Mar 2022 16:37:56 -0700 Subject: More debug information --- src/cpu/irq.c | 38 ++++++++++++++++++++------------------ src/util/mutex.c | 7 +++++++ 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/cpu/irq.c b/src/cpu/irq.c index d4c157f..e3353e8 100644 --- a/src/cpu/irq.c +++ b/src/cpu/irq.c @@ -26,29 +26,27 @@ unsigned long c_irq_handler(void) if(load32(UART0_MIS) & (1<<4)) { // Get the UART data unsigned long data = load32(UART0_DR); - // Draw it on the screen - { - draw_chex32(0, 9, data, 0xAA00FF); - } // Handle the recieved data // Ctrl+G to output scheduler debug info - if (data == 0x7) + if (data == 0x7) { uart_scheduler(); - // Ctrl+T to toggle timer - else if(data == 0x14) { - unsigned long timer_status; - asm volatile("mrc p15, 0, %0, c14, c3, 1" : "=r"(timer_status)); - if(timer_status == 0) { - cntfrq = read_cntfrq(); - write_cntv_tval(cntfrq/CPS); - enablecntv(); - draw_cstring(0, 3, "TIMER", 0x00FF00); - } else { - disablecntv(); - draw_cstring(0, 3, "TIMER", 0xFF0000); - } + uart_mutexes(); } + //// Ctrl+T to toggle timer + //else if(data == 0x14) { + // unsigned long timer_status; + // asm volatile("mrc p15, 0, %0, c14, c3, 1" : "=r"(timer_status)); + // if(timer_status == 0) { + // cntfrq = read_cntfrq(); + // write_cntv_tval(cntfrq/CPS); + // enablecntv(); + // draw_cstring(0, 3, "TIMER", 0x00FF00); + // } else { + // disablecntv(); + // draw_cstring(0, 3, "TIMER", 0xFF0000); + // } + //} // Add task to handle the data else { add_thread(handle_data, (void*)data, 7); @@ -111,4 +109,8 @@ void handle_data(unsigned char data) } else if (data == 0x62) { //add_thread(test_entry, 0, 2); } + // Draw it on the screen + { + draw_chex32(0, 9, data, 0xAA00FF); + } } diff --git a/src/util/mutex.c b/src/util/mutex.c index a60cea6..8e85f8f 100644 --- a/src/util/mutex.c +++ b/src/util/mutex.c @@ -67,6 +67,13 @@ void uart_mutexes(void) uart_hexn((unsigned long)m->addr); entry = entry->next; } + unsigned long count = 0; + entry = mutex_manager.free.start.next; + while (entry->entry_type == VALUE_ENTRY) { + count++; + entry = entry->next; + } + uart_hexn(count); } void lock_mutex(struct Mutex* m) -- cgit v1.2.1