mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
git-svn-id: svn://coreboot.org/openbios/openbios-devel@392 f158a5a8-5612-0410-a976-696ce0be7e32
49 lines
1.1 KiB
C
49 lines
1.1 KiB
C
/*
|
|
* <console.c>
|
|
*
|
|
* Simple text console
|
|
*
|
|
* Copyright (C) 2005 Stefan Reinauer <stepan@openbios.org>
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation
|
|
*
|
|
*/
|
|
|
|
#include "openbios/config.h"
|
|
#include "openbios/bindings.h"
|
|
#include "openbios/drivers.h"
|
|
|
|
#ifdef CONFIG_DEBUG_CONSOLE
|
|
/* ******************************************************************
|
|
* common functions, implementing simple concurrent console
|
|
* ****************************************************************** */
|
|
|
|
int putchar(int c)
|
|
{
|
|
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
|
|
serial_putchar(c);
|
|
#endif
|
|
return c;
|
|
}
|
|
|
|
int availchar(void)
|
|
{
|
|
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
|
|
if (uart_charav(CONFIG_SERIAL_PORT))
|
|
return 1;
|
|
#endif
|
|
return 0;
|
|
}
|
|
|
|
int getchar(void)
|
|
{
|
|
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
|
|
if (uart_charav(CONFIG_SERIAL_PORT))
|
|
return (uart_getchar(CONFIG_SERIAL_PORT));
|
|
#endif
|
|
return 0;
|
|
}
|
|
#endif // CONFIG_DEBUG_CONSOLE
|