USBMSD SD card Hello World for Mbed platforms

Dependencies:   mbed USBMSD_SD USBDevice

Revision:
3:0ffb2eee9e06
Parent:
2:27a7e7f8d399
Child:
4:980e6470dcce
--- a/USBDevice/USBMSD/USBMSD.cpp	Fri Nov 11 15:22:53 2011 +0000
+++ b/USBDevice/USBMSD/USBMSD.cpp	Fri Nov 11 16:12:21 2011 +0000
@@ -38,7 +38,7 @@
 #define MAX_PACKET  MAX_PACKET_SIZE_EPBULK
 
 // memory size
-#define MemorySize  0x2000000
+#define MemorySize  0x200000
 
 //number of blocks
 #define BlockCount  (MemorySize / BlockSize)
@@ -51,7 +51,7 @@
 };
 
 
-USBMSD::USBMSD(uint16_t vendor_id, uint16_t product_id, uint16_t product_release): USBDevice(vendor_id, product_id, product_release), mem(p5, p6, p7, p8) {
+USBMSD::USBMSD(uint16_t vendor_id, uint16_t product_id, uint16_t product_release): USBDevice(vendor_id, product_id, product_release) {
 }
 
 // Called in ISR context to process a class specific request
@@ -164,7 +164,7 @@
 
     // if the array is filled, write it in memory
     if (!((addr + size)%BlockSize))
-        mem.disk_write((char *)page, addr/BlockSize);
+        blockWrite(page, addr/BlockSize);
 
     addr += size;
     length -= size;
@@ -187,7 +187,7 @@
 
     // beginning of a new block -> load a whole block in RAM
     if (!(addr%BlockSize))
-        mem.disk_read((char *)page, addr/BlockSize);
+        blockRead(page, addr/BlockSize);
 
     // info are in RAM -> no need to re-read memory
     for (n = 0; n < size; n++) {
@@ -430,7 +430,7 @@
     }
 
     if (!(addr%BlockSize))
-        mem.disk_read((char *)page, addr/BlockSize);
+        blockRead(page, addr/BlockSize);
 
     writeNB(EPBULK_IN, &page[addr%BlockSize], n, MAX_PACKET_SIZE_EPBULK);