From 22b2957d4610f201bd2d365d42de285478093c01 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Sun, 13 Feb 2022 14:11:24 -0700 Subject: Recreated status board --- Common.mk | 4 ++-- src/cpu/irq.c | 13 ++++++----- src/sys/core.c | 2 -- src/util/status.c | 65 +++++++++++++++++++++++++++---------------------------- 4 files changed, 41 insertions(+), 43 deletions(-) diff --git a/Common.mk b/Common.mk index 09f4445..4c2b878 100644 --- a/Common.mk +++ b/Common.mk @@ -19,7 +19,7 @@ QFLAGS = -M raspi2 -cpu arm1176 -m 1G QFLAGS += -chardev stdio,id=char0,mux=on,logfile=serial.log,signal=off -serial chardev:char0 -mon chardev=char0 #QFLAGS += -serial pipe:/tmp/guest QFLAGS += -device usb-kbd -#QFLAGS += -trace events=events +#QFLAGS += -trace events=events #QFLAGS += -nographic BSP ?= 2 @@ -29,7 +29,7 @@ ifeq ($(BSP),2) CFLAGS += -DBSP23 endif -CFLAGS += -DVERSION="\"0.1a\"" +CFLAGS += -DVERSION="\"0.1b\"" .PHONY: clean run run-debug debug export tree diff --git a/src/cpu/irq.c b/src/cpu/irq.c index 0488231..442c834 100644 --- a/src/cpu/irq.c +++ b/src/cpu/irq.c @@ -23,8 +23,8 @@ void c_irq_handler(void) unsigned int x = g_Drawer.x; unsigned int y = g_Drawer.y; g_Drawer.x = 0; - g_Drawer.y = 14; - write_hex32(&g_Drawer, data); + g_Drawer.y = 9; + write_chex32(&g_Drawer, data, 0xAA00FF); g_Drawer.x = x; g_Drawer.y = y; } @@ -36,16 +36,17 @@ void c_irq_handler(void) unsigned int x = g_Drawer.x; unsigned int y = g_Drawer.y; g_Drawer.x = 0; - g_Drawer.y = 5; - write_string(&g_Drawer, "TIMER: "); + g_Drawer.y = 3; if(timer_status == 0) { cntfrq = read_cntfrq(); write_cntv_tval(cntfrq/CPS); enablecntv(); - write_cstring(&g_Drawer, "Enabled ", 0x00FF00); + write_cstring(&g_Drawer, "TIMER", 0x00FF00); + write_string(&g_Drawer, ": "); } else { disablecntv(); - write_cstring(&g_Drawer, "Disabled", 0xFF0000); + write_cstring(&g_Drawer, "TIMER", 0xFF0000); + write_string(&g_Drawer, ": "); } g_Drawer.x = x; g_Drawer.y = y; diff --git a/src/sys/core.c b/src/sys/core.c index 9803488..1ee898c 100644 --- a/src/sys/core.c +++ b/src/sys/core.c @@ -32,8 +32,6 @@ void sysinit(void) // Enable UART GPU IRQ store32(1<<25, IRQ_ENABLE2); // Enable Timer - // As an IRQ - store32(1<<0, IRQ_BASIC_ENABLE); // Get the frequency cntfrq = read_cntfrq(); // Clear cntv interrupt and set next 1 second timer diff --git a/src/util/status.c b/src/util/status.c index 0e93102..614581e 100644 --- a/src/util/status.c +++ b/src/util/status.c @@ -23,34 +23,38 @@ void output_irq_status(void) // Check GPU Interrupt Routing unsigned long g_val = load32(GPU_INTERRUPTS_ROUTING); - write_string(&g_Drawer, "GPU IRQ: Core "); - write_10(&g_Drawer, g_val & 0b11); - write_string(&g_Drawer, " | GPU FIQ: Core "); - write_10(&g_Drawer, (g_val >> 2) & 0b11); + write_c10(&g_Drawer, g_val & 0b11, 0x1EA1A1); + write_c10(&g_Drawer, (g_val >> 2) & 0b11, 0x1EA1A1); - write_string(&g_Drawer, "\n"); - write_hex32(&g_Drawer, ib_val); - write_string(&g_Drawer, " "); - write_hex32(&g_Drawer, i1_val); - write_string(&g_Drawer, " "); - write_hex32(&g_Drawer, i2_val); write_string(&g_Drawer, " "); - write_hex32(&g_Drawer, f_val); + write_chex32(&g_Drawer, ib_val, 0x1EA1A1); + write_chex32(&g_Drawer, i1_val, 0x1EA1A1); + write_chex32(&g_Drawer, i2_val, 0x1EA1A1); + write_chex32(&g_Drawer, f_val, 0x1EA1A1); + write_char(&g_Drawer, '\n'); // Check UART IRQ - write_string(&g_Drawer, "\nUART: "); if (i2_val & (1<<25)) { - write_cstring(&g_Drawer, "Enabled", 0x00FF00); + write_cstring(&g_Drawer, "UART ", 0x00FF00); + } else if (f_val == 57) { + write_cstring(&g_Drawer, "UART ", 0xFFA500); + } else { + write_cstring(&g_Drawer, "UART ", 0xFF0000); + } + + // Check UART IRQ + if (i1_val & (1<<0)) { + write_cstring(&g_Drawer, "STIMERCMP ", 0x00FF00); } else { - write_cstring(&g_Drawer, "Disabled", 0xFF0000); + write_cstring(&g_Drawer, "STIMERCMP ", 0xFF0000); } - // Check TIMER IRQ - write_string(&g_Drawer, " TIMER: "); - if (ib_val & (1<<0)) { - write_cstring(&g_Drawer, "Enabled", 0x00FF00); + if (load32(CORE0_TIMER_IRQCNTL) & 0xF) { + write_cstring(&g_Drawer, "LTIMER ", 0x00FF00); + } else if (load32(CORE0_TIMER_IRQCNTL) & 0xF0) { + write_cstring(&g_Drawer, "LTIMER ", 0xFFA500); } else { - write_cstring(&g_Drawer, "Disabled", 0xFF0000); + write_cstring(&g_Drawer, "LTIMER ", 0xFF0000); } } @@ -64,17 +68,16 @@ void status(void) write_cstring(&g_Drawer, os_name, 0xFF0000); write_cstring(&g_Drawer, " v", 0x00FFFF); write_cstring(&g_Drawer, os_info_v, 0x00FFFF); - - // Commands - write_string(&g_Drawer, "\nMonitor: Ctrl-A m Exit: Ctrl-A x Timer: Ctrl-T"); + write_cstring(&g_Drawer, " # TStacks: ", 0xFFDF00); + draw_string(g_Drawer.x, g_Drawer.y, " "); + write_c10(&g_Drawer, sched_stack_count, 0xFFDF00); // GPU IRQ Statuses write_string(&g_Drawer, "\n"); output_irq_status(); // Timer Status - write_string(&g_Drawer, "\nTIMER: "); - write_cstring(&g_Drawer, "Enabled ", 0x00FF00); + write_cstring(&g_Drawer, "\nTIMER", 0x00FF00); // Output the frequency write_string(&g_Drawer, " @ "); unsigned long frq = read_cntfrq()/1000; @@ -87,8 +90,7 @@ void status(void) write_hex32(&g_Drawer, v); // Video Status - write_string(&g_Drawer, "\nVIDEO: "); - write_cstring(&g_Drawer, "Enabled ", 0x00FF00); + write_cstring(&g_Drawer, "\nVIDEO ", 0x00FF00); write_10(&g_Drawer, gwidth); write_string(&g_Drawer, "x"); write_10(&g_Drawer, gheight); @@ -99,12 +101,12 @@ void status(void) } g_Drawer.x = 0; - g_Drawer.y = 9; + g_Drawer.y = 5; write_string(&g_Drawer, "SVC IRQ FIQ User/SYS\n"); for(int i = 0; i < 128; i++) write_char(&g_Drawer, ' '); g_Drawer.x = 0; - g_Drawer.y = 10; + g_Drawer.y = 6; unsigned long sp = (unsigned long)getsvcstack(); write_hex32(&g_Drawer, sp); @@ -134,13 +136,10 @@ void status(void) write_string(&g_Drawer, ":"); coren = *(volatile unsigned long*)SYS_TIMER_C0; write_10(&g_Drawer, coren); - write_char(&g_Drawer, '\n'); + write_string(&g_Drawer, " | "); + draw_string(g_Drawer.x, g_Drawer.y, " "); write_10(&g_Drawer, ((unsigned long)tval)/1000000); - g_Drawer.x = 0; - g_Drawer.y = 7; - write_string(&g_Drawer, "Task Stack #"); - write_hex32(&g_Drawer, sched_stack_count); g_Drawer.x = x; g_Drawer.y = y; -- cgit v1.2.1