am3usb.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. /*++
  2. Copyright (c) 2015 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. am3usb.h
  5. Abstract:
  6. This header contains internal definitions for the TI AM33xx USB subsystem
  7. driver.
  8. Author:
  9. Evan Green 11-Sep-2015
  10. --*/
  11. //
  12. // ------------------------------------------------------------------- Includes
  13. //
  14. #include <minoca/fw/acpitabs.h>
  15. #include <minoca/soc/am335x.h>
  16. #include "musb.h"
  17. //
  18. // ---------------------------------------------------------------- Definitions
  19. //
  20. #define AM3_USB_ALLOCATION_TAG 0x55336D41
  21. //
  22. // Define the number of USB controllers exposed here.
  23. //
  24. #define AM3_USB_COUNT 2
  25. //
  26. // ------------------------------------------------------ Data Type Definitions
  27. //
  28. /*++
  29. Structure Description:
  30. This structure stores controller information for the USBSS region of the
  31. USB subsystem on the AM33xx.
  32. Members:
  33. InterruptLine - Stores the interrupt line that this controller's interrupt
  34. comes in on.
  35. InterruptVector - Stores the interrupt vector that this controller's
  36. interrupt comes in on.
  37. InterruptHandle - Stores a pointer to the handle received when the
  38. interrupt was connected.
  39. ControllerBase - Stores the virtual address of the hardware registers.
  40. CppiDma - Stores a pointer to the CPPI DMA controller.
  41. --*/
  42. typedef struct _AM3_USBSS_CONTROLLER {
  43. ULONGLONG InterruptLine;
  44. ULONGLONG InterruptVector;
  45. HANDLE InterruptHandle;
  46. PVOID ControllerBase;
  47. PCPPI_DMA_CONTROLLER CppiDma;
  48. } AM3_USBSS_CONTROLLER, *PAM3_USBSS_CONTROLLER;
  49. /*++
  50. Structure Description:
  51. This structure stores controller information for the USB control regions.
  52. Members:
  53. InterruptLine - Stores the interrupt line that this controller's interrupt
  54. comes in on.
  55. InterruptVector - Stores the interrupt vector that this controller's
  56. interrupt comes in on.
  57. InterruptHandle - Stores a pointer to the handle received when the
  58. interrupt was connected.
  59. ControllerBase - Stores the virtual address of the hardware registers.
  60. MentorUsb - Stores the Mentor Graphics USB controller state.
  61. --*/
  62. typedef struct _AM3_USB_CONTROL {
  63. ULONGLONG InterruptLine;
  64. ULONGLONG InterruptVector;
  65. HANDLE InterruptHandle;
  66. PVOID ControllerBase;
  67. MUSB_CONTROLLER MentorUsb;
  68. } AM3_USB_CONTROL, *PAM3_USB_CONTROL;
  69. /*++
  70. Structure Description:
  71. This structure stores the information for the USB subsystem on the TI
  72. AM33xx SoCs.
  73. Members:
  74. UsbSs - Stores the USBSS controller.
  75. CppiDma - Stores the CPPI DMA controller.
  76. Usb - Stores the USB control definitions.
  77. UsbCore - Stores the two Mentor USB controller contexts.
  78. --*/
  79. typedef struct _AM3_USB_CONTROLLER {
  80. AM3_USBSS_CONTROLLER UsbSs;
  81. CPPI_DMA_CONTROLLER CppiDma;
  82. AM3_USB_CONTROL Usb[AM3_USB_COUNT];
  83. MUSB_CONTROLLER UsbCore[AM3_USB_COUNT];
  84. } AM3_USB_CONTROLLER, *PAM3_USB_CONTROLLER;
  85. //
  86. // -------------------------------------------------------------------- Globals
  87. //
  88. //
  89. // -------------------------------------------------------- Function Prototypes
  90. //
  91. KSTATUS
  92. Am3UsbssInitializeControllerState (
  93. PAM3_USBSS_CONTROLLER Controller,
  94. PVOID RegisterBase,
  95. PCPPI_DMA_CONTROLLER CppiDma
  96. );
  97. /*++
  98. Routine Description:
  99. This routine initializes data structures for the AM335 USBSS controllers.
  100. Arguments:
  101. Controller - Supplies a pointer to the controller structure, which has
  102. already been zeroed.
  103. RegisterBase - Supplies the virtual address of the registers for the
  104. device.
  105. CppiDma - Supplies a pointer to the CPPI DMA controller.
  106. Return Value:
  107. Status code.
  108. --*/
  109. KSTATUS
  110. Am3UsbssDestroyControllerState (
  111. PAM3_USBSS_CONTROLLER Controller
  112. );
  113. /*++
  114. Routine Description:
  115. This routine destroys the given USBSS controller structure, freeing all
  116. resources associated with the controller except the controller structure
  117. itself and the register base, which were passed in on initialize.
  118. Arguments:
  119. Controller - Supplies a pointer to the controller to destroy.
  120. Return Value:
  121. Status code.
  122. --*/
  123. KSTATUS
  124. Am3UsbssResetController (
  125. PAM3_USBSS_CONTROLLER Controller
  126. );
  127. /*++
  128. Routine Description:
  129. This routine performs a hardware reset and initialization on USBSS.
  130. Arguments:
  131. Controller - Supplies a pointer to the controller.
  132. Return Value:
  133. Status code.
  134. --*/
  135. INTERRUPT_STATUS
  136. Am3UsbssInterruptService (
  137. PVOID Context
  138. );
  139. /*++
  140. Routine Description:
  141. This routine implements the USBSS interrupt service routine.
  142. Arguments:
  143. Context - Supplies the context pointer given to the system when the
  144. interrupt was connected. In this case, this points to the EHCI
  145. controller.
  146. Return Value:
  147. Interrupt status.
  148. --*/
  149. INTERRUPT_STATUS
  150. Am3UsbssInterruptServiceDpc (
  151. PVOID Context
  152. );
  153. /*++
  154. Routine Description:
  155. This routine implements the USBSS dispatch level interrupt service routine.
  156. Arguments:
  157. Context - Supplies the context pointer given to the system when the
  158. interrupt was connected. In this case, this points to the EHCI
  159. controller.
  160. Return Value:
  161. Interrupt status.
  162. --*/
  163. INTERRUPT_STATUS
  164. Am3UsbInterruptService (
  165. PVOID Context
  166. );
  167. /*++
  168. Routine Description:
  169. This routine implements the USB Control interrupt service routine.
  170. Arguments:
  171. Context - Supplies the context pointer given to the system when the
  172. interrupt was connected. In this case, this points to the EHCI
  173. controller.
  174. Return Value:
  175. Interrupt status.
  176. --*/
  177. INTERRUPT_STATUS
  178. Am3UsbInterruptServiceDpc (
  179. PVOID Parameter
  180. );
  181. /*++
  182. Routine Description:
  183. This routine implements the AM335 USB dispatch level interrupt service.
  184. Arguments:
  185. Parameter - Supplies the context, in this case the controller structure.
  186. Return Value:
  187. None.
  188. --*/
  189. KSTATUS
  190. Am3UsbControlReset (
  191. PAM3_USB_CONTROL Controller
  192. );
  193. /*++
  194. Routine Description:
  195. This routine performs a hardware reset and initialization of the given
  196. controller.
  197. Arguments:
  198. Controller - Supplies a pointer to the controller.
  199. Return Value:
  200. Status code.
  201. --*/