added prescaler for 16 bit pwm in LPC1347 target

Fork of mbed-dev by mbed official

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mbed_interface.h Source File

mbed_interface.h

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2006-2013 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #ifndef MBED_INTERFACE_H
00017 #define MBED_INTERFACE_H
00018 
00019 #include <stdarg.h>
00020 
00021 #include "device.h"
00022 
00023 /* Mbed interface mac address
00024  * if MBED_MAC_ADD_x are zero, interface uid sets mac address,
00025  * otherwise MAC_ADD_x are used.
00026  */
00027 #define MBED_MAC_ADDR_INTERFACE 0x00
00028 #define MBED_MAC_ADDR_0  MBED_MAC_ADDR_INTERFACE
00029 #define MBED_MAC_ADDR_1  MBED_MAC_ADDR_INTERFACE
00030 #define MBED_MAC_ADDR_2  MBED_MAC_ADDR_INTERFACE
00031 #define MBED_MAC_ADDR_3  MBED_MAC_ADDR_INTERFACE
00032 #define MBED_MAC_ADDR_4  MBED_MAC_ADDR_INTERFACE
00033 #define MBED_MAC_ADDR_5  MBED_MAC_ADDR_INTERFACE
00034 #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)
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 #if DEVICE_SEMIHOST
00041 
00042 /** Functions to control the mbed interface
00043  *
00044  * mbed Microcontrollers have a built-in interface to provide functionality such as
00045  * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file
00046  * system. These functions provide means to control the interface suing semihost
00047  * calls it supports.
00048  */
00049 
00050 /** Determine whether the mbed interface is connected, based on whether debug is enabled
00051  *
00052  *  @returns
00053  *    1 if interface is connected,
00054  *    0 otherwise
00055  */
00056 int mbed_interface_connected(void);
00057 
00058 /** Instruct the mbed interface to reset, as if the reset button had been pressed
00059  *
00060  *  @returns
00061  *    1 if successful,
00062  *    0 otherwise (e.g. interface not present)
00063  */
00064 int mbed_interface_reset(void);
00065 
00066 /** This will disconnect the debug aspect of the interface, so semihosting will be disabled.
00067  * The interface will still support the USB serial aspect
00068  *
00069  *  @returns
00070  *    0 if successful,
00071  *   -1 otherwise (e.g. interface not present)
00072  */
00073 int mbed_interface_disconnect(void);
00074 
00075 /** This will disconnect the debug aspect of the interface, and if the USB cable is not
00076  * connected, also power down the interface. If the USB cable is connected, the interface
00077  * will remain powered up and visible to the host
00078  *
00079  *  @returns
00080  *    0 if successful,
00081  *   -1 otherwise (e.g. interface not present)
00082  */
00083 int mbed_interface_powerdown(void);
00084 
00085 /** This returns a string containing the 32-character UID of the mbed interface
00086  *  This is a weak function that can be overwritten if required
00087  *
00088  *  @param uid A 33-byte array to write the null terminated 32-byte string
00089  *
00090  *  @returns
00091  *    0 if successful,
00092  *   -1 otherwise (e.g. interface not present)
00093  */
00094 int mbed_interface_uid(char *uid);
00095 
00096 #endif
00097 
00098 /** This returns a unique 6-byte MAC address, based on the interface UID
00099  * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00)
00100  *
00101  * This is a weak function that can be overwritten if you want to provide your own mechanism to
00102  * provide a MAC address.
00103  *
00104  *  @param mac A 6-byte array to write the MAC address
00105  */
00106 void mbed_mac_address(char *mac);
00107 
00108 /** Cause the mbed to flash the BLOD (Blue LEDs Of Death) sequence
00109  */
00110 void mbed_die(void);
00111 
00112 /** Print out an error message.  This is typically called when
00113  * hanlding a crash.
00114  *
00115  * @Note Synchronization level: Interrupt safe
00116  */
00117 void mbed_error_printf(const char* format, ...);
00118 
00119 /** Print out an error message.  Similar to mbed_error_printf
00120  * but uses a va_list.
00121  *
00122  * @Note Synchronization level: Interrupt safe
00123  */
00124 void mbed_error_vfprintf(const char * format, va_list arg);
00125 
00126 #ifdef __cplusplus
00127 }
00128 #endif
00129 
00130 #endif