Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
authorFlorian Pose <fp@igh-essen.com>
Fri, 17 Mar 2006 15:18:13 +0000
changeset 105 fad6709a526f
parent 104 052bc82d5442
child 106 d6679c77ad3f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
include/ecrt.h
master/domain.c
--- a/include/ecrt.h	Fri Mar 17 14:21:35 2006 +0000
+++ b/include/ecrt.h	Fri Mar 17 15:18:13 2006 +0000
@@ -78,6 +78,7 @@
                                     ec_field_init_t *fields);
 void ecrt_domain_queue(ec_domain_t *domain);
 void ecrt_domain_process(ec_domain_t *domain);
+int ecrt_domain_state(ec_domain_t *domain);
 
 /*****************************************************************************/
 // Slave Methods
--- a/master/domain.c	Fri Mar 17 14:21:35 2006 +0000
+++ b/master/domain.c	Fri Mar 17 15:18:13 2006 +0000
@@ -394,10 +394,32 @@
 
 /*****************************************************************************/
 
+/**
+   Gibt den Status einer Domäne zurück.
+
+   \return 0 wenn alle Kommandos empfangen wurden, sonst -1.
+*/
+
+int ecrt_domain_state(ec_domain_t *domain /**< Domäne */)
+{
+    unsigned int i;
+    ec_command_t *command;
+
+    for (i = 0; i < domain->command_count; i++) {
+        command = domain->commands + i;
+        if (command->state != EC_CMD_RECEIVED) return -1;
+    }
+
+    return 0;
+}
+
+/*****************************************************************************/
+
 EXPORT_SYMBOL(ecrt_domain_register_field);
 EXPORT_SYMBOL(ecrt_domain_register_field_list);
 EXPORT_SYMBOL(ecrt_domain_queue);
 EXPORT_SYMBOL(ecrt_domain_process);
+EXPORT_SYMBOL(ecrt_domain_state);
 
 /*****************************************************************************/