+++ /dev/null
-==Current Version
-**GCC Version:** [[https://launchpad.net/gcc-arm-embedded/4.6/4.6-2012-q1-update|GCC ARM Embedded 4.6-2012-q1-update]]\\
-**mbed SDK Version:** [[http://mbed.org/handbook/mbed-Library-Releases|Revision 43]]\\
-
-==Previous Versions
-[[https://github.com/adamgreen/gcc4mbed/tree/cs2011.03-42_mbed28|Code Sourcery G++ Lite 2011.03-42 with mbed SDK revision 28]]\\
-
-==Quick Start
-These are the quick steps to get gcc4mbed installed on your computer:
-* Download the gcc4mbed compressed archive from [[https://github.com/adamgreen/gcc4mbed/zipball/master]]
-* Decompress and extract the contents of this archive.
-* Run the install script appropriate for your platform:
-** Windows: win_install.cmd
-** OS X: mac_install
-** Linux: linux_install
-* You can then run the BuildShell script which will be created during the install to properly configure the PATH environment variable. You may want to edit this script to further customize your development environment.
-
-===Important Notes:
-* Files will fail to install to a FAT based file system. Extract to a more appropriate file system (ie. NTFS on Windows) first and then copy to a FAT drive after installation.
-* If the installation should fail, please refer to win_install.log, linux_install.log, or mac_install.log. It will contain the details of the installation process and any errors that were encountered.
-* The OS X install only supports 64-bit Intel machines. The installers for the other platforms only install 32-bit Intel binaries.
-
-==More Information
-**[[https://github.com/adamgreen/mri/blob/master/README.creole#mri---monitor-for-remote-inspection|Debugging]]:** Learn how to use the GNU Debugger, GDB, with the new MRI debug monitor in GCC4MBED.\\
-\\
-**[[https://github.com/adamgreen/gcc4mbed/blob/master/notes/overview.creole#overview|Overview]]:** Overview and a bit of history related to this GCC4MBED project.\\
-\\
-**[[https://github.com/adamgreen/gcc4mbed/blob/master/notes/install.creole#installation|Installation]]:** For more information about how to install and use the GCC4MBED project.\\
-\\
-**[[https://github.com/adamgreen/gcc4mbed/blob/master/notes/makefile.creole#make-variables|Makefile Configuration]]:** Information about makefile options to customize your project's binary.\\
-\\
-**[[https://github.com/adamgreen/gcc4mbed/blob/master/notes/porting.creole#readme|Porting]]:** Notes on porting applications from mbed cloud compiler to offline GCC4MBED project.\\
-
-==Thanks
-The author wants to thank Arthur Wolf for the [[http://mbed.org/forum/mbed/topic/2336/|posting]] he made back in May which kicked off this whole gcc4mbed project and for all of the testing and feedback he has given since.
-
-Thanks to Felyza Wishbringer for writing the first Windows install script which provided the inspiration for the Windows, Mac, and Linux scripts that are now included in the gcc4mbed project.
-
-Thanks for all of the others who have provided valuable feedback since this project was first released. Much of that feedback can be found in this [[http://mbed.org/forum/mbed/topic/2701/|mbed forum thread]]
-
-==Have fun!!
+++ /dev/null
-/* Linker script for mbed LPC1768 */\r
-MEMORY\r
-{\r
-/* FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K */\r
- FLASH (rx) : ORIGIN = 16K, LENGTH = (512K - 16K)\r
- RAM (rwx) : ORIGIN = 0x100000C8, LENGTH = (32K - 0xC8)\r
-\r
- USB_RAM(rwx) : ORIGIN = 0x2007C000, LENGTH = 16K\r
- ETH_RAM(rwx) : ORIGIN = 0x20080000, LENGTH = 16K\r
-}\r
-\r
-/* Linker script to place sections and symbol values. Should be used together\r
- * with other linker script that defines memory regions FLASH and RAM.\r
- * It references following symbols, which must be defined in code:\r
- * Reset_Handler : Entry of reset handler\r
- * \r
- * It defines following symbols, which code can use without definition:\r
- * __exidx_start\r
- * __exidx_end\r
- * __etext\r
- * __data_start__\r
- * __preinit_array_start\r
- * __preinit_array_end\r
- * __init_array_start\r
- * __init_array_end\r
- * __fini_array_start\r
- * __fini_array_end\r
- * __data_end__\r
- * __bss_start__\r
- * __bss_end__\r
- * __end__\r
- * end\r
- * __HeapLimit\r
- * __StackLimit\r
- * __StackTop\r
- * __stack\r
- */\r
-ENTRY(Reset_Handler)\r
-\r
-SECTIONS\r
-{\r
- .text :\r
- {\r
- __cs3_region_start_rom = .;\r
- KEEP(*(.isr_vector))\r
- *(.text*)\r
-\r
- KEEP(*(.init))\r
- KEEP(*(.fini))\r
-\r
- /* .ctors */\r
- *crtbegin.o(.ctors)\r
- *crtbegin?.o(.ctors)\r
- *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)\r
- *(SORT(.ctors.*))\r
- *(.ctors)\r
-\r
- /* .dtors */\r
- *crtbegin.o(.dtors)\r
- *crtbegin?.o(.dtors)\r
- *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)\r
- *(SORT(.dtors.*))\r
- *(.dtors)\r
-\r
- *(.rodata*)\r
-\r
- KEEP(*(.eh_frame*))\r
- } > FLASH\r
-\r
- .ARM.extab : \r
- {\r
- *(.ARM.extab* .gnu.linkonce.armextab.*)\r
- } > FLASH\r
-\r
- __exidx_start = .;\r
- .ARM.exidx :\r
- {\r
- *(.ARM.exidx* .gnu.linkonce.armexidx.*)\r
- } > FLASH\r
- __exidx_end = .;\r
-\r
- __etext = .;\r
- \r
- .data : AT (__etext)\r
- {\r
- __cs3_region_start_ram = .;\r
- __data_start__ = .;\r
- Image$$RW_IRAM1$$Base = .;\r
- *(vtable)\r
- *(.data*)\r
-\r
- . = ALIGN(4);\r
- /* preinit data */\r
- PROVIDE (__preinit_array_start = .);\r
- KEEP(*(.preinit_array))\r
- PROVIDE (__preinit_array_end = .);\r
-\r
- . = ALIGN(4);\r
- /* init data */\r
- PROVIDE (__init_array_start = .);\r
- KEEP(*(SORT(.init_array.*)))\r
- KEEP(*(.init_array))\r
- PROVIDE (__init_array_end = .);\r
-\r
-\r
- . = ALIGN(4);\r
- /* finit data */\r
- PROVIDE (__fini_array_start = .);\r
- KEEP(*(SORT(.fini_array.*)))\r
- KEEP(*(.fini_array))\r
- PROVIDE (__fini_array_end = .);\r
-\r
- . = ALIGN(4);\r
- /* All data end */\r
- __data_end__ = .;\r
-\r
- } > RAM\r
-\r
- .bss :\r
- {\r
- __bss_start__ = .;\r
- *(.bss*)\r
- *(COMMON)\r
- __bss_end__ = .;\r
- Image$$RW_IRAM1$$ZI$$Limit = . ;\r
- } > RAM\r
- \r
- .heap :\r
- {\r
- __end__ = .;\r
- end = __end__;\r
- *(.heap*)\r
- __HeapLimit = .;\r
- } > RAM\r
-\r
- /* .stack_dummy section doesn't contains any symbols. It is only\r
- * used for linker to calculate size of stack sections, and assign\r
- * values to stack symbols later */\r
- .stack_dummy :\r
- {\r
- *(.stack)\r
- } > RAM\r
-\r
- /* Set stack top to end of RAM, and stack limit move down by\r
- * size of stack_dummy section */\r
- __StackTop = ORIGIN(RAM) + LENGTH(RAM);\r
- __StackLimit = __StackTop - SIZEOF(.stack_dummy);\r
- PROVIDE(__stack = __StackTop);\r
- \r
- /* Check if data + heap + stack exceeds RAM limit */\r
- ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")\r
-\r
-\r
- /* Code can explicitly ask for data to be \r
- placed in these higher RAM banks where\r
- they will be left uninitialized. \r
- */\r
- .AHBSRAM0 (NOLOAD):\r
- {\r
- Image$$RW_IRAM2$$Base = . ;\r
- *(AHBSRAM0)\r
- Image$$RW_IRAM2$$ZI$$Limit = .;\r
- } > USB_RAM\r
-\r
- .AHBSRAM1 (NOLOAD):\r
- {\r
- Image$$RW_IRAM3$$Base = . ;\r
- *(AHBSRAM1)\r
- Image$$RW_IRAM3$$ZI$$Limit = .;\r
- } > ETH_RAM\r
-}\r
+++ /dev/null
-/* mbed Microcontroller Library - AnalogIn
- * Copyright (c) 2006-2011 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_ANALOGIN_H
-#define MBED_ANALOGIN_H
-
-#include "device.h"
-
-#if DEVICE_ANALOGIN
-
-#include "platform.h"
-#include "PinNames.h"
-#include "PeripheralNames.h"
-#include "Base.h"
-
-namespace mbed {
-
-/* Class: AnalogIn
- * An analog input, used for reading the voltage on a pin
- *
- * Example:
- * > // Print messages when the AnalogIn is greater than 50%
- * >
- * > #include "mbed.h"
- * >
- * > AnalogIn temperature(p20);
- * >
- * > int main() {
- * > while(1) {
- * > if(temperature > 0.5) {
- * > printf("Too hot! (%f)", temperature.read());
- * > }
- * > }
- * > }
- */
-class AnalogIn : public Base {
-
-public:
-
- /* Constructor: AnalogIn
- * Create an AnalogIn, connected to the specified pin
- *
- * Variables:
- * pin - AnalogIn pin to connect to
- * name - (optional) A string to identify the object
- */
- AnalogIn(PinName pin, const char *name = NULL);
-
- /* Function: read
- * Read the input voltage, represented as a float in the range [0.0, 1.0]
- *
- * Variables:
- * returns - A floating-point value representing the current input voltage,
- * measured as a percentage
- */
- float read();
-
- /* Function: read_u16
- * Read the input voltage, represented as an unsigned short in the range [0x0, 0xFFFF]
- *
- * Variables:
- * returns - 16-bit unsigned short representing the current input voltage,
- * normalised to a 16-bit value
- */
- unsigned short read_u16();
-
-#ifdef MBED_OPERATORS
- /* Function: operator float
- * An operator shorthand for <read()>
- *
- * The float() operator can be used as a shorthand for <read()> to simplify common code sequences
- *
- * Example:
- * > float x = volume.read();
- * > float x = volume;
- * >
- * > if(volume.read() > 0.25) { ... }
- * > if(volume > 0.25) { ... }
- */
- operator float();
-#endif
-
-#ifdef MBED_RPC
- virtual const struct rpc_method *get_rpc_methods();
- static struct rpc_class *get_rpc_class();
-#endif
-
-protected:
-
- ADCName _adc;
-
-};
-
-} // namespace mbed
-
-#endif
-
-#endif
+++ /dev/null
-/* mbed Microcontroller Library - AnalogOut
- * Copyright (c) 2006-2011 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_ANALOGOUT_H
-#define MBED_ANALOGOUT_H
-
-#include "device.h"
-
-#if DEVICE_ANALOGOUT
-
-#include "platform.h"
-#include "PinNames.h"
-#include "PeripheralNames.h"
-#include "Base.h"
-
-namespace mbed {
-
-/* Class: AnalogOut
- * An analog output, used for setting the voltage on a pin
- *
- * Example:
- * > // Make a sawtooth output
- * >
- * > #include "mbed.h"
- * >
- * > AnalogOut tri(p18);
- * > int main() {
- * > while(1) {
- * > tri = tri + 0.01;
- * > wait_us(1);
- * > if(tri == 1) {
- * > tri = 0;
- * > }
- * > }
- * > }
- */
-class AnalogOut : public Base {
-
-public:
-
- /* Constructor: AnalogOut
- * Create an AnalogOut connected to the specified pin
- *
- * Variables:
- * pin - AnalogOut pin to connect to (18)
- */
- AnalogOut(PinName pin, const char *name = NULL);
-
- /* Function: write
- * Set the output voltage, specified as a percentage (float)
- *
- * Variables:
- * percent - A floating-point value representing the output voltage,
- * specified as a percentage. The value should lie between
- * 0.0f (representing 0v / 0%) and 1.0f (representing 3.3v / 100%).
- * Values outside this range will be saturated to 0.0f or 1.0f.
- */
- void write(float value);
-
- /* Function: write_u16
- * Set the output voltage, represented as an unsigned short in the range [0x0, 0xFFFF]
- *
- * Variables:
- * value - 16-bit unsigned short representing the output voltage,
- * normalised to a 16-bit value (0x0000 = 0v, 0xFFFF = 3.3v)
- */
- void write_u16(unsigned short value);
-
- /* Function: read
- * Return the current output voltage setting, measured as a percentage (float)
- *
- * Variables:
- * returns - A floating-point value representing the current voltage being output on the pin,
- * measured as a percentage. The returned value will lie between
- * 0.0f (representing 0v / 0%) and 1.0f (representing 3.3v / 100%).
- *
- * Note:
- * This value may not match exactly the value set by a previous <write>.
- */
- float read();
-
-
-#ifdef MBED_OPERATORS
- /* Function: operator=
- * An operator shorthand for <write()>
- */
- AnalogOut& operator= (float percent);
- AnalogOut& operator= (AnalogOut& rhs);
-
- /* Function: operator float()
- * An operator shorthand for <read()>
- */
- operator float();
-#endif
-
-#ifdef MBED_RPC
- virtual const struct rpc_method *get_rpc_methods();
- static struct rpc_class *get_rpc_class();
-#endif
-
-protected:
-
- DACName _dac;
-
-};
-
-} // namespace mbed
-
-#endif
-
-#endif
+++ /dev/null
-/* mbed Microcontroller Library - Base
- * Copyright (c) 2006-2008 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_BASE_H
-#define MBED_BASE_H
-
-#include "platform.h"
-#include "PinNames.h"
-#include "PeripheralNames.h"
-#include <cstdlib>
-#include "DirHandle.h"
-
-namespace mbed {
-
-#ifdef MBED_RPC
-struct rpc_function {
- const char *name;
- void (*caller)(const char*, char*);
-};
-
-struct rpc_class {
- const char *name;
- const rpc_function *static_functions;
- struct rpc_class *next;
-};
-#endif
-
-/* Class Base
- * The base class for most things
- */
-class Base {
-
-public:
-
- Base(const char *name = NULL);
-
- virtual ~Base();
-
- /* Function register_object
- * Registers this object with the given name, so that it can be
- * looked up with lookup. If this object has already been
- * registered, then this just changes the name.
- *
- * Variables
- * name - The name to give the object. If NULL we do nothing.
- */
- void register_object(const char *name);
-
- /* Function name
- * Returns the name of the object, or NULL if it has no name.
- */
- const char *name();
-
-#ifdef MBED_RPC
-
- /* Function rpc
- * Call the given method with the given arguments, and write the
- * result into the string pointed to by result. The default
- * implementation calls rpc_methods to determine the supported
- * methods.
- *
- * Variables
- * method - The name of the method to call.
- * arguments - A list of arguments separated by spaces.
- * result - A pointer to a string to write the result into. May
- * be NULL, in which case nothing is written.
- *
- * Returns
- * true if method corresponds to a valid rpc method, or
- * false otherwise.
- */
- virtual bool rpc(const char *method, const char *arguments, char *result);
-
- /* Function get_rpc_methods
- * Returns a pointer to an array describing the rpc methods
- * supported by this object, terminated by either
- * RPC_METHOD_END or RPC_METHOD_SUPER(Superclass).
- *
- * Example
- * > class Example : public Base {
- * > int foo(int a, int b) { return a + b; }
- * > virtual const struct rpc_method *get_rpc_methods() {
- * > static const rpc_method rpc_methods[] = {
- * > { "foo", generic_caller<int, Example, int, int, &Example::foo> },
- * > RPC_METHOD_SUPER(Base)
- * > };
- * > return rpc_methods;
- * > }
- * > };
- */
- virtual const struct rpc_method *get_rpc_methods();
-
- /* Function rpc
- * Use the lookup function to lookup an object and, if
- * successful, call its rpc method
- *
- * Variables
- * returns - false if name does not correspond to an object,
- * otherwise the return value of the call to the object's rpc
- * method.
- */
- static bool rpc(const char *name, const char *method, const char *arguments, char *result);
-
-#endif
-
- /* Function lookup
- * Lookup and return the object that has the given name.
- *
- * Variables
- * name - the name to lookup.
- * len - the length of name.
- */
- static Base *lookup(const char *name, unsigned int len);
-
- static DirHandle *opendir();
- friend class BaseDirHandle;
-
-protected:
-
- static Base *_head;
- Base *_next;
- const char *_name;
- bool _from_construct;
-
-private:
-
-#ifdef MBED_RPC
- static rpc_class *_classes;
-
- static const rpc_function _base_funcs[];
- static rpc_class _base_class;
-#endif
-
- void delete_self();
- static void list_objs(const char *arguments, char *result);
- static void clear(const char*,char*);
-
- static char *new_name(Base *p);
-
-public:
-
-#ifdef MBED_RPC
- /* Function add_rpc_class
- * Add the class to the list of classes which can have static
- * methods called via rpc (the static methods which can be called
- * are defined by that class' get_rpc_class() static method).
- */
- template<class C>
- static void add_rpc_class() {
- rpc_class *c = C::get_rpc_class();
- c->next = _classes;
- _classes = c;
- }
-
- template<class C>
- static const char *construct() {
- Base *p = new C();
- p->_from_construct = true;
- if(p->_name==NULL) {
- p->register_object(new_name(p));
- }
- return p->_name;
- }
-
- template<class C, typename A1>
- static const char *construct(A1 arg1) {
- Base *p = new C(arg1);
- p->_from_construct = true;
- if(p->_name==NULL) {
- p->register_object(new_name(p));
- }
- return p->_name;
- }
-
- template<class C, typename A1, typename A2>
- static const char *construct(A1 arg1, A2 arg2) {
- Base *p = new C(arg1,arg2);
- p->_from_construct = true;
- if(p->_name==NULL) {
- p->register_object(new_name(p));
- }
- return p->_name;
- }
-
- template<class C, typename A1, typename A2, typename A3>
- static const char *construct(A1 arg1, A2 arg2, A3 arg3) {
- Base *p = new C(arg1,arg2,arg3);
- p->_from_construct = true;
- if(p->_name==NULL) {
- p->register_object(new_name(p));
- }
- return p->_name;
- }
-
- template<class C, typename A1, typename A2, typename A3, typename A4>
- static const char *construct(A1 arg1, A2 arg2, A3 arg3, A4 arg4) {
- Base *p = new C(arg1,arg2,arg3,arg4);
- p->_from_construct = true;
- if(p->_name==NULL) {
- p->register_object(new_name(p));
- }
- return p->_name;
- }
-#endif
-
-};
-
-/* Macro MBED_OBJECT_NAME_MAX
- * The maximum size of object name (including terminating null byte)
- * that will be recognised when using fopen to open a FileLike
- * object, or when using the rpc function.
- */
-#define MBED_OBJECT_NAME_MAX 32
-
-/* Macro MBED_METHOD_NAME_MAX
- * The maximum size of rpc method name (including terminating null
- * byte) that will be recognised by the rpc function (in rpc.h).
- */
-#define MBED_METHOD_NAME_MAX 32
-
-} // namespace mbed
-
-#endif
-
+++ /dev/null
-/* mbed Microcontroller Library - DigitalIn
- * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_BUSIN_H
-#define MBED_BUSIN_H
-
-#include "platform.h"
-#include "PinNames.h"
-#include "PeripheralNames.h"
-#include "Base.h"
-#include "DigitalIn.h"
-
-namespace mbed {
-
-/* Class: BusIn
- * A digital input bus, used for reading the state of a collection of pins
- */
-class BusIn : public Base {
-
-public:
-
- /* Group: Configuration Methods */
-
- /* Constructor: BusIn
- * Create an BusIn, connected to the specified pins
- *
- * Variables:
- * p<n> - DigitalIn pin to connect to bus bit <n> (p5-p30, NC)
- *
- * Note:
- * It is only required to specify as many pin variables as is required
- * for the bus; the rest will default to NC (not connected)
- */
- BusIn(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC,
- PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC,
- PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC,
- PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC,
- const char *name = NULL);
-
- BusIn(PinName pins[16], const char *name = NULL);
-
- virtual ~BusIn();
-
- /* Group: Access Methods */
-
- /* Function: read
- * Read the value of the input bus
- *
- * Variables:
- * returns - An integer with each bit corresponding to the value read from the associated DigitalIn pin
- */
- int read();
-
-#ifdef MBED_OPERATORS
- /* Group: Access Method Shorthand */
-
- /* Function: operator int()
- * A shorthand for <read>
- */
- operator int();
-#endif
-
-#ifdef MBED_RPC
- virtual const struct rpc_method *get_rpc_methods();
- static struct rpc_class *get_rpc_class();
-#endif
-
-protected:
-
- DigitalIn* _pin[16];
-
-#ifdef MBED_RPC
- static void construct(const char *arguments, char *res);
-#endif
-
-};
-
-} // namespace mbed
-
-#endif
-
+++ /dev/null
-/* mbed Microcontroller Library - BusInOut
- * Copyright (c) 2009 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_BUSINOUT_H
-#define MBED_BUSINOUT_H
-
-#include "platform.h"
-#include "PinNames.h"
-#include "PeripheralNames.h"
-#include "Base.h"
-#include "DigitalInOut.h"
-
-namespace mbed {
-
-/* Class: BusInOut
- * A digital input output bus, used for setting the state of a collection of pins
- */
-class BusInOut : public Base {
-
-public:
-
- /* Group: Configuration Methods */
-
- /* Constructor: BusInOut
- * Create an BusInOut, connected to the specified pins
- *
- * Variables:
- * p<n> - DigitalInOut pin to connect to bus bit p<n> (p5-p30, NC)
- *
- * Note:
- * It is only required to specify as many pin variables as is required
- * for the bus; the rest will default to NC (not connected)
- */
- BusInOut(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC,
- PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC,
- PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC,
- PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC,
- const char *name = NULL);
-
- BusInOut(PinName pins[16], const char *name = NULL);
-
- virtual ~BusInOut();
-
- /* Group: Access Methods */
-
- /* Function: write
- * Write the value to the output bus
- *
- * Variables:
- * value - An integer specifying a bit to write for every corresponding DigitalInOut pin
- */
- void write(int value);
-
-
- /* Function: read
- * Read the value currently output on the bus
- *
- * Variables:
- * returns - An integer with each bit corresponding to associated DigitalInOut pin setting
- */
- int read();
-
- /* Function: output
- * Set as an output
- */
- void output();
-
- /* Function: input
- * Set as an input
- */
- void input();
-
- /* Function: mode
- * Set the input pin mode
- *
- * Variables:
- * mode - PullUp, PullDown, PullNone
- */
- void mode(PinMode pull);
-
-#ifdef MBED_OPERATORS
- /* Group: Access Method Shorthand */
-
- /* Function: operator=
- * A shorthand for <write>
- */
- BusInOut& operator= (int v);
- BusInOut& operator= (BusInOut& rhs);
-
- /* Function: operator int()
- * A shorthand for <read>
- */
- operator int();
-#endif
-
-#ifdef MBED_RPC
- virtual const struct rpc_method *get_rpc_methods();
- static struct rpc_class *get_rpc_class();
-#endif
-
-protected:
-
- DigitalInOut* _pin[16];
-
-#ifdef MBED_RPC
- static void construct(const char *arguments, char *res);
-#endif
-
-};
-
-} // namespace mbed
-
-#endif
-
+++ /dev/null
-/* mbed Microcontroller Library - BusOut
- * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_BUSOUT_H
-#define MBED_BUSOUT_H
-
-#include "platform.h"
-#include "PinNames.h"
-#include "PeripheralNames.h"
-#include "Base.h"
-#include "DigitalOut.h"
-
-namespace mbed {
-
-/* Class: BusOut
- * A digital output bus, used for setting the state of a collection of pins
- */
-class BusOut : public Base {
-
-public:
-
- /* Group: Configuration Methods */
-
- /* Constructor: BusOut
- * Create an BusOut, connected to the specified pins
- *
- * Variables:
- * p<n> - DigitalOut pin to connect to bus bit <n> (p5-p30, NC)
- *
- * Note:
- * It is only required to specify as many pin variables as is required
- * for the bus; the rest will default to NC (not connected)
- */
- BusOut(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC,
- PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC,
- PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC,
- PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC,
- const char *name = NULL);
-
- BusOut(PinName pins[16], const char *name = NULL);
-
- virtual ~BusOut();
-
- /* Group: Access Methods */
-
- /* Function: write
- * Write the value to the output bus
- *
- * Variables:
- * value - An integer specifying a bit to write for every corresponding DigitalOut pin
- */
- void write(int value);
-
-
- /* Function: read
- * Read the value currently output on the bus
- *
- * Variables:
- * returns - An integer with each bit corresponding to associated DigitalOut pin setting
- */
- int read();
-
-#ifdef MBED_OPERATORS
- /* Group: Access Method Shorthand */
-
- /* Function: operator=
- * A shorthand for <write>
- */
- BusOut& operator= (int v);
- BusOut& operator= (BusOut& rhs);
-
- /* Function: operator int()
- * A shorthand for <read>
- */
- operator int();
-#endif
-
-#ifdef MBED_RPC
- virtual const struct rpc_method *get_rpc_methods();
- static struct rpc_class *get_rpc_class();
-#endif
-
-protected:
-
- DigitalOut* _pin[16];
-
-#ifdef MBED_RPC
- static void construct(const char *arguments, char *res);
-#endif
-
-};
-
-} // namespace mbed
-
-#endif
-
+++ /dev/null
-/* mbed Microcontroller Library - can
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_CAN_H
-#define MBED_CAN_H
-
-#include "device.h"
-
-#if DEVICE_CAN
-
-#include "Base.h"
-#include "platform.h"
-#include "PinNames.h"
-#include "PeripheralNames.h"
-
-#include "can_helper.h"
-#include "FunctionPointer.h"
-
-#include <string.h>
-
-namespace mbed {
-
-/* Class: CANMessage
- *
- */
-class CANMessage : public CAN_Message {
-
-public:
-
- /* Constructor: CANMessage
- * Creates empty CAN message.
- */
- CANMessage() {
- len = 8;
- type = CANData;
- format = CANStandard;
- id = 0;
- memset(data, 0, 8);
- }
-
- /* Constructor: CANMessage
- * Creates CAN message with specific content.
- */
- CANMessage(int _id, const char *_data, char _len = 8, CANType _type = CANData, CANFormat _format = CANStandard) {
- len = _len & 0xF;
- type = _type;
- format = _format;
- id = _id;
- memcpy(data, _data, _len);
- }
-
- /* Constructor: CANMessage
- * Creates CAN remote message.
- */
- CANMessage(int _id, CANFormat _format = CANStandard) {
- len = 0;
- type = CANRemote;
- format = _format;
- id = _id;
- memset(data, 0, 8);
- }
-#if 0 // Inhereted from CAN_Message, for documentation only
-
- /* Variable: id
- * The message id.
- *
- * If format is CANStandard it must be an 11 bit long id
- * If format is CANExtended it must be an 29 bit long id
- */
- unsigned int id;
-
- /* Variable: data
- * Space for 8 byte payload.
- *
- * If type is CANData data can store up to 8 byte data.
- */
- unsigned char data[8];
-
- /* Variable: len
- * Length of data in bytes.
- *
- * If type is CANData data can store up to 8 byte data.
- */
- unsigned char len;
-
- /* Variable: format
- * Defines if the message has standard or extended format.
- *
- * Defines the type of message id:
- * Default is CANStandard which implies 11 bit id.
- * CANExtended means 29 bit message id.
- */
- CANFormat format;
-
- /* Variable: type
- * Defines the type of a message.
- *
- * The message type can rather be CANData for a message with data (default).
- * Or CANRemote for a request of a specific CAN message.
- */
- CANType type; // 0 - DATA FRAME, 1 - REMOTE FRAME
-#endif
-};
-
-/* Class: CAN
- * A can bus client, used for communicating with can devices
- */
-class CAN : public Base {
-
-public:
-
- /* Constructor: CAN
- * Creates an CAN interface connected to specific pins.
- *
- * Example:
- * > #include "mbed.h"
- * >
- * > Ticker ticker;
- * > DigitalOut led1(LED1);
- * > DigitalOut led2(LED2);
- * > CAN can1(p9, p10);
- * > CAN can2(p30, p29);
- * >
- * > char counter = 0;
- * >
- * > void send() {
- * > if(can1.write(CANMessage(1337, &counter, 1))) {
- * > printf("Message sent: %d\n", counter);
- * > counter++;
- * > }
- * > led1 = !led1;
- * > }
- * >
- * > int main() {
- * > ticker.attach(&send, 1);
- * > CANMessage msg;
- * > while(1) {
- * > if(can2.read(msg)) {
- * > printf("Message received: %d\n\n", msg.data[0]);
- * > led2 = !led2;
- * > }
- * > wait(0.2);
- * > }
- * > }
- *
- * Variables:
- * rd - read from transmitter
- * td - transmit to transmitter
- */
- CAN(PinName rd, PinName td);
- virtual ~CAN();
-
- /* Function: frequency
- * Set the frequency of the CAN interface
- *
- * Variables:
- * hz - The bus frequency in hertz
- * returns - 1 if successful, 0 otherwise
- */
- int frequency(int hz);
-
- /* Function: write
- * Write a CANMessage to the bus.
- *
- * Variables:
- * msg - The CANMessage to write.
- *
- * Returns:
- * 0 - If write failed.
- * 1 - If write was successful.
- */
- int write(CANMessage msg);
-
- /* Function: read
- * Read a CANMessage from the bus.
- *
- * Variables:
- * msg - A CANMessage to read to.
- *
- * Returns:
- * 0 - If no message arrived.
- * 1 - If message arrived.
- */
- int read(CANMessage &msg);
-
- /* Function: reset
- * Reset CAN interface.
- *
- * To use after error overflow.
- */
- void reset();
-
- /* Function: monitor
- * Puts or removes the CAN interface into silent monitoring mode
- *
- * Variables:
- * silent - boolean indicating whether to go into silent mode or not
- */
- void monitor(bool silent);
-
- /* Function: rderror
- * Returns number of read errors to detect read overflow errors.
- */
- unsigned char rderror();
-
- /* Function: tderror
- * Returns number of write errors to detect write overflow errors.
- */
- unsigned char tderror();
-
- /* Function: attach
- * Attach a function to call whenever a CAN frame received interrupt is
- * generated.
- *
- * Variables:
- * fptr - A pointer to a void function, or 0 to set as none
- */
- void attach(void (*fptr)(void));
-
- /* Function attach
- * Attach a member function to call whenever a CAN frame received interrupt
- * is generated.
- *
- * Variables:
- * tptr - pointer to the object to call the member function on
- * mptr - pointer to the member function to be called
- */
- template<typename T>
- void attach(T* tptr, void (T::*mptr)(void)) {
- if((mptr != NULL) && (tptr != NULL)) {
- _rxirq.attach(tptr, mptr);
- setup_interrupt();
- } else {
- remove_interrupt();
- }
- }
-
-private:
-
- CANName _id;
- FunctionPointer _rxirq;
-
- void setup_interrupt(void);
- void remove_interrupt(void);
-};
-
-} // namespace mbed
-
-#endif // MBED_CAN_H
-
-#endif
+++ /dev/null
-/* mbed Microcontroller Library - DigitalIn
- * Copyright (c) 2006-2011 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_DIGITALIN_H
-#define MBED_DIGITALIN_H
-
-#include "platform.h"
-#include "PinNames.h"
-#include "PeripheralNames.h"
-#include "Base.h"
-
-namespace mbed {
-
-/* Class: DigitalIn
- * A digital input, used for reading the state of a pin
- *
- * Example:
- * > // Flash an LED while a DigitalIn is true
- * >
- * > #include "mbed.h"
- * >
- * > DigitalIn enable(p5);
- * > DigitalOut led(LED1);
- * >
- * > int main() {
- * > while(1) {
- * > if(enable) {
- * > led = !led;
- * > }
- * > wait(0.25);
- * > }
- * > }
- */
-class DigitalIn : public Base {
-
-public:
-
- /* Constructor: DigitalIn
- * Create a DigitalIn connected to the specified pin
- *
- * Variables:
- * pin - DigitalIn pin to connect to
- * name - (optional) A string to identify the object
- */
- DigitalIn(PinName pin, const char *name = NULL);
-
- /* Function: read
- * Read the input, represented as 0 or 1 (int)
- *
- * Variables:
- * returns - An integer representing the state of the input pin,
- * 0 for logical 0 and 1 for logical 1
- */
- int read() {
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
- return ((_gpio->FIOPIN & _mask) ? 1 : 0);
-#elif defined(TARGET_LPC11U24)
- return ((LPC_GPIO->PIN[_index] & _mask) ? 1 : 0);
-#endif
- }
-
-
- /* Function: mode
- * Set the input pin mode
- *
- * Variables:
- * mode - PullUp, PullDown, PullNone, OpenDrain
- */
- void mode(PinMode pull);
-
-#ifdef MBED_OPERATORS
- /* Function: operator int()
- * An operator shorthand for <read()>
- */
- operator int() {
- return read();
- }
-
-#endif
-
-#ifdef MBED_RPC
- virtual const struct rpc_method *get_rpc_methods();
- static struct rpc_class *get_rpc_class();
-#endif
-
-protected:
-
- PinName _pin;
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
- LPC_GPIO_TypeDef *_gpio;
-#elif defined(TARGET_LPC11U24)
- int _index;
-#endif
- uint32_t _mask;
-
-};
-
-} // namespace mbed
-
-#endif
-
+++ /dev/null
-/* mbed Microcontroller Library - DigitalInOut\r
- * Copyright (c) 2006-2011 ARM Limited. All rights reserved.\r
- */ \r
- \r
-#ifndef MBED_DIGITALINOUT_H\r
-#define MBED_DIGITALINOUT_H\r
-\r
-#include "platform.h"\r
-#include "PinNames.h"\r
-#include "PeripheralNames.h"\r
-#include "Base.h"\r
-\r
-namespace mbed {\r
-\r
-/* Class: DigitalInOut\r
- * A digital input/output, used for setting or reading a bi-directional pin\r
- */\r
-class DigitalInOut : public Base {\r
-\r
-public:\r
-\r
- /* Constructor: DigitalInOut\r
- * Create a DigitalInOut connected to the specified pin\r
- *\r
- * Variables:\r
- * pin - DigitalInOut pin to connect to\r
- */\r
- DigitalInOut(PinName pin, const char* name = NULL);\r
-\r
- /* Function: write\r
- * Set the output, specified as 0 or 1 (int)\r
- *\r
- * Variables:\r
- * value - An integer specifying the pin output value, \r
- * 0 for logical 0 and 1 (or any other non-zero value) for logical 1 \r
- */\r
- void write(int value) {\r
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)\r
-\r
- if(value) {\r
- _gpio->FIOSET = _mask;\r
- } else {\r
- _gpio->FIOCLR = _mask;\r
- }\r
-\r
-#elif defined(TARGET_LPC11U24)\r
-\r
- if(value) {\r
- LPC_GPIO->SET[_index] = _mask;\r
- } else {\r
- LPC_GPIO->CLR[_index] = _mask;\r
- }\r
-#endif\r
- }\r
-\r
- /* Function: read\r
- * Return the output setting, represented as 0 or 1 (int)\r
- *\r
- * Variables:\r
- * returns - An integer representing the output setting of the pin if it is an output, \r
- * or read the input if set as an input\r
- */\r
- int read() {\r
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)\r
-\r
- return ((_gpio->FIOPIN & _mask) ? 1 : 0);\r
-#elif defined(TARGET_LPC11U24)\r
- return ((LPC_GPIO->PIN[_index] & _mask) ? 1 : 0);\r
-#endif\r
- }\r
-\r
-\r
- /* Function: output\r
- * Set as an output\r
- */\r
- void output();\r
-\r
- /* Function: input\r
- * Set as an input\r
- */\r
- void input();\r
-\r
- /* Function: mode\r
- * Set the input pin mode\r
- *\r
- * Variables:\r
- * mode - PullUp, PullDown, PullNone, OpenDrain\r
- */\r
- void mode(PinMode pull);\r
- \r
-#ifdef MBED_OPERATORS\r
- /* Function: operator=\r
- * A shorthand for <write>\r
- */\r
- DigitalInOut& operator= (int value) {\r
- write(value);\r
- return *this;\r
- }\r
-\r
- DigitalInOut& operator= (DigitalInOut& rhs) {\r
- write(rhs.read());\r
- return *this;\r
- }\r
-\r
- /* Function: operator int()\r
- * A shorthand for <read>\r
- */\r
- operator int() {\r
- return read();\r
- }\r
-#endif\r
-\r
-#ifdef MBED_RPC\r
- virtual const struct rpc_method *get_rpc_methods();\r
- static struct rpc_class *get_rpc_class();\r
-#endif\r
-\r
-protected:\r
-\r
- PinName _pin;\r
-\r
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)\r
- LPC_GPIO_TypeDef *_gpio;\r
-#elif defined(TARGET_LPC11U24)\r
- int _index;\r
-#endif\r
-\r
- uint32_t _mask;\r
-\r
-};\r
-\r
-} // namespace mbed \r
-\r
-#endif \r
+++ /dev/null
-/* mbed Microcontroller Library - DigitalOut
- * Copyright (c) 2006-2011 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_DIGITALOUT_H
-#define MBED_DIGITALOUT_H
-
-#include "platform.h"
-#include "PinNames.h"
-#include "PeripheralNames.h"
-#include "Base.h"
-
-namespace mbed {
-
-/* Class: DigitalOut
- * A digital output, used for setting the state of a pin
- *
- * Example:
- * > // Toggle a LED
- * > #include "mbed.h"
- * >
- * > DigitalOut led(LED1);
- * >
- * > int main() {
- * > while(1) {
- * > led = !led;
- * > wait(0.2);
- * > }
- * > }
- */
-class DigitalOut : public Base {
-
-public:
-
- /* Constructor: DigitalOut
- * Create a DigitalOut connected to the specified pin
- *
- * Variables:
- * pin - DigitalOut pin to connect to
- */
- DigitalOut(PinName pin, const char* name = NULL);
-
- /* Function: write
- * Set the output, specified as 0 or 1 (int)
- *
- * Variables:
- * value - An integer specifying the pin output value,
- * 0 for logical 0 and 1 (or any other non-zero value) for logical 1
- */
- void write(int value) {
-
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
-
- if(value) {
- _gpio->FIOSET = _mask;
- } else {
- _gpio->FIOCLR = _mask;
- }
-
-#elif defined(TARGET_LPC11U24)
-
- if(value) {
- LPC_GPIO->SET[_index] = _mask;
- } else {
- LPC_GPIO->CLR[_index] = _mask;
- }
-#endif
-
- }
-
- /* Function: read
- * Return the output setting, represented as 0 or 1 (int)
- *
- * Variables:
- * returns - An integer representing the output setting of the pin,
- * 0 for logical 0 and 1 for logical 1
- */
- int read() {
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
- return ((_gpio->FIOPIN & _mask) ? 1 : 0);
-#elif defined(TARGET_LPC11U24)
- return ((LPC_GPIO->PIN[_index] & _mask) ? 1 : 0);
-#endif
-
- }
-
-
-#ifdef MBED_OPERATORS
- /* Function: operator=
- * A shorthand for <write>
- */
- DigitalOut& operator= (int value) {
- write(value);
- return *this;
- }
-
- DigitalOut& operator= (DigitalOut& rhs) {
- write(rhs.read());
- return *this;
- }
-
-
- /* Function: operator int()
- * A shorthand for <read>
- */
- operator int() {
- return read();
- }
-
-#endif
-
-#ifdef MBED_RPC
- virtual const struct rpc_method *get_rpc_methods();
- static struct rpc_class *get_rpc_class();
-#endif
-
-protected:
-
- PinName _pin;
-
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
- LPC_GPIO_TypeDef *_gpio;
-#elif defined(TARGET_LPC11U24)
- int _index;
-#endif
-
- uint32_t _mask;
-
-
-};
-
-} // namespace mbed
-
-#endif
+++ /dev/null
-/* mbed Microcontroller Library - DirHandler
- * Copyright (c) 2008-2009 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_DIRHANDLE_H
-#define MBED_DIRHANDLE_H
-
-#ifdef __ARMCC_VERSION
-# define NAME_MAX 255
-typedef int mode_t;
-#else
-# include <sys/syslimits.h>
-#endif
-#include "FileHandle.h"
-
-struct dirent {
- char d_name[NAME_MAX+1];
-};
-
-namespace mbed {
-
-/* Class DirHandle
- * Represents a directory stream. Objects of this type are returned
- * by a FileSystemLike's opendir method. Implementations must define
- * at least closedir, readdir and rewinddir.
- *
- * If a FileSystemLike class defines the opendir method, then the
- * directories of an object of that type can be accessed by
- * DIR *d = opendir("/example/directory") (or opendir("/example")
- * to open the root of the filesystem), and then using readdir(d) etc.
- *
- * The root directory is considered to contain all FileLike and
- * FileSystemLike objects, so the DIR* returned by opendir("/") will
- * reflect this.
- */
-class DirHandle {
-
- public:
- /* Function closedir
- * Closes the directory.
- *
- * Variables
- * returns - 0 on success, or -1 on error.
- */
- virtual int closedir()=0;
-
- /* Function readdir
- * Return the directory entry at the current position, and
- * advances the position to the next entry.
- *
- * Returns
- * A pointer to a dirent structure representing the
- * directory entry at the current position, or NULL on reaching
- * end of directory or error.
- */
- virtual struct dirent *readdir()=0;
-
- /* Function rewinddir
- * Resets the position to the beginning of the directory.
- */
- virtual void rewinddir()=0;
-
- /* Function telldir
- * Returns the current position of the DirHandle.
- *
- * Returns
- * The current position, or -1 on error.
- */
- virtual off_t telldir() { return -1; }
-
- /* Function seekdir
- * Sets the position of the DirHandle.
- *
- * Variables
- * location - The location to seek to. Must be a value returned
- * by telldir.
- */
- virtual void seekdir(off_t location) { }
-
-};
-
-} // namespace mbed
-
-typedef mbed::DirHandle DIR;
-
-extern "C" {
- DIR *opendir(const char*);
- struct dirent *readdir(DIR *);
- int closedir(DIR*);
- void rewinddir(DIR*);
- long telldir(DIR*);
- void seekdir(DIR*, long);
-// int mkdir(const char *name, mode_t n);
-};
-
-#endif /* MBED_DIRHANDLE_H */
+++ /dev/null
-/* mbed Microcontroller Library - Ethernet\r
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.\r
- */ \r
- \r
-#ifndef MBED_ETHERNET_H\r
-#define MBED_ETHERNET_H\r
-\r
-#include "device.h"\r
-\r
-#if DEVICE_ETHERNET\r
-\r
-#include "Base.h"\r
-\r
-namespace mbed {\r
-\r
-/* Class: Ethernet\r
- * An ethernet interface, to use with the ethernet pins.\r
- *\r
- * Example:\r
- * > // Read destination and source from every ethernet packet\r
- * >\r
- * > #include "mbed.h"\r
- * >\r
- * > Ethernet eth;\r
- * > \r
- * > int main() {\r
- * > char buf[0x600];\r
- * > \r
- * > while(1) {\r
- * > int size = eth.receive();\r
- * > if(size > 0) {\r
- * > eth.read(buf, size);\r
- * > printf("Destination: %02X:%02X:%02X:%02X:%02X:%02X\n",\r
- * > buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);\r
- * > printf("Source: %02X:%02X:%02X:%02X:%02X:%02X\n",\r
- * > buf[6], buf[7], buf[8], buf[9], buf[10], buf[11]);\r
- * > }\r
- * > \r
- * > wait(1);\r
- * > }\r
- * > }\r
- *\r
- */\r
-class Ethernet : public Base {\r
-\r
-public:\r
- \r
- /* Constructor: Ethernet\r
- * Initialise the ethernet interface.\r
- */\r
- Ethernet();\r
-\r
- /* Destructor: Ethernet\r
- * Powers the hardware down.\r
- */\r
- virtual ~Ethernet();\r
-\r
- enum Mode {\r
- AutoNegotiate\r
- , HalfDuplex10\r
- , FullDuplex10\r
- , HalfDuplex100\r
- , FullDuplex100\r
- };\r
-\r
- /* Function: write\r
- * Writes into an outgoing ethernet packet.\r
- *\r
- * It will append size bytes of data to the previously written bytes.\r
- * \r
- * Variables:\r
- * data - An array to write.\r
- * size - The size of data.\r
- *\r
- * Returns:\r
- * The number of written bytes.\r
- */\r
- int write(const char *data, int size);\r
-\r
- /* Function: send\r
- * Send an outgoing ethernet packet.\r
- *\r
- * After filling in the data in an ethernet packet it must be send.\r
- * Send will provide a new packet to write to.\r
- *\r
- * Returns:\r
- * 0 - If the sending was failed.\r
- * 1 - If the package is successfully sent.\r
- */\r
- int send();\r
-\r
- /* Function: receive\r
- * Recevies an arrived ethernet packet.\r
- *\r
- * Receiving an ethernet packet will drop the last received ethernet packet \r
- * and make a new ethernet packet ready to read.\r
- * If no ethernet packet is arrived it will return 0.\r
- *\r
- * Returns:\r
- * 0 - If no ethernet packet is arrived.\r
- * The size of the arrived packet.\r
- */\r
- int receive();\r
-\r
- /* Function: read\r
- * Read from an recevied ethernet packet.\r
- *\r
- * After receive returnd a number bigger than 0it is\r
- * possible to read bytes from this packet.\r
- * Read will write up to size bytes into data.\r
- *\r
- * It is possible to use read multible times. \r
- * Each time read will start reading after the last read byte before.\r
- *\r
- * Returns:\r
- * The number of byte read.\r
- */\r
- int read(char *data, int size);\r
- \r
- /* Function: address\r
- * Gives the ethernet address of the mbed.\r
- *\r
- * Variables:\r
- * mac - Must be a pointer to a 6 byte char array to copy the ethernet address in.\r
- */\r
- void address(char *mac);\r
-\r
- /* Function: link\r
- * Returns if an ethernet link is pressent or not. It takes a wile after Ethernet initializion to show up.\r
- * \r
- * Returns:\r
- * 0 - If no ethernet link is pressent.\r
- * 1 - If an ethernet link is pressent.\r
- *\r
- * Example:\r
- * > // Using the Ethernet link function\r
- * > #include "mbed.h"\r
- * >\r
- * > Ethernet eth;\r
- * >\r
- * > int main() {\r
- * > wait(1); // Needed after startup.\r
- * > if(eth.link()) {\r
- * > printf("online\n");\r
- * > } else {\r
- * > printf("offline\n");\r
- * > }\r
- * > }\r
- *\r
- */\r
- int link();\r
-\r
- /* Function: set_link\r
- * Sets the speed and duplex parameters of an ethernet link\r
- *\r
- * Variables:\r
- * mode - the speed and duplex mode to set the link to:\r
- *\r
- * > AutoNegotiate Auto negotiate speed and duplex\r
- * > HalfDuplex10 10 Mbit, half duplex\r
- * > FullDuplex10 10 Mbit, full duplex\r
- * > HalfDuplex100 100 Mbit, half duplex\r
- * > FullDuplex100 100 Mbit, full duplex\r
- */\r
- void set_link(Mode mode);\r
-\r
-};\r
-\r
-} // namespace mbed\r
-\r
-#endif\r
-\r
-#endif\r
+++ /dev/null
-/* mbed Microcontroller Library - FileHandler
- * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_FILEHANDLE_H
-#define MBED_FILEHANDLE_H
-
-typedef int FILEHANDLE;
-
-#include <stdio.h>
-#ifdef __ARMCC_VERSION
-typedef int ssize_t;
-typedef long off_t;
-#else
-#include <sys/types.h>
-#endif
-
-namespace mbed {
-
-/* Class FileHandle
- * An OO equivalent of the internal FILEHANDLE variable
- * and associated _sys_* functions
- *
- * FileHandle is an abstract class, needing at least sys_write and
- * sys_read to be implmented for a simple interactive device
- *
- * No one ever directly tals to/instanciates a FileHandle - it gets
- * created by FileSystem, and wrapped up by stdio
- */
-class FileHandle {
-
-public:
-
- /* Function write
- * Write the contents of a buffer to the file
- *
- * Parameters
- * buffer - the buffer to write from
- * length - the number of characters to write
- *
- * Returns
- * The number of characters written (possibly 0) on success, -1 on error.
- */
- virtual ssize_t write(const void* buffer, size_t length) = 0;
-
- /* Function close
- * Close the file
- *
- * Returns
- * Zero on success, -1 on error.
- */
- virtual int close() = 0;
-
- /* Function read
- * Reads the contents of the file into a buffer
- *
- * Parameters
- * buffer - the buffer to read in to
- * length - the number of characters to read
- *
- * Returns
- * The number of characters read (zero at end of file) on success, -1 on error.
- */
- virtual ssize_t read(void* buffer, size_t length) = 0;
-
- /* Function isatty
- * Check if the handle is for a interactive terminal device
- *
- * If so, line buffered behaviour is used by default
- *
- * Returns
- * 1 if it is a terminal, 0 otherwise
- */
- virtual int isatty() = 0 ;
-
- /* Function lseek
- * Move the file position to a given offset from a given location.
- *
- * Parameters
- * offset - The offset from whence to move to
- * whence - SEEK_SET for the start of the file, SEEK_CUR for the
- * current file position, or SEEK_END for the end of the file.
- *
- * Returns
- * New file position on success, -1 on failure or unsupported
- */
- virtual off_t lseek(off_t offset, int whence) = 0;
-
- /* Function fsync
- * Flush any buffers associated with the FileHandle, ensuring it
- * is up to date on disk
- *
- * Returns
- * 0 on success or un-needed, -1 on error
- */
- virtual int fsync() = 0;
-
- virtual off_t flen() {
- /* remember our current position */
- off_t pos = lseek(0, SEEK_CUR);
- if(pos == -1) return -1;
- /* seek to the end to get the file length */
- off_t res = lseek(0, SEEK_END);
- /* return to our old position */
- lseek(pos, SEEK_SET);
- return res;
- }
-
-};
-
-} // namespace mbed
-
-#endif
-
+++ /dev/null
-/* mbed Microcontroller Library - FileLike\r
- * Copyright (c) 2008-2009 ARM Limited. All rights reserved.\r
- */ \r
- \r
-#ifndef MBED_FILELIKE_H\r
-#define MBED_FILELIKE_H\r
-\r
-#include "Base.h"\r
-#include "FileHandle.h"\r
-\r
-namespace mbed {\r
-\r
-/* Class FileLike\r
- * A file-like object is one that can be opened with fopen by\r
- * fopen("/name", mode). It is intersection of the classes Base and\r
- * FileHandle.\r
- */ \r
-class FileLike : public Base, public FileHandle {\r
- \r
- public:\r
- /* Constructor FileLike\r
- *\r
- * Variables\r
- * name - The name to use to open the file.\r
- */\r
- FileLike(const char *name) : Base(name) { }\r
- virtual ~FileLike();\r
-\r
-};\r
-\r
-} // namespace mbed\r
-\r
-#endif\r
+++ /dev/null
-/* mbed Microcontroller Library - FileSystemLike\r
- * Copyright (c) 2008-2009 ARM Limited. All rights reserved.\r
- */ \r
- \r
-#ifndef MBED_FILESYSTEMLIKE_H\r
-#define MBED_FILESYSTEMLIKE_H\r
-\r
-#ifdef __ARMCC_VERSION\r
-# define O_RDONLY 0\r
-# define O_WRONLY 1\r
-# define O_RDWR 2\r
-# define O_CREAT 0x0200\r
-# define O_TRUNC 0x0400\r
-# define O_APPEND 0x0008\r
-typedef int mode_t;\r
-#else\r
-# include <sys/fcntl.h>\r
-#endif\r
-#include "Base.h"\r
-#include "FileHandle.h"\r
-#include "DirHandle.h"\r
-\r
-namespace mbed {\r
-\r
-/* Class FileSystemLike\r
- * A filesystem-like object is one that can be used to open files\r
- * though it by fopen("/name/filename", mode)\r
- *\r
- * Implementations must define at least open (the default definitions\r
- * of the rest of the functions just return error values).\r
- */\r
-class FileSystemLike : public Base {\r
-\r
- public:\r
-\r
- /* Constructor FileSystemLike\r
- *\r
- * Variables\r
- * name - The name to use for the filesystem.\r
- */\r
- FileSystemLike(const char *name) : Base(name) {}\r
-\r
- /* Function open\r
- *\r
- * Variables\r
- * filename - The name of the file to open.\r
- * flags - One of O_RDONLY, O_WRONLY, or O_RDWR, OR'd with\r
- * zero or more of O_CREAT, O_TRUNC, or O_APPEND.\r
- * returns - A pointer to a FileHandle object representing the\r
- * file on success, or NULL on failure.\r
- */\r
- virtual FileHandle *open(const char *filename, int flags) = 0;\r
-\r
- /* Function remove\r
- * Remove a file from the filesystem.\r
- *\r
- * Variables\r
- * filename - the name of the file to remove.\r
- * returns - 0 on success, -1 on failure.\r
- */\r
- virtual int remove(const char *filename) { return -1; };\r
-\r
- /* Function rename\r
- * Rename a file in the filesystem.\r
- *\r
- * Variables\r
- * oldname - the name of the file to rename.\r
- * newname - the name to rename it to.\r
- * returns - 0 on success, -1 on failure.\r
- */\r
- virtual int rename(const char *oldname, const char *newname) { return -1; };\r
-\r
- /* Function opendir\r
- * Opens a directory in the filesystem and returns a DirHandle\r
- * representing the directory stream.\r
- *\r
- * Variables\r
- * name - The name of the directory to open.\r
- * returns - A DirHandle representing the directory stream, or\r
- * NULL on failure.\r
- */\r
- virtual DirHandle *opendir(const char *name) { return NULL; };\r
-\r
- /* Function mkdir\r
- * Creates a directory in the filesystem.\r
- *\r
- * Variables\r
- * name - The name of the directory to create.\r
- * mode - The permissions to create the directory with.\r
- * returns - 0 on success, -1 on failure.\r
- */\r
- virtual int mkdir(const char *name, mode_t mode) { return -1; }\r
-\r
- // TODO other filesystem functions (mkdir, rm, rn, ls etc)\r
- \r
-};\r
-\r
-} // namespace mbed\r
-\r
-#endif\r
+++ /dev/null
-/* mbed Microcontroller Library - FunctionPointer
- * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_FUNCTIONPOINTER_H
-#define MBED_FUNCTIONPOINTER_H
-
-#include <string.h>
-
-namespace mbed {
-
-/* Class FunctionPointer
- * A class for storing and calling a pointer to a static or member void function
- */
-class FunctionPointer {
-
-public:
-
- /* Constructor FunctionPointer
- * Create a FunctionPointer, attaching a static function
- *
- * Variables
- * function - The void static function to attach (default is none)
- */
- FunctionPointer(void (*function)(void) = 0);
-
- /* Constructor FunctionPointer
- * Create a FunctionPointer, attaching a member function
- *
- * Variables
- * object - The object pointer to invoke the member function on (i.e. the this pointer)
- * function - The address of the void member function to attach
- */
- template<typename T>
- FunctionPointer(T *object, void (T::*member)(void)) {
- attach(object, member);
- }
-
- /* Function attach
- * Attach a static function
- *
- * Variables
- * function - The void static function to attach (default is none)
- */
- void attach(void (*function)(void) = 0);
-
- /* Function attach
- * Attach a member function
- *
- * Variables
- * object - The object pointer to invoke the member function on (i.e. the this pointer)
- * function - The address of the void member function to attach
- */
- template<typename T>
- void attach(T *object, void (T::*member)(void)) {
- _object = static_cast<void*>(object);
- memcpy(_member, (char*)&member, sizeof(member));
- _membercaller = &FunctionPointer::membercaller<T>;
- _function = 0;
- }
-
- /* Function call
- * Call the attached static or member function
- */
- void call();
-
-private:
-
- template<typename T>
- static void membercaller(void *object, char *member) {
- T* o = static_cast<T*>(object);
- void (T::*m)(void);
- memcpy((char*)&m, member, sizeof(m));
- (o->*m)();
- }
-
- void (*_function)(void); // static function pointer - 0 if none attached
- void *_object; // object this pointer - 0 if none attached
- char _member[16]; // raw member function pointer storage - converted back by registered _membercaller
- void (*_membercaller)(void*, char*); // registered membercaller function to convert back and call _member on _object
-
-};
-
-} // namespace mbed
-
-#endif
+++ /dev/null
-/* mbed Microcontroller Library - I2C
- * Copyright (c) 2007-2011 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_I2C_H
-#define MBED_I2C_H
-
-#include "device.h"
-
-#if DEVICE_I2C
-
-#include "platform.h"
-#include "PinNames.h"
-#include "PeripheralNames.h"
-#include "Base.h"
-
-namespace mbed {
-
-/* Class: I2C
- * An I2C Master, used for communicating with I2C slave devices
- *
- * Example:
- * > // Read from I2C slave at address 0x62
- * >
- * > #include "mbed.h"
- * >
- * > I2C i2c(p28, p27);
- * >
- * > int main() {
- * > int address = 0x62;
- * > char data[2];
- * > i2c.read(address, data, 2);
- * > }
- */
-class I2C : public Base {
-
-public:
-
- enum RxStatus {
- NoData
- , MasterGeneralCall
- , MasterWrite
- , MasterRead
- };
-
- enum Acknowledge {
- NoACK = 0
- , ACK = 1
- };
-
- /* Constructor: I2C
- * Create an I2C Master interface, connected to the specified pins
- *
- * Variables:
- * sda - I2C data line pin
- * scl - I2C clock line pin
- */
- I2C(PinName sda, PinName scl, const char *name = NULL);
-
- /* Function: frequency
- * Set the frequency of the I2C interface
- *
- * Variables:
- * hz - The bus frequency in hertz
- */
- void frequency(int hz);
-
- /* Function: read
- * Read from an I2C slave
- *
- * Performs a complete read transaction. The bottom bit of
- * the address is forced to 1 to indicate a read.
- *
- * Variables:
- * address - 8-bit I2C slave address [ addr | 1 ]
- * data - Pointer to the byte-array to read data in to
- * length - Number of bytes to read
- * repeated - Repeated start, true - don't send stop at end
- * returns - 0 on success (ack), or non-0 on failure (nack)
- */
- int read(int address, char *data, int length, bool repeated = false);
-
- /* Function: read
- * Read a single byte from the I2C bus
- *
- * Variables:
- * ack - indicates if the byte is to be acknowledged (1 = acknowledge)
- * returns - the byte read
- */
- int read(int ack);
-
- /* Function: write
- * Write to an I2C slave
- *
- * Performs a complete write transaction. The bottom bit of
- * the address is forced to 0 to indicate a write.
- *
- * Variables:
- * address - 8-bit I2C slave address [ addr | 0 ]
- * data - Pointer to the byte-array data to send
- * length - Number of bytes to send
- * repeated - Repeated start, true - do not send stop at end
- * returns - 0 on success (ack), or non-0 on failure (nack)
- */
- int write(int address, const char *data, int length, bool repeated = false);
-
- /* Function: write
- * Write single byte out on the I2C bus
- *
- * Variables:
- * data - data to write out on bus
- * returns - a '1' if an ACK was received, a '0' otherwise
- */
- int write(int data);
-
- /* Function: start
- * Creates a start condition on the I2C bus
- */
-
- void start(void);
-
- /* Function: stop
- * Creates a stop condition on the I2C bus
- */
- void stop(void);
-
-protected:
-
- void aquire();
-
- I2CName _i2c;
- static I2C *_owner;
- int _hz;
-
-};
-
-} // namespace mbed
-
-#endif
-
-#endif
-
+++ /dev/null
-/* mbed Microcontroller Library - I2CSlave
- * Copyright (c) 2007-2011 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_I2C_SLAVE_H
-#define MBED_I2C_SLAVE_H
-
-#include "device.h"
-
-#if DEVICE_I2CSLAVE
-
-#include "platform.h"
-#include "PinNames.h"
-#include "PeripheralNames.h"
-#include "Base.h"
-
-namespace mbed {
-
-/* Class: I2CSlave
- * An I2C Slave, used for communicating with an I2C Master device
- *
- * Example:
- * > // Simple I2C responder
- * > #include <mbed.h>
- * >
- * > I2CSlave slave(p9, p10);
- * >
- * > int main() {
- * > char buf[10];
- * > char msg[] = "Slave!";
- * >
- * > slave.address(0xA0);
- * > while (1) {
- * > int i = slave.receive();
- * > switch (i) {
- * > case I2CSlave::ReadAddressed:
- * > slave.write(msg, strlen(msg) + 1); // Includes null char
- * > break;
- * > case I2CSlave::WriteGeneral:
- * > slave.read(buf, 10);
- * > printf("Read G: %s\n", buf);
- * > break;
- * > case I2CSlave::WriteAddressed:
- * > slave.read(buf, 10);
- * > printf("Read A: %s\n", buf);
- * > break;
- * > }
- * > for(int i = 0; i < 10; i++) buf[i] = 0; // Clear buffer
- * > }
- * > }
- * >
- */
-class I2CSlave : public Base {
-
-public:
-
- enum RxStatus {
- NoData = 0
- , ReadAddressed = 1
- , WriteGeneral = 2
- , WriteAddressed = 3
- };
-
- /* Constructor: I2CSlave
- * Create an I2C Slave interface, connected to the specified pins.
- *
- * Variables:
- * sda - I2C data line pin
- * scl - I2C clock line pin
- */
- I2CSlave(PinName sda, PinName scl, const char *name = NULL);
-
- /* Function: frequency
- * Set the frequency of the I2C interface
- *
- * Variables:
- * hz - The bus frequency in hertz
- */
- void frequency(int hz);
-
- /* Function: receive
- * Checks to see if this I2C Slave has been addressed.
- *
- * Variables:
- * returns - a status indicating if the device has been addressed, and how
- * > NoData - the slave has not been addressed
- * > ReadAddressed - the master has requested a read from this slave
- * > WriteAddressed - the master is writing to this slave
- * > WriteGeneral - the master is writing to all slave
- */
- int receive(void);
-
- /* Function: read
- * Read from an I2C master.
- *
- * Variables:
- * data - pointer to the byte array to read data in to
- * length - maximum number of bytes to read
- * returns - 0 on success, non-0 otherwise
- */
- int read(char *data, int length);
-
- /* Function: read
- * Read a single byte from an I2C master.
- *
- * Variables:
- * returns - the byte read
- */
- int read(void);
-
- /* Function: write
- * Write to an I2C master.
- *
- * Variables:
- * data - pointer to the byte array to be transmitted
- * length - the number of bytes to transmite
- * returns - a 0 on success, non-0 otherwise
- */
- int write(const char *data, int length);
-
- /* Function: write
- * Write a single byte to an I2C master.
- *
- * Variables
- * data - the byte to write
- * returns - a '1' if an ACK was received, a '0' otherwise
- */
- int write(int data);
-
- /* Function: address
- * Sets the I2C slave address.
- *
- * Variables
- * address - the address to set for the slave (ignoring the least
- * signifcant bit). If set to 0, the slave will only respond to the
- * general call address.
- */
- void address(int address);
-
- /* Function: stop
- * Reset the I2C slave back into the known ready receiving state.
- */
- void stop(void);
-
-protected:
-
- I2CName _i2c;
-};
-
-} // namespace mbed
-
-#endif
-
-#endif
-
+++ /dev/null
-/* mbed Microcontroller Library - InterruptIn
- * Copyright (c) 2006-2011 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_INTERRUPTIN_H
-#define MBED_INTERRUPTIN_H
-
-#include "device.h"
-
-#if DEVICE_INTERRUPTIN
-
-#include "platform.h"
-#include "PinNames.h"
-#include "PeripheralNames.h"
-#include "Base.h"
-#include "FunctionPointer.h"
-
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
-#define CHANNEL_NUM 48
-#elif defined(TARGET_LPC11U24)
-#define CHANNEL_NUM 8
-#endif
-
-namespace mbed {
-
-/* Class: InterruptIn
- * A digital interrupt input, used to call a function on a rising or falling edge
- *
- * Example:
- * > // Flash an LED while waiting for events
- * >
- * > #include "mbed.h"
- * >
- * > InterruptIn event(p16);
- * > DigitalOut led(LED1);
- * >
- * > void trigger() {
- * > printf("triggered!\n");
- * > }
- * >
- * > int main() {
- * > event.rise(&trigger);
- * > while(1) {
- * > led = !led;
- * > wait(0.25);
- * > }
- * > }
- */
-class InterruptIn : public Base {
-
-public:
-
- /* Constructor: InterruptIn
- * Create an InterruptIn connected to the specified pin
- *
- * Variables:
- * pin - InterruptIn pin to connect to
- * name - (optional) A string to identify the object
- */
- InterruptIn(PinName pin, const char *name = NULL);
-#if defined(TARGET_LPC11U24)
- virtual ~InterruptIn();
-#endif
-
- int read();
-#ifdef MBED_OPERATORS
- operator int();
-
-#endif
-
- /* Function: rise
- * Attach a function to call when a rising edge occurs on the input
- *
- * Variables:
- * fptr - A pointer to a void function, or 0 to set as none
- */
- void rise(void (*fptr)(void));
-
- /* Function: rise
- * Attach a member function to call when a rising edge occurs on the input
- *
- * Variables:
- * tptr - pointer to the object to call the member function on
- * mptr - pointer to the member function to be called
- */
- template<typename T>
- void rise(T* tptr, void (T::*mptr)(void)) {
- _rise.attach(tptr, mptr);
- setup_interrupt(1, 1);
- }
-
- /* Function: fall
- * Attach a function to call when a falling edge occurs on the input
- *
- * Variables:
- * fptr - A pointer to a void function, or 0 to set as none
- */
- void fall(void (*fptr)(void));
-
- /* Function: fall
- * Attach a member function to call when a falling edge occurs on the input
- *
- * Variables:
- * tptr - pointer to the object to call the member function on
- * mptr - pointer to the member function to be called
- */
- template<typename T>
- void fall(T* tptr, void (T::*mptr)(void)) {
- _fall.attach(tptr, mptr);
- setup_interrupt(0, 1);
- }
-
- /* Function: mode
- * Set the input pin mode
- *
- * Variables:
- * mode - PullUp, PullDown, PullNone
- */
- void mode(PinMode pull);
-
- static InterruptIn *_irq_objects[CHANNEL_NUM];
-
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
- static void _irq();
-#elif defined(TARGET_LPC11U24)
- static void handle_interrupt_in(unsigned int channel);
- static void _irq0(); static void _irq1();
- static void _irq2(); static void _irq3();
- static void _irq4(); static void _irq5();
- static void _irq6(); static void _irq7();
-#endif
-
-protected:
- PinName _pin;
-#if defined(TARGET_LPC11U24)
- Channel _channel;
-#endif
- FunctionPointer _rise;
- FunctionPointer _fall;
-
- void setup_interrupt(int rising, int enable);
-
-};
-
-} // namespace mbed
-
-#endif
-
-#endif
+++ /dev/null
-/* Linker script for mbed LPC1768 */\r
-GROUP(-lstdc++ -lsupc++ -lm -lc -lnosys -lgcc)\r
-\r
-/* Linker script to configure memory regions. */\r
-MEMORY\r
-{\r
- FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K\r
- RAM (rwx) : ORIGIN = 0x100000C8, LENGTH = 0x7F38\r
-\r
- USB_RAM(rwx) : ORIGIN = 0x2007C000, LENGTH = 16K\r
- ETH_RAM(rwx) : ORIGIN = 0x20080000, LENGTH = 16K\r
-}\r
-\r
-/* Linker script to place sections and symbol values. Should be used together\r
- * with other linker script that defines memory regions FLASH and RAM.\r
- * It references following symbols, which must be defined in code:\r
- * Reset_Handler : Entry of reset handler\r
- * \r
- * It defines following symbols, which code can use without definition:\r
- * __exidx_start\r
- * __exidx_end\r
- * __etext\r
- * __data_start__\r
- * __preinit_array_start\r
- * __preinit_array_end\r
- * __init_array_start\r
- * __init_array_end\r
- * __fini_array_start\r
- * __fini_array_end\r
- * __data_end__\r
- * __bss_start__\r
- * __bss_end__\r
- * __end__\r
- * end\r
- * __HeapLimit\r
- * __StackLimit\r
- * __StackTop\r
- * __stack\r
- */\r
-ENTRY(Reset_Handler)\r
-\r
-SECTIONS\r
-{\r
- .text :\r
- {\r
- KEEP(*(.isr_vector))\r
- *(.text*)\r
-\r
- KEEP(*(.init))\r
- KEEP(*(.fini))\r
-\r
- /* .ctors */\r
- *crtbegin.o(.ctors)\r
- *crtbegin?.o(.ctors)\r
- *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)\r
- *(SORT(.ctors.*))\r
- *(.ctors)\r
-\r
- /* .dtors */\r
- *crtbegin.o(.dtors)\r
- *crtbegin?.o(.dtors)\r
- *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)\r
- *(SORT(.dtors.*))\r
- *(.dtors)\r
-\r
- *(.rodata*)\r
-\r
- KEEP(*(.eh_frame*))\r
- } > FLASH\r
-\r
- .ARM.extab : \r
- {\r
- *(.ARM.extab* .gnu.linkonce.armextab.*)\r
- } > FLASH\r
-\r
- __exidx_start = .;\r
- .ARM.exidx :\r
- {\r
- *(.ARM.exidx* .gnu.linkonce.armexidx.*)\r
- } > FLASH\r
- __exidx_end = .;\r
-\r
- __etext = .;\r
- \r
- .data : AT (__etext)\r
- {\r
- __data_start__ = .;\r
- *(vtable)\r
- *(.data*)\r
-\r
- . = ALIGN(4);\r
- /* preinit data */\r
- PROVIDE (__preinit_array_start = .);\r
- KEEP(*(.preinit_array))\r
- PROVIDE (__preinit_array_end = .);\r
-\r
- . = ALIGN(4);\r
- /* init data */\r
- PROVIDE (__init_array_start = .);\r
- KEEP(*(SORT(.init_array.*)))\r
- KEEP(*(.init_array))\r
- PROVIDE (__init_array_end = .);\r
-\r
-\r
- . = ALIGN(4);\r
- /* finit data */\r
- PROVIDE (__fini_array_start = .);\r
- KEEP(*(SORT(.fini_array.*)))\r
- KEEP(*(.fini_array))\r
- PROVIDE (__fini_array_end = .);\r
-\r
- . = ALIGN(4);\r
- /* All data end */\r
- __data_end__ = .;\r
-\r
- } > RAM\r
-\r
- .bss :\r
- {\r
- __bss_start__ = .;\r
- *(.bss*)\r
- *(COMMON)\r
- __bss_end__ = .;\r
- } > RAM\r
- \r
- .heap :\r
- {\r
- __end__ = .;\r
- end = __end__;\r
- *(.heap*)\r
- __HeapLimit = .;\r
- } > RAM\r
-\r
- /* .stack_dummy section doesn't contains any symbols. It is only\r
- * used for linker to calculate size of stack sections, and assign\r
- * values to stack symbols later */\r
- .stack_dummy :\r
- {\r
- *(.stack)\r
- } > RAM\r
-\r
- /* Set stack top to end of RAM, and stack limit move down by\r
- * size of stack_dummy section */\r
- __StackTop = ORIGIN(RAM) + LENGTH(RAM);\r
- __StackLimit = __StackTop - SIZEOF(.stack_dummy);\r
- PROVIDE(__stack = __StackTop);\r
- \r
- /* Check if data + heap + stack exceeds RAM limit */\r
- ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")\r
-}\r
+++ /dev/null
-/**************************************************************************//**\r
- * @file LPC17xx.h\r
- * @brief CMSIS Cortex-M3 Core Peripheral Access Layer Header File for \r
- * NXP LPC17xx Device Series\r
- * @version: V1.09\r
- * @date: 17. March 2010\r
-\r
- *\r
- * @note\r
- * Copyright (C) 2009 ARM Limited. All rights reserved.\r
- *\r
- * @par\r
- * ARM Limited (ARM) is supplying this software for use with Cortex-M \r
- * processor based microcontrollers. This file can be freely distributed \r
- * within development tools that are supporting such ARM based processors. \r
- *\r
- * @par\r
- * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED\r
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF\r
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.\r
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR\r
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.\r
- *\r
- ******************************************************************************/\r
-\r
-\r
-#ifndef __LPC17xx_H__\r
-#define __LPC17xx_H__\r
-\r
-/*\r
- * ==========================================================================\r
- * ---------- Interrupt Number Definition -----------------------------------\r
- * ==========================================================================\r
- */\r
-\r
-typedef enum IRQn\r
-{\r
-/****** Cortex-M3 Processor Exceptions Numbers ***************************************************/\r
- NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */\r
- MemoryManagement_IRQn = -12, /*!< 4 Cortex-M3 Memory Management Interrupt */\r
- BusFault_IRQn = -11, /*!< 5 Cortex-M3 Bus Fault Interrupt */\r
- UsageFault_IRQn = -10, /*!< 6 Cortex-M3 Usage Fault Interrupt */\r
- SVCall_IRQn = -5, /*!< 11 Cortex-M3 SV Call Interrupt */\r
- DebugMonitor_IRQn = -4, /*!< 12 Cortex-M3 Debug Monitor Interrupt */\r
- PendSV_IRQn = -2, /*!< 14 Cortex-M3 Pend SV Interrupt */\r
- SysTick_IRQn = -1, /*!< 15 Cortex-M3 System Tick Interrupt */\r
-\r
-/****** LPC17xx Specific Interrupt Numbers *******************************************************/\r
- WDT_IRQn = 0, /*!< Watchdog Timer Interrupt */\r
- TIMER0_IRQn = 1, /*!< Timer0 Interrupt */\r
- TIMER1_IRQn = 2, /*!< Timer1 Interrupt */\r
- TIMER2_IRQn = 3, /*!< Timer2 Interrupt */\r
- TIMER3_IRQn = 4, /*!< Timer3 Interrupt */\r
- UART0_IRQn = 5, /*!< UART0 Interrupt */\r
- UART1_IRQn = 6, /*!< UART1 Interrupt */\r
- UART2_IRQn = 7, /*!< UART2 Interrupt */\r
- UART3_IRQn = 8, /*!< UART3 Interrupt */\r
- PWM1_IRQn = 9, /*!< PWM1 Interrupt */\r
- I2C0_IRQn = 10, /*!< I2C0 Interrupt */\r
- I2C1_IRQn = 11, /*!< I2C1 Interrupt */\r
- I2C2_IRQn = 12, /*!< I2C2 Interrupt */\r
- SPI_IRQn = 13, /*!< SPI Interrupt */\r
- SSP0_IRQn = 14, /*!< SSP0 Interrupt */\r
- SSP1_IRQn = 15, /*!< SSP1 Interrupt */\r
- PLL0_IRQn = 16, /*!< PLL0 Lock (Main PLL) Interrupt */\r
- RTC_IRQn = 17, /*!< Real Time Clock Interrupt */\r
- EINT0_IRQn = 18, /*!< External Interrupt 0 Interrupt */\r
- EINT1_IRQn = 19, /*!< External Interrupt 1 Interrupt */\r
- EINT2_IRQn = 20, /*!< External Interrupt 2 Interrupt */\r
- EINT3_IRQn = 21, /*!< External Interrupt 3 Interrupt */\r
- ADC_IRQn = 22, /*!< A/D Converter Interrupt */\r
- BOD_IRQn = 23, /*!< Brown-Out Detect Interrupt */\r
- USB_IRQn = 24, /*!< USB Interrupt */\r
- CAN_IRQn = 25, /*!< CAN Interrupt */\r
- DMA_IRQn = 26, /*!< General Purpose DMA Interrupt */\r
- I2S_IRQn = 27, /*!< I2S Interrupt */\r
- ENET_IRQn = 28, /*!< Ethernet Interrupt */\r
- RIT_IRQn = 29, /*!< Repetitive Interrupt Timer Interrupt */\r
- MCPWM_IRQn = 30, /*!< Motor Control PWM Interrupt */\r
- QEI_IRQn = 31, /*!< Quadrature Encoder Interface Interrupt */\r
- PLL1_IRQn = 32, /*!< PLL1 Lock (USB PLL) Interrupt */\r
- USBActivity_IRQn = 33, /* USB Activity interrupt */\r
- CANActivity_IRQn = 34, /* CAN Activity interrupt */\r
-} IRQn_Type;\r
-\r
-\r
-/*\r
- * ==========================================================================\r
- * ----------- Processor and Core Peripheral Section ------------------------\r
- * ==========================================================================\r
- */\r
-\r
-/* Configuration of the Cortex-M3 Processor and Core Peripherals */\r
-#define __MPU_PRESENT 1 /*!< MPU present or not */\r
-#define __NVIC_PRIO_BITS 5 /*!< Number of Bits used for Priority Levels */\r
-#define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */\r
-\r
-\r
-#include "core_cm3.h" /* Cortex-M3 processor and core peripherals */\r
-#include "system_LPC17xx.h" /* System Header */\r
-\r
-\r
-/******************************************************************************/\r
-/* Device Specific Peripheral registers structures */\r
-/******************************************************************************/\r
-\r
-#if defined ( __CC_ARM )\r
-#pragma anon_unions\r
-#endif\r
-\r
-/*------------- System Control (SC) ------------------------------------------*/\r
-typedef struct\r
-{\r
- __IO uint32_t FLASHCFG; /* Flash Accelerator Module */\r
- uint32_t RESERVED0[31];\r
- __IO uint32_t PLL0CON; /* Clocking and Power Control */\r
- __IO uint32_t PLL0CFG;\r
- __I uint32_t PLL0STAT;\r
- __O uint32_t PLL0FEED;\r
- uint32_t RESERVED1[4];\r
- __IO uint32_t PLL1CON;\r
- __IO uint32_t PLL1CFG;\r
- __I uint32_t PLL1STAT;\r
- __O uint32_t PLL1FEED;\r
- uint32_t RESERVED2[4];\r
- __IO uint32_t PCON;\r
- __IO uint32_t PCONP;\r
- uint32_t RESERVED3[15];\r
- __IO uint32_t CCLKCFG;\r
- __IO uint32_t USBCLKCFG;\r
- __IO uint32_t CLKSRCSEL;\r
- __IO uint32_t CANSLEEPCLR;\r
- __IO uint32_t CANWAKEFLAGS;\r
- uint32_t RESERVED4[10];\r
- __IO uint32_t EXTINT; /* External Interrupts */\r
- uint32_t RESERVED5;\r
- __IO uint32_t EXTMODE;\r
- __IO uint32_t EXTPOLAR;\r
- uint32_t RESERVED6[12];\r
- __IO uint32_t RSID; /* Reset */\r
- uint32_t RESERVED7[7];\r
- __IO uint32_t SCS; /* Syscon Miscellaneous Registers */\r
- __IO uint32_t IRCTRIM; /* Clock Dividers */\r
- __IO uint32_t PCLKSEL0;\r
- __IO uint32_t PCLKSEL1;\r
- uint32_t RESERVED8[4];\r
- __IO uint32_t USBIntSt; /* USB Device/OTG Interrupt Register */\r
- __IO uint32_t DMAREQSEL;\r
- __IO uint32_t CLKOUTCFG; /* Clock Output Configuration */\r
- } LPC_SC_TypeDef;\r
-\r
-/*------------- Pin Connect Block (PINCON) -----------------------------------*/\r
-typedef struct\r
-{\r
- __IO uint32_t PINSEL0;\r
- __IO uint32_t PINSEL1;\r
- __IO uint32_t PINSEL2;\r
- __IO uint32_t PINSEL3;\r
- __IO uint32_t PINSEL4;\r
- __IO uint32_t PINSEL5;\r
- __IO uint32_t PINSEL6;\r
- __IO uint32_t PINSEL7;\r
- __IO uint32_t PINSEL8;\r
- __IO uint32_t PINSEL9;\r
- __IO uint32_t PINSEL10;\r
- uint32_t RESERVED0[5];\r
- __IO uint32_t PINMODE0;\r
- __IO uint32_t PINMODE1;\r
- __IO uint32_t PINMODE2;\r
- __IO uint32_t PINMODE3;\r
- __IO uint32_t PINMODE4;\r
- __IO uint32_t PINMODE5;\r
- __IO uint32_t PINMODE6;\r
- __IO uint32_t PINMODE7;\r
- __IO uint32_t PINMODE8;\r
- __IO uint32_t PINMODE9;\r
- __IO uint32_t PINMODE_OD0;\r
- __IO uint32_t PINMODE_OD1;\r
- __IO uint32_t PINMODE_OD2;\r
- __IO uint32_t PINMODE_OD3;\r
- __IO uint32_t PINMODE_OD4;\r
- __IO uint32_t I2CPADCFG;\r
-} LPC_PINCON_TypeDef;\r
-\r
-/*------------- General Purpose Input/Output (GPIO) --------------------------*/\r
-typedef struct\r
-{\r
- union {\r
- __IO uint32_t FIODIR;\r
- struct {\r
- __IO uint16_t FIODIRL;\r
- __IO uint16_t FIODIRH;\r
- };\r
- struct {\r
- __IO uint8_t FIODIR0;\r
- __IO uint8_t FIODIR1;\r
- __IO uint8_t FIODIR2;\r
- __IO uint8_t FIODIR3;\r
- };\r
- };\r
- uint32_t RESERVED0[3];\r
- union {\r
- __IO uint32_t FIOMASK;\r
- struct {\r
- __IO uint16_t FIOMASKL;\r
- __IO uint16_t FIOMASKH;\r
- };\r
- struct {\r
- __IO uint8_t FIOMASK0;\r
- __IO uint8_t FIOMASK1;\r
- __IO uint8_t FIOMASK2;\r
- __IO uint8_t FIOMASK3;\r
- };\r
- };\r
- union {\r
- __IO uint32_t FIOPIN;\r
- struct {\r
- __IO uint16_t FIOPINL;\r
- __IO uint16_t FIOPINH;\r
- };\r
- struct {\r
- __IO uint8_t FIOPIN0;\r
- __IO uint8_t FIOPIN1;\r
- __IO uint8_t FIOPIN2;\r
- __IO uint8_t FIOPIN3;\r
- };\r
- };\r
- union {\r
- __IO uint32_t FIOSET;\r
- struct {\r
- __IO uint16_t FIOSETL;\r
- __IO uint16_t FIOSETH;\r
- };\r
- struct {\r
- __IO uint8_t FIOSET0;\r
- __IO uint8_t FIOSET1;\r
- __IO uint8_t FIOSET2;\r
- __IO uint8_t FIOSET3;\r
- };\r
- };\r
- union {\r
- __O uint32_t FIOCLR;\r
- struct {\r
- __O uint16_t FIOCLRL;\r
- __O uint16_t FIOCLRH;\r
- };\r
- struct {\r
- __O uint8_t FIOCLR0;\r
- __O uint8_t FIOCLR1;\r
- __O uint8_t FIOCLR2;\r
- __O uint8_t FIOCLR3;\r
- };\r
- };\r
-} LPC_GPIO_TypeDef;\r
-\r
-typedef struct\r
-{\r
- __I uint32_t IntStatus;\r
- __I uint32_t IO0IntStatR;\r
- __I uint32_t IO0IntStatF;\r
- __O uint32_t IO0IntClr;\r
- __IO uint32_t IO0IntEnR;\r
- __IO uint32_t IO0IntEnF;\r
- uint32_t RESERVED0[3];\r
- __I uint32_t IO2IntStatR;\r
- __I uint32_t IO2IntStatF;\r
- __O uint32_t IO2IntClr;\r
- __IO uint32_t IO2IntEnR;\r
- __IO uint32_t IO2IntEnF;\r
-} LPC_GPIOINT_TypeDef;\r
-\r
-/*------------- Timer (TIM) --------------------------------------------------*/\r
-typedef struct\r
-{\r
- __IO uint32_t IR;\r
- __IO uint32_t TCR;\r
- __IO uint32_t TC;\r
- __IO uint32_t PR;\r
- __IO uint32_t PC;\r
- __IO uint32_t MCR;\r
- __IO uint32_t MR0;\r
- __IO uint32_t MR1;\r
- __IO uint32_t MR2;\r
- __IO uint32_t MR3;\r
- __IO uint32_t CCR;\r
- __I uint32_t CR0;\r
- __I uint32_t CR1;\r
- uint32_t RESERVED0[2];\r
- __IO uint32_t EMR;\r
- uint32_t RESERVED1[12];\r
- __IO uint32_t CTCR;\r
-} LPC_TIM_TypeDef;\r
-\r
-/*------------- Pulse-Width Modulation (PWM) ---------------------------------*/\r
-typedef struct\r
-{\r
- __IO uint32_t IR;\r
- __IO uint32_t TCR;\r
- __IO uint32_t TC;\r
- __IO uint32_t PR;\r
- __IO uint32_t PC;\r
- __IO uint32_t MCR;\r
- __IO uint32_t MR0;\r
- __IO uint32_t MR1;\r
- __IO uint32_t MR2;\r
- __IO uint32_t MR3;\r
- __IO uint32_t CCR;\r
- __I uint32_t CR0;\r
- __I uint32_t CR1;\r
- __I uint32_t CR2;\r
- __I uint32_t CR3;\r
- uint32_t RESERVED0;\r
- __IO uint32_t MR4;\r
- __IO uint32_t MR5;\r
- __IO uint32_t MR6;\r
- __IO uint32_t PCR;\r
- __IO uint32_t LER;\r
- uint32_t RESERVED1[7];\r
- __IO uint32_t CTCR;\r
-} LPC_PWM_TypeDef;\r
-\r
-/*------------- Universal Asynchronous Receiver Transmitter (UART) -----------*/\r
-typedef struct\r
-{\r
- union {\r
- __I uint8_t RBR;\r
- __O uint8_t THR;\r
- __IO uint8_t DLL;\r
- uint32_t RESERVED0;\r
- };\r
- union {\r
- __IO uint8_t DLM;\r
- __IO uint32_t IER;\r
- };\r
- union {\r
- __I uint32_t IIR;\r
- __O uint8_t FCR;\r
- };\r
- __IO uint8_t LCR;\r
- uint8_t RESERVED1[7];\r
- __I uint8_t LSR;\r
- uint8_t RESERVED2[7];\r
- __IO uint8_t SCR;\r
- uint8_t RESERVED3[3];\r
- __IO uint32_t ACR;\r
- __IO uint8_t ICR;\r
- uint8_t RESERVED4[3];\r
- __IO uint8_t FDR;\r
- uint8_t RESERVED5[7];\r
- __IO uint8_t TER;\r
- uint8_t RESERVED6[39];\r
- __IO uint32_t FIFOLVL;\r
-} LPC_UART_TypeDef;\r
-\r
-typedef struct\r
-{\r
- union {\r
- __I uint8_t RBR;\r
- __O uint8_t THR;\r
- __IO uint8_t DLL;\r
- uint32_t RESERVED0;\r
- };\r
- union {\r
- __IO uint8_t DLM;\r
- __IO uint32_t IER;\r
- };\r
- union {\r
- __I uint32_t IIR;\r
- __O uint8_t FCR;\r
- };\r
- __IO uint8_t LCR;\r
- uint8_t RESERVED1[7];\r
- __I uint8_t LSR;\r
- uint8_t RESERVED2[7];\r
- __IO uint8_t SCR;\r
- uint8_t RESERVED3[3];\r
- __IO uint32_t ACR;\r
- __IO uint8_t ICR;\r
- uint8_t RESERVED4[3];\r
- __IO uint8_t FDR;\r
- uint8_t RESERVED5[7];\r
- __IO uint8_t TER;\r
- uint8_t RESERVED6[39];\r
- __IO uint32_t FIFOLVL;\r
-} LPC_UART0_TypeDef;\r
-\r
-typedef struct\r
-{\r
- union {\r
- __I uint8_t RBR;\r
- __O uint8_t THR;\r
- __IO uint8_t DLL;\r
- uint32_t RESERVED0;\r
- };\r
- union {\r
- __IO uint8_t DLM;\r
- __IO uint32_t IER;\r
- };\r
- union {\r
- __I uint32_t IIR;\r
- __O uint8_t FCR;\r
- };\r
- __IO uint8_t LCR;\r
- uint8_t RESERVED1[3];\r
- __IO uint8_t MCR;\r
- uint8_t RESERVED2[3];\r
- __I uint8_t LSR;\r
- uint8_t RESERVED3[3];\r
- __I uint8_t MSR;\r
- uint8_t RESERVED4[3];\r
- __IO uint8_t SCR;\r
- uint8_t RESERVED5[3];\r
- __IO uint32_t ACR;\r
- uint32_t RESERVED6;\r
- __IO uint32_t FDR;\r
- uint32_t RESERVED7;\r
- __IO uint8_t TER;\r
- uint8_t RESERVED8[27];\r
- __IO uint8_t RS485CTRL;\r
- uint8_t RESERVED9[3];\r
- __IO uint8_t ADRMATCH;\r
- uint8_t RESERVED10[3];\r
- __IO uint8_t RS485DLY;\r
- uint8_t RESERVED11[3];\r
- __IO uint32_t FIFOLVL;\r
-} LPC_UART1_TypeDef;\r
-\r
-/*------------- Serial Peripheral Interface (SPI) ----------------------------*/\r
-typedef struct\r
-{\r
- __IO uint32_t SPCR;\r
- __I uint32_t SPSR;\r
- __IO uint32_t SPDR;\r
- __IO uint32_t SPCCR;\r
- uint32_t RESERVED0[3];\r
- __IO uint32_t SPINT;\r
-} LPC_SPI_TypeDef;\r
-\r
-/*------------- Synchronous Serial Communication (SSP) -----------------------*/\r
-typedef struct\r
-{\r
- __IO uint32_t CR0;\r
- __IO uint32_t CR1;\r
- __IO uint32_t DR;\r
- __I uint32_t SR;\r
- __IO uint32_t CPSR;\r
- __IO uint32_t IMSC;\r
- __IO uint32_t RIS;\r
- __IO uint32_t MIS;\r
- __IO uint32_t ICR;\r
- __IO uint32_t DMACR;\r
-} LPC_SSP_TypeDef;\r
-\r
-/*------------- Inter-Integrated Circuit (I2C) -------------------------------*/\r
-typedef struct\r
-{\r
- __IO uint32_t I2CONSET;\r
- __I uint32_t I2STAT;\r
- __IO uint32_t I2DAT;\r
- __IO uint32_t I2ADR0;\r
- __IO uint32_t I2SCLH;\r
- __IO uint32_t I2SCLL;\r
- __O uint32_t I2CONCLR;\r
- __IO uint32_t MMCTRL;\r
- __IO uint32_t I2ADR1;\r
- __IO uint32_t I2ADR2;\r
- __IO uint32_t I2ADR3;\r
- __I uint32_t I2DATA_BUFFER;\r
- __IO uint32_t I2MASK0;\r
- __IO uint32_t I2MASK1;\r
- __IO uint32_t I2MASK2;\r
- __IO uint32_t I2MASK3;\r
-} LPC_I2C_TypeDef;\r
-\r
-/*------------- Inter IC Sound (I2S) -----------------------------------------*/\r
-typedef struct\r
-{\r
- __IO uint32_t I2SDAO;\r
- __IO uint32_t I2SDAI;\r
- __O uint32_t I2STXFIFO;\r
- __I uint32_t I2SRXFIFO;\r
- __I uint32_t I2SSTATE;\r
- __IO uint32_t I2SDMA1;\r
- __IO uint32_t I2SDMA2;\r
- __IO uint32_t I2SIRQ;\r
- __IO uint32_t I2STXRATE;\r
- __IO uint32_t I2SRXRATE;\r
- __IO uint32_t I2STXBITRATE;\r
- __IO uint32_t I2SRXBITRATE;\r
- __IO uint32_t I2STXMODE;\r
- __IO uint32_t I2SRXMODE;\r
-} LPC_I2S_TypeDef;\r
-\r
-/*------------- Repetitive Interrupt Timer (RIT) -----------------------------*/\r
-typedef struct\r
-{\r
- __IO uint32_t RICOMPVAL;\r
- __IO uint32_t RIMASK;\r
- __IO uint8_t RICTRL;\r
- uint8_t RESERVED0[3];\r
- __IO uint32_t RICOUNTER;\r
-} LPC_RIT_TypeDef;\r
-\r
-/*------------- Real-Time Clock (RTC) ----------------------------------------*/\r
-typedef struct\r
-{\r
- __IO uint8_t ILR;\r
- uint8_t RESERVED0[7];\r
- __IO uint8_t CCR;\r
- uint8_t RESERVED1[3];\r
- __IO uint8_t CIIR;\r
- uint8_t RESERVED2[3];\r
- __IO uint8_t AMR;\r
- uint8_t RESERVED3[3];\r
- __I uint32_t CTIME0;\r
- __I uint32_t CTIME1;\r
- __I uint32_t CTIME2;\r
- __IO uint8_t SEC;\r
- uint8_t RESERVED4[3];\r
- __IO uint8_t MIN;\r
- uint8_t RESERVED5[3];\r
- __IO uint8_t HOUR;\r
- uint8_t RESERVED6[3];\r
- __IO uint8_t DOM;\r
- uint8_t RESERVED7[3];\r
- __IO uint8_t DOW;\r
- uint8_t RESERVED8[3];\r
- __IO uint16_t DOY;\r
- uint16_t RESERVED9;\r
- __IO uint8_t MONTH;\r
- uint8_t RESERVED10[3];\r
- __IO uint16_t YEAR;\r
- uint16_t RESERVED11;\r
- __IO uint32_t CALIBRATION;\r
- __IO uint32_t GPREG0;\r
- __IO uint32_t GPREG1;\r
- __IO uint32_t GPREG2;\r
- __IO uint32_t GPREG3;\r
- __IO uint32_t GPREG4;\r
- __IO uint8_t RTC_AUXEN;\r
- uint8_t RESERVED12[3];\r
- __IO uint8_t RTC_AUX;\r
- uint8_t RESERVED13[3];\r
- __IO uint8_t ALSEC;\r
- uint8_t RESERVED14[3];\r
- __IO uint8_t ALMIN;\r
- uint8_t RESERVED15[3];\r
- __IO uint8_t ALHOUR;\r
- uint8_t RESERVED16[3];\r
- __IO uint8_t ALDOM;\r
- uint8_t RESERVED17[3];\r
- __IO uint8_t ALDOW;\r
- uint8_t RESERVED18[3];\r
- __IO uint16_t ALDOY;\r
- uint16_t RESERVED19;\r
- __IO uint8_t ALMON;\r
- uint8_t RESERVED20[3];\r
- __IO uint16_t ALYEAR;\r
- uint16_t RESERVED21;\r
-} LPC_RTC_TypeDef;\r
-\r
-/*------------- Watchdog Timer (WDT) -----------------------------------------*/\r
-typedef struct\r
-{\r
- __IO uint8_t WDMOD;\r
- uint8_t RESERVED0[3];\r
- __IO uint32_t WDTC;\r
- __O uint8_t WDFEED;\r
- uint8_t RESERVED1[3];\r
- __I uint32_t WDTV;\r
- __IO uint32_t WDCLKSEL;\r
-} LPC_WDT_TypeDef;\r
-\r
-/*------------- Analog-to-Digital Converter (ADC) ----------------------------*/\r
-typedef struct\r
-{\r
- __IO uint32_t ADCR;\r
- __IO uint32_t ADGDR;\r
- uint32_t RESERVED0;\r
- __IO uint32_t ADINTEN;\r
- __I uint32_t ADDR0;\r
- __I uint32_t ADDR1;\r
- __I uint32_t ADDR2;\r
- __I uint32_t ADDR3;\r
- __I uint32_t ADDR4;\r
- __I uint32_t ADDR5;\r
- __I uint32_t ADDR6;\r
- __I uint32_t ADDR7;\r
- __I uint32_t ADSTAT;\r
- __IO uint32_t ADTRM;\r
-} LPC_ADC_TypeDef;\r
-\r
-/*------------- Digital-to-Analog Converter (DAC) ----------------------------*/\r
-typedef struct\r
-{\r
- __IO uint32_t DACR;\r
- __IO uint32_t DACCTRL;\r
- __IO uint16_t DACCNTVAL;\r
-} LPC_DAC_TypeDef;\r
-\r
-/*------------- Motor Control Pulse-Width Modulation (MCPWM) -----------------*/\r
-typedef struct\r
-{\r
- __I uint32_t MCCON;\r
- __O uint32_t MCCON_SET;\r
- __O uint32_t MCCON_CLR;\r
- __I uint32_t MCCAPCON;\r
- __O uint32_t MCCAPCON_SET;\r
- __O uint32_t MCCAPCON_CLR;\r
- __IO uint32_t MCTIM0;\r
- __IO uint32_t MCTIM1;\r
- __IO uint32_t MCTIM2;\r
- __IO uint32_t MCPER0;\r
- __IO uint32_t MCPER1;\r
- __IO uint32_t MCPER2;\r
- __IO uint32_t MCPW0;\r
- __IO uint32_t MCPW1;\r
- __IO uint32_t MCPW2;\r
- __IO uint32_t MCDEADTIME;\r
- __IO uint32_t MCCCP;\r
- __IO uint32_t MCCR0;\r
- __IO uint32_t MCCR1;\r
- __IO uint32_t MCCR2;\r
- __I uint32_t MCINTEN;\r
- __O uint32_t MCINTEN_SET;\r
- __O uint32_t MCINTEN_CLR;\r
- __I uint32_t MCCNTCON;\r
- __O uint32_t MCCNTCON_SET;\r
- __O uint32_t MCCNTCON_CLR;\r
- __I uint32_t MCINTFLAG;\r
- __O uint32_t MCINTFLAG_SET;\r
- __O uint32_t MCINTFLAG_CLR;\r
- __O uint32_t MCCAP_CLR;\r
-} LPC_MCPWM_TypeDef;\r
-\r
-/*------------- Quadrature Encoder Interface (QEI) ---------------------------*/\r
-typedef struct\r
-{\r
- __O uint32_t QEICON;\r
- __I uint32_t QEISTAT;\r
- __IO uint32_t QEICONF;\r
- __I uint32_t QEIPOS;\r
- __IO uint32_t QEIMAXPOS;\r
- __IO uint32_t CMPOS0;\r
- __IO uint32_t CMPOS1;\r
- __IO uint32_t CMPOS2;\r
- __I uint32_t INXCNT;\r
- __IO uint32_t INXCMP;\r
- __IO uint32_t QEILOAD;\r
- __I uint32_t QEITIME;\r
- __I uint32_t QEIVEL;\r
- __I uint32_t QEICAP;\r
- __IO uint32_t VELCOMP;\r
- __IO uint32_t FILTER;\r
- uint32_t RESERVED0[998];\r
- __O uint32_t QEIIEC;\r
- __O uint32_t QEIIES;\r
- __I uint32_t QEIINTSTAT;\r
- __I uint32_t QEIIE;\r
- __O uint32_t QEICLR;\r
- __O uint32_t QEISET;\r
-} LPC_QEI_TypeDef;\r
-\r
-/*------------- Controller Area Network (CAN) --------------------------------*/\r
-typedef struct\r
-{\r
- __IO uint32_t mask[512]; /* ID Masks */\r
-} LPC_CANAF_RAM_TypeDef;\r
-\r
-typedef struct /* Acceptance Filter Registers */\r
-{\r
- __IO uint32_t AFMR;\r
- __IO uint32_t SFF_sa;\r
- __IO uint32_t SFF_GRP_sa;\r
- __IO uint32_t EFF_sa;\r
- __IO uint32_t EFF_GRP_sa;\r
- __IO uint32_t ENDofTable;\r
- __I uint32_t LUTerrAd;\r
- __I uint32_t LUTerr;\r
- __IO uint32_t FCANIE;\r
- __IO uint32_t FCANIC0;\r
- __IO uint32_t FCANIC1;\r
-} LPC_CANAF_TypeDef;\r
-\r
-typedef struct /* Central Registers */\r
-{\r
- __I uint32_t CANTxSR;\r
- __I uint32_t CANRxSR;\r
- __I uint32_t CANMSR;\r
-} LPC_CANCR_TypeDef;\r
-\r
-typedef struct /* Controller Registers */\r
-{\r
- __IO uint32_t MOD;\r
- __O uint32_t CMR;\r
- __IO uint32_t GSR;\r
- __I uint32_t ICR;\r
- __IO uint32_t IER;\r
- __IO uint32_t BTR;\r
- __IO uint32_t EWL;\r
- __I uint32_t SR;\r
- __IO uint32_t RFS;\r
- __IO uint32_t RID;\r
- __IO uint32_t RDA;\r
- __IO uint32_t RDB;\r
- __IO uint32_t TFI1;\r
- __IO uint32_t TID1;\r
- __IO uint32_t TDA1;\r
- __IO uint32_t TDB1;\r
- __IO uint32_t TFI2;\r
- __IO uint32_t TID2;\r
- __IO uint32_t TDA2;\r
- __IO uint32_t TDB2;\r
- __IO uint32_t TFI3;\r
- __IO uint32_t TID3;\r
- __IO uint32_t TDA3;\r
- __IO uint32_t TDB3;\r
-} LPC_CAN_TypeDef;\r
-\r
-/*------------- General Purpose Direct Memory Access (GPDMA) -----------------*/\r
-typedef struct /* Common Registers */\r
-{\r
- __I uint32_t DMACIntStat;\r
- __I uint32_t DMACIntTCStat;\r
- __O uint32_t DMACIntTCClear;\r
- __I uint32_t DMACIntErrStat;\r
- __O uint32_t DMACIntErrClr;\r
- __I uint32_t DMACRawIntTCStat;\r
- __I uint32_t DMACRawIntErrStat;\r
- __I uint32_t DMACEnbldChns;\r
- __IO uint32_t DMACSoftBReq;\r
- __IO uint32_t DMACSoftSReq;\r
- __IO uint32_t DMACSoftLBReq;\r
- __IO uint32_t DMACSoftLSReq;\r
- __IO uint32_t DMACConfig;\r
- __IO uint32_t DMACSync;\r
-} LPC_GPDMA_TypeDef;\r
-\r
-typedef struct /* Channel Registers */\r
-{\r
- __IO uint32_t DMACCSrcAddr;\r
- __IO uint32_t DMACCDestAddr;\r
- __IO uint32_t DMACCLLI;\r
- __IO uint32_t DMACCControl;\r
- __IO uint32_t DMACCConfig;\r
-} LPC_GPDMACH_TypeDef;\r
-\r
-/*------------- Universal Serial Bus (USB) -----------------------------------*/\r
-typedef struct\r
-{\r
- __I uint32_t HcRevision; /* USB Host Registers */\r
- __IO uint32_t HcControl;\r
- __IO uint32_t HcCommandStatus;\r
- __IO uint32_t HcInterruptStatus;\r
- __IO uint32_t HcInterruptEnable;\r
- __IO uint32_t HcInterruptDisable;\r
- __IO uint32_t HcHCCA;\r
- __I uint32_t HcPeriodCurrentED;\r
- __IO uint32_t HcControlHeadED;\r
- __IO uint32_t HcControlCurrentED;\r
- __IO uint32_t HcBulkHeadED;\r
- __IO uint32_t HcBulkCurrentED;\r
- __I uint32_t HcDoneHead;\r
- __IO uint32_t HcFmInterval;\r
- __I uint32_t HcFmRemaining;\r
- __I uint32_t HcFmNumber;\r
- __IO uint32_t HcPeriodicStart;\r
- __IO uint32_t HcLSTreshold;\r
- __IO uint32_t HcRhDescriptorA;\r
- __IO uint32_t HcRhDescriptorB;\r
- __IO uint32_t HcRhStatus;\r
- __IO uint32_t HcRhPortStatus1;\r
- __IO uint32_t HcRhPortStatus2;\r
- uint32_t RESERVED0[40];\r
- __I uint32_t Module_ID;\r
-\r
- __I uint32_t OTGIntSt; /* USB On-The-Go Registers */\r
- __IO uint32_t OTGIntEn;\r
- __O uint32_t OTGIntSet;\r
- __O uint32_t OTGIntClr;\r
- __IO uint32_t OTGStCtrl;\r
- __IO uint32_t OTGTmr;\r
- uint32_t RESERVED1[58];\r
-\r
- __I uint32_t USBDevIntSt; /* USB Device Interrupt Registers */\r
- __IO uint32_t USBDevIntEn;\r
- __O uint32_t USBDevIntClr;\r
- __O uint32_t USBDevIntSet;\r
-\r
- __O uint32_t USBCmdCode; /* USB Device SIE Command Registers */\r
- __I uint32_t USBCmdData;\r
-\r
- __I uint32_t USBRxData; /* USB Device Transfer Registers */\r
- __O uint32_t USBTxData;\r
- __I uint32_t USBRxPLen;\r
- __O uint32_t USBTxPLen;\r
- __IO uint32_t USBCtrl;\r
- __O uint32_t USBDevIntPri;\r
-\r
- __I uint32_t USBEpIntSt; /* USB Device Endpoint Interrupt Regs */\r
- __IO uint32_t USBEpIntEn;\r
- __O uint32_t USBEpIntClr;\r
- __O uint32_t USBEpIntSet;\r
- __O uint32_t USBEpIntPri;\r
-\r
- __IO uint32_t USBReEp; /* USB Device Endpoint Realization Reg*/\r
- __O uint32_t USBEpInd;\r
- __IO uint32_t USBMaxPSize;\r
-\r
- __I uint32_t USBDMARSt; /* USB Device DMA Registers */\r
- __O uint32_t USBDMARClr;\r
- __O uint32_t USBDMARSet;\r
- uint32_t RESERVED2[9];\r
- __IO uint32_t USBUDCAH;\r
- __I uint32_t USBEpDMASt;\r
- __O uint32_t USBEpDMAEn;\r
- __O uint32_t USBEpDMADis;\r
- __I uint32_t USBDMAIntSt;\r
- __IO uint32_t USBDMAIntEn;\r
- uint32_t RESERVED3[2];\r
- __I uint32_t USBEoTIntSt;\r
- __O uint32_t USBEoTIntClr;\r
- __O uint32_t USBEoTIntSet;\r
- __I uint32_t USBNDDRIntSt;\r
- __O uint32_t USBNDDRIntClr;\r
- __O uint32_t USBNDDRIntSet;\r
- __I uint32_t USBSysErrIntSt;\r
- __O uint32_t USBSysErrIntClr;\r
- __O uint32_t USBSysErrIntSet;\r
- uint32_t RESERVED4[15];\r
-\r
- union {\r
- __I uint32_t I2C_RX; /* USB OTG I2C Registers */\r
- __O uint32_t I2C_TX;\r
- };\r
- __I uint32_t I2C_STS;\r
- __IO uint32_t I2C_CTL;\r
- __IO uint32_t I2C_CLKHI;\r
- __O uint32_t I2C_CLKLO;\r
- uint32_t RESERVED5[824];\r
-\r
- union {\r
- __IO uint32_t USBClkCtrl; /* USB Clock Control Registers */\r
- __IO uint32_t OTGClkCtrl;\r
- };\r
- union {\r
- __I uint32_t USBClkSt;\r
- __I uint32_t OTGClkSt;\r
- };\r
-} LPC_USB_TypeDef;\r
-\r
-/*------------- Ethernet Media Access Controller (EMAC) ----------------------*/\r
-typedef struct\r
-{\r
- __IO uint32_t MAC1; /* MAC Registers */\r
- __IO uint32_t MAC2;\r
- __IO uint32_t IPGT;\r
- __IO uint32_t IPGR;\r
- __IO uint32_t CLRT;\r
- __IO uint32_t MAXF;\r
- __IO uint32_t SUPP;\r
- __IO uint32_t TEST;\r
- __IO uint32_t MCFG;\r
- __IO uint32_t MCMD;\r
- __IO uint32_t MADR;\r
- __O uint32_t MWTD;\r
- __I uint32_t MRDD;\r
- __I uint32_t MIND;\r
- uint32_t RESERVED0[2];\r
- __IO uint32_t SA0;\r
- __IO uint32_t SA1;\r
- __IO uint32_t SA2;\r
- uint32_t RESERVED1[45];\r
- __IO uint32_t Command; /* Control Registers */\r
- __I uint32_t Status;\r
- __IO uint32_t RxDescriptor;\r
- __IO uint32_t RxStatus;\r
- __IO uint32_t RxDescriptorNumber;\r
- __I uint32_t RxProduceIndex;\r
- __IO uint32_t RxConsumeIndex;\r
- __IO uint32_t TxDescriptor;\r
- __IO uint32_t TxStatus;\r
- __IO uint32_t TxDescriptorNumber;\r
- __IO uint32_t TxProduceIndex;\r
- __I uint32_t TxConsumeIndex;\r
- uint32_t RESERVED2[10];\r
- __I uint32_t TSV0;\r
- __I uint32_t TSV1;\r
- __I uint32_t RSV;\r
- uint32_t RESERVED3[3];\r
- __IO uint32_t FlowControlCounter;\r
- __I uint32_t FlowControlStatus;\r
- uint32_t RESERVED4[34];\r
- __IO uint32_t RxFilterCtrl; /* Rx Filter Registers */\r
- __IO uint32_t RxFilterWoLStatus;\r
- __IO uint32_t RxFilterWoLClear;\r
- uint32_t RESERVED5;\r
- __IO uint32_t HashFilterL;\r
- __IO uint32_t HashFilterH;\r
- uint32_t RESERVED6[882];\r
- __I uint32_t IntStatus; /* Module Control Registers */\r
- __IO uint32_t IntEnable;\r
- __O uint32_t IntClear;\r
- __O uint32_t IntSet;\r
- uint32_t RESERVED7;\r
- __IO uint32_t PowerDown;\r
- uint32_t RESERVED8;\r
- __IO uint32_t Module_ID;\r
-} LPC_EMAC_TypeDef;\r
-\r
-#if defined ( __CC_ARM )\r
-#pragma no_anon_unions\r
-#endif\r
-\r
-\r
-/******************************************************************************/\r
-/* Peripheral memory map */\r
-/******************************************************************************/\r
-/* Base addresses */\r
-#define LPC_FLASH_BASE (0x00000000UL)\r
-#define LPC_RAM_BASE (0x10000000UL)\r
-#define LPC_GPIO_BASE (0x2009C000UL)\r
-#define LPC_APB0_BASE (0x40000000UL)\r
-#define LPC_APB1_BASE (0x40080000UL)\r
-#define LPC_AHB_BASE (0x50000000UL)\r
-#define LPC_CM3_BASE (0xE0000000UL)\r
-\r
-/* APB0 peripherals */\r
-#define LPC_WDT_BASE (LPC_APB0_BASE + 0x00000)\r
-#define LPC_TIM0_BASE (LPC_APB0_BASE + 0x04000)\r
-#define LPC_TIM1_BASE (LPC_APB0_BASE + 0x08000)\r
-#define LPC_UART0_BASE (LPC_APB0_BASE + 0x0C000)\r
-#define LPC_UART1_BASE (LPC_APB0_BASE + 0x10000)\r
-#define LPC_PWM1_BASE (LPC_APB0_BASE + 0x18000)\r
-#define LPC_I2C0_BASE (LPC_APB0_BASE + 0x1C000)\r
-#define LPC_SPI_BASE (LPC_APB0_BASE + 0x20000)\r
-#define LPC_RTC_BASE (LPC_APB0_BASE + 0x24000)\r
-#define LPC_GPIOINT_BASE (LPC_APB0_BASE + 0x28080)\r
-#define LPC_PINCON_BASE (LPC_APB0_BASE + 0x2C000)\r
-#define LPC_SSP1_BASE (LPC_APB0_BASE + 0x30000)\r
-#define LPC_ADC_BASE (LPC_APB0_BASE + 0x34000)\r
-#define LPC_CANAF_RAM_BASE (LPC_APB0_BASE + 0x38000)\r
-#define LPC_CANAF_BASE (LPC_APB0_BASE + 0x3C000)\r
-#define LPC_CANCR_BASE (LPC_APB0_BASE + 0x40000)\r
-#define LPC_CAN1_BASE (LPC_APB0_BASE + 0x44000)\r
-#define LPC_CAN2_BASE (LPC_APB0_BASE + 0x48000)\r
-#define LPC_I2C1_BASE (LPC_APB0_BASE + 0x5C000)\r
-\r
-/* APB1 peripherals */\r
-#define LPC_SSP0_BASE (LPC_APB1_BASE + 0x08000)\r
-#define LPC_DAC_BASE (LPC_APB1_BASE + 0x0C000)\r
-#define LPC_TIM2_BASE (LPC_APB1_BASE + 0x10000)\r
-#define LPC_TIM3_BASE (LPC_APB1_BASE + 0x14000)\r
-#define LPC_UART2_BASE (LPC_APB1_BASE + 0x18000)\r
-#define LPC_UART3_BASE (LPC_APB1_BASE + 0x1C000)\r
-#define LPC_I2C2_BASE (LPC_APB1_BASE + 0x20000)\r
-#define LPC_I2S_BASE (LPC_APB1_BASE + 0x28000)\r
-#define LPC_RIT_BASE (LPC_APB1_BASE + 0x30000)\r
-#define LPC_MCPWM_BASE (LPC_APB1_BASE + 0x38000)\r
-#define LPC_QEI_BASE (LPC_APB1_BASE + 0x3C000)\r
-#define LPC_SC_BASE (LPC_APB1_BASE + 0x7C000)\r
-\r
-/* AHB peripherals */\r
-#define LPC_EMAC_BASE (LPC_AHB_BASE + 0x00000)\r
-#define LPC_GPDMA_BASE (LPC_AHB_BASE + 0x04000)\r
-#define LPC_GPDMACH0_BASE (LPC_AHB_BASE + 0x04100)\r
-#define LPC_GPDMACH1_BASE (LPC_AHB_BASE + 0x04120)\r
-#define LPC_GPDMACH2_BASE (LPC_AHB_BASE + 0x04140)\r
-#define LPC_GPDMACH3_BASE (LPC_AHB_BASE + 0x04160)\r
-#define LPC_GPDMACH4_BASE (LPC_AHB_BASE + 0x04180)\r
-#define LPC_GPDMACH5_BASE (LPC_AHB_BASE + 0x041A0)\r
-#define LPC_GPDMACH6_BASE (LPC_AHB_BASE + 0x041C0)\r
-#define LPC_GPDMACH7_BASE (LPC_AHB_BASE + 0x041E0)\r
-#define LPC_USB_BASE (LPC_AHB_BASE + 0x0C000)\r
-\r
-/* GPIOs */\r
-#define LPC_GPIO0_BASE (LPC_GPIO_BASE + 0x00000)\r
-#define LPC_GPIO1_BASE (LPC_GPIO_BASE + 0x00020)\r
-#define LPC_GPIO2_BASE (LPC_GPIO_BASE + 0x00040)\r
-#define LPC_GPIO3_BASE (LPC_GPIO_BASE + 0x00060)\r
-#define LPC_GPIO4_BASE (LPC_GPIO_BASE + 0x00080)\r
-\r
-\r
-/******************************************************************************/\r
-/* Peripheral declaration */\r
-/******************************************************************************/\r
-#define LPC_SC ((LPC_SC_TypeDef *) LPC_SC_BASE )\r
-#define LPC_GPIO0 ((LPC_GPIO_TypeDef *) LPC_GPIO0_BASE )\r
-#define LPC_GPIO1 ((LPC_GPIO_TypeDef *) LPC_GPIO1_BASE )\r
-#define LPC_GPIO2 ((LPC_GPIO_TypeDef *) LPC_GPIO2_BASE )\r
-#define LPC_GPIO3 ((LPC_GPIO_TypeDef *) LPC_GPIO3_BASE )\r
-#define LPC_GPIO4 ((LPC_GPIO_TypeDef *) LPC_GPIO4_BASE )\r
-#define LPC_WDT ((LPC_WDT_TypeDef *) LPC_WDT_BASE )\r
-#define LPC_TIM0 ((LPC_TIM_TypeDef *) LPC_TIM0_BASE )\r
-#define LPC_TIM1 ((LPC_TIM_TypeDef *) LPC_TIM1_BASE )\r
-#define LPC_TIM2 ((LPC_TIM_TypeDef *) LPC_TIM2_BASE )\r
-#define LPC_TIM3 ((LPC_TIM_TypeDef *) LPC_TIM3_BASE )\r
-#define LPC_RIT ((LPC_RIT_TypeDef *) LPC_RIT_BASE )\r
-#define LPC_UART0 ((LPC_UART0_TypeDef *) LPC_UART0_BASE )\r
-#define LPC_UART1 ((LPC_UART1_TypeDef *) LPC_UART1_BASE )\r
-#define LPC_UART2 ((LPC_UART_TypeDef *) LPC_UART2_BASE )\r
-#define LPC_UART3 ((LPC_UART_TypeDef *) LPC_UART3_BASE )\r
-#define LPC_PWM1 ((LPC_PWM_TypeDef *) LPC_PWM1_BASE )\r
-#define LPC_I2C0 ((LPC_I2C_TypeDef *) LPC_I2C0_BASE )\r
-#define LPC_I2C1 ((LPC_I2C_TypeDef *) LPC_I2C1_BASE )\r
-#define LPC_I2C2 ((LPC_I2C_TypeDef *) LPC_I2C2_BASE )\r
-#define LPC_I2S ((LPC_I2S_TypeDef *) LPC_I2S_BASE )\r
-#define LPC_SPI ((LPC_SPI_TypeDef *) LPC_SPI_BASE )\r
-#define LPC_RTC ((LPC_RTC_TypeDef *) LPC_RTC_BASE )\r
-#define LPC_GPIOINT ((LPC_GPIOINT_TypeDef *) LPC_GPIOINT_BASE )\r
-#define LPC_PINCON ((LPC_PINCON_TypeDef *) LPC_PINCON_BASE )\r
-#define LPC_SSP0 ((LPC_SSP_TypeDef *) LPC_SSP0_BASE )\r
-#define LPC_SSP1 ((LPC_SSP_TypeDef *) LPC_SSP1_BASE )\r
-#define LPC_ADC ((LPC_ADC_TypeDef *) LPC_ADC_BASE )\r
-#define LPC_DAC ((LPC_DAC_TypeDef *) LPC_DAC_BASE )\r
-#define LPC_CANAF_RAM ((LPC_CANAF_RAM_TypeDef *) LPC_CANAF_RAM_BASE)\r
-#define LPC_CANAF ((LPC_CANAF_TypeDef *) LPC_CANAF_BASE )\r
-#define LPC_CANCR ((LPC_CANCR_TypeDef *) LPC_CANCR_BASE )\r
-#define LPC_CAN1 ((LPC_CAN_TypeDef *) LPC_CAN1_BASE )\r
-#define LPC_CAN2 ((LPC_CAN_TypeDef *) LPC_CAN2_BASE )\r
-#define LPC_MCPWM ((LPC_MCPWM_TypeDef *) LPC_MCPWM_BASE )\r
-#define LPC_QEI ((LPC_QEI_TypeDef *) LPC_QEI_BASE )\r
-#define LPC_EMAC ((LPC_EMAC_TypeDef *) LPC_EMAC_BASE )\r
-#define LPC_GPDMA ((LPC_GPDMA_TypeDef *) LPC_GPDMA_BASE )\r
-#define LPC_GPDMACH0 ((LPC_GPDMACH_TypeDef *) LPC_GPDMACH0_BASE )\r
-#define LPC_GPDMACH1 ((LPC_GPDMACH_TypeDef *) LPC_GPDMACH1_BASE )\r
-#define LPC_GPDMACH2 ((LPC_GPDMACH_TypeDef *) LPC_GPDMACH2_BASE )\r
-#define LPC_GPDMACH3 ((LPC_GPDMACH_TypeDef *) LPC_GPDMACH3_BASE )\r
-#define LPC_GPDMACH4 ((LPC_GPDMACH_TypeDef *) LPC_GPDMACH4_BASE )\r
-#define LPC_GPDMACH5 ((LPC_GPDMACH_TypeDef *) LPC_GPDMACH5_BASE )\r
-#define LPC_GPDMACH6 ((LPC_GPDMACH_TypeDef *) LPC_GPDMACH6_BASE )\r
-#define LPC_GPDMACH7 ((LPC_GPDMACH_TypeDef *) LPC_GPDMACH7_BASE )\r
-#define LPC_USB ((LPC_USB_TypeDef *) LPC_USB_BASE )\r
-\r
-#endif // __LPC17xx_H__\r
+++ /dev/null
-/* mbed Microcontroller Library - CMSIS
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
- *
- * A generic CMSIS include header, pulling in LPC1768 specifics
- */
-
-#ifndef MBED_CMSIS_H
-#define MBED_CMSIS_H
-
-#ifndef TARGET_LPC1768
-#define TARGET_LPC1768
-#endif
-
-#include "LPC17xx.h"
-#include "cmsis_nvic.h"
-
-#endif
+++ /dev/null
-/* mbed Microcontroller Library - cmsis_nvic
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */
-
-#ifndef MBED_CMSIS_NVIC_H
-#define MBED_CMSIS_NVIC_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
-uint32_t NVIC_GetVector(IRQn_Type IRQn);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
-/**************************************************************************//**\r
- * @file core_cm3.h\r
- * @brief CMSIS Cortex-M3 Core Peripheral Access Layer Header File\r
- * @version V3.01\r
- * @date 06. March 2012\r
- *\r
- * @note\r
- * Copyright (C) 2009-2012 ARM Limited. All rights reserved.\r
- *\r
- * @par\r
- * ARM Limited (ARM) is supplying this software for use with Cortex-M\r
- * processor based microcontrollers. This file can be freely distributed\r
- * within development tools that are supporting such ARM based processors.\r
- *\r
- * @par\r
- * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED\r
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF\r
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.\r
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR\r
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.\r
- *\r
- ******************************************************************************/\r
-#if defined ( __ICCARM__ )\r
- #pragma system_include /* treat file as system include file for MISRA check */\r
-#endif\r
-\r
-#ifdef __cplusplus\r
- extern "C" {\r
-#endif\r
-\r
-#ifndef __CORE_CM3_H_GENERIC\r
-#define __CORE_CM3_H_GENERIC\r
-\r
-/** \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions\r
- CMSIS violates the following MISRA-C:2004 rules:\r
-\r
- \li Required Rule 8.5, object/function definition in header file.<br>\r
- Function definitions in header files are used to allow 'inlining'.\r
-\r
- \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>\r
- Unions are used for effective representation of core registers.\r
-\r
- \li Advisory Rule 19.7, Function-like macro defined.<br>\r
- Function-like macros are used to allow more efficient code.\r
- */\r
-\r
-\r
-/*******************************************************************************\r
- * CMSIS definitions\r
- ******************************************************************************/\r
-/** \ingroup Cortex_M3\r
- @{\r
- */\r
-\r
-/* CMSIS CM3 definitions */\r
-#define __CM3_CMSIS_VERSION_MAIN (0x03) /*!< [31:16] CMSIS HAL main version */\r
-#define __CM3_CMSIS_VERSION_SUB (0x01) /*!< [15:0] CMSIS HAL sub version */\r
-#define __CM3_CMSIS_VERSION ((__CM3_CMSIS_VERSION_MAIN << 16) | \\r
- __CM3_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */\r
-\r
-#define __CORTEX_M (0x03) /*!< Cortex-M Core */\r
-\r
-\r
-#if defined ( __CC_ARM )\r
- #define __ASM __asm /*!< asm keyword for ARM Compiler */\r
- #define __INLINE __inline /*!< inline keyword for ARM Compiler */\r
- #define __STATIC_INLINE static __inline\r
-\r
-#elif defined ( __ICCARM__ )\r
- #define __ASM __asm /*!< asm keyword for IAR Compiler */\r
- #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */\r
- #define __STATIC_INLINE static inline\r
-\r
-#elif defined ( __TMS470__ )\r
- #define __ASM __asm /*!< asm keyword for TI CCS Compiler */\r
- #define __STATIC_INLINE static inline\r
-\r
-#elif defined ( __GNUC__ )\r
- #define __ASM __asm /*!< asm keyword for GNU Compiler */\r
- #define __INLINE inline /*!< inline keyword for GNU Compiler */\r
- #define __STATIC_INLINE static inline\r
-\r
-#elif defined ( __TASKING__ )\r
- #define __ASM __asm /*!< asm keyword for TASKING Compiler */\r
- #define __INLINE inline /*!< inline keyword for TASKING Compiler */\r
- #define __STATIC_INLINE static inline\r
-\r
-#endif\r
-\r
-/** __FPU_USED indicates whether an FPU is used or not. This core does not support an FPU at all\r
-*/\r
-#define __FPU_USED 0\r
-\r
-#if defined ( __CC_ARM )\r
- #if defined __TARGET_FPU_VFP\r
- #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"\r
- #endif\r
-\r
-#elif defined ( __ICCARM__ )\r
- #if defined __ARMVFP__\r
- #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"\r
- #endif\r
-\r
-#elif defined ( __TMS470__ )\r
- #if defined __TI__VFP_SUPPORT____\r
- #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"\r
- #endif\r
-\r
-#elif defined ( __GNUC__ )\r
- #if defined (__VFP_FP__) && !defined(__SOFTFP__)\r
- #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"\r
- #endif\r
-\r
-#elif defined ( __TASKING__ )\r
- /* add preprocessor checks */\r
-#endif\r
-\r
-#include <stdint.h> /* standard types definitions */\r
-#include <core_cmInstr.h> /* Core Instruction Access */\r
-#include <core_cmFunc.h> /* Core Function Access */\r
-\r
-#endif /* __CORE_CM3_H_GENERIC */\r
-\r
-#ifndef __CMSIS_GENERIC\r
-\r
-#ifndef __CORE_CM3_H_DEPENDANT\r
-#define __CORE_CM3_H_DEPENDANT\r
-\r
-/* check device defines and use defaults */\r
-#if defined __CHECK_DEVICE_DEFINES\r
- #ifndef __CM3_REV\r
- #define __CM3_REV 0x0200\r
- #warning "__CM3_REV not defined in device header file; using default!"\r
- #endif\r
-\r
- #ifndef __MPU_PRESENT\r
- #define __MPU_PRESENT 0\r
- #warning "__MPU_PRESENT not defined in device header file; using default!"\r
- #endif\r
-\r
- #ifndef __NVIC_PRIO_BITS\r
- #define __NVIC_PRIO_BITS 4\r
- #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"\r
- #endif\r
-\r
- #ifndef __Vendor_SysTickConfig\r
- #define __Vendor_SysTickConfig 0\r
- #warning "__Vendor_SysTickConfig not defined in device header file; using default!"\r
- #endif\r
-#endif\r
-\r
-/* IO definitions (access restrictions to peripheral registers) */\r
-/**\r
- \defgroup CMSIS_glob_defs CMSIS Global Defines\r
-\r
- <strong>IO Type Qualifiers</strong> are used\r
- \li to specify the access to peripheral variables.\r
- \li for automatic generation of peripheral register debug information.\r
-*/\r
-#ifdef __cplusplus\r
- #define __I volatile /*!< Defines 'read only' permissions */\r
-#else\r
- #define __I volatile const /*!< Defines 'read only' permissions */\r
-#endif\r
-#define __O volatile /*!< Defines 'write only' permissions */\r
-#define __IO volatile /*!< Defines 'read / write' permissions */\r
-\r
-/*@} end of group Cortex_M3 */\r
-\r
-\r
-\r
-/*******************************************************************************\r
- * Register Abstraction\r
- Core Register contain:\r
- - Core Register\r
- - Core NVIC Register\r
- - Core SCB Register\r
- - Core SysTick Register\r
- - Core Debug Register\r
- - Core MPU Register\r
- ******************************************************************************/\r
-/** \defgroup CMSIS_core_register Defines and Type Definitions\r
- \brief Type definitions and defines for Cortex-M processor based devices.\r
-*/\r
-\r
-/** \ingroup CMSIS_core_register\r
- \defgroup CMSIS_CORE Status and Control Registers\r
- \brief Core Register type definitions.\r
- @{\r
- */\r
-\r
-/** \brief Union type to access the Application Program Status Register (APSR).\r
- */\r
-typedef union\r
-{\r
- struct\r
- {\r
-#if (__CORTEX_M != 0x04)\r
- uint32_t _reserved0:27; /*!< bit: 0..26 Reserved */\r
-#else\r
- uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */\r
- uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */\r
- uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */\r
-#endif\r
- uint32_t Q:1; /*!< bit: 27 Saturation condition flag */\r
- uint32_t V:1; /*!< bit: 28 Overflow condition code flag */\r
- uint32_t C:1; /*!< bit: 29 Carry condition code flag */\r
- uint32_t Z:1; /*!< bit: 30 Zero condition code flag */\r
- uint32_t N:1; /*!< bit: 31 Negative condition code flag */\r
- } b; /*!< Structure used for bit access */\r
- uint32_t w; /*!< Type used for word access */\r
-} APSR_Type;\r
-\r
-\r
-/** \brief Union type to access the Interrupt Program Status Register (IPSR).\r
- */\r
-typedef union\r
-{\r
- struct\r
- {\r
- uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */\r
- uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */\r
- } b; /*!< Structure used for bit access */\r
- uint32_t w; /*!< Type used for word access */\r
-} IPSR_Type;\r
-\r
-\r
-/** \brief Union type to access the Special-Purpose Program Status Registers (xPSR).\r
- */\r
-typedef union\r
-{\r
- struct\r
- {\r
- uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */\r
-#if (__CORTEX_M != 0x04)\r
- uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */\r
-#else\r
- uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */\r
- uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */\r
- uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */\r
-#endif\r
- uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */\r
- uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */\r
- uint32_t Q:1; /*!< bit: 27 Saturation condition flag */\r
- uint32_t V:1; /*!< bit: 28 Overflow condition code flag */\r
- uint32_t C:1; /*!< bit: 29 Carry condition code flag */\r
- uint32_t Z:1; /*!< bit: 30 Zero condition code flag */\r
- uint32_t N:1; /*!< bit: 31 Negative condition code flag */\r
- } b; /*!< Structure used for bit access */\r
- uint32_t w; /*!< Type used for word access */\r
-} xPSR_Type;\r
-\r
-\r
-/** \brief Union type to access the Control Registers (CONTROL).\r
- */\r
-typedef union\r
-{\r
- struct\r
- {\r
- uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */\r
- uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */\r
- uint32_t FPCA:1; /*!< bit: 2 FP extension active flag */\r
- uint32_t _reserved0:29; /*!< bit: 3..31 Reserved */\r
- } b; /*!< Structure used for bit access */\r
- uint32_t w; /*!< Type used for word access */\r
-} CONTROL_Type;\r
-\r
-/*@} end of group CMSIS_CORE */\r
-\r
-\r
-/** \ingroup CMSIS_core_register\r
- \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)\r
- \brief Type definitions for the NVIC Registers\r
- @{\r
- */\r
-\r
-/** \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).\r
- */\r
-typedef struct\r
-{\r
- __IO uint32_t ISER[8]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */\r
- uint32_t RESERVED0[24];\r
- __IO uint32_t ICER[8]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */\r
- uint32_t RSERVED1[24];\r
- __IO uint32_t ISPR[8]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */\r
- uint32_t RESERVED2[24];\r
- __IO uint32_t ICPR[8]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */\r
- uint32_t RESERVED3[24];\r
- __IO uint32_t IABR[8]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */\r
- uint32_t RESERVED4[56];\r
- __IO uint8_t IP[240]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */\r
- uint32_t RESERVED5[644];\r
- __O uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */\r
-} NVIC_Type;\r
-\r
-/* Software Triggered Interrupt Register Definitions */\r
-#define NVIC_STIR_INTID_Pos 0 /*!< STIR: INTLINESNUM Position */\r
-#define NVIC_STIR_INTID_Msk (0x1FFUL << NVIC_STIR_INTID_Pos) /*!< STIR: INTLINESNUM Mask */\r
-\r
-/*@} end of group CMSIS_NVIC */\r
-\r
-\r
-/** \ingroup CMSIS_core_register\r
- \defgroup CMSIS_SCB System Control Block (SCB)\r
- \brief Type definitions for the System Control Block Registers\r
- @{\r
- */\r
-\r
-/** \brief Structure type to access the System Control Block (SCB).\r
- */\r
-typedef struct\r
-{\r
- __I uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */\r
- __IO uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */\r
- __IO uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */\r
- __IO uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */\r
- __IO uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */\r
- __IO uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */\r
- __IO uint8_t SHP[12]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */\r
- __IO uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */\r
- __IO uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */\r
- __IO uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */\r
- __IO uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */\r
- __IO uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */\r
- __IO uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */\r
- __IO uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */\r
- __I uint32_t PFR[2]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */\r
- __I uint32_t DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */\r
- __I uint32_t ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */\r
- __I uint32_t MMFR[4]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */\r
- __I uint32_t ISAR[5]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */\r
- uint32_t RESERVED0[5];\r
- __IO uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */\r
-} SCB_Type;\r
-\r
-/* SCB CPUID Register Definitions */\r
-#define SCB_CPUID_IMPLEMENTER_Pos 24 /*!< SCB CPUID: IMPLEMENTER Position */\r
-#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */\r
-\r
-#define SCB_CPUID_VARIANT_Pos 20 /*!< SCB CPUID: VARIANT Position */\r
-#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */\r
-\r
-#define SCB_CPUID_ARCHITECTURE_Pos 16 /*!< SCB CPUID: ARCHITECTURE Position */\r
-#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */\r
-\r
-#define SCB_CPUID_PARTNO_Pos 4 /*!< SCB CPUID: PARTNO Position */\r
-#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */\r
-\r
-#define SCB_CPUID_REVISION_Pos 0 /*!< SCB CPUID: REVISION Position */\r
-#define SCB_CPUID_REVISION_Msk (0xFUL << SCB_CPUID_REVISION_Pos) /*!< SCB CPUID: REVISION Mask */\r
-\r
-/* SCB Interrupt Control State Register Definitions */\r
-#define SCB_ICSR_NMIPENDSET_Pos 31 /*!< SCB ICSR: NMIPENDSET Position */\r
-#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */\r
-\r
-#define SCB_ICSR_PENDSVSET_Pos 28 /*!< SCB ICSR: PENDSVSET Position */\r
-#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */\r
-\r
-#define SCB_ICSR_PENDSVCLR_Pos 27 /*!< SCB ICSR: PENDSVCLR Position */\r
-#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */\r
-\r
-#define SCB_ICSR_PENDSTSET_Pos 26 /*!< SCB ICSR: PENDSTSET Position */\r
-#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */\r
-\r
-#define SCB_ICSR_PENDSTCLR_Pos 25 /*!< SCB ICSR: PENDSTCLR Position */\r
-#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */\r
-\r
-#define SCB_ICSR_ISRPREEMPT_Pos 23 /*!< SCB ICSR: ISRPREEMPT Position */\r
-#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */\r
-\r
-#define SCB_ICSR_ISRPENDING_Pos 22 /*!< SCB ICSR: ISRPENDING Position */\r
-#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */\r
-\r
-#define SCB_ICSR_VECTPENDING_Pos 12 /*!< SCB ICSR: VECTPENDING Position */\r
-#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */\r
-\r
-#define SCB_ICSR_RETTOBASE_Pos 11 /*!< SCB ICSR: RETTOBASE Position */\r
-#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */\r
-\r
-#define SCB_ICSR_VECTACTIVE_Pos 0 /*!< SCB ICSR: VECTACTIVE Position */\r
-#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL << SCB_ICSR_VECTACTIVE_Pos) /*!< SCB ICSR: VECTACTIVE Mask */\r
-\r
-/* SCB Vector Table Offset Register Definitions */\r
-#if (__CM3_REV < 0x0201) /* core r2p1 */\r
-#define SCB_VTOR_TBLBASE_Pos 29 /*!< SCB VTOR: TBLBASE Position */\r
-#define SCB_VTOR_TBLBASE_Msk (1UL << SCB_VTOR_TBLBASE_Pos) /*!< SCB VTOR: TBLBASE Mask */\r
-\r
-#define SCB_VTOR_TBLOFF_Pos 7 /*!< SCB VTOR: TBLOFF Position */\r
-#define SCB_VTOR_TBLOFF_Msk (0x3FFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */\r
-#else\r
-#define SCB_VTOR_TBLOFF_Pos 7 /*!< SCB VTOR: TBLOFF Position */\r
-#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */\r
-#endif\r
-\r
-/* SCB Application Interrupt and Reset Control Register Definitions */\r
-#define SCB_AIRCR_VECTKEY_Pos 16 /*!< SCB AIRCR: VECTKEY Position */\r
-#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */\r
-\r
-#define SCB_AIRCR_VECTKEYSTAT_Pos 16 /*!< SCB AIRCR: VECTKEYSTAT Position */\r
-#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */\r
-\r
-#define SCB_AIRCR_ENDIANESS_Pos 15 /*!< SCB AIRCR: ENDIANESS Position */\r
-#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */\r
-\r
-#define SCB_AIRCR_PRIGROUP_Pos 8 /*!< SCB AIRCR: PRIGROUP Position */\r
-#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */\r
-\r
-#define SCB_AIRCR_SYSRESETREQ_Pos 2 /*!< SCB AIRCR: SYSRESETREQ Position */\r
-#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */\r
-\r
-#define SCB_AIRCR_VECTCLRACTIVE_Pos 1 /*!< SCB AIRCR: VECTCLRACTIVE Position */\r
-#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */\r
-\r
-#define SCB_AIRCR_VECTRESET_Pos 0 /*!< SCB AIRCR: VECTRESET Position */\r
-#define SCB_AIRCR_VECTRESET_Msk (1UL << SCB_AIRCR_VECTRESET_Pos) /*!< SCB AIRCR: VECTRESET Mask */\r
-\r
-/* SCB System Control Register Definitions */\r
-#define SCB_SCR_SEVONPEND_Pos 4 /*!< SCB SCR: SEVONPEND Position */\r
-#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */\r
-\r
-#define SCB_SCR_SLEEPDEEP_Pos 2 /*!< SCB SCR: SLEEPDEEP Position */\r
-#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */\r
-\r
-#define SCB_SCR_SLEEPONEXIT_Pos 1 /*!< SCB SCR: SLEEPONEXIT Position */\r
-#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */\r
-\r
-/* SCB Configuration Control Register Definitions */\r
-#define SCB_CCR_STKALIGN_Pos 9 /*!< SCB CCR: STKALIGN Position */\r
-#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */\r
-\r
-#define SCB_CCR_BFHFNMIGN_Pos 8 /*!< SCB CCR: BFHFNMIGN Position */\r
-#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */\r
-\r
-#define SCB_CCR_DIV_0_TRP_Pos 4 /*!< SCB CCR: DIV_0_TRP Position */\r
-#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */\r
-\r
-#define SCB_CCR_UNALIGN_TRP_Pos 3 /*!< SCB CCR: UNALIGN_TRP Position */\r
-#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */\r
-\r
-#define SCB_CCR_USERSETMPEND_Pos 1 /*!< SCB CCR: USERSETMPEND Position */\r
-#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */\r
-\r
-#define SCB_CCR_NONBASETHRDENA_Pos 0 /*!< SCB CCR: NONBASETHRDENA Position */\r
-#define SCB_CCR_NONBASETHRDENA_Msk (1UL << SCB_CCR_NONBASETHRDENA_Pos) /*!< SCB CCR: NONBASETHRDENA Mask */\r
-\r
-/* SCB System Handler Control and State Register Definitions */\r
-#define SCB_SHCSR_USGFAULTENA_Pos 18 /*!< SCB SHCSR: USGFAULTENA Position */\r
-#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */\r
-\r
-#define SCB_SHCSR_BUSFAULTENA_Pos 17 /*!< SCB SHCSR: BUSFAULTENA Position */\r
-#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */\r
-\r
-#define SCB_SHCSR_MEMFAULTENA_Pos 16 /*!< SCB SHCSR: MEMFAULTENA Position */\r
-#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */\r
-\r
-#define SCB_SHCSR_SVCALLPENDED_Pos 15 /*!< SCB SHCSR: SVCALLPENDED Position */\r
-#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */\r
-\r
-#define SCB_SHCSR_BUSFAULTPENDED_Pos 14 /*!< SCB SHCSR: BUSFAULTPENDED Position */\r
-#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */\r
-\r
-#define SCB_SHCSR_MEMFAULTPENDED_Pos 13 /*!< SCB SHCSR: MEMFAULTPENDED Position */\r
-#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */\r
-\r
-#define SCB_SHCSR_USGFAULTPENDED_Pos 12 /*!< SCB SHCSR: USGFAULTPENDED Position */\r
-#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */\r
-\r
-#define SCB_SHCSR_SYSTICKACT_Pos 11 /*!< SCB SHCSR: SYSTICKACT Position */\r
-#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */\r
-\r
-#define SCB_SHCSR_PENDSVACT_Pos 10 /*!< SCB SHCSR: PENDSVACT Position */\r
-#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */\r
-\r
-#define SCB_SHCSR_MONITORACT_Pos 8 /*!< SCB SHCSR: MONITORACT Position */\r
-#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */\r
-\r
-#define SCB_SHCSR_SVCALLACT_Pos 7 /*!< SCB SHCSR: SVCALLACT Position */\r
-#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */\r
-\r
-#define SCB_SHCSR_USGFAULTACT_Pos 3 /*!< SCB SHCSR: USGFAULTACT Position */\r
-#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */\r
-\r
-#define SCB_SHCSR_BUSFAULTACT_Pos 1 /*!< SCB SHCSR: BUSFAULTACT Position */\r
-#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */\r
-\r
-#define SCB_SHCSR_MEMFAULTACT_Pos 0 /*!< SCB SHCSR: MEMFAULTACT Position */\r
-#define SCB_SHCSR_MEMFAULTACT_Msk (1UL << SCB_SHCSR_MEMFAULTACT_Pos) /*!< SCB SHCSR: MEMFAULTACT Mask */\r
-\r
-/* SCB Configurable Fault Status Registers Definitions */\r
-#define SCB_CFSR_USGFAULTSR_Pos 16 /*!< SCB CFSR: Usage Fault Status Register Position */\r
-#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */\r
-\r
-#define SCB_CFSR_BUSFAULTSR_Pos 8 /*!< SCB CFSR: Bus Fault Status Register Position */\r
-#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */\r
-\r
-#define SCB_CFSR_MEMFAULTSR_Pos 0 /*!< SCB CFSR: Memory Manage Fault Status Register Position */\r
-#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL << SCB_CFSR_MEMFAULTSR_Pos) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */\r
-\r
-/* SCB Hard Fault Status Registers Definitions */\r
-#define SCB_HFSR_DEBUGEVT_Pos 31 /*!< SCB HFSR: DEBUGEVT Position */\r
-#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */\r
-\r
-#define SCB_HFSR_FORCED_Pos 30 /*!< SCB HFSR: FORCED Position */\r
-#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */\r
-\r
-#define SCB_HFSR_VECTTBL_Pos 1 /*!< SCB HFSR: VECTTBL Position */\r
-#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */\r
-\r
-/* SCB Debug Fault Status Register Definitions */\r
-#define SCB_DFSR_EXTERNAL_Pos 4 /*!< SCB DFSR: EXTERNAL Position */\r
-#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */\r
-\r
-#define SCB_DFSR_VCATCH_Pos 3 /*!< SCB DFSR: VCATCH Position */\r
-#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */\r
-\r
-#define SCB_DFSR_DWTTRAP_Pos 2 /*!< SCB DFSR: DWTTRAP Position */\r
-#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */\r
-\r
-#define SCB_DFSR_BKPT_Pos 1 /*!< SCB DFSR: BKPT Position */\r
-#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */\r
-\r
-#define SCB_DFSR_HALTED_Pos 0 /*!< SCB DFSR: HALTED Position */\r
-#define SCB_DFSR_HALTED_Msk (1UL << SCB_DFSR_HALTED_Pos) /*!< SCB DFSR: HALTED Mask */\r
-\r
-/*@} end of group CMSIS_SCB */\r
-\r
-\r
-/** \ingroup CMSIS_core_register\r
- \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)\r
- \brief Type definitions for the System Control and ID Register not in the SCB\r
- @{\r
- */\r
-\r
-/** \brief Structure type to access the System Control and ID Register not in the SCB.\r
- */\r
-typedef struct\r
-{\r
- uint32_t RESERVED0[1];\r
- __I uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */\r
-#if ((defined __CM3_REV) && (__CM3_REV >= 0x200))\r
- __IO uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */\r
-#else\r
- uint32_t RESERVED1[1];\r
-#endif\r
-} SCnSCB_Type;\r
-\r
-/* Interrupt Controller Type Register Definitions */\r
-#define SCnSCB_ICTR_INTLINESNUM_Pos 0 /*!< ICTR: INTLINESNUM Position */\r
-#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL << SCnSCB_ICTR_INTLINESNUM_Pos) /*!< ICTR: INTLINESNUM Mask */\r
-\r
-/* Auxiliary Control Register Definitions */\r
-\r
-#define SCnSCB_ACTLR_DISFOLD_Pos 2 /*!< ACTLR: DISFOLD Position */\r
-#define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos) /*!< ACTLR: DISFOLD Mask */\r
-\r
-#define SCnSCB_ACTLR_DISDEFWBUF_Pos 1 /*!< ACTLR: DISDEFWBUF Position */\r
-#define SCnSCB_ACTLR_DISDEFWBUF_Msk (1UL << SCnSCB_ACTLR_DISDEFWBUF_Pos) /*!< ACTLR: DISDEFWBUF Mask */\r
-\r
-#define SCnSCB_ACTLR_DISMCYCINT_Pos 0 /*!< ACTLR: DISMCYCINT Position */\r
-#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL << SCnSCB_ACTLR_DISMCYCINT_Pos) /*!< ACTLR: DISMCYCINT Mask */\r
-\r
-/*@} end of group CMSIS_SCnotSCB */\r
-\r
-\r
-/** \ingroup CMSIS_core_register\r
- \defgroup CMSIS_SysTick System Tick Timer (SysTick)\r
- \brief Type definitions for the System Timer Registers.\r
- @{\r
- */\r
-\r
-/** \brief Structure type to access the System Timer (SysTick).\r
- */\r
-typedef struct\r
-{\r
- __IO uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */\r
- __IO uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */\r
- __IO uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */\r
- __I uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */\r
-} SysTick_Type;\r
-\r
-/* SysTick Control / Status Register Definitions */\r
-#define SysTick_CTRL_COUNTFLAG_Pos 16 /*!< SysTick CTRL: COUNTFLAG Position */\r
-#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */\r
-\r
-#define SysTick_CTRL_CLKSOURCE_Pos 2 /*!< SysTick CTRL: CLKSOURCE Position */\r
-#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */\r
-\r
-#define SysTick_CTRL_TICKINT_Pos 1 /*!< SysTick CTRL: TICKINT Position */\r
-#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */\r
-\r
-#define SysTick_CTRL_ENABLE_Pos 0 /*!< SysTick CTRL: ENABLE Position */\r
-#define SysTick_CTRL_ENABLE_Msk (1UL << SysTick_CTRL_ENABLE_Pos) /*!< SysTick CTRL: ENABLE Mask */\r
-\r
-/* SysTick Reload Register Definitions */\r
-#define SysTick_LOAD_RELOAD_Pos 0 /*!< SysTick LOAD: RELOAD Position */\r
-#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL << SysTick_LOAD_RELOAD_Pos) /*!< SysTick LOAD: RELOAD Mask */\r
-\r
-/* SysTick Current Register Definitions */\r
-#define SysTick_VAL_CURRENT_Pos 0 /*!< SysTick VAL: CURRENT Position */\r
-#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos) /*!< SysTick VAL: CURRENT Mask */\r
-\r
-/* SysTick Calibration Register Definitions */\r
-#define SysTick_CALIB_NOREF_Pos 31 /*!< SysTick CALIB: NOREF Position */\r
-#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */\r
-\r
-#define SysTick_CALIB_SKEW_Pos 30 /*!< SysTick CALIB: SKEW Position */\r
-#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */\r
-\r
-#define SysTick_CALIB_TENMS_Pos 0 /*!< SysTick CALIB: TENMS Position */\r
-#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos) /*!< SysTick CALIB: TENMS Mask */\r
-\r
-/*@} end of group CMSIS_SysTick */\r
-\r
-\r
-/** \ingroup CMSIS_core_register\r
- \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM)\r
- \brief Type definitions for the Instrumentation Trace Macrocell (ITM)\r
- @{\r
- */\r
-\r
-/** \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM).\r
- */\r
-typedef struct\r
-{\r
- __O union\r
- {\r
- __O uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */\r
- __O uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */\r
- __O uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */\r
- } PORT [32]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */\r
- uint32_t RESERVED0[864];\r
- __IO uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */\r
- uint32_t RESERVED1[15];\r
- __IO uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */\r
- uint32_t RESERVED2[15];\r
- __IO uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */\r
-} ITM_Type;\r
-\r
-/* ITM Trace Privilege Register Definitions */\r
-#define ITM_TPR_PRIVMASK_Pos 0 /*!< ITM TPR: PRIVMASK Position */\r
-#define ITM_TPR_PRIVMASK_Msk (0xFUL << ITM_TPR_PRIVMASK_Pos) /*!< ITM TPR: PRIVMASK Mask */\r
-\r
-/* ITM Trace Control Register Definitions */\r
-#define ITM_TCR_BUSY_Pos 23 /*!< ITM TCR: BUSY Position */\r
-#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */\r
-\r
-#define ITM_TCR_TraceBusID_Pos 16 /*!< ITM TCR: ATBID Position */\r
-#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */\r
-\r
-#define ITM_TCR_GTSFREQ_Pos 10 /*!< ITM TCR: Global timestamp frequency Position */\r
-#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */\r
-\r
-#define ITM_TCR_TSPrescale_Pos 8 /*!< ITM TCR: TSPrescale Position */\r
-#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */\r
-\r
-#define ITM_TCR_SWOENA_Pos 4 /*!< ITM TCR: SWOENA Position */\r
-#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */\r
-\r
-#define ITM_TCR_TXENA_Pos 3 /*!< ITM TCR: TXENA Position */\r
-#define ITM_TCR_TXENA_Msk (1UL << ITM_TCR_TXENA_Pos) /*!< ITM TCR: TXENA Mask */\r
-\r
-#define ITM_TCR_SYNCENA_Pos 2 /*!< ITM TCR: SYNCENA Position */\r
-#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */\r
-\r
-#define ITM_TCR_TSENA_Pos 1 /*!< ITM TCR: TSENA Position */\r
-#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */\r
-\r
-#define ITM_TCR_ITMENA_Pos 0 /*!< ITM TCR: ITM Enable bit Position */\r
-#define ITM_TCR_ITMENA_Msk (1UL << ITM_TCR_ITMENA_Pos) /*!< ITM TCR: ITM Enable bit Mask */\r
-\r
-/*@}*/ /* end of group CMSIS_ITM */\r
-\r
-\r
-/** \ingroup CMSIS_core_register\r
- \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)\r
- \brief Type definitions for the Data Watchpoint and Trace (DWT)\r
- @{\r
- */\r
-\r
-/** \brief Structure type to access the Data Watchpoint and Trace Register (DWT).\r
- */\r
-typedef struct\r
-{\r
- __IO uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */\r
- __IO uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */\r
- __IO uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */\r
- __IO uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */\r
- __IO uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */\r
- __IO uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */\r
- __IO uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */\r
- __I uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */\r
- __IO uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */\r
- __IO uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */\r
- __IO uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */\r
- uint32_t RESERVED0[1];\r
- __IO uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */\r
- __IO uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */\r
- __IO uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */\r
- uint32_t RESERVED1[1];\r
- __IO uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */\r
- __IO uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */\r
- __IO uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */\r
- uint32_t RESERVED2[1];\r
- __IO uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */\r
- __IO uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */\r
- __IO uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */\r
-} DWT_Type;\r
-\r
-/* DWT Control Register Definitions */\r
-#define DWT_CTRL_NUMCOMP_Pos 28 /*!< DWT CTRL: NUMCOMP Position */\r
-#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */\r
-\r
-#define DWT_CTRL_NOTRCPKT_Pos 27 /*!< DWT CTRL: NOTRCPKT Position */\r
-#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */\r
-\r
-#define DWT_CTRL_NOEXTTRIG_Pos 26 /*!< DWT CTRL: NOEXTTRIG Position */\r
-#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */\r
-\r
-#define DWT_CTRL_NOCYCCNT_Pos 25 /*!< DWT CTRL: NOCYCCNT Position */\r
-#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */\r
-\r
-#define DWT_CTRL_NOPRFCNT_Pos 24 /*!< DWT CTRL: NOPRFCNT Position */\r
-#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */\r
-\r
-#define DWT_CTRL_CYCEVTENA_Pos 22 /*!< DWT CTRL: CYCEVTENA Position */\r
-#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */\r
-\r
-#define DWT_CTRL_FOLDEVTENA_Pos 21 /*!< DWT CTRL: FOLDEVTENA Position */\r
-#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */\r
-\r
-#define DWT_CTRL_LSUEVTENA_Pos 20 /*!< DWT CTRL: LSUEVTENA Position */\r
-#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */\r
-\r
-#define DWT_CTRL_SLEEPEVTENA_Pos 19 /*!< DWT CTRL: SLEEPEVTENA Position */\r
-#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */\r
-\r
-#define DWT_CTRL_EXCEVTENA_Pos 18 /*!< DWT CTRL: EXCEVTENA Position */\r
-#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */\r
-\r
-#define DWT_CTRL_CPIEVTENA_Pos 17 /*!< DWT CTRL: CPIEVTENA Position */\r
-#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */\r
-\r
-#define DWT_CTRL_EXCTRCENA_Pos 16 /*!< DWT CTRL: EXCTRCENA Position */\r
-#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */\r
-\r
-#define DWT_CTRL_PCSAMPLENA_Pos 12 /*!< DWT CTRL: PCSAMPLENA Position */\r
-#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */\r
-\r
-#define DWT_CTRL_SYNCTAP_Pos 10 /*!< DWT CTRL: SYNCTAP Position */\r
-#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */\r
-\r
-#define DWT_CTRL_CYCTAP_Pos 9 /*!< DWT CTRL: CYCTAP Position */\r
-#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */\r
-\r
-#define DWT_CTRL_POSTINIT_Pos 5 /*!< DWT CTRL: POSTINIT Position */\r
-#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */\r
-\r
-#define DWT_CTRL_POSTPRESET_Pos 1 /*!< DWT CTRL: POSTPRESET Position */\r
-#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */\r
-\r
-#define DWT_CTRL_CYCCNTENA_Pos 0 /*!< DWT CTRL: CYCCNTENA Position */\r
-#define DWT_CTRL_CYCCNTENA_Msk (0x1UL << DWT_CTRL_CYCCNTENA_Pos) /*!< DWT CTRL: CYCCNTENA Mask */\r
-\r
-/* DWT CPI Count Register Definitions */\r
-#define DWT_CPICNT_CPICNT_Pos 0 /*!< DWT CPICNT: CPICNT Position */\r
-#define DWT_CPICNT_CPICNT_Msk (0xFFUL << DWT_CPICNT_CPICNT_Pos) /*!< DWT CPICNT: CPICNT Mask */\r
-\r
-/* DWT Exception Overhead Count Register Definitions */\r
-#define DWT_EXCCNT_EXCCNT_Pos 0 /*!< DWT EXCCNT: EXCCNT Position */\r
-#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL << DWT_EXCCNT_EXCCNT_Pos) /*!< DWT EXCCNT: EXCCNT Mask */\r
-\r
-/* DWT Sleep Count Register Definitions */\r
-#define DWT_SLEEPCNT_SLEEPCNT_Pos 0 /*!< DWT SLEEPCNT: SLEEPCNT Position */\r
-#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL << DWT_SLEEPCNT_SLEEPCNT_Pos) /*!< DWT SLEEPCNT: SLEEPCNT Mask */\r
-\r
-/* DWT LSU Count Register Definitions */\r
-#define DWT_LSUCNT_LSUCNT_Pos 0 /*!< DWT LSUCNT: LSUCNT Position */\r
-#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL << DWT_LSUCNT_LSUCNT_Pos) /*!< DWT LSUCNT: LSUCNT Mask */\r
-\r
-/* DWT Folded-instruction Count Register Definitions */\r
-#define DWT_FOLDCNT_FOLDCNT_Pos 0 /*!< DWT FOLDCNT: FOLDCNT Position */\r
-#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL << DWT_FOLDCNT_FOLDCNT_Pos) /*!< DWT FOLDCNT: FOLDCNT Mask */\r
-\r
-/* DWT Comparator Mask Register Definitions */\r
-#define DWT_MASK_MASK_Pos 0 /*!< DWT MASK: MASK Position */\r
-#define DWT_MASK_MASK_Msk (0x1FUL << DWT_MASK_MASK_Pos) /*!< DWT MASK: MASK Mask */\r
-\r
-/* DWT Comparator Function Register Definitions */\r
-#define DWT_FUNCTION_MATCHED_Pos 24 /*!< DWT FUNCTION: MATCHED Position */\r
-#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */\r
-\r
-#define DWT_FUNCTION_DATAVADDR1_Pos 16 /*!< DWT FUNCTION: DATAVADDR1 Position */\r
-#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */\r
-\r
-#define DWT_FUNCTION_DATAVADDR0_Pos 12 /*!< DWT FUNCTION: DATAVADDR0 Position */\r
-#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */\r
-\r
-#define DWT_FUNCTION_DATAVSIZE_Pos 10 /*!< DWT FUNCTION: DATAVSIZE Position */\r
-#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */\r
-\r
-#define DWT_FUNCTION_LNK1ENA_Pos 9 /*!< DWT FUNCTION: LNK1ENA Position */\r
-#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */\r
-\r
-#define DWT_FUNCTION_DATAVMATCH_Pos 8 /*!< DWT FUNCTION: DATAVMATCH Position */\r
-#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */\r
-\r
-#define DWT_FUNCTION_CYCMATCH_Pos 7 /*!< DWT FUNCTION: CYCMATCH Position */\r
-#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */\r
-\r
-#define DWT_FUNCTION_EMITRANGE_Pos 5 /*!< DWT FUNCTION: EMITRANGE Position */\r
-#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */\r
-\r
-#define DWT_FUNCTION_FUNCTION_Pos 0 /*!< DWT FUNCTION: FUNCTION Position */\r
-#define DWT_FUNCTION_FUNCTION_Msk (0xFUL << DWT_FUNCTION_FUNCTION_Pos) /*!< DWT FUNCTION: FUNCTION Mask */\r
-\r
-/*@}*/ /* end of group CMSIS_DWT */\r
-\r
-\r
-/** \ingroup CMSIS_core_register\r
- \defgroup CMSIS_TPI Trace Port Interface (TPI)\r
- \brief Type definitions for the Trace Port Interface (TPI)\r
- @{\r
- */\r
-\r
-/** \brief Structure type to access the Trace Port Interface Register (TPI).\r
- */\r
-typedef struct\r
-{\r
- __IO uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */\r
- __IO uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */\r
- uint32_t RESERVED0[2];\r
- __IO uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */\r
- uint32_t RESERVED1[55];\r
- __IO uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */\r
- uint32_t RESERVED2[131];\r
- __I uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */\r
- __IO uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */\r
- __I uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */\r
- uint32_t RESERVED3[759];\r
- __I uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER */\r
- __I uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */\r
- __I uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */\r
- uint32_t RESERVED4[1];\r
- __I uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */\r
- __I uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */\r
- __IO uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */\r
- uint32_t RESERVED5[39];\r
- __IO uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */\r
- __IO uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */\r
- uint32_t RESERVED7[8];\r
- __I uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */\r
- __I uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */\r
-} TPI_Type;\r
-\r
-/* TPI Asynchronous Clock Prescaler Register Definitions */\r
-#define TPI_ACPR_PRESCALER_Pos 0 /*!< TPI ACPR: PRESCALER Position */\r
-#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL << TPI_ACPR_PRESCALER_Pos) /*!< TPI ACPR: PRESCALER Mask */\r
-\r
-/* TPI Selected Pin Protocol Register Definitions */\r
-#define TPI_SPPR_TXMODE_Pos 0 /*!< TPI SPPR: TXMODE Position */\r
-#define TPI_SPPR_TXMODE_Msk (0x3UL << TPI_SPPR_TXMODE_Pos) /*!< TPI SPPR: TXMODE Mask */\r
-\r
-/* TPI Formatter and Flush Status Register Definitions */\r
-#define TPI_FFSR_FtNonStop_Pos 3 /*!< TPI FFSR: FtNonStop Position */\r
-#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */\r
-\r
-#define TPI_FFSR_TCPresent_Pos 2 /*!< TPI FFSR: TCPresent Position */\r
-#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */\r
-\r
-#define TPI_FFSR_FtStopped_Pos 1 /*!< TPI FFSR: FtStopped Position */\r
-#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */\r
-\r
-#define TPI_FFSR_FlInProg_Pos 0 /*!< TPI FFSR: FlInProg Position */\r
-#define TPI_FFSR_FlInProg_Msk (0x1UL << TPI_FFSR_FlInProg_Pos) /*!< TPI FFSR: FlInProg Mask */\r
-\r
-/* TPI Formatter and Flush Control Register Definitions */\r
-#define TPI_FFCR_TrigIn_Pos 8 /*!< TPI FFCR: TrigIn Position */\r
-#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */\r
-\r
-#define TPI_FFCR_EnFCont_Pos 1 /*!< TPI FFCR: EnFCont Position */\r
-#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */\r
-\r
-/* TPI TRIGGER Register Definitions */\r
-#define TPI_TRIGGER_TRIGGER_Pos 0 /*!< TPI TRIGGER: TRIGGER Position */\r
-#define TPI_TRIGGER_TRIGGER_Msk (0x1UL << TPI_TRIGGER_TRIGGER_Pos) /*!< TPI TRIGGER: TRIGGER Mask */\r
-\r
-/* TPI Integration ETM Data Register Definitions (FIFO0) */\r
-#define TPI_FIFO0_ITM_ATVALID_Pos 29 /*!< TPI FIFO0: ITM_ATVALID Position */\r
-#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */\r
-\r
-#define TPI_FIFO0_ITM_bytecount_Pos 27 /*!< TPI FIFO0: ITM_bytecount Position */\r
-#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */\r
-\r
-#define TPI_FIFO0_ETM_ATVALID_Pos 26 /*!< TPI FIFO0: ETM_ATVALID Position */\r
-#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */\r
-\r
-#define TPI_FIFO0_ETM_bytecount_Pos 24 /*!< TPI FIFO0: ETM_bytecount Position */\r
-#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */\r
-\r
-#define TPI_FIFO0_ETM2_Pos 16 /*!< TPI FIFO0: ETM2 Position */\r
-#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */\r
-\r
-#define TPI_FIFO0_ETM1_Pos 8 /*!< TPI FIFO0: ETM1 Position */\r
-#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */\r
-\r
-#define TPI_FIFO0_ETM0_Pos 0 /*!< TPI FIFO0: ETM0 Position */\r
-#define TPI_FIFO0_ETM0_Msk (0xFFUL << TPI_FIFO0_ETM0_Pos) /*!< TPI FIFO0: ETM0 Mask */\r
-\r
-/* TPI ITATBCTR2 Register Definitions */\r
-#define TPI_ITATBCTR2_ATREADY_Pos 0 /*!< TPI ITATBCTR2: ATREADY Position */\r
-#define TPI_ITATBCTR2_ATREADY_Msk (0x1UL << TPI_ITATBCTR2_ATREADY_Pos) /*!< TPI ITATBCTR2: ATREADY Mask */\r
-\r
-/* TPI Integration ITM Data Register Definitions (FIFO1) */\r
-#define TPI_FIFO1_ITM_ATVALID_Pos 29 /*!< TPI FIFO1: ITM_ATVALID Position */\r
-#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */\r
-\r
-#define TPI_FIFO1_ITM_bytecount_Pos 27 /*!< TPI FIFO1: ITM_bytecount Position */\r
-#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */\r
-\r
-#define TPI_FIFO1_ETM_ATVALID_Pos 26 /*!< TPI FIFO1: ETM_ATVALID Position */\r
-#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */\r
-\r
-#define TPI_FIFO1_ETM_bytecount_Pos 24 /*!< TPI FIFO1: ETM_bytecount Position */\r
-#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */\r
-\r
-#define TPI_FIFO1_ITM2_Pos 16 /*!< TPI FIFO1: ITM2 Position */\r
-#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */\r
-\r
-#define TPI_FIFO1_ITM1_Pos 8 /*!< TPI FIFO1: ITM1 Position */\r
-#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */\r
-\r
-#define TPI_FIFO1_ITM0_Pos 0 /*!< TPI FIFO1: ITM0 Position */\r
-#define TPI_FIFO1_ITM0_Msk (0xFFUL << TPI_FIFO1_ITM0_Pos) /*!< TPI FIFO1: ITM0 Mask */\r
-\r
-/* TPI ITATBCTR0 Register Definitions */\r
-#define TPI_ITATBCTR0_ATREADY_Pos 0 /*!< TPI ITATBCTR0: ATREADY Position */\r
-#define TPI_ITATBCTR0_ATREADY_Msk (0x1UL << TPI_ITATBCTR0_ATREADY_Pos) /*!< TPI ITATBCTR0: ATREADY Mask */\r
-\r
-/* TPI Integration Mode Control Register Definitions */\r
-#define TPI_ITCTRL_Mode_Pos 0 /*!< TPI ITCTRL: Mode Position */\r
-#define TPI_ITCTRL_Mode_Msk (0x1UL << TPI_ITCTRL_Mode_Pos) /*!< TPI ITCTRL: Mode Mask */\r
-\r
-/* TPI DEVID Register Definitions */\r
-#define TPI_DEVID_NRZVALID_Pos 11 /*!< TPI DEVID: NRZVALID Position */\r
-#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */\r
-\r
-#define TPI_DEVID_MANCVALID_Pos 10 /*!< TPI DEVID: MANCVALID Position */\r
-#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */\r
-\r
-#define TPI_DEVID_PTINVALID_Pos 9 /*!< TPI DEVID: PTINVALID Position */\r
-#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */\r
-\r
-#define TPI_DEVID_MinBufSz_Pos 6 /*!< TPI DEVID: MinBufSz Position */\r
-#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */\r
-\r
-#define TPI_DEVID_AsynClkIn_Pos 5 /*!< TPI DEVID: AsynClkIn Position */\r
-#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */\r
-\r
-#define TPI_DEVID_NrTraceInput_Pos 0 /*!< TPI DEVID: NrTraceInput Position */\r
-#define TPI_DEVID_NrTraceInput_Msk (0x1FUL << TPI_DEVID_NrTraceInput_Pos) /*!< TPI DEVID: NrTraceInput Mask */\r
-\r
-/* TPI DEVTYPE Register Definitions */\r
-#define TPI_DEVTYPE_SubType_Pos 0 /*!< TPI DEVTYPE: SubType Position */\r
-#define TPI_DEVTYPE_SubType_Msk (0xFUL << TPI_DEVTYPE_SubType_Pos) /*!< TPI DEVTYPE: SubType Mask */\r
-\r
-#define TPI_DEVTYPE_MajorType_Pos 4 /*!< TPI DEVTYPE: MajorType Position */\r
-#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */\r
-\r
-/*@}*/ /* end of group CMSIS_TPI */\r
-\r
-\r
-#if (__MPU_PRESENT == 1)\r
-/** \ingroup CMSIS_core_register\r
- \defgroup CMSIS_MPU Memory Protection Unit (MPU)\r
- \brief Type definitions for the Memory Protection Unit (MPU)\r
- @{\r
- */\r
-\r
-/** \brief Structure type to access the Memory Protection Unit (MPU).\r
- */\r
-typedef struct\r
-{\r
- __I uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */\r
- __IO uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */\r
- __IO uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */\r
- __IO uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */\r
- __IO uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */\r
- __IO uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */\r
- __IO uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */\r
- __IO uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */\r
- __IO uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */\r
- __IO uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */\r
- __IO uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */\r
-} MPU_Type;\r
-\r
-/* MPU Type Register */\r
-#define MPU_TYPE_IREGION_Pos 16 /*!< MPU TYPE: IREGION Position */\r
-#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */\r
-\r
-#define MPU_TYPE_DREGION_Pos 8 /*!< MPU TYPE: DREGION Position */\r
-#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */\r
-\r
-#define MPU_TYPE_SEPARATE_Pos 0 /*!< MPU TYPE: SEPARATE Position */\r
-#define MPU_TYPE_SEPARATE_Msk (1UL << MPU_TYPE_SEPARATE_Pos) /*!< MPU TYPE: SEPARATE Mask */\r
-\r
-/* MPU Control Register */\r
-#define MPU_CTRL_PRIVDEFENA_Pos 2 /*!< MPU CTRL: PRIVDEFENA Position */\r
-#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */\r
-\r
-#define MPU_CTRL_HFNMIENA_Pos 1 /*!< MPU CTRL: HFNMIENA Position */\r
-#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */\r
-\r
-#define MPU_CTRL_ENABLE_Pos 0 /*!< MPU CTRL: ENABLE Position */\r
-#define MPU_CTRL_ENABLE_Msk (1UL << MPU_CTRL_ENABLE_Pos) /*!< MPU CTRL: ENABLE Mask */\r
-\r
-/* MPU Region Number Register */\r
-#define MPU_RNR_REGION_Pos 0 /*!< MPU RNR: REGION Position */\r
-#define MPU_RNR_REGION_Msk (0xFFUL << MPU_RNR_REGION_Pos) /*!< MPU RNR: REGION Mask */\r
-\r
-/* MPU Region Base Address Register */\r
-#define MPU_RBAR_ADDR_Pos 5 /*!< MPU RBAR: ADDR Position */\r
-#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */\r
-\r
-#define MPU_RBAR_VALID_Pos 4 /*!< MPU RBAR: VALID Position */\r
-#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */\r
-\r
-#define MPU_RBAR_REGION_Pos 0 /*!< MPU RBAR: REGION Position */\r
-#define MPU_RBAR_REGION_Msk (0xFUL << MPU_RBAR_REGION_Pos) /*!< MPU RBAR: REGION Mask */\r
-\r
-/* MPU Region Attribute and Size Register */\r
-#define MPU_RASR_ATTRS_Pos 16 /*!< MPU RASR: MPU Region Attribute field Position */\r
-#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */\r
-\r
-#define MPU_RASR_SRD_Pos 8 /*!< MPU RASR: Sub-Region Disable Position */\r
-#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */\r
-\r
-#define MPU_RASR_SIZE_Pos 1 /*!< MPU RASR: Region Size Field Position */\r
-#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */\r
-\r
-#define MPU_RASR_ENABLE_Pos 0 /*!< MPU RASR: Region enable bit Position */\r
-#define MPU_RASR_ENABLE_Msk (1UL << MPU_RASR_ENABLE_Pos) /*!< MPU RASR: Region enable bit Disable Mask */\r
-\r
-/*@} end of group CMSIS_MPU */\r
-#endif\r
-\r
-\r
-/** \ingroup CMSIS_core_register\r
- \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)\r
- \brief Type definitions for the Core Debug Registers\r
- @{\r
- */\r
-\r
-/** \brief Structure type to access the Core Debug Register (CoreDebug).\r
- */\r
-typedef struct\r
-{\r
- __IO uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */\r
- __O uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */\r
- __IO uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */\r
- __IO uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */\r
-} CoreDebug_Type;\r
-\r
-/* Debug Halting Control and Status Register */\r
-#define CoreDebug_DHCSR_DBGKEY_Pos 16 /*!< CoreDebug DHCSR: DBGKEY Position */\r
-#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */\r
-\r
-#define CoreDebug_DHCSR_S_RESET_ST_Pos 25 /*!< CoreDebug DHCSR: S_RESET_ST Position */\r
-#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */\r
-\r
-#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24 /*!< CoreDebug DHCSR: S_RETIRE_ST Position */\r
-#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */\r
-\r
-#define CoreDebug_DHCSR_S_LOCKUP_Pos 19 /*!< CoreDebug DHCSR: S_LOCKUP Position */\r
-#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */\r
-\r
-#define CoreDebug_DHCSR_S_SLEEP_Pos 18 /*!< CoreDebug DHCSR: S_SLEEP Position */\r
-#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */\r
-\r
-#define CoreDebug_DHCSR_S_HALT_Pos 17 /*!< CoreDebug DHCSR: S_HALT Position */\r
-#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */\r
-\r
-#define CoreDebug_DHCSR_S_REGRDY_Pos 16 /*!< CoreDebug DHCSR: S_REGRDY Position */\r
-#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */\r
-\r
-#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5 /*!< CoreDebug DHCSR: C_SNAPSTALL Position */\r
-#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */\r
-\r
-#define CoreDebug_DHCSR_C_MASKINTS_Pos 3 /*!< CoreDebug DHCSR: C_MASKINTS Position */\r
-#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */\r
-\r
-#define CoreDebug_DHCSR_C_STEP_Pos 2 /*!< CoreDebug DHCSR: C_STEP Position */\r
-#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */\r
-\r
-#define CoreDebug_DHCSR_C_HALT_Pos 1 /*!< CoreDebug DHCSR: C_HALT Position */\r
-#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */\r
-\r
-#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0 /*!< CoreDebug DHCSR: C_DEBUGEN Position */\r
-#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL << CoreDebug_DHCSR_C_DEBUGEN_Pos) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */\r
-\r
-/* Debug Core Register Selector Register */\r
-#define CoreDebug_DCRSR_REGWnR_Pos 16 /*!< CoreDebug DCRSR: REGWnR Position */\r
-#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */\r
-\r
-#define CoreDebug_DCRSR_REGSEL_Pos 0 /*!< CoreDebug DCRSR: REGSEL Position */\r
-#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL << CoreDebug_DCRSR_REGSEL_Pos) /*!< CoreDebug DCRSR: REGSEL Mask */\r
-\r
-/* Debug Exception and Monitor Control Register */\r
-#define CoreDebug_DEMCR_TRCENA_Pos 24 /*!< CoreDebug DEMCR: TRCENA Position */\r
-#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */\r
-\r
-#define CoreDebug_DEMCR_MON_REQ_Pos 19 /*!< CoreDebug DEMCR: MON_REQ Position */\r
-#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */\r
-\r
-#define CoreDebug_DEMCR_MON_STEP_Pos 18 /*!< CoreDebug DEMCR: MON_STEP Position */\r
-#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */\r
-\r
-#define CoreDebug_DEMCR_MON_PEND_Pos 17 /*!< CoreDebug DEMCR: MON_PEND Position */\r
-#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */\r
-\r
-#define CoreDebug_DEMCR_MON_EN_Pos 16 /*!< CoreDebug DEMCR: MON_EN Position */\r
-#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */\r
-\r
-#define CoreDebug_DEMCR_VC_HARDERR_Pos 10 /*!< CoreDebug DEMCR: VC_HARDERR Position */\r
-#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */\r
-\r
-#define CoreDebug_DEMCR_VC_INTERR_Pos 9 /*!< CoreDebug DEMCR: VC_INTERR Position */\r
-#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */\r
-\r
-#define CoreDebug_DEMCR_VC_BUSERR_Pos 8 /*!< CoreDebug DEMCR: VC_BUSERR Position */\r
-#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */\r
-\r
-#define CoreDebug_DEMCR_VC_STATERR_Pos 7 /*!< CoreDebug DEMCR: VC_STATERR Position */\r
-#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */\r
-\r
-#define CoreDebug_DEMCR_VC_CHKERR_Pos 6 /*!< CoreDebug DEMCR: VC_CHKERR Position */\r
-#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */\r
-\r
-#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5 /*!< CoreDebug DEMCR: VC_NOCPERR Position */\r
-#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */\r
-\r
-#define CoreDebug_DEMCR_VC_MMERR_Pos 4 /*!< CoreDebug DEMCR: VC_MMERR Position */\r
-#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */\r
-\r
-#define CoreDebug_DEMCR_VC_CORERESET_Pos 0 /*!< CoreDebug DEMCR: VC_CORERESET Position */\r
-#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL << CoreDebug_DEMCR_VC_CORERESET_Pos) /*!< CoreDebug DEMCR: VC_CORERESET Mask */\r
-\r
-/*@} end of group CMSIS_CoreDebug */\r
-\r
-\r
-/** \ingroup CMSIS_core_register\r
- \defgroup CMSIS_core_base Core Definitions\r
- \brief Definitions for base addresses, unions, and structures.\r
- @{\r
- */\r
-\r
-/* Memory mapping of Cortex-M3 Hardware */\r
-#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */\r
-#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */\r
-#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */\r
-#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */\r
-#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */\r
-#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */\r
-#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */\r
-#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */\r
-\r
-#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */\r
-#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */\r
-#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */\r
-#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */\r
-#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */\r
-#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */\r
-#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */\r
-#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */\r
-\r
-#if (__MPU_PRESENT == 1)\r
- #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */\r
- #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */\r
-#endif\r
-\r
-/*@} */\r
-\r
-\r
-\r
-/*******************************************************************************\r
- * Hardware Abstraction Layer\r
- Core Function Interface contains:\r
- - Core NVIC Functions\r
- - Core SysTick Functions\r
- - Core Debug Functions\r
- - Core Register Access Functions\r
- ******************************************************************************/\r
-/** \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference\r
-*/\r
-\r
-\r
-\r
-/* ########################## NVIC functions #################################### */\r
-/** \ingroup CMSIS_Core_FunctionInterface\r
- \defgroup CMSIS_Core_NVICFunctions NVIC Functions\r
- \brief Functions that manage interrupts and exceptions via the NVIC.\r
- @{\r
- */\r
-\r
-/** \brief Set Priority Grouping\r
-\r
- The function sets the priority grouping field using the required unlock sequence.\r
- The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.\r
- Only values from 0..7 are used.\r
- In case of a conflict between priority grouping and available\r
- priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.\r
-\r
- \param [in] PriorityGroup Priority grouping field.\r
- */\r
-__STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup)\r
-{\r
- uint32_t reg_value;\r
- uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07); /* only values 0..7 are used */\r
-\r
- reg_value = SCB->AIRCR; /* read old register configuration */\r
- reg_value &= ~(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk); /* clear bits to change */\r
- reg_value = (reg_value |\r
- ((uint32_t)0x5FA << SCB_AIRCR_VECTKEY_Pos) |\r
- (PriorityGroupTmp << 8)); /* Insert write key and priorty group */\r
- SCB->AIRCR = reg_value;\r
-}\r
-\r
-\r
-/** \brief Get Priority Grouping\r
-\r
- The function reads the priority grouping field from the NVIC Interrupt Controller.\r
-\r
- \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).\r
- */\r
-__STATIC_INLINE uint32_t NVIC_GetPriorityGrouping(void)\r
-{\r
- return ((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos); /* read priority grouping field */\r
-}\r
-\r
-\r
-/** \brief Enable External Interrupt\r
-\r
- The function enables a device-specific interrupt in the NVIC interrupt controller.\r
-\r
- \param [in] IRQn External interrupt number. Value cannot be negative.\r
- */\r
-__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)\r
-{\r
- NVIC->ISER[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* enable interrupt */\r
-}\r
-\r
-\r
-/** \brief Disable External Interrupt\r
-\r
- The function disables a device-specific interrupt in the NVIC interrupt controller.\r
-\r
- \param [in] IRQn External interrupt number. Value cannot be negative.\r
- */\r
-__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)\r
-{\r
- NVIC->ICER[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* disable interrupt */\r
-}\r
-\r
-\r
-/** \brief Get Pending Interrupt\r
-\r
- The function reads the pending register in the NVIC and returns the pending bit\r
- for the specified interrupt.\r
-\r
- \param [in] IRQn Interrupt number.\r
-\r
- \return 0 Interrupt status is not pending.\r
- \return 1 Interrupt status is pending.\r
- */\r
-__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)\r
-{\r
- return((uint32_t) ((NVIC->ISPR[(uint32_t)(IRQn) >> 5] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); /* Return 1 if pending else 0 */\r
-}\r
-\r
-\r
-/** \brief Set Pending Interrupt\r
-\r
- The function sets the pending bit of an external interrupt.\r
-\r
- \param [in] IRQn Interrupt number. Value cannot be negative.\r
- */\r
-__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)\r
-{\r
- NVIC->ISPR[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* set interrupt pending */\r
-}\r
-\r
-\r
-/** \brief Clear Pending Interrupt\r
-\r
- The function clears the pending bit of an external interrupt.\r
-\r
- \param [in] IRQn External interrupt number. Value cannot be negative.\r
- */\r
-__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)\r
-{\r
- NVIC->ICPR[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* Clear pending interrupt */\r
-}\r
-\r
-\r
-/** \brief Get Active Interrupt\r
-\r
- The function reads the active register in NVIC and returns the active bit.\r
-\r
- \param [in] IRQn Interrupt number.\r
-\r
- \return 0 Interrupt status is not active.\r
- \return 1 Interrupt status is active.\r
- */\r
-__STATIC_INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn)\r
-{\r
- return((uint32_t)((NVIC->IABR[(uint32_t)(IRQn) >> 5] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); /* Return 1 if active else 0 */\r
-}\r
-\r
-\r
-/** \brief Set Interrupt Priority\r
-\r
- The function sets the priority of an interrupt.\r
-\r
- \note The priority cannot be set for every core interrupt.\r
-\r
- \param [in] IRQn Interrupt number.\r
- \param [in] priority Priority to set.\r
- */\r
-__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)\r
-{\r
- if(IRQn < 0) {\r
- SCB->SHP[((uint32_t)(IRQn) & 0xF)-4] = ((priority << (8 - __NVIC_PRIO_BITS)) & 0xff); } /* set Priority for Cortex-M System Interrupts */\r
- else {\r
- NVIC->IP[(uint32_t)(IRQn)] = ((priority << (8 - __NVIC_PRIO_BITS)) & 0xff); } /* set Priority for device specific Interrupts */\r
-}\r
-\r
-\r
-/** \brief Get Interrupt Priority\r
-\r
- The function reads the priority of an interrupt. The interrupt\r
- number can be positive to specify an external (device specific)\r
- interrupt, or negative to specify an internal (core) interrupt.\r
-\r
-\r
- \param [in] IRQn Interrupt number.\r
- \return Interrupt Priority. Value is aligned automatically to the implemented\r
- priority bits of the microcontroller.\r
- */\r
-__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn)\r
-{\r
-\r
- if(IRQn < 0) {\r
- return((uint32_t)(SCB->SHP[((uint32_t)(IRQn) & 0xF)-4] >> (8 - __NVIC_PRIO_BITS))); } /* get priority for Cortex-M system interrupts */\r
- else {\r
- return((uint32_t)(NVIC->IP[(uint32_t)(IRQn)] >> (8 - __NVIC_PRIO_BITS))); } /* get priority for device specific interrupts */\r
-}\r
-\r
-\r
-/** \brief Encode Priority\r
-\r
- The function encodes the priority for an interrupt with the given priority group,\r
- preemptive priority value, and subpriority value.\r
- In case of a conflict between priority grouping and available\r
- priority bits (__NVIC_PRIO_BITS), the samllest possible priority group is set.\r
-\r
- \param [in] PriorityGroup Used priority group.\r
- \param [in] PreemptPriority Preemptive priority value (starting from 0).\r
- \param [in] SubPriority Subpriority value (starting from 0).\r
- \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().\r
- */\r
-__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)\r
-{\r
- uint32_t PriorityGroupTmp = (PriorityGroup & 0x07); /* only values 0..7 are used */\r
- uint32_t PreemptPriorityBits;\r
- uint32_t SubPriorityBits;\r
-\r
- PreemptPriorityBits = ((7 - PriorityGroupTmp) > __NVIC_PRIO_BITS) ? __NVIC_PRIO_BITS : 7 - PriorityGroupTmp;\r
- SubPriorityBits = ((PriorityGroupTmp + __NVIC_PRIO_BITS) < 7) ? 0 : PriorityGroupTmp - 7 + __NVIC_PRIO_BITS;\r
-\r
- return (\r
- ((PreemptPriority & ((1 << (PreemptPriorityBits)) - 1)) << SubPriorityBits) |\r
- ((SubPriority & ((1 << (SubPriorityBits )) - 1)))\r
- );\r
-}\r
-\r
-\r
-/** \brief Decode Priority\r
-\r
- The function decodes an interrupt priority value with a given priority group to\r
- preemptive priority value and subpriority value.\r
- In case of a conflict between priority grouping and available\r
- priority bits (__NVIC_PRIO_BITS) the samllest possible priority group is set.\r
-\r
- \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().\r
- \param [in] PriorityGroup Used priority group.\r
- \param [out] pPreemptPriority Preemptive priority value (starting from 0).\r
- \param [out] pSubPriority Subpriority value (starting from 0).\r
- */\r
-__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority)\r
-{\r
- uint32_t PriorityGroupTmp = (PriorityGroup & 0x07); /* only values 0..7 are used */\r
- uint32_t PreemptPriorityBits;\r
- uint32_t SubPriorityBits;\r
-\r
- PreemptPriorityBits = ((7 - PriorityGroupTmp) > __NVIC_PRIO_BITS) ? __NVIC_PRIO_BITS : 7 - PriorityGroupTmp;\r
- SubPriorityBits = ((PriorityGroupTmp + __NVIC_PRIO_BITS) < 7) ? 0 : PriorityGroupTmp - 7 + __NVIC_PRIO_BITS;\r
-\r
- *pPreemptPriority = (Priority >> SubPriorityBits) & ((1 << (PreemptPriorityBits)) - 1);\r
- *pSubPriority = (Priority ) & ((1 << (SubPriorityBits )) - 1);\r
-}\r
-\r
-\r
-/** \brief System Reset\r
-\r
- The function initiates a system reset request to reset the MCU.\r
- */\r
-__STATIC_INLINE void NVIC_SystemReset(void)\r
-{\r
- __DSB(); /* Ensure all outstanding memory accesses included\r
- buffered write are completed before reset */\r
- SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) |\r
- (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |\r
- SCB_AIRCR_SYSRESETREQ_Msk); /* Keep priority group unchanged */\r
- __DSB(); /* Ensure completion of memory access */\r
- while(1); /* wait until reset */\r
-}\r
-\r
-/*@} end of CMSIS_Core_NVICFunctions */\r
-\r
-\r
-\r
-/* ################################## SysTick function ############################################ */\r
-/** \ingroup CMSIS_Core_FunctionInterface\r
- \defgroup CMSIS_Core_SysTickFunctions SysTick Functions\r
- \brief Functions that configure the System.\r
- @{\r
- */\r
-\r
-#if (__Vendor_SysTickConfig == 0)\r
-\r
-/** \brief System Tick Configuration\r
-\r
- The function initializes the System Timer and its interrupt, and starts the System Tick Timer.\r
- Counter is in free running mode to generate periodic interrupts.\r
-\r
- \param [in] ticks Number of ticks between two interrupts.\r
-\r
- \return 0 Function succeeded.\r
- \return 1 Function failed.\r
-\r
- \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the\r
- function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>\r
- must contain a vendor-specific implementation of this function.\r
-\r
- */\r
-__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)\r
-{\r
- if (ticks > SysTick_LOAD_RELOAD_Msk) return (1); /* Reload value impossible */\r
-\r
- SysTick->LOAD = (ticks & SysTick_LOAD_RELOAD_Msk) - 1; /* set reload register */\r
- NVIC_SetPriority (SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority for Systick Interrupt */\r
- SysTick->VAL = 0; /* Load the SysTick Counter Value */\r
- SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |\r
- SysTick_CTRL_TICKINT_Msk |\r
- SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */\r
- return (0); /* Function successful */\r
-}\r
-\r
-#endif\r
-\r
-/*@} end of CMSIS_Core_SysTickFunctions */\r
-\r
-\r
-\r
-/* ##################################### Debug In/Output function ########################################### */\r
-/** \ingroup CMSIS_Core_FunctionInterface\r
- \defgroup CMSIS_core_DebugFunctions ITM Functions\r
- \brief Functions that access the ITM debug interface.\r
- @{\r
- */\r
-\r
-extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */\r
-#define ITM_RXBUFFER_EMPTY 0x5AA55AA5 /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */\r
-\r
-\r
-/** \brief ITM Send Character\r
-\r
- The function transmits a character via the ITM channel 0, and\r
- \li Just returns when no debugger is connected that has booked the output.\r
- \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted.\r
-\r
- \param [in] ch Character to transmit.\r
-\r
- \returns Character to transmit.\r
- */\r
-__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)\r
-{\r
- if ((ITM->TCR & ITM_TCR_ITMENA_Msk) && /* ITM enabled */\r
- (ITM->TER & (1UL << 0) ) ) /* ITM Port #0 enabled */\r
- {\r
- while (ITM->PORT[0].u32 == 0);\r
- ITM->PORT[0].u8 = (uint8_t) ch;\r
- }\r
- return (ch);\r
-}\r
-\r
-\r
-/** \brief ITM Receive Character\r
-\r
- The function inputs a character via the external variable \ref ITM_RxBuffer.\r
-\r
- \return Received character.\r
- \return -1 No character pending.\r
- */\r
-__STATIC_INLINE int32_t ITM_ReceiveChar (void) {\r
- int32_t ch = -1; /* no character available */\r
-\r
- if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) {\r
- ch = ITM_RxBuffer;\r
- ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */\r
- }\r
-\r
- return (ch);\r
-}\r
-\r
-\r
-/** \brief ITM Check Character\r
-\r
- The function checks whether a character is pending for reading in the variable \ref ITM_RxBuffer.\r
-\r
- \return 0 No character available.\r
- \return 1 Character available.\r
- */\r
-__STATIC_INLINE int32_t ITM_CheckChar (void) {\r
-\r
- if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) {\r
- return (0); /* no character available */\r
- } else {\r
- return (1); /* character available */\r
- }\r
-}\r
-\r
-/*@} end of CMSIS_core_DebugFunctions */\r
-\r
-#endif /* __CORE_CM3_H_DEPENDANT */\r
-\r
-#endif /* __CMSIS_GENERIC */\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
+++ /dev/null
-/**************************************************************************//**\r
- * @file core_cmFunc.h\r
- * @brief CMSIS Cortex-M Core Function Access Header File\r
- * @version V3.00\r
- * @date 09. December 2011\r
- *\r
- * @note\r
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.\r
- *\r
- * @par\r
- * ARM Limited (ARM) is supplying this software for use with Cortex-M \r
- * processor based microcontrollers. This file can be freely distributed \r
- * within development tools that are supporting such ARM based processors. \r
- *\r
- * @par\r
- * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED\r
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF\r
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.\r
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR\r
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.\r
- *\r
- ******************************************************************************/\r
-\r
-#ifndef __CORE_CMFUNC_H\r
-#define __CORE_CMFUNC_H\r
-\r
-\r
-/* ########################### Core Function Access ########################### */\r
-/** \ingroup CMSIS_Core_FunctionInterface \r
- \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions\r
- @{\r
- */\r
-\r
-#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/\r
-/* ARM armcc specific functions */\r
-\r
-#if (__ARMCC_VERSION < 400677)\r
- #error "Please use ARM Compiler Toolchain V4.0.677 or later!"\r
-#endif\r
-\r
-/* intrinsic void __enable_irq(); */\r
-/* intrinsic void __disable_irq(); */\r
-\r
-/** \brief Get Control Register\r
-\r
- This function returns the content of the Control Register.\r
-\r
- \return Control Register value\r
- */\r
-static __INLINE uint32_t __get_CONTROL(void)\r
-{\r
- register uint32_t __regControl __ASM("control");\r
- return(__regControl);\r
-}\r
-\r
-\r
-/** \brief Set Control Register\r
-\r
- This function writes the given value to the Control Register.\r
-\r
- \param [in] control Control Register value to set\r
- */\r
-static __INLINE void __set_CONTROL(uint32_t control)\r
-{\r
- register uint32_t __regControl __ASM("control");\r
- __regControl = control;\r
-}\r
-\r
-\r
-/** \brief Get IPSR Register\r
-\r
- This function returns the content of the IPSR Register.\r
-\r
- \return IPSR Register value\r
- */\r
-static __INLINE uint32_t __get_IPSR(void)\r
-{\r
- register uint32_t __regIPSR __ASM("ipsr");\r
- return(__regIPSR);\r
-}\r
-\r
-\r
-/** \brief Get APSR Register\r
-\r
- This function returns the content of the APSR Register.\r
-\r
- \return APSR Register value\r
- */\r
-static __INLINE uint32_t __get_APSR(void)\r
-{\r
- register uint32_t __regAPSR __ASM("apsr");\r
- return(__regAPSR);\r
-}\r
-\r
-\r
-/** \brief Get xPSR Register\r
-\r
- This function returns the content of the xPSR Register.\r
-\r
- \return xPSR Register value\r
- */\r
-static __INLINE uint32_t __get_xPSR(void)\r
-{\r
- register uint32_t __regXPSR __ASM("xpsr");\r
- return(__regXPSR);\r
-}\r
-\r
-\r
-/** \brief Get Process Stack Pointer\r
-\r
- This function returns the current value of the Process Stack Pointer (PSP).\r
-\r
- \return PSP Register value\r
- */\r
-static __INLINE uint32_t __get_PSP(void)\r
-{\r
- register uint32_t __regProcessStackPointer __ASM("psp");\r
- return(__regProcessStackPointer);\r
-}\r
-\r
-\r
-/** \brief Set Process Stack Pointer\r
-\r
- This function assigns the given value to the Process Stack Pointer (PSP).\r
-\r
- \param [in] topOfProcStack Process Stack Pointer value to set\r
- */\r
-static __INLINE void __set_PSP(uint32_t topOfProcStack)\r
-{\r
- register uint32_t __regProcessStackPointer __ASM("psp");\r
- __regProcessStackPointer = topOfProcStack;\r
-}\r
-\r
-\r
-/** \brief Get Main Stack Pointer\r
-\r
- This function returns the current value of the Main Stack Pointer (MSP).\r
-\r
- \return MSP Register value\r
- */\r
-static __INLINE uint32_t __get_MSP(void)\r
-{\r
- register uint32_t __regMainStackPointer __ASM("msp");\r
- return(__regMainStackPointer);\r
-}\r
-\r
-\r
-/** \brief Set Main Stack Pointer\r
-\r
- This function assigns the given value to the Main Stack Pointer (MSP).\r
-\r
- \param [in] topOfMainStack Main Stack Pointer value to set\r
- */\r
-static __INLINE void __set_MSP(uint32_t topOfMainStack)\r
-{\r
- register uint32_t __regMainStackPointer __ASM("msp");\r
- __regMainStackPointer = topOfMainStack;\r
-}\r
-\r
-\r
-/** \brief Get Priority Mask\r
-\r
- This function returns the current state of the priority mask bit from the Priority Mask Register.\r
-\r
- \return Priority Mask value\r
- */\r
-static __INLINE uint32_t __get_PRIMASK(void)\r
-{\r
- register uint32_t __regPriMask __ASM("primask");\r
- return(__regPriMask);\r
-}\r
-\r
-\r
-/** \brief Set Priority Mask\r
-\r
- This function assigns the given value to the Priority Mask Register.\r
-\r
- \param [in] priMask Priority Mask\r
- */\r
-static __INLINE void __set_PRIMASK(uint32_t priMask)\r
-{\r
- register uint32_t __regPriMask __ASM("primask");\r
- __regPriMask = (priMask);\r
-}\r
- \r
-\r
-#if (__CORTEX_M >= 0x03)\r
-\r
-/** \brief Enable FIQ\r
-\r
- This function enables FIQ interrupts by clearing the F-bit in the CPSR.\r
- Can only be executed in Privileged modes.\r
- */\r
-#define __enable_fault_irq __enable_fiq\r
-\r
-\r
-/** \brief Disable FIQ\r
-\r
- This function disables FIQ interrupts by setting the F-bit in the CPSR.\r
- Can only be executed in Privileged modes.\r
- */\r
-#define __disable_fault_irq __disable_fiq\r
-\r
-\r
-/** \brief Get Base Priority\r
-\r
- This function returns the current value of the Base Priority register.\r
-\r
- \return Base Priority register value\r
- */\r
-static __INLINE uint32_t __get_BASEPRI(void)\r
-{\r
- register uint32_t __regBasePri __ASM("basepri");\r
- return(__regBasePri);\r
-}\r
-\r
-\r
-/** \brief Set Base Priority\r
-\r
- This function assigns the given value to the Base Priority register.\r
-\r
- \param [in] basePri Base Priority value to set\r
- */\r
-static __INLINE void __set_BASEPRI(uint32_t basePri)\r
-{\r
- register uint32_t __regBasePri __ASM("basepri");\r
- __regBasePri = (basePri & 0xff);\r
-}\r
- \r
-\r
-/** \brief Get Fault Mask\r
-\r
- This function returns the current value of the Fault Mask register.\r
-\r
- \return Fault Mask register value\r
- */\r
-static __INLINE uint32_t __get_FAULTMASK(void)\r
-{\r
- register uint32_t __regFaultMask __ASM("faultmask");\r
- return(__regFaultMask);\r
-}\r
-\r
-\r
-/** \brief Set Fault Mask\r
-\r
- This function assigns the given value to the Fault Mask register.\r
-\r
- \param [in] faultMask Fault Mask value to set\r
- */\r
-static __INLINE void __set_FAULTMASK(uint32_t faultMask)\r
-{\r
- register uint32_t __regFaultMask __ASM("faultmask");\r
- __regFaultMask = (faultMask & (uint32_t)1);\r
-}\r
-\r
-#endif /* (__CORTEX_M >= 0x03) */\r
-\r
-\r
-#if (__CORTEX_M == 0x04)\r
-\r
-/** \brief Get FPSCR\r
-\r
- This function returns the current value of the Floating Point Status/Control register.\r
-\r
- \return Floating Point Status/Control register value\r
- */\r
-static __INLINE uint32_t __get_FPSCR(void)\r
-{\r
-#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)\r
- register uint32_t __regfpscr __ASM("fpscr");\r
- return(__regfpscr);\r
-#else\r
- return(0);\r
-#endif\r
-}\r
-\r
-\r
-/** \brief Set FPSCR\r
-\r
- This function assigns the given value to the Floating Point Status/Control register.\r
-\r
- \param [in] fpscr Floating Point Status/Control value to set\r
- */\r
-static __INLINE void __set_FPSCR(uint32_t fpscr)\r
-{\r
-#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)\r
- register uint32_t __regfpscr __ASM("fpscr");\r
- __regfpscr = (fpscr);\r
-#endif\r
-}\r
-\r
-#endif /* (__CORTEX_M == 0x04) */\r
-\r
-\r
-#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/\r
-/* IAR iccarm specific functions */\r
-\r
-#include <cmsis_iar.h>\r
-\r
-#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/\r
-/* GNU gcc specific functions */\r
-\r
-/** \brief Enable IRQ Interrupts\r
-\r
- This function enables IRQ interrupts by clearing the I-bit in the CPSR.\r
- Can only be executed in Privileged modes.\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE void __enable_irq(void)\r
-{\r
- __ASM volatile ("cpsie i");\r
-}\r
-\r
-\r
-/** \brief Disable IRQ Interrupts\r
-\r
- This function disables IRQ interrupts by setting the I-bit in the CPSR.\r
- Can only be executed in Privileged modes.\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE void __disable_irq(void)\r
-{\r
- __ASM volatile ("cpsid i");\r
-}\r
-\r
-\r
-/** \brief Get Control Register\r
-\r
- This function returns the content of the Control Register.\r
-\r
- \return Control Register value\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __get_CONTROL(void)\r
-{\r
- uint32_t result;\r
-\r
- __ASM volatile ("MRS %0, control" : "=r" (result) );\r
- return(result);\r
-}\r
-\r
-\r
-/** \brief Set Control Register\r
-\r
- This function writes the given value to the Control Register.\r
-\r
- \param [in] control Control Register value to set\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE void __set_CONTROL(uint32_t control)\r
-{\r
- __ASM volatile ("MSR control, %0" : : "r" (control) );\r
-}\r
-\r
-\r
-/** \brief Get IPSR Register\r
-\r
- This function returns the content of the IPSR Register.\r
-\r
- \return IPSR Register value\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __get_IPSR(void)\r
-{\r
- uint32_t result;\r
-\r
- __ASM volatile ("MRS %0, ipsr" : "=r" (result) );\r
- return(result);\r
-}\r
-\r
-\r
-/** \brief Get APSR Register\r
-\r
- This function returns the content of the APSR Register.\r
-\r
- \return APSR Register value\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __get_APSR(void)\r
-{\r
- uint32_t result;\r
-\r
- __ASM volatile ("MRS %0, apsr" : "=r" (result) );\r
- return(result);\r
-}\r
-\r
-\r
-/** \brief Get xPSR Register\r
-\r
- This function returns the content of the xPSR Register.\r
-\r
- \return xPSR Register value\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __get_xPSR(void)\r
-{\r
- uint32_t result;\r
-\r
- __ASM volatile ("MRS %0, xpsr" : "=r" (result) );\r
- return(result);\r
-}\r
-\r
-\r
-/** \brief Get Process Stack Pointer\r
-\r
- This function returns the current value of the Process Stack Pointer (PSP).\r
-\r
- \return PSP Register value\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __get_PSP(void)\r
-{\r
- register uint32_t result;\r
-\r
- __ASM volatile ("MRS %0, psp\n" : "=r" (result) );\r
- return(result);\r
-}\r
- \r
-\r
-/** \brief Set Process Stack Pointer\r
-\r
- This function assigns the given value to the Process Stack Pointer (PSP).\r
-\r
- \param [in] topOfProcStack Process Stack Pointer value to set\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE void __set_PSP(uint32_t topOfProcStack)\r
-{\r
- __ASM volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) );\r
-}\r
-\r
-\r
-/** \brief Get Main Stack Pointer\r
-\r
- This function returns the current value of the Main Stack Pointer (MSP).\r
-\r
- \return MSP Register value\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __get_MSP(void)\r
-{\r
- register uint32_t result;\r
-\r
- __ASM volatile ("MRS %0, msp\n" : "=r" (result) );\r
- return(result);\r
-}\r
- \r
-\r
-/** \brief Set Main Stack Pointer\r
-\r
- This function assigns the given value to the Main Stack Pointer (MSP).\r
-\r
- \param [in] topOfMainStack Main Stack Pointer value to set\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE void __set_MSP(uint32_t topOfMainStack)\r
-{\r
- __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) );\r
-}\r
-\r
-\r
-/** \brief Get Priority Mask\r
-\r
- This function returns the current state of the priority mask bit from the Priority Mask Register.\r
-\r
- \return Priority Mask value\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __get_PRIMASK(void)\r
-{\r
- uint32_t result;\r
-\r
- __ASM volatile ("MRS %0, primask" : "=r" (result) );\r
- return(result);\r
-}\r
-\r
-\r
-/** \brief Set Priority Mask\r
-\r
- This function assigns the given value to the Priority Mask Register.\r
-\r
- \param [in] priMask Priority Mask\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE void __set_PRIMASK(uint32_t priMask)\r
-{\r
- __ASM volatile ("MSR primask, %0" : : "r" (priMask) );\r
-}\r
- \r
-\r
-#if (__CORTEX_M >= 0x03)\r
-\r
-/** \brief Enable FIQ\r
-\r
- This function enables FIQ interrupts by clearing the F-bit in the CPSR.\r
- Can only be executed in Privileged modes.\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE void __enable_fault_irq(void)\r
-{\r
- __ASM volatile ("cpsie f");\r
-}\r
-\r
-\r
-/** \brief Disable FIQ\r
-\r
- This function disables FIQ interrupts by setting the F-bit in the CPSR.\r
- Can only be executed in Privileged modes.\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE void __disable_fault_irq(void)\r
-{\r
- __ASM volatile ("cpsid f");\r
-}\r
-\r
-\r
-/** \brief Get Base Priority\r
-\r
- This function returns the current value of the Base Priority register.\r
-\r
- \return Base Priority register value\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __get_BASEPRI(void)\r
-{\r
- uint32_t result;\r
- \r
- __ASM volatile ("MRS %0, basepri_max" : "=r" (result) );\r
- return(result);\r
-}\r
-\r
-\r
-/** \brief Set Base Priority\r
-\r
- This function assigns the given value to the Base Priority register.\r
-\r
- \param [in] basePri Base Priority value to set\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE void __set_BASEPRI(uint32_t value)\r
-{\r
- __ASM volatile ("MSR basepri, %0" : : "r" (value) );\r
-}\r
-\r
-\r
-/** \brief Get Fault Mask\r
-\r
- This function returns the current value of the Fault Mask register.\r
-\r
- \return Fault Mask register value\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __get_FAULTMASK(void)\r
-{\r
- uint32_t result;\r
- \r
- __ASM volatile ("MRS %0, faultmask" : "=r" (result) );\r
- return(result);\r
-}\r
-\r
-\r
-/** \brief Set Fault Mask\r
-\r
- This function assigns the given value to the Fault Mask register.\r
-\r
- \param [in] faultMask Fault Mask value to set\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE void __set_FAULTMASK(uint32_t faultMask)\r
-{\r
- __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) );\r
-}\r
-\r
-#endif /* (__CORTEX_M >= 0x03) */\r
-\r
-\r
-#if (__CORTEX_M == 0x04)\r
-\r
-/** \brief Get FPSCR\r
-\r
- This function returns the current value of the Floating Point Status/Control register.\r
-\r
- \return Floating Point Status/Control register value\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __get_FPSCR(void)\r
-{\r
-#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)\r
- uint32_t result;\r
-\r
- __ASM volatile ("VMRS %0, fpscr" : "=r" (result) );\r
- return(result);\r
-#else\r
- return(0);\r
-#endif\r
-}\r
-\r
-\r
-/** \brief Set FPSCR\r
-\r
- This function assigns the given value to the Floating Point Status/Control register.\r
-\r
- \param [in] fpscr Floating Point Status/Control value to set\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE void __set_FPSCR(uint32_t fpscr)\r
-{\r
-#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)\r
- __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) );\r
-#endif\r
-}\r
-\r
-#endif /* (__CORTEX_M == 0x04) */\r
-\r
-\r
-#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/\r
-/* TASKING carm specific functions */\r
-\r
-/*\r
- * The CMSIS functions have been implemented as intrinsics in the compiler.\r
- * Please use "carm -?i" to get an up to date list of all instrinsics,\r
- * Including the CMSIS ones.\r
- */\r
-\r
-#endif\r
-\r
-/*@} end of CMSIS_Core_RegAccFunctions */\r
-\r
-\r
-#endif /* __CORE_CMFUNC_H */\r
+++ /dev/null
-/**************************************************************************//**\r
- * @file core_cmInstr.h\r
- * @brief CMSIS Cortex-M Core Instruction Access Header File\r
- * @version V3.00\r
- * @date 09. December 2011\r
- *\r
- * @note\r
- * Copyright (C) 2009-2011 ARM Limited. All rights reserved.\r
- *\r
- * @par\r
- * ARM Limited (ARM) is supplying this software for use with Cortex-M \r
- * processor based microcontrollers. This file can be freely distributed \r
- * within development tools that are supporting such ARM based processors. \r
- *\r
- * @par\r
- * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED\r
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF\r
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.\r
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR\r
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.\r
- *\r
- ******************************************************************************/\r
-\r
-#ifndef __CORE_CMINSTR_H\r
-#define __CORE_CMINSTR_H\r
-\r
-\r
-/* ########################## Core Instruction Access ######################### */\r
-/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface\r
- Access to dedicated instructions\r
- @{\r
-*/\r
-\r
-#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/\r
-/* ARM armcc specific functions */\r
-\r
-#if (__ARMCC_VERSION < 400677)\r
- #error "Please use ARM Compiler Toolchain V4.0.677 or later!"\r
-#endif\r
-\r
-\r
-/** \brief No Operation\r
-\r
- No Operation does nothing. This instruction can be used for code alignment purposes.\r
- */\r
-#define __NOP __nop\r
-\r
-\r
-/** \brief Wait For Interrupt\r
-\r
- Wait For Interrupt is a hint instruction that suspends execution\r
- until one of a number of events occurs.\r
- */\r
-#define __WFI __wfi\r
-\r
-\r
-/** \brief Wait For Event\r
-\r
- Wait For Event is a hint instruction that permits the processor to enter\r
- a low-power state until one of a number of events occurs.\r
- */\r
-#define __WFE __wfe\r
-\r
-\r
-/** \brief Send Event\r
-\r
- Send Event is a hint instruction. It causes an event to be signaled to the CPU.\r
- */\r
-#define __SEV __sev\r
-\r
-\r
-/** \brief Instruction Synchronization Barrier\r
-\r
- Instruction Synchronization Barrier flushes the pipeline in the processor, \r
- so that all instructions following the ISB are fetched from cache or \r
- memory, after the instruction has been completed.\r
- */\r
-#define __ISB() __isb(0xF)\r
-\r
-\r
-/** \brief Data Synchronization Barrier\r
-\r
- This function acts as a special kind of Data Memory Barrier. \r
- It completes when all explicit memory accesses before this instruction complete.\r
- */\r
-#define __DSB() __dsb(0xF)\r
-\r
-\r
-/** \brief Data Memory Barrier\r
-\r
- This function ensures the apparent order of the explicit memory operations before \r
- and after the instruction, without ensuring their completion.\r
- */\r
-#define __DMB() __dmb(0xF)\r
-\r
-\r
-/** \brief Reverse byte order (32 bit)\r
-\r
- This function reverses the byte order in integer value.\r
-\r
- \param [in] value Value to reverse\r
- \return Reversed value\r
- */\r
-#define __REV __rev\r
-\r
-\r
-/** \brief Reverse byte order (16 bit)\r
-\r
- This function reverses the byte order in two unsigned short values.\r
-\r
- \param [in] value Value to reverse\r
- \return Reversed value\r
- */\r
-static __attribute__((section(".rev16_text"))) __INLINE __ASM uint32_t __REV16(uint32_t value)\r
-{\r
- rev16 r0, r0\r
- bx lr\r
-}\r
-\r
-\r
-/** \brief Reverse byte order in signed short value\r
-\r
- This function reverses the byte order in a signed short value with sign extension to integer.\r
-\r
- \param [in] value Value to reverse\r
- \return Reversed value\r
- */\r
-static __attribute__((section(".revsh_text"))) __INLINE __ASM int32_t __REVSH(int32_t value)\r
-{\r
- revsh r0, r0\r
- bx lr\r
-}\r
-\r
-\r
-#if (__CORTEX_M >= 0x03)\r
-\r
-/** \brief Reverse bit order of value\r
-\r
- This function reverses the bit order of the given value.\r
-\r
- \param [in] value Value to reverse\r
- \return Reversed value\r
- */\r
-#define __RBIT __rbit\r
-\r
-\r
-/** \brief LDR Exclusive (8 bit)\r
-\r
- This function performs a exclusive LDR command for 8 bit value.\r
-\r
- \param [in] ptr Pointer to data\r
- \return value of type uint8_t at (*ptr)\r
- */\r
-#define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr))\r
-\r
-\r
-/** \brief LDR Exclusive (16 bit)\r
-\r
- This function performs a exclusive LDR command for 16 bit values.\r
-\r
- \param [in] ptr Pointer to data\r
- \return value of type uint16_t at (*ptr)\r
- */\r
-#define __LDREXH(ptr) ((uint16_t) __ldrex(ptr))\r
-\r
-\r
-/** \brief LDR Exclusive (32 bit)\r
-\r
- This function performs a exclusive LDR command for 32 bit values.\r
-\r
- \param [in] ptr Pointer to data\r
- \return value of type uint32_t at (*ptr)\r
- */\r
-#define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr))\r
-\r
-\r
-/** \brief STR Exclusive (8 bit)\r
-\r
- This function performs a exclusive STR command for 8 bit values.\r
-\r
- \param [in] value Value to store\r
- \param [in] ptr Pointer to location\r
- \return 0 Function succeeded\r
- \return 1 Function failed\r
- */\r
-#define __STREXB(value, ptr) __strex(value, ptr)\r
-\r
-\r
-/** \brief STR Exclusive (16 bit)\r
-\r
- This function performs a exclusive STR command for 16 bit values.\r
-\r
- \param [in] value Value to store\r
- \param [in] ptr Pointer to location\r
- \return 0 Function succeeded\r
- \return 1 Function failed\r
- */\r
-#define __STREXH(value, ptr) __strex(value, ptr)\r
-\r
-\r
-/** \brief STR Exclusive (32 bit)\r
-\r
- This function performs a exclusive STR command for 32 bit values.\r
-\r
- \param [in] value Value to store\r
- \param [in] ptr Pointer to location\r
- \return 0 Function succeeded\r
- \return 1 Function failed\r
- */\r
-#define __STREXW(value, ptr) __strex(value, ptr)\r
-\r
-\r
-/** \brief Remove the exclusive lock\r
-\r
- This function removes the exclusive lock which is created by LDREX.\r
-\r
- */\r
-#define __CLREX __clrex\r
-\r
-\r
-/** \brief Signed Saturate\r
-\r
- This function saturates a signed value.\r
-\r
- \param [in] value Value to be saturated\r
- \param [in] sat Bit position to saturate to (1..32)\r
- \return Saturated value\r
- */\r
-#define __SSAT __ssat\r
-\r
-\r
-/** \brief Unsigned Saturate\r
-\r
- This function saturates an unsigned value.\r
-\r
- \param [in] value Value to be saturated\r
- \param [in] sat Bit position to saturate to (0..31)\r
- \return Saturated value\r
- */\r
-#define __USAT __usat\r
-\r
-\r
-/** \brief Count leading zeros\r
-\r
- This function counts the number of leading zeros of a data value.\r
-\r
- \param [in] value Value to count the leading zeros\r
- \return number of leading zeros in value\r
- */\r
-#define __CLZ __clz \r
-\r
-#endif /* (__CORTEX_M >= 0x03) */\r
-\r
-\r
-\r
-#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/\r
-/* IAR iccarm specific functions */\r
-\r
-#include <cmsis_iar.h>\r
-\r
-\r
-#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/\r
-/* GNU gcc specific functions */\r
-\r
-/** \brief No Operation\r
-\r
- No Operation does nothing. This instruction can be used for code alignment purposes.\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE void __NOP(void)\r
-{\r
- __ASM volatile ("nop");\r
-}\r
-\r
-\r
-/** \brief Wait For Interrupt\r
-\r
- Wait For Interrupt is a hint instruction that suspends execution\r
- until one of a number of events occurs.\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE void __WFI(void)\r
-{\r
- __ASM volatile ("wfi");\r
-}\r
-\r
-\r
-/** \brief Wait For Event\r
-\r
- Wait For Event is a hint instruction that permits the processor to enter\r
- a low-power state until one of a number of events occurs.\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE void __WFE(void)\r
-{\r
- __ASM volatile ("wfe");\r
-}\r
-\r
-\r
-/** \brief Send Event\r
-\r
- Send Event is a hint instruction. It causes an event to be signaled to the CPU.\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE void __SEV(void)\r
-{\r
- __ASM volatile ("sev");\r
-}\r
-\r
-\r
-/** \brief Instruction Synchronization Barrier\r
-\r
- Instruction Synchronization Barrier flushes the pipeline in the processor, \r
- so that all instructions following the ISB are fetched from cache or \r
- memory, after the instruction has been completed.\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE void __ISB(void)\r
-{\r
- __ASM volatile ("isb");\r
-}\r
-\r
-\r
-/** \brief Data Synchronization Barrier\r
-\r
- This function acts as a special kind of Data Memory Barrier. \r
- It completes when all explicit memory accesses before this instruction complete.\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE void __DSB(void)\r
-{\r
- __ASM volatile ("dsb");\r
-}\r
-\r
-\r
-/** \brief Data Memory Barrier\r
-\r
- This function ensures the apparent order of the explicit memory operations before \r
- and after the instruction, without ensuring their completion.\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE void __DMB(void)\r
-{\r
- __ASM volatile ("dmb");\r
-}\r
-\r
-\r
-/** \brief Reverse byte order (32 bit)\r
-\r
- This function reverses the byte order in integer value.\r
-\r
- \param [in] value Value to reverse\r
- \return Reversed value\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __REV(uint32_t value)\r
-{\r
- uint32_t result;\r
- \r
- __ASM volatile ("rev %0, %1" : "=r" (result) : "r" (value) );\r
- return(result);\r
-}\r
-\r
-\r
-/** \brief Reverse byte order (16 bit)\r
-\r
- This function reverses the byte order in two unsigned short values.\r
-\r
- \param [in] value Value to reverse\r
- \return Reversed value\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __REV16(uint32_t value)\r
-{\r
- uint32_t result;\r
- \r
- __ASM volatile ("rev16 %0, %1" : "=r" (result) : "r" (value) );\r
- return(result);\r
-}\r
-\r
-\r
-/** \brief Reverse byte order in signed short value\r
-\r
- This function reverses the byte order in a signed short value with sign extension to integer.\r
-\r
- \param [in] value Value to reverse\r
- \return Reversed value\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE int32_t __REVSH(int32_t value)\r
-{\r
- uint32_t result;\r
- \r
- __ASM volatile ("revsh %0, %1" : "=r" (result) : "r" (value) );\r
- return(result);\r
-}\r
-\r
-\r
-#if (__CORTEX_M >= 0x03)\r
-\r
-/** \brief Reverse bit order of value\r
-\r
- This function reverses the bit order of the given value.\r
-\r
- \param [in] value Value to reverse\r
- \return Reversed value\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __RBIT(uint32_t value)\r
-{\r
- uint32_t result;\r
- \r
- __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) );\r
- return(result);\r
-}\r
-\r
-\r
-/** \brief LDR Exclusive (8 bit)\r
-\r
- This function performs a exclusive LDR command for 8 bit value.\r
-\r
- \param [in] ptr Pointer to data\r
- \return value of type uint8_t at (*ptr)\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE uint8_t __LDREXB(volatile uint8_t *addr)\r
-{\r
- uint8_t result;\r
- \r
- __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) );\r
- return(result);\r
-}\r
-\r
-\r
-/** \brief LDR Exclusive (16 bit)\r
-\r
- This function performs a exclusive LDR command for 16 bit values.\r
-\r
- \param [in] ptr Pointer to data\r
- \return value of type uint16_t at (*ptr)\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE uint16_t __LDREXH(volatile uint16_t *addr)\r
-{\r
- uint16_t result;\r
- \r
- __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) );\r
- return(result);\r
-}\r
-\r
-\r
-/** \brief LDR Exclusive (32 bit)\r
-\r
- This function performs a exclusive LDR command for 32 bit values.\r
-\r
- \param [in] ptr Pointer to data\r
- \return value of type uint32_t at (*ptr)\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __LDREXW(volatile uint32_t *addr)\r
-{\r
- uint32_t result;\r
- \r
- __ASM volatile ("ldrex %0, [%1]" : "=r" (result) : "r" (addr) );\r
- return(result);\r
-}\r
-\r
-\r
-/** \brief STR Exclusive (8 bit)\r
-\r
- This function performs a exclusive STR command for 8 bit values.\r
-\r
- \param [in] value Value to store\r
- \param [in] ptr Pointer to location\r
- \return 0 Function succeeded\r
- \return 1 Function failed\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr)\r
-{\r
- uint32_t result;\r
- \r
- __ASM volatile ("strexb %0, %2, [%1]" : "=&r" (result) : "r" (addr), "r" (value) );\r
- return(result);\r
-}\r
-\r
-\r
-/** \brief STR Exclusive (16 bit)\r
-\r
- This function performs a exclusive STR command for 16 bit values.\r
-\r
- \param [in] value Value to store\r
- \param [in] ptr Pointer to location\r
- \return 0 Function succeeded\r
- \return 1 Function failed\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr)\r
-{\r
- uint32_t result;\r
- \r
- __ASM volatile ("strexh %0, %2, [%1]" : "=&r" (result) : "r" (addr), "r" (value) );\r
- return(result);\r
-}\r
-\r
-\r
-/** \brief STR Exclusive (32 bit)\r
-\r
- This function performs a exclusive STR command for 32 bit values.\r
-\r
- \param [in] value Value to store\r
- \param [in] ptr Pointer to location\r
- \return 0 Function succeeded\r
- \return 1 Function failed\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr)\r
-{\r
- uint32_t result;\r
- \r
- __ASM volatile ("strex %0, %2, [%1]" : "=&r" (result) : "r" (addr), "r" (value) );\r
- return(result);\r
-}\r
-\r
-\r
-/** \brief Remove the exclusive lock\r
-\r
- This function removes the exclusive lock which is created by LDREX.\r
-\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE void __CLREX(void)\r
-{\r
- __ASM volatile ("clrex");\r
-}\r
-\r
-\r
-/** \brief Signed Saturate\r
-\r
- This function saturates a signed value.\r
-\r
- \param [in] value Value to be saturated\r
- \param [in] sat Bit position to saturate to (1..32)\r
- \return Saturated value\r
- */\r
-#define __SSAT(ARG1,ARG2) \\r
-({ \\r
- uint32_t __RES, __ARG1 = (ARG1); \\r
- __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \\r
- __RES; \\r
- })\r
-\r
-\r
-/** \brief Unsigned Saturate\r
-\r
- This function saturates an unsigned value.\r
-\r
- \param [in] value Value to be saturated\r
- \param [in] sat Bit position to saturate to (0..31)\r
- \return Saturated value\r
- */\r
-#define __USAT(ARG1,ARG2) \\r
-({ \\r
- uint32_t __RES, __ARG1 = (ARG1); \\r
- __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \\r
- __RES; \\r
- })\r
-\r
-\r
-/** \brief Count leading zeros\r
-\r
- This function counts the number of leading zeros of a data value.\r
-\r
- \param [in] value Value to count the leading zeros\r
- \return number of leading zeros in value\r
- */\r
-__attribute__( ( always_inline ) ) static __INLINE uint8_t __CLZ(uint32_t value)\r
-{\r
- uint8_t result;\r
- \r
- __ASM volatile ("clz %0, %1" : "=r" (result) : "r" (value) );\r
- return(result);\r
-}\r
-\r
-#endif /* (__CORTEX_M >= 0x03) */\r
-\r
-\r
-\r
-\r
-#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/\r
-/* TASKING carm specific functions */\r
-\r
-/*\r
- * The CMSIS functions have been implemented as intrinsics in the compiler.\r
- * Please use "carm -?i" to get an up to date list of all intrinsics,\r
- * Including the CMSIS ones.\r
- */\r
-\r
-#endif\r
-\r
-/*@}*/ /* end of group CMSIS_Core_InstructionInterface */\r
-\r
-#endif /* __CORE_CMINSTR_H */\r
+++ /dev/null
-/******************************************************************************\r
- * @file: system_LPC17xx.h\r
- * @purpose: CMSIS Cortex-M3 Device Peripheral Access Layer Header File\r
- * for the NXP LPC17xx Device Series \r
- * @version: V1.02\r
- * @date: 27. July 2009\r
- *----------------------------------------------------------------------------\r
- *\r
- * Copyright (C) 2009 ARM Limited. All rights reserved.\r
- *\r
- * ARM Limited (ARM) is supplying this software for use with Cortex-M3 \r
- * processor based microcontrollers. This file can be freely distributed \r
- * within development tools that are supporting such ARM based processors. \r
- *\r
- * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED\r
- * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF\r
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.\r
- * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR\r
- * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.\r
- *\r
- ******************************************************************************/\r
-\r
-\r
-#ifndef __SYSTEM_LPC17xx_H\r
-#define __SYSTEM_LPC17xx_H\r
-\r
-#ifdef __cplusplus\r
- extern "C" {\r
-#endif \r
-\r
-extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */\r
-\r
-\r
-/**\r
- * Initialize the system\r
- *\r
- * @param none\r
- * @return none\r
- *\r
- * @brief Setup the microcontroller system.\r
- * Initialize the System and update the SystemCoreClock variable.\r
- */\r
-extern void SystemInit (void);\r
-\r
-/**\r
- * Update SystemCoreClock variable\r
- *\r
- * @param none\r
- * @return none\r
- *\r
- * @brief Updates the SystemCoreClock with current core Clock \r
- * retrieved from cpu registers.\r
- */\r
-extern void SystemCoreClockUpdate (void);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif /* __SYSTEM_LPC17xx_H */\r
+++ /dev/null
-/* mbed Microcontroller Library - LocalFileSystem
- * Copyright (c) 2008-2009 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_LOCALFILESYSTEM_H
-#define MBED_LOCALFILESYSTEM_H
-
-#include "FileSystemLike.h"
-
-namespace mbed {
-
-FILEHANDLE local_file_open(const char* name, int flags);
-
-class LocalFileHandle : public FileHandle {
-
-public:
- LocalFileHandle(FILEHANDLE fh);
-
- virtual int close();
-
- virtual ssize_t write(const void *buffer, size_t length);
-
- virtual ssize_t read(void *buffer, size_t length);
-
- virtual int isatty();
-
- virtual off_t lseek(off_t position, int whence);
-
- virtual int fsync();
-
- virtual off_t flen();
-
-protected:
- FILEHANDLE _fh;
- int pos;
-};
-
-/* Class: LocalFileSystem
- * A filesystem for accessing the local mbed Microcontroller USB disk drive
- *
- * This allows programs to read and write files on the same disk drive that is used to program the
- * mbed Microcontroller. Once created, the standard C file access functions are used to open,
- * read and write files.
- *
- * Example:
- * > #include "mbed.h"
- * >
- * > LocalFileSystem local("local"); // Create the local filesystem under the name "local"
- * >
- * > int main() {
- * > FILE *fp = fopen("/local/out.txt", "w"); // Open "out.txt" on the local file system for writing
- * > fprintf(fp, "Hello World!");
- * > fclose(fp);
- * > remove("/local/out.txt"); // Removes the file "out.txt" from the local file system
- * >
- * > DIR *d = opendir("/local"); // Opens the root directory of the local file system
- * > struct dirent *p;
- * > while((p = readdir(d)) != NULL) { // Print the names of the files in the local file system
- * > printf("%s\n", p->d_name); // to stdout.
- * > }
- * > closedir(d);
- * > }
- *
- * Implementation Notes:
- * If the microcontroller program makes an access to the local drive, it will be marked as "removed"
- * on the Host computer. This means it is no longer accessible from the Host Computer.
- *
- * The drive will only re-appear when the microcontroller program exists. Note that if the program does
- * not exit, you will need to hold down reset on the mbed Microcontroller to be able to see the drive again!
- */
-class LocalFileSystem : public FileSystemLike {
-
-public:
-
- LocalFileSystem(const char* n) : FileSystemLike(n) {
-
- }
-
- virtual FileHandle *open(const char* name, int flags);
- virtual int remove(const char *filename);
- virtual DirHandle *opendir(const char *name);
-};
-
-} // namespace mbed
-
-#endif
+++ /dev/null
-/* mbed Microcontroller Library - PeripheralNames
- * Copyright (C) 2008-2011 ARM Limited. All rights reserved.
- *
- * Provides the mappings for peripherals
- */
-
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "cmsis.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
-
-enum UARTName {
- UART_0 = (int)LPC_UART0_BASE
- , UART_1 = (int)LPC_UART1_BASE
- , UART_2 = (int)LPC_UART2_BASE
- , UART_3 = (int)LPC_UART3_BASE
-};
-typedef enum UARTName UARTName;
-
-enum ADCName {
- ADC0_0 = 0
- , ADC0_1
- , ADC0_2
- , ADC0_3
- , ADC0_4
- , ADC0_5
- , ADC0_6
- , ADC0_7
-};
-typedef enum ADCName ADCName;
-
-enum DACName {
- DAC_0 = 0
-};
-typedef enum DACName DACName;
-
-enum SPIName {
- SPI_0 = (int)LPC_SSP0_BASE
- , SPI_1 = (int)LPC_SSP1_BASE
-};
-typedef enum SPIName SPIName;
-
-enum I2CName {
- I2C_0 = (int)LPC_I2C0_BASE
- , I2C_1 = (int)LPC_I2C1_BASE
- , I2C_2 = (int)LPC_I2C2_BASE
-};
-typedef enum I2CName I2CName;
-
-enum PWMName {
- PWM_1 = 1
- , PWM_2
- , PWM_3
- , PWM_4
- , PWM_5
- , PWM_6
-};
-typedef enum PWMName PWMName;
-
-enum TimerName {
- TIMER_0 = (int)LPC_TIM0_BASE
- , TIMER_1 = (int)LPC_TIM1_BASE
- , TIMER_2 = (int)LPC_TIM2_BASE
- , TIMER_3 = (int)LPC_TIM3_BASE
-};
-typedef enum TimerName TimerName;
-
-enum CANName {
- CAN_1 = (int)LPC_CAN1_BASE,
- CAN_2 = (int)LPC_CAN2_BASE
-};
-typedef enum CANName CANName;
-
-#define US_TICKER_TIMER TIMER_3
-#define US_TICKER_TIMER_IRQn TIMER3_IRQn
-
-#elif defined(TARGET_LPC11U24)
-
-enum UARTName {
- UART_0 = (int)LPC_USART_BASE
-};
-typedef enum UARTName UARTName;
-
-enum I2CName {
- I2C_0 = (int)LPC_I2C_BASE
-};
-typedef enum I2CName I2CName;
-
-enum TimerName {
- TIMER_0 = (int)LPC_CT32B0_BASE
- , TIMER_1 = (int)LPC_CT32B1_BASE
-};
-typedef enum TimerName TimerName;
-
-enum ADCName {
- ADC0_0 = 0
- , ADC0_1
- , ADC0_2
- , ADC0_3
- , ADC0_4
- , ADC0_5
- , ADC0_6
- , ADC0_7
-};
-typedef enum ADCName ADCName;
-
-enum SPIName {
- SPI_0 = (int)LPC_SSP0_BASE
- , SPI_1 = (int)LPC_SSP1_BASE
-};
-typedef enum SPIName SPIName;
-
-#define US_TICKER_TIMER TIMER_1
-#define US_TICKER_TIMER_IRQn TIMER_32_1_IRQn
-
-typedef enum PWMName {
- PWM_1 = 0
- , PWM_2
- , PWM_3
- , PWM_4
- , PWM_5
- , PWM_6
- , PWM_7
- , PWM_8
- , PWM_9
- , PWM_10
- , PWM_11
-} PWMName;
-
-#endif
-
-#define STDIO_UART_TX USBTX
-#define STDIO_UART_RX USBRX
-#define STDIO_UART UART_0
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
-/* mbed Microcontroller Library - PinNames\r
- * Copyright (C) 2008-2011 ARM Limited. All rights reserved.\r
- *\r
- * Provides the mapping of mbed DIP and LPC Pin Names\r
- */\r
-\r
-#ifndef MBED_PINNAMES_H\r
-#define MBED_PINNAMES_H\r
-\r
-#include "cmsis.h"\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)\r
-\r
-enum PinName {\r
-\r
- // LPC Pin Names\r
- P0_0 = LPC_GPIO0_BASE, P0_1, P0_2, P0_3, P0_4, P0_5, P0_6, P0_7\r
- , P0_8, P0_9, P0_10, P0_11, P0_12, P0_13, P0_14, P0_15\r
- , P0_16, P0_17, P0_18, P0_19, P0_20, P0_21, P0_22, P0_23\r
- , P0_24, P0_25, P0_26, P0_27, P0_28, P0_29, P0_30, P0_31\r
- , P1_0, P1_1, P1_2, P1_3, P1_4, P1_5, P1_6, P1_7\r
- , P1_8, P1_9, P1_10, P1_11, P1_12, P1_13, P1_14, P1_15\r
- , P1_16, P1_17, P1_18, P1_19, P1_20, P1_21, P1_22, P1_23\r
- , P1_24, P1_25, P1_26, P1_27, P1_28, P1_29, P1_30, P1_31\r
- , P2_0, P2_1, P2_2, P2_3, P2_4, P2_5, P2_6, P2_7\r
- , P2_8, P2_9, P2_10, P2_11, P2_12, P2_13, P2_14, P2_15\r
- , P2_16, P2_17, P2_18, P2_19, P2_20, P2_21, P2_22, P2_23\r
- , P2_24, P2_25, P2_26, P2_27, P2_28, P2_29, P2_30, P2_31\r
- , P3_0, P3_1, P3_2, P3_3, P3_4, P3_5, P3_6, P3_7\r
- , P3_8, P3_9, P3_10, P3_11, P3_12, P3_13, P3_14, P3_15\r
- , P3_16, P3_17, P3_18, P3_19, P3_20, P3_21, P3_22, P3_23\r
- , P3_24, P3_25, P3_26, P3_27, P3_28, P3_29, P3_30, P3_31\r
- , P4_0, P4_1, P4_2, P4_3, P4_4, P4_5, P4_6, P4_7\r
- , P4_8, P4_9, P4_10, P4_11, P4_12, P4_13, P4_14, P4_15\r
- , P4_16, P4_17, P4_18, P4_19, P4_20, P4_21, P4_22, P4_23\r
- , P4_24, P4_25, P4_26, P4_27, P4_28, P4_29, P4_30, P4_31\r
-\r
- // mbed DIP Pin Names\r
- , p5 = P0_9\r
- , p6 = P0_8\r
- , p7 = P0_7\r
- , p8 = P0_6\r
- , p9 = P0_0\r
- , p10 = P0_1\r
- , p11 = P0_18\r
- , p12 = P0_17\r
- , p13 = P0_15\r
- , p14 = P0_16\r
- , p15 = P0_23\r
- , p16 = P0_24\r
- , p17 = P0_25\r
- , p18 = P0_26\r
- , p19 = P1_30\r
- , p20 = P1_31\r
- , p21 = P2_5\r
- , p22 = P2_4\r
- , p23 = P2_3\r
- , p24 = P2_2\r
- , p25 = P2_1\r
- , p26 = P2_0\r
- , p27 = P0_11\r
- , p28 = P0_10\r
- , p29 = P0_5\r
- , p30 = P0_4\r
-\r
- // Other mbed Pin Names\r
-#ifdef MCB1700\r
- , LED1 = P1_28\r
- , LED2 = P1_29\r
- , LED3 = P1_31\r
- , LED4 = P2_2\r
-#else\r
- , LED1 = P1_18\r
- , LED2 = P1_20\r
- , LED3 = P1_21\r
- , LED4 = P1_23\r
-#endif\r
- , USBTX = P0_2\r
- , USBRX = P0_3\r
-\r
- // Not connected\r
- , NC = (int)0xFFFFFFFF\r
-\r
-};\r
-typedef enum PinName PinName;\r
-\r
-enum PinMode {\r
- PullUp = 0\r
- , PullDown = 3\r
- , PullNone = 2\r
- , OpenDrain = 4\r
-};\r
-typedef enum PinMode PinMode;\r
-\r
-// version of PINCON_TypeDef using register arrays\r
-typedef struct {\r
- __IO uint32_t PINSEL[11];\r
- uint32_t RESERVED0[5];\r
- __IO uint32_t PINMODE[10];\r
-#ifndef TARGET_LPC2368\r
-// Open drain mode is not available on LPC2368\r
- __IO uint32_t PINMODE_OD[5];\r
-#endif\r
-} PINCONARRAY_TypeDef;\r
-\r
-#define PINCONARRAY ((PINCONARRAY_TypeDef *)LPC_PINCON_BASE)\r
-\r
-\r
-#elif defined(TARGET_LPC11U24)\r
-\r
-enum PinName {\r
-\r
- // LPC11U Pin Names\r
- P0_0 = 0\r
- , P0_1 = 1\r
- , P0_2 = 2\r
- , P0_3 = 3\r
- , P0_4 = 4\r
- , P0_5 = 5\r
- , P0_6 = 6\r
- , P0_7 = 7\r
- , P0_8 = 8\r
- , P0_9 = 9\r
- , P0_10 = 10\r
- , P0_11 = 11\r
- , P0_12 = 12\r
- , P0_13 = 13\r
- , P0_14 = 14\r
- , P0_15 = 15\r
- , P0_16 = 16\r
- , P0_17 = 17\r
- , P0_18 = 18\r
- , P0_19 = 19\r
- , P0_20 = 20\r
- , P0_21 = 21\r
- , P0_22 = 22\r
- , P0_23 = 23\r
- , P0_24 = 24\r
- , P0_25 = 25\r
- , P0_26 = 26\r
- , P0_27 = 27\r
-\r
- , P1_0 = 32\r
- , P1_1 = 33\r
- , P1_2 = 34\r
- , P1_3 = 35\r
- , P1_4 = 36\r
- , P1_5 = 37\r
- , P1_6 = 38\r
- , P1_7 = 39\r
- , P1_8 = 40\r
- , P1_9 = 41\r
- , P1_10 = 42\r
- , P1_11 = 43\r
- , P1_12 = 44\r
- , P1_13 = 45\r
- , P1_14 = 46\r
- , P1_15 = 47\r
- , P1_16 = 48\r
- , P1_17 = 49\r
- , P1_18 = 50\r
- , P1_19 = 51\r
- , P1_20 = 52\r
- , P1_21 = 53\r
- , P1_22 = 54\r
- , P1_23 = 55\r
- , P1_24 = 56\r
- , P1_25 = 57\r
- , P1_26 = 58\r
- , P1_27 = 59\r
- , P1_28 = 60\r
- , P1_29 = 61\r
-\r
- , P1_31 = 63\r
-\r
- // mbed DIP Pin Names\r
- , p5 = P0_9\r
- , p6 = P0_8\r
- , p7 = P1_29\r
- , p8 = P0_2\r
- , p9 = P1_27\r
- , p10 = P1_26\r
- , p11 = P1_22\r
- , p12 = P1_21\r
- , p13 = P1_20\r
- , p14 = P1_23\r
- , p15 = P0_11\r
- , p16 = P0_12\r
- , p17 = P0_13\r
- , p18 = P0_14\r
- , p19 = P0_16\r
- , p20 = P0_22\r
- , p21 = P0_7\r
- , p22 = P0_17\r
- , p23 = P1_17\r
- , p24 = P1_18\r
- , p25 = P1_24\r
- , p26 = P1_25\r
- , p27 = P0_4\r
- , p28 = P0_5\r
- , p29 = P1_5\r
- , p30 = P1_2\r
-\r
- , p33 = P0_3\r
- , p34 = P1_15\r
- , p35 = P0_20\r
- , p36 = P0_21\r
-\r
- // Other mbed Pin Names\r
- , LED1 = P1_8\r
- , LED2 = P1_9\r
- , LED3 = P1_10\r
- , LED4 = P1_11\r
-\r
- , USBTX = P0_19\r
- , USBRX = P0_18\r
-\r
- // Not connected\r
- , NC = (int)0xFFFFFFFF\r
-\r
-};\r
-typedef enum PinName PinName;\r
-\r
-typedef enum {\r
- CHANNEL0=FLEX_INT0_IRQn,\r
- CHANNEL1=FLEX_INT1_IRQn,\r
- CHANNEL2=FLEX_INT2_IRQn,\r
- CHANNEL3=FLEX_INT3_IRQn,\r
- CHANNEL4=FLEX_INT4_IRQn,\r
- CHANNEL5=FLEX_INT5_IRQn,\r
- CHANNEL6=FLEX_INT6_IRQn,\r
- CHANNEL7=FLEX_INT7_IRQn\r
-} Channel;\r
-\r
-enum PinMode {\r
- PullUp = 2\r
- , PullDown = 1\r
- , PullNone = 0\r
- , Repeater = 3\r
- , OpenDrain = 4\r
-};\r
-typedef enum PinMode PinMode;\r
-#endif\r
-\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif\r
+++ /dev/null
-/* mbed Microcontroller Library - PortInOut\r
- * Copyright (c) 2006-2011 ARM Limited. All rights reserved.\r
- */ \r
- \r
-#ifndef MBED_PORTIN_H\r
-#define MBED_PORTIN_H\r
-\r
-#include "device.h"\r
-\r
-#if DEVICE_PORTIN\r
-\r
-#include "PortNames.h"\r
-#include "PinNames.h"\r
-\r
-namespace mbed {\r
-\r
-/* Class: PortIn\r
- * A multiple pin digital input\r
- *\r
- * Example:\r
- * > // Switch on an LED if any of mbed pins 21-26 is high\r
- * >\r
- * > #include "mbed.h"\r
- * >\r
- * > PortIn p(Port2, 0x0000003F); // p21-p26\r
- * > DigitalOut ind(LED4);\r
- * >\r
- * > int main() {\r
- * > while(1) {\r
- * > int pins = p.read();\r
- * > if(pins) {\r
- * > ind = 1;\r
- * > } else {\r
- * > ind = 0;\r
- * > }\r
- * > }\r
- * > }\r
- */\r
-class PortIn {\r
-public:\r
-\r
- /* Constructor: PortIn\r
- * Create an PortIn, connected to the specified port\r
- *\r
- * Variables:\r
- * port - Port to connect to (Port0-Port5)\r
- * mask - A bitmask to identify which bits in the port should be included (0 - ignore)\r
- */ \r
- PortIn(PortName port, int mask = 0xFFFFFFFF);\r
-\r
- /* Function: read\r
- * Read the value currently output on the port\r
- *\r
- * Variables:\r
- * returns - An integer with each bit corresponding to associated port pin setting\r
- */\r
- int read();\r
-\r
- /* Function: mode\r
- * Set the input pin mode\r
- *\r
- * Variables:\r
- * mode - PullUp, PullDown, PullNone, OpenDrain\r
- */\r
- void mode(PinMode mode);\r
- \r
- /* Function: operator int()\r
- * A shorthand for <read>\r
- */\r
- operator int() { \r
- return read();\r
- }\r
-\r
-private:\r
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)\r
- LPC_GPIO_TypeDef *_gpio;\r
-#endif\r
- PortName _port;\r
- uint32_t _mask;\r
-};\r
-\r
-} // namespace mbed\r
-\r
-#endif\r
-\r
-#endif\r
+++ /dev/null
-/* mbed Microcontroller Library - PortInOut\r
- * Copyright (c) 2006-2011 ARM Limited. All rights reserved.\r
- */ \r
- \r
-#ifndef MBED_PORTINOUT_H\r
-#define MBED_PORTINOUT_H\r
-\r
-#include "device.h"\r
-\r
-#if DEVICE_PORTINOUT\r
-\r
-#include "PortNames.h"\r
-#include "PinNames.h"\r
-\r
-namespace mbed {\r
-\r
-/* Class: PortInOut\r
- * A multiple pin digital in/out used to set/read multiple bi-directional pins\r
- */\r
-class PortInOut {\r
-public:\r
-\r
- /* Constructor: PortInOut\r
- * Create an PortInOut, connected to the specified port\r
- *\r
- * Variables:\r
- * port - Port to connect to (Port0-Port5)\r
- * mask - A bitmask to identify which bits in the port should be included (0 - ignore)\r
- */ \r
- PortInOut(PortName port, int mask = 0xFFFFFFFF);\r
-\r
- /* Function: write\r
- * Write the value to the output port\r
- *\r
- * Variables:\r
- * value - An integer specifying a bit to write for every corresponding port pin\r
- */ \r
- void write(int value);\r
-\r
- /* Function: read\r
- * Read the value currently output on the port\r
- *\r
- * Variables:\r
- * returns - An integer with each bit corresponding to associated port pin setting\r
- */\r
- int read();\r
-\r
- /* Function: output\r
- * Set as an output\r
- */\r
- void output();\r
-\r
- /* Function: input\r
- * Set as an input\r
- */\r
- void input();\r
-\r
- /* Function: mode\r
- * Set the input pin mode\r
- *\r
- * Variables:\r
- * mode - PullUp, PullDown, PullNone, OpenDrain\r
- */\r
- void mode(PinMode mode);\r
-\r
- /* Function: operator=\r
- * A shorthand for <write>\r
- */ \r
- PortInOut& operator= (int value) { \r
- write(value);\r
- return *this;\r
- }\r
- \r
- PortInOut& operator= (PortInOut& rhs) { \r
- write(rhs.read());\r
- return *this;\r
- }\r
- \r
- /* Function: operator int()\r
- * A shorthand for <read>\r
- */\r
- operator int() { \r
- return read();\r
- }\r
-\r
-private:\r
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)\r
- LPC_GPIO_TypeDef *_gpio;\r
-#endif\r
- PortName _port;\r
- uint32_t _mask;\r
-};\r
-\r
-} // namespace mbed\r
-\r
-#endif\r
-\r
-#endif\r
+++ /dev/null
-/* mbed Microcontroller Library - PortName
- * Copyright (c) 2010-2011 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_PORTNAMES_H
-#define MBED_PORTNAMES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
-
-enum PortName {
- Port0 = 0
- , Port1 = 1
- , Port2 = 2
- , Port3 = 3
- , Port4 = 4
-};
-typedef enum PortName PortName;
-
-#elif defined(TARGET_LPC11U24)
-
-enum PortName {
- Port0 = 0
- , Port1 = 1
-};
-typedef enum PortName PortName;
-
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-#endif
-
+++ /dev/null
-/* mbed Microcontroller Library - PortOut\r
- * Copyright (c) 2006-2011 ARM Limited. All rights reserved.\r
- */ \r
- \r
-#ifndef MBED_PORTOUT_H\r
-#define MBED_PORTOUT_H\r
-\r
-#include "device.h"\r
-\r
-#if DEVICE_PORTOUT\r
-\r
-#include "platform.h"\r
-#include "PinNames.h"\r
-#include "Base.h"\r
-\r
-#include "PortNames.h"\r
-\r
-namespace mbed {\r
-/* Class: PortOut\r
- * A multiple pin digital out\r
- *\r
- * Example:\r
- * > // Toggle all four LEDs\r
- * >\r
- * > #include "mbed.h"\r
- * >\r
- * > // LED1 = P1.18 LED2 = P1.20 LED3 = P1.21 LED4 = P1.23\r
- * > #define LED_MASK 0x00B40000\r
- * >\r
- * > PortOut ledport(Port1, LED_MASK);\r
- * >\r
- * > int main() {\r
- * > while(1) {\r
- * > ledport = LED_MASK;\r
- * > wait(1);\r
- * > ledport = 0;\r
- * > wait(1);\r
- * > }\r
- * > }\r
- */ \r
-class PortOut {\r
-public:\r
-\r
- /* Constructor: PortOut\r
- * Create an PortOut, connected to the specified port\r
- *\r
- * Variables:\r
- * port - Port to connect to (Port0-Port5)\r
- * mask - A bitmask to identify which bits in the port should be included (0 - ignore)\r
- */ \r
- PortOut(PortName port, int mask = 0xFFFFFFFF);\r
-\r
- /* Function: write\r
- * Write the value to the output port\r
- *\r
- * Variables:\r
- * value - An integer specifying a bit to write for every corresponding PortOut pin\r
- */ \r
- void write(int value);\r
-\r
- /* Function: read\r
- * Read the value currently output on the port\r
- *\r
- * Variables:\r
- * returns - An integer with each bit corresponding to associated PortOut pin setting\r
- */\r
- int read();\r
-\r
- /* Function: operator=\r
- * A shorthand for <write>\r
- */ \r
- PortOut& operator= (int value) { \r
- write(value);\r
- return *this;\r
- }\r
- \r
- PortOut& operator= (PortOut& rhs) { \r
- write(rhs.read());\r
- return *this;\r
- }\r
- \r
- /* Function: operator int()\r
- * A shorthand for <read>\r
- */\r
- operator int() { \r
- return read();\r
- }\r
-\r
-private:\r
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)\r
- LPC_GPIO_TypeDef *_gpio;\r
-#endif\r
- PortName _port;\r
- uint32_t _mask;\r
-};\r
-\r
-} // namespace mbed\r
-\r
-#endif\r
-\r
-#endif\r
+++ /dev/null
-/* mbed Microcontroller Library - PwmOut
- * Copyright (c) 2007-2011 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_PWMOUT_H
-#define MBED_PWMOUT_H
-
-#include "device.h"
-
-#if DEVICE_PWMOUT
-
-#include "platform.h"
-#include "PinNames.h"
-#include "PeripheralNames.h"
-#include "Base.h"
-
-namespace mbed {
-
-/* Class: PwmOut
- * A pulse-width modulation digital output
- *
- * Example
- * > // Fade a led on.
- * > #include "mbed.h"
- * >
- * > PwmOut led(LED1);
- * >
- * > int main() {
- * > while(1) {
- * > led = led + 0.01;
- * > wait(0.2);
- * > if(led == 1.0) {
- * > led = 0;
- * > }
- * > }
- * > }
- *
- * Note that on the LPC1768 and LPC2368, the PWMs all share the same
- * period - if you change the period for one, you change it for all.
- * Although routines that change the period maintain the duty cycle
- * for its PWM, all other PWMs will require their duty cycle to be
- * refreshed.
- */
-class PwmOut : public Base {
-
-public:
-
- /* Constructor: PwmOut
- * Create a PwmOut connected to the specified pin
- *
- * Variables:
- * pin - PwmOut pin to connect to
- */
- PwmOut(PinName pin, const char *name = NULL);
-
- /* Function: write
- * Set the ouput duty-cycle, specified as a percentage (float)
- *
- * Variables:
- * value - A floating-point value representing the output duty-cycle,
- * specified as a percentage. The value should lie between
- * 0.0f (representing on 0%) and 1.0f (representing on 100%).
- * Values outside this range will be saturated to 0.0f or 1.0f.
- */
- void write(float value);
-
- /* Function: read
- * Return the current output duty-cycle setting, measured as a percentage (float)
- *
- * Variables:
- * returns - A floating-point value representing the current duty-cycle being output on the pin,
- * measured as a percentage. The returned value will lie between
- * 0.0f (representing on 0%) and 1.0f (representing on 100%).
- *
- * Note:
- * This value may not match exactly the value set by a previous <write>.
- */
- float read();
-
- /* Function: period
- * Set the PWM period, specified in seconds (float), keeping the
- * duty cycle the same.
- *
- * Note:
- * The resolution is currently in microseconds; periods smaller than this
- * will be set to zero.
- */
- void period(float seconds);
-
- /* Function: period_ms
- * Set the PWM period, specified in milli-seconds (int), keeping the
- * duty cycle the same.
- */
- void period_ms(int ms);
-
- /* Function: period_us
- * Set the PWM period, specified in micro-seconds (int), keeping the
- * duty cycle the same.
- */
- void period_us(int us);
-
- /* Function: pulsewidth
- * Set the PWM pulsewidth, specified in seconds (float), keeping the
- * period the same.
- */
- void pulsewidth(float seconds);
-
- /* Function: pulsewidth_ms
- * Set the PWM pulsewidth, specified in milli-seconds (int), keeping
- * the period the same.
- */
- void pulsewidth_ms(int ms);
-
- /* Function: pulsewidth_us
- * Set the PWM pulsewidth, specified in micro-seconds (int), keeping
- * the period the same.
- */
- void pulsewidth_us(int us);
-
-#ifdef MBED_OPERATORS
- /* Function: operator=
- * A operator shorthand for <write()>
- */
- PwmOut& operator= (float value);
- PwmOut& operator= (PwmOut& rhs);
-
- /* Function: operator float()
- * An operator shorthand for <read()>
- */
- operator float();
-#endif
-
-#ifdef MBED_RPC
- virtual const struct rpc_method *get_rpc_methods();
- static struct rpc_class *get_rpc_class();
-#endif
-
-protected:
-
- PWMName _pwm;
-
-};
-
-} // namespace mbed
-
-#endif
-
-#endif
+++ /dev/null
-/* mbed Microcontroller Library - Serial\r
- * Copyright (c) 2007-2011 ARM Limited. All rights reserved.\r
- */ \r
- \r
-#ifndef MBED_SERIAL_H\r
-#define MBED_SERIAL_H\r
-\r
-#include "device.h"\r
-\r
-#if DEVICE_SERIAL\r
-\r
-#include "platform.h"\r
-#include "PinNames.h"\r
-#include "PeripheralNames.h"\r
-#include "Stream.h"\r
-#include "FunctionPointer.h"\r
-\r
-namespace mbed {\r
-\r
-/* Class: Serial\r
- * A serial port (UART) for communication with other serial devices\r
- *\r
- * Can be used for Full Duplex communication, or Simplex by specifying \r
- * one pin as NC (Not Connected)\r
- *\r
- * Example:\r
- * > // Print "Hello World" to the PC\r
- * >\r
- * > #include "mbed.h"\r
- * >\r
- * > Serial pc(USBTX, USBRX);\r
- * >\r
- * > int main() {\r
- * > pc.printf("Hello World\n");\r
- * > }\r
- */\r
-class Serial : public Stream {\r
-\r
-public:\r
-\r
- /* Constructor: Serial\r
- * Create a Serial port, connected to the specified transmit and receive pins\r
- *\r
- * Variables:\r
- * tx - Transmit pin \r
- * rx - Receive pin\r
- *\r
- * Note: Either tx or rx may be specified as NC if unused\r
- */\r
- Serial(PinName tx, PinName rx, const char *name = NULL);\r
-\r
- /* Function: baud\r
- * Set the baud rate of the serial port\r
- * \r
- * Variables:\r
- * baudrate - The baudrate of the serial port (default = 9600).\r
- */\r
- void baud(int baudrate);\r
-\r
- enum Parity {\r
- None = 0\r
- , Odd\r
- , Even\r
- , Forced1 \r
- , Forced0\r
- };\r
-\r
- enum IrqType {\r
- RxIrq = 0\r
- , TxIrq\r
- };\r
-\r
- /* Function: format\r
- * Set the transmission format used by the Serial port\r
- *\r
- * Variables:\r
- * bits - The number of bits in a word (5-8; default = 8)\r
- * parity - The parity used (Serial::None, Serial::Odd, Serial::Even, Serial::Forced1, Serial::Forced0; default = Serial::None)\r
- * stop - The number of stop bits (1 or 2; default = 1)\r
- */\r
- void format(int bits = 8, Parity parity = Serial::None, int stop_bits = 1); \r
-\r
-#if 0 // Inhereted from Stream, for documentation only\r
-\r
- /* Function: putc\r
- * Write a character\r
- *\r
- * Variables:\r
- * c - The character to write to the serial port\r
- */\r
- int putc(int c);\r
-\r
- /* Function: getc\r
- * Read a character\r
- *\r
- * Reads a character from the serial port. This will block until \r
- * a character is available. To see if a character is available, \r
- * see <readable>\r
- *\r
- * Variables:\r
- * returns - The character read from the serial port\r
- */\r
- int getc();\r
-\r
- /* Function: printf\r
- * Write a formated string\r
- *\r
- * Variables:\r
- * format - A printf-style format string, followed by the \r
- * variables to use in formating the string.\r
- */\r
- int printf(const char* format, ...);\r
-\r
- /* Function: scanf\r
- * Read a formated string \r
- *\r
- * Variables:\r
- * format - A scanf-style format string,\r
- * followed by the pointers to variables to store the results. \r
- */\r
- int scanf(const char* format, ...);\r
- \r
-#endif\r
- \r
- /* Function: readable\r
- * Determine if there is a character available to read\r
- *\r
- * Variables:\r
- * returns - 1 if there is a character available to read, else 0\r
- */\r
- int readable();\r
-\r
- /* Function: writeable\r
- * Determine if there is space available to write a character\r
- * \r
- * Variables:\r
- * returns - 1 if there is space to write a character, else 0\r
- */\r
- int writeable();\r
-\r
- /* Function: attach\r
- * Attach a function to call whenever a serial interrupt is generated\r
- *\r
- * Variables:\r
- * fptr - A pointer to a void function, or 0 to set as none\r
- * type - Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty)\r
- */\r
- void attach(void (*fptr)(void), IrqType type = RxIrq);\r
-\r
- /* Function: attach\r
- * Attach a member function to call whenever a serial interrupt is generated\r
- * \r
- * Variables:\r
- * tptr - pointer to the object to call the member function on\r
- * mptr - pointer to the member function to be called\r
- * type - Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty)\r
- */\r
- template<typename T>\r
- void attach(T* tptr, void (T::*mptr)(void), IrqType type = RxIrq) {\r
- if((mptr != NULL) && (tptr != NULL)) {\r
- _irq[type].attach(tptr, mptr);\r
- setup_interrupt(type);\r
- }\r
- }\r
-\r
-#ifdef MBED_RPC\r
- virtual const struct rpc_method *get_rpc_methods();\r
- static struct rpc_class *get_rpc_class();\r
-#endif\r
-\r
-protected:\r
-\r
- void setup_interrupt(IrqType type);\r
- void remove_interrupt(IrqType type);\r
-\r
- virtual int _getc();\r
- virtual int _putc(int c);\r
-\r
- UARTName _uart;\r
- FunctionPointer _irq[2];\r
- int _uidx;\r
-\r
-};\r
-\r
-} // namespace mbed\r
-\r
-#endif\r
-\r
-#endif\r
+++ /dev/null
-/* mbed Microcontroller Library - SerialHalfDuplex
- * Copyright (c) 2010-2011 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_SERIALHALFDUPLEX_H
-#define MBED_SERIALHALFDUPLEX_H
-
-#include "device.h"
-
-#if DEVICE_SERIAL
-
-#include "Serial.h"
-#include "PinNames.h"
-#include "PeripheralNames.h"
-
-namespace mbed {
-
-/* Class: SerialHalfDuplex
- * A serial port (UART) for communication with other devices using
- * Half-Duplex, allowing transmit and receive on a single
- * shared transmit and receive line. Only one end should be transmitting
- * at a time.
- *
- * Both the tx and rx pin should be defined, and wired together.
- * This is in addition to them being wired to the other serial
- * device to allow both read and write functions to operate.
- *
- * Example:
- * > // Send a byte to a second HalfDuplex device, and read the response
- * >
- * > #include "mbed.h"
- * >
- * > // p9 and p10 should be wired together to form "a"
- * > // p28 and p27 should be wired together to form "b"
- * > // p9/p10 should be wired to p28/p27 as the Half Duplex connection
- * >
- * > SerialHalfDuplex a(p9, p10);
- * > SerialHalfDuplex b(p28, p27);
- * >
- * > void b_rx() { // second device response
- * > b.putc(b.getc() + 4);
- * > }
- * >
- * > int main() {
- * > b.attach(&b_rx);
- * > for(int c = 'A'; c < 'Z'; c++) {
- * > a.putc(c);
- * > printf("sent [%c]\n", c);
- * > wait(0.5); // b should respond
- * > if(a.readable()) {
- * > printf("received [%c]\n", a.getc());
- * > }
- * > }
- * > }
- *
- * For Simplex and Full-Duplex Serial communication, see <Serial>
- */
-class SerialHalfDuplex : public Serial {
-
-public:
- /* Constructor: SerialHalfDuplex
- * Create a half-duplex serial port, connected to the specified transmit
- * and receive pins.
- *
- * These pins should be wired together, as well as to the target device
- *
- * Variables:
- * tx - Transmit pin
- * rx - Receive pin
- */
- SerialHalfDuplex(PinName tx, PinName rx, const char *name = NULL);
-
-#if 0 // Inherited from Serial class, for documentation
- /* Function: baud
- * Set the baud rate of the serial port
- *
- * Variables:
- * baudrate - The baudrate of the serial port (default = 9600).
- */
- void baud(int baudrate);
-
- enum Parity {
- None = 0
- , Odd
- , Even
- , Forced1
- , Forced0
- };
-
- /* Function: format
- * Set the transmission format used by the Serial port
- *
- * Variables:
- * bits - The number of bits in a word (5-8; default = 8)
- * parity - The parity used (Serial::None, Serial::Odd,
-Serial::Even, Serial::Forced1, Serial::Forced0; default = Serial::None)
- * stop - The number of stop bits (1 or 2; default = 1)
- */
- void format(int bits = 8, Parity parity = Serial::None, int stop_bits
-= 1);
-
- /* Function: putc
- * Write a character
- *
- * Variables:
- * c - The character to write to the serial port
- */
- int putc(int c);
-
- /* Function: getc
- * Read a character
- *
- * Read a character from the serial port. This call will block
- * until a character is available. For testing if a character is
- * available for reading, see <readable>.
- *
- * Variables:
- * returns - The character read from the serial port
- */
- int getc();
-
- /* Function: printf
- * Write a formated string
- *
- * Variables:
- * format - A printf-style format string, followed by the
- * variables to use in formating the string.
- */
- int printf(const char* format, ...);
-
- /* Function: scanf
- * Read a formated string
- *
- * Variables:
- * format - A scanf-style format string,
- * followed by the pointers to variables to store the results.
- */
- int scanf(const char* format, ...);
-
- /* Function: readable
- * Determine if there is a character available to read
- *
- * Variables:
- * returns - 1 if there is a character available to read, else 0
- */
- int readable();
-
- /* Function: writeable
- * Determine if there is space available to write a character
- *
- * Variables:
- * returns - 1 if there is space to write a character, else 0
- */
- int writeable();
-
- /* Function: attach
- * Attach a function to call whenever a serial interrupt is generated
- *
- * Variables:
- * fptr - A pointer to a void function, or 0 to set as none
- */
- void attach(void (*fptr)(void));
-
- /* Function: attach
- * Attach a member function to call whenever a serial interrupt is generated
- *
- * Variables:
- * tptr - pointer to the object to call the member function on
- * mptr - pointer to the member function to be called
- */
- template<typename T>
- void attach(T* tptr, void (T::*mptr)(void));
-
-#endif
-
-protected:
- PinName _txpin;
-
- virtual int _putc(int c);
- virtual int _getc(void);
-
-}; // End class SerialHalfDuplex
-
-} // End namespace
-
-#endif
-
-#endif
+++ /dev/null
-/* mbed Microcontroller Library - Stream
- * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_STREAM_H
-#define MBED_STREAM_H
-
-#include "FileLike.h"
-#include "platform.h"
-#include <cstdio>
-
-namespace mbed {
-
-class Stream : public FileLike {
-
-public:
-
- Stream(const char *name = NULL);
- virtual ~Stream();
-
- int putc(int c) {
- fflush(_file);
- return std::fputc(c, _file);
- }
- int puts(const char *s) {
- fflush(_file);
- return std::fputs(s, _file);
- }
- int getc() {
- fflush(_file);
- return std::fgetc(_file);
- }
- char *gets(char *s, int size) {
- fflush(_file);
- return std::fgets(s,size,_file);;
- }
- int printf(const char* format, ...);
- int scanf(const char* format, ...);
-
- operator std::FILE*() { return _file; }
-
- std::FILE *_file;
-#ifdef MBED_RPC
- virtual const struct rpc_method *get_rpc_methods();
-#endif
-
-protected:
-
- virtual int close();
- virtual ssize_t write(const void* buffer, size_t length);
- virtual ssize_t read(void* buffer, size_t length);
- virtual off_t lseek(off_t offset, int whence);
- virtual int isatty();
- virtual int fsync();
- virtual off_t flen();
-
- virtual int _putc(int c) = 0;
- virtual int _getc() = 0;
-
-
-};
-
-} // namespace mbed
-
-#endif
-
+++ /dev/null
-/* mbed Microcontroller Library - Ticker
- * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_TICKER_H
-#define MBED_TICKER_H
-
-#include "TimerEvent.h"
-#include "FunctionPointer.h"
-
-namespace mbed {
-
-/* Class: Ticker
- * A Ticker is used to call a function at a recurring interval
- *
- * You can use as many seperate Ticker objects as you require.
- *
- * Example:
- * > // Toggle the blinking led after 5 seconds
- * >
- * > #include "mbed.h"
- * >
- * > Ticker timer;
- * > DigitalOut led1(LED1);
- * > DigitalOut led2(LED2);
- * >
- * > int flip = 0;
- * >
- * > void attime() {
- * > flip = !flip;
- * > }
- * >
- * > int main() {
- * > timer.attach(&attime, 5);
- * > while(1) {
- * > if(flip == 0) {
- * > led1 = !led1;
- * > } else {
- * > led2 = !led2;
- * > }
- * > wait(0.2);
- * > }
- * > }
- *
- */
-class Ticker : public TimerEvent {
-
-public:
-
- /* Function: attach
- * Attach a function to be called by the Ticker, specifiying the interval in seconds
- *
- * Variables:
- * fptr - pointer to the function to be called
- * t - the time between calls in seconds
- */
- void attach(void (*fptr)(void), float t) {
- attach_us(fptr, t * 1000000.0f);
- }
-
- /* Function: attach
- * Attach a member function to be called by the Ticker, specifiying the interval in seconds
- *
- * Variables:
- * tptr - pointer to the object to call the member function on
- * mptr - pointer to the member function to be called
- * t - the time between calls in seconds
- */
- template<typename T>
- void attach(T* tptr, void (T::*mptr)(void), float t) {
- attach_us(tptr, mptr, t * 1000000.0f);
- }
-
- /* Function: attach_us
- * Attach a function to be called by the Ticker, specifiying the interval in micro-seconds
- *
- * Variables:
- * fptr - pointer to the function to be called
- * t - the time between calls in micro-seconds
- */
- void attach_us(void (*fptr)(void), unsigned int t) {
- _function.attach(fptr);
- setup(t);
- }
-
- /* Function: attach_us
- * Attach a member function to be called by the Ticker, specifiying the interval in micro-seconds
- *
- * Variables:
- * tptr - pointer to the object to call the member function on
- * mptr - pointer to the member function to be called
- * t - the time between calls in micro-seconds
- */
- template<typename T>
- void attach_us(T* tptr, void (T::*mptr)(void), unsigned int t) {
- _function.attach(tptr, mptr);
- setup(t);
- }
-
- /* Function: detach
- * Detach the function
- */
- void detach();
-
-protected:
-
- void setup(unsigned int t);
- virtual void handler();
-
- unsigned int _delay;
- FunctionPointer _function;
-
-};
-
-} // namespace mbed
-
-#endif
+++ /dev/null
-/* mbed Microcontroller Library - Timeout
- * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_TIMEOUT_H
-#define MBED_TIMEOUT_H
-
-#include "Ticker.h"
-
-namespace mbed {
-
-/* Class: Timeout
- * A Timeout is used to call a function at a point in the future
- *
- * You can use as many seperate Timeout objects as you require.
- *
- * Example:
- * > // Blink until timeout.
- * >
- * > #include "mbed.h"
- * >
- * > Timeout timeout;
- * > DigitalOut led(LED1);
- * >
- * > int on = 1;
- * >
- * > void attimeout() {
- * > on = 0;
- * > }
- * >
- * > int main() {
- * > timeout.attach(&attimeout, 5);
- * > while(on) {
- * > led = !led;
- * > wait(0.2);
- * > }
- * > }
- */
-class Timeout : public Ticker {
-
-#if 0 // For documentation
-
- /* Function: attach
- * Attach a function to be called by the Timeout, specifiying the delay in seconds
- *
- * Variables:
- * fptr - pointer to the function to be called
- * t - the time before the call in seconds
- */
- void attach(void (*fptr)(void), float t) {
- attach_us(fptr, t * 1000000.0f);
- }
-
- /* Function: attach
- * Attach a member function to be called by the Timeout, specifiying the delay in seconds
- *
- * Variables:
- * tptr - pointer to the object to call the member function on
- * mptr - pointer to the member function to be called
- * t - the time before the calls in seconds
- */
- template<typename T>
- void attach(T* tptr, void (T::*mptr)(void), float t) {
- attach_us(tptr, mptr, t * 1000000.0f);
- }
-
- /* Function: attach_us
- * Attach a function to be called by the Timeout, specifiying the delay in micro-seconds
- *
- * Variables:
- * fptr - pointer to the function to be called
- * t - the time before the call in micro-seconds
- */
- void attach_us(void (*fptr)(void), unsigned int t) {
- _function.attach(fptr);
- setup(t);
- }
-
- /* Function: attach_us
- * Attach a member function to be called by the Timeout, specifiying the delay in micro-seconds
- *
- * Variables:
- * tptr - pointer to the object to call the member function on
- * mptr - pointer to the member function to be called
- * t - the time before the call in micro-seconds
- */
- template<typename T>
- void attach_us(T* tptr, void (T::*mptr)(void), unsigned int t) {
- _function.attach(tptr, mptr);
- setup(t);
- }
-
- /* Function: detach
- * Detach the function
- */
- void detach();
-
-#endif
-
-protected:
-
- virtual void handler();
-
-};
-
-} // namespace mbed
-
-#endif
+++ /dev/null
-/* mbed Microcontroller Library - Timer\r
- * Copyright (c) 2007-2009 ARM Limited. All rights reserved.\r
- */ \r
- \r
-#ifndef MBED_TIMER_H\r
-#define MBED_TIMER_H\r
-\r
-#include "platform.h"\r
-#include "PinNames.h"\r
-#include "PeripheralNames.h"\r
-#include "Base.h"\r
-\r
-namespace mbed {\r
-\r
-/* Class: Timer\r
- * A general purpose timer \r
- *\r
- * Example:\r
- * > // Count the time to toggle a LED\r
- * >\r
- * > #include "mbed.h"\r
- * > \r
- * > Timer timer;\r
- * > DigitalOut led(LED1);\r
- * > int begin, end;\r
- * > \r
- * > int main() {\r
- * > timer.start();\r
- * > begin = timer.read_us();\r
- * > led = !led;\r
- * > end = timer.read_us();\r
- * > printf("Toggle the led takes %d us", end - begin);\r
- * > }\r
- */\r
-class Timer : public Base {\r
-\r
-public:\r
-\r
- Timer(const char *name = NULL);\r
- \r
- /* Function: start\r
- * Start the timer\r
- */\r
- void start(); \r
-\r
- /* Function: stop\r
- * Stop the timer\r
- */\r
- void stop(); \r
-\r
- /* Function: reset\r
- * Reset the timer to 0. \r
- *\r
- * If it was already counting, it will continue\r
- */\r
- void reset();\r
-\r
- /* Function: read\r
- * Get the time passed in seconds\r
- */\r
- float read();\r
-\r
- /* Function: read_ms\r
- * Get the time passed in mili-seconds\r
- */\r
- int read_ms();\r
-\r
- /* Function: read_us\r
- * Get the time passed in micro-seconds\r
- */\r
- int read_us();\r
-\r
-#ifdef MBED_OPERATORS \r
- operator float();\r
-#endif\r
-\r
-#ifdef MBED_RPC\r
- virtual const struct rpc_method *get_rpc_methods();\r
- static struct rpc_class *get_rpc_class();\r
-#endif\r
-\r
-protected:\r
-\r
- int slicetime(); \r
- int _running; // whether the timer is running\r
- unsigned int _start; // the start time of the latest slice\r
- int _time; // any accumulated time from previous slices\r
- \r
-};\r
-\r
-} // namespace mbed\r
-\r
-#endif\r
-\r
+++ /dev/null
-/* mbed Microcontroller Library - TimerEvent\r
- * Copyright (c) 2007-2009 ARM Limited. All rights reserved.\r
- */ \r
- \r
-#ifndef MBED_TIMEREVENT_H\r
-#define MBED_TIMEREVENT_H\r
-\r
-namespace mbed {\r
-\r
-// Base abstraction for timer interrupts\r
-class TimerEvent {\r
-\r
-public:\r
-\r
- TimerEvent();\r
- \r
- // The handler registered with the underlying timer interrupt\r
- static void irq();\r
-\r
- // Destruction removes it... \r
- virtual ~TimerEvent();\r
-\r
-protected:\r
-\r
- // The handler called to service the timer event of the derived class\r
- virtual void handler() = 0;\r
- \r
- // insert in to linked list\r
- void insert(unsigned int timestamp);\r
- \r
- // remove from linked list, if in it\r
- void remove();\r
- \r
- // Get the current usec timestamp\r
- static unsigned int timestamp();\r
-\r
- static TimerEvent *_head; // The head of the list of the events, NULL if none\r
- TimerEvent *_next; // Pointer to the next in the list, NULL if last\r
- unsigned int _timestamp; // The timestamp at which the even should be triggered\r
-\r
-};\r
-\r
-} // namespace mbed\r
-\r
-#endif\r
+++ /dev/null
-/* mbed Microcontroller Library - can_helper
- * Copyright (c) 2009 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_CAN_HELPER_H
-#define MBED_CAN_HELPER_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum CANFormat {
- CANStandard = 0,
- CANExtended = 1
-};
-typedef enum CANFormat CANFormat;
-
-enum CANType {
- CANData = 0,
- CANRemote = 1
-};
-typedef enum CANType CANType;
-
-struct CAN_Message {
- unsigned int id; // 29 bit identifier
- unsigned char data[8]; // Data field
- unsigned char len; // Length of data field in bytes
- CANFormat format; // 0 - STANDARD, 1- EXTENDED IDENTIFIER
- CANType type; // 0 - DATA FRAME, 1 - REMOTE FRAME
-};
-typedef struct CAN_Message CAN_Message;
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif // MBED_CAN_HELPER_H
+++ /dev/null
-
-#ifndef MBED_DEVICE_H
-#define MBED_DEVICE_H
-
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
-
-#define DEVICE_PORTIN 1
-#define DEVICE_PORTOUT 1
-#define DEVICE_PORTINOUT 1
-
-#define DEVICE_INTERRUPTIN 1
-
-#define DEVICE_ANALOGIN 1
-#define DEVICE_ANALOGOUT 1
-
-#define DEVICE_SERIAL 1
-
-#define DEVICE_I2C 1
-#define DEVICE_I2CSLAVE 1
-
-#define DEVICE_SPI 1
-#define DEVICE_SPISLAVE 1
-
-#define DEVICE_CAN 1
-
-#define DEVICE_RTC 1
-
-#define DEVICE_ETHERNET 1
-
-#define DEVICE_PWMOUT 1
-
-#elif defined(TARGET_LPC11U24)
-
-#define DEVICE_PORTIN 1
-#define DEVICE_PORTOUT 1
-#define DEVICE_PORTINOUT 1
-
-#define DEVICE_INTERRUPTIN 1
-
-#define DEVICE_ANALOGIN 1
-#define DEVICE_ANALOGOUT 0
-
-#define DEVICE_SERIAL 1
-
-#define DEVICE_I2C 1
-#define DEVICE_I2CSLAVE 1
-
-#define DEVICE_SPI 1
-#define DEVICE_SPISLAVE 1
-
-#define DEVICE_CAN 0
-
-#define DEVICE_RTC 0
-
-#define DEVICE_ETHERNET 0
-
-#define DEVICE_PWMOUT 1
-
-#endif
-
-#endif
-
+++ /dev/null
-/* mbed Microcontroller Library - error
- * Copyright (c) 2006-2009 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_ERROR_H
-#define MBED_ERROR_H
-
-/* Reporting Compile-Time Errors:
- * To generate a fatal compile-time error, you can use the pre-processor #error directive.
- *
- * > #error "That shouldn't have happened!"
- *
- * If the compiler evaluates this line, it will report the error and stop the compile.
- *
- * For example, you could use this to check some user-defined compile-time variables:
- *
- * > #define NUM_PORTS 7
- * > #if (NUM_PORTS > 4)
- * > #error "NUM_PORTS must be less than 4"
- * > #endif
- *
- * Reporting Run-Time Errors:
- * To generate a fatal run-time error, you can use the mbed error() function.
- *
- * > error("That shouldn't have happened!");
- *
- * If the mbed running the program executes this function, it will print the
- * message via the USB serial port, and then die with the blue lights of death!
- *
- * The message can use printf-style formatting, so you can report variables in the
- * message too. For example, you could use this to check a run-time condition:
- *
- * > if(x >= 5) {
- * > error("expected x to be less than 5, but got %d", x);
- * > }
- */
-
-#if 0 // for documentation only
-/* Function: error
- * Report a fatal runtime error
- *
- * Outputs the specified error message to stderr so it will appear via the USB
- * serial port, and then calls exit(1) to die with the blue lights of death.
- *
- * Variables:
- * format - printf-style format string, followed by associated variables
- */
-void error(const char* format, ...);
-#endif
-
-#include <stdlib.h>
-
-#ifdef NDEBUG
- #define error(...) (exit(1))
-#else
- #include <stdio.h>
- #define error(...) (fprintf(stderr, __VA_ARGS__), exit(1))
-#endif
-
-#endif
+++ /dev/null
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2011 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_H
-#define MBED_H
-
-#define MBED_LIBRARY_VERSION 29
-
-// Useful C libraries
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <time.h>
-
-// mbed Debug libraries
-
-#include "error.h"
-#include "mbed_interface.h"
-
-// mbed Peripheral components
-
-#include "DigitalIn.h"
-#include "DigitalOut.h"
-#include "DigitalInOut.h"
-#include "BusIn.h"
-#include "BusOut.h"
-#include "BusInOut.h"
-#include "PortIn.h"
-#include "PortInOut.h"
-#include "PortOut.h"
-#include "AnalogIn.h"
-#include "AnalogOut.h"
-#include "PwmOut.h"
-#include "Serial.h"
-#include "SerialHalfDuplex.h"
-// #include "SPI.h"
-// #include "SPISlave.h"
-// #include "SPIHalfDuplex.h"
-#include "I2C.h"
-#include "I2CSlave.h"
-#include "Ethernet.h"
-#include "CAN.h"
-
-// mbed Internal components
-#include "Timer.h"
-#include "Ticker.h"
-#include "Timeout.h"
-#include "LocalFileSystem.h"
-#include "InterruptIn.h"
-#include "wait_api.h"
-#include "rtc_time.h"
-
-using namespace mbed;
-using namespace std;
-
-#endif
-
+++ /dev/null
-/* Title: mbed_interface
- * Functions to control the mbed interface
- *
- * mbed Microcontrollers have a built-in interface to provide functionality such as
- * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file
- * system. These functions provide means to control the interface suing semihost
- * calls it supports.
- */
-
-/* mbed Microcontroller Library - mbed_interface
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_INTERFACE_H
-#define MBED_INTERFACE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Function: mbed_interface_connected
- * Determine whether the mbed interface is connected, based on whether debug is enabled
- *
- * Variables:
- * returns - 1 if interface is connected, else 0
- */
-int mbed_interface_connected(void);
-
-/* Function: mbed_interface_reset
- * Instruct the mbed interface to reset, as if the reset button had been pressed
- *
- * Variables:
- * returns - 1 if successful, else 0 (e.g. interface not present)
- */
-int mbed_interface_reset(void);
-
-/* Function: mbed_interface_disconnect
- * This will disconnect the debug aspect of the interface, so semihosting will be disabled.
- * The interface will still support the USB serial aspect
- *
- * Variables:
- * returns - 0 if successful, else -1 (e.g. interface not present)
- */
-int mbed_interface_disconnect(void);
-
-/* Function: mbed_interface_powerdown
- * This will disconnect the debug aspect of the interface, and if the USB cable is not
- * connected, also power down the interface. If the USB cable is connected, the interface
- * will remain powered up and visible to the host
- *
- * Variables:
- * returns - 0 if successful, else -1 (e.g. interface not present)
- */
-int mbed_interface_powerdown(void);
-
-/* Function: mbed_interface_uid
- * This returns a string containing the 32-character UID of the mbed interface
- *
- * This is a weak function that can be overwritten if required
- *
- * Variables:
- * uid - A 33-byte array to write the null terminated 32-byte string
- * returns - 0 if successful, else -1 (e.g. interface not present)
- */
-int mbed_interface_uid(char *uid);
-
-/* Function: mbed_mac_address
- * This returns a unique 6-byte MAC address, based on the interface UID
- *
- * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00)
- *
- * This is a weak function that can be overwritten if you want to provide your own mechanism to
- * provide a MAC address.
-
- * Variables:
- * mac - A 6-byte array to write the MAC address
- */
-void mbed_mac_address(char *mac);
-
-/* Function: mbed_die
- * Cause the mbed to flash the BLOD LED sequence
- */
-void mbed_die(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
-/* mbed Microcontroller Library - platform\r
- * Copyright (c) 2009 ARM Limited. All rights reserved.\r
- */ \r
- \r
-#ifndef MBED_PLATFORM_H\r
-#define MBED_PLATFORM_H\r
-\r
-#define MBED_RPC\r
-\r
-#define MBED_OPERATORS\r
-\r
-#endif\r
+++ /dev/null
-/* mbed Microcontroller Library - RPC\r
- * Copyright (c) 2008-2009 ARM Limited. All rights reserved.\r
- */ \r
- \r
-#ifndef MBED_RPC_H\r
-#define MBED_RPC_H\r
-\r
-/* Section rpc\r
- * Helpers for rpc handling.\r
- */\r
-\r
-#include <stdlib.h>\r
-#include <stdio.h>\r
-#include <string.h>\r
-#include <ctype.h>\r
-#include "Base.h"\r
-\r
-#include "PinNames.h"\r
-#include <stdint.h>\r
-\r
-namespace mbed {\r
-\r
-/* Function parse_arg\r
- * Parses and returns a value from a string.\r
- *\r
- * Variable\r
- * arg - The string to pase\r
- * next - If not NULL a pointer to after the last \r
- * character parsed is written here\r
- */\r
-template<typename T> T parse_arg(const char *arg, const char **next);\r
-\r
-inline char parse_char(const char *arg, const char **next) {\r
- char c = *arg++;\r
- if(c == '\\') {\r
- c = *arg++;\r
- switch(c) {\r
- case 'a': c = '\a'; break;\r
- case 'b': c = '\b'; break;\r
- case 't': c = '\t'; break;\r
- case 'n': c = '\n'; break;\r
- case 'v': c = '\v'; break;\r
- case 'f': c = '\f'; break;\r
- case 'r': c = '\r'; break;\r
- case 'x': \r
- {\r
- /* two-character hexadecimal */\r
- char buf[3];\r
- buf[0] = *arg++;\r
- buf[1] = *arg++;\r
- buf[2] = 0;\r
- c = strtol(buf, NULL, 16); \r
- }\r
- break;\r
- default: \r
- if(isdigit(c)) {\r
- /* three-character octal */\r
- char buf[4];\r
- buf[0] = c;\r
- buf[1] = *arg++;\r
- buf[2] = *arg++;\r
- buf[3] = 0;\r
- c = strtol(buf, NULL, 8); \r
- }\r
- break;\r
- }\r
- }\r
- *next = arg;\r
- return c;\r
-}\r
-\r
-/* signed integer types */\r
-\r
-template<> inline int parse_arg<int>(const char *arg, const char **next) {\r
- if(arg[0] == '\'') {\r
- char c = parse_char(arg+1, &arg);\r
- if(next != NULL) *next = arg+1;\r
- return c;\r
- } else {\r
- return strtol(arg, const_cast<char**>(next), 0); \r
- }\r
-}\r
-\r
-template<> inline char parse_arg<char>(const char *arg, const char **next) {\r
- return parse_arg<int>(arg,next);\r
-}\r
-\r
-template<> inline short int parse_arg<short int>(const char *arg, const char **next) {\r
- return parse_arg<int>(arg,next);\r
-}\r
-\r
-template<> inline long int parse_arg<long int>(const char *arg, const char **next) {\r
- return parse_arg<int>(arg,next);\r
-}\r
-\r
-template<> inline long long parse_arg<long long>(const char *arg, const char **next) {\r
- return strtoll(arg, const_cast<char**>(next), 0);\r
-}\r
-\r
-/* unsigned integer types */\r
-\r
-template<> inline unsigned int parse_arg<unsigned int>(const char *arg, const char **next) {\r
- if(arg[0] == '\'') {\r
- char c = parse_char(arg+1, &arg);\r
- if(next != NULL) *next = arg+1;\r
- return c;\r
- } else {\r
- return strtoul(arg, const_cast<char**>(next), 0); \r
- }\r
-}\r
-\r
-template<> inline unsigned char parse_arg<unsigned char>(const char *arg, const char **next) {\r
- return parse_arg<unsigned int>(arg,next);\r
-}\r
-\r
-template<> inline unsigned short int parse_arg<unsigned short int>(const char *arg, const char **next) {\r
- return parse_arg<unsigned int>(arg,next);\r
-}\r
-\r
-template<> inline unsigned long int parse_arg<unsigned long int>(const char *arg, const char **next) {\r
- return parse_arg<unsigned int>(arg,next);\r
-}\r
-\r
-template<> inline unsigned long long parse_arg<unsigned long long>(const char *arg, const char **next) {\r
- return strtoull(arg, const_cast<char**>(next), 0);\r
-}\r
-\r
-/* floating types */\r
-\r
-template<> inline float parse_arg<float>(const char *arg, const char **next) {\r
-#if !defined(__ARMCC_VERSION) || __ARMCC_VERSION >= 410000\r
- return strtof(arg,const_cast<char**>(next));\r
-#elif __ARMCC_VERSION >= 310000\r
- /* bug in header means no using declaration for strtof */\r
- return std::strtof(arg,const_cast<char**>(next)); \r
-#else\r
- /* strtof not supported */\r
- return strtod(arg,const_cast<char**>(next));\r
-#endif\r
-}\r
-\r
-template<> inline double parse_arg<double>(const char *arg, const char **next) {\r
- return strtod(arg,const_cast<char**>(next));\r
-}\r
-\r
-template<> inline long double parse_arg<long double>(const char *arg, const char **next) {\r
- return strtod(arg,const_cast<char**>(next));\r
-}\r
-\r
-/* string */\r
-\r
-template<> inline char *parse_arg<char*>(const char *arg, const char **next) {\r
- const char *ptr = arg;\r
- char *res = NULL;\r
- if(*arg == '"') {\r
- /* quoted string */\r
- ptr = ++arg;\r
- int len = 0;\r
- /* find the end (and length) of the quoted string */\r
- for(char c = *ptr; c != 0 && c != '"'; c = *++ptr) {\r
- len++;\r
- if(c == '\\') {\r
- ptr++;\r
- }\r
- }\r
- /* copy the quoted string, and unescape characters */\r
- if(len != 0) {\r
- res = new char[len+1];\r
- char *resptr = res;\r
- while(arg != ptr) {\r
- *resptr++ = parse_char(arg, &arg);\r
- }\r
- *resptr = 0;\r
- }\r
- } else {\r
- /* unquoted string */\r
- while(isalnum(*ptr) || *ptr=='_') {\r
- ptr++;\r
- }\r
- int len = ptr-arg;\r
- if(len!=0) {\r
- res = new char[len+1];\r
- memcpy(res, arg, len);\r
- res[len] = 0;\r
- }\r
- }\r
-\r
- if(next != NULL) {\r
- *next = ptr;\r
- }\r
- return res;\r
-}\r
-\r
-template<> inline const char *parse_arg<const char*>(const char *arg, const char **next) {\r
- return parse_arg<char*>(arg,next);\r
-}\r
-\r
-/* Pins */\r
-\r
-\r
-inline PinName parse_pins(const char *str) {\r
- const PinName pin_names[] = {p5, p6, p7, p8, p9, p10, p11, p12, p13, p14\r
- , p15, p16, p17, p18, p19, p20, p21, p22, p23\r
- , p24, p25, p26, p27, p28, p29, p30};\r
-\r
- if(str[0] == 'P') { // Pn_n\r
- uint32_t port = str[1] - '0';\r
- uint32_t pin = str[3] - '0'; // Pn_n\r
- uint32_t pin2 = str[4] - '0'; // Pn_nn\r
- if(pin2 <= 9) {\r
- pin = pin * 10 + pin2;\r
- }\r
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)\r
- return (PinName)(LPC_GPIO0_BASE + port * 32 + pin);\r
-#elif defined(TARGET_LPC11U24)\r
- return (PinName)(port * 32 + pin);\r
-#endif\r
- } else if(str[0] == 'p') { // pn\r
- uint32_t pin = str[1] - '0'; // pn\r
- uint32_t pin2 = str[2] - '0'; // pnn\r
- if(pin2 <= 9) {\r
- pin = pin * 10 + pin2;\r
- }\r
- if(pin < 5 || pin > 30) {\r
- return NC;\r
- }\r
- return pin_names[pin - 5];\r
- } else if(str[0] == 'L') { // LEDn\r
- switch(str[3]) {\r
- case '1' : return LED1;\r
- case '2' : return LED2;\r
- case '3' : return LED3;\r
- case '4' : return LED4;\r
- }\r
- } else if(str[0] == 'U') { // USB?X\r
- switch(str[3]) {\r
- case 'T' : return USBTX;\r
- case 'R' : return USBRX;\r
- }\r
- }\r
- return NC;\r
-}\r
-\r
-template<> inline PinName parse_arg<PinName>(const char *arg, const char **next) {\r
- const char *ptr = arg;\r
- PinName pinname = NC;\r
- while(isalnum(*ptr) || *ptr=='_') {\r
- ptr++;\r
- }\r
- int len = ptr-arg;\r
- if(len!=0) {\r
- pinname = parse_pins(arg);\r
- \r
- }\r
- if(next != NULL) {\r
- *next = ptr;\r
- }\r
- return pinname;\r
-}\r
-\r
-\r
-/* Function write_result\r
- * Writes a value in to a result string in an appropriate manner\r
- *\r
- * Variable\r
- * val - The value to write\r
- * result - A pointer to the array to write the value into\r
- */\r
-template<typename T> void write_result(T val, char *result);\r
-\r
-/* signed integer types */\r
-\r
-template<> inline void write_result<char>(char val, char *result) {\r
- result[0] = val;\r
- result[1] = '\0';\r
-}\r
-\r
-template<> inline void write_result<short int>(short int val, char *result) {\r
- sprintf(result, "%hi", val); \r
-}\r
-\r
-template<> inline void write_result<int>(int val, char *result) {\r
- sprintf(result, "%i", val); \r
-}\r
-\r
-template<> inline void write_result<long int>(long int val, char *result) {\r
- sprintf(result, "%li", val); \r
-}\r
-\r
-template<> inline void write_result<long long int>(long long int val, char *result) {\r
- sprintf(result, "%lli", val); \r
-}\r
-\r
-/* unsigned integer types */\r
-\r
-template<> inline void write_result<unsigned char>(unsigned char val, char *result) {\r
- result[0] = val;\r
- result[1] = '\0';\r
-}\r
-\r
-template<> inline void write_result<unsigned short int>(unsigned short int val, char *result) {\r
- sprintf(result, "%hu", val); \r
-}\r
-\r
-template<> inline void write_result<unsigned int>(unsigned int val, char *result) {\r
- sprintf(result, "%u", val); \r
-}\r
-\r
-template<> inline void write_result<unsigned long int>(unsigned long int val, char *result) {\r
- sprintf(result, "%lu", val); \r
-}\r
-\r
-template<> inline void write_result<unsigned long long int>(unsigned long long int val, char *result) {\r
- sprintf(result, "%llu", val); \r
-}\r
-\r
-/* floating types */\r
-\r
-template<> inline void write_result<float>(float val, char *result) {\r
- sprintf(result, "%.17g", val); \r
-}\r
-\r
-template<> inline void write_result<double>(double val, char *result) {\r
- sprintf(result, "%.17g", val); \r
-}\r
-\r
-template<> inline void write_result<long double>(long double val, char *result) {\r
- sprintf(result, "%.17Lg", val); \r
-}\r
-\r
-\r
-/* string */\r
-\r
-template<> inline void write_result<char*>(char *val, char *result) {\r
- if(val==NULL) {\r
- result[0] = 0;\r
- } else {\r
- strcpy(result, val);\r
- }\r
-}\r
-\r
-template<> inline void write_result<const char*>(const char *val, char *result) {\r
- if(val==NULL) {\r
- result[0] = 0;\r
- } else {\r
- strcpy(result, val);\r
- }\r
-}\r
-\r
-\r
-inline const char *next_arg(const char* next) {\r
- while(*next == ' ') next++;\r
- if(*next == ',' || *next == '?') next++;\r
- while(*next == ' ') next++;\r
- return next;\r
-}\r
-\r
-\r
-/* Function rpc_method_caller\r
- */\r
-template<class T, void (T::*member)(const char *,char *)> \r
-void rpc_method_caller(Base *this_ptr, const char *arguments, char *result) {\r
- (static_cast<T*>(this_ptr)->*member)(arguments,result); \r
-}\r
-\r
-\r
-/* Function rpc_method_caller\r
- */\r
-template<class T, void (T::*member)()> \r
-void rpc_method_caller(Base *this_ptr, const char *arguments, char *result) { \r
- (static_cast<T*>(this_ptr)->*member)(); \r
- if(result != NULL) {\r
- result[0] = '\0';\r
- }\r
-}\r
-\r
-\r
-/* Function rpc_method_caller\r
- */\r
-template<class T, typename A1, void (T::*member)(A1)> \r
-void rpc_method_caller(Base *this_ptr, const char *arguments, char *result) {\r
-\r
- const char *next = arguments;\r
- A1 arg1 = parse_arg<A1>(next_arg(next),NULL);\r
-\r
- (static_cast<T*>(this_ptr)->*member)(arg1); \r
- if(result != NULL) {\r
- result[0] = '\0';\r
- }\r
-}\r
-\r
-\r
-/* Function rpc_method_caller\r
- */\r
-template<class T, typename A1, typename A2, void (T::*member)(A1,A2)> \r
-void rpc_method_caller(Base *this_ptr, const char *arguments, char *result) {\r
-\r
- const char *next = arguments;\r
- A1 arg1 = parse_arg<A1>(next_arg(next),&next);\r
- A2 arg2 = parse_arg<A2>(next_arg(next),NULL);\r
-\r
- (static_cast<T*>(this_ptr)->*member)(arg1,arg2);\r
- if(result != NULL) {\r
- result[0] = '\0';\r
- }\r
-}\r
-\r
-\r
-/* Function rpc_method_caller\r
- */\r
-template<class T, typename A1, typename A2, typename A3, void (T::*member)(A1,A2,A3)> \r
-void rpc_method_caller(Base *this_ptr, const char *arguments, char *result) {\r
-\r
- const char *next = arguments;\r
- A1 arg1 = parse_arg<A1>(next_arg(next),&next);\r
- A2 arg2 = parse_arg<A2>(next_arg(next),&next);\r
- A3 arg3 = parse_arg<A3>(next_arg(next),NULL);\r
-\r
- (static_cast<T*>(this_ptr)->*member)(arg1,arg2,arg3);\r
- if(result != NULL) {\r
- result[0] = '\0';\r
- }\r
-}\r
-\r
-\r
-/* Function rpc_method_caller\r
- */\r
-template<typename R, class T, R (T::*member)()> \r
-void rpc_method_caller(Base *this_ptr, const char *arguments, char *result) { \r
- R res = (static_cast<T*>(this_ptr)->*member)();\r
- if(result != NULL) {\r
- write_result<R>(res, result);\r
- }\r
-}\r
-\r
-\r
-/* Function rpc_method_caller\r
- */\r
-template<typename R, class T, typename A1, R (T::*member)(A1)> \r
-void rpc_method_caller(Base *this_ptr, const char *arguments, char *result) {\r
-\r
- const char *next = arguments;\r
- A1 arg1 = parse_arg<A1>(next_arg(next),NULL);\r
-\r
- R res = (static_cast<T*>(this_ptr)->*member)(arg1);\r
- if(result != NULL) {\r
- write_result<R>(res, result);\r
- }\r
-}\r
-\r
-\r
-/* Function rpc_method_caller\r
- */\r
-template<typename R, class T, typename A1, typename A2, R (T::*member)(A1,A2)> \r
-void rpc_method_caller(Base *this_ptr, const char *arguments, char *result) {\r
-\r
- const char *next = arguments;\r
- A1 arg1 = parse_arg<A1>(next_arg(next),&next);\r
- A2 arg2 = parse_arg<A2>(next_arg(next),NULL);\r
-\r
- R res = (static_cast<T*>(this_ptr)->*member)(arg1,arg2);\r
- if(result != NULL) {\r
- write_result<R>(res, result);\r
- }\r
-}\r
-\r
-\r
-/* Function rpc_method_caller\r
- */\r
-template<typename R, class T, typename A1, typename A2, typename A3, R (T::*member)(A1,A2,A3)> \r
-void rpc_method_caller(Base *this_ptr, const char *arguments, char *result) {\r
-\r
- const char *next = arguments;\r
- A1 arg1 = parse_arg<A1>(next_arg(next),&next);\r
- A2 arg2 = parse_arg<A2>(next_arg(next),&next);\r
- A3 arg3 = parse_arg<A3>(next_arg(next),NULL);\r
-\r
- R res = (static_cast<T*>(this_ptr)->*member)(arg1,arg2,arg3);\r
- if(result != NULL) {\r
- write_result<R>(res, result);\r
- }\r
-}\r
-\r
-\r
-/* Function rpc_function caller\r
- */\r
-template<typename R, R (*func)()>\r
-void rpc_function_caller(const char *arguments, char *result) {\r
- R res = (*func)();\r
- if(result != NULL) {\r
- write_result<R>(res, result);\r
- }\r
-}\r
-\r
-\r
-/* Function rpc_function caller\r
- */\r
-template<typename R, typename A1, R (*func)(A1)>\r
-void rpc_function_caller(const char *arguments, char *result) {\r
- A1 arg1 = parse_arg<A1>(next_arg(arguments),NULL);\r
- R res = (*func)(arg1);\r
- if(result != NULL) {\r
- write_result<R>(res, result);\r
- }\r
-}\r
-\r
-\r
-/* Function rpc_function caller\r
- */\r
-template<typename R, typename A1, typename A2, R (*func)(A1,A2)>\r
-void rpc_function_caller(const char *arguments, char *result) {\r
-\r
- const char *next = arguments;\r
- A1 arg1 = parse_arg<A1>(next_arg(next),&next);\r
- A2 arg2 = parse_arg<A2>(next_arg(next),NULL);\r
-\r
- R res = (*func)(arg1,arg2);\r
- if(result != NULL) {\r
- write_result<R>(res, result);\r
- }\r
-}\r
-\r
-\r
-/* Function rpc_function caller\r
- */\r
-template<typename R, typename A1, typename A2, typename A3, R (*func)(A1,A2,A3)>\r
-void rpc_function_caller(const char *arguments, char *result) {\r
-\r
- const char *next = arguments;\r
- A1 arg1 = parse_arg<A1>(next_arg(next),&next);\r
- A2 arg2 = parse_arg<A2>(next_arg(next),&next);\r
- A3 arg3 = parse_arg<A3>(next_arg(next),NULL);\r
-\r
- R res = (*func)(arg1,arg2,arg3);\r
- if(result != NULL) {\r
- write_result<R>(res, result);\r
- }\r
-}\r
-\r
-\r
-/* Function rpc_function caller\r
- */\r
-template<typename R, typename A1, typename A2, typename A3, typename A4, R (*func)(A1,A2,A3,A4)>\r
-void rpc_function_caller(const char *arguments, char *result) {\r
-\r
- const char *next = arguments;\r
- A1 arg1 = parse_arg<A1>(next_arg(next),&next);\r
- A2 arg2 = parse_arg<A2>(next_arg(next),&next);\r
- A3 arg3 = parse_arg<A3>(next_arg(next),&next);\r
- A4 arg4 = parse_arg<A4>(next_arg(next),NULL);\r
-\r
- R res = (*func)(arg1,arg2,arg3,arg4);\r
- if(result != NULL) {\r
- write_result<R>(res, result);\r
- }\r
-}\r
-\r
-\r
-struct rpc_method { \r
- const char *name;\r
- typedef void (*caller_t)(Base*, const char*, char*);\r
- typedef const struct rpc_method *(*super_t)(Base*);\r
- union {\r
- caller_t caller;\r
- super_t super;\r
- };\r
-};\r
-\r
-template<class C>\r
-const struct rpc_method *rpc_super(Base *this_ptr) {\r
- return static_cast<C*>(this_ptr)->C::get_rpc_methods();\r
-}\r
-\r
-#define RPC_METHOD_END { NULL, NULL }\r
-#define RPC_METHOD_SUPER(C) { NULL, (rpc_method::caller_t)(rpc_method::super_t)rpc_super<C> }\r
-\r
-/* Function rpc\r
- * Parse a string describing a call and then do it\r
- *\r
- * Variables\r
- * call - A pointer to a string describing the call, which has\r
- * the form /object/method arg ... argn. Arguments are\r
- * delimited by space characters, and the string is terminated\r
- * by a null character.\r
- * result - A pointer to an array to write the result into.\r
- */\r
-bool rpc(const char *buf, char *result = 0);\r
-\r
-\r
-} // namespace mbed\r
-\r
-#endif\r
+++ /dev/null
-/* Title: time\r
- * Implementation of the C time.h functions\r
- *\r
- * Provides mechanisms to set and read the current time, based\r
- * on the microcontroller Real-Time Clock (RTC), plus some \r
- * standard C manipulation and formating functions. \r
- *\r
- * Example:\r
- * > #include "mbed.h"\r
- * >\r
- * > int main() {\r
- * > set_time(1256729737); // Set RTC time to Wed, 28 Oct 2009 11:35:37\r
- * > \r
- * > while(1) { \r
- * > time_t seconds = time(NULL);\r
- * > \r
- * > printf("Time as seconds since January 1, 1970 = %d\n", seconds);\r
- * > \r
- * > printf("Time as a basic string = %s", ctime(&seconds));\r
- * >\r
- * > char buffer[32];\r
- * > strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));\r
- * > printf("Time as a custom formatted string = %s", buffer);\r
- * > \r
- * > wait(1);\r
- * > }\r
- * > }\r
- */\r
- \r
-/* mbed Microcontroller Library - rtc_time\r
- * Copyright (c) 2009 ARM Limited. All rights reserved.\r
- */\r
-\r
-#include <time.h>\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-#if 0 // for documentation only\r
-/* Function: time\r
- * Get the current time\r
- *\r
- * Returns the current timestamp as the number of seconds since January 1, 1970\r
- * (the UNIX timestamp). The value is based on the current value of the \r
- * microcontroller Real-Time Clock (RTC), which can be set using <set_time>.\r
- *\r
- * Example:\r
- * > #include "mbed.h"\r
- * >\r
- * > int main() {\r
- * > time_t seconds = time(NULL);\r
- * > printf("It is %d seconds since January 1, 1970\n", seconds);\r
- * > }\r
- *\r
- * Variables:\r
- * t - Pointer to a time_t to be set, or NULL if not used\r
- * returns - Number of seconds since January 1, 1970 (the UNIX timestamp)\r
- */\r
-time_t time(time_t *t);\r
-#endif\r
-\r
-/* Function: set_time\r
- * Set the current time\r
- *\r
- * Initialises and sets the time of the microcontroller Real-Time Clock (RTC)\r
- * to the time represented by the number of seconds since January 1, 1970 \r
- * (the UNIX timestamp). \r
- * \r
- * Example:\r
- * > #include "mbed.h"\r
- * >\r
- * > int main() {\r
- * > set_time(1256729737); // Set time to Wed, 28 Oct 2009 11:35:37\r
- * > }\r
- *\r
- * Variables:\r
- * t - Number of seconds since January 1, 1970 (the UNIX timestamp) \r
- */ \r
-void set_time(time_t t);\r
-\r
-#if 0 // for documentation only\r
-/* Function: mktime\r
- * Converts a tm structure in to a timestamp\r
- * \r
- * Converts the tm structure in to a timestamp in seconds since January 1, 1970\r
- * (the UNIX timestamp). The values of tm_wday and tm_yday of the tm structure \r
- * are also updated to their appropriate values.\r
- *\r
- * Example:\r
- * > #include "mbed.h"\r
- * >\r
- * > int main() {\r
- * > // setup time structure for Wed, 28 Oct 2009 11:35:37\r
- * > struct tm t;\r
- * > t.tm_sec = 37; // 0-59\r
- * > t.tm_min = 35; // 0-59\r
- * > t.tm_hour = 11; // 0-23\r
- * > t.tm_mday = 28; // 1-31\r
- * > t.tm_mon = 9; // 0-11\r
- * > t.tm_year = 109; // year since 1900\r
- * > \r
- * > // convert to timestamp and display (1256729737)\r
- * > time_t seconds = mktime(&t);\r
- * > printf("Time as seconds since January 1, 1970 = %d\n", seconds);\r
- * > }\r
- * \r
- * Variables:\r
- * t - The tm structure to convert\r
- * returns - The converted timestamp\r
- */\r
-time_t mktime(struct tm *t);\r
-#endif\r
-\r
-#if 0 // for documentation only\r
-/* Function: localtime\r
- * Converts a timestamp in to a tm structure\r
- * \r
- * Converts the timestamp pointed to by t to a (statically allocated) \r
- * tm structure. \r
- *\r
- * Example:\r
- * > #include "mbed.h"\r
- * >\r
- * > int main() {\r
- * > time_t seconds = 1256729737;\r
- * > struct tm *t = localtime(&seconds);\r
- * > }\r
- * \r
- * Variables:\r
- * t - Pointer to the timestamp\r
- * returns - Pointer to the (statically allocated) tm structure\r
- */\r
-struct tm *localtime(const time_t *t);\r
-#endif\r
-\r
-#if 0 // for documentation only\r
-/* Function: ctime\r
- * Converts a timestamp to a human-readable string\r
- * \r
- * Converts a time_t timestamp in seconds since January 1, 1970 (the UNIX\r
- * timestamp) to a human readable string format. The result is of the \r
- * format: "Wed Oct 28 11:35:37 2009\n"\r
- *\r
- * Example:\r
- * > #include "mbed.h"\r
- * >\r
- * > int main() {\r
- * > time_t seconds = time(NULL);\r
- * > printf("Time as a string = %s", ctime(&seconds));\r
- * > }\r
- * \r
- * Variables:\r
- * t - The timestamp to convert\r
- * returns - Pointer to a (statically allocated) string containing the\r
- * human readable representation, including a '\n' character\r
- */\r
-char *ctime(const time_t *t);\r
-#endif\r
- \r
-#if 0 // for documentation only\r
-/* Function: strftime\r
- * Converts a tm structure to a custom format human-readable string\r
- * \r
- * Creates a formated string from a tm structure, based on a string format \r
- * specifier provided.\r
- *\r
- * Format Specifiers: \r
- * %S - Second (00-59)\r
- * %M - Minute (00-59)\r
- * %H - Hour (00-23)\r
- * %d - Day (01-31)\r
- * %m - Month (01-12)\r
- * %Y/%y - Year (2009/09)\r
- *\r
- * %A/%a - Weekday Name (Monday/Mon)\r
- * %B/%b - Month Name (January/Jan)\r
- * %I - 12 Hour Format (01-12)\r
- * %p - "AM" or "PM"\r
- * %X - Time (14:55:02)\r
- * %x - Date (08/23/01)\r
- * \r
- * Example:\r
- * > #include "mbed.h"\r
- * >\r
- * > int main() {\r
- * > time_t seconds = time(NULL);\r
- * > \r
- * > char buffer[32];\r
- * > strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));\r
- * > printf("Time as a formatted string = %s", buffer);\r
- * > } \r
- * \r
- * Variables:\r
- * buffer - String buffer to store the result\r
- * max - Maximum number of characters to store in the buffer\r
- * format - Format specifier string\r
- * t - Pointer to the tm structure to convert\r
- * returns - Number of characters copied\r
- */\r
-size_t strftime(char *buffer, size_t max, const char *format, const struct tm *t);\r
-#endif\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif \r
+++ /dev/null
-/* mbed Microcontroller Library - us_ticker_api
- * Copyright (c) 2009 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_US_TICKER_API_H
-#define MBED_US_TICKER_API_H
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-uint32_t us_ticker_read(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
-/* Title: wait
- * Generic wait functions.
- *
- * These provide simple NOP type wait capabilities.
- *
- * Example:
- * > #include "mbed.h"
- * >
- * > DigitalOut heartbeat(LED1);
- * >
- * > int main() {
- * > while (1) {
- * > heartbeat = 1;
- * > wait(0.5);
- * > heartbeat = 0;
- * > wait(0.5);
- * > }
- * > }
- */
-
-/* mbed Microcontroller Library - wait_api
- * Copyright (c) 2009 ARM Limited. All rights reserved.
- */
-
-#ifndef MBED_WAIT_API_H
-#define MBED_WAIT_API_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Function: wait
- * Waits for a number of seconds, with microsecond resolution (within
- * the accuracy of single precision floating point).
- *
- * Variables:
- * s - number of seconds to wait
- */
-void wait(float s);
-
-/* Function: wait_ms
- * Waits a number of milliseconds.
- *
- * Variables:
- * ms - the whole number of milliseconds to wait
- */
-void wait_ms(int ms);
-
-/* Function: wait_us
- * Waits a number of microseconds.
- *
- * Variables:
- * us - the whole number of microseconds to wait
- */
-void wait_us(int us);
-
-#ifdef TARGET_LPC11U24
-/* Function: sleep
- * Send the microcontroller to sleep
- *
- * The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the
- * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates
- * dynamic power used by the processor, memory systems and buses. The processor, peripheral and
- * memory state are maintained, and the peripherals continue to work and can generate interrupts.
- *
- * The processor can be woken up by any internal peripheral interrupt or external pin interrupt.
- *
- * Note: The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
- * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
- * able to access the LocalFileSystem
- */
-void sleep(void);
-
-/* Function: deepsleep
- * Send the microcontroller to deep sleep
- *
- * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode
- * has the same sleep features as sleep plus it powers down peripherals and clocks. All state
- * is still maintained.
- *
- * The processor can only be woken up by an external interrupt on a pin or a watchdog timer.
- *
- * Note: The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
- * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
- * able to access the LocalFileSystem
- */
-void deepsleep(void);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
-# Copyright 2011 Adam Green (http://mbed.org/users/AdamGreen/)\r
-#\r
-# Licensed under the Apache License, Version 2.0 (the "License");\r
-# you may not use this file except in compliance with the License.\r
-# You may obtain a copy of the License at\r
-#\r
-# http://www.apache.org/licenses/LICENSE-2.0\r
-#\r
-# Unless required by applicable law or agreed to in writing, software\r
-# distributed under the License is distributed on an "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-# See the License for the specific language governing permissions and\r
-# limitations under the License.\r
-#\r
-# Directories to be built\r
-DIRS=samples\r
-\r
-.PHONY: subdirs $(DIRS)\r
-\r
-subdirs:$(DIRS)\r
-\r
-clean: $(DIRS)\r
-\r
-# Recurse into each of the specified directories and perform a make\r
-$(DIRS):\r
- $(MAKE) $(MAKECMDGOALS) -C $@\r
+++ /dev/null
-==Installation
-===GNU Tools for ARM Embedded Processors
-You need to first install the GNU toolchain from [[https://launchpad.net/gcc-arm-embedded|launchpad.net site]]. You should select the version that matches the gcc4mbed project you are trying to use. //NOTE: Using the install scripts in the root of the gcc4mbed project take care of these downloads for you and this is the supported method of acquiring the necessary GCC toolchain.//
-
-
-===Where is GCC4MBED?
-The gcc4mbed code is available on github at [[https://github.com/adamgreen/gcc4mbed]]. You can click the Downloads button (found near the top on the right hand side) on this page to popup a dialog allowing you to download a compressed archive of the gcc4mbed source code to your computer.
-
-Decompress this archive on your computer. For the rest of the steps in this tutorial, we will assume that it was placed in /gcc4mbed on a *nix based system or c:\gcc4mbed on a Windows system.
-
-==Build and deploy
-You are now ready to try building and deploying GCC built mbed samples.
-===Build
-{{{
-*nix:
- cd /gcc4mbed
- make
-Windows:
- cd c:\gcc4mbed
- cs-make
-}}}
-This will have built various programs in the samples directory off of the root of the gcc4mbed project.
-{{{
-./gcc4mbed/samples/Blink/
-./gcc4mbed/samples/CTest/
-./gcc4mbed/samples/FileTest/
-./gcc4mbed/samples/HelloWorld/
-./gcc4mbed/samples/HTTPServer/
-./gcc4mbed/samples/LocalFileSystem/
-./gcc4mbed/samples/StdIO/
-./gcc4mbed/samples/Ticker/
-}}}
-===Deploy
-While we could manually copy the binary up to the mbed device, it would be nice if it could be done for us at the end of the build process. The only issue is that different environments will require different deployment steps. To abstract away this environment dependency, the makefiles use an environment variable called LPC_DEPLOY for specifying how the deployment should take place. The user should set this LPC_DEPLOY environment variable to something appropriate for their environment. On *nix it could be exported from something like the {{{~/.profile}}} shell script and on Windows it could be set in a batch file used for development environment configuration or added to the System Properties.
-
-====LPC_DEPLOY Examples
-The author uses this in the {{{~/.profile}}} script on his Mac where the MBED device mounts as /Volumes/MBED:
-{{{
-export LPC_DEPLOY='cp PROJECT.bin /Volumes/MBED/'
-}}}
-The author uses this in a batch file on his Windows XP machine where the MBED device mounts as the F: drive:
-{{{
-set LPC_DEPLOY=copy PROJECT.bin f:\
-}}}
-The following example might be useful if you were deploying to a LPCXpresso using the lpc21isp tool:
-{{{
-export LPC_DEPLOY='lpc21isp PROJECT.hex /dev/ttyUSB0 115200 14746'
-}}}
-It should be noted that the PROJECT identifier in the above examples has a special meaning. This identifier will be replaced by the makefile to match the name of the program currently being built.
-
-At this point, you want to set the LPC_DEPLOY variable to something appropriate for your environment.
-
-====Deploy HelloWorld
-After all of the that work, wouldn't it be great to see something actually run on the mbed device? Let's start with the HelloWorld sample which is probably the same program you first tried with the cloud compiler.
-{{{
-*nix:
- cd /gcc4mbed/samples/HelloWorld
- make clean all deploy
-Windows:
- cd c:\gcc4mbed\samples\HelloWorld
- cmake clean all deploy
-}}}
-Those build rules (clean all deploy) will force all of the output files to be deleted, then rebuilt from a clean start, and then copied up to your mbed device. Pressing the reset button on the mbed device should result in the blinking LED.
-
-If you just want to deploy a binary that has already been built, you can just run "make deploy"
+++ /dev/null
-==Make Variables\r
-The GCC4MBED project uses various makefile variables to configure and customize the binaries being built. This page describes these make variables.\r
-\r
-===PROJECT\r
-The **PROJECT** variable is used in an application's makefile to indicate the name of the project being built. The output binaries with .elf, .bin, and .hex extensions will be given this as a name. The application's makefile must specify a value for this variable.\r
-\r
-===SRC\r
-The **SRC** variable is used in an application's makefile to specify the root directory of the sources for this project. If not explicitly set by the application's makefile then it defaults to the directory in which the makefile is located. However it can be set to a different directory name if it happens that the project's source code is found in a different directory than the makefile.\r
-\r
-===GCC4MBED_DIR\r
-The **GCC4MBED_DIR** variable is used in an application's makefile to specify the root directory location of the GCC4MBED project. This directory will be the directory which contained the GCC4MBED install scripts such as win_install.cmd, linux_install, and mac_install. The application's makefile must specify a value for this variable.\r
-\r
-===INCDIRS\r
-The **INCDIRS** variable can be used by an application's makefile to prepend a list of directories to the INCLUDE path used by the compiler for finding #included header files. This list should be space separated.\r
-\r
-===LIBS_PREFIX\r
-**LIBS_PREFIX** is an optional variable that an application's makefile can use to specify a list of libraries that should be linked into its final binary **before** it links in the mbed SDK libraries.\r
-\r
-===LIBS_SUFFIX\r
-**LIBS_SUFFIX** is an optional variable that an application's makefile can use to specify a list of libraries that should be linked into its final binary **after** it links in the mbed SDK libraries.\r
-\r
-===GCC4MBED_TYPE\r
-The **GCC4MBED_TYPE** variable is used to specify the type of build to produce. It would typically be set as an environment variable but it can also be set in the application's makefile. The allowed values are:\r
-* **Debug** - Build for debugging. Disables optimizations and links in debug MRI runtime. Best debugging experience.\r
-* **Release** - Build for release with no debug support and optimizations enabled.\r
-* **Checked** - Release build with debug support. Due to optimizations, debug experience won't be as good as Debug but might be needed when bugs don't reproduce in Debug builds.\r
-\\The default value is Release.\r
-\r
-===OPTIMIZATION\r
-**OPTIMIZATION** is an optional variable that an application's makefile can use to override the default optimization level used by the compiler in Release/Checked builds (Debug builds always use an optimization level of 0). It defaults to 2 for Checked/Release builds.\r
-\r
-===MRI Debugging Related Variables\r
-====MRI_BREAK_ON_INIT\r
-The **MRI_BREAK_ON_INIT** variable can be set in an application's makefile to a non-zero value to indicate that the MRI debugger should halt and wait for GDB to attach before executing the global constructors and the main() function. This allows the developer to set breakpoints in areas of interest before the main code starts executing. The default value for this variable is 1 for Checked and Debug builds while it defaults to 0 for Release builds.\r
-\r
-====MRI_SEMIHOST_STDIO\r
-The **MRI_SEMIHOST_STDIO** variable can be set in an application's makefile to a non-zero value to allow the debug monitor to use semi-host calls to redirect stdin/stdout/stderr to GDB's console. It defaults to 1 for Debug/Checked builds and 0 for Release builds.\r
-\r
-====MRI_UART\r
-The **MRI_UART** is an optional variable that can be set in an application's makefile to configure the device's UART being used for communicating between GDB and MRI. You can select any of the 4 available UARTs on the mbed device:\r
-| MRI_UART_MBED_USB | \r
-| MRI_UART_MBED_P9_P10 |\r
-| MRI_UART_MBED_P13_P14 |\r
-| MRI_UART_MBED_P28_P27 |\r
-\r
-It defaults to MRI_UART_MBED_USB if not explicitly set in the application's makefile.\r
-\r
-By default the auto-baud functionality is used to allow the device to automatically detect the baud rate used by GDB when it first connects. However it is possible to configure a fixed baud rate by appending a MRI_UART_BAUD=baudRate specifier to the MRI_UART variable string. An example:\r
-{{{\r
-MRI_UART="MRI_UART_MBED_USB MRI_UART_BAUD=115200"\r
-}}}\r
-\r
-===Example Makefile\r
-{{{\r
-PROJECT=HelloWorld\r
-GCC4MBED_DIR=../..\r
-LIBS_PREFIX=\r
-LIBS_SUFFIX=\r
-\r
-include ../../build/gcc4mbed.mk\r
-}}}\r
+++ /dev/null
-==Overview
-The gcc4mbed project was created to give mbed users the flexibility to develop code even when it isn't convenient to be connected to the Internet. While there have been [[http://mbed.org/cookbook/Using-mbed-with-gcc-and-eclipse|documented steps]] for quite some time on how to use GCC for building CMSIS based programs for the mbed processor, they have sacrificed the convenience of the mbed libraries. The gcc4mbed project gives you the flexibility of offline compilation through **free** GCC based ARM toolchains without sacrificing the convenience of these libraries.
-
-While it can be very liberating to pull the plug from the online cloud compiler and work on your mbed code in offline mode, there are a few things you should consider before making the switch:
-* Code size. The code currently generated by GCC when used with the gcc4mbed project is about two times larger than when compiled with the online compiler. Initially the size delta was closer to 10x so this is an improvement from the beginnings of the gcc4mbed project. That's not to say that someone in the community might not be able to analyze the code differences and make changes to gcc4med to further reduce the code size.
-* Community support. Most of the mbed user base is going to continue using the cloud compiler. If you encounter an issue with your project while using the gcc4mbed offline process, you may find it harder to get help since there will be a smaller pool of people familiar with this environment. However if you like adventure and helping others then taking the plunge means you will be one more person able to help others who go on this adventure with us.
-* Libraries. You will have to do some more leg work yourself to get community created libraries to work. People writing these libraries will be developing and testing them on the cloud compiler. They may use features that are specific to the cloud compiler which lead to build breaks and runtime crashes or hangs when used with GCC.
-* Testing. In general, everything mbed related will have been much more thoroughly tested on the cloud compiler.
-* LPC1768 only. This is the only version of the mbed device that the original participants of the gcc4mbed project had access to and used in their projects.
-
-If you are the adventurous sort and want to try out the offline gcc4mbed project then there are some things you will receive for your enthusiasm:
-* Offline capability. No Internet connection? No problem!
-* Build customization. Want to tweak something in the build such as optimization levels, generation of disassembly, code profiling, etc? The gcc4mbed project gives you access to the makefiles and you are free to play. Maybe you will be the one to figure out how to make gcc4mbed projects run 5x times faster while cutting the size in half.
-* Editor/IDE of your choice. Like to code in Eclipse, vi or emacs? As long as you can build from a makefile then you are good to go with gcc4mbed.
+++ /dev/null
-==Downloading Projects from Cloud
-The original source of these steps for downloading an existing project from the cloud compiler were posted to the mbed forum by Peter Drescher in [[http://mbed.org/forum/mbed/topic/2701/?page=2#comment-14008|this post]].
-
-* Export the code on the cloud compiler and unpack into a new directory in the sample folder.
-* If you use an imported lib, open the .lib file. It will contain a link to get the library code. Download the lib and unpack also.
-* Copy the makefile from the StdIO sample.
-* Change the project name inside the makefile.
-* Start BuildShell.
-* Go inside the project directory.
-* make clean all
\ No newline at end of file
+++ /dev/null
-/* Copyright 2012 Adam Green (http://mbed.org/users/AdamGreen/)\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-*/\r
-/* Blink LED without using the mbed library. */\r
-#include "LPC17xx.h"\r
-\r
-volatile int g_LoopDummy;\r
-\r
-int main() \r
-{\r
- LPC_GPIO1->FIODIR |= 1 << 18; // P1.18 connected to LED1\r
- while(1)\r
- {\r
- int i;\r
- \r
- LPC_GPIO1->FIOPIN ^= 1 << 18; // Toggle P1.18\r
- for (i = 0 ; i < 5000000 && !g_LoopDummy ; i++)\r
- {\r
- }\r
- }\r
- return 0;\r
-}\r
+++ /dev/null
-# Copyright 2011 Adam Green (http://mbed.org/users/AdamGreen/)\r
-#\r
-# Licensed under the Apache License, Version 2.0 (the "License");\r
-# you may not use this file except in compliance with the License.\r
-# You may obtain a copy of the License at\r
-#\r
-# http://www.apache.org/licenses/LICENSE-2.0\r
-#\r
-# Unless required by applicable law or agreed to in writing, software\r
-# distributed under the License is distributed on an "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-# See the License for the specific language governing permissions and\r
-# limitations under the License.\r
-PROJECT=Blink\r
-GCC4MBED_DIR=../..\r
-LIBS_PREFIX=\r
-LIBS_SUFFIX=\r
-\r
-include ../../build/gcc4mbed.mk\r
+++ /dev/null
-/* Copyright 2012 Adam Green (http://mbed.org/users/AdamGreen/)\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-*/\r
-/* Basic unit tests for LocalFileSystem functionality. */\r
-#include <mbed.h>\r
-\r
-LocalFileSystem local("local"); // Create the local filesystem under the name "local"\r
-\r
-int main() \r
-{\r
- static const char Filename[] = "/local/foo.bar";\r
- unsigned char TestBuffer[256];\r
- unsigned char ReadBuffer[256];\r
- size_t i;\r
- \r
- // Fill in test buffer with every byte value possible.\r
- for (i = 0 ; i < sizeof(TestBuffer) ; i++)\r
- {\r
- TestBuffer[i] = i;\r
- }\r
- memset(ReadBuffer, 0, sizeof(ReadBuffer));\r
- \r
- // Create a file in the LocalFileSystem with this data.\r
- FILE* fp = fopen(Filename, "w");\r
- if (!fp)\r
- {\r
- error("Failed to open %s for writing\n", Filename);\r
- }\r
- \r
- int BytesWritten = fwrite(TestBuffer, 1, sizeof(TestBuffer), fp);\r
- if (BytesWritten != sizeof(TestBuffer))\r
- {\r
- error("Failed to write all of the bytes to test file.\n");\r
- }\r
- \r
- fclose(fp);\r
- fp = NULL;\r
- \r
- // Now reopen the file and read in the data and make sure it matches.\r
- fp = fopen(Filename, "r");\r
- if (!fp)\r
- {\r
- error("Failed to open %s for writing\n", Filename);\r
- }\r
- \r
- int BytesRead = fread(ReadBuffer, 1, sizeof(ReadBuffer), fp);\r
- if (BytesRead != sizeof(ReadBuffer))\r
- {\r
- error("Failed to read all of the bytes from test file.\n");\r
- }\r
- if (0 != memcmp(TestBuffer, ReadBuffer, sizeof(TestBuffer)))\r
- {\r
- error("File data did match expected value.\n");\r
- }\r
- \r
- fclose(fp);\r
- fp = NULL;\r
-\r
- // Can delete the file now that we are done with it.\r
- remove(Filename);\r
-\r
- printf("\r\nTest completed\r\n");\r
-}\r
+++ /dev/null
-# Copyright 2012 Adam Green (http://mbed.org/users/AdamGreen/)\r
-#\r
-# Licensed under the Apache License, Version 2.0 (the "License");\r
-# you may not use this file except in compliance with the License.\r
-# You may obtain a copy of the License at\r
-#\r
-# http://www.apache.org/licenses/LICENSE-2.0\r
-#\r
-# Unless required by applicable law or agreed to in writing, software\r
-# distributed under the License is distributed on an "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-# See the License for the specific language governing permissions and\r
-# limitations under the License.\r
-PROJECT=FileTest\r
-GCC4MBED_DIR=../..\r
-LIBS_PREFIX=\r
-LIBS_SUFFIX=\r
-\r
-include ../../build/gcc4mbed.mk\r
+++ /dev/null
-/* Copyright 2011 Adam Green (http://mbed.org/users/AdamGreen/)\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-*/\r
-/* Test which brings default HelloWorld project from mbed online compiler\r
- to be built under GCC.\r
-*/\r
-#include "mbed.h"\r
-\r
-DigitalOut myled(LED1);\r
-\r
-int main() \r
-{\r
- while(1) \r
- {\r
- myled = 1;\r
- wait(0.2);\r
- myled = 0;\r
- wait(0.2);\r
- }\r
-}\r
+++ /dev/null
-# Copyright 2011 Adam Green (http://mbed.org/users/AdamGreen/)\r
-#\r
-# Licensed under the Apache License, Version 2.0 (the "License");\r
-# you may not use this file except in compliance with the License.\r
-# You may obtain a copy of the License at\r
-#\r
-# http://www.apache.org/licenses/LICENSE-2.0\r
-#\r
-# Unless required by applicable law or agreed to in writing, software\r
-# distributed under the License is distributed on an "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-# See the License for the specific language governing permissions and\r
-# limitations under the License.\r
-PROJECT=HelloWorld\r
-GCC4MBED_DIR=../..\r
-LIBS_PREFIX=\r
-LIBS_SUFFIX=\r
-\r
-include ../../build/gcc4mbed.mk\r
+++ /dev/null
-/* Copyright 2012 Adam Green (http://mbed.org/users/AdamGreen/)\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-*/\r
-/* Basic unit tests for LocalFileSystem functionality. */\r
-#include <mbed.h>\r
-\r
-LocalFileSystem local("local"); // Create the local filesystem under the name "local"\r
-\r
-int main() \r
-{\r
- int Result = -1;\r
- long Offset = -1;\r
- char Buffer[32];\r
- \r
- printf("\r\n\r\nGCC4MBED Test Suite\r\n");\r
- printf("LocalFileSystem Unit Tests\r\n");\r
- \r
- printf("Test 1: fopen() for write\r\n");\r
- FILE *fp = fopen("/local/out.txt", "w"); // Open "out.txt" on the local file system for writing\r
- if (NULL == fp)\r
- {\r
- error("%s(%d) fopen() failed\r\n", __FILE__, __LINE__);\r
- }\r
-\r
- printf("Test 2: fprintf()\r\n");\r
- Result = fprintf(fp, "Hello World!");\r
- if (Result < 0)\r
- {\r
- error("%s(%d) fprintf() failed\r\n", __FILE__, __LINE__);\r
- }\r
-\r
- printf("Test 3: fclose() on written file\r\n");\r
- Result = fclose(fp);\r
- if (0 != Result)\r
- {\r
- error("%s(%d) fclose() failed\r\n", __FILE__, __LINE__);\r
- }\r
- \r
-\r
-\r
- printf("Test 4: fopen() for read\r\n");\r
- fp = fopen("/local/out.txt", "r");\r
- if (NULL == fp)\r
- {\r
- error("%s(%d) fopen() failed\r\n", __FILE__, __LINE__);\r
- }\r
-\r
- printf("Test 5: fscanf()\r\n");\r
- Result = fscanf(fp, "%31s", Buffer);\r
- if (EOF == Result)\r
- {\r
- error("%s(%d) fscanf() failed\r\n", __FILE__, __LINE__);\r
- }\r
- printf("Contents of /local/out.txt: %s\r\n", Buffer);\r
- if (0 != strcmp(Buffer, "Hello"))\r
- {\r
- error("%s(%d) fscanf read out wrong string\r\n", __FILE__, __LINE__);\r
- }\r
-\r
- printf("Test 6: Determine size of file through fseek and ftell calls\r\n");\r
- Result = fseek(fp, 0, SEEK_END);\r
- if (0 != Result)\r
- {\r
- error("%s(%d) fseek(..,0, SEEK_END) failed\r\n", __FILE__, __LINE__);\r
- }\r
- Offset = ftell(fp);\r
- if (12 != Offset)\r
- {\r
- error("%s(%d) ftell didn't return the expected value of 12\r\n", __FILE__, __LINE__);\r
- }\r
- \r
- printf("Test 7: fclose() on read file\r\n");\r
- Result = fclose(fp);\r
- if (0 != Result)\r
- {\r
- error("%s(%d) fclose() failed\r\n", __FILE__, __LINE__);\r
- }\r
- \r
-\r
-\r
- printf("Test 8: remove()\r\n");\r
- Result = remove("/local/out.txt"); // Removes the file "out.txt" from the local file system\r
- if (0 != Result)\r
- {\r
- error("%s(%d) remove() failed\r\n", __FILE__, __LINE__);\r
- }\r
- \r
-\r
-\r
- if (MRI_ENABLE)\r
- {\r
- printf("Skipping dir tests when MRI is enabled as it doesn't support directory tests.\n");\r
- }\r
- else\r
- {\r
- printf("Test 9: opendir()\r\n");\r
- DIR *d = opendir("/local"); // Opens the root directory of the local file system\r
- if (NULL == d)\r
- {\r
- error("%s(%d) opendir() failed\r\n", __FILE__, __LINE__);\r
- }\r
- struct dirent *p;\r
-\r
- printf("Test 10: readir() for all entries\r\n");\r
- while((p = readdir(d)) != NULL) \r
- { // Print the names of the files in the local file system\r
- printf("%s\r\n", p->d_name); // to stdout.\r
- }\r
-\r
- printf("Test 11: closedir\r\n");\r
- closedir(d);\r
- }\r
- \r
- printf("\r\nTest completed\r\n");\r
-}\r
+++ /dev/null
-# Copyright 2011 Adam Green (http://mbed.org/users/AdamGreen/)\r
-#\r
-# Licensed under the Apache License, Version 2.0 (the "License");\r
-# you may not use this file except in compliance with the License.\r
-# You may obtain a copy of the License at\r
-#\r
-# http://www.apache.org/licenses/LICENSE-2.0\r
-#\r
-# Unless required by applicable law or agreed to in writing, software\r
-# distributed under the License is distributed on an "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-# See the License for the specific language governing permissions and\r
-# limitations under the License.\r
-PROJECT=LocalFileSystem\r
-GCC4MBED_DIR=../..\r
-LIBS_PREFIX=\r
-LIBS_SUFFIX=\r
-\r
-include ../../build/gcc4mbed.mk\r
+++ /dev/null
-/* Copyright 2011 Adam Green (http://mbed.org/users/AdamGreen/)\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-*/\r
-/* Basic unit test for C Standard I/O routines. */\r
-#include "mbed.h"\r
-\r
-\r
-int main() \r
-{\r
- int Value = -1;\r
-\r
- printf("\r\n\r\nGCC4MBED Test Suite\r\n");\r
- printf("Standard I/O Unit Tests\r\n");\r
- \r
- printf("Test 1: printf() test\r\n");\r
- \r
- printf("Test 2: scanf() test\r\n");\r
- printf(" Type number and press Enter: ");\r
- scanf("%d", &Value);\r
- printf("\n Your value was: %d\r\n", Value);\r
- \r
- fprintf(stdout, "Test 3: fprintf(stdout, ...) test\r\n");\r
- \r
- fprintf(stderr, "Test 4: fprintf(stderr, ...) test\r\n");\r
-\r
- printf("Test 5: fscanf(stdin, ...) test\r\n");\r
- printf(" Type number and press Enter: ");\r
- fscanf(stdin, "%d", &Value);\r
- printf("\n Your value was: %d\r\n", Value);\r
- \r
- printf("Test complete\r\n");\r
- \r
- for(;;)\r
- {\r
- }\r
-}\r
+++ /dev/null
-# Copyright 2011 Adam Green (http://mbed.org/users/AdamGreen/)\r
-#\r
-# Licensed under the Apache License, Version 2.0 (the "License");\r
-# you may not use this file except in compliance with the License.\r
-# You may obtain a copy of the License at\r
-#\r
-# http://www.apache.org/licenses/LICENSE-2.0\r
-#\r
-# Unless required by applicable law or agreed to in writing, software\r
-# distributed under the License is distributed on an "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-# See the License for the specific language governing permissions and\r
-# limitations under the License.\r
-PROJECT=StdIO\r
-GCC4MBED_DIR=../..\r
-INCDIRS=\r
-LIBS_PREFIX=\r
-LIBS_SUFFIX=\r
-\r
-include ../../build/gcc4mbed.mk\r
+++ /dev/null
-/* Copyright 2011 Arthur Wolf\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-*/\r
-#include <mbed.h>\r
-\r
-\r
-Ticker flipper;\r
-DigitalOut led1(LED1);\r
-DigitalOut led2(LED2);\r
-\r
-\r
-void flip() {\r
- led2 = !led2;\r
-}\r
-\r
-int main() \r
-{\r
- led2 = 1;\r
- flipper.attach(&flip, 5.0); // the address of the function to be attached (flip) and the interval (2 seconds)\r
-\r
- // spin in a main loop. flipper will interrupt it to call flip\r
- while(1) {\r
- led1 = !led1;\r
- wait(0.1);\r
- }\r
-}\r
-\r
+++ /dev/null
-# Copyright 2011 Adam Green (http://mbed.org/users/AdamGreen/)\r
-#\r
-# Licensed under the Apache License, Version 2.0 (the "License");\r
-# you may not use this file except in compliance with the License.\r
-# You may obtain a copy of the License at\r
-#\r
-# http://www.apache.org/licenses/LICENSE-2.0\r
-#\r
-# Unless required by applicable law or agreed to in writing, software\r
-# distributed under the License is distributed on an "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-# See the License for the specific language governing permissions and\r
-# limitations under the License.\r
-PROJECT=Ticker\r
-GCC4MBED_DIR=../..\r
-INCDIRS=\r
-LIBS_PREFIX=\r
-LIBS_SUFFIX=\r
-\r
-include ../../build/gcc4mbed.mk\r
+++ /dev/null
-# Copyright 2011 Adam Green (http://mbed.org/users/AdamGreen/)\r
-#\r
-# Licensed under the Apache License, Version 2.0 (the "License");\r
-# you may not use this file except in compliance with the License.\r
-# You may obtain a copy of the License at\r
-#\r
-# http://www.apache.org/licenses/LICENSE-2.0\r
-#\r
-# Unless required by applicable law or agreed to in writing, software\r
-# distributed under the License is distributed on an "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-# See the License for the specific language governing permissions and\r
-# limitations under the License.\r
-#\r
-# Directories to be built\r
-DIRS=HelloWorld Blink Ticker StdIO LocalFileSystem FileTest\r
-\r
-.PHONY: subdirs $(DIRS)\r
-\r
-subdirs: $(DIRS)\r
-\r
-clean: $(DIRS)\r
-\r
-# Recurse into each of the specified directories and perform a make\r
-$(DIRS):\r
- $(MAKE) $(MAKECMDGOALS) -C $@\r
-\r