/******************************************************************************* * Function Name: UART_Stop ****************************************************************************//** * * Disables the UART component: disable the hardware and internal * interrupt. It also disables all TX interrupt sources so as not to cause an * unexpected interrupt trigger because after the component is enabled, the * TX FIFO is empty. * Refer to the function UART_Enable() for the interrupt * configuration details. * This function disables the SCB component without checking to see if * communication is in progress. Before calling this function it may be * necessary to check the status of communication to make sure communication * is complete. If this is not done then communication could be stopped mid * byte and corrupted data could result. * *******************************************************************************/ void UART_Stop(void) { #if (UART_SCB_IRQ_INTERNAL) UART_DisableInt(); #endif /* (UART_SCB_IRQ_INTERNAL) */ /* Call Stop function specific to current operation mode */ UART_ScbModeStop(); /* Disable SCB IP */ UART_CTRL_REG &= (uint32) ~UART_CTRL_ENABLED; /* Disable all TX interrupt sources so as not to cause an unexpected * interrupt trigger after the component will be enabled because the * TX FIFO is empty. * For SCB IP v0, it is critical as it does not mask-out interrupt * sources when it is disabled. This can cause a code lock-up in the * interrupt handler because TX FIFO cannot be loaded after the block * is disabled. */ UART_SetTxInterruptMode(UART_NO_INTR_SOURCES); #if (UART_SCB_IRQ_INTERNAL) UART_ClearPendingInt(); #endif /* (UART_SCB_IRQ_INTERNAL) */ }
/******************************************************************************* * Function Name: UART_SpiUartDisableIntTx ******************************************************************************** * * Summary: * Disables TX interrupt sources. * * Parameters: * None * * Return: * Returns TX interrupt soureces enabled before function call. * *******************************************************************************/ uint32 UART_SpiUartDisableIntTx(void) { uint32 intSourceMask; intSourceMask = UART_GetTxInterruptMode(); UART_SetTxInterruptMode(UART_NO_INTR_SOURCES); return(intSourceMask); }