Fork of mbed-dev build 137, last build before FAT file system appears to be broken. Also reduced HSE timeout time in STM4XX HAL
Fork of mbed-dev by
drivers/DirHandle.h@160:d5399cc887bb, 2017-03-14 (annotated)
- Committer:
- <>
- Date:
- Tue Mar 14 16:40:56 2017 +0000
- Revision:
- 160:d5399cc887bb
- Parent:
- 149:156823d33999
This updates the lib to the mbed lib v138
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 149:156823d33999 | 1 | /* mbed Microcontroller Library |
<> | 149:156823d33999 | 2 | * Copyright (c) 2006-2013 ARM Limited |
<> | 149:156823d33999 | 3 | * |
<> | 149:156823d33999 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
<> | 149:156823d33999 | 5 | * you may not use this file except in compliance with the License. |
<> | 149:156823d33999 | 6 | * You may obtain a copy of the License at |
<> | 149:156823d33999 | 7 | * |
<> | 149:156823d33999 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
<> | 149:156823d33999 | 9 | * |
<> | 149:156823d33999 | 10 | * Unless required by applicable law or agreed to in writing, software |
<> | 149:156823d33999 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
<> | 149:156823d33999 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
<> | 149:156823d33999 | 13 | * See the License for the specific language governing permissions and |
<> | 149:156823d33999 | 14 | * limitations under the License. |
<> | 149:156823d33999 | 15 | */ |
<> | 149:156823d33999 | 16 | #ifndef MBED_DIRHANDLE_H |
<> | 149:156823d33999 | 17 | #define MBED_DIRHANDLE_H |
<> | 149:156823d33999 | 18 | |
<> | 160:d5399cc887bb | 19 | #include <stdint.h> |
<> | 160:d5399cc887bb | 20 | #include "platform/platform.h" |
<> | 149:156823d33999 | 21 | |
<> | 149:156823d33999 | 22 | #include "FileHandle.h" |
<> | 149:156823d33999 | 23 | |
<> | 149:156823d33999 | 24 | namespace mbed { |
<> | 149:156823d33999 | 25 | /** \addtogroup drivers */ |
<> | 149:156823d33999 | 26 | /** @{*/ |
<> | 149:156823d33999 | 27 | |
<> | 149:156823d33999 | 28 | /** Represents a directory stream. Objects of this type are returned |
<> | 149:156823d33999 | 29 | * by a FileSystemLike's opendir method. Implementations must define |
<> | 149:156823d33999 | 30 | * at least closedir, readdir and rewinddir. |
<> | 149:156823d33999 | 31 | * |
<> | 149:156823d33999 | 32 | * If a FileSystemLike class defines the opendir method, then the |
<> | 149:156823d33999 | 33 | * directories of an object of that type can be accessed by |
<> | 149:156823d33999 | 34 | * DIR *d = opendir("/example/directory") (or opendir("/example") |
<> | 149:156823d33999 | 35 | * to open the root of the filesystem), and then using readdir(d) etc. |
<> | 149:156823d33999 | 36 | * |
<> | 149:156823d33999 | 37 | * The root directory is considered to contain all FileLike and |
<> | 149:156823d33999 | 38 | * FileSystemLike objects, so the DIR* returned by opendir("/") will |
<> | 149:156823d33999 | 39 | * reflect this. |
<> | 149:156823d33999 | 40 | * |
<> | 149:156823d33999 | 41 | * @Note Synchronization level: Set by subclass |
<> | 149:156823d33999 | 42 | */ |
<> | 149:156823d33999 | 43 | class DirHandle { |
<> | 160:d5399cc887bb | 44 | public: |
<> | 160:d5399cc887bb | 45 | MBED_DEPRECATED_SINCE("mbed-os-5.4", |
<> | 160:d5399cc887bb | 46 | "The mbed 2 filesystem classes have been superseeded by the FileSystem api, " |
<> | 160:d5399cc887bb | 47 | "Replaced by File") |
<> | 160:d5399cc887bb | 48 | DirHandle() {} |
<> | 149:156823d33999 | 49 | |
<> | 149:156823d33999 | 50 | /** Closes the directory. |
<> | 149:156823d33999 | 51 | * |
<> | 149:156823d33999 | 52 | * @returns |
<> | 149:156823d33999 | 53 | * 0 on success, |
<> | 149:156823d33999 | 54 | * -1 on error. |
<> | 149:156823d33999 | 55 | */ |
<> | 149:156823d33999 | 56 | virtual int closedir()=0; |
<> | 149:156823d33999 | 57 | |
<> | 149:156823d33999 | 58 | /** Return the directory entry at the current position, and |
<> | 149:156823d33999 | 59 | * advances the position to the next entry. |
<> | 149:156823d33999 | 60 | * |
<> | 149:156823d33999 | 61 | * @returns |
<> | 149:156823d33999 | 62 | * A pointer to a dirent structure representing the |
<> | 149:156823d33999 | 63 | * directory entry at the current position, or NULL on reaching |
<> | 149:156823d33999 | 64 | * end of directory or error. |
<> | 149:156823d33999 | 65 | */ |
<> | 149:156823d33999 | 66 | virtual struct dirent *readdir()=0; |
<> | 149:156823d33999 | 67 | |
<> | 149:156823d33999 | 68 | /** Resets the position to the beginning of the directory. |
<> | 149:156823d33999 | 69 | */ |
<> | 149:156823d33999 | 70 | virtual void rewinddir()=0; |
<> | 149:156823d33999 | 71 | |
<> | 149:156823d33999 | 72 | /** Returns the current position of the DirHandle. |
<> | 149:156823d33999 | 73 | * |
<> | 149:156823d33999 | 74 | * @returns |
<> | 149:156823d33999 | 75 | * the current position, |
<> | 149:156823d33999 | 76 | * -1 on error. |
<> | 149:156823d33999 | 77 | */ |
<> | 149:156823d33999 | 78 | virtual off_t telldir() { return -1; } |
<> | 149:156823d33999 | 79 | |
<> | 149:156823d33999 | 80 | /** Sets the position of the DirHandle. |
<> | 149:156823d33999 | 81 | * |
<> | 149:156823d33999 | 82 | * @param location The location to seek to. Must be a value returned by telldir. |
<> | 149:156823d33999 | 83 | */ |
<> | 149:156823d33999 | 84 | virtual void seekdir(off_t location) { (void)location;} |
<> | 149:156823d33999 | 85 | |
<> | 149:156823d33999 | 86 | virtual ~DirHandle() {} |
<> | 149:156823d33999 | 87 | |
<> | 149:156823d33999 | 88 | protected: |
<> | 149:156823d33999 | 89 | |
<> | 149:156823d33999 | 90 | /** Acquire exclusive access to this object. |
<> | 149:156823d33999 | 91 | */ |
<> | 149:156823d33999 | 92 | virtual void lock() { |
<> | 149:156823d33999 | 93 | // Stub |
<> | 149:156823d33999 | 94 | } |
<> | 149:156823d33999 | 95 | |
<> | 149:156823d33999 | 96 | /** Release exclusive access to this object. |
<> | 149:156823d33999 | 97 | */ |
<> | 149:156823d33999 | 98 | virtual void unlock() { |
<> | 149:156823d33999 | 99 | // Stub |
<> | 149:156823d33999 | 100 | } |
<> | 160:d5399cc887bb | 101 | |
<> | 160:d5399cc887bb | 102 | protected: |
<> | 160:d5399cc887bb | 103 | /** Internal-only constructor to work around deprecated notices when not used |
<> | 160:d5399cc887bb | 104 | *. due to nested deprecations and difficulty of compilers finding their way around |
<> | 160:d5399cc887bb | 105 | * the class hierarchy |
<> | 160:d5399cc887bb | 106 | */ |
<> | 160:d5399cc887bb | 107 | friend class FileSystemLike; |
<> | 160:d5399cc887bb | 108 | DirHandle(int) {} |
<> | 149:156823d33999 | 109 | }; |
<> | 149:156823d33999 | 110 | |
<> | 149:156823d33999 | 111 | } // namespace mbed |
<> | 149:156823d33999 | 112 | |
<> | 149:156823d33999 | 113 | #endif /* MBED_DIRHANDLE_H */ |
<> | 149:156823d33999 | 114 | |
<> | 149:156823d33999 | 115 | /** @}*/ |