basic led gpio driver
[cortex-from-scratch] / systick.c
index 48065ef..1d632ec 100644 (file)
--- a/systick.c
+++ b/systick.c
@@ -1,8 +1,11 @@
 #include <stdbool.h>
 #include <stddef.h>
 #include <stdint.h>
-#include <stm32.h>
-#include <mmap.h>
+
+#include <sys/robsys.h>
+#include <sys/mmap.h>
+
+#include <lib/regfunc.h> // TODO
 
 struct interrupt_frame {
 
@@ -16,19 +19,12 @@ struct interrupt_frame {
         uint32_t psr; // N-4
 };
 
+//__attribute__ ((interrupt))
+void * systick_handler(/* struct interrupt_frame * frame */) {
 
-/* void * systick_handler() {
-
-//     *RANDOM_ADDR = (volatile uint32_t) 0x10101010 ;
-//     uart_puts("TEST");
-} */
-
-__attribute__ ((interrupt))
-void * systick_handler(struct interrupt_frame * frame) {
-
-       uart_puts("TICKING\n");
-//     addrtohex((uint32_t) 0x12345678);
-       //      for(;;);
+//     uint32_t volatile status;
+       //uart_puts("TICKING\n");
+//     for(;;);
 }
 
 
@@ -41,7 +37,7 @@ void systick_init() {
        /* The counter reload register here holds 
         * 0x1000 -- that's 4096 clock cycles -- if 
         * it is down to zero it is restores the value */
-       *STK_RELOAD = (volatile uint32_t) 0x00000400; 
+       *STK_RELOAD = (volatile uint32_t) 0x00400000; 
 
        /* Every time the counter counts down to zero
         * a systick exception is asserted. Systick has