master/slave.c
changeset 799 068a58b96965
parent 792 3778920f61e4
child 813 bfc3f1ab52de
--- a/master/slave.c	Tue Feb 19 14:05:59 2008 +0000
+++ b/master/slave.c	Tue Feb 19 14:06:50 2008 +0000
@@ -1189,7 +1189,7 @@
 
 /**
  * Get an SDO from the dictionary.
- * \returns The desired SDO, of NULL.
+ * \returns The desired SDO, or NULL.
  */
 
 ec_sdo_t *ec_slave_get_sdo(
@@ -1208,3 +1208,29 @@
 }
 
 /*****************************************************************************/
+
+/** Finds a mapped Pdo.
+ * \returns The desired Pdo object, or NULL.
+ */
+const ec_pdo_t *ec_slave_find_pdo(
+        const ec_slave_t *slave, /**< Slave. */
+        uint16_t index /**< Pdo index to find. */
+        )
+{
+    unsigned int i;
+    const ec_sync_t *sync;
+    const ec_pdo_t *pdo;
+
+    for (i = 0; i < slave->sii_sync_count; i++) {
+        sync = &slave->sii_syncs[i];
+
+        if (!(pdo = ec_pdo_mapping_find_pdo(&sync->mapping, index)))
+            continue;
+
+        return pdo;
+    }
+
+    return NULL;
+}
+
+/*****************************************************************************/