IMXRT1024 LPUART EDMA Received Byte Count in Callback

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMXRT1024 LPUART EDMA Received Byte Count in Callback

562 Views
Lukas_Frank
Senior Contributor I

Hi Dear Authorized,

 

I am just trying to calculate received byte in default SDK examples (LPUART EDMA Ring Buffer). It is calculated in below code.

 

void EXAMPLE_LPUART_IRQHandler(void)
{
    uint32_t status            = LPUART_GetStatusFlags(EXAMPLE_LPUART);
    uint32_t enabledInterrupts = LPUART_GetEnabledInterrupts(EXAMPLE_LPUART);

    /* If new data arrived. */
    if ((0U != ((uint32_t)kLPUART_IdleLineFlag & status)) &&
        (0U != ((uint32_t)kLPUART_IdleLineInterruptEnable & enabledInterrupts)))
    {
        (void)LPUART_ClearStatusFlags(EXAMPLE_LPUART, kLPUART_IdleLineFlag);
        isIdleLineDetected = true;
        receivedBytes      = EXAMPLE_RING_BUFFER_SIZE -
                        EDMA_GetRemainingMajorLoopCount(EXAMPLE_LPUART_DMA_BASEADDR, LPUART_RX_DMA_CHANNEL);
        receivedBytes += (EXAMPLE_RING_BUFFER_SIZE * ringBufferFlag) - ringBufferIndex;

        if (receivedBytes > 32U)
        {
            __NOP();
        }
    }
    LPUART_TransferEdmaHandleIRQ(EXAMPLE_LPUART, &g_lpuartEdmaHandle);
    SDK_ISR_EXIT_BARRIER;
}

 

But I just want to calculate it in "EXAMPLE_RxEDMACallback" because of there is no overload of EXAMPLE_LPUART_IRQHandler. I can not pass my own struct parameters to EXAMPLE_LPUART_IRQHandler.

 

Thanks and Regards.

0 Kudos
Reply
0 Replies