This is SDFileSystem which corrected the bug for MiMicSDK.

Dependents:   MbedFileServer_1768MiniDK2 RedWireBridge IssueDebug_gcc MiMicRemoteMCU-for-Mbed ... more

Fork of SDFileSystem by mbed official

Committer:
nyatla
Date:
Tue Nov 12 03:41:14 2013 +0000
Revision:
9:b2ca0e66c1f7
Parent:
5:2c7b6bd5b079
fix warning.;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nyatla 5:2c7b6bd5b079 1 /* mbed Microcontroller Library
nyatla 5:2c7b6bd5b079 2 * Copyright (c) 2006-2012 ARM Limited
nyatla 5:2c7b6bd5b079 3 *
nyatla 5:2c7b6bd5b079 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
nyatla 5:2c7b6bd5b079 5 * of this software and associated documentation files (the "Software"), to deal
nyatla 5:2c7b6bd5b079 6 * in the Software without restriction, including without limitation the rights
nyatla 5:2c7b6bd5b079 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
nyatla 5:2c7b6bd5b079 8 * copies of the Software, and to permit persons to whom the Software is
nyatla 5:2c7b6bd5b079 9 * furnished to do so, subject to the following conditions:
nyatla 5:2c7b6bd5b079 10 *
nyatla 5:2c7b6bd5b079 11 * The above copyright notice and this permission notice shall be included in
nyatla 5:2c7b6bd5b079 12 * all copies or substantial portions of the Software.
nyatla 5:2c7b6bd5b079 13 *
nyatla 5:2c7b6bd5b079 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
nyatla 5:2c7b6bd5b079 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
nyatla 5:2c7b6bd5b079 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
nyatla 5:2c7b6bd5b079 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
nyatla 5:2c7b6bd5b079 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
nyatla 5:2c7b6bd5b079 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
nyatla 5:2c7b6bd5b079 20 * SOFTWARE.
nyatla 5:2c7b6bd5b079 21 */
nyatla 5:2c7b6bd5b079 22 #ifndef MBED_FATFILESYSTEM_H
nyatla 5:2c7b6bd5b079 23 #define MBED_FATFILESYSTEM_H
nyatla 5:2c7b6bd5b079 24
nyatla 5:2c7b6bd5b079 25 #include "FileSystemLike.h"
nyatla 5:2c7b6bd5b079 26 #include "FileHandle.h"
nyatla 5:2c7b6bd5b079 27 #include "ff.h"
nyatla 5:2c7b6bd5b079 28 #include <stdint.h>
nyatla 5:2c7b6bd5b079 29
nyatla 5:2c7b6bd5b079 30 using namespace mbed;
nyatla 5:2c7b6bd5b079 31
nyatla 5:2c7b6bd5b079 32 class FATFileSystem : public FileSystemLike {
nyatla 5:2c7b6bd5b079 33 public:
nyatla 5:2c7b6bd5b079 34
nyatla 5:2c7b6bd5b079 35 FATFileSystem(const char* n);
nyatla 5:2c7b6bd5b079 36 virtual ~FATFileSystem();
nyatla 5:2c7b6bd5b079 37
nyatla 5:2c7b6bd5b079 38 static FATFileSystem * _ffs[_VOLUMES]; // FATFileSystem objects, as parallel to FatFs drives array
nyatla 5:2c7b6bd5b079 39 FATFS _fs; // Work area (file system object) for logical drive
nyatla 5:2c7b6bd5b079 40 int _fsid;
nyatla 5:2c7b6bd5b079 41
nyatla 5:2c7b6bd5b079 42 virtual FileHandle *open(const char* name, int flags);
nyatla 5:2c7b6bd5b079 43 virtual int remove(const char *filename);
nyatla 5:2c7b6bd5b079 44 virtual int format();
nyatla 5:2c7b6bd5b079 45 virtual DirHandle *opendir(const char *name);
nyatla 5:2c7b6bd5b079 46 virtual int mkdir(const char *name, mode_t mode);
nyatla 5:2c7b6bd5b079 47
nyatla 5:2c7b6bd5b079 48 virtual int disk_initialize() { return 0; }
nyatla 5:2c7b6bd5b079 49 virtual int disk_status() { return 0; }
nyatla 5:2c7b6bd5b079 50 virtual int disk_read(uint8_t * buffer, uint64_t sector) = 0;
nyatla 5:2c7b6bd5b079 51 virtual int disk_write(const uint8_t * buffer, uint64_t sector) = 0;
nyatla 5:2c7b6bd5b079 52 virtual int disk_sync() { return 0; }
nyatla 5:2c7b6bd5b079 53 virtual uint64_t disk_sectors() = 0;
nyatla 5:2c7b6bd5b079 54
nyatla 5:2c7b6bd5b079 55 };
nyatla 5:2c7b6bd5b079 56
nyatla 5:2c7b6bd5b079 57 #endif