Menu

#17 Defect inside writeNetworkDictCallBackAI

open
nobody
None
5
2011-12-13
2011-12-13
No

Please note that two calls of _writeNetworkDict have different "endianize".

Original code:
--------------------------------------------------------------------------------------------------------------------------------------------
UNS8 writeNetworkDictCallBackAI (CO_Data* d, UNS8 nodeId, UNS16 index,
UNS8 subIndex, UNS32 count, UNS8 dataType, void *data, SDOCallback_t Callback, UNS8 endianize)
{
UNS8 ret;
UNS16 lastIndex;
UNS16 offset;
UNS8 nodeIdServer;
UNS8 i;

ret = _writeNetworkDict (d, nodeId, index, subIndex, count, dataType, data, Callback, endianize);
///////////////////////////!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

if(ret == 0xFE)
{
offset = d->firstIndex->SDO_CLT;
lastIndex = d->lastIndex->SDO_CLT;
if (offset == 0)
{
MSG_ERR(0x1AC6, "writeNetworkDict : No SDO client index found", 0);
return 0xFF;
}
i = 0;
while (offset <= lastIndex)
{
if (d->objdict[offset].bSubCount <= 3)
{
MSG_ERR(0x1AC8, "Subindex 3 not found at index ", 0x1280 + i);
return 0xFF;
}
nodeIdServer = *(UNS8*) d->objdict[offset].pSubindex[3].pObject;
if(nodeIdServer == 0)
{
*(UNS32*)d->objdict[offset].pSubindex[1].pObject = (UNS32)(0x600 + nodeId);
*(UNS32*)d->objdict[offset].pSubindex[2].pObject = (UNS32)(0x580 + nodeId);
*(UNS8*) d->objdict[offset].pSubindex[3].pObject = nodeId;
return _writeNetworkDict (d, nodeId, index, subIndex, count, dataType, data, Callback, 1);
///////////////////////////!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
}
offset++;
}
return 0xFF;
}

Original code:
--------------------------------------------------------------------------------------------------------------------------------------------
UNS8 writeNetworkDictCallBackAI (CO_Data* d, UNS8 nodeId, UNS16 index,
UNS8 subIndex, UNS32 count, UNS8 dataType, void *data, SDOCallback_t Callback, UNS8 endianize)
{
UNS8 ret;
UNS16 lastIndex;
UNS16 offset;
UNS8 nodeIdServer;
UNS8 i;

ret = _writeNetworkDict (d, nodeId, index, subIndex, count, dataType, data, Callback, endianize);
///////////////////////////!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

if(ret == 0xFE)
{
offset = d->firstIndex->SDO_CLT;
lastIndex = d->lastIndex->SDO_CLT;
if (offset == 0)
{
MSG_ERR(0x1AC6, "writeNetworkDict : No SDO client index found", 0);
return 0xFF;
}
i = 0;
while (offset <= lastIndex)
{
if (d->objdict[offset].bSubCount <= 3)
{
MSG_ERR(0x1AC8, "Subindex 3 not found at index ", 0x1280 + i);
return 0xFF;
}
nodeIdServer = *(UNS8*) d->objdict[offset].pSubindex[3].pObject;
if(nodeIdServer == 0)
{
*(UNS32*)d->objdict[offset].pSubindex[1].pObject = (UNS32)(0x600 + nodeId);
*(UNS32*)d->objdict[offset].pSubindex[2].pObject = (UNS32)(0x580 + nodeId);
*(UNS8*) d->objdict[offset].pSubindex[3].pObject = nodeId;
return _writeNetworkDict (d, nodeId, index, subIndex, count, dataType, data, Callback, endianize);
///////////////////////////!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
}
offset++;
}
return 0xFF;
}

Discussion


Log in to post a comment.

MongoDB Logo MongoDB