59 {0x0f,
"\tQWERTYUIOP"},
73 {0x02,
"1234567890-="},
85 {0x02,
"!@#$%^&*()_+"},
119 release = (code & 0x80) != 0;
137 if (c == 0177 && ctrl && alt)
142 if (ctrl && c >= 0x40 && c < 0x60)
174 static const struct shift_key shift_keys[] =
185 const struct shift_key *key;
188 for (key = shift_keys; key->scancode != 0; key++)
189 if (key->scancode == code)
191 *key->state_var = !release;
206 && scancode < k->first_scancode +
strlen (k->
chars))
static int tolower(int c)
#define UNUSED
GCC lets us add "attributes" to functions, function parameters, etc.
void intr_register_ext(uint8_t vec_no, intr_handler_func *handler, const char *name)
Registers external interrupt VEC_NO to invoke HANDLER, which is named NAME for debugging purposes.
void intr_handler_func(struct intr_frame *)
static uint8_t inb(uint16_t port)
Reads and returns a byte from PORT.
void kbd_init(void)
Initializes the keyboard.
static bool right_shift
Left and right Shift keys.
static const struct keymap unshifted_keymap[]
Characters for keys pressed without Shift, for those keys where it matters.
static intr_handler_func keyboard_interrupt
static bool caps_lock
Status of Caps Lock.
static bool left_shift
Current state of shift keys.
#define DATA_REG
Keyboard data register port.
static int64_t key_cnt
Number of keys pressed.
static const struct keymap invariant_keymap[]
Keys that produce the same characters regardless of whether the Shift keys are down.
static bool right_ctrl
Left and right Ctl keys.
void kbd_print_stats(void)
Prints keyboard statistics.
static bool map_key(const struct keymap[], unsigned scancode, uint8_t *)
Scans the array of keymaps K for SCANCODE.
static const struct keymap shifted_keymap[]
Characters for keys pressed with Shift, for those keys where it matters.
static bool right_alt
Left and right Alt keys.
int printf(const char *format,...)
Writes formatted output to the console.
void shutdown_reboot(void)
Reboots the machine via the keyboard controller.
signed long long int int64_t
size_t strlen(const char *string)
Returns the length of STRING.
Maps a set of contiguous scancodes into characters.
const char * chars
chars[0] has scancode first_scancode, chars[1] has scancode first_scancode + 1, and so on to the end ...
uint8_t first_scancode
First scancode.