Christian Weiß / Mbed 2 deprecated Diplomarbeit_MW_CW

Dependencies:   mbed

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  * Permission is hereby granted, free of charge, to any person obtaining a copy
00005  * of this software and associated documentation files (the "Software"), to deal
00006  * in the Software without restriction, including without limitation the rights
00007  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00008  * copies of the Software, and to permit persons to whom the Software is
00009  * furnished to do so, subject to the following conditions:
00010  *
00011  * The above copyright notice and this permission notice shall be included in
00012  * all copies or substantial portions of the Software.
00013  *
00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00019  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00020  * SOFTWARE.
00021  */
00022 #ifndef MBED_INTERFACE_H
00023 #define MBED_INTERFACE_H
00024 
00025 #include "device.h"
00026 
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030 
00031 #if DEVICE_SEMIHOST
00032 
00033 /** Functions to control the mbed interface
00034  *
00035  * mbed Microcontrollers have a built-in interface to provide functionality such as
00036  * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file
00037  * system. These functions provide means to control the interface suing semihost
00038  * calls it supports.
00039  */
00040 
00041 /** Determine whether the mbed interface is connected, based on whether debug is enabled
00042  *
00043  *  @returns
00044  *    1 if interface is connected,
00045  *    0 otherwise
00046  */
00047 int mbed_interface_connected(void);
00048 
00049 /** Instruct the mbed interface to reset, as if the reset button had been pressed
00050  *
00051  *  @returns
00052  *    1 if successful,
00053  *    0 otherwise (e.g. interface not present)
00054  */
00055 int mbed_interface_reset(void);
00056 
00057 /** This will disconnect the debug aspect of the interface, so semihosting will be disabled.
00058  * The interface will still support the USB serial aspect
00059  *
00060  *  @returns
00061  *    0 if successful,
00062  *   -1 otherwise (e.g. interface not present)
00063  */
00064 int mbed_interface_disconnect(void);
00065 
00066 /** This will disconnect the debug aspect of the interface, and if the USB cable is not
00067  * connected, also power down the interface. If the USB cable is connected, the interface
00068  * will remain powered up and visible to the host
00069  *
00070  *  @returns
00071  *    0 if successful,
00072  *   -1 otherwise (e.g. interface not present)
00073  */
00074 int mbed_interface_powerdown(void);
00075 
00076 /** This returns a string containing the 32-character UID of the mbed interface
00077  *  This is a weak function that can be overwritten if required
00078  *
00079  *  @param uid A 33-byte array to write the null terminated 32-byte string
00080  *
00081  *  @returns
00082  *    0 if successful,
00083  *   -1 otherwise (e.g. interface not present)
00084  */
00085 int mbed_interface_uid(char *uid);
00086 
00087 #endif
00088 
00089 /** This returns a unique 6-byte MAC address, based on the interface UID
00090  * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00)
00091  *
00092  * This is a weak function that can be overwritten if you want to provide your own mechanism to
00093  * provide a MAC address.
00094  *
00095  *  @param mac A 6-byte array to write the MAC address
00096  */
00097 void mbed_mac_address(char *mac);
00098 
00099 /** Cause the mbed to flash the BLOD (Blue LEDs Of Death) sequence
00100  */
00101 void mbed_die(void);
00102 
00103 #ifdef __cplusplus
00104 }
00105 #endif
00106 
00107 #endif
00108