mbed.h verzija za koristenje na predmetu PAI

Committer:
esokic
Date:
Tue Mar 10 09:51:52 2015 +0000
Revision:
0:05aad811ea07
mbed.h verzija od marta 2014, za koristenje na predmetu PAI

Who changed what in which revision?

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