fixed drive strength

Dependents:   capstone_i2c

Fork of mbed-dev by mbed official

Committer:
<>
Date:
Thu Mar 30 13:45:57 2017 +0100
Revision:
161:2cc1468da177
Parent:
160:d5399cc887bb
This updates the lib to the mbed lib v139

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
<> 160:d5399cc887bb 22 #include <stdint.h>
<> 160:d5399cc887bb 23 #include <stddef.h>
<> 160:d5399cc887bb 24
<> 160:d5399cc887bb 25 /* We can get the following standard types from sys/types for gcc, but we
<> 160:d5399cc887bb 26 * need to define the types ourselves for the other compilers that normally
<> 160:d5399cc887bb 27 * target embedded systems */
<> 160:d5399cc887bb 28 #if defined(__ARMCC_VERSION) || defined(__ICCARM__)
<> 160:d5399cc887bb 29 typedef int ssize_t; ///< Signed size type, usually encodes negative errors
<> 160:d5399cc887bb 30 typedef long off_t; ///< Offset in a data stream
<> 160:d5399cc887bb 31 typedef int mode_t; ///< Mode for opening files
<> 160:d5399cc887bb 32
<> 160:d5399cc887bb 33 #define O_RDONLY 0
<> 160:d5399cc887bb 34 #define O_WRONLY 1
<> 160:d5399cc887bb 35 #define O_RDWR 2
<> 160:d5399cc887bb 36 #define O_CREAT 0x0200
<> 160:d5399cc887bb 37 #define O_TRUNC 0x0400
<> 160:d5399cc887bb 38 #define O_APPEND 0x0008
<> 160:d5399cc887bb 39
<> 160:d5399cc887bb 40 #define NAME_MAX 255 ///< Maximum size of a name in a file path
<> 160:d5399cc887bb 41
<> 160:d5399cc887bb 42 #else
<> 160:d5399cc887bb 43 #include <sys/fcntl.h>
<> 160:d5399cc887bb 44 #include <sys/types.h>
<> 160:d5399cc887bb 45 #include <sys/syslimits.h>
<> 160:d5399cc887bb 46 #endif
<> 160:d5399cc887bb 47
<> 160:d5399cc887bb 48
<> 160:d5399cc887bb 49 /* DIR declarations must also be here */
<> 160:d5399cc887bb 50 #if __cplusplus
<> 160:d5399cc887bb 51 namespace mbed { class Dir; }
<> 160:d5399cc887bb 52 typedef mbed::Dir DIR;
<> 161:2cc1468da177 53 #else
<> 161:2cc1468da177 54 typedef struct Dir DIR;
<> 161:2cc1468da177 55 #endif
<> 160:d5399cc887bb 56
<> 161:2cc1468da177 57 #if __cplusplus
<> 160:d5399cc887bb 58 extern "C" {
<> 161:2cc1468da177 59 #endif
<> 160:d5399cc887bb 60 DIR *opendir(const char*);
<> 160:d5399cc887bb 61 struct dirent *readdir(DIR *);
<> 160:d5399cc887bb 62 int closedir(DIR*);
<> 160:d5399cc887bb 63 void rewinddir(DIR*);
<> 160:d5399cc887bb 64 long telldir(DIR*);
<> 160:d5399cc887bb 65 void seekdir(DIR*, long);
<> 160:d5399cc887bb 66 int mkdir(const char *name, mode_t n);
<> 161:2cc1468da177 67 #if __cplusplus
<> 160:d5399cc887bb 68 };
<> 160:d5399cc887bb 69 #endif
<> 160:d5399cc887bb 70
<> 160:d5399cc887bb 71
<> 160:d5399cc887bb 72 #if defined(__ARMCC_VERSION) || defined(__ICCARM__)
<> 160:d5399cc887bb 73 /* The intent of this section is to unify the errno error values to match
<> 160:d5399cc887bb 74 * the POSIX definitions for the GCC_ARM, ARMCC and IAR compilers. This is
<> 160:d5399cc887bb 75 * necessary because the ARMCC/IAR errno.h, or sys/stat.h are missing some
<> 160:d5399cc887bb 76 * symbol definitions used by the POSIX filesystem API to return errno codes.
<> 160:d5399cc887bb 77 * Note also that ARMCC errno.h defines some symbol values differently from
<> 160:d5399cc887bb 78 * the GCC_ARM/IAR/standard POSIX definitions. The definitions guard against
<> 160:d5399cc887bb 79 * this and future changes by changing the symbol definition as shown below. */
<> 160:d5399cc887bb 80 #ifdef ENOENT
<> 160:d5399cc887bb 81 #undef ENOENT
<> 160:d5399cc887bb 82 #endif
<> 160:d5399cc887bb 83 #define ENOENT 2 /* No such file or directory. */
<> 160:d5399cc887bb 84
<> 160:d5399cc887bb 85 #ifdef EIO
<> 160:d5399cc887bb 86 #undef EIO
<> 160:d5399cc887bb 87 #endif
<> 160:d5399cc887bb 88 #define EIO 5 /* I/O error */
<> 160:d5399cc887bb 89
<> 160:d5399cc887bb 90 #ifdef ENXIO
<> 160:d5399cc887bb 91 #undef ENXIO
<> 160:d5399cc887bb 92 #endif
<> 160:d5399cc887bb 93 #define ENXIO 6 /* No such device or address */
<> 160:d5399cc887bb 94
<> 160:d5399cc887bb 95 #ifdef ENOEXEC
<> 160:d5399cc887bb 96 #undef ENOEXEC
<> 160:d5399cc887bb 97 #endif
<> 160:d5399cc887bb 98 #define ENOEXEC 8 /* Exec format error */
<> 160:d5399cc887bb 99
<> 160:d5399cc887bb 100 #ifdef EBADF
<> 160:d5399cc887bb 101 #undef EBADF
<> 160:d5399cc887bb 102 #endif
<> 160:d5399cc887bb 103 #define EBADF 9 /* Bad file number */
<> 160:d5399cc887bb 104
<> 160:d5399cc887bb 105 #ifdef ENOMEM
<> 160:d5399cc887bb 106 #undef ENOMEM
<> 160:d5399cc887bb 107 #endif
<> 160:d5399cc887bb 108 #define ENOMEM 12 /* Not enough space */
<> 160:d5399cc887bb 109
<> 160:d5399cc887bb 110 #ifdef EACCES
<> 160:d5399cc887bb 111 #undef EACCES
<> 160:d5399cc887bb 112 #endif
<> 160:d5399cc887bb 113 #define EACCES 13 /* Permission denied */
<> 160:d5399cc887bb 114
<> 160:d5399cc887bb 115 #ifdef EFAULT
<> 160:d5399cc887bb 116 #undef EFAULT
<> 160:d5399cc887bb 117 #endif
<> 160:d5399cc887bb 118 #define EFAULT 14 /* Bad address */
<> 160:d5399cc887bb 119
<> 160:d5399cc887bb 120 #ifdef EEXIST
<> 160:d5399cc887bb 121 #undef EEXIST
<> 160:d5399cc887bb 122 #endif
<> 160:d5399cc887bb 123 #define EEXIST 17 /* File exists */
<> 160:d5399cc887bb 124
<> 160:d5399cc887bb 125 #ifdef EINVAL
<> 160:d5399cc887bb 126 #undef EINVAL
<> 160:d5399cc887bb 127 #endif
<> 160:d5399cc887bb 128 #define EINVAL 22 /* Invalid argument */
<> 160:d5399cc887bb 129
<> 160:d5399cc887bb 130 #ifdef ENFILE
<> 160:d5399cc887bb 131 #undef ENFILE
<> 160:d5399cc887bb 132 #endif
<> 160:d5399cc887bb 133 #define ENFILE 23 /* Too many open files in system */
<> 160:d5399cc887bb 134
<> 160:d5399cc887bb 135 #ifdef EMFILE
<> 160:d5399cc887bb 136 #undef EMFILE
<> 160:d5399cc887bb 137 #endif
<> 160:d5399cc887bb 138 #define EMFILE 24 /* File descriptor value too large */
<> 160:d5399cc887bb 139
<> 160:d5399cc887bb 140 #ifdef ENOSYS
<> 160:d5399cc887bb 141 #undef ENOSYS
<> 160:d5399cc887bb 142 #endif
<> 160:d5399cc887bb 143 #define ENOSYS 38 /* Function not implemented */
<> 160:d5399cc887bb 144
<> 160:d5399cc887bb 145 /* Missing stat.h defines.
<> 160:d5399cc887bb 146 * The following are sys/stat.h definitions not currently present in the ARMCC
<> 160:d5399cc887bb 147 * errno.h. Note, ARMCC errno.h defines some symbol values differing from
<> 160:d5399cc887bb 148 * GCC_ARM/IAR/standard POSIX definitions. Guard against this and future
<> 160:d5399cc887bb 149 * changes by changing the symbol definition for filesystem use. */
<> 160:d5399cc887bb 150 #define _IFDIR 0040000 /* directory */
<> 160:d5399cc887bb 151 #define _IFREG 0100000 /* regular */
<> 160:d5399cc887bb 152
<> 160:d5399cc887bb 153 #define S_IFDIR _IFDIR
<> 160:d5399cc887bb 154 #define S_IFREG _IFREG
<> 160:d5399cc887bb 155
<> 160:d5399cc887bb 156 #define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
<> 160:d5399cc887bb 157 #define S_IRUSR 0000400 /* read permission, owner */
<> 160:d5399cc887bb 158 #define S_IWUSR 0000200 /* write permission, owner */
<> 160:d5399cc887bb 159 #define S_IXUSR 0000100/* execute/search permission, owner */
<> 160:d5399cc887bb 160 #define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
<> 160:d5399cc887bb 161 #define S_IRGRP 0000040 /* read permission, group */
<> 160:d5399cc887bb 162 #define S_IWGRP 0000020 /* write permission, grougroup */
<> 160:d5399cc887bb 163 #define S_IXGRP 0000010/* execute/search permission, group */
<> 160:d5399cc887bb 164 #define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
<> 160:d5399cc887bb 165 #define S_IROTH 0000004 /* read permission, other */
<> 160:d5399cc887bb 166 #define S_IWOTH 0000002 /* write permission, other */
<> 160:d5399cc887bb 167 #define S_IXOTH 0000001/* execute/search permission, other */
<> 160:d5399cc887bb 168
<> 160:d5399cc887bb 169 #endif /* defined(__ARMCC_VERSION) || defined(__ICCARM__) */
<> 160:d5399cc887bb 170
<> 160:d5399cc887bb 171
<> 160:d5399cc887bb 172 /* The following are dirent.h definitions are declared here to garuntee
<> 160:d5399cc887bb 173 * consistency where structure may be different with different toolchains */
<> 160:d5399cc887bb 174 struct dirent {
<> 160:d5399cc887bb 175 char d_name[NAME_MAX+1];
<> 160:d5399cc887bb 176 uint8_t d_type;
<> 160:d5399cc887bb 177 };
<> 160:d5399cc887bb 178
<> 160:d5399cc887bb 179 enum {
<> 160:d5399cc887bb 180 DT_UNKNOWN, // The file type could not be determined.
<> 160:d5399cc887bb 181 DT_FIFO, // This is a named pipe (FIFO).
<> 160:d5399cc887bb 182 DT_CHR, // This is a character device.
<> 160:d5399cc887bb 183 DT_DIR, // This is a directory.
<> 160:d5399cc887bb 184 DT_BLK, // This is a block device.
<> 160:d5399cc887bb 185 DT_REG, // This is a regular file.
<> 160:d5399cc887bb 186 DT_LNK, // This is a symbolic link.
<> 160:d5399cc887bb 187 DT_SOCK, // This is a UNIX domain socket.
<> 160:d5399cc887bb 188 };
<> 160:d5399cc887bb 189
<> 160:d5399cc887bb 190
<> 160:d5399cc887bb 191 #endif /* RETARGET_H */