nico@215: nico@215: nico@215: CanFestival: include/win32/applicfg.h Source File nico@215: nico@215: nico@215: nico@215: nico@215:
nico@215:
nico@215:
nico@215:
nico@215: nico@215:

applicfg.h

Go to the documentation of this file.
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_WIN32__
nico@215: 00024 #define __APPLICFG_WIN32__
nico@215: 00025 
nico@215: 00026 #include <windows.h>
nico@215: 00027 #include <string.h>
nico@215: 00028 #include <stdio.h>
nico@215: 00029 
nico@215: 00030 // Define the architecture : little_endian or big_endian
nico@215: 00031 // -----------------------------------------------------
nico@215: 00032 // Test :
nico@215: 00033 // UNS32 v = 0x1234ABCD;
nico@215: 00034 // char *data = &v;
nico@215: 00035 //
nico@215: 00036 // Result for a little_endian architecture :
nico@215: 00037 // data[0] = 0xCD;
nico@215: 00038 // data[1] = 0xAB;
nico@215: 00039 // data[2] = 0x34;
nico@215: 00040 // data[3] = 0x12;
nico@215: 00041 //
nico@215: 00042 // Result for a big_endian architecture :
nico@215: 00043 // data[0] = 0x12;
nico@215: 00044 // data[1] = 0x34;
nico@215: 00045 // data[2] = 0xAB;
nico@215: 00046 // data[3] = 0xCD;
nico@215: 00047 
nico@215: 00048 // Integers
etisserant@240: 00049 #define INTEGER8 char
etisserant@240: 00050 #define INTEGER16 short
etisserant@240: 00051 #define INTEGER24 long
etisserant@240: 00052 #define INTEGER32 long
etisserant@240: 00053 #define INTEGER40 long long
etisserant@240: 00054 #define INTEGER48 long long
etisserant@240: 00055 #define INTEGER56 long long
etisserant@240: 00056 #define INTEGER64 long long
nico@215: 00057 
nico@215: 00058 // Unsigned integers
etisserant@240: 00059 #define UNS8   unsigned char
etisserant@240: 00060 #define UNS16  unsigned short
etisserant@240: 00061 #define UNS32  unsigned long
etisserant@240: 00062 #define UNS24  unsigned long 
etisserant@240: 00063 #define UNS40  unsigned long long
etisserant@240: 00064 #define UNS48  unsigned long long
etisserant@240: 00065 #define UNS56  unsigned long long
etisserant@240: 00066 #define UNS64  unsigned long long
nico@215: 00067 
nico@215: 00068 // Reals
etisserant@240: 00069 #define REAL32 float
etisserant@240: 00070 #define REAL64 double
nico@215: 00071 
nico@215: 00072 // Custom integer types sizes
etisserant@240: 00073 #define sizeof_INTEGER24 3
etisserant@240: 00074 #define sizeof_INTEGER40 5
etisserant@240: 00075 #define sizeof_INTEGER48 6
etisserant@240: 00076 #define sizeof_INTEGER56 7
nico@215: 00077 
etisserant@240: 00078 #define sizeof_UNS24  3
etisserant@240: 00079 #define sizeof_UNS40  5
etisserant@240: 00080 #define sizeof_UNS48  6
etisserant@240: 00081 #define sizeof_UNS56  7
nico@215: 00082 
nico@215: 00083 // Non integral integers conversion macros
etisserant@240: 00084 #define INT24_2_32(a) (a <= 0x7FFFFF ? a : a|0xFF000000)
etisserant@240: 00085 #define INT40_2_64(a) (a <= 0x0000007FFFFFFFFF ? a : a|0xFFFFFF0000000000)
etisserant@240: 00086 #define INT48_2_64(a) (a <= 0x00007FFFFFFFFFFF ? a : a|0xFFFF000000000000)
etisserant@240: 00087 #define INT56_2_64(a) (a <= 0x007FFFFFFFFFFFFF ? a : a|0xFF00000000000000)
nico@215: 00088 
etisserant@240: 00089 #define INT32_2_24(a) (a&0x00FFFFFF)
etisserant@240: 00090 #define INT64_2_40(a) (a&0x000000FFFFFFFFFF)
etisserant@240: 00091 #define INT64_2_48(a) (a&0x0000FFFFFFFFFFFF)
etisserant@240: 00092 #define INT64_2_56(a) (a&0x00FFFFFFFFFFFFFF)
nico@215: 00093 
nico@215: 00095 // --------------------------------------
nico@215: 00096 
nico@215: 00097 #ifdef UNICODE
nico@215: 00098   #define CANFESTIVAL_DEBUG_MSG(num, str, val)\
nico@215: 00099     {wchar_t msg[300];\
nico@215: 00100      unsigned long value = val;\
nico@215: 00101      swprintf(msg,L"%s(%d) : 0x%X %s 0x%X\n",__FILE__, __LINE__,num, str, value);\
nico@215: 00102      OutputDebugString(msg);}
nico@215: 00103 #else
etisserant@240: 00104   #define CANFESTIVAL_DEBUG_MSG(num, str, val)\
nico@215: 00105     {char msg[300];\
nico@215: 00106      unsigned long value = val;\
nico@215: 00107      sprintf(msg,"%s(%d) : 0x%X %s 0x%X\n",__FILE__, __LINE__,num, str, value);\
nico@215: 00108      OutputDebugString(msg);}
nico@215: 00109 #endif  
nico@215: 00110 
nico@215: 00112 // ---------------------
nico@215: 00113 #ifdef DEBUG_WAR_CONSOLE_ON
nico@215: 00114     #define MSG_WAR(num, str, val) CANFESTIVAL_DEBUG_MSG(num, str, val)
nico@215: 00115 #else
etisserant@240: 00116 #    define MSG_WAR(num, str, val)
nico@215: 00117 #endif
nico@215: 00118 
nico@215: 00120 // ---------------------
nico@215: 00121 #ifdef DEBUG_ERR_CONSOLE_ON
nico@215: 00122 #    define MSG_ERR(num, str, val) CANFESTIVAL_DEBUG_MSG(num, str, val)
nico@215: 00123 #else
etisserant@240: 00124 #    define MSG_ERR(num, str, val)
nico@215: 00125 #endif
nico@215: 00126 
nico@215: 00127 
nico@215: 00128 
etisserant@240: 00129 typedef void* CAN_HANDLE;
nico@215: 00130 
etisserant@240: 00131 typedef void* CAN_PORT;
nico@215: 00132 
nico@215: 00133 #endif // __APPLICFG_WIN32__
etisserant@240: 

Generated on Mon Jul 2 19:10:16 2007 for CanFestival by  nico@215: nico@215: doxygen 1.5.1
nico@215: nico@215: