test

Dependencies:   mbed Watchdog

Dependents:   STM32-MC_node

Committer:
ommpy
Date:
Mon Jul 06 17:18:59 2020 +0530
Revision:
0:d383e2dee0f7
first commit

Who changed what in which revision?

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