I added the Isochronous to USBHost library. The Isochronous code based on the following. http://developer.mbed.org/users/va009039/code/USBHostC270_example/
Dependencies: FATFileSystem mbed-rtos
Fork of USBHost_AddIso by
Diff: USBHost/USBHost.cpp
- Revision:
- 30:2851a9b2bbfb
- Parent:
- 24:868cbfe611a7
- Child:
- 31:271fcfd7cfc2
diff -r d3b77affed28 -r 2851a9b2bbfb USBHost/USBHost.cpp --- a/USBHost/USBHost.cpp Tue Mar 31 16:15:42 2015 +0100 +++ b/USBHost/USBHost.cpp Wed Apr 01 05:36:16 2015 +0000 @@ -17,6 +17,9 @@ #include "USBHost.h" #include "USBHostHub.h" +#if(1) /* Isochronous */ +#include "USBIsochronous.h" +#endif USBHost * USBHost::instHost = NULL; @@ -311,6 +314,16 @@ while(tdList != NULL) { volatile HCTD* td = tdList; tdList = (volatile HCTD*)td->nextTD; //Dequeue element now as it could be modified below +#if(1) /* Isochronous */ + if (!isTD((uint8_t*)td)) { // ITD? + HCITD* itd = (HCITD*)td; + IsochronousEp* ep = itd->ep; + if (ep) { + ep->irqWdhHandler(itd); + } + continue; + } +#endif if (td->ep != NULL) { USBEndpoint * ep = (USBEndpoint *)(td->ep); @@ -384,6 +397,32 @@ } else { return; } +#if(1) /* Isochronous */ + if (addr != 0) { + uint8_t state; + volatile HCTD* tdList = NULL; + + //First we must reverse the list order and dequeue each TD + do { + volatile HCTD* td = (volatile HCTD*)addr; + addr = (uint32_t)td->nextTD; //Dequeue from physical list + td->nextTD = tdList; //Enqueue into reversed list + tdList = td; + } while(addr); + + while(tdList != NULL) { + volatile HCTD* td = tdList; + tdList = (volatile HCTD*)td->nextTD; //Dequeue element now as it could be modified below + if (!isTD((uint8_t*)td)) { // ITD? + HCITD* itd = (HCITD*)td; + IsochronousEp* ep = itd->ep; + if (ep) { + ep->irqWdhHandler(itd); + } + } + } + } +#endif message_t * usb_msg = mail_usb_event.alloc(); usb_msg->event_id = DEVICE_DISCONNECTED_EVENT; @@ -912,6 +951,11 @@ bool parsing_intf = false; uint8_t current_intf = 0; +#if(1) /* Isochronous */ + lenCnfdDescr = len; + indexCnfdDescr = 0; +#endif + while (index < len) { len_desc = conf_descr[index]; id = conf_descr[index+1]; @@ -966,6 +1010,9 @@ break; } index += len_desc; +#if(1) /* Isochronous */ + indexCnfdDescr = index; +#endif } }