i8042.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #ifndef _I8042_H
  2. #define _I8042_H
  3. /*
  4. * Copyright (c) 1999-2002 Vojtech Pavlik
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License version 2 as published by
  8. * the Free Software Foundation.
  9. */
  10. /*
  11. * Arch-dependent inline functions and defines.
  12. */
  13. #if defined(CONFIG_MACH_JAZZ)
  14. #include "i8042-jazzio.h"
  15. #elif defined(CONFIG_SGI_IP22)
  16. #include "i8042-ip22io.h"
  17. #elif defined(CONFIG_PPC)
  18. #include "i8042-ppcio.h"
  19. #elif defined(CONFIG_SPARC)
  20. #include "i8042-sparcio.h"
  21. #elif defined(CONFIG_X86) || defined(CONFIG_IA64)
  22. #include "i8042-x86ia64io.h"
  23. #else
  24. #include "i8042-io.h"
  25. #endif
  26. /*
  27. * This is in 50us units, the time we wait for the i8042 to react. This
  28. * has to be long enough for the i8042 itself to timeout on sending a byte
  29. * to a non-existent mouse.
  30. */
  31. #define I8042_CTL_TIMEOUT 10000
  32. /*
  33. * Status register bits.
  34. */
  35. #define I8042_STR_PARITY 0x80
  36. #define I8042_STR_TIMEOUT 0x40
  37. #define I8042_STR_AUXDATA 0x20
  38. #define I8042_STR_KEYLOCK 0x10
  39. #define I8042_STR_CMDDAT 0x08
  40. #define I8042_STR_MUXERR 0x04
  41. #define I8042_STR_IBF 0x02
  42. #define I8042_STR_OBF 0x01
  43. /*
  44. * Control register bits.
  45. */
  46. #define I8042_CTR_KBDINT 0x01
  47. #define I8042_CTR_AUXINT 0x02
  48. #define I8042_CTR_IGNKEYLOCK 0x08
  49. #define I8042_CTR_KBDDIS 0x10
  50. #define I8042_CTR_AUXDIS 0x20
  51. #define I8042_CTR_XLATE 0x40
  52. /*
  53. * Commands.
  54. */
  55. #define I8042_CMD_CTL_RCTR 0x0120
  56. #define I8042_CMD_CTL_WCTR 0x1060
  57. #define I8042_CMD_CTL_TEST 0x01aa
  58. #define I8042_CMD_KBD_DISABLE 0x00ad
  59. #define I8042_CMD_KBD_ENABLE 0x00ae
  60. #define I8042_CMD_KBD_TEST 0x01ab
  61. #define I8042_CMD_KBD_LOOP 0x11d2
  62. #define I8042_CMD_AUX_DISABLE 0x00a7
  63. #define I8042_CMD_AUX_ENABLE 0x00a8
  64. #define I8042_CMD_AUX_TEST 0x01a9
  65. #define I8042_CMD_AUX_SEND 0x10d4
  66. #define I8042_CMD_AUX_LOOP 0x11d3
  67. #define I8042_CMD_MUX_PFX 0x0090
  68. #define I8042_CMD_MUX_SEND 0x1090
  69. /*
  70. * Return codes.
  71. */
  72. #define I8042_RET_CTL_TEST 0x55
  73. /*
  74. * Expected maximum internal i8042 buffer size. This is used for flushing
  75. * the i8042 buffers.
  76. */
  77. #define I8042_BUFFER_SIZE 16
  78. /*
  79. * Number of AUX ports on controllers supporting active multiplexing
  80. * specification
  81. */
  82. #define I8042_NUM_MUX_PORTS 4
  83. /*
  84. * Debug.
  85. */
  86. #ifdef DEBUG
  87. static unsigned long i8042_start_time;
  88. #define dbg_init() do { i8042_start_time = jiffies; } while (0)
  89. #define dbg(format, arg...) \
  90. do { \
  91. if (i8042_debug) \
  92. printk(KERN_DEBUG __FILE__ ": " format " [%d]\n" , \
  93. ## arg, (int) (jiffies - i8042_start_time)); \
  94. } while (0)
  95. #else
  96. #define dbg_init() do { } while (0)
  97. #define dbg(format, arg...) do {} while (0)
  98. #endif
  99. #endif /* _I8042_H */