diff -r 861f4715ed6f -r 4cf9c3e9f0bd master/master.c --- a/master/master.c Mon Sep 25 17:28:31 2006 +0000 +++ b/master/master.c Tue Sep 26 16:38:38 2006 +0000 @@ -108,7 +108,7 @@ master->index = index; master->device = NULL; - master->reserved = 0; + atomic_set(&master->available, 1); INIT_LIST_HEAD(&master->slaves); INIT_LIST_HEAD(&master->datagram_queue); INIT_LIST_HEAD(&master->domains); @@ -1041,9 +1041,10 @@ /** Measures the time, a frame is on the bus. -*/ - -void ec_master_measure_bus_time(ec_master_t *master) + \return 0 in case of success, else < 0 +*/ + +int ec_master_measure_bus_time(ec_master_t *master) { ec_datagram_t datagram; cycles_t cycles_start, cycles_end, cycles_timeout; @@ -1054,7 +1055,7 @@ if (ec_datagram_brd(&datagram, 0x130, 2)) { EC_ERR("Failed to allocate datagram for bus time measuring.\n"); ec_datagram_clear(&datagram); - return; + return -1; } cycles_timeout = (cycles_t) EC_IO_TIMEOUT * (cpu_khz / 1000); @@ -1093,11 +1094,13 @@ EC_INFO("Bus time is (min/avg/max) %u/%u.%u/%u us.\n", min, sum / 100, sum % 100, max); + return 0; error: // Dequeue and free datagram list_del(&datagram.queue); ec_datagram_clear(&datagram); + return -1; } /******************************************************************************