Mouse driver and AxWin
[tpg/acess2.git] / Kernel / include / tpl_drv_joystick.h
1 /**\r
2  * \file tpl_drv_joystick\r
3  * \brief Joystick Driver Interface Definitions\r
4  * \author John Hodge (thePowersGang)\r
5  * \r
6  * \section dirs VFS Layout\r
7  * Joystick drivers define a single VFS node, that acts as a fixed size file.\r
8  * Reads from this file return the current state, writes are ignored.\r
9  *\r
10  * \section File Structure\r
11  * The device file must begin with a valid sJoystick_FileHeader structure.\r
12  * The file header is followed by \a NAxies instances of sJoystick_Axis, one\r
13  * for each axis.\r
14  * This is followed by \a NButtons boolean values (represented using \a Uint8),\r
15  * each representing the state of a single button (where 0 is unpressed,\r
16  * 0xFF is fully depressed - intermediate values are valid in the case of\r
17  * variable-pressure buttons)\r
18  */\r
19 #ifndef _TPL_JOYSTICK_H\r
20 #define _TPL_JOYSTICK_H\r
21 \r
22 #include <tpl_drv_common.h>\r
23 \r
24 /**\r
25  * \enum eTplJoystick_IOCtl\r
26  * \brief Common Joystick IOCtl Calls\r
27  * \extends eTplDrv_IOCtl\r
28  */\r
29 enum eTplJoystick_IOCtl {\r
30         /**\r
31          * ioctl(..., tJoystickCallback *Callback)\r
32          * \brief Sets the callback\r
33          * \note Can be called from kernel mode only\r
34          *\r
35          * Sets the callback that is called when a event occurs (button or axis\r
36          * change). This function pointer must be in kernel mode (although,\r
37          * kernel->user or kernel->ring3driver abstraction functions can be used)\r
38          */\r
39         JOY_IOCTL_SETCALLBACK = 4,\r
40 \r
41         /**\r
42          * ioctl(..., int *Argument)\r
43          * \brief Set the argument passed as the first parameter to the callback\r
44          * \note Kernel mode only\r
45          */\r
46         JOY_IOCTL_SETCALLBACKARG,\r
47 \r
48         /**\r
49          * ioctl(..., tJoystickNumValue *)\r
50          * \brief Set maximum value for sJoystick_Axis.CurState\r
51          * \note If \a Value is equal to -1 (all bits set), the value is not changed\r
52          */\r
53         JOY_IOCTL_GETSETAXISLIMIT,\r
54 \r
55         /**\r
56          * ioctl(..., tJoystickNumValue *)\r
57          * \brief Set the value of sJoystick_Axis.CurState\r
58          * \note If \a Value is equal to -1 (all bits set), the value is not changed\r
59          */\r
60         JOY_IOCTL_GETSETAXISPOSITION,\r
61         \r
62         /**\r
63          * ioctl(..., tJoystickNumValue *)\r
64          * \brief Set axis flags\r
65          * \note If \a Value is equal to -1 (all bits set), the value is not changed\r
66          */\r
67         JOY_IOCTL_GETSETAXISFLAGS,\r
68 \r
69         /**\r
70          * ioctl(..., tJoystickNumValue *)\r
71          * \brief Set Button Flags\r
72          * \note If \a Value is equal to -1 (all bits set), the value is not changed\r
73          */\r
74         JOY_IOCTL_GETSETBUTTONFLAGS,\r
75 };\r
76 \r
77 #define DRV_JOY_IOCTLNAMES      "set_callback", "set_callback_arg", "getset_axis_limit", "getset_axis_position", \\r
78         "getset_axis_flags", "getset_button_flags"\r
79 \r
80 // === TYPES ===\r
81 typedef struct sJoystick_NumValue       tJoystick_NumValue;\r
82 typedef struct sJoystick_FileHeader     tJoystick_FileHeader;\r
83 typedef struct sJoystick_Axis   tJoystick_Axis;\r
84 \r
85 /**\r
86  * \brief Number/Value pair for joystick IOCtls\r
87  */\r
88 struct sJoystick_NumValue\r
89 {\r
90          int    Num;    //!< Axis/Button number\r
91          int    Value;  //!< Value (see IOCtl defs for meaning)\r
92 };\r
93 \r
94 /**\r
95  * \brief Callback type for JOY_IOCTL_SETCALLBACK\r
96  * \param Ident Ident value passed to JOY_IOCTL_SETCALLBACK\r
97  * \r
98  */\r
99 typedef void (*tJoystick_Callback)(int Ident, int bIsAxis, int Num, int Delta);\r
100 \r
101 /**\r
102  * \struct sJoystick_FileHeader\r
103  */\r
104 struct sJoystick_FileHeader\r
105 {\r
106         Uint16  NAxies; //!< Number of Axies\r
107         Uint16  NButtons;       //!< Number of buttons\r
108 };\r
109 \r
110 /**\r
111  * \brief Axis Definition in file data\r
112  *\r
113  * Describes the current state of an axis on the joystick.\r
114  * \a MinValue and \a MaxValue describe the valid range for \a CurValue\r
115  * While \a CurState is between zero and the current limit set by the\r
116  * JOY_IOCTL_GETSETAXISLIMIT IOCtl.\r
117  */\r
118 struct sJoystick_Axis\r
119 {\r
120         Sint16  MinValue;       //!< Minumum value for \a CurValue\r
121         Sint16  MaxValue;       //!< Maximum value for \a CurValue\r
122         Sint16  CurValue;       //!< Current value (joystick position)\r
123         Uint16  CurState;       //!< Current state (cursor position)\r
124 };\r
125 \r
126 #endif\r

UCC git Repository :: git.ucc.asn.au