Exemplo n.º 1
0
int getc(void)
{
	unsigned char ch;
	uint64_t start;

	/*
	 * For 100us we read the characters from the serial driver
	 * into a kfifo. This helps us not to lose characters
	 * in small hardware fifos.
	 */
	start = get_time_ns();
	while (1) {
		if (tstc_raw()) {
			kfifo_putc(console_input_fifo, getc_raw());

			start = get_time_ns();
		}
		if (is_timeout(start, 100 * USECOND) &&
				kfifo_len(console_input_fifo))
			break;
	}

	kfifo_getc(console_input_fifo, &ch);
	return ch;
}
Exemplo n.º 2
0
int tstc(void)
{
	if (unlikely(!console_is_input_allow()))
		return 0;

	return kfifo_len(console_input_fifo) || tstc_raw();
}
Exemplo n.º 3
0
int tstc(void)
{
	return kfifo_len(console_input_fifo) || tstc_raw();
}