AT example.cydsn/Generated_Source/PSoC5/UART.c
void UART_ClearRxBuffer(void) 
    {
        uint8 enableInterrupts;

        /* clear the HW FIFO */
        /* Enter critical section */
        enableInterrupts = CyEnterCriticalSection();
        UART_RXDATA_AUX_CTL_REG |=  UART_RX_FIFO_CLR;
        UART_RXDATA_AUX_CTL_REG &= (uint8)~UART_RX_FIFO_CLR;
        /* Exit critical section */
        CyExitCriticalSection(enableInterrupts);

        #if(UART_RXBUFFERSIZE > UART_FIFO_LENGTH)
            /* Disable Rx interrupt. */
            /* Protect variables that could change on interrupt. */
            #if(UART_RX_INTERRUPT_ENABLED)
                UART_DisableRxInt();
            #endif /* End UART_RX_INTERRUPT_ENABLED */

            UART_rxBufferRead = 0u;
            UART_rxBufferWrite = 0u;
            UART_rxBufferLoopDetect = 0u;
            UART_rxBufferOverflow = 0u;

            /* Enable Rx interrupt. */
            #if(UART_RX_INTERRUPT_ENABLED)
                UART_EnableRxInt();
            #endif /* End UART_RX_INTERRUPT_ENABLED */
        #endif /* End UART_RXBUFFERSIZE > UART_FIFO_LENGTH */

    }
/*******************************************************************************
    * Function Name: UART_ClearRxBuffer
    ********************************************************************************
    *
    * Summary:
    *  Clears the RX RAM buffer by setting the read and write pointers both to zero.
    *  Clears hardware RX FIFO.
    *
    * Parameters:
    *  None.
    *
    * Return:
    *  None.
    *
    * Global Variables:
    *  UART_rxBufferWrite - cleared to zero.
    *  UART_rxBufferRead - cleared to zero.
    *  UART_rxBufferLoopDetect - cleared to zero.
    *  UART_rxBufferOverflow - cleared to zero.
    *
    * Reentrant:
    *  No.
    *
    * Theory:
    *  Setting the pointers to zero makes the system believe there is no data to
    *  read and writing will resume at address 0 overwriting any data that may
    *  have remained in the RAM.
    *
    * Side Effects:
    *  Any received data not read from the RAM or FIFO buffer will be lost.
    *******************************************************************************/
Function Name: UART_ClearRxBuffer
Summary:
Clears the RX RAM buffer by setting the read and write pointers both to zero.
Clears hardware RX FIFO.

None.

None.

Global Variables:
UART_rxBufferWrite - cleared to zero.
UART_rxBufferRead - cleared to zero.
UART_rxBufferLoopDetect - cleared to zero.
UART_rxBufferOverflow - cleared to zero.

No.

Setting the pointers to zero makes the system believe there is no data to
read and writing will resume at address 0 overwriting any data that may
have remained in the RAM.

Side Effects:
Any received data not read from the RAM or FIFO buffer will be lost.
Function Name : UART_ClearRxBuffer Summary : Clears the RX RAM buffer by setting the read and write pointers both to zero . Clears hardware RX FIFO . None . None . Global Variables : UART_rxBufferWrite - cleared to zero . UART_rxBufferRead - cleared to zero . UART_rxBufferLoopDetect - cleared to zero . UART_rxBufferOverflow - cleared to zero . No . Setting the pointers to zero makes the system believe there is no data to read and writing will resume at address 0 overwriting any data that may have remained in the RAM . Side Effects : Any received data not read from the RAM or FIFO buffer will be lost .
void UART_ClearRxBuffer(void) 
    {
        uint8 enableInterrupts;
        enableInterrupts = CyEnterCriticalSection();
        UART_RXDATA_AUX_CTL_REG |=  UART_RX_FIFO_CLR;
        UART_RXDATA_AUX_CTL_REG &= (uint8)~UART_RX_FIFO_CLR;
        CyExitCriticalSection(enableInterrupts);
        #if(UART_RXBUFFERSIZE > UART_FIFO_LENGTH)
            #if(UART_RX_INTERRUPT_ENABLED)
                UART_DisableRxInt();
            #endif 
            UART_rxBufferRead = 0u;
            UART_rxBufferWrite = 0u;
            UART_rxBufferLoopDetect = 0u;
            UART_rxBufferOverflow = 0u;
            #if(UART_RX_INTERRUPT_ENABLED)
                UART_EnableRxInt();
            #endif 
        #endif 
    }
void UART_ClearRxBuffer ( void ) { uint8 enableInterrupts ; enableInterrupts = CyEnterCriticalSection ( ) ; UART_RXDATA_AUX_CTL_REG |= UART_RX_FIFO_CLR ; UART_RXDATA_AUX_CTL_REG &= ( uint8 ) ~ UART_RX_FIFO_CLR ; CyExitCriticalSection ( enableInterrupts ) ; #if ( UART_RXBUFFERSIZE > UART_FIFO_LENGTH ) #if ( UART_RX_INTERRUPT_ENABLED ) UART_DisableRxInt ( ) ; #endif UART_rxBufferRead = 0u ; UART_rxBufferWrite = 0u ; UART_rxBufferLoopDetect = 0u ; UART_rxBufferOverflow = 0u ; #if ( UART_RX_INTERRUPT_ENABLED ) UART_EnableRxInt ( ) ; #endif #endif }
Function Name: UART_ClearRxBuffer
 Summary:
  Clears the RX RAM buffer by setting the read and write pointers both to zero.
Function Name : UART_ClearRxBuffer Summary : Clears the RX RAM buffer by setting the read and write pointers both to zero .
/* clear the HW FIFO */ /* Enter critical section */ /* Exit critical section */ /* Disable Rx interrupt. */ /* Protect variables that could change on interrupt. */ /* End UART_RX_INTERRUPT_ENABLED */ /* Enable Rx interrupt. */ /* End UART_RX_INTERRUPT_ENABLED */ /* End UART_RXBUFFERSIZE > UART_FIFO_LENGTH */