kbm.h 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* keyboard/mouse not implemented yet */
  2. extern int cma_kbm_not_implemented;
  3. /**************** DEFINES for H8542B Keyboard/Mouse Controller ***************/
  4. /*
  5. * note the auxillary port is used to control the mouse
  6. */
  7. /* 8542B Commands (Sent to the Command Port) */
  8. #define HT8542_CMD_SET_BYTE 0x60 /* Set the command byte */
  9. #define HT8542_CMD_GET_BYTE 0x20 /* Get the command byte */
  10. #define HT8542_CMD_KBD_OBUFF 0xD2 /* Write to HT8542 Kbd Output Buffer */
  11. #define HT8542_CMD_AUX_OBUFF 0xD3 /* Write to HT8542 Mse Output Buffer */
  12. #define HT8542_CMD_AUX_WRITE 0xD4 /* Write to Mouse Port */
  13. #define HT8542_CMD_AUX_OFF 0xA7 /* Disable Mouse Port */
  14. #define HT8542_CMD_AUX_ON 0xA8 /* Re-Enable Mouse Port */
  15. #define HT8542_CMD_AUX_TEST 0xA9 /* Test for the presence of a Mouse */
  16. #define HT8542_CMD_DIAG 0xAA /* Start Diagnostics */
  17. #define HT8542_CMD_KBD_TEST 0xAB /* Test for presence of a keyboard */
  18. #define HT8542_CMD_KBD_OFF 0xAD /* Disable Kbd Port (use KBD_DAT_ON) */
  19. #define HT8542_CMD_KBD_ON 0xAE /* Enable Kbd Port (use KBD_DAT_OFF) */
  20. /* HT8542B cmd byte set by KBD_CMD_SET_BYTE and retrieved by KBD_CMD_GET_BYTE */
  21. #define HT8542_CMD_BYTE_TRANS 0x40
  22. #define HT8542_CMD_BYTE_AUX_OFF 0x20 /* 1 = mse port disabled, 0 = enabled */
  23. #define HT8542_CMD_BYTE_KBD_OFF 0x10 /* 1 = kbd port disabled, 0 = enabled */
  24. #define HT8542_CMD_BYTE_OVER 0x08 /* 1 = override keyboard lock */
  25. #define HT8542_CMD_BYTE_RES 0x04 /* reserved */
  26. #define HT8542_CMD_BYTE_AUX_INT 0x02 /* 1 = enable mouse interrupt */
  27. #define HT8542_CMD_BYTE_KBD_INT 0x01 /* 1 = enable keyboard interrupt */
  28. /* Keyboard Commands (Sent to the Data Port) */
  29. #define KBD_CMD_LED 0xED /* Set Keyboard LEDS with next byte */
  30. #define KBD_CMD_ECHO 0xEE /* Echo - we get 0xFA, 0xEE back */
  31. #define KBD_CMD_MODE 0xF0 /* set scan code mode with next byte */
  32. #define KBD_CMD_ID 0xF2 /* get keyboard/mouse ID */
  33. #define KBD_CMD_RPT 0xF3 /* Set Repeat Rate and Delay 2nd Byte */
  34. #define KBD_CMD_ON 0xF4 /* Enable keyboard */
  35. #define KBD_CMD_OFF 0xF5 /* Disables Scanning, Resets to Def */
  36. #define KBD_CMD_DEF 0xF6 /* Reverts kbd to default settings */
  37. #define KBD_CMD_RST 0xFF /* Reset - should get 0xFA, 0xAA back */
  38. /* Set LED second bit defines */
  39. #define KBD_CMD_LED_SCROLL 0x01 /* Set SCROLL LOCK LED on */
  40. #define KBD_CMD_LED_NUM 0x02 /* Set NUM LOCK LED on */
  41. #define KBD_CMD_LED_CAPS 0x04 /* Set CAPS LOCK LED on */
  42. /* Set Mode second byte defines */
  43. #define KBD_CMD_MODE_STAT 0x00 /* get current scan code mode */
  44. #define KBD_CMD_MODE_SCAN1 0x01 /* set mode to scan code 1 */
  45. #define KBD_CMD_MODE_SCAN2 0x02 /* set mode to scan code 2 */
  46. #define KBD_CMD_MODE_SCAN3 0x03 /* set mode to scan code 3 */
  47. /* Keyboard/Mouse ID Codes */
  48. #define KBD_CMD_ID_1ST 0xAB /* 1st byte is 0xAB, 2nd is actual ID */
  49. #define KBD_CMD_ID_KBD 0x83 /* Keyboard */
  50. #define KBD_CMD_ID_MOUSE 0x00 /* Mouse */
  51. /* Keyboard Data Return Defines */
  52. #define KBD_STAT_OVER 0x00 /* Buffer Overrun */
  53. #define KBD_STAT_DIAG_OK 0x55 /* Internal Self Test OK */
  54. #define KBD_STAT_RST_OK 0xAA /* Reset Complete */
  55. #define KBD_STAT_ECHO 0xEE /* Echo Command Return */
  56. #define KBD_STAT_BRK 0xF0 /* Prefix for Break Key Code */
  57. #define KBD_STAT_ACK 0xFA /* Received after all commands */
  58. #define KBD_STAT_DIAG_FAIL 0xFD /* Internal Self Test Failed */
  59. #define KBD_STAT_RESEND 0xFE /* Resend Last Command */
  60. /* HT8542B Status Register Bit Defines */
  61. #define HT8542_STAT_OBF 0x01 /* 1 = output buffer is full */
  62. #define HT8542_STAT_IBF 0x02 /* 1 = input buffer is full */
  63. #define HT8542_STAT_SYS 0x04 /* system flag - unused */
  64. #define HT8542_STAT_CMD 0x08 /* 1 = cmd in input buffer, 0 = data */
  65. #define HT8542_STAT_INH 0x10 /* 1 = Inhibit - unused */
  66. #define HT8542_STAT_TX 0x20 /* 1 = Transmit Timeout has occured */
  67. #define HT8542_STAT_RX 0x40 /* 1 = Receive Timeout has occured */
  68. #define HT8542_STAT_PERR 0x80 /* 1 = Parity Error from Keyboard */