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