]> git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/mbed/api/mbed_interface.h
Merge commit '1fe4406f374291ab2e86e95a97341fd9c475fcb8'
[tmk_keyboard.git] / tmk_core / tool / mbed / mbed-sdk / libraries / mbed / api / mbed_interface.h
1 /* mbed Microcontroller Library
2 * Copyright (c) 2006-2013 ARM Limited
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 #ifndef MBED_INTERFACE_H
17 #define MBED_INTERFACE_H
18
19 #include "device.h"
20
21 /* Mbed interface mac address
22 * if MBED_MAC_ADD_x are zero, interface uid sets mac address,
23 * otherwise MAC_ADD_x are used.
24 */
25 #define MBED_MAC_ADDR_INTERFACE 0x00
26 #define MBED_MAC_ADDR_0 MBED_MAC_ADDR_INTERFACE
27 #define MBED_MAC_ADDR_1 MBED_MAC_ADDR_INTERFACE
28 #define MBED_MAC_ADDR_2 MBED_MAC_ADDR_INTERFACE
29 #define MBED_MAC_ADDR_3 MBED_MAC_ADDR_INTERFACE
30 #define MBED_MAC_ADDR_4 MBED_MAC_ADDR_INTERFACE
31 #define MBED_MAC_ADDR_5 MBED_MAC_ADDR_INTERFACE
32 #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)
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 #if DEVICE_SEMIHOST
39
40 /** Functions to control the mbed interface
41 *
42 * mbed Microcontrollers have a built-in interface to provide functionality such as
43 * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file
44 * system. These functions provide means to control the interface suing semihost
45 * calls it supports.
46 */
47
48 /** Determine whether the mbed interface is connected, based on whether debug is enabled
49 *
50 * @returns
51 * 1 if interface is connected,
52 * 0 otherwise
53 */
54 int mbed_interface_connected(void);
55
56 /** Instruct the mbed interface to reset, as if the reset button had been pressed
57 *
58 * @returns
59 * 1 if successful,
60 * 0 otherwise (e.g. interface not present)
61 */
62 int mbed_interface_reset(void);
63
64 /** This will disconnect the debug aspect of the interface, so semihosting will be disabled.
65 * The interface will still support the USB serial aspect
66 *
67 * @returns
68 * 0 if successful,
69 * -1 otherwise (e.g. interface not present)
70 */
71 int mbed_interface_disconnect(void);
72
73 /** This will disconnect the debug aspect of the interface, and if the USB cable is not
74 * connected, also power down the interface. If the USB cable is connected, the interface
75 * will remain powered up and visible to the host
76 *
77 * @returns
78 * 0 if successful,
79 * -1 otherwise (e.g. interface not present)
80 */
81 int mbed_interface_powerdown(void);
82
83 /** This returns a string containing the 32-character UID of the mbed interface
84 * This is a weak function that can be overwritten if required
85 *
86 * @param uid A 33-byte array to write the null terminated 32-byte string
87 *
88 * @returns
89 * 0 if successful,
90 * -1 otherwise (e.g. interface not present)
91 */
92 int mbed_interface_uid(char *uid);
93
94 #endif
95
96 /** This returns a unique 6-byte MAC address, based on the interface UID
97 * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00)
98 *
99 * This is a weak function that can be overwritten if you want to provide your own mechanism to
100 * provide a MAC address.
101 *
102 * @param mac A 6-byte array to write the MAC address
103 */
104 void mbed_mac_address(char *mac);
105
106 /** Cause the mbed to flash the BLOD (Blue LEDs Of Death) sequence
107 */
108 void mbed_die(void);
109
110 #ifdef __cplusplus
111 }
112 #endif
113
114 #endif
Imprint / Impressum