aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cpu/irq.c28
-rw-r--r--src/graphics/drawer.c3
-rw-r--r--src/graphics/drawer.h4
-rw-r--r--src/sys/timer.c26
4 files changed, 28 insertions, 33 deletions
diff --git a/src/cpu/irq.c b/src/cpu/irq.c
index 7c7fc45..a6ed5e4 100644
--- a/src/cpu/irq.c
+++ b/src/cpu/irq.c
@@ -46,32 +46,24 @@ void c_irq_handler(void) {
if (data == 0x0D) {
off = 0;
cmd[0] = 0x0;
- uart_char(data);
- uart_string("\033[?25l> \033[0K\033[?25h");
// Backspace Case
} else if (data == 0x08 || data == 0x7F) {
if (off > 0) {
off -= 1;
}
cmd[off] = 0x0;
- uart_char((unsigned char)data);
- uart_char(0x20);
- uart_char((unsigned char)data);
// Lock Case
} else if (data == 0x6C) {
- uart_char((unsigned char)data);
cmd[off] = (char) data;
off += 1;
lock_mutex(&exe_cnt_m, SCHED_PID);
// Release Case
} else if (data == 0x72) {
- uart_char((unsigned char)data);
cmd[off] = (char) data;
off += 1;
release_mutex(&exe_cnt_m, SCHED_PID);
// Else output
} else {
- uart_char((unsigned char)data);
cmd[off] = (char) data;
off += 1;
}
@@ -79,27 +71,23 @@ void c_irq_handler(void) {
if (data == 0x0D) {
off = 0;
cmd[0] = 0x0;
- //uart_char(0x0a);
- uart_char(data);
- uart_string("\033[?25l> \033[0K\033[?25h");
} else if (data == 0x08 || data == 0x7F) {
if (off > 0) {
off -= 1;
}
cmd[off] = 0x0;
- uart_char((unsigned char)data);
- uart_char(0x20);
- uart_char((unsigned char)data);
}
}
cmdidx = off;
- //store32(off, (unsigned long*) cmdidx);
- uart_string("\033[?25l\033[9;1H\033[0K");
- uart_10(off);
- uart_string("\n\033[0K");
- uart_string(cmd);
- uart_string("\033[?25h\033[8;1H> ");
}
+ g_Drawer.x = 0;
+ g_Drawer.y = 8;
+ for(int i = 0; i < 128; i++)
+ write_char(&g_Drawer, ' ');
+ g_Drawer.x = 0;
+ g_Drawer.y = 8;
+ write_string(&g_Drawer, "> ");
+ write_string(&g_Drawer, cmd);
//enable_irq();
enableirq();
return;
diff --git a/src/graphics/drawer.c b/src/graphics/drawer.c
index 742712a..542c04c 100644
--- a/src/graphics/drawer.c
+++ b/src/graphics/drawer.c
@@ -1,7 +1,8 @@
#include "../graphics/lfb.h"
#include "../graphics/drawer.h"
-static struct Drawer g_Drawer = {x: 0, y: 0};
+#define GRAPHICS_DRAWER_C
+struct Drawer g_Drawer = {.x = 0, .y = 0};
void write_cchar(struct Drawer* d, char s, unsigned int c) {
d->x %= GG_MAX_X;
diff --git a/src/graphics/drawer.h b/src/graphics/drawer.h
index 04f8f23..1ad89c5 100644
--- a/src/graphics/drawer.h
+++ b/src/graphics/drawer.h
@@ -6,7 +6,9 @@ struct Drawer {
unsigned int y;
};
-static struct Drawer g_Drawer;
+#ifndef GRAPHICS_DRAWER_C
+extern struct Drawer g_Drawer;
+#endif
void write_cchar(struct Drawer* d, char s, unsigned int c);
void write_char(struct Drawer* d, char s);
diff --git a/src/sys/timer.c b/src/sys/timer.c
index ff55bd4..8e333c4 100644
--- a/src/sys/timer.c
+++ b/src/sys/timer.c
@@ -15,27 +15,31 @@ void c_timer() {
// Reset the counter
write_cntv_tval(cntfrq);
- // Output the value
- //uart_string((char*)"Timer Value: ");
- //unsigned long v = read_cntv_tval();
- //uart_10(v);
- //uart_char(0x20);
- //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;
+
+ // Lock the execution counter
if (lock_mutex(&exe_cnt_m, SCHED_PID) == 0) {
*(exe_cnt_m.addr) += 1;
- write_cstring(&g_Drawer, "DendritOS", 0xDF0000);
- write_cstring(&g_Drawer, " v", 0x00DF00);
- write_cstring(&g_Drawer, os_info_v, 0x00DF00);
+ write_cstring(&g_Drawer, "DendritOS", 0xFF0000);
+ write_cstring(&g_Drawer, " v", 0x00FF00);
+ write_cstring(&g_Drawer, os_info_v, 0x00FF00);
write_string(&g_Drawer, " #");
write_10(&g_Drawer, *(exe_cnt_m.addr));
release_mutex(&exe_cnt_m, SCHED_PID);
}
+
+ g_Drawer.x = 0;
+ g_Drawer.y = 10;
+ // Output the value
+ write_string(&g_Drawer, "Timer Value: ");
+ unsigned long v = read_cntv_tval();
+ write_10(&g_Drawer, v);
+ write_string(&g_Drawer, " | ");
+ write_hex32(&g_Drawer, v);
+
g_Drawer.x = x;
g_Drawer.y = y;
}