Hi Aniket Markande
Actually, if you are using the latest USB stack (the one that comes with SDK2.x), it already support HUB drivers. You can find in usb_host_config.h file a macro definitions as #define USB_HOST_CONFIG_HUB (1U), this will enable Host HUB class driver is enable.
Regardless of this, the given example doesn't implement the support for more MSD, but you can add it to it:
1. You have to add a new mass storage device instance, the example uses the g_MsdFatfsInstance global variable for the instance, so you could add a g_MsdFatfsInstance_2.
2. Inside app.c you can see that this instance is used to create the task with USB_HostMsdTask(&g_MsdFatfsInstance); (this variable is declared here as extern because we actually used in host_msd_fatfs.c).
3. In host_msd_fatfs.c implement the controller for more devices inside USB_HostMsdEvent, for example, in the kUSB_HostEventAttach event you find:
if (g_MsdFatfsInstance.deviceState == kStatus_DEV_Idle)
{
g_MsdFatfsInstance.deviceHandle = deviceHandle;
g_MsdFatfsInstance.interfaceHandle = interface;
g_MsdFatfsInstance.configHandle = configurationHandle;
return kStatus_USB_Success;
}
In this case you will have to implement a count of devices to use different handlers. This instance is also used in kUSB_HostEventEnumerationDone and in kUSB_HostEventDetach events
Hope this information could help you.
Best Regards
Jorge Alcala
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------