USB device stack

Dependents:   mbed-mX-USB-TEST1 USBMSD_SD_HID_HelloWorld HidTest MIDI_usb_bridge ... more

Legacy Warning

This is an mbed 2 library. To learn more about mbed OS 5, visit the docs.

Pull requests against this repository are no longer supported. Please raise against mbed OS 5 as documented above.

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Mon Aug 18 13:45:19 2014 +0100
Parent:
28:c09a0c9bf425
Child:
30:4408411999c8
Commit message:
Synchronized with git revision e91e6e69d628a619396c2140bd068b5dbb0986db

Full URL: https://github.com/mbedmicro/mbed/commit/e91e6e69d628a619396c2140bd068b5dbb0986db/

Added count argument to disk read/write

Changed in this revision

USBMSD/USBMSD.cpp Show annotated file Show diff for this revision Revisions of this file
USBMSD/USBMSD.h Show annotated file Show diff for this revision Revisions of this file
--- a/USBMSD/USBMSD.cpp	Tue Aug 05 20:15:19 2014 +0100
+++ b/USBMSD/USBMSD.cpp	Mon Aug 18 13:45:19 2014 +0100
@@ -232,7 +232,7 @@
     // if the array is filled, write it in memory
     if (!((addr + size)%BlockSize)) {
         if (!(disk_status() & WRITE_PROTECT)) {
-            disk_write(page, addr/BlockSize);
+            disk_write(page, addr/BlockSize, 1);
         }
     }
 
@@ -257,7 +257,7 @@
 
     // beginning of a new block -> load a whole block in RAM
     if (!(addr%BlockSize))
-        disk_read(page, addr/BlockSize);
+        disk_read(page, addr/BlockSize, 1);
 
     // info are in RAM -> no need to re-read memory
     for (n = 0; n < size; n++) {
@@ -505,7 +505,7 @@
 
     // we read an entire block
     if (!(addr%BlockSize))
-        disk_read(page, addr/BlockSize);
+        disk_read(page, addr/BlockSize, 1);
 
     // write data which are in RAM
     writeNB(EPBULK_IN, &page[addr%BlockSize], n, MAX_PACKET_SIZE_EPBULK);
--- a/USBMSD/USBMSD.h	Tue Aug 05 20:15:19 2014 +0100
+++ b/USBMSD/USBMSD.h	Mon Aug 18 13:45:19 2014 +0100
@@ -88,22 +88,24 @@
 protected:
 
     /*
-    * read a block on a storage chip
+    * read one or more blocks on a storage chip
     *
     * @param data pointer where will be stored read data
-    * @param block block number
+    * @param block starting block number
+    * @param count number of blocks to read
     * @returns 0 if successful
     */
-    virtual int disk_read(uint8_t * data, uint64_t block) = 0;
+    virtual int disk_read(uint8_t* data, uint64_t block, uint8_t count) = 0;
 
     /*
-    * write a block on a storage chip
+    * write one or more blocks on a storage chip
     *
     * @param data data to write
-    * @param block block number
+    * @param block starting block number
+    * @param count number of blocks to write
     * @returns 0 if successful
     */
-    virtual int disk_write(const uint8_t * data, uint64_t block) = 0;
+    virtual int disk_write(const uint8_t* data, uint64_t block, uint8_t count) = 0;
 
     /*
     * Disk initilization