Opencv 3.1 project on GR-PEACH board
Fork of gr-peach-opencv-project by
platform/mbed_semihost_api.h@170:54ff26da7eb6, 2017-07-04 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
thedo | 167:1657b442184c | 1 | |
thedo | 167:1657b442184c | 2 | /** \addtogroup platform */ |
thedo | 167:1657b442184c | 3 | /** @{*/ |
thedo | 167:1657b442184c | 4 | /* mbed Microcontroller Library |
thedo | 167:1657b442184c | 5 | * Copyright (c) 2006-2013 ARM Limited |
thedo | 167:1657b442184c | 6 | * |
thedo | 167:1657b442184c | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
thedo | 167:1657b442184c | 8 | * you may not use this file except in compliance with the License. |
thedo | 167:1657b442184c | 9 | * You may obtain a copy of the License at |
thedo | 167:1657b442184c | 10 | * |
thedo | 167:1657b442184c | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
thedo | 167:1657b442184c | 12 | * |
thedo | 167:1657b442184c | 13 | * Unless required by applicable law or agreed to in writing, software |
thedo | 167:1657b442184c | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
thedo | 167:1657b442184c | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
thedo | 167:1657b442184c | 16 | * See the License for the specific language governing permissions and |
thedo | 167:1657b442184c | 17 | * limitations under the License. |
thedo | 167:1657b442184c | 18 | */ |
thedo | 167:1657b442184c | 19 | #ifndef MBED_SEMIHOST_H |
thedo | 167:1657b442184c | 20 | #define MBED_SEMIHOST_H |
thedo | 167:1657b442184c | 21 | |
thedo | 167:1657b442184c | 22 | #include "device.h" |
thedo | 167:1657b442184c | 23 | #include "platform/mbed_toolchain.h" |
thedo | 167:1657b442184c | 24 | |
thedo | 167:1657b442184c | 25 | #ifdef __cplusplus |
thedo | 167:1657b442184c | 26 | extern "C" { |
thedo | 167:1657b442184c | 27 | #endif |
thedo | 167:1657b442184c | 28 | |
thedo | 167:1657b442184c | 29 | #if DEVICE_SEMIHOST |
thedo | 167:1657b442184c | 30 | |
thedo | 167:1657b442184c | 31 | #ifndef __CC_ARM |
thedo | 167:1657b442184c | 32 | |
thedo | 167:1657b442184c | 33 | #if defined(__ICCARM__) |
thedo | 167:1657b442184c | 34 | static inline int __semihost(int reason, const void *arg) { |
thedo | 167:1657b442184c | 35 | return __semihosting(reason, (void*)arg); |
thedo | 167:1657b442184c | 36 | } |
thedo | 167:1657b442184c | 37 | #else |
thedo | 167:1657b442184c | 38 | |
thedo | 167:1657b442184c | 39 | #ifdef __thumb__ |
thedo | 167:1657b442184c | 40 | # define AngelSWI 0xAB |
thedo | 167:1657b442184c | 41 | # define AngelSWIInsn "bkpt" |
thedo | 167:1657b442184c | 42 | # define AngelSWIAsm bkpt |
thedo | 167:1657b442184c | 43 | #else |
thedo | 167:1657b442184c | 44 | # define AngelSWI 0x123456 |
thedo | 167:1657b442184c | 45 | # define AngelSWIInsn "swi" |
thedo | 167:1657b442184c | 46 | # define AngelSWIAsm swi |
thedo | 167:1657b442184c | 47 | #endif |
thedo | 167:1657b442184c | 48 | |
thedo | 167:1657b442184c | 49 | static inline int __semihost(int reason, const void *arg) { |
thedo | 167:1657b442184c | 50 | int value; |
thedo | 167:1657b442184c | 51 | |
thedo | 167:1657b442184c | 52 | asm volatile ( |
thedo | 167:1657b442184c | 53 | "mov r0, %1" "\n\t" |
thedo | 167:1657b442184c | 54 | "mov r1, %2" "\n\t" |
thedo | 167:1657b442184c | 55 | AngelSWIInsn " %a3" "\n\t" |
thedo | 167:1657b442184c | 56 | "mov %0, r0" |
thedo | 167:1657b442184c | 57 | : "=r" (value) /* output operands */ |
thedo | 167:1657b442184c | 58 | : "r" (reason), "r" (arg), "i" (AngelSWI) /* input operands */ |
thedo | 167:1657b442184c | 59 | : "r0", "r1", "r2", "r3", "ip", "lr", "memory", "cc" /* list of clobbered registers */ |
thedo | 167:1657b442184c | 60 | ); |
thedo | 167:1657b442184c | 61 | |
thedo | 167:1657b442184c | 62 | return value; |
thedo | 167:1657b442184c | 63 | } |
thedo | 167:1657b442184c | 64 | #endif |
thedo | 167:1657b442184c | 65 | #endif |
thedo | 167:1657b442184c | 66 | |
thedo | 167:1657b442184c | 67 | #if DEVICE_LOCALFILESYSTEM |
thedo | 167:1657b442184c | 68 | FILEHANDLE semihost_open(const char* name, int openmode); |
thedo | 167:1657b442184c | 69 | int semihost_close (FILEHANDLE fh); |
thedo | 167:1657b442184c | 70 | int semihost_read (FILEHANDLE fh, unsigned char* buffer, unsigned int length, int mode); |
thedo | 167:1657b442184c | 71 | int semihost_write (FILEHANDLE fh, const unsigned char* buffer, unsigned int length, int mode); |
thedo | 167:1657b442184c | 72 | int semihost_ensure(FILEHANDLE fh); |
thedo | 167:1657b442184c | 73 | long semihost_flen (FILEHANDLE fh); |
thedo | 167:1657b442184c | 74 | int semihost_seek (FILEHANDLE fh, long position); |
thedo | 167:1657b442184c | 75 | int semihost_istty (FILEHANDLE fh); |
thedo | 167:1657b442184c | 76 | |
thedo | 167:1657b442184c | 77 | int semihost_remove(const char *name); |
thedo | 167:1657b442184c | 78 | int semihost_rename(const char *old_name, const char *new_name); |
thedo | 167:1657b442184c | 79 | #endif |
thedo | 167:1657b442184c | 80 | |
thedo | 167:1657b442184c | 81 | int semihost_uid(char *uid); |
thedo | 167:1657b442184c | 82 | int semihost_reset(void); |
thedo | 167:1657b442184c | 83 | int semihost_vbus(void); |
thedo | 167:1657b442184c | 84 | int semihost_powerdown(void); |
thedo | 167:1657b442184c | 85 | int semihost_exit(void); |
thedo | 167:1657b442184c | 86 | |
thedo | 167:1657b442184c | 87 | int semihost_connected(void); |
thedo | 167:1657b442184c | 88 | int semihost_disabledebug(void); |
thedo | 167:1657b442184c | 89 | |
thedo | 167:1657b442184c | 90 | #endif |
thedo | 167:1657b442184c | 91 | |
thedo | 167:1657b442184c | 92 | #ifdef __cplusplus |
thedo | 167:1657b442184c | 93 | } |
thedo | 167:1657b442184c | 94 | #endif |
thedo | 167:1657b442184c | 95 | |
thedo | 167:1657b442184c | 96 | #endif |
thedo | 167:1657b442184c | 97 | |
thedo | 167:1657b442184c | 98 | /** @}*/ |
thedo | 167:1657b442184c | 99 |