Skip to content

Commit

Permalink
[testutils,i2c] Stop waiting upon receiving a NACK
Browse files Browse the repository at this point in the history
End the transaction wait if the controller receives a NACK.

Signed-off-by: Alexander Williams <[email protected]>
  • Loading branch information
a-will committed Apr 12, 2024
1 parent f5ec916 commit 2feef77
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sw/device/lib/testing/i2c_testutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,11 @@ status_t i2c_testutils_wait_host_idle(const dif_i2c_t *i2c) {

status_t i2c_testutils_wait_transaction_finish(const dif_i2c_t *i2c) {
dif_i2c_status_t status;
bool controller_halted = false;
do {
TRY(dif_i2c_get_status(i2c, &status));
} while (!status.fmt_fifo_empty);
TRY(dif_i2c_irq_is_pending(i2c, kDifI2cIrqControllerHalt,
&controller_halted));
} while (!status.fmt_fifo_empty || controller_halted);
return OK_STATUS();
}

0 comments on commit 2feef77

Please sign in to comment.