diff options
author | Christian Cunningham <cc@localhost> | 2022-03-02 15:36:24 -0700 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2022-03-02 15:36:24 -0700 |
commit | 4c74418b1d97b2e9f7daeea365d5018db199fca7 (patch) | |
tree | cf3c2672343c6dd75e316003d2cf4242a30c3d40 | |
parent | c31227d9046c3ab853255f89358966fe0721e957 (diff) |
Ensure one test is added
Mount and export make
-rw-r--r-- | Common.mk | 3 | ||||
-rw-r--r-- | src/cpu/irq.c | 16 | ||||
-rw-r--r-- | src/graphics/lfb.c | 22 | ||||
-rw-r--r-- | src/sys/core.c | 2 | ||||
-rw-r--r-- | src/tests/test.c | 51 |
5 files changed, 52 insertions, 42 deletions
@@ -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 <graphics/glyphs.h> #include <graphics/lfb.h> #include <graphics/mbox.h> -#include <graphics/philosopher_toad.h> 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<toad_height;y++) { - for(x=0;x<toad_width;x++) { - HEADER_PIXEL(data, pixel); - // the image is in RGB. So if we have an RGB framebuffer, we can copy the pixels - // directly, but for BGR we must swap R (pixel[0]) and B (pixel[2]) channels. - *((unsigned int*)ptr)=gisrgb ? *((unsigned int *)&pixel) : (unsigned int)(pixel[0]<<16 | pixel[1]<<8 | pixel[2]); - ptr+=4; - } - ptr+=gpitch-toad_width*4; - } +#define FWIDTH 240 +#define FHEIGHT 80 + draw_cbox(SCR_WIDTH-FWIDTH, SCR_HEIGHT-FHEIGHT*2, FWIDTH, FHEIGHT, 0x0057b7); + draw_cbox(SCR_WIDTH-FWIDTH, SCR_HEIGHT-FHEIGHT, FWIDTH, FHEIGHT, 0xffd700); } void draw_cpixel(unsigned long lx, unsigned long ly, unsigned int c) diff --git a/src/sys/core.c b/src/sys/core.c index 4816d50..fbe0d59 100644 --- a/src/sys/core.c +++ b/src/sys/core.c @@ -19,7 +19,7 @@ void sysinit(void) // Initialize System Globals stimeh = *(unsigned long*)SYS_TIMER_CHI; stimel = *(unsigned long*)SYS_TIMER_CLO; - *(unsigned long*) SYS_TIMER_C0 = 60000000 + stimeh; // 60 second trigger + *(unsigned long*) SYS_TIMER_C0 = 3000000 + stimeh; // 11 second trigger uart_init(); ///... diff --git a/src/tests/test.c b/src/tests/test.c index bb1bf31..7f18627 100644 --- a/src/tests/test.c +++ b/src/tests/test.c @@ -1,5 +1,5 @@ #include <cpu.h> -#include <drivers/uart.h> +//#include <drivers/uart.h> #include <graphics/lfb.h> #include <lib/kmem.h> #include <sys/core.h> @@ -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) |