Update version of EALib.

Dependencies:   FATFileSystem

Fork of EALib by IONX

Revision:
0:0fdadbc3d852
Child:
2:1c6134c80dc5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QSPIFileSystem.h	Thu Sep 26 06:37:02 2013 +0000
@@ -0,0 +1,81 @@
+#ifndef QSPIFILESYSTEM_H
+#define QSPIFILESYSTEM_H
+
+#include "mbed.h"
+#include "FileSystemLike.h"
+
+/** Access the filesystem on an QSPI flash using SPIFI
+ *
+ * @code
+ * #include "mbed.h"
+ * #include "QSPIFileSystem.h"
+ *
+ * QSPIFileSystem qspi("qspi");
+ *  
+ * int main() {
+ *     if (!qspifs.isFormatted()) {
+ *         qspifs.format();
+ *     }
+ *
+ *     FILE *fp = fopen("/qspi/myfile.txt", "w");
+ *     if (fp != NULL) {
+ *         fprintf(fp, "Hello World!\n");
+ *         fclose(fp);
+ *     }
+ * }
+ * @endcode
+ */
+class QSPIFileSystem : public FileSystemLike {
+public:
+
+    /** Create the File System for accessing a QSPI Flash
+     *
+     * @param name The name used to access the virtual filesystem
+     */
+    QSPIFileSystem(const char* name);
+
+    virtual FileHandle *open(const char *filename, int flags);
+    virtual int remove(const char *filename);
+    virtual int rename(const char *oldname, const char *newname);
+    virtual DirHandle *opendir(const char *name);
+    virtual int mkdir(const char *name, mode_t mode);
+
+    /** Creates a new file system on the QSPI flash.
+     * The file system will have the specified size and will always
+     * be positioned at the end of the QSPI flash. If the fsSizeInMB is
+     * less than the size of the QSPI flash the lower end of the flash
+     * will be left untouched.
+     *
+     * @param fsSizeInMB The size of the file system
+     *
+     * @returns
+     *    0 on success,
+     *   -1 on failure.
+     */
+    int format(unsigned int fsSizeInMB = 8);
+
+    /** Tests if there is a file system present on the QSPI flash
+     *
+     * @returns
+     *   True if a valid file system could be found,
+     *   False on failure.
+     */
+    bool isformatted();
+
+    /** Retrieves the start and end addresses for the file system.
+     * The pStartAddr and pEndAddr will only be assigned values if the
+     * function returns true.
+     *
+     * @param pStartAddr Will return the start of the file system area
+     * @param pEndAddr   Will return the end of the file system area
+     *
+     * @returns
+     *   True if there is a file system,
+     *   False on failure.
+     */
+    bool getMemoryBoundaries(uint32_t* pStartAddr, uint32_t* pEndAddr);
+};
+
+#endif
+
+