From 9efaabe40456414602cb05c046fc2239747c5c7b Mon Sep 17 00:00:00 2001 From: Filip Jagodzinski Date: Fri, 7 Jun 2019 16:41:36 +0200 Subject: [PATCH] K66F: 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_K66F/serial_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K66F/serial_api.c b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K66F/serial_api.c index f740572896..c8f38964c0 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K66F/serial_api.c +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K66F/serial_api.c @@ -127,10 +127,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 && (UART_GetEnabledInterrupts(uart_addrs[index]) & kUART_TxDataRegEmptyInterruptEnable)) irq_handler(serial_irq_ids[index], TxIrq); - if (receive_full) + if (receive_full && (UART_GetEnabledInterrupts(uart_addrs[index]) & kUART_RxDataRegFullInterruptEnable)) irq_handler(serial_irq_ids[index], RxIrq); } }