Пример #1
0
/* blocking call for a character */
int conio_getch() {
	int key = -1;
	uint8 b;

	switch (conio_ttymode) {
		case CONIO_TTY_PVR:
#ifdef GFX
			while ((key = kbd_get_key()) == -1) { thd_pass(); }
#endif
			break;
		case CONIO_TTY_SERIAL: {
			while ((key = scif_read()) == -1) { thd_pass(); }

			if (key == 3)
				arch_exit();
	
			break;
		}
		case CONIO_TTY_STDIO: {
			int i;
			i = fs_read(conio_serial_fd, &b, 1);
			if (i <= 0)
				return -1;
			key = b;
			if (key == '\n')
				return conio_getch();
			break;
		}
	}

	return key;
}
Пример #2
0
/* Check to see if a key has been pressed */
int conio_check_getch() {
	int key = -1;
	uint8 b;

	switch (conio_ttymode) {
		case CONIO_TTY_PVR:
#ifdef GFX
			key = kbd_get_key();
#endif
			break;
		case CONIO_TTY_SERIAL: {
			key = scif_read();

			if (key == 3)
				arch_exit();
	
			break;
		}
		case CONIO_TTY_STDIO:
			if (fs_total(conio_serial_fd) > 0) {
				if (fs_read(conio_serial_fd, &b, 1) == 1)
					key = b;
			}
			if (key == '\n')
				key = -1;
			break;
	}

	return key;
}
Пример #3
0
u32 sys_get_key( void )
{
	return kbd_get_key();
}