diff options
Diffstat (limited to 'src/sys')
-rw-r--r-- | src/sys/core.c | 117 | ||||
-rw-r--r-- | src/sys/core.h | 1 | ||||
-rw-r--r-- | src/sys/timer.c | 25 |
3 files changed, 30 insertions, 113 deletions
diff --git a/src/sys/core.c b/src/sys/core.c index f3699d8..f5d7ca1 100644 --- a/src/sys/core.c +++ b/src/sys/core.c @@ -18,9 +18,6 @@ char* os_info_v = "?"; char* os_info_v = VERSION; #endif -static char* irq_on = " \033[92mEnabled\033[0m"; -static char* irq_off = " \033[91mDisabled\033[0m"; - // Initialize IRQs void sysinit() { // Mask Overrun of UART0 @@ -31,7 +28,6 @@ void sysinit() { // Route GPU interrupts to Core 0 store32(0x00, GPU_INTERRUPTS_ROUTING); - //*(unsigned long*) // Enable Timer // As an IRQ @@ -48,9 +44,6 @@ void sysinit() { enable_cntv(); // Graphics Initialize - //init_graphics(); - //draw_box(0x01FE, 0, 0, 640, 480); - //draw_box(0xFFFF, 2, 2, 10, 10); lfb_init(); lfb_showpicture(); @@ -59,72 +52,6 @@ void sysinit() { enablefiq(); } -// Checks IRQ status -void chk_irq_stat() { - uart_string((char*)"Checking Enabled Services...\n"); - - // Basic IRQ - unsigned long ib_val = load32(IRQ_BASIC_ENABLE); - uart_string((char*)"IRQB Status: "); - uart_hexn(ib_val); - - // IRQ 1 - unsigned long i1_val = load32(IRQ_ENABLE1); - uart_string((char*)"IRQ1 Status: "); - uart_hexn(i1_val); - - // IRQ 2 - unsigned long i2_val = load32(IRQ_ENABLE2); - uart_string((char*)"IRQ2 Status: "); - uart_hexn(i2_val); - - // Check UART IRQ - uart_string((char*)" UART:"); - if (i2_val & (1<<25)) { - uart_string(irq_on); - } else { - uart_string(irq_off); - } - uart_char(0x0a); - - // Check TIMER IRQ - uart_string((char*)" TIMER:"); - if (ib_val & (1<<0)) { - uart_string(irq_on); - // Output the frequency - uart_string((char*)" Frequency: "); - cntfrq = read_cntfrq(); - //uart_hexn(cntfrq); - uart_10(cntfrq); - uart_string((char*)" Hz\n"); - } else { - uart_string(irq_off); - } - uart_char(0x0a); - - // Check FIQ - unsigned long f_val = load32(FIQ_CONTROL); - uart_string((char*)"FIQ Status: "); - uart_hexn(f_val); - if (f_val & 0x80) { - uart_string(irq_on); - } else { - uart_string(irq_off); - } - uart_char(0x0a); - - // Check GPU Interrupt Routing - unsigned long g_val = load32(GPU_INTERRUPTS_ROUTING); - uart_string((char*)"GPU IRQ Routed to Core "); - uart_char(0x30 + (g_val & 0x3)); - uart_char(0x0a); - uart_string((char*)"GPU FIQ Routed to Core "); - uart_char(0x30 + ((g_val>>2) & 0x3)); - uart_char(0x0a); - - uart_char(0x0a); -} - void output_irq_status(void) { // Basic IRQ unsigned long ib_val = load32(IRQ_BASIC_ENABLE); @@ -135,17 +62,12 @@ void output_irq_status(void) { // FIQ unsigned long f_val = load32(FIQ_CONTROL); - uart_string("\033[5;1H"); // Check GPU Interrupt Routing unsigned long g_val = load32(GPU_INTERRUPTS_ROUTING); - uart_string((char*)"GPU IRQ: Core "); - uart_char(0x30 + (g_val & 0x3)); - uart_string((char*)" | GPU FIQ: Core "); - uart_char(0x30 + ((g_val>>2) & 0x3)); write_string(&g_Drawer, "GPU IRQ: Core "); - write_hex32(&g_Drawer, g_val & 0b11); + write_10(&g_Drawer, g_val & 0b11); write_string(&g_Drawer, " | GPU FIQ: Core "); - write_hex32(&g_Drawer, (g_val >> 2) & 0b11); + write_10(&g_Drawer, (g_val >> 2) & 0b11); write_string(&g_Drawer, "\n"); write_hex32(&g_Drawer, ib_val); @@ -159,46 +81,43 @@ void output_irq_status(void) { // Check UART IRQ write_string(&g_Drawer, "\nUART: "); if (i2_val & (1<<25)) { - uart_string(irq_on); write_cstring(&g_Drawer, "Enabled", 0x00FF00); } else { - uart_string(irq_off); write_cstring(&g_Drawer, "Disabled", 0xFF0000); } // Check TIMER IRQ - write_string(&g_Drawer, "\n"); - write_string(&g_Drawer, "TIMER: "); + write_string(&g_Drawer, "\nTIMER: "); if (ib_val & (1<<0)) { - uart_string(irq_on); write_cstring(&g_Drawer, "Enabled", 0x00FF00); // Output the frequency - uart_string(" @ "); + write_string(&g_Drawer, " @ "); unsigned long frq = read_cntfrq()/1000; - uart_10(frq); - uart_string((char*)" kHz"); + write_10(&g_Drawer, frq); + write_string(&g_Drawer, " kHz"); } else { - uart_string(irq_off); write_cstring(&g_Drawer, "Disabled", 0xFF0000); } - + write_string(&g_Drawer, "\nTIMER: "); + write_cstring(&g_Drawer, "Enabled", 0x00FF00); } void postinit() { // OS Info - uart_string("\033[2J\033[1;1H\033[91mDendritOS \033[96mv"); - uart_string(os_info_v); - uart_string("\033[0m #"); + write_cstring(&g_Drawer, "DendritOS", 0xFF0000); + write_cstring(&g_Drawer, " v", 0x00FF00); + write_cstring(&g_Drawer, os_info_v, 0x00FF00); + write_string(&g_Drawer, " #"); if (lock_mutex(&exe_cnt_m, SYS_PID) == 0) { - uart_10(*(exe_cnt_m.addr)); + write_10(&g_Drawer, *(exe_cnt_m.addr)); release_mutex(&exe_cnt_m, SYS_PID); } // Commands - uart_string("\033[2;1HMonitor: Ctrl-A m\033[2;20HExit: Ctrl-A x"); - uart_string("\033[3;1HTimer: Ctrl-T\033[3;20H"); + write_string(&g_Drawer, "\nMonitor Ctrl-A m Exit: Ctrl-A x"); + write_string(&g_Drawer, "\nTimer: Ctrl-T"); // Timer Status - uart_string("\033[4;1HTimer: \033[92mEnabled\033[0m"); + //uart_string("Timer: \033[92mEnabled\033[0m"); // GPU IRQ Statuses + write_string(&g_Drawer, "\n"); output_irq_status(); - // Input line - uart_string("\033[8;1H> "); + write_string(&g_Drawer, "\n> "); } diff --git a/src/sys/core.h b/src/sys/core.h index d720e17..88d4644 100644 --- a/src/sys/core.h +++ b/src/sys/core.h @@ -114,7 +114,6 @@ enum }; void sysinit(); -void chk_irq_stat(); void postinit(); #endif diff --git a/src/sys/timer.c b/src/sys/timer.c index ca3366c..ff55bd4 100644 --- a/src/sys/timer.c +++ b/src/sys/timer.c @@ -1,3 +1,4 @@ +#include "../graphics/drawer.h" #include "../sys/core.h" #include "../sys/timer.h" #include "../util/time.h" @@ -22,21 +23,19 @@ void c_timer() { //uart_hexn(v); // Lock the execution counter + unsigned int x = g_Drawer.x; + unsigned int y = g_Drawer.y; + g_Drawer.x = 0; + g_Drawer.y = 0; if (lock_mutex(&exe_cnt_m, SCHED_PID) == 0) { *(exe_cnt_m.addr) += 1; -#ifndef NOANSI - uart_string("\033[?25l\033[s\033[1;1H\033[91mDendritOS \033[96mv"); -#else - uart_string("\033[?25l\033[1;1H\033[91mDendritOS \033[96mv"); -#endif - uart_string(os_info_v); - uart_string("\033[0m #"); - uart_10(*(exe_cnt_m.addr)); -#ifndef NOANSI - uart_string("\033[u\033[?25h"); -#else - uart_string("\033[8;1H\033[?25h> "); -#endif + write_cstring(&g_Drawer, "DendritOS", 0xDF0000); + write_cstring(&g_Drawer, " v", 0x00DF00); + write_cstring(&g_Drawer, os_info_v, 0x00DF00); + write_string(&g_Drawer, " #"); + write_10(&g_Drawer, *(exe_cnt_m.addr)); release_mutex(&exe_cnt_m, SCHED_PID); } + g_Drawer.x = x; + g_Drawer.y = y; } |