Piotr Trojanek (ptroja) cleanup patche. Thanks.
--- a/doc/doxygen/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-html
-
--- a/doc/manual/en/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-manual.lyx
-manual.out
-manual.pdf
-manual.toc
-manual.aux
-manual.log
-html
--- a/drivers/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Makefile
--- a/drivers/can_anagate_linux/can_anagate_linux.c Fri Nov 12 22:49:26 2010 +0100
+++ b/drivers/can_anagate_linux/can_anagate_linux.c Sat Nov 13 00:03:24 2010 +0100
@@ -104,7 +104,7 @@
}
/***************************************************************************/
-UNS8 canSend_driver(CAN_HANDLE fd0, Message *m)
+UNS8 canSend_driver(CAN_HANDLE fd0, Message const *m)
{
struct SAnaGatePort* pAnaCanPort = (struct SAnaGatePort*)fd0;
char cErrorMsg[100];
--- a/drivers/can_anagate_win32/can_anagate_win32.c Fri Nov 12 22:49:26 2010 +0100
+++ b/drivers/can_anagate_win32/can_anagate_win32.c Sat Nov 13 00:03:24 2010 +0100
@@ -108,7 +108,7 @@
}
/***************************************************************************/
-UNS8 canSend_driver(CAN_HANDLE fd0, Message *m)
+UNS8 canSend_driver(CAN_HANDLE fd0, Message const *m)
{
SAnaGatePort* pAnaCanPort = (SAnaGatePort*)fd0;
char cErrorMsg[100];
--- a/drivers/can_can4linux/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-libcanfestival_can_can4linux.so
-Makefile
--- a/drivers/can_can4linux/can_can4linux.c Fri Nov 12 22:49:26 2010 +0100
+++ b/drivers/can_can4linux/can_can4linux.c Sat Nov 13 00:03:24 2010 +0100
@@ -75,7 +75,7 @@
}
/***************************************************************************/
-UNS8 canSend_driver(CAN_HANDLE fd0, Message *m)
+UNS8 canSend_driver(CAN_HANDLE fd0, Message const *m)
{
int res;
canmsg_t canmsg;
--- a/drivers/can_ixxat_win32/ixxat.cpp Fri Nov 12 22:49:26 2010 +0100
+++ b/drivers/can_ixxat_win32/ixxat.cpp Sat Nov 13 00:03:24 2010 +0100
@@ -301,7 +301,7 @@
}
extern "C"
- UNS8 canSend_driver(CAN_HANDLE inst, Message *m)
+ UNS8 canSend_driver(CAN_HANDLE inst, Message const *m)
{
return (UNS8)reinterpret_cast<IXXAT*>(inst)->send(m);
}
@@ -331,4 +331,4 @@
{
//printf("canChangeBaudRate not yet supported by this driver\n");
return 0;
- }
\ No newline at end of file
+ }
--- a/drivers/can_kvaser/can_kvaser.c Fri Nov 12 22:49:26 2010 +0100
+++ b/drivers/can_kvaser/can_kvaser.c Sat Nov 13 00:03:24 2010 +0100
@@ -93,7 +93,7 @@
* so fd0 needs to be decremented before use.
*
*/
-UNS8 canSend_driver(CAN_HANDLE fd0, Message *m)
+UNS8 canSend_driver(CAN_HANDLE fd0, Message const *m)
{
canStatus retval = canOK;
unsigned flags = 0;
--- a/drivers/can_lincan/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Makefile
--- a/drivers/can_lincan/can_lincan.c Fri Nov 12 22:49:26 2010 +0100
+++ b/drivers/can_lincan/can_lincan.c Sat Nov 13 00:03:24 2010 +0100
@@ -62,7 +62,7 @@
}
/***************************************************************************/
-UNS8 canSend_driver(CAN_HANDLE fd0, Message *m)
+UNS8 canSend_driver(CAN_HANDLE fd0, Message const *m)
{
int res;
struct canmsg_t canmsg;
--- a/drivers/can_peak_linux/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-Makefile
-libcanfestival_can_peak_linux.so
--- a/drivers/can_peak_linux/can_peak_linux.c Fri Nov 12 22:49:26 2010 +0100
+++ b/drivers/can_peak_linux/can_peak_linux.c Sat Nov 13 00:03:24 2010 +0100
@@ -67,7 +67,7 @@
}
/***************************************************************************/
-UNS8 canSend_driver(CAN_HANDLE fd0, Message *m)
+UNS8 canSend_driver(CAN_HANDLE fd0, Message const *m)
{
UNS8 data;
TPCANMsg peakMsg;
--- a/drivers/can_peak_win32/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-Makefile
-cancfg.h
-Debug UNICODE
-cygcan_peak_win32.dll
-can_peak_win32.ncb
-can_peak_win32.vcproj.KONG.edouard.user
-Release
--- a/drivers/can_peak_win32/can_peak_win32.c Fri Nov 12 22:49:26 2010 +0100
+++ b/drivers/can_peak_win32/can_peak_win32.c Sat Nov 13 00:03:24 2010 +0100
@@ -217,7 +217,7 @@
}
/***************************************************************************/
-UNS8 canSend_driver (CAN_HANDLE fd0, Message * m)
+UNS8 canSend_driver (CAN_HANDLE fd0, Message const * m)
{
UNS8 data;
DWORD localerrno;
--- a/drivers/can_serial/can_serial.c Fri Nov 12 22:49:26 2010 +0100
+++ b/drivers/can_serial/can_serial.c Sat Nov 13 00:03:24 2010 +0100
@@ -102,7 +102,7 @@
}
/***************************************************************************/
-UNS8 canSend_driver(CAN_HANDLE fd0, Message * m)
+UNS8 canSend_driver(CAN_HANDLE fd0, Message const * m)
{
int rv;
--- a/drivers/can_socket/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-libcanfestival_can_socket.so
-Makefile
--- a/drivers/can_socket/can_socket.c Fri Nov 12 22:49:26 2010 +0100
+++ b/drivers/can_socket/can_socket.c Sat Nov 13 00:03:24 2010 +0100
@@ -40,13 +40,18 @@
#define CAN_SETSOCKOPT rt_dev_setsockopt
#define CAN_ERRNO(err) (-err)
#else
+#include <unistd.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include "linux/can.h"
#include "linux/can/raw.h"
#include "net/if.h"
+#ifndef PF_CAN
#define PF_CAN 29
+#endif
+#ifndef AF_CAN
#define AF_CAN PF_CAN
+#endif
//#include "af_can.h"
#define CAN_IFNAME "can%s"
#define CAN_SOCKET socket
@@ -93,7 +98,7 @@
/***************************************************************************/
UNS8
-canSend_driver (CAN_HANDLE fd0, Message * m)
+canSend_driver (CAN_HANDLE fd0, Message const * m)
{
int res;
struct can_frame frame;
@@ -174,6 +179,11 @@
can_mode_t *mode;
#endif
+ if(!fd0)
+ {
+ return NULL;
+ }
+
*(int *) fd0 = CAN_SOCKET (PF_CAN, SOCK_RAW, CAN_RAW);
if (*(int *) fd0 < 0)
{
--- a/drivers/can_tcp_win32/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-libcanfestival_can_socket.so
-Makefile
-*.exe
-*.dll
--- a/drivers/can_tcp_win32/can_tcp_win32.cpp Fri Nov 12 22:49:26 2010 +0100
+++ b/drivers/can_tcp_win32/can_tcp_win32.cpp Sat Nov 13 00:03:24 2010 +0100
@@ -61,7 +61,7 @@
}
extern "C"
- UNS8 canSend_driver(CAN_HANDLE fd0, Message *m)
+ UNS8 canSend_driver(CAN_HANDLE fd0, Message const *m)
{
char s[1024];
sprintf(s,"{0x%3.3x,%1d,%1d,{0x%2.2x,0x%2.2x,0x%2.2x,0x%2.2x,0x%2.2x,0x%2.2x,0x%2.2x,0x%2.2x}}",
@@ -122,4 +122,4 @@
{
cerr << "canChangeBaudRate not yet supported by this driver\n";
return 0;
- }
\ No newline at end of file
+ }
--- a/drivers/can_uvccm_win32/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-Debug UNICODE
-can_uvccm_win32.vcproj.KONG.edouard.user
-Release
--- a/drivers/can_uvccm_win32/can_uvccm_win32.cpp Fri Nov 12 22:49:26 2010 +0100
+++ b/drivers/can_uvccm_win32/can_uvccm_win32.cpp Sat Nov 13 00:03:24 2010 +0100
@@ -323,7 +323,7 @@
}
extern "C"
- UNS8 canSend_driver(CAN_HANDLE fd0, Message *m)
+ UNS8 canSend_driver(CAN_HANDLE fd0, Message const *m)
{
return (UNS8)reinterpret_cast<can_uvccm_win32*>(fd0)->send(m);
}
@@ -352,4 +352,4 @@
UNS8 canChangeBaudRate_driver( CAN_HANDLE fd, char* baud)
{
return 0;
- }
\ No newline at end of file
+ }
--- a/drivers/can_virtual/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-Makefile
-*.a
-libcanfestival_can_virtual.so
--- a/drivers/can_virtual/can_virtual.c Fri Nov 12 22:49:26 2010 +0100
+++ b/drivers/can_virtual/can_virtual.c Sat Nov 13 00:03:24 2010 +0100
@@ -51,7 +51,7 @@
}
/***************************************************************************/
-UNS8 canSend_driver(CAN_HANDLE fd0, Message *m)
+UNS8 canSend_driver(CAN_HANDLE fd0, Message const *m)
{
int i;
--- a/drivers/can_virtual_kernel/can_virtual_kernel.c Fri Nov 12 22:49:26 2010 +0100
+++ b/drivers/can_virtual_kernel/can_virtual_kernel.c Sat Nov 13 00:03:24 2010 +0100
@@ -72,7 +72,7 @@
return 0;
}
-UNS8 canSend_driver(CAN_HANDLE fd0, Message *m)
+UNS8 canSend_driver(CAN_HANDLE fd0, Message const *m)
{
int i;
--- a/drivers/can_vscom/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-VSCAN_API_1_0.zip
-libvs_can_api_arm.so
-Makefile
-libvs_can_api.so
-vs_can_api.h
-vs_can_api.lib
-libcanfestival_can_vscom.so
-vs_can_api.dll
--- a/drivers/can_vscom/can_vscom.c Fri Nov 12 22:49:26 2010 +0100
+++ b/drivers/can_vscom/can_vscom.c Sat Nov 13 00:03:24 2010 +0100
@@ -79,7 +79,7 @@
}
/***************************************************************************/
-UNS8 canSend_driver(CAN_HANDLE fd0, Message *m)
+UNS8 canSend_driver(CAN_HANDLE fd0, Message const *m)
{
VSCAN_MSG Msg[1];
UNS8 i;
--- a/drivers/timers_rtai/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Makefile
--- a/drivers/timers_unix/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Makefile
--- a/drivers/timers_unix/timers_unix.c Fri Nov 12 22:49:26 2010 +0100
+++ b/drivers/timers_unix/timers_unix.c Sat Nov 13 00:03:24 2010 +0100
@@ -3,19 +3,16 @@
#include <sys/time.h>
#include <pthread.h>
#include <signal.h>
+#include <time.h>
#include "applicfg.h"
#include "timer.h"
-pthread_mutex_t CanFestival_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t CanFestival_mutex = PTHREAD_MUTEX_INITIALIZER;
-TASK_HANDLE TimerLoopThread;
+static struct timeval last_sig;
-TIMEVAL last_time_set = TIMEVAL_MAX;
-
-struct timeval last_sig;
-
-timer_t timer;
+static timer_t timer;
void TimerCleanup(void)
{
@@ -24,17 +21,23 @@
void EnterMutex(void)
{
- pthread_mutex_lock(&CanFestival_mutex);
+ if(pthread_mutex_lock(&CanFestival_mutex)) {
+ fprintf(stderr, "pthread_mutex_lock() failed\n");
+ }
}
void LeaveMutex(void)
{
- pthread_mutex_unlock(&CanFestival_mutex);
+ if(pthread_mutex_unlock(&CanFestival_mutex)) {
+ fprintf(stderr, "pthread_mutex_unlock() failed\n");
+ }
}
void timer_notify(sigval_t val)
{
- gettimeofday(&last_sig,NULL);
+ if(gettimeofday(&last_sig,NULL)) {
+ perror("gettimeofday()");
+ }
EnterMutex();
TimeDispatch();
LeaveMutex();
@@ -46,7 +49,9 @@
struct sigevent sigev;
// Take first absolute time ref.
- gettimeofday(&last_sig,NULL);
+ if(gettimeofday(&last_sig,NULL)){
+ perror("gettimeofday()");
+ }
#if defined(__UCLIBC__)
int ret;
@@ -59,14 +64,18 @@
sigev.sigev_notify_attributes = NULL;
sigev.sigev_notify_function = timer_notify;
- timer_create (CLOCK_REALTIME, &sigev, &timer);
+ if(timer_create (CLOCK_REALTIME, &sigev, &timer)) {
+ perror("timer_create()");
+ }
#endif
}
void StopTimerLoop(TimerCallback_t exitfunction)
{
EnterMutex();
- timer_delete (timer);
+ if(timer_delete (timer)) {
+ perror("timer_delete()");
+ }
exitfunction(NULL,0);
LeaveMutex();
}
@@ -91,22 +100,31 @@
*/
void* unixtimer_canReceiveLoop(void* port)
{
-
/*get signal*/
- signal(SIGTERM, canReceiveLoop_signal);
+ if(signal(SIGTERM, canReceiveLoop_signal) == SIG_ERR) {
+ perror("signal()");
+ }
unixtimer_ReceiveLoop_task_proc((CAN_PORT)port);
+
+ return NULL;
}
void CreateReceiveTask(CAN_PORT port, TASK_HANDLE* Thread, void* ReceiveLoopPtr)
{
unixtimer_ReceiveLoop_task_proc = ReceiveLoopPtr;
- pthread_create(Thread, NULL, unixtimer_canReceiveLoop, (void*)port);
+ if(pthread_create(Thread, NULL, unixtimer_canReceiveLoop, (void*)port)) {
+ perror("pthread_create()");
+ }
}
void WaitReceiveTaskEnd(TASK_HANDLE *Thread)
{
- pthread_kill(*Thread, SIGTERM);
- pthread_join(*Thread, NULL);
+ if(pthread_kill(*Thread, SIGTERM)) {
+ perror("pthread_kill()");
+ }
+ if(pthread_join(*Thread, NULL)) {
+ perror("pthread_join()");
+ }
}
#define maxval(a,b) ((a>b)?a:b)
@@ -128,7 +146,9 @@
TIMEVAL getElapsedTime(void)
{
struct timeval p;
- gettimeofday(&p,NULL);
+ if(gettimeofday(&p,NULL)) {
+ perror("gettimeofday()");
+ }
// printf("getCurrentTime() return=%u\n", p.tv_usec);
return (p.tv_sec - last_sig.tv_sec)* 1000000 + p.tv_usec - last_sig.tv_usec;
}
--- a/drivers/timers_win32/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Makefile
--- a/drivers/timers_xeno/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Makefile
--- a/drivers/unix/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-Makefile
-*.a
--- a/drivers/win32/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-Makefile
-*.a
--- a/examples/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Makefile
--- a/examples/DS401_Master/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-Makefile
-TestMasterMicroMod
-DS401_Master
--- a/examples/DS401_Slave_Gui/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-Makefile
-TestMasterSlave
-result.txt
-TestMasterSlave.exe
-TestMasterSalve.vcproj.KONG.edouard.user
-Release
-*.depend
-DS401_Slave_Gui
--- a/examples/SillySlave/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Makefile
--- a/examples/TestMasterMicroMod/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-Makefile
-TestMasterMicroMod
-*.exe
--- a/examples/TestMasterSlave/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-Makefile
-TestMasterSlave
-result.txt
-TestMasterSlave.exe
-TestMasterSalve.vcproj.KONG.edouard.user
-Release
--- a/examples/TestMasterSlaveLSS/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-Makefile
-TestMasterSlaveLSS
-result.txt
-TestMasterSlaveLSS.exe
-TestMasterSalve.vcproj.KONG.edouard.user
-Release
--- a/examples/win32test/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-Debug
-win32test.vcproj.KONG.edouard.user
-Release
--- a/include/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-config.h
--- a/include/can_driver.h Fri Nov 12 22:49:26 2010 +0100
+++ b/include/can_driver.h Sat Nov 13 00:03:24 2010 +0100
@@ -59,7 +59,7 @@
UNS8 DLL_CALL(canReceive)(CAN_HANDLE, Message *)FCT_PTR_INIT;
-UNS8 DLL_CALL(canSend)(CAN_HANDLE, Message *)FCT_PTR_INIT;
+UNS8 DLL_CALL(canSend)(CAN_HANDLE, Message const *)FCT_PTR_INIT;
CAN_HANDLE DLL_CALL(canOpen)(s_BOARD *)FCT_PTR_INIT;
int DLL_CALL(canClose)(CAN_HANDLE)FCT_PTR_INIT;
UNS8 DLL_CALL(canChangeBaudRate)(CAN_HANDLE, char *)FCT_PTR_INIT;
@@ -69,7 +69,7 @@
#define _P(fc) case fc: MSG(#fc" ");break;
-static inline void print_message(Message *m)
+static inline void print_message(Message const *m)
{
int i;
UNS8 fc;
--- a/include/nmtMaster.h Fri Nov 12 22:49:26 2010 +0100
+++ b/include/nmtMaster.h Sat Nov 13 00:03:24 2010 +0100
@@ -80,7 +80,7 @@
* @param *d Pointer to a CAN object data structure
* @param nodeId Id of the slave node
*/
-void masterRequestNodeState (CO_Data* d, UNS8 nodeId);
+UNS8 masterRequestNodeState (CO_Data* d, UNS8 nodeId);
#endif /* __nmtMaster_h__ */
--- a/objdictgen/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-Makefile
-objdict.xml
-gnosis
-Gnosis_Utils-1.2.1.tar.gz
-*.od
-*.pyc
-*.c
-*.h
-*.eds
-canfestival_config.py
--- a/objdictgen/doc_index/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-*.pyc
--- a/src/.cvsignore Fri Nov 12 22:49:26 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-Makefile
-libcanfestival.a
--- a/src/nmtMaster.c Fri Nov 12 22:49:26 2010 +0100
+++ b/src/nmtMaster.c Sat Nov 13 00:03:24 2010 +0100
@@ -88,8 +88,10 @@
**
** @param d
** @param nodeId
+**
+** @return
**/
-void masterRequestNodeState(CO_Data* d, UNS8 nodeId)
+UNS8 masterRequestNodeState(CO_Data* d, UNS8 nodeId)
{
/* FIXME: should warn for bad toggle bit. */
@@ -105,6 +107,6 @@
d->NMTable[i] = Unknown_state;
}
}
- masterSendNMTnodeguard(d,nodeId);
+ return masterSendNMTnodeguard(d,nodeId);
}