SD card interface

Committer:
lharoon
Date:
Mon Oct 08 11:14:07 2012 +0000
Revision:
0:22612ae617a0
1st edition

Who changed what in which revision?

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