32,14 → 32,13 |
*/ |
/** |
* @file |
* @brief PC keyboard controller driver. |
* @brief PC keyboard controller driver. |
*/ |
|
#include <kbd.h> |
#include <io/console.h> |
#include <io/keycode.h> |
#include <kbd/kbd.h> |
#include <kbd/keycode.h> |
#include <kbd_ctl.h> |
#include <gsp.h> |
|
enum dec_state { |
ds_s, |
46,7 → 45,7 |
ds_e |
}; |
|
static enum dec_state ds; |
static enum dec_state ds = ds_s; |
|
static int scanmap_simple[] = { |
|
180,15 → 179,10 |
[0x1c] = KC_NENTER |
}; |
|
int kbd_ctl_init(void) |
{ |
ds = ds_s; |
return 0; |
} |
|
void kbd_ctl_parse_scancode(int scancode) |
{ |
console_ev_type_t type; |
kbd_ev_type_t type; |
unsigned int key; |
int *map; |
size_t map_length; |
207,9 → 201,6 |
map = scanmap_e0; |
map_length = sizeof(scanmap_e0) / sizeof(int); |
break; |
default: |
map = NULL; |
map_length = 0; |
} |
|
ds = ds_s; |
216,12 → 207,12 |
|
if (scancode & 0x80) { |
scancode &= ~0x80; |
type = KEY_RELEASE; |
type = KE_RELEASE; |
} else { |
type = KEY_PRESS; |
type = KE_PRESS; |
} |
|
if ((scancode < 0) || ((size_t) scancode >= map_length)) |
if (scancode < 0 || scancode >= map_length) |
return; |
|
key = map[scancode]; |