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