18 #if (defined(DEBUG_CONSOLE_ASSERT_DISABLE) && (DEBUG_CONSOLE_ASSERT_DISABLE > 0U))
24 #if (defined(UART_ADAPTER_NON_BLOCKING_MODE) && (UART_ADAPTER_NON_BLOCKING_MODE > 0U))
26 typedef struct _hal_uart_receive_state
28 uint8_t *
volatile buffer;
29 volatile uint32_t bufferLength;
30 volatile uint32_t bufferSofar;
31 } hal_uart_receive_state_t;
34 typedef struct _hal_uart_send_state
36 uint8_t *
volatile buffer;
37 volatile uint32_t bufferLength;
38 volatile uint32_t bufferSofar;
39 } hal_uart_send_state_t;
44 #if (defined(UART_ADAPTER_NON_BLOCKING_MODE) && (UART_ADAPTER_NON_BLOCKING_MODE > 0U))
47 #if (defined(HAL_UART_TRANSFER_MODE) && (HAL_UART_TRANSFER_MODE > 0U))
50 hal_uart_receive_state_t rx;
51 hal_uart_send_state_t tx;
53 #if (defined(HAL_UART_ADAPTER_LOWPOWER) && (HAL_UART_ADAPTER_LOWPOWER > 0U))
68 #if (defined(UART_ADAPTER_NON_BLOCKING_MODE) && (UART_ADAPTER_NON_BLOCKING_MODE > 0U))
70 #if !(defined(HAL_UART_TRANSFER_MODE) && (HAL_UART_TRANSFER_MODE > 0U))
72 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
73 static const IRQn_Type s_LpuartRxIRQ[] = LPUART_RX_IRQS;
74 static const IRQn_Type s_LpuartTxIRQ[] = LPUART_TX_IRQS;
80 #if !(defined(HAL_UART_TRANSFER_MODE) && (HAL_UART_TRANSFER_MODE > 0U))
90 #if (defined(HAL_UART_TRANSFER_MODE) && (HAL_UART_TRANSFER_MODE > 0U))
139 #if (defined(UART_ADAPTER_NON_BLOCKING_MODE) && (UART_ADAPTER_NON_BLOCKING_MODE > 0U))
141 #if (defined(HAL_UART_TRANSFER_MODE) && (HAL_UART_TRANSFER_MODE > 0U))
146 assert(callbackParam);
152 if (0U != uartHandle->hardwareHandle.rxDataSize)
158 if (
NULL != uartHandle->callback)
160 uartHandle->callback(uartHandle, uartStatus, uartHandle->callbackParam);
166 static void HAL_UartInterruptHandle(uint8_t instance)
171 if (
NULL == uartHandle)
182 if (
NULL != uartHandle->rx.buffer)
185 if (uartHandle->rx.bufferSofar >= uartHandle->rx.bufferLength)
189 uartHandle->rx.buffer =
NULL;
190 if (
NULL != uartHandle->callback)
202 if (
NULL != uartHandle->tx.buffer)
205 if (uartHandle->tx.bufferSofar >= uartHandle->tx.bufferLength)
209 uartHandle->tx.buffer =
NULL;
210 if (
NULL != uartHandle->callback)
273 #if (defined(HAL_UART_ADAPTER_LOWPOWER) && (HAL_UART_ADAPTER_LOWPOWER > 0U))
274 uartHandle->config = *
config;
276 #if (defined(UART_ADAPTER_NON_BLOCKING_MODE) && (UART_ADAPTER_NON_BLOCKING_MODE > 0U))
278 #if (defined(HAL_UART_TRANSFER_MODE) && (HAL_UART_TRANSFER_MODE > 0U))
282 s_UartState[uartHandle->
instance] = uartHandle;
284 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
285 #if defined(FSL_FEATURE_SOC_INTMUX_COUNT) && (FSL_FEATURE_SOC_INTMUX_COUNT > 0)
286 if (s_LpuartRxIRQ[uartHandle->
instance] < FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS)
295 #if defined(FSL_FEATURE_SOC_INTMUX_COUNT) && (FSL_FEATURE_SOC_INTMUX_COUNT > 0)
296 if (s_LpuartIRQ[uartHandle->
instance] < FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS)
320 #if (defined(UART_ADAPTER_NON_BLOCKING_MODE) && (UART_ADAPTER_NON_BLOCKING_MODE > 0U))
322 #if !(defined(HAL_UART_TRANSFER_MODE) && (HAL_UART_TRANSFER_MODE > 0U))
341 #if (defined(UART_ADAPTER_NON_BLOCKING_MODE) && (UART_ADAPTER_NON_BLOCKING_MODE > 0U))
342 if (
NULL != uartHandle->rx.buffer)
362 #if (defined(UART_ADAPTER_NON_BLOCKING_MODE) && (UART_ADAPTER_NON_BLOCKING_MODE > 0U))
363 if (
NULL != uartHandle->tx.buffer)
383 #if (defined(HAL_UART_ADAPTER_LOWPOWER) && (HAL_UART_ADAPTER_LOWPOWER > 0U))
394 #if (defined(UART_ADAPTER_NON_BLOCKING_MODE) && (UART_ADAPTER_NON_BLOCKING_MODE > 0U))
396 #if (defined(HAL_UART_TRANSFER_MODE) && (HAL_UART_TRANSFER_MODE > 0U))
409 uartHandle->callbackParam = callbackParam;
410 uartHandle->callback = callback;
518 uartHandle->callbackParam = callbackParam;
519 uartHandle->callback = callback;
534 if (
NULL != uartHandle->rx.buffer)
539 uartHandle->rx.bufferLength = length;
540 uartHandle->rx.bufferSofar = 0;
541 uartHandle->rx.buffer = data;
557 if (
NULL != uartHandle->tx.buffer)
561 uartHandle->tx.bufferLength = length;
562 uartHandle->tx.bufferSofar = 0;
563 uartHandle->tx.buffer = data;
577 if (
NULL != uartHandle->rx.buffer)
579 *reCount = uartHandle->rx.bufferSofar;
594 if (
NULL != uartHandle->tx.buffer)
596 *seCount = uartHandle->tx.bufferSofar;
610 if (
NULL != uartHandle->rx.buffer)
615 uartHandle->rx.buffer =
NULL;
629 if (
NULL != uartHandle->tx.buffer)
633 uartHandle->tx.buffer =
NULL;
641 #if (defined(HAL_UART_TRANSFER_MODE) && (HAL_UART_TRANSFER_MODE > 0U))
652 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
661 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
684 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
691 HAL_UartInterruptHandle(uartHandle->
instance);
693 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
705 #if defined(FSL_FEATURE_LPUART_HAS_SHARED_IRQ0_IRQ1) && FSL_FEATURE_LPUART_HAS_SHARED_IRQ0_IRQ1
706 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
707 void LPUART0_LPUART1_RX_IRQHandler(
void)
709 if ((s_UartState[0]))
714 HAL_UartInterruptHandle(0);
717 if ((s_UartState[1]))
722 HAL_UartInterruptHandle(1);
727 void LPUART0_LPUART1_TX_IRQHandler(
void)
729 if ((s_UartState[0]))
734 HAL_UartInterruptHandle(0);
737 if ((s_UartState[1]))
742 HAL_UartInterruptHandle(1);
748 void LPUART0_LPUART1_IRQHandler(
void);
749 void LPUART0_LPUART1_IRQHandler(
void)
756 if (
NULL != (s_UartState[0]))
763 if ((
bool)orMask || ((
bool)rdrfMask && (
bool)rieMask) || ((
bool)tdreMask && (
bool)tieMask))
765 HAL_UartInterruptHandle(0);
768 if (
NULL != (s_UartState[1]))
775 if ((
bool)orMask || ((
bool)rdrfMask && (
bool)rieMask) || ((
bool)tdreMask && (
bool)tieMask))
777 HAL_UartInterruptHandle(1);
786 #if !(defined(FSL_FEATURE_LPUART_HAS_SHARED_IRQ0_IRQ1) && FSL_FEATURE_LPUART_HAS_SHARED_IRQ0_IRQ1)
787 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
788 void LPUART0_TX_IRQHandler(
void)
790 HAL_UartInterruptHandle(0);
793 void LPUART0_RX_IRQHandler(
void)
795 HAL_UartInterruptHandle(0);
799 void LPUART0_IRQHandler(
void)
801 HAL_UartInterruptHandle(0);
809 #if !(defined(FSL_FEATURE_LPUART_HAS_SHARED_IRQ0_IRQ1) && FSL_FEATURE_LPUART_HAS_SHARED_IRQ0_IRQ1)
810 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
811 void LPUART1_TX_IRQHandler(
void)
813 HAL_UartInterruptHandle(1);
816 void LPUART1_RX_IRQHandler(
void)
818 HAL_UartInterruptHandle(1);
824 HAL_UartInterruptHandle(1);
832 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
833 void LPUART2_TX_IRQHandler(
void)
835 HAL_UartInterruptHandle(2);
838 void LPUART2_RX_IRQHandler(
void)
840 HAL_UartInterruptHandle(2);
846 HAL_UartInterruptHandle(2);
853 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
854 void LPUART3_TX_IRQHandler(
void)
856 HAL_UartInterruptHandle(3);
859 void LPUART3_RX_IRQHandler(
void)
861 HAL_UartInterruptHandle(3);
867 HAL_UartInterruptHandle(3);
874 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
875 void LPUART4_TX_IRQHandler(
void)
877 HAL_UartInterruptHandle(4);
880 void LPUART4_RX_IRQHandler(
void)
882 HAL_UartInterruptHandle(4);
888 HAL_UartInterruptHandle(4);
895 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
896 void LPUART5_TX_IRQHandler(
void)
898 HAL_UartInterruptHandle(5);
901 void LPUART5_RX_IRQHandler(
void)
903 HAL_UartInterruptHandle(5);
909 HAL_UartInterruptHandle(5);
916 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
917 void LPUART6_TX_IRQHandler(
void)
919 HAL_UartInterruptHandle(6);
922 void LPUART6_RX_IRQHandler(
void)
924 HAL_UartInterruptHandle(6);
930 HAL_UartInterruptHandle(6);
937 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
938 void LPUART7_TX_IRQHandler(
void)
940 HAL_UartInterruptHandle(7);
943 void LPUART7_RX_IRQHandler(
void)
945 HAL_UartInterruptHandle(7);
951 HAL_UartInterruptHandle(7);
958 #if defined(FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ) && FSL_FEATURE_LPUART_HAS_SEPARATE_RX_TX_IRQ
959 void LPUART8_TX_IRQHandler(
void)
961 HAL_UartInterruptHandle(8);
964 void LPUART8_RX_IRQHandler(
void)
966 HAL_UartInterruptHandle(8);
972 HAL_UartInterruptHandle(8);
978 #if defined(CM4_0__LPUART)
979 void M4_0_LPUART_IRQHandler(
void)
986 #if defined(CM4_1__LPUART)
987 void M4_1_LPUART_IRQHandler(
void)
994 #if defined(CM4__LPUART)
995 void M4_LPUART_IRQHandler(
void)
1002 #if defined(DMA__LPUART0)
1003 void DMA_UART0_INT_IRQHandler(
void)
1010 #if defined(DMA__LPUART1)
1011 void DMA_UART1_INT_IRQHandler(
void)
1018 #if defined(DMA__LPUART2)
1019 void DMA_UART2_INT_IRQHandler(
void)
1026 #if defined(DMA__LPUART3)
1027 void DMA_UART3_INT_IRQHandler(
void)
1034 #if defined(DMA__LPUART4)
1035 void DMA_UART4_INT_IRQHandler(
void)
1042 #if defined(ADMA__LPUART0)
1043 void ADMA_UART0_INT_IRQHandler(
void)
1050 #if defined(ADMA__LPUART1)
1051 void ADMA_UART1_INT_IRQHandler(
void)
1058 #if defined(ADMA__LPUART2)
1059 void ADMA_UART2_INT_IRQHandler(
void)
1066 #if defined(ADMA__LPUART3)
1067 void ADMA_UART3_INT_IRQHandler(
void)