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.
Dependencies: mbed-rtos EthernetInterface FatFileSystemCpp MCP23S17 SDFileSystem mbed
Fork of HTTPServerHelloWorld by
HardwareDrivers/MscFileSystem/MSCFileSystem.h@6:b2c4687b421d, 2014-02-02 (annotated)
- Committer:
- wyunreal
- Date:
- Sun Feb 02 16:57:24 2014 +0000
- Revision:
- 6:b2c4687b421d
Adding support for mass storage devices and making new request handlers to provide access to the webApp sources and logs
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| wyunreal | 6:b2c4687b421d | 1 | /* USB Mass Storage device file system |
| wyunreal | 6:b2c4687b421d | 2 | * Copyrigh (c) 2010, Igor Skochinsky |
| wyunreal | 6:b2c4687b421d | 3 | * based on SDFileStorage |
| wyunreal | 6:b2c4687b421d | 4 | * Copyright (c) 2008-2009, sford |
| wyunreal | 6:b2c4687b421d | 5 | */ |
| wyunreal | 6:b2c4687b421d | 6 | |
| wyunreal | 6:b2c4687b421d | 7 | #ifndef MSCFILESYSTEM_H |
| wyunreal | 6:b2c4687b421d | 8 | #define MSCFILESYSTEM_H |
| wyunreal | 6:b2c4687b421d | 9 | |
| wyunreal | 6:b2c4687b421d | 10 | #include "mbed.h" |
| wyunreal | 6:b2c4687b421d | 11 | #include "FATFileSystem.h" |
| wyunreal | 6:b2c4687b421d | 12 | |
| wyunreal | 6:b2c4687b421d | 13 | /* Class: MSCFileSystem |
| wyunreal | 6:b2c4687b421d | 14 | * Access the filesystem on an attached USB mass storage device (e.g. a memory stick) |
| wyunreal | 6:b2c4687b421d | 15 | * |
| wyunreal | 6:b2c4687b421d | 16 | * Example: |
| wyunreal | 6:b2c4687b421d | 17 | * > MSCFileSystem msc("msc"); |
| wyunreal | 6:b2c4687b421d | 18 | * > |
| wyunreal | 6:b2c4687b421d | 19 | * > int main() { |
| wyunreal | 6:b2c4687b421d | 20 | * > FILE *fp = fopen("/msc/myfile.txt", "w"); |
| wyunreal | 6:b2c4687b421d | 21 | * > fprintf(fp, "Hello World!\n"); |
| wyunreal | 6:b2c4687b421d | 22 | * > fclose(fp); |
| wyunreal | 6:b2c4687b421d | 23 | * > } |
| wyunreal | 6:b2c4687b421d | 24 | */ |
| wyunreal | 6:b2c4687b421d | 25 | class MSCFileSystem : public FATFileSystem { |
| wyunreal | 6:b2c4687b421d | 26 | public: |
| wyunreal | 6:b2c4687b421d | 27 | |
| wyunreal | 6:b2c4687b421d | 28 | /* Constructor: MSCFileSystem |
| wyunreal | 6:b2c4687b421d | 29 | * Create the File System for accessing a USB mass storage device |
| wyunreal | 6:b2c4687b421d | 30 | * |
| wyunreal | 6:b2c4687b421d | 31 | * Parameters: |
| wyunreal | 6:b2c4687b421d | 32 | * name - The name used to access the filesystem |
| wyunreal | 6:b2c4687b421d | 33 | */ |
| wyunreal | 6:b2c4687b421d | 34 | MSCFileSystem(const char* name); |
| wyunreal | 6:b2c4687b421d | 35 | virtual int disk_initialize(); |
| wyunreal | 6:b2c4687b421d | 36 | virtual int disk_write(const char *buffer, int block_number); |
| wyunreal | 6:b2c4687b421d | 37 | virtual int disk_read(char *buffer, int block_number); |
| wyunreal | 6:b2c4687b421d | 38 | virtual int disk_status(); |
| wyunreal | 6:b2c4687b421d | 39 | virtual int disk_sync(); |
| wyunreal | 6:b2c4687b421d | 40 | virtual int disk_sectors(); |
| wyunreal | 6:b2c4687b421d | 41 | |
| wyunreal | 6:b2c4687b421d | 42 | protected: |
| wyunreal | 6:b2c4687b421d | 43 | |
| wyunreal | 6:b2c4687b421d | 44 | int initialise_msc(); |
| wyunreal | 6:b2c4687b421d | 45 | uint32_t _numBlks; |
| wyunreal | 6:b2c4687b421d | 46 | uint32_t _blkSize; |
| wyunreal | 6:b2c4687b421d | 47 | }; |
| wyunreal | 6:b2c4687b421d | 48 | |
| wyunreal | 6:b2c4687b421d | 49 | #endif |
