source: EcnlProtoTool/trunk/asp3_dcre/mbed/api/semihost_api.h@ 270

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

mruby版ECNLプロトタイピング・ツールを追加

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