From 7d0b2b3ad32a029de63fce17c35ae0fd5ca6d53b Mon Sep 17 00:00:00 2001 From: Florian Pose <fp@igh-essen.com> Date: Fri, 13 Oct 2006 20:44:23 +0000 Subject: [PATCH] BUGFIX: Added returns after timeout in SII state machine. --- master/fsm.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/master/fsm.c b/master/fsm.c index 77927507..bb49ea7a 100644 --- a/master/fsm.c +++ b/master/fsm.c @@ -1649,7 +1649,7 @@ void ec_fsm_sii_read_fetch(ec_fsm_t *fsm /**< finite state machine */) 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 @@ void ec_fsm_sii_read_fetch(ec_fsm_t *fsm /**< finite state machine */) EC_READ_U8(datagram->data + 2), EC_READ_U8(datagram->data + 3)); #endif + return; } // issue check/fetch datagram again @@ -1752,18 +1753,22 @@ void ec_fsm_sii_write_check2(ec_fsm_t *fsm /**< finite state machine */) 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); + return; } - else if (EC_READ_U8(datagram->data + 1) & 0x40) { + + if (EC_READ_U8(datagram->data + 1) & 0x40) { EC_ERR("SII: Write operation failed!\n"); fsm->sii_state = ec_fsm_error; + return; } - else { // success - fsm->sii_state = ec_fsm_end; - } + + // success + fsm->sii_state = ec_fsm_end; } /****************************************************************************** -- GitLab