The official mbed C/C SDK provides the software platform and libraries to build your applications.

Fork of mbed by mbed official

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mbed_interface.h Source File

mbed_interface.h

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2006-2013 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #ifndef MBED_INTERFACE_H
00017 #define MBED_INTERFACE_H
00018 
00019 #include "device.h"
00020 
00021 #ifdef __cplusplus
00022 extern "C" {
00023 #endif
00024 
00025 #if DEVICE_SEMIHOST
00026 
00027 /** Functions to control the mbed interface
00028  *
00029  * mbed Microcontrollers have a built-in interface to provide functionality such as
00030  * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file
00031  * system. These functions provide means to control the interface suing semihost
00032  * calls it supports.
00033  */
00034 
00035 /** Determine whether the mbed interface is connected, based on whether debug is enabled
00036  *
00037  *  @returns
00038  *    1 if interface is connected,
00039  *    0 otherwise
00040  */
00041 int mbed_interface_connected(void);
00042 
00043 /** Instruct the mbed interface to reset, as if the reset button had been pressed
00044  *
00045  *  @returns
00046  *    1 if successful,
00047  *    0 otherwise (e.g. interface not present)
00048  */
00049 int mbed_interface_reset(void);
00050 
00051 /** This will disconnect the debug aspect of the interface, so semihosting will be disabled.
00052  * The interface will still support the USB serial aspect
00053  *
00054  *  @returns
00055  *    0 if successful,
00056  *   -1 otherwise (e.g. interface not present)
00057  */
00058 int mbed_interface_disconnect(void);
00059 
00060 /** This will disconnect the debug aspect of the interface, and if the USB cable is not
00061  * connected, also power down the interface. If the USB cable is connected, the interface
00062  * will remain powered up and visible to the host
00063  *
00064  *  @returns
00065  *    0 if successful,
00066  *   -1 otherwise (e.g. interface not present)
00067  */
00068 int mbed_interface_powerdown(void);
00069 
00070 /** This returns a string containing the 32-character UID of the mbed interface
00071  *  This is a weak function that can be overwritten if required
00072  *
00073  *  @param uid A 33-byte array to write the null terminated 32-byte string
00074  *
00075  *  @returns
00076  *    0 if successful,
00077  *   -1 otherwise (e.g. interface not present)
00078  */
00079 int mbed_interface_uid(char *uid);
00080 
00081 #endif
00082 
00083 /** This returns a unique 6-byte MAC address, based on the interface UID
00084  * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00)
00085  *
00086  * This is a weak function that can be overwritten if you want to provide your own mechanism to
00087  * provide a MAC address.
00088  *
00089  *  @param mac A 6-byte array to write the MAC address
00090  */
00091 void mbed_mac_address(char *mac);
00092 
00093 /** Cause the mbed to flash the BLOD (Blue LEDs Of Death) sequence
00094  */
00095 void mbed_die(void);
00096 
00097 #ifdef __cplusplus
00098 }
00099 #endif
00100 
00101 #endif