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