home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / Drivers / joystick-0.0-I / linux / joystick.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-07  |  2.1 KB  |  56 lines

  1. #ifndef _LINUX_JOYSTICK_H
  2. #define _LINUX_JOYSTICK_H
  3.  
  4. #define JS_RETURN sizeof(struct JS_DATA_TYPE)    /*number of bytes returned by js_read*/
  5. #define JS_TRUE 1
  6. #define JS_FALSE 0
  7. #define JS_PORT 0x201        /*io port for joystick operations*/
  8. #define JS_DEF_TIMEOUT 0x1300    /*default timeout value for js_read()*/
  9. #define JS_DEF_CORR    0    /*default correction factor*/
  10. #define JS_DEF_TIMELIMIT 10L    /*default data valid time =10 jiffies == 100ms*/
  11. #define JS_X_0    0x01        /*bit mask for x-axis js0*/
  12. #define JS_Y_0    0x02        /*bit mask for y-axis js0*/
  13. #define JS_X_1    0x04        /*bit mask for x-axis js1*/
  14. #define JS_Y_1    0x08        /*bit mask for y-axis js1*/
  15. #define JS_MAX 2        /*Max number of joysticks*/
  16. #define PIT_MODE 0x43        /*io port for timer 0*/
  17. #define PIT_COUNTER_0 0x40    /*io port for timer 0*/
  18. #define JS_SET_CAL 0x01        /*ioctl cmd to set joystick correction factor*/
  19. #define JS_GET_CAL 0x02        /*ioctl cmd to get joystick correction factor*/
  20. #define JS_SET_TIMEOUT 0x03    /*ioctl cmd to set maximum number of iterations
  21.                   to wait for a timeout*/
  22. #define JS_GET_TIMEOUT        0x04    /*as above, to get*/
  23. #define JS_SET_TIMELIMIT    0x05    /*set data retention time*/
  24. #define JS_GET_TIMELIMIT    0x06    /*get data retention time*/
  25. #define JS_GET_ALL        0x07    /*get the whole JS_DATA[minor] struct*/
  26. #define JS_SET_ALL        0x08    /*set the whole JS_DATA[minor] struct
  27.                           except JS_BUSY!*/
  28.  
  29. /*This union is used for the ioctl to set the scaling factor and to return
  30.   the current values for a joystick. 'buttons' is ignored on the ioctl call*/
  31.  
  32. struct JS_DATA_TYPE {
  33.     int buttons;
  34.     int x;
  35.     int y;
  36. };
  37.  
  38. /* This struct is used for misc data about the joystick*/
  39. struct JS_DATA_SAVE_TYPE {
  40.     int JS_TIMEOUT;        /*timeout*/
  41.     int BUSY;        /*joystick is in use*/
  42.     long JS_EXPIRETIME;    /*Time when stick after which stick must be re-read*/
  43.     long JS_TIMELIMIT;    /*Max time before data is invalid*/
  44.     struct JS_DATA_TYPE JS_SAVE;    /*last read data*/
  45.     struct JS_DATA_TYPE JS_CORR;    /*correction factor*/
  46. };
  47.  
  48. #define LATCH (1193180L/HZ)    /*initial timer 0 value*/
  49. #define DELTA_TIME(X,Y) ((X)-(Y)+(((X)>=(Y))?0:LATCH))
  50. #define CURRENT_JIFFIES (jiffies)
  51.  
  52. // #define JOYSTICK_MAJOR        15
  53. #define JOYSTICK_MAJOR        113
  54.  
  55. #endif /* _LINUX_JOYSTICK_H */
  56.