/* Receives a character. It fails if the RX fifo is not ready after a number of retries.  */
static int ug_getc(void)
/* Receives a character. It fails if the RX fifo is not ready after a number of retries.  */
static int ug_getc(void)
{
	int count = UG_READ_ATTEMPTS;
	if (!ug_io_base)
		return -1;
	while (!ug_is_rxfifo_ready() && count--)
		barrier();
	return ug_raw_getc();
}