Stand-alone HMD demo system built on mbed FRDM-K64F.

Dependencies:   SDFileSystem mbed FATFileSystem

Committer:
maruishi
Date:
Tue Jul 29 11:41:59 2014 +0000
Revision:
0:9bbe50de69d8
FRDM-K64F based 3D Head-mount-display for Interface(CQ Pub)

Who changed what in which revision?

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