PokittoLib is the library needed for programming the Pokitto DIY game console (www.pokitto.com)

Committer:
Pokitto
Date:
Wed Oct 11 20:35:27 2017 +0000
Revision:
5:ea7377f3d1af
Fixed PokittoLib. Includes a working custom mbed-src

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Pokitto 5:ea7377f3d1af 1 /* mbed Microcontroller Library
Pokitto 5:ea7377f3d1af 2 * Copyright (c) 2006-2013 ARM Limited
Pokitto 5:ea7377f3d1af 3 *
Pokitto 5:ea7377f3d1af 4 * Licensed under the Apache License, Version 2.0 (the "License");
Pokitto 5:ea7377f3d1af 5 * you may not use this file except in compliance with the License.
Pokitto 5:ea7377f3d1af 6 * You may obtain a copy of the License at
Pokitto 5:ea7377f3d1af 7 *
Pokitto 5:ea7377f3d1af 8 * http://www.apache.org/licenses/LICENSE-2.0
Pokitto 5:ea7377f3d1af 9 *
Pokitto 5:ea7377f3d1af 10 * Unless required by applicable law or agreed to in writing, software
Pokitto 5:ea7377f3d1af 11 * distributed under the License is distributed on an "AS IS" BASIS,
Pokitto 5:ea7377f3d1af 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Pokitto 5:ea7377f3d1af 13 * See the License for the specific language governing permissions and
Pokitto 5:ea7377f3d1af 14 * limitations under the License.
Pokitto 5:ea7377f3d1af 15 */
Pokitto 5:ea7377f3d1af 16 #ifndef MBED_INTERFACE_H
Pokitto 5:ea7377f3d1af 17 #define MBED_INTERFACE_H
Pokitto 5:ea7377f3d1af 18
Pokitto 5:ea7377f3d1af 19 #include "device.h"
Pokitto 5:ea7377f3d1af 20
Pokitto 5:ea7377f3d1af 21 /* Mbed interface mac address
Pokitto 5:ea7377f3d1af 22 * if MBED_MAC_ADD_x are zero, interface uid sets mac address,
Pokitto 5:ea7377f3d1af 23 * otherwise MAC_ADD_x are used.
Pokitto 5:ea7377f3d1af 24 */
Pokitto 5:ea7377f3d1af 25 #define MBED_MAC_ADDR_INTERFACE 0x00
Pokitto 5:ea7377f3d1af 26 #define MBED_MAC_ADDR_0 MBED_MAC_ADDR_INTERFACE
Pokitto 5:ea7377f3d1af 27 #define MBED_MAC_ADDR_1 MBED_MAC_ADDR_INTERFACE
Pokitto 5:ea7377f3d1af 28 #define MBED_MAC_ADDR_2 MBED_MAC_ADDR_INTERFACE
Pokitto 5:ea7377f3d1af 29 #define MBED_MAC_ADDR_3 MBED_MAC_ADDR_INTERFACE
Pokitto 5:ea7377f3d1af 30 #define MBED_MAC_ADDR_4 MBED_MAC_ADDR_INTERFACE
Pokitto 5:ea7377f3d1af 31 #define MBED_MAC_ADDR_5 MBED_MAC_ADDR_INTERFACE
Pokitto 5:ea7377f3d1af 32 #define MBED_MAC_ADDRESS_SUM (MBED_MAC_ADDR_0 | MBED_MAC_ADDR_1 | MBED_MAC_ADDR_2 | MBED_MAC_ADDR_3 | MBED_MAC_ADDR_4 | MBED_MAC_ADDR_5)
Pokitto 5:ea7377f3d1af 33
Pokitto 5:ea7377f3d1af 34 #ifdef __cplusplus
Pokitto 5:ea7377f3d1af 35 extern "C" {
Pokitto 5:ea7377f3d1af 36 #endif
Pokitto 5:ea7377f3d1af 37
Pokitto 5:ea7377f3d1af 38 #if DEVICE_SEMIHOST
Pokitto 5:ea7377f3d1af 39
Pokitto 5:ea7377f3d1af 40 /** Functions to control the mbed interface
Pokitto 5:ea7377f3d1af 41 *
Pokitto 5:ea7377f3d1af 42 * mbed Microcontrollers have a built-in interface to provide functionality such as
Pokitto 5:ea7377f3d1af 43 * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file
Pokitto 5:ea7377f3d1af 44 * system. These functions provide means to control the interface suing semihost
Pokitto 5:ea7377f3d1af 45 * calls it supports.
Pokitto 5:ea7377f3d1af 46 */
Pokitto 5:ea7377f3d1af 47
Pokitto 5:ea7377f3d1af 48 /** Determine whether the mbed interface is connected, based on whether debug is enabled
Pokitto 5:ea7377f3d1af 49 *
Pokitto 5:ea7377f3d1af 50 * @returns
Pokitto 5:ea7377f3d1af 51 * 1 if interface is connected,
Pokitto 5:ea7377f3d1af 52 * 0 otherwise
Pokitto 5:ea7377f3d1af 53 */
Pokitto 5:ea7377f3d1af 54 int mbed_interface_connected(void);
Pokitto 5:ea7377f3d1af 55
Pokitto 5:ea7377f3d1af 56 /** Instruct the mbed interface to reset, as if the reset button had been pressed
Pokitto 5:ea7377f3d1af 57 *
Pokitto 5:ea7377f3d1af 58 * @returns
Pokitto 5:ea7377f3d1af 59 * 1 if successful,
Pokitto 5:ea7377f3d1af 60 * 0 otherwise (e.g. interface not present)
Pokitto 5:ea7377f3d1af 61 */
Pokitto 5:ea7377f3d1af 62 int mbed_interface_reset(void);
Pokitto 5:ea7377f3d1af 63
Pokitto 5:ea7377f3d1af 64 /** This will disconnect the debug aspect of the interface, so semihosting will be disabled.
Pokitto 5:ea7377f3d1af 65 * The interface will still support the USB serial aspect
Pokitto 5:ea7377f3d1af 66 *
Pokitto 5:ea7377f3d1af 67 * @returns
Pokitto 5:ea7377f3d1af 68 * 0 if successful,
Pokitto 5:ea7377f3d1af 69 * -1 otherwise (e.g. interface not present)
Pokitto 5:ea7377f3d1af 70 */
Pokitto 5:ea7377f3d1af 71 int mbed_interface_disconnect(void);
Pokitto 5:ea7377f3d1af 72
Pokitto 5:ea7377f3d1af 73 /** This will disconnect the debug aspect of the interface, and if the USB cable is not
Pokitto 5:ea7377f3d1af 74 * connected, also power down the interface. If the USB cable is connected, the interface
Pokitto 5:ea7377f3d1af 75 * will remain powered up and visible to the host
Pokitto 5:ea7377f3d1af 76 *
Pokitto 5:ea7377f3d1af 77 * @returns
Pokitto 5:ea7377f3d1af 78 * 0 if successful,
Pokitto 5:ea7377f3d1af 79 * -1 otherwise (e.g. interface not present)
Pokitto 5:ea7377f3d1af 80 */
Pokitto 5:ea7377f3d1af 81 int mbed_interface_powerdown(void);
Pokitto 5:ea7377f3d1af 82
Pokitto 5:ea7377f3d1af 83 /** This returns a string containing the 32-character UID of the mbed interface
Pokitto 5:ea7377f3d1af 84 * This is a weak function that can be overwritten if required
Pokitto 5:ea7377f3d1af 85 *
Pokitto 5:ea7377f3d1af 86 * @param uid A 33-byte array to write the null terminated 32-byte string
Pokitto 5:ea7377f3d1af 87 *
Pokitto 5:ea7377f3d1af 88 * @returns
Pokitto 5:ea7377f3d1af 89 * 0 if successful,
Pokitto 5:ea7377f3d1af 90 * -1 otherwise (e.g. interface not present)
Pokitto 5:ea7377f3d1af 91 */
Pokitto 5:ea7377f3d1af 92 int mbed_interface_uid(char *uid);
Pokitto 5:ea7377f3d1af 93
Pokitto 5:ea7377f3d1af 94 #endif
Pokitto 5:ea7377f3d1af 95
Pokitto 5:ea7377f3d1af 96 /** This returns a unique 6-byte MAC address, based on the interface UID
Pokitto 5:ea7377f3d1af 97 * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00)
Pokitto 5:ea7377f3d1af 98 *
Pokitto 5:ea7377f3d1af 99 * This is a weak function that can be overwritten if you want to provide your own mechanism to
Pokitto 5:ea7377f3d1af 100 * provide a MAC address.
Pokitto 5:ea7377f3d1af 101 *
Pokitto 5:ea7377f3d1af 102 * @param mac A 6-byte array to write the MAC address
Pokitto 5:ea7377f3d1af 103 */
Pokitto 5:ea7377f3d1af 104 void mbed_mac_address(char *mac);
Pokitto 5:ea7377f3d1af 105
Pokitto 5:ea7377f3d1af 106 /** Cause the mbed to flash the BLOD (Blue LEDs Of Death) sequence
Pokitto 5:ea7377f3d1af 107 */
Pokitto 5:ea7377f3d1af 108 void mbed_die(void);
Pokitto 5:ea7377f3d1af 109
Pokitto 5:ea7377f3d1af 110 #ifdef __cplusplus
Pokitto 5:ea7377f3d1af 111 }
Pokitto 5:ea7377f3d1af 112 #endif
Pokitto 5:ea7377f3d1af 113
Pokitto 5:ea7377f3d1af 114 #endif