2 * \file tpl_drv_joystick
\r
3 * \brief Joystick Driver Interface Definitions
\r
4 * \author John Hodge (thePowersGang)
\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
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
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
19 #ifndef _TPL_JOYSTICK_H
\r
20 #define _TPL_JOYSTICK_H
\r
22 #include <tpl_drv_common.h>
\r
25 * \enum eTplJoystick_IOCtl
\r
26 * \brief Common Joystick IOCtl Calls
\r
27 * \extends eTplDrv_IOCtl
\r
29 enum eTplJoystick_IOCtl {
\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
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
39 JOY_IOCTL_SETCALLBACK = 4,
\r
42 * ioctl(..., struct{int AxisNum;int Value})
\r
43 * \brief Set maximum value for sJoystick_Axis.CurState
\r
44 * \note If \a Value is equal to -1 (all bits set), the value is not changed
\r
46 JOY_IOCTL_GETSETAXISLIMIT,
\r
49 * ioctl(..., struct{int AxisNum;int Value})
\r
50 * \brief Set axis flags
\r
51 * \note If \a Value is equal to -1 (all bits set), the value is not changed
\r
53 JOY_IOCTL_GETSETAXISFLAGS,
\r
56 * ioctl(..., struct{int ButtonNum;int Value})
\r
57 * \brief Set Button Flags
\r
58 * \note If \a Value is equal to -1 (all bits set), the value is not changed
\r
60 JOY_IOCTL_GETSETBUTTONFLAGS,
\r
64 * \brief Callback type for JOY_IOCTL_SETCALLBACK
\r
65 * \param Ident Ident value passed to JOY_IOCTL_SETCALLBACK
\r
68 typedef void (*tJoystickCallback)(int Ident, int bIsAxis, int Num, int Delta);
\r
71 * \struct sJoystick_FileHeader
\r
73 struct sJoystick_FileHeader
\r
75 Uint16 NAxies; //!< Number of Axies
\r
76 Uint16 NButtons; //!< Number of buttons
\r
80 * \brief Axis Definition
\r
82 * Describes the current state of an axis on the joystick.
\r
83 * \a MinValue and \a MaxValue describe the valid range for \a CurValue
\r
84 * While \a CurState is between zero and the current limit set by the
\r
85 * JOY_IOCTL_GETSETAXISLIMIT IOCtl.
\r
87 struct sJoystick_Axis
\r
89 Sint16 MinValue; //!< Minumum value for \a CurValue
\r
90 Sint16 MaxValue; //!< Maximum value for \a MaxValue
\r
91 Sint16 CurValue; //!< Current value (joystick position)
\r
92 Uint16 CurState; //!< Current state (cursor position)
\r