From 4c74418b1d97b2e9f7daeea365d5018db199fca7 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Wed, 2 Mar 2022 15:36:24 -0700 Subject: Ensure one test is added Mount and export make --- Common.mk | 3 +++ src/cpu/irq.c | 16 +++++++++++----- src/graphics/lfb.c | 22 ++++------------------ src/sys/core.c | 2 +- src/tests/test.c | 51 +++++++++++++++++++++++++++++++++------------------ 5 files changed, 52 insertions(+), 42 deletions(-) diff --git a/Common.mk b/Common.mk index b2664b0..ecf10de 100644 --- a/Common.mk +++ b/Common.mk @@ -10,6 +10,7 @@ AUTO ?= 0 BSP ?= 2 DEBUG ?= 0 SILENT ?= 0 +DISK ?= /dev/sdc1 CROSS = arm-none-eabi CC = ${CROSS}-gcc @@ -110,4 +111,6 @@ test: clean build/kernel.elf @./tests/run.sh copy: clean build/kernel7.img + sudo mount -o umask=0 $(DISK) /mnt/sd0 sudo cp build/kernel7.img /mnt/sd0 + sudo umount /mnt/sd0 diff --git a/src/cpu/irq.c b/src/cpu/irq.c index 9e44009..e2a6773 100644 --- a/src/cpu/irq.c +++ b/src/cpu/irq.c @@ -55,12 +55,18 @@ void c_irq_handler(void) } } // Check if System Time Compare 0 Triggered the Interrupt - 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; + else if (*(volatile unsigned long*)SYS_TIMER_CS & SYS_TIMER_SC_M0) { + volatile unsigned long* timer_cs = (volatile unsigned long*)SYS_TIMER_CS; + volatile unsigned long* timer_chi = (volatile unsigned long*)SYS_TIMER_CHI; + volatile unsigned long* nexttime = (volatile unsigned long*)SYS_TIMER_C0; + static char timer_lock = 0; + if (!timer_lock) { + timer_lock = 1; + add_thread(test_entry, 0, 2); + timer_lock = 0; + } + *nexttime = *timer_chi + 30000000; *timer_cs = SYS_TIMER_SC_M0; - *nexttime = *timer_chi + 60000000; } } // Check if CNTV triggered the interrupt diff --git a/src/graphics/lfb.c b/src/graphics/lfb.c index 8f7ad06..8c9c395 100644 --- a/src/graphics/lfb.c +++ b/src/graphics/lfb.c @@ -3,12 +3,9 @@ #include #include #include -#include unsigned char *lfb; /* raw frame buffer address */ -//#define SCR_WIDTH 1024 -//#define SCR_HEIGHT 768 #define SCR_WIDTH 1920 #define SCR_HEIGHT 1080 @@ -92,21 +89,10 @@ void clear_screen(void) void lfb_showpicture(void) { clear_screen(); - unsigned int x,y; - unsigned char *ptr=lfb; - char *data=toad_data, pixel[4]; - - ptr = lfb + (gheight-toad_height)*gpitch + (gwidth-toad_width)*4; - for(y=0;y -#include +//#include #include #include #include @@ -10,17 +10,20 @@ extern void atest(void); void btest(void); +static int x = 0; +static int y = 13; void test_entry(void) { - draw_string(0, 18, "Starting tests"); + x = 0; + draw_string(0, y+4, "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); + DRAW64(0, y+5, dt/64); + DRAW64(17, y+5, dt%64); // atest add_thread(atest, 0, 0); @@ -28,8 +31,8 @@ void test_entry(void) sys0(SYS_YIELD); sys0_64(SYS_TIME, &tf); dt = tf - ti; - DRAW64(34, 19, dt/64); - DRAW64(34+17, 19, dt%64); + DRAW64(34, y+5, dt/64); + DRAW64(34+17, y+5, dt%64); add_thread(btest, 0, 4); } @@ -43,37 +46,49 @@ void ctest4(void); void ctest1(void) { - uart_string("1 Started\n"); - uart_string("1 Locking\n"); + draw_cletter(x++, y+2, 'S', 0xFF0000); + //uart_string("1 Started\n"); + draw_cletter(x++, y+2, 'L', 0xFF0000); + //uart_string("1 Locking\n"); lock(&testm); add_thread(ctest3, 0, 2); - uart_string("1 Unlocking\n"); + draw_cletter(x++, y+2, 'U', 0xFF0000); + //uart_string("1 Unlocking\n"); unlock(&testm); - uart_string("1 Finished\n"); + draw_cletter(x++, y+2, 'F', 0xFF0000); + //uart_string("1 Finished\n"); } void ctest2(void) { - uart_string("2 Started\n"); + draw_cletter(x++, y+0, 'S', 0x0000FF); + //uart_string("2 Started\n"); add_thread(ctest4, 0, 3); - uart_string("2 Locking\n"); + draw_cletter(x++, y+0, 'L', 0x0000FF); + //uart_string("2 Locking\n"); lock(&testm); - uart_string("2 Unlocking\n"); + draw_cletter(x++, y+0, 'U', 0x0000FF); + //uart_string("2 Unlocking\n"); unlock(&testm); - uart_string("2 Finished\n"); + draw_cletter(x++, y+0, 'F', 0x0000FF); + //uart_string("2 Finished\n"); } void ctest3(void) { - uart_string("3 Started\n"); + draw_cletter(x++, y+1, 'S', 0x00FF00); + //uart_string("3 Started\n"); add_thread(ctest2, 0, 1); - uart_string("3 Finished\n"); + draw_cletter(x++, y+1, 'F', 0x00FF00); + //uart_string("3 Finished\n"); } void ctest4(void) { - uart_string("4 Started\n"); - uart_string("4 Finished\n"); + draw_cletter(x++, y+2, 'S', 0xAFAF00); + //uart_string("4 Started\n"); + draw_cletter(x++, y+2, 'F', 0xAFAF00); + //uart_string("4 Finished\n"); } void btest(void) -- cgit v1.2.1