initialize timer
authorJohn Tsiombikas <nuclear@member.fsf.org>
Sun, 15 Nov 2020 07:26:55 +0000 (09:26 +0200)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Sun, 15 Nov 2020 07:26:55 +0000 (09:26 +0200)
src/timer.c

index 7df21bb..cbcebee 100644 (file)
@@ -6,5 +6,10 @@ volatile unsigned long num_ticks;
 
 void timer_init(void)
 {
+       /* clear all 4 timer interrupt bits */
+       STM_CTL_REG = 0xf;
+       /* setup first timer interrupt */
+       STM_CMP1_REG = STM_LCNT_REG + 4000;
+
        enable_gpu_irq(IRQ_GPU_TIMER1);
 }