mbed library sources, mbed-dev only for TYBLE16

Fork of mbed-dev by mbed official

Please refer flowing link.
/users/kenjiArai/notebook/tyble16-module-will-become-a-mbed-family--mbedliza/

Committer:
kenjiArai
Date:
Sun Feb 25 02:00:51 2018 +0000
Revision:
182:976b131d2800
Parent:
180:96ed750bd169
Only for TYBLE16

Who changed what in which revision?

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