Zyklische Ausgaben um "Verz?gerte" Rahmen erweitert.
--- a/master/domain.c Tue Feb 28 11:35:32 2006 +0000
+++ b/master/domain.c Tue Feb 28 11:36:29 2006 +0000
@@ -279,7 +279,7 @@
frame = &domain->frame;
working_counter_sum = 0;
- ec_output_lost_frames(master); // Evtl. verlorene Frames ausgeben
+ ec_cyclic_output(master);
rdtscl(start_ticks); // Sendezeit nehmen
timeout_ticks = domain->timeout_us * cpu_khz / 1000;
@@ -309,10 +309,16 @@
master->bus_time = (end_ticks - start_ticks) * 1000 / cpu_khz;
if (unlikely(end_ticks - start_ticks >= timeout_ticks)) {
- master->device.state = EC_DEVICE_STATE_READY;
- master->frames_lost++;
- ec_output_lost_frames(master);
- return -1;
+ if (master->device.state == EC_DEVICE_STATE_RECEIVED) {
+ master->frames_delayed++;
+ ec_cyclic_output(master);
+ }
+ else {
+ master->device.state = EC_DEVICE_STATE_READY;
+ master->frames_lost++;
+ ec_cyclic_output(master);
+ return -1;
+ }
}
if (unlikely(ec_frame_receive(frame) < 0)) {
--- a/master/master.c Tue Feb 28 11:35:32 2006 +0000
+++ b/master/master.c Tue Feb 28 11:36:29 2006 +0000
@@ -39,7 +39,8 @@
master->debug_level = 0;
master->bus_time = 0;
master->frames_lost = 0;
- master->t_lost_output = 0;
+ master->frames_delayed = 0;
+ master->t_last_cyclic_output = 0;
}
/*****************************************************************************/
@@ -84,7 +85,8 @@
master->debug_level = 0;
master->bus_time = 0;
master->frames_lost = 0;
- master->t_lost_output = 0;
+ master->frames_delayed = 0;
+ master->t_last_cyclic_output = 0;
}
/*****************************************************************************/
@@ -237,22 +239,30 @@
/*****************************************************************************/
/**
- Gibt die Anzahl verlorener Frames aus.
+ Ausgaben während des zyklischen Betriebs.
+
+ Diese Funktion sorgt dafür, dass Ausgaben (Zählerstände) während
+ des zyklischen Betriebs nicht zu oft getätigt werden.
Die Ausgabe erfolgt gesammelt höchstens einmal pro Sekunde.
*/
-void ec_output_lost_frames(ec_master_t *master /**< EtherCAT-Master */)
+void ec_cyclic_output(ec_master_t *master /**< EtherCAT-Master */)
{
unsigned long int t;
- if (master->frames_lost) {
- rdtscl(t);
- if ((t - master->t_lost_output) / cpu_khz > 1000) {
+ rdtscl(t);
+
+ if ((t - master->t_last_cyclic_output) / cpu_khz > 1000) {
+ if (master->frames_lost) {
EC_WARN("%u frame(s) LOST!\n", master->frames_lost);
master->frames_lost = 0;
- master->t_lost_output = t;
- }
+ }
+ if (master->frames_delayed) {
+ EC_WARN("%u frame(s) DELAYED!\n", master->frames_delayed);
+ master->frames_delayed = 0;
+ }
+ master->t_last_cyclic_output = t;
}
}
--- a/master/master.h Tue Feb 28 11:35:32 2006 +0000
+++ b/master/master.h Tue Feb 28 11:36:29 2006 +0000
@@ -36,9 +36,10 @@
unsigned int domain_count; /**< Anzahl Domänen */
int debug_level; /**< Debug-Level im Master-Code */
unsigned int bus_time; /**< Letzte Bus-Zeit in Mikrosekunden */
- unsigned int frames_lost; /**< Anzahl verlorene Frames */
- unsigned long t_lost_output; /**< Timer-Ticks bei der letzten Ausgabe von
- verlorenen Frames */
+ unsigned int frames_lost; /**< Anzahl verlorener Frames */
+ unsigned int frames_delayed; /**< Anzahl verzögerter Frames */
+ unsigned long t_last_cyclic_output; /**< Timer-Ticks bei den letzten
+ zyklischen Ausgaben */
};
/*****************************************************************************/
@@ -59,7 +60,7 @@
// Misc
void ec_output_debug_data(const ec_master_t *);
-void ec_output_lost_frames(ec_master_t *);
+void ec_cyclic_output(ec_master_t *);
/*****************************************************************************/