include/AVR/applicfg.h
author greg
Wed, 15 Jul 2009 09:32:35 +0200
changeset 555 ee24dcbd3e64
parent 375 03fb0bfccc1f
permissions -rw-r--r--
Add new example : CANOpen shell
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 __APPLICFG_AVR__
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    25
#define __APPLICFG_AVR__
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
#include <string.h>
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    28
#include <stdio.h>
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    29
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    30
// Integers
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    31
#define INTEGER8 signed char
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    32
#define INTEGER16 short
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    33
#define INTEGER24
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    34
#define INTEGER32 long
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    35
#define INTEGER40
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    36
#define INTEGER48
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    37
#define INTEGER56
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    38
#define INTEGER64
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
// Unsigned integers
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    41
#define UNS8   unsigned char
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    42
#define UNS16  unsigned short
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    43
#define UNS32  unsigned long
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    44
/*
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    45
#define UNS24
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    46
#define UNS40
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    47
#define UNS48
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    48
#define UNS56
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    49
#define UNS64
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    50
*/ 
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    51
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    52
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    53
// Reals
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    54
#define REAL32	float
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    55
#define REAL64 double
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    56
#include "can.h"
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
// MSG functions
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    59
// not finished, the strings have to be placed to the flash and printed out 
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    60
// using the printf_P function
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    61
/// Definition of MSG_ERR
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
#ifdef DEBUG_ERR_CONSOLE_ON
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    64
#define MSG_ERR(num, str, val)      \
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    65
          printf(num, ' ');	\
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    66
          printf(str);		\
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    67
          printf(val);		\
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    68
          printf('\n');
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    69
#else
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    70
#    define MSG_ERR(num, str, val)
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    71
#endif
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
/// Definition of MSG_WAR
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    74
// ---------------------
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    75
#ifdef DEBUG_WAR_CONSOLE_ON
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    76
#define MSG_WAR(num, str, val)      \
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    77
          printf(num, ' ');	\
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    78
          printf(str);		\
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    79
          printf(val);		\
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    80
          printf('\n');
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    81
#else
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    82
#    define MSG_WAR(num, str, val)
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    83
#endif
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    84
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    85
typedef void* CAN_HANDLE;
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    86
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    87
typedef void* CAN_PORT;
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    88
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    89
#endif
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    90
03fb0bfccc1f AVR port, thanks to Peter Christen, Comat AG.
etisserant
parents:
diff changeset
    91