diff options
author | 2017-04-25 03:31:15 -0700 | |
---|---|---|
committer | 2017-05-22 06:48:08 +0000 | |
commit | bb756eebdac6fd24e8919e2c43f7d2c8c4091f59 (patch) | |
tree | ca11e03542edf2d8f631efeca5e1626d211107e3 /qemu/roms/ipxe/src/core/pc_kbd.c | |
parent | a14b48d18a9ed03ec191cf16b162206998a895ce (diff) |
Adding qemu as a submodule of KVMFORNFV
This Patch includes the changes to add qemu as a submodule to
kvmfornfv repo and make use of the updated latest qemu for the
execution of all testcase
Change-Id: I1280af507a857675c7f81d30c95255635667bdd7
Signed-off-by:RajithaY<rajithax.yerrumsetty@intel.com>
Diffstat (limited to 'qemu/roms/ipxe/src/core/pc_kbd.c')
-rw-r--r-- | qemu/roms/ipxe/src/core/pc_kbd.c | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/qemu/roms/ipxe/src/core/pc_kbd.c b/qemu/roms/ipxe/src/core/pc_kbd.c deleted file mode 100644 index 42df755b5..000000000 --- a/qemu/roms/ipxe/src/core/pc_kbd.c +++ /dev/null @@ -1,112 +0,0 @@ -/* Minimal polling PC keyboard driver - * - No interrupt - * - No LED - * - No special keys - * - * still Enough For Me to type a filename. - * - * 2003-07 by SONE Takesh - * 2004-04 moved by LYH From filo to Etherboot - * yhlu@tyan.com - */ - -#include <ipxe/io.h> -#include <ipxe/console.h> - -static char key_map[][128] = { - { - "\0\x1b""1234567890-=\b\t" - "qwertyuiop[]\r\0as" - "dfghjkl;'`\0\\zxcv" - "bnm,./\0*\0 \0\0\0\0\0\0" - "\0\0\0\0\0\0\0""789-456+1" - "230." - },{ - "\0\x1b""!@#$%^&*()_+\b\t" - "QWERTYUIOP{}\r\0AS" - "DFGHJKL:\"~\0|ZXCV" - "BNM<>?\0\0\0 \0\0\0\0\0\0" - "\0\0\0\0\0\0\0""789-456+1" - "230." - } -}; - -static int cur_scan; -static unsigned int shift_state; -#define SHIFT 1 -#define CONTROL 2 -#define CAPS 4 - -static int get_scancode(void) -{ - int scan; - - if ((inb(0x64) & 1) == 0) - return 0; - scan = inb(0x60); - - switch (scan) { - case 0x2a: - case 0x36: - shift_state |= SHIFT; - break; - case 0xaa: - case 0xb6: - shift_state &= ~SHIFT; - break; - case 0x1d: - shift_state |= CONTROL; - break; - case 0x9d: - shift_state &= ~CONTROL; - break; - case 0x3a: - shift_state ^= CAPS; - break; - } - - if (scan & 0x80) - return 0; /* ignore break code or 0xe0 etc! */ - return scan; -} - -static int kbd_havekey(void) -{ - if (!cur_scan) - cur_scan = get_scancode(); - return cur_scan != 0; -} - -static int kbd_ischar(void) -{ - if (!kbd_havekey()) - return 0; - if (!key_map[shift_state & SHIFT][cur_scan]) { - cur_scan = 0; - return 0; - } - return 1; -} - -static int kbd_getc(void) -{ - int c; - - while (!kbd_ischar()) - ; - c = key_map[shift_state & SHIFT][cur_scan]; - if (shift_state & (CONTROL | CAPS)) { - if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { - if (shift_state & CONTROL) - c &= 0x1f; - else if (shift_state & CAPS) - c ^= ('A' ^ 'a'); - } - } - cur_scan = 0; - return c; -} - -struct console_driver pc_kbd_console __console_driver = { - .getchar = kbd_getc, -}; |