/* param base SPDIF base pointer. param handle Pointer to the spdif_handle_t structure which stores the transfer state. param xfer Pointer to the spdif_transfer_t structure. retval kStatus_Success Successfully started the data receive. retval kStatus_SPDIF_TxBusy Previous receive still not finished. retval kStatus_InvalidArgument The input parameter is invalid.  */
status_t SPDIF_TransferSendNonBlocking(SPDIF_Type *base, spdif_handle_t *handle, spdif_transfer_t *xfer)
/* param base SPDIF base pointer. param handle Pointer to the spdif_handle_t structure which stores the transfer state. param xfer Pointer to the spdif_transfer_t structure. retval kStatus_Success Successfully started the data receive. retval kStatus_SPDIF_TxBusy Previous receive still not finished. retval kStatus_InvalidArgument The input parameter is invalid.  */
status_t SPDIF_TransferSendNonBlocking(SPDIF_Type *base, spdif_handle_t *handle, spdif_transfer_t *xfer)
{
    assert(handle);
    if (handle->spdifQueue[handle->queueUser].data)
    {
        return kStatus_SPDIF_QueueFull;
    }
    handle->transferSize[handle->queueUser]        = xfer->dataSize;
    handle->spdifQueue[handle->queueUser].data     = xfer->data;
    handle->spdifQueue[handle->queueUser].dataSize = xfer->dataSize;
    handle->queueUser                              = (handle->queueUser + 1) % SPDIF_XFER_QUEUE_SIZE;
    handle->state = kSPDIF_Busy;
    SPDIF_EnableInterrupts(base, kSPDIF_TxFIFOEmpty);
    SPDIF_TxEnable(base, true);
    return kStatus_Success;
}