usb_def.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*****************************************************************************
  2. * Copyright (c) 2019, Nations Technologies Inc.
  3. *
  4. * All rights reserved.
  5. * ****************************************************************************
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions are met:
  9. *
  10. * - Redistributions of source code must retain the above copyright notice,
  11. * this list of conditions and the disclaimer below.
  12. *
  13. * Nations' name may not be used to endorse or promote products derived from
  14. * this software without specific prior written permission.
  15. *
  16. * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY NATIONS "AS IS" AND ANY EXPRESS OR
  17. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  18. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
  19. * DISCLAIMED. IN NO EVENT SHALL NATIONS BE LIABLE FOR ANY DIRECT, INDIRECT,
  20. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  21. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  22. * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  23. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  24. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  25. * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. * ****************************************************************************/
  27. /**
  28. * @file usb_def.h
  29. * @author Nations
  30. * @version v1.0.0
  31. *
  32. * @copyright Copyright (c) 2019, Nations Technologies Inc. All rights reserved.
  33. */
  34. #ifndef __USB_DEF_H__
  35. #define __USB_DEF_H__
  36. /**
  37. * @addtogroup N32G45X_USB_Driver
  38. * @{
  39. */
  40. typedef enum _RECIPIENT_TYPE
  41. {
  42. DEVICE_RECIPIENT, /* Recipient device */
  43. INTERFACE_RECIPIENT, /* Recipient interface */
  44. ENDPOINT_RECIPIENT, /* Recipient endpoint */
  45. OTHER_RECIPIENT
  46. } RECIPIENT_TYPE;
  47. typedef enum _STANDARD_REQUESTS
  48. {
  49. GET_STATUS = 0,
  50. CLR_FEATURE,
  51. RESERVED1,
  52. SET_FEATURE,
  53. RESERVED2,
  54. SET_ADDRESS,
  55. GET_DESCRIPTOR,
  56. SET_DESCRIPTOR,
  57. GET_CONFIGURATION,
  58. SET_CONFIGURATION,
  59. GET_INTERFACE,
  60. SET_INTERFACE,
  61. TOTAL_SREQUEST, /* Total number of Standard request */
  62. SYNCH_FRAME = 12
  63. } STANDARD_REQUESTS;
  64. /* Definition of "USBwValue" */
  65. typedef enum _DESCRIPTOR_TYPE
  66. {
  67. DEVICE_DESCRIPTOR = 1,
  68. CONFIG_DESCRIPTOR,
  69. STRING_DESCRIPTOR,
  70. INTERFACE_DESCRIPTOR,
  71. ENDPOINT_DESCRIPTOR
  72. } DESCRIPTOR_TYPE;
  73. /* Feature selector of a SET_FEATURE or CLR_FEATURE */
  74. typedef enum _FEATURE_SELECTOR
  75. {
  76. ENDPOINT_STALL,
  77. DEVICE_REMOTE_WAKEUP
  78. } FEATURE_SELECTOR;
  79. /* Definition of "bmRequestType" */
  80. #define REQUEST_TYPE 0x60 /* Mask to get request type */
  81. #define STANDARD_REQUEST 0x00 /* Standard request */
  82. #define CLASS_REQUEST 0x20 /* Class request */
  83. #define VENDOR_REQUEST 0x40 /* Vendor request */
  84. #define RECIPIENT 0x1F /* Mask to get recipient */
  85. /**
  86. * @}
  87. */
  88. #endif /* __USB_DEF_H__ */