xref: /haiku/headers/private/kernel/boot/platform/generic/text_console.h (revision 268f99dd7dc4bd7474a8bd2742d3f1ec1de6752a)
14c62b091SIngo Weinhold /*
2cf4cc905SFrançois Revol  * Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3cf4cc905SFrançois Revol  * Distributed under the terms of the MIT License.
44c62b091SIngo Weinhold  */
54c62b091SIngo Weinhold #ifndef GENERIC_TEXT_CONSOLE_H
64c62b091SIngo Weinhold #define GENERIC_TEXT_CONSOLE_H
74c62b091SIngo Weinhold 
84c62b091SIngo Weinhold 
94c62b091SIngo Weinhold #include <boot/vfs.h>
104c62b091SIngo Weinhold #include <boot/stdio.h>
114c62b091SIngo Weinhold 
12*80519e78SAugustin Cavalier // Standard 16 color palette.
134c62b091SIngo Weinhold enum console_color {
144c62b091SIngo Weinhold 	// foreground and background colors
154c62b091SIngo Weinhold 	BLACK,
164c62b091SIngo Weinhold 	BLUE,
174c62b091SIngo Weinhold 	GREEN,
184c62b091SIngo Weinhold 	CYAN,
194c62b091SIngo Weinhold 	RED,
204c62b091SIngo Weinhold 	PURPLE,
214c62b091SIngo Weinhold 	BROWN,
224c62b091SIngo Weinhold 	GRAY,
23*80519e78SAugustin Cavalier 	// foreground colors only, if blinking is enabled (on bios_ia32)
244c62b091SIngo Weinhold 	DARK_GRAY,
254c62b091SIngo Weinhold 	BRIGHT_BLUE,
264c62b091SIngo Weinhold 	BRIGHT_GREEN,
274c62b091SIngo Weinhold 	BRIGHT_CYAN,
284c62b091SIngo Weinhold 	BRIGHT_RED,
294c62b091SIngo Weinhold 	MAGENTA,
304c62b091SIngo Weinhold 	YELLOW,
314c62b091SIngo Weinhold 	WHITE
324c62b091SIngo Weinhold };
334c62b091SIngo Weinhold 
344c62b091SIngo Weinhold enum {
354c62b091SIngo Weinhold 	// ASCII
364c62b091SIngo Weinhold 	TEXT_CONSOLE_NO_KEY				= '\0',
374c62b091SIngo Weinhold 	TEXT_CONSOLE_KEY_RETURN			= '\r',
38d2b49a00SRene Gollent 	TEXT_CONSOLE_KEY_BACKSPACE		= '\b',
394c62b091SIngo Weinhold 	TEXT_CONSOLE_KEY_ESCAPE			= 0x1b,
404c62b091SIngo Weinhold 	TEXT_CONSOLE_KEY_SPACE			= ' ',
414c62b091SIngo Weinhold 
424c62b091SIngo Weinhold 	// cursor keys
434c62b091SIngo Weinhold 	TEXT_CONSOLE_CURSOR_KEYS_START	= 0x40000000,
444c62b091SIngo Weinhold 	TEXT_CONSOLE_KEY_UP				= TEXT_CONSOLE_CURSOR_KEYS_START,
454c62b091SIngo Weinhold 	TEXT_CONSOLE_KEY_DOWN,
464c62b091SIngo Weinhold 	TEXT_CONSOLE_KEY_LEFT,
474c62b091SIngo Weinhold 	TEXT_CONSOLE_KEY_RIGHT,
484c62b091SIngo Weinhold 	TEXT_CONSOLE_KEY_PAGE_UP,
494c62b091SIngo Weinhold 	TEXT_CONSOLE_KEY_PAGE_DOWN,
504c62b091SIngo Weinhold 	TEXT_CONSOLE_KEY_HOME,
514c62b091SIngo Weinhold 	TEXT_CONSOLE_KEY_END,
524c62b091SIngo Weinhold 	TEXT_CONSOLE_CURSOR_KEYS_END,
534c62b091SIngo Weinhold };
544c62b091SIngo Weinhold 
554c62b091SIngo Weinhold #define TEXT_CONSOLE_IS_CURSOR_KEY(key) \
564c62b091SIngo Weinhold 	(key >= TEXT_CONSOLE_CURSOR_KEYS_START \
574c62b091SIngo Weinhold 	 && key < TEXT_CONSOLE_CURSOR_KEYS_END)
584c62b091SIngo Weinhold 
594c62b091SIngo Weinhold #ifdef __cplusplus
604c62b091SIngo Weinhold extern "C" {
614c62b091SIngo Weinhold #endif
624c62b091SIngo Weinhold 
634c62b091SIngo Weinhold extern void console_clear_screen(void);
644c62b091SIngo Weinhold extern int32 console_width(void);
654c62b091SIngo Weinhold extern int32 console_height(void);
664c62b091SIngo Weinhold extern void console_set_cursor(int32 x, int32 y);
67d2b49a00SRene Gollent extern void console_show_cursor(void);
68d2b49a00SRene Gollent extern void console_hide_cursor(void);
694c62b091SIngo Weinhold extern void console_set_color(int32 foreground, int32 background);
704c62b091SIngo Weinhold 
714c62b091SIngo Weinhold extern int console_wait_for_key(void);
724c62b091SIngo Weinhold 
734c62b091SIngo Weinhold #ifdef __cplusplus
744c62b091SIngo Weinhold }
754c62b091SIngo Weinhold #endif
764c62b091SIngo Weinhold 
774c62b091SIngo Weinhold #endif	/* GENERIC_TEXT_CONSOLE_H */
78