mbed library for NZ32-SC151

Committer:
modtronix-com
Date:
Fri Aug 19 15:46:42 2016 +1000
Revision:
17:639ed60ce759
Parent:
1:71204b8406f2
Added tag v1.1 for changeset 076cbe3e55be

Who changed what in which revision?

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