dd

Dependencies:   C12832 LM75B mbed

Committer:
pfe
Date:
Tue Apr 21 10:16:20 2015 +0000
Revision:
0:05a20e3e3179
dd

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pfe 0:05a20e3e3179 1 /* mbed Microcontroller Library - FATFileSystem
pfe 0:05a20e3e3179 2 * Copyright (c) 2008, sford
pfe 0:05a20e3e3179 3 */
pfe 0:05a20e3e3179 4
pfe 0:05a20e3e3179 5 /* Library: FATFileSystem.h
pfe 0:05a20e3e3179 6 * A library of stuff to make a fat filesystem on top of a block device
pfe 0:05a20e3e3179 7 */
pfe 0:05a20e3e3179 8
pfe 0:05a20e3e3179 9 #ifndef MBED_FATFILESYSTEM_H
pfe 0:05a20e3e3179 10 #define MBED_FATFILESYSTEM_H
pfe 0:05a20e3e3179 11
pfe 0:05a20e3e3179 12 #ifndef FFSDEBUG_ENABLED
pfe 0:05a20e3e3179 13 #define FFSDEBUG_ENABLED 0
pfe 0:05a20e3e3179 14 #endif
pfe 0:05a20e3e3179 15
pfe 0:05a20e3e3179 16 #if FFSDEBUG_ENABLED
pfe 0:05a20e3e3179 17 #define FFSDEBUG(FMT, ...) printf(FMT, ##__VA_ARGS__)
pfe 0:05a20e3e3179 18 #else
pfe 0:05a20e3e3179 19 #define FFSDEBUG(FMT, ...)
pfe 0:05a20e3e3179 20 #endif
pfe 0:05a20e3e3179 21
pfe 0:05a20e3e3179 22 #include "FileSystemLike.h"
pfe 0:05a20e3e3179 23 #include "FileHandle.h"
pfe 0:05a20e3e3179 24 #include "ff.h"
pfe 0:05a20e3e3179 25 #include "diskio.h"
pfe 0:05a20e3e3179 26
pfe 0:05a20e3e3179 27 namespace mbed {
pfe 0:05a20e3e3179 28 /* Class: FATFileSystem
pfe 0:05a20e3e3179 29 * The class itself
pfe 0:05a20e3e3179 30 */
pfe 0:05a20e3e3179 31 class FATFileSystem : public FileSystemLike {
pfe 0:05a20e3e3179 32 public:
pfe 0:05a20e3e3179 33
pfe 0:05a20e3e3179 34 FATFileSystem(const char* n);
pfe 0:05a20e3e3179 35 virtual ~FATFileSystem();
pfe 0:05a20e3e3179 36
pfe 0:05a20e3e3179 37 /* Function: open
pfe 0:05a20e3e3179 38 * open a file on the filesystem. never called directly
pfe 0:05a20e3e3179 39 */
pfe 0:05a20e3e3179 40 virtual FileHandle *open(const char* name, int flags);
pfe 0:05a20e3e3179 41 virtual int remove(const char *filename);
pfe 0:05a20e3e3179 42 virtual int format();
pfe 0:05a20e3e3179 43 virtual DirHandle *opendir(const char *name);
pfe 0:05a20e3e3179 44 virtual int mkdir(const char *name, mode_t mode);
pfe 0:05a20e3e3179 45
pfe 0:05a20e3e3179 46 FATFS _fs; // Work area (file system object) for logical drive
pfe 0:05a20e3e3179 47 static FATFileSystem *_ffs[_VOLUMES]; // FATFileSystem objects, as parallel to FatFs drives array
pfe 0:05a20e3e3179 48 int _fsid;
pfe 0:05a20e3e3179 49
pfe 0:05a20e3e3179 50 virtual int disk_initialize() { return 0; }
pfe 0:05a20e3e3179 51 virtual int disk_status() { return 0; }
pfe 0:05a20e3e3179 52 virtual int disk_read(char *buffer, int sector) = 0;
pfe 0:05a20e3e3179 53 virtual int disk_write(const char *buffer, int sector) = 0;
pfe 0:05a20e3e3179 54 virtual int disk_sync() { return 0; }
pfe 0:05a20e3e3179 55 virtual int disk_sectors() = 0;
pfe 0:05a20e3e3179 56
pfe 0:05a20e3e3179 57 };
pfe 0:05a20e3e3179 58
pfe 0:05a20e3e3179 59 }
pfe 0:05a20e3e3179 60
pfe 0:05a20e3e3179 61 #endif