ISR_Tc0
Default mainpagebasic-usart-hw-handshaking-projectISR_Tc0
Description Source Call Graph
Start Line: 196
void ISR_Tc0(void)
{
    unsigned int status;
    static unsigned int bytesTotal = 0;

    // Read TC0 status
    status = AT91C_BASE_TC0->TC_SR;

    // RC compare
    if ((status & AT91C_TC_CPCS) == AT91C_TC_CPCS) {
            
        // Display info
        bytesTotal += bytesReceived;
        sprintf(pString, "Bps: %4u; Tot: %6u\r", bytesReceived, bytesTotal);
        USART_WriteBuffer(AT91C_BASE_US0, pString, sizeof(pString));
        bytesReceived = 0;

        // Resume transfer if needed
        if (AT91C_BASE_US0->US_RCR == 0) {

            USART_ReadBuffer(AT91C_BASE_US0, pBuffer, BUFFER_SIZE);
            AT91C_BASE_US0->US_IER = AT91C_US_RXBUFF;
        }
    }
}