# HG changeset patch
# User Edouard Tisserant
# Date 1339607338 -7200
# Node ID 4faa0bb578e0d219608af8aca6288c838720d48f
# Parent 396839c5d70fcb9889c299a5287a6b0cb2a4937d# Parent 0590f7941fa88f53b9c2fe2889f71fa88e98f41e
Merged Christian Taedcke changes
diff -r 396839c5d70f -r 4faa0bb578e0 .travis.yml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.travis.yml Wed Jun 13 19:08:58 2012 +0200
@@ -0,0 +1,27 @@
+language: "c"
+install: "echo"
+
+before_script:
+ - sudo apt-get install libxenomai-dev
+# - sudo apt-get install gcc-avr binutils-avr avr-libc
+
+script: "./configure --can=\"$CAN_DRIVER\" --timers=\"$TIMERS\" && make"
+branches:
+ only:
+ - master
+notifications:
+ recipients:
+ - hacking@taedcke.com
+ email:
+ on_success: change
+ on_failure: always
+ irc: "irc.freenode.org#canfestival"
+
+env:
+ - CAN_DRIVER="virtual" TIMERS="unix"
+ - CAN_DRIVER="vscom" TIMERS="unix"
+ - CAN_DRIVER="can4linux" TIMERS="unix"
+ - CAN_DRIVER="lincan" TIMERS="unix"
+ - CAN_DRIVER="socket" TIMERS="unix"
+ - CAN_DRIVER="virtual" TIMERS="xeno"
+ - CAN_DRIVER="socket" TIMERS="xeno"
diff -r 396839c5d70f -r 4faa0bb578e0 CanFestival-3.vc10.vcxproj
--- a/CanFestival-3.vc10.vcxproj Wed Jun 13 19:07:41 2012 +0200
+++ b/CanFestival-3.vc10.vcxproj Wed Jun 13 19:08:58 2012 +0200
@@ -54,7 +54,7 @@
MultiThreadedDebugDLL
- $(IntDir)CanFestival-3.pdb
+ $(OutDir)$(ProjectName).pdb
Level3
EditAndContinue
diff -r 396839c5d70f -r 4faa0bb578e0 configure
--- a/configure Wed Jun 13 19:07:41 2012 +0200
+++ b/configure Wed Jun 13 19:08:58 2012 +0200
@@ -88,7 +88,7 @@
rm -f $test $test.c
if [ "$XENO_CONFIG" = "" ]; then
- XENO_CONFIG=/usr/xenomai/bin/xeno-config
+ XENO_CONFIG=xeno-config
fi
if [ "$RTAI_CONFIG" = "" ]; then
@@ -482,9 +482,8 @@
fi
if [ "$SUB_TIMERS_DRIVER" = "xeno" ]; then
- RT_LIB_DIR=`$XENO_CONFIG --library-dir`\ -Wl,-rpath\ `$XENO_CONFIG --library-dir`
- SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ `$XENO_CONFIG --xeno-ldflags`\ -L$RT_LIB_DIR\ -lnative\ -lrtdm
- SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DUSE_XENO\ `$XENO_CONFIG --xeno-cflags`
+ SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ `$XENO_CONFIG --skin=native --ldflags`\ -lrtdm
+ SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DUSE_XENO\ `$XENO_CONFIG --skin=rtdm --cflags`
RTCAN_SOCKET=1
fi
diff -r 396839c5d70f -r 4faa0bb578e0 drivers/can_anagate_win32/can_anagate_win32.vc10.vcxproj
--- a/drivers/can_anagate_win32/can_anagate_win32.vc10.vcxproj Wed Jun 13 19:07:41 2012 +0200
+++ b/drivers/can_anagate_win32/can_anagate_win32.vc10.vcxproj Wed Jun 13 19:08:58 2012 +0200
@@ -24,7 +24,7 @@
DynamicLibrary
- Unicode
+ MultiByte
diff -r 396839c5d70f -r 4faa0bb578e0 drivers/can_copcican_win32/can_copcican_win32.vc10.vcxproj
--- a/drivers/can_copcican_win32/can_copcican_win32.vc10.vcxproj Wed Jun 13 19:07:41 2012 +0200
+++ b/drivers/can_copcican_win32/can_copcican_win32.vc10.vcxproj Wed Jun 13 19:08:58 2012 +0200
@@ -20,7 +20,7 @@
DynamicLibrary
true
- Unicode
+ MultiByte
DynamicLibrary
diff -r 396839c5d70f -r 4faa0bb578e0 drivers/can_ixxat_win32/can_ixxat_win32.vc10.vcxproj
--- a/drivers/can_ixxat_win32/can_ixxat_win32.vc10.vcxproj Wed Jun 13 19:07:41 2012 +0200
+++ b/drivers/can_ixxat_win32/can_ixxat_win32.vc10.vcxproj Wed Jun 13 19:08:58 2012 +0200
@@ -57,6 +57,7 @@
Level3
EditAndContinue
+ $(OutDir)$(ProjectName).pdb
vci11un6.lib;%(AdditionalDependencies)
diff -r 396839c5d70f -r 4faa0bb578e0 drivers/can_ixxat_win32/ixxat.cpp
--- a/drivers/can_ixxat_win32/ixxat.cpp Wed Jun 13 19:07:41 2012 +0200
+++ b/drivers/can_ixxat_win32/ixxat.cpp Wed Jun 13 19:08:58 2012 +0200
@@ -69,6 +69,8 @@
~IXXAT();
bool send(const Message *m);
bool receive(Message *m);
+
+ static bool isDriverClosed() {return m_driverClosed;}
private:
bool open(int board_number, const char* baud_rate);
bool close();
@@ -86,6 +88,8 @@
UINT16 m_RxQueHdl;
async_access_que m_RX_Que;
static IXXAT* m_callbackPtr;
+
+ static bool m_driverClosed;
static UINT_PTR m_watchdogTimerId;
static const unsigned int CAN_BUS_WATCHDOG_INTERVAL_MSEC = 10000;
@@ -103,6 +107,8 @@
UINT_PTR IXXAT::m_watchdogTimerId = 0;
+bool IXXAT::m_driverClosed = false;
+
IXXAT::IXXAT(s_BOARD *board) : m_BoardHdl(0xFFFF),
m_TxQueHdl(0xFFFF),
m_RxQueHdl(0xFFFF)
@@ -244,11 +250,14 @@
//Start CAN Bus-Off watchdog
m_watchdogTimerId = SetTimer(NULL, NULL, IXXAT::CAN_BUS_WATCHDOG_INTERVAL_MSEC, IXXAT::canBusWatchdog);
+ m_driverClosed = false;
+
return true;
}
bool IXXAT::close()
{
+ m_driverClosed = true;
if (m_BoardHdl == 0xFFFF)
return true;
VCI_ResetBoard(m_BoardHdl);
@@ -369,12 +378,14 @@
extern "C"
UNS8 __stdcall canReceive_driver(CAN_HANDLE inst, Message *m)
{
+ if (IXXAT::isDriverClosed()) return 0;
return reinterpret_cast(inst)->receive(m) ? 0 : 1;
}
extern "C"
UNS8 __stdcall canSend_driver(CAN_HANDLE inst, Message const *m)
{
+ if (IXXAT::isDriverClosed()) return 0;
return reinterpret_cast(inst)->send(m) ? 0 : 1;
}
diff -r 396839c5d70f -r 4faa0bb578e0 drivers/can_ixxat_win32/ixxat.def
--- a/drivers/can_ixxat_win32/ixxat.def Wed Jun 13 19:07:41 2012 +0200
+++ b/drivers/can_ixxat_win32/ixxat.def Wed Jun 13 19:08:58 2012 +0200
@@ -26,3 +26,4 @@
canSend_driver
canOpen_driver
canClose_driver
+ canChangeBaudRate_driver
diff -r 396839c5d70f -r 4faa0bb578e0 drivers/can_peak_win32/can_peak_win32.c
--- a/drivers/can_peak_win32/can_peak_win32.c Wed Jun 13 19:07:41 2012 +0200
+++ b/drivers/can_peak_win32/can_peak_win32.c Wed Jun 13 19:08:58 2012 +0200
@@ -261,7 +261,7 @@
m->rtr = 1;
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 */
+ m->data[data] = peakMsg.DATA[data]; /* data bytes, up to 8 */
#if defined DEBUG_MSG_CONSOLE_ON
MSG("in : ");
print_message(m);
@@ -301,7 +301,7 @@
peakMsg.LEN = m->len;
/* count of data bytes (0..8) */
for (data = 0; data < m->len; data++)
- peakMsg.DATA[data] = m->Data[data]; /* data bytes, up to 8 */
+ peakMsg.DATA[data] = m->data[data]; /* data bytes, up to 8 */
do
{
diff -r 396839c5d70f -r 4faa0bb578e0 drivers/can_peak_win32/can_peak_win32.vc10.vcxproj
--- a/drivers/can_peak_win32/can_peak_win32.vc10.vcxproj Wed Jun 13 19:07:41 2012 +0200
+++ b/drivers/can_peak_win32/can_peak_win32.vc10.vcxproj Wed Jun 13 19:08:58 2012 +0200
@@ -78,7 +78,7 @@
Disabled
- ../../include;../../include/win32;%(AdditionalIncludeDirectories)
+ ../../include;../../include/win32;D:\myProjects/PCAN-Light API/Include/C++;%(AdditionalIncludeDirectories)
WIN32;_DEBUG;_WINDOWS;_USRDLL;CANpeak_EXPORTS;%(PreprocessorDefinitions)
true
EnableFastChecks
@@ -99,11 +99,12 @@
$(OutDir)can_peak_win32.lib
MachineX86
+ D:\myProjects\PCAN-Light API\Win32\VC_LIB\PCAN_USB.lib
- ../../include;../../include/win32;%(AdditionalIncludeDirectories)
+ ../../include;../../include/win32;D:\myProjects/PCAN-Light API/Include/C++;%(AdditionalIncludeDirectories)
WIN32;NDEBUG;_WINDOWS;_USRDLL;CANpeak_EXPORTS;%(PreprocessorDefinitions)
MultiThreadedDLL
@@ -123,11 +124,12 @@
$(OutDir)can_peak_win32.lib
MachineX86
+ D:\myProjects\PCAN-Light API\Win32\VC_LIB\PCAN_USB.lib
- ../../include;../../include/win32;%(AdditionalIncludeDirectories)
+ ../../include;../../include/win32;D:\myProjects/PCAN-Light API/Include/C++;%(AdditionalIncludeDirectories)
WIN32;NDEBUG;_WINDOWS;_USRDLL;CANpeak_EXPORTS;%(PreprocessorDefinitions)
MultiThreadedDLL
@@ -147,12 +149,13 @@
$(OutDir)can_peak_win32.lib
MachineX86
+ D:\myProjects\PCAN-Light API\Win32\VC_LIB\PCAN_USB.lib
Disabled
- ../../include;../../include/win32;%(AdditionalIncludeDirectories)
+ ../../include;../../include/win32;D:\myProjects/PCAN-Light API/Include/C++;%(AdditionalIncludeDirectories)
WIN32;_DEBUG;_WINDOWS;_USRDLL;CANpeak_EXPORTS;%(PreprocessorDefinitions)
true
EnableFastChecks
@@ -173,6 +176,7 @@
$(OutDir)can_peak_win32.lib
MachineX86
+ D:\myProjects\PCAN-Light API\Win32\VC_LIB\PCAN_USB.lib
@@ -184,10 +188,6 @@
-
-
-
-
diff -r 396839c5d70f -r 4faa0bb578e0 drivers/can_peak_win32/can_peak_win32.vc10.vcxproj.filters
--- a/drivers/can_peak_win32/can_peak_win32.vc10.vcxproj.filters Wed Jun 13 19:07:41 2012 +0200
+++ b/drivers/can_peak_win32/can_peak_win32.vc10.vcxproj.filters Wed Jun 13 19:08:58 2012 +0200
@@ -29,8 +29,4 @@
Header Files
-
-
-
-
\ No newline at end of file
diff -r 396839c5d70f -r 4faa0bb578e0 drivers/can_peak_win32/can_peak_win32.vc9.vcproj
--- a/drivers/can_peak_win32/can_peak_win32.vc9.vcproj Wed Jun 13 19:07:41 2012 +0200
+++ b/drivers/can_peak_win32/can_peak_win32.vc9.vcproj Wed Jun 13 19:08:58 2012 +0200
@@ -4,6 +4,7 @@
Version="9,00"
Name="can_peak_win32"
ProjectGUID="{732EC5B6-C6F1-4783-9BC8-924FFF67BF5A}"
+ RootNamespace="can_peak_win32"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
@@ -41,7 +42,7 @@
-
-
-
-
diff -r 396839c5d70f -r 4faa0bb578e0 drivers/win32/win32.c
--- a/drivers/win32/win32.c Wed Jun 13 19:07:41 2012 +0200
+++ b/drivers/win32/win32.c Wed Jun 13 19:08:58 2012 +0200
@@ -97,7 +97,7 @@
* @param driver_name String containing driver's dynamic library name
* @return Library handle
*/
-LIB_HANDLE LoadCanDriver(LPCTSTR driver_name)
+LIB_HANDLE LoadCanDriver(LPCSTR driver_name)
{
// driver module handle
LIB_HANDLE handle = NULL;
@@ -105,7 +105,7 @@
#ifndef NOT_USE_DYNAMIC_LOADING
if(handle == NULL)
{
- handle = LoadLibrary(driver_name);
+ handle = LoadLibraryA(driver_name);
}
if (!handle)
diff -r 396839c5d70f -r 4faa0bb578e0 examples/CANOpenShell/CANOpenShell.vc10.vcxproj
--- a/examples/CANOpenShell/CANOpenShell.vc10.vcxproj Wed Jun 13 19:07:41 2012 +0200
+++ b/examples/CANOpenShell/CANOpenShell.vc10.vcxproj Wed Jun 13 19:08:58 2012 +0200
@@ -24,7 +24,7 @@
Application
- Unicode
+ MultiByte
@@ -57,9 +57,10 @@
Level3
EditAndContinue
+ $(OutDir)$(ProjectName).pdb
- false
+ true
Console
MachineX86
diff -r 396839c5d70f -r 4faa0bb578e0 examples/win32test/main.c
--- a/examples/win32test/main.c Wed Jun 13 19:07:41 2012 +0200
+++ b/examples/win32test/main.c Wed Jun 13 19:08:58 2012 +0200
@@ -107,7 +107,7 @@
/* process command line arguments */
if (argc < 2)
{
- printf("USAGE: win32test [can driver dll filename [baud rate]]\n");
+ printf("USAGE: win32test [can driver dll filename [baud rate[bus name]]]\n");
return 1;
}
@@ -126,6 +126,9 @@
if (argc > 3)
MasterBoard.baudrate = argv[3];
+ if (argc > 4)
+ MasterBoard.busname = argv[4];
+
// load can driver
if (!LoadCanDriver(dll_file_name))
{
@@ -158,12 +161,13 @@
/* modify Client SDO 1 Parameter */
UNS32 COB_ID_Client_to_Server_Transmit_SDO = 0x600 + node_id;
UNS32 COB_ID_Server_to_Client_Receive_SDO = 0x580 + node_id;
- UNS32 Node_ID_of_the_SDO_Server = node_id;
- UNS32 ExpectedSize = sizeof (UNS32);
+ UNS8 Node_ID_of_the_SDO_Server = node_id;
+ UNS32 ExpectedSize = sizeof(UNS32);
+ UNS32 ExpectedSizeNodeId = sizeof (UNS8);
if (OD_SUCCESSFUL == writeLocalDict(&win32test_Data, 0x1280, 1, &COB_ID_Client_to_Server_Transmit_SDO, &ExpectedSize, RW)
&& OD_SUCCESSFUL == writeLocalDict(&win32test_Data, 0x1280, 2, &COB_ID_Server_to_Client_Receive_SDO, &ExpectedSize, RW)
- && OD_SUCCESSFUL == writeLocalDict(&win32test_Data, 0x1280, 3, &Node_ID_of_the_SDO_Server, &ExpectedSize, RW))
+ && OD_SUCCESSFUL == writeLocalDict(&win32test_Data, 0x1280, 3, &Node_ID_of_the_SDO_Server, &ExpectedSizeNodeId, RW))
{
UNS32 dev_type = 0;
char device_name[64]="";
diff -r 396839c5d70f -r 4faa0bb578e0 examples/win32test/win32test.vc10.vcxproj
--- a/examples/win32test/win32test.vc10.vcxproj Wed Jun 13 19:07:41 2012 +0200
+++ b/examples/win32test/win32test.vc10.vcxproj Wed Jun 13 19:08:58 2012 +0200
@@ -18,7 +18,7 @@
Application
- MultiByte
+ Unicode
Application
@@ -57,6 +57,7 @@
Level3
EditAndContinue
+ $(OutDir)$(ProjectName).pdb
$(OutDir)win32test.exe
diff -r 396839c5d70f -r 4faa0bb578e0 include/can_driver.h
--- a/include/can_driver.h Wed Jun 13 19:07:41 2012 +0200
+++ b/include/can_driver.h Wed Jun 13 19:08:58 2012 +0200
@@ -49,11 +49,14 @@
#if !defined(WIN32) || defined(__CYGWIN__)
#define DLL_CALL(funcname) funcname##_driver
#else
+#define LIBAPI __stdcall
//Windows was missing the definition of the calling convention
-#define DLL_CALL(funcname) __stdcall funcname##_driver
+#define DLL_CALL(funcname) LIBAPI funcname##_driver
#endif
#endif //DLL_CALL
+#define LIBPUBLIC
+
#ifndef FCT_PTR_INIT
#define FCT_PTR_INIT
#endif
diff -r 396839c5d70f -r 4faa0bb578e0 include/win32/applicfg.h
--- a/include/win32/applicfg.h Wed Jun 13 19:07:41 2012 +0200
+++ b/include/win32/applicfg.h Wed Jun 13 19:08:58 2012 +0200
@@ -101,9 +101,9 @@
//Visual Studio 2005 and above
#ifdef UNICODE
#define MSG(...) \
- do{wchar_t msg[300];\
- swprintf(msg,sizeof(msg)/sizeof(msg[0]), L##__VA_ARGS__); \
- OutputDebugString(msg);}while(0)
+ do{char msg[300];\
+ sprintf(msg, __VA_ARGS__); \
+ OutputDebugStringA(msg);}while(0)
#else
#define MSG(...) \
do{char msg[300];\
@@ -126,7 +126,7 @@
#define CANFESTIVAL_DEBUG_MSG(num, str, val)\
{unsigned long value = val;\
- MSG(("%s(%d) : 0x%X %s 0x%lX\n",__FILE__, __LINE__,num, str, value)); \
+ MSG("%s(%d) : 0x%X %s 0x%lX\n",__FILE__, __LINE__,num, str, value); \
}
#define CANFESTIVAL_DEBUG_DRV_MSG(...)\
diff -r 396839c5d70f -r 4faa0bb578e0 include/win32/canfestival.h
--- a/include/win32/canfestival.h Wed Jun 13 19:07:41 2012 +0200
+++ b/include/win32/canfestival.h Wed Jun 13 19:08:58 2012 +0200
@@ -32,7 +32,7 @@
typedef HINSTANCE LIB_HANDLE;
UNS8 UnLoadCanDriver(LIB_HANDLE handle);
-LIB_HANDLE LoadCanDriver(LPCTSTR driver_name);
+LIB_HANDLE LoadCanDriver(LPCSTR driver_name);
UNS8 canSend(CAN_PORT port, Message *m);
CAN_PORT canOpen(s_BOARD *board, CO_Data * d);
int canClose(CO_Data * d);