This is a repository for all my programs or modified programs.

Committer:
mturner5
Date:
Sun Sep 11 23:48:09 2016 +0000
Revision:
0:72480818e4a9
Made delays for the LEDS and button presses

Who changed what in which revision?

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