22 #include "USBDescriptor.h" 23 #include "USBDevice_Types.h" 24 #include "platform/Callback.h" 25 #include "usb/internal/PolledQueue.h" 26 #include "usb/internal/Task.h" 27 #include "BlockDevice.h" 30 #include "USBDevice.h" 79 USBMSD(
BlockDevice *bd,
bool connect_blocking =
true, uint16_t vendor_id = 0x0703, uint16_t product_id = 0x0104, uint16_t product_release = 0x0001);
149 virtual int disk_read(uint8_t *data, uint64_t block, uint8_t count);
159 virtual int disk_write(
const uint8_t *data, uint64_t block, uint8_t count);
164 virtual int disk_initialize();
171 virtual uint64_t disk_sectors();
178 virtual uint64_t disk_size();
185 virtual int disk_status();
198 typedef MBED_PACKED(
struct)
210 typedef MBED_PACKED(
struct)
214 uint32_t DataResidue;
222 volatile bool _media_removed;
246 uint64_t _memory_size;
247 uint64_t _block_count;
252 uint8_t _bulk_in_buf[64];
253 uint8_t _bulk_out_buf[64];
256 uint32_t _bulk_out_size;
271 uint8_t _configuration_descriptor[32];
273 virtual const uint8_t *string_iproduct_desc();
274 virtual const uint8_t *string_iinterface_desc();
275 virtual const uint8_t *configuration_desc(uint8_t index);
276 virtual void callback_set_configuration(uint8_t configuration);
277 virtual void callback_set_interface(uint16_t interface, uint8_t alternate);
278 virtual void callback_state_change(DeviceState new_state);
280 virtual void callback_request_xfer_done(
const setup_packet_t *setup,
bool aborted);
293 void _write_next(uint8_t *data, uint32_t size);
296 void CBWDecode(uint8_t *buf, uint16_t size);
298 bool inquiryRequest(
void);
299 bool write(uint8_t *buf, uint16_t size);
300 bool readFormatCapacity();
301 bool readCapacity(
void);
302 bool infoTransfer(
void);
303 void memoryRead(
void);
304 bool modeSense6(
void);
305 bool modeSense10(
void);
306 void testUnitReady(
void);
307 bool requestSense(
void);
308 void memoryVerify(uint8_t *buf, uint16_t size);
309 void memoryWrite(uint8_t *buf, uint16_t size);
bool connect()
Connect the USB MSD device.
A hardware device capable of writing and reading blocks.
void process()
Perform USB processing.
USBMSD class: generic class in order to use all kinds of blocks storage chip.
Abstract interface to physical USB hardware.
USBMSD(BlockDevice *bd, bool connect_blocking=true, uint16_t vendor_id=0x0703, uint16_t product_id=0x0104, uint16_t product_release=0x0001)
Constructor.
The Mutex class is used to synchronize the execution of threads.
bool media_removed()
Check if MSD device was removed/unmounted on the host side.
void attach(mbed::Callback< void()> cb)
Called when USBMSD needs to perform processing.
virtual ~USBMSD()
Destroy this object.
Callback class based on template specialization.
void disconnect()
Disconnect the USB MSD device.