/**/ /***************************************************************************/ /** **/ /** © Copyright 2010, Hewlett-Packard Development Company, L.P. **/ /** **/ /** Confidential computer software. Valid license from HP and/or **/ /** its subsidiaries required for possession, use, or copying. **/ /** **/ /** Consistent with FAR 12.211 and 12.212, Commercial Computer Software, **/ /** Computer Software Documentation, and Technical Data for Commercial **/ /** Items are licensed to the U.S. Government under vendor's standard **/ /** commercial license. **/ /** **/ /** Neither HP nor any of its subsidiaries shall be liable for technical **/ /** or editorial errors or omissions contained herein. The information **/ /** in this document is provided "as is" without warranty of any kind and **/ /** is subject to change without notice. The warranties for HP products **/ /** are set forth in the express limited warranty statements accompanying **/ /** such products. Nothing herein should be construed as constituting an **/ /** additional warranty. **/ /** **/ /***************************************************************************/ /********************************************************************************************************************************/ /* Created: 30-Mar-2010 16:33:52 by OpenVMS SDL EV3-3 */ /* Source: 03-AUG-2005 10:13:04 $1$DGA7374:[USB.SRC]AGDEF.SDL;1 */ /********************************************************************************************************************************/ /*** MODULE AGDEF ***/ #ifndef __AGDEF_LOADED #define __AGDEF_LOADED 1 #pragma __nostandard /* This file uses non-ANSI-Standard features */ #pragma __member_alignment __save #pragma __nomember_alignment #ifdef __INITIAL_POINTER_SIZE /* Defined whenever ptr size pragmas supported */ #pragma __required_pointer_size __save /* Save the previously-defined required ptr size */ #pragma __required_pointer_size __short /* And set ptr size default to 32-bit pointers */ #endif #ifdef __cplusplus extern "C" { #define __unknown_params ... #define __optional_params ... #else #define __unknown_params #define __optional_params ... #endif #ifndef __struct #if !defined(__VAXC) #define __struct struct #else #define __struct variant_struct #endif #endif #ifndef __union #if !defined(__VAXC) #define __union union #else #define __union variant_union #endif #endif /* */ /* AGDRIVER supports the following function codes: */ /* */ /* IO$_READVBLK Read virtual block */ /* IO$_READLBLK Read logical block */ /* IO$_READPBLK Read physical block */ /* */ /* p1 Address of data buffer */ /* p2 Size of buffer in bytes */ /* */ /* Read formated data from the device driver makes no distinction */ /* between Virtual, Logical and physical I/O requests. The */ /* data structure JOYSTICK_INPUT_FRAME defines the size and */ /* format of the data. Applications should check the type and */ /* version number to make sure they are reading and decoding the */ /* data correctly. */ /* */ /* IO$_WRITEVBLK Write virtual block */ /* IO$_WRITELBLK Write logical block */ /* IO$_WRITEPBLCK Write physical block */ /* */ /* p1 Address of data buffer to write */ /* p2 Size in bytes */ /* */ /* This command will support writing a block of bytes to the joystick it */ /* the device supports it. If the driver does not support it you will get */ /* an error of SS$_UNSPPORTED. The user should assume that the data has */ /* been sent when control is returned. The actual write may be in transit */ /* and repeated attempts to write data without allowing time for the */ /* device to respond will result in the last write being honored. The */ /* driver supports message in flight to the device and one pending. */ /* */ /* IO$_SETMODE IO FUNCTION CODES (in P1) */ /* */ /* p1 Function code */ /* */ /* JOYSTICK_IO_SET_EFN_NOTIFY = 1 */ /* - P2 = EFN number */ /* */ /* JOYSTICK_IO_SET_AST_NOTIFY = 2 */ /* - P3 = AST routine address */ /* */ /* JOYSTICK_IO_SET_ASTEFN_NOTIFY = 3 */ /* - P2 = EFN number */ /* - P3 = AST routine address */ /* */ /* JOYSTICK_IO_CLEAR_EFN_NOTIFY = 16 */ /* JOYSTICK_IO_CLEAR_AST_NOTIFY = 32 */ /* JOYSTICK_IO_CLEAR_ALL_NOTIFY = 48 */ /* */ /* JOYSTICK_IO_SET_CALIBRATION_DATA = 256 */ /* - P2 = Structure length */ /* - P3 = Limit data structure address */ /* */ /* p2 EFN number */ /* LIMIT Data length */ /* */ /* p3 AST routine address */ /* LIMIT Data address */ /* */ /* p4 ast parameter */ /* */ /* p5 mode, default = PSL$C_USER */ /* */ /* p6 Not used */ /* */ /* P1 determines the type of operation. Motion/Button state change */ /* notification can be done via AST or by EFN. These can be set and */ /* cleared individually, or at the same time (you can't clear one and */ /* set the other in the same IO function call). */ /* */ /* SET_CALIBRATION_DATA takes a JOYSTICK_LIMIT_DATA structure address */ /* as input in P3 and the length in P2. The calibration fields in */ /* the per-axis structures are copied if the valid bit is set. This */ /* will be returned to the user in the SENSEMODE IO call. */ /* */ #define JOYSTICK_IO_NOOP 0 #define JOYSTICK_IO_SET_EFN_NOTIFY 1 #define JOYSTICK_IO_SET_AST_NOTIFY 2 #define JOYSTICK_IO_SET_ASTEFN_NOTIFY 3 #define JOYSTICK_IO_CLEAR_EFN_NOTIFY 16 #define JOYSTICK_IO_CLEAR_AST_NOTIFY 32 #define JOYSTICK_IO_CLEAR_ALL_NOTIFY 48 #define JOYSTICK_IO_SET_CALIBRATION_DATA 256 /* */ /* Currently we will only sense limit data */ /* */ #define JOYSTICK_IO_SENSE_LIMIT_DATA 1 #define MAX_JOYSTICK_BUTTONS 64 #define MAX_JOYSTICK_XYZH 32 #define JOYSTICK_INPUT_FRAME_TYPE 5 #define JOYSTICK_INPUT_FRAME_VERSION 4 #define JOYSTICK_INPUT_FRAME_MINOR_REV 1 /* */ /* This structure provides input data from the device */ /* */ /* Buttons are aggregated into a longword */ /* */ /* Axis and Hat switches are returned in integer arrays, */ /* since there can potentially be multiple instances of */ /* an Axis type. */ /* */ /* A timestamp is provided by storing the value of */ /* EXE$GQ_SYSTIME when the event is being generated. */ /* This allows the user to do motion calculations */ /* and acelleration if they want. */ /* */ /* To interpret the data, you first should do a sensemode */ /* to get the limit data (see below) which will then provide */ /* a way to interpret the data. */ /* */ /* No attempt is made to normalize or massage the data in */ /* the driver, except for the aggregation of individual */ /* button reports into a single field. Nothing that the */ /* driver might do would be the "right" thing for all apps, */ /* and by doing anything, some apps might not be able to */ /* do what they need. Nor is any time wasted in providing */ /* both normalized and raw data - since the application will */ /* have all it needs to simply normalize the data itself. */ /* */ /* NOTE: Signed values in all the fields will be sign */ /* extended to 32-bits for convenience. This doesn't */ /* change the data (the original data can still be masked */ /* out of the reported data) - but makes library code */ /* conversions slighly simpler. */ /* */ /* A version value is included for checking for incompatable */ /* changes, and a minor ident handles compatable changes */ /* */ /* */ typedef struct _joystick_input_frame { int size; int type; int version; int minor; int vendor_id; /* USB vendor ID */ int product_id; /* USB product ID */ unsigned __int64 timestamp; /* VMS time for event */ unsigned __int64 button_state; /* Button State Aggregate */ int hat [32]; /* Hat switch */ int x [32]; /* X */ int y [32]; /* Y */ int z [32]; /* Z */ int rx [32]; /* Rotational X */ int ry [32]; /* Rotational Y */ int rz [32]; /* Rotational Z */ int vx [32]; /* Vector X */ int vy [32]; /* Vector Y */ int vz [32]; /* Vector Z */ int vbrx [32]; /* Vector Base Relative X */ int vbry [32]; /* Vector Base Relative Y */ int vbrz [32]; /* Vector Base Relative Z */ int vno [32]; /* Non Directional Vector */ int slider [32]; /* Slider Control */ int dial [32]; /* Dial Control */ int wheel [32]; /* Wheel Control */ int extras [64]; /* Some extra space for expansion later */ } JOYSTICK_INPUT_FRAME; #define JOYSTICK_BASE_FRAME_SIZE 2472 #define JOYSTICK_MAX_FRAME_SIZE 4944 /* */ /* This structure describes an Axis or Hat switch. */ /* */ /* A count describe how many instances of the Axis type */ /* exist. The rest of the data each is an array to allow */ /* each instance to be described. */ /* */ /* The flag word provides fine grain detail about which */ /* fields in the axis data are valid. A field that is */ /* not reported returns a -1. But since some of the */ /* fields are user-settable, or might be ambiguous (like */ /* a sign extended logical/physical value) - applications */ /* or library code can use this to determine which fields */ /* it can rely on. */ /* */ /* The values returned are desribed by the min/max/size */ /* fields which provide the logical min, logical max, and */ /* size in bits of the field. So a 10 bit axis would have */ /* min = 0, max = 1023, size = 10 - for data thaat responds */ /* with unsigned data. It also could have -511, 511, 10 for */ /* signed return values. This descibes the data that will */ /* actually be returned in the frame data report (above). */ /* */ /* Calibration data is provided here. Normally the data is */ /* zero in the driver, and is set by a SETMODE by an */ /* application to provide the end application/library the */ /* information to compensate for devices (typically analog */ /* inputs) which are "off" at their center points and at */ /* their full range of travel. The input data (logical */ /* value) can then be adjusted. The driver makes no attempt */ /* to do this, and leaves this to application/library code */ /* to handle. */ /* */ /* Physical min/max and unit/unit exponent: */ /* */ /* See 6.2.2.7 of the HID 1.11 spec for specifics on physical */ /* logical, and unit calculations. */ /* */ /* Resolution = (Logical_Max - Logical_Min) / */ /* (Physical_Max - Physical_Min) * (10 ** Unit_Exponent) */ /* */ /* If I read the table correctly (and it is far from clearly */ /* stated) the UNIT is determined by viewing the low order */ /* 4 bits as the SYSTEM and the upper 4 bits to derive a */ /* description of the physical units. With the system codes */ /* 0x5 - 0xE having special meanings, and 0xF being vendor */ /* defined. */ /* */ /* Note that PHYSICAL and UNIT/UNIT_E values are optional */ /* and may be zero. */ /* */ /* */ typedef struct _joystick_axis_instance { unsigned int flags; /* Axis flags */ int min; /* Logical minimum */ int max; /* Logical maximum */ int size; /* Bit field size */ int pmin; /* Physical minimum */ int pmax; /* Physical maximum */ int unit; /* Units code */ int unit_e; /* Unit exponent */ int center_off; /* Calibration center offset */ int cmin; /* Calibration min */ int cmax; /* Calibration max */ } JOYSTICK_AXIS_INSTANCE; /* */ /* Flag bits */ /* */ /* Note that min/max/size are always valid for a valid axis */ /* Axes are always populated from 0 to MAX_JOYSTICK_XYZH so */ /* there is no need to explicitly indicate an axis is valid */ /* A non-zero count makes axes 0 through (count-1) valid. */ /* */ #define JOYSTICK_AXIS_SIGNED 1 /* Axis returns signed data */ #define JOYSTICK_AXIS_PMIN_VALID 16 /* PHYSICAL MIN Valid */ #define JOYSTICK_AXIS_PMAX_VALID 32 /* PHYSICAL MAX Valid */ #define JOYSTICK_AXIS_UNIT_VALID 64 /* UNIT Valid */ #define JOYSTICK_AXIS_UNIT_E_VALID 128 /* UNIT EXPONENT Valid */ #define JOYSTICK_AXIS_CENTER_OFF_VALID 256 /* CENTER OFFSET Valid */ #define JOYSTICK_AXIS_CMIN_VALID 512 /* CALIBRATION MIN Valid */ #define JOYSTICK_AXIS_CMAX_VALID 1024 /* CALIBRATION MAX Valid */ /* */ /* The complete structure is an array of axes and */ /* the count */ /* */ typedef struct _joystick_axis_info { int count; /* Number of valid axes */ JOYSTICK_AXIS_INSTANCE axis [32]; } JOYSTICK_AXIS_INFO; #define JOYSTICK_LIMIT_DATA_TYPE 6 #define JOYSTICK_LIMIT_DATA_VERSION 4 #define JOYSTICK_LIMIT_DATA_MINOR_REV 1 /* */ /* This structure describes the parts of the joystick/gamepad */ /* For Axis and Hat switches, there is a structure that contains */ /* the number of instances, and then arrays for each instance */ /* that contain the length of the field in bits, the logical */ /* and physical limits of the device, the units code, and the */ /* units exponent (which can be used to turn a logical value */ /* into something meaningful, like 10 degrees, or 3 inches, */ /* or 42 grams). */ /* */ /* Buttons in the data field are aggregated and packed into */ /* a longword and the count is provided here. */ /* */ /* The number of available axes are also provided as a */ /* shortcut to having to go through each axis to add the */ /* counts. */ /* */ /* The vendor and product ID is provided for special casing */ /* devices in code */ /* */ /* The version/minor codes allow for detection of binary */ /* incompatable versions, as well as upward binary compatable */ /* feature additions. Additional cells are provided at the */ /* end for use by extended features (when they are used, and */ /* the first part of the structure is unmodified, roll the */ /* minor version value). */ /* */ /* Lastly, there is a minimal section for potential user */ /* writes to the device. It is generalized, so the caller */ /* has to know about the USB device and HID/USB requests. */ /* */ #define JOYSTICK_OUTPUT_AVAILABLE 1 #define JOYSTICK_OUTPUT_NOTAVAILABLE 0 typedef struct _joystick_limit_data { int size; int type; int version; int minor; int vendor_id; int product_id; unsigned __int64 button_valid; /* Bits that are valid */ int button_count; /* Number of buttons */ int num_axes; /* Number of Axes */ JOYSTICK_AXIS_INFO hat; /* Hat switch */ JOYSTICK_AXIS_INFO x; /* X Axis */ JOYSTICK_AXIS_INFO y; /* Y Axis */ JOYSTICK_AXIS_INFO z; /* Z Axis */ JOYSTICK_AXIS_INFO rx; /* RX Axis */ JOYSTICK_AXIS_INFO ry; /* RY Axis */ JOYSTICK_AXIS_INFO rz; /* RZ Axis */ JOYSTICK_AXIS_INFO vx; /* VX Axis */ JOYSTICK_AXIS_INFO vy; /* VY Axis */ JOYSTICK_AXIS_INFO vz; /* VZ Axis */ JOYSTICK_AXIS_INFO vbrx; /* VBRX Axis */ JOYSTICK_AXIS_INFO vbry; /* VBRY Axis */ JOYSTICK_AXIS_INFO vbrz; /* VBRZ Axis */ JOYSTICK_AXIS_INFO vno; /* VNO Axis */ JOYSTICK_AXIS_INFO slider; /* SLIDER */ JOYSTICK_AXIS_INFO wheel; /* WHEEL */ JOYSTICK_AXIS_INFO dial; /* DIAL */ int extras_longs [32]; /** */ /** */ /** This section reports a minimum of data for devices that support */ /** output. So far in our limited testing all output devices are vendor */ /** specific. So for the time being we will just report the useage page */ /** type and the maximum number of bytes that can be sent down the pipe. */ /** */ /** Note that usage page values from ff00 - ffff are vendor */ /** defined. */ /** */ /** */ int output_available; int output_max_bytes; int output_item_usage_page; } JOYSTICK_LIMIT_DATA; #define JOYSTICK_LIMIT_DATA_SIZE 24184 #pragma __member_alignment __restore #ifdef __INITIAL_POINTER_SIZE /* Defined whenever ptr size pragmas supported */ #pragma __required_pointer_size __restore /* Restore the previously-defined required ptr size */ #endif #ifdef __cplusplus } #endif #pragma __standard #endif /* __AGDEF_LOADED */