4 #include <gpxe/tables.h>
10 * Various console devices can be selected via the build options
11 * CONSOLE_FIRMWARE, CONSOLE_SERIAL etc. The console functions
12 * putchar(), getchar() and iskey() delegate to the individual console
20 * Defines the functions that implement a particular console type.
21 * Must be made part of the console drivers table by using
24 * @note Consoles that cannot be used before their initialisation
25 * function has completed should set #disabled=1 initially. This
26 * allows other console devices to still be used to print out early
30 struct console_driver {
31 /** Console is disabled.
33 * The console's putchar(), putline(), getchar() and iskey()
34 * methods will not be called while #disabled==1. Typically
35 * the console's initialisation functions will set #disabled=0
41 /** Write a character to the console.
43 * @v character Character to be written
48 void ( *putchar ) ( int character );
50 /** Write an entire line to the console.
51 * This is intended to be used by line-oriented output media,
52 * like system logging facilities or line printers.
53 * Line output will not contain non-printable characters.
55 * @v linebuffer Pointer to the \0-terminated line
59 void ( * putline ) ( unsigned char * linebuffer );
61 /** Read a character from the console.
64 * @ret character Character read
67 * If no character is available to be read, this method will
68 * block. The character read should not be echoed back to the
72 int ( *getchar ) ( void );
74 /** Check for available input.
77 * @ret True Input is available
78 * @ret False Input is not available
81 * This should return True if a subsequent call to getchar()
85 int ( *iskey ) ( void );
88 /** Console driver table */
89 #define CONSOLES "consoles"
92 * Mark a <tt> struct console_driver </tt> as being part of the
93 * console drivers table.
99 * struct console_driver my_console __console_driver = {
100 * .putchar = my_putchar,
101 * .getchar = my_getchar,
108 #define __console_driver __table ( struct console_driver, CONSOLES, 01 )
110 /* Function prototypes */
112 extern void putchar ( int character );
113 extern int getchar ( void );
114 extern int iskey ( void );
115 extern int getkey ( void );
117 #endif /* CONSOLE_H */