/* retval kStatus_Success retval kStatus_I2S_Busy if all queue slots are occupied with buffers which are not full.  */
status_t I2S_RxTransferReceiveDMA(I2S_Type *base, i2s_dma_handle_t *handle, i2s_transfer_t transfer)
/* retval kStatus_Success retval kStatus_I2S_Busy if all queue slots are occupied with buffers which are not full.  */
status_t I2S_RxTransferReceiveDMA(I2S_Type *base, i2s_dma_handle_t *handle, i2s_transfer_t transfer)
{
    status_t status;
    I2S_DisableDMAInterrupts(handle);
    status = I2S_EnqueueUserBuffer(base, handle, transfer);
    if (status != kStatus_Success)
    {
        I2S_EnableDMAInterrupts(handle);
        return status;
    }
    if (handle->state == (uint32_t)kI2S_DmaStateIdle)
    {
        handle->state = (uint32_t)kI2S_DmaStateRx;
        status        = I2S_StartTransferDMA(base, handle);
        if (status != kStatus_Success)
        {
            I2S_EnableDMAInterrupts(handle);
            return status;
        }
    }
    I2S_AddTransferDMA(base, handle);
    I2S_EnableDMAInterrupts(handle);
    return kStatus_Success;
}