From 1c0ff6e1a720907f9211f43d4d8d9fc18d522348 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 9 Mar 2011 20:09:26 +0000 Subject: [console] Move include/console.h to include/ipxe/console.h Signed-off-by: Michael Brown --- src/include/console.h | 108 --------------------------------------------- src/include/etherboot.h | 2 +- src/include/ipxe/console.h | 108 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+), 109 deletions(-) delete mode 100644 src/include/console.h create mode 100644 src/include/ipxe/console.h (limited to 'src/include') diff --git a/src/include/console.h b/src/include/console.h deleted file mode 100644 index df9e8092f..000000000 --- a/src/include/console.h +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef CONSOLE_H -#define CONSOLE_H - -#include - -/** @file - * - * User interaction. - * - * Various console devices can be selected via the build options - * CONSOLE_FIRMWARE, CONSOLE_SERIAL etc. The console functions - * putchar(), getchar() and iskey() delegate to the individual console - * drivers. - * - */ - -FILE_LICENCE ( GPL2_OR_LATER ); - -/** - * A console driver - * - * Defines the functions that implement a particular console type. - * Must be made part of the console drivers table by using - * #__console_driver. - * - * @note Consoles that cannot be used before their initialisation - * function has completed should set #disabled=1 initially. This - * allows other console devices to still be used to print out early - * debugging messages. - * - */ -struct console_driver { - /** Console is disabled. - * - * The console's putchar(), getchar() and iskey() methods will - * not be called while #disabled==1. Typically the console's - * initialisation functions will set #disabled=0 upon - * completion. - * - */ - int disabled; - - /** Write a character to the console. - * - * @v character Character to be written - * @ret None - - * @err None - - * - */ - void ( *putchar ) ( int character ); - - /** Read a character from the console. - * - * @v None - - * @ret character Character read - * @err None - - * - * If no character is available to be read, this method will - * block. The character read should not be echoed back to the - * console. - * - */ - int ( *getchar ) ( void ); - - /** Check for available input. - * - * @v None - - * @ret True Input is available - * @ret False Input is not available - * @err None - - * - * This should return True if a subsequent call to getchar() - * will not block. - * - */ - int ( *iskey ) ( void ); -}; - -/** Console driver table */ -#define CONSOLES __table ( struct console_driver, "consoles" ) - -/** - * Mark a struct console_driver as being part of the - * console drivers table. - * - * Use as e.g. - * - * @code - * - * struct console_driver my_console __console_driver = { - * .putchar = my_putchar, - * .getchar = my_getchar, - * .iskey = my_iskey, - * }; - * - * @endcode - * - */ -#define __console_driver __table_entry ( CONSOLES, 01 ) - -/* Function prototypes */ - -extern void putchar ( int character ); -extern int getchar ( void ); -extern int iskey ( void ); -extern int getkey ( unsigned long timeout ); - -#endif /* CONSOLE_H */ diff --git a/src/include/etherboot.h b/src/include/etherboot.h index 3241294d9..b2fbe4f67 100644 --- a/src/include/etherboot.h +++ b/src/include/etherboot.h @@ -14,7 +14,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include #include #include -#include +#include #include #include #include diff --git a/src/include/ipxe/console.h b/src/include/ipxe/console.h new file mode 100644 index 000000000..3bfa5033f --- /dev/null +++ b/src/include/ipxe/console.h @@ -0,0 +1,108 @@ +#ifndef _IPXE_CONSOLE_H +#define _IPXE_CONSOLE_H + +#include + +/** @file + * + * User interaction. + * + * Various console devices can be selected via the build options + * CONSOLE_FIRMWARE, CONSOLE_SERIAL etc. The console functions + * putchar(), getchar() and iskey() delegate to the individual console + * drivers. + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +/** + * A console driver + * + * Defines the functions that implement a particular console type. + * Must be made part of the console drivers table by using + * #__console_driver. + * + * @note Consoles that cannot be used before their initialisation + * function has completed should set #disabled=1 initially. This + * allows other console devices to still be used to print out early + * debugging messages. + * + */ +struct console_driver { + /** Console is disabled. + * + * The console's putchar(), getchar() and iskey() methods will + * not be called while #disabled==1. Typically the console's + * initialisation functions will set #disabled=0 upon + * completion. + * + */ + int disabled; + + /** Write a character to the console. + * + * @v character Character to be written + * @ret None - + * @err None - + * + */ + void ( *putchar ) ( int character ); + + /** Read a character from the console. + * + * @v None - + * @ret character Character read + * @err None - + * + * If no character is available to be read, this method will + * block. The character read should not be echoed back to the + * console. + * + */ + int ( *getchar ) ( void ); + + /** Check for available input. + * + * @v None - + * @ret True Input is available + * @ret False Input is not available + * @err None - + * + * This should return True if a subsequent call to getchar() + * will not block. + * + */ + int ( *iskey ) ( void ); +}; + +/** Console driver table */ +#define CONSOLES __table ( struct console_driver, "consoles" ) + +/** + * Mark a struct console_driver as being part of the + * console drivers table. + * + * Use as e.g. + * + * @code + * + * struct console_driver my_console __console_driver = { + * .putchar = my_putchar, + * .getchar = my_getchar, + * .iskey = my_iskey, + * }; + * + * @endcode + * + */ +#define __console_driver __table_entry ( CONSOLES, 01 ) + +/* Function prototypes */ + +extern void putchar ( int character ); +extern int getchar ( void ); +extern int iskey ( void ); +extern int getkey ( unsigned long timeout ); + +#endif /* _IPXE_CONSOLE_H */ -- cgit v1.2.3-55-g7522