equal
deleted
inserted
replaced
33 */ |
33 */ |
34 |
34 |
35 #include <data.h> |
35 #include <data.h> |
36 #include "emcy.h" |
36 #include "emcy.h" |
37 #include "canfestival.h" |
37 #include "canfestival.h" |
|
38 #include "sysdep.h" |
38 |
39 |
39 |
40 |
40 |
41 |
41 UNS32 OnNumberOfErrorsUpdate(CO_Data* d, const indextable * unsused_indextable, UNS8 unsused_bSubindex); |
42 UNS32 OnNumberOfErrorsUpdate(CO_Data* d, const indextable * unsused_indextable, UNS8 unsused_bSubindex); |
42 UNS8 sendEMCY(CO_Data* d, UNS16 errCode, UNS8 errRegister); |
43 UNS8 sendEMCY(CO_Data* d, UNS16 errCode, UNS8 errRegister); |
98 { |
99 { |
99 Message m; |
100 Message m; |
100 |
101 |
101 MSG_WAR(0x3051, "sendEMCY", 0); |
102 MSG_WAR(0x3051, "sendEMCY", 0); |
102 |
103 |
103 m.cob_id = *d->error_cobid; |
104 m.cob_id = UNS16_LE(*(UNS16*)d->error_cobid); |
104 m.rtr = NOT_A_REQUEST; |
105 m.rtr = NOT_A_REQUEST; |
105 m.len = 8; |
106 m.len = 8; |
106 m.data[0] = errCode & 0xFF; /* LSB */ |
107 m.data[0] = errCode & 0xFF; /* LSB */ |
107 m.data[1] = (errCode >> 8) & 0xFF; /* MSB */ |
108 m.data[1] = (errCode >> 8) & 0xFF; /* MSB */ |
108 m.data[2] = errRegister; |
109 m.data[2] = errRegister; |
236 MSG_ERR(0x1056, "Error size EMCY. CobId : ", m->cob_id); |
237 MSG_ERR(0x1056, "Error size EMCY. CobId : ", m->cob_id); |
237 return; |
238 return; |
238 } |
239 } |
239 |
240 |
240 /* post the received EMCY */ |
241 /* post the received EMCY */ |
241 nodeID = m->cob_id & 0x7F; |
242 nodeID = UNS16_LE(m->cob_id) & 0x7F; |
242 errCode = m->data[0] | ((UNS16)m->data[1] << 8); |
243 errCode = m->data[0] | ((UNS16)m->data[1] << 8); |
243 errReg = m->data[2]; |
244 errReg = m->data[2]; |
244 (*d->post_emcy)(nodeID, errCode, errReg); |
245 (*d->post_emcy)(nodeID, errCode, errReg); |
245 } |
246 } |
246 |
247 |