Commit 22e0d992 authored by Adam Wujek's avatar Adam Wujek

common/i2c: for PEC finish i2c write transaction before the execution of a callback

Without PEC the i2c write transaction is finished before the execution of a callback.
Make the same behavior when the PEC is used.
Triggering a reset over i2c returns write failure if the transaction is not finished.
Signed-off-by: 's avatarAdam Wujek <dev_public@wujek.eu>
parent b29fb0ef
Pipeline #3783 passed with stage
in 1 minute and 16 seconds
...@@ -155,14 +155,17 @@ static void __xMR I2C_rx_complete(const struct i2c_s_async_descriptor *const des ...@@ -155,14 +155,17 @@ static void __xMR I2C_rx_complete(const struct i2c_s_async_descriptor *const des
io_read(io, &checksum_from_m, 1); io_read(io, &checksum_from_m, 1);
if (checksum_from_m == pec_checksum) { if (checksum_from_m == pec_checksum) {
send_ack(descr); send_ack(descr);
set_cmd(descr, 2);
rx_state = CMD;
if (cmds->cmds[cmd_index].w_callback) if (cmds->cmds[cmd_index].w_callback)
notmr_call_helper(cmds->cmds[cmd_index].w_callback); notmr_call_helper(cmds->cmds[cmd_index].w_callback);
} else { } else {
status_cml = CML_PEC; // PEC error status_cml = CML_PEC; // PEC error
send_nack(descr); send_nack(descr);
set_cmd(descr, 2);
rx_state = CMD;
} }
set_cmd(descr, 2);
rx_state = CMD;
break; break;
default: default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment