AT example.cydsn/Generated_Source/PSoC5/UART.c
void UART_PutChar(uint8 txDataByte) 
    {
            #if(UART_TXBUFFERSIZE > UART_FIFO_LENGTH)
                /* The temporary output pointer is used since it takes two instructions
                *  to increment with a wrap, and we can't risk doing that with the real
                *  pointer and getting an interrupt in between instructions.
                */
                uint8 loc_txBufferWrite;
                uint8 loc_txBufferRead;

                do{
                    /* Block if software buffer is full, so we don't overwrite. */
                    #if ((UART_TXBUFFERSIZE > UART_MAX_BYTE_VALUE) && (CY_PSOC3))
                        /* Disable TX interrupt to protect variables that could change on interrupt */
                        CyIntDisable(UART_TX_VECT_NUM);
                    #endif /* End TXBUFFERSIZE > 255 */
                    loc_txBufferWrite = UART_txBufferWrite;
                    loc_txBufferRead = UART_txBufferRead;
                    #if ((UART_TXBUFFERSIZE > UART_MAX_BYTE_VALUE) && (CY_PSOC3))
                        /* Enable interrupt to continue transmission */
                        CyIntEnable(UART_TX_VECT_NUM);
                    #endif /* End TXBUFFERSIZE > 255 */
                }while( (loc_txBufferWrite < loc_txBufferRead) ? (loc_txBufferWrite == (loc_txBufferRead - 1u)) :
                                        ((loc_txBufferWrite - loc_txBufferRead) ==
                                        (uint8)(UART_TXBUFFERSIZE - 1u)) );

                if( (loc_txBufferRead == loc_txBufferWrite) &&
                    ((UART_TXSTATUS_REG & UART_TX_STS_FIFO_FULL) == 0u) )
                {
                    /* Add directly to the FIFO. */
                    UART_TXDATA_REG = txDataByte;
                }
                else
                {
                    if(loc_txBufferWrite >= UART_TXBUFFERSIZE)
                    {
                        loc_txBufferWrite = 0u;
                    }
                    /* Add to the software buffer. */
                    UART_txBuffer[loc_txBufferWrite] = txDataByte;
                    loc_txBufferWrite++;

                    /* Finally, update the real output pointer */
                    #if ((UART_TXBUFFERSIZE > UART_MAX_BYTE_VALUE) && (CY_PSOC3))
                        CyIntDisable(UART_TX_VECT_NUM);
                    #endif /* End TXBUFFERSIZE > 255 */
                    UART_txBufferWrite = loc_txBufferWrite;
                    #if ((UART_TXBUFFERSIZE > UART_MAX_BYTE_VALUE) && (CY_PSOC3))
                        CyIntEnable(UART_TX_VECT_NUM);
                    #endif /* End TXBUFFERSIZE > 255 */
                }

            #else /* UART_TXBUFFERSIZE > UART_FIFO_LENGTH */

                while((UART_TXSTATUS_REG & UART_TX_STS_FIFO_FULL) != 0u)
                {
                    ; /* Wait for room in the FIFO. */
                }

                /* Add directly to the FIFO. */
                UART_TXDATA_REG = txDataByte;

            #endif /* End UART_TXBUFFERSIZE > UART_FIFO_LENGTH */
    }
/*******************************************************************************
    * Function Name: UART_PutChar
    ********************************************************************************
    *
    * Summary:
    *  Wait to send byte until TX register or buffer has room.
    *
    * Parameters:
    *  txDataByte: The 8-bit data value to send across the UART.
    *
    * Return:
    *  None.
    *
    * Global Variables:
    *  UART_txBuffer - RAM buffer pointer for save data for transmission
    *  UART_txBufferWrite - cyclic index for write to txBuffer,
    *     checked to identify free space in txBuffer and incremented after each byte
    *     saved to buffer.
    *  UART_txBufferRead - cyclic index for read from txBuffer,
    *     checked to identify free space in txBuffer.
    *  UART_initVar - checked to identify that the component has been
    *     initialized.
    *
    * Reentrant:
    *  No.
    *
    * Theory:
    *  Allows the user to transmit any byte of data in a single transfer
    *
    *******************************************************************************/
Function Name: UART_PutChar
Summary:
Wait to send byte until TX register or buffer has room.

The 8-bit data value to send across the UART.

None.

Global Variables:
UART_txBuffer - RAM buffer pointer for save data for transmission
UART_txBufferWrite - cyclic index for write to txBuffer,
checked to identify free space in txBuffer and incremented after each byte
saved to buffer.
UART_txBufferRead - cyclic index for read from txBuffer,
checked to identify free space in txBuffer.
UART_initVar - checked to identify that the component has been
initialized.

No.

Allows the user to transmit any byte of data in a single transfer
Function Name : UART_PutChar Summary : Wait to send byte until TX register or buffer has room . The 8 - bit data value to send across the UART . None . Global Variables : UART_txBuffer - RAM buffer pointer for save data for transmission UART_txBufferWrite - cyclic index for write to txBuffer checked to identify free space in txBuffer and incremented after each byte saved to buffer . UART_txBufferRead - cyclic index for read from txBuffer checked to identify free space in txBuffer . UART_initVar - checked to identify that the component has been initialized . No . Allows the user to transmit any byte of data in a single transfer
void UART_PutChar(uint8 txDataByte) 
    {
            #if(UART_TXBUFFERSIZE > UART_FIFO_LENGTH)
                uint8 loc_txBufferWrite;
                uint8 loc_txBufferRead;
                do{
                    #if ((UART_TXBUFFERSIZE > UART_MAX_BYTE_VALUE) && (CY_PSOC3))
                        CyIntDisable(UART_TX_VECT_NUM);
                    #endif 
                    loc_txBufferWrite = UART_txBufferWrite;
                    loc_txBufferRead = UART_txBufferRead;
                    #if ((UART_TXBUFFERSIZE > UART_MAX_BYTE_VALUE) && (CY_PSOC3))
                        CyIntEnable(UART_TX_VECT_NUM);
                    #endif 
                }while( (loc_txBufferWrite < loc_txBufferRead) ? (loc_txBufferWrite == (loc_txBufferRead - 1u)) :
                                        ((loc_txBufferWrite - loc_txBufferRead) ==
                                        (uint8)(UART_TXBUFFERSIZE - 1u)) );
                if( (loc_txBufferRead == loc_txBufferWrite) &&
                    ((UART_TXSTATUS_REG & UART_TX_STS_FIFO_FULL) == 0u) )
                {
                    UART_TXDATA_REG = txDataByte;
                }
                else
                {
                    if(loc_txBufferWrite >= UART_TXBUFFERSIZE)
                    {
                        loc_txBufferWrite = 0u;
                    }
                    UART_txBuffer[loc_txBufferWrite] = txDataByte;
                    loc_txBufferWrite++;
                    #if ((UART_TXBUFFERSIZE > UART_MAX_BYTE_VALUE) && (CY_PSOC3))
                        CyIntDisable(UART_TX_VECT_NUM);
                    #endif 
                    UART_txBufferWrite = loc_txBufferWrite;
                    #if ((UART_TXBUFFERSIZE > UART_MAX_BYTE_VALUE) && (CY_PSOC3))
                        CyIntEnable(UART_TX_VECT_NUM);
                    #endif 
                }
            #else 
                while((UART_TXSTATUS_REG & UART_TX_STS_FIFO_FULL) != 0u)
                {
                    ; 
                }
                UART_TXDATA_REG = txDataByte;
            #endif 
    }
void UART_PutChar ( uint8 txDataByte ) { #if ( UART_TXBUFFERSIZE > UART_FIFO_LENGTH ) uint8 loc_txBufferWrite ; uint8 loc_txBufferRead ; do { #if ( ( UART_TXBUFFERSIZE > UART_MAX_BYTE_VALUE ) && ( CY_PSOC3 ) ) CyIntDisable ( UART_TX_VECT_NUM ) ; #endif loc_txBufferWrite = UART_txBufferWrite ; loc_txBufferRead = UART_txBufferRead ; #if ( ( UART_TXBUFFERSIZE > UART_MAX_BYTE_VALUE ) && ( CY_PSOC3 ) ) CyIntEnable ( UART_TX_VECT_NUM ) ; #endif } while ( ( loc_txBufferWrite < loc_txBufferRead ) ? ( loc_txBufferWrite == ( loc_txBufferRead - 1u ) ) : ( ( loc_txBufferWrite - loc_txBufferRead ) == ( uint8 ) ( UART_TXBUFFERSIZE - 1u ) ) ) ; if ( ( loc_txBufferRead == loc_txBufferWrite ) && ( ( UART_TXSTATUS_REG & UART_TX_STS_FIFO_FULL ) == 0u ) ) { UART_TXDATA_REG = txDataByte ; } else { if ( loc_txBufferWrite >= UART_TXBUFFERSIZE ) { loc_txBufferWrite = 0u ; } UART_txBuffer [ loc_txBufferWrite ] = txDataByte ; loc_txBufferWrite ++ ; #if ( ( UART_TXBUFFERSIZE > UART_MAX_BYTE_VALUE ) && ( CY_PSOC3 ) ) CyIntDisable ( UART_TX_VECT_NUM ) ; #endif UART_txBufferWrite = loc_txBufferWrite ; #if ( ( UART_TXBUFFERSIZE > UART_MAX_BYTE_VALUE ) && ( CY_PSOC3 ) ) CyIntEnable ( UART_TX_VECT_NUM ) ; #endif } #else while ( ( UART_TXSTATUS_REG & UART_TX_STS_FIFO_FULL ) != 0u ) { ; } UART_TXDATA_REG = txDataByte ; #endif }
Function Name: UART_PutChar
 Summary:
  Wait to send byte until TX register or buffer has room.
Function Name : UART_PutChar Summary : Wait to send byte until TX register or buffer has room .
/* The temporary output pointer is used since it takes two instructions
                *  to increment with a wrap, and we can't risk doing that with the real
                *  pointer and getting an interrupt in between instructions.
                */ /* Block if software buffer is full, so we don't overwrite. */ /* Disable TX interrupt to protect variables that could change on interrupt */ /* End TXBUFFERSIZE > 255 */ /* Enable interrupt to continue transmission */ /* End TXBUFFERSIZE > 255 */ /* Add directly to the FIFO. */ /* Add to the software buffer. */ /* Finally, update the real output pointer */ /* End TXBUFFERSIZE > 255 */ /* End TXBUFFERSIZE > 255 */ /* UART_TXBUFFERSIZE > UART_FIFO_LENGTH */ /* Wait for room in the FIFO. */ /* Add directly to the FIFO. */ /* End UART_TXBUFFERSIZE > UART_FIFO_LENGTH */