Ack timeout 100ns in simple IO.
authorFlorian Pose <fp@igh-essen.com>
Tue, 18 Jul 2006 16:46:26 +0000
changeset 302 ad630f38cca1
parent 301 dfe8192a7e19
child 303 03fd45bc13ef
Ack timeout 100ns in simple IO.
master/slave.c
--- a/master/slave.c	Tue Jul 18 16:42:52 2006 +0000
+++ b/master/slave.c	Tue Jul 18 16:46:26 2006 +0000
@@ -853,10 +853,9 @@
     }
 
     start = get_cycles();
-    timeout = (cycles_t) 10 * cpu_khz; // 10ms
-
-    while (1)
-    {
+    timeout = (cycles_t) 100 * cpu_khz; // 100ms
+
+    while (1) {
         udelay(100); // wait a little bit...
 
         if (ec_datagram_nprd(datagram, slave->station_address, 0x0130, 2))
@@ -870,14 +869,14 @@
 
         end = get_cycles();
 
-        if (likely(EC_READ_U8(datagram->data) == state)) {
+        if (EC_READ_U8(datagram->data) == state) {
             slave->current_state = state;
             EC_INFO("Acknowleged state 0x%02X on slave %i.\n", state,
                     slave->ring_position);
             return;
         }
 
-        if (unlikely((end - start) >= timeout)) {
+        if (end - start >= timeout) {
             slave->current_state = EC_SLAVE_STATE_UNKNOWN;
             EC_WARN("Failed to acknowledge state 0x%02X on slave %i"
                     " - Timeout!\n", state, slave->ring_position);