Modules/SB16 - Stub driver, nowhere near complete
[tpg/acess2.git] / Kernel / include / tpl_drv_joystick.h
index d521207..2f4249b 100644 (file)
  */\r
 enum eTplJoystick_IOCtl {\r
        /**\r
-        * ioctl(..., struct{int Ident;tKeybardCallback *Callback})\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(..., struct{int AxisNum;int Value})\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_SETAXISLIMIT,\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(..., struct{int AxisNum;int Value})\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_SETAXISFLAGS,\r
+       JOY_IOCTL_GETSETAXISFLAGS,\r
 \r
        /**\r
-        * ioctl(..., struct{int ButtonNum;int Value})\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_SETBUTTONFLAGS,\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
@@ -62,23 +102,38 @@ enum eTplJoystick_IOCtl {
  * \param Ident        Ident value passed to JOY_IOCTL_SETCALLBACK\r
  * \r
  */\r
-typedef void (*tJoystickCallback)(int Ident, int bIsAxis, int Num, int Delta);\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;\r
-       Uint16  NButtons;\r
+       Uint16  NAxies; //!< Number of Axies\r
+       Uint16  NButtons;       //!< Number of buttons\r
 };\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;\r
-       Sint16  MaxValue;\r
-       Sint16  CurValue;\r
-       Uint16  CurState;\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
 };\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

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