source: bootcd/isolinux/syslinux-6.03/gpxe/src/include/console.h @ e16e8f2

Last change on this file since e16e8f2 was e16e8f2, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

bootstuff

  • Property mode set to 100644
File size: 2.7 KB
Line 
1#ifndef CONSOLE_H
2#define CONSOLE_H
3
4#include <gpxe/tables.h>
5
6/** @file
7 *
8 * User interaction.
9 *
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.
14 *
15 */
16
17FILE_LICENCE ( GPL2_OR_LATER );
18
19/**
20 * A console driver
21 *
22 * Defines the functions that implement a particular console type.
23 * Must be made part of the console drivers table by using
24 * #__console_driver.
25 *
26 * @note Consoles that cannot be used before their initialisation
27 * function has completed should set #disabled=1 initially.  This
28 * allows other console devices to still be used to print out early
29 * debugging messages.
30 *
31 */
32struct console_driver {
33        /** Console is disabled.
34         *
35         * The console's putchar(), putline(), getchar() and iskey()
36         * methods will not be called while #disabled==1. Typically
37         * the console's initialisation functions will set #disabled=0
38         * upon completion.
39         *
40         */
41        int disabled;
42
43        /** Write a character to the console.
44         *
45         * @v character         Character to be written
46         * @ret None            -
47         * @err None            -
48         *
49         */
50        void ( *putchar ) ( int character );
51
52        /** Write an entire line to the console.
53         * This is intended to be used by line-oriented output media,
54         * like system logging facilities or line printers.
55         * Line output will not contain non-printable characters.
56         *
57         * @v linebuffer        Pointer to the \0-terminated line
58         * @ret None            -
59         * @err None            -
60         */
61        void ( * putline ) ( unsigned char * linebuffer );
62
63        /** Read a character from the console.
64         *
65         * @v None              -
66         * @ret character       Character read
67         * @err None            -
68         *
69         * If no character is available to be read, this method will
70         * block.  The character read should not be echoed back to the
71         * console.
72         *
73         */
74        int ( *getchar ) ( void );
75
76        /** Check for available input.
77         *
78         * @v None              -
79         * @ret True            Input is available
80         * @ret False           Input is not available
81         * @err None            -
82         *
83         * This should return True if a subsequent call to getchar()
84         * will not block.
85         *
86         */
87        int ( *iskey ) ( void );
88};
89
90/** Console driver table */
91#define CONSOLES __table ( struct console_driver, "consoles" )
92
93/**
94 * Mark a <tt> struct console_driver </tt> as being part of the
95 * console drivers table.
96 *
97 * Use as e.g.
98 *
99 * @code
100 *
101 *   struct console_driver my_console __console_driver = {
102 *      .putchar = my_putchar,
103 *      .getchar = my_getchar,
104 *      .iskey = my_iskey,
105 *   };
106 *
107 * @endcode
108 *
109 */
110#define __console_driver __table_entry ( CONSOLES, 01 )
111
112/* Function prototypes */
113
114extern void putchar ( int character );
115extern int getchar ( void );
116extern int iskey ( void );
117extern int getkey ( void );
118
119#endif /* CONSOLE_H */
Note: See TracBrowser for help on using the repository browser.