| 1 | /* Title: mbed_interface |
|---|
| 2 | * Functions to control the mbed interface |
|---|
| 3 | * |
|---|
| 4 | * mbed Microcontrollers have a built-in interface to provide functionality such as |
|---|
| 5 | * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file |
|---|
| 6 | * system. These functions provide means to control the interface suing semihost |
|---|
| 7 | * calls it supports. |
|---|
| 8 | */ |
|---|
| 9 | |
|---|
| 10 | /* mbed Microcontroller Library - mbed_interface |
|---|
| 11 | * Copyright (c) 2009-2011 ARM Limited. All rights reserved. |
|---|
| 12 | */ |
|---|
| 13 | |
|---|
| 14 | #ifndef MBED_INTERFACE_H |
|---|
| 15 | #define MBED_INTERFACE_H |
|---|
| 16 | |
|---|
| 17 | #ifdef __cplusplus |
|---|
| 18 | extern "C" { |
|---|
| 19 | #endif |
|---|
| 20 | |
|---|
| 21 | /* Function: mbed_interface_connected |
|---|
| 22 | * Determine whether the mbed interface is connected, based on whether debug is enabled |
|---|
| 23 | * |
|---|
| 24 | * Variables: |
|---|
| 25 | * returns - 1 if interface is connected, else 0 |
|---|
| 26 | */ |
|---|
| 27 | int mbed_interface_connected(void); |
|---|
| 28 | |
|---|
| 29 | /* Function: mbed_interface_reset |
|---|
| 30 | * Instruct the mbed interface to reset, as if the reset button had been pressed |
|---|
| 31 | * |
|---|
| 32 | * Variables: |
|---|
| 33 | * returns - 1 if successful, else 0 (e.g. interface not present) |
|---|
| 34 | */ |
|---|
| 35 | int mbed_interface_reset(void); |
|---|
| 36 | |
|---|
| 37 | /* Function: mbed_interface_disconnect |
|---|
| 38 | * This will disconnect the debug aspect of the interface, so semihosting will be disabled. |
|---|
| 39 | * The interface will still support the USB serial aspect |
|---|
| 40 | * |
|---|
| 41 | * Variables: |
|---|
| 42 | * returns - 0 if successful, else -1 (e.g. interface not present) |
|---|
| 43 | */ |
|---|
| 44 | int mbed_interface_disconnect(void); |
|---|
| 45 | |
|---|
| 46 | /* Function: mbed_interface_powerdown |
|---|
| 47 | * This will disconnect the debug aspect of the interface, and if the USB cable is not |
|---|
| 48 | * connected, also power down the interface. If the USB cable is connected, the interface |
|---|
| 49 | * will remain powered up and visible to the host |
|---|
| 50 | * |
|---|
| 51 | * Variables: |
|---|
| 52 | * returns - 0 if successful, else -1 (e.g. interface not present) |
|---|
| 53 | */ |
|---|
| 54 | int mbed_interface_powerdown(void); |
|---|
| 55 | |
|---|
| 56 | /* Function: mbed_interface_uid |
|---|
| 57 | * This returns a string containing the 32-character UID of the mbed interface |
|---|
| 58 | * |
|---|
| 59 | * This is a weak function that can be overwritten if required |
|---|
| 60 | * |
|---|
| 61 | * Variables: |
|---|
| 62 | * uid - A 33-byte array to write the null terminated 32-byte string |
|---|
| 63 | * returns - 0 if successful, else -1 (e.g. interface not present) |
|---|
| 64 | */ |
|---|
| 65 | int mbed_interface_uid(char *uid); |
|---|
| 66 | |
|---|
| 67 | /* Function: mbed_mac_address |
|---|
| 68 | * This returns a unique 6-byte MAC address, based on the interface UID |
|---|
| 69 | * |
|---|
| 70 | * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00) |
|---|
| 71 | * |
|---|
| 72 | * This is a weak function that can be overwritten if you want to provide your own mechanism to |
|---|
| 73 | * provide a MAC address. |
|---|
| 74 | |
|---|
| 75 | * Variables: |
|---|
| 76 | * mac - A 6-byte array to write the MAC address |
|---|
| 77 | */ |
|---|
| 78 | void mbed_mac_address(char *mac); |
|---|
| 79 | |
|---|
| 80 | /* Function: mbed_die |
|---|
| 81 | * Cause the mbed to flash the BLOD LED sequence |
|---|
| 82 | */ |
|---|
| 83 | void mbed_die(void); |
|---|
| 84 | |
|---|
| 85 | #ifdef __cplusplus |
|---|
| 86 | } |
|---|
| 87 | #endif |
|---|
| 88 | |
|---|
| 89 | #endif |
|---|