diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2017-05-14 18:41:09 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2017-05-14 18:41:09 +0200 |
commit | e47f8666ec59b9726cc0daee98872bdc4ea6fe3e (patch) | |
tree | 376644302801d6972e457431d573f564f2d87c4c /src/console.c | |
parent | 5bebcc939adc868110a91b9bd0c013208f6f1779 (diff) | |
download | abaos-e47f8666ec59b9726cc0daee98872bdc4ea6fe3e.tar.gz abaos-e47f8666ec59b9726cc0daee98872bdc4ea6fe3e.tar.bz2 |
added a simple kernel console which can use VGA and the first serial port for output
(no terminal emulation, only sequential output)
shows how to intermix VGA animations and line-orinented console output
Diffstat (limited to 'src/console.c')
-rw-r--r-- | src/console.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/console.c b/src/console.c new file mode 100644 index 0000000..d9ae941 --- /dev/null +++ b/src/console.c @@ -0,0 +1,51 @@ +#include "console.h" + +#include "string.h" + +void console_init( console_t *console ) +{ + memset( console, 0, sizeof( console_t ) ); +} + +void console_add_vga_output( console_t *console, vga_t *vga ) +{ + console->vga = vga; +} + +void console_add_serial_output( console_t *console, serial_t *serial ) +{ + console->serial = serial; +} + +void console_put_char( console_t *console, const char c ) +{ + if( console->vga ) { + vga_put_char( console->vga, c ); + } + + if( console->serial ) { + serial_put_char( console->serial, c ); + } +} + +void console_put_string( console_t *console, const char *s ) +{ + if( console->vga ) { + vga_put_string( console->vga, s ); + } + + if( console->serial ) { + serial_put_string( console->serial, s ); + } +} + +void console_put_newline( console_t *console ) +{ + if( console->vga ) { + vga_put_newline( console->vga ); + } + + if( console->serial ) { + serial_put_newline( console->serial ); + } +} |