add isochronous transfer interface for LogitechC270(USBHostC270)
Dependencies: FATFileSystem mbed-rtos
Dependents: USBHostC210_example USBHostC270_example GSwifi_ap_webcam n-bed-USBHostC270_example
Fork of USBHost by
Revision 10:5cc7bad4f28e, committed 2013-03-16
- Comitter:
- va009039
- Date:
- Sat Mar 16 13:05:41 2013 +0000
- Parent:
- 9:7671b6a8c363
- Child:
- 11:a338d6a681fb
- Commit message:
- add isochronous transfer
Changed in this revision
--- a/USBHost/USBHALHost.cpp Thu Mar 14 14:20:03 2013 +0000 +++ b/USBHost/USBHALHost.cpp Sat Mar 16 13:05:41 2013 +0000 @@ -232,6 +232,12 @@ return NULL; //Could not alloc TD } +bool USBHALHost::isTD(volatile uint8_t* td) { + if (td >= usb_tdBuf && td < (usb_tdBuf+TD_SIZE*MAX_TD)) { + return true; + } + return false; +} void USBHALHost::freeED(volatile uint8_t * ed) { int i;
--- a/USBHost/USBHALHost.h Thu Mar 14 14:20:03 2013 +0000 +++ b/USBHost/USBHALHost.h Sat Mar 16 13:05:41 2013 +0000 @@ -135,6 +135,7 @@ * @returns the address of the new TD */ volatile uint8_t * getTD(); + bool isTD(volatile uint8_t* td); /** * Release a previous memory section reserved for an ED
--- a/USBHost/USBHost.cpp Thu Mar 14 14:20:03 2013 +0000 +++ b/USBHost/USBHost.cpp Sat Mar 16 13:05:41 2013 +0000 @@ -17,6 +17,7 @@ #include "USBHost.h" #include "USBHostHub.h" +#include "BaseUvc.h" USBHost * USBHost::instHost = NULL; @@ -303,6 +304,14 @@ 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; + BaseEp* ep = itd->ep; + if (ep) { + ep->irqWdhHandler((HCTD*)itd); + } + continue; + } if (td->ep != NULL) { USBEndpoint * ep = (USBEndpoint *)(td->ep); @@ -851,7 +860,7 @@ pEnumerator->setVidPid( data[8] | (data[9] << 8), data[10] | (data[11] << 8) ); - res = getConfigurationDescriptor(dev, data, 400, &total_conf_descr_length); + res = getConfigurationDescriptor(dev, data, sizeof(data), &total_conf_descr_length); if (res != USB_TYPE_OK) { usb_mutex.unlock(); return res;
--- a/USBHost/dbg.h Thu Mar 14 14:20:03 2013 +0000 +++ b/USBHost/dbg.h Sat Mar 16 13:05:41 2013 +0000 @@ -24,7 +24,8 @@ #define DEBUG_EVENT 0 #if (DEBUG) -#define USB_DBG(x, ...) std::printf("[USB_DBG: %s:%d]"x"\r\n", __FILE__, __LINE__, ##__VA_ARGS__); +//#define USB_DBG(x, ...) std::printf("[USB_DBG: %s:%d]"x"\r\n", __FILE__, __LINE__, ##__VA_ARGS__); +#define USB_DBG(x, ...) std::printf("[USB_DBG: %s:%d]"x"\r\n", __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); #else #define USB_DBG(x, ...) #endif