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