PokittoLib with changes to lcd refresh etc.

Dependents:   Pokittris

Fork of Pokitto by Pokitto Community Team

This is a fork by user @Spinal, and is used in Pokittris for testing. Do not import this to your own program.

Committer:
Pokitto
Date:
Sat Oct 07 21:31:12 2017 +0000
Revision:
5:7e5c566b1760
mbed-pokitto integrated

Who changed what in which revision?

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