From: batt Date: Thu, 18 Oct 2007 09:36:26 +0000 (+0000) Subject: Update test apps. X-Git-Tag: 1.0.0~349 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=aad922a8b3d6433fb1987f75173044b61abf65c2;p=bertos.git Update test apps. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@892 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/app/at91sam7s/at91sam7s.c b/app/at91sam7s/at91sam7s.c index 8db8afdd..b088247f 100644 --- a/app/at91sam7s/at91sam7s.c +++ b/app/at91sam7s/at91sam7s.c @@ -38,19 +38,72 @@ */ #include +#include #include +#include + +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; } + diff --git a/app/at91sam7s/at91sam7s.mk b/app/at91sam7s/at91sam7s.mk index 926dd9e6..858670aa 100644 --- a/app/at91sam7s/at91sam7s.mk +++ b/app/at91sam7s/at91sam7s.mk @@ -19,11 +19,15 @@ TRG += at91sam7s 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 diff --git a/app/at91sam7s/hw/hw_cpu.h b/app/at91sam7s/hw/hw_cpu.h index 0b46cc7c..f95458dd 100644 --- a/app/at91sam7s/hw/hw_cpu.h +++ b/app/at91sam7s/hw/hw_cpu.h @@ -47,10 +47,8 @@ #ifndef AT91SAM7SEK_HW_H #define AT91SAM7SEK_HW_H -#include - -/// CPU Clock frequency (14.7456 MHz) -#define CLOCK_FREQ (14745600UL) +/// CPU Clock frequency (48.023 MHz) +#define CLOCK_FREQ (48023000UL) /* Timer IRQ strobe */ diff --git a/app/triface/triface.mk b/app/triface/triface.mk index c1d095dc..bc0d7d04 100644 --- a/app/triface/triface.mk +++ b/app/triface/triface.mk @@ -31,7 +31,7 @@ triface_CSRC = \ 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 \ @@ -43,7 +43,7 @@ triface_CSRC = \ 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