Buskoppler werden jetzt gesondert behandelt.
authorFlorian Pose <fp@igh-essen.com>
Fri, 24 Feb 2006 13:54:27 +0000
changeset 82 30d0708229b9
parent 81 28b1defdcc88
child 83 e8b76a509bc9
Buskoppler werden jetzt gesondert behandelt.
master/master.c
master/types.c
master/types.h
rt/msr_module.c
--- a/master/master.c	Fri Feb 24 13:34:31 2006 +0000
+++ b/master/master.c	Fri Feb 24 13:54:27 2006 +0000
@@ -335,8 +335,7 @@
             slave = master->slaves + i;
             if (!slave->type) continue;
 
-            if (strcmp(slave->type->vendor_name, "Beckhoff") == 0 &&
-                strcmp(slave->type->product_name, "EK1100") == 0) {
+            if (slave->type->bus_coupler) {
                 coupler_idx++;
                 slave_idx = 0;
             }
@@ -543,7 +542,7 @@
 
         // Slaves that are not registered are only brought into PREOP
         // state -> nice blinking and mailbox comm. possible
-        if (!slave->registered) {
+        if (!slave->registered && !slave->type->bus_coupler) {
             printk(KERN_WARNING "EtherCAT: Slave %i was not registered!\n",
                    slave->ring_position);
             continue;
--- a/master/types.c	Fri Feb 24 13:34:31 2006 +0000
+++ b/master/types.c	Fri Feb 24 13:54:27 2006 +0000
@@ -25,14 +25,14 @@
 /*****************************************************************************/
 
 const ec_slave_type_t Beckhoff_EK1100 = {
-    "Beckhoff", "EK1100", "Bus Coupler",
+    "Beckhoff", "EK1100", "Bus Coupler", 1,
     {NULL} // Keine Sync-Manager
 };
 
 /*****************************************************************************/
 
 const ec_slave_type_t Beckhoff_EK1110 = {
-    "Beckhoff", "EK1110", "Extension terminal",
+    "Beckhoff", "EK1110", "Extension terminal", 0,
     {NULL} // Keine Sync-Manager
 };
 
@@ -46,7 +46,7 @@
 };
 
 const ec_slave_type_t Beckhoff_EL1014 = {
-    "Beckhoff", "EL1014", "4x Digital Input",
+    "Beckhoff", "EL1014", "4x Digital Input", 0,
     {&el1014_sm0, NULL}
 };
 
@@ -60,12 +60,12 @@
 };
 
 const ec_slave_type_t Beckhoff_EL2004 = {
-    "Beckhoff", "EL2004", "4x Digital Output",
+    "Beckhoff", "EL2004", "4x Digital Output", 0,
     {&el20XX_sm0, NULL}
 };
 
 const ec_slave_type_t Beckhoff_EL2032 = {
-    "Beckhoff", "EL2032", "2x Digital Output (2A)",
+    "Beckhoff", "EL2032", "2x Digital Output (2A)", 0,
     {&el20XX_sm0, NULL}
 };
 
@@ -87,12 +87,12 @@
 };
 
 const ec_slave_type_t Beckhoff_EL3102 = {
-    "Beckhoff", "EL3102", "2x Analog Input diff.",
+    "Beckhoff", "EL3102", "2x Analog Input diff.", 0,
     {&mailbox_sm0, &mailbox_sm1, &el31X2_sm2, &el31X2_sm3, NULL}
 };
 
 const ec_slave_type_t Beckhoff_EL3162 = {
-    "Beckhoff", "EL3102", "2x Analog Input",
+    "Beckhoff", "EL3102", "2x Analog Input", 0,
     {&mailbox_sm0, &mailbox_sm1, &el31X2_sm2, &el31X2_sm3, NULL}
 };
 
@@ -106,12 +106,12 @@
 };
 
 const ec_slave_type_t Beckhoff_EL4102 = {
-    "Beckhoff", "EL4102", "2x Analog Output",
+    "Beckhoff", "EL4102", "2x Analog Output", 0,
     {&mailbox_sm0, &mailbox_sm1, &el41X2_sm2, NULL}
 };
 
 const ec_slave_type_t Beckhoff_EL4132 = {
-    "Beckhoff", "EL4132", "2x Analog Output diff.",
+    "Beckhoff", "EL4132", "2x Analog Output diff.", 0,
     {&mailbox_sm0, &mailbox_sm1, &el41X2_sm2, NULL}
 };
 
@@ -131,7 +131,7 @@
 };
 
 const ec_slave_type_t Beckhoff_EL5001 = {
-    "Beckhoff", "EL5001", "SSI-Interface",
+    "Beckhoff", "EL5001", "SSI-Interface", 0,
     {&mailbox_sm0, &mailbox_sm1, &el5001_sm2, &el5001_sm3, NULL}
 };
 
@@ -155,7 +155,7 @@
 
 const ec_slave_type_t Beckhoff_EL5101 =
 {
-    "Beckhoff", "EL5101", "Incremental Encoder Interface",
+    "Beckhoff", "EL5101", "Incremental Encoder Interface", 0,
     {&mailbox_sm0, &mailbox_sm1, &el5101_sm2, &el5101_sm3, NULL}
 };
 
--- a/master/types.h	Fri Feb 24 13:34:31 2006 +0000
+++ b/master/types.h	Fri Feb 24 13:54:27 2006 +0000
@@ -63,6 +63,9 @@
     const char *vendor_name; /**< Name des Herstellers */
     const char *product_name; /**< Name des Slaves-Typs */
     const char *description; /**< Genauere Beschreibung des Slave-Typs */
+    uint8_t bus_coupler; /**< Dieser Typ ist ein Buskoppler. Diese dienen als
+                            Anker für die Adressierung und müssen nicht
+                            registriert werden. */
     const ec_sync_t *sync_managers[EC_MAX_SYNC]; /**< Sync-Manager
                                                     Konfigurationen */
 }
--- a/rt/msr_module.c	Fri Feb 24 13:34:31 2006 +0000
+++ b/rt/msr_module.c	Fri Feb 24 13:54:27 2006 +0000
@@ -52,17 +52,15 @@
 ec_domain_t *domain1 = NULL;
 
 // Prozessdaten
-uint8_t *dig_out1;
-uint16_t *ssi_value;
-uint16_t *inc_value;
-
-uint32_t angle0;
+void *r_ssi;
+void *r_inc;
+
+uint32_t k_angle;
+uint32_t k_pos;
 
 ec_field_init_t domain1_fields[] = {
-    {},
-    {(void **) &ssi_value,   "1", "Beckhoff", "EL5001", ec_ipvalue, 0, 1},
-    {(void **) &dig_out1,    "2", "Beckhoff", "EL2004", ec_opvalue, 0, 1},
-    {(void **) &inc_value, "0:4", "Beckhoff", "EL5101", ec_ipvalue, 0, 1},
+    {(void **) &r_ssi,   "1", "Beckhoff", "EL5001", ec_ipvalue, 0, 1},
+    {(void **) &r_inc, "0:3", "Beckhoff", "EL5101", ec_ipvalue, 0, 1},
     {}
 };
 
@@ -73,7 +71,18 @@
     // Prozessdaten lesen und schreiben
     EtherCAT_rt_domain_xio(domain1);
 
-    //angle0 = (uint32_t) *inc_value;
+    k_angle = EC_READ_U16(r_inc);
+    k_pos = EC_READ_U32(r_ssi);
+}
+
+/*****************************************************************************/
+
+int msr_globals_register(void)
+{
+    msr_reg_kanal("/angle0", "", &k_angle, TUINT);
+    msr_reg_kanal("/pos0",   "", &k_pos,   TUINT);
+
+    return 0;
 }
 
 /*****************************************************************************/
@@ -106,15 +115,6 @@
 
 /*****************************************************************************/
 
-int msr_globals_register(void)
-{
-    msr_reg_kanal("/angle0", "", &angle0, TUINT);
-
-    return 0;
-}
-
-/*****************************************************************************/
-
 int __init init_rt_module(void)
 {
     struct ipipe_domain_attr attr; //ipipe