Driver_USB.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Copyright (c) 2013-2020 ARM Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the License); you may
  7. * not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  14. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. *
  18. * $Date: 24. January 2020
  19. * $Revision: V2.0
  20. *
  21. * Project: USB Driver common definitions
  22. */
  23. /* History:
  24. * Version 2.0
  25. * Version 1.10
  26. * Namespace prefix ARM_ added
  27. * Version 1.01
  28. * Added PID Types
  29. * Version 1.00
  30. * Initial release
  31. */
  32. #ifndef DRIVER_USB_H_
  33. #define DRIVER_USB_H_
  34. #include "Driver_Common.h"
  35. /* USB Role */
  36. #define ARM_USB_ROLE_NONE (0U)
  37. #define ARM_USB_ROLE_HOST (1U)
  38. #define ARM_USB_ROLE_DEVICE (2U)
  39. /* USB Pins */
  40. #define ARM_USB_PIN_DP (1U << 0) ///< USB D+ pin
  41. #define ARM_USB_PIN_DM (1U << 1) ///< USB D- pin
  42. #define ARM_USB_PIN_VBUS (1U << 2) ///< USB VBUS pin
  43. #define ARM_USB_PIN_OC (1U << 3) ///< USB OverCurrent pin
  44. #define ARM_USB_PIN_ID (1U << 4) ///< USB ID pin
  45. /* USB Speed */
  46. #define ARM_USB_SPEED_LOW (0U) ///< Low-speed USB
  47. #define ARM_USB_SPEED_FULL (1U) ///< Full-speed USB
  48. #define ARM_USB_SPEED_HIGH (2U) ///< High-speed USB
  49. /* USB PID Types */
  50. #define ARM_USB_PID_OUT (1U)
  51. #define ARM_USB_PID_IN (9U)
  52. #define ARM_USB_PID_SOF (5U)
  53. #define ARM_USB_PID_SETUP (13U)
  54. #define ARM_USB_PID_DATA0 (3U)
  55. #define ARM_USB_PID_DATA1 (11U)
  56. #define ARM_USB_PID_DATA2 (7U)
  57. #define ARM_USB_PID_MDATA (15U)
  58. #define ARM_USB_PID_ACK (2U)
  59. #define ARM_USB_PID_NAK (10U)
  60. #define ARM_USB_PID_STALL (14U)
  61. #define ARM_USB_PID_NYET (6U)
  62. #define ARM_USB_PID_PRE (12U)
  63. #define ARM_USB_PID_ERR (12U)
  64. #define ARM_USB_PID_SPLIT (8U)
  65. #define ARM_USB_PID_PING (4U)
  66. #define ARM_USB_PID_RESERVED (0U)
  67. /* USB Endpoint Address (bEndpointAddress) */
  68. #define ARM_USB_ENDPOINT_NUMBER_MASK (0x0FU)
  69. #define ARM_USB_ENDPOINT_DIRECTION_MASK (0x80U)
  70. /* USB Endpoint Type */
  71. #define ARM_USB_ENDPOINT_CONTROL (0U) ///< Control Endpoint
  72. #define ARM_USB_ENDPOINT_ISOCHRONOUS (1U) ///< Isochronous Endpoint
  73. #define ARM_USB_ENDPOINT_BULK (2U) ///< Bulk Endpoint
  74. #define ARM_USB_ENDPOINT_INTERRUPT (3U) ///< Interrupt Endpoint
  75. /* USB Endpoint Maximum Packet Size (wMaxPacketSize) */
  76. #define ARM_USB_ENDPOINT_MAX_PACKET_SIZE_MASK (0x07FFU)
  77. #define ARM_USB_ENDPOINT_MICROFRAME_TRANSACTIONS_MASK (0x1800U)
  78. #define ARM_USB_ENDPOINT_MICROFRAME_TRANSACTIONS_1 (0x0000U)
  79. #define ARM_USB_ENDPOINT_MICROFRAME_TRANSACTIONS_2 (0x0800U)
  80. #define ARM_USB_ENDPOINT_MICROFRAME_TRANSACTIONS_3 (0x1000U)
  81. #endif /* DRIVER_USB_H_ */