2004-02-15 20:46:45 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* (c) 2004 Laurent Vivier <LaurentVivier@wanadoo.fr>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2005-05-23 17:09:48 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2004-02-15 20:46:45 +00:00
|
|
|
#include "console.h"
|
|
|
|
|
2004-06-22 21:21:32 +00:00
|
|
|
#include "vga.h"
|
2004-06-25 11:15:16 +00:00
|
|
|
#include "serial.h"
|
|
|
|
|
|
|
|
static int vga_enabled = 0;
|
2004-02-15 20:46:45 +00:00
|
|
|
|
|
|
|
void
|
2004-06-22 21:21:32 +00:00
|
|
|
console_init(emile_l2_header_t* info)
|
2004-02-15 20:46:45 +00:00
|
|
|
{
|
2004-06-25 11:15:16 +00:00
|
|
|
if (info->console_mask & STDOUT_VGA)
|
|
|
|
{
|
|
|
|
vga_init();
|
|
|
|
vga_enabled = 1;
|
|
|
|
}
|
|
|
|
if ( info->console_mask & (STDOUT_SERIAL0 | STDOUT_SERIAL1) )
|
|
|
|
serial_init(info);
|
2004-02-15 20:46:45 +00:00
|
|
|
}
|
|
|
|
|
2005-05-25 06:26:00 +00:00
|
|
|
inline int console_putchar(int c)
|
2004-02-15 20:46:45 +00:00
|
|
|
{
|
2004-06-25 11:15:16 +00:00
|
|
|
if (vga_enabled)
|
|
|
|
vga_put(c);
|
|
|
|
serial_put(c);
|
2005-05-23 17:09:48 +00:00
|
|
|
|
|
|
|
return c;
|
2004-02-15 20:46:45 +00:00
|
|
|
}
|
|
|
|
|
2005-05-25 06:26:00 +00:00
|
|
|
void console_putstring(const char *s)
|
2004-02-15 20:46:45 +00:00
|
|
|
{
|
|
|
|
while(*s)
|
2005-05-25 06:26:00 +00:00
|
|
|
console_putchar(*(s++));
|
2004-02-15 20:46:45 +00:00
|
|
|
}
|