master/master.c
changeset 1485 5ddc3a455059
parent 1483 43adf48aa157
child 1489 f77a1182b6f4
--- a/master/master.c	Fri Jun 26 08:00:47 2009 +0000
+++ b/master/master.c	Fri Jun 26 09:46:57 2009 +0000
@@ -1334,6 +1334,50 @@
 
 /*****************************************************************************/
 
+/** Get the number of EoE handlers.
+ *
+ * \return Number of EoE handlers.
+ */
+uint16_t ec_master_eoe_handler_count(
+		const ec_master_t *master /**< EtherCAT master. */
+		)
+{
+	const ec_eoe_t *eoe;
+	unsigned int count = 0;
+
+	list_for_each_entry(eoe, &master->eoe_handlers, list) {
+		count++;
+	}
+
+	return count;
+}
+
+/*****************************************************************************/
+
+/** Get an EoE handler via its position in the list.
+ *
+ * Const version.
+ *
+ * \return EoE handler pointer, or \a NULL if not found.
+ */
+const ec_eoe_t *ec_master_get_eoe_handler_const(
+		const ec_master_t *master, /**< EtherCAT master. */
+		uint16_t index /**< EoE handler index. */
+		)
+{
+	const ec_eoe_t *eoe;
+
+	list_for_each_entry(eoe, &master->eoe_handlers, list) {
+		if (index--)
+			continue;
+		return eoe;
+	}
+
+	return NULL;
+}
+
+/*****************************************************************************/
+
 /** Set the debug level.
  *
  * \retval       0 Success.