haiku_usb_raw.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /*
  2. * Copyright 2006-2008, Haiku Inc. All rights reserved.
  3. * Distributed under the terms of the MIT License.
  4. */
  5. #ifndef _USB_RAW_H_
  6. #define _USB_RAW_H_
  7. #include <USB3.h>
  8. #define B_USB_RAW_PROTOCOL_VERSION 0x0015
  9. #define B_USB_RAW_ACTIVE_ALTERNATE 0xffffffff
  10. typedef enum {
  11. B_USB_RAW_COMMAND_GET_VERSION = 0x1000,
  12. B_USB_RAW_COMMAND_GET_DEVICE_DESCRIPTOR = 0x2000,
  13. B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR,
  14. B_USB_RAW_COMMAND_GET_INTERFACE_DESCRIPTOR,
  15. B_USB_RAW_COMMAND_GET_ENDPOINT_DESCRIPTOR,
  16. B_USB_RAW_COMMAND_GET_STRING_DESCRIPTOR,
  17. B_USB_RAW_COMMAND_GET_GENERIC_DESCRIPTOR,
  18. B_USB_RAW_COMMAND_GET_ALT_INTERFACE_COUNT,
  19. B_USB_RAW_COMMAND_GET_ACTIVE_ALT_INTERFACE_INDEX,
  20. B_USB_RAW_COMMAND_GET_INTERFACE_DESCRIPTOR_ETC,
  21. B_USB_RAW_COMMAND_GET_ENDPOINT_DESCRIPTOR_ETC,
  22. B_USB_RAW_COMMAND_GET_GENERIC_DESCRIPTOR_ETC,
  23. B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR_ETC,
  24. B_USB_RAW_COMMAND_SET_CONFIGURATION = 0x3000,
  25. B_USB_RAW_COMMAND_SET_FEATURE,
  26. B_USB_RAW_COMMAND_CLEAR_FEATURE,
  27. B_USB_RAW_COMMAND_GET_STATUS,
  28. B_USB_RAW_COMMAND_GET_DESCRIPTOR,
  29. B_USB_RAW_COMMAND_SET_ALT_INTERFACE,
  30. B_USB_RAW_COMMAND_CONTROL_TRANSFER = 0x4000,
  31. B_USB_RAW_COMMAND_INTERRUPT_TRANSFER,
  32. B_USB_RAW_COMMAND_BULK_TRANSFER,
  33. B_USB_RAW_COMMAND_ISOCHRONOUS_TRANSFER
  34. } usb_raw_command_id;
  35. typedef enum {
  36. B_USB_RAW_STATUS_SUCCESS = 0,
  37. B_USB_RAW_STATUS_FAILED,
  38. B_USB_RAW_STATUS_ABORTED,
  39. B_USB_RAW_STATUS_STALLED,
  40. B_USB_RAW_STATUS_CRC_ERROR,
  41. B_USB_RAW_STATUS_TIMEOUT,
  42. B_USB_RAW_STATUS_INVALID_CONFIGURATION,
  43. B_USB_RAW_STATUS_INVALID_INTERFACE,
  44. B_USB_RAW_STATUS_INVALID_ENDPOINT,
  45. B_USB_RAW_STATUS_INVALID_STRING,
  46. B_USB_RAW_STATUS_NO_MEMORY
  47. } usb_raw_command_status;
  48. typedef union {
  49. struct {
  50. status_t status;
  51. } version;
  52. struct {
  53. status_t status;
  54. usb_device_descriptor *descriptor;
  55. } device;
  56. struct {
  57. status_t status;
  58. usb_configuration_descriptor *descriptor;
  59. uint32 config_index;
  60. } config;
  61. struct {
  62. status_t status;
  63. usb_configuration_descriptor *descriptor;
  64. uint32 config_index;
  65. size_t length;
  66. } config_etc;
  67. struct {
  68. status_t status;
  69. uint32 alternate_info;
  70. uint32 config_index;
  71. uint32 interface_index;
  72. } alternate;
  73. struct {
  74. status_t status;
  75. usb_interface_descriptor *descriptor;
  76. uint32 config_index;
  77. uint32 interface_index;
  78. } interface;
  79. struct {
  80. status_t status;
  81. usb_interface_descriptor *descriptor;
  82. uint32 config_index;
  83. uint32 interface_index;
  84. uint32 alternate_index;
  85. } interface_etc;
  86. struct {
  87. status_t status;
  88. usb_endpoint_descriptor *descriptor;
  89. uint32 config_index;
  90. uint32 interface_index;
  91. uint32 endpoint_index;
  92. } endpoint;
  93. struct {
  94. status_t status;
  95. usb_endpoint_descriptor *descriptor;
  96. uint32 config_index;
  97. uint32 interface_index;
  98. uint32 alternate_index;
  99. uint32 endpoint_index;
  100. } endpoint_etc;
  101. struct {
  102. status_t status;
  103. usb_descriptor *descriptor;
  104. uint32 config_index;
  105. uint32 interface_index;
  106. uint32 generic_index;
  107. size_t length;
  108. } generic;
  109. struct {
  110. status_t status;
  111. usb_descriptor *descriptor;
  112. uint32 config_index;
  113. uint32 interface_index;
  114. uint32 alternate_index;
  115. uint32 generic_index;
  116. size_t length;
  117. } generic_etc;
  118. struct {
  119. status_t status;
  120. usb_string_descriptor *descriptor;
  121. uint32 string_index;
  122. size_t length;
  123. } string;
  124. struct {
  125. status_t status;
  126. uint8 type;
  127. uint8 index;
  128. uint16 language_id;
  129. void *data;
  130. size_t length;
  131. } descriptor;
  132. struct {
  133. status_t status;
  134. uint8 request_type;
  135. uint8 request;
  136. uint16 value;
  137. uint16 index;
  138. uint16 length;
  139. void *data;
  140. } control;
  141. struct {
  142. status_t status;
  143. uint32 interface;
  144. uint32 endpoint;
  145. void *data;
  146. size_t length;
  147. } transfer;
  148. struct {
  149. status_t status;
  150. uint32 interface;
  151. uint32 endpoint;
  152. void *data;
  153. size_t length;
  154. usb_iso_packet_descriptor *packet_descriptors;
  155. uint32 packet_count;
  156. } isochronous;
  157. } usb_raw_command;
  158. #endif // _USB_RAW_H_