123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325 |
- /*++
- Copyright (c) 2015 Minoca Corp. All Rights Reserved
- Module Name:
- am3usb.h
- Abstract:
- This header contains internal definitions for the TI AM33xx USB subsystem
- driver.
- Author:
- Evan Green 11-Sep-2015
- --*/
- //
- // ------------------------------------------------------------------- Includes
- //
- #include <minoca/fw/acpitabs.h>
- #include <minoca/soc/am335x.h>
- #include "musb.h"
- //
- // ---------------------------------------------------------------- Definitions
- //
- #define AM3_USB_ALLOCATION_TAG 0x55336D41
- //
- // Define the number of USB controllers exposed here.
- //
- #define AM3_USB_COUNT 2
- //
- // ------------------------------------------------------ Data Type Definitions
- //
- /*++
- Structure Description:
- This structure stores controller information for the USBSS region of the
- USB subsystem on the AM33xx.
- Members:
- InterruptLine - Stores the interrupt line that this controller's interrupt
- comes in on.
- InterruptVector - Stores the interrupt vector that this controller's
- interrupt comes in on.
- InterruptHandle - Stores a pointer to the handle received when the
- interrupt was connected.
- ControllerBase - Stores the virtual address of the hardware registers.
- CppiDma - Stores a pointer to the CPPI DMA controller.
- --*/
- typedef struct _AM3_USBSS_CONTROLLER {
- ULONGLONG InterruptLine;
- ULONGLONG InterruptVector;
- HANDLE InterruptHandle;
- PVOID ControllerBase;
- PCPPI_DMA_CONTROLLER CppiDma;
- } AM3_USBSS_CONTROLLER, *PAM3_USBSS_CONTROLLER;
- /*++
- Structure Description:
- This structure stores controller information for the USB control regions.
- Members:
- InterruptLine - Stores the interrupt line that this controller's interrupt
- comes in on.
- InterruptVector - Stores the interrupt vector that this controller's
- interrupt comes in on.
- InterruptHandle - Stores a pointer to the handle received when the
- interrupt was connected.
- ControllerBase - Stores the virtual address of the hardware registers.
- MentorUsb - Stores the Mentor Graphics USB controller state.
- --*/
- typedef struct _AM3_USB_CONTROL {
- ULONGLONG InterruptLine;
- ULONGLONG InterruptVector;
- HANDLE InterruptHandle;
- PVOID ControllerBase;
- MUSB_CONTROLLER MentorUsb;
- } AM3_USB_CONTROL, *PAM3_USB_CONTROL;
- /*++
- Structure Description:
- This structure stores the information for the USB subsystem on the TI
- AM33xx SoCs.
- Members:
- UsbSs - Stores the USBSS controller.
- CppiDma - Stores the CPPI DMA controller.
- Usb - Stores the USB control definitions.
- UsbCore - Stores the two Mentor USB controller contexts.
- --*/
- typedef struct _AM3_USB_CONTROLLER {
- AM3_USBSS_CONTROLLER UsbSs;
- CPPI_DMA_CONTROLLER CppiDma;
- AM3_USB_CONTROL Usb[AM3_USB_COUNT];
- MUSB_CONTROLLER UsbCore[AM3_USB_COUNT];
- } AM3_USB_CONTROLLER, *PAM3_USB_CONTROLLER;
- //
- // -------------------------------------------------------------------- Globals
- //
- //
- // -------------------------------------------------------- Function Prototypes
- //
- KSTATUS
- Am3UsbssInitializeControllerState (
- PAM3_USBSS_CONTROLLER Controller,
- PVOID RegisterBase,
- PCPPI_DMA_CONTROLLER CppiDma
- );
- /*++
- Routine Description:
- This routine initializes data structures for the AM335 USBSS controllers.
- Arguments:
- Controller - Supplies a pointer to the controller structure, which has
- already been zeroed.
- RegisterBase - Supplies the virtual address of the registers for the
- device.
- CppiDma - Supplies a pointer to the CPPI DMA controller.
- Return Value:
- Status code.
- --*/
- KSTATUS
- Am3UsbssDestroyControllerState (
- PAM3_USBSS_CONTROLLER Controller
- );
- /*++
- Routine Description:
- This routine destroys the given USBSS controller structure, freeing all
- resources associated with the controller except the controller structure
- itself and the register base, which were passed in on initialize.
- Arguments:
- Controller - Supplies a pointer to the controller to destroy.
- Return Value:
- Status code.
- --*/
- KSTATUS
- Am3UsbssResetController (
- PAM3_USBSS_CONTROLLER Controller
- );
- /*++
- Routine Description:
- This routine performs a hardware reset and initialization on USBSS.
- Arguments:
- Controller - Supplies a pointer to the controller.
- Return Value:
- Status code.
- --*/
- INTERRUPT_STATUS
- Am3UsbssInterruptService (
- PVOID Context
- );
- /*++
- Routine Description:
- This routine implements the USBSS interrupt service routine.
- Arguments:
- Context - Supplies the context pointer given to the system when the
- interrupt was connected. In this case, this points to the EHCI
- controller.
- Return Value:
- Interrupt status.
- --*/
- INTERRUPT_STATUS
- Am3UsbssInterruptServiceDpc (
- PVOID Context
- );
- /*++
- Routine Description:
- This routine implements the USBSS dispatch level interrupt service routine.
- Arguments:
- Context - Supplies the context pointer given to the system when the
- interrupt was connected. In this case, this points to the EHCI
- controller.
- Return Value:
- Interrupt status.
- --*/
- INTERRUPT_STATUS
- Am3UsbInterruptService (
- PVOID Context
- );
- /*++
- Routine Description:
- This routine implements the USB Control interrupt service routine.
- Arguments:
- Context - Supplies the context pointer given to the system when the
- interrupt was connected. In this case, this points to the EHCI
- controller.
- Return Value:
- Interrupt status.
- --*/
- INTERRUPT_STATUS
- Am3UsbInterruptServiceDpc (
- PVOID Parameter
- );
- /*++
- Routine Description:
- This routine implements the AM335 USB dispatch level interrupt service.
- Arguments:
- Parameter - Supplies the context, in this case the controller structure.
- Return Value:
- None.
- --*/
- KSTATUS
- Am3UsbControlReset (
- PAM3_USB_CONTROL Controller
- );
- /*++
- Routine Description:
- This routine performs a hardware reset and initialization of the given
- controller.
- Arguments:
- Controller - Supplies a pointer to the controller.
- Return Value:
- Status code.
- --*/
|