Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of MSCFileSystem by
MSCFileSystem.h@8:cccdf653258b, 2016-06-12 (annotated)
- Committer:
- mrsoundhar
- Date:
- Sun Jun 12 16:44:44 2016 +0000
- Revision:
- 8:cccdf653258b
- Parent:
- 0:3e7d2baed4b4
Soundharrajan USB Log for Drive
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| chris | 0:3e7d2baed4b4 | 1 | /* USB Mass Storage device file system |
| chris | 0:3e7d2baed4b4 | 2 | * Copyrigh (c) 2010, Igor Skochinsky |
| chris | 0:3e7d2baed4b4 | 3 | * based on SDFileStorage |
| chris | 0:3e7d2baed4b4 | 4 | * Copyright (c) 2008-2009, sford |
| chris | 0:3e7d2baed4b4 | 5 | */ |
| chris | 0:3e7d2baed4b4 | 6 | |
| chris | 0:3e7d2baed4b4 | 7 | #ifndef MSCFILESYSTEM_H |
| chris | 0:3e7d2baed4b4 | 8 | #define MSCFILESYSTEM_H |
| chris | 0:3e7d2baed4b4 | 9 | |
| chris | 0:3e7d2baed4b4 | 10 | #include "mbed.h" |
| chris | 0:3e7d2baed4b4 | 11 | #include "FATFileSystem.h" |
| chris | 0:3e7d2baed4b4 | 12 | |
| chris | 0:3e7d2baed4b4 | 13 | /* Class: MSCFileSystem |
| chris | 0:3e7d2baed4b4 | 14 | * Access the filesystem on an attached USB mass storage device (e.g. a memory stick) |
| chris | 0:3e7d2baed4b4 | 15 | * |
| chris | 0:3e7d2baed4b4 | 16 | * Example: |
| chris | 0:3e7d2baed4b4 | 17 | * > MSCFileSystem msc("msc"); |
| chris | 0:3e7d2baed4b4 | 18 | * > |
| chris | 0:3e7d2baed4b4 | 19 | * > int main() { |
| chris | 0:3e7d2baed4b4 | 20 | * > FILE *fp = fopen("/msc/myfile.txt", "w"); |
| chris | 0:3e7d2baed4b4 | 21 | * > fprintf(fp, "Hello World!\n"); |
| chris | 0:3e7d2baed4b4 | 22 | * > fclose(fp); |
| chris | 0:3e7d2baed4b4 | 23 | * > } |
| chris | 0:3e7d2baed4b4 | 24 | */ |
| chris | 0:3e7d2baed4b4 | 25 | class MSCFileSystem : public FATFileSystem { |
| chris | 0:3e7d2baed4b4 | 26 | public: |
| chris | 0:3e7d2baed4b4 | 27 | |
| chris | 0:3e7d2baed4b4 | 28 | /* Constructor: MSCFileSystem |
| chris | 0:3e7d2baed4b4 | 29 | * Create the File System for accessing a USB mass storage device |
| chris | 0:3e7d2baed4b4 | 30 | * |
| chris | 0:3e7d2baed4b4 | 31 | * Parameters: |
| chris | 0:3e7d2baed4b4 | 32 | * name - The name used to access the filesystem |
| chris | 0:3e7d2baed4b4 | 33 | */ |
| chris | 0:3e7d2baed4b4 | 34 | MSCFileSystem(const char* name); |
| chris | 0:3e7d2baed4b4 | 35 | virtual int disk_initialize(); |
| chris | 0:3e7d2baed4b4 | 36 | virtual int disk_write(const char *buffer, int block_number); |
| chris | 0:3e7d2baed4b4 | 37 | virtual int disk_read(char *buffer, int block_number); |
| chris | 0:3e7d2baed4b4 | 38 | virtual int disk_status(); |
| chris | 0:3e7d2baed4b4 | 39 | virtual int disk_sync(); |
| chris | 0:3e7d2baed4b4 | 40 | virtual int disk_sectors(); |
| chris | 0:3e7d2baed4b4 | 41 | |
| chris | 0:3e7d2baed4b4 | 42 | protected: |
| chris | 0:3e7d2baed4b4 | 43 | |
| chris | 0:3e7d2baed4b4 | 44 | int initialise_msc(); |
| chris | 0:3e7d2baed4b4 | 45 | uint32_t _numBlks; |
| chris | 0:3e7d2baed4b4 | 46 | uint32_t _blkSize; |
| chris | 0:3e7d2baed4b4 | 47 | }; |
| chris | 0:3e7d2baed4b4 | 48 | |
| chris | 0:3e7d2baed4b4 | 49 | #endif |
