IMXRT1024 LPUART Handler Passing Parameter Fail

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

IMXRT1024 LPUART Handler Passing Parameter Fail

跳至解决方案
1,262 次查看
Lukas_Frank
Senior Contributor I

Hi Dear Authorized,

I am just trying to pass my own pointer struct as parameter to the "EXAMPLE_LPUART_IRQHandler" method.

 

In default SDK example of LPUART EDMA Ring Buffer :

...
..
.
#define EXAMPLE_LPUART_IRQHandler      LPUART1_IRQHandler
#define EXAMPLE_LPUART_IRQn            LPUART1_IRQn
.
..
...
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;
}

 

What I am trying to do:

 

void EXAMPLE_LPUART_IRQHandler(myStruct* myStruct_param)
{
        ...
        ..
        .   
        myStruct_param->isIdleLineDetected = true;
        myStruct_param->receivedBytes      = EXAMPLE_RING_BUFFER_SIZE - EDMA_GetRemainingMajorLoopCount(EXAMPLE_LPUART_DMA_BASEADDR, LPUART_RX_DMA_CHANNEL);
        myStruct_param->receivedBytes += (EXAMPLE_RING_BUFFER_SIZE * ringBufferFlag) - myStruct_param->ringBufferIndex;

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

 

I just manupulate "WEAK LPUART1_IRQHandler" with parameters but it didn't work. Comments says it can be only override. How do we overload this method as stated above?

 

Thanks and Regards.

0 项奖励
回复
1 解答
1,213 次查看
danielchen
NXP TechSupport
NXP TechSupport

Hi

No parameters can be explicitly passed to an interrupt handler because it is designed to be called by the hardware.

 

Regards

Daniel

在原帖中查看解决方案

2 回复数
1,214 次查看
danielchen
NXP TechSupport
NXP TechSupport

Hi

No parameters can be explicitly passed to an interrupt handler because it is designed to be called by the hardware.

 

Regards

Daniel

1,173 次查看
Lukas_Frank
Senior Contributor I

Thank you @danielchen 

0 项奖励
回复