aboutsummaryrefslogtreecommitdiff
path: root/usr/main.c
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-03-30 15:38:55 -0700
committerChristian Cunningham <cc@localhost>2022-03-30 15:38:55 -0700
commit16348742989a94b63f278fb4c43e09ef994353f8 (patch)
tree34ee5b1ba2daaf979babdd6a005d02664aa55824 /usr/main.c
parentfb5ebe9eaae5f90ca3358fed94fc2611f3661b9a (diff)
GPIO and delayed execution tests
Diffstat (limited to 'usr/main.c')
-rw-r--r--usr/main.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/usr/main.c b/usr/main.c
index 71f003f..a4c6048 100644
--- a/usr/main.c
+++ b/usr/main.c
@@ -1,3 +1,4 @@
+#include <setjmp.h>
#include <cpu.h>
#include <globals.h>
#include <graphics/lfb.h>
@@ -27,7 +28,7 @@ static struct SysTimerInfo stime_2 = {
};
static struct SysTimerInfo stime_3 = {
- .tick_rate = 6,
+ .tick_rate = 10,
.priority = 0,
.arg = 0,
};
@@ -47,17 +48,19 @@ void gptest(void)
static unsigned long long ts[4096*2+20];
sys0_64(SYS_TIME, &ts[count++]);
if (count == (4096*2+18)) {
- //unsubscribe_irq(GPIO_BANK_1_IRQ);
- unsubscribe_irq(SYS_TIMER_3_IRQ);
+ unsubscribe_irq(GPIO_BANK_1_IRQ);
+ //unsubscribe_irq(SYS_TIMER_3_IRQ);
static char str[14];
char* start;
- unsigned long mean=0, stdev=0, max=0;
+ unsigned long mean=0, stdev=0, max=0, min=0xFFFFFFFF;
for (unsigned long i = 0; i < 4096; i++) {
unsigned long elapsed = ts[2*(i+2)+1]-ts[2*(i+2)];
elapsed *= 1000;
mean += elapsed;
if (elapsed > max)
max = elapsed;
+ if (elapsed < min)
+ min = elapsed;
}
mean /= 4096;
for (unsigned long i = 0; i < 4096; i++) {
@@ -71,8 +74,10 @@ void gptest(void)
draw_string(0, 10, start);
start = ulong_to_string(stdev, str);
draw_string(0, 11, start);
- start = ulong_to_string(max, str);
+ start = ulong_to_string(min, str);
draw_string(0, 12, start);
+ start = ulong_to_string(max, str);
+ draw_string(0, 13, start);
}
//unsigned long gplev0 = *GPLEV0;
//draw_hex32(0, 30, gplev0);
@@ -89,9 +94,9 @@ void main(void)
//subscribe_irq(SYS_TIMER_1_IRQ, loopt, &stime_1);
//subscribe_irq(SYS_TIMER_2_IRQ, loopt, &stime_2);
//subscribe_irq(SYS_TIMER_3_IRQ, loopt, &stime_3);
- subscribe_irq(SYS_TIMER_3_IRQ, gptest, &stime_3);
- //subscribe_irq(GPIO_BANK_1_IRQ, gptest, &gpinfo);
+ subscribe_irq(GPIO_BANK_1_IRQ, gptest, &gpinfo);
//add_thread(loop, 0, 8);
//add_thread(consumer, 0, 3);
//add_thread(test_super, 0, 4);
+ //subscribe_irq(SYS_TIMER_3_IRQ, gptest, &stime_3);
}