change some io settings for TWR-K22F-120M

Dependents:   twr_helloworld

Committer:
Jasper_lee
Date:
Tue Dec 23 03:35:08 2014 +0000
Revision:
0:b16d94660a33
change some io setting used in TWR-K22F120M

Who changed what in which revision?

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