Example #1
0
bool uart_sps_sw_flow_off(void)
{
    bool flow_off = true;

    do
    {
        // First check if no transmission is ongoing
        if ((uart_temt_getf() == 0) || (uart_thre_getf() == 0) || !uart_sps_is_rx_fifo_empty())
        {
            flow_off = false;
            break;
        }
                
        uart_txdata_setf(UART_XOFF_BYTE);
        
        // Wait for 1 character duration to ensure host has not started a transmission at the
        // same time
        for (int i=0;i<UART_WAIT_BYTE_COUNTER;i++);
        
        // Check if data has been received during wait time
        if(!uart_sps_is_rx_fifo_empty())
        {
            // Re-enable UART flow
            uart_sps_sw_flow_on();

            // We failed stopping the flow
            flow_off = false;
        }
    } while(false);

    return (flow_off);
}
Example #2
0
bool uart_sps_flow_off(void)
{
    bool flow_off = true;

    do
    {
        // First check if no transmission is ongoing
        if ((uart_temt_getf() == 0) || (uart_thre_getf() == 0) || !uart_sps_is_rx_fifo_empty())
        {
            flow_off = false;
            break;
        }
        // Configure modem (HW flow control disable, 'RTS flow off')
        SetWord32(UART_MCR_REG, GetWord32(UART_MCR_REG) & (~UART_RTS)); 
        //SetWord32(UART_MCR_REG, 0);
        
        // Wait for 1 character duration to ensure host has not started a transmission at the
        // same time
        for (int i=0;i<UART_WAIT_BYTE_COUNTER;i++);

        // Check if data has been received during wait time
        if(!uart_sps_is_rx_fifo_empty())
        {
            // Re-enable UART flow
            uart_sps_flow_on();

            // We failed stopping the flow
            flow_off = false;
        }
    } while(false);
    
    
    return (flow_off);
}
Example #3
0
bool uart_sps_flow_off(void)
{
    bool flow_off = true;

    do
    {
        // First check if no transmission is ongoing
        if ((uart_temt_getf() == 0) || (uart_thre_getf() == 0))
        {
            flow_off = false;
            break;
        }

        // Configure modem (HW flow control disable, 'RTS flow off')
        // Wait for 1 character duration to ensure host has not started a transmission at the
        // same time
        #ifndef __GNUC__
//        timer_wait(UART_CHAR_DURATION);
        #endif //__GNUC__

        // Check if data has been received during wait time
        if(!uart_sps_is_rx_fifo_empty())
        {
            // Re-enable UART flow
            uart_sps_flow_on();

            // We failed stopping the flow
            flow_off = false;
        }
    } while(false);

    return (flow_off);
}
Example #4
0
bool uart_sps_fifo_check()
{
    if ((uart_temt_getf() == 0) || (uart_thre_getf() == 0) || !uart_sps_is_rx_fifo_empty())
    {
        return true;
    }
    else
        return false;
}
Example #5
0
void uart_sps_finish_transfers(void)
{
    // Configure modem (HW flow control disable, 'RTS flow off')
    uart_mcr_pack(UART_ENABLE,     // extfunc
                  UART_DISABLE,    // autorts
                  UART_ENABLE,     // autocts
                  UART_DISABLE);   // rts

    // Wait TX FIFO empty
    while(!uart_thre_getf() || !uart_temt_getf());
}
Example #6
0
bool uart_flow_off_func(void)
{
    bool flow_off = true;

    do
    {
        // First check if no transmission is ongoing
        if ((uart_temt_getf() == 0) || (uart_thre_getf() == 0))
        {
            flow_off = false;
            break;
        }

        // Configure modem (HW flow control disable, 'RTS flow off')
#if 0
        uart_mcr_pack(UART_ENABLE,     // extfunc
                      UART_DISABLE,    // autorts
                      UART_ENABLE,     // autocts
                      UART_DISABLE);   // rts
#endif
        SetWord32(UART_MCR_REG, 0);
 
        // Wait for 1 character duration to ensure host has not started a transmission at the
        // same time
        for (i=0;i<350;i++);

        // Wait for 1 character duration to ensure host has not started a transmission at the
        // same time
        #ifndef __GNUC__
//        timer_wait(UART_CHAR_DURATION);
        #endif //__GNUC__

        // Check if data has been received during wait time
        if(!uart_is_rx_fifo_empty())
        {
            // Re-enable UART flow
            uart_flow_on();

            // We failed stopping the flow
            flow_off = false;
        }
    } while(false);

    return (flow_off);
}