SDFileSystem/LocalFileSystem等の不具合や機種依存性を少なくしたライブラリ。 MiMic用

Dependents:   HttpClientSamlpe AsyncHttpdSample MbedFileServer TcpSocketClientSamlpe ... more

Fork of NySDFileSystem by Ryo Iizuka

Revision:
8:22ce3449b224
Parent:
7:5429e81addde
Child:
9:b2ca0e66c1f7
diff -r 5429e81addde -r 22ce3449b224 SDFileSystem.cpp
--- a/SDFileSystem.cpp	Sun Apr 28 08:54:19 2013 +0000
+++ b/SDFileSystem.cpp	Sun Apr 28 12:23:28 2013 +0000
@@ -113,9 +113,7 @@
  * +------+---------+---------+- -  - -+---------+-----------+----------+
  */
 #include "SDFileSystem.h"
-//#include "mbed_debug.h"
-#define debug
-#define debug_if
+
 
 
 #define SD_COMMAND_TIMEOUT 5000
@@ -156,7 +154,6 @@
     
     // send CMD0, should return with all zeros except IDLE STATE set (bit 0)
     if (_cmd(0, 0) != R1_IDLE_STATE) {
-        debug("No disk, or could not put SD card in to SPI idle state\n");
         return SDCARD_FAIL;
     }
     
@@ -167,7 +164,6 @@
     } else if (r == (R1_IDLE_STATE | R1_ILLEGAL_COMMAND)) {
         return initialise_card_v1();
     } else {
-        debug("Not in idle state after sending CMD8 (not an SD card?)\n");
         return SDCARD_FAIL;
     }
 }
@@ -177,12 +173,10 @@
         _cmd(55, 0);
         if (_cmd(41, 0) == 0) {
             cdv = 512;
-            debug_if(SD_DBG, "\n\rInit: SEDCARD_V1\n\r");
             return SDCARD_V1;
         }
     }
     
-    debug("Timeout waiting for v1.x card\n");
     return SDCARD_FAIL;
 }
 
@@ -193,13 +187,11 @@
         _cmd(55, 0);
         if (_cmd(41, 0x40000000) == 0) {
             _cmd58();
-            debug_if(SD_DBG, "\n\rInit: SDCARD_V2\n\r");
             cdv = 1;
             return SDCARD_V2;
         }
     }
     
-    debug("Timeout waiting for v2.x card\n");
     return SDCARD_FAIL;
 }
 
@@ -208,12 +200,10 @@
     if(i==SDCARD_FAIL){
         return 1;
     }    
-    debug_if(SD_DBG, "init card = %d\n", i);
     _sectors = _sd_sectors();
     
     // Set block length to 512 (CMD16)
     if (_cmd(16, 512) != 0) {
-        debug("Set 512-byte block timed out\n");
         return 1;
     }
     
@@ -425,13 +415,11 @@
     
     // CMD9, Response R2 (R1 byte + 16-byte block read)
     if (_cmdx(9, 0) != 0) {
-        debug("Didn't get a response from the disk\n");
         return 0;
     }
     
     uint8_t csd[16];
     if (_read(csd, 16) != 0) {
-        debug("Couldn't read csd response from disk\n");
         return 0;
     }
     
@@ -454,18 +442,15 @@
             blocknr = (c_size + 1) * mult;
             capacity = blocknr * block_len;
             blocks = capacity / 512;
-            debug_if(SD_DBG, "\n\rSDCard\n\rc_size: %d \n\rcapacity: %ld \n\rsectors: %lld\n\r", c_size, capacity, blocks);
             break;
         
         case 1:
             cdv = 1;
             hc_c_size = ext_bits(csd, 63, 48);
             blocks = (hc_c_size+1)*1024;
-            debug_if(SD_DBG, "\n\rSDHC Card \n\rhc_c_size: %d\n\rcapacity: %lld \n\rsectors: %lld\n\r", hc_c_size, blocks*512, blocks);
             break;
         
         default:
-            debug("CSD struct unsupported\r\n");
             return 0;
     };
     return blocks;