Update test apps.
[bertos.git] / app / at91sam7s / at91sam7s.c
index 860e72cd71628c08150415547e47450b6ac81218..b088247f90fc47494e1a4597edf3c9e152b4a44d 100644 (file)
@@ -27,7 +27,7 @@
  * the GNU General Public License.
  *
  * Copyright 2007 Develer S.r.l. (http://www.develer.com/)
- * This file is part of DevLib - See README.devlib for information.
+ *
  * -->
  *
  * \version $Id$
  */
 
 #include <drv/timer.h>
+#include <drv/sysirq_at91.h>
 #include <cfg/macros.h>
+#include <io/at91sam7s.h>
+
+int iort = 23;
+int iort1 = 232;
+int iort2 = 233;
+
+Timer leds_timer;
+
+static void leds_toggle(void)
+{
+       uint8_t a = (~PIOA_ODSR & 0x0f);
+
+       if (a)
+       {
+               PIOA_SODR = a;
+               PIOA_CODR = a << 1;
+       }
+       else
+       {
+               PIOA_SODR  =  0x0f;
+               /* turn first led on */
+               PIOA_CODR  = 0x00000001;
+       }
+
+       /* Wait for interval time */
+       timer_setDelay(&leds_timer, ms_to_ticks(100));
+       timer_add(&leds_timer);
+}
+
 
 int main(void)
 {
-//     kdbg_init();
+       //kdbg_init();
+       sysirq_init();
        timer_init();
        IRQ_ENABLE;
 
+       /* Disable all pullups */
+       PIOA_PUDR = 0xffffffff;
+       /* Set all port pin connected to PIOA */
+       PIOA_PER  = 0xffffffff;
+       /* Set PA0..3 as output */
+       PIOA_OER  = 0x0000000f;
+       /* Disable multidrive on all pins */
+       PIOA_MDDR = 0x0000000f;
+
+       /* Set PA0..3 to 1 to turn off leds */
+       PIOA_SODR  = 0x0000000f;
+       /* turn first led on */
+       PIOA_CODR  = 0x00000001;
+
+       timer_set_event_softint(&leds_timer, (Hook)leds_toggle, 0);
+       timer_setDelay(&leds_timer, ms_to_ticks(100));
+       timer_add(&leds_timer);
+
+
        // Main loop
        for(;;)
        {
-
+               iort+= 1;
+               iort1+= 1;
+               iort2+= 1;
        }
 
        return 0;
 }
+