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