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 INIT_FN() has
25 * completed should set #disabled=1 initially. This allows other
26 * console devices to still be used to print out early debugging
30 struct console_driver {
31 /** Console is disabled.
33 * The console's putchar(), getchar() and iskey() methods will
34 * not be called while #disabled==1. Typically the
35 * console's initialisation functions (called via INIT_FN())
36 * will set #disabled=0 upon completion.
41 /** Write a character to the console.
43 * @v character Character to be written
48 void ( *putchar ) ( int character );
50 /** Read a character from the console.
53 * @ret character Character read
56 * If no character is available to be read, this method will
57 * block. The character read should not be echoed back to the
61 int ( *getchar ) ( void );
63 /** Check for available input.
66 * @ret True Input is available
67 * @ret False Input is not available
70 * This should return True if a subsequent call to getchar()
74 int ( *iskey ) ( void );
78 * Mark a <tt> struct console_driver </tt> as being part of the
79 * console drivers table.
85 * struct console_driver my_console __console_driver = {
86 * .putchar = my_putchar,
87 * .getchar = my_getchar,
94 #define __console_driver __table ( struct console_driver, console, 01 )
96 /* Function prototypes */
98 extern void putchar ( int character );
99 extern int getchar ( void );
100 extern int iskey ( void );
101 extern int getkey ( void );
103 #endif /* CONSOLE_H */