192 offset = d->firstIndex->PDO_RCV; |
192 offset = d->firstIndex->PDO_RCV; |
193 lastIndex = d->lastIndex->PDO_RCV; |
193 lastIndex = d->lastIndex->PDO_RCV; |
194 if (offset) |
194 if (offset) |
195 while (offset <= lastIndex) { |
195 while (offset <= lastIndex) { |
196 /* get the CobId*/ |
196 /* get the CobId*/ |
197 pwCobId = d->objdict[offset].pSubindex[1].pObject; |
197 pwCobId = (UNS32*) d->objdict[offset].pSubindex[1].pObject; |
198 |
198 |
199 if ( *pwCobId == cobId ) { |
199 if ( *pwCobId == cobId ) { |
200 s_PDO pdo; |
200 s_PDO pdo; |
201 pdo.cobId = *pwCobId; |
201 pdo.cobId = *pwCobId; |
202 pdo.len = 0; |
202 pdo.len = 0; |
267 break; |
267 break; |
268 |
268 |
269 case state2: |
269 case state2: |
270 /* get CobId of the dictionary correspondant to the received |
270 /* get CobId of the dictionary correspondant to the received |
271 PDO */ |
271 PDO */ |
272 pwCobId = d->objdict[offsetObjdict].pSubindex[1].pObject; |
272 pwCobId = (UNS32*) d->objdict[offsetObjdict].pSubindex[1].pObject; |
273 /* check the CobId coherance */ |
273 /* check the CobId coherance */ |
274 /*pwCobId is the cobId read in the dictionary at the state 3 |
274 /*pwCobId is the cobId read in the dictionary at the state 3 |
275 */ |
275 */ |
276 if ( *pwCobId == (*m).cob_id.w ){ |
276 if ( *pwCobId == (*m).cob_id.w ){ |
277 /* The cobId is recognized */ |
277 /* The cobId is recognized */ |
291 case state4:/* Get Mapped Objects Number */ |
291 case state4:/* Get Mapped Objects Number */ |
292 /* The cobId of the message received has been found in the |
292 /* The cobId of the message received has been found in the |
293 dictionnary. */ |
293 dictionnary. */ |
294 offsetObjdict = d->firstIndex->PDO_RCV_MAP; |
294 offsetObjdict = d->firstIndex->PDO_RCV_MAP; |
295 lastIndex = d->lastIndex->PDO_RCV_MAP; |
295 lastIndex = d->lastIndex->PDO_RCV_MAP; |
296 pMappingCount = (d->objdict + offsetObjdict + numPdo)->pSubindex[0].pObject; |
296 pMappingCount = (UNS8*) (d->objdict + offsetObjdict + numPdo)->pSubindex[0].pObject; |
297 numMap = 0; |
297 numMap = 0; |
298 while (numMap < *pMappingCount) { |
298 while (numMap < *pMappingCount) { |
299 UNS8 tmp[]= {0,0,0,0,0,0,0,0}; |
299 UNS8 tmp[]= {0,0,0,0,0,0,0,0}; |
300 UNS8 ByteSize; |
300 UNS8 ByteSize; |
301 pMappingParameter = (d->objdict + offsetObjdict + numPdo)->pSubindex[numMap + 1].pObject; |
301 pMappingParameter = (UNS32*) (d->objdict + offsetObjdict + numPdo)->pSubindex[numMap + 1].pObject; |
302 if (pMappingParameter == NULL) { |
302 if (pMappingParameter == NULL) { |
303 MSG_ERR(0x1937, "Couldn't get mapping parameter : ", numMap + 1); |
303 MSG_ERR(0x1937, "Couldn't get mapping parameter : ", numMap + 1); |
304 return 0xFF; |
304 return 0xFF; |
305 } |
305 } |
306 /* Get the addresse of the mapped variable. */ |
306 /* Get the addresse of the mapped variable. */ |
384 } |
384 } |
385 |
385 |
386 case state5:/* get mapped objects number */ |
386 case state5:/* get mapped objects number */ |
387 offsetObjdict = d->firstIndex->PDO_TRS_MAP; |
387 offsetObjdict = d->firstIndex->PDO_TRS_MAP; |
388 lastIndex = d->lastIndex->PDO_TRS_MAP; |
388 lastIndex = d->lastIndex->PDO_TRS_MAP; |
389 pMappingCount = (d->objdict + offsetObjdict + numPdo)->pSubindex[0].pObject; |
389 pMappingCount = (UNS8*) (d->objdict + offsetObjdict + numPdo)->pSubindex[0].pObject; |
390 numMap = 0; |
390 numMap = 0; |
391 while (numMap < *pMappingCount) { |
391 while (numMap < *pMappingCount) { |
392 pMappingParameter = (d->objdict + offsetObjdict + numPdo)->pSubindex[numMap + 1].pObject; |
392 pMappingParameter = (UNS32*) (d->objdict + offsetObjdict + numPdo)->pSubindex[numMap + 1].pObject; |
393 /* Get the mapped variable */ |
393 /* Get the mapped variable */ |
394 Size = ((UNS8)(((*pMappingParameter) & 0xFF) >> 3)); |
394 Size = ((UNS8)(((*pMappingParameter) & 0xFF) >> 3)); |
395 objDict = getODentry( d, (UNS16)((*pMappingParameter) >> (UNS8)16), |
395 objDict = getODentry( d, (UNS16)((*pMappingParameter) >> (UNS8)16), |
396 (UNS8)(( (*pMappingParameter) >> (UNS8)8 ) & 0xFF), |
396 (UNS8)(( (*pMappingParameter) >> (UNS8)8 ) & 0xFF), |
397 (void *)&d->process_var.data[offset], &Size, &dataType, 0 ); |
397 (void *)&d->process_var.data[offset], &Size, &dataType, 0 ); |