pc_keyb.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * include/linux/pc_keyb.h
  3. *
  4. * PC Keyboard And Keyboard Controller
  5. *
  6. * (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
  7. */
  8. /*
  9. * Configuration Switches
  10. */
  11. #undef KBD_REPORT_ERR /* Report keyboard errors */
  12. #define KBD_REPORT_UNKN /* Report unknown scan codes */
  13. #define KBD_REPORT_TIMEOUTS /* Report keyboard timeouts */
  14. #undef KBD_IS_FOCUS_9000 /* We have the brain-damaged FOCUS-9000 keyboard */
  15. #undef INITIALIZE_MOUSE /* Define if your PS/2 mouse needs initialization. */
  16. #define KBD_INIT_TIMEOUT 1000 /* Timeout in ms for initializing the keyboard */
  17. #define KBC_TIMEOUT 250 /* Timeout in ms for sending to keyboard controller */
  18. #define KBD_TIMEOUT 1000 /* Timeout in ms for keyboard command acknowledge */
  19. /*
  20. * Internal variables of the driver
  21. */
  22. extern unsigned char pckbd_read_mask;
  23. extern unsigned char aux_device_present;
  24. /*
  25. * Keyboard Controller Registers on normal PCs.
  26. */
  27. #define KBD_STATUS_REG 0x64 /* Status register (R) */
  28. #define KBD_CNTL_REG 0x64 /* Controller command register (W) */
  29. #define KBD_DATA_REG 0x60 /* Keyboard data register (R/W) */
  30. /*
  31. * Keyboard Controller Commands
  32. */
  33. #define KBD_CCMD_READ_MODE 0x20 /* Read mode bits */
  34. #define KBD_CCMD_WRITE_MODE 0x60 /* Write mode bits */
  35. #define KBD_CCMD_GET_VERSION 0xA1 /* Get controller version */
  36. #define KBD_CCMD_MOUSE_DISABLE 0xA7 /* Disable mouse interface */
  37. #define KBD_CCMD_MOUSE_ENABLE 0xA8 /* Enable mouse interface */
  38. #define KBD_CCMD_TEST_MOUSE 0xA9 /* Mouse interface test */
  39. #define KBD_CCMD_SELF_TEST 0xAA /* Controller self test */
  40. #define KBD_CCMD_KBD_TEST 0xAB /* Keyboard interface test */
  41. #define KBD_CCMD_KBD_DISABLE 0xAD /* Keyboard interface disable */
  42. #define KBD_CCMD_KBD_ENABLE 0xAE /* Keyboard interface enable */
  43. #define KBD_CCMD_WRITE_AUX_OBUF 0xD3 /* Write to output buffer as if
  44. initiated by the auxiliary device */
  45. #define KBD_CCMD_WRITE_MOUSE 0xD4 /* Write the following byte to the mouse */
  46. /*
  47. * Keyboard Commands
  48. */
  49. #define KBD_CMD_SET_LEDS 0xED /* Set keyboard leds */
  50. #define KBD_CMD_SET_RATE 0xF3 /* Set typematic rate */
  51. #define KBD_CMD_ENABLE 0xF4 /* Enable scanning */
  52. #define KBD_CMD_DISABLE 0xF5 /* Disable scanning */
  53. #define KBD_CMD_RESET 0xFF /* Reset */
  54. /*
  55. * Keyboard Replies
  56. */
  57. #define KBD_REPLY_POR 0xAA /* Power on reset */
  58. #define KBD_REPLY_ACK 0xFA /* Command ACK */
  59. #define KBD_REPLY_RESEND 0xFE /* Command NACK, send the cmd again */
  60. /*
  61. * Status Register Bits
  62. */
  63. #define KBD_STAT_OBF 0x01 /* Keyboard output buffer full */
  64. #define KBD_STAT_IBF 0x02 /* Keyboard input buffer full */
  65. #define KBD_STAT_SELFTEST 0x04 /* Self test successful */
  66. #define KBD_STAT_CMD 0x08 /* Last write was a command write (0=data) */
  67. #define KBD_STAT_UNLOCKED 0x10 /* Zero if keyboard locked */
  68. #define KBD_STAT_MOUSE_OBF 0x20 /* Mouse output buffer full */
  69. #define KBD_STAT_GTO 0x40 /* General receive/xmit timeout */
  70. #define KBD_STAT_PERR 0x80 /* Parity error */
  71. #define AUX_STAT_OBF (KBD_STAT_OBF | KBD_STAT_MOUSE_OBF)
  72. /*
  73. * Controller Mode Register Bits
  74. */
  75. #define KBD_MODE_KBD_INT 0x01 /* Keyboard data generate IRQ1 */
  76. #define KBD_MODE_MOUSE_INT 0x02 /* Mouse data generate IRQ12 */
  77. #define KBD_MODE_SYS 0x04 /* The system flag (?) */
  78. #define KBD_MODE_NO_KEYLOCK 0x08 /* The keylock doesn't affect the keyboard if set */
  79. #define KBD_MODE_DISABLE_KBD 0x10 /* Disable keyboard interface */
  80. #define KBD_MODE_DISABLE_MOUSE 0x20 /* Disable mouse interface */
  81. #define KBD_MODE_KCC 0x40 /* Scan code conversion to PC format */
  82. #define KBD_MODE_RFU 0x80
  83. /*
  84. * Mouse Commands
  85. */
  86. #define AUX_SET_RES 0xE8 /* Set resolution */
  87. #define AUX_SET_SCALE11 0xE6 /* Set 1:1 scaling */
  88. #define AUX_SET_SCALE21 0xE7 /* Set 2:1 scaling */
  89. #define AUX_GET_SCALE 0xE9 /* Get scaling factor */
  90. #define AUX_SET_STREAM 0xEA /* Set stream mode */
  91. #define AUX_SET_SAMPLE 0xF3 /* Set sample rate */
  92. #define AUX_ENABLE_DEV 0xF4 /* Enable aux device */
  93. #define AUX_DISABLE_DEV 0xF5 /* Disable aux device */
  94. #define AUX_RESET 0xFF /* Reset aux device */
  95. #define AUX_ACK 0xFA /* Command byte ACK. */
  96. #define AUX_BUF_SIZE 2048 /* This might be better divisible by
  97. three to make overruns stay in sync
  98. but then the read function would need
  99. a lock etc - ick */
  100. #if 0
  101. struct aux_queue {
  102. unsigned long head;
  103. unsigned long tail;
  104. wait_queue_head_t proc_list;
  105. struct fasync_struct *fasync;
  106. unsigned char buf[AUX_BUF_SIZE];
  107. };
  108. #endif