mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
<>
Date:
Fri Oct 28 11:17:30 2016 +0100
Revision:
149:156823d33999
Child:
160:d5399cc887bb
This updates the lib to the mbed lib v128

NOTE: This release includes a restructuring of the file and directory locations and thus some
include paths in your code may need updating accordingly.

Who changed what in which revision?

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