/* See fsl_debug_console.h for documentation of this function.*/ debug_console_status_t DbgConsole_DeInit(void) { if (s_debugConsole.type == kDebugConsoleNone) { return kStatus_DEBUGCONSOLE_Success; } switch(s_debugConsole.type) { #if defined(HW_UART_INSTANCE_COUNT) case kDebugConsoleUART: CLOCK_SYS_DisableUartClock(s_debugConsole.instance); break; #endif #if defined(HW_UART0_INSTANCE_COUNT) case kDebugConsoleLPSCI: CLOCK_SYS_DisableLpsciClock(s_debugConsole.instance); break; #endif #if defined(HW_LPUART_INSTANCE_COUNT) case kDebugConsoleLPUART: CLOCK_SYS_DisableLpuartClock(s_debugConsole.instance); break; #endif default: return kStatus_DEBUGCONSOLE_InvalidDevice; } s_debugConsole.type = kDebugConsoleNone; return kStatus_DEBUGCONSOLE_Success; }
/*FUNCTION********************************************************************** * * Function Name : LPSCI_DRV_Deinit * Description : This function shuts down the LPSCI by disabling interrupts * and the transmitter/receiver. * *END**************************************************************************/ void LPSCI_DRV_Deinit(uint32_t instance) { assert(instance < HW_UART0_INSTANCE_COUNT); uint32_t baseAddr = g_lpsciBaseAddr[instance]; lpsci_state_t * lpsciState = (lpsci_state_t *)g_lpsciStatePtr[instance]; /* Wait until the data is completely shifted out of shift register */ while(!(LPSCI_HAL_IsTxComplete(baseAddr))) { } /* Disable the interrupt */ INT_SYS_DisableIRQ(g_lpsciRxTxIrqId[instance]); /* Disable TX and RX */ LPSCI_HAL_DisableTransmitter(baseAddr); LPSCI_HAL_DisableReceiver(baseAddr); /* Destroy TX and RX sema. */ OSA_SemaDestroy(&lpsciState->txIrqSync); OSA_SemaDestroy(&lpsciState->rxIrqSync); /* Cleared state pointer. */ g_lpsciStatePtr[instance] = NULL; /* Gate LPSCI module clock */ CLOCK_SYS_DisableUartClock(instance); }
/*FUNCTION********************************************************************** * * Function Name : UART_DRV_DmaDeinit * Description : This function shuts down the UART by disabling UART DMA and * the transmitter/receiver. * *END**************************************************************************/ uart_status_t UART_DRV_DmaDeinit(uint32_t instance) { assert(instance < UART_INSTANCE_COUNT); assert(g_uartBase[instance]); /* Exit if current instance is already de-initialized or is gated.*/ if ((!g_uartStatePtr[instance]) || (!CLOCK_SYS_GetUartGateCmd(instance))) { return kStatus_UART_Fail; } UART_Type * base = g_uartBase[instance]; uart_dma_state_t * uartDmaState = (uart_dma_state_t *)g_uartStatePtr[instance]; /* Wait until the data is completely shifted out of shift register */ while(!(UART_BRD_S1_TC(base))) { } UART_HAL_SetTxDmaCmd(base, false); UART_HAL_SetRxDmaCmd(base, false); /* Release DMA channel. */ DMA_DRV_FreeChannel(&uartDmaState->dmaUartRx); DMA_DRV_FreeChannel(&uartDmaState->dmaUartTx); /* Disable TX and RX */ UART_HAL_DisableTransmitter(base); UART_HAL_DisableReceiver(base); /* Destroy TX and RX sema. */ OSA_SemaDestroy(&uartDmaState->txIrqSync); OSA_SemaDestroy(&uartDmaState->rxIrqSync); /* Cleared state pointer. */ g_uartStatePtr[instance] = NULL; /* Gate UART module clock */ CLOCK_SYS_DisableUartClock(instance); return kStatus_UART_Success; }
/* See fsl_debug_console.h for documentation of this function.*/ debug_console_status_t DbgConsole_DeInit(void) { if (s_debugConsole.type == kDebugConsoleNone) { return kStatus_DEBUGCONSOLE_Success; } switch(s_debugConsole.type) { #if defined(UART_INSTANCE_COUNT) case kDebugConsoleUART: CLOCK_SYS_DisableUartClock(s_debugConsole.instance); break; #endif #if defined(UART0_INSTANCE_COUNT) case kDebugConsoleLPSCI: CLOCK_SYS_DisableLpsciClock(s_debugConsole.instance); break; #endif #if defined(LPUART_INSTANCE_COUNT) case kDebugConsoleLPUART: CLOCK_SYS_DisableLpuartClock(s_debugConsole.instance); break; #endif #if (defined(USB_INSTANCE_COUNT) && defined(BOARD_USE_VIRTUALCOM)) case kDebugConsoleUSBCDC: VirtualCom_Deinit(); CLOCK_SYS_DisableUsbfsClock(0); break; #endif default: return kStatus_DEBUGCONSOLE_InvalidDevice; } s_debugConsole.type = kDebugConsoleNone; return kStatus_DEBUGCONSOLE_Success; }