USB Host WAN Dongle library

Fork of USBHostWANDongle_bleedingedge by Donatien Garnier

Files at this revision

API Documentation at this revision

Comitter:
donatien
Date:
Sat Jul 28 14:15:14 2012 +0000
Parent:
6:075e36a3463e
Child:
8:0d1ec493842c
Commit message:
Optimization of memory consumption; fixed leak in TD allocation

Changed in this revision

USBHost/Endpoint.cpp Show annotated file Show diff for this revision Revisions of this file
USBHost/Endpoint.h Show annotated file Show diff for this revision Revisions of this file
USBHost/USBHost.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/USBHost/Endpoint.cpp	Fri Jul 27 16:14:07 2012 +0000
+++ b/USBHost/Endpoint.cpp	Sat Jul 28 14:15:14 2012 +0000
@@ -226,3 +226,8 @@
     //return headTD;
   return (volatile HCTD*) (hced->headTD & ~0xF);
 }
+
+volatile HCTD ** Endpoint::getTDList()
+{
+  return td_list;
+}
--- a/USBHost/Endpoint.h	Fri Jul 27 16:14:07 2012 +0000
+++ b/USBHost/Endpoint.h	Sat Jul 28 14:15:14 2012 +0000
@@ -154,6 +154,7 @@
     uint32_t   getBufStart();
     uint32_t            getSize();
     volatile HCTD *     getHeadTD();
+    volatile HCTD**     getTDList();
     volatile HCED *     getHCED();
     ENDPOINT_DIRECTION  getDir() {return dir;}
     bool                isSetup() {return setup;}
--- a/USBHost/USBHost.cpp	Fri Jul 27 16:14:07 2012 +0000
+++ b/USBHost/USBHost.cpp	Sat Jul 28 14:15:14 2012 +0000
@@ -216,10 +216,10 @@
         DBG("Dequeueing endpoint");
         unqueueEndpoint(ep);
 
-        DBG("Freeing head transfer descriptor");
-        freeTD((volatile uint8_t*)ep->getHeadTD());
-        DBG("Freeing tail transfer descriptor");
-        freeTD((volatile uint8_t*)ep->getNextTD());
+        DBG("Freeing first transfer descriptor");
+        freeTD((volatile uint8_t*)ep->getTDList()[0]);
+        DBG("Freeing second transfer descriptor");
+        freeTD((volatile uint8_t*)ep->getTDList()[1]);
 
         DBG("Freeing endpoint descriptor");
         freeED((uint8_t *)ep->getHCED());