Dependencies:   mbed

Committer:
joe
Date:
Fri Aug 20 15:38:52 2010 +0000
Revision:
2:a079de4fd5b9
Parent:
0:960b355eaa84

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joe 0:960b355eaa84 1 /* USB Mass Storage device file system
joe 0:960b355eaa84 2 * Copyrigh (c) 2010, Igor Skochinsky
joe 0:960b355eaa84 3 * based on SDFileStorage
joe 0:960b355eaa84 4 * Copyright (c) 2008-2009, sford
joe 0:960b355eaa84 5 */
joe 0:960b355eaa84 6
joe 0:960b355eaa84 7 #ifndef MSCFILESYSTEM_H
joe 0:960b355eaa84 8 #define MSCFILESYSTEM_H
joe 0:960b355eaa84 9
joe 0:960b355eaa84 10 #include "mbed.h"
joe 0:960b355eaa84 11 #include "FATFileSystem.h"
joe 0:960b355eaa84 12
joe 0:960b355eaa84 13 /* Class: MSCFileSystem
joe 0:960b355eaa84 14 * Access the filesystem on an attached USB mass storage device (e.g. a memory stick)
joe 0:960b355eaa84 15 *
joe 0:960b355eaa84 16 * Example:
joe 0:960b355eaa84 17 * > MSCFileSystem msc("msc");
joe 0:960b355eaa84 18 * >
joe 0:960b355eaa84 19 * > int main() {
joe 0:960b355eaa84 20 * > FILE *fp = fopen("/msc/myfile.txt", "w");
joe 0:960b355eaa84 21 * > fprintf(fp, "Hello World!\n");
joe 0:960b355eaa84 22 * > fclose(fp);
joe 0:960b355eaa84 23 * > }
joe 0:960b355eaa84 24 */
joe 0:960b355eaa84 25 class MSCFileSystem : public FATFileSystem {
joe 0:960b355eaa84 26 public:
joe 0:960b355eaa84 27
joe 0:960b355eaa84 28 /* Constructor: MSCFileSystem
joe 0:960b355eaa84 29 * Create the File System for accessing a USB mass storage device
joe 0:960b355eaa84 30 *
joe 0:960b355eaa84 31 * Parameters:
joe 0:960b355eaa84 32 * name - The name used to access the filesystem
joe 0:960b355eaa84 33 */
joe 0:960b355eaa84 34 MSCFileSystem(const char* name);
joe 0:960b355eaa84 35 virtual int disk_initialize();
joe 0:960b355eaa84 36 virtual int disk_write(const char *buffer, int block_number);
joe 0:960b355eaa84 37 virtual int disk_read(char *buffer, int block_number);
joe 0:960b355eaa84 38 virtual int disk_status();
joe 0:960b355eaa84 39 virtual int disk_sync();
joe 0:960b355eaa84 40 virtual int disk_sectors();
joe 0:960b355eaa84 41
joe 0:960b355eaa84 42 protected:
joe 0:960b355eaa84 43
joe 0:960b355eaa84 44 int initialise_msc();
joe 0:960b355eaa84 45 uint32_t _numBlks;
joe 0:960b355eaa84 46 uint32_t _blkSize;
joe 0:960b355eaa84 47 };
joe 0:960b355eaa84 48
joe 0:960b355eaa84 49 #endif