--- a/master/master.c Fri Mar 24 08:56:16 2006 +0000
+++ b/master/master.c Mon Mar 27 09:53:59 2006 +0000
@@ -101,6 +101,10 @@
master->command_index = 0;
master->debug_level = 0;
master->timeout = 100; // us
+
+ master->slaves_responding = 0;
+ master->slave_states = EC_SLAVE_STATE_UNKNOWN;
+
master->stats.timeouts = 0;
master->stats.delayed = 0;
master->stats.corrupted = 0;
@@ -389,7 +393,7 @@
}
// Keine direkte Antwort. Dem Slave Zeit lassen...
- udelay(10);
+ udelay(100);
if (unlikely(--response_tries_left)) {
EC_ERR("No response in simple-IO!\n");
@@ -679,6 +683,58 @@
EC_WRITE_U16(data + 14, 0x0000); // res.
}
+/*****************************************************************************/
+
+/**
+ Gibt Überwachungsinformationen aus.
+*/
+
+void ec_master_process_watch_command(ec_master_t *master
+ /**< EtherCAT-Master */
+ )
+{
+ unsigned int first;
+
+ first = 1;
+
+ if (master->watch_command.working_counter != master->slaves_responding ||
+ master->watch_command.data[0] != master->slave_states)
+ {
+ master->slaves_responding = master->watch_command.working_counter;
+ master->slave_states = master->watch_command.data[0];
+
+ EC_INFO("%i slave%s responding (", master->slaves_responding,
+ master->slaves_responding == 1 ? "" : "s");
+
+ if (master->slave_states & EC_SLAVE_STATE_INIT) {
+ printk("INIT");
+ first = 0;
+ }
+ if (master->slave_states & EC_SLAVE_STATE_PREOP) {
+ if (!first) {
+ printk(", ");
+ first = 0;
+ }
+ printk("PREOP");
+ }
+ if (master->slave_states & EC_SLAVE_STATE_SAVEOP) {
+ if (!first) {
+ printk(", ");
+ first = 0;
+ }
+ printk("SAVEOP");
+ }
+ if (master->slave_states & EC_SLAVE_STATE_OP) {
+ if (!first) {
+ printk(", ");
+ first = 0;
+ }
+ printk("OP");
+ }
+ printk(")\n");
+ }
+}
+
/******************************************************************************
*
* Echtzeitschnittstelle
@@ -836,6 +892,9 @@
return -1;
}
+ master->slaves_responding = master->slave_count;
+ master->slave_states = EC_SLAVE_STATE_OP;
+
return 0;
}
@@ -952,6 +1011,10 @@
return;
}
+ // Watch-Kommando hinzufügen
+ ec_command_init_brd(&master->watch_command, 0x130, 2);
+ ec_master_queue_command(master, &master->watch_command);
+
// Rahmen senden
ec_master_send_commands(master);
}
@@ -966,8 +1029,6 @@
{
ec_command_t *command, *next;
- ec_master_output_stats(master);
-
ec_device_call_isr(master->device);
// Alle empfangenen Kommandos aus der Liste entfernen
@@ -989,6 +1050,12 @@
}
list_del_init(&command->list);
}
+
+ // Watch-Kommando verarbeiten
+ ec_master_process_watch_command(master);
+
+ // Statistiken ausgeben
+ ec_master_output_stats(master);
}
/*****************************************************************************/
--- a/mini/mini.c Fri Mar 24 08:56:16 2006 +0000
+++ b/mini/mini.c Mon Mar 27 09:53:59 2006 +0000
@@ -29,7 +29,7 @@
ec_domain_t *domain1 = NULL;
// Datenfelder
-void *r_ssi_input, *r_ssi_status, *r_4102[3];
+//void *r_ssi_input, *r_ssi_status, *r_4102[3];
// Kanäle
uint32_t k_pos;
@@ -37,13 +37,10 @@
ec_field_init_t domain1_fields[] = {
{NULL, "1", "Beckhoff", "EL1014", "InputValue", 0},
- {NULL, "2", "Beckhoff", "EL1014", "InputValue", 0},
- {NULL, "3", "Beckhoff", "EL1014", "InputValue", 0},
- {NULL, "4", "Beckhoff", "EL1014", "InputValue", 0},
- {NULL, "5", "Beckhoff", "EL1014", "InputValue", 0},
- {NULL, "6", "Beckhoff", "EL2004", "OutputValue", 0},
- {NULL, "7", "Beckhoff", "EL2004", "OutputValue", 0},
- {NULL, "8", "Beckhoff", "EL2004", "OutputValue", 0},
+ {NULL, "2", "Beckhoff", "EL2004", "OutputValue", 0},
+ //{NULL, "3", "Beckhoff", "EL3162", "InputValue", 0},
+ {NULL, "4", "Beckhoff", "EL4132", "OutputValue", 0},
+ {NULL, "6", "Beckhoff", "EL5001", "InputValue", 0},
{}
};
@@ -127,6 +124,7 @@
//ecrt_master_debug(master, 2);
+#if 0
if (ecrt_master_sdo_write(master, "1", 0x4061, 1, 0, 1) ||
ecrt_master_sdo_write(master, "1", 0x4061, 2, 1, 1) ||
ecrt_master_sdo_write(master, "1", 0x4061, 3, 1, 1) ||
@@ -139,6 +137,7 @@
printk(KERN_ERR "EtherCAT: Failed to configure SSI!\n");
goto out_deactivate;
}
+#endif
//ecrt_master_debug(master, 0);
@@ -166,8 +165,10 @@
return 0;
+#if 0
out_deactivate:
ecrt_master_deactivate(master);
+#endif
out_release_master:
ecrt_release_master(master);