Skip to content

Commit 3119d69

Browse files
author
Filip Jagodzinski
committed
KL27Z: Fix serial IRQ handling
Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg.
1 parent 9efaabe commit 3119d69

File tree

1 file changed

+2
-2
lines changed
  • targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL27Z

1 file changed

+2
-2
lines changed

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL27Z/serial_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ static inline void uart_irq(uint32_t transmit_empty, uint32_t receive_full, uint
135135
}
136136

137137
if (serial_irq_ids[index] != 0) {
138-
if (transmit_empty)
138+
if (transmit_empty && (LPUART_GetEnabledInterrupts(uart_addrs[index]) & kLPUART_TxDataRegEmptyInterruptEnable))
139139
irq_handler(serial_irq_ids[index], TxIrq);
140140

141-
if (receive_full)
141+
if (receive_full && (LPUART_GetEnabledInterrupts(uart_addrs[index]) & kLPUART_RxDataRegFullInterruptEnable))
142142
irq_handler(serial_irq_ids[index], RxIrq);
143143
}
144144
}

0 commit comments

Comments
 (0)