SPKT

Dependents:   Player

Committer:
phungductung
Date:
Tue Jun 04 21:51:46 2019 +0000
Revision:
0:e87aa4c49e95
libray

Who changed what in which revision?

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