From 8e3ca20817d65b109f976c152caa8aa67a3f8cc8 Mon Sep 17 00:00:00 2001 From: Filip Jagodzinski Date: Fri, 7 Jun 2019 16:47:59 +0200 Subject: [PATCH] K82F: Fix serial IRQ handling Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg. --- .../TARGET_MCUXpresso_MCUS/TARGET_K82F/serial_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K82F/serial_api.c b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K82F/serial_api.c index 8d124f90be..8f6332296c 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K82F/serial_api.c +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K82F/serial_api.c @@ -152,10 +152,10 @@ static inline void uart_irq(uint32_t transmit_empty, uint32_t receive_full, uint } if (serial_irq_ids[index] != 0) { - if (transmit_empty) + if (transmit_empty && (LPUART_GetEnabledInterrupts(uart_addrs[index]) & kLPUART_TxDataRegEmptyInterruptEnable)) irq_handler(serial_irq_ids[index], TxIrq); - if (receive_full) + if (receive_full && (LPUART_GetEnabledInterrupts(uart_addrs[index]) & kLPUART_RxDataRegFullInterruptEnable)) irq_handler(serial_irq_ids[index], RxIrq); } }