Lab Checkoff

Dependencies:   SDFileSystem TextLCD mbed-rtos mbed wave_player FATFileSystem

Committer:
doubster
Date:
Wed Nov 13 20:00:28 2013 +0000
Revision:
0:67dbd54e60d4
Lab Checkoff

Who changed what in which revision?

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