Nicolas Borla / Mbed OS ROME2_Robot_Firmware
Committer:
boro
Date:
Tue Mar 09 13:10:40 2021 +0000
Revision:
3:6fe17b8a6d62
Parent:
0:4beb2ea291ec
SDBlockDevice added

Who changed what in which revision?

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