Added ec_sync_get_pdo_type().
authorFlorian Pose <fp@igh-essen.com>
Thu, 20 Sep 2007 12:57:28 +0000
changeset 748 6c8801bd547f
parent 747 ac8a822c3e5b
child 749 c8f1395f818a
Added ec_sync_get_pdo_type().
master/sync.c
master/sync.h
--- a/master/sync.c	Thu Sep 20 12:33:58 2007 +0000
+++ b/master/sync.c	Thu Sep 20 12:57:28 2007 +0000
@@ -195,3 +195,26 @@
 }
 
 /*****************************************************************************/
+
+/**
+ */
+
+ec_pdo_type_t ec_sync_get_pdo_type(
+        const ec_sync_t *sync /**< EtherCAT sync manager */
+        )
+{
+    int index = sync->index;
+
+    if (sync->slave && sync->slave->sii_mailbox_protocols) {
+        index -= 2;
+    }
+
+    if (index < 0 || index > 1) {
+        EC_WARN("ec_sync_get_pdo_type(): invalid sync manager index.\n");
+        return EC_RX_PDO;
+    }
+
+    return (ec_pdo_type_t) index;
+}
+
+/*****************************************************************************/
--- a/master/sync.h	Thu Sep 20 12:33:58 2007 +0000
+++ b/master/sync.h	Thu Sep 20 12:57:28 2007 +0000
@@ -83,6 +83,8 @@
 int ec_sync_add_pdo(ec_sync_t *, const ec_pdo_t *);
 void ec_sync_clear_pdos(ec_sync_t *);
 
+ec_pdo_type_t ec_sync_get_pdo_type(const ec_sync_t *);
+
 /*****************************************************************************/
 
 #endif