USB device stack (USBDevice::connect non-blocking)

Fork of USBDevice by mbed official

Files at this revision

API Documentation at this revision

Comitter:
samux
Date:
Mon Jan 21 10:41:28 2013 +0000
Parent:
6:d0945750af57
Child:
8:335f2506f422
Commit message:
modify USBMSD prototypes to fit latest sdfilesystem lib

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	Thu Dec 20 17:05:37 2012 +0000
+++ b/USBMSD/USBMSD.cpp	Mon Jan 21 10:41:28 2013 +0000
@@ -114,7 +114,7 @@
     // get memory size
     MemorySize = disk_size();
 
-    if (BlockCount >= 0) {
+    if (BlockCount > 0) {
         BlockSize = MemorySize / BlockCount;
         if (BlockSize != 0) {
             page = (uint8_t *)malloc(BlockSize * sizeof(uint8_t));
@@ -222,7 +222,7 @@
     // if the array is filled, write it in memory
     if (!((addr + size)%BlockSize)) {
         if (!(disk_status() & WRITE_PROTECT)) {
-            disk_write((const char *)page, addr/BlockSize);
+            disk_write(page, addr/BlockSize);
         }
     }
 
@@ -247,7 +247,7 @@
 
     // beginning of a new block -> load a whole block in RAM
     if (!(addr%BlockSize))
-        disk_read((char *)page, addr/BlockSize);
+        disk_read(page, addr/BlockSize);
 
     // info are in RAM -> no need to re-read memory
     for (n = 0; n < size; n++) {
@@ -495,7 +495,7 @@
 
     // we read an entire block
     if (!(addr%BlockSize))
-        disk_read((char *)page, addr/BlockSize);
+        disk_read(page, addr/BlockSize);
 
     // write data which are in RAM
     writeNB(EPBULK_IN, &page[addr%BlockSize], n, MAX_PACKET_SIZE_EPBULK);
--- a/USBMSD/USBMSD.h	Thu Dec 20 17:05:37 2012 +0000
+++ b/USBMSD/USBMSD.h	Mon Jan 21 10:41:28 2013 +0000
@@ -84,7 +84,7 @@
     * @param block block number
     * @returns 0 if successful
     */
-    virtual int disk_read(char * data, int block) = 0;
+    virtual int disk_read(uint8_t * data, uint64_t block) = 0;
 
     /*
     * write a block on a storage chip
@@ -93,7 +93,7 @@
     * @param block block number
     * @returns 0 if successful
     */
-    virtual int disk_write(const char * data, int block) = 0;
+    virtual int disk_write(const uint8_t * data, uint64_t block) = 0;
 
     /*
     * Disk initilization
@@ -105,14 +105,14 @@
     *
     * @returns number of blocks
     */
-    virtual int disk_sectors() = 0;
+    virtual uint64_t disk_sectors() = 0;
 
     /*
     * Return memory size
     *
     * @returns memory size
     */
-    virtual int disk_size() = 0;
+    virtual uint64_t disk_size() = 0;
 
 
     /*
@@ -216,8 +216,8 @@
     uint8_t * page;
 
     int BlockSize;
-    int MemorySize;
-    int BlockCount;
+    uint64_t MemorySize;
+    uint64_t BlockCount;
 
     void CBWDecode(uint8_t * buf, uint16_t size);
     void sendCSW (void);