usb_def.h
上传用户:yyyd609
上传日期:2022-07-18
资源大小:183k
文件大小:2k
源码类别:

微处理器开发

开发平台:

C/C++

  1. /******************** (C) COPYRIGHT 2003 STMicroelectronics ********************
  2. * File Name          : usb_def.h
  3. * Author             : MCD Application Team
  4. * Date First Issued  : 27/10/2003
  5. * Description        : Definitions related to USB
  6. *
  7. ********************************************************************************/
  8. /* Definition of "USBbmRequestType" */
  9. #define REQUEST_TYPE 0x60 /* Mask to get request type */
  10. #define STANDARD_REQUEST 0x00 /* Standard request */
  11. #define CLASS_REQUEST 0x20 /* Class request */
  12. #define VENDOR_REQUEST 0x40 /* Vendor request */
  13. #define RECIPIENT 0x1F /* Mask to get recipient */
  14. typedef enum _RECIPIENT_TYPE {
  15. DEVICE_RECIPIENT, /* Recipient device */
  16. INTERFACE_RECIPIENT, /* Recipient interface */
  17. ENDPOINT_RECIPIENT, /* Recipient endpoint */
  18. OTHER_RECIPIENT
  19. } RECIPIENT_TYPE;
  20. /* Definition of "USBbRequest" */
  21. /*
  22. #define GET_STATUS 0
  23. #define CLEAR_FEATURE 1
  24. #define RESERVED1 2
  25. #define SET_FEATURE 3
  26. #define RESERVED2 4
  27. #define SET_ADDRESS 5
  28. #define GET_DESCRIPTOR 6
  29. #define SET_DESCRIPTOR 7
  30. #define GET_CONFIGURATION 8
  31. #define SET_CONFIGURATION 9
  32. #define GET_INTERFACE 10
  33. #define SET_INTERFACE 11
  34. */
  35. typedef enum _STANDARD_REQUESTS {
  36. GET_STATUS = 0,
  37. CLEAR_FEATURE,
  38. RESERVED1,
  39. SET_FEATURE,
  40. RESERVED2,
  41. SET_ADDRESS,
  42. GET_DESCRIPTOR,
  43. SET_DESCRIPTOR,
  44. GET_CONFIGURATION,
  45. SET_CONFIGURATION,
  46. GET_INTERFACE,
  47. SET_INTERFACE,
  48. TOTAL_sREQUEST, /* Total number of Standard request */
  49. SYNCH_FRAME = 12
  50. } STANDARD_REQUESTS;
  51. /* Definition of "USBwValue" */
  52. typedef enum _DESCRIPTOR_TYPE {
  53. DEVICE_DESCRIPTOR = 1,
  54. CONFIG_DESCRIPTOR,
  55. STRING_DESCRIPTOR,
  56. INTERFACE_DESCRIPTOR,
  57. ENDPOINT_DESCRIPTOR
  58. } DESCRIPTOR_TYPE;
  59. /* Feature selector of a SET_FEATURE or CLEAR_FEATURE */
  60. typedef enum _FEATURE_SELECTOR {
  61. ENDPOINT_STALL,
  62. DEVICE_REMOTE_WAKEUP
  63. } FEATURE_SELECTOR;
  64. /*---------------------------------------------------------------------*/
  65. /* HID descriptors */
  66. /*---------------------------------------------------------------------*/
  67. typedef enum _HID_DESCRIPTOR_TYPE {
  68. HID_DESCRIPTOR = 0x21,
  69. REPORT_DESCRIPTOR,
  70. PHYSICAL_DESCRIPTOR
  71. } HID_DESCRIPTOR_TYPE;
  72. typedef enum _HID_REQUESTS {
  73. GET_REPORT = 1,
  74. GET_IDLE,
  75. GET_PROTOCOL,
  76. SET_REPORT = 9,
  77. SET_IDLE,
  78. SET_PROTOCOL
  79. } HID_REQUESTS;
  80. typedef enum _HID_REPORT_TYPE {
  81. INPUT_REPORT = 1,
  82. OUTPUT_REPORT,
  83. FEATURE_REPORT
  84. } HID_REPORT_TYPE;