Fixed compile error because of missed type casting in certain compiler (http://www.iar.se/). Thanks to Raphael Studer
authoretisserant
Fri, 08 Jun 2007 14:41:17 +0200
changeset 217 94c3f89bc3cc
parent 216 8ae2ae25b096
child 218 3bc225b6fb43
Fixed compile error because of missed type casting in certain compiler (http://www.iar.se/). Thanks to Raphael Studer
src/pdo.c
src/sdo.c
src/sync.c
--- a/src/pdo.c	Fri Jun 08 11:50:51 2007 +0200
+++ b/src/pdo.c	Fri Jun 08 14:41:17 2007 +0200
@@ -194,7 +194,7 @@
   if (offset)
     while (offset <= lastIndex) {
       /* get the CobId*/
-      pwCobId = d->objdict[offset].pSubindex[1].pObject;
+      pwCobId = (UNS32*) d->objdict[offset].pSubindex[1].pObject;
 
       if ( *pwCobId  == cobId ) {
         s_PDO pdo;
@@ -269,7 +269,7 @@
         case state2:
           /* get CobId of the dictionary correspondant to the received
              PDO */
-          pwCobId = d->objdict[offsetObjdict].pSubindex[1].pObject;
+          pwCobId = (UNS32*) d->objdict[offsetObjdict].pSubindex[1].pObject;
           /* check the CobId coherance */
           /*pwCobId is the cobId read in the dictionary at the state 3
             */
@@ -293,12 +293,12 @@
                  dictionnary. */
                offsetObjdict = d->firstIndex->PDO_RCV_MAP;
              lastIndex = d->lastIndex->PDO_RCV_MAP;
-             pMappingCount = (d->objdict + offsetObjdict + numPdo)->pSubindex[0].pObject;
+             pMappingCount = (UNS8*) (d->objdict + offsetObjdict + numPdo)->pSubindex[0].pObject;
              numMap = 0;
              while (numMap < *pMappingCount) {
                UNS8 tmp[]= {0,0,0,0,0,0,0,0};
                UNS8 ByteSize;
-               pMappingParameter = (d->objdict + offsetObjdict + numPdo)->pSubindex[numMap + 1].pObject;
+               pMappingParameter = (UNS32*) (d->objdict + offsetObjdict + numPdo)->pSubindex[numMap + 1].pObject;
                if (pMappingParameter == NULL) {
                  MSG_ERR(0x1937, "Couldn't get mapping parameter : ", numMap + 1);
                  return 0xFF;
@@ -357,7 +357,7 @@
       case state1:/* check the CobId */
         /* get CobId of the dictionary which match to the received PDO
          */
-        pwCobId = (d->objdict + offsetObjdict)->pSubindex[1].pObject;
+        pwCobId = (UNS32*) (d->objdict + offsetObjdict)->pSubindex[1].pObject;
         if ( *pwCobId == (*m).cob_id.w ) {
           status = state4;
           break;
@@ -371,7 +371,7 @@
 
 
       case state4:/* check transmission type (after request?) */
-        pTransmissionType = d->objdict[offsetObjdict].pSubindex[2].pObject;
+        pTransmissionType = (UNS8*) d->objdict[offsetObjdict].pSubindex[2].pObject;
         if ( (*pTransmissionType == TRANS_RTR) || (*pTransmissionType == TRANS_RTR_SYNC ) || (*pTransmissionType == TRANS_EVENT) ) {
           status = state5;
           break;
@@ -386,10 +386,10 @@
       case state5:/* get mapped objects number */
         offsetObjdict = d->firstIndex->PDO_TRS_MAP;
         lastIndex = d->lastIndex->PDO_TRS_MAP;
-        pMappingCount = (d->objdict + offsetObjdict + numPdo)->pSubindex[0].pObject;
+        pMappingCount = (UNS8*) (d->objdict + offsetObjdict + numPdo)->pSubindex[0].pObject;
         numMap = 0;
         while (numMap < *pMappingCount) {
-          pMappingParameter = (d->objdict + offsetObjdict + numPdo)->pSubindex[numMap + 1].pObject;
+          pMappingParameter = (UNS32*) (d->objdict + offsetObjdict + numPdo)->pSubindex[numMap + 1].pObject;
           /* Get the mapped variable */
           Size = ((UNS8)(((*pMappingParameter) & 0xFF) >> 3));
           objDict = getODentry( d, (UNS16)((*pMappingParameter) >> (UNS8)16),
--- a/src/sdo.c	Fri Jun 08 11:50:51 2007 +0200
+++ b/src/sdo.c	Fri Jun 08 14:41:17 2007 +0200
@@ -518,7 +518,7 @@
       MSG_ERR(0x1A42, "SendSDO : No SDO server found", 0); 
       return 0xFF;
     }
-    pwCobId = d->objdict[offset].pSubindex[2].pObject;
+    pwCobId = (UNS32*) d->objdict[offset].pSubindex[2].pObject;
     MSG_WAR(0x3A41, "I am server. cobId : ", *pwCobId); 
   }
   else {			/*case client*/
@@ -537,7 +537,7 @@
 	MSG_ERR(0x1A28, "Subindex 3  not found at index ", 0x1280 + sdoNum);
 	return 0xFF;
       }
-      pwNodeId = d->objdict[offset].pSubindex[3].pObject;
+      pwNodeId = (UNS32*) d->objdict[offset].pSubindex[3].pObject;
       MSG_WAR(0x3A44, "Found nodeId server = ", *pwNodeId);	
       if(*pwNodeId == sdo.nodeId) {
 	found = 1;
@@ -551,7 +551,7 @@
       return 0xFF;
     }
     /* Second, read the cobid client->server */
-    pwCobId = d->objdict[offset].pSubindex[1].pObject;
+    pwCobId = (UNS32*) d->objdict[offset].pSubindex[1].pObject;
   }
   /* message copy for sending */
   m.cob_id.w = *pwCobId;
@@ -636,7 +636,7 @@
 	  MSG_ERR(0x1A61, "Subindex 1  not found at index ", 0x1200 + j);
 	  return 0xFF;
 	}
-      pCobId = d->objdict[offset].pSubindex[1].pObject;
+      pCobId = (UNS32*) d->objdict[offset].pSubindex[1].pObject;
       if ( *pCobId == (*m).cob_id.w ) {
 	whoami = SDO_SERVER;
 	MSG_WAR(0x3A62, "proceedSDO. I am server. index : ", 0x1200 + j);
@@ -659,10 +659,10 @@
 	 return 0xFF;
        }
        /* a) Looking for the cobid received. */
-       pCobId = d->objdict[offset].pSubindex[2].pObject;
+       pCobId = (UNS32*) d->objdict[offset].pSubindex[2].pObject;
        if (*pCobId == (*m).cob_id.w ) {
 	 /* b) cobid found, so reading the node id of the server. */
-	 pNodeId = d->objdict[offset].pSubindex[3].pObject;
+	 pNodeId = (UNS32*) d->objdict[offset].pSubindex[3].pObject;
 	 whoami = SDO_CLIENT;
 	 nodeId_32 = *pNodeId;
 	 nodeId = (UNS8)nodeId_32;
@@ -1288,7 +1288,7 @@
 	 return 0xFF;
      }
      /* looking for the nodeId server */
-     pNodeIdServer = d->objdict[offset].pSubindex[3].pObject;
+     pNodeIdServer = (UNS32*) d->objdict[offset].pSubindex[3].pObject;
      nodeIdServer = *pNodeIdServer;
      MSG_WAR(0x1AD2, "index : ", 0x1280 + i);
      MSG_WAR(0x1AD3, "nodeIdServer : ", nodeIdServer);
@@ -1448,7 +1448,7 @@
 	 return 0xFF;
      }
      /* looking for the nodeId server */
-     pNodeIdServer = d->objdict[offset].pSubindex[3].pObject;
+     pNodeIdServer = (UNS32*) d->objdict[offset].pSubindex[3].pObject;
      nodeIdServer = *pNodeIdServer;
    
     if(nodeIdServer == (UNS32)nodeId) {
--- a/src/sync.c	Fri Jun 08 11:50:51 2007 +0200
+++ b/src/sync.c	Fri Jun 08 14:41:17 2007 +0200
@@ -192,7 +192,7 @@
 	  MSG_ERR(0x1004, "Subindex 2  not found at index ", 0x1800 + pdoNum);
 	  return 0xFF;
 	}
-      pTransmissionType = d->objdict[offsetObjdict].pSubindex[2].pObject;    
+      pTransmissionType = (UNS8*) d->objdict[offsetObjdict].pSubindex[2].pObject;    
       MSG_WAR(0x3005, "Reading PDO at index : ", 0x1800 + pdoNum);
       status = state4; 
       break;     
@@ -215,16 +215,16 @@
 	break;
       }      
     case state5:	/* get PDO CobId */
-        pwCobId = d->objdict[offsetObjdict].pSubindex[1].pObject;     
+        pwCobId = (UNS32*) d->objdict[offsetObjdict].pSubindex[1].pObject;     
 	MSG_WAR(0x3009, "  PDO CobId is : ", *pwCobId);
 	status = state7;
 	break;     
     case state7:  /* get mapped objects number to transmit with this PDO */
-      pMappingCount = d->objdict[offsetObjdictMap].pSubindex[0].pObject;
+      pMappingCount = (UNS8*) d->objdict[offsetObjdictMap].pSubindex[0].pObject;
 	MSG_WAR(0x300D, "  Number of objects mapped : ",*pMappingCount );
 	status = state8;
     case state8:	/* get mapping parameters */
-      pMappingParameter = d->objdict[offsetObjdictMap].pSubindex[prp_j + 1].pObject;
+      pMappingParameter = (UNS32*) d->objdict[offsetObjdictMap].pSubindex[prp_j + 1].pObject;
 	MSG_WAR(0x300F, "  got mapping parameter : ", *pMappingParameter);
 	MSG_WAR(0x3050, "    at index : ", 0x1A00 + pdoNum);
 	MSG_WAR(0x3051, "    sub-index : ", prp_j + 1);