drivers: spi_mcux_lpspi: Macro for master cfg flag
All the master transfer seemed to use the same config flags, reuse with a macro. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
This commit is contained in:
parent
561b4347d7
commit
47115e3afe
1 changed files with 6 additions and 4 deletions
|
@ -39,6 +39,10 @@ LOG_MODULE_REGISTER(spi_mcux_lpspi, CONFIG_SPI_LOG_LEVEL);
|
||||||
/* Argument to MCUX SDK IRQ handler */
|
/* Argument to MCUX SDK IRQ handler */
|
||||||
#define LPSPI_IRQ_HANDLE_ARG COND_CODE_1(CONFIG_NXP_LP_FLEXCOMM, (LPSPI_GetInstance(base)), (base))
|
#define LPSPI_IRQ_HANDLE_ARG COND_CODE_1(CONFIG_NXP_LP_FLEXCOMM, (LPSPI_GetInstance(base)), (base))
|
||||||
|
|
||||||
|
/* flag for SDK API for master transfers */
|
||||||
|
#define LPSPI_MASTER_XFER_CFG_FLAGS(slave) \
|
||||||
|
kLPSPI_MasterPcsContinuous | (slave << LPSPI_MASTER_PCS_SHIFT)
|
||||||
|
|
||||||
#ifdef CONFIG_SPI_MCUX_LPSPI_DMA
|
#ifdef CONFIG_SPI_MCUX_LPSPI_DMA
|
||||||
#include <zephyr/drivers/dma.h>
|
#include <zephyr/drivers/dma.h>
|
||||||
|
|
||||||
|
@ -137,8 +141,7 @@ static int spi_mcux_transfer_next_packet(const struct device *dev)
|
||||||
|
|
||||||
data->transfer_len = max_chunk;
|
data->transfer_len = max_chunk;
|
||||||
|
|
||||||
transfer.configFlags =
|
transfer.configFlags = LPSPI_MASTER_XFER_CFG_FLAGS(ctx->config->slave);
|
||||||
kLPSPI_MasterPcsContinuous | (ctx->config->slave << LPSPI_MASTER_PCS_SHIFT);
|
|
||||||
transfer.txData = (ctx->tx_len == 0 ? NULL : ctx->tx_buf);
|
transfer.txData = (ctx->tx_len == 0 ? NULL : ctx->tx_buf);
|
||||||
transfer.rxData = (ctx->rx_len == 0 ? NULL : ctx->rx_buf);
|
transfer.rxData = (ctx->rx_len == 0 ? NULL : ctx->rx_buf);
|
||||||
transfer.dataSize = max_chunk;
|
transfer.dataSize = max_chunk;
|
||||||
|
@ -550,8 +553,7 @@ static void spi_mcux_iodev_start(const struct device *dev)
|
||||||
lpspi_transfer_t transfer;
|
lpspi_transfer_t transfer;
|
||||||
status_t status;
|
status_t status;
|
||||||
|
|
||||||
transfer.configFlags =
|
transfer.configFlags = LPSPI_MASTER_XFER_CFG_FLAGS(spi_cfg->slave);
|
||||||
kLPSPI_MasterPcsContinuous | (spi_cfg->slave << LPSPI_MASTER_PCS_SHIFT);
|
|
||||||
|
|
||||||
switch (sqe->op) {
|
switch (sqe->op) {
|
||||||
case RTIO_OP_RX:
|
case RTIO_OP_RX:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue