akaros/kern/arch/x86/kbdreg.h
<<
>>
Prefs
   1#pragma once
   2
   3// Special keycodes
   4#define KEY_HOME        0xE0
   5#define KEY_END         0xE1
   6#define KEY_UP          0xE2
   7#define KEY_DN          0xE3
   8#define KEY_LF          0xE4
   9#define KEY_RT          0xE5
  10#define KEY_PGUP        0xE6
  11#define KEY_PGDN        0xE7
  12#define KEY_INS         0xE8
  13#define KEY_DEL         0xE9
  14
  15
  16/* This is i8042reg.h + kbdreg.h from NetBSD. */
  17
  18#define KBSTATP         0x64    /* kbd controller status port(I) */
  19#define  KBS_DIB        0x01    /* kbd data in buffer */
  20#define  KBS_IBF        0x02    /* kbd input buffer low */
  21#define  KBS_WARM       0x04    /* kbd input buffer low */
  22#define  KBS_OCMD       0x08    /* kbd output buffer has command */
  23#define  KBS_NOSEC      0x10    /* kbd security lock not engaged */
  24#define  KBS_TERR       0x20    /* kbd transmission error */
  25#define  KBS_RERR       0x40    /* kbd receive error */
  26#define  KBS_PERR       0x80    /* kbd parity error */
  27
  28#define KBCMDP          0x64    /* kbd controller port(O) */
  29#define  KBC_RAMREAD    0x20    /* read from RAM */
  30#define  KBC_RAMWRITE   0x60    /* write to RAM */
  31#define  KBC_AUXDISABLE 0xa7    /* disable auxiliary port */
  32#define  KBC_AUXENABLE  0xa8    /* enable auxiliary port */
  33#define  KBC_AUXTEST    0xa9    /* test auxiliary port */
  34#define  KBC_KBDECHO    0xd2    /* echo to keyboard port */
  35#define  KBC_AUXECHO    0xd3    /* echo to auxiliary port */
  36#define  KBC_AUXWRITE   0xd4    /* write to auxiliary port */
  37#define  KBC_SELFTEST   0xaa    /* start self-test */
  38#define  KBC_KBDTEST    0xab    /* test keyboard port */
  39#define  KBC_KBDDISABLE 0xad    /* disable keyboard port */
  40#define  KBC_KBDENABLE  0xae    /* enable keyboard port */
  41#define  KBC_PULSE0     0xfe    /* pulse output bit 0 */
  42#define  KBC_PULSE1     0xfd    /* pulse output bit 1 */
  43#define  KBC_PULSE2     0xfb    /* pulse output bit 2 */
  44#define  KBC_PULSE3     0xf7    /* pulse output bit 3 */
  45
  46#define KBDATAP         0x60    /* kbd data port(I) */
  47#define KBOUTP          0x60    /* kbd data port(O) */
  48
  49#define K_RDCMDBYTE     0x20
  50#define K_LDCMDBYTE     0x60
  51
  52#define KC8_TRANS       0x40    /* convert to old scan codes */
  53#define KC8_MDISABLE    0x20    /* disable mouse */
  54#define KC8_KDISABLE    0x10    /* disable keyboard */
  55#define KC8_IGNSEC      0x08    /* ignore security lock */
  56#define KC8_CPU         0x04    /* exit from protected mode reset */
  57#define KC8_MENABLE     0x02    /* enable mouse interrupt */
  58#define KC8_KENABLE     0x01    /* enable keyboard interrupt */
  59#define CMDBYTE         (KC8_TRANS|KC8_CPU|KC8_MENABLE|KC8_KENABLE)
  60
  61/* keyboard commands */
  62#define KBC_RESET       0xFF    /* reset the keyboard */
  63#define KBC_RESEND      0xFE    /* request the keyboard resend the last byte */
  64#define KBC_SETDEFAULT  0xF6    /* resets keyboard to its power-on defaults */
  65#define KBC_DISABLE     0xF5    /* as per KBC_SETDEFAULT, but also disable key scanning */
  66#define KBC_ENABLE      0xF4    /* enable key scanning */
  67#define KBC_TYPEMATIC   0xF3    /* set typematic rate and delay */
  68#define KBC_SETTABLE    0xF0    /* set scancode translation table */
  69#define KBC_MODEIND     0xED    /* set mode indicators(i.e. LEDs) */
  70#define KBC_ECHO        0xEE    /* request an echo from the keyboard */
  71
  72/* keyboard responses */
  73#define KBR_EXTENDED    0xE0    /* extended key sequence */
  74#define KBR_RESEND      0xFE    /* needs resend of command */
  75#define KBR_ACK         0xFA    /* received a valid command */
  76#define KBR_OVERRUN     0x00    /* flooded */
  77#define KBR_FAILURE     0xFD    /* diagnosic failure */
  78#define KBR_BREAK       0xF0    /* break code prefix - sent on key release */
  79#define KBR_RSTDONE     0xAA    /* reset complete */
  80#define KBR_ECHO        0xEE    /* echo response */
  81