- cli();
- if (ao_fifo_empty(usart->rx_fifo)) {
- sei();
- return AO_READ_AGAIN;
- }
- ao_fifo_remove(usart->rx_fifo,c);
- sei();
+
+ ao_arch_block_interrupts();
+ if (ao_fifo_empty(usart->rx_fifo))
+ c = AO_READ_AGAIN;
+ else
+ ao_fifo_remove(usart->rx_fifo,c);
+ ao_arch_release_interrupts();