Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lypinator 0:bb348c97df44 1 /* mbed Microcontroller Library
lypinator 0:bb348c97df44 2 * Copyright (c) 2006-2013 ARM Limited
lypinator 0:bb348c97df44 3 *
lypinator 0:bb348c97df44 4 * Licensed under the Apache License, Version 2.0 (the "License");
lypinator 0:bb348c97df44 5 * you may not use this file except in compliance with the License.
lypinator 0:bb348c97df44 6 * You may obtain a copy of the License at
lypinator 0:bb348c97df44 7 *
lypinator 0:bb348c97df44 8 * http://www.apache.org/licenses/LICENSE-2.0
lypinator 0:bb348c97df44 9 *
lypinator 0:bb348c97df44 10 * Unless required by applicable law or agreed to in writing, software
lypinator 0:bb348c97df44 11 * distributed under the License is distributed on an "AS IS" BASIS,
lypinator 0:bb348c97df44 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
lypinator 0:bb348c97df44 13 * See the License for the specific language governing permissions and
lypinator 0:bb348c97df44 14 * limitations under the License.
lypinator 0:bb348c97df44 15 */
lypinator 0:bb348c97df44 16 #ifndef MBED_FILESYSTEMHANDLE_H
lypinator 0:bb348c97df44 17 #define MBED_FILESYSTEMHANDLE_H
lypinator 0:bb348c97df44 18
lypinator 0:bb348c97df44 19 #include "platform/platform.h"
lypinator 0:bb348c97df44 20
lypinator 0:bb348c97df44 21 #include "platform/FileBase.h"
lypinator 0:bb348c97df44 22 #include "platform/FileHandle.h"
lypinator 0:bb348c97df44 23 #include "platform/DirHandle.h"
lypinator 0:bb348c97df44 24 #include "platform/NonCopyable.h"
lypinator 0:bb348c97df44 25
lypinator 0:bb348c97df44 26 namespace mbed {
lypinator 0:bb348c97df44 27 /** \addtogroup platform */
lypinator 0:bb348c97df44 28 /** @{*/
lypinator 0:bb348c97df44 29 /**
lypinator 0:bb348c97df44 30 * \defgroup platform_FileSystemHandle FileSystemHandle functions
lypinator 0:bb348c97df44 31 * @{
lypinator 0:bb348c97df44 32 */
lypinator 0:bb348c97df44 33
lypinator 0:bb348c97df44 34
lypinator 0:bb348c97df44 35 /** A filesystem-like object is one that can be used to open file-like
lypinator 0:bb348c97df44 36 * objects though it by fopen("/name/filename", mode)
lypinator 0:bb348c97df44 37 *
lypinator 0:bb348c97df44 38 * Implementations must define at least open (the default definitions
lypinator 0:bb348c97df44 39 * of the rest of the functions just return error values).
lypinator 0:bb348c97df44 40 *
lypinator 0:bb348c97df44 41 * @note Synchronization level: Set by subclass
lypinator 0:bb348c97df44 42 */
lypinator 0:bb348c97df44 43 class FileSystemHandle : private NonCopyable<FileSystemHandle> {
lypinator 0:bb348c97df44 44 public:
lypinator 0:bb348c97df44 45 /** FileSystemHandle lifetime
lypinator 0:bb348c97df44 46 */
lypinator 0:bb348c97df44 47 virtual ~FileSystemHandle() {}
lypinator 0:bb348c97df44 48
lypinator 0:bb348c97df44 49 /** Open a file on the filesystem
lypinator 0:bb348c97df44 50 *
lypinator 0:bb348c97df44 51 * @param file Destination for the handle to a newly created file
lypinator 0:bb348c97df44 52 * @param filename The name of the file to open
lypinator 0:bb348c97df44 53 * @param flags The flags to open the file in, one of O_RDONLY, O_WRONLY, O_RDWR,
lypinator 0:bb348c97df44 54 * bitwise or'd with one of O_CREAT, O_TRUNC, O_APPEND
lypinator 0:bb348c97df44 55 * @return 0 on success, negative error code on failure
lypinator 0:bb348c97df44 56 */
lypinator 0:bb348c97df44 57 virtual int open(FileHandle **file, const char *filename, int flags) = 0;
lypinator 0:bb348c97df44 58
lypinator 0:bb348c97df44 59 /** Open a directory on the filesystem
lypinator 0:bb348c97df44 60 *
lypinator 0:bb348c97df44 61 * @param dir Destination for the handle to the directory
lypinator 0:bb348c97df44 62 * @param path Name of the directory to open
lypinator 0:bb348c97df44 63 * @return 0 on success, negative error code on failure
lypinator 0:bb348c97df44 64 */
lypinator 0:bb348c97df44 65 virtual int open(DirHandle **dir, const char *path);
lypinator 0:bb348c97df44 66
lypinator 0:bb348c97df44 67 /** Remove a file from the filesystem.
lypinator 0:bb348c97df44 68 *
lypinator 0:bb348c97df44 69 * @param path The name of the file to remove.
lypinator 0:bb348c97df44 70 * @return 0 on success, negative error code on failure
lypinator 0:bb348c97df44 71 */
lypinator 0:bb348c97df44 72 virtual int remove(const char *path);
lypinator 0:bb348c97df44 73
lypinator 0:bb348c97df44 74 /** Rename a file in the filesystem.
lypinator 0:bb348c97df44 75 *
lypinator 0:bb348c97df44 76 * @param path The name of the file to rename.
lypinator 0:bb348c97df44 77 * @param newpath The name to rename it to
lypinator 0:bb348c97df44 78 * @return 0 on success, negative error code on failure
lypinator 0:bb348c97df44 79 */
lypinator 0:bb348c97df44 80 virtual int rename(const char *path, const char *newpath);
lypinator 0:bb348c97df44 81
lypinator 0:bb348c97df44 82 /** Store information about the file in a stat structure
lypinator 0:bb348c97df44 83 *
lypinator 0:bb348c97df44 84 * @param path The name of the file to find information about
lypinator 0:bb348c97df44 85 * @param st The stat buffer to write to
lypinator 0:bb348c97df44 86 * @return 0 on success, negative error code on failure
lypinator 0:bb348c97df44 87 */
lypinator 0:bb348c97df44 88 virtual int stat(const char *path, struct stat *st);
lypinator 0:bb348c97df44 89
lypinator 0:bb348c97df44 90 /** Create a directory in the filesystem.
lypinator 0:bb348c97df44 91 *
lypinator 0:bb348c97df44 92 * @param path The name of the directory to create.
lypinator 0:bb348c97df44 93 * @param mode The permissions with which to create the directory
lypinator 0:bb348c97df44 94 * @return 0 on success, negative error code on failure
lypinator 0:bb348c97df44 95 */
lypinator 0:bb348c97df44 96 virtual int mkdir(const char *path, mode_t mode);
lypinator 0:bb348c97df44 97
lypinator 0:bb348c97df44 98 /** Store information about the mounted filesystem in a statvfs structure
lypinator 0:bb348c97df44 99 *
lypinator 0:bb348c97df44 100 * @param path The name of the file to find information about
lypinator 0:bb348c97df44 101 * @param buf The stat buffer to write to
lypinator 0:bb348c97df44 102 * @return 0 on success, negative error code on failure
lypinator 0:bb348c97df44 103 */
lypinator 0:bb348c97df44 104 virtual int statvfs(const char *path, struct statvfs *buf);
lypinator 0:bb348c97df44 105 };
lypinator 0:bb348c97df44 106 /**@}*/
lypinator 0:bb348c97df44 107
lypinator 0:bb348c97df44 108 /**@}*/
lypinator 0:bb348c97df44 109
lypinator 0:bb348c97df44 110 } // namespace mbed
lypinator 0:bb348c97df44 111
lypinator 0:bb348c97df44 112 #endif
lypinator 0:bb348c97df44 113
lypinator 0:bb348c97df44 114 /** @}*/