USBMSD SD card Hello World for Mbed platforms

Dependencies:   mbed USBMSD_SD USBDevice

Revision:
20:50bf1cd2e2fe
Parent:
19:148a0b8d23bc
--- a/USBDevice/USBMSD/USBMSD.h	Sun Dec 11 15:42:23 2011 +0000
+++ b/USBDevice/USBMSD/USBMSD.h	Sun Dec 11 15:56:08 2011 +0000
@@ -32,7 +32,7 @@
  *   - virtual int disk_size(): return the memory size
  *   - virtual int disk_status(): return the status of the storage chip
  *
- * All functions names are compatible with the fat filesystem library. So you can imagine using your own class with 
+ * All functions names are compatible with the fat filesystem library. So you can imagine using your own class with
  * USBMSD and the fat filesystem library in the same program. Just be careful because there are two different parts which
  * will access the sd card. You can do a master/slave system using the disk_status method.
  *
@@ -50,38 +50,6 @@
 
 #include "USBDevice.h"
 
-#define DEFAULT_CONFIGURATION (1)
-
-
-// MSC Bulk-only Stage
-enum Stage {
-    READ_CBW,     // wait a CBW
-    ERROR,        // error
-    PROCESS_CBW,  // process a CBW request
-    SEND_CSW,     // send a CSW
-    WAIT_CSW,     // wait that a CSW has been effectively sent
-};
-
-// Bulk-only CBW
-typedef __packed struct {
-    uint32_t Signature;
-    uint32_t Tag;
-    uint32_t DataLength;
-    uint8_t  Flags;
-    uint8_t  LUN;
-    uint8_t  CBLength;
-    uint8_t  CB[16];
-} CBW;
-
-// Bulk-only CSW
-typedef __packed struct {
-    uint32_t Signature;
-    uint32_t Tag;
-    uint32_t DataResidue;
-    uint8_t  Status;
-} CSW;
-
-
 class USBMSD: public USBDevice {
 public:
 
@@ -94,6 +62,16 @@
     */
     USBMSD(uint16_t vendor_id = 0x0703, uint16_t product_id = 0x0104, uint16_t product_release = 0x0001);
 
+    /**
+    * Connect the USB MSD device. Establish disk initialization before really connect the device.
+    *
+    * @returns true if successful
+    */
+    bool connect();
+
+
+protected:
+
     /*
     * read a block on a storage chip
     *
@@ -130,8 +108,8 @@
     * @returns memory size
     */
     virtual int disk_size() = 0;
-    
-    
+
+
     /*
     * To check the status of the storage chip
     *
@@ -140,24 +118,6 @@
     virtual int disk_status() = 0;
 
     /*
-    * Connect the USB MSD device. Establish disk initialization before really connect the device.
-    *
-    * @returns
-    */
-    bool connect();
-
-
-protected:
-
-
-    /*
-    * Get number of logical unit - 1 (here 0)
-    *
-    * @returns Pointer containing the number of logical unit - 1
-    */
-    uint8_t * getMaxLUN();
-
-    /*
     * Get string product descriptor
     *
     * @returns pointer to the string product descriptor
@@ -200,6 +160,35 @@
 
 
 private:
+
+    // MSC Bulk-only Stage
+    enum Stage {
+        READ_CBW,     // wait a CBW
+        ERROR,        // error
+        PROCESS_CBW,  // process a CBW request
+        SEND_CSW,     // send a CSW
+        WAIT_CSW,     // wait that a CSW has been effectively sent
+    };
+
+    // Bulk-only CBW
+    typedef __packed struct {
+        uint32_t Signature;
+        uint32_t Tag;
+        uint32_t DataLength;
+        uint8_t  Flags;
+        uint8_t  LUN;
+        uint8_t  CBLength;
+        uint8_t  CB[16];
+    } CBW;
+
+    // Bulk-only CSW
+    typedef __packed struct {
+        uint32_t Signature;
+        uint32_t Tag;
+        uint32_t DataResidue;
+        uint8_t  Status;
+    } CSW;
+
     //state of the bulk-only state machine
     Stage stage;