Add errfile definition for new e1000.c
[gpxe.git] / src / include / console.h
blob9addd5265221d9978815628cf60ac3782c9c23b0
1 #ifndef CONSOLE_H
2 #define CONSOLE_H
4 #include <gpxe/tables.h>
6 /** @file
8 * User interaction.
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
13 * drivers.
17 /**
18 * A console driver
20 * Defines the functions that implement a particular console type.
21 * Must be made part of the console drivers table by using
22 * #__console_driver.
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
27 * debugging messages.
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
36 * upon completion.
39 int disabled;
41 /** Write a character to the console.
43 * @v character Character to be written
44 * @ret None -
45 * @err None -
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
56 * @ret None -
57 * @err None -
59 void ( * putline ) ( unsigned char * linebuffer );
61 /** Read a character from the console.
63 * @v None -
64 * @ret character Character read
65 * @err None -
67 * If no character is available to be read, this method will
68 * block. The character read should not be echoed back to the
69 * console.
72 int ( *getchar ) ( void );
74 /** Check for available input.
76 * @v None -
77 * @ret True Input is available
78 * @ret False Input is not available
79 * @err None -
81 * This should return True if a subsequent call to getchar()
82 * will not block.
85 int ( *iskey ) ( void );
88 /**
89 * Mark a <tt> struct console_driver </tt> as being part of the
90 * console drivers table.
92 * Use as e.g.
94 * @code
96 * struct console_driver my_console __console_driver = {
97 * .putchar = my_putchar,
98 * .getchar = my_getchar,
99 * .iskey = my_iskey,
100 * };
102 * @endcode
105 #define __console_driver __table ( struct console_driver, console, 01 )
107 /* Function prototypes */
109 extern void putchar ( int character );
110 extern int getchar ( void );
111 extern int iskey ( void );
112 extern int getkey ( void );
114 #endif /* CONSOLE_H */