change some io settings for TWR-K22F-120M

Dependents:   twr_helloworld

Committer:
Jasper_lee
Date:
Tue Dec 23 03:35:08 2014 +0000
Revision:
0:b16d94660a33
change some io setting used in TWR-K22F120M

Who changed what in which revision?

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