LPC11U35 ADC Tick & USBSerial

Dependencies:   mbed

Dependents:   SmallDoseMeter_SingleCH_AE_lpc11u35_V1_00

Committer:
H_Tsunemoto
Date:
Mon Feb 19 09:09:52 2018 +0000
Revision:
1:b1a3be5f48ab
Parent:
0:871ab6846b18
test

Who changed what in which revision?

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