USB host library, support isochronous,bulk,interrupt and control.

Dependents:   BaseUsbHost_example BaseJpegDecode_example SimpleJpegDecode_example

Import programBaseUsbHost_example

BaseUsbHost example program

Revision:
4:d931d24c2f81
Parent:
3:ae77d63a1eda
--- a/BaseUsbHostUvc.cpp	Sun Jan 06 11:45:18 2013 +0000
+++ b/BaseUsbHostUvc.cpp	Fri Jan 25 14:51:33 2013 +0000
@@ -1,4 +1,4 @@
-// BaseUsbHostUvc.cpp 2012/12/11
+// BaseUsbHostUvc.cpp 2013/1/11
 #include "mbed.h"
 #include "rtos.h"
 #include "BaseUsbHost.h"
@@ -11,19 +11,18 @@
 {
     HCITD* itd = m_isoEp->isochronousReveive(millisec);
     if (itd) {
-        uint8_t cc = itd->Control>>28;
+        uint8_t cc = itd->ConditionCode();
         report_cc_count[cc]++;
-        if (cc == 0) { // ConditionCode
-            //DBG_ITD(itd);
-            uint16_t frame = itd->Control & 0xffff;
-            int fc = ((itd->Control>>24)&7)+1;
+        if (cc == 0) {
+            uint16_t frame = itd->StartingFrame();
+            int fc = itd->FrameCount();
             uint8_t* buf = const_cast<uint8_t*>(itd->buf); 
             int mps = m_isoEp->m_PacketSize;
             for(int i = 0; i < fc; i++) {
-                uint16_t pswn = itd->OffsetPSW[i];
-                cc = pswn>>12;
+                uint16_t psw = itd->OffsetPSW[i];
+                cc = psw>>12;
                 if (cc == 0 || cc == 9) {
-                    int len = pswn & 0x7ff;
+                    int len = psw & 0x7ff;
                     onResult(frame, buf, len);
                }
                report_ps_cc_count[cc]++;
@@ -31,13 +30,16 @@
                frame++;
             }
         }
-        m_isoEp->delete_HCTD(reinterpret_cast<HCTD*>(itd));
+        delete itd;
     }
 }
 
 int BaseUvc::Control(int req, int cs, int index, uint8_t* buf, int size)
 {
     TEST_ASSERT(m_ctlEp);
+    if (m_ctlEp == NULL) {
+        return USB_ERROR;
+    }
     int rc;
     if (req == SET_CUR) {    
         rc = m_ctlEp->controlSend(
@@ -72,4 +74,3 @@
     m_pCbItem = NULL;
     m_pCbMeth = NULL;
 }
-