nico@215: nico@215:
nico@215:00001 /* nico@215: 00002 This file is part of CanFestival, a library implementing CanOpen Stack. nico@215: 00003 nico@215: 00004 Copyright (C): Edouard TISSERANT and Francis DUPIN nico@215: 00005 nico@215: 00006 See COPYING file for copyrights details. nico@215: 00007 nico@215: 00008 This library is free software; you can redistribute it and/or nico@215: 00009 modify it under the terms of the GNU Lesser General Public nico@215: 00010 License as published by the Free Software Foundation; either nico@215: 00011 version 2.1 of the License, or (at your option) any later version. nico@215: 00012 nico@215: 00013 This library is distributed in the hope that it will be useful, nico@215: 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of nico@215: 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU nico@215: 00016 Lesser General Public License for more details. nico@215: 00017 nico@215: 00018 You should have received a copy of the GNU Lesser General Public nico@215: 00019 License along with this library; if not, write to the Free Software nico@215: 00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA nico@215: 00021 */ nico@215: 00022 nico@215: 00023 #ifndef __APPLICFG_LINUX__ nico@215: 00024 #define __APPLICFG_LINUX__ nico@215: 00025 nico@215: 00026 #include <string.h> nico@215: 00027 #include <stdio.h> etisserant@240: 00028 #include <sys/types.h> etisserant@240: 00029 etisserant@240: 00030 /* Define the architecture : little_endian or big_endian etisserant@240: 00031 ----------------------------------------------------- etisserant@240: 00032 Test : etisserant@240: 00033 UNS32 v = 0x1234ABCD; etisserant@240: 00034 char *data = &v; etisserant@240: 00035 etisserant@240: 00036 Result for a little_endian architecture : etisserant@240: 00037 data[0] = 0xCD; etisserant@240: 00038 data[1] = 0xAB; etisserant@240: 00039 data[2] = 0x34; etisserant@240: 00040 data[3] = 0x12; etisserant@240: 00041 etisserant@240: 00042 Result for a big_endian architecture : etisserant@240: 00043 data[0] = 0x12; etisserant@240: 00044 data[1] = 0x34; etisserant@240: 00045 data[2] = 0xAB; etisserant@240: 00046 data[3] = 0xCD; etisserant@240: 00047 */ etisserant@240: 00048 etisserant@240: 00049 /* Integers */ etisserant@240: 00050 #define INTEGER8 int8_t etisserant@240: 00051 #define INTEGER16 int16_t etisserant@240: 00052 #define INTEGER24 int32_t etisserant@240: 00053 #define INTEGER32 int32_t etisserant@240: 00054 #define INTEGER40 int64_t etisserant@240: 00055 #define INTEGER48 int64_t etisserant@240: 00056 #define INTEGER56 int64_t etisserant@240: 00057 #define INTEGER64 int64_t etisserant@240: 00058 etisserant@240: 00059 /* Unsigned integers */ etisserant@240: 00060 #define UNS8 u_int8_t etisserant@240: 00061 #define UNS16 u_int16_t etisserant@240: 00062 #define UNS32 u_int32_t etisserant@240: 00063 #define UNS24 u_int32_t etisserant@240: 00064 #define UNS40 u_int64_t etisserant@240: 00065 #define UNS48 u_int64_t etisserant@240: 00066 #define UNS56 u_int64_t etisserant@240: 00067 #define UNS64 u_int64_t etisserant@240: 00068 etisserant@240: 00069 /* Reals */ etisserant@240: 00070 #define REAL32 float etisserant@240: 00071 #define REAL64 double etisserant@240: 00072 etisserant@240: 00073 /* Definition of error and warning macros */ etisserant@240: 00074 /* -------------------------------------- */ etisserant@240: 00075 #if defined DEBUG_ERR_CONSOLE_ON || defined DEBUG_WAR_CONSOLE_ON etisserant@240: 00076 #include <stdio.h> etisserant@240: 00077 #endif etisserant@240: 00078 etisserant@240: 00079 /* Definition of MSG_ERR */ etisserant@240: 00080 /* --------------------- */ etisserant@240: 00081 #ifdef DEBUG_ERR_CONSOLE_ON etisserant@240: 00082 # define MSG_ERR(num, str, val) \ etisserant@240: 00083 printf("%s,%d : 0X%x %s 0X%x \n",__FILE__, __LINE__,num, str, val); etisserant@240: 00084 #else etisserant@240: 00085 # define MSG_ERR(num, str, val) etisserant@240: 00086 #endif etisserant@240: 00087 etisserant@240: 00088 /* Definition of MSG_WAR */ etisserant@240: 00089 /* --------------------- */ etisserant@240: 00090 #ifdef DEBUG_WAR_CONSOLE_ON etisserant@240: 00091 # define MSG_WAR(num, str, val) \ etisserant@240: 00092 printf("%s,%d : 0X%x %s 0X%x \n",__FILE__, __LINE__,num, str, val); etisserant@240: 00093 #else etisserant@240: 00094 # define MSG_WAR(num, str, val) etisserant@240: 00095 #endif etisserant@240: 00096 etisserant@240: 00097 typedef void* CAN_HANDLE; etisserant@240: 00098 etisserant@240: 00099 typedef void* CAN_PORT; etisserant@240: 00100 etisserant@240: 00101 #endif etisserant@240: