Hi TI,
I am trying to port Tivaware USB host HUB to beaglebone black, basically just reworking on StarterWare, following Tivaware example project.
The most confused me is how usbhostenum.c finds downstream devices.
Here is my observation,
1. The below 3 functions in usbhostenum.c seem not be called by any other function/program. There is no effect after I commented it out and rebuild the example project.
GetEventFlag(uint32_t ui32Event),
USBHCDEventEnable(uint32_t ui32Index, void *pvEventDriver, uint32_t ui32Event)
USBHCDEventDisable(uint32_t ui32Index, void *pvEventDriver, uint32_t ui32Event)
2. main function constantly calls USBHCDMain(void), and further calls USBHHubMain() from inside USBHCDMain(void);
after hub successfully opened, g_sUSBHCD.piDeviceState[DEV_NUM] still stay at eHCDIdle (in USBHCDMain at usbhostenum.c), while g_sRootHub.psPorts[ui8Port].iState suddently (in USBHHubMain() at usbhhub.c) change from ePortIdle to ePortConnected, then downstream devices got enumerated, and finally g_sUSBHCD.piDeviceState[DEV_NUM] become eHCDDevConfigured .
What I do not understand is how g_sRootHub.psPorts[ui8Port].iState become ePortConnected.
3. HubIntINCallback() in usbhhub.c has case USB_EVENT_RX_AVAILABLE: and case USB_EVENT_SCHEDULER:
it reads back g_ulHubChanges, which further be assigned to g_ulChangeFlags, and indicates DEV_NUM locations, i.e., 2,4,8,16 for my tests. (0 has been occupied by HUB controller), which indicates finding downstream devices at psPorts location 1~4.
for some reason, in my porting codes, case USB_EVENT_SCHEDULER always return g_ulHubChanges=0; I am not sure whether my porting codes are bugged, or USBHCDPipeSchedule actually receives 0 value.
Wish TI experts can elaborate more detail. Thanks in advance.
Mike