From a6dbd7a691a6c70ebaf132cdc92fc21b3428f6f7 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 6 Mar 2008 11:38:11 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@217 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/AVR-AT90CANx-GCC/Makefile | 25 +++++-- demos/AVR-AT90CANx-GCC/board.c | 87 +++++++++++++++++++++++ demos/AVR-AT90CANx-GCC/board.h | 86 +++++++++++++++++++++++ demos/AVR-AT90CANx-GCC/chconf.h | 15 ++-- demos/AVR-AT90CANx-GCC/chcore.c | 137 ------------------------------------- demos/AVR-AT90CANx-GCC/chcore.h | 116 ------------------------------- demos/AVR-AT90CANx-GCC/chcore2.S | 123 --------------------------------- demos/AVR-AT90CANx-GCC/chtypes.h | 48 ------------- demos/AVR-AT90CANx-GCC/main.c | 30 +++++++- demos/AVR-AT90CANx-GCC/readme.txt | 25 +++++++ demos/AVR-ATmega128-GCC/readme.txt | 3 +- readme.txt | 6 +- 12 files changed, 256 insertions(+), 445 deletions(-) create mode 100644 demos/AVR-AT90CANx-GCC/board.c create mode 100644 demos/AVR-AT90CANx-GCC/board.h delete mode 100644 demos/AVR-AT90CANx-GCC/chcore.c delete mode 100644 demos/AVR-AT90CANx-GCC/chcore.h delete mode 100644 demos/AVR-AT90CANx-GCC/chcore2.S delete mode 100644 demos/AVR-AT90CANx-GCC/chtypes.h create mode 100644 demos/AVR-AT90CANx-GCC/readme.txt diff --git a/demos/AVR-AT90CANx-GCC/Makefile b/demos/AVR-AT90CANx-GCC/Makefile index b65fb4a74..106c3c390 100644 --- a/demos/AVR-AT90CANx-GCC/Makefile +++ b/demos/AVR-AT90CANx-GCC/Makefile @@ -80,8 +80,14 @@ OBJDIR = . # List C source files here. (C dependencies are automatically generated.) -SRC = ./main.c ./chcore.c ../../src/chinit.c ../../src/chlists.c ../../src/chdelta.c ../../src/chschd.c ../../src/chthreads.c ../../src/chsem.c ../../src/chevents.c ../../src/chmsg.c ../../src/chsleep.c ../../src/chqueues.c ../../src/chserial.c - +SRC = ../../ports/AVR/chcore.c ../../ports/AVR/avr_serial.c \ + ../../src/chinit.c ../../src/chdebug.c ../../src/chlists.c ../../src/chdelta.c \ + ../../src/chschd.c ../../src/chthreads.c ../../src/chsem.c ../../src/chmtx.c \ + ../../src/chevents.c ../../src/chmsg.c ../../src/chsleep.c ../../src/chqueues.c \ + ../../src/chserial.c \ + ../../src/lib/evtimer.c \ + ../../test/test.c \ + board.c main.c # List C++ source files here. (C dependencies are automatically generated.) @@ -95,7 +101,7 @@ CPPSRC = # Even though the DOS/Win* filesystem matches both .s and .S the same, # it will preserve the spelling of the filenames, and gcc itself does # care about how the name is spelled on its command-line. -ASRC = ./chcore2.S +ASRC = # Optimization level, can be [0, 1, 2, 3, s]. @@ -115,7 +121,7 @@ DEBUG = dwarf-2 # Each directory must be seperated by a space. # Use forward slashes for directory separators. # For a directory that has spaces, enclose it in quotes. -EXTRAINCDIRS = ../../src/include +EXTRAINCDIRS = ../../src/include ../../src/lib ../../ports/AVR # Compiler flag to set the C Standard level. @@ -402,12 +408,13 @@ ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) all: begin gccversion sizebefore build sizeafter end # Change the build target to build a HEX file or a library. -build: elf hex eep lss sym +build: elf hex bin eep lss sym #build: lib elf: $(TARGET).elf hex: $(TARGET).hex +bin: $(TARGET).bin eep: $(TARGET).eep lss: $(TARGET).lss sym: $(TARGET).sym @@ -512,6 +519,11 @@ extcoff: $(TARGET).elf @echo $(MSG_FLASH) $@ $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ +%.bin: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O binary -R .eeprom $< $@ + %.eep: %.elf @echo @echo $(MSG_EEPROM) $@ @@ -593,6 +605,7 @@ clean_list : @echo @echo $(MSG_CLEANING) $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).bin $(REMOVE) $(TARGET).eep $(REMOVE) $(TARGET).cof $(REMOVE) $(TARGET).elf @@ -617,7 +630,7 @@ $(shell mkdir $(OBJDIR) 2>/dev/null) # Listing of phony targets. .PHONY : all begin finish end sizebefore sizeafter gccversion \ -build elf hex eep lss sym coff extcoff \ +build elf hex bin eep lss sym coff extcoff \ clean clean_list program debug gdb-config diff --git a/demos/AVR-AT90CANx-GCC/board.c b/demos/AVR-AT90CANx-GCC/board.c new file mode 100644 index 000000000..e78360e9a --- /dev/null +++ b/demos/AVR-AT90CANx-GCC/board.c @@ -0,0 +1,87 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +#include +#include + +#include "board.h" +#include "avr_serial.h" + +ISR(TIMER0_COMP_vect) { + + chSysIRQEnterI(); + + chSysTimerHandlerI(); + + chSysIRQExitI(); +} + +/* + * Board initialization code. + */ +void hwinit(void) { + + /* + * I/O ports setup. + */ + DDRA = VAL_DDRA; + PORTA = VAL_PORTA; + DDRB = VAL_DDRB; + PORTB = VAL_PORTB; + DDRC = VAL_DDRC; + PORTC = VAL_PORTC; + DDRD = VAL_DDRD; + PORTD = VAL_PORTD; + DDRE = VAL_DDRE; + PORTE = VAL_PORTE; + DDRF = VAL_DDRF; + PORTF = VAL_PORTF; + DDRG = VAL_DDRG; + PORTG = VAL_PORTG; + + /* + * External interrupts setup, all disabled initially. + */ + EICRA = 0x00; + EICRB = 0x00; + EIMSK = 0x00; + + /* + * Enables Idle mode for SLEEP instruction. + */ + SMCR = (1 << SE); + + /* + * Timer 0 setup. + */ + TCCR0A = (1 << WGM01) | (0 << WGM00) | // CTC mode. + (0 << COM0A1) | (0 << COM0A0) | // OC0A disabled (normal I/O). + (0 << CS02) | (1 << CS01) | (1 << CS00); // CLK/64 clock source. + OCR0A = F_CPU / 64 / CH_FREQUENCY - 1; + TCNT0 = 0; // Reset counter. + TIFR0 = (1 << OCF0A); // Reset pending (if any). + TIMSK0 = (1 << OCIE0A); // Interrupt on compare. + + /* + * Other initializations. + */ + InitSerial(); +} diff --git a/demos/AVR-AT90CANx-GCC/board.h b/demos/AVR-AT90CANx-GCC/board.h new file mode 100644 index 000000000..fefd6a39c --- /dev/null +++ b/demos/AVR-AT90CANx-GCC/board.h @@ -0,0 +1,86 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _BOARD_H_ +#define _BOARD_H_ + +#define BOARD_OLIMEX_AVR_CAN + +/* + * All inputs with pullups. + */ +#define VAL_DDRA 0x00 +#define VAL_PORTA 0xFF + +/* + * All inputs with pullups. + */ +#define VAL_DDRB 0x00 +#define VAL_PORTB 0xFF + +/* + * All inputs with pullups. + */ +#define VAL_DDRC 0x00 +#define VAL_PORTC 0xFF + +/* PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0 + * IN IN OUT IN OUT IN IN IN + * DDRD 0 0 1 0 1 0 0 0 + * PU HiZ VAL PU VAL HiZ HiZ HiZ + * PORTD 1 0 ?1 1 1 0 0 0 + */ +#define VAL_DDRD 0x28 +#define VAL_PORTD 0xB8 + +/* PE7 PE6 BUT LED PE3 PE2 PE1 PE0 + * IN IN IN OUT IN IN OUT IN + * DDRE 0 0 0 1 0 0 1 0 + * PU PU HiZ VAL PU PU VAL HiZ + * PORTE 1 1 0 1 1 1 1 0 + */ +#define VAL_DDRE 0x12 +#define VAL_PORTE 0xDE + +/* TDI TDO TMS TCK PF3 PF2 PF1 PF0 + * x x x x IN IN IN IN + * DDRF 0 0 0 0 0 0 0 0 + * x x x x PU PU PU PU + * PORTF 0 0 0 0 1 1 1 1 + * + */ +#define VAL_DDRF 0x00 +#define VAL_PORTF 0x0F + +/* x x x x x PG2 PG1 PG0 + * x x x x x IN IN IN + * DDRG 0 0 0 0 0 0 0 0 + * x x x x x PU PU PU + * PORTG 0 0 0 0 0 1 1 1 + * + */ +#define VAL_DDRG 0x00 +#define VAL_PORTG 0x07 + +#define PORTE_LED (1 << 4) +#define PORTE_BUTTON (1 << 5) + +void hwinit(void); + +#endif /* _BOARD_H_ */ diff --git a/demos/AVR-AT90CANx-GCC/chconf.h b/demos/AVR-AT90CANx-GCC/chconf.h index 162255af5..17c2c3d38 100644 --- a/demos/AVR-AT90CANx-GCC/chconf.h +++ b/demos/AVR-AT90CANx-GCC/chconf.h @@ -17,6 +17,10 @@ along with this program. If not, see . */ +/* + * Configuration file for LPC214x-GCC demo project. + */ + /** * @addtogroup Config * @{ @@ -25,15 +29,10 @@ #ifndef _CHCONF_H_ #define _CHCONF_H_ -/* - * NOTE: this is just documentation for doxigen, the real configuration file - * is the one into the project directories. - */ - /** Configuration option: if specified then time efficient rather than space * efficient code is used when two possible implementations exist, note * that this is not related to the compiler optimization options.*/ -//#define CH_OPTIMIZE_SPEED +#define CH_OPTIMIZE_SPEED /** Configuration option: if specified then the Virtual Timers subsystem is * included in the kernel.*/ @@ -151,9 +150,9 @@ * on processors with many registers like ARM cores. * @note If this option is enabled then ALL the libraries linked to the * ChibiOS/RT code must be recompiled with the GCC option \p - * -ffixed-\. + * -ffixed-. */ -//#define CH_CURRP_REGISTER_CACHE "reg" +//#define CH_CURRP_REGISTER_CACHE "r8" /** Configuration option: Includes basic debug support to the kernel. * @note the debug support is port-dependent, it may be not present on some diff --git a/demos/AVR-AT90CANx-GCC/chcore.c b/demos/AVR-AT90CANx-GCC/chcore.c deleted file mode 100644 index 3bc5b027e..000000000 --- a/demos/AVR-AT90CANx-GCC/chcore.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include - -#include - -/* - * All inputs with pullups. - */ -#define VAL_DDRA 0x00 -#define VAL_PORTA 0xFF - -/* - * All inputs with pullups. - */ -#define VAL_DDRB 0x00 -#define VAL_PORTB 0xFF - -/* - * All inputs with pullups. - */ -#define VAL_DDRC 0x00 -#define VAL_PORTC 0xFF - -/* PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0 - * IN IN OUT IN OUT IN IN IN - * DDRD 0 0 1 0 1 0 0 0 - * PU HiZ VAL PU VAL HiZ HiZ HiZ - * PORTD 1 0 ?1 1 1 0 0 0 - */ -#define VAL_DDRD 0x28 -#define VAL_PORTD 0xB8 - -/* PE7 PE6 BUT LED PE3 PE2 PE1 PE0 - * IN IN IN OUT IN IN OUT IN - * DDRE 0 0 0 1 0 0 1 0 - * PU PU HiZ VAL PU PU VAL HiZ - * PORTE 1 1 0 1 1 1 1 0 - */ -#define VAL_DDRE 0x12 -#define VAL_PORTE 0xDE - -/* TDI TDO TMS TCK PF3 PF2 PF1 PF0 - * x x x x IN IN IN IN - * DDRF 0 0 0 0 0 0 0 0 - * x x x x PU PU PU PU - * PORTF 0 0 0 0 1 1 1 1 - * - */ -#define VAL_DDRF 0x00 -#define VAL_PORTF 0x0F - -/* x x x x x PG2 PG1 PG0 - * x x x x x IN IN IN - * DDRG 0 0 0 0 0 0 0 0 - * x x x x x PU PU PU - * PORTG 0 0 0 0 0 1 1 1 - * - */ -#define VAL_DDRG 0x00 -#define VAL_PORTG 0x07 - -void hwinit(void) { - - /* - * I/O ports setup. - */ - DDRA = VAL_DDRA; - PORTA = VAL_PORTA; - DDRB = VAL_DDRB; - PORTB = VAL_PORTB; - DDRC = VAL_DDRC; - PORTC = VAL_PORTC; - DDRD = VAL_DDRD; - PORTD = VAL_PORTD; - DDRE = VAL_DDRE; - PORTE = VAL_PORTE; - DDRF = VAL_DDRF; - PORTF = VAL_PORTF; - DDRG = VAL_DDRG; - PORTG = VAL_PORTG; - - /* - * External interrupts setup, all disabled initially. - */ - EICRA = 0x00; - EICRB = 0x00; - EIMSK = 0x00; - - /* - * Enables Idle mode for SLEEP instruction. - */ - SMCR = 1; - - /* - * Timer 0 setup. - */ - TCCR0A = (1 << WGM01) | (0 << WGM00) | // CTC mode. - (0 << COM0A1) | (0 << COM0A0) | // OC0A disabled (normal I/O). - (0 << CS02) | (1 << CS01) | (1 << CS00); // CLK/64 clock source. - OCR0A = F_CPU / 64 / CH_FREQUENCY - 1; - TCNT0 = 0; // Reset counter. - TIFR0 = (1 << OCF0A); // Reset pending (if any). - TIMSK0 = (1 << OCIE0A); // Interrupt on compare. -} - -void _IdleThread(void *p) { - - while (TRUE) { -// asm volatile ("sleep"); - } -} - -void chSysHalt(void) { - - chSysLock(); - - while (TRUE) - ; -} diff --git a/demos/AVR-AT90CANx-GCC/chcore.h b/demos/AVR-AT90CANx-GCC/chcore.h deleted file mode 100644 index 9e1b95db8..000000000 --- a/demos/AVR-AT90CANx-GCC/chcore.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @addtogroup Core - * @{ - */ - -#ifndef _CHCORE_H_ -#define _CHCORE_H_ - -/* - * Interrupt saved context. - */ -struct extctx { - BYTE8 sr; - BYTE8 r31; - BYTE8 r30; - BYTE8 r27; - BYTE8 r26; - BYTE8 r25; - BYTE8 r24; - BYTE8 r23; - BYTE8 r22; - BYTE8 r21; - BYTE8 r20; - BYTE8 r19; - BYTE8 r18; - BYTE8 r1; - BYTE8 r0; - UWORD16 pc; -}; - -/* - * System saved context. - */ -struct intctx { - BYTE8 r29; - BYTE8 r28; - BYTE8 r17; - BYTE8 r16; - BYTE8 r15; - BYTE8 r14; - BYTE8 r13; - BYTE8 r12; - BYTE8 r11; - BYTE8 r10; - BYTE8 r9; - BYTE8 r8; - BYTE8 r7; - BYTE8 r6; - BYTE8 r5; - BYTE8 r4; - BYTE8 r3; - BYTE8 r2; - UWORD16 pc; -}; - -/* - * Port dependent part of the Thread structure, you may add fields in - * this structure. - */ -typedef struct { - struct intctx *sp; -} Context; - -/** - * Platform dependent part of the \p chThdCreate() API. - */ -#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \ - tp->p_ctx.sp--; \ - tp->p_ctx.sp->r2 = (int)pf; \ - tp->p_ctx.sp->r3 = (int)pf >> 8; \ - tp->p_ctx.sp->r4 = (int)arg; \ - tp->p_ctx.sp->r5 = (int)arg >> 8; \ - tp->p_ctx.sp->pc = (UWORD16)threadstart; \ -} - -#define INT_REQUIRED_STACK 0x10 -#define StackAlign(n) (n) -#define UserStackSize(n) StackAlign(sizeof(Thread) + \ - sizeof(struct intctx) + \ - sizeof(struct extctx) + \ - (n) + (INT_REQUIRED_STACK)) -#define WorkingArea(s, n) BYTE8 s[UserStackSize(n)]; - -#define chSysLock() asm("cli") -#define chSysUnlock() asm("sei") -#define chSysPuts(msg) {} - -#define IDLE_THREAD_STACK_SIZE 8 -void _IdleThread(void *p) __attribute__((noreturn)); - -void chSysHalt(void) __attribute__((noreturn)) ; -void chSysSwitchI(Context *oldp, Context *newp); -void threadstart(void); - -#endif /* _CHCORE_H_ */ - -/** @} */ diff --git a/demos/AVR-AT90CANx-GCC/chcore2.S b/demos/AVR-AT90CANx-GCC/chcore2.S deleted file mode 100644 index 96c17f011..000000000 --- a/demos/AVR-AT90CANx-GCC/chcore2.S +++ /dev/null @@ -1,123 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include - -.global threadstart -threadstart: - sei - movw r24, r4 // argument - movw r30, r2 // thread function - icall - call chThdExit - -.global chSysSwitchI -chSysSwitchI: - push r2 - push r3 - push r4 - push r5 - push r6 - push r7 - push r8 - push r9 - push r10 - push r11 - push r12 - push r13 - push r14 - push r15 - push r16 - push r17 - push r28 - push r29 - movw r30, r24 // Z <- oldp - in r0, _SFR_IO_ADDR(SPL) - st Z, r0 - in r0, _SFR_IO_ADDR(SPH) - std Z+1, r0 - - movw r30, r22 // Z <- newp - ld r0, Z - out _SFR_IO_ADDR(SPL), r0 - ldd r0, Z+1 - out _SFR_IO_ADDR(SPH), r0 - pop r29 - pop r28 - pop r17 - pop r16 - pop r15 - pop r14 - pop r13 - pop r12 - pop r11 - pop r10 - pop r9 - pop r8 - pop r7 - pop r6 - pop r5 - pop r4 - pop r3 - pop r2 - ret - -.global __vector_17 -__vector_17: - push r0 - push r1 - push r18 - push r19 - push r20 - push r21 - push r22 - push r23 - push r24 - push r25 - push r26 - push r27 - push r30 - push r31 - in r0, _SFR_IO_ADDR(SREG) - push r0 - clr r1 - call chSysTimerHandlerI -intcommon: - call chSchRescRequiredI - tst r24 - breq noschd - call chSchDoRescheduleI -noschd: - pop r0 - out _SFR_IO_ADDR(SREG), r0 - pop r31 - pop r30 - pop r27 - pop r26 - pop r25 - pop r24 - pop r23 - pop r22 - pop r21 - pop r20 - pop r19 - pop r18 - pop r1 - pop r0 - reti diff --git a/demos/AVR-AT90CANx-GCC/chtypes.h b/demos/AVR-AT90CANx-GCC/chtypes.h deleted file mode 100644 index 60e16aaf4..000000000 --- a/demos/AVR-AT90CANx-GCC/chtypes.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifndef _CHTYPES_H_ -#define _CHTYPES_H_ - -/* - * Generic types often dependant on the compiler. - */ -#define BOOL char -#define BYTE8 unsigned char -#define SBYTE8 signed char -#define WORD16 int -#define UWORD16 unsigned int -#define LONG32 long -#define ULONG32 unsigned long -#define PTR_EQ int - -typedef BYTE8 t_tmode; -typedef BYTE8 t_tstate; -typedef BYTE8 t_tid; -typedef BYTE8 t_prio; -typedef WORD16 t_msg; -typedef BYTE8 t_eventid; -typedef BYTE8 t_eventmask; -typedef UWORD16 t_time; -typedef SBYTE8 t_cnt; -typedef UWORD16 t_size; - -#define INLINE inline - -#endif /* _CHTYPES_H_ */ diff --git a/demos/AVR-AT90CANx-GCC/main.c b/demos/AVR-AT90CANx-GCC/main.c index 14c45cf47..2379b670f 100644 --- a/demos/AVR-AT90CANx-GCC/main.c +++ b/demos/AVR-AT90CANx-GCC/main.c @@ -18,21 +18,38 @@ */ #include +#include +#include #include +#include "board.h" + void hwinit(void); static WorkingArea(waThread1, 32); -static t_msg Thread1(void *arg) { +static msg_t Thread1(void *arg) { while (TRUE) { - chThdSleep(800); + PORTE ^= PORTE_LED; + chThdSleep(500); } return 0; } +static void TimerHandler(eventid_t id) { + msg_t TestThread(void *p); + + if (!(PORTE & PORTE_BUTTON)) + TestThread(&SER2); +} + int main(int argc, char **argv) { + static EvTimer evt; + static evhandler_t handlers[1] = { + TimerHandler + }; + static EventListener el0; hwinit(); @@ -42,13 +59,20 @@ int main(int argc, char **argv) { */ chSysInit(); + /* + * Event Timer initialization. + */ + evtInit(&evt, 500); /* Initializes an event timer object. */ + evtStart(&evt); /* Starts the event timer. */ + chEvtRegister(&evt.et_es, &el0, 0); /* Registers on the timer event source. */ + /* * Starts the LED blinker thread. */ chThdCreate(NORMALPRIO, 0, waThread1, sizeof(waThread1), Thread1, NULL); while(TRUE) - /* Do stuff*/ ; + chEvtWait(ALL_EVENTS, handlers); return 0; } diff --git a/demos/AVR-AT90CANx-GCC/readme.txt b/demos/AVR-AT90CANx-GCC/readme.txt new file mode 100644 index 000000000..3102bcf15 --- /dev/null +++ b/demos/AVR-AT90CANx-GCC/readme.txt @@ -0,0 +1,25 @@ +***************************************************************************** +** ChibiOS/RT port for Atmel AVR AT90CAN128. ** +***************************************************************************** + +** TARGET ** + +The demo runs on an Olimex AVR-CAN board. + +** The Demo ** + +The demo currently just flashes the board LED using a thread. It will be +expanded in next releases. +By pressing the board button the test suite is activated, output on serial +port 2. + +** Build Procedure ** + +The demo was built using the WinAVR toolchain. + +** Notes ** + +The demo requires include files from WinAVR that are not part of the ChibiOS/RT +distribution, please install WinAVR. + + http://winavr.sourceforge.net/ diff --git a/demos/AVR-ATmega128-GCC/readme.txt b/demos/AVR-ATmega128-GCC/readme.txt index b580dbc6e..1c6ab3c5d 100644 --- a/demos/AVR-ATmega128-GCC/readme.txt +++ b/demos/AVR-ATmega128-GCC/readme.txt @@ -1,5 +1,5 @@ ***************************************************************************** -** ChibiOS/RT port for Atmel AVRmega128. ** +** ChibiOS/RT port for Atmel AVR ATmega128. ** ***************************************************************************** ** TARGET ** @@ -10,6 +10,7 @@ The demo runs on an Olimex AVR-MT-128 board. The demo currently just toggles the relay using a thread. It will be expanded in next releases. +By pressing the button 1 the test suite is activated, output on serial port 2. ** Build Procedure ** diff --git a/readme.txt b/readme.txt index ff827878b..e903f4ddf 100644 --- a/readme.txt +++ b/readme.txt @@ -42,8 +42,7 @@ AVR-AVRmega128-GCC - Port on AVRmega128, experimental. A special thanks to Vladimir for the work done on the AVR port. The demo program targets the Olimex AVR-MT-128 mini terminal board. -AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not complete yet, scheduled - for a complete rewrite. +AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not tested on hardware yet. ***************************************************************************** *** Plans *** @@ -72,9 +71,10 @@ AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not complete yet, scheduled the size_t type defined into stddef.h. Some type names were modified in order to not match commonly used type names. - The above changes have an impact on some API prototypes but we can't help - it, the change was required because the type names were the main concern of + it, the change was required because the type names were a concern for some users. - Implemented a serial driver in the AVR port. +- Reworked the AVR AT90CAN128 port to share the common AVR code. - Modified the test suite to be compatible with 8 bit micros. - MSVC demo dropped, it is still possible to use the MinGW demo as simulator in Win32. -- cgit v1.2.3