AT example.cydsn/Generated_Source/PSoC5/UART.c
uint8 UART_GetRxBufferSize(void)
                                                            
    {
        uint8 size;

        #if(UART_RXBUFFERSIZE > UART_FIFO_LENGTH)

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

            if(UART_rxBufferRead == UART_rxBufferWrite)
            {
                if(UART_rxBufferLoopDetect > 0u)
                {
                    size = UART_RXBUFFERSIZE;
                }
                else
                {
                    size = 0u;
                }
            }
            else if(UART_rxBufferRead < UART_rxBufferWrite)
            {
                size = (UART_rxBufferWrite - UART_rxBufferRead);
            }
            else
            {
                size = (UART_RXBUFFERSIZE - UART_rxBufferRead) + UART_rxBufferWrite;
            }

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

        #else /* UART_RXBUFFERSIZE > UART_FIFO_LENGTH */

            /* We can only know if there is data in the fifo. */
            size = ((UART_RXSTATUS_REG & UART_RX_STS_FIFO_NOTEMPTY) != 0u) ? 1u : 0u;

        #endif /* End UART_RXBUFFERSIZE > UART_FIFO_LENGTH */

        return(size);
    }
/*******************************************************************************
    * Function Name: UART_GetRxBufferSize
    ********************************************************************************
    *
    * Summary:
    *  Determine the amount of bytes left in the RX buffer and return the count in
    *  bytes
    *
    * Parameters:
    *  None.
    *
    * Return:
    *  uint8: Integer count of the number of bytes left
    *  in the RX buffer
    *
    * Global Variables:
    *  UART_rxBufferWrite - used to calculate left bytes.
    *  UART_rxBufferRead - used to calculate left bytes.
    *  UART_rxBufferLoopDetect - checked to decide left bytes amount.
    *
    * Reentrant:
    *  No.
    *
    * Theory:
    *  Allows the user to find out how full the RX Buffer is.
    *
    *******************************************************************************/
Function Name: UART_GetRxBufferSize
Summary:
Determine the amount of bytes left in the RX buffer and return the count in
bytes

None.

Integer count of the number of bytes left
in the RX buffer

Global Variables:
UART_rxBufferWrite - used to calculate left bytes.
UART_rxBufferRead - used to calculate left bytes.
UART_rxBufferLoopDetect - checked to decide left bytes amount.

No.

Allows the user to find out how full the RX Buffer is.
Function Name : UART_GetRxBufferSize Summary : Determine the amount of bytes left in the RX buffer and return the count in bytes None . Integer count of the number of bytes left in the RX buffer Global Variables : UART_rxBufferWrite - used to calculate left bytes . UART_rxBufferRead - used to calculate left bytes . UART_rxBufferLoopDetect - checked to decide left bytes amount . No . Allows the user to find out how full the RX Buffer is .
uint8 UART_GetRxBufferSize(void)
    {
        uint8 size;
        #if(UART_RXBUFFERSIZE > UART_FIFO_LENGTH)
            #if(UART_RX_INTERRUPT_ENABLED)
                UART_DisableRxInt();
            #endif 
            if(UART_rxBufferRead == UART_rxBufferWrite)
            {
                if(UART_rxBufferLoopDetect > 0u)
                {
                    size = UART_RXBUFFERSIZE;
                }
                else
                {
                    size = 0u;
                }
            }
            else if(UART_rxBufferRead < UART_rxBufferWrite)
            {
                size = (UART_rxBufferWrite - UART_rxBufferRead);
            }
            else
            {
                size = (UART_RXBUFFERSIZE - UART_rxBufferRead) + UART_rxBufferWrite;
            }
            #if(UART_RX_INTERRUPT_ENABLED)
                UART_EnableRxInt();
            #endif 
        #else 
            size = ((UART_RXSTATUS_REG & UART_RX_STS_FIFO_NOTEMPTY) != 0u) ? 1u : 0u;
        #endif 
        return(size);
    }
uint8 UART_GetRxBufferSize ( void ) { uint8 size ; #if ( UART_RXBUFFERSIZE > UART_FIFO_LENGTH ) #if ( UART_RX_INTERRUPT_ENABLED ) UART_DisableRxInt ( ) ; #endif if ( UART_rxBufferRead == UART_rxBufferWrite ) { if ( UART_rxBufferLoopDetect > 0u ) { size = UART_RXBUFFERSIZE ; } else { size = 0u ; } } else if ( UART_rxBufferRead < UART_rxBufferWrite ) { size = ( UART_rxBufferWrite - UART_rxBufferRead ) ; } else { size = ( UART_RXBUFFERSIZE - UART_rxBufferRead ) + UART_rxBufferWrite ; } #if ( UART_RX_INTERRUPT_ENABLED ) UART_EnableRxInt ( ) ; #endif #else size = ( ( UART_RXSTATUS_REG & UART_RX_STS_FIFO_NOTEMPTY ) != 0u ) ? 1u : 0u ; #endif return ( size ) ; }
Function Name: UART_GetRxBufferSize
 Summary:
  Determine the amount of bytes left in the RX buffer and return the count in
  bytes
Function Name : UART_GetRxBufferSize Summary : Determine the amount of bytes left in the RX buffer and return the count in bytes
/* Disable Rx interrupt. */ /* Protect variables that could change on interrupt. */ /* UART_RX_INTERRUPT_ENABLED */ /* Enable Rx interrupt. */ /* End UART_RX_INTERRUPT_ENABLED */ /* UART_RXBUFFERSIZE > UART_FIFO_LENGTH */ /* We can only know if there is data in the fifo. */ /* End UART_RXBUFFERSIZE > UART_FIFO_LENGTH */