equal
deleted
inserted
replaced
52 |
52 |
53 UNS8 prp_j = 0x00; |
53 UNS8 prp_j = 0x00; |
54 UNS8 offset = 0x00; |
54 UNS8 offset = 0x00; |
55 const UNS8* pMappingCount = (UNS8*) TPDO_map->pSubindex[0].pObject; |
55 const UNS8* pMappingCount = (UNS8*) TPDO_map->pSubindex[0].pObject; |
56 |
56 |
57 pdo->cob_id.w = *(UNS32*)TPDO_com->pSubindex[1].pObject & 0x7FF; |
57 pdo->cob_id = *(UNS32*)TPDO_com->pSubindex[1].pObject & 0x7FF; |
58 pdo->rtr = NOT_A_REQUEST; |
58 pdo->rtr = NOT_A_REQUEST; |
59 |
59 |
60 MSG_WAR(0x3009, " PDO CobId is : ", *(UNS32*)TPDO_com->pSubindex[1].pObject); |
60 MSG_WAR(0x3009, " PDO CobId is : ", *(UNS32*)TPDO_com->pSubindex[1].pObject); |
61 MSG_WAR(0x300D, " Number of objects mapped : ",*pMappingCount ); |
61 MSG_WAR(0x300D, " Number of objects mapped : ",*pMappingCount ); |
62 |
62 |
124 pwCobId = (UNS32*) d->objdict[offset].pSubindex[1].pObject; |
124 pwCobId = (UNS32*) d->objdict[offset].pSubindex[1].pObject; |
125 |
125 |
126 MSG_WAR(0x3930, "sendPDOrequest cobId is : ",*pwCobId); |
126 MSG_WAR(0x3930, "sendPDOrequest cobId is : ",*pwCobId); |
127 { |
127 { |
128 Message pdo; |
128 Message pdo; |
129 pdo.cob_id.w = *pwCobId; |
129 pdo.cob_id = *pwCobId; |
130 pdo.rtr = REQUEST; |
130 pdo.rtr = REQUEST; |
131 pdo.len = 0; |
131 pdo.len = 0; |
132 return canSend(d->canHandle,&pdo); |
132 return canSend(d->canHandle,&pdo); |
133 } |
133 } |
134 } |
134 } |
166 UNS16 offsetObjdict; |
166 UNS16 offsetObjdict; |
167 UNS16 lastIndex; |
167 UNS16 lastIndex; |
168 |
168 |
169 status = state2; |
169 status = state2; |
170 |
170 |
171 MSG_WAR(0x3935, "proceedPDO, cobID : ", ((*m).cob_id.w & 0x7ff)); |
171 MSG_WAR(0x3935, "proceedPDO, cobID : ", ((*m).cob_id & 0x7ff)); |
172 offset = 0x00; |
172 offset = 0x00; |
173 numPdo = 0; |
173 numPdo = 0; |
174 numMap = 0; |
174 numMap = 0; |
175 if((*m).rtr == NOT_A_REQUEST ) { /* The PDO received is not a |
175 if((*m).rtr == NOT_A_REQUEST ) { /* The PDO received is not a |
176 request. */ |
176 request. */ |
189 PDO */ |
189 PDO */ |
190 pwCobId = (UNS32*) d->objdict[offsetObjdict].pSubindex[1].pObject; |
190 pwCobId = (UNS32*) d->objdict[offsetObjdict].pSubindex[1].pObject; |
191 /* check the CobId coherance */ |
191 /* check the CobId coherance */ |
192 /*pwCobId is the cobId read in the dictionary at the state 3 |
192 /*pwCobId is the cobId read in the dictionary at the state 3 |
193 */ |
193 */ |
194 if ( *pwCobId == (*m).cob_id.w ){ |
194 if ( *pwCobId == (*m).cob_id ){ |
195 /* The cobId is recognized */ |
195 /* The cobId is recognized */ |
196 status = state4; |
196 status = state4; |
197 MSG_WAR(0x3936, "cobId found at index ", 0x1400 + numPdo); |
197 MSG_WAR(0x3936, "cobId found at index ", 0x1400 + numPdo); |
198 break; |
198 break; |
199 } |
199 } |
247 MSG_WAR(0x2939, " Mapped at index : ", (*pMappingParameter) >> 16); |
247 MSG_WAR(0x2939, " Mapped at index : ", (*pMappingParameter) >> 16); |
248 MSG_WAR(0x2940, " subindex : ", ((*pMappingParameter) >> 8 ) & 0xFF); |
248 MSG_WAR(0x2940, " subindex : ", ((*pMappingParameter) >> 8 ) & 0xFF); |
249 return 0xFF; |
249 return 0xFF; |
250 } |
250 } |
251 |
251 |
252 MSG_WAR(0x3942, "Variable updated with value received by PDO cobid : ", m->cob_id.w); |
252 MSG_WAR(0x3942, "Variable updated with value received by PDO cobid : ", m->cob_id); |
253 MSG_WAR(0x3943, " Mapped at index : ", (*pMappingParameter) >> 16); |
253 MSG_WAR(0x3943, " Mapped at index : ", (*pMappingParameter) >> 16); |
254 MSG_WAR(0x3944, " subindex : ", ((*pMappingParameter) >> 8 ) & 0xFF); |
254 MSG_WAR(0x3944, " subindex : ", ((*pMappingParameter) >> 8 ) & 0xFF); |
255 /* MSG_WAR(0x3945, " data : ",*((UNS32*)pMappedAppObject)); */ |
255 /* MSG_WAR(0x3945, " data : ",*((UNS32*)pMappedAppObject)); */ |
256 offset += Size; |
256 offset += Size; |
257 } |
257 } |
264 |
264 |
265 }/* end switch status*/ |
265 }/* end switch status*/ |
266 }/* end while*/ |
266 }/* end while*/ |
267 }/* end if Donnees */ |
267 }/* end if Donnees */ |
268 else if ((*m).rtr == REQUEST ){ |
268 else if ((*m).rtr == REQUEST ){ |
269 MSG_WAR(0x3946, "Receive a PDO request cobId : ", m->cob_id.w); |
269 MSG_WAR(0x3946, "Receive a PDO request cobId : ", m->cob_id); |
270 status = state1; |
270 status = state1; |
271 offsetObjdict = d->firstIndex->PDO_TRS; |
271 offsetObjdict = d->firstIndex->PDO_TRS; |
272 lastIndex = d->lastIndex->PDO_TRS; |
272 lastIndex = d->lastIndex->PDO_TRS; |
273 if(offsetObjdict) while( offsetObjdict <= lastIndex ){ |
273 if(offsetObjdict) while( offsetObjdict <= lastIndex ){ |
274 /* study of all PDO stored in the objects dictionary */ |
274 /* study of all PDO stored in the objects dictionary */ |
277 |
277 |
278 case state1:/* check the CobId */ |
278 case state1:/* check the CobId */ |
279 /* get CobId of the dictionary which match to the received PDO |
279 /* get CobId of the dictionary which match to the received PDO |
280 */ |
280 */ |
281 pwCobId = (UNS32*) (d->objdict + offsetObjdict)->pSubindex[1].pObject; |
281 pwCobId = (UNS32*) (d->objdict + offsetObjdict)->pSubindex[1].pObject; |
282 if ( *pwCobId == (*m).cob_id.w ) { |
282 if ( *pwCobId == (*m).cob_id ) { |
283 status = state4; |
283 status = state4; |
284 break; |
284 break; |
285 } |
285 } |
286 else { |
286 else { |
287 numPdo++; |
287 numPdo++; |
304 canSend(d->canHandle,&d->PDO_status[numPdo].last_message); |
304 canSend(d->canHandle,&d->PDO_status[numPdo].last_message); |
305 return 0; |
305 return 0; |
306 }else{ |
306 }else{ |
307 /* if SYNC did never occur, force emission with current data */ |
307 /* if SYNC did never occur, force emission with current data */ |
308 /* DS301 do not tell what to do in such a case...*/ |
308 /* DS301 do not tell what to do in such a case...*/ |
309 MSG_ERR(0x1947, "Not ready RTR_SYNC TPDO send current data : ", m->cob_id.w); |
309 MSG_ERR(0x1947, "Not ready RTR_SYNC TPDO send current data : ", m->cob_id); |
310 status = state5; |
310 status = state5; |
311 } |
311 } |
312 break; |
312 break; |
313 }else if( |
313 }else if( |
314 (*pTransmissionType == TRANS_EVENT_PROFILE) || |
314 (*pTransmissionType == TRANS_EVENT_PROFILE) || |
321 PDOEventTimerAlarm(d, numPdo); |
321 PDOEventTimerAlarm(d, numPdo); |
322 return 0; |
322 return 0; |
323 }else { |
323 }else { |
324 /* The requested PDO is not to send on request. So, does |
324 /* The requested PDO is not to send on request. So, does |
325 nothing. */ |
325 nothing. */ |
326 MSG_WAR(0x2947, "PDO is not to send on request : ", m->cob_id.w); |
326 MSG_WAR(0x2947, "PDO is not to send on request : ", m->cob_id); |
327 return 0xFF; |
327 return 0xFF; |
328 } |
328 } |
329 |
329 |
330 case state5:/* build and send requested PDO */ |
330 case state5:/* build and send requested PDO */ |
331 { |
331 { |
423 void PDOEventTimerAlarm(CO_Data* d, UNS32 pdoNum) |
423 void PDOEventTimerAlarm(CO_Data* d, UNS32 pdoNum) |
424 { |
424 { |
425 /* This is needed to avoid deletion of re-attribuated timer */ |
425 /* This is needed to avoid deletion of re-attribuated timer */ |
426 d->PDO_status[pdoNum].event_timer = TIMER_NONE; |
426 d->PDO_status[pdoNum].event_timer = TIMER_NONE; |
427 /* force emission of PDO by artificially changing last emitted*/ |
427 /* force emission of PDO by artificially changing last emitted*/ |
428 d->PDO_status[pdoNum].last_message.cob_id.w = 0; |
428 d->PDO_status[pdoNum].last_message.cob_id = 0; |
429 _sendPDOevent( d, 0 ); /* not a Sync Event*/ |
429 _sendPDOevent( d, 0 ); /* not a Sync Event*/ |
430 } |
430 } |
431 |
431 |
432 void PDOInhibitTimerAlarm(CO_Data* d, UNS32 pdoNum) |
432 void PDOInhibitTimerAlarm(CO_Data* d, UNS32 pdoNum) |
433 { |
433 { |
521 status = state11; |
521 status = state11; |
522 break; |
522 break; |
523 } |
523 } |
524 |
524 |
525 /*Compare new and old PDO*/ |
525 /*Compare new and old PDO*/ |
526 if(d->PDO_status[pdoNum].last_message.cob_id.w == pdo.cob_id.w && |
526 if(d->PDO_status[pdoNum].last_message.cob_id == pdo.cob_id && |
527 d->PDO_status[pdoNum].last_message.len == pdo.len && |
527 d->PDO_status[pdoNum].last_message.len == pdo.len && |
528 #ifdef UNS64 |
528 #ifdef UNS64 |
529 *(UNS64*)(&d->PDO_status[pdoNum].last_message.data[0]) == *(UNS64*)(&pdo.data[0])){ |
529 *(UNS64*)(&d->PDO_status[pdoNum].last_message.data[0]) == *(UNS64*)(&pdo.data[0])){ |
530 #else /* don't ALLOW_64BIT_OPS*/ |
530 #else /* don't ALLOW_64BIT_OPS*/ |
531 *(UNS32*)(&d->PDO_status[pdoNum].last_message.data[0]) == *(UNS32*)(&pdo.data[0]) && |
531 *(UNS32*)(&d->PDO_status[pdoNum].last_message.data[0]) == *(UNS32*)(&pdo.data[0]) && |
565 } |
565 } |
566 break; |
566 break; |
567 case state5: /*Send the pdo*/ |
567 case state5: /*Send the pdo*/ |
568 /*store_as_last_message*/ |
568 /*store_as_last_message*/ |
569 d->PDO_status[pdoNum].last_message = pdo; |
569 d->PDO_status[pdoNum].last_message = pdo; |
570 MSG_WAR(0x396D, "sendPDO cobId :", pdo.cob_id.w); |
570 MSG_WAR(0x396D, "sendPDO cobId :", pdo.cob_id); |
571 MSG_WAR(0x396E, " Nb octets : ", pdo.len); |
571 MSG_WAR(0x396E, " Nb octets : ", pdo.len); |
572 |
572 |
573 canSend(d->canHandle,&pdo); |
573 canSend(d->canHandle,&pdo); |
574 status = state11; |
574 status = state11; |
575 break; |
575 break; |
668 /* Delete TPDO timers */ |
668 /* Delete TPDO timers */ |
669 d->PDO_status[pdoNum].event_timer = DelAlarm(d->PDO_status[pdoNum].event_timer); |
669 d->PDO_status[pdoNum].event_timer = DelAlarm(d->PDO_status[pdoNum].event_timer); |
670 d->PDO_status[pdoNum].inhibit_timer = DelAlarm(d->PDO_status[pdoNum].inhibit_timer); |
670 d->PDO_status[pdoNum].inhibit_timer = DelAlarm(d->PDO_status[pdoNum].inhibit_timer); |
671 /* Reset transmit type parameter */ |
671 /* Reset transmit type parameter */ |
672 d->PDO_status[pdoNum].transmit_type_parameter = 0; |
672 d->PDO_status[pdoNum].transmit_type_parameter = 0; |
673 d->PDO_status[pdoNum].last_message.cob_id.w = 0; |
673 d->PDO_status[pdoNum].last_message.cob_id = 0; |
674 pdoNum++; |
674 pdoNum++; |
675 offsetObjdict++; |
675 offsetObjdict++; |
676 } |
676 } |
677 } |
677 } |