xref: /illumos-gate/usr/src/boot/efi/include/Protocol/SimplePointer.h (revision f334afcfaebea1b7dc3430015651d8d748fa8a3e)
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 - 2018, Intel Corporation. All rights reserved.<BR>
7   SPDX-License-Identifier: BSD-2-Clause-Patent
8 
9 **/
10 
11 #ifndef __SIMPLE_POINTER_H__
12 #define __SIMPLE_POINTER_H__
13 
14 #define EFI_SIMPLE_POINTER_PROTOCOL_GUID \
15   { \
16     0x31878c87, 0xb75, 0x11d5, {0x9a, 0x4f, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
17   }
18 
19 typedef struct _EFI_SIMPLE_POINTER_PROTOCOL EFI_SIMPLE_POINTER_PROTOCOL;
20 
21 //
22 // Data structures
23 //
24 typedef struct {
25   ///
26   /// The signed distance in counts that the pointer device has been moved along the x-axis.
27   ///
28   INT32      RelativeMovementX;
29   ///
30   /// The signed distance in counts that the pointer device has been moved along the y-axis.
31   ///
32   INT32      RelativeMovementY;
33   ///
34   /// The signed distance in counts that the pointer device has been moved along the z-axis.
35   ///
36   INT32      RelativeMovementZ;
37   ///
38   /// If TRUE, then the left button of the pointer device is being
39   /// pressed. If FALSE, then the left button of the pointer device is not being pressed.
40   ///
41   BOOLEAN    LeftButton;
42   ///
43   /// If TRUE, then the right button of the pointer device is being
44   /// pressed. If FALSE, then the right button of the pointer device is not being pressed.
45   ///
46   BOOLEAN    RightButton;
47 } EFI_SIMPLE_POINTER_STATE;
48 
49 typedef struct {
50   ///
51   /// The resolution of the pointer device on the x-axis in counts/mm.
52   /// If 0, then the pointer device does not support an x-axis.
53   ///
54   UINT64     ResolutionX;
55   ///
56   /// The resolution of the pointer device on the y-axis in counts/mm.
57   /// If 0, then the pointer device does not support an x-axis.
58   ///
59   UINT64     ResolutionY;
60   ///
61   /// The resolution of the pointer device on the z-axis in counts/mm.
62   /// If 0, then the pointer device does not support an x-axis.
63   ///
64   UINT64     ResolutionZ;
65   ///
66   /// TRUE if a left button is present on the pointer device. Otherwise FALSE.
67   ///
68   BOOLEAN    LeftButton;
69   ///
70   /// TRUE if a right button is present on the pointer device. Otherwise FALSE.
71   ///
72   BOOLEAN    RightButton;
73 } EFI_SIMPLE_POINTER_MODE;
74 
75 /**
76   Resets the pointer device hardware.
77 
78   @param  This                  A pointer to the EFI_SIMPLE_POINTER_PROTOCOL
79                                 instance.
80   @param  ExtendedVerification  Indicates that the driver may perform a more exhaustive
81                                 verification operation of the device during reset.
82 
83   @retval EFI_SUCCESS           The device was reset.
84   @retval EFI_DEVICE_ERROR      The device is not functioning correctly and could not be reset.
85 
86 **/
87 typedef
88 EFI_STATUS
89 (EFIAPI *EFI_SIMPLE_POINTER_RESET)(
90   IN EFI_SIMPLE_POINTER_PROTOCOL            *This,
91   IN BOOLEAN                                ExtendedVerification
92   );
93 
94 /**
95   Retrieves the current state of a pointer device.
96 
97   @param  This                  A pointer to the EFI_SIMPLE_POINTER_PROTOCOL
98                                 instance.
99   @param  State                 A pointer to the state information on the pointer device.
100 
101   @retval EFI_SUCCESS           The state of the pointer device was returned in State.
102   @retval EFI_NOT_READY         The state of the pointer device has not changed since the last call to
103                                 GetState().
104   @retval EFI_DEVICE_ERROR      A device error occurred while attempting to retrieve the pointer device's
105                                 current state.
106 
107 **/
108 typedef
109 EFI_STATUS
110 (EFIAPI *EFI_SIMPLE_POINTER_GET_STATE)(
111   IN EFI_SIMPLE_POINTER_PROTOCOL          *This,
112   OUT EFI_SIMPLE_POINTER_STATE            *State
113   );
114 
115 ///
116 /// The EFI_SIMPLE_POINTER_PROTOCOL provides a set of services for a pointer
117 /// device that can use used as an input device from an application written
118 /// to this specification. The services include the ability to reset the
119 /// pointer device, retrieve get the state of the pointer device, and
120 /// retrieve the capabilities of the pointer device.
121 ///
122 struct _EFI_SIMPLE_POINTER_PROTOCOL {
123   EFI_SIMPLE_POINTER_RESET        Reset;
124   EFI_SIMPLE_POINTER_GET_STATE    GetState;
125   ///
126   /// Event to use with WaitForEvent() to wait for input from the pointer device.
127   ///
128   EFI_EVENT                       WaitForInput;
129   ///
130   /// Pointer to EFI_SIMPLE_POINTER_MODE data.
131   ///
132   EFI_SIMPLE_POINTER_MODE         *Mode;
133 };
134 
135 extern EFI_GUID  gEfiSimplePointerProtocolGuid;
136 
137 #endif
138