drivers: spi: stm32: dynamically update spi word/frame size
Update the source_data and dest_data sizes with the frame size in bytes before performing the transfer. With these changes, we can handle cases where the buffers switch between 8-bit and 16-bit modes. Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
This commit is contained in:
parent
994efc0b92
commit
eccf541ea6
1 changed files with 7 additions and 0 deletions
|
@ -1186,6 +1186,13 @@ static int transceive_dma(const struct device *dev,
|
|||
/* This is turned off in spi_stm32_complete(). */
|
||||
spi_stm32_cs_control(dev, true);
|
||||
|
||||
uint8_t word_size_bytes = bits2bytes(SPI_WORD_SIZE_GET(config->operation));
|
||||
|
||||
data->dma_rx.dma_cfg.source_data_size = word_size_bytes;
|
||||
data->dma_rx.dma_cfg.dest_data_size = word_size_bytes;
|
||||
data->dma_tx.dma_cfg.source_data_size = word_size_bytes;
|
||||
data->dma_tx.dma_cfg.dest_data_size = word_size_bytes;
|
||||
|
||||
while (data->ctx.rx_len > 0 || data->ctx.tx_len > 0) {
|
||||
size_t dma_len;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue