--- a/configure Fri Feb 03 15:43:44 2012 +0100
+++ b/configure Sat Feb 04 00:57:39 2012 +0100
@@ -28,17 +28,17 @@
# Number of can bus to use
MAX_CAN_BUS_ID=1
-# max bytes to transmit by SDO Put 4 if you only support expedited transfert.
-#For a normal transfert, (usually for a string), put the maximum string size to transfer.
-SDO_MAX_LENGTH_TRANSFERT=32
-
-# For block transfert, number of segments transmitted at once.
+# max bytes to transmit by SDO Put 4 if you only support expedited transfer.
+#For a normal transfer, (usually for a string), put the maximum string size to transfer.
+SDO_MAX_LENGTH_TRANSFER=32
+
+# For block transfer, number of segments transmitted at once.
# SDO_BLOCK_SIZE CAN frames must fit into the CAN Tx buffer
SDO_BLOCK_SIZE=16
# Number of SDO from differents nodes that the node can manage concurrently.
#for a slave node, usually put 1.
-SDO_MAX_SIMULTANEOUS_TRANSFERTS=4
+SDO_MAX_SIMULTANEOUS_TRANSFERS=4
# Used for NMTable[bus][nodeId]
# You can put less of 128 if on the netwo
@@ -125,9 +125,9 @@
echo "On user request: LSS FastScan service enabled";;
--debug=*) DEBUG=$optarg;;
--MAX_CAN_BUS_ID=*) MAX_CAN_BUS_ID=$optarg;;
- --SDO_MAX_LENGTH_TRANSFERT=*) SDO_MAX_LENGTH_TRANSFERT=$optarg;;
+ --SDO_MAX_LENGTH_TRANSFER=*) SDO_MAX_LENGTH_TRANSFER=$optarg;;
--SDO_BLOCK_SIZE=*) SDO_BLOCK_SIZE=$optarg;;
- --SDO_MAX_SIMULTANEOUS_TRANSFERTS=*) SDO_MAX_SIMULTANEOUS_TRANSFERTS=$optarg;;
+ --SDO_MAX_SIMULTANEOUS_TRANSFERS=*) SDO_MAX_SIMULTANEOUS_TRANSFERS=$optarg;;
--NMT_MAX_NODE_ID=*) NMT_MAX_NODE_ID=$optarg;;
--SDO_TIMEOUT_MS=*) SDO_TIMEOUT_MS=$optarg;;
--CANOPEN_BIG_ENDIAN=*) CANOPEN_BIG_ENDIAN=$optarg;;
@@ -183,9 +183,9 @@
echo
echo "Stack compilation constants"
echo " --MAX_CAN_BUS_ID [=1] Number of can bus to use"
- echo " --SDO_MAX_LENGTH_TRANSFERT [=32] max bytes to transmit by SDO"
- echo " --SDO_BLOCK_SIZE [=16] max CAN frames transmitted at once for block transfert"
- echo " --SDO_MAX_SIMULTANEOUS_TRANSFERTS [=4] Number of SDO that the node can manage concurrently"
+ echo " --SDO_MAX_LENGTH_TRANSFER [=32] max bytes to transmit by SDO"
+ echo " --SDO_BLOCK_SIZE [=16] max CAN frames transmitted at once for block transfer"
+ echo " --SDO_MAX_SIMULTANEOUS_TRANSFERS [=4] Number of SDO that the node can manage concurrently"
echo " --NMT_MAX_NODE_ID [=128] can be reduced to gain memory on small network"
echo " --SDO_TIMEOUT_MS [=3000] Timeout in milliseconds for SDO (None to disable the feature)"
echo " --EMCY_MAX_ERRORS [=8] Max number of active errors managed in error_data structure"
@@ -672,9 +672,9 @@
echo "" >> include/config.h
for i in \
MAX_CAN_BUS_ID\
- SDO_MAX_LENGTH_TRANSFERT\
+ SDO_MAX_LENGTH_TRANSFER\
SDO_BLOCK_SIZE\
- SDO_MAX_SIMULTANEOUS_TRANSFERTS\
+ SDO_MAX_SIMULTANEOUS_TRANSFERS\
NMT_MAX_NODE_ID\
SDO_TIMEOUT_MS\
MAX_NB_TIMER\
@@ -695,7 +695,7 @@
echo "" >> include/config.h
for i in \
- SDO_MAX_SIMULTANEOUS_TRANSFERTS\
+ SDO_MAX_SIMULTANEOUS_TRANSFERS\
NMT_MAX_NODE_ID\
EMCY_MAX_ERRORS; do
echo "#define REPEAT_"$i"_TIMES(repeat)\\">> include/config.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/drivers/can_multi_peeakwin32/can_multi_peak_win32.c Sat Feb 04 00:57:39 2012 +0100
@@ -0,0 +1,461 @@
+/*
+ This file is part of CanFestival, a library implementing CanOpen Stack.
+
+ Copyright (C): Jaroslav Fojtik
+*/
+
+#if defined(WIN32) && !defined(__CYGWIN__)
+#define usleep(micro) Sleep(micro%1000 ? (micro/1000) + 1 : (micro/1000))
+#else
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#endif
+
+
+#include "cancfg.h"
+#include "can_driver.h"
+#include "def.h"
+
+UNS8 LIBAPI canSend_driver(CAN_HANDLE fd0, Message const *m);
+
+
+#define VERSION_2
+
+/* dummy implementation for older version. */
+#ifndef VERSION_2
+void CAN_SetRcvEvent(HANDLE hEventx)
+{
+ SetEvent(hEventx);
+}
+#endif
+
+
+#define SLAVE_COUNT 10
+#define QueueSize 100
+
+
+#ifndef extra_PCAN_init_params
+ #define extra_PCAN_init_params /**/
+#else
+ long int print_getenv(const char* pcanparam)
+ {
+ char* param=NULL;
+ long int res=0;
+
+ param = getenv(pcanparam);
+ if(param != NULL){
+ res = strtol(param,NULL,0);
+ }
+ else
+ printf("Environment variable %s not defined !\n", pcanparam);
+ printf("Found environment variable %s : %ld\n", pcanparam ,res);
+ return res;
+ }
+ #define extra_PCAN_init_params\
+ ,print_getenv("PCANHwType")\
+ ,print_getenv("PCANIO_Port")\
+ ,print_getenv("PCANInterupt")
+#endif
+
+
+
+typedef struct
+{
+ s_BOARD *board;
+ Message MQueue[QueueSize];
+ unsigned QStart, QEnd;
+ HANDLE hEventx;
+} QueueRecord;
+
+int initialisedQ = 0;
+QueueRecord Q_DATA[10];
+
+
+/** Store message into a queue. */
+static void PushMsgToQueue(QueueRecord *QR, Message *m)
+{
+ if(QR==NULL || m==NULL) return;
+ if(QR->board==NULL) return; // No Board assigned yet
+ memcpy(&QR->MQueue[QR->QStart], m, sizeof(Message));
+ QR->QStart = (QR->QStart + 1) % QueueSize;
+ if(QR->QEnd==QR->QStart) QR->QEnd = (QR->QEnd+1) % QueueSize;
+ if(QR->hEventx) SetEvent(QR->hEventx); // Signalise internal flag
+}
+
+
+/** Get message from a queue. */
+static int PopMsgFromQueue(QueueRecord *QR, Message *m)
+{
+ if(QR==NULL || m==NULL) return 0;
+ if(QR->QEnd == QR->QStart) return 0;
+
+ memcpy(m, &QR->MQueue[QR->QEnd], sizeof(Message));
+ QR->QEnd = (QR->QEnd+1) % QueueSize;
+ return 1;
+}
+
+
+/** Create the Event for the first board */
+HANDLE hEvent1 = NULL;
+CRITICAL_SECTION InitLock;
+
+
+// Define for rtr CAN message
+#define CAN_INIT_TYPE_ST_RTR MSGTYPE_STANDARD | MSGTYPE_RTR
+
+
+/***************************************************************************/
+static int TranslateBaudeRate(char* optarg)
+{
+ if(!strcmp( optarg, "1M")) return CAN_BAUD_1M;
+ if(!strcmp( optarg, "500K")) return CAN_BAUD_500K;
+ if(!strcmp( optarg, "250K")) return CAN_BAUD_250K;
+ if(!strcmp( optarg, "125K")) return CAN_BAUD_125K;
+ if(!strcmp( optarg, "100K")) return CAN_BAUD_100K;
+ if(!strcmp( optarg, "50K")) return CAN_BAUD_50K;
+ if(!strcmp( optarg, "20K")) return CAN_BAUD_20K;
+ if(!strcmp( optarg, "10K")) return CAN_BAUD_10K;
+ if(!strcmp( optarg, "5K")) return CAN_BAUD_5K;
+ if(!strcmp( optarg, "none")) return 0;
+ return 0x0000;
+}
+
+
+static UNS8 canInit(s_BOARD *board)
+{
+int baudrate;
+int ret = 0;
+
+ if(hEvent1==NULL)
+ { //Create the Event for the first board
+ hEvent1 = CreateEvent(NULL, // lpEventAttributes
+ FALSE, // bManualReset
+ FALSE, // bInitialState
+ ""); // lpName
+ InitializeCriticalSection(&InitLock);
+ }
+
+ EnterCriticalSection(&InitLock);
+
+ if(baudrate = TranslateBaudeRate(board->baudrate))
+ {
+ ret = CAN_Init(baudrate, CAN_INIT_TYPE_ST extra_PCAN_init_params);
+ if(ret != CAN_ERR_OK)
+ {
+ LeaveCriticalSection(&InitLock);
+ return 0;
+ }
+ }
+
+ CAN_SetRcvEvent(hEvent1); //Set Event Handler for CANReadExt
+ LeaveCriticalSection(&InitLock);
+ return 1;
+}
+
+
+/********* functions which permit to communicate with the board ****************/
+UNS8 LIBAPI canReceive_driver(CAN_HANDLE fd0, Message *m)
+{
+static int HeavyCounter = 0;
+int ret=0;
+UNS8 data;
+TPCANMsg peakMsg;
+DWORD Res;
+DWORD result;
+HANDLE hh[2];
+int i;
+
+#ifdef CAN_READ_EX
+ TPCANTimestamp peakRcvTime;
+#endif
+
+ i = strtol(((s_BOARD *)fd0)->busname,NULL,0);
+ if(i>=SLAVE_COUNT || i<0) return 1; // error
+ if(Q_DATA[i].board!=(s_BOARD *)fd0) return 1; // error
+
+ hh[0]=hEvent1; hh[1]=Q_DATA[i].hEventx;
+
+ // loop until valid message or fatal error
+ do
+ {
+CONTINUE:
+ if(PopMsgFromQueue(&Q_DATA[i],m)) return 0; //message is waiting in the internal queue
+
+ // We read the queue looking for messages.
+#ifdef VERSION_2
+ result = WaitForMultipleObjects(2,hh,FALSE,15);
+ if(Q_DATA[i].board==NULL) return 1; //exit hook, exit immediatelly when device is closed
+
+ if(result == WAIT_OBJECT_0+1)
+ goto CONTINUE; //look to a PopMsgFromQueue() (continue will check while(), goto skips it)
+
+ if(result==WAIT_OBJECT_0 || result==WAIT_TIMEOUT)
+ {
+#endif
+#ifdef CAN_READ_EX
+ Res = CAN_ReadEx(&peakMsg, &peakRcvTime);
+#else
+ Res = CAN_Read(&peakMsg);
+#endif
+ // Exit receive thread when handle is no more valid
+#ifdef CAN_ERRMASK_ILLHANDLE
+ if(Res & CAN_ERRMASK_ILLHANDLE) return 1;
+#else
+ if(Res & CAN_ERR_ILLHANDLE) return 1;
+#endif
+
+#ifndef VERSION_2
+ if(Res != CAN_ERR_OK)
+ result = WaitForSingleObject(hEvent1, 1); //pooling for pcan release<2
+#endif
+ if(Res==CAN_ERR_QRCVEMPTY) goto CONTINUE;
+#ifdef VERSION_2
+ }
+ else
+ {
+ //if(result==WAIT_TIMEOUT || result==(WAIT_OBJECT_0+1))
+ // Res = CAN_ERR_BUSLIGHT;
+ //else
+ Res = CAN_ERR_UNKNOWN;
+ }
+#endif
+
+ if(Res==CAN_ERR_BUSHEAVY)
+ {
+ if(HeavyCounter++>10)
+ {
+ HeavyCounter = 0;
+ Res=CAN_ERR_BUSOFF;
+ }
+ }
+
+ if(Res & CAN_ERR_BUSOFF)
+ {
+ peakMsg.MSGTYPE = MSGTYPE_STATUS;
+ peakMsg.DATA[3] = CAN_ERR_BUSOFF;
+ Res = CAN_ERR_OK;
+ }
+
+ // A message was received : we process the message(s)
+ if(Res == CAN_ERR_OK)
+ {
+ // if something different that 11bit or rtr... problem
+ switch(peakMsg.MSGTYPE)
+ {
+ case MSGTYPE_STATUS:
+ switch(peakMsg.DATA[3])
+ {
+ case CAN_ERR_BUSHEAVY:
+ break;
+ case CAN_ERR_BUSOFF:
+ printf ("Peak board read BUSOFF: re-init!!!\n");
+ canInit((s_BOARD*)fd0);
+ usleep(2000);
+ break;
+ }
+ return peakMsg.DATA[3]; /* if something different that 11bit or rtr... problem */
+
+ case MSGTYPE_STANDARD: /* bits of MSGTYPE_ */
+ case MSGTYPE_EXTENDED:
+ m->rtr = 0;
+ break;
+
+ case MSGTYPE_RTR: /* bits of MSGTYPE_ */
+ m->rtr = 1;
+ break;
+
+ default: return CAN_ERR_OVERRUN; /* If status, return status if 29bit, return overrun. */
+
+ }
+
+ m->cob_id = 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 */
+#if defined DEBUG_MSG_CONSOLE_ON
+ MSG("in : ");
+ print_message(m);
+#endif
+ }
+ else
+ { // not benign error => fatal error
+ if(!(Res & CAN_ERR_QRCVEMPTY
+ || Res & CAN_ERR_BUSLIGHT
+ || Res & CAN_ERR_BUSHEAVY))
+ {
+ printf ("canReceive returned error (%d)\n", Res);
+ return 1;
+ }
+ }
+ } while(Res != CAN_ERR_OK);
+
+
+ // populate message received to other drivers
+ for(i=0; i<SLAVE_COUNT; i++)
+ {
+ if(Q_DATA[i].board != (s_BOARD *)fd0) // do not populate to own queue
+ {
+ PushMsgToQueue(&Q_DATA[i],m);
+ }
+ }
+
+ return 0;
+}
+
+
+/***************************************************************************/
+UNS8 LIBAPI canSend_driver(CAN_HANDLE fd0, Message const *m)
+{
+UNS8 data;
+TPCANMsg peakMsg;
+int i, j;
+int loc_errno;
+int MaxLoops = 100;
+
+ i = -1;
+ for(j=0; j<SLAVE_COUNT; j++)
+ {
+ if(Q_DATA[j].board != (s_BOARD *)fd0) // store this message forr all other drivers
+ {
+ PushMsgToQueue(&Q_DATA[j],m);
+ i = j;
+ }
+ }
+
+ if(i<0) return 1; // no board found
+
+ peakMsg.ID = m->cob_id; /* 11/29 bit code */
+ if(m->rtr == 0)
+ {
+ if(peakMsg.ID > 0x7FF)
+ peakMsg.MSGTYPE = MSGTYPE_EXTENDED; /* bits of MSGTYPE_ */
+ else
+ peakMsg.MSGTYPE = MSGTYPE_STANDARD; /* bits of MSGTYPE_ */
+ }
+ else
+ peakMsg.MSGTYPE = MSGTYPE_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 */
+
+ do
+ {
+ errno = loc_errno = CAN_Write(&peakMsg);
+
+ if(loc_errno)
+ {
+ if(loc_errno==CAN_ERR_BUSOFF && (MaxLoops%20)==1)
+ {
+#if defined DEBUG_MSG_CONSOLE_ON
+ printf ("Peak board write: re-init!!!\n");
+#endif
+ canInit((s_BOARD*)fd0);
+ usleep(1000);
+ }
+ usleep(80);
+ }
+ if(MaxLoops-- == 0) break; // limit max looping
+ } while(loc_errno != CAN_ERR_OK);
+
+#if defined DEBUG_MSG_CONSOLE_ON
+ MSG("out : ");
+ print_message(m);
+#endif
+ return 0;
+}
+
+
+/***************************************************************************/
+UNS8 LIBAPI canChangeBaudRate_driver(CAN_HANDLE fd, char* baud)
+{
+ printf("canChangeBaudRate not yet supported by this driver\n");
+ return 0;
+}
+
+
+/***************************************************************************/
+LIBPUBLIC CAN_HANDLE LIBAPI canOpen_driver(s_BOARD * board)
+{
+int ret;
+int i;
+
+ if(!initialisedQ)
+ {
+ memset(Q_DATA,0,sizeof(Q_DATA));
+ initialisedQ = 1;
+ }
+
+ i = strtol(board->busname,NULL,0); // Get slot name
+ //printf ("Board Busname=%d.\n",strtol(board->busname, &pEnd,0));
+ if(i<SLAVE_COUNT && i>=0)
+ {
+ Q_DATA[i].board = board;
+ //printf ("First Board selected\n");
+ if(Q_DATA[i].hEventx==NULL) // Create local event
+ {
+ Q_DATA[i].hEventx = CreateEvent(NULL, FALSE, FALSE, "");
+ }
+
+ if(hEvent1!=NULL) return (CAN_HANDLE)board; // Create global event, if needed
+
+ ret = canInit(board);
+ if(ret)
+ return (CAN_HANDLE)board;
+ }
+
+ return NULL;
+}
+
+
+/***************************************************************************/
+int LIBAPI canClose_driver(CAN_HANDLE fd0)
+{
+s_BOARD *x_board = NULL;
+int ActiveBoards = 0;
+int i;
+
+ if((s_BOARD *)fd0==NULL) return 0;
+ for(i=0; i<SLAVE_COUNT; i++)
+ {
+ if(Q_DATA[i].board == (s_BOARD *)fd0)
+ {
+ x_board = Q_DATA[i].board;
+ Q_DATA[i].board = NULL;
+ CloseHandle(Q_DATA[i].hEventx);
+ Q_DATA[i].hEventx = NULL;
+ }
+ else
+ ActiveBoards++;
+ }
+
+ if(ActiveBoards<=0)
+ { // No can device is used.
+ CAN_SetRcvEvent(NULL);
+ CAN_Close();
+ if(hEvent1)
+ {
+ SetEvent(hEvent1);
+ CloseHandle(hEvent1);
+ hEvent1 = NULL;
+ }
+ }
+ else
+ SetEvent(hEvent1);
+
+ return 0;
+}
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/drivers/can_multi_peeakwin32/can_multi_peak_win32.def Sat Feb 04 00:57:39 2012 +0100
@@ -0,0 +1,8 @@
+LIBRARY can_multi_peak_win32
+
+EXPORTS
+ canReceive_driver
+ canSend_driver
+ canOpen_driver
+ canClose_driver
+ canChangeBaudRate_driver
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/drivers/can_multi_peeakwin32/can_multi_peak_win32.vcproj Sat Feb 04 00:57:39 2012 +0100
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="can_multi_peak_win32"
+ ProjectGUID="{732EC5B6-C6F1-4783-9BC8-924FFF67BF5A}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="../../Debug"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../include;../../include/win32;../../../lib/PEAK-2.49/Include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CANpeak_EXPORTS"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ ProgramDataBaseFileName="$(IntDir)/can_multi_peak_win32.pdb"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Pcan_usb.lib"
+ OutputFile="$(OutDir)/can_multi_peak_win32.dll"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories=""..\..\..\lib\PEAK-2.49\VC_LIB""
+ ModuleDefinitionFile="can_multi_peak_win32.def"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/can_multi_peak_win32.pdb"
+ SubSystem="2"
+ OptimizeForWindows98="1"
+ ImportLibrary="$(OutDir)/can_multi_peak_win32.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="../../Release"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../include;../../include/win32;../../../lib/PEAK-2.49/Include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;CANpeak_EXPORTS"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Pcan_usb.lib"
+ OutputFile="$(OutDir)/can_multi_peak_win32.dll"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories=""..\..\..\lib\PEAK-2.49\VC_LIB""
+ ModuleDefinitionFile="can_multi_peak_win32.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ OptimizeForWindows98="1"
+ ImportLibrary="$(OutDir)/can_multi_peak_win32.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release UNICODE|Win32"
+ OutputDirectory=""../../Release UNICODE""
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../include;../../include/win32;../../../lib/PEAK-2.49/Include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;CANpeak_EXPORTS"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/can_multi_peak_win32.dll"
+ LinkIncremental="1"
+ ModuleDefinitionFile="can_multi_peak_win32.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ OptimizeForWindows98="1"
+ ImportLibrary="$(OutDir)/can_multi_peak_win32.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug UNICODE|Win32"
+ OutputDirectory=""../../Debug UNICODE""
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../include;../../include/win32;../../../lib/PEAK-2.49/Include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CANpeak_EXPORTS"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/can_multi_peak_win32.dll"
+ LinkIncremental="2"
+ ModuleDefinitionFile="can_multi_peak_win32.def"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/can_multi_peak_win32.pdb"
+ SubSystem="2"
+ OptimizeForWindows98="1"
+ ImportLibrary="$(OutDir)/can_multi_peak_win32.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release2|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../include;../../include/win32;../../../lib/PEAK-2.49/Include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;CANpeak_EXPORTS;PCAN2_HEADER_"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ ProgramDataBaseFileName="$(IntDir)/can2_multi_peak_win32.pdb"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Pcan_2usb.lib"
+ OutputFile="$(OutDir)/can2_multi_peak_win32.dll"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories=""..\..\..\lib\PEAK-2.49\VC_LIB""
+ ModuleDefinitionFile="can_multi_peak_win32.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ OptimizeForWindows98="1"
+ ImportLibrary="$(OutDir)/can_multi_peak_win32.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug2|Win32"
+ OutputDirectory="../../Debug"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../include;../../include/win32;../../../lib/PEAK-2.49/Include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CANpeak_EXPORTS;PCAN2_HEADER_"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ ProgramDataBaseFileName="$(IntDir)/can2_multi_peak_win32.pdb"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Pcan_2usb.lib"
+ OutputFile="$(OutDir)/can2_multi_peak_win32.dll"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories=""..\..\..\lib\PEAK-2.49\VC_LIB""
+ ModuleDefinitionFile="can_multi_peak_win32.def"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/can_multi_peak_win32.pdb"
+ SubSystem="2"
+ OptimizeForWindows98="1"
+ ImportLibrary="$(OutDir)/can_multi_peak_win32.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath=".\can_multi_peak_win32.c">
+ </File>
+ <File
+ RelativePath=".\can_multi_peak_win32.def">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ <File
+ RelativePath=".\cancfg.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/drivers/can_multi_peeakwin32/cancfg.h Sat Feb 04 00:57:39 2012 +0100
@@ -0,0 +1,56 @@
+/*
+This file is part of CanFestival, a library implementing CanOpen Stack.
+
+Copyright (C): Jaroslav Fojtik
+
+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
+*/
+
+#ifndef __CANCFG_H__
+#define __CANCFG_H__
+
+
+#if defined(__CYGWIN__)
+#include <windef.h>
+#else
+#include <windows.h>
+#endif
+
+// Following part of the file is copied by configure script
+// from choosen PcanLight header file
+//-------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------
+
+#ifdef PCAN2_HEADER_
+ #include "pcan_2usb.h"
+ #define CAN_Init(wBTR0BTR1,Type) CAN2_Init(wBTR0BTR1,Type)
+ #define CAN_Close() CAN2_Close()
+ #define CAN_Status() CAN2_Status()
+ #define CAN_Write(PCANMsg) CAN2_Write(PCANMsg)
+ #define CAN_Read(PCANMsg) CAN2_Read(PCANMsg)
+ #define CAN_VersionInfo(lpszTextBuff) CAN2_VersionInfo(lpszTextBuff)
+ #define CAN_ResetClient() CAN2_ResetClient()
+ #define CAN_MsgFilter(FromID,ToID,Type) CAN2_MsgFilter(FromID,ToID,Type)
+ #define CAN_ReadEx(pMsgBuff,pRcvTime) CAN2_ReadEx(pMsgBuff,pRcvTime)
+ #define CAN_SetRcvEvent(hEvent) CAN2_SetRcvEvent(hEvent)
+#else
+ #include "pcan_usb.h"
+#endif
+
+
+#endif
\ No newline at end of file
--- a/drivers/can_peak_win32/can_peak_win32.c Fri Feb 03 15:43:44 2012 +0100
+++ b/drivers/can_peak_win32/can_peak_win32.c Sat Feb 04 00:57:39 2012 +0100
@@ -2,6 +2,7 @@
This file is part of CanFestival, a library implementing CanOpen Stack.
Copyright (C): Edouard TISSERANT and Francis DUPIN
+Modified by: Jaroslav Fojtik
See COPYING file for copyrights details.
--- a/drivers/timers_win32/timers_win32.c Fri Feb 03 15:43:44 2012 +0100
+++ b/drivers/timers_win32/timers_win32.c Sat Feb 04 00:57:39 2012 +0100
@@ -45,7 +45,7 @@
HANDLE timer_thread = NULL;
HANDLE timer = NULL;
-int stop_timer=0;
+volatile int stop_timer=0;
static TimerCallback_t init_callback;
--- a/drivers/win32/win32.c Fri Feb 03 15:43:44 2012 +0100
+++ b/drivers/win32/win32.c Sat Feb 04 00:57:39 2012 +0100
@@ -3,6 +3,7 @@
Copyright (C): Edouard TISSERANT and Francis DUPIN
Copyright (C) Win32 Port Leonid Tochinski
+Modified by: Jaroslav Fojtik
See COPYING file for copyrights details.
@@ -118,6 +119,17 @@
m_canOpen = (CANOPEN_DRIVER_PROC)GetProcAddress(handle, myTEXT("canOpen_driver"));
m_canClose = (CANCLOSE_DRIVER_PROC)GetProcAddress(handle, myTEXT("canClose_driver"));
m_canChangeBaudRate = (CANCHANGEBAUDRATE_DRIVER_PROC)GetProcAddress(handle, myTEXT("canChangeBaudRate_driver"));
+
+ if(m_canReceive==NULL || m_canSend==NULL || m_canOpen==NULL || m_canClose==NULL || m_canChangeBaudRate==NULL)
+ {
+ m_canReceive = NULL;
+ m_canSend = NULL;
+ m_canOpen = NULL;
+ m_canClose = NULL;
+ m_canChangeBaudRate = NULL;
+ FreeLibrary(handle);
+ handle = NULL;
+ }
#else
//compiled in...
handle = 1; //TODO: remove this hack
@@ -140,27 +152,35 @@
{
return m_canSend(((CANPort*)port)->fd, m);
}
- return 1;
-}
-
-/***************************************************************************/
-void canReceiveLoop(CAN_PORT port)
+ return 1; /* NOT OK */
+}
+
+/***************************************************************************/
+DWORD canReceiveLoop(CAN_PORT port)
{
Message m;
while(((CANPort*)port)->used)
{
- if(m_canReceive(((CANPort*)port)->fd, &m) != 0) break;
+ if(m_canReceive(((CANPort*)port)->fd, &m) != 0) continue;
EnterMutex();
canDispatch(((CANPort*)port)->d, &m);
LeaveMutex();
}
+ return 0;
}
/***************************************************************************/
CAN_HANDLE canOpen(s_BOARD *board, CO_Data * d)
{
int i;
- CAN_HANDLE fd0;
+ CAN_HANDLE fd0;
+
+
+ /* Fix of multiple opening one data set, added by J.Fojtik. */
+ if(d->canHandle)
+ {
+ canClose(d);
+ }
for(i=0; i < MAX_NB_CAN_PORTS; i++)
{
@@ -196,28 +216,27 @@
/***************************************************************************/
int canClose(CO_Data * d)
{
- UNS8 res = 1;
+ UNS8 res;
CANPort* tmp;
- if((CANPort*)d->canHandle)
- {
- ((CANPort*)d->canHandle)->used = 0;
- }
-
tmp = (CANPort*)d->canHandle;
if(tmp)
{
- // kill receiver task before port is closed and handle set to NULL
+ d->canHandle = NULL;
+
+ // close CAN port
+ res = m_canClose(tmp->fd);
+
+ // kill receiver task
WaitReceiveTaskEnd(&tmp->receiveTask);
- // close CAN port
- res = m_canClose(tmp->fd);
- }
-
- d->canHandle = NULL;
-
- return res;
+ // release used flag as a last step.
+ tmp->used = 0;
+ }
+ else res = 255;
+
+return res;
}
UNS8 canChangeBaudRate(CAN_PORT port, char* baud)
--- a/include/AT91/Atmel/lib_AT91SAM7X256.h Fri Feb 03 15:43:44 2012 +0100
+++ b/include/AT91/Atmel/lib_AT91SAM7X256.h Sat Feb 04 00:57:39 2012 +0100
@@ -1867,7 +1867,7 @@
//*----------------------------------------------------------------------------
//* \fn AT91F_SPI_Close
-//* \brief Close SPI: disable IT disable transfert, close PDC
+//* \brief Close SPI: disable IT disable transfer, close PDC
//*----------------------------------------------------------------------------
__inline void AT91F_SPI_Close (
AT91PS_SPI pSPI) // \arg pointer to a SPI controller
--- a/include/AT91/config.h Fri Feb 03 15:43:44 2012 +0100
+++ b/include/AT91/config.h Sat Feb 04 00:57:39 2012 +0100
@@ -51,8 +51,8 @@
// Needed defines by Canfestival lib
#define MAX_CAN_BUS_ID 1
-#define SDO_MAX_LENGTH_TRANSFERT 32
-#define SDO_MAX_SIMULTANEOUS_TRANSFERTS 1
+#define SDO_MAX_LENGTH_TRANSFER 32
+#define SDO_MAX_SIMULTANEOUS_TRANSFERS 1
#define NMT_MAX_NODE_ID 128
#define SDO_TIMEOUT_MS 3000U
#define MAX_NB_TIMER 8
@@ -62,7 +62,7 @@
#define US_TO_TIMEVAL_FACTOR 8
-#define REPEAT_SDO_MAX_SIMULTANEOUS_TRANSFERTS_TIMES(repeat)\
+#define REPEAT_SDO_MAX_SIMULTANEOUS_TRANSFERS_TIMES(repeat)\
repeat
#define REPEAT_NMT_MAX_NODE_ID_TIMES(repeat)\
repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat
--- a/include/AVR/config.h Fri Feb 03 15:43:44 2012 +0100
+++ b/include/AVR/config.h Sat Feb 04 00:57:39 2012 +0100
@@ -48,9 +48,9 @@
// Needed defines by Canfestival lib
#define MAX_CAN_BUS_ID 1
-#define SDO_MAX_LENGTH_TRANSFERT 32
+#define SDO_MAX_LENGTH_TRANSFER 32
#define SDO_BLOCK_SIZE 16
-#define SDO_MAX_SIMULTANEOUS_TRANSFERTS 1
+#define SDO_MAX_SIMULTANEOUS_TRANSFERS 1
#define NMT_MAX_NODE_ID 128
#define SDO_TIMEOUT_MS 3000U
#define MAX_NB_TIMER 8
@@ -60,7 +60,7 @@
#define US_TO_TIMEVAL_FACTOR 8
-#define REPEAT_SDO_MAX_SIMULTANEOUS_TRANSFERTS_TIMES(repeat)\
+#define REPEAT_SDO_MAX_SIMULTANEOUS_TRANSFERS_TIMES(repeat)\
repeat
#define REPEAT_NMT_MAX_NODE_ID_TIMES(repeat)\
repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat
--- a/include/data.h Fri Feb 03 15:43:44 2012 +0100
+++ b/include/data.h Sat Feb 04 00:57:39 2012 +0100
@@ -67,7 +67,7 @@
valueRangeTest_t valueRangeTest;
/* SDO */
- s_transfer transfers[SDO_MAX_SIMULTANEOUS_TRANSFERTS];
+ s_transfer transfers[SDO_MAX_SIMULTANEOUS_TRANSFERS];
/* s_sdo_parameter *sdo_parameters; */
/* State machine */
@@ -251,7 +251,7 @@
\
/* SDO, structure s_transfer */\
{\
- REPEAT_SDO_MAX_SIMULTANEOUS_TRANSFERTS_TIMES(s_transfer_Initializer)\
+ REPEAT_SDO_MAX_SIMULTANEOUS_TRANSFERS_TIMES(s_transfer_Initializer)\
},\
\
/* State machine*/\
--- a/include/def.h Fri Feb 03 15:43:44 2012 +0100
+++ b/include/def.h Sat Feb 04 00:57:39 2012 +0100
@@ -42,7 +42,7 @@
*/
#define SDOABT_TOGGLE_NOT_ALTERNED 0x05030000
#define SDOABT_TIMED_OUT 0x05040000
-#define SDOABT_OUT_OF_MEMORY 0x05040005 /* Size data exceed SDO_MAX_LENGTH_TRANSFERT */
+#define SDOABT_OUT_OF_MEMORY 0x05040005 /* Size data exceed SDO_MAX_LENGTH_TRANSFER */
#define SDOABT_GENERAL_ERROR 0x08000000 /* Error size of SDO message */
#define SDOABT_LOCAL_CTRL_ERROR 0x08000021
@@ -82,7 +82,7 @@
*/
#define SDO_PROVIDED_BUFFER_TOO_SMALL 0x8A
-/* Status of the node during the SDO transfert : */
+/* Status of the node during the SDO transfer : */
#define SDO_SERVER 0x1
#define SDO_CLIENT 0x2
#define SDO_UNKNOWN 0x3
--- a/include/sdo.h Fri Feb 03 15:43:44 2012 +0100
+++ b/include/sdo.h Sat Feb 04 00:57:39 2012 +0100
@@ -71,7 +71,7 @@
* WARNING s_transfer.data is subject to ENDIANISATION
* (with respect to CANOPEN_BIG_ENDIAN)
*/
- UNS8 data [SDO_MAX_LENGTH_TRANSFERT];
+ UNS8 data [SDO_MAX_LENGTH_TRANSFER];
#ifdef SDO_DYNAMIC_BUFFER_ALLOCATION
UNS8 *dynamicData;
UNS32 dynamicDataSize;
@@ -120,7 +120,7 @@
/**
- * @brief Copy the data received from the SDO line transfert to the object dictionary.
+ * @brief Copy the data received from the SDO line transfer to the object dictionary.
* @param *d Pointer on a CAN object data structure
* @param line SDO line
* @return SDO error code if error. Else, returns 0.
@@ -128,7 +128,7 @@
UNS32 SDOlineToObjdict (CO_Data* d, UNS8 line);
/**
- * @brief Copy the data from the object dictionary to the SDO line for a network transfert.
+ * @brief Copy the data from the object dictionary to the SDO line for a network transfer.
* @param *d Pointer on a CAN object data structure
* @param line SDO line
* @return SDO error code if error. Else, returns 0.
@@ -288,7 +288,7 @@
* @param *m Pointer on a CAN message structure
* @return code :
* - 0xFF if error
- * - 0x80 if transfert aborted by the server
+ * - 0x80 if transfer aborted by the server
* - 0x0 ok
*/
UNS8 proceedSDO (CO_Data* d, Message *m);
@@ -421,8 +421,8 @@
*
* @return
* - SDO_FINISHED // datas are available
- * - SDO_ABORTED_RCV // Transfert failed (abort SDO received)
- * - SDO_ABORTED_INTERNAL // Transfert failed (internal abort)
+ * - SDO_ABORTED_RCV // Transfer failed (abort SDO received)
+ * - SDO_ABORTED_INTERNAL // Transfer failed (internal abort)
* - SDO_UPLOAD_IN_PROGRESS // Datas are not yet available
* - SDO_DOWNLOAD_IN_PROGRESS // Download is in progress
* - SDO_PROVIDED_BUFFER_TOO_SMALL //The value *size is not enough to store the received data
@@ -449,8 +449,8 @@
*
* @return :
* - SDO_FINISHED // datas are available
- * - SDO_ABORTED_RCV // Transfert failed (abort SDO received)
- * - SDO_ABORTED_INTERNAL // Transfert failed (Internal abort)
+ * - SDO_ABORTED_RCV // Transfer failed (abort SDO received)
+ * - SDO_ABORTED_INTERNAL // Transfer failed (Internal abort)
* - SDO_DOWNLOAD_IN_PROGRESS // Datas are not yet available
* - SDO_UPLOAD_IN_PROGRESS // Upload in progress
* \n\n
--- a/include/win32/config.h Fri Feb 03 15:43:44 2012 +0100
+++ b/include/win32/config.h Sat Feb 04 00:57:39 2012 +0100
@@ -25,10 +25,10 @@
#define CO_ENABLE_LSS
#define MAX_CAN_BUS_ID 1
-#define SDO_DYNAMIC_BUFFER_ALLOCATION //New define, if SDO_MAX_LENGTH_TRANSFERT is exceeded allocate data buffer dynamically
+#define SDO_DYNAMIC_BUFFER_ALLOCATION //New define, if SDO_MAX_LENGTH_TRANSFER is exceeded allocate data buffer dynamically
#define SDO_DYNAMIC_BUFFER_ALLOCATION_SIZE (1024 * 128)
-#define SDO_MAX_LENGTH_TRANSFERT 32
-#define SDO_MAX_SIMULTANEOUS_TRANSFERTS 32
+#define SDO_MAX_LENGTH_TRANSFER 32
+#define SDO_MAX_SIMULTANEOUS_TRANSFERS 32
#define NMT_MAX_NODE_ID 128
#define SDO_TIMEOUT_MS 3000
#define MAX_NB_TIMER 32
@@ -41,7 +41,7 @@
#define LSS_TIMEOUT_MS 1000
#define LSS_FS_TIMEOUT_MS 100
-#define REPEAT_SDO_MAX_SIMULTANEOUS_TRANSFERTS_TIMES(repeat)\
+#define REPEAT_SDO_MAX_SIMULTANEOUS_TRANSFERS_TIMES(repeat)\
repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat
#define REPEAT_NMT_MAX_NODE_ID_TIMES(repeat)\
repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat repeat
--- a/src/sdo.c Fri Feb 03 15:43:44 2012 +0100
+++ b/src/sdo.c Sat Feb 04 00:57:39 2012 +0100
@@ -123,7 +123,7 @@
*/
#define getSDOsubIndex(byte3) (byte3)
-/** Returns the subcommand in SDO block transfert
+/** Returns the subcommand in SDO block transfer
*/
#define getSDOblockSC(byte) (byte & 3)
@@ -188,7 +188,7 @@
UNS8 j;
/* transfer structure initialization */
- for (j = 0 ; j < SDO_MAX_SIMULTANEOUS_TRANSFERTS ; j++)
+ for (j = 0 ; j < SDO_MAX_SIMULTANEOUS_TRANSFERS ; j++)
resetSDOline(d, j);
}
@@ -211,7 +211,7 @@
size = d->transfers[line].count;
#ifdef SDO_DYNAMIC_BUFFER_ALLOCATION
- if (size > SDO_MAX_LENGTH_TRANSFERT)
+ if (size > SDO_MAX_LENGTH_TRANSFER)
{
errorCode = setODentry(d, d->transfers[line].index, d->transfers[line].subIndex,
(void *) d->transfers[line].dynamicData, &size, 1);
@@ -243,7 +243,7 @@
**/
UNS32 objdictToSDOline (CO_Data* d, UNS8 line)
{
- UNS32 size = SDO_MAX_LENGTH_TRANSFERT;
+ UNS32 size = SDO_MAX_LENGTH_TRANSFER;
UNS8 dataType;
UNS32 errorCode;
@@ -304,8 +304,8 @@
UNS32 offset;
#ifndef SDO_DYNAMIC_BUFFER_ALLOCATION
- if ((d->transfers[line].offset + nbBytes) > SDO_MAX_LENGTH_TRANSFERT) {
- MSG_ERR(0x1A10,"SDO Size of data too large. Exceed SDO_MAX_LENGTH_TRANSFERT", nbBytes);
+ if ((d->transfers[line].offset + nbBytes) > SDO_MAX_LENGTH_TRANSFER) {
+ MSG_ERR(0x1A10,"SDO Size of data too large. Exceed SDO_MAX_LENGTH_TRANSFER", nbBytes);
return 0xFF;
}
#endif //SDO_DYNAMIC_BUFFER_ALLOCATION
@@ -316,7 +316,7 @@
}
offset = d->transfers[line].offset;
#ifdef SDO_DYNAMIC_BUFFER_ALLOCATION
- if (d->transfers[line].count <= SDO_MAX_LENGTH_TRANSFERT)
+ if (d->transfers[line].count <= SDO_MAX_LENGTH_TRANSFER)
{
for (i = 0 ; i < nbBytes ; i++)
* (data + i) = d->transfers[line].data[offset + i];
@@ -354,8 +354,8 @@
UNS8 i;
UNS32 offset;
#ifndef SDO_DYNAMIC_BUFFER_ALLOCATION
- if ((d->transfers[line].offset + nbBytes) > SDO_MAX_LENGTH_TRANSFERT) {
- MSG_ERR(0x1A15,"SDO Size of data too large. Exceed SDO_MAX_LENGTH_TRANSFERT", nbBytes);
+ if ((d->transfers[line].offset + nbBytes) > SDO_MAX_LENGTH_TRANSFER) {
+ MSG_ERR(0x1A15,"SDO Size of data too large. Exceed SDO_MAX_LENGTH_TRANSFER", nbBytes);
return 0xFF;
}
#endif //SDO_DYNAMIC_BUFFER_ALLOCATION
@@ -364,7 +364,7 @@
#ifdef SDO_DYNAMIC_BUFFER_ALLOCATION
{
UNS8* lineData = d->transfers[line].data;
- if ((d->transfers[line].offset + nbBytes) > SDO_MAX_LENGTH_TRANSFERT) {
+ if ((d->transfers[line].offset + nbBytes) > SDO_MAX_LENGTH_TRANSFER) {
if (d->transfers[line].dynamicData == NULL) {
d->transfers[line].dynamicData = (UNS8*) malloc(SDO_DYNAMIC_BUFFER_ALLOCATION_SIZE);
d->transfers[line].dynamicDataSize = SDO_DYNAMIC_BUFFER_ALLOCATION_SIZE;
@@ -450,7 +450,7 @@
UNS32 i;
MSG_WAR(0x3A25, "reset SDO line nb : ", line);
initSDOline(d, line, 0, 0, 0, SDO_RESET);
- for (i = 0 ; i < SDO_MAX_LENGTH_TRANSFERT ; i++)
+ for (i = 0 ; i < SDO_MAX_LENGTH_TRANSFER ; i++)
d->transfers[line].data[i] = 0;
d->transfers[line].whoami = 0;
d->transfers[line].abortCode = 0;
@@ -516,7 +516,7 @@
UNS8 i;
- for (i = 0 ; i < SDO_MAX_SIMULTANEOUS_TRANSFERTS ; i++){
+ for (i = 0 ; i < SDO_MAX_SIMULTANEOUS_TRANSFERS ; i++){
if ( d->transfers[i].state == SDO_RESET ) {
*line = i;
d->transfers[i].whoami = whoami;
@@ -542,7 +542,7 @@
UNS8 i;
- for (i = 0 ; i < SDO_MAX_SIMULTANEOUS_TRANSFERTS ; i++){
+ for (i = 0 ; i < SDO_MAX_SIMULTANEOUS_TRANSFERS ; i++){
if ( (d->transfers[i].state != SDO_RESET) &&
(d->transfers[i].state != SDO_ABORTED_INTERNAL) &&
(d->transfers[i].CliServNbr == CliServNbr) &&
@@ -569,7 +569,7 @@
UNS8 i;
- for (i = 0 ; i < SDO_MAX_SIMULTANEOUS_TRANSFERTS ; i++){
+ for (i = 0 ; i < SDO_MAX_SIMULTANEOUS_TRANSFERS ; i++){
if ( (d->transfers[i].state != SDO_RESET) &&
(d->transfers[i].CliServNbr == CliServNbr) &&
(d->transfers[i].whoami == whoami) ) {
@@ -639,8 +639,8 @@
UNS8 setSDOlineRestBytes (CO_Data* d, UNS8 line, UNS32 nbBytes)
{
#ifndef SDO_DYNAMIC_BUFFER_ALLOCATION
- if (nbBytes > SDO_MAX_LENGTH_TRANSFERT) {
- MSG_ERR(0x1A35,"SDO Size of data too large. Exceed SDO_MAX_LENGTH_TRANSFERT", nbBytes);
+ if (nbBytes > SDO_MAX_LENGTH_TRANSFER) {
+ MSG_ERR(0x1A35,"SDO Size of data too large. Exceed SDO_MAX_LENGTH_TRANSFER", nbBytes);
return 0xFF;
}
#endif //SDO_DYNAMIC_BUFFER_ALLOCATION
@@ -761,10 +761,10 @@
UNS32 *pCobId = NULL;
UNS16 offset;
UNS16 lastIndex;
- UNS8 SubCommand; /* Block transfert only */
- UNS8 SeqNo; /* Sequence number in block transfert */
+ UNS8 SubCommand; /* Block transfer only */
+ UNS8 SeqNo; /* Sequence number in block transfer */
UNS8 AckSeq; /* Sequence number of last segment that was received successfully */
- UNS8 NbBytesNoData; /* Number of bytes that do not contain data in last segment of block transfert */
+ UNS8 NbBytesNoData; /* Number of bytes that do not contain data in last segment of block transfer */
MSG_WAR(0x3A60, "proceedSDO ", 0);
whoami = SDO_UNKNOWN;
@@ -833,12 +833,12 @@
MSG_WAR(0x3A69, "I am SERVER number ", CliServNbr);
}
- /* Look for an SDO transfert already initiated. */
+ /* Look for an SDO transfer already initiated. */
err = getSDOlineOnUse( d, CliServNbr, whoami, &line );
/* Let's find cs value, first it is set as "not valid" */
cs = 0xFF;
- /* Special cases for block transfert : in frames with segment data cs is not spécified */
+ /* Special cases for block transfer : in frames with segment data cs is not spécified */
if (!err) {
if ((whoami == SDO_SERVER) && (d->transfers[line].state == SDO_BLOCK_DOWNLOAD_IN_PROGRESS) ||
(whoami == SDO_CLIENT) && (d->transfers[line].state == SDO_BLOCK_UPLOAD_IN_PROGRESS)) {
@@ -860,7 +860,7 @@
case 0:
/* I am SERVER */
if (whoami == SDO_SERVER) {
- /* Receiving a download segment data : an SDO transfert should have been yet initiated. */
+ /* Receiving a download segment data : an SDO transfer should have been yet initiated. */
if (!err)
err = d->transfers[line].state != SDO_DOWNLOAD_IN_PROGRESS;
if (err) {
@@ -882,7 +882,7 @@
}
/* Nb of data to be downloaded */
nbBytes = 7 - getSDOn3(m->data[0]);
- /* Store the data in the transfert structure. */
+ /* Store the data in the transfer structure. */
err = SDOtoLine(d, line, nbBytes, (*m).data + 1);
if (err) {
failedSDO(d, CliServNbr, whoami, index, subIndex, SDOABT_GENERAL_ERROR);
@@ -973,7 +973,7 @@
MSG_WAR(0x3A80, "Writing at index : ", index);
MSG_WAR(0x3A80, "Writing at subIndex : ", subIndex);
- /* Search if a SDO transfert have been yet initiated */
+ /* Search if a SDO transfer have been yet initiated */
if (! err) {
MSG_ERR(0x1A81, "SDO error : Transmission yet started.", 0);
failedSDO(d, CliServNbr, whoami, index, subIndex, SDOABT_LOCAL_CTRL_ERROR);
@@ -1001,9 +1001,9 @@
return 0xFF;
}
- /* SDO expedited -> transfert finished. Data can be stored in the dictionary. */
+ /* SDO expedited -> transfer finished. Data can be stored in the dictionary. */
/*The line will be reseted when it is downloading in the dictionary. */
- MSG_WAR(0x3A83, "SDO Initiate Download is an expedited transfert. Finished. ", 0);
+ MSG_WAR(0x3A83, "SDO Initiate Download is an expedited transfer. Finished. ", 0);
/* Transfering line data to object dictionary. */
errorCode = SDOlineToObjdict(d, line);
if (errorCode) {
@@ -1014,7 +1014,7 @@
/* Release of the line. */
resetSDOline(d, line);
}
- else {/* So, if it is not an expedited transfert */
+ else {/* So, if it is not an expedited transfer */
if (getSDOs(m->data[0])) {
nbBytes = (m->data[4]) + ((UNS32)(m->data[5])<<8) + ((UNS32)(m->data[6])<<16) + ((UNS32)(m->data[7])<<24);
err = setSDOlineRestBytes(d, line, nbBytes);
@@ -1103,7 +1103,7 @@
CliServNbr);
MSG_WAR(0x3A90, "Reading at index : ", index);
MSG_WAR(0x3A91, "Reading at subIndex : ", subIndex);
- /* Search if a SDO transfert have been yet initiated*/
+ /* Search if a SDO transfer have been yet initiated*/
if (! err) {
MSG_ERR(0x1A92, "SDO error : Transmission yet started at line : ", line);
MSG_WAR(0x3A93, "Server Nbr = ", CliServNbr);
@@ -1131,7 +1131,7 @@
/* Preparing the response.*/
getSDOlineRestBytes(d, line, &nbBytes); /* Nb bytes to transfer ? */
if (nbBytes > 4) {
- /* normal transfert. (segmented). */
+ /* normal transfer. (segmented). */
/* code to send the initiate upload response. (cs = 2) */
data[0] = (2 << 5) | 1;
data[1] = index & 0xFF; /* LSB */
@@ -1189,7 +1189,7 @@
failedSDO(d, CliServNbr, whoami, index, subIndex, SDOABT_GENERAL_ERROR);
return 0xFF;
}
- /* SDO expedited -> transfert finished. data are available via getReadResultNetworkDict(). */
+ /* SDO expedited -> transfer finished. data are available via getReadResultNetworkDict(). */
MSG_WAR(0x3A98, "SDO expedited upload finished. Response received from node : ", nodeId);
StopSDO_TIMER(line)
d->transfers[line].count = nbBytes;
@@ -1197,7 +1197,7 @@
if(d->transfers[line].Callback) (*d->transfers[line].Callback)(d,nodeId);
return 0;
}
- else { /* So, if it is not an expedited transfert */
+ else { /* So, if it is not an expedited transfer */
/* Storing the nb of data to receive. */
if (getSDOs(m->data[0])) {
nbBytes = m->data[4] + ((UNS32)(m->data[5])<<8) + ((UNS32)(m->data[6])<<16) + ((UNS32)(m->data[7])<<24);
@@ -1221,7 +1221,7 @@
/* I am SERVER */
if (whoami == SDO_SERVER) {
/* Receiving a upload segment. */
- /* A SDO transfert should have been yet initiated. */
+ /* A SDO transfer should have been yet initiated. */
if (!err)
err = d->transfers[line].state != SDO_UPLOAD_IN_PROGRESS;
if (err) {
@@ -1366,7 +1366,7 @@
CliServNbr);
MSG_WAR(0x3AB3, "Reading at index : ", index);
MSG_WAR(0x3AB4, "Reading at subIndex : ", subIndex);
- /* Search if a SDO transfert have been yet initiated */
+ /* Search if a SDO transfer have been yet initiated */
if (! err) {
MSG_ERR(0x1A93, "SDO error : Transmission yet started at line : ", line);
MSG_WAR(0x3AB5, "Server Nbr = ", CliServNbr);
@@ -1408,7 +1408,7 @@
}
else if (SubCommand == SDO_BCS_END_UPLOAD_REQUEST) {
MSG_WAR(0x3AA2, "Received SDO block END upload request defined at index 0x1200 + ", CliServNbr);
- /* A SDO transfert should have been yet initiated. */
+ /* A SDO transfer should have been yet initiated. */
if (!err)
err = d->transfers[line].state != SDO_BLOCK_UPLOAD_IN_PROGRESS;
if (err) {
@@ -1421,7 +1421,7 @@
resetSDOline(d, line);
}
else if ((SubCommand == SDO_BCS_UPLOAD_RESPONSE) || (SubCommand == SDO_BCS_START_UPLOAD)) {
- /* A SDO transfert should have been yet initiated. */
+ /* A SDO transfer should have been yet initiated. */
if (!err)
err = d->transfers[line].state != SDO_BLOCK_UPLOAD_IN_PROGRESS;
if (err) {
@@ -1636,7 +1636,7 @@
else {
if (SeqNo == (d->transfers[line].seqno + 1)) {
d->transfers[line].seqno = SeqNo;
- /* Store the data in the transfert structure. */
+ /* Store the data in the transfer structure. */
err = SDOtoLine(d, line, 7, (*m).data + 1);
if (err) {
failedSDO(d, CliServNbr, whoami, d->transfers[line].index, d->transfers[line].subIndex, SDOABT_GENERAL_ERROR);
@@ -1664,7 +1664,7 @@
}
RestartSDO_TIMER(line)
NbBytesNoData = (m->data[0]>>2) & 0x07;
- /* Store the data in the transfert structure. */
+ /* Store the data in the transfer structure. */
err = SDOtoLine(d, line, 7-NbBytesNoData, d->transfers[line].tmpData + 1);
if (err) {
failedSDO(d, CliServNbr, whoami, d->transfers[line].index, d->transfers[line].subIndex, SDOABT_GENERAL_ERROR);
@@ -1736,7 +1736,7 @@
else {
if (SeqNo == (d->transfers[line].seqno + 1)) {
d->transfers[line].seqno = SeqNo;
- /* Store the data in the transfert structure. */
+ /* Store the data in the transfer structure. */
err = SDOtoLine(d, line, 7, (*m).data + 1);
if (err) {
failedSDO(d, CliServNbr, whoami, d->transfers[line].index, d->transfers[line].subIndex, SDOABT_GENERAL_ERROR);
@@ -1762,7 +1762,7 @@
return 0xFF;
}
NbBytesNoData = (m->data[0]>>2) & 0x07;
- /* Store the data in the transfert structure. */
+ /* Store the data in the transfer structure. */
err = SDOtoLine(d, line, 7-NbBytesNoData, d->transfers[line].tmpData + 1);
if (err) {
failedSDO(d, CliServNbr, whoami, d->transfers[line].index, d->transfers[line].subIndex, SDOABT_GENERAL_ERROR);
@@ -1909,7 +1909,7 @@
#ifdef SDO_DYNAMIC_BUFFER_ALLOCATION
{
UNS8* lineData = d->transfers[line].data;
- if (count > SDO_MAX_LENGTH_TRANSFERT)
+ if (count > SDO_MAX_LENGTH_TRANSFER)
{
d->transfers[line].dynamicData = (UNS8*) malloc(count);
d->transfers[line].dynamicDataSize = count;
@@ -1952,13 +1952,13 @@
}
else {
/* Send the SDO to the server. Initiate download, cs=1. */
- if (count <= 4) { /* Expedited transfert */
+ if (count <= 4) { /* Expedited transfer */
buf[0] = (UNS8)((1 << 5) | ((4 - count) << 2) | 3);
for (i = 4 ; i < 8 ; i++)
buf[i] = d->transfers[line].data[i - 4];
d->transfers[line].offset = count;
}
- else { /** Normal transfert */
+ else { /** Normal transfer */
buf[0] = (1 << 5) | 1;
for (i = 0 ; i < 4 ; i++)
buf[i+4] = (UNS8)((count >> (i<<3))); /* i*8 */
@@ -2267,7 +2267,7 @@
return SDO_ABORTED_INTERNAL;
}
- /* If transfert not finished just return, but if aborted set abort code and size to 0 */
+ /* If transfer not finished just return, but if aborted set abort code and size to 0 */
if (d->transfers[line].state != SDO_FINISHED) {
if((d->transfers[line].state == SDO_ABORTED_RCV) || (d->transfers[line].state == SDO_ABORTED_INTERNAL)) {
*abortCode = d->transfers[line].abortCode;