types.c: BK1120 outputs and EL1004.
authorFlorian Pose <fp@igh-essen.com>
Mon, 26 Jun 2006 11:28:24 +0000
changeset 280 35c99cdda518
parent 279 12f48c1cb143
child 281 c91bbf7bc52c
types.c: BK1120 outputs and EL1004.
examples/mini/mini.c
master/types.c
--- a/examples/mini/mini.c	Wed Jun 21 10:09:36 2006 +0000
+++ b/examples/mini/mini.c	Mon Jun 26 11:28:24 2006 +0000
@@ -57,14 +57,15 @@
 
 // data fields
 //void *r_ssi_input, *r_ssi_status, *r_4102[3];
-void *r_kbus_in;
+void *r_kbus_in, *r_kbus_out;
 
 // channels
 uint32_t k_pos;
 uint8_t k_stat;
 
 ec_field_init_t domain1_fields[] = {
-    {&r_kbus_in, "0", "Beckhoff", "BK1120", "Inputs", 0},
+    //{&r_kbus_out, "0", "Beckhoff", "BK1120", "Outputs", 0},
+    //{&r_kbus_in,  "0", "Beckhoff", "BK1120", "Inputs",  0},
     {}
 };
 
@@ -73,6 +74,7 @@
 void run(unsigned long data)
 {
     static unsigned int counter = 0;
+    unsigned int i;
 
     spin_lock(&master_lock);
 
@@ -105,8 +107,9 @@
     }
     else {
         counter = FREQUENCY;
-        //printk(KERN_INFO "k_pos    = %i\n", k_pos);
-        //printk(KERN_INFO "k_stat   = 0x%02X\n", k_stat);
+        printk(KERN_INFO "input = ");
+        for (i = 0; i < 22; i++) printk("%02X ", *((uint8_t *) r_kbus_in + i));
+        printk("\n");
     }
 
     // restart timer
@@ -163,7 +166,8 @@
         printk(KERN_ERR "Failed to get slave!\n");
         goto out_deactivate;
     }
-    ecrt_slave_field_size(slave, "Inputs", 0, 1);
+    ecrt_slave_field_size(slave, "Outputs", 0, 0x16);
+    ecrt_slave_field_size(slave, "Inputs", 0, 0x16);
 #endif
 
     printk(KERN_INFO "Activating master...\n");
@@ -172,7 +176,7 @@
         goto out_release_master;
     }
 
-#if 0
+#if 1
     if (ecrt_master_fetch_sdo_lists(master)) {
         printk(KERN_ERR "Failed to fetch SDO lists!\n");
         goto out_deactivate;
--- a/master/types.c	Wed Jun 21 10:09:36 2006 +0000
+++ b/master/types.c	Mon Jun 26 11:28:24 2006 +0000
@@ -67,6 +67,7 @@
 
 /*****************************************************************************/
 
+const ec_field_t bk1120_out = {"Outputs", 0}; // variable size
 const ec_field_t bk1120_in = {"Inputs", 0}; // variable size
 
 const ec_sync_t bk1120_sm0 = {0x1C00, 264, 0x26, {NULL}};
@@ -74,7 +75,7 @@
 
 const ec_sync_t bk1120_sm2 = { // outputs
     0x1000, 0, 0x24, // variable size
-    {NULL}
+    {&bk1120_out, NULL}
 };
 
 const ec_sync_t bk1120_sm3 = { // inputs
@@ -89,6 +90,20 @@
 
 /*****************************************************************************/
 
+const ec_field_t el1004_in = {"InputValue", 1};
+
+const ec_sync_t el1004_sm0 = { // inputs
+    0x1000, 1, 0x00,
+    {&el1004_in, NULL}
+};
+
+const ec_slave_type_t Beckhoff_EL1004 = {
+    "Beckhoff", "EL1004", "4x Digital Input, 3ms", EC_TYPE_NORMAL,
+    {&el1004_sm0, NULL}
+};
+
+/*****************************************************************************/
+
 const ec_field_t el1014_in = {"InputValue", 1};
 
 const ec_sync_t el1014_sm0 = { // inputs
@@ -97,7 +112,7 @@
 };
 
 const ec_slave_type_t Beckhoff_EL1014 = {
-    "Beckhoff", "EL1014", "4x Digital Input", EC_TYPE_NORMAL,
+    "Beckhoff", "EL1014", "4x Digital Input, 10us", EC_TYPE_NORMAL,
     {&el1014_sm0, NULL}
 };
 
@@ -244,6 +259,7 @@
 */
 
 ec_slave_ident_t slave_idents[] = {
+    {0x00000002, 0x03EC3052, &Beckhoff_EL1004},
     {0x00000002, 0x03F63052, &Beckhoff_EL1014},
     {0x00000002, 0x044C2C52, &Beckhoff_EK1100},
     {0x00000002, 0x04562C52, &Beckhoff_EK1110},