include/unix/applicfg.h
author greg
Wed, 27 Jun 2007 08:35:22 +0200
changeset 228 c6e9fc22de5c
parent 195 1510dd61ead0
child 231 4fd03ee0c30e
permissions -rw-r--r--
add datatypes translation (define)
24
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
     1
/*
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
     2
This file is part of CanFestival, a library implementing CanOpen Stack. 
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
     3
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
     4
Copyright (C): Edouard TISSERANT and Francis DUPIN
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
     5
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
     6
See COPYING file for copyrights details.
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
     7
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
     8
This library is free software; you can redistribute it and/or
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
     9
modify it under the terms of the GNU Lesser General Public
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    10
License as published by the Free Software Foundation; either
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    11
version 2.1 of the License, or (at your option) any later version.
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    12
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    13
This library is distributed in the hope that it will be useful,
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    14
but WITHOUT ANY WARRANTY; without even the implied warranty of
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    16
Lesser General Public License for more details.
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    17
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    18
You should have received a copy of the GNU Lesser General Public
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    19
License along with this library; if not, write to the Free Software
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    21
*/
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    22
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    23
#ifndef __APPLICFG_LINUX__
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    24
#define __APPLICFG_LINUX__
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    25
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    26
#include <string.h>
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    27
#include <stdio.h>
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    28
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    29
/*  Define the architecture : little_endian or big_endian
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    30
 -----------------------------------------------------
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    31
 Test :
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    32
 UNS32 v = 0x1234ABCD;
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    33
 char *data = &v;
24
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    34
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    35
 Result for a little_endian architecture :
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    36
 data[0] = 0xCD;
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    37
 data[1] = 0xAB;
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    38
 data[2] = 0x34;
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    39
 data[3] = 0x12;
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    40
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    41
 Result for a big_endian architecture :
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    42
 data[0] = 0x12;
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    43
 data[1] = 0x34;
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    44
 data[2] = 0xAB;
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    45
 data[3] = 0xCD;
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    46
 */
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    47
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    48
/* Integers */
24
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    49
#define INTEGER8 char
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    50
#define INTEGER16 short
228
c6e9fc22de5c add datatypes translation (define)
greg
parents: 195
diff changeset
    51
#define INTEGER24 long
24
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    52
#define INTEGER32 long
228
c6e9fc22de5c add datatypes translation (define)
greg
parents: 195
diff changeset
    53
#define INTEGER40 long long
c6e9fc22de5c add datatypes translation (define)
greg
parents: 195
diff changeset
    54
#define INTEGER48 long long
c6e9fc22de5c add datatypes translation (define)
greg
parents: 195
diff changeset
    55
#define INTEGER56 long long
c6e9fc22de5c add datatypes translation (define)
greg
parents: 195
diff changeset
    56
#define INTEGER64 long long
24
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    57
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    58
/* Unsigned integers */
24
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    59
#define UNS8   unsigned char
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    60
#define UNS16  unsigned short
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    61
#define UNS32  unsigned long
228
c6e9fc22de5c add datatypes translation (define)
greg
parents: 195
diff changeset
    62
#define UNS24  unsigned long
c6e9fc22de5c add datatypes translation (define)
greg
parents: 195
diff changeset
    63
#define UNS40  unsigned long long
c6e9fc22de5c add datatypes translation (define)
greg
parents: 195
diff changeset
    64
#define UNS48  unsigned long long
c6e9fc22de5c add datatypes translation (define)
greg
parents: 195
diff changeset
    65
#define UNS56  unsigned long long
c6e9fc22de5c add datatypes translation (define)
greg
parents: 195
diff changeset
    66
#define UNS64  unsigned long long
24
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    67
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    68
/* Reals */
24
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    69
#define REAL32	float
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    70
#define REAL64 double
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    71
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    72
/* Definition of error and warning macros */
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    73
/* -------------------------------------- */
24
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    74
#if defined DEBUG_ERR_CONSOLE_ON || defined DEBUG_WAR_CONSOLE_ON
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    75
#include <stdio.h>
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    76
#endif
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    77
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    78
/* Definition of MSG_ERR */
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    79
/* --------------------- */
24
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    80
#ifdef DEBUG_ERR_CONSOLE_ON
195
1510dd61ead0 Added debug level opt in configure and re-enabled debug macros.
etisserant
parents: 145
diff changeset
    81
#    define MSG_ERR(num, str, val)            \
1510dd61ead0 Added debug level opt in configure and re-enabled debug macros.
etisserant
parents: 145
diff changeset
    82
          printf("%s,%d : 0X%x %s 0X%x \n",__FILE__, __LINE__,num, str, val);
24
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    83
#else
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    84
#    define MSG_ERR(num, str, val)
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    85
#endif
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    86
71
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    87
/* Definition of MSG_WAR */
95cd3376cc9f compilator compatitibility
frdupin
parents: 24
diff changeset
    88
/* --------------------- */
24
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    89
#ifdef DEBUG_WAR_CONSOLE_ON
195
1510dd61ead0 Added debug level opt in configure and re-enabled debug macros.
etisserant
parents: 145
diff changeset
    90
#    define MSG_WAR(num, str, val)          \
1510dd61ead0 Added debug level opt in configure and re-enabled debug macros.
etisserant
parents: 145
diff changeset
    91
          printf("%s,%d : 0X%x %s 0X%x \n",__FILE__, __LINE__,num, str, val);
24
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    92
#else
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    93
#    define MSG_WAR(num, str, val)
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    94
#endif
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
    95
145
e747d2e26af0 Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents: 71
diff changeset
    96
typedef void* CAN_HANDLE;
e747d2e26af0 Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents: 71
diff changeset
    97
e747d2e26af0 Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents: 71
diff changeset
    98
typedef void* CAN_PORT;
e747d2e26af0 Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents: 71
diff changeset
    99
24
a9543d2ccd56 Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
diff changeset
   100
#endif