Final version.

Dependencies:   F746_GUI F746_SAI_IO UIT_FFT_Real

Fork of F746_Spectrogram by 不韋 呂

Committer:
MikamiUitOpen
Date:
Sun Oct 02 10:51:10 2016 +0000
Revision:
4:c1beacfc42c7
5

Who changed what in which revision?

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