|
LumaOS
v0.1.116
An experimental x86-64 OS
|
Handler and utilities for the keyboard. More...
#include <drivers/keyboard.h>#include <arch/x86_64/io.h>#include <arch/x86_64/irq.h>#include <stdbool.h>#include "arch/x86_64/pic.h"Go to the source code of this file.
Functions | |
| static bool | kbd_buf_push (uint8_t b) |
| Pushes byte to key buffer. | |
| int | kbd_buf_pop (void) |
| Pops byte from the keyboard key buffer. | |
| int | kbd_getchar (void) |
| Waits for a key to be pressed and returns the character. | |
| bool | kbd_decode (uint8_t raw, struct key_event *ev) |
| Convert a keyboard byte into the correct char. | |
| static void | keyboard_handler (struct interrupt_frame *frame) |
| Pushes the key code to the key buffer. | |
| void | keyboard_init (void) |
| Initialize the keyboard driver and register the handler with the IRQ handler. | |
Variables | |
| static volatile uint8_t | kbd_buf [KBD_BUF_SIZE] |
| The buffer holding the keys codes. | |
| static volatile uint32_t | kbd_head |
| next slot to WRITE: only the handler changes this | |
| static volatile uint32_t | kbd_tail |
| next slot to READ: only the main code changes this | |
| static bool | e0_pending |
| saw 0xE0, the next byte completes the key | |
| bool | shift_down |
| Keyboard modifier key status. | |
| bool | ctrl_down |
| bool | alt_down |
| bool | caps_on |
| static const char | sc_lower [0x3A] |
| The lowercase character conversion table for set 1. | |
| static const char | sc_upper [0x3A] |
| The uppercase (shifted) character conversion table for set 1. | |
Handler and utilities for the keyboard.
Definition in file keyboard.c.
| int kbd_buf_pop | ( | void | ) |
Pops byte from the keyboard key buffer.
Definition at line 61 of file keyboard.c.
|
static |
Pushes byte to key buffer.
| b | Byte to push to buffer |
Definition at line 53 of file keyboard.c.
| bool kbd_decode | ( | uint8_t | raw, |
| struct key_event * | ev ) |
Convert a keyboard byte into the correct char.
| raw | The raw byte from the keyboard |
| ev | The key event to write to. |
Definition at line 78 of file keyboard.c.
| int kbd_getchar | ( | void | ) |
Waits for a key to be pressed and returns the character.
Definition at line 68 of file keyboard.c.
|
static |
Pushes the key code to the key buffer.
| frame | the frame status when the interrupt happened |
Definition at line 117 of file keyboard.c.
| void keyboard_init | ( | void | ) |
Initialize the keyboard driver and register the handler with the IRQ handler.
Definition at line 128 of file keyboard.c.
| bool alt_down |
Definition at line 30 of file keyboard.c.
| bool caps_on |
Definition at line 30 of file keyboard.c.
| bool ctrl_down |
Definition at line 30 of file keyboard.c.
|
static |
saw 0xE0, the next byte completes the key
Definition at line 27 of file keyboard.c.
|
static |
The buffer holding the keys codes.
Definition at line 19 of file keyboard.c.
|
static |
next slot to WRITE: only the handler changes this
Definition at line 22 of file keyboard.c.
|
static |
next slot to READ: only the main code changes this
Definition at line 24 of file keyboard.c.
|
static |
The lowercase character conversion table for set 1.
Definition at line 33 of file keyboard.c.
|
static |
The uppercase (shifted) character conversion table for set 1.
Definition at line 41 of file keyboard.c.
| bool shift_down |
Keyboard modifier key status.
Definition at line 30 of file keyboard.c.