37 master->command_index = 0x00; |
37 master->command_index = 0x00; |
38 master->domain_count = 0; |
38 master->domain_count = 0; |
39 master->debug_level = 0; |
39 master->debug_level = 0; |
40 master->bus_time = 0; |
40 master->bus_time = 0; |
41 master->frames_lost = 0; |
41 master->frames_lost = 0; |
42 master->t_lost_output = 0; |
42 master->frames_delayed = 0; |
|
43 master->t_last_cyclic_output = 0; |
43 } |
44 } |
44 |
45 |
45 /*****************************************************************************/ |
46 /*****************************************************************************/ |
46 |
47 |
47 /** |
48 /** |
82 |
83 |
83 master->command_index = 0; |
84 master->command_index = 0; |
84 master->debug_level = 0; |
85 master->debug_level = 0; |
85 master->bus_time = 0; |
86 master->bus_time = 0; |
86 master->frames_lost = 0; |
87 master->frames_lost = 0; |
87 master->t_lost_output = 0; |
88 master->frames_delayed = 0; |
|
89 master->t_last_cyclic_output = 0; |
88 } |
90 } |
89 |
91 |
90 /*****************************************************************************/ |
92 /*****************************************************************************/ |
91 |
93 |
92 /** |
94 /** |
235 } |
237 } |
236 |
238 |
237 /*****************************************************************************/ |
239 /*****************************************************************************/ |
238 |
240 |
239 /** |
241 /** |
240 Gibt die Anzahl verlorener Frames aus. |
242 Ausgaben während des zyklischen Betriebs. |
|
243 |
|
244 Diese Funktion sorgt dafür, dass Ausgaben (Zählerstände) während |
|
245 des zyklischen Betriebs nicht zu oft getätigt werden. |
241 |
246 |
242 Die Ausgabe erfolgt gesammelt höchstens einmal pro Sekunde. |
247 Die Ausgabe erfolgt gesammelt höchstens einmal pro Sekunde. |
243 */ |
248 */ |
244 |
249 |
245 void ec_output_lost_frames(ec_master_t *master /**< EtherCAT-Master */) |
250 void ec_cyclic_output(ec_master_t *master /**< EtherCAT-Master */) |
246 { |
251 { |
247 unsigned long int t; |
252 unsigned long int t; |
248 |
253 |
249 if (master->frames_lost) { |
254 rdtscl(t); |
250 rdtscl(t); |
255 |
251 if ((t - master->t_lost_output) / cpu_khz > 1000) { |
256 if ((t - master->t_last_cyclic_output) / cpu_khz > 1000) { |
|
257 if (master->frames_lost) { |
252 EC_WARN("%u frame(s) LOST!\n", master->frames_lost); |
258 EC_WARN("%u frame(s) LOST!\n", master->frames_lost); |
253 master->frames_lost = 0; |
259 master->frames_lost = 0; |
254 master->t_lost_output = t; |
260 } |
255 } |
261 if (master->frames_delayed) { |
|
262 EC_WARN("%u frame(s) DELAYED!\n", master->frames_delayed); |
|
263 master->frames_delayed = 0; |
|
264 } |
|
265 master->t_last_cyclic_output = t; |
256 } |
266 } |
257 } |
267 } |
258 |
268 |
259 /*****************************************************************************/ |
269 /*****************************************************************************/ |
260 |
270 |