Dataloger

Committer:
jhon309
Date:
Thu Aug 20 00:37:14 2015 +0000
Revision:
0:666850d06c9f
ok

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jhon309 0:666850d06c9f 1 /* mbed Microcontroller Library
jhon309 0:666850d06c9f 2 * Copyright (c) 2006-2013 ARM Limited
jhon309 0:666850d06c9f 3 *
jhon309 0:666850d06c9f 4 * Licensed under the Apache License, Version 2.0 (the "License");
jhon309 0:666850d06c9f 5 * you may not use this file except in compliance with the License.
jhon309 0:666850d06c9f 6 * You may obtain a copy of the License at
jhon309 0:666850d06c9f 7 *
jhon309 0:666850d06c9f 8 * http://www.apache.org/licenses/LICENSE-2.0
jhon309 0:666850d06c9f 9 *
jhon309 0:666850d06c9f 10 * Unless required by applicable law or agreed to in writing, software
jhon309 0:666850d06c9f 11 * distributed under the License is distributed on an "AS IS" BASIS,
jhon309 0:666850d06c9f 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
jhon309 0:666850d06c9f 13 * See the License for the specific language governing permissions and
jhon309 0:666850d06c9f 14 * limitations under the License.
jhon309 0:666850d06c9f 15 */
jhon309 0:666850d06c9f 16 #ifndef MBED_INTERFACE_H
jhon309 0:666850d06c9f 17 #define MBED_INTERFACE_H
jhon309 0:666850d06c9f 18
jhon309 0:666850d06c9f 19 #include "device.h"
jhon309 0:666850d06c9f 20
jhon309 0:666850d06c9f 21 /* Mbed interface mac address
jhon309 0:666850d06c9f 22 * if MBED_MAC_ADD_x are zero, interface uid sets mac address,
jhon309 0:666850d06c9f 23 * otherwise MAC_ADD_x are used.
jhon309 0:666850d06c9f 24 */
jhon309 0:666850d06c9f 25 #define MBED_MAC_ADDR_INTERFACE 0x00
jhon309 0:666850d06c9f 26 #define MBED_MAC_ADDR_0 MBED_MAC_ADDR_INTERFACE
jhon309 0:666850d06c9f 27 #define MBED_MAC_ADDR_1 MBED_MAC_ADDR_INTERFACE
jhon309 0:666850d06c9f 28 #define MBED_MAC_ADDR_2 MBED_MAC_ADDR_INTERFACE
jhon309 0:666850d06c9f 29 #define MBED_MAC_ADDR_3 MBED_MAC_ADDR_INTERFACE
jhon309 0:666850d06c9f 30 #define MBED_MAC_ADDR_4 MBED_MAC_ADDR_INTERFACE
jhon309 0:666850d06c9f 31 #define MBED_MAC_ADDR_5 MBED_MAC_ADDR_INTERFACE
jhon309 0:666850d06c9f 32 #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)
jhon309 0:666850d06c9f 33
jhon309 0:666850d06c9f 34 #ifdef __cplusplus
jhon309 0:666850d06c9f 35 extern "C" {
jhon309 0:666850d06c9f 36 #endif
jhon309 0:666850d06c9f 37
jhon309 0:666850d06c9f 38 #if DEVICE_SEMIHOST
jhon309 0:666850d06c9f 39
jhon309 0:666850d06c9f 40 /** Functions to control the mbed interface
jhon309 0:666850d06c9f 41 *
jhon309 0:666850d06c9f 42 * mbed Microcontrollers have a built-in interface to provide functionality such as
jhon309 0:666850d06c9f 43 * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file
jhon309 0:666850d06c9f 44 * system. These functions provide means to control the interface suing semihost
jhon309 0:666850d06c9f 45 * calls it supports.
jhon309 0:666850d06c9f 46 */
jhon309 0:666850d06c9f 47
jhon309 0:666850d06c9f 48 /** Determine whether the mbed interface is connected, based on whether debug is enabled
jhon309 0:666850d06c9f 49 *
jhon309 0:666850d06c9f 50 * @returns
jhon309 0:666850d06c9f 51 * 1 if interface is connected,
jhon309 0:666850d06c9f 52 * 0 otherwise
jhon309 0:666850d06c9f 53 */
jhon309 0:666850d06c9f 54 int mbed_interface_connected(void);
jhon309 0:666850d06c9f 55
jhon309 0:666850d06c9f 56 /** Instruct the mbed interface to reset, as if the reset button had been pressed
jhon309 0:666850d06c9f 57 *
jhon309 0:666850d06c9f 58 * @returns
jhon309 0:666850d06c9f 59 * 1 if successful,
jhon309 0:666850d06c9f 60 * 0 otherwise (e.g. interface not present)
jhon309 0:666850d06c9f 61 */
jhon309 0:666850d06c9f 62 int mbed_interface_reset(void);
jhon309 0:666850d06c9f 63
jhon309 0:666850d06c9f 64 /** This will disconnect the debug aspect of the interface, so semihosting will be disabled.
jhon309 0:666850d06c9f 65 * The interface will still support the USB serial aspect
jhon309 0:666850d06c9f 66 *
jhon309 0:666850d06c9f 67 * @returns
jhon309 0:666850d06c9f 68 * 0 if successful,
jhon309 0:666850d06c9f 69 * -1 otherwise (e.g. interface not present)
jhon309 0:666850d06c9f 70 */
jhon309 0:666850d06c9f 71 int mbed_interface_disconnect(void);
jhon309 0:666850d06c9f 72
jhon309 0:666850d06c9f 73 /** This will disconnect the debug aspect of the interface, and if the USB cable is not
jhon309 0:666850d06c9f 74 * connected, also power down the interface. If the USB cable is connected, the interface
jhon309 0:666850d06c9f 75 * will remain powered up and visible to the host
jhon309 0:666850d06c9f 76 *
jhon309 0:666850d06c9f 77 * @returns
jhon309 0:666850d06c9f 78 * 0 if successful,
jhon309 0:666850d06c9f 79 * -1 otherwise (e.g. interface not present)
jhon309 0:666850d06c9f 80 */
jhon309 0:666850d06c9f 81 int mbed_interface_powerdown(void);
jhon309 0:666850d06c9f 82
jhon309 0:666850d06c9f 83 /** This returns a string containing the 32-character UID of the mbed interface
jhon309 0:666850d06c9f 84 * This is a weak function that can be overwritten if required
jhon309 0:666850d06c9f 85 *
jhon309 0:666850d06c9f 86 * @param uid A 33-byte array to write the null terminated 32-byte string
jhon309 0:666850d06c9f 87 *
jhon309 0:666850d06c9f 88 * @returns
jhon309 0:666850d06c9f 89 * 0 if successful,
jhon309 0:666850d06c9f 90 * -1 otherwise (e.g. interface not present)
jhon309 0:666850d06c9f 91 */
jhon309 0:666850d06c9f 92 int mbed_interface_uid(char *uid);
jhon309 0:666850d06c9f 93
jhon309 0:666850d06c9f 94 #endif
jhon309 0:666850d06c9f 95
jhon309 0:666850d06c9f 96 /** This returns a unique 6-byte MAC address, based on the interface UID
jhon309 0:666850d06c9f 97 * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00)
jhon309 0:666850d06c9f 98 *
jhon309 0:666850d06c9f 99 * This is a weak function that can be overwritten if you want to provide your own mechanism to
jhon309 0:666850d06c9f 100 * provide a MAC address.
jhon309 0:666850d06c9f 101 *
jhon309 0:666850d06c9f 102 * @param mac A 6-byte array to write the MAC address
jhon309 0:666850d06c9f 103 */
jhon309 0:666850d06c9f 104 void mbed_mac_address(char *mac);
jhon309 0:666850d06c9f 105
jhon309 0:666850d06c9f 106 /** Cause the mbed to flash the BLOD (Blue LEDs Of Death) sequence
jhon309 0:666850d06c9f 107 */
jhon309 0:666850d06c9f 108 void mbed_die(void);
jhon309 0:666850d06c9f 109
jhon309 0:666850d06c9f 110 #ifdef __cplusplus
jhon309 0:666850d06c9f 111 }
jhon309 0:666850d06c9f 112 #endif
jhon309 0:666850d06c9f 113
jhon309 0:666850d06c9f 114 #endif