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