mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Fri Feb 16 16:09:33 2018 +0000
Revision:
181:57724642e740
Parent:
178:79309dc6340a
Child:
187:0387e8f68319
mbed-dev library. Release version 159.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 149:156823d33999 1
<> 149:156823d33999 2 /** \addtogroup platform */
<> 149:156823d33999 3 /** @{*/
AnnaBridge 178:79309dc6340a 4 /**
AnnaBridge 178:79309dc6340a 5 * \defgroup platform_interface Network interface and other utility functions
AnnaBridge 178:79309dc6340a 6 * @{
AnnaBridge 178:79309dc6340a 7 */
AnnaBridge 178:79309dc6340a 8
<> 149:156823d33999 9 /* mbed Microcontroller Library
<> 149:156823d33999 10 * Copyright (c) 2006-2013 ARM Limited
<> 149:156823d33999 11 *
<> 149:156823d33999 12 * Licensed under the Apache License, Version 2.0 (the "License");
<> 149:156823d33999 13 * you may not use this file except in compliance with the License.
<> 149:156823d33999 14 * You may obtain a copy of the License at
<> 149:156823d33999 15 *
<> 149:156823d33999 16 * http://www.apache.org/licenses/LICENSE-2.0
<> 149:156823d33999 17 *
<> 149:156823d33999 18 * Unless required by applicable law or agreed to in writing, software
<> 149:156823d33999 19 * distributed under the License is distributed on an "AS IS" BASIS,
<> 149:156823d33999 20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 149:156823d33999 21 * See the License for the specific language governing permissions and
<> 149:156823d33999 22 * limitations under the License.
<> 149:156823d33999 23 */
<> 149:156823d33999 24 #ifndef MBED_INTERFACE_H
<> 149:156823d33999 25 #define MBED_INTERFACE_H
<> 149:156823d33999 26
<> 149:156823d33999 27 #include <stdarg.h>
<> 149:156823d33999 28
<> 149:156823d33999 29 #include "device.h"
<> 149:156823d33999 30
<> 149:156823d33999 31 /* Mbed interface mac address
<> 149:156823d33999 32 * if MBED_MAC_ADD_x are zero, interface uid sets mac address,
<> 149:156823d33999 33 * otherwise MAC_ADD_x are used.
<> 149:156823d33999 34 */
<> 149:156823d33999 35 #define MBED_MAC_ADDR_INTERFACE 0x00
<> 149:156823d33999 36 #define MBED_MAC_ADDR_0 MBED_MAC_ADDR_INTERFACE
<> 149:156823d33999 37 #define MBED_MAC_ADDR_1 MBED_MAC_ADDR_INTERFACE
<> 149:156823d33999 38 #define MBED_MAC_ADDR_2 MBED_MAC_ADDR_INTERFACE
<> 149:156823d33999 39 #define MBED_MAC_ADDR_3 MBED_MAC_ADDR_INTERFACE
<> 149:156823d33999 40 #define MBED_MAC_ADDR_4 MBED_MAC_ADDR_INTERFACE
<> 149:156823d33999 41 #define MBED_MAC_ADDR_5 MBED_MAC_ADDR_INTERFACE
<> 149:156823d33999 42 #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 43
<> 149:156823d33999 44 #ifdef __cplusplus
<> 149:156823d33999 45 extern "C" {
<> 149:156823d33999 46 #endif
<> 149:156823d33999 47
<> 149:156823d33999 48 #if DEVICE_SEMIHOST
<> 149:156823d33999 49
AnnaBridge 178:79309dc6340a 50 /**
AnnaBridge 178:79309dc6340a 51 * \defgroup platform_interface interface functions
AnnaBridge 178:79309dc6340a 52 * @{
AnnaBridge 178:79309dc6340a 53 */
AnnaBridge 178:79309dc6340a 54
<> 149:156823d33999 55 /** Functions to control the mbed interface
<> 149:156823d33999 56 *
<> 149:156823d33999 57 * mbed Microcontrollers have a built-in interface to provide functionality such as
<> 149:156823d33999 58 * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file
<> 149:156823d33999 59 * system. These functions provide means to control the interface suing semihost
<> 149:156823d33999 60 * calls it supports.
<> 149:156823d33999 61 */
<> 149:156823d33999 62
<> 149:156823d33999 63 /** Determine whether the mbed interface is connected, based on whether debug is enabled
<> 149:156823d33999 64 *
<> 149:156823d33999 65 * @returns
<> 149:156823d33999 66 * 1 if interface is connected,
<> 149:156823d33999 67 * 0 otherwise
<> 149:156823d33999 68 */
<> 149:156823d33999 69 int mbed_interface_connected(void);
<> 149:156823d33999 70
<> 149:156823d33999 71 /** Instruct the mbed interface to reset, as if the reset button had been pressed
<> 149:156823d33999 72 *
<> 149:156823d33999 73 * @returns
<> 149:156823d33999 74 * 1 if successful,
<> 149:156823d33999 75 * 0 otherwise (e.g. interface not present)
<> 149:156823d33999 76 */
<> 149:156823d33999 77 int mbed_interface_reset(void);
<> 149:156823d33999 78
<> 149:156823d33999 79 /** This will disconnect the debug aspect of the interface, so semihosting will be disabled.
<> 149:156823d33999 80 * The interface will still support the USB serial aspect
<> 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_disconnect(void);
<> 149:156823d33999 87
<> 149:156823d33999 88 /** This will disconnect the debug aspect of the interface, and if the USB cable is not
<> 149:156823d33999 89 * connected, also power down the interface. If the USB cable is connected, the interface
<> 149:156823d33999 90 * will remain powered up and visible to the host
<> 149:156823d33999 91 *
<> 149:156823d33999 92 * @returns
<> 149:156823d33999 93 * 0 if successful,
<> 149:156823d33999 94 * -1 otherwise (e.g. interface not present)
<> 149:156823d33999 95 */
<> 149:156823d33999 96 int mbed_interface_powerdown(void);
<> 149:156823d33999 97
<> 149:156823d33999 98 /** This returns a string containing the 32-character UID of the mbed interface
<> 149:156823d33999 99 * This is a weak function that can be overwritten if required
<> 149:156823d33999 100 *
<> 149:156823d33999 101 * @param uid A 33-byte array to write the null terminated 32-byte string
<> 149:156823d33999 102 *
<> 149:156823d33999 103 * @returns
<> 149:156823d33999 104 * 0 if successful,
<> 149:156823d33999 105 * -1 otherwise (e.g. interface not present)
<> 149:156823d33999 106 */
<> 149:156823d33999 107 int mbed_interface_uid(char *uid);
<> 149:156823d33999 108
<> 149:156823d33999 109 #endif
<> 149:156823d33999 110
<> 149:156823d33999 111 /** This returns a unique 6-byte MAC address, based on the interface UID
<> 149:156823d33999 112 * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00)
<> 149:156823d33999 113 *
<> 149:156823d33999 114 * This is a weak function that can be overwritten if you want to provide your own mechanism to
<> 149:156823d33999 115 * provide a MAC address.
<> 149:156823d33999 116 *
<> 149:156823d33999 117 * @param mac A 6-byte array to write the MAC address
<> 149:156823d33999 118 */
<> 149:156823d33999 119 void mbed_mac_address(char *mac);
<> 149:156823d33999 120
<> 149:156823d33999 121 /** Cause the mbed to flash the BLOD (Blue LEDs Of Death) sequence
<> 149:156823d33999 122 */
<> 149:156823d33999 123 void mbed_die(void);
<> 149:156823d33999 124
<> 149:156823d33999 125 /** Print out an error message. This is typically called when
AnnaBridge 167:e84263d55307 126 * handling a crash.
AnnaBridge 167:e84263d55307 127 *
AnnaBridge 167:e84263d55307 128 * @note Synchronization level: Interrupt safe
<> 149:156823d33999 129 *
AnnaBridge 167:e84263d55307 130 * @param format C string that contains data stream to be printed.
AnnaBridge 167:e84263d55307 131 * Code snippets below show valid format.
AnnaBridge 167:e84263d55307 132 *
AnnaBridge 167:e84263d55307 133 * @code
AnnaBridge 167:e84263d55307 134 * mbed_error_printf("Failed: %s, file: %s, line %d \n", expr, file, line);
AnnaBridge 167:e84263d55307 135 * @endcode
AnnaBridge 167:e84263d55307 136 *
<> 149:156823d33999 137 */
<> 149:156823d33999 138 void mbed_error_printf(const char* format, ...);
<> 149:156823d33999 139
<> 149:156823d33999 140 /** Print out an error message. Similar to mbed_error_printf
<> 149:156823d33999 141 * but uses a va_list.
<> 149:156823d33999 142 *
AnnaBridge 167:e84263d55307 143 * @note Synchronization level: Interrupt safe
AnnaBridge 167:e84263d55307 144 *
AnnaBridge 167:e84263d55307 145 * @param format C string that contains data stream to be printed.
AnnaBridge 167:e84263d55307 146 * @param arg Variable arguments list
AnnaBridge 167:e84263d55307 147 *
<> 149:156823d33999 148 */
<> 149:156823d33999 149 void mbed_error_vfprintf(const char * format, va_list arg);
AnnaBridge 178:79309dc6340a 150 /** @}*/
<> 149:156823d33999 151
<> 149:156823d33999 152 #ifdef __cplusplus
<> 149:156823d33999 153 }
<> 149:156823d33999 154 #endif
<> 149:156823d33999 155
<> 149:156823d33999 156 #endif
<> 149:156823d33999 157
<> 149:156823d33999 158 /** @}*/