SDFileSystem fork without the Debugging messages of mbed_debug.h
Fork of SDFileSystem by
Revision 3:84ec2ccdc170, committed 2013-09-16
- Comitter:
- mosi
- Date:
- Mon Sep 16 23:03:22 2013 +0000
- Parent:
- 2:c8f66dc765d4
- Commit message:
- fork of SDFilesystem without the debugging mbed_debug.h features, which do not work for my mbed 1768;
Changed in this revision
SDFileSystem.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/SDFileSystem.cpp Thu Nov 29 10:56:21 2012 +0000 +++ b/SDFileSystem.cpp Mon Sep 16 23:03:22 2013 +0000 @@ -113,7 +113,7 @@ * +------+---------+---------+- - - -+---------+-----------+----------+ */ #include "SDFileSystem.h" -#include "mbed_debug.h" +//#include "mbed_debug.h" #define SD_COMMAND_TIMEOUT 5000 @@ -152,7 +152,7 @@ // 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"); + printf("No disk, or could not put SD card in to SPI idle state\r\n"); return SDCARD_FAIL; } @@ -163,7 +163,7 @@ } 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"); + printf("Not in idle state after sending CMD8 (not an SD card?)\r\n"); return SDCARD_FAIL; } } @@ -173,12 +173,12 @@ _cmd(55, 0); if (_cmd(41, 0) == 0) { cdv = 512; - debug_if(SD_DBG, "\n\rInit: SEDCARD_V1\n\r"); + printf( "\n\rInit: SEDCARD_V1\r\n"); // debug_if(SD_DBG, "\n\rInit: SEDCARD_V1\n\r"); return SDCARD_V1; } } - debug("Timeout waiting for v1.x card\n"); + printf("Timeout waiting for v1.x card\r\n"); return SDCARD_FAIL; } @@ -189,24 +189,26 @@ _cmd(55, 0); if (_cmd(41, 0x40000000) == 0) { _cmd58(); - debug_if(SD_DBG, "\n\rInit: SDCARD_V2\n\r"); + //debug_if(SD_DBG, "\n\rInit: SDCARD_V2\n\r"); + printf("\n\rInit: SDCARD_V2\n\r"); cdv = 1; return SDCARD_V2; } } - debug("Timeout waiting for v2.x card\n"); + printf("Timeout waiting for v2.x card\r\n"); return SDCARD_FAIL; } int SDFileSystem::disk_initialize() { int i = initialise_card(); - debug_if(SD_DBG, "init card = %d\n", i); + //debug_if(SD_DBG, "init card = %d\r\r\n", i); + printf(SD_DBG, "init card = %d\r\n", i); _sectors = _sd_sectors(); // Set block length to 512 (CMD16) if (_cmd(16, 512) != 0) { - debug("Set 512-byte block timed out\n"); + printf("Set 512-byte block timed out\r\n"); return 1; } @@ -418,13 +420,13 @@ // CMD9, Response R2 (R1 byte + 16-byte block read) if (_cmdx(9, 0) != 0) { - debug("Didn't get a response from the disk\n"); + printf("Didn't get a response from the disk\r\n"); return 0; } uint8_t csd[16]; if (_read(csd, 16) != 0) { - debug("Couldn't read csd response from disk\n"); + printf("Couldn't read csd response from disk\r\n"); return 0; } @@ -447,18 +449,20 @@ 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); + //debug_if(SD_DBG, "\n\rSDCard\n\rc_size: %d \n\rcapacity: %ld \n\rsectors: %lld\n\r", c_size, capacity, blocks); + printf("\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); + //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); + printf("\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"); + printf("CSD struct unsupported\r\r\n"); return 0; }; return blocks;