コード例 #1
0
ファイル: Usb_dev_serial.c プロジェクト: OS-Project/Divers
void
USBUARTIntHandler(void)
{
    unsigned int ulInts;
    int lErrors;

    //
    // Get and clear the current interrupt source(s)
    //
    ulInts = UARTIntIdentityGet(SOC_UART_0_REGS);



        /* Check if the cause is receiver line error condition.*/
        if( UART_INTID_RX_LINE_STAT_ERROR == ulInts || UART_INTID_CHAR_TIMEOUT == ulInts)
        {
            UARTHandleError();
        }

        //
        // Are we being interrupted because the TX FIFO has space available?
        //
        if(ulInts == UART_INTID_TX_THRES_REACH)
        {
            //
            // Move as many bytes as we can into the transmit FIFO.
            //
            USBUARTPrimeTransmit(USB_UART_BASE);

            //
            // If the output buffer is empty, turn off the transmit interrupt.
            //
            if(!USBBufferDataAvailable(&g_sRxBuffer))
            {
                UARTIntDisable(USB_UART_BASE, UART_INTID_TX_THRES_REACH);
            }
        }

        //
        // Handle receive interrupts.
        //
        if(ulInts  == UART_INTID_RX_THRES_REACH)
        {
            //
            // Read the UART's characters into the buffer.
            //

            lErrors = ReadUARTData();

            //
            // Check to see if we need to notify the host of any errors we just
            // detected.
            //
            CheckForSerialStateChange(&g_sCDCDevice, lErrors);
        }

}
コード例 #2
0
ファイル: usb_dev_serial.c プロジェクト: GarethS/Motor
//*****************************************************************************
//
// Interrupt handler for the UART which we are redirecting via USB.
//
//*****************************************************************************
void
USBUARTIntHandler(void)
{
    uint32_t ui32Ints;
    int32_t i32Errors;

    //
    // Get and clear the current interrupt source(s)
    //
    ui32Ints = ROM_UARTIntStatus(USB_UART_BASE, true);
    ROM_UARTIntClear(USB_UART_BASE, ui32Ints);

    //
    // Are we being interrupted because the TX FIFO has space available?
    //
    if(ui32Ints & UART_INT_TX)
    {
        //
        // Move as many bytes as we can into the transmit FIFO.
        //
        USBUARTPrimeTransmit(USB_UART_BASE);

        //
        // If the output buffer is empty, turn off the transmit interrupt.
        //
        if(!USBBufferDataAvailable(&g_sRxBuffer))
        {
            ROM_UARTIntDisable(USB_UART_BASE, UART_INT_TX);
        }
    }

    //
    // Handle receive interrupts.
    //
    // gjs if(ui32Ints & (UART_INT_RX))
    if(ui32Ints & (UART_INT_RX | UART_INT_RT))
    {
        //
        // Read the UART's characters into the buffer.
        //
        i32Errors = ReadUARTData();

        //
        // Check to see if we need to notify the host of any errors we just
        // detected.
        //
        CheckForSerialStateChange(&g_sCDCDevice, i32Errors);
    }
}
コード例 #3
0
//*****************************************************************************
//
// Interrupt handler for the UART which is being redirected via USB.
//
//*****************************************************************************
void
USBUARTIntHandler(void)
{
    unsigned long ulInts;
    long lErrors;

    //
    // Get and clear the current interrupt source(s)
    //
    ulInts = ROM_UARTIntStatus(UART0_BASE, true);
    ROM_UARTIntClear(UART0_BASE, ulInts);

    //
    // Handle transmit interrupts.
    //
    if(ulInts & UART_INT_TX)
    {
        //
        // Move as many bytes as possible into the transmit FIFO.
        //
        USBUARTPrimeTransmit();

        //
        // If the output buffer is empty, turn off the transmit interrupt.
        //
        if(!USBBufferDataAvailable(&g_sRxBuffer))
        {
            ROM_UARTIntDisable(UART0_BASE, UART_INT_TX);
        }
    }

    //
    // Handle receive interrupts.
    //
    if(ulInts & (UART_INT_RX | UART_INT_RT))
    {
        //
        // Read the UART's characters into the buffer.
        //
        lErrors = ReadUARTData();

        //
        // Check to see if the host needs to be notified of any errors just
        // detected.
        //
        CheckForSerialStateChange(&g_sCDCDevice, lErrors);
    }
}