logibusmouse.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:3k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. #ifndef _LINUX_BUSMOUSE_H
  2. #define _LINUX_BUSMOUSE_H
  3. /*
  4.  * linux/include/linux/busmouse.h: header file for Logitech Bus Mouse driver
  5.  * by James Banks
  6.  *
  7.  * based on information gleamed from various mouse drivers on the net
  8.  *
  9.  * Heavily modified by David giller (rafetmad@oxy.edu)
  10.  *
  11.  * Minor modifications for Linux 0.96c-pl1 by Nathan Laredo
  12.  * gt7080a@prism.gatech.edu (13JUL92)
  13.  *
  14.  * Microsoft BusMouse support by Teemu Rantanen (tvr@cs.hut.fi) (02AUG92)
  15.  *
  16.  * Microsoft Bus Mouse support modified by Derrick Cole (cole@concert.net)
  17.  *    8/28/92
  18.  *
  19.  * Microsoft Bus Mouse support folded into 0.97pl4 code
  20.  *    by Peter Cervasio (pete%q106fm.uucp@wupost.wustl.edu) (08SEP92)
  21.  * Changes:  Logitech and Microsoft support in the same kernel.
  22.  *           Defined new constants in busmouse.h for MS mice.
  23.  *           Added int mse_busmouse_type to distinguish busmouse types
  24.  *           Added a couple of new functions to handle differences in using
  25.  *             MS vs. Logitech (where the int variable wasn't appropriate).
  26.  *
  27.  */
  28. #define MOUSE_IRQ 5
  29. #define LOGITECH_BUSMOUSE       0   /* Minor device # for Logitech  */
  30. #define MICROSOFT_BUSMOUSE      2   /* Minor device # for Microsoft */
  31. /*--------- LOGITECH BUSMOUSE ITEMS -------------*/
  32. #define LOGIBM_BASE 0x23c
  33. #define MSE_DATA_PORT 0x23c
  34. #define MSE_SIGNATURE_PORT 0x23d
  35. #define MSE_CONTROL_PORT 0x23e
  36. #define MSE_INTERRUPT_PORT 0x23e
  37. #define MSE_CONFIG_PORT 0x23f
  38. #define LOGIBM_EXTENT 0x4
  39. #define MSE_ENABLE_INTERRUPTS 0x00
  40. #define MSE_DISABLE_INTERRUPTS 0x10
  41. #define MSE_READ_X_LOW 0x80
  42. #define MSE_READ_X_HIGH 0xa0
  43. #define MSE_READ_Y_LOW 0xc0
  44. #define MSE_READ_Y_HIGH 0xe0
  45. /* Magic number used to check if the mouse exists */
  46. #define MSE_CONFIG_BYTE 0x91
  47. #define MSE_DEFAULT_MODE 0x90
  48. #define MSE_SIGNATURE_BYTE 0xa5
  49. /* useful Logitech Mouse macros */
  50. #define MSE_INT_OFF() outb(MSE_DISABLE_INTERRUPTS, MSE_CONTROL_PORT)
  51. #define MSE_INT_ON() outb(MSE_ENABLE_INTERRUPTS, MSE_CONTROL_PORT)
  52. /*--------- MICROSOFT BUSMOUSE ITEMS -------------*/
  53. #define MSBM_BASE 0x23d
  54. #define MS_MSE_DATA_PORT         0x23d
  55. #define MS_MSE_SIGNATURE_PORT         0x23e
  56. #define MS_MSE_CONTROL_PORT         0x23c
  57. #define MS_MSE_CONFIG_PORT 0x23f
  58. #define MSBM_EXTENT 0x3
  59. #define MS_MSE_ENABLE_INTERRUPTS 0x11
  60. #define MS_MSE_DISABLE_INTERRUPTS 0x10
  61. #define MS_MSE_READ_BUTTONS             0x00
  62. #define MS_MSE_READ_X         0x01
  63. #define MS_MSE_READ_Y                   0x02
  64. #define MS_MSE_START                    0x80
  65. #define MS_MSE_COMMAND_MODE             0x07
  66. /* useful microsoft busmouse macros */
  67. #define MS_MSE_INT_OFF() {outb(MS_MSE_COMMAND_MODE, MS_MSE_CONTROL_PORT); 
  68.     outb(MS_MSE_DISABLE_INTERRUPTS, MS_MSE_DATA_PORT);}
  69. #define MS_MSE_INT_ON()  {outb(MS_MSE_COMMAND_MODE, MS_MSE_CONTROL_PORT); 
  70.     outb(MS_MSE_ENABLE_INTERRUPTS, MS_MSE_DATA_PORT);}
  71.  
  72. struct mouse_status {
  73. unsigned char buttons;
  74. unsigned char latch_buttons;
  75. int dx;
  76. int dy;
  77. int  present;
  78. int ready;
  79. int active;
  80. wait_queue_head_t wait;
  81. struct fasync_struct *fasyncptr;
  82. };
  83. /* Function Prototypes */
  84. #endif