# HG changeset patch # User etisserant # Date 1201789259 -3600 # Node ID 03fb0bfccc1fdb5daf3c92b3d1726b0f58296d2e # Parent b74f7ec412fc14b2bdb0da309bcd2da398d19814 AVR port, thanks to Peter Christen, Comat AG. diff -r b74f7ec412fc -r 03fb0bfccc1f drivers/AVR/can_AVR.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/AVR/can_AVR.c Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,229 @@ +/* +This file is part of CanFestival, a library implementing CanOpen Stack. + +Copyright (C): Edouard TISSERANT and Francis DUPIN +AVR Port: Andreas GLAUSER and Peter CHRISTEN + +See COPYING file for copyrights details. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library 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 +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +//#define DEBUG_WAR_CONSOLE_ON +//#define DEBUG_ERR_CONSOLE_ON + +#include "can_AVR.h" +#include "canfestival.h" + +volatile unsigned char msg_received = 0; + +unsigned char canInit(unsigned int bitrate) +/****************************************************************************** +Initialize the hardware to receive CAN messages and start the timer for the +CANopen stack. +INPUT bitrate bitrate in kilobit +OUTPUT 1 if successful +******************************************************************************/ +{ + unsigned char i,k; + //- Pull-up on TxCAN & RxCAN one by one to use bit-addressing + CAN_PORT_DIR &= ~(1< CAN frame +******************************************************************************/ +{ + unsigned char i; + + for (i = START_TX_MOB; i < NB_MOB; i++) // Search the first free MOb + { + Can_set_mob(i); // Change to MOb + if ((CANCDMOB & CONMOB_MSK) == 0) // MOb disabled = free + { + break; + } + } + if (i < NB_MOB) // free MOb found + { + Can_set_mob(i); // Switch to the sending messagebox + Can_set_std_id(m->cob_id); // Set cob id + if (m->rtr) // Set remote transmission request + Can_set_rtr(); + Can_set_dlc(m->len); // Set data lenght code + + for (i= 0; i < (m->len); i++) // Add data bytes to the MOb + CANMSG = m->data[i]; + // Start sending by writing the MB configuration register to transmit + Can_config_tx(); // Set the last MOb to transmit mode + return 1; // succesful + } + else + return 0; // not succesful +} + +unsigned char canReceive(Message *m) +/****************************************************************************** +The driver pass a received CAN message to the stack +INPUT Message *m pointer to received CAN message +OUTPUT 1 if a message received +******************************************************************************/ +{ + unsigned char i; + + if (msg_received == 0) + return 0; // Nothing received + + for (i = 0; i < NB_RX_MOB; i++) // Search the first MOb received + { + Can_set_mob(i); // Change to MOb + if ((CANCDMOB & CONMOB_MSK) == 0) // MOb disabled = received + { + msg_received--; + break; + } + } + if (i < NB_RX_MOB) // message found + { + Can_get_std_id(m->cob_id); // Get cob id + m->rtr = Can_get_rtr(); // Get remote transmission request + m->len = Can_get_dlc(); // Get data lenght code + for (i= 0; i < (m->len); i++) // get data bytes from the MOb + m->data[i] = CANMSG; + Can_config_rx_buffer(); // reset the MOb for receive + return 1; // message received + } + else // no message found + { + msg_received = 0; // reset counter + return 0; // no message received + } +} + +#ifdef __IAR_SYSTEMS_ICC__ +#pragma type_attribute = __interrupt +#pragma vector=CANIT_vect +void CANIT_interrupt(void) +#else // GCC +ISR(CANIT_vect) +#endif // GCC +/****************************************************************************** +CAN Interrupt +******************************************************************************/ +{ + unsigned char i; + + if (CANGIT & (1 << CANIT)) // is a messagebox interrupt + { + if ((CANSIT1 & TX_INT_MSK) == 0) // is a Rx interrupt + { + for (i = 0; (i < NB_RX_MOB) && (CANGIT & (1 << CANIT)); i++) // Search the first MOb received + { + Can_set_mob(i); // Change to MOb + if (CANSTMOB & MOB_RX_COMPLETED) // receive ok + { + Can_clear_status_mob(); // Clear status register + Can_mob_abort(); // disable the MOb = received + msg_received++; + } + else if (CANSTMOB & ~MOB_RX_COMPLETED) // error + { + Can_clear_status_mob(); // Clear status register + Can_config_rx_buffer(); // reconfigure as receive buffer + } + } + } + else // is a Tx interrupt + { + for (i = NB_RX_MOB; i < NB_MOB; i++) // Search the first MOb transmitted + { + Can_set_mob(i); // change to MOb + if (CANSTMOB) // transmission ok or error + { + Can_clear_status_mob(); // clear status register + CANCDMOB = 0; // disable the MOb + break; + } + } + } + } + + // Bus Off Interrupt Flag + if (CANGIT & (1 << BOFFIT)) // Finaly clear the interrupt status register + { + CANGIT |= (1 << BOFFIT); // Clear the interrupt flag + } + else + CANGIT |= (1 << BXOK) | (1 << SERG) | (1 << CERG) | (1 << FERG) | (1 << AERG);// Finaly clear other interrupts +} + +#ifdef __IAR_SYSTEMS_ICC__ +#pragma type_attribute = __interrupt +#pragma vector=OVRIT_vect +void OVRIT_interrupt(void) +#else // GCC +ISR(OVRIT_vect) +#endif // GCC +/****************************************************************************** +CAN Timer Interrupt +******************************************************************************/ +{ + CANGIT |= (1 << OVRTIM); +} + diff -r b74f7ec412fc -r 03fb0bfccc1f drivers/AVR/timer_AVR.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/AVR/timer_AVR.c Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,93 @@ +/* +This file is part of CanFestival, a library implementing CanOpen Stack. + +Copyright (C): Edouard TISSERANT and Francis DUPIN +AVR Port: Andreas GLAUSER and Peter CHRISTEN + +See COPYING file for copyrights details. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library 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 +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +// AVR implementation of the CANopen timer driver, uses Timer 3 (16 bit) + +// Includes for the Canfestival driver +#include "canfestival.h" +#include "timer.h" + +// Define the timer registers +#define TimerAlarm OCR3B +#define TimerCounter TCNT3 + +/************************** Modul variables **********************************/ +// Store the last timer value to calculate the elapsed time +static TIMEVAL last_time_set = TIMEVAL_MAX; + +void initTimer(void) +/****************************************************************************** +Initializes the timer, turn on the interrupt and put the interrupt time to zero +INPUT void +OUTPUT void +******************************************************************************/ +{ + TimerAlarm = 0; // Set it back to the zero + // Set timer 3 for CANopen operation tick 8us max, time is 524ms + TCCR3B = 1 << CS31 | 1 << CS30; // Timer 3 normal, mit CK/64 + TIMSK3 = 1 << OCIE3B; // Enable the interrupt +} + +void setTimer(TIMEVAL value) +/****************************************************************************** +Set the timer for the next alarm. +INPUT value TIMEVAL (unsigned long) +OUTPUT void +******************************************************************************/ +{ + TimerAlarm += (int)value; // Add the desired time to timer interrupt time +} + +TIMEVAL getElapsedTime(void) +/****************************************************************************** +Return the elapsed time to tell the Stack how much time is spent since last call. +INPUT void +OUTPUT value TIMEVAL (unsigned long) the elapsed time +******************************************************************************/ +{ + unsigned int timer = TimerCounter; // Copy the value of the running timer + if (timer > last_time_set) // In case the timer value is higher than the last time. + return (timer - last_time_set); // Calculate the time difference + else if (timer < last_time_set) + return (last_time_set - timer); // Calculate the time difference + else + return TIMEVAL_MAX; +} + +#ifdef __IAR_SYSTEMS_ICC__ +#pragma type_attribute = __interrupt +#pragma vector=TIMER3_COMPB_vect +void TIMER3_COMPB_interrupt(void) +#else // GCC +ISR(TIMER3_COMPB_vect) +#endif // GCC +/****************************************************************************** +Interruptserviceroutine Timer 3 Compare B for the CAN timer +******************************************************************************/ +{ + last_time_set = TimerCounter; + TimeDispatch(); // Call the time handler of the stack to adapt the elapsed time +} + + + diff -r b74f7ec412fc -r 03fb0bfccc1f examples/AVR/DS401_Slave/GCC/SlaveAVR.aps --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/AVR/DS401_Slave/GCC/SlaveAVR.aps Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,1 @@ +SlaveAVR16-Dec-2007 22:17:1029-Jan-2008 17:17:04241016-Dec-2007 22:17:1044, 13, 0, 528AVR GCCdefault\SlaveAVR.elfI:\Entwicklung\Firmware\CAN\CanFestival-3\examples\AVR\DS401_Slave\GCC\JTAGICE mkIIAT90CAN128falseR00R01R02R03R04R05R06R07R08R09R10R11R12R13R14R15R16R17R18R19R20R21R22R23R24R25R26R27R28R29R30R31Auto00msg_receivedipExpectedSizepExpectedSize0I:\Entwicklung\Firmware\CAN\CanFestival-3\drivers\AVR\can_AVR.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\dcf.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\timer.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\emcy.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\lifegrd.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\nmtSlave.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\objacces.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\pdo.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\sdo.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\states.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\sync.cI:\Entwicklung\Firmware\CAN\CanFestival-3\examples\AVR\DS401_Slave\ObjDict.cI:\Entwicklung\Firmware\CAN\CanFestival-3\examples\AVR\DS401_Slave\main.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\nmtMaster.cI:\Entwicklung\Firmware\CAN\CanFestival-3\drivers\AVR\timer_AVR.cI:\Entwicklung\Firmware\CAN\CanFestival-3\include\AVR\can_AVR.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\AVR\applicfg.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\AVR\canfestival.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\can.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\data.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\dcf.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\def.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\emcy.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\lifegrd.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\nmtMaster.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\nmtSlave.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\objacces.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\objdictdef.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\pdo.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\sdo.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\states.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\sync.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\sysdep.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\timer.hI:\Entwicklung\Firmware\CAN\CanFestival-3\examples\AVR\DS401_Slave\ObjDict.hI:\Entwicklung\Firmware\CAN\CanFestival-3\examples\AVR\DS401_Slave\hardware.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\AVR\timerscfg.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\AVR\can_drv.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\AVR\config.hdefault\SlaveAVR.mapdefault\SlaveAVR.lssdefaultNOat90can128111SlaveAVR.elfdefault\0..\..\..\..\include\AVR\.\..\..\..\..\include\-Wall -gdwarf-2 -Os -fsigned-char -fpack-structdefault1C:\programme\WinAVR\bin\avr-gcc.exeC:\programme\WinAVR\utils\bin\make.exe000001920080000000100011main20138561238000000011I:\Entwicklung\Firmware\CAN\CanFestival-3\include\AVR\can_AVR.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\AVR\applicfg.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\AVR\canfestival.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\can.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\data.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\dcf.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\def.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\emcy.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\lifegrd.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\nmtMaster.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\nmtSlave.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\objacces.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\objdictdef.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\pdo.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\sdo.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\states.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\sync.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\sysdep.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\timer.hI:\Entwicklung\Firmware\CAN\CanFestival-3\examples\AVR\DS401_Slave\ObjDict.hI:\Entwicklung\Firmware\CAN\CanFestival-3\examples\AVR\DS401_Slave\hardware.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\AVR\timerscfg.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\AVR\can_drv.hI:\Entwicklung\Firmware\CAN\CanFestival-3\include\AVR\config.hI:\Entwicklung\Firmware\CAN\CanFestival-3\drivers\AVR\can_AVR.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\dcf.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\timer.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\emcy.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\lifegrd.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\nmtSlave.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\objacces.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\pdo.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\sdo.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\states.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\sync.cI:\Entwicklung\Firmware\CAN\CanFestival-3\examples\AVR\DS401_Slave\ObjDict.cI:\Entwicklung\Firmware\CAN\CanFestival-3\examples\AVR\DS401_Slave\main.cI:\Entwicklung\Firmware\CAN\CanFestival-3\src\nmtMaster.cI:\Entwicklung\Firmware\CAN\CanFestival-3\drivers\AVR\timer_AVR.c00000I:\Entwicklung\Firmware\CAN\CanFestival-3\include\AVR\canfestival.h100001I:\Entwicklung\Firmware\CAN\CanFestival-3\include\AVR\applicfg.h100002I:\Entwicklung\Firmware\CAN\CanFestival-3\include\AVR\timerscfg.h100003I:\Entwicklung\Firmware\CAN\CanFestival-3\include\can.h100004I:\Entwicklung\Firmware\CAN\CanFestival-3\include\AVR\can_AVR.h100005i:\entwicklung\Firmware\CAN\canfestival-3\drivers\AVR\can_AVR.c100006I:\Entwicklung\Firmware\CAN\CanFestival-3\examples\AVR\DS401_Slave\main.c100007i:\entwicklung\Firmware\CAN\canfestival-3\src\timer.c100008I:\Entwicklung\Firmware\CAN\CanFestival-3\include\timer.h100009I:\Entwicklung\Firmware\CAN\CanFestival-3\src\sdo.c100010I:\Entwicklung\Firmware\CAN\CanFestival-3\drivers\AVR\timer_AVR.c1 diff -r b74f7ec412fc -r 03fb0bfccc1f examples/AVR/DS401_Slave/GCC/default/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/AVR/DS401_Slave/GCC/default/Makefile Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,120 @@ +############################################################################### +# Makefile for the project SlaveAVR +############################################################################### + +## General Flags +PROJECT = SlaveAVR +MCU = at90can128 +TARGET = SlaveAVR.elf +CC = avr-gcc.exe + +## Options common to compile, link and assembly rules +COMMON = -mmcu=$(MCU) + +## Compile options common for all C compilation units. +CFLAGS = $(COMMON) +CFLAGS += -Wall -gdwarf-2 -Os -fsigned-char -fpack-struct +CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d + +## Assembly specific flags +ASMFLAGS = $(COMMON) +ASMFLAGS += $(CFLAGS) +ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2 + +## Linker flags +LDFLAGS = $(COMMON) +LDFLAGS += -Wl,-Map=SlaveAVR.map + + +## Intel Hex file production flags +HEX_FLASH_FLAGS = -R .eeprom + +HEX_EEPROM_FLAGS = -j .eeprom +HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load" +HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings + + +## Include Directories +INCLUDES = -I"I:\Entwicklung\Firmware\CAN\CanFestival-3\examples\AVR\DS401_Slave\GCC\..\..\..\..\include\AVR" -I"I:\Entwicklung\Firmware\CAN\CanFestival-3\examples\AVR\DS401_Slave\GCC\." -I"I:\Entwicklung\Firmware\CAN\CanFestival-3\examples\AVR\DS401_Slave\GCC\..\..\..\..\include" + +## Objects that must be built in order to link +OBJECTS = can_AVR.o dcf.o timer.o emcy.o lifegrd.o nmtSlave.o objacces.o pdo.o sdo.o states.o sync.o ObjDict.o main.o nmtMaster.o timer_AVR.o + +## Objects explicitly added by the user +LINKONLYOBJECTS = + +## Build +all: $(TARGET) SlaveAVR.hex SlaveAVR.eep SlaveAVR.lss size + +## Compile +can_AVR.o: ../../../../../drivers/AVR/can_AVR.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +dcf.o: ../../../../../src/dcf.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +timer.o: ../../../../../src/timer.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +emcy.o: ../../../../../src/emcy.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +lifegrd.o: ../../../../../src/lifegrd.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +nmtSlave.o: ../../../../../src/nmtSlave.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +objacces.o: ../../../../../src/objacces.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +pdo.o: ../../../../../src/pdo.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +sdo.o: ../../../../../src/sdo.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +states.o: ../../../../../src/states.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +sync.o: ../../../../../src/sync.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +ObjDict.o: ../../ObjDict.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +main.o: ../../main.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +nmtMaster.o: ../../../../../src/nmtMaster.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +timer_AVR.o: ../../../../../drivers/AVR/timer_AVR.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +##Link +$(TARGET): $(OBJECTS) + $(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET) + +%.hex: $(TARGET) + avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $< $@ + +%.eep: $(TARGET) + -avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@ || exit 0 + +%.lss: $(TARGET) + avr-objdump -h -S $< > $@ + +size: ${TARGET} + @echo + @avr-size -C --mcu=${MCU} ${TARGET} + +## Clean target +.PHONY: clean +clean: + -rm -rf $(OBJECTS) SlaveAVR.elf dep/* SlaveAVR.hex SlaveAVR.eep SlaveAVR.lss SlaveAVR.map + + +## Other dependencies +-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*) + diff -r b74f7ec412fc -r 03fb0bfccc1f examples/AVR/DS401_Slave/GCC/slaveavr.aws --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/AVR/DS401_Slave/GCC/slaveavr.aws Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,1 @@ + diff -r b74f7ec412fc -r 03fb0bfccc1f examples/AVR/DS401_Slave/IAR/Exe/SlaveAVR_dbg.aps --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/AVR/DS401_Slave/IAR/Exe/SlaveAVR_dbg.aps Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,1 @@ +SlaveAVR_dbg03-Jan-2008 22:16:1703-Jan-2008 22:18:36Object.bmp103-Jan-2008 22:16:1744, 13, 0, 528SlaveAVR.dbgC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\examples\AVR\DS401_Slave\IAR\Exe\JTAGICE mkIIAT90CAN128falseR00R01R02R03R04R05R06R07R08R09R10R11R12R13R14R15R16R17R18R19R20R21R22R23R24R25R26R27R28R29R30R31Auto000C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\examples\AVR\DS401_Slave\ObjDict.cC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\examples\AVR\DS401_Slave\ObjDict.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\AVR\applicfg.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\AVR\config.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\AVR\timerscfg.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\can.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\data.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\def.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\emcy.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\lifegrd.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\nmtMaster.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\objacces.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\objdictdef.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\pdo.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\sdo.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\states.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\sync.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\timer.hC:\Programme\IAR Systems\Embedded Workbench 4.0\avr\inc\clib\stdarg.hC:\Programme\IAR Systems\Embedded Workbench 4.0\avr\inc\clib\stdio.hC:\Programme\IAR Systems\Embedded Workbench 4.0\avr\inc\clib\string.hC:\Programme\IAR Systems\Embedded Workbench 4.0\avr\inc\clib\sysmac.hC:\Programme\IAR Systems\Embedded Workbench 4.0\avr\inc\intrinsics.hC:\Programme\IAR Systems\Embedded Workbench 4.0\avr\inc\ioavr.hC:\Programme\IAR Systems\Embedded Workbench 4.0\avr\inc\iocan128.hC:\Programme\IAR Systems\Embedded Workbench 4.0\avr\inc\iomacro.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\drivers\AVR\can_AVR.cC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\examples\AVR\DS401_Slave\hardware.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\AVR\AtmelLib\can_drv.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\AVR\can_AVR.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\AVR\canfestival.hC:\Programme\IAR Systems\Embedded Workbench 4.0\avr\inc\clib\stddef.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\dcf.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\sysdep.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\src\dcf.cC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\src\emcy.cC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\src\lifegrd.cC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\examples\AVR\DS401_Slave\main.cC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\nmtSlave.hC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\src\nmtSlave.cC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\src\objacces.cC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\src\pdo.cC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\src\sdo.cC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\src\states.cC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\src\sync.cC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\src\timer.cC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\drivers\AVR\timers_AVR.cC:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\AVR\timers_AVR.h000001920010000000100011main100000C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\examples\AVR\DS401_Slave\ObjDict.c25800001C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\examples\AVR\DS401_Slave\ObjDict.h25800002C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\AVR\applicfg.h25800003C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\AVR\config.h25800004C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\AVR\timerscfg.h25800005C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\can.h25800006C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\data.h25800007C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\def.h25800008C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\emcy.h25800009C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\lifegrd.h25800010C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\nmtMaster.h25800011C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\objacces.h25800012C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\objdictdef.h25800013C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\pdo.h25800014C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\sdo.h25800015C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\states.h25800016C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\sync.h25800017C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\timer.h25800018C:\Programme\IAR Systems\Embedded Workbench 4.0\avr\inc\clib\stdarg.h25800019C:\Programme\IAR Systems\Embedded Workbench 4.0\avr\inc\clib\stdio.h25800020C:\Programme\IAR Systems\Embedded Workbench 4.0\avr\inc\clib\string.h25800021C:\Programme\IAR Systems\Embedded Workbench 4.0\avr\inc\clib\sysmac.h25800022C:\Programme\IAR Systems\Embedded Workbench 4.0\avr\inc\intrinsics.h25800023C:\Programme\IAR Systems\Embedded Workbench 4.0\avr\inc\ioavr.h25800024C:\Programme\IAR Systems\Embedded Workbench 4.0\avr\inc\iocan128.h25800025C:\Programme\IAR Systems\Embedded Workbench 4.0\avr\inc\iomacro.h25800026C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\drivers\AVR\can_AVR.c25800027C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\examples\AVR\DS401_Slave\hardware.h25800028C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\AVR\AtmelLib\can_drv.h25800029C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\AVR\can_AVR.h25800030C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\AVR\canfestival.h25800031C:\Programme\IAR Systems\Embedded Workbench 4.0\avr\inc\clib\stddef.h25800032C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\dcf.h25800033C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\sysdep.h25800034C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\src\dcf.c25800035C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\src\emcy.c25800036C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\src\lifegrd.c25800037C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\examples\AVR\DS401_Slave\main.c25900038C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\nmtSlave.h25800039C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\src\nmtSlave.c25800040C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\src\objacces.c25800041C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\src\pdo.c25800042C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\src\sdo.c25800043C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\src\states.c25800044C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\src\sync.c25800045C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\src\timer.c25800046C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\drivers\AVR\timers_AVR.c25800047C:\Dokumente und Einstellungen\cp\Eigene Dateien\CanFestival-3\include\AVR\timers_AVR.h258262 71 1048 804100 0Maximized diff -r b74f7ec412fc -r 03fb0bfccc1f examples/AVR/DS401_Slave/IAR/Exe/slaveavr_dbg.aws --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/AVR/DS401_Slave/IAR/Exe/slaveavr_dbg.aws Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,1 @@ + diff -r b74f7ec412fc -r 03fb0bfccc1f examples/AVR/DS401_Slave/IAR/SlaveAVR.dep --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/AVR/DS401_Slave/IAR/SlaveAVR.dep Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,274 @@ + + + + 2 + + Debug + + $PROJ_DIR$\..\..\..\..\drivers\AVR\timer_AVR.C + $PROJ_DIR$\..\..\..\..\drivers\AVR\can_AVR.c + $PROJ_DIR$\..\..\..\..\src\emcy.c + $PROJ_DIR$\..\..\..\..\src\dcf.c + $PROJ_DIR$\..\..\..\..\src\lifegrd.c + $PROJ_DIR$\..\..\..\..\src\nmtSlave.c + $PROJ_DIR$\..\..\..\..\src\sdo.c + $PROJ_DIR$\..\..\..\..\src\states.c + $PROJ_DIR$\..\..\..\..\src\sync.c + $PROJ_DIR$\..\..\..\..\src\timer.c + $PROJ_DIR$\..\..\..\..\src\nmtMaster.c + $PROJ_DIR$\..\..\..\..\src\pdo.c + $PROJ_DIR$\..\..\..\..\src\objacces.c + $PROJ_DIR$\..\main.c + $PROJ_DIR$\..\ObjDict.c + + + + Release + + $TOOLKIT_DIR$\inc\ioavr.h + $PROJ_DIR$\CANopen\src\sync.c + $PROJ_DIR$\Release\Obj\can_AVR.r90 + $PROJ_DIR$\Release\Obj\states.pbi + $PROJ_DIR$\Release\Obj\timers_AVR.r90 + $PROJ_DIR$\Release\Obj\SlaveAVR.pbd + $PROJ_DIR$\Release\Exe\SlaveAVR.hex + $PROJ_DIR$\CANopen\src\nmtSlave.c + $PROJ_DIR$\constant.h + $PROJ_DIR$\CANopen\src\timer.c + $PROJ_DIR$\Release\Obj\timer.pbi + $PROJ_DIR$\CANopen\CANDriver\can_AVR.c + $PROJ_DIR$\Release\Obj\nmtSlave.r90 + $PROJ_DIR$\CANopen\src\sdo.c + $PROJ_DIR$\hardware.h + $PROJ_DIR$\Release\Obj\pdo.r90 + $PROJ_DIR$\CANopen\src\states.c + $PROJ_DIR$\Release\Obj\main.pbi + $PROJ_DIR$\Release\Obj\states.r90 + $PROJ_DIR$\Release\Obj\can_AVR.pbi + $PROJ_DIR$\main.c + $PROJ_DIR$\CANopen\src\objacces.c + $PROJ_DIR$\CANopen\src\pdo.c + $PROJ_DIR$\Release\Obj\SlaveAVR.r90 + $PROJ_DIR$\Release\Obj\objacces.r90 + $PROJ_DIR$\CANopen\src\lifegrd.c + $PROJ_DIR$\Release\Obj\lifegrd.pbi + $PROJ_DIR$\CANopen\SlaveAVR.h + $PROJ_DIR$\Release\Obj\nmtSlave.pbi + $PROJ_DIR$\Release\Obj\pdo.pbi + $PROJ_DIR$\Release\Obj\timer.r90 + $PROJ_DIR$\CANopen\SlaveAVR.c + $PROJ_DIR$\Release\Obj\timers_AVR.pbi + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\Release\Obj\lifegrd.r90 + $PROJ_DIR$\Release\Obj\sync.r90 + $PROJ_DIR$\Release\Obj\sync.pbi + $PROJ_DIR$\Release\Obj\sdo.r90 + $PROJ_DIR$\Release\Obj\SlaveAVR.pbi + $PROJ_DIR$\CANopen\CANDriver\timers_AVR.c + $PROJ_DIR$\Release\Obj\objacces.pbi + $PROJ_DIR$\Release\Obj\main.r90 + $PROJ_DIR$\Release\Obj\sdo.pbi + $PROJ_DIR$\controller.h + + + $PROJ_DIR$\CANopen\src\sync.c + + + ICCAVR + 35 + + + BICOMP + 36 + + + + + $PROJ_DIR$\Release\Obj\SlaveAVR.pbd + + + BILINK + 38 19 26 17 28 40 29 42 3 36 10 32 + + + + + $PROJ_DIR$\CANopen\src\nmtSlave.c + + + ICCAVR + 12 + + + BICOMP + 28 + + + + + $PROJ_DIR$\CANopen\src\timer.c + + + ICCAVR + 30 + + + BICOMP + 10 + + + + + $PROJ_DIR$\CANopen\CANDriver\can_AVR.c + + + ICCAVR + 2 + + + BICOMP + 19 + + + + + [ROOT_NODE] + + + XLINK + 6 + + + + + $PROJ_DIR$\CANopen\src\sdo.c + + + ICCAVR + 37 + + + BICOMP + 42 + + + + + $PROJ_DIR$\CANopen\src\states.c + + + ICCAVR + 18 + + + BICOMP + 3 + + + + + $PROJ_DIR$\main.c + + + ICCAVR + 41 + + + BICOMP + 17 + + + + + ICCAVR + 43 0 + + + BICOMP + 43 0 33 14 8 + + + + + $PROJ_DIR$\CANopen\src\objacces.c + + + ICCAVR + 24 + + + BICOMP + 40 + + + + + $PROJ_DIR$\CANopen\src\pdo.c + + + ICCAVR + 15 + + + BICOMP + 29 + + + + + $PROJ_DIR$\CANopen\src\lifegrd.c + + + ICCAVR + 34 + + + BICOMP + 26 + + + + + $PROJ_DIR$\CANopen\SlaveAVR.c + + + ICCAVR + 23 + + + BICOMP + 38 + + + + + ICCAVR + 27 + + + BICOMP + 27 + + + + + $PROJ_DIR$\CANopen\CANDriver\timers_AVR.c + + + ICCAVR + 4 + + + BICOMP + 32 + + + + + [MULTI_TOOL] + XLINK + + + + + diff -r b74f7ec412fc -r 03fb0bfccc1f examples/AVR/DS401_Slave/IAR/SlaveAVR.ewp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/AVR/DS401_Slave/IAR/SlaveAVR.ewp Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,1979 @@ + + + + 1 + + Debug + + AVR + + 1 + + General + 4 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCAVR + 3 + + 12 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AAVR + 4 + + 10 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 2 + + 13 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 2 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Release + + AVR + + 0 + + General + 4 + + 7 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCAVR + 3 + + 12 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AAVR + 4 + + 10 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 2 + + 13 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 2 + + 0 + 1 + 0 + + + + + + + BILINK + 0 + + + + + CANDriver + + $PROJ_DIR$\..\..\..\..\drivers\AVR\can_AVR.c + + + $PROJ_DIR$\..\..\..\..\drivers\AVR\timer_AVR.C + + + + CANopen + + $PROJ_DIR$\..\..\..\..\src\dcf.c + + + $PROJ_DIR$\..\..\..\..\src\emcy.c + + + $PROJ_DIR$\..\..\..\..\src\lifegrd.c + + + $PROJ_DIR$\..\..\..\..\src\nmtMaster.c + + + $PROJ_DIR$\..\..\..\..\src\nmtSlave.c + + + $PROJ_DIR$\..\..\..\..\src\objacces.c + + + $PROJ_DIR$\..\..\..\..\src\pdo.c + + + $PROJ_DIR$\..\..\..\..\src\sdo.c + + + $PROJ_DIR$\..\..\..\..\src\states.c + + + $PROJ_DIR$\..\..\..\..\src\sync.c + + + $PROJ_DIR$\..\..\..\..\src\timer.c + + + + $PROJ_DIR$\..\main.c + + + $PROJ_DIR$\..\ObjDict.c + + + + diff -r b74f7ec412fc -r 03fb0bfccc1f examples/AVR/DS401_Slave/IAR/SlaveAVR.eww --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/AVR/DS401_Slave/IAR/SlaveAVR.eww Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,10 @@ + + + + + $WS_DIR$\SlaveAVR.ewp + + + + + diff -r b74f7ec412fc -r 03fb0bfccc1f examples/AVR/DS401_Slave/IAR/settings/SlaveAVR.cspy.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/AVR/DS401_Slave/IAR/settings/SlaveAVR.cspy.bat Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,32 @@ +@REM This bat file has been generated by the IAR Embeddded Workbench +@REM C-SPY interactive debugger,as an aid to preparing a command +@REM line for running the cspybat command line utility with the +@REM appropriate settings. +@REM +@REM After making some adjustments to this file, you can launch cspybat +@REM by typing the name of this file followed by the name of the debug +@REM file (usually an ubrof file). Note that this file is generated +@REM every time a new debug session is initialized, so you may want to +@REM move or rename the file before making changes. +@REM +@REM Note: some command line arguments cannot be properly generated +@REM by this process. Specifically, the plugin which is responsible +@REM for the Terminal I/O window (and other C runtime functionality) +@REM comes in a special version for cspybat, and the name of that +@REM plugin dll is not known when generating this file. It resides in +@REM the $TOOLKIT_DIR$\bin folder and is usually called XXXbat.dll or +@REM XXXlibsupportbat.dll, where XXX is the name of the corresponding +@REM tool chain. Replace the '' parameter +@REM below with the appropriate file name. Other plugins loaded by +@REM C-SPY are usually not needed by, or will not work in, cspybat +@REM but they are listed at the end of this file for reference. + + +"C:\Programme\IAR Systems\Embedded Workbench 4.0\common\bin\cspybat" "C:\Programme\IAR Systems\Embedded Workbench 4.0\avr\bin\avrproc.dll" "C:\Programme\IAR Systems\Embedded Workbench 4.0\avr\bin\avrsim.dll" %1 --plugin "C:\Programme\IAR Systems\Embedded Workbench 4.0\avr\bin\" --backend -B "--cpu=can128" "--enhanced_core" "-p" "C:\Programme\IAR Systems\Embedded Workbench 4.0\avr\Config\iocan128.ddf" "--eeprom_size" "4096" "-d" "sim" + + +@REM loaded plugins: +@REM avrlibsupport.dll +@REM C:\Programme\IAR Systems\Embedded Workbench 4.0\common\plugins\CodeCoverage\CodeCoverage.dll +@REM C:\Programme\IAR Systems\Embedded Workbench 4.0\common\plugins\Profiling\Profiling.dll +@REM C:\Programme\IAR Systems\Embedded Workbench 4.0\common\plugins\stack\stack.dll diff -r b74f7ec412fc -r 03fb0bfccc1f examples/AVR/DS401_Slave/IAR/settings/SlaveAVR.dbgdt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/AVR/DS401_Slave/IAR/settings/SlaveAVR.dbgdt Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,5 @@ + + + + + diff -r b74f7ec412fc -r 03fb0bfccc1f examples/AVR/DS401_Slave/IAR/settings/SlaveAVR.dni --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/AVR/DS401_Slave/IAR/settings/SlaveAVR.dni Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,15 @@ +[StackPlugin] +Enabled=1 +OverflowWarningsEnabled=1 +WarningThreshold=90 +SpWarningsEnabled=1 +WarnHow=0 +UseTrigger=1 +TriggerName=main +LimitSize=0 +ByteLimit=50 +[Breakpoints] +Count=0 +[TraceHelper] +Enabled=0 +ShowSource=1 diff -r b74f7ec412fc -r 03fb0bfccc1f examples/AVR/DS401_Slave/IAR/settings/SlaveAVR.wsdt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/AVR/DS401_Slave/IAR/settings/SlaveAVR.wsdt Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,66 @@ + + + + + + SlaveAVR/Debug + + + + + + + + + 171272727 + + + + + + + 16100926967 + 48268826 + + + + + + + TabID-27291-21359 + Workspace + Workspace + + + SlaveAVRSlaveAVR/CANDriverSlaveAVR/CANopenSlaveAVR/Output + + + + 0 + + + TabID-2134-21421 + Build + Build + + + TabID-13651-31422Find in FilesFind-in-Files + + 0 + + + + + + TextEditorI:\Entwicklung\Firmware\CAN\CanFestival-3\src\sdo.c0499229732297300100000010000001 + + + + + + + iaridepm1-2-2753245-2-20000192969767276-2-21871282-2-21284189100312519207300 + + + + diff -r b74f7ec412fc -r 03fb0bfccc1f examples/AVR/DS401_Slave/ObjDict.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/AVR/DS401_Slave/ObjDict.c Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,425 @@ + +/* File generated by gen_cfile.py. Should not be modified. */ + +#include "ObjDict.h" + +/**************************************************************************/ +/* Declaration of the mapped variables */ +/**************************************************************************/ +UNS8 Read_Inputs_8_Bit[] = /* Mapped at index 0x6000, subindex 0x01 - 0x01 */ + { + 0x0 /* 0 */ + }; +UNS8 Polarity_Input_8_Bit[] = /* Mapped at index 0x6002, subindex 0x01 - 0x01 */ + { + 0x0 /* 0 */ + }; +UNS8 Filter_Constant_Input_8_Bit[] = /* Mapped at index 0x6003, subindex 0x01 - 0x01 */ + { + 0x0 /* 0 */ + }; +UNS8 Global_Interrupt_Enable_Digital = 0x1; /* Mapped at index 0x6005, subindex 0x00 */ +UNS8 Interrupt_Mask_Any_Change_8_Bit[] = /* Mapped at index 0x6006, subindex 0x01 - 0x01 */ + { + 0xFF /* 255 */ + }; +UNS8 Write_Outputs_8_Bit[] = /* Mapped at index 0x6200, subindex 0x01 - 0x01 */ + { + 0x0 /* 0 */ + }; + +/**************************************************************************/ +/* Declaration of the value range types */ +/**************************************************************************/ + +#define valueRange_EMC 0x9F /* Type for index 0x1003 subindex 0x00 (only set of value 0 is possible) */ +UNS32 ObjDict_valueRangeTest (UNS8 typeValue, void * value) +{ + switch (typeValue) { + case valueRange_EMC: + if (*(UNS8*)value != (UNS8)0) return OD_VALUE_RANGE_EXCEEDED; + break; + } + return 0; +} + +/**************************************************************************/ +/* The node id */ +/**************************************************************************/ +/* node_id default value.*/ +UNS8 ObjDict_bDeviceNodeId = 0x00; + +/**************************************************************************/ +/* Array of message processing information */ + +const UNS8 ObjDict_iam_a_slave = 1; + +TIMER_HANDLE ObjDict_heartBeatTimers[1] = {TIMER_NONE,}; + +/* +$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ + + OBJECT DICTIONARY + +$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ +*/ + +/* index 0x1000 : Device Type. */ + UNS32 ObjDict_obj1000 = 0x30191; /* 197009 */ + subindex ObjDict_Index1000[] = + { + { RO, uint32, sizeof (UNS32), (void*)&ObjDict_obj1000 } + }; + +/* index 0x1001 : Error Register. */ + UNS8 ObjDict_obj1001 = 0x0; /* 0 */ + subindex ObjDict_Index1001[] = + { + { RO, uint8, sizeof (UNS8), (void*)&ObjDict_obj1001 } + }; + +/* index 0x1003 : Pre-defined Error Field. */ + UNS8 ObjDict_highestSubIndex_obj1003 = 0; /* number of subindex - 1*/ + UNS32 ObjDict_obj1003[] = + { + 0x0 /* 0 */ + }; + ODCallback_t ObjDict_Index1003_callbacks[] = + { + NULL, + NULL, + }; + subindex ObjDict_Index1003[] = + { + { RW, valueRange_EMC, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1003 }, + { RO, uint32, sizeof (UNS32), (void*)&ObjDict_obj1003[0] } + }; + +/* index 0x1005 : SYNC COB ID. */ + UNS32 ObjDict_obj1005 = 0x80; /* 128 */ + ODCallback_t ObjDict_Index1005_callbacks[] = + { + NULL, + }; + subindex ObjDict_Index1005[] = + { + { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1005 } + }; + +/* index 0x1006 : Communication / Cycle Period */ + UNS32 ObjDict_obj1006 = 0x0; /* 0 */ + +/* index 0x1008 : Manufacturer Device Name. */ + UNS8 ObjDict_obj1008[10] = ""; + subindex ObjDict_Index1008[] = + { + { RO, visible_string, 0, (void*)&ObjDict_obj1008 } + }; + +/* index 0x1009 : Manufacturer Hardware Version. */ + UNS8 ObjDict_obj1009[10] = ""; + subindex ObjDict_Index1009[] = + { + { RO, visible_string, 0, (void*)&ObjDict_obj1009 } + }; + +/* index 0x100A : Manufacturer Software Version. */ + UNS8 ObjDict_obj100A[10] = ""; + subindex ObjDict_Index100A[] = + { + { RO, visible_string, 0, (void*)&ObjDict_obj100A } + }; + +/* index 0x1010 : Store parameters. */ + UNS8 ObjDict_highestSubIndex_obj1010 = 4; /* number of subindex - 1*/ + UNS32 ObjDict_obj1010_Save_All_Parameters = 0x0; /* 0 */ + UNS32 ObjDict_obj1010_Save_Communication_Parameters = 0x0; /* 0 */ + UNS32 ObjDict_obj1010_Save_Application_Parameters = 0x0; /* 0 */ + UNS32 ObjDict_obj1010_Save_Manufacturer_Parameters = 0x0; /* 0 */ + subindex ObjDict_Index1010[] = + { + { RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1010 }, + { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1010_Save_All_Parameters }, + { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1010_Save_Communication_Parameters }, + { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1010_Save_Application_Parameters }, + { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1010_Save_Manufacturer_Parameters } + }; + +/* index 0x1011 : Restore Default Parameters. */ + UNS8 ObjDict_highestSubIndex_obj1011 = 4; /* number of subindex - 1*/ + UNS32 ObjDict_obj1011_Restore_All_Default_Parameters = 0x0; /* 0 */ + UNS32 ObjDict_obj1011_Restore_Communication_Default_Parameters = 0x0; /* 0 */ + UNS32 ObjDict_obj1011_Restore_Application_Default_Parameters = 0x0; /* 0 */ + UNS32 ObjDict_obj1011_Restore_Manufacturer_Default_Parameters = 0x0; /* 0 */ + subindex ObjDict_Index1011[] = + { + { RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1011 }, + { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1011_Restore_All_Default_Parameters }, + { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1011_Restore_Communication_Default_Parameters }, + { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1011_Restore_Application_Default_Parameters }, + { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1011_Restore_Manufacturer_Default_Parameters } + }; + +/* index 0x1014 : Emergency COB ID. */ + UNS32 ObjDict_obj1014 = 0x80; /* 128 */ + subindex ObjDict_Index1014[] = + { + { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1014 } + }; + +/* index 0x1016 : Consumer Heartbeat Time. */ + UNS8 ObjDict_highestSubIndex_obj1016 = 1; /* number of subindex - 1*/ + UNS32 ObjDict_obj1016[] = + { + 0x0 /* 0 */ + }; + subindex ObjDict_Index1016[] = + { + { RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1016 }, + { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1016[0] } + }; + +/* index 0x1017 : Producer Heartbeat Time. */ + UNS16 ObjDict_obj1017 = 0x3E8; /* 1000 */ + ODCallback_t ObjDict_Index1017_callbacks[] = + { + NULL, + }; + subindex ObjDict_Index1017[] = + { + { RW, uint16, sizeof (UNS16), (void*)&ObjDict_obj1017 } + }; + +/* index 0x1018 : Identity. */ + UNS8 ObjDict_highestSubIndex_obj1018 = 4; /* number of subindex - 1*/ + UNS32 ObjDict_obj1018_Vendor_ID = 0x0; /* 0 */ + UNS32 ObjDict_obj1018_Product_Code = 0x0; /* 0 */ + UNS32 ObjDict_obj1018_Revision_Number = 0x0; /* 0 */ + UNS32 ObjDict_obj1018_Serial_Number = 0x0; /* 0 */ + subindex ObjDict_Index1018[] = + { + { RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1018 }, + { RO, uint32, sizeof (UNS32), (void*)&ObjDict_obj1018_Vendor_ID }, + { RO, uint32, sizeof (UNS32), (void*)&ObjDict_obj1018_Product_Code }, + { RO, uint32, sizeof (UNS32), (void*)&ObjDict_obj1018_Revision_Number }, + { RO, uint32, sizeof (UNS32), (void*)&ObjDict_obj1018_Serial_Number } + }; + +/* index 0x1200 : Server SDO Parameter. */ + UNS8 ObjDict_highestSubIndex_obj1200 = 2; /* number of subindex - 1*/ + UNS32 ObjDict_obj1200_COB_ID_Client_to_Server_Receive_SDO = 0x600; /* 1536 */ + UNS32 ObjDict_obj1200_COB_ID_Server_to_Client_Transmit_SDO = 0x580; /* 1408 */ + subindex ObjDict_Index1200[] = + { + { RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1200 }, + { RO, uint32, sizeof (UNS32), (void*)&ObjDict_obj1200_COB_ID_Client_to_Server_Receive_SDO }, + { RO, uint32, sizeof (UNS32), (void*)&ObjDict_obj1200_COB_ID_Server_to_Client_Transmit_SDO } + }; + +/* index 0x1400 : Receive PDO 1 Parameter. */ + UNS8 ObjDict_highestSubIndex_obj1400 = 5; /* number of subindex - 1*/ + UNS32 ObjDict_obj1400_COB_ID_used_by_PDO = 0x200; /* 512 */ + UNS8 ObjDict_obj1400_Transmission_Type = 0x1; /* 1 */ + UNS16 ObjDict_obj1400_Inhibit_Time = 0x0; /* 0 */ + UNS8 ObjDict_obj1400_Compatibility_Entry = 0x0; /* 0 */ + UNS16 ObjDict_obj1400_Event_Timer = 0x0; /* 0 */ + subindex ObjDict_Index1400[] = + { + { RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1400 }, + { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1400_COB_ID_used_by_PDO }, + { RW, uint8, sizeof (UNS8), (void*)&ObjDict_obj1400_Transmission_Type }, + { RW, uint16, sizeof (UNS16), (void*)&ObjDict_obj1400_Inhibit_Time }, + { RW, uint8, sizeof (UNS8), (void*)&ObjDict_obj1400_Compatibility_Entry }, + { RW, uint16, sizeof (UNS16), (void*)&ObjDict_obj1400_Event_Timer } + }; + +/* index 0x1600 : Receive PDO 1 Mapping. */ + UNS8 ObjDict_highestSubIndex_obj1600 = 1; /* number of subindex - 1*/ + UNS32 ObjDict_obj1600[] = + { + 0x62000108 /* 1644167432 */ + }; + subindex ObjDict_Index1600[] = + { + { RW, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1600 }, + { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1600[0] } + }; + +/* index 0x1800 : Transmit PDO 1 Parameter. */ + UNS8 ObjDict_highestSubIndex_obj1800 = 5; /* number of subindex - 1*/ + UNS32 ObjDict_obj1800_COB_ID_used_by_PDO = 0x180; /* 384 */ + UNS8 ObjDict_obj1800_Transmission_Type = 0x0; /* 0 */ + UNS16 ObjDict_obj1800_Inhibit_Time = 0x0; /* 0 */ + UNS8 ObjDict_obj1800_Compatibility_Entry = 0x0; /* 0 */ + UNS16 ObjDict_obj1800_Event_Timer = 0x0; /* 0 */ + ODCallback_t ObjDict_Index1800_callbacks[] = + { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }; + subindex ObjDict_Index1800[] = + { + { RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1800 }, + { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1800_COB_ID_used_by_PDO }, + { RW, uint8, sizeof (UNS8), (void*)&ObjDict_obj1800_Transmission_Type }, + { RW, uint16, sizeof (UNS16), (void*)&ObjDict_obj1800_Inhibit_Time }, + { RW, uint8, sizeof (UNS8), (void*)&ObjDict_obj1800_Compatibility_Entry }, + { RW, uint16, sizeof (UNS16), (void*)&ObjDict_obj1800_Event_Timer } + }; + +/* index 0x1A00 : Transmit PDO 1 Mapping. */ + UNS8 ObjDict_highestSubIndex_obj1A00 = 1; /* number of subindex - 1*/ + UNS32 ObjDict_obj1A00[] = + { + 0x60000108 /* 1610613000 */ + }; + subindex ObjDict_Index1A00[] = + { + { RW, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj1A00 }, + { RW, uint32, sizeof (UNS32), (void*)&ObjDict_obj1A00[0] } + }; + +/* index 0x6000 : Mapped variable Read Inputs 8 Bit */ + UNS8 ObjDict_highestSubIndex_obj6000 = 1; /* number of subindex - 1*/ + subindex ObjDict_Index6000[] = + { + { RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj6000 }, + { RO, uint8, sizeof (UNS8), (void*)&Read_Inputs_8_Bit[0] } + }; + +/* index 0x6002 : Mapped variable Polarity Input 8 Bit */ + UNS8 ObjDict_highestSubIndex_obj6002 = 1; /* number of subindex - 1*/ + subindex ObjDict_Index6002[] = + { + { RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj6002 }, + { RW, uint8, sizeof (UNS8), (void*)&Polarity_Input_8_Bit[0] } + }; + +/* index 0x6003 : Mapped variable Filter Constant Input 8 Bit */ + UNS8 ObjDict_highestSubIndex_obj6003 = 1; /* number of subindex - 1*/ + subindex ObjDict_Index6003[] = + { + { RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj6003 }, + { RW, uint8, sizeof (UNS8), (void*)&Filter_Constant_Input_8_Bit[0] } + }; + +/* index 0x6005 : Mapped variable Global Interrupt Enable Digital */ + subindex ObjDict_Index6005[] = + { + { RW, boolean, sizeof (UNS8), (void*)&Global_Interrupt_Enable_Digital } + }; + +/* index 0x6006 : Mapped variable Interrupt Mask Any Change 8 Bit */ + UNS8 ObjDict_highestSubIndex_obj6006 = 1; /* number of subindex - 1*/ + subindex ObjDict_Index6006[] = + { + { RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj6006 }, + { RW, uint8, sizeof (UNS8), (void*)&Interrupt_Mask_Any_Change_8_Bit[0] } + }; + +/* index 0x6200 : Mapped variable Write Outputs 8 Bit */ + UNS8 ObjDict_highestSubIndex_obj6200 = 1; /* number of subindex - 1*/ + subindex ObjDict_Index6200[] = + { + { RO, uint8, sizeof (UNS8), (void*)&ObjDict_highestSubIndex_obj6200 }, + { RW, uint8, sizeof (UNS8), (void*)&Write_Outputs_8_Bit[0] } + }; + +const indextable ObjDict_objdict[] = +{ + { (subindex*)ObjDict_Index1000,sizeof(ObjDict_Index1000)/sizeof(ObjDict_Index1000[0]), 0x1000}, + { (subindex*)ObjDict_Index1001,sizeof(ObjDict_Index1001)/sizeof(ObjDict_Index1001[0]), 0x1001}, + { (subindex*)ObjDict_Index1003,sizeof(ObjDict_Index1003)/sizeof(ObjDict_Index1003[0]), 0x1003}, + { (subindex*)ObjDict_Index1005,sizeof(ObjDict_Index1005)/sizeof(ObjDict_Index1005[0]), 0x1005}, + { (subindex*)ObjDict_Index1008,sizeof(ObjDict_Index1008)/sizeof(ObjDict_Index1008[0]), 0x1008}, + { (subindex*)ObjDict_Index1009,sizeof(ObjDict_Index1009)/sizeof(ObjDict_Index1009[0]), 0x1009}, + { (subindex*)ObjDict_Index100A,sizeof(ObjDict_Index100A)/sizeof(ObjDict_Index100A[0]), 0x100A}, + { (subindex*)ObjDict_Index1010,sizeof(ObjDict_Index1010)/sizeof(ObjDict_Index1010[0]), 0x1010}, + { (subindex*)ObjDict_Index1011,sizeof(ObjDict_Index1011)/sizeof(ObjDict_Index1011[0]), 0x1011}, + { (subindex*)ObjDict_Index1014,sizeof(ObjDict_Index1014)/sizeof(ObjDict_Index1014[0]), 0x1014}, + { (subindex*)ObjDict_Index1016,sizeof(ObjDict_Index1016)/sizeof(ObjDict_Index1016[0]), 0x1016}, + { (subindex*)ObjDict_Index1017,sizeof(ObjDict_Index1017)/sizeof(ObjDict_Index1017[0]), 0x1017}, + { (subindex*)ObjDict_Index1018,sizeof(ObjDict_Index1018)/sizeof(ObjDict_Index1018[0]), 0x1018}, + { (subindex*)ObjDict_Index1200,sizeof(ObjDict_Index1200)/sizeof(ObjDict_Index1200[0]), 0x1200}, + { (subindex*)ObjDict_Index1400,sizeof(ObjDict_Index1400)/sizeof(ObjDict_Index1400[0]), 0x1400}, + { (subindex*)ObjDict_Index1600,sizeof(ObjDict_Index1600)/sizeof(ObjDict_Index1600[0]), 0x1600}, + { (subindex*)ObjDict_Index1800,sizeof(ObjDict_Index1800)/sizeof(ObjDict_Index1800[0]), 0x1800}, + { (subindex*)ObjDict_Index1A00,sizeof(ObjDict_Index1A00)/sizeof(ObjDict_Index1A00[0]), 0x1A00}, + { (subindex*)ObjDict_Index6000,sizeof(ObjDict_Index6000)/sizeof(ObjDict_Index6000[0]), 0x6000}, + { (subindex*)ObjDict_Index6002,sizeof(ObjDict_Index6002)/sizeof(ObjDict_Index6002[0]), 0x6002}, + { (subindex*)ObjDict_Index6003,sizeof(ObjDict_Index6003)/sizeof(ObjDict_Index6003[0]), 0x6003}, + { (subindex*)ObjDict_Index6005,sizeof(ObjDict_Index6005)/sizeof(ObjDict_Index6005[0]), 0x6005}, + { (subindex*)ObjDict_Index6006,sizeof(ObjDict_Index6006)/sizeof(ObjDict_Index6006[0]), 0x6006}, + { (subindex*)ObjDict_Index6200,sizeof(ObjDict_Index6200)/sizeof(ObjDict_Index6200[0]), 0x6200}, +}; + +const indextable * ObjDict_scanIndexOD (UNS16 wIndex, UNS32 * errorCode, ODCallback_t **callbacks) +{ + int i; + *callbacks = NULL; + switch(wIndex){ + case 0x1000: i = 0;break; + case 0x1001: i = 1;break; + case 0x1003: i = 2;*callbacks = ObjDict_Index1003_callbacks; break; + case 0x1005: i = 3;*callbacks = ObjDict_Index1005_callbacks; break; + case 0x1008: i = 4;break; + case 0x1009: i = 5;break; + case 0x100A: i = 6;break; + case 0x1010: i = 7;break; + case 0x1011: i = 8;break; + case 0x1014: i = 9;break; + case 0x1016: i = 10;break; + case 0x1017: i = 11;*callbacks = ObjDict_Index1017_callbacks; break; + case 0x1018: i = 12;break; + case 0x1200: i = 13;break; + case 0x1400: i = 14;break; + case 0x1600: i = 15;break; + case 0x1800: i = 16;*callbacks = ObjDict_Index1800_callbacks; break; + case 0x1A00: i = 17;break; + case 0x6000: i = 18;break; + case 0x6002: i = 19;break; + case 0x6003: i = 20;break; + case 0x6005: i = 21;break; + case 0x6006: i = 22;break; + case 0x6200: i = 23;break; + default: + *errorCode = OD_NO_SUCH_OBJECT; + return NULL; + } + *errorCode = OD_SUCCESSFUL; + return &ObjDict_objdict[i]; +} + +/* + * To count at which received SYNC a PDO must be sent. + * Even if no pdoTransmit are defined, at least one entry is computed + * for compilations issues. + */ +s_PDO_status ObjDict_PDO_status[1] = {s_PDO_status_Initializer}; + +quick_index ObjDict_firstIndex = { + 13, /* SDO_SVR */ + 0, /* SDO_CLT */ + 14, /* PDO_RCV */ + 15, /* PDO_RCV_MAP */ + 16, /* PDO_TRS */ + 17 /* PDO_TRS_MAP */ +}; + +quick_index ObjDict_lastIndex = { + 13, /* SDO_SVR */ + 0, /* SDO_CLT */ + 14, /* PDO_RCV */ + 15, /* PDO_RCV_MAP */ + 16, /* PDO_TRS */ + 17 /* PDO_TRS_MAP */ +}; + +UNS16 ObjDict_ObjdictSize = sizeof(ObjDict_objdict)/sizeof(ObjDict_objdict[0]); + +CO_Data ObjDict_Data = CANOPEN_NODE_DATA_INITIALIZER(ObjDict); + diff -r b74f7ec412fc -r 03fb0bfccc1f examples/AVR/DS401_Slave/ObjDict.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/AVR/DS401_Slave/ObjDict.h Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,23 @@ + +/* File generated by gen_cfile.py. Should not be modified. */ + +#ifndef OBJDICT_H +#define OBJDICT_H + +#include "data.h" + +/* Prototypes of function provided by object dictionnary */ +UNS32 ObjDict_valueRangeTest (UNS8 typeValue, void * value); +const indextable * ObjDict_scanIndexOD (UNS16 wIndex, UNS32 * errorCode, ODCallback_t **callbacks); + +/* Master node data struct */ +extern CO_Data ObjDict_Data; +extern ODCallback_t Transmit_PDO_1_Parameter_callbacks[]; /* Callbacks of index0x1800 */ +extern UNS8 Read_Inputs_8_Bit[1]; /* Mapped at index 0x6000, subindex 0x01 - 0x01 */ +extern UNS8 Polarity_Input_8_Bit[1]; /* Mapped at index 0x6002, subindex 0x01 - 0x01 */ +extern UNS8 Filter_Constant_Input_8_Bit[1]; /* Mapped at index 0x6003, subindex 0x01 - 0x01 */ +extern UNS8 Global_Interrupt_Enable_Digital; /* Mapped at index 0x6005, subindex 0x00*/ +extern UNS8 Interrupt_Mask_Any_Change_8_Bit[1]; /* Mapped at index 0x6006, subindex 0x01 - 0x01 */ +extern UNS8 Write_Outputs_8_Bit[1]; /* Mapped at index 0x6200, subindex 0x01 - 0x01 */ + +#endif // OBJDICT_H diff -r b74f7ec412fc -r 03fb0bfccc1f examples/AVR/DS401_Slave/ObjDict.od --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/AVR/DS401_Slave/ObjDict.od Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,5190 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Slave AVR Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +DS-401 +slave + +ObjDict + diff -r b74f7ec412fc -r 03fb0bfccc1f examples/AVR/DS401_Slave/hardware.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/AVR/DS401_Slave/hardware.h Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,52 @@ +/* +This file is part of CanFestival, a library implementing CanOpen Stack. + +Copyright (C): Edouard TISSERANT and Francis DUPIN +AVR Port: Andreas GLAUSER and Peter CHRISTEN + +See COPYING file for copyrights details. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library 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 +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +/****************************************************************************** +MCU ports and Bits +Makros for access on hardware +******************************************************************************/ + +#ifndef _HARDWARE_INCLUDED +#define _HARDWARE_INCLUDED + +/****************************************************************************** +Makros for bit access on the ports and registers +******************************************************************************/ +// Macros for set and clear bits in I/O registers +#define setbit(address,bit) ((address) |= (1<<(bit))) +#define clearbit(address,bit) ((address) &= ~(1<<(bit))) +#define togglebit(address,bit) ((address) ^= (1<<(bit))) + +// Macro for testing of a single bit in an I/O location +#define checkbit(address,bit) ((address) & (1<<(bit))) + +/************************** Hardware Makros **********************************/ + +// Read the inputs +#define get_inputs() (~PINA) +#define read_bcd() (~PINC & 0x0F) +// Write the outputs +#define set_outputs(val) PORTB = ~(val) + +#endif // _HARDWARE_INCLUDED + + diff -r b74f7ec412fc -r 03fb0bfccc1f examples/AVR/DS401_Slave/main.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/AVR/DS401_Slave/main.c Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,158 @@ +/* +This file is part of CanFestival, a library implementing CanOpen Stack. + +Copyright (C): Edouard TISSERANT and Francis DUPIN +AVR Port: Andreas GLAUSER and Peter CHRISTEN + +See COPYING file for copyrights details. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library 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 +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +/****************************************************************************** +Project description: +Test projekt for a DS 401 slave, running on Atmel's STK500 with AT90CAN128 +Short description: + PORTA: Inputs (Keys, low active) + PORTB: Outputs (LEDs, low active) + PORTC: Node ID (1 BCD switch) + +******************************************************************************/ +#include "hardware.h" +#include "canfestival.h" +#include "can_AVR.h" +#include "objdict.h" + +unsigned char timer_interrupt = 0; // Set if timer interrupt eclapsed +unsigned char inputs; + +// CAN +unsigned char nodeID; +static Message m = Message_Initializer; // contain a CAN message + +static unsigned char old_input_value; // Inputs, to check if a input has changed + +void sys_init(); + +// macros to handle the schedule timer +#define sys_timer timer_interrupt +#define reset_sys_timer() timer_interrupt = 0 +#define CYCLE_TIME 1000 // Sample Timebase [us] + +int main(void) +{ + sys_init(); // Initialize system + canInit(CAN_BAUDRATE); // Initialize the CANopen bus + initTimer(); // Start timer for the CANopen stack + nodeID = read_bcd(); // Read node ID first + setNodeId (&ObjDict_Data, nodeID); + setState(&ObjDict_Data, Initialisation); // Init the state + PDOInit(&ObjDict_Data); + + // Examples for callbacks + // RegisterSetODentryCallBack(d, 0x1005, 0, &OnCOB_ID_SyncUpdate); + // errorCode = setODentry(d, d->transfers[line].index, d->transfers[line].subIndex, + // (void *) d->transfers[line].data, &size, 1); + + for(;;) // forever loop + { + if (sys_timer) // Cycle timer, invoke action on every time slice + { + reset_sys_timer(); // Reset timer + + // Read the input states from the ports + Read_Inputs_8_Bit[0] = get_inputs(); + // Send the new input state if there was a change + if (old_input_value != Read_Inputs_8_Bit[0]) + { + old_input_value = Read_Inputs_8_Bit[0]; + if (getState(&ObjDict_Data) == Operational) + sendPDOevent(&ObjDict_Data); + } + set_outputs(Write_Outputs_8_Bit[0]); + + // Check if CAN address has been changed + if(!( nodeID == read_bcd())) + { + nodeID = read_bcd(); // Save the new CAN adress + setState(&ObjDict_Data, Stopped); // Stop the node, to change the node ID + setNodeId(&ObjDict_Data, nodeID); // Now the CAN adress is changed + setState(&ObjDict_Data, Pre_operational); // Set to Pre_operational, master must boot it again + } + } + // Handle all MOB's at once, if a message was received pass it to the CANstack + if (canReceive(&m)) // a message reveived + canDispatch(&ObjDict_Data, &m); // process it + else + { + // Enter sleep mode + #ifdef WD_SLEEP // Watchdog and Sleep + wdt_reset(); + sleep_enable(); + sleep_cpu(); + #endif // Watchdog and Sleep + } + } +} + +void sys_init() +/****************************************************************************** +Initialize the relays, the main states and the modbus protocol stack. +INPUT LOCK_STATES *lock_states +OUTPUT void +******************************************************************************/ +{ + OSCCAL = 0x43; + + PORTA = 0xFF; // Inputs (Keys, low active) with pullup + DDRA = 0x00; // + PORTB = 0xFF; // Outputs (LEDs, low active) all 1 + DDRB = 0xFF; // + PORTC = 0xFF; // 1 BCD switch with pullup + DDRC = 0x00; // + PORTD = 0x2C; // 2xCOM, unused, CAN, unused + DDRD = 0x2A; // All init 0 or without pullup + PORTE = 0x00; // Output + DDRE = 0x3C; // 2x not used, 2x not used + PORTF = 0x00; // Not used + DDRF = 0xFF; // All output + PORTG = 0x00; // Not used + DDRG = 0x1F; // Output for debug (only 5 pins) + +// Set timer 0 for main schedule time + TCCR0A |= 1 << WGM01 | 1 << CS01 | 1 << CS00;// Timer 0 CTC , Timer 0 mit CK/64 starten + TIMSK0 = 1 << OCIE0A; // Timer Interrupts: Timer 0 Compare + OCR0A = (unsigned char)(F_CPU / 64 * CYCLE_TIME/1000000 - 1); // Reloadvalue for timer 0 + #ifdef WD_SLEEP // Watchdog and Sleep + wdt_reset(); + wdt_enable(WDTO_15MS); // Watchdogtimer start with 16 ms timeout + #endif // Watchdog and Sleep + sei(); // Enable Interrupts +} + + +#ifdef __IAR_SYSTEMS_ICC__ +#pragma type_attribute = __interrupt +#pragma vector=TIMER0_COMP_vect +void TIMER0_COMP_interrupt(void) +#else // GCC +ISR(TIMER0_COMP_vect) +#endif // GCC +/****************************************************************************** +Interruptserviceroutine Timer 2 Compare A for the main cycle +******************************************************************************/ + +{ + timer_interrupt = 1; // Set flag +} diff -r b74f7ec412fc -r 03fb0bfccc1f include/AVR/applicfg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/AVR/applicfg.h Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,91 @@ +/* +This file is part of CanFestival, a library implementing CanOpen Stack. + +Copyright (C): Edouard TISSERANT and Francis DUPIN +AVR Port: Andreas GLAUSER and Peter CHRISTEN + +See COPYING file for copyrights details. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library 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 +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef __APPLICFG_AVR__ +#define __APPLICFG_AVR__ + +#include +#include + +// Integers +#define INTEGER8 signed char +#define INTEGER16 short +#define INTEGER24 +#define INTEGER32 long +#define INTEGER40 +#define INTEGER48 +#define INTEGER56 +#define INTEGER64 + +// Unsigned integers +#define UNS8 unsigned char +#define UNS16 unsigned short +#define UNS32 unsigned long +/* +#define UNS24 +#define UNS40 +#define UNS48 +#define UNS56 +#define UNS64 +*/ + + +// Reals +#define REAL32 float +#define REAL64 double +#include "can.h" + +// MSG functions +// not finished, the strings have to be placed to the flash and printed out +// using the printf_P function +/// Definition of MSG_ERR +// --------------------- +#ifdef DEBUG_ERR_CONSOLE_ON +#define MSG_ERR(num, str, val) \ + printf(num, ' '); \ + printf(str); \ + printf(val); \ + printf('\n'); +#else +# define MSG_ERR(num, str, val) +#endif + +/// Definition of MSG_WAR +// --------------------- +#ifdef DEBUG_WAR_CONSOLE_ON +#define MSG_WAR(num, str, val) \ + printf(num, ' '); \ + printf(str); \ + printf(val); \ + printf('\n'); +#else +# define MSG_WAR(num, str, val) +#endif + +typedef void* CAN_HANDLE; + +typedef void* CAN_PORT; + +#endif + + diff -r b74f7ec412fc -r 03fb0bfccc1f include/AVR/can_AVR.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/AVR/can_AVR.h Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,54 @@ +/* +This file is part of CanFestival, a library implementing CanOpen Stack. + +Copyright (C): Edouard TISSERANT and Francis DUPIN +AVR Port: Andreas GLAUSER and Peter CHRISTEN + +See COPYING file for copyrights details. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library 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 +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef __CAN_AVR__ +#define __CAN_AVR__ + +// AVR implementation of the CANopen driver includes +// Hardware related macros and ATMEL lib can_drv +#include "config.h" +#include "can_drv.h" + +// Canfestivals includes +#include "can.h" + +// Number of receive MOb +#define NB_RX_MOB 13 // minimal 8 +// Number of transmit MOb +#define NB_TX_MOB (NB_MOB - NB_RX_MOB) + +#if (NB_TX_MOB < 1) +#error define less RX Mobs, you must have at least 1 TX MOb! +#elif (NB_RX_MOB < 8) +#error define at least 8 RX MObs! +#endif + +#define START_TX_MOB NB_RX_MOB +#define TX_INT_MSK ((0x7F << (7 - NB_TX_MOB)) & 0x7F) + +/************************* To be called by user app ***************************/ + +unsigned char canInit(unsigned int bitrate); +unsigned char canSend(CAN_PORT notused, Message *m); +unsigned char canReceive(Message *m); +#endif diff -r b74f7ec412fc -r 03fb0bfccc1f include/AVR/can_drv.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/AVR/can_drv.h Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,191 @@ +//****************************************************************************** +//! @file $RCSfile$ +//! +//! Copyright (c) 2007 Atmel. +//! +//! Use of this program is subject to Atmel's End User License Agreement. +//! Please read file license.txt for copyright notice. +//! +//! @brief This file contains the prototypes and the macros of the +//! low level functions (drivers) of: +//! - CAN (Controller Array Network) +//! - for AT90CAN128/64/32. +//! +//! This file can be parsed by Doxygen for automatic documentation generation. +//! This file has been validated with AVRStudio-413528/WinAVR-20070122. +//! +//! @version $Revision$ $Name$ +//! +//! @todo +//! @bug +//****************************************************************************** +// Same stuff removed by Peter Christen + +#ifndef _CAN_DRV_H_ +#define _CAN_DRV_H_ + +typedef unsigned char U8 ; + +#define CAN_PORT_IN PIND +#define CAN_PORT_DIR DDRD +#define CAN_PORT_OUT PORTD +#define CAN_INPUT_PIN 6 +#define CAN_OUTPUT_PIN 5 + // ---------- +#define ERR_GEN_MSK ((1<> DLC ) +#define Can_get_ide() ((CANCDMOB & (1<> IDE ) +#define Can_get_rtr() ((CANIDT4 & (1<> RTRTAG) + // ---------- +#define Can_set_rtrmsk() ( CANIDM4 |= (1<>5 ; \ + *((U8 *)(&(identifier)) ) = (CANIDT2>>5)+(CANIDT1<<3); } + // ---------- + //!< EXT ID TAG Reading +#define Can_get_ext_id(identifier) { *((U8 *)(&(identifier))+3) = CANIDT1>>3 ; \ + *((U8 *)(&(identifier))+2) = (CANIDT2>>3)+(CANIDT1<<5); \ + *((U8 *)(&(identifier))+1) = (CANIDT3>>3)+(CANIDT2<<5); \ + *((U8 *)(&(identifier)) ) = (CANIDT4>>3)+(CANIDT3<<5); } + // ---------- + //!< STD ID Construction +#define CAN_SET_STD_ID_10_4(identifier) (((*((U8 *)(&(identifier))+1))<<5)+((* (U8 *)(&(identifier)))>>3)) +#define CAN_SET_STD_ID_3_0( identifier) (( * (U8 *)(&(identifier)) )<<5) + // ---------- + //!< STD ID TAG writing +#define Can_set_std_id(identifier) { CANIDT1 = CAN_SET_STD_ID_10_4(identifier); \ + CANIDT2 = CAN_SET_STD_ID_3_0( identifier); \ + CANCDMOB &= (~(1<>5)) +#define CAN_SET_EXT_ID_20_13(identifier) (((*((U8 *)(&(identifier))+2))<<3)+((*((U8 *)(&(identifier))+1))>>5)) +#define CAN_SET_EXT_ID_12_5( identifier) (((*((U8 *)(&(identifier))+1))<<3)+((* (U8 *)(&(identifier)) )>>5)) +#define CAN_SET_EXT_ID_4_0( identifier) ((* (U8 *)(&(identifier)) )<<3) + // ---------- + //!< EXT ID TAG writing +#define Can_set_ext_id(identifier) { CANIDT1 = CAN_SET_EXT_ID_28_21(identifier); \ + CANIDT2 = CAN_SET_EXT_ID_20_13(identifier); \ + CANIDT3 = CAN_SET_EXT_ID_12_5( identifier); \ + CANIDT4 = CAN_SET_EXT_ID_4_0( identifier); \ + CANCDMOB |= (1< +#include +#include "iar.h" +#else // GCC +#include +#include +#include +#include +#include +#include +#endif // GCC + +//#define WD_SLEEP +// Needed defines by Atmel lib +#define FOSC 8000 // 8 MHz External cristal +#ifndef F_CPU +#define F_CPU (1000UL*FOSC) // Need for AVR GCC +#endif +#define CAN_BAUDRATE 125 + +// Needed defines by Canfestival lib +#define MAX_CAN_BUS_ID 1 +#define SDO_MAX_LENGTH_TRANSFERT 32 +#define SDO_MAX_SIMULTANEOUS_TRANSFERTS 1 +#define NMT_MAX_NODE_ID 128 +#define SDO_TIMEOUT_MS 3000U +#define MAX_NB_TIMER 8 + +// CANOPEN_BIG_ENDIAN is not defined +#define CANOPEN_LITTLE_ENDIAN 1 + +#define US_TO_TIMEVAL_FACTOR 8 + +#define REPEAT_SDO_MAX_SIMULTANEOUS_TRANSFERTS_TIMES(repeat)\ +repeat +#define REPEAT_NMT_MAX_NODE_ID_TIMES(repeat)\ +repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat + +#define EMCY_MAX_ERRORS 8 +#define REPEAT_EMCY_MAX_ERRORS_TIMES(repeat)\ +repeat repeat repeat repeat repeat repeat repeat repeat + + +#endif /* _CONFIG_H_ */ diff -r b74f7ec412fc -r 03fb0bfccc1f include/AVR/iar.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/AVR/iar.h Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,46 @@ +/* +This file is part of CanFestival, a library implementing CanOpen Stack. + +Copyright (C): Edouard TISSERANT and Francis DUPIN +Copyright (C): AVR Port Andreas GLAUSER and Peter CHRISTEN + +See COPYING file for copyrights details. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library 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 +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef _IAR_H_ +#define _IAR_H_ + +#ifdef __IAR_SYSTEMS_ICC__ // IAR Compiler + +/* +#define ISR(vect) \ + _Pragma("vector="vect) \ + __interrupt void Interrupt_##vect (void) +*/ +#define sei() __enable_interrupt() +#define cli() __disable_interrupt() +#define sleep_enable() SMCR = 1 << SE +#define sleep_cpu() __sleep() +#define wdt_reset() __watchdog_reset() +#define wdt_enable(val) {WDTCSR = 1 << WDCE | 1 << WDE; \ + WDTCSR = 1 << WDE | (val);} + +#else +#error Not an IAR Compiler! +#endif // IAR Compiler + +#endif // _IAR_H_ diff -r b74f7ec412fc -r 03fb0bfccc1f include/AVR/timerscfg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/AVR/timerscfg.h Thu Jan 31 15:20:59 2008 +0100 @@ -0,0 +1,43 @@ +/* +This file is part of CanFestival, a library implementing CanOpen Stack. + +Copyright (C): Edouard TISSERANT and Francis DUPIN +AVR Port: Andreas GLAUSER and Peter CHRISTEN + +See COPYING file for copyrights details. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library 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 +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef __TIMERSCFG_H__ +#define __TIMERSCFG_H__ + +// Whatever your microcontroller, the timer wont work if +// TIMEVAL is not at least on 32 bits +#define TIMEVAL UNS32 + +// The timer of the AVR counts from 0000 to 0xFFFF in CTC mode (it can be +// shortened setting OCR3A eg. to get 2ms instead of 2.048ms) +#define TIMEVAL_MAX 0xFFFF + +// The timer is incrementing every 4 us. +//#define MS_TO_TIMEVAL(ms) (ms * 250) +//#define US_TO_TIMEVAL(us) (us>>2) + +// The timer is incrementing every 8 us. +#define MS_TO_TIMEVAL(ms) ((ms) * 125) +#define US_TO_TIMEVAL(us) ((us)>>3) + +#endif