Marco Zecchini
/
Example_RTOS
Rtos API example
mbed-os/platform/mbed_retarget.h@0:9fca2b23d0ba, 2019-02-23 (annotated)
- Committer:
- marcozecchini
- Date:
- Sat Feb 23 12:13:36 2019 +0000
- Revision:
- 0:9fca2b23d0ba
final commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
marcozecchini | 0:9fca2b23d0ba | 1 | /* |
marcozecchini | 0:9fca2b23d0ba | 2 | * mbed Microcontroller Library |
marcozecchini | 0:9fca2b23d0ba | 3 | * Copyright (c) 2006-2016 ARM Limited |
marcozecchini | 0:9fca2b23d0ba | 4 | * |
marcozecchini | 0:9fca2b23d0ba | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
marcozecchini | 0:9fca2b23d0ba | 6 | * you may not use this file except in compliance with the License. |
marcozecchini | 0:9fca2b23d0ba | 7 | * You may obtain a copy of the License at |
marcozecchini | 0:9fca2b23d0ba | 8 | * |
marcozecchini | 0:9fca2b23d0ba | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
marcozecchini | 0:9fca2b23d0ba | 10 | * |
marcozecchini | 0:9fca2b23d0ba | 11 | * Unless required by applicable law or agreed to in writing, software |
marcozecchini | 0:9fca2b23d0ba | 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
marcozecchini | 0:9fca2b23d0ba | 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
marcozecchini | 0:9fca2b23d0ba | 14 | * See the License for the specific language governing permissions and |
marcozecchini | 0:9fca2b23d0ba | 15 | * limitations under the License. |
marcozecchini | 0:9fca2b23d0ba | 16 | * |
marcozecchini | 0:9fca2b23d0ba | 17 | */ |
marcozecchini | 0:9fca2b23d0ba | 18 | |
marcozecchini | 0:9fca2b23d0ba | 19 | #ifndef RETARGET_H |
marcozecchini | 0:9fca2b23d0ba | 20 | #define RETARGET_H |
marcozecchini | 0:9fca2b23d0ba | 21 | |
marcozecchini | 0:9fca2b23d0ba | 22 | #if __cplusplus |
marcozecchini | 0:9fca2b23d0ba | 23 | #include <cstdio> |
marcozecchini | 0:9fca2b23d0ba | 24 | #endif //__cplusplus |
marcozecchini | 0:9fca2b23d0ba | 25 | #include <stdint.h> |
marcozecchini | 0:9fca2b23d0ba | 26 | #include <stddef.h> |
marcozecchini | 0:9fca2b23d0ba | 27 | |
marcozecchini | 0:9fca2b23d0ba | 28 | /* We can get the following standard types from sys/types for gcc, but we |
marcozecchini | 0:9fca2b23d0ba | 29 | * need to define the types ourselves for the other compilers that normally |
marcozecchini | 0:9fca2b23d0ba | 30 | * target embedded systems */ |
marcozecchini | 0:9fca2b23d0ba | 31 | typedef signed int ssize_t; ///< Signed size type, usually encodes negative errors |
marcozecchini | 0:9fca2b23d0ba | 32 | typedef signed long off_t; ///< Offset in a data stream |
marcozecchini | 0:9fca2b23d0ba | 33 | #if defined(__ARMCC_VERSION) || !defined(__GNUC__) |
marcozecchini | 0:9fca2b23d0ba | 34 | typedef unsigned int mode_t; ///< Mode for opening files |
marcozecchini | 0:9fca2b23d0ba | 35 | typedef unsigned int dev_t; ///< Device ID type |
marcozecchini | 0:9fca2b23d0ba | 36 | typedef unsigned long ino_t; ///< File serial number |
marcozecchini | 0:9fca2b23d0ba | 37 | typedef unsigned int nlink_t; ///< Number of links to a file |
marcozecchini | 0:9fca2b23d0ba | 38 | typedef unsigned int uid_t; ///< User ID |
marcozecchini | 0:9fca2b23d0ba | 39 | typedef unsigned int gid_t; ///< Group ID |
marcozecchini | 0:9fca2b23d0ba | 40 | #endif |
marcozecchini | 0:9fca2b23d0ba | 41 | |
marcozecchini | 0:9fca2b23d0ba | 42 | #define O_RDONLY 0 ///< Open for reading |
marcozecchini | 0:9fca2b23d0ba | 43 | #define O_WRONLY 1 ///< Open for writing |
marcozecchini | 0:9fca2b23d0ba | 44 | #define O_RDWR 2 ///< Open for reading and writing |
marcozecchini | 0:9fca2b23d0ba | 45 | #define O_CREAT 0x0200 ///< Create file if it does not exist |
marcozecchini | 0:9fca2b23d0ba | 46 | #define O_TRUNC 0x0400 ///< Truncate file to zero length |
marcozecchini | 0:9fca2b23d0ba | 47 | #define O_EXCL 0x0800 ///< Fail if file exists |
marcozecchini | 0:9fca2b23d0ba | 48 | #define O_APPEND 0x0008 ///< Set file offset to end of file prior to each write |
marcozecchini | 0:9fca2b23d0ba | 49 | #define O_BINARY 0x8000 ///< Open file in binary mode |
marcozecchini | 0:9fca2b23d0ba | 50 | |
marcozecchini | 0:9fca2b23d0ba | 51 | #define NAME_MAX 255 ///< Maximum size of a name in a file path |
marcozecchini | 0:9fca2b23d0ba | 52 | |
marcozecchini | 0:9fca2b23d0ba | 53 | #include <time.h> |
marcozecchini | 0:9fca2b23d0ba | 54 | |
marcozecchini | 0:9fca2b23d0ba | 55 | /** \addtogroup platform */ |
marcozecchini | 0:9fca2b23d0ba | 56 | /** @{*/ |
marcozecchini | 0:9fca2b23d0ba | 57 | /** |
marcozecchini | 0:9fca2b23d0ba | 58 | * \defgroup platform_retarget Retarget functions |
marcozecchini | 0:9fca2b23d0ba | 59 | * @{ |
marcozecchini | 0:9fca2b23d0ba | 60 | */ |
marcozecchini | 0:9fca2b23d0ba | 61 | |
marcozecchini | 0:9fca2b23d0ba | 62 | /* DIR declarations must also be here */ |
marcozecchini | 0:9fca2b23d0ba | 63 | #if __cplusplus |
marcozecchini | 0:9fca2b23d0ba | 64 | namespace mbed { |
marcozecchini | 0:9fca2b23d0ba | 65 | |
marcozecchini | 0:9fca2b23d0ba | 66 | class FileHandle; |
marcozecchini | 0:9fca2b23d0ba | 67 | class DirHandle; |
marcozecchini | 0:9fca2b23d0ba | 68 | std::FILE *mbed_fdopen(FileHandle *fh, const char *mode); |
marcozecchini | 0:9fca2b23d0ba | 69 | |
marcozecchini | 0:9fca2b23d0ba | 70 | } |
marcozecchini | 0:9fca2b23d0ba | 71 | typedef mbed::DirHandle DIR; |
marcozecchini | 0:9fca2b23d0ba | 72 | #else |
marcozecchini | 0:9fca2b23d0ba | 73 | typedef struct Dir DIR; |
marcozecchini | 0:9fca2b23d0ba | 74 | #endif |
marcozecchini | 0:9fca2b23d0ba | 75 | |
marcozecchini | 0:9fca2b23d0ba | 76 | #if __cplusplus |
marcozecchini | 0:9fca2b23d0ba | 77 | extern "C" { |
marcozecchini | 0:9fca2b23d0ba | 78 | #endif |
marcozecchini | 0:9fca2b23d0ba | 79 | DIR *opendir(const char*); |
marcozecchini | 0:9fca2b23d0ba | 80 | struct dirent *readdir(DIR *); |
marcozecchini | 0:9fca2b23d0ba | 81 | int closedir(DIR*); |
marcozecchini | 0:9fca2b23d0ba | 82 | void rewinddir(DIR*); |
marcozecchini | 0:9fca2b23d0ba | 83 | long telldir(DIR*); |
marcozecchini | 0:9fca2b23d0ba | 84 | void seekdir(DIR*, long); |
marcozecchini | 0:9fca2b23d0ba | 85 | int mkdir(const char *name, mode_t n); |
marcozecchini | 0:9fca2b23d0ba | 86 | #if __cplusplus |
marcozecchini | 0:9fca2b23d0ba | 87 | }; |
marcozecchini | 0:9fca2b23d0ba | 88 | #endif |
marcozecchini | 0:9fca2b23d0ba | 89 | |
marcozecchini | 0:9fca2b23d0ba | 90 | |
marcozecchini | 0:9fca2b23d0ba | 91 | /* The intent of this section is to unify the errno error values to match |
marcozecchini | 0:9fca2b23d0ba | 92 | * the POSIX definitions for the GCC_ARM, ARMCC and IAR compilers. This is |
marcozecchini | 0:9fca2b23d0ba | 93 | * necessary because the ARMCC/IAR errno.h, or sys/stat.h are missing some |
marcozecchini | 0:9fca2b23d0ba | 94 | * symbol definitions used by the POSIX filesystem API to return errno codes. |
marcozecchini | 0:9fca2b23d0ba | 95 | * Note also that ARMCC errno.h defines some symbol values differently from |
marcozecchini | 0:9fca2b23d0ba | 96 | * the GCC_ARM/IAR/standard POSIX definitions. The definitions guard against |
marcozecchini | 0:9fca2b23d0ba | 97 | * this and future changes by changing the symbol definition as shown below. |
marcozecchini | 0:9fca2b23d0ba | 98 | */ |
marcozecchini | 0:9fca2b23d0ba | 99 | #undef EPERM |
marcozecchini | 0:9fca2b23d0ba | 100 | #define EPERM 1 /* Operation not permitted */ |
marcozecchini | 0:9fca2b23d0ba | 101 | #undef ENOENT |
marcozecchini | 0:9fca2b23d0ba | 102 | #define ENOENT 2 /* No such file or directory */ |
marcozecchini | 0:9fca2b23d0ba | 103 | #undef ESRCH |
marcozecchini | 0:9fca2b23d0ba | 104 | #define ESRCH 3 /* No such process */ |
marcozecchini | 0:9fca2b23d0ba | 105 | #undef EINTR |
marcozecchini | 0:9fca2b23d0ba | 106 | #define EINTR 4 /* Interrupted system call */ |
marcozecchini | 0:9fca2b23d0ba | 107 | #undef EIO |
marcozecchini | 0:9fca2b23d0ba | 108 | #define EIO 5 /* I/O error */ |
marcozecchini | 0:9fca2b23d0ba | 109 | #undef ENXIO |
marcozecchini | 0:9fca2b23d0ba | 110 | #define ENXIO 6 /* No such device or address */ |
marcozecchini | 0:9fca2b23d0ba | 111 | #undef E2BIG |
marcozecchini | 0:9fca2b23d0ba | 112 | #define E2BIG 7 /* Argument list too long */ |
marcozecchini | 0:9fca2b23d0ba | 113 | #undef ENOEXEC |
marcozecchini | 0:9fca2b23d0ba | 114 | #define ENOEXEC 8 /* Exec format error */ |
marcozecchini | 0:9fca2b23d0ba | 115 | #undef EBADF |
marcozecchini | 0:9fca2b23d0ba | 116 | #define EBADF 9 /* Bad file number */ |
marcozecchini | 0:9fca2b23d0ba | 117 | #undef ECHILD |
marcozecchini | 0:9fca2b23d0ba | 118 | #define ECHILD 10 /* No child processes */ |
marcozecchini | 0:9fca2b23d0ba | 119 | #undef EAGAIN |
marcozecchini | 0:9fca2b23d0ba | 120 | #define EAGAIN 11 /* Try again */ |
marcozecchini | 0:9fca2b23d0ba | 121 | #undef ENOMEM |
marcozecchini | 0:9fca2b23d0ba | 122 | #define ENOMEM 12 /* Out of memory */ |
marcozecchini | 0:9fca2b23d0ba | 123 | #undef EACCES |
marcozecchini | 0:9fca2b23d0ba | 124 | #define EACCES 13 /* Permission denied */ |
marcozecchini | 0:9fca2b23d0ba | 125 | #undef EFAULT |
marcozecchini | 0:9fca2b23d0ba | 126 | #define EFAULT 14 /* Bad address */ |
marcozecchini | 0:9fca2b23d0ba | 127 | #undef ENOTBLK |
marcozecchini | 0:9fca2b23d0ba | 128 | #define ENOTBLK 15 /* Block device required */ |
marcozecchini | 0:9fca2b23d0ba | 129 | #undef EBUSY |
marcozecchini | 0:9fca2b23d0ba | 130 | #define EBUSY 16 /* Device or resource busy */ |
marcozecchini | 0:9fca2b23d0ba | 131 | #undef EEXIST |
marcozecchini | 0:9fca2b23d0ba | 132 | #define EEXIST 17 /* File exists */ |
marcozecchini | 0:9fca2b23d0ba | 133 | #undef EXDEV |
marcozecchini | 0:9fca2b23d0ba | 134 | #define EXDEV 18 /* Cross-device link */ |
marcozecchini | 0:9fca2b23d0ba | 135 | #undef ENODEV |
marcozecchini | 0:9fca2b23d0ba | 136 | #define ENODEV 19 /* No such device */ |
marcozecchini | 0:9fca2b23d0ba | 137 | #undef ENOTDIR |
marcozecchini | 0:9fca2b23d0ba | 138 | #define ENOTDIR 20 /* Not a directory */ |
marcozecchini | 0:9fca2b23d0ba | 139 | #undef EISDIR |
marcozecchini | 0:9fca2b23d0ba | 140 | #define EISDIR 21 /* Is a directory */ |
marcozecchini | 0:9fca2b23d0ba | 141 | #undef EINVAL |
marcozecchini | 0:9fca2b23d0ba | 142 | #define EINVAL 22 /* Invalid argument */ |
marcozecchini | 0:9fca2b23d0ba | 143 | #undef ENFILE |
marcozecchini | 0:9fca2b23d0ba | 144 | #define ENFILE 23 /* File table overflow */ |
marcozecchini | 0:9fca2b23d0ba | 145 | #undef EMFILE |
marcozecchini | 0:9fca2b23d0ba | 146 | #define EMFILE 24 /* Too many open files */ |
marcozecchini | 0:9fca2b23d0ba | 147 | #undef ENOTTY |
marcozecchini | 0:9fca2b23d0ba | 148 | #define ENOTTY 25 /* Not a typewriter */ |
marcozecchini | 0:9fca2b23d0ba | 149 | #undef ETXTBSY |
marcozecchini | 0:9fca2b23d0ba | 150 | #define ETXTBSY 26 /* Text file busy */ |
marcozecchini | 0:9fca2b23d0ba | 151 | #undef EFBIG |
marcozecchini | 0:9fca2b23d0ba | 152 | #define EFBIG 27 /* File too large */ |
marcozecchini | 0:9fca2b23d0ba | 153 | #undef ENOSPC |
marcozecchini | 0:9fca2b23d0ba | 154 | #define ENOSPC 28 /* No space left on device */ |
marcozecchini | 0:9fca2b23d0ba | 155 | #undef ESPIPE |
marcozecchini | 0:9fca2b23d0ba | 156 | #define ESPIPE 29 /* Illegal seek */ |
marcozecchini | 0:9fca2b23d0ba | 157 | #undef EROFS |
marcozecchini | 0:9fca2b23d0ba | 158 | #define EROFS 30 /* Read-only file system */ |
marcozecchini | 0:9fca2b23d0ba | 159 | #undef EMLINK |
marcozecchini | 0:9fca2b23d0ba | 160 | #define EMLINK 31 /* Too many links */ |
marcozecchini | 0:9fca2b23d0ba | 161 | #undef EPIPE |
marcozecchini | 0:9fca2b23d0ba | 162 | #define EPIPE 32 /* Broken pipe */ |
marcozecchini | 0:9fca2b23d0ba | 163 | #undef EDOM |
marcozecchini | 0:9fca2b23d0ba | 164 | #define EDOM 33 /* Math argument out of domain of func */ |
marcozecchini | 0:9fca2b23d0ba | 165 | #undef ERANGE |
marcozecchini | 0:9fca2b23d0ba | 166 | #define ERANGE 34 /* Math result not representable */ |
marcozecchini | 0:9fca2b23d0ba | 167 | #undef EDEADLK |
marcozecchini | 0:9fca2b23d0ba | 168 | #define EDEADLK 35 /* Resource deadlock would occur */ |
marcozecchini | 0:9fca2b23d0ba | 169 | #undef ENAMETOOLONG |
marcozecchini | 0:9fca2b23d0ba | 170 | #define ENAMETOOLONG 36 /* File name too long */ |
marcozecchini | 0:9fca2b23d0ba | 171 | #undef ENOLCK |
marcozecchini | 0:9fca2b23d0ba | 172 | #define ENOLCK 37 /* No record locks available */ |
marcozecchini | 0:9fca2b23d0ba | 173 | #undef ENOSYS |
marcozecchini | 0:9fca2b23d0ba | 174 | #define ENOSYS 38 /* Function not implemented */ |
marcozecchini | 0:9fca2b23d0ba | 175 | #undef ENOTEMPTY |
marcozecchini | 0:9fca2b23d0ba | 176 | #define ENOTEMPTY 39 /* Directory not empty */ |
marcozecchini | 0:9fca2b23d0ba | 177 | #undef ELOOP |
marcozecchini | 0:9fca2b23d0ba | 178 | #define ELOOP 40 /* Too many symbolic links encountered */ |
marcozecchini | 0:9fca2b23d0ba | 179 | #undef EWOULDBLOCK |
marcozecchini | 0:9fca2b23d0ba | 180 | #define EWOULDBLOCK EAGAIN /* Operation would block */ |
marcozecchini | 0:9fca2b23d0ba | 181 | #undef ENOMSG |
marcozecchini | 0:9fca2b23d0ba | 182 | #define ENOMSG 42 /* No message of desired type */ |
marcozecchini | 0:9fca2b23d0ba | 183 | #undef EIDRM |
marcozecchini | 0:9fca2b23d0ba | 184 | #define EIDRM 43 /* Identifier removed */ |
marcozecchini | 0:9fca2b23d0ba | 185 | #undef ECHRNG |
marcozecchini | 0:9fca2b23d0ba | 186 | #define ECHRNG 44 /* Channel number out of range */ |
marcozecchini | 0:9fca2b23d0ba | 187 | #undef EL2NSYNC |
marcozecchini | 0:9fca2b23d0ba | 188 | #define EL2NSYNC 45 /* Level 2 not synchronized */ |
marcozecchini | 0:9fca2b23d0ba | 189 | #undef EL3HLT |
marcozecchini | 0:9fca2b23d0ba | 190 | #define EL3HLT 46 /* Level 3 halted */ |
marcozecchini | 0:9fca2b23d0ba | 191 | #undef EL3RST |
marcozecchini | 0:9fca2b23d0ba | 192 | #define EL3RST 47 /* Level 3 reset */ |
marcozecchini | 0:9fca2b23d0ba | 193 | #undef ELNRNG |
marcozecchini | 0:9fca2b23d0ba | 194 | #define ELNRNG 48 /* Link number out of range */ |
marcozecchini | 0:9fca2b23d0ba | 195 | #undef EUNATCH |
marcozecchini | 0:9fca2b23d0ba | 196 | #define EUNATCH 49 /* Protocol driver not attached */ |
marcozecchini | 0:9fca2b23d0ba | 197 | #undef ENOCSI |
marcozecchini | 0:9fca2b23d0ba | 198 | #define ENOCSI 50 /* No CSI structure available */ |
marcozecchini | 0:9fca2b23d0ba | 199 | #undef EL2HLT |
marcozecchini | 0:9fca2b23d0ba | 200 | #define EL2HLT 51 /* Level 2 halted */ |
marcozecchini | 0:9fca2b23d0ba | 201 | #undef EBADE |
marcozecchini | 0:9fca2b23d0ba | 202 | #define EBADE 52 /* Invalid exchange */ |
marcozecchini | 0:9fca2b23d0ba | 203 | #undef EBADR |
marcozecchini | 0:9fca2b23d0ba | 204 | #define EBADR 53 /* Invalid request descriptor */ |
marcozecchini | 0:9fca2b23d0ba | 205 | #undef EXFULL |
marcozecchini | 0:9fca2b23d0ba | 206 | #define EXFULL 54 /* Exchange full */ |
marcozecchini | 0:9fca2b23d0ba | 207 | #undef ENOANO |
marcozecchini | 0:9fca2b23d0ba | 208 | #define ENOANO 55 /* No anode */ |
marcozecchini | 0:9fca2b23d0ba | 209 | #undef EBADRQC |
marcozecchini | 0:9fca2b23d0ba | 210 | #define EBADRQC 56 /* Invalid request code */ |
marcozecchini | 0:9fca2b23d0ba | 211 | #undef EBADSLT |
marcozecchini | 0:9fca2b23d0ba | 212 | #define EBADSLT 57 /* Invalid slot */ |
marcozecchini | 0:9fca2b23d0ba | 213 | #undef EDEADLOCK |
marcozecchini | 0:9fca2b23d0ba | 214 | #define EDEADLOCK EDEADLK /* Resource deadlock would occur */ |
marcozecchini | 0:9fca2b23d0ba | 215 | #undef EBFONT |
marcozecchini | 0:9fca2b23d0ba | 216 | #define EBFONT 59 /* Bad font file format */ |
marcozecchini | 0:9fca2b23d0ba | 217 | #undef ENOSTR |
marcozecchini | 0:9fca2b23d0ba | 218 | #define ENOSTR 60 /* Device not a stream */ |
marcozecchini | 0:9fca2b23d0ba | 219 | #undef ENODATA |
marcozecchini | 0:9fca2b23d0ba | 220 | #define ENODATA 61 /* No data available */ |
marcozecchini | 0:9fca2b23d0ba | 221 | #undef ETIME |
marcozecchini | 0:9fca2b23d0ba | 222 | #define ETIME 62 /* Timer expired */ |
marcozecchini | 0:9fca2b23d0ba | 223 | #undef ENOSR |
marcozecchini | 0:9fca2b23d0ba | 224 | #define ENOSR 63 /* Out of streams resources */ |
marcozecchini | 0:9fca2b23d0ba | 225 | #undef ENONET |
marcozecchini | 0:9fca2b23d0ba | 226 | #define ENONET 64 /* Machine is not on the network */ |
marcozecchini | 0:9fca2b23d0ba | 227 | #undef ENOPKG |
marcozecchini | 0:9fca2b23d0ba | 228 | #define ENOPKG 65 /* Package not installed */ |
marcozecchini | 0:9fca2b23d0ba | 229 | #undef EREMOTE |
marcozecchini | 0:9fca2b23d0ba | 230 | #define EREMOTE 66 /* Object is remote */ |
marcozecchini | 0:9fca2b23d0ba | 231 | #undef ENOLINK |
marcozecchini | 0:9fca2b23d0ba | 232 | #define ENOLINK 67 /* Link has been severed */ |
marcozecchini | 0:9fca2b23d0ba | 233 | #undef EADV |
marcozecchini | 0:9fca2b23d0ba | 234 | #define EADV 68 /* Advertise error */ |
marcozecchini | 0:9fca2b23d0ba | 235 | #undef ESRMNT |
marcozecchini | 0:9fca2b23d0ba | 236 | #define ESRMNT 69 /* Srmount error */ |
marcozecchini | 0:9fca2b23d0ba | 237 | #undef ECOMM |
marcozecchini | 0:9fca2b23d0ba | 238 | #define ECOMM 70 /* Communication error on send */ |
marcozecchini | 0:9fca2b23d0ba | 239 | #undef EPROTO |
marcozecchini | 0:9fca2b23d0ba | 240 | #define EPROTO 71 /* Protocol error */ |
marcozecchini | 0:9fca2b23d0ba | 241 | #undef EMULTIHOP |
marcozecchini | 0:9fca2b23d0ba | 242 | #define EMULTIHOP 72 /* Multihop attempted */ |
marcozecchini | 0:9fca2b23d0ba | 243 | #undef EDOTDOT |
marcozecchini | 0:9fca2b23d0ba | 244 | #define EDOTDOT 73 /* RFS specific error */ |
marcozecchini | 0:9fca2b23d0ba | 245 | #undef EBADMSG |
marcozecchini | 0:9fca2b23d0ba | 246 | #define EBADMSG 74 /* Not a data message */ |
marcozecchini | 0:9fca2b23d0ba | 247 | #undef EOVERFLOW |
marcozecchini | 0:9fca2b23d0ba | 248 | #define EOVERFLOW 75 /* Value too large for defined data type */ |
marcozecchini | 0:9fca2b23d0ba | 249 | #undef ENOTUNIQ |
marcozecchini | 0:9fca2b23d0ba | 250 | #define ENOTUNIQ 76 /* Name not unique on network */ |
marcozecchini | 0:9fca2b23d0ba | 251 | #undef EBADFD |
marcozecchini | 0:9fca2b23d0ba | 252 | #define EBADFD 77 /* File descriptor in bad state */ |
marcozecchini | 0:9fca2b23d0ba | 253 | #undef EREMCHG |
marcozecchini | 0:9fca2b23d0ba | 254 | #define EREMCHG 78 /* Remote address changed */ |
marcozecchini | 0:9fca2b23d0ba | 255 | #undef ELIBACC |
marcozecchini | 0:9fca2b23d0ba | 256 | #define ELIBACC 79 /* Can not access a needed shared library */ |
marcozecchini | 0:9fca2b23d0ba | 257 | #undef ELIBBAD |
marcozecchini | 0:9fca2b23d0ba | 258 | #define ELIBBAD 80 /* Accessing a corrupted shared library */ |
marcozecchini | 0:9fca2b23d0ba | 259 | #undef ELIBSCN |
marcozecchini | 0:9fca2b23d0ba | 260 | #define ELIBSCN 81 /* .lib section in a.out corrupted */ |
marcozecchini | 0:9fca2b23d0ba | 261 | #undef ELIBMAX |
marcozecchini | 0:9fca2b23d0ba | 262 | #define ELIBMAX 82 /* Attempting to link in too many shared libraries */ |
marcozecchini | 0:9fca2b23d0ba | 263 | #undef ELIBEXEC |
marcozecchini | 0:9fca2b23d0ba | 264 | #define ELIBEXEC 83 /* Cannot exec a shared library directly */ |
marcozecchini | 0:9fca2b23d0ba | 265 | #undef EILSEQ |
marcozecchini | 0:9fca2b23d0ba | 266 | #define EILSEQ 84 /* Illegal byte sequence */ |
marcozecchini | 0:9fca2b23d0ba | 267 | #undef ERESTART |
marcozecchini | 0:9fca2b23d0ba | 268 | #define ERESTART 85 /* Interrupted system call should be restarted */ |
marcozecchini | 0:9fca2b23d0ba | 269 | #undef ESTRPIPE |
marcozecchini | 0:9fca2b23d0ba | 270 | #define ESTRPIPE 86 /* Streams pipe error */ |
marcozecchini | 0:9fca2b23d0ba | 271 | #undef EUSERS |
marcozecchini | 0:9fca2b23d0ba | 272 | #define EUSERS 87 /* Too many users */ |
marcozecchini | 0:9fca2b23d0ba | 273 | #undef ENOTSOCK |
marcozecchini | 0:9fca2b23d0ba | 274 | #define ENOTSOCK 88 /* Socket operation on non-socket */ |
marcozecchini | 0:9fca2b23d0ba | 275 | #undef EDESTADDRREQ |
marcozecchini | 0:9fca2b23d0ba | 276 | #define EDESTADDRREQ 89 /* Destination address required */ |
marcozecchini | 0:9fca2b23d0ba | 277 | #undef EMSGSIZE |
marcozecchini | 0:9fca2b23d0ba | 278 | #define EMSGSIZE 90 /* Message too long */ |
marcozecchini | 0:9fca2b23d0ba | 279 | #undef EPROTOTYPE |
marcozecchini | 0:9fca2b23d0ba | 280 | #define EPROTOTYPE 91 /* Protocol wrong type for socket */ |
marcozecchini | 0:9fca2b23d0ba | 281 | #undef ENOPROTOOPT |
marcozecchini | 0:9fca2b23d0ba | 282 | #define ENOPROTOOPT 92 /* Protocol not available */ |
marcozecchini | 0:9fca2b23d0ba | 283 | #undef EPROTONOSUPPORT |
marcozecchini | 0:9fca2b23d0ba | 284 | #define EPROTONOSUPPORT 93 /* Protocol not supported */ |
marcozecchini | 0:9fca2b23d0ba | 285 | #undef ESOCKTNOSUPPORT |
marcozecchini | 0:9fca2b23d0ba | 286 | #define ESOCKTNOSUPPORT 94 /* Socket type not supported */ |
marcozecchini | 0:9fca2b23d0ba | 287 | #undef EOPNOTSUPP |
marcozecchini | 0:9fca2b23d0ba | 288 | #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ |
marcozecchini | 0:9fca2b23d0ba | 289 | #undef EPFNOSUPPORT |
marcozecchini | 0:9fca2b23d0ba | 290 | #define EPFNOSUPPORT 96 /* Protocol family not supported */ |
marcozecchini | 0:9fca2b23d0ba | 291 | #undef EAFNOSUPPORT |
marcozecchini | 0:9fca2b23d0ba | 292 | #define EAFNOSUPPORT 97 /* Address family not supported by protocol */ |
marcozecchini | 0:9fca2b23d0ba | 293 | #undef EADDRINUSE |
marcozecchini | 0:9fca2b23d0ba | 294 | #define EADDRINUSE 98 /* Address already in use */ |
marcozecchini | 0:9fca2b23d0ba | 295 | #undef EADDRNOTAVAIL |
marcozecchini | 0:9fca2b23d0ba | 296 | #define EADDRNOTAVAIL 99 /* Cannot assign requested address */ |
marcozecchini | 0:9fca2b23d0ba | 297 | #undef ENETDOWN |
marcozecchini | 0:9fca2b23d0ba | 298 | #define ENETDOWN 100 /* Network is down */ |
marcozecchini | 0:9fca2b23d0ba | 299 | #undef ENETUNREACH |
marcozecchini | 0:9fca2b23d0ba | 300 | #define ENETUNREACH 101 /* Network is unreachable */ |
marcozecchini | 0:9fca2b23d0ba | 301 | #undef ENETRESET |
marcozecchini | 0:9fca2b23d0ba | 302 | #define ENETRESET 102 /* Network dropped connection because of reset */ |
marcozecchini | 0:9fca2b23d0ba | 303 | #undef ECONNABORTED |
marcozecchini | 0:9fca2b23d0ba | 304 | #define ECONNABORTED 103 /* Software caused connection abort */ |
marcozecchini | 0:9fca2b23d0ba | 305 | #undef ECONNRESET |
marcozecchini | 0:9fca2b23d0ba | 306 | #define ECONNRESET 104 /* Connection reset by peer */ |
marcozecchini | 0:9fca2b23d0ba | 307 | #undef ENOBUFS |
marcozecchini | 0:9fca2b23d0ba | 308 | #define ENOBUFS 105 /* No buffer space available */ |
marcozecchini | 0:9fca2b23d0ba | 309 | #undef EISCONN |
marcozecchini | 0:9fca2b23d0ba | 310 | #define EISCONN 106 /* Transport endpoint is already connected */ |
marcozecchini | 0:9fca2b23d0ba | 311 | #undef ENOTCONN |
marcozecchini | 0:9fca2b23d0ba | 312 | #define ENOTCONN 107 /* Transport endpoint is not connected */ |
marcozecchini | 0:9fca2b23d0ba | 313 | #undef ESHUTDOWN |
marcozecchini | 0:9fca2b23d0ba | 314 | #define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ |
marcozecchini | 0:9fca2b23d0ba | 315 | #undef ETOOMANYREFS |
marcozecchini | 0:9fca2b23d0ba | 316 | #define ETOOMANYREFS 109 /* Too many references: cannot splice */ |
marcozecchini | 0:9fca2b23d0ba | 317 | #undef ETIMEDOUT |
marcozecchini | 0:9fca2b23d0ba | 318 | #define ETIMEDOUT 110 /* Connection timed out */ |
marcozecchini | 0:9fca2b23d0ba | 319 | #undef ECONNREFUSED |
marcozecchini | 0:9fca2b23d0ba | 320 | #define ECONNREFUSED 111 /* Connection refused */ |
marcozecchini | 0:9fca2b23d0ba | 321 | #undef EHOSTDOWN |
marcozecchini | 0:9fca2b23d0ba | 322 | #define EHOSTDOWN 112 /* Host is down */ |
marcozecchini | 0:9fca2b23d0ba | 323 | #undef EHOSTUNREACH |
marcozecchini | 0:9fca2b23d0ba | 324 | #define EHOSTUNREACH 113 /* No route to host */ |
marcozecchini | 0:9fca2b23d0ba | 325 | #undef EALREADY |
marcozecchini | 0:9fca2b23d0ba | 326 | #define EALREADY 114 /* Operation already in progress */ |
marcozecchini | 0:9fca2b23d0ba | 327 | #undef EINPROGRESS |
marcozecchini | 0:9fca2b23d0ba | 328 | #define EINPROGRESS 115 /* Operation now in progress */ |
marcozecchini | 0:9fca2b23d0ba | 329 | #undef ESTALE |
marcozecchini | 0:9fca2b23d0ba | 330 | #define ESTALE 116 /* Stale NFS file handle */ |
marcozecchini | 0:9fca2b23d0ba | 331 | #undef EUCLEAN |
marcozecchini | 0:9fca2b23d0ba | 332 | #define EUCLEAN 117 /* Structure needs cleaning */ |
marcozecchini | 0:9fca2b23d0ba | 333 | #undef ENOTNAM |
marcozecchini | 0:9fca2b23d0ba | 334 | #define ENOTNAM 118 /* Not a XENIX named type file */ |
marcozecchini | 0:9fca2b23d0ba | 335 | #undef ENAVAIL |
marcozecchini | 0:9fca2b23d0ba | 336 | #define ENAVAIL 119 /* No XENIX semaphores available */ |
marcozecchini | 0:9fca2b23d0ba | 337 | #undef EISNAM |
marcozecchini | 0:9fca2b23d0ba | 338 | #define EISNAM 120 /* Is a named type file */ |
marcozecchini | 0:9fca2b23d0ba | 339 | #undef EREMOTEIO |
marcozecchini | 0:9fca2b23d0ba | 340 | #define EREMOTEIO 121 /* Remote I/O error */ |
marcozecchini | 0:9fca2b23d0ba | 341 | #undef EDQUOT |
marcozecchini | 0:9fca2b23d0ba | 342 | #define EDQUOT 122 /* Quota exceeded */ |
marcozecchini | 0:9fca2b23d0ba | 343 | #undef ENOMEDIUM |
marcozecchini | 0:9fca2b23d0ba | 344 | #define ENOMEDIUM 123 /* No medium found */ |
marcozecchini | 0:9fca2b23d0ba | 345 | #undef EMEDIUMTYPE |
marcozecchini | 0:9fca2b23d0ba | 346 | #define EMEDIUMTYPE 124 /* Wrong medium type */ |
marcozecchini | 0:9fca2b23d0ba | 347 | #undef ECANCELED |
marcozecchini | 0:9fca2b23d0ba | 348 | #define ECANCELED 125 /* Operation Canceled */ |
marcozecchini | 0:9fca2b23d0ba | 349 | #undef ENOKEY |
marcozecchini | 0:9fca2b23d0ba | 350 | #define ENOKEY 126 /* Required key not available */ |
marcozecchini | 0:9fca2b23d0ba | 351 | #undef EKEYEXPIRED |
marcozecchini | 0:9fca2b23d0ba | 352 | #define EKEYEXPIRED 127 /* Key has expired */ |
marcozecchini | 0:9fca2b23d0ba | 353 | #undef EKEYREVOKED |
marcozecchini | 0:9fca2b23d0ba | 354 | #define EKEYREVOKED 128 /* Key has been revoked */ |
marcozecchini | 0:9fca2b23d0ba | 355 | #undef EKEYREJECTED |
marcozecchini | 0:9fca2b23d0ba | 356 | #define EKEYREJECTED 129 /* Key was rejected by service */ |
marcozecchini | 0:9fca2b23d0ba | 357 | #undef EOWNERDEAD |
marcozecchini | 0:9fca2b23d0ba | 358 | #define EOWNERDEAD 130 /* Owner died */ |
marcozecchini | 0:9fca2b23d0ba | 359 | #undef ENOTRECOVERABLE |
marcozecchini | 0:9fca2b23d0ba | 360 | #define ENOTRECOVERABLE 131 /* State not recoverable */ |
marcozecchini | 0:9fca2b23d0ba | 361 | |
marcozecchini | 0:9fca2b23d0ba | 362 | /* Missing stat.h defines. |
marcozecchini | 0:9fca2b23d0ba | 363 | * The following are sys/stat.h definitions not currently present in the ARMCC |
marcozecchini | 0:9fca2b23d0ba | 364 | * errno.h. Note, ARMCC errno.h defines some symbol values differing from |
marcozecchini | 0:9fca2b23d0ba | 365 | * GCC_ARM/IAR/standard POSIX definitions. Guard against this and future |
marcozecchini | 0:9fca2b23d0ba | 366 | * changes by changing the symbol definition for filesystem use. |
marcozecchini | 0:9fca2b23d0ba | 367 | */ |
marcozecchini | 0:9fca2b23d0ba | 368 | #define _IFMT 0170000 //< type of file |
marcozecchini | 0:9fca2b23d0ba | 369 | #define _IFSOCK 0140000 //< socket |
marcozecchini | 0:9fca2b23d0ba | 370 | #define _IFLNK 0120000 //< symbolic link |
marcozecchini | 0:9fca2b23d0ba | 371 | #define _IFREG 0100000 //< regular |
marcozecchini | 0:9fca2b23d0ba | 372 | #define _IFBLK 0060000 //< block special |
marcozecchini | 0:9fca2b23d0ba | 373 | #define _IFDIR 0040000 //< directory |
marcozecchini | 0:9fca2b23d0ba | 374 | #define _IFCHR 0020000 //< character special |
marcozecchini | 0:9fca2b23d0ba | 375 | #define _IFIFO 0010000 //< fifo special |
marcozecchini | 0:9fca2b23d0ba | 376 | |
marcozecchini | 0:9fca2b23d0ba | 377 | #define S_IFMT _IFMT //< type of file |
marcozecchini | 0:9fca2b23d0ba | 378 | #define S_IFSOCK _IFSOCK //< socket |
marcozecchini | 0:9fca2b23d0ba | 379 | #define S_IFLNK _IFLNK //< symbolic link |
marcozecchini | 0:9fca2b23d0ba | 380 | #define S_IFREG _IFREG //< regular |
marcozecchini | 0:9fca2b23d0ba | 381 | #define S_IFBLK _IFBLK //< block special |
marcozecchini | 0:9fca2b23d0ba | 382 | #define S_IFDIR _IFDIR //< directory |
marcozecchini | 0:9fca2b23d0ba | 383 | #define S_IFCHR _IFCHR //< character special |
marcozecchini | 0:9fca2b23d0ba | 384 | #define S_IFIFO _IFIFO //< fifo special |
marcozecchini | 0:9fca2b23d0ba | 385 | |
marcozecchini | 0:9fca2b23d0ba | 386 | #define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) |
marcozecchini | 0:9fca2b23d0ba | 387 | #define S_IRUSR 0000400 ///< read permission, owner |
marcozecchini | 0:9fca2b23d0ba | 388 | #define S_IWUSR 0000200 ///< write permission, owner |
marcozecchini | 0:9fca2b23d0ba | 389 | #define S_IXUSR 0000100 ///< execute/search permission, owner |
marcozecchini | 0:9fca2b23d0ba | 390 | #define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) |
marcozecchini | 0:9fca2b23d0ba | 391 | #define S_IRGRP 0000040 ///< read permission, group |
marcozecchini | 0:9fca2b23d0ba | 392 | #define S_IWGRP 0000020 ///< write permission, grougroup |
marcozecchini | 0:9fca2b23d0ba | 393 | #define S_IXGRP 0000010 ///< execute/search permission, group |
marcozecchini | 0:9fca2b23d0ba | 394 | #define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) |
marcozecchini | 0:9fca2b23d0ba | 395 | #define S_IROTH 0000004 ///< read permission, other |
marcozecchini | 0:9fca2b23d0ba | 396 | #define S_IWOTH 0000002 ///< write permission, other |
marcozecchini | 0:9fca2b23d0ba | 397 | #define S_IXOTH 0000001 ///< execute/search permission, other |
marcozecchini | 0:9fca2b23d0ba | 398 | |
marcozecchini | 0:9fca2b23d0ba | 399 | /* Refer to sys/stat standard |
marcozecchini | 0:9fca2b23d0ba | 400 | * Note: Not all fields may be supported by the underlying filesystem |
marcozecchini | 0:9fca2b23d0ba | 401 | */ |
marcozecchini | 0:9fca2b23d0ba | 402 | struct stat { |
marcozecchini | 0:9fca2b23d0ba | 403 | dev_t st_dev; ///< Device ID containing file |
marcozecchini | 0:9fca2b23d0ba | 404 | ino_t st_ino; ///< File serial number |
marcozecchini | 0:9fca2b23d0ba | 405 | mode_t st_mode; ///< Mode of file |
marcozecchini | 0:9fca2b23d0ba | 406 | nlink_t st_nlink; ///< Number of links to file |
marcozecchini | 0:9fca2b23d0ba | 407 | |
marcozecchini | 0:9fca2b23d0ba | 408 | uid_t st_uid; ///< User ID |
marcozecchini | 0:9fca2b23d0ba | 409 | gid_t st_gid; ///< Group ID |
marcozecchini | 0:9fca2b23d0ba | 410 | |
marcozecchini | 0:9fca2b23d0ba | 411 | off_t st_size; ///< Size of file in bytes |
marcozecchini | 0:9fca2b23d0ba | 412 | |
marcozecchini | 0:9fca2b23d0ba | 413 | time_t st_atime; ///< Time of last access |
marcozecchini | 0:9fca2b23d0ba | 414 | time_t st_mtime; ///< Time of last data modification |
marcozecchini | 0:9fca2b23d0ba | 415 | time_t st_ctime; ///< Time of last status change |
marcozecchini | 0:9fca2b23d0ba | 416 | }; |
marcozecchini | 0:9fca2b23d0ba | 417 | |
marcozecchini | 0:9fca2b23d0ba | 418 | #if __cplusplus |
marcozecchini | 0:9fca2b23d0ba | 419 | extern "C" { |
marcozecchini | 0:9fca2b23d0ba | 420 | #endif |
marcozecchini | 0:9fca2b23d0ba | 421 | int stat(const char *path, struct stat *st); |
marcozecchini | 0:9fca2b23d0ba | 422 | #if __cplusplus |
marcozecchini | 0:9fca2b23d0ba | 423 | }; |
marcozecchini | 0:9fca2b23d0ba | 424 | #endif |
marcozecchini | 0:9fca2b23d0ba | 425 | |
marcozecchini | 0:9fca2b23d0ba | 426 | |
marcozecchini | 0:9fca2b23d0ba | 427 | /* The following are dirent.h definitions are declared here to garuntee |
marcozecchini | 0:9fca2b23d0ba | 428 | * consistency where structure may be different with different toolchains |
marcozecchini | 0:9fca2b23d0ba | 429 | */ |
marcozecchini | 0:9fca2b23d0ba | 430 | struct dirent { |
marcozecchini | 0:9fca2b23d0ba | 431 | char d_name[NAME_MAX+1]; ///< Name of file |
marcozecchini | 0:9fca2b23d0ba | 432 | uint8_t d_type; ///< Type of file |
marcozecchini | 0:9fca2b23d0ba | 433 | }; |
marcozecchini | 0:9fca2b23d0ba | 434 | |
marcozecchini | 0:9fca2b23d0ba | 435 | enum { |
marcozecchini | 0:9fca2b23d0ba | 436 | DT_UNKNOWN, ///< The file type could not be determined. |
marcozecchini | 0:9fca2b23d0ba | 437 | DT_FIFO, ///< This is a named pipe (FIFO). |
marcozecchini | 0:9fca2b23d0ba | 438 | DT_CHR, ///< This is a character device. |
marcozecchini | 0:9fca2b23d0ba | 439 | DT_DIR, ///< This is a directory. |
marcozecchini | 0:9fca2b23d0ba | 440 | DT_BLK, ///< This is a block device. |
marcozecchini | 0:9fca2b23d0ba | 441 | DT_REG, ///< This is a regular file. |
marcozecchini | 0:9fca2b23d0ba | 442 | DT_LNK, ///< This is a symbolic link. |
marcozecchini | 0:9fca2b23d0ba | 443 | DT_SOCK, ///< This is a UNIX domain socket. |
marcozecchini | 0:9fca2b23d0ba | 444 | }; |
marcozecchini | 0:9fca2b23d0ba | 445 | |
marcozecchini | 0:9fca2b23d0ba | 446 | /**@}*/ |
marcozecchini | 0:9fca2b23d0ba | 447 | |
marcozecchini | 0:9fca2b23d0ba | 448 | /**@}*/ |
marcozecchini | 0:9fca2b23d0ba | 449 | |
marcozecchini | 0:9fca2b23d0ba | 450 | #endif /* RETARGET_H */ |