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