luciaos/kbd.h

49 lines
1.8 KiB
C
Raw Permalink Normal View History

#pragma once
#include <stdint.h>
#include "interrupt.h"
__attribute((__no_caller_saved_registers__))
void kbd_wait();
__attribute((__no_caller_saved_registers__))
void kbd_clear();
__attribute((__no_caller_saved_registers__))
uint8_t get_key();
__attribute((__no_caller_saved_registers__))
uint16_t get_scancode();
__attribute__ ((interrupt))
void keyboardHandler(struct interrupt_frame *frame);
typedef enum {
KEY_ESCAPE=0x01, KEY_1=0x02, KEY_2=0x03,
KEY_3=0x04, KEY_4=0x05, KEY_5=0x06, KEY_6=0x07,
KEY_7=0x08, KEY_8=0x09, KEY_9=0x0A, KEY_0=0x0B,
KEY_HYPHEN=0x0C, KEY_EQUALS=0x0D, KEY_BACKSPACE=0x0E, KEY_TAB=0x0F,
KEY_Q=0x10, KEY_W=0x11, KEY_E=0x12, KEY_R=0x13,
KEY_T=0x14, KEY_Y=0x15, KEY_U=0x16, KEY_I=0x17,
KEY_O=0x18, KEY_P=0x19, KEY_SQBRKLEFT=0x1A, KEY_SQBRKRIGHT=0x1B,
KEY_ENTER=0x1C, KEY_CTRL=0x1D, KEY_A=0x1E, KEY_S=0x1F,
KEY_D=0x20, KEY_F=0x21, KEY_G=0x22, KEY_H=0x23,
KEY_J=0x24, KEY_K=0x25, KEY_L=0x26, KEY_SEMICOLON=0x27,
KEY_QUOTE=0x28, KEY_BACKTICK=0x29, KEY_SHIFTLEFT=0x2A, KEY_BACKSTROKE=0x2B,
KEY_Z=0x2C, KEY_X=0x2D, KEY_C=0x2E, KEY_V=0x2F,
KEY_B=0x30, KEY_N=0x31, KEY_M=0x32, KEY_COMMA=0x33,
KEY_PERIOD=0x34, KEY_SLASH=0x35, KEY_SHIFTRIGHT=0x36, KEY_KPDSTAR=0x37,
KEY_ALT=0x38, KEY_SPACE=0x39, KEY_CAPSLOCK=0x3A, KEY_F1=0x3B,
KEY_F2=0x3C, KEY_F3=0x3D, KEY_F4=0x3E, KEY_F5=0x3F,
KEY_F6=0x40, KEY_F7=0x41, KEY_F8=0x42, KEY_F9=0x43,
KEY_F10=0x44, KEY_NUMLOCK=0x45, KEY_SCROLLLOCK=0x46, KEY_KPD7=0x47,
KEY_KPD8=0x48, KEY_KPD9=0x49, KEY_KPDMINUS=0x4A, KEY_KPD4=0x4B,
KEY_KPD5=0x4C, KEY_KPD6=0x4D, KEY_KPDPLUS=0x4E, KEY_KPD1=0x4F,
KEY_KPD2=0x50, KEY_KPD3=0x51, KEY_KPD0=0x52, KEY_KPDPERIOD=0x53,
KEY_F11=0x57, KEY_F12=0x58,
KEY_DOWN=KEY_KPD2,KEY_UP=KEY_KPD8,
KEY_LEFT=KEY_KPD4,KEY_RIGHT=KEY_KPD6,
KEY_PGUP=KEY_KPD9,KEY_PGDOWN=KEY_KPD3,
KEY_HOME=KEY_KPD7,KEY_END=KEY_KPD1,
KEY_INSERT=KEY_KPD0, KEY_DELETE=KEY_KPDPERIOD
} SCANCODE;