X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Finclude%2Ftpl_drv_joystick.h;h=06cdb23cb28caf6d0469601daae0aa8ecd2c3136;hb=425494c449d668bf4728eef3a45f890432fd9999;hp=d5212071b96323b95750c2e6fc5d2d76301a90e0;hpb=8e02a8c64e6c37e7a0a3b5d0bd3d2e2c8edefff0;p=tpg%2Facess2.git diff --git a/Kernel/include/tpl_drv_joystick.h b/Kernel/include/tpl_drv_joystick.h index d5212071..06cdb23c 100644 --- a/Kernel/include/tpl_drv_joystick.h +++ b/Kernel/include/tpl_drv_joystick.h @@ -28,7 +28,7 @@ */ enum eTplJoystick_IOCtl { /** - * ioctl(..., struct{int Ident;tKeybardCallback *Callback}) + * ioctl(..., tJoystickCallback *Callback) * \brief Sets the callback * \note Can be called from kernel mode only * @@ -39,22 +39,58 @@ enum eTplJoystick_IOCtl { JOY_IOCTL_SETCALLBACK = 4, /** - * ioctl(..., struct{int AxisNum;int Value}) + * ioctl(..., int *Argument) + * \brief Set the argument passed as the first parameter to the callback + * \note Kernel mode only + */ + JOY_IOCTL_SETCALLBACKARG, + + /** + * ioctl(..., tJoystickNumValue *) * \brief Set maximum value for sJoystick_Axis.CurState + * \note If \a Value is equal to -1 (all bits set), the value is not changed */ - JOY_IOCTL_SETAXISLIMIT, + JOY_IOCTL_GETSETAXISLIMIT, + + /** + * ioctl(..., tJoystickNumValue *) + * \brief Set the value of sJoystick_Axis.CurState + * \note If \a Value is equal to -1 (all bits set), the value is not changed + */ + JOY_IOCTL_GETSETAXISPOSITION, /** - * ioctl(..., struct{int AxisNum;int Value}) + * ioctl(..., tJoystickNumValue *) * \brief Set axis flags + * \note If \a Value is equal to -1 (all bits set), the value is not changed + * \todo Define flag values */ - JOY_IOCTL_SETAXISFLAGS, + JOY_IOCTL_GETSETAXISFLAGS, /** - * ioctl(..., struct{int ButtonNum;int Value}) + * ioctl(..., tJoystickNumValue *) * \brief Set Button Flags + * \note If \a Value is equal to -1 (all bits set), the value is not changed + * \todo Define flag values */ - JOY_IOCTL_SETBUTTONFLAGS, + JOY_IOCTL_GETSETBUTTONFLAGS, +}; + +#define DRV_JOY_IOCTLNAMES "set_callback", "set_callback_arg", "getset_axis_limit", "getset_axis_position", \ + "getset_axis_flags", "getset_button_flags" + +// === TYPES === +typedef struct sJoystick_NumValue tJoystick_NumValue; +typedef struct sJoystick_FileHeader tJoystick_FileHeader; +typedef struct sJoystick_Axis tJoystick_Axis; + +/** + * \brief Number/Value pair for joystick IOCtls + */ +struct sJoystick_NumValue +{ + int Num; //!< Axis/Button number + int Value; //!< Value (see IOCtl defs for meaning) }; /** @@ -62,23 +98,38 @@ enum eTplJoystick_IOCtl { * \param Ident Ident value passed to JOY_IOCTL_SETCALLBACK * */ -typedef void (*tJoystickCallback)(int Ident, int bIsAxis, int Num, int Delta); +typedef void (*tJoystick_Callback)(int Ident, int bIsAxis, int Num, int Delta); /** * \struct sJoystick_FileHeader */ struct sJoystick_FileHeader { - Uint16 NAxies; - Uint16 NButtons; + Uint16 NAxies; //!< Number of Axies + Uint16 NButtons; //!< Number of buttons }; +/** + * \brief Axis Definition in file data + * + * Describes the current state of an axis on the joystick. + * \a CursorPos is between zero and the current limit set by the + * JOY_IOCTL_GETSETAXISLIMIT IOCtl, while \a CurValue indicates the + * current position of the joystick axis. This is defined to be between + * \a MinValue and \a MaxValue. + */ struct sJoystick_Axis { - Sint16 MinValue; - Sint16 MaxValue; - Sint16 CurValue; - Uint16 CurState; + Sint16 MinValue; //!< Minumum value for \a CurValue + Sint16 MaxValue; //!< Maximum value for \a CurValue + Sint16 CurValue; //!< Current value (joystick position) + Uint16 CursorPos; //!< Current state (cursor position) }; +#define JOY_INFOSTRUCT(_naxies, _nbuttons) struct { \ + Uint16 NAxies, NButtons;\ + tJoystick_Axis Axies[_naxies];\ + Uint16 Buttons[_nbuttons];\ + } + #endif