Updated doc. Cleaned some code.
authoretisserant
Wed, 11 Apr 2007 07:50:34 +0200
changeset 151 ebf4bd44f282
parent 150 d2fc5d5f8a36
child 152 5e14844e5756
Updated doc. Cleaned some code.
doc/canfestival_OS.png
doc/canfestival_OS.svg
doc/manual/en/manual.odt
doc/manual/en/manual.pdf
drivers/can_peak/.cvsignore
drivers/can_peak/Makefile.in
drivers/can_peak/can_peak.c
drivers/unix/unix.c
Binary file doc/canfestival_OS.png has changed
--- a/doc/canfestival_OS.svg	Sat Apr 07 09:49:05 2007 +0200
+++ b/doc/canfestival_OS.svg	Wed Apr 11 07:50:34 2007 +0200
@@ -20,7 +20,7 @@
    inkscape:export-xdpi="87.57"
    inkscape:export-ydpi="87.57"
    inkscape:output_extension="org.inkscape.output.svg.inkscape"
-   sodipodi:modified="TRUE">
+   sodipodi:modified="true">
   <defs
      id="defs4">
     <marker
@@ -105,16 +105,16 @@
      borderopacity="1.0"
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
-     inkscape:zoom="0.6302963"
-     inkscape:cx="765.19682"
-     inkscape:cy="373.17074"
+     inkscape:zoom="1.2605926"
+     inkscape:cx="740.98173"
+     inkscape:cy="552.24525"
      inkscape:document-units="px"
      inkscape:current-layer="layer1"
      showguides="true"
      inkscape:guide-bbox="true"
      inkscape:window-width="1592"
      inkscape:window-height="965"
-     inkscape:window-x="80"
+     inkscape:window-x="0"
      inkscape:window-y="0"
      showgrid="false"
      gridspacingy="1cm"
@@ -809,7 +809,7 @@
          sodipodi:role="line"
          id="tspan5230"
          x="466.21942"
-         y="566.78787"> s_BOARD SlaveBoard = {&quot;0&quot;, &quot;500K&quot;};</tspan><tspan
+         y="566.78787"> s_BOARD MyBoard = {&quot;0&quot;, &quot;500K&quot;};</tspan><tspan
          sodipodi:role="line"
          x="466.21942"
          y="582.04782"
@@ -1140,7 +1140,7 @@
          id="tspan6812">scheduled function call.</tspan></text>
     <path
        style="opacity:1;color:#ff0000;fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#ff0000;stroke-width:3.4000001;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:url(#Arrow2Mend);stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
-       d="M 967.14579,220.52677 C 991.41355,213.9215 964.05968,86.919629 959.18694,82.040011 C 896.38411,19.148526 571.25806,132.9419 379.06207,93.795141"
+       d="M 967.14579,220.52677 C 991.41355,213.9215 963.66304,74.623825 958.7903,69.744207 C 895.98747,6.8527216 571.25806,132.9419 379.06207,93.795141"
        id="path6816"
        sodipodi:nodetypes="csc" />
     <path
@@ -1187,7 +1187,7 @@
          y="670.44073"
          x="934.95794"
          sodipodi:role="line"
-         id="tspan8782">satck calls with</tspan><tspan
+         id="tspan8782">stack calls with</tspan><tspan
          y="692.89482"
          x="934.95795"
          sodipodi:role="line"
Binary file doc/manual/en/manual.odt has changed
Binary file doc/manual/en/manual.pdf has changed
--- a/drivers/can_peak/.cvsignore	Sat Apr 07 09:49:05 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Makefile
--- a/drivers/can_peak/Makefile.in	Sat Apr 07 09:49:05 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-#! gmake
-
-#
-# Copyright (C) 2006 Laurent Bessard
-# 
-# This file is part of canfestival, a library implementing the canopen
-# stack
-# 
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-# 
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-# 
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-# 
-
-CC = SUB_CC
-OPT_CFLAGS = -O2
-CFLAGS = SUB_OPT_CFLAGS
-PROG_CFLAGS = SUB_PROG_CFLAGS
-PREFIX = SUB_PREFIX
-TARGET = SUB_TARGET
-CAN_DRIVER = SUB_CAN_DRIVER
-TIMERS_DRIVER = SUB_TIMERS_DRIVER
-
-INCLUDES = -I../../include -I../../include/$(TARGET) -I../../include/$(CAN_DRIVER) -I../../include/$(TIMERS_DRIVER)
-
-OBJS = $(CAN_DRIVER).o
-
-SRC_HFILES = ../../include/$(CAN_DRIVER)/cancfg.h
-
-TARGET_HFILES = $(PREFIX)/include/canfestival/cancfg.h
-
-all: driver
-
-driver: $(OBJS)
-
-%o: %c
-	$(CC) $(CFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -o $@ -c $<
-
-install:
-	mkdir -p $(PREFIX)/include/canfestival
-	cp $(SRC_HFILES) $(PREFIX)/include/canfestival
-
-uninstall:
-	rm -f $(TARGET_HFILES)
-
-clean:
-	rm -f $(OBJS)
-
-mrproper: clean
--- a/drivers/can_peak/can_peak.c	Sat Apr 07 09:49:05 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +0,0 @@
-/*
-This file is part of CanFestival, a library implementing CanOpen Stack. 
-
-Copyright (C): Edouard TISSERANT and Francis DUPIN
-
-See COPYING file for copyrights details.
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <stddef.h> /* for NULL */
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/time.h>
-#include <unistd.h>
-
-/* driver pcan pci for Peak board */
-//#include "libpcan.h"
-//#include "pcan.h"
-
-#include "libpcan.h" // for CAN_HANDLE
-
-#include <applicfg.h>
-#include "timer.h"
-#include "can_driver.h"
-#include "timers_driver.h"
-
-#define MAX_NB_CAN_PORTS 16
-
-typedef struct {
-  char used;
-  HANDLE fd;
-  TASK_HANDLE receiveTask;
-  CO_Data* d;
-} CANPort;
-
-CANPort canports[MAX_NB_CAN_PORTS] = {{0,},};
-
-// Define for rtr CAN message
-#define CAN_INIT_TYPE_ST_RTR MSGTYPE_STANDARD | MSGTYPE_RTR 
-
-/*********functions which permit to communicate with the board****************/
-UNS8 canReceive(CAN_HANDLE fd0, Message *m)
-{
-  UNS8 data; 
-  TPCANMsg peakMsg;
-  if ((errno = CAN_Read(((CANPort*)fd0)->fd, & peakMsg))) {		// Blocks until no new message or error.
-    if(errno != -EIDRM && errno != -EPERM) // error is not "Can Port closed while reading" 
-    {
-    	perror("!!! Peak board : error of reading. (from f_can_receive function) \n");
-    }
-    return 1;
-  }
-  m->cob_id.w = peakMsg.ID;   
-  if (peakMsg.MSGTYPE == CAN_INIT_TYPE_ST)         	/* bits of MSGTYPE_*/
-    m->rtr = 0;
-  else 
-    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 */
-  
-  return 0;
-}
-
-void canReceiveLoop(CAN_HANDLE fd0)
-{
-	CO_Data* d = ((CANPort*)fd0)->d;
-	Message m;
-	while (1) {
-		if(!canReceive(fd0, &m))
-		{
-			EnterMutex();
-			canDispatch(d, &m);
-			LeaveMutex();
-		}else{
-//			printf("canReceive returned error\n");
-			break;
-		}
-	}
-}
-
-/***************************************************************************/
-UNS8 canSend(CAN_HANDLE fd0, Message *m)
-{
-  UNS8 data;
-  TPCANMsg peakMsg;
-  peakMsg.ID=m -> cob_id.w;              			/* 11/29 bit code */
-  if(m->rtr == 0)	
-    peakMsg.MSGTYPE = CAN_INIT_TYPE_ST;       /* bits of MSGTYPE_*/
-  else {
-    peakMsg.MSGTYPE = CAN_INIT_TYPE_ST_RTR;       /* bits of MSGTYPE_*/
-  }
-  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 */
-  
-  if((errno = CAN_Write(((CANPort*)fd0)->fd, & peakMsg))) {
-    perror("!!! Peak board : error of writing. (from canSend function) \n");
-    return 1;
-  }
-  return 0;
-
-}
-
-/***************************************************************************/
-CAN_HANDLE canOpen(s_BOARD *board)
-{
-  HANDLE fd0 = NULL;
-  char busname[64];
-  char* pEnd;
-  int i;  
-  
-  for(i=0; i < MAX_NB_CAN_PORTS; i++)
-  {
-  	if(!canports[i].used)
-	  	break;
-  }
-
-  if(strtol(board->busname, &pEnd,0) >= 0)
-  {
-    sprintf(busname,"/dev/pcan%s",board->busname);
-    fd0 = LINUX_CAN_Open(busname, O_RDWR);
-  }
-
-  if (i==MAX_NB_CAN_PORTS || fd0 == NULL)
-    {
-      fprintf (stderr, "Open failed.\n");
-      return (CAN_HANDLE)NULL;
-    }
-
-   CAN_Init(fd0, board->baudrate, CAN_INIT_TYPE_ST);
-
-   canports[i].used = 1;
-   canports[i].fd = fd0;
-
-   canports[i].d = board->d;
-   CreateReceiveTask((CANPort*) &canports[i], &canports[i].receiveTask);
-
-   return (CANPort*) &canports[i];
-}
-
-/***************************************************************************/
-int canClose(CAN_HANDLE fd0)
-{
-  CAN_Close(((CANPort*)fd0)->fd);
-  WaitReceiveTaskEnd(&((CANPort*)fd0)->receiveTask);
-  ((CANPort*)fd0)->used = 0;
-  return 0;
-}
--- a/drivers/unix/unix.c	Sat Apr 07 09:49:05 2007 +0200
+++ b/drivers/unix/unix.c	Wed Apr 11 07:50:34 2007 +0200
@@ -27,16 +27,6 @@
 #define DLL_CALL(funcname) (* funcname##_driver)
 #define FCT_PTR_INIT =NULL
 
-#ifdef WIN32
-#define DLSYM(name)\
-    *(void **) (&_##name) = GetProcAddress(handle, TEXT(#name"_driver"));\
-	if (name##_driver == NULL)  {\
-		fprintf (stderr, "Error loading symbol %s\n",#name"_driver");\
-		UnLoadCanDriver(handle);\
-		return NULL;\
-	}
- 
-#else
 #define DLSYM(name)\
 	*(void **) (&name##_driver) = dlsym(handle, #name"_driver");\
 	if ((error = dlerror()) != NULL)  {\
@@ -44,7 +34,6 @@
 		UnLoadCanDriver(handle);\
 		return NULL;\
 	}
-#endif
 
 #else /*NOT_USE_DYNAMIC_LOADING*/
 
@@ -83,11 +72,8 @@
 {
 	if(handle!=NULL)
 	{
-#ifdef WIN32
-	        FreeLibrary(handle);    
-#else
 		dlclose(handle);
-#endif
+
 		handle=NULL;
 		return 0;
 	}
@@ -100,21 +86,9 @@
 	LIB_HANDLE handle = NULL;
 	char *error;
 	
-#ifdef WIN32
 
 	if(handle==NULL)
 	{
-		handle = LoadLibrary(driver_name);
-	}
- 
-	if (handle == NULL) {
-        	fprintf(stderr,"Error loading Can Driver dll \n");
-        	return -1;
-	}
-
-#else
-	if(handle==NULL)
-	{
 		handle = dlopen(driver_name, RTLD_LAZY);
 	}
 
@@ -122,7 +96,6 @@
 		fprintf (stderr, "%s\n", dlerror());
         	return NULL;
 	}
-#endif
  
 	/*Get function ptr*/
 	DLSYM(canReceive)