drivers: spim: Move the length check to beginning
This check has to be done independent of whether RAM is used for buffers or not and depends on device maximum length property. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This commit is contained in:
parent
2c0f121727
commit
0a1eff8d97
1 changed files with 5 additions and 4 deletions
|
@ -312,6 +312,11 @@ static void transfer_next_chunk(const struct device *dev)
|
|||
nrfx_spim_xfer_desc_t xfer;
|
||||
nrfx_err_t result;
|
||||
const uint8_t *tx_buf = ctx->tx_buf;
|
||||
|
||||
if (chunk_len > dev_config->max_chunk_len) {
|
||||
chunk_len = dev_config->max_chunk_len;
|
||||
}
|
||||
|
||||
#if (CONFIG_SPI_NRFX_RAM_BUFFER_SIZE > 0)
|
||||
if (spi_context_tx_buf_on(ctx) &&
|
||||
!nrf_dma_accessible_check(&dev_config->spim.p_reg, tx_buf)) {
|
||||
|
@ -323,10 +328,6 @@ static void transfer_next_chunk(const struct device *dev)
|
|||
tx_buf = dev_data->buffer;
|
||||
}
|
||||
#endif
|
||||
if (chunk_len > dev_config->max_chunk_len) {
|
||||
chunk_len = dev_config->max_chunk_len;
|
||||
}
|
||||
|
||||
dev_data->chunk_len = chunk_len;
|
||||
|
||||
xfer.p_tx_buffer = tx_buf;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue