MDX-20用の改造
Dependencies: FatFileSystemCpp
Revision 7:a6b950d25e29, committed 2016-12-12
- Comitter:
- suupen
- Date:
- Mon Dec 12 02:02:11 2016 +0000
- Parent:
- 6:d407fe3e0c97
- Child:
- 8:6e23bf867e38
- Commit message:
- int MSCFileSystem::disk_initialize() ?????????????????????????????
Changed in this revision
MSCFileSystem.cpp | Show annotated file Show diff for this revision Revisions of this file |
usbMemory.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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; +}
--- a/usbMemory.cpp Sat Dec 03 13:21:35 2016 +0000 +++ b/usbMemory.cpp Mon Dec 12 02:02:11 2016 +0000 @@ -67,7 +67,7 @@ } -int32_t fileSelect( char *fileName, uint32_t *numberLine) +int32_t fileSelect(char *fileName, uint32_t *numberLine) { uint32_t numMax = 0; int32_t ans = false; @@ -77,39 +77,24 @@ d = opendir("/" FSNAME); - // directory check - if ( d != NULL ) { - while ( (p = readdir(d)) != NULL ) { - if(NULL != strstr(p->d_name, ".prn")) { - strcpy(fileName, p->d_name); - DEBUG_PRINT("detect = %s\n",fileName); - ans = true; - continue; + // file check + sprintf(buffer,"/msc/%s",fileName); + fp = fopen( buffer, "r"); + if ( fp != NULL ) { + char buf[256]; + while ( NULL != fgets(buf, sizeof(buf), fp) ) { + DEBUG_PRINT("%s", buf); + numMax++; } + *numberLine = numMax; + fclose(fp); + ans = true; + + } else { + // Don't file open + // nothing } - // file check - if (ans == true) { - sprintf(buffer,"/msc/%s",fileName); - fp = fopen( buffer, "r"); - if ( fp != NULL ) { - char buf[256]; - while ( NULL != fgets(buf, sizeof(buf), fp) ) { - DEBUG_PRINT("%s", buf); - numMax++; - } - *numberLine = numMax; - fclose(fp); - - } else { - // Don't file open - // nothing - } - } else { - // nothing Directory - } - } return ans; - } uint32_t fileOneLineRead(char *fileName, char *data, uint32_t dataNumber, uint32_t numberLine)