summaryrefslogtreecommitdiff
path: root/gpxe/src/core/console.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2016-02-09 18:08:47 -0800
committerH. Peter Anvin <hpa@zytor.com>2016-02-09 18:08:47 -0800
commitf2f897a1762fab84d2905f32b1c15dd7b42abb56 (patch)
treea38f51d3f1fcbf44afddb4736d549c12eaf491be /gpxe/src/core/console.c
parent72d2959272b4616f17a97667e6dfa9d06bf109a3 (diff)
downloadsyslinux-f2f897a1762fab84d2905f32b1c15dd7b42abb56.tar.gz
gpxe: delete long since obsolete snapshot of gPXE
gPXE has been deprecated in favor of iPXE for many, many years now. It is much better than users get it directly from the iPXE project, since we should no longer need any special modifications for Syslinux use. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'gpxe/src/core/console.c')
-rw-r--r--gpxe/src/core/console.c130
1 files changed, 0 insertions, 130 deletions
diff --git a/gpxe/src/core/console.c b/gpxe/src/core/console.c
deleted file mode 100644
index e22d2601..00000000
--- a/gpxe/src/core/console.c
+++ /dev/null
@@ -1,130 +0,0 @@
-#include "stddef.h"
-#include "console.h"
-#include <gpxe/process.h>
-#include <gpxe/nap.h>
-
-/** @file */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-/**
- * Write a single character to each console device.
- *
- * @v character Character to be written
- * @ret None -
- * @err None -
- *
- * The character is written out to all enabled console devices, using
- * each device's console_driver::putchar() method.
- *
- */
-void putchar ( int character ) {
- struct console_driver *console;
-
- /* Automatic LF -> CR,LF translation */
- if ( character == '\n' )
- putchar ( '\r' );
-
- for_each_table_entry ( console, CONSOLES ) {
- if ( ( ! console->disabled ) && console->putchar )
- console->putchar ( character );
- }
-}
-
-/**
- * Check to see if any input is available on any console.
- *
- * @v None -
- * @ret console Console device that has input available, if any.
- * @ret NULL No console device has input available.
- * @err None -
- *
- * All enabled console devices are checked once for available input
- * using each device's console_driver::iskey() method. The first
- * console device that has available input will be returned, if any.
- *
- */
-static struct console_driver * has_input ( void ) {
- struct console_driver *console;
-
- for_each_table_entry ( console, CONSOLES ) {
- if ( ( ! console->disabled ) && console->iskey ) {
- if ( console->iskey () )
- return console;
- }
- }
- return NULL;
-}
-
-/**
- * Read a single character from any console.
- *
- * @v None -
- * @ret character Character read from a console.
- * @err None -
- *
- * A character will be read from the first enabled console device that
- * has input available using that console's console_driver::getchar()
- * method. If no console has input available to be read, this method
- * will block. To perform a non-blocking read, use something like
- *
- * @code
- *
- * int key = iskey() ? getchar() : -1;
- *
- * @endcode
- *
- * The character read will not be echoed back to any console.
- *
- */
-int getchar ( void ) {
- struct console_driver *console;
- int character;
-
- while ( 1 ) {
- console = has_input();
- if ( console && console->getchar ) {
- character = console->getchar ();
- break;
- }
-
- /* Doze for a while (until the next interrupt). This works
- * fine, because the keyboard is interrupt-driven, and the
- * timer interrupt (approx. every 50msec) takes care of the
- * serial port, which is read by polling. This reduces the
- * power dissipation of a modern CPU considerably, and also
- * makes Etherboot waiting for user interaction waste a lot
- * less CPU time in a VMware session.
- */
- cpu_nap();
-
- /* Keep processing background tasks while we wait for
- * input.
- */
- step();
- }
-
- /* CR -> LF translation */
- if ( character == '\r' )
- character = '\n';
-
- return character;
-}
-
-/** Check for available input on any console.
- *
- * @v None -
- * @ret True Input is available on a console
- * @ret False Input is not available on any console
- * @err None -
- *
- * All enabled console devices are checked once for available input
- * using each device's console_driver::iskey() method. If any console
- * device has input available, this call will return True. If this
- * call returns True, you can then safely call getchar() without
- * blocking.
- *
- */
-int iskey ( void ) {
- return has_input() ? 1 : 0;
-}