*/
#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;
}
+
at91sam7s_CSRC = \
app/at91sam7s/at91sam7s.c \
drv/timer.c \
- drv/at91/sysirq.c
+ cpu/arm/drv/sysirq_at91.c \
+ mware/event.c
-at91sam7s_PCSRC += mware/formatwr.c
+at91sam7s_CPPASRC = cpu/arm/hw/crtat91sam7s256_rom.S
+
+at91sam7s_CPPAFLAGS = -O0 -g -gdwarf-2 -g -gen-debug
+at91sam7s_CPPFLAGS = -O0 -D'ARCH=0' -D__ARM_AT91SAM7S256__ -g3 -gdwarf-2 -fverbose-asm -Iapp/at91sam7s/hw -Iapp/at91sam7s -Icpu/arm
+at91sam7s_LDFLAGS = -nostartfiles -T cpu/arm/scripts/at91sam7s256_rom.ld -Wl,--no-warn-mismatch
-at91sam7s_CFLAGS = -O3 -D'ARCH=0' -Iapp/at91sam7s/hw -Iapp/at91sam7s
at91sam7s_CPU = arm7tdmi
# Debug stuff
#ifndef AT91SAM7SEK_HW_H
#define AT91SAM7SEK_HW_H
-#include <appconfig.h>
-
-/// CPU Clock frequency (14.7456 MHz)
-#define CLOCK_FREQ (14745600UL)
+/// CPU Clock frequency (48.023 MHz)
+#define CLOCK_FREQ (48023000UL)
/* Timer IRQ strobe */
app/triface/protocol.c \
drv/timer.c \
drv/ser.c \
- drv/ser_avr.c \
+ cpu/avr/drv/ser_avr.c \
mware/formatwr.c \
mware/hex.c \
mware/hashtable.c \
triface_PCSRC += mware/formatwr.c
#triface_CFLAGS = -O3 -D'ARCH=0' -Iapp/triface/hw -Iapp/triface
-triface_CFLAGS = -O0 -D'ARCH=0' -Iapp/triface/hw -Iapp/triface
+triface_CFLAGS = -O0 -D'ARCH=0' -Iapp/triface/hw -Iapp/triface -Icpu/avr
triface_MCU = atmega128
# Debug stuff