ECE 2036 Project

Dependencies:   mbed wave_player 4DGL-uLCD-SE

Committer:
rconnorlawson
Date:
Fri Nov 03 18:48:48 2017 +0000
Revision:
0:cf4396614a79
Emptied shell code (including doubly linked list) and added comments for all the functionality.;

Who changed what in which revision?

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