22 #include "USBDescriptor.h" 23 #include "USBDevice_Types.h" 24 #include "platform/Callback.h" 25 #include "events/PolledQueue.h" 26 #include "events/Task.h" 27 #include "BlockDevice.h" 30 #include "USBDevice.h" 73 USBMSD(
BlockDevice *bd,
bool connect_blocking =
true, uint16_t vendor_id = 0x0703, uint16_t product_id = 0x0104, uint16_t product_release = 0x0001);
143 virtual int disk_read(uint8_t *data, uint64_t block, uint8_t count);
153 virtual int disk_write(
const uint8_t *data, uint64_t block, uint8_t count);
158 virtual int disk_initialize();
165 virtual uint64_t disk_sectors();
172 virtual uint64_t disk_size();
179 virtual int disk_status();
192 typedef MBED_PACKED(
struct)
204 typedef MBED_PACKED(
struct)
208 uint32_t DataResidue;
216 volatile bool _media_removed;
240 uint64_t _memory_size;
241 uint64_t _block_count;
246 uint8_t _bulk_in_buf[64];
247 uint8_t _bulk_out_buf[64];
250 uint32_t _bulk_out_size;
265 uint8_t _configuration_descriptor[32];
267 virtual const uint8_t *string_iproduct_desc();
268 virtual const uint8_t *string_iinterface_desc();
269 virtual const uint8_t *configuration_desc(uint8_t index);
270 virtual void callback_set_configuration(uint8_t configuration);
271 virtual void callback_set_interface(uint16_t interface, uint8_t alternate);
272 virtual void callback_state_change(DeviceState new_state);
274 virtual void callback_request_xfer_done(
const setup_packet_t *setup,
bool aborted);
287 void _write_next(uint8_t *data, uint32_t size);
290 void CBWDecode(uint8_t *buf, uint16_t size);
292 bool inquiryRequest(
void);
293 bool write(uint8_t *buf, uint16_t size);
294 bool readFormatCapacity();
295 bool readCapacity(
void);
296 bool infoTransfer(
void);
297 void memoryRead(
void);
298 bool modeSense6(
void);
299 void testUnitReady(
void);
300 bool requestSense(
void);
301 void memoryVerify(uint8_t *buf, uint16_t size);
302 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.