MDX-20用の改造
Dependencies: FatFileSystemCpp
Diff: MSCFileSystem.cpp
- Revision:
- 4:dc14f62cb09f
- Parent:
- 0:e294af8d0e07
- Child:
- 7:a6b950d25e29
--- a/MSCFileSystem.cpp Mon Jul 30 13:49:56 2012 +0000 +++ b/MSCFileSystem.cpp Wed Nov 23 09:12:30 2016 +0000 @@ -9,10 +9,23 @@ * TODO: write one * we're basically using NXP's USBHotLite sample code, just plugging in our own FAT library */ - + #include "MSCFileSystem.h" #include "usbhost_inc.h" +/* +************************************************************************************************************** +* PRINT CONFIGURATION +************************************************************************************************************** +*/ +//#define DEBUG +#ifdef DEBUG +#define DEBUG_PRINT(...) printf(__VA_ARGS__) +#else +#define DEBUG_PRINT(...) +#endif // DEBUG + + MSCFileSystem::MSCFileSystem(const char* name) : FATFileSystem(name) { @@ -22,40 +35,40 @@ { // see USB Mass Storage Class – UFI Command Specification, // 4.2 INQUIRY Command - printf("Inquiry reply:\n"); + DEBUG_PRINT("Inquiry reply:\n"); uint8_t tmp = inqReply[0]&0x1F; - printf("Peripheral device type: %02Xh\n", tmp); + DEBUG_PRINT("Peripheral device type: %02Xh\n", tmp); if ( tmp == 0 ) - printf("\t- Direct access (floppy)\n"); + DEBUG_PRINT("\t- Direct access (floppy)\n"); else if ( tmp == 0x1F ) - printf("\t- none (no FDD connected)\n"); + DEBUG_PRINT("\t- none (no FDD connected)\n"); else - printf("\t- unknown type\n"); + DEBUG_PRINT("\t- unknown type\n"); tmp = inqReply[1] >> 7; - printf("Removable Media Bit: %d\n", tmp); + DEBUG_PRINT("Removable Media Bit: %d\n", tmp); tmp = inqReply[2] & 3; - printf("ANSI Version: %02Xh\n", tmp); + DEBUG_PRINT("ANSI Version: %02Xh\n", tmp); if ( tmp != 0 ) - printf("\t- warning! must be 0\n"); + DEBUG_PRINT("\t- warning! must be 0\n"); tmp = (inqReply[2]>>3) & 3; - printf("ECMA Version: %02Xh\n", tmp); + DEBUG_PRINT("ECMA Version: %02Xh\n", tmp); if ( tmp != 0 ) - printf("\t- warning! should be 0\n"); + DEBUG_PRINT("\t- warning! should be 0\n"); tmp = inqReply[2]>>6; - printf("ISO Version: %02Xh\n", tmp); + DEBUG_PRINT("ISO Version: %02Xh\n", tmp); if ( tmp != 0 ) - printf("\t- warning! should be 0\n"); + DEBUG_PRINT("\t- warning! should be 0\n"); tmp = inqReply[3] & 0xF; - printf("Response Data Format: %02Xh\n", tmp); + DEBUG_PRINT("Response Data Format: %02Xh\n", tmp); if ( tmp != 1 ) - printf("\t- warning! should be 1\n"); + DEBUG_PRINT("\t- warning! should be 1\n"); tmp = inqReply[4]; - printf("Additional length: %02Xh\n", tmp); + DEBUG_PRINT("Additional length: %02Xh\n", tmp); if ( tmp != 0x1F ) - printf("\t- warning! should be 1Fh\n"); - printf("Vendor Information: '%.8s'\n", &inqReply[8]); - printf("Product Identification: '%.16s'\n", &inqReply[16]); - printf("Product Revision: '%.4s'\n", &inqReply[32]); + DEBUG_PRINT("\t- warning! should be 1Fh\n"); + DEBUG_PRINT("Vendor Information: '%.8s'\n", &inqReply[8]); + DEBUG_PRINT("Product Identification: '%.16s'\n", &inqReply[16]); + DEBUG_PRINT("Product Revision: '%.4s'\n", &inqReply[32]); } int MSCFileSystem::initialise_msc() @@ -80,7 +93,7 @@ fprintf(stderr, "Could not initialize mass storage interface: %d\n", rc); return rc; } - printf("Successfully initialized mass storage interface; %d blocks of size %d\n", _numBlks, _blkSize); + DEBUG_PRINT("Successfully initialized mass storage interface; %d blocks of size %d\n", _numBlks, _blkSize); print_inquiry(inquiryResult); // FATFileSystem supports only 512-byte blocks return _blkSize == 512 ? OK : 1;