test test test

Dependencies:   mbed

Committer:
mohamedmoawya
Date:
Mon May 25 19:06:11 2020 +0000
Revision:
0:e4c5e6ec922e
snake game tteest

Who changed what in which revision?

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