Driver_USB.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Copyright (c) 2013-2017 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: 2. Feb 2017
  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 (0)
  37. #define ARM_USB_ROLE_HOST (1)
  38. #define ARM_USB_ROLE_DEVICE (2)
  39. /* USB Pins */
  40. #define ARM_USB_PIN_DP (1 << 0) ///< USB D+ pin
  41. #define ARM_USB_PIN_DM (1 << 1) ///< USB D- pin
  42. #define ARM_USB_PIN_VBUS (1 << 2) ///< USB VBUS pin
  43. #define ARM_USB_PIN_OC (1 << 3) ///< USB OverCurrent pin
  44. #define ARM_USB_PIN_ID (1 << 4) ///< USB ID pin
  45. /* USB Speed */
  46. #define ARM_USB_SPEED_LOW (0) ///< Low-speed USB
  47. #define ARM_USB_SPEED_FULL (1) ///< Full-speed USB
  48. #define ARM_USB_SPEED_HIGH (2) ///< High-speed USB
  49. /* USB PID Types */
  50. #define ARM_USB_PID_OUT (1)
  51. #define ARM_USB_PID_IN (9)
  52. #define ARM_USB_PID_SOF (5)
  53. #define ARM_USB_PID_SETUP (13)
  54. #define ARM_USB_PID_DATA0 (3)
  55. #define ARM_USB_PID_DATA1 (11)
  56. #define ARM_USB_PID_DATA2 (7)
  57. #define ARM_USB_PID_MDATA (15)
  58. #define ARM_USB_PID_ACK (2)
  59. #define ARM_USB_PID_NAK (10)
  60. #define ARM_USB_PID_STALL (14)
  61. #define ARM_USB_PID_NYET (6)
  62. #define ARM_USB_PID_PRE (12)
  63. #define ARM_USB_PID_ERR (12)
  64. #define ARM_USB_PID_SPLIT (8)
  65. #define ARM_USB_PID_PING (4)
  66. #define ARM_USB_PID_RESERVED (0)
  67. /* USB Endpoint Address (bEndpointAddress) */
  68. #define ARM_USB_ENDPOINT_NUMBER_MASK (0x0F)
  69. #define ARM_USB_ENDPOINT_DIRECTION_MASK (0x80)
  70. /* USB Endpoint Type */
  71. #define ARM_USB_ENDPOINT_CONTROL (0) ///< Control Endpoint
  72. #define ARM_USB_ENDPOINT_ISOCHRONOUS (1) ///< Isochronous Endpoint
  73. #define ARM_USB_ENDPOINT_BULK (2) ///< Bulk Endpoint
  74. #define ARM_USB_ENDPOINT_INTERRUPT (3) ///< Interrupt Endpoint
  75. /* USB Endpoint Maximum Packet Size (wMaxPacketSize) */
  76. #define ARM_USB_ENDPOINT_MAX_PACKET_SIZE_MASK (0x07FF)
  77. #define ARM_USB_ENDPOINT_MICROFRAME_TRANSACTIONS_MASK (0x1800)
  78. #define ARM_USB_ENDPOINT_MICROFRAME_TRANSACTIONS_1 (0x0000)
  79. #define ARM_USB_ENDPOINT_MICROFRAME_TRANSACTIONS_2 (0x0800)
  80. #define ARM_USB_ENDPOINT_MICROFRAME_TRANSACTIONS_3 (0x1000)
  81. #endif /* DRIVER_USB_H_ */