2008-11-24 12:16:22 +00:00
|
|
|
/*
|
|
|
|
|
* <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"
|
2009-01-12 17:47:56 +00:00
|
|
|
#include "openbios/drivers.h"
|
2008-11-24 12:16:22 +00:00
|
|
|
|
2008-11-24 12:23:01 +00:00
|
|
|
#ifdef CONFIG_DEBUG_CONSOLE
|
|
|
|
|
/* ******************************************************************
|
|
|
|
|
* common functions, implementing simple concurrent console
|
|
|
|
|
* ****************************************************************** */
|
2008-11-24 12:16:22 +00:00
|
|
|
|
2008-11-24 12:23:01 +00:00
|
|
|
int putchar(int c)
|
|
|
|
|
{
|
|
|
|
|
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
|
|
|
|
|
serial_putchar(c);
|
|
|
|
|
#endif
|
|
|
|
|
return c;
|
|
|
|
|
}
|
2008-11-24 12:16:22 +00:00
|
|
|
|
2008-11-24 12:23:01 +00:00
|
|
|
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
|