fft

Dependencies:   BSP_DISCO_F746NG SDFileSystem_Warning_Fixed

Committer:
aria19970520
Date:
Fri Mar 06 06:52:14 2020 +0000
Revision:
3:6f7e05dd8d15
Parent:
0:3e46577dc273
fft

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MikamiUitOpen 0:3e46577dc273 1 /* mbed Microcontroller Library
MikamiUitOpen 0:3e46577dc273 2 * Copyright (c) 2006-2013 ARM Limited
MikamiUitOpen 0:3e46577dc273 3 *
MikamiUitOpen 0:3e46577dc273 4 * Licensed under the Apache License, Version 2.0 (the "License");
MikamiUitOpen 0:3e46577dc273 5 * you may not use this file except in compliance with the License.
MikamiUitOpen 0:3e46577dc273 6 * You may obtain a copy of the License at
MikamiUitOpen 0:3e46577dc273 7 *
MikamiUitOpen 0:3e46577dc273 8 * http://www.apache.org/licenses/LICENSE-2.0
MikamiUitOpen 0:3e46577dc273 9 *
MikamiUitOpen 0:3e46577dc273 10 * Unless required by applicable law or agreed to in writing, software
MikamiUitOpen 0:3e46577dc273 11 * distributed under the License is distributed on an "AS IS" BASIS,
MikamiUitOpen 0:3e46577dc273 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
MikamiUitOpen 0:3e46577dc273 13 * See the License for the specific language governing permissions and
MikamiUitOpen 0:3e46577dc273 14 * limitations under the License.
MikamiUitOpen 0:3e46577dc273 15 */
MikamiUitOpen 0:3e46577dc273 16 #ifndef MBED_DIRHANDLE_H
MikamiUitOpen 0:3e46577dc273 17 #define MBED_DIRHANDLE_H
MikamiUitOpen 0:3e46577dc273 18
MikamiUitOpen 0:3e46577dc273 19 #if defined(__ARMCC_VERSION) || defined(__ICCARM__)
MikamiUitOpen 0:3e46577dc273 20 # define NAME_MAX 255
MikamiUitOpen 0:3e46577dc273 21 typedef int mode_t;
MikamiUitOpen 0:3e46577dc273 22
MikamiUitOpen 0:3e46577dc273 23 #else
MikamiUitOpen 0:3e46577dc273 24 # include <sys/syslimits.h>
MikamiUitOpen 0:3e46577dc273 25 #endif
MikamiUitOpen 0:3e46577dc273 26
MikamiUitOpen 0:3e46577dc273 27 #include "FileHandle.h"
MikamiUitOpen 0:3e46577dc273 28
MikamiUitOpen 0:3e46577dc273 29 struct dirent {
MikamiUitOpen 0:3e46577dc273 30 char d_name[NAME_MAX+1];
MikamiUitOpen 0:3e46577dc273 31 };
MikamiUitOpen 0:3e46577dc273 32
MikamiUitOpen 0:3e46577dc273 33 namespace mbed {
MikamiUitOpen 0:3e46577dc273 34
MikamiUitOpen 0:3e46577dc273 35 /** Represents a directory stream. Objects of this type are returned
MikamiUitOpen 0:3e46577dc273 36 * by a FileSystemLike's opendir method. Implementations must define
MikamiUitOpen 0:3e46577dc273 37 * at least closedir, readdir and rewinddir.
MikamiUitOpen 0:3e46577dc273 38 *
MikamiUitOpen 0:3e46577dc273 39 * If a FileSystemLike class defines the opendir method, then the
MikamiUitOpen 0:3e46577dc273 40 * directories of an object of that type can be accessed by
MikamiUitOpen 0:3e46577dc273 41 * DIR *d = opendir("/example/directory") (or opendir("/example")
MikamiUitOpen 0:3e46577dc273 42 * to open the root of the filesystem), and then using readdir(d) etc.
MikamiUitOpen 0:3e46577dc273 43 *
MikamiUitOpen 0:3e46577dc273 44 * The root directory is considered to contain all FileLike and
MikamiUitOpen 0:3e46577dc273 45 * FileSystemLike objects, so the DIR* returned by opendir("/") will
MikamiUitOpen 0:3e46577dc273 46 * reflect this.
MikamiUitOpen 0:3e46577dc273 47 */
MikamiUitOpen 0:3e46577dc273 48 class DirHandle {
MikamiUitOpen 0:3e46577dc273 49
MikamiUitOpen 0:3e46577dc273 50 public:
MikamiUitOpen 0:3e46577dc273 51 /** Closes the directory.
MikamiUitOpen 0:3e46577dc273 52 *
MikamiUitOpen 0:3e46577dc273 53 * @returns
MikamiUitOpen 0:3e46577dc273 54 * 0 on success,
MikamiUitOpen 0:3e46577dc273 55 * -1 on error.
MikamiUitOpen 0:3e46577dc273 56 */
MikamiUitOpen 0:3e46577dc273 57 virtual int closedir()=0;
MikamiUitOpen 0:3e46577dc273 58
MikamiUitOpen 0:3e46577dc273 59 /** Return the directory entry at the current position, and
MikamiUitOpen 0:3e46577dc273 60 * advances the position to the next entry.
MikamiUitOpen 0:3e46577dc273 61 *
MikamiUitOpen 0:3e46577dc273 62 * @returns
MikamiUitOpen 0:3e46577dc273 63 * A pointer to a dirent structure representing the
MikamiUitOpen 0:3e46577dc273 64 * directory entry at the current position, or NULL on reaching
MikamiUitOpen 0:3e46577dc273 65 * end of directory or error.
MikamiUitOpen 0:3e46577dc273 66 */
MikamiUitOpen 0:3e46577dc273 67 virtual struct dirent *readdir()=0;
MikamiUitOpen 0:3e46577dc273 68
MikamiUitOpen 0:3e46577dc273 69 /** Resets the position to the beginning of the directory.
MikamiUitOpen 0:3e46577dc273 70 */
MikamiUitOpen 0:3e46577dc273 71 virtual void rewinddir()=0;
MikamiUitOpen 0:3e46577dc273 72
MikamiUitOpen 0:3e46577dc273 73 /** Returns the current position of the DirHandle.
MikamiUitOpen 0:3e46577dc273 74 *
MikamiUitOpen 0:3e46577dc273 75 * @returns
MikamiUitOpen 0:3e46577dc273 76 * the current position,
MikamiUitOpen 0:3e46577dc273 77 * -1 on error.
MikamiUitOpen 0:3e46577dc273 78 */
MikamiUitOpen 0:3e46577dc273 79 virtual off_t telldir() { return -1; }
MikamiUitOpen 0:3e46577dc273 80
MikamiUitOpen 0:3e46577dc273 81 /** Sets the position of the DirHandle.
MikamiUitOpen 0:3e46577dc273 82 *
MikamiUitOpen 0:3e46577dc273 83 * @param location The location to seek to. Must be a value returned by telldir.
MikamiUitOpen 0:3e46577dc273 84 */
MikamiUitOpen 0:3e46577dc273 85 virtual void seekdir(off_t location) { }
MikamiUitOpen 0:3e46577dc273 86
MikamiUitOpen 0:3e46577dc273 87 virtual ~DirHandle() {}
MikamiUitOpen 0:3e46577dc273 88 };
MikamiUitOpen 0:3e46577dc273 89
MikamiUitOpen 0:3e46577dc273 90 } // namespace mbed
MikamiUitOpen 0:3e46577dc273 91
MikamiUitOpen 0:3e46577dc273 92 typedef mbed::DirHandle DIR;
MikamiUitOpen 0:3e46577dc273 93
MikamiUitOpen 0:3e46577dc273 94 extern "C" {
MikamiUitOpen 0:3e46577dc273 95 DIR *opendir(const char*);
MikamiUitOpen 0:3e46577dc273 96 struct dirent *readdir(DIR *);
MikamiUitOpen 0:3e46577dc273 97 int closedir(DIR*);
MikamiUitOpen 0:3e46577dc273 98 void rewinddir(DIR*);
MikamiUitOpen 0:3e46577dc273 99 long telldir(DIR*);
MikamiUitOpen 0:3e46577dc273 100 void seekdir(DIR*, long);
MikamiUitOpen 0:3e46577dc273 101 int mkdir(const char *name, mode_t n);
MikamiUitOpen 0:3e46577dc273 102 };
MikamiUitOpen 0:3e46577dc273 103
MikamiUitOpen 0:3e46577dc273 104 #endif /* MBED_DIRHANDLE_H */