From 6dee02ac21e05fd093240b473ccbfc9923f0a686 Mon Sep 17 00:00:00 2001 From: etisserant Date: Fri, 8 Jun 2007 12:41:17 +0000 Subject: [PATCH] Fixed compile error because of missed type casting in certain compiler (http://www.iar.se/). Thanks to Raphael Studer --- src/pdo.c | 16 ++++++++-------- src/sdo.c | 16 ++++++++-------- src/sync.c | 8 ++++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/pdo.c b/src/pdo.c index 6f54a1b..c033ff7 100644 --- a/src/pdo.c +++ b/src/pdo.c @@ -194,7 +194,7 @@ UNS8 sendPDOrequest( CO_Data* d, UNS32 cobId ) 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 @@ UNS8 proceedPDO(CO_Data* d, Message *m) 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 @@ UNS8 proceedPDO(CO_Data* d, Message *m) 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 @@ UNS8 proceedPDO(CO_Data* d, Message *m) 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 @@ UNS8 proceedPDO(CO_Data* d, Message *m) 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 @@ UNS8 proceedPDO(CO_Data* d, Message *m) 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), diff --git a/src/sdo.c b/src/sdo.c index 72a48c5..b8faa33 100644 --- a/src/sdo.c +++ b/src/sdo.c @@ -518,7 +518,7 @@ UNS8 sendSDO (CO_Data* d, UNS8 whoami, s_SDO sdo) 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 @@ UNS8 sendSDO (CO_Data* d, UNS8 whoami, s_SDO sdo) 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 @@ UNS8 sendSDO (CO_Data* d, UNS8 whoami, s_SDO sdo) 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 @@ UNS8 proceedSDO (CO_Data* d, Message *m) 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 @@ UNS8 proceedSDO (CO_Data* d, Message *m) 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 @@ INLINE UNS8 _writeNetworkDict (CO_Data* d, UNS8 nodeId, UNS16 index, 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 @@ INLINE UNS8 _readNetworkDict (CO_Data* d, UNS8 nodeId, UNS16 index, UNS8 subInde 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) { diff --git a/src/sync.c b/src/sync.c index 062f15c..3d025f6 100644 --- a/src/sync.c +++ b/src/sync.c @@ -192,7 +192,7 @@ UNS8 proceedSYNC(CO_Data* d, Message *m) 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 @@ UNS8 proceedSYNC(CO_Data* d, Message *m) 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); -- 2.39.2