1 /** @file
2   Simple Pointer protocol from the UEFI 2.0 specification.
3 
4   Abstraction of a very simple pointer device like a mouse or trackball.
5 
6   Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
7   This program and the accompanying materials
8   are licensed and made available under the terms and conditions of the BSD License
9   which accompanies this distribution.  The full text of the license may be found at
10   http://opensource.org/licenses/bsd-license.php
11 
12   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 
15 **/
16 
17 #ifndef __SIMPLE_POINTER_H__
18 #define __SIMPLE_POINTER_H__
19 
20 #define EFI_SIMPLE_POINTER_PROTOCOL_GUID \
21   { \
22     0x31878c87, 0xb75, 0x11d5, {0x9a, 0x4f, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
23   }
24 
25 typedef struct _EFI_SIMPLE_POINTER_PROTOCOL  EFI_SIMPLE_POINTER_PROTOCOL;
26 
27 //
28 // Data structures
29 //
30 typedef struct {
31   ///
32   /// The signed distance in counts that the pointer device has been moved along the x-axis.
33   ///
34   INT32   RelativeMovementX;
35   ///
36   /// The signed distance in counts that the pointer device has been moved along the y-axis.
37   ///
38   INT32   RelativeMovementY;
39   ///
40   /// The signed distance in counts that the pointer device has been moved along the z-axis.
41   ///
42   INT32   RelativeMovementZ;
43   ///
44   /// If TRUE, then the left button of the pointer device is being
45   /// pressed. If FALSE, then the left button of the pointer device is not being pressed.
46   ///
47   BOOLEAN LeftButton;
48   ///
49   /// If TRUE, then the right button of the pointer device is being
50   /// pressed. If FALSE, then the right button of the pointer device is not being pressed.
51   ///
52   BOOLEAN RightButton;
53 } EFI_SIMPLE_POINTER_STATE;
54 
55 typedef struct {
56   ///
57   /// The resolution of the pointer device on the x-axis in counts/mm.
58   /// If 0, then the pointer device does not support an x-axis.
59   ///
60   UINT64  ResolutionX;
61   ///
62   /// The resolution of the pointer device on the y-axis in counts/mm.
63   /// If 0, then the pointer device does not support an x-axis.
64   ///
65   UINT64  ResolutionY;
66   ///
67   /// The resolution of the pointer device on the z-axis in counts/mm.
68   /// If 0, then the pointer device does not support an x-axis.
69   ///
70   UINT64  ResolutionZ;
71   ///
72   /// TRUE if a left button is present on the pointer device. Otherwise FALSE.
73   ///
74   BOOLEAN LeftButton;
75   ///
76   /// TRUE if a right button is present on the pointer device. Otherwise FALSE.
77   ///
78   BOOLEAN RightButton;
79 } EFI_SIMPLE_POINTER_MODE;
80 
81 /**
82   Resets the pointer device hardware.
83 
84   @param  This                  A pointer to the EFI_SIMPLE_POINTER_PROTOCOL
85                                 instance.
86   @param  ExtendedVerification  Indicates that the driver may perform a more exhaustive
87                                 verification operation of the device during reset.
88 
89   @retval EFI_SUCCESS           The device was reset.
90   @retval EFI_DEVICE_ERROR      The device is not functioning correctly and could not be reset.
91 
92 **/
93 typedef
94 EFI_STATUS
95 (EFIAPI *EFI_SIMPLE_POINTER_RESET)(
96   IN EFI_SIMPLE_POINTER_PROTOCOL            *This,
97   IN BOOLEAN                                ExtendedVerification
98   );
99 
100 /**
101   Retrieves the current state of a pointer device.
102 
103   @param  This                  A pointer to the EFI_SIMPLE_POINTER_PROTOCOL
104                                 instance.
105   @param  State                 A pointer to the state information on the pointer device.
106 
107   @retval EFI_SUCCESS           The state of the pointer device was returned in State.
108   @retval EFI_NOT_READY         The state of the pointer device has not changed since the last call to
109                                 GetState().
110   @retval EFI_DEVICE_ERROR      A device error occurred while attempting to retrieve the pointer device's
111                                 current state.
112 
113 **/
114 typedef
115 EFI_STATUS
116 (EFIAPI *EFI_SIMPLE_POINTER_GET_STATE)(
117   IN EFI_SIMPLE_POINTER_PROTOCOL          *This,
118   IN OUT EFI_SIMPLE_POINTER_STATE         *State
119   );
120 
121 ///
122 /// The EFI_SIMPLE_POINTER_PROTOCOL provides a set of services for a pointer
123 /// device that can use used as an input device from an application written
124 /// to this specification. The services include the ability to reset the
125 /// pointer device, retrieve get the state of the pointer device, and
126 /// retrieve the capabilities of the pointer device.
127 ///
128 struct _EFI_SIMPLE_POINTER_PROTOCOL {
129   EFI_SIMPLE_POINTER_RESET      Reset;
130   EFI_SIMPLE_POINTER_GET_STATE  GetState;
131   ///
132   /// Event to use with WaitForEvent() to wait for input from the pointer device.
133   ///
134   EFI_EVENT                     WaitForInput;
135   ///
136   /// Pointer to EFI_SIMPLE_POINTER_MODE data.
137   ///
138   EFI_SIMPLE_POINTER_MODE       *Mode;
139 };
140 
141 extern EFI_GUID gEfiSimplePointerProtocolGuid;
142 
143 #endif
144