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