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