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