예제 #1
0
/*FUNCTION**********************************************************************
 *
 * Function Name : LPSCI_DRV_DmaGetReceiveStatus
 * Description   : This function returns whether the previous LPSCI receive is
 * complete. When performing an async receive, the user can call this function
 * to ascertain the state of the current receive progress: in progress (or busy)
 * or complete (success). In addition, if the receive is still in progress,
 * the user can obtain the number of words that have been currently received.
 *
 *END**************************************************************************/
lpsci_status_t LPSCI_DRV_DmaGetReceiveStatus(uint32_t instance,
                                           uint32_t * bytesRemaining)
{
    assert(instance < UART0_INSTANCE_COUNT);
    lpsci_dma_state_t * lpsciDmaState = (lpsci_dma_state_t *)g_lpsciStatePtr[instance];

    /* Fill in the bytes transferred. */
    if (bytesRemaining)
    {
        *bytesRemaining = DMA_DRV_GetUnfinishedBytes(&lpsciDmaState->dmaLpsciRx);
    }

    return (lpsciDmaState->isRxBusy ? kStatus_LPSCI_RxBusy : kStatus_LPSCI_Success);
}
예제 #2
0
/*FUNCTION**********************************************************************
 *
 * Function Name : UART_DRV_DmaGetReceiveStatus
 * Description   : This function returns whether the previous UART receive is
 * complete. When performing an async receive, the user can call this function
 * to ascertain the state of the current receive progress: in progress (or busy)
 * or complete (success). In addition, if the receive is still in progress,
 * the user can obtain the number of words that have been currently received.
 *
 *END**************************************************************************/
uart_status_t UART_DRV_DmaGetReceiveStatus(uint32_t instance,
                                           uint32_t * bytesRemaining)
{
    assert(instance < UART_INSTANCE_COUNT);
    uart_dma_state_t * uartDmaState = (uart_dma_state_t *)g_uartStatePtr[instance];

    /* Fill in the bytes transferred. */
    if (bytesRemaining)
    {
        *bytesRemaining = DMA_DRV_GetUnfinishedBytes(&uartDmaState->dmaUartRx);
    }

    return (uartDmaState->isRxBusy ? kStatus_UART_RxBusy : kStatus_UART_Success);
}
/*FUNCTION**********************************************************************
 *
 * Function Name : SPI_DRV_DmaSlaveGetTransferStatus
 * Description   : Returns whether the previous transfer finished.
 * When performing an a-sync transfer, the user can call this function to ascertain the state of the
 * current transfer: in progress (or busy) or complete (success). In addition, if the transfer
 * is still in progress, the user can get the number of words that have been
 * transferred up to now.
 *
 *END**************************************************************************/
spi_status_t SPI_DRV_DmaSlaveGetTransferStatus(uint32_t instance,
                                            uint32_t * framesTransferred)
{
    spi_dma_slave_state_t * spiState = (spi_dma_slave_state_t *)g_spiStatePtr[instance];

    /* Fill in the bytes transferred. */
    if (framesTransferred)
    {
        *framesTransferred = spiState->remainingSendByteCount -
                            DMA_DRV_GetUnfinishedBytes(&spiState->dmaTransmit);
    }

    return (spiState->isTransferInProgress ? kStatus_SPI_Busy : kStatus_SPI_Success);
}
/*FUNCTION**********************************************************************
 *
 * Function Name : SPI_DRV_DmaMasterGetTransferStatus
 * Description   : Returns whether the previous transfer finished with DMA support.
 *
 * When performing an a-sync transfer, the user can call this function to ascertain the state of the
 * current transfer: in progress (or busy) or complete (success). In addition, if the transfer
 * is still in progress, the user can get the number of words that have been
 * transferred up to now.
 *
 *END**************************************************************************/
spi_status_t SPI_DRV_DmaMasterGetTransferStatus(uint32_t instance,
                                                uint32_t * bytesTransferred)
{
    /* instantiate local variable of type spi_dma_master_state_t and point to global state */
    spi_dma_master_state_t * spiDmaState = (spi_dma_master_state_t *)g_spiStatePtr[instance];

    /* Fill in the bytes transferred.*/
    if (bytesTransferred)
    {
        *bytesTransferred = spiDmaState->remainingSendByteCount -
                            DMA_DRV_GetUnfinishedBytes(&spiDmaState->dmaTransmit);
    }

    return (spiDmaState->isTransferInProgress ? kStatus_SPI_Busy : kStatus_SPI_Success);
}
/*FUNCTION**********************************************************************
 *
 * Function Name : LPUART_DRV_DmaGetTransmitStatus
 * Description   : This function returns whether the previous LPUART transmit
 * has finished. When performing an async transmit, the user can call this
 * function to ascertain the state of the current transmission: in progress
 * (or busy) or complete (success). In addition, if the transmission is still
 * in progress, the user can obtain the number of words that have been
 * currently transferred.
 *
 *END**************************************************************************/
lpuart_status_t LPUART_DRV_DmaGetTransmitStatus(uint32_t instance,
                                            uint32_t * bytesRemaining)
{
    assert(instance < LPUART_INSTANCE_COUNT);

    lpuart_dma_state_t * lpuartDmaState = (lpuart_dma_state_t *)g_lpuartStatePtr[instance];

    /* Fill in the bytes transferred. */
    if (bytesRemaining)
    {
        *bytesRemaining = DMA_DRV_GetUnfinishedBytes(&lpuartDmaState->dmaLpuartTx);
    }

    return (lpuartDmaState->isTxBusy ? kStatus_LPUART_TxBusy : kStatus_LPUART_Success);
}