d5212071b96323b95750c2e6fc5d2d76301a90e0
[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(..., struct{int Ident;tKeybardCallback *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(..., struct{int AxisNum;int Value})\r
43          * \brief Set maximum value for sJoystick_Axis.CurState\r
44          */\r
45         JOY_IOCTL_SETAXISLIMIT,\r
46         \r
47         /**\r
48          * ioctl(..., struct{int AxisNum;int Value})\r
49          * \brief Set axis flags\r
50          */\r
51         JOY_IOCTL_SETAXISFLAGS,\r
52 \r
53         /**\r
54          * ioctl(..., struct{int ButtonNum;int Value})\r
55          * \brief Set Button Flags\r
56          */\r
57         JOY_IOCTL_SETBUTTONFLAGS,\r
58 };\r
59 \r
60 /**\r
61  * \brief Callback type for JOY_IOCTL_SETCALLBACK\r
62  * \param Ident Ident value passed to JOY_IOCTL_SETCALLBACK\r
63  * \r
64  */\r
65 typedef void (*tJoystickCallback)(int Ident, int bIsAxis, int Num, int Delta);\r
66 \r
67 /**\r
68  * \struct sJoystick_FileHeader\r
69  */\r
70 struct sJoystick_FileHeader\r
71 {\r
72         Uint16  NAxies;\r
73         Uint16  NButtons;\r
74 };\r
75 \r
76 struct sJoystick_Axis\r
77 {\r
78         Sint16  MinValue;\r
79         Sint16  MaxValue;\r
80         Sint16  CurValue;\r
81         Uint16  CurState;\r
82 };\r
83 \r
84 #endif\r

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