V18.

Dependencies:   FATFileSystem mbed-rtos

Fork of USBHost by mbed official

Revision:
4:b320d68e98e7
Parent:
0:a554658735bf
Child:
6:1571e517a91b
--- a/USBHost/USBHost.h	Wed Mar 06 17:50:07 2013 +0000
+++ b/USBHost/USBHost.h	Tue Mar 12 17:23:37 2013 +0000
@@ -156,6 +156,7 @@
      *  register a driver into the host associated with a callback function called when the device is disconnected
      *
      *  @param dev device
+     *  @param intf interface number
      *  @param tptr pointer to the object to call the member function on
      *  @param mptr pointer to the member function to be called
      */
@@ -163,8 +164,8 @@
     inline void registerDriver(USBDeviceConnected * dev, uint8_t intf, T* tptr, void (T::*mptr)(void)) {
         int index = findDevice(dev);
         if ((index != -1) && (mptr != NULL) && (tptr != NULL)) {
-            USB_DBG("register driver for dev: %p", dev);
-            deviceAttachedDriver[index] = true;
+            USB_DBG("register driver for dev: %p on intf: %d", dev, intf);
+            deviceAttachedDriver[index][intf] = true;
             dev->onDisconnect(intf, tptr, mptr);
         }
     }
@@ -173,13 +174,14 @@
      * register a driver into the host associated with a callback function called when the device is disconnected
      *
      * @param dev device
+     * @param intf interface number
      * @param fn callback called when the specified device has been disconnected
      */
     inline void registerDriver(USBDeviceConnected * dev, uint8_t intf, void (*fn)(void)) {
         int index = findDevice(dev);
         if ((index != -1) && (fn != NULL)) {
-            USB_DBG("register driver for dev: %p", dev);
-            deviceAttachedDriver[index] = true;
+            USB_DBG("register driver for dev: %p on intf: %d", dev, intf);
+            deviceAttachedDriver[index][intf] = true;
             dev->onDisconnect(intf, fn);
         }
     }
@@ -244,8 +246,9 @@
     // devices connected
     USBDeviceConnected devices[MAX_DEVICE_CONNECTED];
     volatile bool  deviceInUse[MAX_DEVICE_CONNECTED];
-    volatile bool  deviceAttachedDriver[MAX_DEVICE_CONNECTED];
+    volatile bool  deviceAttachedDriver[MAX_DEVICE_CONNECTED][MAX_INTF];
     volatile bool  deviceReset[MAX_DEVICE_CONNECTED];
+    volatile bool  deviceInited[MAX_DEVICE_CONNECTED];
     
 #if MAX_HUB_NB
     USBHostHub hubs[MAX_HUB_NB];
@@ -273,7 +276,7 @@
     Mutex usb_mutex;
     
     // buffer for conf descriptor
-    uint8_t data[400];
+    uint8_t data[300];
     
     /**
     * Add a transfer on the TD linked list associated to an ED
@@ -365,6 +368,7 @@
     void parseConfDescr(USBDeviceConnected * dev, uint8_t * conf_descr, uint32_t len, IUSBEnumerator* pEnumerator) ;
     int findDevice(USBDeviceConnected * dev) ;
     int findDevice(uint8_t hub, uint8_t port, USBHostHub * hub_parent = NULL) ;
+    uint8_t numberDriverAttached(USBDeviceConnected * dev);
 
     /////////////////////////
     /// FOR DEBUG
@@ -374,4 +378,3 @@
 };
 
 #endif
-