A board support package for the LPC4088 Display Module.
Dependencies: DM_HttpServer DM_USBHost
Dependents: lpc4088_displaymodule_emwin lpc4088_displaymodule_demo_sphere sampleGUI sampleEmptyGUI ... more
Fork of DMSupport by
FileSystems/RAMFileSystem.h@0:6b68dac0d986, 2014-11-21 (annotated)
- Committer:
- embeddedartists
- Date:
- Fri Nov 21 11:42:51 2014 +0000
- Revision:
- 0:6b68dac0d986
- Child:
- 9:a33326afd686
First version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 0:6b68dac0d986 | 1 | #ifndef RAMFILESYSTEM_H |
embeddedartists | 0:6b68dac0d986 | 2 | #define RAMFILESYSTEM_H |
embeddedartists | 0:6b68dac0d986 | 3 | |
embeddedartists | 0:6b68dac0d986 | 4 | #include "mbed.h" |
embeddedartists | 0:6b68dac0d986 | 5 | #include "FATFileSystem.h" |
embeddedartists | 0:6b68dac0d986 | 6 | #include "sdram.h" |
embeddedartists | 0:6b68dac0d986 | 7 | #include <stdint.h> |
embeddedartists | 0:6b68dac0d986 | 8 | |
embeddedartists | 0:6b68dac0d986 | 9 | /** Creates a FAT file system in SDRAM |
embeddedartists | 0:6b68dac0d986 | 10 | * |
embeddedartists | 0:6b68dac0d986 | 11 | * @code |
embeddedartists | 0:6b68dac0d986 | 12 | * #include "mbed.h" |
embeddedartists | 0:6b68dac0d986 | 13 | * #include "RAMFileSystem.h" |
embeddedartists | 0:6b68dac0d986 | 14 | * |
embeddedartists | 0:6b68dac0d986 | 15 | * RAMFileSystem ramfs(0xA0000000, 4*1024*1024, "ram"); // 4MB of ram starting at 0xA... |
embeddedartists | 0:6b68dac0d986 | 16 | * |
embeddedartists | 0:6b68dac0d986 | 17 | * int main() { |
embeddedartists | 0:6b68dac0d986 | 18 | * sdram_init(); |
embeddedartists | 0:6b68dac0d986 | 19 | * |
embeddedartists | 0:6b68dac0d986 | 20 | * FILE *fp = fopen("/ram/myfile.txt", "w"); |
embeddedartists | 0:6b68dac0d986 | 21 | * fprintf(fp, "Hello World!\n"); |
embeddedartists | 0:6b68dac0d986 | 22 | * fclose(fp); |
embeddedartists | 0:6b68dac0d986 | 23 | * } |
embeddedartists | 0:6b68dac0d986 | 24 | * @endcode |
embeddedartists | 0:6b68dac0d986 | 25 | */ |
embeddedartists | 0:6b68dac0d986 | 26 | class RAMFileSystem : public FATFileSystem { |
embeddedartists | 0:6b68dac0d986 | 27 | public: |
embeddedartists | 0:6b68dac0d986 | 28 | |
embeddedartists | 0:6b68dac0d986 | 29 | /** Create the File System in RAM |
embeddedartists | 0:6b68dac0d986 | 30 | * |
embeddedartists | 0:6b68dac0d986 | 31 | * @param addr Start of memory to use for file system |
embeddedartists | 0:6b68dac0d986 | 32 | * @param size Number of bytes to use for file system |
embeddedartists | 0:6b68dac0d986 | 33 | * @param name The name used to access the virtual filesystem |
embeddedartists | 0:6b68dac0d986 | 34 | */ |
embeddedartists | 0:6b68dac0d986 | 35 | RAMFileSystem(uint32_t addr, uint32_t size, const char* name); |
embeddedartists | 0:6b68dac0d986 | 36 | virtual int disk_initialize(); |
embeddedartists | 0:6b68dac0d986 | 37 | virtual int disk_status(); |
embeddedartists | 0:6b68dac0d986 | 38 | virtual int disk_read(uint8_t * buffer, uint64_t sector, uint8_t count); |
embeddedartists | 0:6b68dac0d986 | 39 | virtual int disk_write(const uint8_t * buffer, uint64_t sector, uint8_t count); |
embeddedartists | 0:6b68dac0d986 | 40 | virtual int disk_sync(); |
embeddedartists | 0:6b68dac0d986 | 41 | virtual uint64_t disk_sectors(); |
embeddedartists | 0:6b68dac0d986 | 42 | |
embeddedartists | 0:6b68dac0d986 | 43 | uint64_t disk_size(); |
embeddedartists | 0:6b68dac0d986 | 44 | |
embeddedartists | 0:6b68dac0d986 | 45 | protected: |
embeddedartists | 0:6b68dac0d986 | 46 | |
embeddedartists | 0:6b68dac0d986 | 47 | uint32_t memStart; |
embeddedartists | 0:6b68dac0d986 | 48 | uint32_t memSize; |
embeddedartists | 0:6b68dac0d986 | 49 | int status; |
embeddedartists | 0:6b68dac0d986 | 50 | }; |
embeddedartists | 0:6b68dac0d986 | 51 | |
embeddedartists | 0:6b68dac0d986 | 52 | #endif |
embeddedartists | 0:6b68dac0d986 | 53 |