Windows related enhancements
authoretisserant
Mon, 10 Dec 2007 23:23:19 +0100
changeset 341 7ff01f109bbc
parent 340 60e1eb89455e
child 342 66f007300c10
Windows related enhancements
configure
drivers/can_peak_win32/can_peak_win32.c
include/can_driver.h
objdictgen/doc_index/DS301_index.py
objdictgen/objdictedit.py
--- a/configure	Mon Dec 10 23:15:55 2007 +0100
+++ b/configure	Mon Dec 10 23:23:19 2007 +0100
@@ -95,6 +95,8 @@
 	
 	case $1 in
 	--cc=*)		CC=$optarg;;
+	--cxx=*)	CXX=$optarg;;
+	--ld=*)		LD=$optarg;;
 	--arch=*)	SUB_ARCH_NAME=$optarg;;
 	--os=*)		SUB_OS_NAME=$optarg;;
 	--prefix=*)	SUB_PREFIX=$optarg;;
@@ -114,35 +116,37 @@
 	--CANOPEN_BIG_ENDIAN=*)	CANOPEN_BIG_ENDIAN=$1;;
 	--MAX_NB_TIMER=*) MAX_NB_TIMER=$1;;
 	--EMCY_MAX_ERRORS=*) EMCY_MAX_ERRORS=$1;;
-	--help)	echo	"Usage: ./configure [options]"
-    		echo	"Options:"
-    		echo 	" --cc=foo      Use compiler 'foo' instead of defaults ${CC1} or ${CC2}."
+	--help)
+		echo	"Usage: ./configure [options]"
+		echo	"Options:"
+		echo 	" --cc=foo      Use C compiler 'foo' instead of defaults ${CC1} or ${CC2}."
+		echo 	" --cxx=foo     Use C++ compiler 'foo' instead of defaults g++."
+		echo 	" --ld=foo      Use linker 'foo' instead of ld."
 		echo 	" --arch=foo    Use architecture 'foo' instead of trying to autodetect."
 		echo 	" --os=foo      Use operative system 'foo' instead of trying to autodetect."
 		echo 	" --prefix=foo  Use prefix 'foo' instead of default ${SUB_PREFIX}."
 		echo 	" --target=foo  Use 'foo' as build target."
-		echo	"               \"generic\" for have independant CAN and TIMERS driver"
-		echo	"               \"unix\" for unix-like systems"
-		echo	"               \"win32\" for win32 systems"
+		echo	"               \"unix\" for unix-like systems (Linux, Cygwin)"
+		echo	"               \"win32\" for win32 systems (native, mingw or VC++)"
 		echo	"               \"hcs12\" for HCS12 micro-controller"
 		echo 	" --can=foo	Use 'foo' as CAN driver"
 		echo	"               \"peak_linux\" use Linux build host installed Peak driver and library"
-		echo	"                                please see http://www.peak-system.com/linux/"
+		echo	"                 see http://www.peak-system.com/linux/"
 		echo	"               \"peak_win32\" use win32 PcanLight Peak driver and library with Cygwin" 
-		echo	"                                please see http://www.peak-system.com/themen/download_gb.html"
+		echo	"                 see http://www.peak-system.com/themen/download_gb.html"
 		echo	"               \"virtual\" use unix pipe based virtual can driver"
 		echo	"               \"socket\" use socket-can  "
-		echo	"                                please see http://developer.berlios.de/projects/socketcan/"
-		echo	"               \"lincan\" for HCS12 micro-controller"
-		echo	"                                please see http://www.ocera.org/download/components/WP7/lincan-0.3.3.html"
+		echo	"                 see http://developer.berlios.de/projects/socketcan/"
+		echo	"               \"lincan\" lincan driver"
+		echo	"                 see http://www.ocera.org/download/components/WP7/lincan-0.3.3.html"
 		echo 	" --timers=foo  Use 'foo' as TIMERS driver (can be either 'unix' or 'xeno')"
 		echo 	" --disable-dll Disable run-time dynamic linking of can, led and nvram drivers"
 		echo	" --disable-Ox  Disable gcc \"-Ox\" optimizations."
 		echo	" --debug=foo,foo,..   Enable debug messages, ERR -> only errors, WAR)."
-		echo	"                 \"PDO\" send errors and warnings through PDO messages"
-		echo	"                 \"ERR\" print errors only, to stdout"
-		echo	"                 \"WAR\" print errors and warnings, to stdout"
-		echo	"                 \"MSG\" print messages content, to stdout"
+		echo	"               \"PDO\" send errors and warnings through PDO messages"
+		echo	"               \"ERR\" print errors only, to stdout"
+		echo	"               \"WAR\" print errors and warnings, to stdout"
+		echo	"               \"MSG\" print messages content, to stdout"
 		echo
 		echo	"Stack compilation constants"
 		echo	" --MAX_CAN_BUS_ID [=1] Number of can bus to use"
@@ -166,9 +170,6 @@
 	SUB_OS_NAME="`(uname -s | sed \"s/\//-/\" | sed \"s/_/-/\" \
 			| sed \"s/-.*//g\") 2>&1`"
 fi
-if [ "$SUB_OS_NAME" = "HP" -o "$SUB_OS_NAME" = "HP-UX" ]; then
-	SUB_OS_NAME=HPUX
-fi
 
 if [ "$SUB_ARCH_NAME" = "" ]; then
 	if [ "$CC" = "" ]; then
@@ -179,19 +180,7 @@
 fi
 
 # x86
-if [ "$A_NAME" = "i386" ]; then
-	SUB_ARCH_NAME=x86
-fi
-if [ "$A_NAME" = "i486" ]; then
-	SUB_ARCH_NAME=x86
-fi
-if [ "$A_NAME" = "i586" ]; then
-	SUB_ARCH_NAME=x86
-fi
-if [ "$A_NAME" = "i686" ]; then
-	SUB_ARCH_NAME=x86
-fi
-if [ "$A_NAME" = "x86" ]; then
+if [ "$A_NAME" = "i386" -o "$A_NAME" = "i486" -o "$A_NAME" = "i586" -o "$A_NAME" = "i686" -o "$A_NAME" = "x86" ]; then
 	SUB_ARCH_NAME=x86
 fi
 
@@ -200,39 +189,6 @@
 	SUB_ARCH_NAME=x86_64
 fi
 
-# ia64
-if [ "$A_NAME" = "ia64" ]; then
-	SUB_ARCH_NAME=ia64
-fi
-
-# alpha
-if [ "$A_NAME" = "alpha" ]; then
-	SUB_ARCH_NAME=alpha
-fi
-
-# parisc
-if [ "$A_NAME" = "parisc" ]; then
-	SUB_ARCH_NAME=parisc
-fi
-if [ "$SUB_OS_NAME" = "HPUX" -a "$A_NAME" != "ia64" ]; then
-	# If we're on HP-UX and the architecture is *not* ia64,
-	# it's most likely parisc
-	SUB_ARCH_NAME=parisc
-fi
-
-# sparc
-if [ "$A_NAME" = "sparc" ]; then
-	SUB_ARCH_NAME=sparc
-fi
-if [ "$A_NAME" = "sun4u" ]; then
-	SUB_ARCH_NAME=sparc
-fi
-
-# sparc64
-if [ "$A_NAME" = "sparc64" ]; then
-	SUB_ARCH_NAME=sparc64
-fi
-
 # ppc
 if [ "$A_NAME" = "powerpc" ]; then
 	SUB_ARCH_NAME=ppc
@@ -248,78 +204,14 @@
 	SUB_ARCH_NAME=arm
 fi
 
-# mips3
-if [ "$A_NAME" = "ip32" ]; then		# IRIX
-	SUB_ARCH_NAME=mips3
-fi
-if [ "$A_NAME" = "ip35" ]; then		# IRIX
-	SUB_ARCH_NAME=mips3
-fi
-
-# mips32
-if [ "$A_NAME" = "mips32" ]; then
-	SUB_ARCH_NAME=mips32
-fi
-if [ "$A_NAME" = "mips" ]; then
-	SUB_ARCH_NAME=mips32
-fi
-if [ "$A_NAME" = "MIPS" ]; then
-	SUB_ARCH_NAME=mips32
-fi
-if [ "$A_NAME" = "RISC" ]; then		# MIPS Ultrix
-	SUB_ARCH_NAME=mips32
-fi
-
-# mips64
-if [ "$A_NAME" = "mips64" ]; then
-	SUB_ARCH_NAME=mips64
-fi
-if [ "$A_NAME" = "MIPS64" ]; then
-	SUB_ARCH_NAME=mips64
-fi
-if [ "$A_NAME" = "IP64" ]; then		# IRIX
-	SUB_ARCH_NAME=mips64
-fi
-
-# power
-if [ "$A_NAME" = "power" ]; then	# Manual
-	SUB_ARCH_NAME=power
-fi
-
-echo "Using OS: ${SUB_OS_NAME}"
-echo "Using architecture: ${SUB_ARCH_NAME}"
-
 if [ "$SUB_ARCH_NAME" = "" ]; then
 	echo "Error: could not detect what architecture this system is running!"
 	echo "Please supply manually instead with \"--arch=foo\""
 	exit -1
 fi
 
-if [ "$SUB_OS_NAME" = "HPUX" -a "$CC" = "gcc" ]; then
-	# Only if we are on HP-UX, ia64 and using gcc
-	SUB_PROG_CFLAGS=-mlp64
-fi
-
-if [ "$SUB_OS_NAME" = "SunOS" -a "$SUB_ARCH_NAME" = "sparc" -a "$CC" = "gcc" ]; then
-	# Only if we are on SunOS, sparc and using gcc
-	# Tells the assembler that we are dealing with a v8plusa arch sparc
-	# and -mimpure-text is needed for shared library linking
-	SUB_PROG_CFLAGS="-Wa,-xarch=v8plusa -mimpure-text"
-fi
-
-if [ "$SUB_OS_NAME" = "AIX" -a "$SUB_ARCH_NAME" = "power" -a "$CC" = "gcc" ]; then
-	# Only if we are on AIX, power and using gcc
-	# The assembler may default to generating Power and PowerPC compatible
-	# code. We need to override that.
-	SUB_PROG_CFLAGS=-Wa,-mpwr
-fi
-
-if [ "$SUB_OS_NAME" = "AIX" -a "$SUB_ARCH_NAME" = "ppc" -a "$CC" = "gcc" ]; then
-	# Only if we are on AIX, ppc and using gcc
-	# The assembler may default to generating Power and PowerPC compatible
-	# code. We need to override that.
-	SUB_PROG_CFLAGS=-Wa,-mppc
-fi
+echo "Using OS: ${SUB_OS_NAME}"
+echo "Using architecture: ${SUB_ARCH_NAME}"
 
 if [ "$SUB_ARCH_NAME" = "x86_64" -a "$CC" = "gcc" ]; then
 	# Only if we are on x86_64 and using gcc
@@ -390,18 +282,6 @@
 ###########################################################################
 #              TARGET/DRIVER SPECIFIC CFLAGS and OPTIONS                  #
 ###########################################################################
-if [ "$SUB_TARGET" = "generic" ]; then
-	if [ "$US_TO_TIMEVAL_FACTOR" = "" ]; then
-		US_TO_TIMEVAL_FACTOR=1
-	fi
-	if [ "$TIMEVAL" = "" ]; then
-		TIMEVAL=UNS64
-	fi
-	if [ "$TIMEVAL_MAX" = "" ]; then
-		TIMEVAL_MAX=0xffffffffffffffff
-	fi
-fi
-
 if [ "$SUB_TARGET" = "hcs12" ]; then
 	# Only if we want to compile for a µC HCS12
        # it is a big endian architecture.
@@ -483,8 +363,7 @@
 fi
 
 if [ "$SUB_TIMERS_DRIVER" = "xeno" ]; then
-	SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -lnative\ -lrtdm\
-\	-L`$XENO_CONFIG --library-dir`
+	SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -lnative\ -lrtdm\ -L`$XENO_CONFIG --library-dir`
 	SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ `$XENO_CONFIG --xeno-cflags`
 	RTCAN_SOCKET=1
 fi
--- a/drivers/can_peak_win32/can_peak_win32.c	Mon Dec 10 23:15:55 2007 +0100
+++ b/drivers/can_peak_win32/can_peak_win32.c	Mon Dec 10 23:23:19 2007 +0100
@@ -134,7 +134,10 @@
 			m->len = peakMsg.LEN;	/* count of data bytes (0..8) */
 			for (data = 0; data < peakMsg.LEN; data++)
 				m->data[data] = peakMsg.DATA[data];	/* data bytes, up to 8 */
-		
+#if defined DEBUG_MSG_CONSOLE_ON
+			printf("in : ");
+			print_message(m);
+#endif
 		}else{
 		//pthread_mutex_unlock (&PeakCan_mutex);
 		//if (Res != CAN_ERR_OK)
@@ -198,6 +201,10 @@
 		}
 	}
 	while (errno != CAN_ERR_OK);
+#if defined DEBUG_MSG_CONSOLE_ON
+	printf("out : ");
+	print_message(m);
+#endif
 	return 0;
 fail:
 	return 1;
--- a/include/can_driver.h	Mon Dec 10 23:15:55 2007 +0100
+++ b/include/can_driver.h	Mon Dec 10 23:23:19 2007 +0100
@@ -49,7 +49,7 @@
 CAN_HANDLE DLL_CALL(canOpen)(s_BOARD *)FCT_PTR_INIT;
 int DLL_CALL(canClose)(CAN_HANDLE)FCT_PTR_INIT;
 
-#if defined DEBUG_WAR_CONSOLE_ON || defined DEBUG_ERR_CONSOLE_ON || defined NEED_PRINT_MESSAGE
+#if defined DEBUG_MSG_CONSOLE_ON || defined NEED_PRINT_MESSAGE
 #include "def.h"
 
 #define _P(fc) case fc: printf(#fc" ");break;
--- a/objdictgen/doc_index/DS301_index.py	Mon Dec 10 23:15:55 2007 +0100
+++ b/objdictgen/doc_index/DS301_index.py	Mon Dec 10 23:23:19 2007 +0100
@@ -1,19 +1,25 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
-import os
+import os,wx
 
 DS301_PDF_INDEX = {0x1000: 86, 0x1001: 87, 0x1002: 87, 0x1003: 88, 0x1005: 89, 0x1006: 90, 0x1007: 90, 0x1008: 91, 0x1009: 91, 0x100A: 91, 0x100C: 92, 0x100D: 92, 0x1010: 92, 0x1011: 94, 0x1012: 97, 0x1013: 98, 0x1014: 98, 0x1015: 99, 0x1016: 100, 0x1017: 101, 0x1018: 101, 0x1020: 117, 0x1200: 103, 0x1201: 103, 0x1280: 105, 0x1400: 106, 0x1600: 109, 0x1800: 111, 0x1A00: 112}
 
 def OpenPDFDocIndex(index, cwd):
-    if not os.path.isfile(os.path.join(cwd, "doc/301_v04000201.pdf")):
+    if not os.path.isfile(os.path.join(cwd, "doc","301_v04000201.pdf")):
         return """No documentation file available.
 Please read can festival documentation to know how to obtain one."""
     try:
         if index in DS301_PDF_INDEX:
-            os.system("xpdf -remote DS301 %s %d &"%(os.path.join(cwd, "doc/301_v04000201.pdf"), DS301_PDF_INDEX[index]))
+            if wx.Platform == '__WXMSW__':
+                os.system("Reader %s -n %d &"%(os.path.join(cwd, "doc","301_v04000201.pdf"), DS301_PDF_INDEX[index]))
+            else:
+                os.system("xpdf -remote DS301 %s %d &"%(os.path.join(cwd, "doc","301_v04000201.pdf"), DS301_PDF_INDEX[index]))
         else:
-            os.system("xpdf -remote DS301 %s &"%os.path.join(cwd, "doc/301_v04000201.pdf"))
+            if wx.Platform == '__WXMSW__':
+                os.system("Reader %s &"%os.path.join(cwd, "doc","301_v04000201.pdf"))
+            else:
+                os.system("xpdf -remote DS301 %s &"%os.path.join(cwd, "doc","301_v04000201.pdf"))
         return True
     except:
         return """Check if xpdf is correctly installed on your computer"""
--- a/objdictgen/objdictedit.py	Mon Dec 10 23:15:55 2007 +0100
+++ b/objdictgen/objdictedit.py	Mon Dec 10 23:23:19 2007 +0100
@@ -391,7 +391,10 @@
         
     def OnHelpCANFestivalMenu(self, event):
         #self.OpenHtmlFrame("CAN Festival Reference", os.path.join(ScriptDirectory, "doc/canfestival.html"), wx.Size(1000, 600))
-        os.system("xpdf -remote CANFESTIVAL %s %d &"%(os.path.join(ScriptDirectory, "doc/manual_en.pdf"),16))
+        if wx.Platform == '__WXMSW__':
+            os.system("Reader %s -n %d &"%(os.path.join(ScriptDirectory, "doc/manual_en.pdf"),16))
+        else:
+            os.system("xpdf -remote CANFESTIVAL %s %d &"%(os.path.join(ScriptDirectory, "doc/manual_en.pdf"),16))
         event.Skip()
 
     def OnAboutMenu(self, event):