Skip to content
Snippets Groups Projects
Commit 7d0b2b3a authored by Florian Pose's avatar Florian Pose
Browse files

BUGFIX: Added returns after timeout in SII state machine.

parent c79ed4f1
No related branches found
No related tags found
No related merge requests found
...@@ -1649,7 +1649,7 @@ void ec_fsm_sii_read_fetch(ec_fsm_t *fsm /**< finite state machine */) ...@@ -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) { if (EC_READ_U8(datagram->data + 1) & 0x81) {
// still busy... timeout? // still busy... timeout?
if (get_cycles() - fsm->sii_start >= (cycles_t) 10 * cpu_khz) { 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; fsm->sii_state = ec_fsm_error;
#if 0 #if 0
EC_DBG("SII busy: %02X %02X %02X %02X\n", 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 */) ...@@ -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 + 2),
EC_READ_U8(datagram->data + 3)); EC_READ_U8(datagram->data + 3));
#endif #endif
return;
} }
// issue check/fetch datagram again // issue check/fetch datagram again
...@@ -1752,18 +1753,22 @@ void ec_fsm_sii_write_check2(ec_fsm_t *fsm /**< finite state machine */) ...@@ -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) { if (get_cycles() - fsm->sii_start >= (cycles_t) 10 * cpu_khz) {
EC_ERR("SII: Write timeout.\n"); EC_ERR("SII: Write timeout.\n");
fsm->sii_state = ec_fsm_error; fsm->sii_state = ec_fsm_error;
return;
} }
// issue check/fetch datagram again // issue check/fetch datagram again
ec_master_queue_datagram(fsm->master, datagram); 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"); EC_ERR("SII: Write operation failed!\n");
fsm->sii_state = ec_fsm_error; fsm->sii_state = ec_fsm_error;
return;
} }
else { // success
fsm->sii_state = ec_fsm_end; // success
} fsm->sii_state = ec_fsm_end;
} }
/****************************************************************************** /******************************************************************************
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment