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