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

        #if(UART_TXBUFFERSIZE > UART_FIFO_LENGTH)

            /* Disable Tx interrupt. */
            /* Protect variables that could change on interrupt. */
            #if(UART_TX_INTERRUPT_ENABLED)
                UART_DisableTxInt();
            #endif /* End UART_TX_INTERRUPT_ENABLED */

            if(UART_txBufferRead == UART_txBufferWrite)
            {
                size = 0u;
            }
            else if(UART_txBufferRead < UART_txBufferWrite)
            {
                size = (UART_txBufferWrite - UART_txBufferRead);
            }
            else
            {
                size = (UART_TXBUFFERSIZE - UART_txBufferRead) + UART_txBufferWrite;
            }

            /* Enable Tx interrupt. */
            #if(UART_TX_INTERRUPT_ENABLED)
                UART_EnableTxInt();
            #endif /* End UART_TX_INTERRUPT_ENABLED */

        #else /* UART_TXBUFFERSIZE > UART_FIFO_LENGTH */

            size = UART_TXSTATUS_REG;

            /* Is the fifo is full. */
            if((size & UART_TX_STS_FIFO_FULL) != 0u)
            {
                size = UART_FIFO_LENGTH;
            }
            else if((size & UART_TX_STS_FIFO_EMPTY) != 0u)
            {
                size = 0u;
            }
            else
            {
                /* We only know there is data in the fifo. */
                size = 1u;
            }

        #endif /* End UART_TXBUFFERSIZE > UART_FIFO_LENGTH */

        return(size);
    }
/*******************************************************************************
    * Function Name: UART_GetTxBufferSize
    ********************************************************************************
    *
    * Summary:
    *  Determine the amount of space left in the TX buffer and return the count in
    *  bytes
    *
    * Parameters:
    *  None.
    *
    * Return:
    *  Integer count of the number of bytes left in the TX buffer
    *
    * Global Variables:
    *  UART_txBufferWrite - used to calculate left space.
    *  UART_txBufferRead - used to calculate left space.
    *
    * Reentrant:
    *  No.
    *
    * Theory:
    *  Allows the user to find out how full the TX Buffer is.
    *
    *******************************************************************************/
Function Name: UART_GetTxBufferSize
Summary:
Determine the amount of space left in the TX buffer and return the count in
bytes

None.

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

Global Variables:
UART_txBufferWrite - used to calculate left space.
UART_txBufferRead - used to calculate left space.

No.

Allows the user to find out how full the TX Buffer is.
Function Name : UART_GetTxBufferSize Summary : Determine the amount of space left in the TX buffer and return the count in bytes None . Integer count of the number of bytes left in the TX buffer Global Variables : UART_txBufferWrite - used to calculate left space . UART_txBufferRead - used to calculate left space . No . Allows the user to find out how full the TX Buffer is .
uint8 UART_GetTxBufferSize(void)
    {
        uint8 size;
        #if(UART_TXBUFFERSIZE > UART_FIFO_LENGTH)
            #if(UART_TX_INTERRUPT_ENABLED)
                UART_DisableTxInt();
            #endif 
            if(UART_txBufferRead == UART_txBufferWrite)
            {
                size = 0u;
            }
            else if(UART_txBufferRead < UART_txBufferWrite)
            {
                size = (UART_txBufferWrite - UART_txBufferRead);
            }
            else
            {
                size = (UART_TXBUFFERSIZE - UART_txBufferRead) + UART_txBufferWrite;
            }
            #if(UART_TX_INTERRUPT_ENABLED)
                UART_EnableTxInt();
            #endif 
        #else 
            size = UART_TXSTATUS_REG;
            if((size & UART_TX_STS_FIFO_FULL) != 0u)
            {
                size = UART_FIFO_LENGTH;
            }
            else if((size & UART_TX_STS_FIFO_EMPTY) != 0u)
            {
                size = 0u;
            }
            else
            {
                size = 1u;
            }
        #endif 
        return(size);
    }
uint8 UART_GetTxBufferSize ( void ) { uint8 size ; #if ( UART_TXBUFFERSIZE > UART_FIFO_LENGTH ) #if ( UART_TX_INTERRUPT_ENABLED ) UART_DisableTxInt ( ) ; #endif if ( UART_txBufferRead == UART_txBufferWrite ) { size = 0u ; } else if ( UART_txBufferRead < UART_txBufferWrite ) { size = ( UART_txBufferWrite - UART_txBufferRead ) ; } else { size = ( UART_TXBUFFERSIZE - UART_txBufferRead ) + UART_txBufferWrite ; } #if ( UART_TX_INTERRUPT_ENABLED ) UART_EnableTxInt ( ) ; #endif #else size = UART_TXSTATUS_REG ; if ( ( size & UART_TX_STS_FIFO_FULL ) != 0u ) { size = UART_FIFO_LENGTH ; } else if ( ( size & UART_TX_STS_FIFO_EMPTY ) != 0u ) { size = 0u ; } else { size = 1u ; } #endif return ( size ) ; }
Function Name: UART_GetTxBufferSize
 Summary:
  Determine the amount of space left in the TX buffer and return the count in
  bytes
Function Name : UART_GetTxBufferSize Summary : Determine the amount of space left in the TX buffer and return the count in bytes
/* Disable Tx interrupt. */ /* Protect variables that could change on interrupt. */ /* End UART_TX_INTERRUPT_ENABLED */ /* Enable Tx interrupt. */ /* End UART_TX_INTERRUPT_ENABLED */ /* UART_TXBUFFERSIZE > UART_FIFO_LENGTH */ /* Is the fifo is full. */ /* We only know there is data in the fifo. */ /* End UART_TXBUFFERSIZE > UART_FIFO_LENGTH */