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