include/AT91/applicfg.h
author mwildbolz
Mon, 01 Oct 2012 17:01:36 +0200
changeset 750 bfb63ff7106e
parent 521 731bbe1b67b4
permissions -rw-r--r--
Implementation of a basic working node-guarding
Documentation adapted
Typos corrected
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 __APPLICFG_AVR__
peter
parents:
diff changeset
    25
#define __APPLICFG_AVR__
peter
parents:
diff changeset
    26
peter
parents:
diff changeset
    27
#include <string.h>
peter
parents:
diff changeset
    28
#include <stdio.h>
peter
parents:
diff changeset
    29
peter
parents:
diff changeset
    30
peter
parents:
diff changeset
    31
/// Convert an integer to a string in hexadecimal format
peter
parents:
diff changeset
    32
/// If you do not wants to use a lastCar, put lastCar = '\0' (end of string)
peter
parents:
diff changeset
    33
/// ex : value = 0XABCDEF and lastCar = '\n'
peter
parents:
diff changeset
    34
/// buf[0] = '0'
peter
parents:
diff changeset
    35
/// buf[1] = 'X'
peter
parents:
diff changeset
    36
/// buf[2] = 'A'
peter
parents:
diff changeset
    37
/// ....
peter
parents:
diff changeset
    38
/// buf[7] = 'F'
peter
parents:
diff changeset
    39
/// buf[8] = '\n'
peter
parents:
diff changeset
    40
/// buf[9] = '\0'
peter
parents:
diff changeset
    41
extern char *
peter
parents:
diff changeset
    42
hex_convert (char *buf, unsigned long value, char lastCar);
peter
parents:
diff changeset
    43
peter
parents:
diff changeset
    44
/// Print the string to the serial port sci
peter
parents:
diff changeset
    45
/// (sci takes the values SCI0 or SCI1)
peter
parents:
diff changeset
    46
extern void printSCI_str (char sci, const char * str);
peter
parents:
diff changeset
    47
peter
parents:
diff changeset
    48
/// Print the number in hexadecimal  to the serial port sci
peter
parents:
diff changeset
    49
/// (sci takes the values SCI0 or SCI1)
peter
parents:
diff changeset
    50
extern void printSCI_nbr (char sci, unsigned long nbr, char lastCar);
peter
parents:
diff changeset
    51
peter
parents:
diff changeset
    52
// Integers
peter
parents:
diff changeset
    53
#define INTEGER8 signed char
peter
parents:
diff changeset
    54
#define INTEGER16 short
peter
parents:
diff changeset
    55
#define INTEGER24 long
peter
parents:
diff changeset
    56
#define INTEGER32 long
peter
parents:
diff changeset
    57
#define INTEGER40 long long
peter
parents:
diff changeset
    58
#define INTEGER48 long long
peter
parents:
diff changeset
    59
#define INTEGER56 long long
peter
parents:
diff changeset
    60
#define INTEGER64 long long
peter
parents:
diff changeset
    61
peter
parents:
diff changeset
    62
// Unsigned integers
peter
parents:
diff changeset
    63
#define UNS8   unsigned char
peter
parents:
diff changeset
    64
#define UNS16  unsigned short
peter
parents:
diff changeset
    65
#define UNS32  unsigned long
peter
parents:
diff changeset
    66
#define UNS24  unsigned long
peter
parents:
diff changeset
    67
#define UNS40  unsigned long long
peter
parents:
diff changeset
    68
#define UNS48  unsigned long long
peter
parents:
diff changeset
    69
#define UNS56  unsigned long long
peter
parents:
diff changeset
    70
#define UNS64  unsigned long long
peter
parents:
diff changeset
    71
peter
parents:
diff changeset
    72
// Reals
peter
parents:
diff changeset
    73
#define REAL32 float
peter
parents:
diff changeset
    74
#define REAL64 double
peter
parents:
diff changeset
    75
peter
parents:
diff changeset
    76
// Reals
peter
parents:
diff changeset
    77
#define REAL32	float
peter
parents:
diff changeset
    78
#define REAL64 double
peter
parents:
diff changeset
    79
peter
parents:
diff changeset
    80
#include "can.h"
peter
parents:
diff changeset
    81
peter
parents:
diff changeset
    82
peter
parents:
diff changeset
    83
/// Definition of MSG_ERR
peter
parents:
diff changeset
    84
// ---------------------
peter
parents:
diff changeset
    85
#ifdef DEBUG_ERR_CONSOLE_ON
peter
parents:
diff changeset
    86
#    define MSG_ERR(num, str, val)            \
peter
parents:
diff changeset
    87
          initSCI_0();                        \
peter
parents:
diff changeset
    88
          printSCI_nbr(SCI0, num, ' ');       \
peter
parents:
diff changeset
    89
          /* large printing on console  */    \
peter
parents:
diff changeset
    90
          printSCI_str(SCI0, str);            \
peter
parents:
diff changeset
    91
          printSCI_nbr(SCI0, val, '\n');
peter
parents:
diff changeset
    92
#else
peter
parents:
diff changeset
    93
#    define MSG_ERR(num, str, val)
peter
parents:
diff changeset
    94
#endif
peter
parents:
diff changeset
    95
peter
parents:
diff changeset
    96
/// Definition of MSG_WAR
peter
parents:
diff changeset
    97
// ---------------------
peter
parents:
diff changeset
    98
#ifdef DEBUG_WAR_CONSOLE_ON
peter
parents:
diff changeset
    99
#    define MSG_WAR(num, str, val)          \
peter
parents:
diff changeset
   100
        initSCI_0();                        \
peter
parents:
diff changeset
   101
        printSCI_nbr(SCI0, num, ' ');       \
peter
parents:
diff changeset
   102
        /* large printing on console  */    \
peter
parents:
diff changeset
   103
        printSCI_str(SCI0, str);            \
peter
parents:
diff changeset
   104
        printSCI_nbr(SCI0, val, '\n');
peter
parents:
diff changeset
   105
#else
peter
parents:
diff changeset
   106
#    define MSG_WAR(num, str, val)
peter
parents:
diff changeset
   107
#endif
peter
parents:
diff changeset
   108
peter
parents:
diff changeset
   109
typedef void* CAN_HANDLE;
peter
parents:
diff changeset
   110
peter
parents:
diff changeset
   111
typedef void* CAN_PORT;
peter
parents:
diff changeset
   112
peter
parents:
diff changeset
   113
#endif
peter
parents:
diff changeset
   114
peter
parents:
diff changeset
   115