usb_ehci.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * Copyright (c) 2015, Freescale Semiconductor, Inc.
  3. * Copyright 2016 NXP
  4. *
  5. * Redistribution and use in source and binary forms, with or without modification,
  6. * are permitted provided that the following conditions are met:
  7. *
  8. * o Redistributions of source code must retain the above copyright notice, this list
  9. * of conditions and the following disclaimer.
  10. *
  11. * o Redistributions in binary form must reproduce the above copyright notice, this
  12. * list of conditions and the following disclaimer in the documentation and/or
  13. * other materials provided with the distribution.
  14. *
  15. * o Neither the name of the copyright holder nor the names of its
  16. * contributors may be used to endorse or promote products derived from this
  17. * software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  20. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  21. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  22. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  23. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  24. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  25. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  26. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  28. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. */
  30. #ifndef __USB_EHCI_H__
  31. #define __USB_EHCI_H__
  32. /*******************************************************************************
  33. * Definitions
  34. ******************************************************************************/
  35. /* Device QH */
  36. #define USB_DEVICE_EHCI_QH_POINTER_MASK (0xFFFFFFC0U)
  37. #define USB_DEVICE_EHCI_QH_MULT_MASK (0xC0000000U)
  38. #define USB_DEVICE_EHCI_QH_ZLT_MASK (0x20000000U)
  39. #define USB_DEVICE_EHCI_QH_MAX_PACKET_SIZE_MASK (0x07FF0000U)
  40. #define USB_DEVICE_EHCI_QH_MAX_PACKET_SIZE (0x00000800U)
  41. #define USB_DEVICE_EHCI_QH_IOS_MASK (0x00008000U)
  42. /* Device DTD */
  43. #define USB_DEVICE_ECHI_DTD_POINTER_MASK (0xFFFFFFE0U)
  44. #define USB_DEVICE_ECHI_DTD_TERMINATE_MASK (0x00000001U)
  45. #define USB_DEVICE_ECHI_DTD_PAGE_MASK (0xFFFFF000U)
  46. #define USB_DEVICE_ECHI_DTD_PAGE_OFFSET_MASK (0x00000FFFU)
  47. #define USB_DEVICE_ECHI_DTD_PAGE_BLOCK (0x00001000U)
  48. #define USB_DEVICE_ECHI_DTD_TOTAL_BYTES_MASK (0x7FFF0000U)
  49. #define USB_DEVICE_ECHI_DTD_TOTAL_BYTES (0x00004000U)
  50. #define USB_DEVICE_ECHI_DTD_IOC_MASK (0x00008000U)
  51. #define USB_DEVICE_ECHI_DTD_MULTIO_MASK (0x00000C00U)
  52. #define USB_DEVICE_ECHI_DTD_STATUS_MASK (0x000000FFU)
  53. #define USB_DEVICE_EHCI_DTD_STATUS_ERROR_MASK (0x00000068U)
  54. #define USB_DEVICE_ECHI_DTD_STATUS_ACTIVE (0x00000080U)
  55. #define USB_DEVICE_ECHI_DTD_STATUS_HALTED (0x00000040U)
  56. #define USB_DEVICE_ECHI_DTD_STATUS_DATA_BUFFER_ERROR (0x00000020U)
  57. #define USB_DEVICE_ECHI_DTD_STATUS_TRANSACTION_ERROR (0x00000008U)
  58. typedef struct _usb_device_ehci_qh_struct
  59. {
  60. union
  61. {
  62. volatile uint32_t capabilttiesCharacteristics;
  63. struct
  64. {
  65. volatile uint32_t reserved1 : 15;
  66. volatile uint32_t ios : 1;
  67. volatile uint32_t maxPacketSize : 11;
  68. volatile uint32_t reserved2 : 2;
  69. volatile uint32_t zlt : 1;
  70. volatile uint32_t mult : 2;
  71. } capabilttiesCharacteristicsBitmap;
  72. } capabilttiesCharacteristicsUnion;
  73. volatile uint32_t currentDtdPointer;
  74. volatile uint32_t nextDtdPointer;
  75. union
  76. {
  77. volatile uint32_t dtdToken;
  78. struct
  79. {
  80. volatile uint32_t status : 8;
  81. volatile uint32_t reserved1 : 2;
  82. volatile uint32_t multiplierOverride : 2;
  83. volatile uint32_t reserved2 : 3;
  84. volatile uint32_t ioc : 1;
  85. volatile uint32_t totalBytes : 15;
  86. volatile uint32_t reserved3 : 1;
  87. } dtdTokenBitmap;
  88. } dtdTokenUnion;
  89. volatile uint32_t bufferPointerPage[5];
  90. volatile uint32_t reserved1;
  91. uint32_t setupBuffer[2];
  92. uint32_t setupBufferBack[2];
  93. union
  94. {
  95. uint32_t endpointStatus;
  96. struct
  97. {
  98. uint32_t isOpened : 1;
  99. uint32_t : 31;
  100. } endpointStatusBitmap;
  101. } endpointStatusUnion;
  102. uint32_t reserved2;
  103. } usb_device_ehci_qh_struct_t;
  104. typedef struct _usb_device_ehci_dtd_struct
  105. {
  106. volatile uint32_t nextDtdPointer;
  107. union
  108. {
  109. volatile uint32_t dtdToken;
  110. struct
  111. {
  112. volatile uint32_t status : 8;
  113. volatile uint32_t reserved1 : 2;
  114. volatile uint32_t multiplierOverride : 2;
  115. volatile uint32_t reserved2 : 3;
  116. volatile uint32_t ioc : 1;
  117. volatile uint32_t totalBytes : 15;
  118. volatile uint32_t reserved3 : 1;
  119. } dtdTokenBitmap;
  120. } dtdTokenUnion;
  121. volatile uint32_t bufferPointerPage[5];
  122. union
  123. {
  124. volatile uint32_t reserved;
  125. struct
  126. {
  127. uint32_t originalBufferOffest : 12;
  128. uint32_t originalBufferLength : 19;
  129. uint32_t dtdInvalid : 1;
  130. } originalBufferInfo;
  131. } reservedUnion;
  132. } usb_device_ehci_dtd_struct_t;
  133. #endif /* __USB_EHCI_H__ */