include/AVR/config.h
author Christian Taedcke <hacking@taedcke.com>
Mon, 23 Jan 2012 08:43:13 +0100
changeset 699 c26ea35559f8
parent 675 e5c5101c4f0b
child 694 8dd1e58b3815
permissions -rw-r--r--
dcf.c:
- removed inline definition of dcf variable, which is not allowed on many c compilers.
- removed SaveNode() call using ifdef, because not all canopen devices support this feature.
Later on it should be possible to enable this for each dcf entry using objdictedit.
- fixed bug when dereferencing an dcf entry from the object dictionary.
375
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
     1
/*
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
     2
This file is part of CanFestival, a library implementing CanOpen Stack.
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
     3
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
     4
Copyright (C): Edouard TISSERANT and Francis DUPIN
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
     5
AVR Port: Andreas GLAUSER and Peter CHRISTEN
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
     6
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
     7
See COPYING file for copyrights details.
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
     8
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
     9
This library is free software; you can redistribute it and/or
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    10
modify it under the terms of the GNU Lesser General Public
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    11
License as published by the Free Software Foundation; either
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    12
version 2.1 of the License, or (at your option) any later version.
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    13
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    14
This library is distributed in the hope that it will be useful,
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    15
but WITHOUT ANY WARRANTY; without even the implied warranty of
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    17
Lesser General Public License for more details.
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    18
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    19
You should have received a copy of the GNU Lesser General Public
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    20
License along with this library; if not, write to the Free Software
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    21
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    22
*/
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    23
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    24
#ifndef _CONFIG_H_
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    25
#define _CONFIG_H_
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    26
675
e5c5101c4f0b FIXED: - The AVR example now compiles in linux.
Christian Taedcke <hacking@taedcke.com>
parents: 375
diff changeset
    27
375
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    28
#ifdef  __IAR_SYSTEMS_ICC__
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    29
#include <ioavr.h>
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    30
#include <intrinsics.h>
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    31
#include "iar.h"
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    32
#else	// GCC
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    33
#include <inttypes.h>
675
e5c5101c4f0b FIXED: - The AVR example now compiles in linux.
Christian Taedcke <hacking@taedcke.com>
parents: 375
diff changeset
    34
#include <avr/io.h>
e5c5101c4f0b FIXED: - The AVR example now compiles in linux.
Christian Taedcke <hacking@taedcke.com>
parents: 375
diff changeset
    35
#include <avr/interrupt.h>
375
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    36
#include <avr/pgmspace.h>
675
e5c5101c4f0b FIXED: - The AVR example now compiles in linux.
Christian Taedcke <hacking@taedcke.com>
parents: 375
diff changeset
    37
#include <avr/sleep.h>
e5c5101c4f0b FIXED: - The AVR example now compiles in linux.
Christian Taedcke <hacking@taedcke.com>
parents: 375
diff changeset
    38
#include <avr/wdt.h>
375
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    39
#endif	// GCC
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    40
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    41
//#define WD_SLEEP
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    42
// Needed defines by Atmel lib
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    43
#define FOSC           8000        // 8 MHz External cristal
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    44
#ifndef F_CPU
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    45
#define F_CPU          (1000UL*FOSC) // Need for AVR GCC
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    46
#endif
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    47
#define CAN_BAUDRATE    125
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    48
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    49
// Needed defines by Canfestival lib
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    50
#define MAX_CAN_BUS_ID 1
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    51
#define SDO_MAX_LENGTH_TRANSFERT 32
675
e5c5101c4f0b FIXED: - The AVR example now compiles in linux.
Christian Taedcke <hacking@taedcke.com>
parents: 375
diff changeset
    52
#define SDO_BLOCK_SIZE 16
375
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    53
#define SDO_MAX_SIMULTANEOUS_TRANSFERTS 1
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    54
#define NMT_MAX_NODE_ID 128
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    55
#define SDO_TIMEOUT_MS 3000U
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    56
#define MAX_NB_TIMER 8
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    57
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    58
// CANOPEN_BIG_ENDIAN is not defined
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    59
#define CANOPEN_LITTLE_ENDIAN 1
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    60
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    61
#define US_TO_TIMEVAL_FACTOR 8
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    62
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    63
#define REPEAT_SDO_MAX_SIMULTANEOUS_TRANSFERTS_TIMES(repeat)\
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    64
repeat
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    65
#define REPEAT_NMT_MAX_NODE_ID_TIMES(repeat)\
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    66
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
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    67
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    68
#define EMCY_MAX_ERRORS 8
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    69
#define REPEAT_EMCY_MAX_ERRORS_TIMES(repeat)\
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    70
repeat repeat repeat repeat repeat repeat repeat repeat
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    71
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    72
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    73
#endif /* _CONFIG_H_ */