Describes predefine macros for mbed online compiler (armcc)

Committer:
MACRUM
Date:
Thu Mar 16 21:58:09 2017 +0900
Revision:
6:40e873bbc5f7
Add licence header info

Who changed what in which revision?

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