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