include/AVR/config.h
author etisserant
Tue, 19 Aug 2008 18:02:02 +0200
changeset 508 08adb8d4b098
parent 375 03fb0bfccc1f
child 675 e5c5101c4f0b
permissions -rw-r--r--
Added more correct signal handling to unix timers.
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
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    27
#ifdef  __IAR_SYSTEMS_ICC__
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    28
#include <ioavr.h>
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    29
#include <intrinsics.h>
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    30
#include "iar.h"
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    31
#else	// GCC
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    32
#include <inttypes.h>
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    33
#include <avr\io.h>
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    34
#include <avr\interrupt.h>
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    35
#include <avr/pgmspace.h>
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    36
#include <avr\sleep.h>
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    37
#include <avr\wdt.h>
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    38
#endif	// GCC
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    39
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    40
//#define WD_SLEEP
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    41
// Needed defines by Atmel lib
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    42
#define FOSC           8000        // 8 MHz External cristal
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    43
#ifndef F_CPU
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    44
#define F_CPU          (1000UL*FOSC) // Need for AVR GCC
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    45
#endif
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    46
#define CAN_BAUDRATE    125
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    47
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    48
// Needed defines by Canfestival lib
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    49
#define MAX_CAN_BUS_ID 1
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    50
#define SDO_MAX_LENGTH_TRANSFERT 32
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    51
#define SDO_MAX_SIMULTANEOUS_TRANSFERTS 1
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    52
#define NMT_MAX_NODE_ID 128
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    53
#define SDO_TIMEOUT_MS 3000U
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    54
#define MAX_NB_TIMER 8
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    55
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    56
// CANOPEN_BIG_ENDIAN is not defined
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    57
#define CANOPEN_LITTLE_ENDIAN 1
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    58
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    59
#define US_TO_TIMEVAL_FACTOR 8
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 REPEAT_SDO_MAX_SIMULTANEOUS_TRANSFERTS_TIMES(repeat)\
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    62
repeat
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    63
#define REPEAT_NMT_MAX_NODE_ID_TIMES(repeat)\
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    64
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
    65
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    66
#define EMCY_MAX_ERRORS 8
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    67
#define REPEAT_EMCY_MAX_ERRORS_TIMES(repeat)\
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    68
repeat repeat repeat repeat repeat repeat repeat repeat
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    69
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    70
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    71
#endif /* _CONFIG_H_ */