Introduced ec_master_domain_count() and ec_master_find_domain().
--- a/master/master.c Wed Jun 04 09:59:23 2008 +0000
+++ b/master/master.c Wed Jun 04 10:10:05 2008 +0000
@@ -1305,6 +1305,40 @@
return NULL;
}
+/*****************************************************************************/
+
+unsigned int ec_master_domain_count(
+ const ec_master_t *master /**< EtherCAT master. */
+ )
+{
+ const ec_domain_t *domain;
+ unsigned int count = 0;
+
+ list_for_each_entry(domain, &master->domains, list) {
+ count++;
+ }
+
+ return count;
+}
+
+/*****************************************************************************/
+
+ec_domain_t *ec_master_find_domain(
+ ec_master_t *master, /**< EtherCAT master. */
+ unsigned int index /**< Domain index. */
+ )
+{
+ ec_domain_t *domain;
+
+ list_for_each_entry(domain, &master->domains, list) {
+ if (index--)
+ continue;
+ return domain;
+ }
+
+ return NULL;
+}
+
/******************************************************************************
* Realtime interface
*****************************************************************************/
--- a/master/master.h Wed Jun 04 09:59:23 2008 +0000
+++ b/master/master.h Wed Jun 04 10:10:05 2008 +0000
@@ -197,6 +197,9 @@
#endif
void ec_master_destroy_slaves(ec_master_t *);
-/*****************************************************************************/
-
-#endif
+unsigned int ec_master_domain_count(const ec_master_t *);
+ec_domain_t *ec_master_find_domain(ec_master_t *, unsigned int);
+
+/*****************************************************************************/
+
+#endif