size_t HAL_USBControllerInfo(int bus, struct usbinfo *info, size_t len)
Entry | |
---|---|
bus | Bus/interface number to query |
info | usbinfo pointer to fill with data |
len | Length of info |
Exit | |
---|---|
- | Returns sizeof( usbinfo ) for valid bus indices |
Returns 0 for invalid bus indices. |
This is an internal call for OS use only and should not be used by user software.
Reads information about the available USB controllers. The information is stored in a usbinfo struct:
struct usbinfo { enum { OHCI = 0, EHCI = 1, MUSBMHDRC = 2, DWC = 3 } type; /* Controller type */ int32 flags; /* Extra flags */ void *hw; /* Logical address of controller registers */ int devno; /* Device (interrupt) number of controller */ };
The available flags are as follows:
Bit | Meaning |
---|---|
0 | Port power controlled via HAL_USBPortPower (OHCI) |
1 | Port status read via HAL_USBPortStatus? (OHCI) |
2 | Port status IRQ number available via HAL_USBPortIRQ? (OHCI) |
3 | Must use 32bit access for all registers (EHCI) |
The info structure will only be fully filled in if the supplied len is large enough. If len is too small, only the type field will be filled in.
OHCI, EHCI and MUSBMHDRC controllers all use the usbinfo struct described above. DWC controllers extend the struct to provide extra information:
struct usbinfo_dwc { struct usbinfo base; /* Base structure */ int dma_offset; /* Offset to apply to ARM physical addresses to obtain DMA addresses */ };