# HG changeset patch # User Florian Pose # Date 1212574205 0 # Node ID 6ef20c5de875ff83146e29ce6e00926e6ebdac69 # Parent a5907351e13e3cdee3e9c3b50e56f00b65ebcc1a Introduced ec_master_domain_count() and ec_master_find_domain(). diff -r a5907351e13e -r 6ef20c5de875 master/master.c --- 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 *****************************************************************************/ diff -r a5907351e13e -r 6ef20c5de875 master/master.h --- 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