Adaptation of the official mbed USBHost repository to work with the LPC4088 Display Module
Dependents: DMSupport DMSupport DMSupport DMSupport
Fork of DM_USBHost by
Diff: USBHostHub/USBHostHub.cpp
- Revision:
- 28:a55c5a98d5e9
- Parent:
- 27:aa2fd412f1d3
- Child:
- 31:9a462d032742
diff -r aa2fd412f1d3 -r a55c5a98d5e9 USBHostHub/USBHostHub.cpp --- a/USBHostHub/USBHostHub.cpp Tue Dec 02 15:16:39 2014 +0000 +++ b/USBHostHub/USBHostHub.cpp Wed Dec 03 13:32:37 2014 +0000 @@ -53,6 +53,16 @@ USBHostHub::USBHostHub() { host = NULL; init(); + + buf = host->getSafeMem(sizeof(HubDescriptor)); +} + +USBHostHub::~USBHostHub() +{ + if (buf != NULL) { + host->returnSafeMem(buf); + buf = NULL; + } } void USBHostHub::init() { @@ -257,14 +267,17 @@ } uint32_t USBHostHub::getPortStatus(uint8_t port) { + uint8_t* safe = host->getSafeMem(4); uint32_t st; host->controlRead( dev, USB_DEVICE_TO_HOST | USB_REQUEST_TYPE_CLASS | USB_RECIPIENT_INTERFACE | USB_RECIPIENT_ENDPOINT, GET_STATUS, 0, port, - (uint8_t *)&st, + safe, 4); + st = *((uint32_t*)safe); + host->returnSafeMem(safe); return st; }