+enum
+{
+ FORWARD,
+ BACKWARD,
+};
+
+int direction = FORWARD;
+
+static void leds_init(void)
+{
+ #if CPU_ARM_AT91SAM7X256
+ /* Set PB19..22 connected to PIOB */
+ PIOB_PER = 0x780000;
+ /* Set PB19..22 as output */
+ PIOB_OER = 0x780000;
+
+ /* Set PB19..22 to 1 to turn off leds */
+ PIOB_SODR = 0x780000;
+
+ /* turn first led on (PB19) */
+ PIOB_CODR = 0x80000;
+ #elif CPU_ARM_AT91SAM7S256
+ /* Set PA0..3 connected to PIOA */
+ PIOA_PER = 0x0000001f;
+ /* Set PA0..3 as output */
+ PIOA_OER = 0x0000001f;
+
+ /* Set PA0..3 to 1 to turn off leds */
+ PIOA_SODR = 0x0000000f;
+ /* turn first led on (PA0) */
+ PIOA_CODR = 0x00000001;
+ #endif
+}
+
+#if CPU_ARM_AT91SAM7X256
+ #define GET_PIO_STATUS() (~PIOB_ODSR & 0x780000)
+ #define LAST_LED 0x200000
+ #define FIRST_LED 0x100000
+ #define SET_PIO_BITS PIOB_SODR
+ #define CLEAR_PIO_BITS PIOB_CODR
+ #define AT91SAM7_MSG "BeRTOS is run on AT91SAM7X256..\n"
+#elif CPU_ARM_AT91SAM7S256
+ #define GET_PIO_STATUS() (~PIOA_ODSR & 0x0000000f)
+ #define LAST_LED 0x00000004
+ #define FIRST_LED 0x00000002
+ #define SET_PIO_BITS PIOA_SODR
+ #define CLEAR_PIO_BITS PIOA_CODR
+ #define AT91SAM7_MSG "BeRTOS is run on AT91SAM7S256..\n"
+#endif
+
+/*
+ * Knight Rider leds effect..
+ */