include/AT91/config.h
author greg
Fri, 17 Jul 2009 20:30:38 +0200
changeset 571 6eddab0b7ca8
parent 521 731bbe1b67b4
child 694 8dd1e58b3815
permissions -rw-r--r--
fix method to exit properly the Timer Loop
fix time unit
521
peter
parents:
diff changeset
     1
/*
peter
parents:
diff changeset
     2
This file is part of CanFestival, a library implementing CanOpen Stack.
peter
parents:
diff changeset
     3
peter
parents:
diff changeset
     4
Copyright (C): Edouard TISSERANT and Francis DUPIN
peter
parents:
diff changeset
     5
AT91 Port: Peter CHRISTEN
peter
parents:
diff changeset
     6
peter
parents:
diff changeset
     7
See COPYING file for copyrights details.
peter
parents:
diff changeset
     8
peter
parents:
diff changeset
     9
This library is free software; you can redistribute it and/or
peter
parents:
diff changeset
    10
modify it under the terms of the GNU Lesser General Public
peter
parents:
diff changeset
    11
License as published by the Free Software Foundation; either
peter
parents:
diff changeset
    12
version 2.1 of the License, or (at your option) any later version.
peter
parents:
diff changeset
    13
peter
parents:
diff changeset
    14
This library is distributed in the hope that it will be useful,
peter
parents:
diff changeset
    15
but WITHOUT ANY WARRANTY; without even the implied warranty of
peter
parents:
diff changeset
    16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
peter
parents:
diff changeset
    17
Lesser General Public License for more details.
peter
parents:
diff changeset
    18
peter
parents:
diff changeset
    19
You should have received a copy of the GNU Lesser General Public
peter
parents:
diff changeset
    20
License along with this library; if not, write to the Free Software
peter
parents:
diff changeset
    21
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
peter
parents:
diff changeset
    22
*/
peter
parents:
diff changeset
    23
peter
parents:
diff changeset
    24
#ifndef _CONFIG_H_
peter
parents:
diff changeset
    25
#define _CONFIG_H_
peter
parents:
diff changeset
    26
peter
parents:
diff changeset
    27
//#include "compiler.h"
peter
parents:
diff changeset
    28
peter
parents:
diff changeset
    29
#ifdef  __IAR_SYSTEMS_ICC__
peter
parents:
diff changeset
    30
#include <intrinsics.h>
peter
parents:
diff changeset
    31
#include <atmel/ioat91sam7x256.h>
peter
parents:
diff changeset
    32
#define __inline inline
peter
parents:
diff changeset
    33
#include "atmel/lib_AT91SAM7X256.h"
peter
parents:
diff changeset
    34
//#include "iar.h"
peter
parents:
diff changeset
    35
#else	// GCC
peter
parents:
diff changeset
    36
#include <avr\io.h>
peter
parents:
diff changeset
    37
#include <avr\interrupt.h>
peter
parents:
diff changeset
    38
#include <inttypes.h>
peter
parents:
diff changeset
    39
#include <avr\sleep.h>
peter
parents:
diff changeset
    40
#include <avr\wdt.h>
peter
parents:
diff changeset
    41
#endif	// GCC
peter
parents:
diff changeset
    42
peter
parents:
diff changeset
    43
#define WD_SLEEP
peter
parents:
diff changeset
    44
peter
parents:
diff changeset
    45
#define	FALSE					0
peter
parents:
diff changeset
    46
#define	TRUE					1
peter
parents:
diff changeset
    47
peter
parents:
diff changeset
    48
// Needed defines by Atmel lib
peter
parents:
diff changeset
    49
#define AT91C_MASTER_CLOCK      48000000UL    // Master Clock
peter
parents:
diff changeset
    50
#define CAN_BAUDRATE 125
peter
parents:
diff changeset
    51
peter
parents:
diff changeset
    52
// Needed defines by Canfestival lib
peter
parents:
diff changeset
    53
#define MAX_CAN_BUS_ID 1
peter
parents:
diff changeset
    54
#define SDO_MAX_LENGTH_TRANSFERT 32
peter
parents:
diff changeset
    55
#define SDO_MAX_SIMULTANEOUS_TRANSFERTS 1
peter
parents:
diff changeset
    56
#define NMT_MAX_NODE_ID 128
peter
parents:
diff changeset
    57
#define SDO_TIMEOUT_MS 3000U
peter
parents:
diff changeset
    58
#define MAX_NB_TIMER 8
peter
parents:
diff changeset
    59
peter
parents:
diff changeset
    60
// CANOPEN_BIG_ENDIAN is not defined
peter
parents:
diff changeset
    61
#define CANOPEN_LITTLE_ENDIAN 1
peter
parents:
diff changeset
    62
peter
parents:
diff changeset
    63
#define US_TO_TIMEVAL_FACTOR 8
peter
parents:
diff changeset
    64
peter
parents:
diff changeset
    65
#define REPEAT_SDO_MAX_SIMULTANEOUS_TRANSFERTS_TIMES(repeat)\
peter
parents:
diff changeset
    66
repeat
peter
parents:
diff changeset
    67
#define REPEAT_NMT_MAX_NODE_ID_TIMES(repeat)\
peter
parents:
diff changeset
    68
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
peter
parents:
diff changeset
    69
peter
parents:
diff changeset
    70
#define EMCY_MAX_ERRORS 8
peter
parents:
diff changeset
    71
#define REPEAT_EMCY_MAX_ERRORS_TIMES(repeat)\
peter
parents:
diff changeset
    72
repeat repeat repeat repeat repeat repeat repeat repeat
peter
parents:
diff changeset
    73
peter
parents:
diff changeset
    74
peter
parents:
diff changeset
    75
#endif /* _CONFIG_H_ */