inport from local

Dependents:   Hobbyking_Cheetah_0511

Committer:
NYX
Date:
Mon Mar 16 06:35:48 2020 +0000
Revision:
0:85b3fd62ea1a
reinport to mbed;

Who changed what in which revision?

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