/* USART IRQ handler. 
Interrupt handler for USART. After reception is done, set g_ul_recv_done to true, and if transmission is done, set g_ul_sent_done to true.  */
void USART0_Handler(void)
/* USART IRQ handler. 
Interrupt handler for USART. After reception is done, set g_ul_recv_done to true, and if transmission is done, set g_ul_sent_done to true.  */
void USART0_Handler(void)
{
	uint32_t ul_status;
	uint8_t uc_char;
	ul_status = usart_get_status(BOARD_USART);
	if(ul_status & (US_IER_TXRDY | US_IER_TXEMPTY)) {
		usart_disable_interrupt(BOARD_USART, (US_IER_TXRDY | US_IER_TXEMPTY));
	}
	if((g_uc_state == STATE_READ) && (usart_read(BOARD_USART, (uint32_t *)&uc_char) == 0)) {
		*p_revdata++ = uc_char;
		g_ulcount++;
		if(g_ulcount >= BUFFER_SIZE) {
			usart_disable_interrupt(BOARD_USART, US_IER_RXRDY);
			g_ul_recv_done = true;
		}
	}
}