diff --git a/dts/nxp/s32/S32Z27-BGA400-pinctrl.h b/dts/nxp/s32/S32Z27-BGA400-pinctrl.h index 75c21bd40..8d4a0efec 100644 --- a/dts/nxp/s32/S32Z27-BGA400-pinctrl.h +++ b/dts/nxp/s32/S32Z27-BGA400-pinctrl.h @@ -464,6 +464,9 @@ #define PA11_DSPI_10_PCS0_O NXP_S32_PINMUX(0, 0, 11, 1, 0, 0) #define PA12_DSPI_10_PCS1 NXP_S32_PINMUX(0, 0, 12, 1, 0, 0) #define PB6_DSPI_10_PCS2 NXP_S32_PINMUX(0, 0, 22, 6, 0, 0) +#define LVDS_DSPI_10_SIN NXP_S32_PINMUX(0, 0, 500, 0, 0, 0) +#define LVDS_DSPI_10_SOUT NXP_S32_PINMUX(0, 0, 501, 0, 0, 0) +#define LVDS_DSPI_10_SCK NXP_S32_PINMUX(0, 0, 502, 0, 0, 0) /* SPI_1 */ #define PA11_DSPI_1_PCS4 NXP_S32_PINMUX(0, 0, 11, 5, 0, 0) diff --git a/dts/nxp/s32/S32Z27-BGA594-pinctrl.h b/dts/nxp/s32/S32Z27-BGA594-pinctrl.h index dc505a7b3..5acb4ec93 100644 --- a/dts/nxp/s32/S32Z27-BGA594-pinctrl.h +++ b/dts/nxp/s32/S32Z27-BGA594-pinctrl.h @@ -612,6 +612,9 @@ #define PA11_DSPI_10_PCS0_O NXP_S32_PINMUX(0, 0, 11, 1, 0, 0) #define PA12_DSPI_10_PCS1 NXP_S32_PINMUX(0, 0, 12, 1, 0, 0) #define PB6_DSPI_10_PCS2 NXP_S32_PINMUX(0, 0, 22, 6, 0, 0) +#define LVDS_DSPI_10_SIN NXP_S32_PINMUX(0, 0, 500, 0, 0, 0) +#define LVDS_DSPI_10_SOUT NXP_S32_PINMUX(0, 0, 501, 0, 0, 0) +#define LVDS_DSPI_10_SCK NXP_S32_PINMUX(0, 0, 502, 0, 0, 0) /* SPI_1 */ #define PA11_DSPI_1_PCS4 NXP_S32_PINMUX(0, 0, 11, 5, 0, 0) diff --git a/mcux/README b/mcux/README index b6d95793b..a939afaf2 100644 --- a/mcux/README +++ b/mcux/README @@ -118,3 +118,5 @@ Patch List: - Add missing CMAKE file to ccm32k driver driver_ccm32k.cmake. - Add missing CMAKE file to flash_k4 driver driver_flash_k4.cmake. - Add missing CMAKE file to spc driver driver_spc.cmake + - mcux-sdk/drivers/dspi/fsl_dspi.c, mcux-sdk/drivers/dspi/fsl_dspi.h, mcux-sdk/drivers/dspi/fsl_dspi_edma.c, + mcux-sdk/drivers/dspi/fsl_dspi_edma.h: add the guards for unsupport features on S32Z27x devices diff --git a/mcux/mcux-sdk/drivers/dspi/fsl_dspi.c b/mcux/mcux-sdk/drivers/dspi/fsl_dspi.c index 7532041dc..fda637ab2 100644 --- a/mcux/mcux-sdk/drivers/dspi/fsl_dspi.c +++ b/mcux/mcux-sdk/drivers/dspi/fsl_dspi.c @@ -20,8 +20,10 @@ /*! @brief Typedef for master interrupt handler. */ typedef void (*dspi_master_isr_t)(SPI_Type *base, dspi_master_handle_t *handle); +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! @brief Typedef for slave interrupt handler. */ typedef void (*dspi_slave_isr_t)(SPI_Type *base, dspi_slave_handle_t *handle); +#endif /******************************************************************************* * Prototypes @@ -53,18 +55,22 @@ static void DSPI_MasterTransferFillUpTxFifo(SPI_Type *base, dspi_master_handle_t */ static void DSPI_MasterTransferComplete(SPI_Type *base, dspi_master_handle_t *handle); +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * @brief Slave fill up the TX FIFO with data. * This is not a public API. */ static void DSPI_SlaveTransferFillUpTxFifo(SPI_Type *base, dspi_slave_handle_t *handle); +#endif +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * @brief Slave finish up a transfer. * It would call back if there is callback function and set the state to idle. * This is not a public API. */ static void DSPI_SlaveTransferComplete(SPI_Type *base, dspi_slave_handle_t *handle); +#endif /*! * @brief DSPI common interrupt handler. @@ -111,8 +117,10 @@ static void *g_dspiHandle[ARRAY_SIZE(s_dspiBases)]; /*! @brief Pointer to master IRQ handler for each instance. */ static dspi_master_isr_t s_dspiMasterIsr; +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! @brief Pointer to slave IRQ handler for each instance. */ static dspi_slave_isr_t s_dspiSlaveIsr; +#endif /* @brief Dummy data for each instance. This data is used when user's tx buffer is NULL*/ volatile uint8_t g_dspiDummyData[ARRAY_SIZE(s_dspiBases)] = {0}; @@ -285,6 +293,7 @@ void DSPI_MasterGetDefaultConfig(dspi_master_config_t *masterConfig) masterConfig->samplePoint = kDSPI_SckToSin0Clock; } +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * brief DSPI slave configuration. * @@ -342,7 +351,9 @@ void DSPI_SlaveInit(SPI_Type *base, const dspi_slave_config_t *slaveConfig) DSPI_StartTransfer(base); } +#endif +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * brief Sets the dspi_slave_config_t structure to a default value. * @@ -373,6 +384,7 @@ void DSPI_SlaveGetDefaultConfig(dspi_slave_config_t *slaveConfig) slaveConfig->enableModifiedTimingFormat = false; slaveConfig->samplePoint = kDSPI_SckToSin0Clock; } +#endif /*! * brief De-initializes the DSPI peripheral. Call this API to disable the DSPI clock. @@ -787,6 +799,7 @@ void DSPI_MasterWriteCommandDataBlocking(SPI_Type *base, uint32_t data) } } +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * brief Writes data into the data buffer in slave mode, waits till data was transmitted, and returns. * @@ -815,6 +828,7 @@ void DSPI_SlaveWriteDataBlocking(SPI_Type *base, uint32_t data) { } } +#endif /*! * brief Enables the DSPI interrupts. @@ -1707,6 +1721,7 @@ void DSPI_MasterTransferHandleIRQ(SPI_Type *base, dspi_master_handle_t *handle) } /*Transactional APIs -- Slave*/ +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * brief Initializes the DSPI slave handle. * @@ -1733,7 +1748,9 @@ void DSPI_SlaveTransferCreateHandle(SPI_Type *base, handle->callback = callback; handle->userData = userData; } +#endif +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * brief DSPI slave transfers data using an interrupt. * @@ -1800,11 +1817,13 @@ status_t DSPI_SlaveTransferNonBlocking(SPI_Type *base, dspi_slave_handle_t *hand /* RX FIFO overflow request enable */ DSPI_EnableInterrupts(base, (uint32_t)kDSPI_RxFifoOverflowInterruptEnable); } +#if !(defined(FSL_FEATURE_FLEXCAN_HAS_NO_RSER_TFUF_SUPPORT) && FSL_FEATURE_FLEXCAN_HAS_NO_RSER_TFUF_SUPPORT) if (NULL != handle->txData) { /* TX FIFO underflow request enable */ DSPI_EnableInterrupts(base, (uint32_t)kDSPI_TxFifoUnderflowInterruptEnable); } +#endif DSPI_StartTransfer(base); @@ -1813,7 +1832,9 @@ status_t DSPI_SlaveTransferNonBlocking(SPI_Type *base, dspi_slave_handle_t *hand return kStatus_Success; } +#endif +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * brief Gets the slave transfer count. * @@ -1843,7 +1864,9 @@ status_t DSPI_SlaveTransferGetCount(SPI_Type *base, dspi_slave_handle_t *handle, *count = handle->totalByteCount - handle->remainingReceiveByteCount; return kStatus_Success; } +#endif +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) static void DSPI_SlaveTransferFillUpTxFifo(SPI_Type *base, dspi_slave_handle_t *handle) { assert(NULL != handle); @@ -1931,15 +1954,21 @@ static void DSPI_SlaveTransferFillUpTxFifo(SPI_Type *base, dspi_slave_handle_t * DSPI_ClearStatusFlags(base, (uint32_t)kDSPI_TxFifoFillRequestFlag); } } +#endif +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) static void DSPI_SlaveTransferComplete(SPI_Type *base, dspi_slave_handle_t *handle) { assert(NULL != handle); /* Disable interrupt requests */ DSPI_DisableInterrupts( - base, ((uint32_t)kDSPI_TxFifoUnderflowInterruptEnable | (uint32_t)kDSPI_TxFifoFillRequestInterruptEnable | - (uint32_t)kDSPI_RxFifoOverflowInterruptEnable | (uint32_t)kDSPI_RxFifoDrainRequestInterruptEnable)); + base, ( +#if !(defined(FSL_FEATURE_FLEXCAN_HAS_NO_RSER_TFUF_SUPPORT) && FSL_FEATURE_FLEXCAN_HAS_NO_RSER_TFUF_SUPPORT) + (uint32_t)kDSPI_TxFifoUnderflowInterruptEnable | +#endif + (uint32_t)kDSPI_TxFifoFillRequestInterruptEnable | + (uint32_t)kDSPI_RxFifoOverflowInterruptEnable | (uint32_t)kDSPI_RxFifoDrainRequestInterruptEnable)); /* The transfer is complete. */ handle->txData = NULL; @@ -1964,7 +1993,9 @@ static void DSPI_SlaveTransferComplete(SPI_Type *base, dspi_slave_handle_t *hand handle->callback(base, handle, status, handle->userData); } } +#endif +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * brief DSPI slave aborts a transfer using an interrupt. * @@ -1981,14 +2012,20 @@ void DSPI_SlaveTransferAbort(SPI_Type *base, dspi_slave_handle_t *handle) /* Disable interrupt requests */ DSPI_DisableInterrupts( - base, ((uint32_t)kDSPI_TxFifoUnderflowInterruptEnable | (uint32_t)kDSPI_TxFifoFillRequestInterruptEnable | + base, ( +#if !(defined(FSL_FEATURE_FLEXCAN_HAS_NO_RSER_TFUF_SUPPORT) && FSL_FEATURE_FLEXCAN_HAS_NO_RSER_TFUF_SUPPORT) + (uint32_t)kDSPI_TxFifoUnderflowInterruptEnable | +#endif + (uint32_t)kDSPI_TxFifoFillRequestInterruptEnable | (uint32_t)kDSPI_RxFifoOverflowInterruptEnable | (uint32_t)kDSPI_RxFifoDrainRequestInterruptEnable)); handle->state = (uint8_t)kDSPI_Idle; handle->remainingSendByteCount = 0; handle->remainingReceiveByteCount = 0; } +#endif +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * brief DSPI Master IRQ handler function. * @@ -2145,6 +2182,7 @@ void DSPI_SlaveTransferHandleIRQ(SPI_Type *base, dspi_slave_handle_t *handle) return; } +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SR_TFUF_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SR_TFUF_SUPPORT) /* Catch tx fifo underflow conditions, service only if tx under flow interrupt enabled */ if (0U != (DSPI_GetStatusFlags(base) & (uint32_t)kDSPI_TxFifoUnderflowFlag)) { @@ -2159,6 +2197,7 @@ void DSPI_SlaveTransferHandleIRQ(SPI_Type *base, dspi_slave_handle_t *handle) handle->errorCount++; } } +#endif /* Catch rx fifo overflow conditions, service only if rx over flow interrupt enabled */ if (0U != (DSPI_GetStatusFlags(base) & (uint32_t)kDSPI_RxFifoOverflowFlag)) @@ -2175,6 +2214,7 @@ void DSPI_SlaveTransferHandleIRQ(SPI_Type *base, dspi_slave_handle_t *handle) } } } +#endif static void DSPI_CommonIRQHandler(SPI_Type *base, void *param) { @@ -2182,10 +2222,12 @@ static void DSPI_CommonIRQHandler(SPI_Type *base, void *param) { s_dspiMasterIsr(base, (dspi_master_handle_t *)param); } +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) else { s_dspiSlaveIsr(base, (dspi_slave_handle_t *)param); } +#endif SDK_ISR_EXIT_BARRIER; } diff --git a/mcux/mcux-sdk/drivers/dspi/fsl_dspi.h b/mcux/mcux-sdk/drivers/dspi/fsl_dspi.h index c20ba23ac..0e79e4a78 100644 --- a/mcux/mcux-sdk/drivers/dspi/fsl_dspi.h +++ b/mcux/mcux-sdk/drivers/dspi/fsl_dspi.h @@ -47,13 +47,18 @@ enum _dspi_flags { kDSPI_TxCompleteFlag = (int)SPI_SR_TCF_MASK, /*!< Transfer Complete Flag. */ kDSPI_EndOfQueueFlag = SPI_SR_EOQF_MASK, /*!< End of Queue Flag.*/ +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SR_TFUF_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SR_TFUF_SUPPORT) kDSPI_TxFifoUnderflowFlag = SPI_SR_TFUF_MASK, /*!< Transmit FIFO Underflow Flag.*/ +#endif kDSPI_TxFifoFillRequestFlag = SPI_SR_TFFF_MASK, /*!< Transmit FIFO Fill Flag.*/ kDSPI_RxFifoOverflowFlag = SPI_SR_RFOF_MASK, /*!< Receive FIFO Overflow Flag.*/ kDSPI_RxFifoDrainRequestFlag = SPI_SR_RFDF_MASK, /*!< Receive FIFO Drain Flag.*/ kDSPI_TxAndRxStatusFlag = SPI_SR_TXRXS_MASK, /*!< The module is in Stopped/Running state.*/ - kDSPI_AllStatusFlag = (int)(SPI_SR_TCF_MASK | SPI_SR_EOQF_MASK | SPI_SR_TFUF_MASK | SPI_SR_TFFF_MASK | - SPI_SR_RFOF_MASK | SPI_SR_RFDF_MASK | SPI_SR_TXRXS_MASK) /*!< All statuses above.*/ + kDSPI_AllStatusFlag = (int)(SPI_SR_TCF_MASK | SPI_SR_EOQF_MASK | +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SR_TFUF_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SR_TFUF_SUPPORT) + SPI_SR_TFUF_MASK | +#endif + SPI_SR_TFFF_MASK | SPI_SR_RFOF_MASK | SPI_SR_RFDF_MASK | SPI_SR_TXRXS_MASK) /*!< All statuses above.*/ }; /*! @brief DSPI interrupt source.*/ @@ -61,11 +66,16 @@ enum _dspi_interrupt_enable { kDSPI_TxCompleteInterruptEnable = (int)SPI_RSER_TCF_RE_MASK, /*!< TCF interrupt enable.*/ kDSPI_EndOfQueueInterruptEnable = SPI_RSER_EOQF_RE_MASK, /*!< EOQF interrupt enable.*/ +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_RSER_TFUF_RE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_RSER_TFUF_RE_SUPPORT) kDSPI_TxFifoUnderflowInterruptEnable = SPI_RSER_TFUF_RE_MASK, /*!< TFUF interrupt enable.*/ +#endif kDSPI_TxFifoFillRequestInterruptEnable = SPI_RSER_TFFF_RE_MASK, /*!< TFFF interrupt enable, DMA disable.*/ kDSPI_RxFifoOverflowInterruptEnable = SPI_RSER_RFOF_RE_MASK, /*!< RFOF interrupt enable.*/ kDSPI_RxFifoDrainRequestInterruptEnable = SPI_RSER_RFDF_RE_MASK, /*!< RFDF interrupt enable, DMA disable.*/ - kDSPI_AllInterruptEnable = (int)(SPI_RSER_TCF_RE_MASK | SPI_RSER_EOQF_RE_MASK | SPI_RSER_TFUF_RE_MASK | + kDSPI_AllInterruptEnable = (int)(SPI_RSER_TCF_RE_MASK | SPI_RSER_EOQF_RE_MASK | +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_RSER_TFUF_RE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_RSER_TFUF_RE_SUPPORT) + SPI_RSER_TFUF_RE_MASK | +#endif SPI_RSER_TFFF_RE_MASK | SPI_RSER_RFOF_RE_MASK | SPI_RSER_RFDF_RE_MASK) /*!< All above interrupts enable.*/ }; @@ -201,14 +211,18 @@ enum _dspi_transfer_config_flag_for_master /*!< Indicates whether the PCS signal is active after the last frame transfer.*/ }; +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) #define DSPI_SLAVE_CTAR_SHIFT (0U) /*!< DSPI slave CTAR shift macro; used internally. */ #define DSPI_SLAVE_CTAR_MASK (0x07U) /*!< DSPI slave CTAR mask macro; used internally. */ +#endif +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! @brief Use this enumeration for the DSPI slave transfer configFlags. */ enum _dspi_transfer_config_flag_for_slave { kDSPI_SlaveCtar0 = 0U << DSPI_SLAVE_CTAR_SHIFT, /*!< DSPI slave transfer use CTAR0 setting. DSPI slave can only use PCS0. */ }; +#endif /*! @brief DSPI transfer state, which is used for DSPI transactional API state machine. */ enum _dspi_transfer_state @@ -269,6 +283,7 @@ typedef struct _dspi_master_config Format. It's valid only when CPHA=0. */ } dspi_master_config_t; +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! @brief DSPI slave ctar configuration structure.*/ typedef struct _dspi_slave_ctar_config { @@ -277,7 +292,9 @@ typedef struct _dspi_slave_ctar_config dspi_clock_phase_t cpha; /*!< Clock phase. */ /*!< Slave only supports MSB and does not support LSB.*/ } dspi_slave_ctar_config_t; +#endif +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! @brief DSPI slave configuration structure.*/ typedef struct _dspi_slave_config { @@ -294,16 +311,19 @@ typedef struct _dspi_slave_config dspi_master_sample_point_t samplePoint; /*!< Controls when the module master samples SIN in the Modified Transfer Format. It's valid only when CPHA=0. */ } dspi_slave_config_t; +#endif /*! * @brief Forward declaration of the @ref _dspi_master_handle typedefs. */ typedef struct _dspi_master_handle dspi_master_handle_t; /*!< The master handle. */ +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * @brief Forward declaration of the @ref _dspi_slave_handle typedefs. */ typedef struct _dspi_slave_handle dspi_slave_handle_t; /*!< The slave handle. */ +#endif /*! * @brief Completion callback function pointer type. @@ -317,6 +337,8 @@ typedef void (*dspi_master_transfer_callback_t)(SPI_Type *base, dspi_master_handle_t *handle, status_t status, void *userData); + +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * @brief Completion callback function pointer type. * @@ -329,6 +351,7 @@ typedef void (*dspi_slave_transfer_callback_t)(SPI_Type *base, dspi_slave_handle_t *handle, status_t status, void *userData); +#endif /*! @brief DSPI master/slave transfer structure.*/ typedef struct _dspi_transfer @@ -380,6 +403,7 @@ struct _dspi_master_handle void *userData; /*!< Callback user data. */ }; +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! @brief DSPI slave transfer handle structure used for the transactional API. */ struct _dspi_slave_handle { @@ -399,6 +423,7 @@ struct _dspi_slave_handle dspi_slave_transfer_callback_t callback; /*!< Completion callback. */ void *userData; /*!< Callback user data. */ }; +#endif /********************************************************************************************************************** * API @@ -457,6 +482,7 @@ void DSPI_MasterInit(SPI_Type *base, const dspi_master_config_t *masterConfig, u */ void DSPI_MasterGetDefaultConfig(dspi_master_config_t *masterConfig); +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * @brief DSPI slave configuration. * @@ -478,7 +504,9 @@ void DSPI_MasterGetDefaultConfig(dspi_master_config_t *masterConfig); * @param slaveConfig Pointer to the structure @ref dspi_master_config_t. */ void DSPI_SlaveInit(SPI_Type *base, const dspi_slave_config_t *slaveConfig); +#endif +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * @brief Sets the @ref dspi_slave_config_t structure to a default value. * @@ -493,6 +521,7 @@ void DSPI_SlaveInit(SPI_Type *base, const dspi_slave_config_t *slaveConfig); * @param slaveConfig Pointer to the @ref dspi_slave_config_t structure. */ void DSPI_SlaveGetDefaultConfig(dspi_slave_config_t *slaveConfig); +#endif /*! * @brief De-initializes the DSPI peripheral. Call this API to disable the DSPI clock. @@ -657,10 +686,12 @@ static inline uint32_t DSPI_MasterGetTxRegisterAddress(SPI_Type *base) * @param base DSPI peripheral address. * @return The DSPI slave PUSHR data register address. */ +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) static inline uint32_t DSPI_SlaveGetTxRegisterAddress(SPI_Type *base) { return (uint32_t) & (base->PUSHR_SLAVE); } +#endif /*! * @brief Gets the DSPI POPR data register address for the DMA operation. @@ -998,6 +1029,7 @@ static inline uint32_t DSPI_MasterGetFormattedCommand(dspi_command_data_config_t */ void DSPI_MasterWriteCommandDataBlocking(SPI_Type *base, uint32_t data); +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * @brief Writes data into the data buffer in slave mode. * @@ -1010,7 +1042,9 @@ static inline void DSPI_SlaveWriteData(SPI_Type *base, uint32_t data) { base->PUSHR_SLAVE = data; } +#endif +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * @brief Writes data into the data buffer in slave mode, waits till data was transmitted, and returns. * @@ -1021,6 +1055,7 @@ static inline void DSPI_SlaveWriteData(SPI_Type *base, uint32_t data) * @param data The data to send. */ void DSPI_SlaveWriteDataBlocking(SPI_Type *base, uint32_t data); +#endif /*! * @brief Reads data from the data buffer. @@ -1152,6 +1187,7 @@ void DSPI_MasterTransferAbort(SPI_Type *base, dspi_master_handle_t *handle); */ void DSPI_MasterTransferHandleIRQ(SPI_Type *base, dspi_master_handle_t *handle); +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * @brief Initializes the DSPI slave handle. * @@ -1167,7 +1203,9 @@ void DSPI_SlaveTransferCreateHandle(SPI_Type *base, dspi_slave_handle_t *handle, dspi_slave_transfer_callback_t callback, void *userData); +#endif +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * @brief DSPI slave transfers data using an interrupt. * @@ -1180,7 +1218,9 @@ void DSPI_SlaveTransferCreateHandle(SPI_Type *base, * @return status of status_t. */ status_t DSPI_SlaveTransferNonBlocking(SPI_Type *base, dspi_slave_handle_t *handle, dspi_transfer_t *transfer); +#endif +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * @brief Gets the slave transfer count. * @@ -1192,7 +1232,9 @@ status_t DSPI_SlaveTransferNonBlocking(SPI_Type *base, dspi_slave_handle_t *hand * @return status of status_t. */ status_t DSPI_SlaveTransferGetCount(SPI_Type *base, dspi_slave_handle_t *handle, size_t *count); +#endif +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * @brief DSPI slave aborts a transfer using an interrupt. * @@ -1202,7 +1244,9 @@ status_t DSPI_SlaveTransferGetCount(SPI_Type *base, dspi_slave_handle_t *handle, * @param handle Pointer to the @ref _dspi_slave_handle structure which stores the transfer state. */ void DSPI_SlaveTransferAbort(SPI_Type *base, dspi_slave_handle_t *handle); +#endif +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * @brief DSPI Master IRQ handler function. * @@ -1212,6 +1256,7 @@ void DSPI_SlaveTransferAbort(SPI_Type *base, dspi_slave_handle_t *handle); * @param handle Pointer to the @ref _dspi_slave_handle structure which stores the transfer state. */ void DSPI_SlaveTransferHandleIRQ(SPI_Type *base, dspi_slave_handle_t *handle); +#endif /*! * brief Dummy data for each instance. diff --git a/mcux/mcux-sdk/drivers/dspi/fsl_dspi_edma.c b/mcux/mcux-sdk/drivers/dspi/fsl_dspi_edma.c index db4bf5c73..9176965cb 100644 --- a/mcux/mcux-sdk/drivers/dspi/fsl_dspi_edma.c +++ b/mcux/mcux-sdk/drivers/dspi/fsl_dspi_edma.c @@ -26,6 +26,7 @@ typedef struct _dspi_master_edma_private_handle dspi_master_edma_handle_t *handle; /*!< dspi_master_edma_handle_t handle */ } dspi_master_edma_private_handle_t; +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * @brief Structure definition for dspi_slave_edma_private_handle_t. The structure is private. */ @@ -34,6 +35,7 @@ typedef struct _dspi_slave_edma_private_handle SPI_Type *base; /*!< DSPI peripheral base address. */ dspi_slave_edma_handle_t *handle; /*!< dspi_master_edma_handle_t handle */ } dspi_slave_edma_private_handle_t; +#endif /*********************************************************************************************************************** * Prototypes @@ -47,6 +49,7 @@ static void EDMA_DspiMasterCallback(edma_handle_t *edmaHandle, bool transferDone, uint32_t tcds); +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * @brief EDMA_DspiSlaveCallback after the DSPI slave transfer completed by using EDMA. * This is not a public API. @@ -55,6 +58,7 @@ static void EDMA_DspiSlaveCallback(edma_handle_t *edmaHandle, void *g_dspiEdmaPrivateHandle, bool transferDone, uint32_t tcds); +#endif /*********************************************************************************************************************** * Variables @@ -62,7 +66,9 @@ static void EDMA_DspiSlaveCallback(edma_handle_t *edmaHandle, /*! @brief Pointers to dspi edma handles for each instance. */ static dspi_master_edma_private_handle_t s_dspiMasterEdmaPrivateHandle[FSL_FEATURE_SOC_DSPI_COUNT]; +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) static dspi_slave_edma_private_handle_t s_dspiSlaveEdmaPrivateHandle[FSL_FEATURE_SOC_DSPI_COUNT]; +#endif /*********************************************************************************************************************** * Code @@ -1101,6 +1107,7 @@ status_t DSPI_MasterTransferGetCountEDMA(SPI_Type *base, dspi_master_edma_handle return kStatus_Success; } +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * brief Initializes the DSPI slave eDMA handle. * @@ -1145,7 +1152,9 @@ void DSPI_SlaveTransferCreateHandleEDMA(SPI_Type *base, handle->edmaRxRegToRxDataHandle = edmaRxRegToRxDataHandle; handle->edmaTxDataToTxRegHandle = edmaTxDataToTxRegHandle; } +#endif +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * brief DSPI slave transfer data using eDMA. * @@ -1463,7 +1472,9 @@ status_t DSPI_SlaveTransferEDMA(SPI_Type *base, dspi_slave_edma_handle_t *handle return kStatus_Success; } +#endif +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) static void EDMA_DspiSlaveCallback(edma_handle_t *edmaHandle, void *g_dspiEdmaPrivateHandle, bool transferDone, @@ -1486,7 +1497,9 @@ static void EDMA_DspiSlaveCallback(edma_handle_t *edmaHandle, kStatus_Success, dspiEdmaPrivateHandle->handle->userData); } } +#endif +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * brief DSPI slave aborts a transfer which is using eDMA. * @@ -1508,7 +1521,9 @@ void DSPI_SlaveTransferAbortEDMA(SPI_Type *base, dspi_slave_edma_handle_t *handl handle->state = (uint8_t)kDSPI_Idle; } +#endif +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * brief Gets the slave eDMA transfer count. * @@ -1544,3 +1559,4 @@ status_t DSPI_SlaveTransferGetCountEDMA(SPI_Type *base, dspi_slave_edma_handle_t return kStatus_Success; } +#endif diff --git a/mcux/mcux-sdk/drivers/dspi/fsl_dspi_edma.h b/mcux/mcux-sdk/drivers/dspi/fsl_dspi_edma.h index cf529c126..120693fe8 100644 --- a/mcux/mcux-sdk/drivers/dspi/fsl_dspi_edma.h +++ b/mcux/mcux-sdk/drivers/dspi/fsl_dspi_edma.h @@ -38,10 +38,12 @@ */ typedef struct _dspi_master_edma_handle dspi_master_edma_handle_t; +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * @brief Forward declaration of the DSPI eDMA slave handle typedefs. */ typedef struct _dspi_slave_edma_handle dspi_slave_edma_handle_t; +#endif /*! * @brief Completion callback function pointer type. @@ -55,6 +57,7 @@ typedef void (*dspi_master_edma_transfer_callback_t)(SPI_Type *base, dspi_master_edma_handle_t *handle, status_t status, void *userData); +#if !(defined(FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) && FSL_FEATURE_DSPI_HAS_NO_SLAVE_SUPPORT) /*! * @brief Completion callback function pointer type. * @@ -67,6 +70,7 @@ typedef void (*dspi_slave_edma_transfer_callback_t)(SPI_Type *base, dspi_slave_edma_handle_t *handle, status_t status, void *userData); +#endif /*! @brief DSPI master eDMA transfer handle structure used for the transactional API. */ struct _dspi_master_edma_handle @@ -102,6 +106,7 @@ struct _dspi_master_edma_handle edma_tcd_t dspiSoftwareTCD[2]; /*!