RT1021 SDK lpuart driver interrupt modifications question

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

RT1021 SDK lpuart driver interrupt modifications question

814 次查看
rshipman
Senior Contributor I

Hi,

I've been looking at changes that have been made to the RT1021 SDK 2.11.0.

In particular to fsl_lpuart.c.

In the function: LPUART_TransferReceiveNonBlocking

I noticed this code has changed:

            /* Disable and re-enable the global interrupt to protect the interrupt enable register during

             * read-modify-wrte. */

            irqMask = DisableGlobalIRQ();

            /* Disable LPUART RX IRQ, protect ring buffer. */

            base->CTRL &= ~(uint32_t)(LPUART_CTRL_RIE_MASK | LPUART_CTRL_ORIE_MASK);

            EnableGlobalIRQ(irqMask);

and 

            /* Disable and re-enable the global interrupt to protect the interrupt enable register during

             * read-modify-wrte. */

            irqMask = DisableGlobalIRQ();

            /* Re-enable LPUART RX IRQ. */

            base->CTRL |= (uint32_t)(LPUART_CTRL_RIE_MASK | LPUART_CTRL_ORIE_MASK);

            EnableGlobalIRQ(irqMask);

The old code used to be:

            /* Disable LPUART RX IRQ, protect ring buffer. */

            LPUART_DisableInterrupts(base, (uint32_t)kLPUART_RxDataRegFullInterruptEnable);

and

            /* Enable LPUART RX IRQ if previously enabled. */

            LPUART_EnableInterrupts(base, (uint32_t)kLPUART_RxDataRegFullInterruptEnable);

Why is the RxOverrun (LPUART_CTRL_ORIE_MASK ) interrupt being disabled? I'm not sure that is a good idea, especially when disabling the receive interrupt while copying the ring buffer to rxData. Won't that hide issues when the copy takes too long?

Perhaps I have mis-understood it.

Thanks and regards,

Ronnie

标签 (1)
0 项奖励
回复
0 回复数