diff options
author | Christian Cunningham <cc@localhost> | 2022-01-23 13:22:39 -0700 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2022-01-23 13:22:39 -0700 |
commit | 91741716578c1dea150fa7b4e6ac46553121447f (patch) | |
tree | 66100464b494d772db0ec190279f3fbfcb589b73 /src | |
parent | 13b239faf1c7f1d21fd4b0b774ea90c97c536623 (diff) |
Trimmed IRQ handler
Diffstat (limited to 'src')
-rw-r--r-- | src/cpu/irq.c | 104 |
1 files changed, 4 insertions, 100 deletions
diff --git a/src/cpu/irq.c b/src/cpu/irq.c index fd0cbd5..1a743ff 100644 --- a/src/cpu/irq.c +++ b/src/cpu/irq.c @@ -78,12 +78,8 @@ void c_irq_handler(void) cmd[off] = (char) data; off += 1; release_mutex(&exe_cnt_m, SYS_PID); - // New Task Case - } else if (data == 0x61) { - cmd[off] = (char) data; - off += 1; - add_thread(localtest, 0, 0); - } else if (data == 0x62) { + // heap Info + } else if (data == 0x69) { cmd[off] = (char) data; off += 1; add_thread(heap_info, 0, 5); @@ -137,98 +133,7 @@ static unsigned long counter = 0; unsigned long c_fiq_handler(void) { unsigned long source = load32(CORE0_FIQ_SOURCE); - if (source & (1 << 8)) { - if(load32(IRQ_PENDING2) & (1 << 25)) { - if(load32(UART0_MIS) & (1<<4)) { - unsigned long data = load32(UART0_DR); - // Ctrl+Tab to toggle timer - if(data == 0x14) { - unsigned long timer_status; - asm volatile("mrc p15, 0, %0, c14, c3, 1" : "=r"(timer_status)); - 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: "); - if(timer_status == 0) { - cntfrq = read_cntfrq(); - write_cntv_tval(cntfrq/CPS); - enablecntv(); - write_cstring(&g_Drawer, "Enabled ", 0x00FF00); - } else { - disablecntv(); - write_cstring(&g_Drawer, "Disabled", 0xFF0000); - } - g_Drawer.x = x; - g_Drawer.y = y; - } else { - unsigned long off = cmdidx; - if (off < 2048) { - // Newline Case - if (data == 0x0D) { - for(int i = off; i>=0;i--) - cmd[i] = 0x0; - off = 0; - // Backspace Case - } else if (data == 0x08 || data == 0x7F) { - if (off > 0) { - off -= 1; - } - cmd[off] = 0x0; - // Lock Case - } else if (data == 0x6C) { - cmd[off] = (char) data; - off += 1; - lock_mutex(&exe_cnt_m, SYS_PID); - // Release Case - } else if (data == 0x72) { - cmd[off] = (char) data; - off += 1; - release_mutex(&exe_cnt_m, SYS_PID); - // New Task Case - } else if (data == 0x61) { - cmd[off] = (char) data; - off += 1; - //_start(); // Trigger reset - //heap_info_u(); - // Else output - } else { - cmd[off] = (char) data; - off += 1; - } - } else if (off == 2048) { - if (data == 0x0D) { - for(int i = off; i>=0;i--) - cmd[i] = 0x0; - off = 0; - } else if (data == 0x08 || data == 0x7F) { - if (off > 0) { - off -= 1; - } - cmd[off] = 0x0; - } - } - cmdidx = off; - } - g_Drawer.x = 0; - g_Drawer.y = 7; - for(int i = 0; i < 128; i++) - write_char(&g_Drawer, ' '); - g_Drawer.x = 0; - g_Drawer.y = 7; - write_string(&g_Drawer, "> "); - write_string(&g_Drawer, cmd); - return 0; - } - } else if (*(unsigned long*)SYS_TIMER_CS == SYS_TIMER_SC_M0) { - volatile unsigned long* timer_cs = (unsigned long*)SYS_TIMER_CS; - volatile unsigned long* timer_chi = (unsigned long*)SYS_TIMER_CHI; - volatile unsigned long* nexttime = (unsigned long*)SYS_TIMER_C0; - *timer_cs = SYS_TIMER_SC_M0; - //*nexttime = *timer_chi + 60000000; - *nexttime = *timer_chi + 10000; - } - } else if (source & (1 << 3)) { + if (source & (1 << 3)) { c_timer(); counter++; if (counter % 0x100 == 0) { @@ -236,8 +141,7 @@ unsigned long c_fiq_handler(void) } else if (counter % 0x6000 == 0) { counter = 0; } - if (counter % 0x60 == 0) { - //uart_scheduler(); + if (counter % 0x30 == 0) { return 1; } return 0; |