MDX-20用の改造
Dependencies: FatFileSystemCpp
Diff: MSCFileSystem.cpp
- Revision:
- 7:a6b950d25e29
- Parent:
- 4:dc14f62cb09f
- Child:
- 8:6e23bf867e38
diff -r d407fe3e0c97 -r a6b950d25e29 MSCFileSystem.cpp --- a/MSCFileSystem.cpp Sat Dec 03 13:21:35 2016 +0000 +++ b/MSCFileSystem.cpp Mon Dec 12 02:02:11 2016 +0000 @@ -3,13 +3,13 @@ * based on SDFileStorage * Copyright (c) 2008-2009, sford */ - + /* Introduction * ------------ * 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" @@ -18,7 +18,7 @@ * PRINT CONFIGURATION ************************************************************************************************************** */ -//#define DEBUG +#define DEBUG #ifdef DEBUG #define DEBUG_PRINT(...) printf(__VA_ARGS__) #else @@ -27,7 +27,7 @@ MSCFileSystem::MSCFileSystem(const char* name) : - FATFileSystem(name) + FATFileSystem(name) { } @@ -68,28 +68,26 @@ 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]); + DEBUG_PRINT("Product Revision: '%.4s'\n", &inqReply[32]); } int MSCFileSystem::initialise_msc() { USB_INT32S rc; USB_INT08U inquiryResult[INQUIRY_LENGTH]; - + //print_clock(); Host_Init(); /* Initialize the host controller */ rc = Host_EnumDev(); /* Enumerate the device connected */ - if (rc != OK) - { + if (rc != OK) { fprintf(stderr, "Could not enumerate device: %d\n", rc); return rc; } - - + + /* Initialize the mass storage and scsi interfaces */ rc = MS_Init( &_blkSize, &_numBlks, inquiryResult ); - if (rc != OK) - { + if (rc != OK) { fprintf(stderr, "Could not initialize mass storage interface: %d\n", rc); return rc; } @@ -101,10 +99,17 @@ int MSCFileSystem::disk_initialize() { - if ( initialise_msc() != OK ) + if(MS_TestUnitReady == OK) { return 1; - - return 0; + } else { + return 0; + } + /* + if ( initialise_msc() != OK ) + return 1; + + return 0; + */ } int MSCFileSystem::disk_write(const char *buffer, int block_number) @@ -121,6 +126,15 @@ return 1; } -int MSCFileSystem::disk_status() { return 0; } -int MSCFileSystem::disk_sync() { return 0; } -int MSCFileSystem::disk_sectors() { return _numBlks; } +int MSCFileSystem::disk_status() +{ + return 0; +} +int MSCFileSystem::disk_sync() +{ + return 0; +} +int MSCFileSystem::disk_sectors() +{ + return _numBlks; +}