i8042.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:5k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* i8042.h - header file for the Intel 8042 Keyboard Controller */
  2. /* Copyright 1993-2001 Wind River System, Inc. */
  3. #include "copyright_wrs.h"
  4. /*
  5. modification history
  6. --------------------
  7. 01a,06dec01,jlb  written.
  8. DESCRIPTION
  9. This file contains the data structures and defines used to manipulate the
  10. Intel 8042 keyboard/mouse driver chip.
  11. */
  12. #ifndef __INCi8042h
  13. #define __INCi8042h
  14. #include "tyLib.h"
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. /* status register defines */
  19. #define I8042_KBD_OBFULL      0x01  /* output buffer full (data from keyboard) */
  20. #define I8042_KBD_IBFULL      0x02  /* input buffer full (data to keyboard) */
  21. #define I8042_KBD_SYSFLAG     0x04  /* system flag (0 power on reset, 1 st ok) */
  22. #define I8042_KBD_CD          0x08  /* cmd/data (0 data wt on 60, 1 cmd on 64 */
  23. #define I8042_KBD_KEYL        0x10  /* lock status (0 locked, 1 free) */
  24. #define I8042_KBD_AUXB        0x20  /* aux device (0 keyboard data, 1 aux data)*/
  25. #define I8042_KBD_RXTO        0x40  /* General timeout */
  26. #define I8042_KBD_PARERR      0x80  /* Parity error */
  27. /* configuration defines */
  28. #define I8042_KBD_INT         0x01  /* Enable keyboard interrupts */
  29. #define I8042_KBD_AUX_INT     0x02  /* Enable aux device interrupts */
  30. #define I8042_KBD_OFF         0x10  /* Turn keyboard off */
  31. #define I8042_KBD_XT          0x20  /* XT Scan codes */
  32. #define I8042_KBD_AT_TO_XT    0x40  /* Convert AT scan codes to XT scan codes */
  33. /* 8042 command defines */
  34. #define I8042_KBD_RD_CONFIG   0x20  /* Read the configuration byte */
  35. #define I8042_KBD_WT_CONFIG   0x60  /* Write the configuration byte */
  36. #define I8042_KBD_DISABLE_AUX 0xA7  /* Disable aux device */
  37. #define I8042_KBD_ENABLE_AUX  0xA8  /* Enable aux device */
  38. #define I8042_KBD_IF_AUX_TEST 0xA9  /* Perform aux interface test */
  39. #define I8042_KBD_SELF_TEST   0xAA  /* Perform keyboard self test */
  40. #define I8042_KBD_IF_TEST     0xAB  /* Perform keyboard interface test */
  41. #define I8042_KBD_ENABLE      0xAE  /* Enable keyboard (sets bit 4 of config) */
  42. #define I8042_KBD_DISABLE     0xAD  /* Disable I8042_KBD (resets bit 4 of config) */
  43. #define I8042_KBD_WT_AUX      0xD4  /* Write next data to aux device */
  44. /* 8042 command results */
  45. #define I8042_KBD_IF_OK       0x00  /* Clock and data lines are ok */
  46. #define I8042_KBD_IF_CLKL     0x01  /* Clock line stuck low */
  47. #define I8042_KBD_IF_CLKH     0x02  /* Clock line stuck high */
  48. #define I8042_KBD_IF_DATAL    0x03  /* Data line stuck low */
  49. #define I8042_KBD_IF_DATAH    0x04  /* Data line stuck high */
  50. #define I8042_KBD_SF_OK       0x55  /* Passed self test */
  51. #define I8042_KBD_NO_DEV      0xFF  /* No aux device */
  52. /* keyboard command defines */
  53. #define I8042_KBD_LED_CMD     0xED  /* Set LED command */
  54. #define I8042_KBD_ECHO_CMD    0xEE  /* Echo (returns 0xee) */
  55. #define I8042_KBD_SC_CMD      0xF0  /* Set/Identify scan code */
  56. #define I8042_KBD_ID_CMD      0xF2  /* Get keyboard id code */
  57. #define I8042_KBD_RATE_CMD    0xF3  /* Set repetition and delay rates */
  58. #define I8042_KBD_ENABLE_CMD  0xF4  /* Enable keyboard */
  59. #define I8042_KBD_STDDIS_CMD  0xF5  /* Standard Disable  */
  60. #define I8042_KBD_STDEN_CMD   0xF6  /* Standard Enable   */
  61. #define I8042_KBD_RESEND_CMD  0xFE  /* Resend last character */
  62. #define I8042_KBD_RESET_CMD   0xFF  /* Reset keyboard */
  63. /* keyboard command returns */
  64. #define I8042_KBD_BAT_OK      0xAA  /* BAT Complete code  */
  65. #define I8042_KBD_CMD_ACK     0xFA  /* Command Acknowledge */
  66. #define I8042_KBD_BAT_ERROR   0xFC  /* BAT Error code */
  67. /* LED defines */
  68. #define I8042_KBD_LED_SCROLL  0x01   /* Scroll LED */
  69. #define I8042_KBD_LED_NUMLOCK 0x02   /* Num Lock LED */
  70. #define I8042_KBD_LED_CAPLOCK 0x04   /* Caps Lock LED */
  71. /* ps2 mouse command defines */
  72. #define I8042_KBDM_SR_CMD     0xE8  /* Mouse set resolution */
  73. #define I8042_KBDM_DS_CMD     0xE9  /* Mouse Determine status */
  74. #define I8042_KBDM_SS_CMD     0xF3  /* Mouse set sample rate */
  75. #define I8042_KBDM_ENABLE_CMD 0xF4  /* Mouse enable */
  76. #define I8042_KBDM_DIS_CMD    0xF5  /* Mouse disable */
  77. #define I8042_KBDM_SETS_CMD   0xF6  /* Mouse set standard */
  78. #define I8042_KBDM_RESEND_CMD 0xFE  /* Mouse resend last packet */
  79. #define I8042_KBDM_RESET_CMD  0xFF  /* Mouse reset */
  80. /* ps2 mouse command returns */
  81. #define I8042_KBDM_ID         0x00  /* Mouse identification */
  82. #define I8042_KBDM_ACK        0xFA  /* Command Acknowledge */
  83. #define I8042_KBDM_RESEND     0xFE  /* Resend Request */
  84. /* musc definitions */
  85. #define I8042_READ_DELAY       100  /* Maximum wait time for keyboard */
  86. #define I8042_WAIT_SEC           2  /* Time to wait for command completion */
  87. /*  Register definitions */         
  88. #define I8042_DATA               0  /* Data regsiter offset */
  89. #define I8042_STAT_CMD           1  /* Status/Command regsiter offset */
  90. /* Register access method, these may be overriden within the BSP config.h file */
  91. #ifndef I8042_KBD_OUT
  92. #define I8042_KBD_OUT sysOutByte    /* Routine to call for output */
  93. #define I8042_KBD_IN  sysInByte     /* Routine to call for input */
  94. #endif /* KBD_OUT */
  95. /* Mouse device control structure */
  96. typedef struct
  97.     {
  98.     TY_DEV          ty_dev;
  99.     WINDML_DEVICE * pDev;
  100.     ULONG           dataReg;
  101.     ULONG           statCmdReg;
  102.     } I8042_MSE_DEVICE;
  103. /* keyboard device descriptor */
  104. typedef struct
  105.     {
  106.     TY_DEV          tyDev;
  107.     WINDML_DEVICE * pDev;
  108.     UINT16          kbdFlags;   
  109.     ULONG           oldLedStat;
  110.     ULONG           dataReg;
  111.     ULONG           statCmdReg;
  112.     } I8042_KBD_DEVICE;
  113. #ifdef __cplusplus
  114. }
  115. #endif
  116. #endif  /* __INCi8042h */