aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-02-05 00:32:30 -0700
committerChristian Cunningham <cc@localhost>2022-02-05 00:32:30 -0700
commit44ad380cccc36184be13de37df701e1a1e713cf0 (patch)
treec9075af1b6458fa188a03704e9b8d45499f76ecf
parent21c6fe3075bf31da11e4d9a2f98eaf98a684664d (diff)
Starting test suite
-rw-r--r--include/graphics/lfb.h2
-rw-r--r--src/cpu/irq.c3
-rw-r--r--src/tests/test.c23
3 files changed, 16 insertions, 12 deletions
diff --git a/include/graphics/lfb.h b/include/graphics/lfb.h
index b21e12b..56981d2 100644
--- a/include/graphics/lfb.h
+++ b/include/graphics/lfb.h
@@ -4,6 +4,8 @@
#define GG_MAX_X 128
#define GG_MAX_Y 46
+#define DRAW64(x,y,v) draw_hex32(x,y,v>>32);draw_hex32(x+8,y,v);
+
void lfb_init(void);
void lfb_showpicture(void);
diff --git a/src/cpu/irq.c b/src/cpu/irq.c
index 9685b0a..6d9a02a 100644
--- a/src/cpu/irq.c
+++ b/src/cpu/irq.c
@@ -1,6 +1,5 @@
#include <cpu.h>
#include <cpu/irq.h>
-#include <drivers/uart.h>
#include <globals.h>
#include <graphics/drawer.h>
#include <symbols.h>
@@ -101,5 +100,7 @@ void handle_data(unsigned char data)
release_mutex(&exe_cnt_m, SYS_PID);
} else if (data == 0x61) {
add_thread(uart_scheduler, 0, 2);
+ } else if (data == 0x62) {
+ add_thread(test_entry, 0, 2);
}
}
diff --git a/src/tests/test.c b/src/tests/test.c
index 247465e..f2f3e6b 100644
--- a/src/tests/test.c
+++ b/src/tests/test.c
@@ -1,17 +1,18 @@
#include <cpu.h>
#include <drivers/uart.h>
-
-void utime(void);
+#include <graphics/lfb.h>
+#include <lib/kmem.h>
+#include <sys/core.h>
void test_entry(void)
{
-}
-
-void utime(void)
-{
- unsigned long long ti, tf, dt;
- sys0_64(SYS_TIME, &ti);
- sys0_64(SYS_TIME, &tf);
- dt = tf - ti;
- PRINT64(dt);
+ draw_string(0, 18, "Starting tests");
+ unsigned long long ti, tf, dt=0;
+ for(int i = 0; i < 64; i++) {
+ sys0_64(SYS_TIME, &ti);
+ sys0_64(SYS_TIME, &tf);
+ dt += tf - ti;
+ }
+ DRAW64(0, 19, dt/64);
+ DRAW64(17, 19, dt%64);
}