Public fork of mbed-src to add generic stm32f030k6 target

Fork of mbed-src by mbed official

Committer:
emilmont
Date:
Mon Feb 18 11:44:18 2013 +0000
Revision:
2:143cac498751
Parent:
1:62685faffa05
Update mbed sources to Rev 59

Who changed what in which revision?

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