xref: /freebsd/sys/contrib/edk2/Include/Protocol/AbsolutePointer.h (revision f439973d6726c3be929c8fb3b1545b8b1744abc3)
1*f439973dSWarner Losh /** @file
2*f439973dSWarner Losh   The file provides services that allow information about an
3*f439973dSWarner Losh   absolute pointer device to be retrieved.
4*f439973dSWarner Losh 
5*f439973dSWarner Losh   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
6*f439973dSWarner Losh   SPDX-License-Identifier: BSD-2-Clause-Patent
7*f439973dSWarner Losh 
8*f439973dSWarner Losh   @par Revision Reference:
9*f439973dSWarner Losh   This Protocol was introduced in UEFI Specification 2.3.
10*f439973dSWarner Losh 
11*f439973dSWarner Losh **/
12*f439973dSWarner Losh 
13*f439973dSWarner Losh #ifndef __ABSOLUTE_POINTER_H__
14*f439973dSWarner Losh #define __ABSOLUTE_POINTER_H__
15*f439973dSWarner Losh 
16*f439973dSWarner Losh #define EFI_ABSOLUTE_POINTER_PROTOCOL_GUID \
17*f439973dSWarner Losh   { 0x8D59D32B, 0xC655, 0x4AE9, { 0x9B, 0x15, 0xF2, 0x59, 0x04, 0x99, 0x2A, 0x43 } }
18*f439973dSWarner Losh 
19*f439973dSWarner Losh typedef struct _EFI_ABSOLUTE_POINTER_PROTOCOL EFI_ABSOLUTE_POINTER_PROTOCOL;
20*f439973dSWarner Losh 
21*f439973dSWarner Losh // *******************************************************
22*f439973dSWarner Losh // EFI_ABSOLUTE_POINTER_MODE
23*f439973dSWarner Losh // *******************************************************
24*f439973dSWarner Losh 
25*f439973dSWarner Losh /**
26*f439973dSWarner Losh   The following data values in the EFI_ABSOLUTE_POINTER_MODE
27*f439973dSWarner Losh   interface are read-only and are changed by using the appropriate
28*f439973dSWarner Losh   interface functions.
29*f439973dSWarner Losh **/
30*f439973dSWarner Losh typedef struct {
31*f439973dSWarner Losh   UINT64    AbsoluteMinX; ///< The Absolute Minimum of the device on the x-axis
32*f439973dSWarner Losh   UINT64    AbsoluteMinY; ///< The Absolute Minimum of the device on the y axis.
33*f439973dSWarner Losh   UINT64    AbsoluteMinZ; ///< The Absolute Minimum of the device on the z-axis
34*f439973dSWarner Losh   UINT64    AbsoluteMaxX; ///< The Absolute Maximum of the device on the x-axis. If 0, and the
35*f439973dSWarner Losh                           ///< AbsoluteMinX is 0, then the pointer device does not support a xaxis
36*f439973dSWarner Losh   UINT64    AbsoluteMaxY; ///< The Absolute Maximum of the device on the y -axis. If 0, and the
37*f439973dSWarner Losh                           ///< AbsoluteMinX is 0, then the pointer device does not support a yaxis.
38*f439973dSWarner Losh   UINT64    AbsoluteMaxZ; ///< The Absolute Maximum of the device on the z-axis. If 0 , and the
39*f439973dSWarner Losh                           ///< AbsoluteMinX is 0, then the pointer device does not support a zaxis
40*f439973dSWarner Losh   UINT32    Attributes;   ///< The following bits are set as needed (or'd together) to indicate the
41*f439973dSWarner Losh                           ///< capabilities of the device supported. The remaining bits are undefined
42*f439973dSWarner Losh                           ///< and should be 0
43*f439973dSWarner Losh } EFI_ABSOLUTE_POINTER_MODE;
44*f439973dSWarner Losh 
45*f439973dSWarner Losh ///
46*f439973dSWarner Losh /// If set, indicates this device supports an alternate button input.
47*f439973dSWarner Losh ///
48*f439973dSWarner Losh #define EFI_ABSP_SupportsAltActive  0x00000001
49*f439973dSWarner Losh 
50*f439973dSWarner Losh ///
51*f439973dSWarner Losh /// If set, indicates this device returns pressure data in parameter CurrentZ.
52*f439973dSWarner Losh ///
53*f439973dSWarner Losh #define EFI_ABSP_SupportsPressureAsZ  0x00000002
54*f439973dSWarner Losh 
55*f439973dSWarner Losh /**
56*f439973dSWarner Losh   This function resets the pointer device hardware. As part of
57*f439973dSWarner Losh   initialization process, the firmware/device will make a quick
58*f439973dSWarner Losh   but reasonable attempt to verify that the device is
59*f439973dSWarner Losh   functioning. If the ExtendedVerification flag is TRUE the
60*f439973dSWarner Losh   firmware may take an extended amount of time to verify the
61*f439973dSWarner Losh   device is operating on reset. Otherwise the reset operation is
62*f439973dSWarner Losh   to occur as quickly as possible. The hardware verification
63*f439973dSWarner Losh   process is not defined by this specification and is left up to
64*f439973dSWarner Losh   the platform firmware or driver to implement.
65*f439973dSWarner Losh 
66*f439973dSWarner Losh   @param This                 A pointer to the EFI_ABSOLUTE_POINTER_PROTOCOL
67*f439973dSWarner Losh                               instance.
68*f439973dSWarner Losh 
69*f439973dSWarner Losh   @param ExtendedVerification Indicates that the driver may
70*f439973dSWarner Losh                               perform a more exhaustive
71*f439973dSWarner Losh                               verification operation of the
72*f439973dSWarner Losh                               device during reset.
73*f439973dSWarner Losh 
74*f439973dSWarner Losh   @retval EFI_SUCCESS       The device was reset.
75*f439973dSWarner Losh 
76*f439973dSWarner Losh   @retval EFI_DEVICE_ERROR  The device is not functioning
77*f439973dSWarner Losh                             correctly and could not be reset.
78*f439973dSWarner Losh 
79*f439973dSWarner Losh **/
80*f439973dSWarner Losh typedef
81*f439973dSWarner Losh EFI_STATUS
82*f439973dSWarner Losh (EFIAPI *EFI_ABSOLUTE_POINTER_RESET)(
83*f439973dSWarner Losh   IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,
84*f439973dSWarner Losh   IN BOOLEAN                       ExtendedVerification
85*f439973dSWarner Losh   );
86*f439973dSWarner Losh 
87*f439973dSWarner Losh ///
88*f439973dSWarner Losh /// This bit is set if the touch sensor is active.
89*f439973dSWarner Losh ///
90*f439973dSWarner Losh #define EFI_ABSP_TouchActive  0x00000001
91*f439973dSWarner Losh 
92*f439973dSWarner Losh ///
93*f439973dSWarner Losh /// This bit is set if the alt sensor, such as pen-side button, is active
94*f439973dSWarner Losh ///
95*f439973dSWarner Losh #define EFI_ABS_AltActive  0x00000002
96*f439973dSWarner Losh 
97*f439973dSWarner Losh /**
98*f439973dSWarner Losh   Definition of EFI_ABSOLUTE_POINTER_STATE.
99*f439973dSWarner Losh **/
100*f439973dSWarner Losh typedef struct {
101*f439973dSWarner Losh   ///
102*f439973dSWarner Losh   /// The unsigned position of the activation on the x axis. If the AboluteMinX
103*f439973dSWarner Losh   /// and the AboluteMaxX fields of the EFI_ABSOLUTE_POINTER_MODE structure are
104*f439973dSWarner Losh   /// both 0, then this pointer device does not support an x-axis, and this field
105*f439973dSWarner Losh   /// must be ignored.
106*f439973dSWarner Losh   ///
107*f439973dSWarner Losh   UINT64    CurrentX;
108*f439973dSWarner Losh 
109*f439973dSWarner Losh   ///
110*f439973dSWarner Losh   /// The unsigned position of the activation on the y axis. If the AboluteMinY
111*f439973dSWarner Losh   /// and the AboluteMaxY fields of the EFI_ABSOLUTE_POINTER_MODE structure are
112*f439973dSWarner Losh   /// both 0, then this pointer device does not support an y-axis, and this field
113*f439973dSWarner Losh   /// must be ignored.
114*f439973dSWarner Losh   ///
115*f439973dSWarner Losh   UINT64    CurrentY;
116*f439973dSWarner Losh 
117*f439973dSWarner Losh   ///
118*f439973dSWarner Losh   /// The unsigned position of the activation on the z axis, or the pressure
119*f439973dSWarner Losh   /// measurement. If the AboluteMinZ and the AboluteMaxZ fields of the
120*f439973dSWarner Losh   /// EFI_ABSOLUTE_POINTER_MODE structure are both 0, then this pointer device
121*f439973dSWarner Losh   /// does not support an z-axis, and this field must be ignored.
122*f439973dSWarner Losh   ///
123*f439973dSWarner Losh   UINT64    CurrentZ;
124*f439973dSWarner Losh 
125*f439973dSWarner Losh   ///
126*f439973dSWarner Losh   /// Bits are set to 1 in this structure item to indicate that device buttons are
127*f439973dSWarner Losh   /// active.
128*f439973dSWarner Losh   ///
129*f439973dSWarner Losh   UINT32    ActiveButtons;
130*f439973dSWarner Losh } EFI_ABSOLUTE_POINTER_STATE;
131*f439973dSWarner Losh 
132*f439973dSWarner Losh /**
133*f439973dSWarner Losh   The GetState() function retrieves the current state of a pointer
134*f439973dSWarner Losh   device. This includes information on the active state associated
135*f439973dSWarner Losh   with the pointer device and the current position of the axes
136*f439973dSWarner Losh   associated with the pointer device. If the state of the pointer
137*f439973dSWarner Losh   device has not changed since the last call to GetState(), then
138*f439973dSWarner Losh   EFI_NOT_READY is returned. If the state of the pointer device
139*f439973dSWarner Losh   has changed since the last call to GetState(), then the state
140*f439973dSWarner Losh   information is placed in State, and EFI_SUCCESS is returned. If
141*f439973dSWarner Losh   a device error occurs while attempting to retrieve the state
142*f439973dSWarner Losh   information, then EFI_DEVICE_ERROR is returned.
143*f439973dSWarner Losh 
144*f439973dSWarner Losh 
145*f439973dSWarner Losh   @param This   A pointer to the EFI_ABSOLUTE_POINTER_PROTOCOL
146*f439973dSWarner Losh                 instance.
147*f439973dSWarner Losh 
148*f439973dSWarner Losh   @param State  A pointer to the state information on the
149*f439973dSWarner Losh                 pointer device.
150*f439973dSWarner Losh 
151*f439973dSWarner Losh   @retval EFI_SUCCESS       The state of the pointer device was
152*f439973dSWarner Losh                             returned in State.
153*f439973dSWarner Losh 
154*f439973dSWarner Losh   @retval EFI_NOT_READY     The state of the pointer device has not
155*f439973dSWarner Losh                             changed since the last call to GetState().
156*f439973dSWarner Losh 
157*f439973dSWarner Losh   @retval EFI_DEVICE_ERROR  A device error occurred while
158*f439973dSWarner Losh                             attempting to retrieve the pointer
159*f439973dSWarner Losh                             device's current state.
160*f439973dSWarner Losh 
161*f439973dSWarner Losh **/
162*f439973dSWarner Losh typedef
163*f439973dSWarner Losh EFI_STATUS
164*f439973dSWarner Losh (EFIAPI *EFI_ABSOLUTE_POINTER_GET_STATE)(
165*f439973dSWarner Losh   IN      EFI_ABSOLUTE_POINTER_PROTOCOL  *This,
166*f439973dSWarner Losh   OUT  EFI_ABSOLUTE_POINTER_STATE        *State
167*f439973dSWarner Losh   );
168*f439973dSWarner Losh 
169*f439973dSWarner Losh ///
170*f439973dSWarner Losh /// The EFI_ABSOLUTE_POINTER_PROTOCOL provides a set of services
171*f439973dSWarner Losh /// for a pointer device that can be used as an input device from an
172*f439973dSWarner Losh /// application written to this specification. The services include
173*f439973dSWarner Losh /// the ability to: reset the pointer device, retrieve the state of
174*f439973dSWarner Losh /// the pointer device, and retrieve the capabilities of the pointer
175*f439973dSWarner Losh /// device. The service also provides certain data items describing the device.
176*f439973dSWarner Losh ///
177*f439973dSWarner Losh struct _EFI_ABSOLUTE_POINTER_PROTOCOL {
178*f439973dSWarner Losh   EFI_ABSOLUTE_POINTER_RESET        Reset;
179*f439973dSWarner Losh   EFI_ABSOLUTE_POINTER_GET_STATE    GetState;
180*f439973dSWarner Losh   ///
181*f439973dSWarner Losh   /// Event to use with WaitForEvent() to wait for input from the pointer device.
182*f439973dSWarner Losh   ///
183*f439973dSWarner Losh   EFI_EVENT                         WaitForInput;
184*f439973dSWarner Losh   ///
185*f439973dSWarner Losh   /// Pointer to EFI_ABSOLUTE_POINTER_MODE data.
186*f439973dSWarner Losh   ///
187*f439973dSWarner Losh   EFI_ABSOLUTE_POINTER_MODE         *Mode;
188*f439973dSWarner Losh };
189*f439973dSWarner Losh 
190*f439973dSWarner Losh extern EFI_GUID  gEfiAbsolutePointerProtocolGuid;
191*f439973dSWarner Losh 
192*f439973dSWarner Losh #endif
193