Keyboard input routines. More...
#include <core.h>
Go to the source code of this file.
Data Structures | |
struct | key_t |
A record representing the state of the keyboard at the time a key was presssed or unpressed. More... | |
struct | keylayout_t |
A map of keyboard scan codes to key codes. More... | |
Macros | |
#define | KEYBRK_DOWN 0 |
Key-down break code. More... | |
#define | KEYBRK_UP 1 |
Key-up break code. More... | |
#define | META_SHIFT (1 << 0) |
Set while the shift key is pressed. More... | |
#define | META_CTRL (1 << 1) |
Set while the ctrl key is pressed. More... | |
#define | META_ALT (1 << 2) |
Set while the alt key is pressed. More... | |
#define | META_ESCAPED (1 << 3) |
Set if key's scan code is escaped. More... | |
#define | META_CAPSLOCK (1 << 4) |
Set while caps lock is on. More... | |
#define | META_NUMLOCK (1 << 5) |
Set while num lock is on. More... | |
#define | META_SCRLOCK (1 << 6) |
Set while scroll lock is on. More... | |
Typedefs | |
typedef enum keycode | keycode_t |
Enumerations |
Functions | |
void | kb_init () |
Initialize the keyboard so that it can provide input to the kernel. More... | |
void | kb_setlayout (keylayout_t *layout) |
Install a new keyboard layout. More... | |
char | kb_getchar () |
Return the next available character from the keyboard's input buffer. More... | |
bool | kb_getkey (key_t *key) |
Return the available next key from the keyboard's input buffer. More... | |
uint8_t | kb_meta () |
Return the current meta-key bit mask. More... | |
Keyboard input routines.
Definition in file keyboard.h.
struct key |
A record representing the state of the keyboard at the time a key was presssed or unpressed.
Definition at line 87 of file keyboard.h.
Data Fields | ||
---|---|---|
uint8_t | brk | KEYBRK_UP or KEYBRK_DOWN. |
uint8_t | meta | Metakey mask when key was generated. |
uint8_t | code | Keycode value (type = keycode_t). |
uint8_t | ch | Character value, if valid. |
struct keylayout |
A map of keyboard scan codes to key codes.
Definition at line 101 of file keyboard.h.
Data Fields | ||
---|---|---|
uint8_t | shifted[128] | when shift key is down. |
uint8_t | unshifted[128] | when shift key is up. |
#define KEYBRK_DOWN 0 |
Key-down break code.
Definition at line 19 of file keyboard.h.
Referenced by command_run(), and isr_keyboard().
#define KEYBRK_UP 1 |
Key-up break code.
Definition at line 20 of file keyboard.h.
Referenced by isr_keyboard(), and keycode_run().
#define META_SHIFT (1 << 0) |
Set while the shift key is pressed.
Definition at line 23 of file keyboard.h.
Referenced by isr_keyboard().
#define META_CTRL (1 << 1) |
Set while the ctrl key is pressed.
Definition at line 24 of file keyboard.h.
Referenced by isr_keyboard().
#define META_ALT (1 << 2) |
Set while the alt key is pressed.
Definition at line 25 of file keyboard.h.
Referenced by isr_keyboard(), and keycode_run().
#define META_ESCAPED (1 << 3) |
Set if key's scan code is escaped.
Definition at line 26 of file keyboard.h.
Referenced by addkey(), and isr_keyboard().
#define META_CAPSLOCK (1 << 4) |
#define META_NUMLOCK (1 << 5) |
#define META_SCRLOCK (1 << 6) |
Set while scroll lock is on.
Definition at line 29 of file keyboard.h.
Referenced by isr_keyboard().
Definition at line 80 of file keyboard.h.
enum keycode |
Key code values representing individual keys on the keyboard.
Key codes corresponding to printable characters are not listed here, but they are equal in value to their lowercase ASCII representations (e.g., KEY_A = 'a', KEY_1 = '1', etc.).
Definition at line 38 of file keyboard.h.
void kb_init | ( | ) |
Initialize the keyboard so that it can provide input to the kernel.
kb_init installs the default US English PS/2 keyboard layout.
Definition at line 268 of file keyboard.c.
Referenced by kmain().
void kb_setlayout | ( | keylayout_t * | layout | ) |
Install a new keyboard layout.
[in] | layout | The keyboard layout to install. |
Definition at line 288 of file keyboard.c.
char kb_getchar | ( | ) |
Return the next available character from the keyboard's input buffer.
Definition at line 294 of file keyboard.c.
bool kb_getkey | ( | key_t * | key | ) |
Return the available next key from the keyboard's input buffer.
[out] | key | The key record of the next key in the buffer. |
Definition at line 318 of file keyboard.c.
Referenced by command_run(), and keycode_run().
uint8_t kb_meta | ( | ) |
Return the current meta-key bit mask.
Definition at line 340 of file keyboard.c.