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