source: asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/platform/mbed_semihost_api.h@ 352

Last change on this file since 352 was 352, checked in by coas-nagasima, 6 years ago

arm向けASP3版ECNLを追加

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