TianoCore EDK2 master
Loading...
Searching...
No Matches
UsbMouse.h
Go to the documentation of this file.
1
9#ifndef _EFI_USB_MOUSE_H_
10#define _EFI_USB_MOUSE_H_
11
12#include <Uefi.h>
13
15#include <Protocol/UsbIo.h>
16#include <Protocol/DevicePath.h>
17
22#include <Library/UefiLib.h>
24#include <Library/UefiUsbLib.h>
25#include <Library/DebugLib.h>
26
28
29#define CLASS_HID 3
30#define SUBCLASS_BOOT 1
31#define PROTOCOL_MOUSE 2
32
33#define BOOT_PROTOCOL 0
34#define REPORT_PROTOCOL 1
35
36#define USB_MOUSE_DEV_SIGNATURE SIGNATURE_32 ('u', 'm', 'o', 'u')
37
38//
39// A common header for usb standard descriptor.
40// Each stand descriptor has a length and type.
41//
42#pragma pack(1)
43typedef struct {
44 UINT8 Len;
45 UINT8 Type;
47#pragma pack()
48
52typedef struct {
53 BOOLEAN ButtonDetected;
54 UINT8 ButtonMinIndex;
55 UINT8 ButtonMaxIndex;
56 UINT8 Reserved;
58
62typedef struct {
63 UINTN Signature;
64 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
65 EFI_EVENT DelayedRecoveryEvent;
67 EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
68 EFI_USB_ENDPOINT_DESCRIPTOR IntEndpointDescriptor;
69 UINT8 NumberOfButtons;
70 INT32 XLogicMax;
71 INT32 XLogicMin;
72 INT32 YLogicMax;
73 INT32 YLogicMin;
74 EFI_SIMPLE_POINTER_PROTOCOL SimplePointerProtocol;
77 BOOLEAN StateChanged;
78 USB_MOUSE_BUTTON_DATA PrivateData;
79 EFI_UNICODE_STRING_TABLE *ControllerNameTable;
81
85
86typedef union {
87 UINT8 Uint8;
88 UINT16 Uint16;
89 UINT32 Uint32;
90 INT8 Int8;
91 INT16 Int16;
92 INT32 Int32;
93 UINT8 *LongData;
94} HID_DATA;
95
96typedef struct {
97 UINT16 Format;
98 UINT8 Size;
99 UINT8 Type;
100 UINT8 Tag;
101 HID_DATA Data;
102} HID_ITEM;
103
104#define USB_MOUSE_DEV_FROM_MOUSE_PROTOCOL(a) \
105 CR(a, USB_MOUSE_DEV, SimplePointerProtocol, USB_MOUSE_DEV_SIGNATURE)
106
107//
108// Global Variables
109//
110extern EFI_DRIVER_BINDING_PROTOCOL gUsbMouseDriverBinding;
111extern EFI_COMPONENT_NAME_PROTOCOL gUsbMouseComponentName;
112extern EFI_COMPONENT_NAME2_PROTOCOL gUsbMouseComponentName2;
113
114//
115// Functions of Driver Binding Protocol
116//
117
130EFIAPI
133 IN EFI_HANDLE Controller,
134 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
135 );
136
157EFIAPI
160 IN EFI_HANDLE Controller,
161 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
162 );
163
178EFIAPI
181 IN EFI_HANDLE Controller,
182 IN UINTN NumberOfChildren,
183 IN EFI_HANDLE *ChildHandleBuffer
184 );
185
186//
187// EFI Component Name Functions
188//
189
225EFIAPI
228 IN CHAR8 *Language,
229 OUT CHAR16 **DriverName
230 );
231
291EFIAPI
294 IN EFI_HANDLE ControllerHandle,
295 IN EFI_HANDLE ChildHandle OPTIONAL,
296 IN CHAR8 *Language,
297 OUT CHAR16 **ControllerName
298 );
299
300//
301// Functions of EFI_SIMPLE_POINTER_PROTOCOL
302//
303
319EFIAPI
322 OUT EFI_SIMPLE_POINTER_STATE *MouseState
323 );
324
337EFIAPI
340 IN BOOLEAN ExtendedVerification
341 );
342
350VOID
351EFIAPI
353 IN EFI_EVENT Event,
354 IN VOID *Context
355 );
356
357//
358// Internal worker functions
359//
360
370BOOLEAN
373 );
374
392 IN OUT USB_MOUSE_DEV *UsbMouseDev
393 );
394
413EFIAPI
415 IN VOID *Data,
416 IN UINTN DataLength,
417 IN VOID *Context,
418 IN UINT32 Result
419 );
420
434VOID
435EFIAPI
437 IN EFI_EVENT Event,
438 IN VOID *Context
439 );
440
459 OUT USB_MOUSE_DEV *UsbMouse,
460 IN UINT8 *ReportDescriptor,
461 IN UINTN ReportSize
462 );
463
464#endif
UINT64 UINTN
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
EFI_STATUS InitializeUsbMouseDevice(IN OUT USB_MOUSE_DEV *UsbMouseDev)
Definition: UsbMouse.c:537
EFI_STATUS EFIAPI USBMouseDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
Definition: UsbMouse.c:67
BOOLEAN IsUsbMouse(IN EFI_USB_IO_PROTOCOL *UsbIo)
EFI_STATUS EFIAPI OnMouseInterruptComplete(IN VOID *Data, IN UINTN DataLength, IN VOID *Context, IN UINT32 Result)
EFI_STATUS EFIAPI UsbMouseComponentNameGetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle OPTIONAL, IN CHAR8 *Language, OUT CHAR16 **ControllerName)
EFI_STATUS EFIAPI USBMouseDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
Definition: UsbMouse.c:395
VOID EFIAPI USBMouseRecoveryHandler(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS EFIAPI UsbMouseReset(IN EFI_SIMPLE_POINTER_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
Definition: UsbMouse.c:907
EFI_STATUS ParseMouseReportDescriptor(OUT USB_MOUSE_DEV *UsbMouse, IN UINT8 *ReportDescriptor, IN UINTN ReportSize)
Definition: MouseHid.c:242
VOID EFIAPI UsbMouseWaitForInput(IN EFI_EVENT Event, IN VOID *Context)
Definition: UsbMouse.c:943
EFI_STATUS EFIAPI USBMouseDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
Definition: UsbMouse.c:128
EFI_STATUS EFIAPI GetMouseState(IN EFI_SIMPLE_POINTER_PROTOCOL *This, OUT EFI_SIMPLE_POINTER_STATE *MouseState)
Definition: UsbMouse.c:856
EFI_STATUS EFIAPI UsbMouseComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
Definition: ComponentName.c:70