summaryrefslogtreecommitdiff
path: root/libhw_cr/rp2040_hwspi.c
diff options
context:
space:
mode:
Diffstat (limited to 'libhw_cr/rp2040_hwspi.c')
-rw-r--r--libhw_cr/rp2040_hwspi.c8
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),