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: DM_FATFileSystem DM_HttpServer DM_USBHost EthernetInterface USBDevice mbed-rpc mbed-rtos
Fork of DMSupport by
FileSystems/RAMFileSystem.h
- Committer:
- embeddedartists
- Date:
- 2014-11-21
- Revision:
- 0:6b68dac0d986
- Child:
- 9:a33326afd686
File content as of revision 0:6b68dac0d986:
#ifndef RAMFILESYSTEM_H
#define RAMFILESYSTEM_H
#include "mbed.h"
#include "FATFileSystem.h"
#include "sdram.h"
#include <stdint.h>
/** Creates a FAT file system in SDRAM
*
* @code
* #include "mbed.h"
* #include "RAMFileSystem.h"
*
* RAMFileSystem ramfs(0xA0000000, 4*1024*1024, "ram"); // 4MB of ram starting at 0xA...
*
* int main() {
* sdram_init();
*
* FILE *fp = fopen("/ram/myfile.txt", "w");
* fprintf(fp, "Hello World!\n");
* fclose(fp);
* }
* @endcode
*/
class RAMFileSystem : public FATFileSystem {
public:
/** Create the File System in RAM
*
* @param addr Start of memory to use for file system
* @param size Number of bytes to use for file system
* @param name The name used to access the virtual filesystem
*/
RAMFileSystem(uint32_t addr, uint32_t size, const char* name);
virtual int disk_initialize();
virtual int disk_status();
virtual int disk_read(uint8_t * buffer, uint64_t sector, uint8_t count);
virtual int disk_write(const uint8_t * buffer, uint64_t sector, uint8_t count);
virtual int disk_sync();
virtual uint64_t disk_sectors();
uint64_t disk_size();
protected:
uint32_t memStart;
uint32_t memSize;
int status;
};
#endif
