diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-03-26 16:15:42 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-03-26 22:01:16 -0600 |
commit | 63fcccd84cb348b1b4194024a0dea4dd81941daf (patch) | |
tree | 59f0a19116791a5894892d6275330b482b92f222 /libhw_cr/rp2040_hwspi.c | |
parent | 0378f059440d4702203f9bc005894f7b53cad889 (diff) |
libhw_generic: Re-think duplex_iovec
Diffstat (limited to 'libhw_cr/rp2040_hwspi.c')
-rw-r--r-- | libhw_cr/rp2040_hwspi.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libhw_cr/rp2040_hwspi.c b/libhw_cr/rp2040_hwspi.c index 7b57792..d4adb11 100644 --- a/libhw_cr/rp2040_hwspi.c +++ b/libhw_cr/rp2040_hwspi.c @@ -185,23 +185,23 @@ static void rp2040_hwspi_readwritev(struct rp2040_hwspi *self, const struct dupl if (!iov[i].iov_len) continue; tx_data_blocks[j] = (typeof(tx_data_blocks[0])){ - .read_addr = iov[i].iov_write_src ?: &self->bogus_data, + .read_addr = (iov[i].iov_write_from != IOVEC_DISCARD) ? iov[i].iov_write_from : &self->bogus_data, .write_addr = &spi_get_hw(self->inst)->dr, .trans_count = iov[i].iov_len, .ctrl = (DMA_CTRL_ENABLE | DMA_CTRL_DATA_SIZE(DMA_SIZE_8) - | (iov[i].iov_write_src ? DMA_CTRL_INCR_READ : 0) + | ((iov[i].iov_write_from != IOVEC_DISCARD) ? DMA_CTRL_INCR_READ : 0) | DMA_CTRL_CHAIN_TO(self->dma_tx_ctrl) | DMA_CTRL_TREQ_SEL(SPI_DREQ_NUM(self->inst, true)) | DMA_CTRL_IRQ_QUIET), }; rx_data_blocks[j] = (typeof(rx_data_blocks[0])){ .read_addr = &spi_get_hw(self->inst)->dr, - .write_addr = iov[i].iov_read_dst ?: &bogus_rx_dst, + .write_addr = (iov[i].iov_read_to != IOVEC_DISCARD) ? iov[i].iov_read_to : &bogus_rx_dst, .trans_count = iov[i].iov_len, .ctrl = (DMA_CTRL_ENABLE | DMA_CTRL_DATA_SIZE(DMA_SIZE_8) - | (iov[i].iov_read_dst ? DMA_CTRL_INCR_WRITE : 0) + | ((iov[i].iov_read_to != IOVEC_DISCARD) ? DMA_CTRL_INCR_WRITE : 0) | DMA_CTRL_CHAIN_TO(self->dma_rx_ctrl) | DMA_CTRL_TREQ_SEL(SPI_DREQ_NUM(self->inst, false)) | DMA_CTRL_IRQ_QUIET), |