as
Dependencies: C12832 CMPS03 FatFileSystemCpp mbed
MSCFileSystem.h@0:6cf24371ad4f, 2014-05-07 (annotated)
- Committer:
- JWitherstone
- Date:
- Wed May 07 10:15:01 2014 +0000
- Revision:
- 0:6cf24371ad4f
this is compass;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JWitherstone | 0:6cf24371ad4f | 1 | /* USB Mass Storage device file system |
JWitherstone | 0:6cf24371ad4f | 2 | * Copyrigh (c) 2010, Igor Skochinsky |
JWitherstone | 0:6cf24371ad4f | 3 | * based on SDFileStorage |
JWitherstone | 0:6cf24371ad4f | 4 | * Copyright (c) 2008-2009, sford |
JWitherstone | 0:6cf24371ad4f | 5 | */ |
JWitherstone | 0:6cf24371ad4f | 6 | |
JWitherstone | 0:6cf24371ad4f | 7 | #ifndef MSCFILESYSTEM_H |
JWitherstone | 0:6cf24371ad4f | 8 | #define MSCFILESYSTEM_H |
JWitherstone | 0:6cf24371ad4f | 9 | |
JWitherstone | 0:6cf24371ad4f | 10 | #include "mbed.h" |
JWitherstone | 0:6cf24371ad4f | 11 | #include "FATFileSystem.h" |
JWitherstone | 0:6cf24371ad4f | 12 | |
JWitherstone | 0:6cf24371ad4f | 13 | /* Class: MSCFileSystem |
JWitherstone | 0:6cf24371ad4f | 14 | * Access the filesystem on an attached USB mass storage device (e.g. a memory stick) |
JWitherstone | 0:6cf24371ad4f | 15 | * |
JWitherstone | 0:6cf24371ad4f | 16 | * Example: |
JWitherstone | 0:6cf24371ad4f | 17 | * > MSCFileSystem msc("msc"); |
JWitherstone | 0:6cf24371ad4f | 18 | * > |
JWitherstone | 0:6cf24371ad4f | 19 | * > int main() { |
JWitherstone | 0:6cf24371ad4f | 20 | * > FILE *fp = fopen("/msc/myfile.txt", "w"); |
JWitherstone | 0:6cf24371ad4f | 21 | * > fprintf(fp, "Hello World!\n"); |
JWitherstone | 0:6cf24371ad4f | 22 | * > fclose(fp); |
JWitherstone | 0:6cf24371ad4f | 23 | * > } |
JWitherstone | 0:6cf24371ad4f | 24 | */ |
JWitherstone | 0:6cf24371ad4f | 25 | class MSCFileSystem : public FATFileSystem { |
JWitherstone | 0:6cf24371ad4f | 26 | public: |
JWitherstone | 0:6cf24371ad4f | 27 | |
JWitherstone | 0:6cf24371ad4f | 28 | /* Constructor: MSCFileSystem |
JWitherstone | 0:6cf24371ad4f | 29 | * Create the File System for accessing a USB mass storage device |
JWitherstone | 0:6cf24371ad4f | 30 | * |
JWitherstone | 0:6cf24371ad4f | 31 | * Parameters: |
JWitherstone | 0:6cf24371ad4f | 32 | * name - The name used to access the filesystem |
JWitherstone | 0:6cf24371ad4f | 33 | */ |
JWitherstone | 0:6cf24371ad4f | 34 | MSCFileSystem(const char* name); |
JWitherstone | 0:6cf24371ad4f | 35 | virtual int disk_initialize(); |
JWitherstone | 0:6cf24371ad4f | 36 | virtual int disk_write(const char *buffer, int block_number); |
JWitherstone | 0:6cf24371ad4f | 37 | virtual int disk_read(char *buffer, int block_number); |
JWitherstone | 0:6cf24371ad4f | 38 | virtual int disk_status(); |
JWitherstone | 0:6cf24371ad4f | 39 | virtual int disk_sync(); |
JWitherstone | 0:6cf24371ad4f | 40 | virtual int disk_sectors(); |
JWitherstone | 0:6cf24371ad4f | 41 | |
JWitherstone | 0:6cf24371ad4f | 42 | protected: |
JWitherstone | 0:6cf24371ad4f | 43 | |
JWitherstone | 0:6cf24371ad4f | 44 | int initialise_msc(); |
JWitherstone | 0:6cf24371ad4f | 45 | uint32_t _numBlks; |
JWitherstone | 0:6cf24371ad4f | 46 | uint32_t _blkSize; |
JWitherstone | 0:6cf24371ad4f | 47 | }; |
JWitherstone | 0:6cf24371ad4f | 48 | |
JWitherstone | 0:6cf24371ad4f | 49 | #endif |