diff options
author | Christian Cunningham <cc@localhost> | 2022-03-30 13:16:39 -0700 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2022-03-30 13:16:39 -0700 |
commit | fb5ebe9eaae5f90ca3358fed94fc2611f3661b9a (patch) | |
tree | f54a926610b3ed64cdfa98796fa09ee0526680d4 | |
parent | 9e1bb73b5a9cc7819ff032ff6630f88ed7d94b62 (diff) |
Testing temporal event resolution
-rw-r--r-- | Common.mk | 2 | ||||
-rw-r--r-- | usr/main.c | 10 |
2 files changed, 8 insertions, 4 deletions
@@ -140,6 +140,6 @@ test: clean build/kernel.elf @./tests/run.sh copy: clean build/kernel7.img - sudo mount /mnt/sd0 + sudo mount $(DISK) /mnt/sd0 sudo cp build/kernel7.img /mnt/sd0 sudo umount /mnt/sd0 @@ -27,7 +27,7 @@ static struct SysTimerInfo stime_2 = { }; static struct SysTimerInfo stime_3 = { - .tick_rate = 70000, + .tick_rate = 6, .priority = 0, .arg = 0, }; @@ -47,12 +47,14 @@ 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(GPIO_BANK_1_IRQ); + unsubscribe_irq(SYS_TIMER_3_IRQ); static char str[14]; char* start; unsigned long mean=0, stdev=0, max=0; 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; @@ -60,6 +62,7 @@ void gptest(void) mean /= 4096; for (unsigned long i = 0; i < 4096; i++) { unsigned long elapsed = ts[2*(i+2)+1]-ts[2*(i+2)]; + elapsed *= 1000; unsigned long term = (elapsed-mean)*(elapsed-mean)/4096; stdev += term; } @@ -86,7 +89,8 @@ 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(GPIO_BANK_1_IRQ, gptest, &gpinfo); + subscribe_irq(SYS_TIMER_3_IRQ, gptest, &stime_3); + //subscribe_irq(GPIO_BANK_1_IRQ, gptest, &gpinfo); //add_thread(loop, 0, 8); //add_thread(consumer, 0, 3); //add_thread(test_super, 0, 4); |