# HG changeset patch # User Florian Pose # Date 1160772263 0 # Node ID 8b1194e51cf2bc9cc05a668ff7114d634241b1ce # Parent ff1b018a9b09e34d82db0a34e12c986081a66b87 BUGFIX: Added returns after timeout in SII state machine. diff -r ff1b018a9b09 -r 8b1194e51cf2 master/fsm.c --- a/master/fsm.c Fri Oct 13 09:45:22 2006 +0000 +++ b/master/fsm.c Fri Oct 13 20:44:23 2006 +0000 @@ -1649,7 +1649,7 @@ if (EC_READ_U8(datagram->data + 1) & 0x81) { // still busy... timeout? if (get_cycles() - fsm->sii_start >= (cycles_t) 10 * cpu_khz) { - EC_ERR("SII: Timeout.\n"); + EC_ERR("SII: Read timeout.\n"); fsm->sii_state = ec_fsm_error; #if 0 EC_DBG("SII busy: %02X %02X %02X %02X\n", @@ -1658,6 +1658,7 @@ EC_READ_U8(datagram->data + 2), EC_READ_U8(datagram->data + 3)); #endif + return; } // issue check/fetch datagram again @@ -1752,18 +1753,22 @@ if (get_cycles() - fsm->sii_start >= (cycles_t) 10 * cpu_khz) { EC_ERR("SII: Write timeout.\n"); fsm->sii_state = ec_fsm_error; + return; } // issue check/fetch datagram again ec_master_queue_datagram(fsm->master, datagram); - } - else if (EC_READ_U8(datagram->data + 1) & 0x40) { + return; + } + + if (EC_READ_U8(datagram->data + 1) & 0x40) { EC_ERR("SII: Write operation failed!\n"); fsm->sii_state = ec_fsm_error; - } - else { // success - fsm->sii_state = ec_fsm_end; - } + return; + } + + // success + fsm->sii_state = ec_fsm_end; } /******************************************************************************