Some fixes for visual studio C compiler compatiblity.
authoretisserant
Fri, 25 May 2007 23:57:17 +0200
changeset 204 44ce74232ccb
parent 203 55be5b85501c
child 205 dac0f9b4e3f8
Some fixes for visual studio C compiler compatiblity.
include/data.h
src/dcf.c
src/pdo.c
src/states.c
src/sync.c
src/win32/CanFestival-3.def
--- a/include/data.h	Fri May 25 15:48:34 2007 +0200
+++ b/include/data.h	Fri May 25 23:57:17 2007 +0200
@@ -92,7 +92,7 @@
 	storeODSubIndex_t storeODSubIndex; 
 	
 	/* DCF concise */
-	void* dcf_cursor;
+	UNS8* dcf_cursor;
 	UNS32 dcf_count_targets;
 	
 };
--- a/src/dcf.c	Fri May 25 15:48:34 2007 +0200
+++ b/src/dcf.c	Fri May 25 23:57:17 2007 +0200
@@ -25,6 +25,10 @@
 #include "dcf.h"
 #include "sysdep.h"
 
+
+extern UNS8 _writeNetworkDict (CO_Data* d, UNS8 nodeId, UNS16 index, 
+		       UNS8 subIndex, UNS8 count, UNS8 dataType, void *data, SDOCallback_t Callback, UNS8 endianize);
+
 const indextable *ptrTable;
 
 static void CheckSDOAndContinue(CO_Data* d, UNS8 nodeId)
@@ -61,24 +65,24 @@
 			UNS32 nb_targets;
 	  		
 	  		UNS8 szData = ptrTable->pSubindex[nodeId].size;
-	  		void* dcfend;
+	  		UNS8* dcfend;
 	  		
 		  	{
-			  	void* dcf = *((void**)ptrTable->pSubindex[nodeId].pObject);
+			  	UNS8* dcf = *((UNS8**)ptrTable->pSubindex[nodeId].pObject);
 		  		dcfend = dcf + szData;
 				if (!d->dcf_cursor)	{
-					d->dcf_cursor = dcf + 4;
+					d->dcf_cursor = (UNS8*)dcf + 4;
 					d->dcf_count_targets = 0;
 				}
 				nb_targets = UNS32_LE(*((UNS32*)dcf));
 		  	}
 			
 			// condition on consise DCF string for NodeID, if big enough
-			if(d->dcf_cursor + 7 < dcfend && d->dcf_count_targets < nb_targets)
+			if((UNS8*)d->dcf_cursor + 7 < (UNS8*)dcfend && d->dcf_count_targets < nb_targets)
 			{
 				// pointer to the DCF string for NodeID
 				target_Index = UNS16_LE(*((UNS16*)(d->dcf_cursor))); d->dcf_cursor += 2;
-				target_Subindex = *((UNS8*)(d->dcf_cursor++));
+				target_Subindex = *((UNS8*)(((UNS8*)d->dcf_cursor)++));
 				target_Size = UNS32_LE(*((UNS32*)(d->dcf_cursor))); d->dcf_cursor += 4;
 					
 					/*printf("Master : ConfigureSlaveNode %2.2x (Concise DCF)\n",nodeId);*/
--- a/src/pdo.c	Fri May 25 15:48:34 2007 +0200
+++ b/src/pdo.c	Fri May 25 23:57:17 2007 +0200
@@ -203,8 +203,6 @@
   UNS32      objDict;
   UNS16      offsetObjdict;
   UNS16      lastIndex;
-  UNS16      Index;
-  UNS8       Sindex;
   status = state1;
  
   MSG_WAR(0x3935, "proceedPDO, cobID : ", ((*m).cob_id.w & 0x7ff)); 
--- a/src/states.c	Fri May 25 15:48:34 2007 +0200
+++ b/src/states.c	Fri May 25 23:57:17 2007 +0200
@@ -22,7 +22,7 @@
 
 #include "states.h"
 #include "def.h"
-
+#include "dcf.h"
 #include "nmtSlave.h"
 
 /* Prototypes for internals functions */
--- a/src/sync.c	Fri May 25 15:48:34 2007 +0200
+++ b/src/sync.c	Fri May 25 23:57:17 2007 +0200
@@ -183,16 +183,17 @@
 	status = state9;
     
     case state9:	/* get data to transmit */ 
-      index = (UNS16)((*pMappingParameter) >> 16);
-      subIndex = (UNS8)(( (*pMappingParameter) >> (UNS8)8 ) & (UNS32)0x000000FF);
+	{
 	  UNS8 ByteSize;
 	  UNS8 tmp[]= {0,0,0,0,0,0,0,0};
+	  index = (UNS16)((*pMappingParameter) >> 16);
+          subIndex = (UNS8)(( (*pMappingParameter) >> (UNS8)8 ) & (UNS32)0x000000FF);
 	  Size = (UNS8)(*pMappingParameter); /* Size in bits */
 	  ByteSize = 1 + ((Size - 1) >> 3); /*1->8 => 1 ; 9->16 => 2, ... */
 	  objDict = getODentry(d, index, subIndex, tmp, &ByteSize, &dataType, 0 );
 	  /* copy bit per bit in little endian*/
 	  CopyBits(Size, ((UNS8*)tmp), 0 , 0, (UNS8*)&d->process_var.data[offset>>3], offset%8, 0);
-	    
+	}   
         if( objDict != OD_SUCCESSFUL ){
           MSG_ERR(0x1013, " Couldn't find mapped variable at index-subindex-size : ", (UNS16)(*pMappingParameter));
           return 0xFF;
--- a/src/win32/CanFestival-3.def	Fri May 25 15:48:34 2007 +0200
+++ b/src/win32/CanFestival-3.def	Fri May 25 23:57:17 2007 +0200
@@ -21,7 +21,7 @@
         RegisterSetODentryCallBack
         sendPDO
         PDOmGR
-        buildPDO
+;        buildPDO
         sendPDOrequest
         proceedPDO
 ;        sendPDOevent
@@ -67,11 +67,12 @@
         canReceive
         canOpen
         canClose
-		_post_TPDO
-		_post_sync
-		_heartbeatError
-		_stopped
-		_operational
-		_preOperational
-		_initialisation
-		_SDOtimeoutError
+        _post_TPDO
+        _post_sync
+        _heartbeatError
+        _stopped
+        _operational
+        _preOperational
+        _initialisation
+        writeNetworkDictCallBack
+        _storeODSubIndex