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