From 782fce7e323f38fd0dd10de1e4017ad31cef202d Mon Sep 17 00:00:00 2001 From: sbosse Date: Mon, 14 Oct 2024 23:08:42 +0200 Subject: [PATCH] Mon 14 Oct 23:06:38 CEST 2024 --- kernel/console.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 kernel/console.h diff --git a/kernel/console.h b/kernel/console.h new file mode 100644 index 0000000..3dd07e8 --- /dev/null +++ b/kernel/console.h @@ -0,0 +1,46 @@ +/* +Copyright (C) 2015-2019 The University of Notre Dame +This software is distributed under the GNU General Public License. +See the file LICENSE for details. +*/ + +#ifndef CONSOLE_H +#define CONSOLE_H + +#include "kernel/types.h" +#include "window.h" +#include "device.h" +#include "string.h" + +/* +console_create_root creates the very first global console that +is used for kernel debug output. The singleton "console_root" +must be statically allocated so that is usable at early +startup before memory allocation is available. +*/ + +extern struct console console_root; + +struct console * console_create_root(); + +/* +Any number of other consoles can be created and manipulated +on top of existing windows. +*/ + +struct console * console_create( struct window *w ); +struct console * console_addref( struct console *c ); +void console_delete( struct console *c ); + +void console_reset( struct console *c ); +int console_post( struct console *c, const char *data, int length ); +int console_write( struct console *c, const char *data, int length ); +int console_read( struct console *c, char *data, int length ); +int console_read_nonblock( struct console *c, char *data, int length ); +int console_getchar( struct console *c ); +void console_putchar( struct console *c, char ch ); +void console_putstring( struct console *c, const char *str ); +void console_heartbeat( struct console *c ); +void console_size( struct console *c, int *xsize, int *ysize ); + +#endif