/* param base SPI peripheral base address. param handle SPI handle pointer. param callback User callback function called at the end of a transfer. param userData User data for callback. param txHandle DMA handle pointer for SPI Tx, the handle shall be static allocated by users. param rxHandle DMA handle pointer for SPI Rx, the handle shall be static allocated by users.  */
status_t SPI_MasterTransferCreateHandleDMA(SPI_Type *base, spi_dma_handle_t *handle, spi_dma_callback_t callback, void *userData, dma_handle_t *txHandle, dma_handle_t *rxHandle)
/* param base SPI peripheral base address. param handle SPI handle pointer. param callback User callback function called at the end of a transfer. param userData User data for callback. param txHandle DMA handle pointer for SPI Tx, the handle shall be static allocated by users. param rxHandle DMA handle pointer for SPI Rx, the handle shall be static allocated by users.  */
status_t SPI_MasterTransferCreateHandleDMA(SPI_Type *base, spi_dma_handle_t *handle, spi_dma_callback_t callback, void *userData, dma_handle_t *txHandle, dma_handle_t *rxHandle)
{
    uint32_t instance;
    assert(!(NULL == base));
    if (NULL == base)
    {
        return kStatus_InvalidArgument;
    }
    assert(!(NULL == handle));
    if (NULL == handle)
    {
        return kStatus_InvalidArgument;
    }
    instance = SPI_GetInstance(base);
    (void)memset(handle, 0, sizeof(*handle));
    handle->txHandle = txHandle;
    handle->rxHandle = rxHandle;
    handle->callback = callback;
    handle->userData = userData;
    handle->state = (uint8_t)kSPI_Idle;
    s_dmaPrivateHandle[instance].base   = base;
    s_dmaPrivateHandle[instance].handle = handle;
    DMA_SetCallback(handle->txHandle, SPI_TxDMACallback, &s_dmaPrivateHandle[instance]);
    DMA_SetCallback(handle->rxHandle, SPI_RxDMACallback, &s_dmaPrivateHandle[instance]);
    return kStatus_Success;
}