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