Added TARGET_DISCO_F469NI in USBHOST\USBHost\TARGET_STM\USBHALHost_STM_TARGET.h
Dependents: DISCO-F469NI_USB_Disk STM32F4xx_USB_Memory
Fork of USBHOST by
Diff: USBHostMSD/USBHostMSD.cpp
- Revision:
- 8:3e7a33f81048
- Parent:
- 6:d3ac9e1c0035
--- a/USBHostMSD/USBHostMSD.cpp Mon Apr 30 05:37:24 2018 +0000 +++ b/USBHostMSD/USBHostMSD.cpp Sat Jan 04 23:30:59 2020 +0000 @@ -195,7 +195,6 @@ 0, ep->getAddress(), NULL, 0); // set state to IDLE if clear feature successful if (res == USB_TYPE_OK) { - USBHost::Lock Lock(host); ep->setState(USB_TYPE_IDLE); } } @@ -323,7 +322,7 @@ uint16_t i, timeout = 10, ret; getMaxLun(); for (i = 0; i < timeout; i++) { - Thread::wait(100); + ThisThread::sleep_for(100); if (!testUnitReady()) break; } @@ -345,8 +344,9 @@ if (!disk_init) { init(); } - if (!disk_init) + if (!disk_init) { return -1; + } block_number = addr / blockSize; count = size /blockSize; @@ -365,13 +365,14 @@ if (!disk_init) { init(); } - if (!disk_init) + if (!disk_init) { return -1; + } block_number = addr / blockSize; - count = size /blockSize; + count = size / blockSize; for (uint32_t b = block_number; b < block_number + count; b++) { - if (dataTransfer((uint8_t*)buf, b, 1, DEVICE_TO_HOST)) + if (dataTransfer(buf, b, 1, DEVICE_TO_HOST)) return -1; buf += blockSize; } @@ -385,29 +386,26 @@ bd_size_t USBHostMSD::get_read_size() const { - if (!disk_init) - return -1; - return (bd_size_t)blockSize; + return (disk_init ? (bd_size_t)blockSize : -1); } bd_size_t USBHostMSD::get_program_size() const { - if (!disk_init) - return -1; - return (bd_size_t)blockSize; + return (disk_init ? (bd_size_t)blockSize : -1); } bd_size_t USBHostMSD::get_erase_size() const { - if (!disk_init) - return -1; - return (bd_size_t)blockSize; + return (disk_init ? (bd_size_t)blockSize : -1); } bd_size_t USBHostMSD::size() const { USB_DBG("FILESYSTEM: size "); - if (!disk_init) - return 0; - return (bd_size_t)blockCount*(bd_size_t)blockSize; + return (disk_init ? (bd_size_t)blockSize : 0); +} + +const char *USBHostMSD::get_type() const +{ + return "USBMSD"; } #endif