Skip to content

Commit d1b79aa

Browse files
ubiedakartben
authored andcommitted
drivers: i2c_nrfx_twi_rtio: Fix multi-writes with OP_TRANSACTION flag
This patch establishes proper handling of RTIO OPs with multiple write requests in the same transfer (as in: including OP_TRANSACTION flag). An example of this is captured in test_ram_rtio_write_with_transaction test). This patch makes that testcase pass for i2c_nrfx_twi_rtio. Signed-off-by: Luis Ubieda <[email protected]>
1 parent 7f65888 commit d1b79aa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/i2c/i2c_nrfx_twi_rtio.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,16 @@ static bool i2c_nrfx_twi_rtio_msg_start(const struct device *dev, uint8_t flags,
4141
struct i2c_nrfx_twi_rtio_data *const dev_data = dev->data;
4242
struct i2c_rtio *ctx = dev_data->ctx;
4343
int ret = 0;
44+
bool more_msgs = (rtio_txn_next(ctx->txn_curr) != NULL) &&
45+
((ctx->txn_curr->next->sqe.iodev_flags & RTIO_IODEV_I2C_RESTART) == 0);
4446

4547
/** Enabling while already enabled ends up in a failed assertion: skip it. */
4648
if (!dev_data->twi_enabled) {
4749
nrfx_twi_enable(&config->twi);
4850
dev_data->twi_enabled = true;
4951
}
5052

51-
ret = i2c_nrfx_twi_msg_transfer(dev, flags, buf, buf_len, i2c_addr, false);
53+
ret = i2c_nrfx_twi_msg_transfer(dev, flags, buf, buf_len, i2c_addr, more_msgs);
5254
if (ret != 0) {
5355
nrfx_twi_disable(&config->twi);
5456
dev_data->twi_enabled = false;

0 commit comments

Comments
 (0)