temp

Dependencies:   mbed SDFileSystem MS5607 ADXL345_I2C FATFileSystem

Committer:
IKobayashi
Date:
Mon Mar 16 23:37:42 2020 +0900
Revision:
0:c88c3b616c00
copy

Who changed what in which revision?

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