Removed SDOTimeout application callback.Please use SDO callbacks instead.
authoretisserant
Tue, 24 Apr 2007 13:26:03 +0200
changeset 172 0248c2b148bb
parent 171 db7a030babb2
child 173 d776314a1efc
Removed SDOTimeout application callback.Please use SDO callbacks instead.
examples/TestMasterMicroMod/TestMasterMicroMod.c
examples/TestMasterSlave/Master.c
examples/TestMasterSlave/Master.h
examples/TestMasterSlave/Slave.c
examples/TestMasterSlave/Slave.h
examples/TestMasterSlave/TestMasterSlave.c
examples/gene_SYNC_HCS12/appli.c
examples/gene_SYNC_HCS12/objdict.h
examples/win32test/win32test.h
include/data.h
include/sdo.h
src/sdo.c
--- a/examples/TestMasterMicroMod/TestMasterMicroMod.c	Thu Apr 19 09:54:34 2007 +0200
+++ b/examples/TestMasterMicroMod/TestMasterMicroMod.c	Tue Apr 24 13:26:03 2007 +0200
@@ -47,12 +47,6 @@
 	eprintf("TestMaster_heartbeatError %d\n", heartbeatID);
 }
 
-/*****************************************************************************/
-void TestMaster_SDOtimeoutError (UNS8 line)
-{
-	eprintf("TestMaster_SDOtimeoutError %d\n", line);
-}
-
 /********************************************************
  * ConfigureSlaveNode is responsible to
  *  - setup master RPDO 1 to receive TPDO 1 from id 0x40
@@ -343,7 +337,6 @@
 #endif		
 
 	TestMaster_Data.heartbeatError = TestMaster_heartbeatError;
-	TestMaster_Data.SDOtimeoutError = TestMaster_SDOtimeoutError;
 	TestMaster_Data.initialisation = TestMaster_initialisation;
 	TestMaster_Data.preOperational = TestMaster_preOperational;
 	TestMaster_Data.operational = TestMaster_operational;
--- a/examples/TestMasterSlave/Master.c	Thu Apr 19 09:54:34 2007 +0200
+++ b/examples/TestMasterSlave/Master.c	Tue Apr 24 13:26:03 2007 +0200
@@ -30,12 +30,6 @@
 	eprintf("TestMaster_heartbeatError %d\n", heartbeatID);
 }
 
-/*****************************************************************************/
-void TestMaster_SDOtimeoutError (UNS8 line)
-{
-	eprintf("TestMaster_SDOtimeoutError %d\n", line);
-}
-
 /********************************************************
  * ConfigureSlaveNode is responsible to
  *  - setup master RPDO 1 to receive TPDO 1 from id 2
--- a/examples/TestMasterSlave/Master.h	Thu Apr 19 09:54:34 2007 +0200
+++ b/examples/TestMasterSlave/Master.h	Tue Apr 24 13:26:03 2007 +0200
@@ -1,6 +1,5 @@
 #include "TestMaster.h"
 
-void TestMaster_SDOtimeoutError(UNS8 line);
 void TestMaster_heartbeatError(UNS8);
 
 UNS8 TestMaster_canSend(Message *);
--- a/examples/TestMasterSlave/Slave.c	Thu Apr 19 09:54:34 2007 +0200
+++ b/examples/TestMasterSlave/Slave.c	Tue Apr 24 13:26:03 2007 +0200
@@ -30,12 +30,6 @@
 	eprintf("TestSlave_heartbeatError %d\n", heartbeatID);
 }
 
-/*****************************************************************************/
-void TestSlave_SDOtimeoutError (UNS8 line)
-{
-	eprintf("TestSlave_SDOtimeoutError %d\n", line);
-}
-
 void TestSlave_initialisation()
 {
 	eprintf("TestSlave_initialisation\n");
--- a/examples/TestMasterSlave/Slave.h	Thu Apr 19 09:54:34 2007 +0200
+++ b/examples/TestMasterSlave/Slave.h	Tue Apr 24 13:26:03 2007 +0200
@@ -1,6 +1,5 @@
 #include "TestSlave.h"
 
-void TestSlave_SDOtimeoutError(UNS8 line);
 void TestSlave_heartbeatError(UNS8);
 
 UNS8 TestSlave_canSend(Message *);
--- a/examples/TestMasterSlave/TestMasterSlave.c	Thu Apr 19 09:54:34 2007 +0200
+++ b/examples/TestMasterSlave/TestMasterSlave.c	Tue Apr 24 13:26:03 2007 +0200
@@ -191,7 +191,6 @@
 	if(strcmp( SlaveBoard.baudrate, "none")){
 		
 		TestSlave_Data.heartbeatError = TestSlave_heartbeatError;
-		TestSlave_Data.SDOtimeoutError = TestSlave_SDOtimeoutError;
 		TestSlave_Data.initialisation = TestSlave_initialisation;
 		TestSlave_Data.preOperational = TestSlave_preOperational;
 		TestSlave_Data.operational = TestSlave_operational;
@@ -209,7 +208,6 @@
 	if(strcmp( MasterBoard.baudrate, "none")){
 		
 		TestMaster_Data.heartbeatError = TestMaster_heartbeatError;
-		TestMaster_Data.SDOtimeoutError = TestMaster_SDOtimeoutError;
 		TestMaster_Data.initialisation = TestMaster_initialisation;
 		TestMaster_Data.preOperational = TestMaster_preOperational;
 		TestMaster_Data.operational = TestMaster_operational;
@@ -234,9 +232,9 @@
 	StopTimerLoop();
 	
 	// Close CAN devices (and can threads)
-	if(SlaveBoard.baudrate) canClose(&TestSlave_Data);
+	if(strcmp( SlaveBoard.baudrate, "none")) canClose(&TestSlave_Data);
 fail_master:
-	if(MasterBoard.baudrate) canClose(&TestMaster_Data);	
+	if(strcmp( MasterBoard.baudrate, "none")) canClose(&TestMaster_Data);	
 fail_slave:
 	
 
--- a/examples/gene_SYNC_HCS12/appli.c	Thu Apr 19 09:54:34 2007 +0200
+++ b/examples/gene_SYNC_HCS12/appli.c	Tue Apr 24 13:26:03 2007 +0200
@@ -269,22 +269,6 @@
 }
 
 //------------------------------------------------------------------------------
-void gene_SYNC_SDOtimeoutError (UNS8 line)
-{
-	// This function was implemented for the Client's use (client = the one which initiate the dialog),
-	// but we can use it also for the server.
-	// Note : if for an other reason than a timeout, a SDO to read or write 
-	// faile, we do not have implemented a warning function at the server side.
-	// Of course, there is one on the client side.
-  
-  MSG_ERR(0x1F01, "SDO timeout for line : ", line);
-  // See the transfer structure in sdo.h to know what informations
-  // you can retreive.
-  MSG_ERR(0x1F02, "  to access index ", gene_SYNC_Data.transfers[line].index);
-  MSG_ERR(0x1F03, "         subIndex ", gene_SYNC_Data.transfers[line].subIndex);
-}
-
-//------------------------------------------------------------------------------
 void gene_SYNC_initialisation()
 {  
   MSG_WAR (0x3F00, "Entering in INIT ", 0); 
@@ -402,7 +386,6 @@
   MSG_WAR(0x3F34, "Entering in the main ", 0);
   //----------------------------- INITIALISATION --------------------------------
   gene_SYNC_Data.heartbeatError = gene_SYNC_heartbeatError;
-  gene_SYNC_Data.SDOtimeoutError = gene_SYNC_SDOtimeoutError;
   gene_SYNC_Data.initialisation = gene_SYNC_initialisation;
   gene_SYNC_Data.preOperational = gene_SYNC_preOperational;
   gene_SYNC_Data.preOperational = gene_SYNC_operational;
--- a/examples/gene_SYNC_HCS12/objdict.h	Thu Apr 19 09:54:34 2007 +0200
+++ b/examples/gene_SYNC_HCS12/objdict.h	Tue Apr 24 13:26:03 2007 +0200
@@ -8,7 +8,6 @@
 const indextable * gene_SYNC_scanIndexOD (UNS16 wIndex, UNS32 * errorCode, ODCallback_t **callbacks);
 
 /* prototypes of function to be filled by app. */
-void gene_SYNC_SDOtimeoutError(UNS8 line);
 void gene_SYNC_heartbeatError(UNS8);
 
 UNS8 gene_SYNC_canSend(Message *);
--- a/examples/win32test/win32test.h	Thu Apr 19 09:54:34 2007 +0200
+++ b/examples/win32test/win32test.h	Tue Apr 24 13:26:03 2007 +0200
@@ -8,7 +8,6 @@
 const indextable * win32test_scanIndexOD (UNS16 wIndex, UNS32 * errorCode, ODCallback_t **callbacks);
 
 /* prototypes of function to be filled by app. */
-void win32test_SDOtimeoutError(UNS8 line);
 void win32test_heartbeatError(UNS8);
 
 UNS8 win32test_canSend(Message *);
--- a/include/data.h	Thu Apr 19 09:54:34 2007 +0200
+++ b/include/data.h	Tue Apr 24 13:26:03 2007 +0200
@@ -55,7 +55,6 @@
 	
 	/* SDO */
 	s_transfer transfers[SDO_MAX_SIMULTANEOUS_TRANSFERTS];
-	SDOtimeoutError_t SDOtimeoutError;
 	/* s_sdo_parameter *sdo_parameters; */
 
 	/* State machine */
@@ -128,7 +127,6 @@
 	{\
           REPEAT_SDO_MAX_SIMULTANEOUS_TRANSFERTS_TIMES(s_transfer_Initializer)\
 	},\
-	_SDOtimeoutError,   /* SDOtimeoutError */\
 	\
 	/* State machine*/\
 	Unknown_state,      /* nodeState */\
--- a/include/sdo.h	Thu Apr 19 09:54:34 2007 +0200
+++ b/include/sdo.h	Tue Apr 24 13:26:03 2007 +0200
@@ -23,9 +23,6 @@
 #ifndef __sdo_h__
 #define __sdo_h__
 
-typedef void (*SDOtimeoutError_t)(UNS8 line);
-void _SDOtimeoutError (UNS8);
-
 struct struct_s_transfer;
 
 #include "timer.h"
--- a/src/sdo.c	Thu Apr 19 09:54:34 2007 +0200
+++ b/src/sdo.c	Tue Apr 24 13:26:03 2007 +0200
@@ -98,13 +98,19 @@
     MSG_WAR(0x2A02, "   subIndex : ", d->transfers[id].subIndex); 
     /* Reset timer handler */
     d->transfers[id].timer = TIMER_NONE;
-    /* Call the user function to inform of the problem.*/
-    (*d->SDOtimeoutError)((UNS8)id);
+    /*Set aborted state*/
+    d->transfers[id].state = SDO_ABORTED_INTERNAL;
     /* Sending a SDO abort */
     sendSDOabort(d, d->transfers[id].whoami, 
 		 d->transfers[id].index, d->transfers[id].subIndex, SDOABT_TIMED_OUT);
-    /* Reset the line*/
-    resetSDOline(d, (UNS8)id);
+    d->transfers[id].abortCode = SDOABT_TIMED_OUT;
+    /* Call the user function to inform of the problem.*/
+    if(d->transfers[id].Callback)
+    	/*If ther is a callback, it is responsible to close SDO transfer (client)*/
+    	(*d->transfers[id].Callback)(d,d->transfers[id].nodeId);
+    else if(d->transfers[id].whoami == SDO_SERVER)
+    	/*Else, if server, reset the line*/
+    	resetSDOline(d, (UNS8)id);
 }
 
 #define StopSDO_TIMER(id) \
@@ -1335,5 +1341,3 @@
   * abortCode = d->transfers[line].abortCode;
   return d->transfers[line].state;
 }
-
-void _SDOtimeoutError (UNS8 line){}