Opencv 3.1 project on GR-PEACH board

Fork of gr-peach-opencv-project by the do

Committer:
thedo
Date:
Tue Jul 04 06:23:13 2017 +0000
Revision:
170:54ff26da7eb6
Parent:
167:1657b442184c
project opencv 3.1 on GR PEACH board, no use SD card.

Who changed what in which revision?

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