etisserant@24: /*
etisserant@24: This file is part of CanFestival, a library implementing CanOpen Stack. 
etisserant@24: 
etisserant@24: Copyright (C): Edouard TISSERANT and Francis DUPIN
etisserant@24: 
etisserant@24: See COPYING file for copyrights details.
etisserant@24: 
etisserant@24: This library is free software; you can redistribute it and/or
etisserant@24: modify it under the terms of the GNU Lesser General Public
etisserant@24: License as published by the Free Software Foundation; either
etisserant@24: version 2.1 of the License, or (at your option) any later version.
etisserant@24: 
etisserant@24: This library is distributed in the hope that it will be useful,
etisserant@24: but WITHOUT ANY WARRANTY; without even the implied warranty of
etisserant@24: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
etisserant@24: Lesser General Public License for more details.
etisserant@24: 
etisserant@24: You should have received a copy of the GNU Lesser General Public
etisserant@24: License along with this library; if not, write to the Free Software
etisserant@24: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
etisserant@24: */
etisserant@24: 
etisserant@24: #ifndef __APPLICFG_LINUX__
etisserant@24: #define __APPLICFG_LINUX__
etisserant@24: 
etisserant@391: #ifndef __KERNEL__
etisserant@24: #include <string.h>
etisserant@24: #include <stdio.h>
etisserant@231: #include <sys/types.h>
etisserant@391: #else
etisserant@391: #include <linux/types.h>
etisserant@391: #endif
etisserant@24: 
frdupin@71: /*  Define the architecture : little_endian or big_endian
frdupin@71:  -----------------------------------------------------
frdupin@71:  Test :
frdupin@71:  UNS32 v = 0x1234ABCD;
frdupin@71:  char *data = &v;
etisserant@24: 
frdupin@71:  Result for a little_endian architecture :
frdupin@71:  data[0] = 0xCD;
frdupin@71:  data[1] = 0xAB;
frdupin@71:  data[2] = 0x34;
frdupin@71:  data[3] = 0x12;
frdupin@71: 
frdupin@71:  Result for a big_endian architecture :
frdupin@71:  data[0] = 0x12;
frdupin@71:  data[1] = 0x34;
frdupin@71:  data[2] = 0xAB;
frdupin@71:  data[3] = 0xCD;
frdupin@71:  */
frdupin@71: 
frdupin@71: /* Integers */
etisserant@231: #define INTEGER8 int8_t
etisserant@231: #define INTEGER16 int16_t
etisserant@231: #define INTEGER24 int32_t
etisserant@231: #define INTEGER32 int32_t
etisserant@231: #define INTEGER40 int64_t
etisserant@231: #define INTEGER48 int64_t
etisserant@231: #define INTEGER56 int64_t
etisserant@231: #define INTEGER64 int64_t
etisserant@24: 
frdupin@71: /* Unsigned integers */
etisserant@231: #define UNS8   u_int8_t
etisserant@231: #define UNS16  u_int16_t
etisserant@231: #define UNS32  u_int32_t
etisserant@231: #define UNS24  u_int32_t
etisserant@231: #define UNS40  u_int64_t
etisserant@231: #define UNS48  u_int64_t
etisserant@231: #define UNS56  u_int64_t
etisserant@231: #define UNS64  u_int64_t
etisserant@24: 
frdupin@71: /* Reals */
etisserant@24: #define REAL32	float
etisserant@24: #define REAL64 double
etisserant@24: 
frdupin@71: /* Definition of error and warning macros */
frdupin@71: /* -------------------------------------- */
greg@454: #ifdef __KERNEL__
greg@454: #	define MSG(...) printk (__VA_ARGS__)
greg@454: #elif defined USE_RTAI
greg@454: #	define MSG(...) /*rt_printk (__VA_ARGS__)*/
greg@454: #elif defined USE_XENO
greg@454: #	define MSG(...)
greg@454: #else
etisserant@391: #	include <stdio.h>
etisserant@391: #	define MSG(...) printf (__VA_ARGS__)
etisserant@24: #endif
etisserant@24: 
frdupin@71: /* Definition of MSG_ERR */
frdupin@71: /* --------------------- */
etisserant@24: #ifdef DEBUG_ERR_CONSOLE_ON
etisserant@195: #    define MSG_ERR(num, str, val)            \
etisserant@391:           MSG("%s,%d : 0X%x %s 0X%x \n",__FILE__, __LINE__,num, str, val);
etisserant@24: #else
etisserant@24: #    define MSG_ERR(num, str, val)
etisserant@24: #endif
etisserant@24: 
frdupin@71: /* Definition of MSG_WAR */
frdupin@71: /* --------------------- */
etisserant@24: #ifdef DEBUG_WAR_CONSOLE_ON
etisserant@195: #    define MSG_WAR(num, str, val)          \
etisserant@391:           MSG("%s,%d : 0X%x %s 0X%x \n",__FILE__, __LINE__,num, str, val);
etisserant@24: #else
etisserant@24: #    define MSG_WAR(num, str, val)
etisserant@24: #endif
etisserant@24: 
etisserant@145: typedef void* CAN_HANDLE;
etisserant@145: 
etisserant@145: typedef void* CAN_PORT;
etisserant@145: 
etisserant@24: #endif