mbed library sources. Supersedes mbed-src. removed serial
Fork of mbed-dev by
platform/mbed_interface.h@149:156823d33999, 2016-10-28 (annotated)
- Committer:
- <>
- Date:
- Fri Oct 28 11:17:30 2016 +0100
- Revision:
- 149:156823d33999
This updates the lib to the mbed lib v128
NOTE: This release includes a restructuring of the file and directory locations and thus some
include paths in your code may need updating accordingly.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 149:156823d33999 | 1 | |
<> | 149:156823d33999 | 2 | /** \addtogroup platform */ |
<> | 149:156823d33999 | 3 | /** @{*/ |
<> | 149:156823d33999 | 4 | /* mbed Microcontroller Library |
<> | 149:156823d33999 | 5 | * Copyright (c) 2006-2013 ARM Limited |
<> | 149:156823d33999 | 6 | * |
<> | 149:156823d33999 | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
<> | 149:156823d33999 | 8 | * you may not use this file except in compliance with the License. |
<> | 149:156823d33999 | 9 | * You may obtain a copy of the License at |
<> | 149:156823d33999 | 10 | * |
<> | 149:156823d33999 | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
<> | 149:156823d33999 | 12 | * |
<> | 149:156823d33999 | 13 | * Unless required by applicable law or agreed to in writing, software |
<> | 149:156823d33999 | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
<> | 149:156823d33999 | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
<> | 149:156823d33999 | 16 | * See the License for the specific language governing permissions and |
<> | 149:156823d33999 | 17 | * limitations under the License. |
<> | 149:156823d33999 | 18 | */ |
<> | 149:156823d33999 | 19 | #ifndef MBED_INTERFACE_H |
<> | 149:156823d33999 | 20 | #define MBED_INTERFACE_H |
<> | 149:156823d33999 | 21 | |
<> | 149:156823d33999 | 22 | #include <stdarg.h> |
<> | 149:156823d33999 | 23 | |
<> | 149:156823d33999 | 24 | #include "device.h" |
<> | 149:156823d33999 | 25 | |
<> | 149:156823d33999 | 26 | /* Mbed interface mac address |
<> | 149:156823d33999 | 27 | * if MBED_MAC_ADD_x are zero, interface uid sets mac address, |
<> | 149:156823d33999 | 28 | * otherwise MAC_ADD_x are used. |
<> | 149:156823d33999 | 29 | */ |
<> | 149:156823d33999 | 30 | #define MBED_MAC_ADDR_INTERFACE 0x00 |
<> | 149:156823d33999 | 31 | #define MBED_MAC_ADDR_0 MBED_MAC_ADDR_INTERFACE |
<> | 149:156823d33999 | 32 | #define MBED_MAC_ADDR_1 MBED_MAC_ADDR_INTERFACE |
<> | 149:156823d33999 | 33 | #define MBED_MAC_ADDR_2 MBED_MAC_ADDR_INTERFACE |
<> | 149:156823d33999 | 34 | #define MBED_MAC_ADDR_3 MBED_MAC_ADDR_INTERFACE |
<> | 149:156823d33999 | 35 | #define MBED_MAC_ADDR_4 MBED_MAC_ADDR_INTERFACE |
<> | 149:156823d33999 | 36 | #define MBED_MAC_ADDR_5 MBED_MAC_ADDR_INTERFACE |
<> | 149:156823d33999 | 37 | #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) |
<> | 149:156823d33999 | 38 | |
<> | 149:156823d33999 | 39 | #ifdef __cplusplus |
<> | 149:156823d33999 | 40 | extern "C" { |
<> | 149:156823d33999 | 41 | #endif |
<> | 149:156823d33999 | 42 | |
<> | 149:156823d33999 | 43 | #if DEVICE_SEMIHOST |
<> | 149:156823d33999 | 44 | |
<> | 149:156823d33999 | 45 | /** Functions to control the mbed interface |
<> | 149:156823d33999 | 46 | * |
<> | 149:156823d33999 | 47 | * mbed Microcontrollers have a built-in interface to provide functionality such as |
<> | 149:156823d33999 | 48 | * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file |
<> | 149:156823d33999 | 49 | * system. These functions provide means to control the interface suing semihost |
<> | 149:156823d33999 | 50 | * calls it supports. |
<> | 149:156823d33999 | 51 | */ |
<> | 149:156823d33999 | 52 | |
<> | 149:156823d33999 | 53 | /** Determine whether the mbed interface is connected, based on whether debug is enabled |
<> | 149:156823d33999 | 54 | * |
<> | 149:156823d33999 | 55 | * @returns |
<> | 149:156823d33999 | 56 | * 1 if interface is connected, |
<> | 149:156823d33999 | 57 | * 0 otherwise |
<> | 149:156823d33999 | 58 | */ |
<> | 149:156823d33999 | 59 | int mbed_interface_connected(void); |
<> | 149:156823d33999 | 60 | |
<> | 149:156823d33999 | 61 | /** Instruct the mbed interface to reset, as if the reset button had been pressed |
<> | 149:156823d33999 | 62 | * |
<> | 149:156823d33999 | 63 | * @returns |
<> | 149:156823d33999 | 64 | * 1 if successful, |
<> | 149:156823d33999 | 65 | * 0 otherwise (e.g. interface not present) |
<> | 149:156823d33999 | 66 | */ |
<> | 149:156823d33999 | 67 | int mbed_interface_reset(void); |
<> | 149:156823d33999 | 68 | |
<> | 149:156823d33999 | 69 | /** This will disconnect the debug aspect of the interface, so semihosting will be disabled. |
<> | 149:156823d33999 | 70 | * The interface will still support the USB serial aspect |
<> | 149:156823d33999 | 71 | * |
<> | 149:156823d33999 | 72 | * @returns |
<> | 149:156823d33999 | 73 | * 0 if successful, |
<> | 149:156823d33999 | 74 | * -1 otherwise (e.g. interface not present) |
<> | 149:156823d33999 | 75 | */ |
<> | 149:156823d33999 | 76 | int mbed_interface_disconnect(void); |
<> | 149:156823d33999 | 77 | |
<> | 149:156823d33999 | 78 | /** This will disconnect the debug aspect of the interface, and if the USB cable is not |
<> | 149:156823d33999 | 79 | * connected, also power down the interface. If the USB cable is connected, the interface |
<> | 149:156823d33999 | 80 | * will remain powered up and visible to the host |
<> | 149:156823d33999 | 81 | * |
<> | 149:156823d33999 | 82 | * @returns |
<> | 149:156823d33999 | 83 | * 0 if successful, |
<> | 149:156823d33999 | 84 | * -1 otherwise (e.g. interface not present) |
<> | 149:156823d33999 | 85 | */ |
<> | 149:156823d33999 | 86 | int mbed_interface_powerdown(void); |
<> | 149:156823d33999 | 87 | |
<> | 149:156823d33999 | 88 | /** This returns a string containing the 32-character UID of the mbed interface |
<> | 149:156823d33999 | 89 | * This is a weak function that can be overwritten if required |
<> | 149:156823d33999 | 90 | * |
<> | 149:156823d33999 | 91 | * @param uid A 33-byte array to write the null terminated 32-byte string |
<> | 149:156823d33999 | 92 | * |
<> | 149:156823d33999 | 93 | * @returns |
<> | 149:156823d33999 | 94 | * 0 if successful, |
<> | 149:156823d33999 | 95 | * -1 otherwise (e.g. interface not present) |
<> | 149:156823d33999 | 96 | */ |
<> | 149:156823d33999 | 97 | int mbed_interface_uid(char *uid); |
<> | 149:156823d33999 | 98 | |
<> | 149:156823d33999 | 99 | #endif |
<> | 149:156823d33999 | 100 | |
<> | 149:156823d33999 | 101 | /** This returns a unique 6-byte MAC address, based on the interface UID |
<> | 149:156823d33999 | 102 | * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00) |
<> | 149:156823d33999 | 103 | * |
<> | 149:156823d33999 | 104 | * This is a weak function that can be overwritten if you want to provide your own mechanism to |
<> | 149:156823d33999 | 105 | * provide a MAC address. |
<> | 149:156823d33999 | 106 | * |
<> | 149:156823d33999 | 107 | * @param mac A 6-byte array to write the MAC address |
<> | 149:156823d33999 | 108 | */ |
<> | 149:156823d33999 | 109 | void mbed_mac_address(char *mac); |
<> | 149:156823d33999 | 110 | |
<> | 149:156823d33999 | 111 | /** Cause the mbed to flash the BLOD (Blue LEDs Of Death) sequence |
<> | 149:156823d33999 | 112 | */ |
<> | 149:156823d33999 | 113 | void mbed_die(void); |
<> | 149:156823d33999 | 114 | |
<> | 149:156823d33999 | 115 | /** Print out an error message. This is typically called when |
<> | 149:156823d33999 | 116 | * hanlding a crash. |
<> | 149:156823d33999 | 117 | * |
<> | 149:156823d33999 | 118 | * @Note Synchronization level: Interrupt safe |
<> | 149:156823d33999 | 119 | */ |
<> | 149:156823d33999 | 120 | void mbed_error_printf(const char* format, ...); |
<> | 149:156823d33999 | 121 | |
<> | 149:156823d33999 | 122 | /** Print out an error message. Similar to mbed_error_printf |
<> | 149:156823d33999 | 123 | * but uses a va_list. |
<> | 149:156823d33999 | 124 | * |
<> | 149:156823d33999 | 125 | * @Note Synchronization level: Interrupt safe |
<> | 149:156823d33999 | 126 | */ |
<> | 149:156823d33999 | 127 | void mbed_error_vfprintf(const char * format, va_list arg); |
<> | 149:156823d33999 | 128 | |
<> | 149:156823d33999 | 129 | #ifdef __cplusplus |
<> | 149:156823d33999 | 130 | } |
<> | 149:156823d33999 | 131 | #endif |
<> | 149:156823d33999 | 132 | |
<> | 149:156823d33999 | 133 | #endif |
<> | 149:156823d33999 | 134 | |
<> | 149:156823d33999 | 135 | /** @}*/ |