#include "stddef.h"#include "console.h"#include <gpxe/process.h>#include <gpxe/nap.h>Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| void | putchar (int character) |
| Write a single character to each console device. | |
| static struct console_driver * | has_input (void) |
| Check to see if any input is available on any console. | |
| int | getchar (void) |
| Read a single character from any console. | |
| int | iskey (void) |
| Check for available input on any console. | |
Definition in file console.c.
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| void putchar | ( | int | character | ) |
Write a single character to each console device.
| character | Character to be written |
| None | - |
| None | - |
Definition at line 21 of file console.c.
References CONSOLES, console_driver::disabled, for_each_table_entry, console_driver::putchar, and putchar().
Referenced by ansiscr_putc(), clrline(), eepro_poll(), epic100_open(), falcon_init_xmac(), get_eeprom_data(), int21(), print_user_string(), printf_putchar(), putchar(), readline(), and sync_console().
00021 { 00022 struct console_driver *console; 00023 00024 /* Automatic LF -> CR,LF translation */ 00025 if ( character == '\n' ) 00026 putchar ( '\r' ); 00027 00028 for_each_table_entry ( console, CONSOLES ) { 00029 if ( ( ! console->disabled ) && console->putchar ) 00030 console->putchar ( character ); 00031 } 00032 }
| static struct console_driver* has_input | ( | void | ) | [static, read] |
Check to see if any input is available on any console.
| None | - |
| console | Console device that has input available, if any. | |
| NULL | No console device has input available. |
| None | - |
Definition at line 47 of file console.c.
References CONSOLES, console_driver::disabled, for_each_table_entry, console_driver::iskey, and NULL.
Referenced by getchar(), and iskey().
00047 { 00048 struct console_driver *console; 00049 00050 for_each_table_entry ( console, CONSOLES ) { 00051 if ( ( ! console->disabled ) && console->iskey ) { 00052 if ( console->iskey () ) 00053 return console; 00054 } 00055 } 00056 return NULL; 00057 }
| int getchar | ( | void | ) |
Read a single character from any console.
| None | - |
| character | Character read from a console. |
| None | - |
The character read will not be echoed back to any console.
Definition at line 80 of file console.c.
References cpu_nap(), console_driver::getchar, has_input(), and step().
Referenced by ansiscr_getc(), getchar_timeout(), getkey(), iflinkwait(), int21(), monojob_wait(), more(), pause(), and shell_banner().
00080 { 00081 struct console_driver *console; 00082 int character; 00083 00084 while ( 1 ) { 00085 console = has_input(); 00086 if ( console && console->getchar ) { 00087 character = console->getchar (); 00088 break; 00089 } 00090 00091 /* Doze for a while (until the next interrupt). This works 00092 * fine, because the keyboard is interrupt-driven, and the 00093 * timer interrupt (approx. every 50msec) takes care of the 00094 * serial port, which is read by polling. This reduces the 00095 * power dissipation of a modern CPU considerably, and also 00096 * makes Etherboot waiting for user interaction waste a lot 00097 * less CPU time in a VMware session. 00098 */ 00099 cpu_nap(); 00100 00101 /* Keep processing background tasks while we wait for 00102 * input. 00103 */ 00104 step(); 00105 } 00106 00107 /* CR -> LF translation */ 00108 if ( character == '\r' ) 00109 character = '\n'; 00110 00111 return character; 00112 }
| int iskey | ( | void | ) |
Check for available input on any console.
| None | - |
| True | Input is available on a console | |
| False | Input is not available on any console |
| None | - |
Definition at line 128 of file console.c.
References has_input().
Referenced by ansiscr_peek(), getchar_timeout(), iflinkwait(), int21(), monojob_wait(), pxe_menu_prompt_and_select(), pxe_menu_select(), and shell_banner().
00128 { 00129 return has_input() ? 1 : 0; 00130 }
1.5.7.1