mbed library sources

Fork of mbed-src by mbed official

Committer:
emilmont
Date:
Mon Jun 10 16:03:00 2013 +0100
Revision:
9:0ce32e54c9a7
Parent:
capi/mbed_interface.h@2:143cac498751
Child:
10:3bc89ef62ce7
Refactoring of the mbed SDK:
- Provide a well defined HAL and API
- Keep separated the HAL implementations for the different targets

Who changed what in which revision?

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