Rahul Dahiya / Mbed OS STM32F7 Ethernet
Committer:
rahul_dahiya
Date:
Wed Jan 15 15:57:15 2020 +0530
Revision:
0:fb8047b156bb
STM32F7 LWIP

Who changed what in which revision?

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