Esempio n. 1
0
/*******************************************************************************
* 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) */
}
Esempio n. 2
0
/*******************************************************************************
* Function Name: UART_Stop
********************************************************************************
*
* Summary:
*  Disables the SCB component.
*
* Parameters:
*  None
*
* Return:
*  None
*
*******************************************************************************/
void UART_Stop(void)
{
    UART_CTRL_REG &= (uint32) ~UART_CTRL_ENABLED;  /* Disable SCB block */

    #if(UART_SCB_IRQ_INTERNAL)
        UART_SCB_IRQ_ClearPending(); /* Clear pending interrupt */
    #endif /* (UART_SCB_IRQ_INTERNAL) */

    UART_ScbModeStop(); /* Calls scbMode specific Stop function */
}