mbed.h library with any bug fixes AV finds.

Dependents:   micromouse4_encoder_testing PID_Test Lab1_Test WorkingPID ... more

Committer:
aravindsv
Date:
Mon Nov 02 03:07:12 2015 +0000
Revision:
1:ebce2ad32f95
Parent:
0:ba7650f404af
Changed the RCC timeout value to 500 ms, so total code startup time before program starts running is ~1s. Hopefully no side-effects from lower startup timeouts

Who changed what in which revision?

UserRevisionLine numberNew contents of line
aravindsv 0:ba7650f404af 1 /* mbed Microcontroller Library
aravindsv 0:ba7650f404af 2 * Copyright (c) 2006-2013 ARM Limited
aravindsv 0:ba7650f404af 3 *
aravindsv 0:ba7650f404af 4 * Licensed under the Apache License, Version 2.0 (the "License");
aravindsv 0:ba7650f404af 5 * you may not use this file except in compliance with the License.
aravindsv 0:ba7650f404af 6 * You may obtain a copy of the License at
aravindsv 0:ba7650f404af 7 *
aravindsv 0:ba7650f404af 8 * http://www.apache.org/licenses/LICENSE-2.0
aravindsv 0:ba7650f404af 9 *
aravindsv 0:ba7650f404af 10 * Unless required by applicable law or agreed to in writing, software
aravindsv 0:ba7650f404af 11 * distributed under the License is distributed on an "AS IS" BASIS,
aravindsv 0:ba7650f404af 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
aravindsv 0:ba7650f404af 13 * See the License for the specific language governing permissions and
aravindsv 0:ba7650f404af 14 * limitations under the License.
aravindsv 0:ba7650f404af 15 */
aravindsv 0:ba7650f404af 16 #ifndef MBED_FILESYSTEMLIKE_H
aravindsv 0:ba7650f404af 17 #define MBED_FILESYSTEMLIKE_H
aravindsv 0:ba7650f404af 18
aravindsv 0:ba7650f404af 19 #include "platform.h"
aravindsv 0:ba7650f404af 20
aravindsv 0:ba7650f404af 21 #include "FileBase.h"
aravindsv 0:ba7650f404af 22 #include "FileHandle.h"
aravindsv 0:ba7650f404af 23 #include "DirHandle.h"
aravindsv 0:ba7650f404af 24
aravindsv 0:ba7650f404af 25 namespace mbed {
aravindsv 0:ba7650f404af 26
aravindsv 0:ba7650f404af 27 /** A filesystem-like object is one that can be used to open files
aravindsv 0:ba7650f404af 28 * though it by fopen("/name/filename", mode)
aravindsv 0:ba7650f404af 29 *
aravindsv 0:ba7650f404af 30 * Implementations must define at least open (the default definitions
aravindsv 0:ba7650f404af 31 * of the rest of the functions just return error values).
aravindsv 0:ba7650f404af 32 */
aravindsv 0:ba7650f404af 33 class FileSystemLike : public FileBase {
aravindsv 0:ba7650f404af 34
aravindsv 0:ba7650f404af 35 public:
aravindsv 0:ba7650f404af 36 /** FileSystemLike constructor
aravindsv 0:ba7650f404af 37 *
aravindsv 0:ba7650f404af 38 * @param name The name to use for the filesystem.
aravindsv 0:ba7650f404af 39 */
aravindsv 0:ba7650f404af 40 FileSystemLike(const char *name);
aravindsv 0:ba7650f404af 41
aravindsv 0:ba7650f404af 42 virtual ~FileSystemLike();
aravindsv 0:ba7650f404af 43
aravindsv 0:ba7650f404af 44 static DirHandle *opendir();
aravindsv 0:ba7650f404af 45 friend class BaseDirHandle;
aravindsv 0:ba7650f404af 46
aravindsv 0:ba7650f404af 47 /** Opens a file from the filesystem
aravindsv 0:ba7650f404af 48 *
aravindsv 0:ba7650f404af 49 * @param filename The name of the file to open.
aravindsv 0:ba7650f404af 50 * @param flags One of O_RDONLY, O_WRONLY, or O_RDWR, OR'd with
aravindsv 0:ba7650f404af 51 * zero or more of O_CREAT, O_TRUNC, or O_APPEND.
aravindsv 0:ba7650f404af 52 *
aravindsv 0:ba7650f404af 53 * @returns
aravindsv 0:ba7650f404af 54 * A pointer to a FileHandle object representing the
aravindsv 0:ba7650f404af 55 * file on success, or NULL on failure.
aravindsv 0:ba7650f404af 56 */
aravindsv 0:ba7650f404af 57 virtual FileHandle *open(const char *filename, int flags) = 0;
aravindsv 0:ba7650f404af 58
aravindsv 0:ba7650f404af 59 /** Remove a file from the filesystem.
aravindsv 0:ba7650f404af 60 *
aravindsv 0:ba7650f404af 61 * @param filename the name of the file to remove.
aravindsv 0:ba7650f404af 62 * @param returns 0 on success, -1 on failure.
aravindsv 0:ba7650f404af 63 */
aravindsv 0:ba7650f404af 64 virtual int remove(const char *filename) { return -1; };
aravindsv 0:ba7650f404af 65
aravindsv 0:ba7650f404af 66 /** Rename a file in the filesystem.
aravindsv 0:ba7650f404af 67 *
aravindsv 0:ba7650f404af 68 * @param oldname the name of the file to rename.
aravindsv 0:ba7650f404af 69 * @param newname the name to rename it to.
aravindsv 0:ba7650f404af 70 *
aravindsv 0:ba7650f404af 71 * @returns
aravindsv 0:ba7650f404af 72 * 0 on success,
aravindsv 0:ba7650f404af 73 * -1 on failure.
aravindsv 0:ba7650f404af 74 */
aravindsv 0:ba7650f404af 75 virtual int rename(const char *oldname, const char *newname) { return -1; };
aravindsv 0:ba7650f404af 76
aravindsv 0:ba7650f404af 77 /** Opens a directory in the filesystem and returns a DirHandle
aravindsv 0:ba7650f404af 78 * representing the directory stream.
aravindsv 0:ba7650f404af 79 *
aravindsv 0:ba7650f404af 80 * @param name The name of the directory to open.
aravindsv 0:ba7650f404af 81 *
aravindsv 0:ba7650f404af 82 * @returns
aravindsv 0:ba7650f404af 83 * A DirHandle representing the directory stream, or
aravindsv 0:ba7650f404af 84 * NULL on failure.
aravindsv 0:ba7650f404af 85 */
aravindsv 0:ba7650f404af 86 virtual DirHandle *opendir(const char *name) { return NULL; };
aravindsv 0:ba7650f404af 87
aravindsv 0:ba7650f404af 88 /** Creates a directory in the filesystem.
aravindsv 0:ba7650f404af 89 *
aravindsv 0:ba7650f404af 90 * @param name The name of the directory to create.
aravindsv 0:ba7650f404af 91 * @param mode The permissions to create the directory with.
aravindsv 0:ba7650f404af 92 *
aravindsv 0:ba7650f404af 93 * @returns
aravindsv 0:ba7650f404af 94 * 0 on success,
aravindsv 0:ba7650f404af 95 * -1 on failure.
aravindsv 0:ba7650f404af 96 */
aravindsv 0:ba7650f404af 97 virtual int mkdir(const char *name, mode_t mode) { return -1; }
aravindsv 0:ba7650f404af 98
aravindsv 0:ba7650f404af 99 // TODO other filesystem functions (mkdir, rm, rn, ls etc)
aravindsv 0:ba7650f404af 100 };
aravindsv 0:ba7650f404af 101
aravindsv 0:ba7650f404af 102 } // namespace mbed
aravindsv 0:ba7650f404af 103
aravindsv 0:ba7650f404af 104 #endif