Bugfix: ecrt_domain_state() always returned -1.
--- a/master/domain.c Tue Sep 19 14:08:31 2006 +0000
+++ b/master/domain.c Sat Sep 23 10:56:02 2006 +0000
@@ -515,10 +515,14 @@
ec_datagram_t *datagram;
working_counter_sum = 0;
+ domain->state = 0;
list_for_each_entry(datagram, &domain->datagrams, list) {
if (datagram->state == EC_DATAGRAM_RECEIVED) {
working_counter_sum += datagram->working_counter;
}
+ else {
+ domain->state = -1;
+ }
}
if (working_counter_sum != domain->response_count) {
@@ -554,13 +558,7 @@
int ecrt_domain_state(const ec_domain_t *domain /**< EtherCAT domain */)
{
- ec_datagram_t *datagram;
-
- list_for_each_entry(datagram, &domain->datagrams, list) {
- if (datagram->state != EC_DATAGRAM_RECEIVED) return -1;
- }
-
- return 0;
+ return domain->state;
}
/*****************************************************************************/
--- a/master/domain.h Tue Sep 19 14:08:31 2006 +0000
+++ b/master/domain.h Sat Sep 23 10:56:02 2006 +0000
@@ -66,6 +66,7 @@
struct list_head datagrams; /**< process data datagrams */
uint32_t base_address; /**< logical offset address of the process data */
unsigned int response_count; /**< number of responding slaves */
+ unsigned int state; /**< domain error state */
struct list_head data_regs; /**< PDO data registrations */
unsigned int working_counter_changes; /**< working counter changes
since last notification */