usbdesc.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * GRUB -- GRand Unified Bootloader
  3. * Copyright (C) 2008 Free Software Foundation, Inc.
  4. *
  5. * GRUB is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * GRUB is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef GRUB_USBDESC_H
  19. #define GRUB_USBDESC_H 1
  20. #include <grub/types.h>
  21. #include <grub/symbol.h>
  22. typedef enum {
  23. GRUB_USB_DESCRIPTOR_DEVICE = 1,
  24. GRUB_USB_DESCRIPTOR_CONFIG,
  25. GRUB_USB_DESCRIPTOR_STRING,
  26. GRUB_USB_DESCRIPTOR_INTERFACE,
  27. GRUB_USB_DESCRIPTOR_ENDPOINT,
  28. GRUB_USB_DESCRIPTOR_DEBUG = 10,
  29. GRUB_USB_DESCRIPTOR_HUB = 0x29
  30. } grub_usb_descriptor_t;
  31. struct grub_usb_desc
  32. {
  33. grub_uint8_t length;
  34. grub_uint8_t type;
  35. } GRUB_PACKED;
  36. struct grub_usb_desc_device
  37. {
  38. grub_uint8_t length;
  39. grub_uint8_t type;
  40. grub_uint16_t usbrel;
  41. grub_uint8_t class;
  42. grub_uint8_t subclass;
  43. grub_uint8_t protocol;
  44. grub_uint8_t maxsize0;
  45. grub_uint16_t vendorid;
  46. grub_uint16_t prodid;
  47. grub_uint16_t devrel;
  48. grub_uint8_t strvendor;
  49. grub_uint8_t strprod;
  50. grub_uint8_t strserial;
  51. grub_uint8_t configcnt;
  52. } GRUB_PACKED;
  53. struct grub_usb_desc_config
  54. {
  55. grub_uint8_t length;
  56. grub_uint8_t type;
  57. grub_uint16_t totallen;
  58. grub_uint8_t numif;
  59. grub_uint8_t config;
  60. grub_uint8_t strconfig;
  61. grub_uint8_t attrib;
  62. grub_uint8_t maxpower;
  63. } GRUB_PACKED;
  64. #if 0
  65. struct grub_usb_desc_if_association
  66. {
  67. grub_uint8_t length;
  68. grub_uint8_t type;
  69. grub_uint8_t firstif;
  70. grub_uint8_t ifcnt;
  71. grub_uint8_t class;
  72. grub_uint8_t subclass;
  73. grub_uint8_t protocol;
  74. grub_uint8_t function;
  75. } GRUB_PACKED;
  76. #endif
  77. struct grub_usb_desc_if
  78. {
  79. grub_uint8_t length;
  80. grub_uint8_t type;
  81. grub_uint8_t ifnum;
  82. grub_uint8_t altsetting;
  83. grub_uint8_t endpointcnt;
  84. grub_uint8_t class;
  85. grub_uint8_t subclass;
  86. grub_uint8_t protocol;
  87. grub_uint8_t strif;
  88. } GRUB_PACKED;
  89. struct grub_usb_desc_endp
  90. {
  91. grub_uint8_t length;
  92. grub_uint8_t type;
  93. grub_uint8_t endp_addr;
  94. grub_uint8_t attrib;
  95. grub_uint16_t maxpacket;
  96. grub_uint8_t interval;
  97. } GRUB_PACKED;
  98. struct grub_usb_desc_str
  99. {
  100. grub_uint8_t length;
  101. grub_uint8_t type;
  102. grub_uint16_t str[0];
  103. } GRUB_PACKED;
  104. struct grub_usb_desc_debug
  105. {
  106. grub_uint8_t length;
  107. grub_uint8_t type;
  108. grub_uint8_t in_endp;
  109. grub_uint8_t out_endp;
  110. } GRUB_PACKED;
  111. struct grub_usb_usb_hubdesc
  112. {
  113. grub_uint8_t length;
  114. grub_uint8_t type;
  115. grub_uint8_t portcnt;
  116. grub_uint16_t characteristics;
  117. grub_uint8_t pwdgood;
  118. grub_uint8_t current;
  119. /* Removable and power control bits follow. */
  120. } GRUB_PACKED;
  121. #endif /* GRUB_USBDESC_H */