Describes predefine macros for mbed online compiler (armcc)

Committer:
MACRUM
Date:
Thu Mar 16 21:58:09 2017 +0900
Revision:
6:40e873bbc5f7
Add licence header info

Who changed what in which revision?

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