Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of OmniWheels by
mbed_interface.h
00001 00002 /** \addtogroup platform */ 00003 /** @{*/ 00004 /** 00005 * \defgroup platform_interface Network interface and other utility functions 00006 * @{ 00007 */ 00008 00009 /* mbed Microcontroller Library 00010 * Copyright (c) 2006-2013 ARM Limited 00011 * 00012 * Licensed under the Apache License, Version 2.0 (the "License"); 00013 * you may not use this file except in compliance with the License. 00014 * You may obtain a copy of the License at 00015 * 00016 * http://www.apache.org/licenses/LICENSE-2.0 00017 * 00018 * Unless required by applicable law or agreed to in writing, software 00019 * distributed under the License is distributed on an "AS IS" BASIS, 00020 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00021 * See the License for the specific language governing permissions and 00022 * limitations under the License. 00023 */ 00024 #ifndef MBED_INTERFACE_H 00025 #define MBED_INTERFACE_H 00026 00027 #include <stdarg.h> 00028 00029 #include "device.h" 00030 00031 /* Mbed interface mac address 00032 * if MBED_MAC_ADD_x are zero, interface uid sets mac address, 00033 * otherwise MAC_ADD_x are used. 00034 */ 00035 #define MBED_MAC_ADDR_INTERFACE 0x00 00036 #define MBED_MAC_ADDR_0 MBED_MAC_ADDR_INTERFACE 00037 #define MBED_MAC_ADDR_1 MBED_MAC_ADDR_INTERFACE 00038 #define MBED_MAC_ADDR_2 MBED_MAC_ADDR_INTERFACE 00039 #define MBED_MAC_ADDR_3 MBED_MAC_ADDR_INTERFACE 00040 #define MBED_MAC_ADDR_4 MBED_MAC_ADDR_INTERFACE 00041 #define MBED_MAC_ADDR_5 MBED_MAC_ADDR_INTERFACE 00042 #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) 00043 00044 #ifdef __cplusplus 00045 extern "C" { 00046 #endif 00047 00048 #if DEVICE_SEMIHOST 00049 00050 /** 00051 * \defgroup platform_interface interface functions 00052 * @{ 00053 */ 00054 00055 /** Functions to control the mbed interface 00056 * 00057 * mbed Microcontrollers have a built-in interface to provide functionality such as 00058 * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file 00059 * system. These functions provide means to control the interface suing semihost 00060 * calls it supports. 00061 */ 00062 00063 /** Determine whether the mbed interface is connected, based on whether debug is enabled 00064 * 00065 * @returns 00066 * 1 if interface is connected, 00067 * 0 otherwise 00068 */ 00069 int mbed_interface_connected(void); 00070 00071 /** Instruct the mbed interface to reset, as if the reset button had been pressed 00072 * 00073 * @returns 00074 * 1 if successful, 00075 * 0 otherwise (e.g. interface not present) 00076 */ 00077 int mbed_interface_reset(void); 00078 00079 /** This will disconnect the debug aspect of the interface, so semihosting will be disabled. 00080 * The interface will still support the USB serial aspect 00081 * 00082 * @returns 00083 * 0 if successful, 00084 * -1 otherwise (e.g. interface not present) 00085 */ 00086 int mbed_interface_disconnect(void); 00087 00088 /** This will disconnect the debug aspect of the interface, and if the USB cable is not 00089 * connected, also power down the interface. If the USB cable is connected, the interface 00090 * will remain powered up and visible to the host 00091 * 00092 * @returns 00093 * 0 if successful, 00094 * -1 otherwise (e.g. interface not present) 00095 */ 00096 int mbed_interface_powerdown(void); 00097 00098 /** This returns a string containing the 32-character UID of the mbed interface 00099 * This is a weak function that can be overwritten if required 00100 * 00101 * @param uid A 33-byte array to write the null terminated 32-byte string 00102 * 00103 * @returns 00104 * 0 if successful, 00105 * -1 otherwise (e.g. interface not present) 00106 */ 00107 int mbed_interface_uid(char *uid); 00108 00109 #endif 00110 00111 /** This returns a unique 6-byte MAC address, based on the interface UID 00112 * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00) 00113 * 00114 * This is a weak function that can be overwritten if you want to provide your own mechanism to 00115 * provide a MAC address. 00116 * 00117 * @param mac A 6-byte array to write the MAC address 00118 */ 00119 void mbed_mac_address(char *mac); 00120 00121 /** Cause the mbed to flash the BLOD (Blue LEDs Of Death) sequence 00122 */ 00123 void mbed_die(void); 00124 00125 /** Print out an error message. This is typically called when 00126 * handling a crash. 00127 * 00128 * @note Synchronization level: Interrupt safe 00129 * 00130 * @param format C string that contains data stream to be printed. 00131 * Code snippets below show valid format. 00132 * 00133 * @code 00134 * mbed_error_printf("Failed: %s, file: %s, line %d \n", expr, file, line); 00135 * @endcode 00136 * 00137 */ 00138 void mbed_error_printf(const char* format, ...); 00139 00140 /** Print out an error message. Similar to mbed_error_printf 00141 * but uses a va_list. 00142 * 00143 * @note Synchronization level: Interrupt safe 00144 * 00145 * @param format C string that contains data stream to be printed. 00146 * @param arg Variable arguments list 00147 * 00148 */ 00149 void mbed_error_vfprintf(const char * format, va_list arg); 00150 /** @}*/ 00151 00152 #ifdef __cplusplus 00153 } 00154 #endif 00155 00156 #endif 00157 00158 /** @}*/
Generated on Fri Jul 22 2022 04:53:56 by
