]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Move some definitions defined in USB spec and HID Spec from Library/Usblib.h to Indus...
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 17 Jul 2007 10:09:51 +0000 (10:09 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 17 Jul 2007 10:09:51 +0000 (10:09 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3300 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Include/IndustryStandard/Usb.h
MdePkg/Include/Library/UsbLib.h

index e37389151adc83ded26a8f5c1faf89dfad705dc0..333bb67e2ee36a696d83ba7ccf004a3d51d4e43c 100644 (file)
 #ifndef __USB_H__\r
 #define __USB_H__\r
 \r
+//\r
+// Standard device request and request type\r
+// By [Spec-USB20/Chapter-9.4]\r
+//\r
+#define USB_DEV_GET_STATUS                  0x00\r
+#define USB_DEV_GET_STATUS_REQ_TYPE_D       0x80 // Receiver : Device\r
+#define USB_DEV_GET_STATUS_REQ_TYPE_I       0x81 // Receiver : Interface\r
+#define USB_DEV_GET_STATUS_REQ_TYPE_E       0x82 // Receiver : Endpoint\r
+\r
+#define USB_DEV_CLEAR_FEATURE               0x01\r
+#define USB_DEV_CLEAR_FEATURE_REQ_TYPE_D    0x00 // Receiver : Device\r
+#define USB_DEV_CLEAR_FEATURE_REQ_TYPE_I    0x01 // Receiver : Interface\r
+#define USB_DEV_CLEAR_FEATURE_REQ_TYPE_E    0x02 // Receiver : Endpoint\r
+\r
+#define USB_DEV_SET_FEATURE                 0x03\r
+#define USB_DEV_SET_FEATURE_REQ_TYPE_D      0x00 // Receiver : Device\r
+#define USB_DEV_SET_FEATURE_REQ_TYPE_I      0x01 // Receiver : Interface\r
+#define USB_DEV_SET_FEATURE_REQ_TYPE_E      0x02 // Receiver : Endpoint\r
+\r
+#define USB_DEV_SET_ADDRESS                 0x05\r
+#define USB_DEV_SET_ADDRESS_REQ_TYPE        0x00\r
+\r
+#define USB_DEV_GET_DESCRIPTOR              0x06\r
+#define USB_DEV_GET_DESCRIPTOR_REQ_TYPE     0x80\r
+\r
+#define USB_DEV_SET_DESCRIPTOR              0x07\r
+#define USB_DEV_SET_DESCRIPTOR_REQ_TYPE     0x00\r
+\r
+#define USB_DEV_GET_CONFIGURATION           0x08\r
+#define USB_DEV_GET_CONFIGURATION_REQ_TYPE  0x80\r
+\r
+#define USB_DEV_SET_CONFIGURATION           0x09\r
+#define USB_DEV_SET_CONFIGURATION_REQ_TYPE  0x00\r
+\r
+#define USB_DEV_GET_INTERFACE               0x0A\r
+#define USB_DEV_GET_INTERFACE_REQ_TYPE      0x81\r
+\r
+#define USB_DEV_SET_INTERFACE               0x0B\r
+#define USB_DEV_SET_INTERFACE_REQ_TYPE      0x01\r
+\r
+#define USB_DEV_SYNCH_FRAME                 0x0C\r
+#define USB_DEV_SYNCH_FRAME_REQ_TYPE        0x82\r
 \r
 //\r
 // Definitions defined in UEFI spec\r
@@ -221,4 +263,125 @@ enum {
   //\r
   EFI_USB_INTERRUPT_DELAY = 2000000,\r
 };\r
+\r
+\r
+//\r
+// HID constants definition, see HID rev1.0\r
+//\r
+\r
+//\r
+// HID report item format\r
+//\r
+#define HID_ITEM_FORMAT_SHORT 0\r
+#define HID_ITEM_FORMAT_LONG  1\r
+\r
+//\r
+// Special tag indicating long items\r
+//\r
+#define HID_ITEM_TAG_LONG 15\r
+\r
+//\r
+// HID report descriptor item type (prefix bit 2,3)\r
+//\r
+#define HID_ITEM_TYPE_MAIN      0\r
+#define HID_ITEM_TYPE_GLOBAL    1\r
+#define HID_ITEM_TYPE_LOCAL     2\r
+#define HID_ITEM_TYPE_RESERVED  3\r
+\r
+//\r
+// HID report descriptor main item tags\r
+//\r
+#define HID_MAIN_ITEM_TAG_INPUT             8\r
+#define HID_MAIN_ITEM_TAG_OUTPUT            9\r
+#define HID_MAIN_ITEM_TAG_FEATURE           11\r
+#define HID_MAIN_ITEM_TAG_BEGIN_COLLECTION  10\r
+#define HID_MAIN_ITEM_TAG_END_COLLECTION    12\r
+\r
+//\r
+// HID report descriptor main item contents\r
+//\r
+#define HID_MAIN_ITEM_CONSTANT      0x001\r
+#define HID_MAIN_ITEM_VARIABLE      0x002\r
+#define HID_MAIN_ITEM_RELATIVE      0x004\r
+#define HID_MAIN_ITEM_WRAP          0x008\r
+#define HID_MAIN_ITEM_NONLINEAR     0x010\r
+#define HID_MAIN_ITEM_NO_PREFERRED  0x020\r
+#define HID_MAIN_ITEM_NULL_STATE    0x040\r
+#define HID_MAIN_ITEM_VOLATILE      0x080\r
+#define HID_MAIN_ITEM_BUFFERED_BYTE 0x100\r
+\r
+//\r
+// HID report descriptor collection item types\r
+//\r
+#define HID_COLLECTION_PHYSICAL     0\r
+#define HID_COLLECTION_APPLICATION  1\r
+#define HID_COLLECTION_LOGICAL      2\r
+\r
+//\r
+// HID report descriptor global item tags\r
+//\r
+#define HID_GLOBAL_ITEM_TAG_USAGE_PAGE        0\r
+#define HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM   1\r
+#define HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM   2\r
+#define HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM  3\r
+#define HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM  4\r
+#define HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT     5\r
+#define HID_GLOBAL_ITEM_TAG_UNIT              6\r
+#define HID_GLOBAL_ITEM_TAG_REPORT_SIZE       7\r
+#define HID_GLOBAL_ITEM_TAG_REPORT_ID         8\r
+#define HID_GLOBAL_ITEM_TAG_REPORT_COUNT      9\r
+#define HID_GLOBAL_ITEM_TAG_PUSH              10\r
+#define HID_GLOBAL_ITEM_TAG_POP               11\r
+\r
+//\r
+// HID report descriptor local item tags\r
+//\r
+#define HID_LOCAL_ITEM_TAG_USAGE              0\r
+#define HID_LOCAL_ITEM_TAG_USAGE_MINIMUM      1\r
+#define HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM      2\r
+#define HID_LOCAL_ITEM_TAG_DESIGNATOR_INDEX   3\r
+#define HID_LOCAL_ITEM_TAG_DESIGNATOR_MINIMUM 4\r
+#define HID_LOCAL_ITEM_TAG_DESIGNATOR_MAXIMUM 5\r
+#define HID_LOCAL_ITEM_TAG_STRING_INDEX       7\r
+#define HID_LOCAL_ITEM_TAG_STRING_MINIMUM     8\r
+#define HID_LOCAL_ITEM_TAG_STRING_MAXIMUM     9\r
+#define HID_LOCAL_ITEM_TAG_DELIMITER          10\r
+\r
+//\r
+// HID report types\r
+//\r
+#define HID_INPUT_REPORT    1\r
+#define HID_OUTPUT_REPORT   2\r
+#define HID_FEATURE_REPORT  3\r
+\r
+//\r
+// HID class protocol request\r
+//\r
+#define EFI_USB_GET_REPORT_REQUEST    0x01\r
+#define EFI_USB_GET_IDLE_REQUEST      0x02\r
+#define EFI_USB_GET_PROTOCOL_REQUEST  0x03\r
+#define EFI_USB_SET_REPORT_REQUEST    0x09\r
+#define EFI_USB_SET_IDLE_REQUEST      0x0a\r
+#define EFI_USB_SET_PROTOCOL_REQUEST  0x0b\r
+\r
+#pragma pack(1)\r
+//\r
+// Descriptor header for Report/Physical Descriptors\r
+//\r
+typedef struct hid_class_descriptor {\r
+  UINT8   DescriptorType;\r
+  UINT16  DescriptorLength;\r
+} EFI_USB_HID_CLASS_DESCRIPTOR;\r
+\r
+typedef struct hid_descriptor {\r
+  UINT8                         Length;\r
+  UINT8                         DescriptorType;\r
+  UINT16                        BcdHID;\r
+  UINT8                         CountryCode;\r
+  UINT8                         NumDescriptors;\r
+  EFI_USB_HID_CLASS_DESCRIPTOR  HidClassDesc[1];\r
+} EFI_USB_HID_DESCRIPTOR;\r
+\r
+#pragma pack()\r
+\r
 #endif\r
index 1438328c9bdc2450fa7a2d0088c088b37751f651..fc01e7d1c43edfd20e18f0f03ea4f5244da67237 100644 (file)
 \r
 #include <Protocol/UsbIo.h>\r
 \r
-//\r
-// Standard device request and request type\r
-// By [Spec-USB20/Chapter-9.4]\r
-//\r
-#define USB_DEV_GET_STATUS                  0x00\r
-#define USB_DEV_GET_STATUS_REQ_TYPE_D       0x80 // Receiver : Device\r
-#define USB_DEV_GET_STATUS_REQ_TYPE_I       0x81 // Receiver : Interface\r
-#define USB_DEV_GET_STATUS_REQ_TYPE_E       0x82 // Receiver : Endpoint\r
-\r
-#define USB_DEV_CLEAR_FEATURE               0x01\r
-#define USB_DEV_CLEAR_FEATURE_REQ_TYPE_D    0x00 // Receiver : Device\r
-#define USB_DEV_CLEAR_FEATURE_REQ_TYPE_I    0x01 // Receiver : Interface\r
-#define USB_DEV_CLEAR_FEATURE_REQ_TYPE_E    0x02 // Receiver : Endpoint\r
-\r
-#define USB_DEV_SET_FEATURE                 0x03\r
-#define USB_DEV_SET_FEATURE_REQ_TYPE_D      0x00 // Receiver : Device\r
-#define USB_DEV_SET_FEATURE_REQ_TYPE_I      0x01 // Receiver : Interface\r
-#define USB_DEV_SET_FEATURE_REQ_TYPE_E      0x02 // Receiver : Endpoint\r
-\r
-#define USB_DEV_SET_ADDRESS                 0x05\r
-#define USB_DEV_SET_ADDRESS_REQ_TYPE        0x00\r
-\r
-#define USB_DEV_GET_DESCRIPTOR              0x06\r
-#define USB_DEV_GET_DESCRIPTOR_REQ_TYPE     0x80\r
-\r
-#define USB_DEV_SET_DESCRIPTOR              0x07\r
-#define USB_DEV_SET_DESCRIPTOR_REQ_TYPE     0x00\r
-\r
-#define USB_DEV_GET_CONFIGURATION           0x08\r
-#define USB_DEV_GET_CONFIGURATION_REQ_TYPE  0x80\r
-\r
-#define USB_DEV_SET_CONFIGURATION           0x09\r
-#define USB_DEV_SET_CONFIGURATION_REQ_TYPE  0x00\r
-\r
-#define USB_DEV_GET_INTERFACE               0x0A\r
-#define USB_DEV_GET_INTERFACE_REQ_TYPE      0x81\r
-\r
-#define USB_DEV_SET_INTERFACE               0x0B\r
-#define USB_DEV_SET_INTERFACE_REQ_TYPE      0x01\r
-\r
-#define USB_DEV_SYNCH_FRAME                 0x0C\r
-#define USB_DEV_SYNCH_FRAME_REQ_TYPE        0x82\r
-\r
 //\r
 // define the timeout time as 3ms\r
 //\r
 #define TIMEOUT_VALUE 3 * 1000\r
 \r
-//\r
-// HID constants definition, see HID rev1.0\r
-//\r
-//\r
-// HID report item format\r
-//\r
-#define HID_ITEM_FORMAT_SHORT 0\r
-#define HID_ITEM_FORMAT_LONG  1\r
-\r
-//\r
-// Special tag indicating long items\r
-//\r
-#define HID_ITEM_TAG_LONG 15\r
-\r
-//\r
-// HID report descriptor item type (prefix bit 2,3)\r
-//\r
-#define HID_ITEM_TYPE_MAIN      0\r
-#define HID_ITEM_TYPE_GLOBAL    1\r
-#define HID_ITEM_TYPE_LOCAL     2\r
-#define HID_ITEM_TYPE_RESERVED  3\r
-\r
-//\r
-// HID report descriptor main item tags\r
-//\r
-#define HID_MAIN_ITEM_TAG_INPUT             8\r
-#define HID_MAIN_ITEM_TAG_OUTPUT            9\r
-#define HID_MAIN_ITEM_TAG_FEATURE           11\r
-#define HID_MAIN_ITEM_TAG_BEGIN_COLLECTION  10\r
-#define HID_MAIN_ITEM_TAG_END_COLLECTION    12\r
-\r
-//\r
-// HID report descriptor main item contents\r
-//\r
-#define HID_MAIN_ITEM_CONSTANT      0x001\r
-#define HID_MAIN_ITEM_VARIABLE      0x002\r
-#define HID_MAIN_ITEM_RELATIVE      0x004\r
-#define HID_MAIN_ITEM_WRAP          0x008\r
-#define HID_MAIN_ITEM_NONLINEAR     0x010\r
-#define HID_MAIN_ITEM_NO_PREFERRED  0x020\r
-#define HID_MAIN_ITEM_NULL_STATE    0x040\r
-#define HID_MAIN_ITEM_VOLATILE      0x080\r
-#define HID_MAIN_ITEM_BUFFERED_BYTE 0x100\r
-\r
-//\r
-// HID report descriptor collection item types\r
-//\r
-#define HID_COLLECTION_PHYSICAL     0\r
-#define HID_COLLECTION_APPLICATION  1\r
-#define HID_COLLECTION_LOGICAL      2\r
-\r
-//\r
-// HID report descriptor global item tags\r
-//\r
-#define HID_GLOBAL_ITEM_TAG_USAGE_PAGE        0\r
-#define HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM   1\r
-#define HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM   2\r
-#define HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM  3\r
-#define HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM  4\r
-#define HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT     5\r
-#define HID_GLOBAL_ITEM_TAG_UNIT              6\r
-#define HID_GLOBAL_ITEM_TAG_REPORT_SIZE       7\r
-#define HID_GLOBAL_ITEM_TAG_REPORT_ID         8\r
-#define HID_GLOBAL_ITEM_TAG_REPORT_COUNT      9\r
-#define HID_GLOBAL_ITEM_TAG_PUSH              10\r
-#define HID_GLOBAL_ITEM_TAG_POP               11\r
-\r
-//\r
-// HID report descriptor local item tags\r
-//\r
-#define HID_LOCAL_ITEM_TAG_USAGE              0\r
-#define HID_LOCAL_ITEM_TAG_USAGE_MINIMUM      1\r
-#define HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM      2\r
-#define HID_LOCAL_ITEM_TAG_DESIGNATOR_INDEX   3\r
-#define HID_LOCAL_ITEM_TAG_DESIGNATOR_MINIMUM 4\r
-#define HID_LOCAL_ITEM_TAG_DESIGNATOR_MAXIMUM 5\r
-#define HID_LOCAL_ITEM_TAG_STRING_INDEX       7\r
-#define HID_LOCAL_ITEM_TAG_STRING_MINIMUM     8\r
-#define HID_LOCAL_ITEM_TAG_STRING_MAXIMUM     9\r
-#define HID_LOCAL_ITEM_TAG_DELIMITER          10\r
-\r
-//\r
-// HID usage tables\r
-//\r
-#define HID_USAGE_PAGE    0xffff0000\r
-\r
-#define HID_UP_GENDESK    0x00010000\r
-#define HID_UP_KEYBOARD   0x00070000\r
-#define HID_UP_LED        0x00080000\r
-#define HID_UP_BUTTON     0x00090000\r
-#define HID_UP_CONSUMER   0x000c0000\r
-#define HID_UP_DIGITIZER  0x000d0000\r
-#define HID_UP_PID        0x000f0000\r
-\r
-#define HID_USAGE         0x0000ffff\r
-\r
-#define HID_GD_POINTER    0x00010001\r
-#define HID_GD_MOUSE      0x00010002\r
-#define HID_GD_JOYSTICK   0x00010004\r
-#define HID_GD_GAMEPAD    0x00010005\r
-#define HID_GD_HATSWITCH  0x00010039\r
-\r
-//\r
-// HID report types\r
-//\r
-#define HID_INPUT_REPORT    1\r
-#define HID_OUTPUT_REPORT   2\r
-#define HID_FEATURE_REPORT  3\r
-\r
-//\r
-// HID device quirks.\r
-//\r
-#define HID_QUIRK_INVERT  0x01\r
-#define HID_QUIRK_NOTOUCH 0x02\r
-\r
-//\r
-// HID class protocol request\r
-//\r
-#define EFI_USB_GET_REPORT_REQUEST    0x01\r
-#define EFI_USB_GET_IDLE_REQUEST      0x02\r
-#define EFI_USB_GET_PROTOCOL_REQUEST  0x03\r
-#define EFI_USB_SET_REPORT_REQUEST    0x09\r
-#define EFI_USB_SET_IDLE_REQUEST      0x0a\r
-#define EFI_USB_SET_PROTOCOL_REQUEST  0x0b\r
-\r
-#pragma pack(1)\r
-//\r
-// Descriptor header for Report/Physical Descriptors\r
-//\r
-typedef struct hid_class_descriptor {\r
-  UINT8   DescriptorType;\r
-  UINT16  DescriptorLength;\r
-} EFI_USB_HID_CLASS_DESCRIPTOR;\r
-\r
-typedef struct hid_descriptor {\r
-  UINT8                         Length;\r
-  UINT8                         DescriptorType;\r
-  UINT16                        BcdHID;\r
-  UINT8                         CountryCode;\r
-  UINT8                         NumDescriptors;\r
-  EFI_USB_HID_CLASS_DESCRIPTOR  HidClassDesc[1];\r
-} EFI_USB_HID_DESCRIPTOR;\r
-\r
-#pragma pack()\r
-\r
 EFI_STATUS\r
 UsbGetHidDescriptor (\r
   IN  EFI_USB_IO_PROTOCOL        *UsbIo,\r