]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.h
Clean up to update the reference of the these macros:
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbMouseDxe / UsbMouse.h
1 /** @file
2
3 Helper routine and corresponding data struct used by USB Mouse Driver.
4
5 Copyright (c) 2004 - 2008, Intel Corporation
6 All rights reserved. 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 _EFI_USB_MOUSE_H_
17 #define _EFI_USB_MOUSE_H_
18
19
20 #include <Uefi.h>
21
22 #include <Protocol/SimplePointer.h>
23 #include <Protocol/UsbIo.h>
24 #include <Protocol/DevicePath.h>
25
26 #include <Library/ReportStatusCodeLib.h>
27 #include <Library/BaseMemoryLib.h>
28 #include <Library/UefiDriverEntryPoint.h>
29 #include <Library/UefiBootServicesTableLib.h>
30 #include <Library/UefiLib.h>
31 #include <Library/MemoryAllocationLib.h>
32 #include <Library/PcdLib.h>
33 #include <Library/UefiUsbLib.h>
34
35 #include <IndustryStandard/Usb.h>
36
37 #define CLASS_HID 3
38 #define SUBCLASS_BOOT 1
39 #define PROTOCOL_MOUSE 2
40
41 #define BOOT_PROTOCOL 0
42 #define REPORT_PROTOCOL 1
43
44 #define USB_MOUSE_DEV_SIGNATURE SIGNATURE_32 ('u', 'm', 'o', 'u')
45
46 typedef struct {
47 BOOLEAN ButtonDetected;
48 UINT8 ButtonMinIndex;
49 UINT8 ButtonMaxIndex;
50 UINT8 Reserved;
51 } PRIVATE_DATA;
52
53 typedef struct {
54 UINTN Signature;
55 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
56 EFI_EVENT DelayedRecoveryEvent;
57 EFI_USB_IO_PROTOCOL *UsbIo;
58 EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDescriptor;
59 EFI_USB_ENDPOINT_DESCRIPTOR *IntEndpointDescriptor;
60 UINT8 NumberOfButtons;
61 INT32 XLogicMax;
62 INT32 XLogicMin;
63 INT32 YLogicMax;
64 INT32 YLogicMin;
65 EFI_SIMPLE_POINTER_PROTOCOL SimplePointerProtocol;
66 EFI_SIMPLE_POINTER_STATE State;
67 EFI_SIMPLE_POINTER_MODE Mode;
68 BOOLEAN StateChanged;
69 PRIVATE_DATA PrivateData;
70 EFI_UNICODE_STRING_TABLE *ControllerNameTable;
71 } USB_MOUSE_DEV;
72
73 #define USB_MOUSE_DEV_FROM_MOUSE_PROTOCOL(a) \
74 CR(a, USB_MOUSE_DEV, SimplePointerProtocol, USB_MOUSE_DEV_SIGNATURE)
75
76
77 /**
78 Timer handler for Delayed Recovery timer.
79
80 @param Event The Delayed Recovery event.
81 @param Context Points to the USB_KB_DEV instance.
82
83
84 **/
85 VOID
86 EFIAPI
87 USBMouseRecoveryHandler (
88 IN EFI_EVENT Event,
89 IN VOID *Context
90 );
91
92 //
93 // Global Variables
94 //
95 extern EFI_DRIVER_BINDING_PROTOCOL gUsbMouseDriverBinding;
96 extern EFI_COMPONENT_NAME_PROTOCOL gUsbMouseComponentName;
97 extern EFI_COMPONENT_NAME2_PROTOCOL gUsbMouseComponentName2;
98 extern EFI_GUID gEfiUsbMouseDriverGuid;
99
100
101 /**
102 Report Status Code in Usb Bot Driver.
103
104 @param DevicePath Use this to get Device Path
105 @param CodeType Status Code Type
106 @param CodeValue Status Code Value
107
108 @return None
109
110 **/
111 VOID
112 MouseReportStatusCode (
113 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
114 IN EFI_STATUS_CODE_TYPE CodeType,
115 IN EFI_STATUS_CODE_VALUE Value
116 );
117
118 /**
119 The USB Mouse driver entry pointer.
120
121 @param ImageHandle The driver image handle.
122 @param SystemTable The system table.
123
124 @return EFI_SUCCESS The component name protocol is installed.
125 @return Others Failed to init the usb driver.
126
127 **/
128 EFI_STATUS
129 EFIAPI
130 USBMouseDriverBindingEntryPoint (
131 IN EFI_HANDLE ImageHandle,
132 IN EFI_SYSTEM_TABLE *SystemTable
133 );
134
135 /**
136 Test to see if this driver supports ControllerHandle. Any ControllerHandle
137 that has UsbIoProtocol installed will be supported.
138
139 @param This Protocol instance pointer.
140 @param Controller Handle of device to test.
141 @param RemainingDevicePath Not used.
142
143 @retval EFI_SUCCESS This driver supports this device.
144 @retval EFI_UNSUPPORTED This driver does not support this device.
145
146 **/
147 EFI_STATUS
148 EFIAPI
149 USBMouseDriverBindingSupported (
150 IN EFI_DRIVER_BINDING_PROTOCOL *This,
151 IN EFI_HANDLE Controller,
152 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
153 );
154
155 /**
156 Starting the Usb Mouse Driver.
157
158 @param This Protocol instance pointer.
159 @param Controller Handle of device to test
160 @param RemainingDevicePath Not used
161
162 @retval EFI_SUCCESS This driver supports this device.
163 @retval EFI_UNSUPPORTED This driver does not support this device.
164 @retval EFI_DEVICE_ERROR This driver cannot be started due to device Error.
165 @retval EFI_OUT_OF_RESOURCES Can't allocate memory resources.
166 @retval EFI_ALREADY_STARTED Thios driver has been started.
167
168 **/
169 EFI_STATUS
170 EFIAPI
171 USBMouseDriverBindingStart (
172 IN EFI_DRIVER_BINDING_PROTOCOL *This,
173 IN EFI_HANDLE Controller,
174 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
175 );
176
177 /**
178 Stop this driver on ControllerHandle. Support stoping any child handles
179 created by this driver.
180
181 @param This Protocol instance pointer.
182 @param Controller Handle of device to stop driver on.
183 @param NumberOfChildren Number of Children in the ChildHandleBuffer.
184 @param ChildHandleBuffer List of handles for the children we need to stop.
185
186 @retval EFI_SUCCESS The controller or children are stopped.
187 @retval Other Failed to stop the driver.
188
189 **/
190 EFI_STATUS
191 EFIAPI
192 USBMouseDriverBindingStop (
193 IN EFI_DRIVER_BINDING_PROTOCOL *This,
194 IN EFI_HANDLE Controller,
195 IN UINTN NumberOfChildren,
196 IN EFI_HANDLE *ChildHandleBuffer
197 );
198
199 #endif