void ISR_Usart0(void) { unsigned int status; // Read USART status status = AT91C_BASE_US0->US_CSR; // Receive buffer is full if ((status & AT91C_US_RXBUFF) == AT91C_US_RXBUFF) { bytesReceived += BUFFER_SIZE; // Restart transfer if BPS is not high enough if (bytesReceived < MAX_BPS) { USART_ReadBuffer(AT91C_BASE_US0, pBuffer, BUFFER_SIZE); } // Otherwise disable interrupt else { AT91C_BASE_US0->US_IDR = AT91C_US_RXBUFF; } } }