+++ /dev/null
-/**\r
- * \file api_drv_joystick\r
- * \brief Joystick Driver Interface Definitions\r
- * \author John Hodge (thePowersGang)\r
- * \r
- * \section dirs VFS Layout\r
- * Joystick drivers define a single VFS node, that acts as a fixed size file.\r
- * Reads from this file return the current state, writes are ignored.\r
- *\r
- * \section File Structure\r
- * The device file must begin with a valid sJoystick_FileHeader structure.\r
- * The file header is followed by \a NAxies instances of sJoystick_Axis, one\r
- * for each axis.\r
- * This is followed by \a NButtons boolean values (represented using \a Uint8),\r
- * each representing the state of a single button (where 0 is unpressed,\r
- * 0xFF is fully depressed - intermediate values are valid in the case of\r
- * variable-pressure buttons)\r
- */\r
-#ifndef _API_DRV_JOYSTICK_H\r
-#define _API_DRV_JOYSTICK_H\r
-\r
-#include <api_drv_common.h>\r
-\r
-/**\r
- * \enum eTplJoystick_IOCtl\r
- * \brief Common Joystick IOCtl Calls\r
- * \extends eTplDrv_IOCtl\r
- */\r
-enum eTplJoystick_IOCtl {\r
- /**\r
- * ioctl(..., tJoystick_Callback *Callback)\r
- * \brief Sets the callback\r
- * \note Can be called from kernel mode only\r
- *\r
- * Sets the callback that is called when a event occurs (button or axis\r
- * change). This function pointer must be in kernel mode (although,\r
- * kernel->user or kernel->ring3driver abstraction functions can be used)\r
- * \r
- * Axis events depend on the axis limit, if non-zero, the callback fires\r
- * if the cursor position changes. Otherwise it fires when the axis value\r
- * (cursor accelleration) changes.\r
- */\r
- JOY_IOCTL_SETCALLBACK = 4,\r
-\r
- /**\r
- * ioctl(..., int *Argument)\r
- * \brief Set the argument passed as the first parameter to the callback\r
- * \note Kernel mode only\r
- */\r
- JOY_IOCTL_SETCALLBACKARG,\r
-\r
- /**\r
- * ioctl(..., tJoystickNumValue *)\r
- * \brief Set maximum value for sJoystick_Axis.CurState\r
- * \note If \a Value is equal to -1 (all bits set), the value is not changed\r
- */\r
- JOY_IOCTL_GETSETAXISLIMIT,\r
-\r
- /**\r
- * ioctl(..., tJoystickNumValue *)\r
- * \brief Set the value of sJoystick_Axis.CurState\r
- * \note If \a Value is equal to -1 (all bits set), the value is not changed\r
- */\r
- JOY_IOCTL_GETSETAXISPOSITION,\r
- \r
- /**\r
- * ioctl(..., tJoystickNumValue *)\r
- * \brief Set axis flags\r
- * \note If \a Value is equal to -1 (all bits set), the value is not changed\r
- * \todo Define flag values\r
- */\r
- JOY_IOCTL_GETSETAXISFLAGS,\r
-\r
- /**\r
- * ioctl(..., tJoystickNumValue *)\r
- * \brief Set Button Flags\r
- * \note If \a Value is equal to -1 (all bits set), the value is not changed\r
- * \todo Define flag values\r
- */\r
- JOY_IOCTL_GETSETBUTTONFLAGS,\r
-};\r
-\r
-#define DRV_JOY_IOCTLNAMES "set_callback", "set_callback_arg", "getset_axis_limit", "getset_axis_position", \\r
- "getset_axis_flags", "getset_button_flags"\r
-\r
-// === TYPES ===\r
-typedef struct sJoystick_NumValue tJoystick_NumValue;\r
-typedef struct sJoystick_FileHeader tJoystick_FileHeader;\r
-typedef struct sJoystick_Axis tJoystick_Axis;\r
-\r
-/**\r
- * \brief Number/Value pair for joystick IOCtls\r
- */\r
-struct sJoystick_NumValue\r
-{\r
- int Num; //!< Axis/Button number\r
- int Value; //!< Value (see IOCtl defs for meaning)\r
-};\r
-\r
-/**\r
- * \brief Callback type for JOY_IOCTL_SETCALLBACK\r
- * \param Ident Ident value passed to JOY_IOCTL_SETCALLBACK\r
- * \r
- */\r
-typedef void (*tJoystick_Callback)(int Ident, int bIsAxis, int Num, int Delta);\r
-\r
-/**\r
- * \struct sJoystick_FileHeader\r
- */\r
-struct sJoystick_FileHeader\r
-{\r
- Uint16 NAxies; //!< Number of Axies\r
- Uint16 NButtons; //!< Number of buttons\r
-} PACKED;\r
-\r
-/**\r
- * \brief Axis Definition in file data\r
- *\r
- * Describes the current state of an axis on the joystick.\r
- * \a CursorPos is between zero and the current limit set by the\r
- * JOY_IOCTL_GETSETAXISLIMIT IOCtl, while \a CurValue indicates the\r
- * current position of the joystick axis. This is defined to be between\r
- * \a MinValue and \a MaxValue.\r
- */\r
-struct sJoystick_Axis\r
-{\r
- Sint16 MinValue; //!< Minumum value for \a CurValue\r
- Sint16 MaxValue; //!< Maximum value for \a CurValue\r
- Sint16 CurValue; //!< Current value (joystick position)\r
- Uint16 CursorPos; //!< Current state (cursor position)\r
-} PACKED;\r
-\r
-#define JOY_INFOSTRUCT(_naxies, _nbuttons) struct { \\r
- Uint16 NAxies, NButtons;\\r
- tJoystick_Axis Axies[_naxies];\\r
- Uint16 Buttons[_nbuttons];\\r
- }\r
-\r
-#endif\r